chunk-5JZ72JAQ.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import {
  2. l
  3. } from "./chunk-5UVJ64RB.js";
  4. import {
  5. o2 as o
  6. } from "./chunk-SPWQ3AWG.js";
  7. // node_modules/@arcgis/core/core/number.js
  8. var n = { ar: [".", ","], bg: [",", "\xA0"], bs: [",", "."], ca: [",", "."], cs: [",", "\xA0"], da: [",", "."], de: [",", "."], "de-ch": [".", "\u2019"], el: [",", "."], en: [".", ","], "en-au": [".", ","], es: [",", "."], "es-mx": [".", ","], et: [",", "\xA0"], fi: [",", "\xA0"], fr: [",", "\u202F"], "fr-ch": [",", "\u202F"], he: [".", ","], hi: [".", ",", "#,##,##0.###"], hr: [",", "."], hu: [",", "\xA0"], id: [",", "."], it: [",", "."], "it-ch": [".", "\u2019"], ja: [".", ","], ko: [".", ","], lt: [",", "\xA0"], lv: [",", "\xA0"], mk: [",", "."], nb: [",", "\xA0"], nl: [",", "."], pl: [",", "\xA0"], pt: [",", "."], "pt-pt": [",", "\xA0"], ro: [",", "."], ru: [",", "\xA0"], sk: [",", "\xA0"], sl: [",", "."], sr: [",", "."], sv: [",", "\xA0"], th: [".", ","], tr: [",", "."], uk: [",", "\xA0"], vi: [",", "."], zh: [".", ","] };
  9. function r(e) {
  10. e || (e = l());
  11. let r2 = e in n;
  12. if (!r2) {
  13. const t = e.split("-");
  14. t.length > 1 && t[0] in n && (e = t[0], r2 = true), r2 || (e = "en");
  15. }
  16. const [s2, l3, o3 = "#,##0.###"] = n[e];
  17. return { decimal: s2, group: l3, pattern: o3 };
  18. }
  19. function s(e, t) {
  20. const n2 = r((t = { ...t }).locale);
  21. t.customs = n2;
  22. const s2 = t.pattern || n2.pattern;
  23. return isNaN(e) || Math.abs(e) === 1 / 0 ? null : o2(e, s2, t);
  24. }
  25. var l2 = /[#0,]*[#0](?:\.0*#*)?/;
  26. function o2(e, t, n2) {
  27. const r2 = (n2 = n2 || {}).customs.group, s2 = n2.customs.decimal, o3 = t.split(";"), c = o3[0];
  28. if ((t = o3[e < 0 ? 1 : 0] || "-" + c).includes("%"))
  29. e *= 100;
  30. else if (t.includes("\u2030"))
  31. e *= 1e3;
  32. else {
  33. if (t.includes("\xA4"))
  34. throw new Error("currency notation not supported");
  35. if (t.includes("E"))
  36. throw new Error("exponential notation not supported");
  37. }
  38. const a2 = l2, p2 = c.match(a2);
  39. if (!p2)
  40. throw new Error("unable to find a number expression in pattern: " + t);
  41. return false === n2.fractional && (n2.places = 0), t.replace(a2, i(e, p2[0], { decimal: s2, group: r2, places: n2.places, round: n2.round }));
  42. }
  43. function i(e, t, n2) {
  44. true === (n2 = n2 || {}).places && (n2.places = 0), n2.places === 1 / 0 && (n2.places = 6);
  45. const r2 = t.split("."), s2 = "string" == typeof n2.places && n2.places.indexOf(",");
  46. let l3 = n2.places;
  47. s2 ? l3 = n2.places.substring(s2 + 1) : l3 >= 0 || (l3 = (r2[1] || []).length), n2.round < 0 || (e = Number(e.toFixed(Number(l3))));
  48. const o3 = String(Math.abs(e)).split("."), i2 = o3[1] || "";
  49. if (r2[1] || n2.places) {
  50. s2 && (n2.places = n2.places.substring(0, s2));
  51. const e2 = void 0 !== n2.places ? n2.places : r2[1] && r2[1].lastIndexOf("0") + 1;
  52. e2 > i2.length && (o3[1] = i2.padEnd(Number(e2), "0")), l3 < i2.length && (o3[1] = i2.substr(0, Number(l3)));
  53. } else
  54. o3[1] && o3.pop();
  55. const c = r2[0].replace(",", "");
  56. let a2 = c.indexOf("0");
  57. -1 !== a2 && (a2 = c.length - a2, a2 > o3[0].length && (o3[0] = o3[0].padStart(a2, "0")), c.includes("#") || (o3[0] = o3[0].substr(o3[0].length - a2)));
  58. let p2, u2, d2 = r2[0].lastIndexOf(",");
  59. if (-1 !== d2) {
  60. p2 = r2[0].length - d2 - 1;
  61. const e2 = r2[0].substr(0, d2);
  62. d2 = e2.lastIndexOf(","), -1 !== d2 && (u2 = e2.length - d2 - 1);
  63. }
  64. const g2 = [];
  65. for (let f2 = o3[0]; f2; ) {
  66. const e2 = f2.length - p2;
  67. g2.push(e2 > 0 ? f2.substr(e2) : f2), f2 = e2 > 0 ? f2.slice(0, e2) : "", u2 && (p2 = u2, u2 = void 0);
  68. }
  69. return o3[0] = g2.reverse().join(n2.group || ","), o3.join(n2.decimal || ".");
  70. }
  71. function a(t) {
  72. const n2 = r((t = t || {}).locale), s2 = t.pattern || n2.pattern, o3 = n2.group, i2 = n2.decimal;
  73. let c = 1;
  74. if (s2.includes("%"))
  75. c /= 100;
  76. else if (s2.includes("\u2030"))
  77. c /= 1e3;
  78. else if (s2.includes("\xA4"))
  79. throw new Error("currency notation not supported");
  80. const a2 = s2.split(";");
  81. 1 === a2.length && a2.push("-" + a2[0]);
  82. const p2 = g(a2, (n3) => (n3 = "(?:" + o(n3, ".") + ")").replace(l2, (e) => {
  83. const n4 = { signed: false, separator: t.strict ? o3 : [o3, ""], fractional: t.fractional, decimal: i2, exponent: false }, r2 = e.split(".");
  84. let s3 = t.places;
  85. 1 === r2.length && 1 !== c && (r2[1] = "###"), 1 === r2.length || 0 === s3 ? n4.fractional = false : (void 0 === s3 && (s3 = t.pattern ? r2[1].lastIndexOf("0") + 1 : 1 / 0), s3 && null == t.fractional && (n4.fractional = true), !t.places && s3 < r2[1].length && (s3 += "," + r2[1].length), n4.places = s3);
  86. const l3 = r2[0].split(",");
  87. return l3.length > 1 && (n4.groupSize = l3.pop().length, l3.length > 1 && (n4.groupSize2 = l3.pop().length)), "(" + u(n4) + ")";
  88. }), true);
  89. return { regexp: p2.replace(/[\xa0 ]/g, "[\\s\\xa0]"), group: o3, decimal: i2, factor: c };
  90. }
  91. function p(e, t) {
  92. const n2 = a(t), r2 = new RegExp("^" + n2.regexp + "$").exec(e);
  93. if (!r2)
  94. return NaN;
  95. let s2 = r2[1];
  96. if (!r2[1]) {
  97. if (!r2[2])
  98. return NaN;
  99. s2 = r2[2], n2.factor *= -1;
  100. }
  101. return s2 = s2.replace(new RegExp("[" + n2.group + "\\s\\xa0]", "g"), "").replace(n2.decimal, "."), Number(s2) * n2.factor;
  102. }
  103. function u(e) {
  104. "places" in (e = e || {}) || (e.places = 1 / 0), "string" != typeof e.decimal && (e.decimal = "."), "fractional" in e && !/^0/.test(String(e.places)) || (e.fractional = [true, false]), "exponent" in e || (e.exponent = [true, false]), "eSigned" in e || (e.eSigned = [true, false]);
  105. const t = d(e), n2 = g(e.fractional, (t2) => {
  106. let n3 = "";
  107. return t2 && 0 !== e.places && (n3 = "\\" + e.decimal, e.places === 1 / 0 ? n3 = "(?:" + n3 + "\\d+)?" : n3 += "\\d{" + e.places + "}"), n3;
  108. }, true);
  109. let r2 = t + n2;
  110. return n2 && (r2 = "(?:(?:" + r2 + ")|(?:" + n2 + "))"), r2 + g(e.exponent, (t2) => t2 ? "([eE]" + d({ signed: e.eSigned }) + ")" : "");
  111. }
  112. function d(t) {
  113. "signed" in (t = t || {}) || (t.signed = [true, false]), "separator" in t ? "groupSize" in t || (t.groupSize = 3) : t.separator = "";
  114. return g(t.signed, (e) => e ? "[-+]" : "", true) + g(t.separator, (n2) => {
  115. if (!n2)
  116. return "(?:\\d+)";
  117. " " === (n2 = o(n2)) ? n2 = "\\s" : "\xA0" === n2 && (n2 = "\\s\\xa0");
  118. const r2 = t.groupSize, s2 = t.groupSize2;
  119. if (s2) {
  120. const e = "(?:0|[1-9]\\d{0," + (s2 - 1) + "}(?:[" + n2 + "]\\d{" + s2 + "})*[" + n2 + "]\\d{" + r2 + "})";
  121. return r2 - s2 > 0 ? "(?:" + e + "|(?:0|[1-9]\\d{0," + (r2 - 1) + "}))" : e;
  122. }
  123. return "(?:0|[1-9]\\d{0," + (r2 - 1) + "}(?:[" + n2 + "]\\d{" + r2 + "})*)";
  124. }, true);
  125. }
  126. var g = (e, t, n2) => {
  127. if (!(e instanceof Array))
  128. return t(e);
  129. const r2 = [];
  130. for (let s2 = 0; s2 < e.length; s2++)
  131. r2.push(t(e[s2]));
  132. return f(r2.join("|"), Boolean(n2));
  133. };
  134. var f = (e, t) => "(" + (t ? "?:" : "") + e + ")";
  135. export {
  136. s,
  137. a,
  138. p
  139. };
  140. //# sourceMappingURL=chunk-5JZ72JAQ.js.map