@edugis-org/webmapx 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,7 @@ var i = {
26
26
  "3d": () => import("./webmapx-3d-tool-D4CTD2gB.js"),
27
27
  truearea: () => import("./webmapx-truearea-tool-CMB4Orm-.js"),
28
28
  "view-mode": () => import("./webmapx-view-mode-tool-CUpLNjOj.js"),
29
- coordinates: () => import("./webmapx-coordinates-tool-Cygt5m-J.js"),
29
+ coordinates: () => import("./webmapx-coordinates-tool-Ca5-r3im.js"),
30
30
  settings: () => import("./webmapx-settings-DDEJ8aoV.js"),
31
31
  "config-edit": () => import("./webmapx-config-edit-tool-BgcSkmmg.js")
32
32
  };
@@ -109,7 +109,7 @@ var c = (e) => typeof e == "string", l = () => {
109
109
  "\"": """,
110
110
  "'": "'",
111
111
  "/": "/"
112
- }, C = (e) => c(e) ? e.replace(/[&<>"'\/]/g, (e) => S[e]) : e, w = class {
112
+ }, ee = (e) => c(e) ? e.replace(/[&<>"'\/]/g, (e) => S[e]) : e, te = class {
113
113
  constructor(e) {
114
114
  this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
115
115
  }
@@ -119,23 +119,23 @@ var c = (e) => typeof e == "string", l = () => {
119
119
  let n = new RegExp(e);
120
120
  return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
121
121
  }
122
- }, T = [
122
+ }, C = [
123
123
  " ",
124
124
  ",",
125
125
  "?",
126
126
  "!",
127
127
  ";"
128
- ], E = new w(20), D = (e, t, n) => {
128
+ ], w = new te(20), T = (e, t, n) => {
129
129
  t ||= "", n ||= "";
130
- let r = T.filter((e) => !t.includes(e) && !n.includes(e));
130
+ let r = C.filter((e) => !t.includes(e) && !n.includes(e));
131
131
  if (r.length === 0) return !0;
132
- let i = E.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
132
+ let i = w.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
133
133
  if (!a) {
134
134
  let t = e.indexOf(n);
135
135
  t > 0 && !i.test(e.substring(0, t)) && (a = !0);
136
136
  }
137
137
  return a;
138
- }, O = (e, t, n = ".") => {
138
+ }, E = (e, t, n = ".") => {
139
139
  if (!e) return;
140
140
  if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
141
141
  let r = t.split(n), i = e;
@@ -154,7 +154,7 @@ var c = (e) => typeof e == "string", l = () => {
154
154
  i = t;
155
155
  }
156
156
  return i;
157
- }, k = (e) => e?.replace(/_/g, "-"), ee = {
157
+ }, D = (e) => e?.replace(/_/g, "-"), ne = {
158
158
  type: "logger",
159
159
  log(e) {
160
160
  this.output("log", e);
@@ -168,12 +168,12 @@ var c = (e) => typeof e == "string", l = () => {
168
168
  output(e, t) {
169
169
  console?.[e]?.apply?.(console, t);
170
170
  }
171
- }, A = new class e {
171
+ }, O = new class e {
172
172
  constructor(e, t = {}) {
173
173
  this.init(e, t);
174
174
  }
175
175
  init(e, t = {}) {
176
- this.prefix = t.prefix || "i18next:", this.logger = e || ee, this.options = t, this.debug = t.debug;
176
+ this.prefix = t.prefix || "i18next:", this.logger = e || ne, this.options = t, this.debug = t.debug;
177
177
  }
178
178
  log(...e) {
179
179
  return this.forward(e, "log", "", !0);
@@ -199,7 +199,7 @@ var c = (e) => typeof e == "string", l = () => {
199
199
  clone(t) {
200
200
  return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
201
201
  }
202
- }(), j = class {
202
+ }(), k = class {
203
203
  constructor() {
204
204
  this.observers = {};
205
205
  }
@@ -232,7 +232,7 @@ var c = (e) => typeof e == "string", l = () => {
232
232
  for (let i = 0; i < r; i++) n(e, ...t);
233
233
  });
234
234
  }
235
- }, M = class extends j {
235
+ }, A = class extends k {
236
236
  constructor(e, t = {
237
237
  ns: ["translation"],
238
238
  defaultNS: "translation"
@@ -250,7 +250,7 @@ var c = (e) => typeof e == "string", l = () => {
250
250
  let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
251
251
  e.includes(".") ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : c(n) && i ? o.push(...n.split(i)) : o.push(n)));
252
252
  let s = v(this.data, o);
253
- return !s && !t && !n && e.includes(".") && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !c(n) ? s : O(this.data?.[e]?.[t], n, i);
253
+ return !s && !t && !n && e.includes(".") && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !c(n) ? s : E(this.data?.[e]?.[t], n, i);
254
254
  }
255
255
  addResource(e, t, n, r, i = { silent: !1 }) {
256
256
  let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
@@ -291,7 +291,7 @@ var c = (e) => typeof e == "string", l = () => {
291
291
  toJSON() {
292
292
  return this.data;
293
293
  }
294
- }, N = {
294
+ }, j = {
295
295
  processors: {},
296
296
  addPostProcessor(e) {
297
297
  this.processors[e.name] = e;
@@ -301,20 +301,20 @@ var c = (e) => typeof e == "string", l = () => {
301
301
  t = this.processors[e]?.process(t, n, r, i) ?? t;
302
302
  }), t;
303
303
  }
304
- }, P = Symbol("i18next/PATH_KEY");
305
- function te() {
304
+ }, M = Symbol("i18next/PATH_KEY");
305
+ function re() {
306
306
  let e = [], t = Object.create(null), n;
307
- return t.get = (r, i) => (n?.revoke?.(), i === P ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
307
+ return t.get = (r, i) => (n?.revoke?.(), i === M ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
308
308
  }
309
- function F(e, t) {
310
- let { [P]: n } = e(te()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":", a = t?.enableSelector === "strict";
309
+ function N(e, t) {
310
+ let { [M]: n } = e(re()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":", a = t?.enableSelector === "strict";
311
311
  if (n.length > 1 && i) {
312
312
  let e = t?.ns, o = a ? Array.isArray(e) ? e : e ? [e] : null : Array.isArray(e) ? e : null;
313
313
  if (o && (a ? o : o.length > 1 ? o.slice(1) : []).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
314
314
  }
315
315
  return n.join(r);
316
316
  }
317
- var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class e extends j {
317
+ var P = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", ie = class e extends k {
318
318
  constructor(e, t = {}) {
319
319
  super(), d([
320
320
  "resourceStore",
@@ -324,7 +324,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
324
324
  "backendConnector",
325
325
  "i18nFormat",
326
326
  "utils"
327
- ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = A.create("translator"), this.checkedLoadedFor = {};
327
+ ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = O.create("translator"), this.checkedLoadedFor = {};
328
328
  }
329
329
  changeLanguage(e) {
330
330
  e && (this.language = e);
@@ -334,13 +334,13 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
334
334
  if (e == null) return !1;
335
335
  let r = this.resolve(e, n);
336
336
  if (r?.res === void 0) return !1;
337
- let i = I(r.res);
337
+ let i = P(r.res);
338
338
  return !(n.returnObjects === !1 && i);
339
339
  }
340
340
  extractFromKey(e, t) {
341
341
  let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
342
342
  n === void 0 && (n = ":");
343
- let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.includes(n), o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !D(e, n, r);
343
+ let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.includes(n), o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !T(e, n, r);
344
344
  if (a && !o) {
345
345
  let t = e.match(this.interpolator.nestingRegexp);
346
346
  if (t && t.length > 0) return {
@@ -358,10 +358,10 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
358
358
  translate(t, n, r) {
359
359
  let i = typeof n == "object" ? { ...n } : n;
360
360
  if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
361
- typeof t == "function" && (t = F(t, {
361
+ typeof t == "function" && (t = N(t, {
362
362
  ...this.options,
363
363
  ...i
364
- })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? F(e, {
364
+ })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? N(e, {
365
365
  ...this.options,
366
366
  ...i
367
367
  }) : String(e));
@@ -387,42 +387,42 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
387
387
  "[object Number]",
388
388
  "[object Function]",
389
389
  "[object RegExp]"
390
- ], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !c(i.count), S = e.hasDefaultValue(i), C = x ? this.pluralResolver.getSuffix(f, i.count, i) : "", w = i.ordinal && x ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", T = x && !i.ordinal && i.count === 0, E = T && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${C}`] || i[`defaultValue${w}`] || i.defaultValue, D = h;
391
- b && !h && S && (D = E);
392
- let O = I(D), k = Object.prototype.toString.apply(D);
393
- if (b && D && O && !v.includes(k) && !(c(y) && Array.isArray(D))) {
390
+ ], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !c(i.count), S = e.hasDefaultValue(i), ee = x ? this.pluralResolver.getSuffix(f, i.count, i) : "", te = i.ordinal && x ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", C = x && !i.ordinal && i.count === 0, w = C && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${ee}`] || i[`defaultValue${te}`] || i.defaultValue, T = h;
391
+ b && !h && S && (T = w);
392
+ let E = P(T), D = Object.prototype.toString.apply(T);
393
+ if (b && T && E && !v.includes(D) && !(c(y) && Array.isArray(T))) {
394
394
  if (!i.returnObjects && !this.options.returnObjects) {
395
395
  this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
396
- let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, D, {
396
+ let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, T, {
397
397
  ...i,
398
398
  ns: l
399
399
  }) : `key '${s} (${this.language})' returned an object instead of string.`;
400
400
  return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
401
401
  }
402
402
  if (o) {
403
- let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ : g;
404
- for (let e in D) if (Object.prototype.hasOwnProperty.call(D, e)) {
403
+ let e = Array.isArray(T), t = e ? [] : {}, n = e ? _ : g;
404
+ for (let e in T) if (Object.prototype.hasOwnProperty.call(T, e)) {
405
405
  let r = `${n}${o}${e}`;
406
406
  S && !h ? t[e] = this.translate(r, {
407
407
  ...i,
408
- defaultValue: I(E) ? E[e] : void 0,
408
+ defaultValue: P(w) ? w[e] : void 0,
409
409
  joinArrays: !1,
410
410
  ns: l
411
411
  }) : t[e] = this.translate(r, {
412
412
  ...i,
413
413
  joinArrays: !1,
414
414
  ns: l
415
- }), t[e] === r && (t[e] = D[e]);
415
+ }), t[e] === r && (t[e] = T[e]);
416
416
  }
417
417
  h = t;
418
418
  }
419
419
  } else if (b && c(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, t, i, r);
420
420
  else {
421
421
  let e = !1, n = !1;
422
- !this.isValidLookup(h) && S && (e = !0, h = E), this.isValidLookup(h) || (n = !0, h = s);
423
- let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S && E !== h && this.options.updateMissing;
422
+ !this.isValidLookup(h) && S && (e = !0, h = w), this.isValidLookup(h) || (n = !0, h = s);
423
+ let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S && w !== h && this.options.updateMissing;
424
424
  if (n || e || c) {
425
- if (this.logger.log(c ? "updateKey" : "missingKey", f, u, x && !c ? `${s}${this.pluralResolver.getSuffix(f, i.count, i)}` : s, c ? E : h), o) {
425
+ if (this.logger.log(c ? "updateKey" : "missingKey", f, u, x && !c ? `${s}${this.pluralResolver.getSuffix(f, i.count, i)}` : s, c ? w : h), o) {
426
426
  let e = this.resolve(s, {
427
427
  ...i,
428
428
  keySeparator: !1
@@ -438,10 +438,10 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
438
438
  };
439
439
  this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
440
440
  let t = this.pluralResolver.getSuffixes(e, i);
441
- T && i[`defaultValue${this.options.pluralSeparator}zero`] && !t.includes(`${this.options.pluralSeparator}zero`) && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
442
- n([e], s + t, i[`defaultValue${t}`] || E);
441
+ C && i[`defaultValue${this.options.pluralSeparator}zero`] && !t.includes(`${this.options.pluralSeparator}zero`) && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
442
+ n([e], s + t, i[`defaultValue${t}`] || w);
443
443
  });
444
- }) : n(e, s, E));
444
+ }) : n(e, s, w));
445
445
  }
446
446
  h = this.extendTranslation(h, t, i, m, r), n && h === s && this.options.appendNamespaceToMissingKey && (h = `${u}${d}${s}`), (n || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${d}${s}` : s, e ? h : void 0, i));
447
447
  }
@@ -476,7 +476,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
476
476
  !n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
477
477
  }
478
478
  let a = n.postProcess || this.options.postProcess, o = c(a) ? [a] : a;
479
- return e != null && o?.length && n.applyPostProcessor !== !1 && (e = N.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
479
+ return e != null && o?.length && n.applyPostProcessor !== !1 && (e = j.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
480
480
  i18nResolved: {
481
481
  ...r,
482
482
  usedParams: this.getUsedParamsDetails(n)
@@ -486,7 +486,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
486
486
  }
487
487
  resolve(e, t = {}) {
488
488
  let n, r, i, a, o;
489
- return c(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? F(e, {
489
+ return c(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? N(e, {
490
490
  ...this.options,
491
491
  ...t
492
492
  }) : e)), e.forEach((e) => {
@@ -560,17 +560,17 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
560
560
  for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.startsWith("defaultValue") && e[t] !== void 0) return !0;
561
561
  return !1;
562
562
  }
563
- }, R = class {
563
+ }, ae = class {
564
564
  constructor(e) {
565
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = A.create("languageUtils");
565
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = O.create("languageUtils");
566
566
  }
567
567
  getScriptPartFromCode(e) {
568
- if (e = k(e), !e || !e.includes("-")) return null;
568
+ if (e = D(e), !e || !e.includes("-")) return null;
569
569
  let t = e.split("-");
570
570
  return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
571
571
  }
572
572
  getLanguagePartFromCode(e) {
573
- if (e = k(e), !e || !e.includes("-")) return e;
573
+ if (e = D(e), !e || !e.includes("-")) return e;
574
574
  let t = e.split("-");
575
575
  return this.formatLanguageCode(t[0]);
576
576
  }
@@ -618,25 +618,25 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
618
618
  r.includes(e) || i(this.formatLanguageCode(e));
619
619
  }), r;
620
620
  }
621
- }, z = {
621
+ }, oe = {
622
622
  zero: 0,
623
623
  one: 1,
624
624
  two: 2,
625
625
  few: 3,
626
626
  many: 4,
627
627
  other: 5
628
- }, B = {
628
+ }, se = {
629
629
  select: (e) => e === 1 ? "one" : "other",
630
630
  resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
631
- }, V = class {
631
+ }, ce = class {
632
632
  constructor(e, t = {}) {
633
- this.languageUtils = e, this.options = t, this.logger = A.create("pluralResolver"), this.pluralRulesCache = {};
633
+ this.languageUtils = e, this.options = t, this.logger = O.create("pluralResolver"), this.pluralRulesCache = {};
634
634
  }
635
635
  clearCache() {
636
636
  this.pluralRulesCache = {};
637
637
  }
638
638
  getRule(e, t = {}) {
639
- let n = k(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
639
+ let n = D(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
640
640
  cleanedCode: n,
641
641
  type: r
642
642
  });
@@ -645,8 +645,8 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
645
645
  try {
646
646
  a = new Intl.PluralRules(n, { type: r });
647
647
  } catch {
648
- if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), B;
649
- if (!e.match(/-|_/)) return B;
648
+ if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), se;
649
+ if (!e.match(/-|_/)) return se;
650
650
  let n = this.languageUtils.getLanguagePartFromCode(e);
651
651
  a = this.getRule(n, t);
652
652
  }
@@ -661,23 +661,23 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
661
661
  }
662
662
  getSuffixes(e, t = {}) {
663
663
  let n = this.getRule(e, t);
664
- return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => z[e] - z[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
664
+ return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => oe[e] - oe[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
665
665
  }
666
666
  getSuffix(e, t, n = {}) {
667
667
  let r = this.getRule(e, n);
668
668
  return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
669
669
  }
670
- }, H = (e, t, n, r = ".", i = !0) => {
670
+ }, le = (e, t, n, r = ".", i = !0) => {
671
671
  let a = y(e, t, n);
672
- return !a && i && c(n) && (a = O(e, n, r), a === void 0 && (a = O(t, n, r))), a;
673
- }, U = (e) => e.replace(/\$/g, "$$$$"), W = class {
672
+ return !a && i && c(n) && (a = E(e, n, r), a === void 0 && (a = E(t, n, r))), a;
673
+ }, F = (e) => e.replace(/\$/g, "$$$$"), I = class {
674
674
  constructor(e = {}) {
675
- this.logger = A.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
675
+ this.logger = O.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
676
676
  }
677
677
  init(e = {}) {
678
678
  e.interpolation ||= { escapeValue: !0 };
679
679
  let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
680
- this.escape = t === void 0 ? C : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? x(i) : a || "{{", this.suffix = o ? x(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u ? x(u) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : l ? x(l) : "", this.nestingPrefix = d ? x(d) : f || x("$t("), this.nestingSuffix = p ? x(p) : m || x(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
680
+ this.escape = t === void 0 ? ee : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? x(i) : a || "{{", this.suffix = o ? x(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u ? x(u) : "-", this.unescapeSuffix = this.unescapePrefix ? "" : l ? x(l) : "", this.nestingPrefix = d ? x(d) : f || x("$t("), this.nestingSuffix = p ? x(p) : m || x(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ === void 0 ? !1 : _, this.resetRegExp();
681
681
  }
682
682
  reset() {
683
683
  this.options && this.init(this.options);
@@ -689,7 +689,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
689
689
  interpolate(e, t, n, r) {
690
690
  let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (e) => {
691
691
  if (!e.includes(this.formatSeparator)) {
692
- let i = H(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
692
+ let i = le(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
693
693
  return this.alwaysFormat ? this.format(i, void 0, n, {
694
694
  ...r,
695
695
  ...t,
@@ -697,7 +697,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
697
697
  }) : i;
698
698
  }
699
699
  let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
700
- return this.format(H(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
700
+ return this.format(le(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
701
701
  ...r,
702
702
  ...t,
703
703
  interpolationkey: a
@@ -707,10 +707,10 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
707
707
  let d = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
708
708
  return [{
709
709
  regex: this.regexpUnescape,
710
- safeValue: (e) => U(e)
710
+ safeValue: (e) => F(e)
711
711
  }, {
712
712
  regex: this.regexp,
713
- safeValue: (e) => this.escapeValue ? U(this.escape(e)) : U(e)
713
+ safeValue: (e) => this.escapeValue ? F(this.escape(e)) : F(e)
714
714
  }].forEach((t) => {
715
715
  for (o = 0; i = t.regex.exec(e);) {
716
716
  let n = i[1].trim();
@@ -758,7 +758,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
758
758
  }
759
759
  return e;
760
760
  }
761
- }, G = (e) => {
761
+ }, ue = (e) => {
762
762
  let t = e.toLowerCase().trim(), n = {};
763
763
  if (e.includes("(")) {
764
764
  let r = e.split("(");
@@ -775,7 +775,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
775
775
  formatName: t,
776
776
  formatOptions: n
777
777
  };
778
- }, K = (e) => {
778
+ }, L = (e) => {
779
779
  let t = {};
780
780
  return (n, r, i) => {
781
781
  let a = i;
@@ -784,15 +784,15 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
784
784
  [i.interpolationkey]: void 0
785
785
  });
786
786
  let o = r + JSON.stringify(a), s = t[o];
787
- return s || (s = e(k(r), i), t[o] = s), s(n);
787
+ return s || (s = e(D(r), i), t[o] = s), s(n);
788
788
  };
789
- }, ne = (e) => (t, n, r) => e(k(n), r)(t), re = class {
789
+ }, de = (e) => (t, n, r) => e(D(n), r)(t), fe = class {
790
790
  constructor(e = {}) {
791
- this.logger = A.create("formatter"), this.options = e, this.init(e);
791
+ this.logger = O.create("formatter"), this.options = e, this.init(e);
792
792
  }
793
793
  init(e, t = { interpolation: {} }) {
794
794
  this.formatSeparator = t.interpolation.formatSeparator || ",";
795
- let n = t.cacheInBuiltFormats ? K : ne;
795
+ let n = t.cacheInBuiltFormats ? L : de;
796
796
  this.formats = {
797
797
  number: n((e, t) => {
798
798
  let n = new Intl.NumberFormat(e, { ...t });
@@ -823,7 +823,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
823
823
  this.formats[e.toLowerCase().trim()] = t;
824
824
  }
825
825
  addCached(e, t) {
826
- this.formats[e.toLowerCase().trim()] = K(t);
826
+ this.formats[e.toLowerCase().trim()] = L(t);
827
827
  }
828
828
  format(e, t, n, r = {}) {
829
829
  if (!t || e == null) return e;
@@ -833,7 +833,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
833
833
  i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
834
834
  }
835
835
  return i.reduce((e, t) => {
836
- let { formatName: i, formatOptions: a } = G(t);
836
+ let { formatName: i, formatOptions: a } = ue(t);
837
837
  if (this.formats[i]) {
838
838
  let t = e;
839
839
  try {
@@ -851,11 +851,11 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
851
851
  return e;
852
852
  }, e);
853
853
  }
854
- }, ie = (e, t) => {
854
+ }, pe = (e, t) => {
855
855
  e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
856
- }, ae = class extends j {
856
+ }, me = class extends k {
857
857
  constructor(e, t, n, r = {}) {
858
- super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = A.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
858
+ super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = O.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
859
859
  }
860
860
  queueLoad(e, t, n, r) {
861
861
  let i = {}, a = {}, o = {}, s = {};
@@ -883,7 +883,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
883
883
  t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
884
884
  let o = {};
885
885
  this.queue.forEach((n) => {
886
- _(n.loaded, [i], a), ie(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
886
+ _(n.loaded, [i], a), pe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
887
887
  o[e] || (o[e] = {});
888
888
  let t = n.loaded[e];
889
889
  t.length && t.forEach((t) => {
@@ -973,7 +973,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
973
973
  !e || !e[0] || this.store.addResource(e[0], t, n, r);
974
974
  }
975
975
  }
976
- }, q = () => ({
976
+ }, R = () => ({
977
977
  debug: !1,
978
978
  initAsync: !0,
979
979
  ns: ["translation"],
@@ -1029,13 +1029,13 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1029
1029
  skipOnVariables: !0
1030
1030
  },
1031
1031
  cacheInBuiltFormats: !0
1032
- }), J = (e) => (c(e.ns) && (e.ns = [e.ns]), c(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), c(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs && !e.supportedLngs.includes("cimode") && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), e), Y = () => {}, oe = (e) => {
1032
+ }), z = (e) => (c(e.ns) && (e.ns = [e.ns]), c(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), c(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs && !e.supportedLngs.includes("cimode") && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), e), B = () => {}, he = (e) => {
1033
1033
  Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
1034
1034
  typeof e[t] == "function" && (e[t] = e[t].bind(e));
1035
1035
  });
1036
- }, X = class e extends j {
1036
+ }, V = class e extends k {
1037
1037
  constructor(e = {}, t) {
1038
- if (super(), this.options = J(e), this.services = {}, this.logger = A, this.modules = { external: [] }, oe(this), t && !this.isInitialized && !e.isClone) {
1038
+ if (super(), this.options = z(e), this.services = {}, this.logger = O, this.modules = { external: [] }, he(this), t && !this.isInitialized && !e.isClone) {
1039
1039
  if (!this.options.initAsync) return this.init(e, t), this;
1040
1040
  setTimeout(() => {
1041
1041
  this.init(e, t);
@@ -1044,32 +1044,32 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1044
1044
  }
1045
1045
  init(e = {}, t) {
1046
1046
  this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (c(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0]));
1047
- let n = q();
1047
+ let n = R();
1048
1048
  this.options = {
1049
1049
  ...n,
1050
1050
  ...this.options,
1051
- ...J(e)
1051
+ ...z(e)
1052
1052
  }, this.options.interpolation = {
1053
1053
  ...n.interpolation,
1054
1054
  ...this.options.interpolation
1055
1055
  }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler);
1056
1056
  let r = (e) => e ? typeof e == "function" ? new e() : e : null;
1057
1057
  if (!this.options.isClone) {
1058
- this.modules.logger ? A.init(r(this.modules.logger), this.options) : A.init(null, this.options);
1058
+ this.modules.logger ? O.init(r(this.modules.logger), this.options) : O.init(null, this.options);
1059
1059
  let e;
1060
- e = this.modules.formatter ? this.modules.formatter : re;
1061
- let t = new R(this.options);
1062
- this.store = new M(this.options.resources, this.options);
1060
+ e = this.modules.formatter ? this.modules.formatter : fe;
1061
+ let t = new ae(this.options);
1062
+ this.store = new A(this.options.resources, this.options);
1063
1063
  let n = this.services;
1064
- n.logger = A, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new V(t, { prepend: this.options.pluralSeparator }), e && (n.formatter = r(e), n.formatter.init && n.formatter.init(n, this.options), this.options.interpolation.format = n.formatter.format.bind(n.formatter)), n.interpolator = new W(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new ae(r(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
1064
+ n.logger = O, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new ce(t, { prepend: this.options.pluralSeparator }), e && (n.formatter = r(e), n.formatter.init && n.formatter.init(n, this.options), this.options.interpolation.format = n.formatter.format.bind(n.formatter)), n.interpolator = new I(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new me(r(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
1065
1065
  this.emit(e, ...t);
1066
- }), this.modules.languageDetector && (n.languageDetector = r(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = r(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new L(this.services, this.options), this.translator.on("*", (e, ...t) => {
1066
+ }), this.modules.languageDetector && (n.languageDetector = r(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = r(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new ie(this.services, this.options), this.translator.on("*", (e, ...t) => {
1067
1067
  this.emit(e, ...t);
1068
1068
  }), this.modules.external.forEach((e) => {
1069
1069
  e.init && e.init(this);
1070
1070
  });
1071
1071
  }
1072
- if (this.format = this.options.interpolation.format, t ||= Y, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1072
+ if (this.format = this.options.interpolation.format, t ||= B, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1073
1073
  let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1074
1074
  e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
1075
1075
  }
@@ -1097,7 +1097,7 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1097
1097
  };
1098
1098
  return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
1099
1099
  }
1100
- loadResources(e, t = Y) {
1100
+ loadResources(e, t = B) {
1101
1101
  let n = t, r = c(e) ? e : this.language;
1102
1102
  if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1103
1103
  if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
@@ -1113,14 +1113,14 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1113
1113
  }
1114
1114
  reloadResources(e, t, n) {
1115
1115
  let r = l();
1116
- return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= Y, this.services.backendConnector.reload(e, t, (e) => {
1116
+ return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= B, this.services.backendConnector.reload(e, t, (e) => {
1117
1117
  r.resolve(), n(e);
1118
1118
  }), r;
1119
1119
  }
1120
1120
  use(e) {
1121
1121
  if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1122
1122
  if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1123
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && N.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1123
+ return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && j.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1124
1124
  }
1125
1125
  setResolvedLanguage(e) {
1126
1126
  if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) {
@@ -1161,9 +1161,9 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1161
1161
  ...this.options,
1162
1162
  ...o
1163
1163
  };
1164
- Array.isArray(i) && !s && (c.ns = i), typeof o.keyPrefix == "function" && (o.keyPrefix = F(o.keyPrefix, c));
1164
+ Array.isArray(i) && !s && (c.ns = i), typeof o.keyPrefix == "function" && (o.keyPrefix = N(o.keyPrefix, c));
1165
1165
  let l = this.options.keySeparator || ".", u;
1166
- return o.keyPrefix && Array.isArray(e) ? u = e.map((e) => (typeof e == "function" && (e = F(e, c)), `${o.keyPrefix}${l}${e}`)) : (typeof e == "function" && (e = F(e, c)), u = o.keyPrefix ? `${o.keyPrefix}${l}${e}` : e), this.t(u, o);
1166
+ return o.keyPrefix && Array.isArray(e) ? u = e.map((e) => (typeof e == "function" && (e = N(e, c)), `${o.keyPrefix}${l}${e}`)) : (typeof e == "function" && (e = N(e, c)), u = o.keyPrefix ? `${o.keyPrefix}${l}${e}` : e), this.t(u, o);
1167
1167
  };
1168
1168
  return c(e) ? a.lng = e : a.lngs = e, a.ns = t, a.keyPrefix = n, a;
1169
1169
  }
@@ -1216,14 +1216,14 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1216
1216
  if (e && e.direction) return e.direction;
1217
1217
  }
1218
1218
  } catch {}
1219
- let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new R(q());
1219
+ let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new ae(R());
1220
1220
  return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.includes(n.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1221
1221
  }
1222
1222
  static createInstance(t = {}, n) {
1223
1223
  let r = new e(t, n);
1224
1224
  return r.createInstance = e.createInstance, r;
1225
1225
  }
1226
- cloneInstance(t = {}, n = Y) {
1226
+ cloneInstance(t = {}, n = B) {
1227
1227
  let r = t.forkResourceStore;
1228
1228
  r && delete t.forkResourceStore;
1229
1229
  let i = {
@@ -1237,18 +1237,18 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1237
1237
  "language"
1238
1238
  ].forEach((e) => {
1239
1239
  a[e] = this[e];
1240
- }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new M(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
1240
+ }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new A(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
1241
1241
  let e = {
1242
- ...q().interpolation,
1242
+ ...R().interpolation,
1243
1243
  ...this.options.interpolation,
1244
1244
  ...t.interpolation
1245
1245
  }, n = {
1246
1246
  ...i,
1247
1247
  interpolation: e
1248
1248
  };
1249
- a.services.interpolator = new W(n);
1249
+ a.services.interpolator = new I(n);
1250
1250
  }
1251
- return a.translator = new L(a.services, i), a.translator.on("*", (e, ...t) => {
1251
+ return a.translator = new ie(a.services, i), a.translator.on("*", (e, ...t) => {
1252
1252
  a.emit(e, ...t);
1253
1253
  }), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
1254
1254
  }
@@ -1262,8 +1262,8 @@ var I = (e) => !c(e) && typeof e != "boolean" && typeof e != "number", L = class
1262
1262
  };
1263
1263
  }
1264
1264
  }.createInstance();
1265
- X.createInstance, X.dir, X.init, X.loadResources, X.reloadResources, X.use, X.changeLanguage, X.getFixedT, X.t, X.exists, X.setDefaultNamespace, X.hasLoadedNamespace, X.loadNamespaces, X.loadLanguages;
1266
- var se = {
1265
+ V.createInstance, V.dir, V.init, V.loadResources, V.reloadResources, V.use, V.changeLanguage, V.getFixedT, V.t, V.exists, V.setDefaultNamespace, V.hasLoadedNamespace, V.loadNamespaces, V.loadLanguages;
1266
+ var ge = {
1267
1267
  tools: {
1268
1268
  draw: "Draw",
1269
1269
  measure: "Measure",
@@ -1282,62 +1282,1277 @@ var se = {
1282
1282
  ok: "OK",
1283
1283
  loading: "Loading..."
1284
1284
  }
1285
- }, Z = X.createInstance(), Q = !1;
1286
- async function ce() {
1287
- Q || (Q = !0, await Z.init({
1285
+ }, H = V.createInstance(), U = !1;
1286
+ async function _e() {
1287
+ U || (U = !0, await H.init({
1288
1288
  lng: "en",
1289
1289
  fallbackLng: "en",
1290
1290
  ns: ["webmapx"],
1291
1291
  defaultNS: "webmapx",
1292
- resources: { en: { webmapx: se } },
1292
+ resources: { en: { webmapx: ge } },
1293
1293
  interpolation: { escapeValue: !1 }
1294
1294
  }));
1295
1295
  }
1296
- function le(e, t) {
1297
- return Z.t(e, t);
1296
+ function ve(e, t) {
1297
+ return H.t(e, t);
1298
1298
  }
1299
1299
  //#endregion
1300
1300
  //#region src/bootstrap/locale-loader.ts
1301
- var ue = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.4/src/locales";
1302
- async function $(e) {
1303
- if (Z.hasResourceBundle(e, "webmapx")) {
1304
- await Z.changeLanguage(e);
1301
+ var ye = "https://cdn.jsdelivr.net/npm/@edugis-org/webmapx@0.1.5/src/locales";
1302
+ async function W(e) {
1303
+ if (H.hasResourceBundle(e, "webmapx")) {
1304
+ await H.changeLanguage(e);
1305
1305
  return;
1306
1306
  }
1307
1307
  try {
1308
- let t = `${ue}/${e}/core.json`, n = await fetch(t).then((e) => {
1308
+ let t = `${ye}/${e}/core.json`, n = await fetch(t).then((e) => {
1309
1309
  if (!e.ok) throw Error(`HTTP ${e.status}`);
1310
1310
  return e.json();
1311
1311
  });
1312
- Z.addResourceBundle(e, "webmapx", n), await Z.changeLanguage(e);
1312
+ H.addResourceBundle(e, "webmapx", n), await H.changeLanguage(e);
1313
1313
  } catch (t) {
1314
1314
  console.error(`[webmapx] Failed to load locale "${e}", falling back to EN`, t);
1315
1315
  }
1316
1316
  }
1317
1317
  //#endregion
1318
+ //#region src/config/validator.ts
1319
+ var be = new Set(["nominatim"]), G = {
1320
+ root: [
1321
+ "version",
1322
+ "project",
1323
+ "map",
1324
+ "runtimeMap",
1325
+ "layerData",
1326
+ "catalog",
1327
+ "library",
1328
+ "state",
1329
+ "ui",
1330
+ "tools"
1331
+ ],
1332
+ map: [
1333
+ "label",
1334
+ "center",
1335
+ "zoom",
1336
+ "minZoom",
1337
+ "maxZoom",
1338
+ "minPitch",
1339
+ "maxPitch",
1340
+ "type",
1341
+ "style",
1342
+ "styleUrl"
1343
+ ],
1344
+ runtimeMap: [
1345
+ "minZoom",
1346
+ "maxZoom",
1347
+ "minPitch",
1348
+ "maxPitch"
1349
+ ],
1350
+ layerData: ["sources", "layers"],
1351
+ catalog: [
1352
+ "label",
1353
+ "tree",
1354
+ "sources",
1355
+ "layers"
1356
+ ],
1357
+ treeNode: [
1358
+ "label",
1359
+ "layerId",
1360
+ "selectionMode",
1361
+ "selectionGroup",
1362
+ "allowNone",
1363
+ "stackOrder",
1364
+ "checked",
1365
+ "expanded",
1366
+ "children",
1367
+ "separator"
1368
+ ],
1369
+ state: [
1370
+ "activeBackground",
1371
+ "activeLayers",
1372
+ "activeExclusiveLayers"
1373
+ ],
1374
+ stateLayer: [
1375
+ "id",
1376
+ "ref",
1377
+ "layerId",
1378
+ "visible",
1379
+ "timeState",
1380
+ "paint",
1381
+ "layout",
1382
+ "metadata",
1383
+ "source",
1384
+ "type"
1385
+ ],
1386
+ sourceBase: [
1387
+ "id",
1388
+ "type",
1389
+ "attribution"
1390
+ ],
1391
+ sourceRaster: [
1392
+ "service",
1393
+ "url",
1394
+ "tiles",
1395
+ "tileSize",
1396
+ "minzoom",
1397
+ "maxzoom",
1398
+ "bounds",
1399
+ "scheme",
1400
+ "volatile",
1401
+ "attribution",
1402
+ "layers",
1403
+ "format",
1404
+ "transparent",
1405
+ "version",
1406
+ "crs"
1407
+ ],
1408
+ sourceGeojson: [
1409
+ "data",
1410
+ "attribution",
1411
+ "minzoom",
1412
+ "maxzoom",
1413
+ "bounds",
1414
+ "buffer",
1415
+ "tolerance",
1416
+ "cluster",
1417
+ "clusterRadius",
1418
+ "clusterMaxZoom",
1419
+ "lineMetrics",
1420
+ "generateId"
1421
+ ],
1422
+ sourceVector: [
1423
+ "url",
1424
+ "tiles",
1425
+ "bounds",
1426
+ "scheme",
1427
+ "minzoom",
1428
+ "maxzoom",
1429
+ "attribution",
1430
+ "volatile"
1431
+ ],
1432
+ sourceRasterDem: [
1433
+ "tiles",
1434
+ "tileSize",
1435
+ "encoding",
1436
+ "maxzoom",
1437
+ "attribution"
1438
+ ],
1439
+ layer: [
1440
+ "id",
1441
+ "type",
1442
+ "source",
1443
+ "source-layer",
1444
+ "sources",
1445
+ "layers",
1446
+ "url",
1447
+ "annotation",
1448
+ "fallbackLayerId",
1449
+ "singleGroup",
1450
+ "title",
1451
+ "metadata",
1452
+ "minzoom",
1453
+ "maxzoom",
1454
+ "paint",
1455
+ "layout",
1456
+ "filter",
1457
+ "featureInfoLimit"
1458
+ ],
1459
+ styleLayer: [
1460
+ "id",
1461
+ "type",
1462
+ "source",
1463
+ "sourceLayer",
1464
+ "source-layer",
1465
+ "metadata",
1466
+ "minzoom",
1467
+ "maxzoom",
1468
+ "paint",
1469
+ "layout",
1470
+ "filter"
1471
+ ],
1472
+ tool: [
1473
+ "enabled",
1474
+ "label",
1475
+ "icon",
1476
+ "element"
1477
+ ],
1478
+ toolInsetMap: [
1479
+ "enabled",
1480
+ "type",
1481
+ "position",
1482
+ "label",
1483
+ "icon",
1484
+ "element",
1485
+ "zoomOffset",
1486
+ "baseScale",
1487
+ "styleUrl",
1488
+ "background"
1489
+ ],
1490
+ toolInsetMapBackground: [
1491
+ "service",
1492
+ "url",
1493
+ "tiles",
1494
+ "attribution",
1495
+ "tileSize"
1496
+ ],
1497
+ toolSearch: [
1498
+ "enabled",
1499
+ "type",
1500
+ "label",
1501
+ "title",
1502
+ "icon",
1503
+ "element",
1504
+ "endpoint",
1505
+ "params",
1506
+ "maxResults",
1507
+ "defaultZoom",
1508
+ "marker",
1509
+ "persistOnSelect",
1510
+ "provider",
1511
+ "attribution"
1512
+ ]
1513
+ }, K = [
1514
+ "maplibre",
1515
+ "openlayers",
1516
+ "leaflet",
1517
+ "cesium"
1518
+ ], xe = [
1519
+ "raster",
1520
+ "geojson",
1521
+ "vector",
1522
+ "raster-dem"
1523
+ ], Se = [
1524
+ "xyz",
1525
+ "wms",
1526
+ "wmts"
1527
+ ], q = [
1528
+ "background",
1529
+ "fill",
1530
+ "line",
1531
+ "circle",
1532
+ "symbol",
1533
+ "raster",
1534
+ "fill-extrusion",
1535
+ "heatmap",
1536
+ "hillshade"
1537
+ ], Ce = ["multiple", "single"];
1538
+ function we(e) {
1539
+ let t = [], n = [];
1540
+ if (!J(e)) return t.push({
1541
+ severity: "error",
1542
+ path: "",
1543
+ message: "Configuration must be an object"
1544
+ }), {
1545
+ valid: !1,
1546
+ errors: t,
1547
+ warnings: n
1548
+ };
1549
+ let r = e;
1550
+ Y(r, G.root, "", n), Ee(r.map, t, n), De(r.runtimeMap, t, n);
1551
+ let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1552
+ if (r.layerData !== void 0 && ({sourceIds: i, layerIds: a} = Te(r.layerData, t, n, "layerData")), r.catalog !== void 0) {
1553
+ n.push({
1554
+ severity: "warning",
1555
+ path: "catalog",
1556
+ message: "\"catalog\" is deprecated; use \"layerData\" and place tree under layerTree tool config"
1557
+ });
1558
+ let e = Oe(r.catalog, t, n);
1559
+ r.layerData === void 0 && (e.sourceIds, a = e.layerIds);
1560
+ }
1561
+ return r.layerData === void 0 && r.catalog === void 0 && t.push({
1562
+ severity: "error",
1563
+ path: "layerData",
1564
+ message: "Missing required \"layerData\" section"
1565
+ }), ke(r.state, a, t, n), r.tools !== void 0 && Fe(r.tools, "tools", a, t, n), {
1566
+ valid: t.length === 0,
1567
+ errors: t,
1568
+ warnings: n
1569
+ };
1570
+ }
1571
+ function Te(e, t, n, r) {
1572
+ let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1573
+ if (!J(e)) return t.push({
1574
+ severity: "error",
1575
+ path: r,
1576
+ message: `"${r}" must be an object`
1577
+ }), {
1578
+ sourceIds: i,
1579
+ layerIds: a
1580
+ };
1581
+ let o = e;
1582
+ return Y(o, G.layerData, r, n), o.sources === void 0 ? t.push({
1583
+ severity: "error",
1584
+ path: `${r}.sources`,
1585
+ message: "Missing required \"sources\" array"
1586
+ }) : Array.isArray(o.sources) ? Ae(o.sources, `${r}.sources`, i, t, n) : t.push({
1587
+ severity: "error",
1588
+ path: `${r}.sources`,
1589
+ message: "\"sources\" must be an array"
1590
+ }), o.layers === void 0 ? t.push({
1591
+ severity: "error",
1592
+ path: `${r}.layers`,
1593
+ message: "Missing required \"layers\" array"
1594
+ }) : Array.isArray(o.layers) ? (je(o.layers, `${r}.layers`, i, a, t, n), o.layers.forEach((e, n) => {
1595
+ if (!J(e)) return;
1596
+ let i = e, o = `${r}.layers[${n}]`;
1597
+ if (i.fallbackLayerId !== void 0 && typeof i.fallbackLayerId != "string") {
1598
+ t.push({
1599
+ severity: "error",
1600
+ path: `${o}.fallbackLayerId`,
1601
+ message: "\"fallbackLayerId\" must be a string"
1602
+ });
1603
+ return;
1604
+ }
1605
+ typeof i.fallbackLayerId == "string" && !a.has(i.fallbackLayerId) && t.push({
1606
+ severity: "error",
1607
+ path: `${o}.fallbackLayerId`,
1608
+ message: `Layer "${i.fallbackLayerId}" not found in layers`
1609
+ });
1610
+ })) : t.push({
1611
+ severity: "error",
1612
+ path: `${r}.layers`,
1613
+ message: "\"layers\" must be an array"
1614
+ }), {
1615
+ sourceIds: i,
1616
+ layerIds: a
1617
+ };
1618
+ }
1619
+ function Ee(e, t, n) {
1620
+ if (e === void 0) {
1621
+ t.push({
1622
+ severity: "error",
1623
+ path: "map",
1624
+ message: "Missing required \"map\" section"
1625
+ });
1626
+ return;
1627
+ }
1628
+ if (!J(e)) {
1629
+ t.push({
1630
+ severity: "error",
1631
+ path: "map",
1632
+ message: "\"map\" must be an object"
1633
+ });
1634
+ return;
1635
+ }
1636
+ let r = e;
1637
+ Y(r, G.map, "map", n), r.center === void 0 ? t.push({
1638
+ severity: "error",
1639
+ path: "map.center",
1640
+ message: "Missing required \"center\""
1641
+ }) : Re(r.center) || t.push({
1642
+ severity: "error",
1643
+ path: "map.center",
1644
+ message: "\"center\" must be [longitude, latitude] array with valid values"
1645
+ }), r.zoom === void 0 ? t.push({
1646
+ severity: "error",
1647
+ path: "map.zoom",
1648
+ message: "Missing required \"zoom\""
1649
+ }) : (typeof r.zoom != "number" || r.zoom < 0 || r.zoom > 24) && t.push({
1650
+ severity: "error",
1651
+ path: "map.zoom",
1652
+ message: "\"zoom\" must be a number between 0 and 24"
1653
+ }), r.type === void 0 ? t.push({
1654
+ severity: "error",
1655
+ path: "map.type",
1656
+ message: "Missing required \"type\""
1657
+ }) : K.includes(r.type) || t.push({
1658
+ severity: "error",
1659
+ path: "map.type",
1660
+ message: `"type" must be one of: ${K.join(", ")}`
1661
+ }), r.minZoom !== void 0 && (typeof r.minZoom != "number" || r.minZoom < 0 || r.minZoom > 24) ? t.push({
1662
+ severity: "error",
1663
+ path: "map.minZoom",
1664
+ message: "\"minZoom\" must be a number between 0 and 24"
1665
+ }) : r.minZoom !== void 0 && n.push({
1666
+ severity: "warning",
1667
+ path: "map.minZoom",
1668
+ message: "\"map.minZoom\" is deprecated; use \"runtimeMap.minZoom\""
1669
+ }), r.maxZoom !== void 0 && (typeof r.maxZoom != "number" || r.maxZoom < 0 || r.maxZoom > 24) ? t.push({
1670
+ severity: "error",
1671
+ path: "map.maxZoom",
1672
+ message: "\"maxZoom\" must be a number between 0 and 24"
1673
+ }) : r.maxZoom !== void 0 && n.push({
1674
+ severity: "warning",
1675
+ path: "map.maxZoom",
1676
+ message: "\"map.maxZoom\" is deprecated; use \"runtimeMap.maxZoom\""
1677
+ }), typeof r.minZoom == "number" && typeof r.maxZoom == "number" && r.minZoom > r.maxZoom && t.push({
1678
+ severity: "error",
1679
+ path: "map.minZoom",
1680
+ message: "\"minZoom\" cannot be greater than \"maxZoom\""
1681
+ }), r.minPitch !== void 0 && (typeof r.minPitch != "number" || r.minPitch < 0 || r.minPitch > 85) ? t.push({
1682
+ severity: "error",
1683
+ path: "map.minPitch",
1684
+ message: "\"minPitch\" must be a number between 0 and 85"
1685
+ }) : r.minPitch !== void 0 && n.push({
1686
+ severity: "warning",
1687
+ path: "map.minPitch",
1688
+ message: "\"map.minPitch\" is deprecated; use \"runtimeMap.minPitch\""
1689
+ }), r.maxPitch !== void 0 && (typeof r.maxPitch != "number" || r.maxPitch < 0 || r.maxPitch > 85) ? t.push({
1690
+ severity: "error",
1691
+ path: "map.maxPitch",
1692
+ message: "\"maxPitch\" must be a number between 0 and 85"
1693
+ }) : r.maxPitch !== void 0 && n.push({
1694
+ severity: "warning",
1695
+ path: "map.maxPitch",
1696
+ message: "\"map.maxPitch\" is deprecated; use \"runtimeMap.maxPitch\""
1697
+ }), typeof r.minPitch == "number" && typeof r.maxPitch == "number" && r.minPitch > r.maxPitch && t.push({
1698
+ severity: "error",
1699
+ path: "map.minPitch",
1700
+ message: "\"minPitch\" cannot be greater than \"maxPitch\""
1701
+ });
1702
+ }
1703
+ function De(e, t, n) {
1704
+ let r = "runtimeMap";
1705
+ if (e === void 0) return;
1706
+ if (!J(e)) {
1707
+ t.push({
1708
+ severity: "error",
1709
+ path: r,
1710
+ message: "\"runtimeMap\" must be an object"
1711
+ });
1712
+ return;
1713
+ }
1714
+ let i = e;
1715
+ Y(i, G.runtimeMap, r, n), i.minZoom !== void 0 && (typeof i.minZoom != "number" || i.minZoom < 0 || i.minZoom > 24) && t.push({
1716
+ severity: "error",
1717
+ path: `${r}.minZoom`,
1718
+ message: "\"minZoom\" must be a number between 0 and 24"
1719
+ }), i.maxZoom !== void 0 && (typeof i.maxZoom != "number" || i.maxZoom < 0 || i.maxZoom > 24) && t.push({
1720
+ severity: "error",
1721
+ path: `${r}.maxZoom`,
1722
+ message: "\"maxZoom\" must be a number between 0 and 24"
1723
+ }), typeof i.minZoom == "number" && typeof i.maxZoom == "number" && i.minZoom > i.maxZoom && t.push({
1724
+ severity: "error",
1725
+ path: `${r}.minZoom`,
1726
+ message: "\"minZoom\" cannot be greater than \"maxZoom\""
1727
+ }), i.minPitch !== void 0 && (typeof i.minPitch != "number" || i.minPitch < 0 || i.minPitch > 85) && t.push({
1728
+ severity: "error",
1729
+ path: `${r}.minPitch`,
1730
+ message: "\"minPitch\" must be a number between 0 and 85"
1731
+ }), i.maxPitch !== void 0 && (typeof i.maxPitch != "number" || i.maxPitch < 0 || i.maxPitch > 85) && t.push({
1732
+ severity: "error",
1733
+ path: `${r}.maxPitch`,
1734
+ message: "\"maxPitch\" must be a number between 0 and 85"
1735
+ }), typeof i.minPitch == "number" && typeof i.maxPitch == "number" && i.minPitch > i.maxPitch && t.push({
1736
+ severity: "error",
1737
+ path: `${r}.minPitch`,
1738
+ message: "\"minPitch\" cannot be greater than \"maxPitch\""
1739
+ });
1740
+ }
1741
+ function Oe(e, t, n) {
1742
+ let r = "catalog", i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1743
+ if (e === void 0) return t.push({
1744
+ severity: "error",
1745
+ path: r,
1746
+ message: "Missing required \"catalog\" section"
1747
+ }), {
1748
+ sourceIds: i,
1749
+ layerIds: a
1750
+ };
1751
+ if (!J(e)) return t.push({
1752
+ severity: "error",
1753
+ path: r,
1754
+ message: "\"catalog\" must be an object"
1755
+ }), {
1756
+ sourceIds: i,
1757
+ layerIds: a
1758
+ };
1759
+ let o = e;
1760
+ return Y(o, G.catalog, r, n), o.sources === void 0 ? t.push({
1761
+ severity: "error",
1762
+ path: `${r}.sources`,
1763
+ message: "Missing required \"sources\" array"
1764
+ }) : Array.isArray(o.sources) ? Ae(o.sources, `${r}.sources`, i, t, n) : t.push({
1765
+ severity: "error",
1766
+ path: `${r}.sources`,
1767
+ message: "\"sources\" must be an array"
1768
+ }), o.layers === void 0 ? t.push({
1769
+ severity: "error",
1770
+ path: `${r}.layers`,
1771
+ message: "Missing required \"layers\" array"
1772
+ }) : Array.isArray(o.layers) ? (je(o.layers, `${r}.layers`, i, a, t, n), o.layers.forEach((e, n) => {
1773
+ if (!J(e)) return;
1774
+ let i = e, o = `${r}.layers[${n}]`;
1775
+ if (i.fallbackLayerId !== void 0 && typeof i.fallbackLayerId != "string") {
1776
+ t.push({
1777
+ severity: "error",
1778
+ path: `${o}.fallbackLayerId`,
1779
+ message: "\"fallbackLayerId\" must be a string"
1780
+ });
1781
+ return;
1782
+ }
1783
+ typeof i.fallbackLayerId == "string" && !a.has(i.fallbackLayerId) && t.push({
1784
+ severity: "error",
1785
+ path: `${o}.fallbackLayerId`,
1786
+ message: `Layer "${i.fallbackLayerId}" not found in layers`
1787
+ });
1788
+ })) : t.push({
1789
+ severity: "error",
1790
+ path: `${r}.layers`,
1791
+ message: "\"layers\" must be an array"
1792
+ }), o.tree === void 0 ? t.push({
1793
+ severity: "error",
1794
+ path: `${r}.tree`,
1795
+ message: "Missing required \"tree\" array"
1796
+ }) : Array.isArray(o.tree) ? Ne(o.tree, `${r}.tree`, a, t, n) : t.push({
1797
+ severity: "error",
1798
+ path: `${r}.tree`,
1799
+ message: "\"tree\" must be an array"
1800
+ }), {
1801
+ sourceIds: i,
1802
+ layerIds: a
1803
+ };
1804
+ }
1805
+ function ke(e, t, n, r) {
1806
+ let i = "state";
1807
+ if (e === void 0) return;
1808
+ if (!J(e)) {
1809
+ n.push({
1810
+ severity: "error",
1811
+ path: i,
1812
+ message: "\"state\" must be an object"
1813
+ });
1814
+ return;
1815
+ }
1816
+ let a = e;
1817
+ Y(a, G.state, i, r), a.activeBackground !== void 0 && typeof a.activeBackground != "string" && n.push({
1818
+ severity: "error",
1819
+ path: `${i}.activeBackground`,
1820
+ message: "\"activeBackground\" must be a string"
1821
+ }), a.activeLayers === void 0 || (Array.isArray(a.activeLayers) ? a.activeLayers.forEach((e, a) => {
1822
+ let o = `${i}.activeLayers[${a}]`;
1823
+ if (typeof e == "string") {
1824
+ t.has(e) || n.push({
1825
+ severity: "error",
1826
+ path: o,
1827
+ message: `Layer "${e}" not found in layers`
1828
+ });
1829
+ return;
1830
+ }
1831
+ if (!J(e)) {
1832
+ n.push({
1833
+ severity: "error",
1834
+ path: o,
1835
+ message: "Active layer entry must be a string ref or object"
1836
+ });
1837
+ return;
1838
+ }
1839
+ let s = e;
1840
+ Y(s, G.stateLayer, o, r);
1841
+ let c = typeof s.ref == "string" ? s.ref : typeof s.layerId == "string" ? s.layerId : null;
1842
+ c && !t.has(c) && n.push({
1843
+ severity: "error",
1844
+ path: `${o}.ref`,
1845
+ message: `Layer "${c}" not found in layers`
1846
+ }), s.visible !== void 0 && typeof s.visible != "boolean" && n.push({
1847
+ severity: "error",
1848
+ path: `${o}.visible`,
1849
+ message: "\"visible\" must be a boolean"
1850
+ });
1851
+ }) : n.push({
1852
+ severity: "error",
1853
+ path: `${i}.activeLayers`,
1854
+ message: "\"activeLayers\" must be an array"
1855
+ })), a.activeExclusiveLayers !== void 0 && (J(a.activeExclusiveLayers) ? Object.entries(a.activeExclusiveLayers).forEach(([e, r]) => {
1856
+ let a = `${i}.activeExclusiveLayers.${e}`;
1857
+ if (typeof r != "string" || r.length === 0) {
1858
+ n.push({
1859
+ severity: "error",
1860
+ path: a,
1861
+ message: "Exclusive group value must be a non-empty layer id string"
1862
+ });
1863
+ return;
1864
+ }
1865
+ t.has(r) || n.push({
1866
+ severity: "error",
1867
+ path: a,
1868
+ message: `Layer "${r}" not found in layers`
1869
+ });
1870
+ }) : n.push({
1871
+ severity: "error",
1872
+ path: `${i}.activeExclusiveLayers`,
1873
+ message: "\"activeExclusiveLayers\" must be an object"
1874
+ }));
1875
+ }
1876
+ function Ae(e, t, n, r, i) {
1877
+ e.forEach((e, a) => {
1878
+ let o = `${t}[${a}]`;
1879
+ if (!J(e)) {
1880
+ r.push({
1881
+ severity: "error",
1882
+ path: o,
1883
+ message: "Source must be an object"
1884
+ });
1885
+ return;
1886
+ }
1887
+ let s = e;
1888
+ if (typeof s.id != "string" || s.id.length === 0 ? r.push({
1889
+ severity: "error",
1890
+ path: `${o}.id`,
1891
+ message: "Source must have a non-empty string \"id\""
1892
+ }) : (n.has(s.id) && r.push({
1893
+ severity: "error",
1894
+ path: `${o}.id`,
1895
+ message: `Duplicate source ID: "${s.id}"`
1896
+ }), n.add(s.id)), !xe.includes(s.type)) {
1897
+ r.push({
1898
+ severity: "error",
1899
+ path: `${o}.type`,
1900
+ message: `Source "type" must be one of: ${xe.join(", ")}`
1901
+ });
1902
+ return;
1903
+ }
1904
+ let c = [...G.sourceBase];
1905
+ if (s.type === "raster") {
1906
+ c.push(...G.sourceRaster);
1907
+ let e = typeof s.url == "string" && s.url.length > 0, t = Array.isArray(s.url) && s.url.length > 0 && s.url.every((e) => typeof e == "string" && e.length > 0);
1908
+ !e && !t && r.push({
1909
+ severity: "error",
1910
+ path: `${o}.url`,
1911
+ message: "Raster source requires a non-empty string \"url\" or string array"
1912
+ }), s.service !== void 0 && !Se.includes(s.service) && r.push({
1913
+ severity: "error",
1914
+ path: `${o}.service`,
1915
+ message: `Raster "service" must be one of: ${Se.join(", ")}`
1916
+ }), s.tileSize !== void 0 && (typeof s.tileSize != "number" || s.tileSize <= 0) && r.push({
1917
+ severity: "error",
1918
+ path: `${o}.tileSize`,
1919
+ message: "\"tileSize\" must be a positive number"
1920
+ }), s.minZoom !== void 0 && r.push({
1921
+ severity: "error",
1922
+ path: `${o}.minZoom`,
1923
+ message: "\"minZoom\" is not supported; use \"minzoom\" (Mapbox/MapLibre style spec)"
1924
+ }), s.maxZoom !== void 0 && r.push({
1925
+ severity: "error",
1926
+ path: `${o}.maxZoom`,
1927
+ message: "\"maxZoom\" is not supported; use \"maxzoom\" (Mapbox/MapLibre style spec)"
1928
+ });
1929
+ let n = s.minzoom, i = s.maxzoom;
1930
+ n !== void 0 && (typeof n != "number" || n < 0 || n > 24) && r.push({
1931
+ severity: "error",
1932
+ path: `${o}.minzoom`,
1933
+ message: "\"minzoom\" must be a number between 0 and 24"
1934
+ }), i !== void 0 && (typeof i != "number" || i < 0 || i > 24) && r.push({
1935
+ severity: "error",
1936
+ path: `${o}.maxzoom`,
1937
+ message: "\"maxzoom\" must be a number between 0 and 24"
1938
+ }), typeof n == "number" && typeof i == "number" && n > i && r.push({
1939
+ severity: "error",
1940
+ path: `${o}.minzoom`,
1941
+ message: "\"minzoom\" cannot be greater than \"maxzoom\""
1942
+ });
1943
+ } else if (s.type === "geojson") c.push(...G.sourceGeojson), s.data === void 0 ? r.push({
1944
+ severity: "error",
1945
+ path: `${o}.data`,
1946
+ message: "GeoJSON source requires \"data\""
1947
+ }) : typeof s.data != "string" && !J(s.data) && r.push({
1948
+ severity: "error",
1949
+ path: `${o}.data`,
1950
+ message: "\"data\" must be a URL string or GeoJSON object"
1951
+ });
1952
+ else if (s.type === "vector") {
1953
+ c.push(...G.sourceVector);
1954
+ let e = typeof s.url == "string" && s.url.length > 0, t = Array.isArray(s.tiles) && s.tiles.length > 0;
1955
+ !e && !t && r.push({
1956
+ severity: "error",
1957
+ path: `${o}.url`,
1958
+ message: "Vector source requires a \"url\" or \"tiles\""
1959
+ });
1960
+ } else s.type === "raster-dem" && (c.push(...G.sourceRasterDem), Array.isArray(s.tiles) && s.tiles.length > 0 && s.tiles.every((e) => typeof e == "string" && e.length > 0) || r.push({
1961
+ severity: "error",
1962
+ path: `${o}.tiles`,
1963
+ message: "Raster-dem source requires a non-empty \"tiles\" string array"
1964
+ }));
1965
+ Y(s, c, o, i), s.attribution === void 0 && i.push({
1966
+ severity: "warning",
1967
+ path: o,
1968
+ message: "Source is missing \"attribution\""
1969
+ });
1970
+ });
1971
+ }
1972
+ function je(e, t, n, r, i, a) {
1973
+ e.forEach((e, o) => {
1974
+ let s = `${t}[${o}]`;
1975
+ if (!J(e)) {
1976
+ i.push({
1977
+ severity: "error",
1978
+ path: s,
1979
+ message: "Layer must be an object"
1980
+ });
1981
+ return;
1982
+ }
1983
+ let c = e;
1984
+ Y(c, c.type === "style" ? [
1985
+ ...G.layer,
1986
+ "attribution",
1987
+ "version"
1988
+ ] : G.layer, s, a), typeof c.id != "string" || c.id.length === 0 ? i.push({
1989
+ severity: "error",
1990
+ path: `${s}.id`,
1991
+ message: "Layer must have a non-empty string \"id\""
1992
+ }) : (r.has(c.id) && i.push({
1993
+ severity: "error",
1994
+ path: `${s}.id`,
1995
+ message: `Duplicate layer ID: "${c.id}"`
1996
+ }), r.add(c.id));
1997
+ let l = c.type;
1998
+ l === "allmaps" ? (typeof c.annotation != "string" || c.annotation.length === 0) && i.push({
1999
+ severity: "error",
2000
+ path: `${s}.annotation`,
2001
+ message: "Allmaps layer must have an \"annotation\" URL"
2002
+ }) : l === "style" ? Array.isArray(c.layers) && c.layers.length > 0 && Me(c.layers, `${s}.layers`, n, i, a) : typeof l == "string" && q.includes(l) ? typeof c.source != "string" && a.push({
2003
+ severity: "warning",
2004
+ path: `${s}.source`,
2005
+ message: "Standard layer should have a \"source\""
2006
+ }) : l !== void 0 && i.push({
2007
+ severity: "error",
2008
+ path: `${s}.type`,
2009
+ message: `Unknown layer type: "${l}"`
2010
+ });
2011
+ });
2012
+ }
2013
+ function Me(e, t, n, r, i) {
2014
+ e.forEach((e, a) => {
2015
+ let o = `${t}[${a}]`;
2016
+ if (!J(e)) {
2017
+ r.push({
2018
+ severity: "error",
2019
+ path: o,
2020
+ message: "Style layer must be an object"
2021
+ });
2022
+ return;
2023
+ }
2024
+ let s = e;
2025
+ Y(s, G.styleLayer, o, i), s.minZoom !== void 0 && r.push({
2026
+ severity: "error",
2027
+ path: `${o}.minZoom`,
2028
+ message: "\"minZoom\" is not supported; use \"minzoom\" (Mapbox/MapLibre style spec)"
2029
+ }), s.maxZoom !== void 0 && r.push({
2030
+ severity: "error",
2031
+ path: `${o}.maxZoom`,
2032
+ message: "\"maxZoom\" is not supported; use \"maxzoom\" (Mapbox/MapLibre style spec)"
2033
+ }), q.includes(s.type) || r.push({
2034
+ severity: "error",
2035
+ path: `${o}.type`,
2036
+ message: `Style layer "type" must be one of: ${q.join(", ")}`
2037
+ }), s.type !== "background" && (typeof s.source != "string" || s.source.length === 0 ? r.push({
2038
+ severity: "error",
2039
+ path: `${o}.source`,
2040
+ message: "Style layer must have a \"source\""
2041
+ }) : n.has(s.source) || r.push({
2042
+ severity: "error",
2043
+ path: `${o}.source`,
2044
+ message: `Source "${s.source}" not found in sources`
2045
+ }), s.minzoom !== void 0 && (typeof s.minzoom != "number" || s.minzoom < 0 || s.minzoom > 24) && r.push({
2046
+ severity: "error",
2047
+ path: `${o}.minzoom`,
2048
+ message: "\"minzoom\" must be a number between 0 and 24"
2049
+ }), s.maxzoom !== void 0 && (typeof s.maxzoom != "number" || s.maxzoom < 0 || s.maxzoom > 24) && r.push({
2050
+ severity: "error",
2051
+ path: `${o}.maxzoom`,
2052
+ message: "\"maxzoom\" must be a number between 0 and 24"
2053
+ }));
2054
+ });
2055
+ }
2056
+ function Ne(e, t, n, r, i) {
2057
+ e.forEach((e, a) => {
2058
+ Pe(e, `${t}[${a}]`, n, r, i);
2059
+ });
2060
+ }
2061
+ function Pe(e, t, n, r, i) {
2062
+ if (!J(e)) {
2063
+ r.push({
2064
+ severity: "error",
2065
+ path: t,
2066
+ message: "Tree node must be an object"
2067
+ });
2068
+ return;
2069
+ }
2070
+ let a = e;
2071
+ if (Y(a, G.treeNode, t, i), a.separator === !0) {
2072
+ (typeof a.label != "string" || a.label.length === 0) && r.push({
2073
+ severity: "error",
2074
+ path: `${t}.label`,
2075
+ message: "Separator node must have a non-empty \"label\""
2076
+ });
2077
+ return;
2078
+ }
2079
+ !(typeof a.layerId == "string" && a.layerId.length > 0) && (typeof a.label != "string" || a.label.length === 0) && r.push({
2080
+ severity: "error",
2081
+ path: `${t}.label`,
2082
+ message: "Tree node must have a non-empty \"label\""
2083
+ });
2084
+ let o = a.layerId !== void 0, s = a.children !== void 0;
2085
+ o && s && i.push({
2086
+ severity: "warning",
2087
+ path: t,
2088
+ message: "Tree node has both \"layerId\" and \"children\" - consider separating leaf and group nodes"
2089
+ }), o && (typeof a.layerId == "string" ? n.has(a.layerId) || r.push({
2090
+ severity: "error",
2091
+ path: `${t}.layerId`,
2092
+ message: `Layer "${a.layerId}" not found in layers`
2093
+ }) : r.push({
2094
+ severity: "error",
2095
+ path: `${t}.layerId`,
2096
+ message: "\"layerId\" must be a string"
2097
+ })), s && (Array.isArray(a.children) ? a.children.forEach((e, a) => {
2098
+ Pe(e, `${t}.children[${a}]`, n, r, i);
2099
+ }) : r.push({
2100
+ severity: "error",
2101
+ path: `${t}.children`,
2102
+ message: "\"children\" must be an array"
2103
+ })), a.checked !== void 0 && typeof a.checked != "boolean" && r.push({
2104
+ severity: "error",
2105
+ path: `${t}.checked`,
2106
+ message: "\"checked\" must be a boolean"
2107
+ }), a.expanded !== void 0 && typeof a.expanded != "boolean" && r.push({
2108
+ severity: "error",
2109
+ path: `${t}.expanded`,
2110
+ message: "\"expanded\" must be a boolean"
2111
+ }), a.selectionMode !== void 0 && !Ce.includes(a.selectionMode) && r.push({
2112
+ severity: "error",
2113
+ path: `${t}.selectionMode`,
2114
+ message: `"selectionMode" must be one of: ${Ce.join(", ")}`
2115
+ }), a.selectionGroup !== void 0 && typeof a.selectionGroup != "string" && r.push({
2116
+ severity: "error",
2117
+ path: `${t}.selectionGroup`,
2118
+ message: "\"selectionGroup\" must be a string"
2119
+ }), a.allowNone !== void 0 && typeof a.allowNone != "boolean" && r.push({
2120
+ severity: "error",
2121
+ path: `${t}.allowNone`,
2122
+ message: "\"allowNone\" must be a boolean"
2123
+ }), a.stackOrder !== void 0 && (typeof a.stackOrder != "number" || !Number.isFinite(a.stackOrder)) && r.push({
2124
+ severity: "error",
2125
+ path: `${t}.stackOrder`,
2126
+ message: "\"stackOrder\" must be a finite number"
2127
+ }), a.selectionMode === "single" && !s && i.push({
2128
+ severity: "warning",
2129
+ path: `${t}.selectionMode`,
2130
+ message: "\"selectionMode: single\" is typically used on group nodes with children"
2131
+ }), a.allowNone !== void 0 && a.selectionMode !== "single" && i.push({
2132
+ severity: "warning",
2133
+ path: `${t}.allowNone`,
2134
+ message: "\"allowNone\" only applies when \"selectionMode\" is \"single\""
2135
+ });
2136
+ }
2137
+ function Fe(e, t, n, r, i) {
2138
+ if (!J(e)) {
2139
+ i.push({
2140
+ severity: "warning",
2141
+ path: t,
2142
+ message: "\"tools\" should be an object"
2143
+ });
2144
+ return;
2145
+ }
2146
+ Object.entries(e).forEach(([e, a]) => {
2147
+ let o = `${t}.${e}`;
2148
+ if (!J(a)) {
2149
+ i.push({
2150
+ severity: "warning",
2151
+ path: o,
2152
+ message: "Tool config should be an object"
2153
+ });
2154
+ return;
2155
+ }
2156
+ let s = a;
2157
+ if (s.enabled === void 0 ? i.push({
2158
+ severity: "warning",
2159
+ path: o,
2160
+ message: "Tool config is missing \"enabled\" property"
2161
+ }) : typeof s.enabled != "boolean" && i.push({
2162
+ severity: "warning",
2163
+ path: `${o}.enabled`,
2164
+ message: "\"enabled\" should be a boolean"
2165
+ }), Ie(s, o, i), Array.isArray(s.items) && s.items.forEach((e, t) => {
2166
+ if (!J(e)) return;
2167
+ let a = `${o}.items[${t}]`, s = e;
2168
+ if (Ie(s, a, i), s.type === "layerTree") {
2169
+ if (s.catalog !== void 0 && i.push({
2170
+ severity: "warning",
2171
+ path: `${a}.catalog`,
2172
+ message: "\"catalog\" reference is deprecated; embed \"tree\" in this layerTree tool item"
2173
+ }), s.tree === void 0) {
2174
+ i.push({
2175
+ severity: "warning",
2176
+ path: `${a}.tree`,
2177
+ message: "LayerTree tool item should define a \"tree\" array"
2178
+ });
2179
+ return;
2180
+ }
2181
+ if (!Array.isArray(s.tree)) {
2182
+ r.push({
2183
+ severity: "error",
2184
+ path: `${a}.tree`,
2185
+ message: "\"tree\" must be an array"
2186
+ });
2187
+ return;
2188
+ }
2189
+ Ne(s.tree, `${a}.tree`, n, r, i);
2190
+ }
2191
+ }), e === "search" && (Y(s, G.toolSearch, o, i), s.provider !== void 0 && (typeof s.provider == "string" ? be.has(s.provider.toLowerCase()) || i.push({
2192
+ severity: "warning",
2193
+ path: `${o}.provider`,
2194
+ message: `Unknown search provider "${s.provider}"`
2195
+ }) : i.push({
2196
+ severity: "warning",
2197
+ path: `${o}.provider`,
2198
+ message: "\"provider\" should be a string"
2199
+ })), s.attribution !== void 0 && typeof s.attribution != "string" && i.push({
2200
+ severity: "warning",
2201
+ path: `${o}.attribution`,
2202
+ message: "\"attribution\" should be a string"
2203
+ })), e === "insetMap" && (Y(s, G.toolInsetMap, o, i), s.zoomOffset !== void 0 && (typeof s.zoomOffset != "number" || !Number.isFinite(s.zoomOffset)) && i.push({
2204
+ severity: "warning",
2205
+ path: `${o}.zoomOffset`,
2206
+ message: "\"zoomOffset\" should be a finite number"
2207
+ }), s.baseScale !== void 0 && (typeof s.baseScale != "number" || !Number.isFinite(s.baseScale) || s.baseScale <= 0) && i.push({
2208
+ severity: "warning",
2209
+ path: `${o}.baseScale`,
2210
+ message: "\"baseScale\" should be a positive finite number"
2211
+ }), s.styleUrl !== void 0 && typeof s.styleUrl != "string" && i.push({
2212
+ severity: "warning",
2213
+ path: `${o}.styleUrl`,
2214
+ message: "\"styleUrl\" should be a string"
2215
+ }), s.background !== void 0)) if (!J(s.background)) i.push({
2216
+ severity: "warning",
2217
+ path: `${o}.background`,
2218
+ message: "\"background\" should be an object"
2219
+ });
2220
+ else {
2221
+ let e = s.background;
2222
+ Y(e, G.toolInsetMapBackground, `${o}.background`, i), e.service !== "xyz" && i.push({
2223
+ severity: "warning",
2224
+ path: `${o}.background.service`,
2225
+ message: "Only \"xyz\" background service is currently supported"
2226
+ });
2227
+ let t = typeof e.url == "string" && e.url.length > 0, n = Array.isArray(e.tiles) && e.tiles.length > 0 && e.tiles.every((e) => typeof e == "string" && e.length > 0);
2228
+ !t && !n && i.push({
2229
+ severity: "warning",
2230
+ path: `${o}.background`,
2231
+ message: "Provide either \"url\" or non-empty string array \"tiles\""
2232
+ }), e.url !== void 0 && (typeof e.url != "string" || e.url.length === 0) && i.push({
2233
+ severity: "warning",
2234
+ path: `${o}.background.url`,
2235
+ message: "\"url\" should be a non-empty string when provided"
2236
+ }), e.tiles !== void 0 && !n && i.push({
2237
+ severity: "warning",
2238
+ path: `${o}.background.tiles`,
2239
+ message: "\"tiles\" should be a non-empty string array when provided"
2240
+ }), e.attribution !== void 0 && typeof e.attribution != "string" && i.push({
2241
+ severity: "warning",
2242
+ path: `${o}.background.attribution`,
2243
+ message: "\"attribution\" should be a string"
2244
+ }), e.tileSize !== void 0 && (typeof e.tileSize != "number" || !Number.isFinite(e.tileSize) || e.tileSize <= 0) && i.push({
2245
+ severity: "warning",
2246
+ path: `${o}.background.tileSize`,
2247
+ message: "\"tileSize\" should be a positive finite number"
2248
+ });
2249
+ }
2250
+ });
2251
+ }
2252
+ function Ie(e, t, n) {
2253
+ e.label !== void 0 && typeof e.label != "string" && n.push({
2254
+ severity: "warning",
2255
+ path: `${t}.label`,
2256
+ message: "\"label\" should be a string"
2257
+ }), e.title !== void 0 && typeof e.title != "string" && n.push({
2258
+ severity: "warning",
2259
+ path: `${t}.title`,
2260
+ message: "\"title\" should be a string"
2261
+ }), Le(e.icon, `${t}.icon`, n);
2262
+ }
2263
+ function Le(e, t, n) {
2264
+ if (e === void 0) return;
2265
+ if (typeof e == "string") {
2266
+ e.trim().length === 0 && n.push({
2267
+ severity: "warning",
2268
+ path: t,
2269
+ message: "\"icon\" should not be an empty string"
2270
+ });
2271
+ return;
2272
+ }
2273
+ if (!J(e)) {
2274
+ n.push({
2275
+ severity: "warning",
2276
+ path: t,
2277
+ message: "\"icon\" should be a string or an object with \"name\", \"library\", or \"src\""
2278
+ });
2279
+ return;
2280
+ }
2281
+ let r = e;
2282
+ r.name !== void 0 && typeof r.name != "string" && n.push({
2283
+ severity: "warning",
2284
+ path: `${t}.name`,
2285
+ message: "\"name\" should be a string"
2286
+ }), r.library !== void 0 && typeof r.library != "string" && n.push({
2287
+ severity: "warning",
2288
+ path: `${t}.library`,
2289
+ message: "\"library\" should be a string"
2290
+ }), r.src !== void 0 && typeof r.src != "string" && n.push({
2291
+ severity: "warning",
2292
+ path: `${t}.src`,
2293
+ message: "\"src\" should be a string"
2294
+ }), r.name === void 0 && r.src === void 0 && n.push({
2295
+ severity: "warning",
2296
+ path: t,
2297
+ message: "\"icon\" object should define either \"name\" or \"src\""
2298
+ });
2299
+ }
2300
+ function J(e) {
2301
+ return typeof e == "object" && !!e && !Array.isArray(e);
2302
+ }
2303
+ function Re(e) {
2304
+ if (!Array.isArray(e) || e.length !== 2) return !1;
2305
+ let [t, n] = e;
2306
+ return typeof t == "number" && typeof n == "number" && t >= -180 && t <= 180 && n >= -90 && n <= 90;
2307
+ }
2308
+ function Y(e, t, n, r) {
2309
+ Object.keys(e).forEach((e) => {
2310
+ t.includes(e) || r.push({
2311
+ severity: "warning",
2312
+ path: n ? `${n}.${e}` : e,
2313
+ message: `Unknown key "${e}"`
2314
+ });
2315
+ });
2316
+ }
2317
+ //#endregion
2318
+ //#region src/config/loader.ts
2319
+ function X(e) {
2320
+ return typeof e == "object" && !!e && !Array.isArray(e);
2321
+ }
2322
+ function Z(e, t) {
2323
+ if (!X(t)) return {
2324
+ id: e,
2325
+ type: "geojson",
2326
+ data: t
2327
+ };
2328
+ let n = {
2329
+ id: e,
2330
+ ...t
2331
+ };
2332
+ return n.type === "raster" && n.url === void 0 && Array.isArray(n.tiles) && (n.url = n.tiles), n.type === "raster" && n.service === void 0 && (n.service = "xyz"), n;
2333
+ }
2334
+ function Q(e) {
2335
+ return X(e) ? Object.entries(e).map(([e, t]) => Z(e, t)) : [];
2336
+ }
2337
+ function $(e, t) {
2338
+ let n = typeof e.source == "string" ? t?.get(e.source) ?? e.source : void 0, r = e["source-layer"] ?? e.sourceLayer, i = e.minzoom ?? e.minZoom, a = e.maxzoom ?? e.maxZoom, o = { ...e };
2339
+ return n !== void 0 && (o.source = n), r !== void 0 && (o["source-layer"] = r), i !== void 0 && (o.minzoom = i), a !== void 0 && (o.maxzoom = a), delete o.sourceLayer, delete o.minZoom, delete o.maxZoom, o;
2340
+ }
2341
+ function ze(e, t) {
2342
+ return Array.isArray(e) ? e.filter(X).map((e) => Be(e, t)) : X(e) ? Object.entries(e).map(([e, n]) => X(n) ? Be({
2343
+ id: e,
2344
+ ...n
2345
+ }, t) : null).filter(Boolean) : [];
2346
+ }
2347
+ function Be(e, t) {
2348
+ let n = typeof e.id == "string" ? e.id : null;
2349
+ if (!n) return null;
2350
+ let r = typeof e.fallbackLayerId == "string" ? e.fallbackLayerId : typeof e.fallbackRef == "string" ? e.fallbackRef : void 0, i = typeof e.singleGroup == "string" ? e.singleGroup : typeof e.selectionGroup == "string" ? e.selectionGroup : void 0, a = X(e.metadata) ? {
2351
+ ...e.metadata,
2352
+ ...i ? {
2353
+ selectionGroup: i,
2354
+ singleSelectionGroupKey: i
2355
+ } : {},
2356
+ ...r ? { fallbackLayerId: r } : {}
2357
+ } : i || r ? {
2358
+ ...i ? {
2359
+ selectionGroup: i,
2360
+ singleSelectionGroupKey: i
2361
+ } : {},
2362
+ ...r ? { fallbackLayerId: r } : {}
2363
+ } : void 0, o = {
2364
+ ...e,
2365
+ id: n,
2366
+ ...r ? { fallbackLayerId: r } : {},
2367
+ ...i ? { singleGroup: i } : {},
2368
+ ...a ? { metadata: a } : {}
2369
+ };
2370
+ if (e.type === "allmaps") return o;
2371
+ if (e.type === "style") {
2372
+ let r = {}, i = /* @__PURE__ */ new Map();
2373
+ if (X(e.sources)) for (let [a, o] of Object.entries(e.sources)) {
2374
+ let e = `${n}:${a}`;
2375
+ i.set(a, e), t.push(Z(e, o)), r[a] = o;
2376
+ }
2377
+ let a = Array.isArray(e.layers) ? e.layers.filter(X).map((e) => $(e, i)) : [];
2378
+ return {
2379
+ ...o,
2380
+ type: "style",
2381
+ sources: e.sources ?? {},
2382
+ layers: a
2383
+ };
2384
+ }
2385
+ if (typeof e.type == "string" && typeof e.source == "string" && !e.layerset && !e.style) {
2386
+ let t = e["source-layer"] ?? e.sourceLayer, n = e.minzoom ?? e.minZoom, r = e.maxzoom ?? e.maxZoom, i = { ...o };
2387
+ return t !== void 0 && (i["source-layer"] = t), n !== void 0 && (i.minzoom = n), r !== void 0 && (i.maxzoom = r), delete i.sourceLayer, delete i.minZoom, delete i.maxZoom, i;
2388
+ }
2389
+ if (Array.isArray(e.layerset)) {
2390
+ let t = e.layerset.filter(X).map((e) => $(e));
2391
+ return {
2392
+ ...o,
2393
+ type: "style",
2394
+ layers: t,
2395
+ layerset: void 0
2396
+ };
2397
+ }
2398
+ if (X(e.style)) {
2399
+ let r = e.style, i = /* @__PURE__ */ new Map(), a = {};
2400
+ if (X(r.sources)) for (let [e, o] of Object.entries(r.sources)) {
2401
+ let r = `${n}:${e}`;
2402
+ i.set(e, r), t.push(Z(r, o)), a[e] = o;
2403
+ }
2404
+ let s = Array.isArray(r.layers) ? r.layers.filter(X).map((e) => $(e, i)) : [], c = typeof r.url == "string" ? r.url : void 0;
2405
+ return {
2406
+ ...o,
2407
+ type: "style",
2408
+ ...c ? { url: c } : {},
2409
+ sources: a,
2410
+ layers: s,
2411
+ style: void 0
2412
+ };
2413
+ }
2414
+ return null;
2415
+ }
2416
+ function Ve(e, t) {
2417
+ let n = (e) => {
2418
+ let t = e.selectionMode;
2419
+ if (t === "single" || t === "multiple") return t;
2420
+ }, r = (e) => typeof e.selectionGroup == "string" ? e.selectionGroup : void 0, i = (e) => typeof e.allowNone == "boolean" ? e.allowNone : void 0, a = (e) => typeof e.stackOrder == "number" && Number.isFinite(e.stackOrder) ? e.stackOrder : void 0, o = (e) => {
2421
+ if (!X(e)) return null;
2422
+ let t = typeof e.kind == "string" ? e.kind : void 0;
2423
+ if (t === "group") {
2424
+ let t = Array.isArray(e.children) ? e.children.map(o).filter((e) => e !== null) : [];
2425
+ return {
2426
+ label: typeof e.title == "string" ? e.title : "Group",
2427
+ expanded: e.expanded === !0,
2428
+ ...n(e) ? { selectionMode: n(e) } : {},
2429
+ ...r(e) ? { selectionGroup: r(e) } : {},
2430
+ ...i(e) === void 0 ? {} : { allowNone: i(e) },
2431
+ ...a(e) === void 0 ? {} : { stackOrder: a(e) },
2432
+ children: t
2433
+ };
2434
+ }
2435
+ if (t === "layer") {
2436
+ let t = typeof e.ref == "string" ? e.ref : void 0;
2437
+ return t ? {
2438
+ label: typeof e.title == "string" ? e.title : t,
2439
+ layerId: t,
2440
+ ...n(e) ? { selectionMode: n(e) } : {},
2441
+ ...r(e) ? { selectionGroup: r(e) } : {},
2442
+ ...i(e) === void 0 ? {} : { allowNone: i(e) },
2443
+ ...a(e) === void 0 ? {} : { stackOrder: a(e) }
2444
+ } : null;
2445
+ }
2446
+ return null;
2447
+ };
2448
+ if (!X(e)) return t.map((e) => !X(e) || typeof e.id != "string" ? null : {
2449
+ label: e.id,
2450
+ layerId: e.id
2451
+ }).filter(Boolean);
2452
+ let s = Object.values(e).find((e) => X(e)), c = (Array.isArray(s?.items) ? s.items : []).map(o).filter((e) => e !== null);
2453
+ return c.length > 0 ? c : t.map((e) => !X(e) || typeof e.id != "string" ? null : {
2454
+ label: e.id,
2455
+ layerId: e.id
2456
+ }).filter(Boolean);
2457
+ }
2458
+ function He(e, t) {
2459
+ if (!X(e)) return;
2460
+ let n = JSON.parse(JSON.stringify(e)), r = Object.values(n).filter((e) => X(e));
2461
+ for (let e of r) {
2462
+ let r = Array.isArray(e.items) ? e.items : [];
2463
+ for (let e of r) if (X(e) && e.type === "layerTree") return Array.isArray(e.tree) && e.tree.length > 0 || (e.tree = t), delete e.catalog, n;
2464
+ }
2465
+ return n;
2466
+ }
2467
+ function Ue(e) {
2468
+ if (!X(e)) return {
2469
+ sources: [],
2470
+ layers: []
2471
+ };
2472
+ let t = e, n = Array.isArray(t.sources) ? t.sources : Q(t.sources), r = [], i = ze(t.layers, r), a = /* @__PURE__ */ new Map();
2473
+ for (let e of [...n, ...r]) X(e) && typeof e.id == "string" && !a.has(e.id) && a.set(e.id, e);
2474
+ return {
2475
+ sources: Array.from(a.values()),
2476
+ layers: i.map((e) => {
2477
+ if (!X(e)) return e;
2478
+ let t = e, n = typeof t.source == "string" ? t.source : null, r = n ? a.get(n) : null;
2479
+ if (!r || r.type !== "raster" || r.service !== "wms") return e;
2480
+ let i = X(t.metadata) ? { ...t.metadata } : {};
2481
+ if (typeof i.getFeatureInfoUrl == "string") return e;
2482
+ let o = Array.isArray(r.url) ? r.url[0] : r.url;
2483
+ if (typeof o != "string") return e;
2484
+ let s = r.layers ?? "", c = r.version ?? "1.1.1", l = new URL(o);
2485
+ return l.searchParams.set("SERVICE", "WMS"), l.searchParams.set("REQUEST", "GetFeatureInfo"), l.searchParams.set("VERSION", String(c)), l.searchParams.set("LAYERS", String(s)), l.searchParams.set("QUERY_LAYERS", String(s)), i.getFeatureInfoUrl = l.toString(), i.getFeatureInfoFormat = r.format ?? "application/json", {
2486
+ ...t,
2487
+ metadata: i
2488
+ };
2489
+ })
2490
+ };
2491
+ }
2492
+ function We(e) {
2493
+ if (!X(e)) return e;
2494
+ let t = e;
2495
+ if (X(t.layerData)) return {
2496
+ ...t,
2497
+ layerData: Ue(t.layerData)
2498
+ };
2499
+ if (X(t.catalog)) {
2500
+ let e = t.catalog;
2501
+ return {
2502
+ ...t,
2503
+ layerData: {
2504
+ sources: Array.isArray(e.sources) ? e.sources : [],
2505
+ layers: Array.isArray(e.layers) ? e.layers : []
2506
+ },
2507
+ catalog: t.catalog
2508
+ };
2509
+ }
2510
+ if (!X(t.library)) return t;
2511
+ let n = t.library, r = Q(n.sources), i = ze(n.layers, r), a = Ve(n.catalogs, i);
2512
+ return {
2513
+ map: t.map,
2514
+ runtimeMap: X(t.runtimeMap) ? t.runtimeMap : void 0,
2515
+ layerData: {
2516
+ sources: r,
2517
+ layers: i
2518
+ },
2519
+ tools: He(t.tools, a),
2520
+ state: X(t.state) ? t.state : void 0,
2521
+ version: typeof t.version == "number" ? t.version : void 0,
2522
+ project: X(t.project) ? t.project : void 0
2523
+ };
2524
+ }
2525
+ function Ge(e, t) {
2526
+ let n = We(e), r = we(n);
2527
+ if (!r.valid) {
2528
+ let e = r.errors.map((e) => ` ${e.path}: ${e.message}`).join("\n");
2529
+ throw Error(`Invalid config from "${t}":\n${e}`);
2530
+ }
2531
+ return r.warnings.length > 0 && (console.warn(`[config] Warnings for "${t}":`), r.warnings.forEach((e) => console.warn(` ${e.path}: ${e.message}`))), n;
2532
+ }
2533
+ //#endregion
1318
2534
  //#region src/bootstrap/WebMapX.ts
1319
- var de = {
2535
+ var Ke = {
1320
2536
  version: 8,
1321
2537
  sources: {},
1322
2538
  layers: []
1323
- }, fe = class {
2539
+ }, qe = class {
1324
2540
  static async mount(e, t) {
1325
2541
  let n = typeof t.config == "string" ? await fetch(t.config).then((e) => {
1326
2542
  if (!e.ok) throw Error(`[webmapx] Failed to load config: ${t.config}`);
1327
2543
  return e.json();
1328
2544
  }) : t.config;
1329
- await ce();
2545
+ await _e();
1330
2546
  let i = n.engine ?? "maplibre";
1331
2547
  await Promise.all([
1332
2548
  r(i),
1333
2549
  a(n.tools ?? []),
1334
2550
  n.plugins?.length ? s(n.plugins) : Promise.resolve()
1335
- ]), n.locale && n.locale !== "en" && await $(n.locale);
2551
+ ]), n.locale && n.locale !== "en" && await W(n.locale);
1336
2552
  let o = document.querySelector(e);
1337
2553
  if (!o) throw Error(`[webmapx] Mount target not found: "${e}"`);
1338
2554
  o.innerHTML = `<webmapx-map adapter="${i}"><webmapx-layout></webmapx-layout></webmapx-map>`;
1339
- let c = o.querySelector("webmapx-map"), l = n.map;
1340
- c.setConfig({
2555
+ let c = o.querySelector("webmapx-map"), l = n.map, u = Ge({
1341
2556
  ...n,
1342
2557
  map: {
1343
2558
  type: i,
@@ -1345,28 +2560,29 @@ var de = {
1345
2560
  zoom: 2,
1346
2561
  ...l
1347
2562
  }
1348
- });
1349
- let u = c.querySelector("webmapx-layout");
1350
- if (u && u.childElementCount === 0 && n.tools) {
2563
+ }, "WebMapX.mount");
2564
+ c.setConfig(u);
2565
+ let d = c.querySelector("webmapx-layout");
2566
+ if (d && d.childElementCount === 0 && n.tools) {
1351
2567
  let { buildLayoutFromConfig: e } = await import("./dynamic-layout-DmLc5_yX.js");
1352
- e(u, n.tools);
2568
+ e(d, n.tools);
1353
2569
  }
1354
- let d = await c.getAdapterAsync?.();
1355
- if (!d) {
2570
+ let f = await c.getAdapterAsync?.();
2571
+ if (!f) {
1356
2572
  console.error("[webmapx] Adapter not available — check engine config.");
1357
2573
  return;
1358
2574
  }
1359
- let f = l?.style ?? de, p = {
2575
+ let p = l?.style ?? Ke, m = {
1360
2576
  center: l?.center ?? [0, 0],
1361
2577
  zoom: l?.zoom ?? 2,
1362
2578
  ...l?.bearing == null ? {} : { bearing: l.bearing },
1363
2579
  ...l?.pitch == null ? {} : { pitch: l.pitch },
1364
2580
  ...l?.minZoom == null ? {} : { minZoom: l.minZoom },
1365
2581
  ...l?.maxZoom == null ? {} : { maxZoom: l.maxZoom },
1366
- ...typeof f == "string" ? { styleUrl: f } : { style: f }
2582
+ ...typeof p == "string" ? { styleUrl: p } : { style: p }
1367
2583
  };
1368
- d.initialize(e.replace(/^#/, ""), p);
2584
+ f.initialize(e.replace(/^#/, ""), m);
1369
2585
  }
1370
2586
  };
1371
2587
  //#endregion
1372
- export { fe as WebMapX, e as WebmapxBaseTool, t as WebmapxPluginTool, $ as changeLocale, Z as i18n, le as t };
2588
+ export { qe as WebMapX, e as WebmapxBaseTool, t as WebmapxPluginTool, W as changeLocale, H as i18n, ve as t };