import { n as n2 } from "./chunk-DT6EAZQ5.js"; import { e as e3 } from "./chunk-HNOZUNJ4.js"; import { d, e, l, n2 as n, v2 as v } from "./chunk-Y3WMVFTW.js"; import { e as e2, t } from "./chunk-WSRBH7BF.js"; import { N, b } from "./chunk-IHXECKQQ.js"; import { m } from "./chunk-IKP3YN53.js"; import { q } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/core/ObservableChangesType.js var E; !function(E3) { E3[E3.ADD = 1] = "ADD", E3[E3.REMOVE = 2] = "REMOVE", E3[E3.MOVE = 4] = "MOVE"; }(E || (E = {})); // node_modules/@arcgis/core/core/accessorSupport/decorators/shared.js function n3(n4) { return (r, t2) => { r[t2] = n4; }; } // node_modules/@arcgis/core/core/Collection.js var g; var p = class { constructor() { this.target = null, this.cancellable = false, this.defaultPrevented = false, this.item = void 0, this.type = void 0; } preventDefault() { this.cancellable && (this.defaultPrevented = true); } reset(e4) { this.defaultPrevented = false, this.item = e4; } }; var b2 = new e2(p, void 0, (e4) => { e4.item = null, e4.target = null, e4.defaultPrevented = false, e4.cancellable = false; }); var d2 = () => { }; function v2(e4) { return e4 ? e4 instanceof V ? e4.toArray() : e4.length ? Array.prototype.slice.apply(e4) : [] : []; } function E2(e4) { if (e4 && e4.length) return e4[0]; } function y(e4, t2, s, i) { const r = Math.min(e4.length - s, t2.length - i); let n4 = 0; for (; n4 < r && e4[s + n4] === t2[i + n4]; ) n4++; return n4; } function C(e4, t2, s, i) { t2 && t2.forEach((t3, r, n4) => { e4.push(t3), C(e4, s.call(i, t3, r, n4), s, i); }); } var A = new Set(); var O = new Set(); var M = new Set(); var D = new Map(); var x = 0; var V = g = class extends n2.EventedAccessor { constructor(e4) { super(e4), this._chgListeners = [], this._notifications = null, this._timer = null, this._observable = new e3(), this.length = 0, this._items = [], Object.defineProperty(this, "uid", { value: x++ }); } static isCollection(e4) { return e4 != null && e4 instanceof g; } normalizeCtorArgs(e4) { return e4 ? Array.isArray(e4) || e4 instanceof g ? { items: e4 } : e4 : {}; } destroy() { this.removeAll(); } *[Symbol.iterator]() { yield* this.items; } get items() { return l(this._observable), this._items; } set items(e4) { this._emitBeforeChanges(E.ADD) || (this._splice(0, this.length, v2(e4)), this._emitAfterChanges(E.ADD)); } hasEventListener(e4) { return e4 === "change" ? this._chgListeners.length > 0 : this._emitter.hasEventListener(e4); } on(e4, t2) { if (e4 === "change") { const e5 = this._chgListeners, s = { removed: false, callback: t2 }; return e5.push(s), this._notifications && this._notifications.push({ listeners: e5.slice(), items: this._items.slice(), changes: [] }), { remove() { this.remove = d2, s.removed = true, e5.splice(e5.indexOf(s), 1); } }; } return this._emitter.on(e4, t2); } once(e4, t2) { const s = this.on(e4, t2); return { remove() { s.remove(); } }; } add(e4, t2) { if (l(this._observable), this._emitBeforeChanges(E.ADD)) return this; const s = this.getNextIndex(t2 ?? null); return this._splice(s, 0, [e4]), this._emitAfterChanges(E.ADD), this; } addMany(e4, t2 = this._items.length) { if (l(this._observable), !e4 || !e4.length) return this; if (this._emitBeforeChanges(E.ADD)) return this; const s = this.getNextIndex(t2); return this._splice(s, 0, v2(e4)), this._emitAfterChanges(E.ADD), this; } at(e4) { if (l(this._observable), (e4 = Math.trunc(e4) || 0) < 0 && (e4 += this.length), !(e4 < 0 || e4 >= this.length)) return this._items[e4]; } removeAll() { if (l(this._observable), !this.length || this._emitBeforeChanges(E.REMOVE)) return []; const e4 = this._splice(0, this.length) || []; return this._emitAfterChanges(E.REMOVE), e4; } clone() { return l(this._observable), this._createNewInstance({ items: this._items.map(m) }); } concat(...e4) { l(this._observable); const t2 = e4.map(v2); return this._createNewInstance({ items: this._items.concat(...t2) }); } drain(e4, t2) { if (l(this._observable), !this.length || this._emitBeforeChanges(E.REMOVE)) return; const s = q(this._splice(0, this.length)), i = s.length; for (let r = 0; r < i; r++) e4.call(t2, s[r], r, s); this._emitAfterChanges(E.REMOVE); } every(e4, t2) { return l(this._observable), this._items.every(e4, t2); } filter(e4, t2) { let s; return l(this._observable), s = arguments.length === 2 ? this._items.filter(e4, t2) : this._items.filter(e4), this._createNewInstance({ items: s }); } find(e4, t2) { return l(this._observable), this._items.find(e4, t2); } findIndex(e4, t2) { return l(this._observable), this._items.findIndex(e4, t2); } flatten(e4, t2) { l(this._observable); const s = []; return C(s, this, e4, t2), new g(s); } forEach(e4, t2) { return l(this._observable), this._items.forEach(e4, t2); } getItemAt(e4) { return l(this._observable), this._items[e4]; } getNextIndex(e4) { l(this._observable); const t2 = this.length; return (e4 = e4 == null ? t2 : e4) < 0 ? e4 = 0 : e4 > t2 && (e4 = t2), e4; } includes(e4, t2 = 0) { return l(this._observable), this._items.includes(e4, t2); } indexOf(e4, t2 = 0) { return l(this._observable), this._items.indexOf(e4, t2); } join(e4 = ",") { return l(this._observable), this._items.join(e4); } lastIndexOf(e4, t2 = this.length - 1) { return l(this._observable), this._items.lastIndexOf(e4, t2); } map(e4, t2) { l(this._observable); const s = this._items.map(e4, t2); return new g({ items: s }); } reorder(e4, t2 = this.length - 1) { l(this._observable); const s = this.indexOf(e4); if (s !== -1) { if (t2 < 0 ? t2 = 0 : t2 >= this.length && (t2 = this.length - 1), s !== t2) { if (this._emitBeforeChanges(E.MOVE)) return e4; this._splice(s, 1), this._splice(t2, 0, [e4]), this._emitAfterChanges(E.MOVE); } return e4; } } pop() { if (l(this._observable), !this.length || this._emitBeforeChanges(E.REMOVE)) return; const e4 = E2(this._splice(this.length - 1, 1)); return this._emitAfterChanges(E.REMOVE), e4; } push(...e4) { return l(this._observable), this._emitBeforeChanges(E.ADD) || (this._splice(this.length, 0, e4), this._emitAfterChanges(E.ADD)), this.length; } reduce(e4, t2) { l(this._observable); const s = this._items; return arguments.length === 2 ? s.reduce(e4, t2) : s.reduce(e4); } reduceRight(e4, t2) { l(this._observable); const s = this._items; return arguments.length === 2 ? s.reduceRight(e4, t2) : s.reduceRight(e4); } remove(e4) { return l(this._observable), this.removeAt(this.indexOf(e4)); } removeAt(e4) { if (l(this._observable), e4 < 0 || e4 >= this.length || this._emitBeforeChanges(E.REMOVE)) return; const t2 = E2(this._splice(e4, 1)); return this._emitAfterChanges(E.REMOVE), t2; } removeMany(e4) { if (l(this._observable), !e4 || !e4.length || this._emitBeforeChanges(E.REMOVE)) return []; const t2 = e4 instanceof g ? e4.toArray() : e4, s = this._items, i = [], r = t2.length; for (let n4 = 0; n4 < r; n4++) { const e5 = t2[n4], r2 = s.indexOf(e5); if (r2 > -1) { const e6 = 1 + y(t2, s, n4 + 1, r2 + 1), h = this._splice(r2, e6); h && h.length > 0 && i.push.apply(i, h), n4 += e6 - 1; } } return this._emitAfterChanges(E.REMOVE), i; } reverse() { if (l(this._observable), this._emitBeforeChanges(E.MOVE)) return this; const e4 = this._splice(0, this.length); return e4 && (e4.reverse(), this._splice(0, 0, e4)), this._emitAfterChanges(E.MOVE), this; } shift() { if (l(this._observable), !this.length || this._emitBeforeChanges(E.REMOVE)) return; const e4 = E2(this._splice(0, 1)); return this._emitAfterChanges(E.REMOVE), e4; } slice(e4 = 0, t2 = this.length) { return l(this._observable), this._createNewInstance({ items: this._items.slice(e4, t2) }); } some(e4, t2) { return l(this._observable), this._items.some(e4, t2); } sort(e4) { if (l(this._observable), !this.length || this._emitBeforeChanges(E.MOVE)) return this; const t2 = q(this._splice(0, this.length)); return arguments.length ? t2.sort(e4) : t2.sort(), this._splice(0, 0, t2), this._emitAfterChanges(E.MOVE), this; } splice(e4, t2, ...s) { l(this._observable); const i = (t2 ? E.REMOVE : 0) | (s.length ? E.ADD : 0); if (this._emitBeforeChanges(i)) return []; const r = this._splice(e4, t2, s) || []; return this._emitAfterChanges(i), r; } toArray() { return l(this._observable), this._items.slice(); } toJSON() { return l(this._observable), this.toArray(); } toLocaleString() { return l(this._observable), this._items.toLocaleString(); } toString() { return l(this._observable), this._items.toString(); } unshift(...e4) { return l(this._observable), !e4.length || this._emitBeforeChanges(E.ADD) || (this._splice(0, 0, e4), this._emitAfterChanges(E.ADD)), this.length; } _createNewInstance(e4) { return new this.constructor(e4); } _splice(e4, t2, s) { const i = this._items, r = this.itemType; let n4, h; if (!this._notifications && this.hasEventListener("change") && (this._notifications = [{ listeners: this._chgListeners.slice(), items: this._items.slice(), changes: [] }], this._timer && this._timer.remove(), this._timer = v(() => this._dispatchChange())), t2) { if (h = i.splice(e4, t2), this.hasEventListener("before-remove")) { const t3 = b2.acquire(); t3.target = this, t3.cancellable = true; for (let s2 = 0, r2 = h.length; s2 < r2; s2++) n4 = h[s2], t3.reset(n4), this.emit("before-remove", t3), t3.defaultPrevented && (h.splice(s2, 1), i.splice(e4, 0, n4), e4 += 1, s2 -= 1, r2 -= 1); b2.release(t3); } if (this.length = this._items.length, this.hasEventListener("after-remove")) { const e5 = b2.acquire(); e5.target = this, e5.cancellable = false; const t3 = h.length; for (let s2 = 0; s2 < t3; s2++) e5.reset(h[s2]), this.emit("after-remove", e5); b2.release(e5); } } if (s && s.length) { if (r) { const e5 = []; for (const t4 of s) { const s2 = r.ensureType(t4); s2 == null && t4 != null || e5.push(s2); } s = e5; } const t3 = this.hasEventListener("before-add"), n5 = this.hasEventListener("after-add"), h2 = e4 === this.length; if (t3 || n5) { const r2 = b2.acquire(); r2.target = this, r2.cancellable = true; const o = b2.acquire(); o.target = this, o.cancellable = false; for (const l2 of s) t3 ? (r2.reset(l2), this.emit("before-add", r2), r2.defaultPrevented || (h2 ? i.push(l2) : i.splice(e4++, 0, l2), this._set("length", i.length), n5 && (o.reset(l2), this.emit("after-add", o)))) : (h2 ? i.push(l2) : i.splice(e4++, 0, l2), this._set("length", i.length), o.reset(l2), this.emit("after-add", o)); b2.release(o), b2.release(r2); } else { if (h2) for (const e5 of s) i.push(e5); else i.splice(e4, 0, ...s); this._set("length", i.length); } } return (s && s.length || h && h.length) && this._notifyChangeEvent(s, h), h; } _emitBeforeChanges(e4) { let t2 = false; if (this.hasEventListener("before-changes")) { const s = b2.acquire(); s.target = this, s.cancellable = true, s.type = e4, this.emit("before-changes", s), t2 = s.defaultPrevented, b2.release(s); } return t2; } _emitAfterChanges(e4) { if (this.hasEventListener("after-changes")) { const t2 = b2.acquire(); t2.target = this, t2.cancellable = false, t2.type = e4, this.emit("after-changes", t2), b2.release(t2); } this._observable.notify(); } _notifyChangeEvent(e4, t2) { this.hasEventListener("change") && this._notifications && this._notifications[this._notifications.length - 1].changes.push({ added: e4, removed: t2 }); } _dispatchChange() { if (this._timer && (this._timer.remove(), this._timer = null), !this._notifications) return; const e4 = this._notifications; this._notifications = null; for (const s of e4) { const e5 = s.changes; A.clear(), O.clear(), M.clear(); for (const { added: t2, removed: s2 } of e5) { if (t2) if (M.size === 0 && O.size === 0) for (const e6 of t2) A.add(e6); else for (const e6 of t2) O.has(e6) ? (M.add(e6), O.delete(e6)) : M.has(e6) || A.add(e6); if (s2) if (M.size === 0 && A.size === 0) for (const e6 of s2) O.add(e6); else for (const e6 of s2) A.has(e6) ? A.delete(e6) : (M.delete(e6), O.add(e6)); } const i = t.acquire(); A.forEach((e6) => { i.push(e6); }); const r = t.acquire(); O.forEach((e6) => { r.push(e6); }); const n4 = this._items, h = s.items, o = t.acquire(); if (M.forEach((e6) => { h.indexOf(e6) !== n4.indexOf(e6) && o.push(e6); }), s.listeners && (i.length || r.length || o.length)) { const e6 = { target: this, added: i, removed: r, moved: o }, t2 = s.listeners.length; for (let i2 = 0; i2 < t2; i2++) { const t3 = s.listeners[i2]; t3.removed || t3.callback.call(this, e6); } } t.release(i), t.release(r), t.release(o); } A.clear(), O.clear(), M.clear(); } }; V.ofType = (t2) => { if (!t2) return g; if (D.has(t2)) return D.get(t2); let s = null; if (typeof t2 == "function") s = t2.prototype.declaredClass; else if (t2.base) s = t2.base.prototype.declaredClass; else for (const e4 in t2.typeMap) { const i2 = t2.typeMap[e4].prototype.declaredClass; s ? s += ` | ${i2}` : s = i2; } let i = class extends g { }; return e([n3({ Type: t2, ensureType: typeof t2 == "function" ? b(t2) : N(t2) })], i.prototype, "itemType", void 0), i = e([n(`esri.core.Collection<${s}>`)], i), D.set(t2, i), i; }, e([d()], V.prototype, "length", void 0), e([d()], V.prototype, "items", null), V = g = e([n("esri.core.Collection")], V); var j = V; export { n3 as n, j }; //# sourceMappingURL=chunk-ALDCDSPV.js.map