chunk-TBBTRX4O.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import {
  2. _
  3. } from "./chunk-YBSUITLL.js";
  4. import {
  5. d,
  6. e,
  7. n2 as n,
  8. t
  9. } from "./chunk-Y3WMVFTW.js";
  10. import {
  11. d as d2,
  12. v
  13. } from "./chunk-ULGDPLM2.js";
  14. import {
  15. s3 as s
  16. } from "./chunk-EMJ4ZSM2.js";
  17. // node_modules/@arcgis/core/core/Loadable.js
  18. var i = "not-loaded";
  19. var d3 = "loading";
  20. var c = "failed";
  21. var h = "loaded";
  22. var u = (s2) => {
  23. let u2 = class extends s2 {
  24. constructor(...o) {
  25. super(...o), this._loadController = null, this.loadError = null, this.loadStatus = "not-loaded", this._set("loadWarnings", []), this.addResolvingPromise(new Promise((o2) => {
  26. const s3 = this.load.bind(this);
  27. this.load = (l) => {
  28. const a = new Promise((o3, s4) => {
  29. const e2 = d2(l, s4);
  30. this.destroyed && s4(new s("load:instance-destroyed", `Instance of '${this.declaredClass || this.constructor.name}' is already destroyed`, { instance: this })), this._promiseProps.when(o3, s4).finally(() => {
  31. e2 && e2.remove();
  32. });
  33. });
  34. if (this.loadStatus === i) {
  35. this._set("loadStatus", d3);
  36. const o3 = this._loadController = new AbortController();
  37. s3({ signal: o3.signal }), v(o3.signal, () => {
  38. this._promiseProps.abort();
  39. });
  40. }
  41. return o2(), a;
  42. };
  43. })), this.when(() => {
  44. this._set("loadStatus", h), this._loadController = null;
  45. }, (o2) => {
  46. this._set("loadStatus", c), this._set("loadError", o2), this._loadController = null;
  47. });
  48. }
  49. get loaded() {
  50. return this.loadStatus === h;
  51. }
  52. get loadWarnings() {
  53. return this._get("loadWarnings");
  54. }
  55. load() {
  56. return null;
  57. }
  58. cancelLoad() {
  59. return this.isFulfilled() || (this._set("loadError", new s("load:cancelled", "Cancelled")), this._loadController?.abort()), this;
  60. }
  61. };
  62. return e([d({ readOnly: true })], u2.prototype, "loaded", null), e([d({ readOnly: true })], u2.prototype, "loadError", void 0), e([d({ clonable: false })], u2.prototype, "loadStatus", void 0), e([d({ type: [t], readOnly: true })], u2.prototype, "loadWarnings", null), u2 = e([n("esri.core.Loadable")], u2), u2;
  63. };
  64. var p = class extends u(_) {
  65. };
  66. p = e([n("esri.core.Loadable")], p), function(o) {
  67. function t2(o2) {
  68. return !(!o2 || !o2.load);
  69. }
  70. o.LoadableMixin = u, o.isLoadable = t2;
  71. }(p || (p = {}));
  72. var m = p;
  73. export {
  74. m
  75. };
  76. //# sourceMappingURL=chunk-TBBTRX4O.js.map