chunk-2ZSOO377.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import {
  2. e,
  3. m,
  4. n5 as n,
  5. y3 as y
  6. } from "./chunk-2Z2TG5CU.js";
  7. import {
  8. E,
  9. v,
  10. w
  11. } from "./chunk-V6P2MAQQ.js";
  12. import {
  13. h,
  14. p,
  15. r,
  16. t
  17. } from "./chunk-YXWMMD76.js";
  18. // node_modules/@arcgis/core/core/asyncUtils.js
  19. function c(r2, t2, o) {
  20. return E(r2.map((r3, e2) => t2.apply(o, [r3, e2])));
  21. }
  22. async function h2(r2, t2, o) {
  23. return (await E(r2.map((r3, e2) => t2.apply(o, [r3, e2])))).map((r3) => r3.value);
  24. }
  25. function m2(r2) {
  26. return { ok: true, value: r2 };
  27. }
  28. function f(r2) {
  29. return { ok: false, error: r2 };
  30. }
  31. function _(r2) {
  32. return r(r2) && true === r2.ok ? r2.value : null;
  33. }
  34. function y2(r2) {
  35. return r(r2) && false === r2.ok ? r2.error : null;
  36. }
  37. async function b(r2) {
  38. if (t(r2))
  39. return { ok: false, error: new Error("no promise provided") };
  40. try {
  41. return m2(await r2);
  42. } catch (t2) {
  43. return f(t2);
  44. }
  45. }
  46. async function d(r2) {
  47. try {
  48. return m2(await r2);
  49. } catch (t2) {
  50. return w(t2), f(t2);
  51. }
  52. }
  53. function j(r2, t2) {
  54. return new k(r2, t2);
  55. }
  56. var k = class extends m {
  57. constructor(r2, t2) {
  58. super({}), this._result = null, this._abortHandle = null, this.abort = () => {
  59. this._abortController = p(this._abortController);
  60. }, this.remove = this.abort, this._abortController = new AbortController();
  61. const { signal: o } = this._abortController;
  62. this.promise = r2(o), this.promise.then((r3) => {
  63. this._result = m2(r3), this._cleanup();
  64. }, (r3) => {
  65. this._result = f(r3), this._cleanup();
  66. }), this._abortHandle = v(t2, this.abort);
  67. }
  68. get value() {
  69. return _(this._result);
  70. }
  71. get error() {
  72. return y2(this._result);
  73. }
  74. get finished() {
  75. return r(this._result);
  76. }
  77. normalizeCtorArgs() {
  78. return {};
  79. }
  80. destroy() {
  81. this.abort();
  82. }
  83. _cleanup() {
  84. this._abortHandle = h(this._abortHandle), this._abortController = null;
  85. }
  86. };
  87. e([y()], k.prototype, "value", null), e([y()], k.prototype, "error", null), e([y()], k.prototype, "finished", null), e([y()], k.prototype, "promise", void 0), e([y()], k.prototype, "_result", void 0), k = e([n("esri.core.asyncUtils.ReactiveTask")], k);
  88. export {
  89. c,
  90. h2 as h,
  91. b,
  92. d,
  93. j
  94. };
  95. //# sourceMappingURL=chunk-2ZSOO377.js.map