@edugis-org/webmapx 0.1.0

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.
Files changed (84) hide show
  1. package/README.md +149 -0
  2. package/dist-lib/WMTS-DCN4zX0-.js +1169 -0
  3. package/dist-lib/alert-GeHlqlN8.js +310 -0
  4. package/dist-lib/assets/epsg-lookup.worker-J7TVnHDq.js +1 -0
  5. package/dist-lib/assets/shapefile.worker-kQfZj6G2.js +4 -0
  6. package/dist-lib/attribution-format-B4f05_u0.js +62 -0
  7. package/dist-lib/button-DFdGkRPQ.js +741 -0
  8. package/dist-lib/cesium-adapter-BHXNytkU.js +1488 -0
  9. package/dist-lib/checkbox-QoR4S8tV.js +284 -0
  10. package/dist-lib/chunk-HEgqtunE.js +20 -0
  11. package/dist-lib/chunk.36O46B5H-B6ZL7Sm1.js +77 -0
  12. package/dist-lib/chunk.3RPBFEDE-BFO1fHVm.js +138 -0
  13. package/dist-lib/chunk.5JY5FUCG-DTXsslmx.js +1090 -0
  14. package/dist-lib/chunk.6CTB5ZDJ-DjZrBd6Y.js +99 -0
  15. package/dist-lib/chunk.AJ3ENQ5C-Ci7Gm2b6.js +175 -0
  16. package/dist-lib/chunk.LD4M4QGE-CiCfhE8r.js +8 -0
  17. package/dist-lib/chunk.NYIIDP5N-BikXIStD.js +99 -0
  18. package/dist-lib/chunk.RWUUFNUL-DFztA4uV.js +43 -0
  19. package/dist-lib/chunk.SI4ACBFK-CLb9VfMG.js +61 -0
  20. package/dist-lib/chunk.YHLNUJ7P-D-kanrCf.js +503 -0
  21. package/dist-lib/core-CMAlSR68.js +22 -0
  22. package/dist-lib/decorate-CWgUV1hU.js +1139 -0
  23. package/dist-lib/decorators-B35AgiCU.js +351 -0
  24. package/dist-lib/deferred-query-service-BJDcngw6.js +386 -0
  25. package/dist-lib/dist-Dm6b7XCs.js +12318 -0
  26. package/dist-lib/dist-Ha9LQCut.js +244 -0
  27. package/dist-lib/dist-c1PlDAd1.js +2359 -0
  28. package/dist-lib/dist-kKlmcBXq.js +50 -0
  29. package/dist-lib/divider-CPm675yY.js +41 -0
  30. package/dist-lib/dropped-config-C_GyVa8o.js +17 -0
  31. package/dist-lib/dropped-layer-builder-DAaYgUPk.js +396 -0
  32. package/dist-lib/epsg-definitions-BZLZWa8Q.js +668 -0
  33. package/dist-lib/esm-CTuscnN5.js +46 -0
  34. package/dist-lib/file-sniff-Dhxj3KTF.js +251 -0
  35. package/dist-lib/geo-calculations-DbFJAUoI.js +30 -0
  36. package/dist-lib/icon-CEOgWlro.js +9 -0
  37. package/dist-lib/icon-button-Da_nBTy3.js +408 -0
  38. package/dist-lib/input-CeGntPlT.js +590 -0
  39. package/dist-lib/layer-discovery-afWzu5hY.js +2825 -0
  40. package/dist-lib/leaflet-adapter-D9djjrKv.js +1227 -0
  41. package/dist-lib/lib-CdHVicAE.js +4074 -0
  42. package/dist-lib/map-layer-registry-2cmkiRDK.js +62 -0
  43. package/dist-lib/maplibre-adapter-TFc3e0G9.js +1190 -0
  44. package/dist-lib/maplibre-expression-evaluator-DCWUcpwf.js +7233 -0
  45. package/dist-lib/marker-utils-DztWXeop.js +12 -0
  46. package/dist-lib/ol-tilegrid-9VtyxaLG.js +64 -0
  47. package/dist-lib/openlayers-adapter-DVW1KCRv.js +13307 -0
  48. package/dist-lib/option-CBxl1mZP.js +1106 -0
  49. package/dist-lib/papaparse.min-B7v3c0D7.js +501 -0
  50. package/dist-lib/rbush-C8k41T4z.js +254 -0
  51. package/dist-lib/shapefile-SawVY6xg.js +207 -0
  52. package/dist-lib/spinner-DysxdNG9.js +6 -0
  53. package/dist-lib/src-CL94RDe3.js +111 -0
  54. package/dist-lib/throttle-BeneRNYK.js +16 -0
  55. package/dist-lib/toast-Cm28o9U6.js +15 -0
  56. package/dist-lib/togeojson.es-DAgiTBvg.js +579 -0
  57. package/dist-lib/tooltip-Cucn1SiD.js +197 -0
  58. package/dist-lib/webmapx-3d-tool-D4CTD2gB.js +176 -0
  59. package/dist-lib/webmapx-base-tool-Dm9NAWLD.js +75 -0
  60. package/dist-lib/webmapx-config-edit-tool-DCTyxqTk.js +389 -0
  61. package/dist-lib/webmapx-coordinates-tool-jeWohup9.js +648 -0
  62. package/dist-lib/webmapx-core-bundle-BDImi1RE.js +8203 -0
  63. package/dist-lib/webmapx-draw-tool-DooAV8cF.js +4336 -0
  64. package/dist-lib/webmapx-geolocation-tool-Rw3-Iad1.js +788 -0
  65. package/dist-lib/webmapx-import-layer-tool-DRYviHd5.js +250 -0
  66. package/dist-lib/webmapx-info-tool-BJA157cy.js +412 -0
  67. package/dist-lib/webmapx-language-osmvector-M5y_lwOg.js +489 -0
  68. package/dist-lib/webmapx-measure-tool-BXhMJFC6.js +590 -0
  69. package/dist-lib/webmapx-modal-tool-eF6Naluv.js +84 -0
  70. package/dist-lib/webmapx-plugin-tool-D2Hghf9n.js +45 -0
  71. package/dist-lib/webmapx-print-tool-ob1bOsR5.js +348 -0
  72. package/dist-lib/webmapx-search-tool-Cv8BrYvY.js +437 -0
  73. package/dist-lib/webmapx-settings-DDEJ8aoV.js +479 -0
  74. package/dist-lib/webmapx-truearea-tool-CMB4Orm-.js +615 -0
  75. package/dist-lib/webmapx-view-mode-tool-CUpLNjOj.js +106 -0
  76. package/dist-lib/webmapx.css +2 -0
  77. package/dist-lib/webmapx.js +1321 -0
  78. package/dist-lib/wms-feature-info-C0RVMEQC.js +145 -0
  79. package/dist-lib/wms-url-builder-DIJLQ1v2.js +54 -0
  80. package/dist-lib/zip.js-DVhmtjxZ.js +3615 -0
  81. package/package.json +107 -0
  82. package/public/data/country-epsg-codes.json +297 -0
  83. package/public/data/world-countries-simplified.topojson +1 -0
  84. package/src/locales/en/core.json +20 -0
@@ -0,0 +1,251 @@
1
+ import { i as e, n as t, r as n } from "./zip.js-DVhmtjxZ.js";
2
+ //#region src/utils/file-sniff.ts
3
+ var r = 8192;
4
+ function i() {
5
+ let e = navigator.deviceMemory;
6
+ return typeof e == "number" && e > 0 ? Math.min(e * .1 * 1e9, 500 * 1024 * 1024) : 100 * 1024 * 1024;
7
+ }
8
+ function a(e, t, n) {
9
+ if (e.length < t + n.length) return !1;
10
+ for (let r = 0; r < n.length; r++) if (e[t + r] !== n[r]) return !1;
11
+ return !0;
12
+ }
13
+ var o = [
14
+ ",",
15
+ ";",
16
+ " ",
17
+ "|"
18
+ ];
19
+ function s(e) {
20
+ for (let t = 0; t < e.length; t++) {
21
+ let n = e.charCodeAt(t);
22
+ if (n < 32 && n !== 9 && n !== 10 && n !== 13 || n === 65533) return !0;
23
+ }
24
+ return !1;
25
+ }
26
+ function c(e) {
27
+ if (s(e)) return null;
28
+ let t = e.split(/\r?\n/).filter((e) => e.length > 0).slice(0, 5);
29
+ t.length > 1 && (t = t.slice(0, -1));
30
+ let n = t[0] ?? "";
31
+ if (!n) return null;
32
+ let r = null, i = 0;
33
+ for (let e of o) {
34
+ let t = n.split(e).length - 1;
35
+ t > i && (i = t, r = e);
36
+ }
37
+ if (!r || i < 1) return null;
38
+ for (let e of t) if (e.split(r).length - 1 !== i) return null;
39
+ return {
40
+ kind: "csv",
41
+ description: `CSV (${{
42
+ ",": "comma",
43
+ ";": "semicolon",
44
+ " ": "tab",
45
+ "|": "pipe"
46
+ }[r]}-delimited, ${i + 1} columns)`
47
+ };
48
+ }
49
+ function l(e) {
50
+ let t;
51
+ try {
52
+ t = JSON.parse(e);
53
+ } catch {
54
+ return {
55
+ kind: "json",
56
+ description: "JSON (could not parse)"
57
+ };
58
+ }
59
+ if (typeof t != "object" || !t) return {
60
+ kind: "json",
61
+ description: "JSON (unrecognized structure)"
62
+ };
63
+ let n = t, r = n.type;
64
+ return r === "Topology" && n.objects && n.arcs ? {
65
+ kind: "topojson",
66
+ description: "TopoJSON"
67
+ } : r === "FeatureCollection" || r === "Feature" || r === "Point" || r === "MultiPoint" || r === "LineString" || r === "MultiLineString" || r === "Polygon" || r === "MultiPolygon" || r === "GeometryCollection" ? {
68
+ kind: "geojson",
69
+ description: `GeoJSON (${r})`
70
+ } : n.sources && n.layers ? {
71
+ kind: "maplibre-style",
72
+ description: "MapLibre style.json"
73
+ } : n.version !== void 0 && n.project && n.map ? {
74
+ kind: "webmapx-config",
75
+ description: "webmapx config.json"
76
+ } : {
77
+ kind: "json",
78
+ description: "JSON (unrecognized structure)"
79
+ };
80
+ }
81
+ async function u(r) {
82
+ let a;
83
+ try {
84
+ let e = new t(new n(r));
85
+ a = await e.getEntries(), await e.close();
86
+ } catch {
87
+ return {
88
+ kind: "zip",
89
+ description: "ZIP archive (could not list contents)",
90
+ rejected: !0
91
+ };
92
+ }
93
+ let o = a.map((e) => e.filename.toLowerCase());
94
+ if (o.some((e) => e.startsWith("xl/"))) return {
95
+ kind: "xlsx",
96
+ description: "Excel workbook (.xlsx)"
97
+ };
98
+ if (o.includes("doc.kml") || o.some((e) => e.endsWith(".kml"))) return {
99
+ kind: "kmz",
100
+ description: "KMZ (zipped KML)"
101
+ };
102
+ let s = i(), c = [];
103
+ for (let t of a) {
104
+ if (t.directory || !t.getData) continue;
105
+ let n;
106
+ try {
107
+ n = await t.getData(new e());
108
+ } catch {
109
+ c.push({
110
+ path: t.filename,
111
+ size: 0,
112
+ result: {
113
+ kind: "unknown",
114
+ description: "Could not read entry",
115
+ rejected: !0
116
+ }
117
+ });
118
+ continue;
119
+ }
120
+ if (n.size > s) {
121
+ c.push({
122
+ path: t.filename,
123
+ size: n.size,
124
+ result: {
125
+ kind: "too-large",
126
+ description: `File too large (${(n.size / 1e6).toFixed(1)} MB, limit ${(s / 1e6).toFixed(0)} MB)`,
127
+ rejected: !0
128
+ }
129
+ });
130
+ continue;
131
+ }
132
+ let r = await p(n);
133
+ c.push({
134
+ path: t.filename,
135
+ size: n.size,
136
+ result: r
137
+ });
138
+ }
139
+ return {
140
+ kind: "zip",
141
+ description: `ZIP archive (${a.length} entries)`,
142
+ children: c
143
+ };
144
+ }
145
+ function d(e) {
146
+ let t = e.slice(0, 1024);
147
+ return /<gpx[\s>]/i.test(t) ? {
148
+ kind: "gpx",
149
+ description: "GPX track/route"
150
+ } : /<kml[\s>]/i.test(t) ? {
151
+ kind: "kml",
152
+ description: "KML"
153
+ } : /<qgis[\s>]/i.test(t) ? {
154
+ kind: "qml",
155
+ description: "QGIS layer style (.qml)"
156
+ } : /^\s*<\?xml/i.test(t) || /^\s*</.test(t) ? {
157
+ kind: "xml",
158
+ description: "XML (unrecognized format)",
159
+ rejected: !0
160
+ } : null;
161
+ }
162
+ async function f(e) {
163
+ let t = new Uint8Array(await e.slice(0, 4).arrayBuffer());
164
+ return a(t, 0, [
165
+ 80,
166
+ 75,
167
+ 3,
168
+ 4
169
+ ]) || a(t, 0, [
170
+ 80,
171
+ 75,
172
+ 5,
173
+ 6
174
+ ]);
175
+ }
176
+ async function p(e) {
177
+ let t = new Uint8Array(await e.slice(0, r).arrayBuffer());
178
+ if (a(t, 0, [
179
+ 80,
180
+ 75,
181
+ 3,
182
+ 4
183
+ ]) || a(t, 0, [
184
+ 80,
185
+ 75,
186
+ 5,
187
+ 6
188
+ ])) return u(e);
189
+ if (a(t, 0, [
190
+ 83,
191
+ 81,
192
+ 76,
193
+ 105,
194
+ 116,
195
+ 101
196
+ ])) return {
197
+ kind: "gpkg",
198
+ description: "GeoPackage (SQLite) - not yet supported",
199
+ rejected: !0
200
+ };
201
+ if (a(t, 0, [
202
+ 73,
203
+ 73,
204
+ 42,
205
+ 0
206
+ ]) || a(t, 0, [
207
+ 77,
208
+ 77,
209
+ 0,
210
+ 42
211
+ ])) return {
212
+ kind: "geotiff",
213
+ description: "GeoTIFF - not yet supported",
214
+ rejected: !0
215
+ };
216
+ if (a(t, 0, [
217
+ 208,
218
+ 207,
219
+ 17,
220
+ 224
221
+ ])) return {
222
+ kind: "xls",
223
+ description: "Excel workbook (.xls, legacy) - not yet supported",
224
+ rejected: !0
225
+ };
226
+ if (a(t, 0, [
227
+ 0,
228
+ 0,
229
+ 39,
230
+ 10
231
+ ])) return {
232
+ kind: "shp",
233
+ description: "Shapefile geometry (.shp)"
234
+ };
235
+ let n = new TextDecoder("utf-8", { fatal: !1 }).decode(t).trim();
236
+ return d(n) || (n.startsWith("{") || n.startsWith("[") ? l(e.size <= t.length ? n : await e.text()) : c(n) || {
237
+ kind: "unknown",
238
+ description: "Unrecognized file type",
239
+ rejected: !0
240
+ });
241
+ }
242
+ async function m(e) {
243
+ let t = i();
244
+ return e.size > t ? {
245
+ kind: "too-large",
246
+ description: `File too large (${(e.size / 1e6).toFixed(1)} MB, limit ${(t / 1e6).toFixed(0)} MB)`,
247
+ rejected: !0
248
+ } : p(e);
249
+ }
250
+ //#endregion
251
+ export { f as isZip, p as sniffBlob, m as sniffFile };
@@ -0,0 +1,30 @@
1
+ //#region src/utils/geo-calculations.ts
2
+ var e = 637100880;
3
+ function t(t, n) {
4
+ let [r, i] = t, [a, o] = n, s = (e) => e * Math.PI / 180, c = s(o - i), l = s(a - r), u = Math.sin(c / 2) ** 2 + Math.cos(s(i)) * Math.cos(s(o)) * Math.sin(l / 2) ** 2;
5
+ return e * (2 * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u)));
6
+ }
7
+ function n(e) {
8
+ if (e.length < 3) return 0;
9
+ let t = (e) => e * Math.PI / 180, n = 6371008.8, r = 0, i = e.length;
10
+ for (let n = 0; n < i; n++) {
11
+ let a = (n + 1) % i, [o, s] = e[n], [c, l] = e[a];
12
+ r += t(c - o) * (2 + Math.sin(t(s)) + Math.sin(t(l)));
13
+ }
14
+ return Math.abs(r * n * n / 2);
15
+ }
16
+ function r(e) {
17
+ let t = e / 100;
18
+ if (t < 1e3) return `${Math.round(t)} m`;
19
+ let n = t / 1e3;
20
+ return n < 10 ? `${n.toFixed(3)} km` : n < 100 ? `${n.toFixed(2)} km` : n < 1e3 ? `${n.toFixed(1)} km` : `${Math.round(n)} km`;
21
+ }
22
+ function i(e) {
23
+ if (e < 1e4) return `${Math.round(e)} m²`;
24
+ let t = e / 1e4;
25
+ if (t < 100) return `${t.toFixed(2)} ha`;
26
+ let n = e / 1e6;
27
+ return n < 10 ? `${n.toFixed(3)} km²` : n < 100 ? `${n.toFixed(2)} km²` : `${n.toFixed(1)} km²`;
28
+ }
29
+ //#endregion
30
+ export { t as i, r as n, n as r, i as t };
@@ -0,0 +1,9 @@
1
+ import { r as e } from "./chunk-HEgqtunE.js";
2
+ import { t } from "./chunk.YHLNUJ7P-D-kanrCf.js";
3
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.ZGGPD2XJ.js
4
+ t.define("sl-icon");
5
+ //#endregion
6
+ //#region node_modules/@shoelace-style/shoelace/dist/components/icon/icon.js
7
+ var n = /* @__PURE__ */ e({});
8
+ //#endregion
9
+ export { n as t };
@@ -0,0 +1,408 @@
1
+ import { a as e, n as t } from "./decorators-B35AgiCU.js";
2
+ import { t as n } from "./chunk.LD4M4QGE-CiCfhE8r.js";
3
+ import { a as r, c as i, i as a, o, s, t as c } from "./chunk.AJ3ENQ5C-Ci7Gm2b6.js";
4
+ import { d as l, f as u, h as d, l as f, u as p } from "./chunk.YHLNUJ7P-D-kanrCf.js";
5
+ import { a as m, n as h, t as g } from "./chunk.NYIIDP5N-BikXIStD.js";
6
+ import { t as _ } from "./chunk.6CTB5ZDJ-DjZrBd6Y.js";
7
+ import { r as v, t as y } from "./chunk.RWUUFNUL-DFztA4uV.js";
8
+ import { css as b, html as x } from "lit";
9
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.VESXC477.js
10
+ function* S(e = document.activeElement) {
11
+ e != null && (yield e, "shadowRoot" in e && e.shadowRoot && e.shadowRoot.mode !== "closed" && (yield* d(S(e.shadowRoot.activeElement))));
12
+ }
13
+ function C() {
14
+ return [...S()].pop();
15
+ }
16
+ var w = /* @__PURE__ */ new WeakMap();
17
+ function T(e) {
18
+ let t = w.get(e);
19
+ return t || (t = window.getComputedStyle(e, null), w.set(e, t)), t;
20
+ }
21
+ function E(e) {
22
+ if (typeof e.checkVisibility == "function") return e.checkVisibility({
23
+ checkOpacity: !1,
24
+ checkVisibilityCSS: !0
25
+ });
26
+ let t = T(e);
27
+ return t.visibility !== "hidden" && t.display !== "none";
28
+ }
29
+ function D(e) {
30
+ let { overflowY: t, overflowX: n } = T(e);
31
+ return t === "scroll" || n === "scroll" ? !0 : t !== "auto" || n !== "auto" ? !1 : e.scrollHeight > e.clientHeight && t === "auto" || e.scrollWidth > e.clientWidth && n === "auto";
32
+ }
33
+ function O(e) {
34
+ let t = e.tagName.toLowerCase(), n = Number(e.getAttribute("tabindex"));
35
+ if (e.hasAttribute("tabindex") && (isNaN(n) || n <= -1) || e.hasAttribute("disabled") || e.closest("[inert]")) return !1;
36
+ if (t === "input" && e.getAttribute("type") === "radio") {
37
+ let t = e.getRootNode(), n = `input[type='radio'][name="${e.getAttribute("name")}"]`, r = t.querySelector(`${n}:checked`);
38
+ return r ? r === e : t.querySelector(n) === e;
39
+ }
40
+ return E(e) ? (t === "audio" || t === "video") && e.hasAttribute("controls") || e.hasAttribute("tabindex") || e.hasAttribute("contenteditable") && e.getAttribute("contenteditable") !== "false" || [
41
+ "button",
42
+ "input",
43
+ "select",
44
+ "textarea",
45
+ "a",
46
+ "audio",
47
+ "video",
48
+ "summary",
49
+ "iframe"
50
+ ].includes(t) ? !0 : D(e) : !1;
51
+ }
52
+ function k(e) {
53
+ let t = j(e);
54
+ return {
55
+ start: t[0] ?? null,
56
+ end: t[t.length - 1] ?? null
57
+ };
58
+ }
59
+ function A(e, t) {
60
+ return e.getRootNode({ composed: !0 })?.host !== t;
61
+ }
62
+ function j(e) {
63
+ let t = /* @__PURE__ */ new WeakMap(), n = [];
64
+ function r(i) {
65
+ if (i instanceof Element) {
66
+ if (i.hasAttribute("inert") || i.closest("[inert]") || t.has(i)) return;
67
+ t.set(i, !0), !n.includes(i) && O(i) && n.push(i), i instanceof HTMLSlotElement && A(i, e) && i.assignedElements({ flatten: !0 }).forEach((e) => {
68
+ r(e);
69
+ }), i.shadowRoot !== null && i.shadowRoot.mode === "open" && r(i.shadowRoot);
70
+ }
71
+ for (let e of i.children) r(e);
72
+ }
73
+ return r(e), n.sort((e, t) => {
74
+ let n = Number(e.getAttribute("tabindex")) || 0;
75
+ return (Number(t.getAttribute("tabindex")) || 0) - n;
76
+ });
77
+ }
78
+ //#endregion
79
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.EMN3H5QW.js
80
+ var M = [], N = class {
81
+ constructor(e) {
82
+ this.tabDirection = "forward", this.handleFocusIn = () => {
83
+ this.isActive() && this.checkFocus();
84
+ }, this.handleKeyDown = (e) => {
85
+ var t;
86
+ if (e.key !== "Tab" || this.isExternalActivated || !this.isActive()) return;
87
+ let n = C();
88
+ if (this.previousFocus = n, this.previousFocus && this.possiblyHasTabbableChildren(this.previousFocus)) return;
89
+ e.shiftKey ? this.tabDirection = "backward" : this.tabDirection = "forward";
90
+ let r = j(this.element), i = r.findIndex((e) => e === n);
91
+ this.previousFocus = this.currentFocus;
92
+ let a = this.tabDirection === "forward" ? 1 : -1;
93
+ for (;;) {
94
+ i + a >= r.length ? i = 0 : i + a < 0 ? i = r.length - 1 : i += a, this.previousFocus = this.currentFocus;
95
+ let n = r[i];
96
+ if (this.tabDirection === "backward" && this.previousFocus && this.possiblyHasTabbableChildren(this.previousFocus) || n && this.possiblyHasTabbableChildren(n)) return;
97
+ e.preventDefault(), this.currentFocus = n, (t = this.currentFocus) == null || t.focus({ preventScroll: !1 });
98
+ let o = [...S()];
99
+ if (o.includes(this.currentFocus) || !o.includes(this.previousFocus)) break;
100
+ }
101
+ setTimeout(() => this.checkFocus());
102
+ }, this.handleKeyUp = () => {
103
+ this.tabDirection = "forward";
104
+ }, this.element = e, this.elementsWithTabbableControls = ["iframe"];
105
+ }
106
+ activate() {
107
+ M.push(this.element), document.addEventListener("focusin", this.handleFocusIn), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
108
+ }
109
+ deactivate() {
110
+ M = M.filter((e) => e !== this.element), this.currentFocus = null, document.removeEventListener("focusin", this.handleFocusIn), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp);
111
+ }
112
+ isActive() {
113
+ return M[M.length - 1] === this.element;
114
+ }
115
+ activateExternal() {
116
+ this.isExternalActivated = !0;
117
+ }
118
+ deactivateExternal() {
119
+ this.isExternalActivated = !1;
120
+ }
121
+ checkFocus() {
122
+ if (this.isActive() && !this.isExternalActivated) {
123
+ let e = j(this.element);
124
+ if (!this.element.matches(":focus-within")) {
125
+ let t = e[0], n = e[e.length - 1], r = this.tabDirection === "forward" ? t : n;
126
+ typeof r?.focus == "function" && (this.currentFocus = r, r.focus({ preventScroll: !1 }));
127
+ }
128
+ }
129
+ }
130
+ possiblyHasTabbableChildren(e) {
131
+ return this.elementsWithTabbableControls.includes(e.tagName.toLowerCase()) || e.hasAttribute("controls");
132
+ }
133
+ }, P = b`
134
+ :host {
135
+ --width: 31rem;
136
+ --header-spacing: var(--sl-spacing-large);
137
+ --body-spacing: var(--sl-spacing-large);
138
+ --footer-spacing: var(--sl-spacing-large);
139
+
140
+ display: contents;
141
+ }
142
+
143
+ .dialog {
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ position: fixed;
148
+ top: 0;
149
+ right: 0;
150
+ bottom: 0;
151
+ left: 0;
152
+ z-index: var(--sl-z-index-dialog);
153
+ }
154
+
155
+ .dialog__panel {
156
+ display: flex;
157
+ flex-direction: column;
158
+ z-index: 2;
159
+ width: var(--width);
160
+ max-width: calc(100% - var(--sl-spacing-2x-large));
161
+ max-height: calc(100% - var(--sl-spacing-2x-large));
162
+ background-color: var(--sl-panel-background-color);
163
+ border-radius: var(--sl-border-radius-medium);
164
+ box-shadow: var(--sl-shadow-x-large);
165
+ }
166
+
167
+ .dialog__panel:focus {
168
+ outline: none;
169
+ }
170
+
171
+ /* Ensure there's enough vertical padding for phones that don't update vh when chrome appears (e.g. iPhone) */
172
+ @media screen and (max-width: 420px) {
173
+ .dialog__panel {
174
+ max-height: 80vh;
175
+ }
176
+ }
177
+
178
+ .dialog--open .dialog__panel {
179
+ display: flex;
180
+ opacity: 1;
181
+ }
182
+
183
+ .dialog__header {
184
+ flex: 0 0 auto;
185
+ display: flex;
186
+ }
187
+
188
+ .dialog__title {
189
+ flex: 1 1 auto;
190
+ font: inherit;
191
+ font-size: var(--sl-font-size-large);
192
+ line-height: var(--sl-line-height-dense);
193
+ padding: var(--header-spacing);
194
+ margin: 0;
195
+ }
196
+
197
+ .dialog__header-actions {
198
+ flex-shrink: 0;
199
+ display: flex;
200
+ flex-wrap: wrap;
201
+ justify-content: end;
202
+ gap: var(--sl-spacing-2x-small);
203
+ padding: 0 var(--header-spacing);
204
+ }
205
+
206
+ .dialog__header-actions sl-icon-button,
207
+ .dialog__header-actions ::slotted(sl-icon-button) {
208
+ flex: 0 0 auto;
209
+ display: flex;
210
+ align-items: center;
211
+ font-size: var(--sl-font-size-medium);
212
+ }
213
+
214
+ .dialog__body {
215
+ flex: 1 1 auto;
216
+ display: block;
217
+ padding: var(--body-spacing);
218
+ overflow: auto;
219
+ -webkit-overflow-scrolling: touch;
220
+ }
221
+
222
+ .dialog__footer {
223
+ flex: 0 0 auto;
224
+ text-align: right;
225
+ padding: var(--footer-spacing);
226
+ }
227
+
228
+ .dialog__footer ::slotted(sl-button:not(:first-of-type)) {
229
+ margin-inline-start: var(--sl-spacing-x-small);
230
+ }
231
+
232
+ .dialog:not(.dialog--has-footer) .dialog__footer {
233
+ display: none;
234
+ }
235
+
236
+ .dialog__overlay {
237
+ position: fixed;
238
+ top: 0;
239
+ right: 0;
240
+ bottom: 0;
241
+ left: 0;
242
+ background-color: var(--sl-overlay-background-color);
243
+ }
244
+
245
+ @media (forced-colors: active) {
246
+ .dialog__panel {
247
+ border: solid 1px var(--sl-color-neutral-0);
248
+ }
249
+ }
250
+ `, F = class extends f {
251
+ constructor() {
252
+ super(...arguments), this.hasSlotController = new g(this, "footer"), this.localize = new _(this), this.modal = new N(this), this.open = !1, this.label = "", this.noHeader = !1, this.handleDocumentKeyDown = (e) => {
253
+ e.key === "Escape" && this.modal.isActive() && this.open && (e.stopPropagation(), this.requestClose("keyboard"));
254
+ };
255
+ }
256
+ firstUpdated() {
257
+ this.dialog.hidden = !this.open, this.open && (this.addOpenListeners(), this.modal.activate(), y(this));
258
+ }
259
+ disconnectedCallback() {
260
+ super.disconnectedCallback(), this.modal.deactivate(), v(this), this.removeOpenListeners();
261
+ }
262
+ requestClose(e) {
263
+ if (this.emit("sl-request-close", {
264
+ cancelable: !0,
265
+ detail: { source: e }
266
+ }).defaultPrevented) {
267
+ let e = o(this, "dialog.denyClose", { dir: this.localize.dir() });
268
+ c(this.panel, e.keyframes, e.options);
269
+ return;
270
+ }
271
+ this.hide();
272
+ }
273
+ addOpenListeners() {
274
+ var e;
275
+ "CloseWatcher" in window ? ((e = this.closeWatcher) == null || e.destroy(), this.closeWatcher = new CloseWatcher(), this.closeWatcher.onclose = () => this.requestClose("keyboard")) : document.addEventListener("keydown", this.handleDocumentKeyDown);
276
+ }
277
+ removeOpenListeners() {
278
+ var e;
279
+ (e = this.closeWatcher) == null || e.destroy(), document.removeEventListener("keydown", this.handleDocumentKeyDown);
280
+ }
281
+ async handleOpenChange() {
282
+ if (this.open) {
283
+ this.emit("sl-show"), this.addOpenListeners(), this.originalTrigger = document.activeElement, this.modal.activate(), y(this);
284
+ let e = this.querySelector("[autofocus]");
285
+ e && e.removeAttribute("autofocus"), await Promise.all([a(this.dialog), a(this.overlay)]), this.dialog.hidden = !1, requestAnimationFrame(() => {
286
+ this.emit("sl-initial-focus", { cancelable: !0 }).defaultPrevented || (e ? e.focus({ preventScroll: !0 }) : this.panel.focus({ preventScroll: !0 })), e && e.setAttribute("autofocus", "");
287
+ });
288
+ let t = o(this, "dialog.show", { dir: this.localize.dir() }), n = o(this, "dialog.overlay.show", { dir: this.localize.dir() });
289
+ await Promise.all([c(this.panel, t.keyframes, t.options), c(this.overlay, n.keyframes, n.options)]), this.emit("sl-after-show");
290
+ } else {
291
+ n(this), this.emit("sl-hide"), this.removeOpenListeners(), this.modal.deactivate(), await Promise.all([a(this.dialog), a(this.overlay)]);
292
+ let e = o(this, "dialog.hide", { dir: this.localize.dir() }), t = o(this, "dialog.overlay.hide", { dir: this.localize.dir() });
293
+ await Promise.all([c(this.overlay, t.keyframes, t.options).then(() => {
294
+ this.overlay.hidden = !0;
295
+ }), c(this.panel, e.keyframes, e.options).then(() => {
296
+ this.panel.hidden = !0;
297
+ })]), this.dialog.hidden = !0, this.overlay.hidden = !1, this.panel.hidden = !1, v(this);
298
+ let r = this.originalTrigger;
299
+ typeof r?.focus == "function" && setTimeout(() => r.focus()), this.emit("sl-after-hide");
300
+ }
301
+ }
302
+ async show() {
303
+ if (!this.open) return this.open = !0, r(this, "sl-after-show");
304
+ }
305
+ async hide() {
306
+ if (this.open) return this.open = !1, r(this, "sl-after-hide");
307
+ }
308
+ render() {
309
+ return x`
310
+ <div
311
+ part="base"
312
+ class=${m({
313
+ dialog: !0,
314
+ "dialog--open": this.open,
315
+ "dialog--has-footer": this.hasSlotController.test("footer")
316
+ })}
317
+ >
318
+ <div part="overlay" class="dialog__overlay" @click=${() => this.requestClose("overlay")} tabindex="-1"></div>
319
+
320
+ <div
321
+ part="panel"
322
+ class="dialog__panel"
323
+ role="dialog"
324
+ aria-modal="true"
325
+ aria-hidden=${this.open ? "false" : "true"}
326
+ aria-label=${h(this.noHeader ? this.label : void 0)}
327
+ aria-labelledby=${h(this.noHeader ? void 0 : "title")}
328
+ tabindex="-1"
329
+ >
330
+ ${this.noHeader ? "" : x`
331
+ <header part="header" class="dialog__header">
332
+ <h2 part="title" class="dialog__title" id="title">
333
+ <slot name="label"> ${this.label.length > 0 ? this.label : ""} </slot>
334
+ </h2>
335
+ <div part="header-actions" class="dialog__header-actions">
336
+ <slot name="header-actions"></slot>
337
+ <sl-icon-button
338
+ part="close-button"
339
+ exportparts="base:close-button__base"
340
+ class="dialog__close"
341
+ name="x-lg"
342
+ label=${this.localize.term("close")}
343
+ library="system"
344
+ @click="${() => this.requestClose("close-button")}"
345
+ ></sl-icon-button>
346
+ </div>
347
+ </header>
348
+ `}
349
+ ${""}
350
+ <div part="body" class="dialog__body" tabindex="-1"><slot></slot></div>
351
+
352
+ <footer part="footer" class="dialog__footer">
353
+ <slot name="footer"></slot>
354
+ </footer>
355
+ </div>
356
+ </div>
357
+ `;
358
+ }
359
+ };
360
+ //#endregion
361
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.EZCUSG7Q.js
362
+ F.styles = [p, P], F.dependencies = { "sl-icon-button": i }, u([t(".dialog")], F.prototype, "dialog", 2), u([t(".dialog__panel")], F.prototype, "panel", 2), u([t(".dialog__overlay")], F.prototype, "overlay", 2), u([e({
363
+ type: Boolean,
364
+ reflect: !0
365
+ })], F.prototype, "open", 2), u([e({ reflect: !0 })], F.prototype, "label", 2), u([e({
366
+ attribute: "no-header",
367
+ type: Boolean,
368
+ reflect: !0
369
+ })], F.prototype, "noHeader", 2), u([l("open", { waitUntilFirstUpdate: !0 })], F.prototype, "handleOpenChange", 1), s("dialog.show", {
370
+ keyframes: [{
371
+ opacity: 0,
372
+ scale: .8
373
+ }, {
374
+ opacity: 1,
375
+ scale: 1
376
+ }],
377
+ options: {
378
+ duration: 250,
379
+ easing: "ease"
380
+ }
381
+ }), s("dialog.hide", {
382
+ keyframes: [{
383
+ opacity: 1,
384
+ scale: 1
385
+ }, {
386
+ opacity: 0,
387
+ scale: .8
388
+ }],
389
+ options: {
390
+ duration: 250,
391
+ easing: "ease"
392
+ }
393
+ }), s("dialog.denyClose", {
394
+ keyframes: [
395
+ { scale: 1 },
396
+ { scale: 1.02 },
397
+ { scale: 1 }
398
+ ],
399
+ options: { duration: 250 }
400
+ }), s("dialog.overlay.show", {
401
+ keyframes: [{ opacity: 0 }, { opacity: 1 }],
402
+ options: { duration: 250 }
403
+ }), s("dialog.overlay.hide", {
404
+ keyframes: [{ opacity: 1 }, { opacity: 0 }],
405
+ options: { duration: 250 }
406
+ }), F.define("sl-dialog"), i.define("sl-icon-button");
407
+ //#endregion
408
+ export { k as n, C as t };