chunk-YZVAB3DF.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import {
  2. U,
  3. a,
  4. f,
  5. l
  6. } from "./chunk-TJV6ODRM.js";
  7. import {
  8. e,
  9. m,
  10. n5 as n,
  11. t2,
  12. v,
  13. y3 as y
  14. } from "./chunk-2Z2TG5CU.js";
  15. import {
  16. t
  17. } from "./chunk-YXWMMD76.js";
  18. // node_modules/@arcgis/core/core/support/WatchUpdatingTracking.js
  19. var c = class extends m {
  20. constructor() {
  21. super(...arguments), this.updating = false, this._handleId = 0, this._handles = new t2(), this._scheduleHandleId = 0, this._pendingPromises = /* @__PURE__ */ new Set();
  22. }
  23. destroy() {
  24. this.removeAll(), this._handles.destroy();
  25. }
  26. add(e2, s, t3 = {}) {
  27. return this._installWatch(e2, s, t3, l);
  28. }
  29. addWhen(e2, s, t3 = {}) {
  30. return this._installWatch(e2, s, t3, f);
  31. }
  32. addOnCollectionChange(e2, s, { initial: t3 = false, final: i = false } = {}) {
  33. const n2 = ++this._handleId;
  34. return this._handles.add([a(e2, "after-changes", this._createSyncUpdatingCallback(), U), a(e2, "change", s, { onListenerAdd: t3 ? (e3) => s({ added: e3.toArray(), removed: [] }) : void 0, onListenerRemove: i ? (e3) => s({ added: [], removed: e3.toArray() }) : void 0 })], n2), { remove: () => this._handles.remove(n2) };
  35. }
  36. addPromise(e2) {
  37. if (t(e2))
  38. return e2;
  39. const s = ++this._handleId;
  40. this._handles.add({ remove: () => {
  41. this._pendingPromises.delete(e2) && (0 !== this._pendingPromises.size || this._handles.has(_) || this._set("updating", false));
  42. } }, s), this._pendingPromises.add(e2), this._set("updating", true);
  43. const t3 = () => this._handles.remove(s);
  44. return e2.then(t3, t3), e2;
  45. }
  46. removeAll() {
  47. this._pendingPromises.clear(), this._handles.removeAll(), this._set("updating", false);
  48. }
  49. _installWatch(e2, s, t3 = {}, i) {
  50. const n2 = ++this._handleId;
  51. t3.sync || this._installSyncUpdatingWatch(e2, n2);
  52. const d2 = i(e2, s, t3);
  53. return this._handles.add(d2, n2), { remove: () => this._handles.remove(n2) };
  54. }
  55. _installSyncUpdatingWatch(e2, s) {
  56. const t3 = this._createSyncUpdatingCallback(), i = l(e2, t3, { sync: true, equals: () => false });
  57. return this._handles.add(i, s), i;
  58. }
  59. _createSyncUpdatingCallback() {
  60. return () => {
  61. this._handles.remove(_), ++this._scheduleHandleId;
  62. const e2 = this._scheduleHandleId;
  63. this._get("updating") || this._set("updating", true), this._handles.add(v(() => {
  64. e2 === this._scheduleHandleId && (this._set("updating", this._pendingPromises.size > 0), this._handles.remove(_));
  65. }), _);
  66. };
  67. }
  68. };
  69. e([y({ readOnly: true })], c.prototype, "updating", void 0), c = e([n("esri.core.support.WatchUpdatingTracking")], c);
  70. var _ = -42;
  71. // node_modules/@arcgis/core/core/HandleOwner.js
  72. var a2 = (s) => {
  73. let a3 = class extends s {
  74. destroy() {
  75. var _a, _b;
  76. this.destroyed || ((_a = this._get("handles")) == null ? void 0 : _a.destroy(), (_b = this._get("updatingHandles")) == null ? void 0 : _b.destroy());
  77. }
  78. get handles() {
  79. return this._get("handles") || new t2();
  80. }
  81. get updatingHandles() {
  82. return this._get("updatingHandles") || new c();
  83. }
  84. };
  85. return e([y({ readOnly: true })], a3.prototype, "handles", null), e([y({ readOnly: true })], a3.prototype, "updatingHandles", null), a3 = e([n("esri.core.HandleOwner")], a3), a3;
  86. };
  87. var d = class extends a2(m) {
  88. };
  89. d = e([n("esri.core.HandleOwner")], d);
  90. export {
  91. c,
  92. a2 as a,
  93. d
  94. };
  95. //# sourceMappingURL=chunk-YZVAB3DF.js.map