{"version":3,"sources":["node_modules/@arcgis/core/core/reactiveUtils.js"],"sourcesContent":["/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport { createTask as n } from \"./asyncUtils.js\";\nimport e from \"./Collection.js\";\nimport { isEventedOrEventTarget as t, on as o } from \"./events.js\";\nimport { handlesGroup as r, destroyHandle as s, makeHandle as i } from \"./handleUtils.js\";\nimport { removeMaybe as c } from \"./maybe.js\";\nimport { isAborted as u, createAbortError as l, onAbort as a, ignoreAbortErrors as f } from \"./promiseUtils.js\";\nimport { watchTracked as m } from \"./accessorSupport/watch.js\";\nexport { autorun } from \"./accessorSupport/trackingUtils.js\";\nfunction d(n, e, t = {}) {\n return y(n, e, t, L);\n}\nfunction p(n, e, t = {}) {\n return y(n, e, t, M);\n}\nfunction y(n, e, t = {}, o) {\n let r = null;\n const s = t.once ? (n, t) => {\n o(n) && (c(r), e(n, t));\n } : (n, t) => {\n o(n) && e(n, t);\n };\n if (r = m(n, s, t.sync, t.equals), t.initial) {\n const e = n();\n s(e, e);\n }\n return r;\n}\nfunction v(n, e, r, s = {}) {\n let u = null,\n l = null,\n a = null;\n function f() {\n u && l && (l.remove(), s.onListenerRemove?.(u), u = null, l = null);\n }\n function m(n) {\n s.once && s.once && c(a), r(n);\n }\n const p = d(n, (n, r) => {\n f(), t(n) && (u = n, l = o(n, e, m), s.onListenerAdd?.(n));\n }, {\n sync: s.sync,\n initial: !0\n });\n return a = i(() => {\n p.remove(), f();\n }), a;\n}\nfunction j(n, e) {\n return h(n, null, e);\n}\nfunction w(n, e) {\n return h(n, M, e);\n}\nfunction h(n, e, t) {\n if (u(t)) return Promise.reject(l());\n const o = n();\n if (e?.(o)) return Promise.resolve(o);\n let s = null;\n function i() {\n s = c(s);\n }\n return new Promise((o, c) => {\n s = r([a(t, () => {\n i(), c(l());\n }), y(n, n => {\n i(), o(n);\n }, {\n sync: !1,\n once: !0\n }, e ?? L)]);\n });\n}\nfunction L(n) {\n return !0;\n}\nfunction M(n) {\n return !!n;\n}\nfunction U(n, e, t = {}) {\n let o = !1;\n const r = d(n, (n, t) => {\n o || e(n, t);\n }, t);\n return {\n remove() {\n r.remove();\n },\n pause() {\n o = !0;\n },\n resume() {\n o = !1;\n }\n };\n}\nfunction g(n, t) {\n const o = new e(),\n r = v(n, \"after-splice\", ({\n added: n,\n start: e,\n deleteCount: r\n }) => {\n const s = o.splice(e, r);\n for (const t of s) t.remove();\n if (n?.length) {\n const r = n.map(t);\n o.addMany(r, e);\n }\n }, {\n sync: !0,\n onListenerRemove: () => o.drain(n => n.remove()),\n onListenerAdd: n => o.addMany(n.items.map(t))\n });\n return o.addHandles(r), o;\n}\nfunction x(t, o) {\n const r = new e(),\n i = g(t, e => n(async n => {\n const t = await o(e, n);\n if (u(n)) throw t.remove(), l();\n return t;\n })),\n c = () => null,\n a = async n => {\n const e = await n.promise,\n t = i.indexOf(n);\n t < 0 || r.splice(t, 1, e);\n };\n r.addMany(i.items.map(c));\n for (const n of i) f(a(n));\n const m = i.on(\"after-splice\", ({\n added: n,\n start: e,\n deleteCount: t\n }) => {\n const o = r.splice(e, t);\n for (const r of o) r?.remove();\n if (n?.length) {\n r.addMany(n.map(c), e);\n for (const e of n) f(a(e));\n }\n });\n return r.addHandles([s(i), m]), r;\n}\nconst C = {\n sync: !0\n },\n P = {\n initial: !0\n },\n A = {\n sync: !0,\n initial: !0\n };\nexport { P as initial, g as mapCollection, x as mapCollectionAsync, v as on, j as once, U as pausable, C as sync, A as syncAndInitial, d as watch, p as when, w as whenOnce };"],"mappings":"kKAYA,SAASA,EAAE,EAAGC,EAAGC,EAAI,CAAC,EAAG,CACvB,OAAOC,EAAE,EAAGF,EAAGC,EAAGE,CAAC,CACrB,CACA,SAASC,EAAE,EAAGJ,EAAGC,EAAI,CAAC,EAAG,CACvB,OAAOC,EAAE,EAAGF,EAAGC,EAAGI,CAAC,CACrB,CACA,SAASH,EAAE,EAAGF,EAAG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,IAAIM,CAAC,EAAG,OAAO,QAAQ,QAAQA,CAAC,EACpC,IAAI,EAAI,KACR,SAASC,GAAI,CACX,EAAI,EAAE,CAAC,CACT,CACA,OAAO,IAAI,QAAQ,CAACD,EAAGF,IAAM,CAC3B,EAAID,EAAE,CAACK,EAAEL,EAAG,IAAM,CAChBI,EAAE,EAAGH,EAAEC,EAAE,CAAC,CACZ,CAAC,EAAGI,EAAE,EAAGC,GAAK,CACZH,EAAE,EAAGD,EAAEI,CAAC,CACV,EAAG,CACD,KAAM,GACN,KAAM,EACR,EAAGV,GAAKW,CAAC,CAAC,CAAC,CACb,CAAC,CACH,CACA,SAASA,EAAE,EAAG,CACZ,MAAO,EACT,CACA,SAAST,EAAE,EAAG,CACZ,MAAO,CAAC,CAAC,CACX,CACA,SAASU,EAAE,EAAGZ,EAAGG,EAAI,CAAC,EAAG,CACvB,IAAIG,EAAI,GACFO,EAAIC,EAAE,EAAG,CAACJ,EAAGP,IAAM,CACvBG,GAAKN,EAAEU,EAAGP,CAAC,CACb,EAAGA,CAAC,EACJ,MAAO,CACL,QAAS,CACPU,EAAE,OAAO,CACX,EACA,OAAQ,CACNP,EAAI,EACN,EACA,QAAS,CACPA,EAAI,EACN,CACF,CACF,CAkDA,IAAMS,EAAI,CACN,KAAM,EACR,EACAC,EAAI,CACF,QAAS,EACX,EACAC,EAAI,CACF,KAAM,GACN,QAAS,EACX","names":["d","e","t","y","L","p","M","o","r","s","n","w","v","u","l","a","f","m","w","e","h","M","t","c","u","o","i","m","y","n","L","U","r","d","C","P","A"],"x_google_ignoreList":[0]}