chunk-NE3ESGA6.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {
  2. j
  3. } from "./chunk-ALDCDSPV.js";
  4. import {
  5. d,
  6. e,
  7. n2 as n,
  8. y3 as y
  9. } from "./chunk-Y3WMVFTW.js";
  10. import {
  11. q
  12. } from "./chunk-GZT4BVFP.js";
  13. // node_modules/@arcgis/core/core/Handles.js
  14. var h = class extends y {
  15. constructor(r) {
  16. super(r), this._groups = new Map();
  17. }
  18. destroy() {
  19. this.removeAll();
  20. }
  21. get size() {
  22. let r = 0;
  23. return this._groups.forEach((e2) => {
  24. r += e2.length;
  25. }), r;
  26. }
  27. add(r, e2) {
  28. if (!this._isHandle(r) && !Array.isArray(r) && !j.isCollection(r))
  29. return this;
  30. const t = this._getOrCreateGroup(e2);
  31. return Array.isArray(r) || j.isCollection(r) ? r.forEach((r2) => this._isHandle(r2) && t.push(r2)) : t.push(r), this.notifyChange("size"), this;
  32. }
  33. forEach(r, e2) {
  34. if (typeof r == "function")
  35. this._groups.forEach((e3) => e3.forEach(r));
  36. else {
  37. const s = this._getGroup(r);
  38. s && e2 && s.forEach(e2);
  39. }
  40. }
  41. has(r) {
  42. return this._groups.has(this._ensureGroupKey(r));
  43. }
  44. remove(r) {
  45. if (Array.isArray(r) || j.isCollection(r))
  46. return r.forEach(this.remove, this), this;
  47. if (!this.has(r))
  48. return this;
  49. const e2 = this._getGroup(r);
  50. for (let s = 0; s < e2.length; s++)
  51. e2[s].remove();
  52. return this._deleteGroup(r), this.notifyChange("size"), this;
  53. }
  54. removeAll() {
  55. return this._groups.forEach((r) => {
  56. for (let e2 = 0; e2 < r.length; e2++)
  57. r[e2].remove();
  58. }), this._groups.clear(), this.notifyChange("size"), this;
  59. }
  60. _isHandle(r) {
  61. return r && !!r.remove;
  62. }
  63. _getOrCreateGroup(r) {
  64. if (this.has(r))
  65. return this._getGroup(r);
  66. const e2 = [];
  67. return this._groups.set(this._ensureGroupKey(r), e2), e2;
  68. }
  69. _getGroup(r) {
  70. return q(this._groups.get(this._ensureGroupKey(r)));
  71. }
  72. _deleteGroup(r) {
  73. return this._groups.delete(this._ensureGroupKey(r));
  74. }
  75. _ensureGroupKey(r) {
  76. return r || "_default_";
  77. }
  78. };
  79. e([d({ readOnly: true })], h.prototype, "size", null), h = e([n("esri.core.Handles")], h);
  80. var u = h;
  81. export {
  82. u
  83. };
  84. //# sourceMappingURL=chunk-NE3ESGA6.js.map