chunk-HWSWTWZD.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import {
  2. g,
  3. l
  4. } from "./chunk-5UVJ64RB.js";
  5. import {
  6. A
  7. } from "./chunk-V6P2MAQQ.js";
  8. import {
  9. s3 as s
  10. } from "./chunk-E5O6P5I2.js";
  11. // node_modules/@arcgis/core/intl/messages.js
  12. var r = /^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/;
  13. var o = { ar: true, bg: true, bs: true, ca: true, cs: true, da: true, de: true, el: true, en: true, es: true, et: true, fi: true, fr: true, he: true, hr: true, hu: true, id: true, it: true, ja: true, ko: true, lt: true, lv: true, nb: true, nl: true, pl: true, "pt-BR": true, "pt-PT": true, ro: true, ru: true, sk: true, sl: true, sr: true, sv: true, th: true, tr: true, uk: true, vi: true, "zh-CN": true, "zh-HK": true, "zh-TW": true };
  14. function i(t) {
  15. var _a;
  16. return (_a = o[t]) != null ? _a : false;
  17. }
  18. var a = [];
  19. var c = /* @__PURE__ */ new Map();
  20. function d(t) {
  21. for (const e of c.keys())
  22. _(t.pattern, e) && c.delete(e);
  23. }
  24. function l2(t) {
  25. return a.includes(t) || (d(t), a.unshift(t)), { remove() {
  26. const e = a.indexOf(t);
  27. e > -1 && (a.splice(e, 1), d(t));
  28. } };
  29. }
  30. async function u(t) {
  31. const e = l();
  32. c.has(t) || c.set(t, f(t, e));
  33. const n = c.get(t);
  34. return n && await m.add(n), n;
  35. }
  36. function h(t) {
  37. if (!r.test(t))
  38. return null;
  39. const e = r.exec(t);
  40. if (null === e)
  41. return null;
  42. const [, n, s2] = e, o2 = n + (s2 ? "-" + s2.toUpperCase() : "");
  43. return i(o2) ? o2 : i(n) ? n : null;
  44. }
  45. async function f(e, n) {
  46. const s2 = [];
  47. for (const t of a)
  48. if (_(t.pattern, e))
  49. try {
  50. return await t.fetchMessageBundle(e, n);
  51. } catch (r2) {
  52. s2.push(r2);
  53. }
  54. if (s2.length)
  55. throw new s("intl:message-bundle-error", `Errors occurred while loading "${e}"`, { errors: s2 });
  56. throw new s("intl:no-message-bundle-loader", `No loader found for message bundle "${e}"`);
  57. }
  58. function _(t, e) {
  59. return "string" == typeof t ? e.startsWith(t) : t.test(e);
  60. }
  61. g(() => {
  62. c.clear();
  63. });
  64. var m = new class {
  65. constructor() {
  66. this._numLoading = 0, this._dfd = null;
  67. }
  68. async waitForAll() {
  69. this._dfd && await this._dfd.promise;
  70. }
  71. add(t) {
  72. return this._increase(), t.then(() => this._decrease(), () => this._decrease()), this.waitForAll();
  73. }
  74. _increase() {
  75. this._numLoading++, this._dfd || (this._dfd = A());
  76. }
  77. _decrease() {
  78. this._numLoading = Math.max(this._numLoading - 1, 0), this._dfd && 0 === this._numLoading && (this._dfd.resolve(), this._dfd = null);
  79. }
  80. }();
  81. export {
  82. l2 as l,
  83. u,
  84. h
  85. };
  86. //# sourceMappingURL=chunk-HWSWTWZD.js.map