chunk-RMX2AZ4P.js 3.4 KB

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