@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,284 @@
1
+ import { a as e, i as t, n } from "./decorators-B35AgiCU.js";
2
+ import { d as r, f as i, l as a, t as o, u as s } from "./chunk.YHLNUJ7P-D-kanrCf.js";
3
+ import { a as c, n as l, t as u } from "./chunk.NYIIDP5N-BikXIStD.js";
4
+ import { t as d } from "./chunk.3RPBFEDE-BFO1fHVm.js";
5
+ import { n as f, r as p } from "./input-CeGntPlT.js";
6
+ import { t as m } from "./chunk.SI4ACBFK-CLb9VfMG.js";
7
+ import { css as h, html as g } from "lit";
8
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.R3NF57O3.js
9
+ var _ = h`
10
+ :host {
11
+ display: inline-block;
12
+ }
13
+
14
+ .checkbox {
15
+ position: relative;
16
+ display: inline-flex;
17
+ align-items: flex-start;
18
+ font-family: var(--sl-input-font-family);
19
+ font-weight: var(--sl-input-font-weight);
20
+ color: var(--sl-input-label-color);
21
+ vertical-align: middle;
22
+ cursor: pointer;
23
+ }
24
+
25
+ .checkbox--small {
26
+ --toggle-size: var(--sl-toggle-size-small);
27
+ font-size: var(--sl-input-font-size-small);
28
+ }
29
+
30
+ .checkbox--medium {
31
+ --toggle-size: var(--sl-toggle-size-medium);
32
+ font-size: var(--sl-input-font-size-medium);
33
+ }
34
+
35
+ .checkbox--large {
36
+ --toggle-size: var(--sl-toggle-size-large);
37
+ font-size: var(--sl-input-font-size-large);
38
+ }
39
+
40
+ .checkbox__control {
41
+ flex: 0 0 auto;
42
+ position: relative;
43
+ display: inline-flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ width: var(--toggle-size);
47
+ height: var(--toggle-size);
48
+ border: solid var(--sl-input-border-width) var(--sl-input-border-color);
49
+ border-radius: 2px;
50
+ background-color: var(--sl-input-background-color);
51
+ color: var(--sl-color-neutral-0);
52
+ transition:
53
+ var(--sl-transition-fast) border-color,
54
+ var(--sl-transition-fast) background-color,
55
+ var(--sl-transition-fast) color,
56
+ var(--sl-transition-fast) box-shadow;
57
+ }
58
+
59
+ .checkbox__input {
60
+ position: absolute;
61
+ opacity: 0;
62
+ padding: 0;
63
+ margin: 0;
64
+ pointer-events: none;
65
+ }
66
+
67
+ .checkbox__checked-icon,
68
+ .checkbox__indeterminate-icon {
69
+ display: inline-flex;
70
+ width: var(--toggle-size);
71
+ height: var(--toggle-size);
72
+ }
73
+
74
+ /* Hover */
75
+ .checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
76
+ border-color: var(--sl-input-border-color-hover);
77
+ background-color: var(--sl-input-background-color-hover);
78
+ }
79
+
80
+ /* Focus */
81
+ .checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
82
+ outline: var(--sl-focus-ring);
83
+ outline-offset: var(--sl-focus-ring-offset);
84
+ }
85
+
86
+ /* Checked/indeterminate */
87
+ .checkbox--checked .checkbox__control,
88
+ .checkbox--indeterminate .checkbox__control {
89
+ border-color: var(--sl-color-primary-600);
90
+ background-color: var(--sl-color-primary-600);
91
+ }
92
+
93
+ /* Checked/indeterminate + hover */
94
+ .checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
95
+ .checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
96
+ border-color: var(--sl-color-primary-500);
97
+ background-color: var(--sl-color-primary-500);
98
+ }
99
+
100
+ /* Checked/indeterminate + focus */
101
+ .checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control,
102
+ .checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
103
+ outline: var(--sl-focus-ring);
104
+ outline-offset: var(--sl-focus-ring-offset);
105
+ }
106
+
107
+ /* Disabled */
108
+ .checkbox--disabled {
109
+ opacity: 0.5;
110
+ cursor: not-allowed;
111
+ }
112
+
113
+ .checkbox__label {
114
+ display: inline-block;
115
+ color: var(--sl-input-label-color);
116
+ line-height: var(--toggle-size);
117
+ margin-inline-start: 0.5em;
118
+ user-select: none;
119
+ -webkit-user-select: none;
120
+ }
121
+
122
+ :host([required]) .checkbox__label::after {
123
+ content: var(--sl-input-required-content);
124
+ color: var(--sl-input-required-content-color);
125
+ margin-inline-start: var(--sl-input-required-content-offset);
126
+ }
127
+ `, v = class extends a {
128
+ constructor() {
129
+ super(...arguments), this.formControlController = new d(this, {
130
+ value: (e) => e.checked ? e.value || "on" : void 0,
131
+ defaultValue: (e) => e.defaultChecked,
132
+ setValue: (e, t) => e.checked = t
133
+ }), this.hasSlotController = new u(this, "help-text"), this.hasFocus = !1, this.title = "", this.name = "", this.size = "medium", this.disabled = !1, this.checked = !1, this.indeterminate = !1, this.defaultChecked = !1, this.form = "", this.required = !1, this.helpText = "";
134
+ }
135
+ get validity() {
136
+ return this.input.validity;
137
+ }
138
+ get validationMessage() {
139
+ return this.input.validationMessage;
140
+ }
141
+ firstUpdated() {
142
+ this.formControlController.updateValidity();
143
+ }
144
+ handleClick() {
145
+ this.checked = !this.checked, this.indeterminate = !1, this.emit("sl-change");
146
+ }
147
+ handleBlur() {
148
+ this.hasFocus = !1, this.emit("sl-blur");
149
+ }
150
+ handleInput() {
151
+ this.emit("sl-input");
152
+ }
153
+ handleInvalid(e) {
154
+ this.formControlController.setValidity(!1), this.formControlController.emitInvalidEvent(e);
155
+ }
156
+ handleFocus() {
157
+ this.hasFocus = !0, this.emit("sl-focus");
158
+ }
159
+ handleDisabledChange() {
160
+ this.formControlController.setValidity(this.disabled);
161
+ }
162
+ handleStateChange() {
163
+ this.input.checked = this.checked, this.input.indeterminate = this.indeterminate, this.formControlController.updateValidity();
164
+ }
165
+ click() {
166
+ this.input.click();
167
+ }
168
+ focus(e) {
169
+ this.input.focus(e);
170
+ }
171
+ blur() {
172
+ this.input.blur();
173
+ }
174
+ checkValidity() {
175
+ return this.input.checkValidity();
176
+ }
177
+ getForm() {
178
+ return this.formControlController.getForm();
179
+ }
180
+ reportValidity() {
181
+ return this.input.reportValidity();
182
+ }
183
+ setCustomValidity(e) {
184
+ this.input.setCustomValidity(e), this.formControlController.updateValidity();
185
+ }
186
+ render() {
187
+ let e = this.hasSlotController.test("help-text"), t = this.helpText ? !0 : !!e;
188
+ return g`
189
+ <div
190
+ class=${c({
191
+ "form-control": !0,
192
+ "form-control--small": this.size === "small",
193
+ "form-control--medium": this.size === "medium",
194
+ "form-control--large": this.size === "large",
195
+ "form-control--has-help-text": t
196
+ })}
197
+ >
198
+ <label
199
+ part="base"
200
+ class=${c({
201
+ checkbox: !0,
202
+ "checkbox--checked": this.checked,
203
+ "checkbox--disabled": this.disabled,
204
+ "checkbox--focused": this.hasFocus,
205
+ "checkbox--indeterminate": this.indeterminate,
206
+ "checkbox--small": this.size === "small",
207
+ "checkbox--medium": this.size === "medium",
208
+ "checkbox--large": this.size === "large"
209
+ })}
210
+ >
211
+ <input
212
+ class="checkbox__input"
213
+ type="checkbox"
214
+ title=${this.title}
215
+ name=${this.name}
216
+ value=${l(this.value)}
217
+ .indeterminate=${f(this.indeterminate)}
218
+ .checked=${f(this.checked)}
219
+ .disabled=${this.disabled}
220
+ .required=${this.required}
221
+ aria-checked=${this.checked ? "true" : "false"}
222
+ aria-describedby="help-text"
223
+ @click=${this.handleClick}
224
+ @input=${this.handleInput}
225
+ @invalid=${this.handleInvalid}
226
+ @blur=${this.handleBlur}
227
+ @focus=${this.handleFocus}
228
+ />
229
+
230
+ <span
231
+ part="control${this.checked ? " control--checked" : ""}${this.indeterminate ? " control--indeterminate" : ""}"
232
+ class="checkbox__control"
233
+ >
234
+ ${this.checked ? g`
235
+ <sl-icon part="checked-icon" class="checkbox__checked-icon" library="system" name="check"></sl-icon>
236
+ ` : ""}
237
+ ${!this.checked && this.indeterminate ? g`
238
+ <sl-icon
239
+ part="indeterminate-icon"
240
+ class="checkbox__indeterminate-icon"
241
+ library="system"
242
+ name="indeterminate"
243
+ ></sl-icon>
244
+ ` : ""}
245
+ </span>
246
+
247
+ <div part="label" class="checkbox__label">
248
+ <slot></slot>
249
+ </div>
250
+ </label>
251
+
252
+ <div
253
+ aria-hidden=${t ? "false" : "true"}
254
+ class="form-control__help-text"
255
+ id="help-text"
256
+ part="form-control-help-text"
257
+ >
258
+ <slot name="help-text">${this.helpText}</slot>
259
+ </div>
260
+ </div>
261
+ `;
262
+ }
263
+ };
264
+ //#endregion
265
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.D5YQDJ7X.js
266
+ v.styles = [
267
+ s,
268
+ m,
269
+ _
270
+ ], v.dependencies = { "sl-icon": o }, i([n("input[type=\"checkbox\"]")], v.prototype, "input", 2), i([t()], v.prototype, "hasFocus", 2), i([e()], v.prototype, "title", 2), i([e()], v.prototype, "name", 2), i([e()], v.prototype, "value", 2), i([e({ reflect: !0 })], v.prototype, "size", 2), i([e({
271
+ type: Boolean,
272
+ reflect: !0
273
+ })], v.prototype, "disabled", 2), i([e({
274
+ type: Boolean,
275
+ reflect: !0
276
+ })], v.prototype, "checked", 2), i([e({
277
+ type: Boolean,
278
+ reflect: !0
279
+ })], v.prototype, "indeterminate", 2), i([p("checked")], v.prototype, "defaultChecked", 2), i([e({ reflect: !0 })], v.prototype, "form", 2), i([e({
280
+ type: Boolean,
281
+ reflect: !0
282
+ })], v.prototype, "required", 2), i([e({ attribute: "help-text" })], v.prototype, "helpText", 2), i([r("disabled", { waitUntilFirstUpdate: !0 })], v.prototype, "handleDisabledChange", 1), i([r(["checked", "indeterminate"], { waitUntilFirstUpdate: !0 })], v.prototype, "handleStateChange", 1), v.define("sl-checkbox");
283
+ //#endregion
284
+ export { v as t };
@@ -0,0 +1,20 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (e && (t = e(e = 0)), t), s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), c = (e, n) => {
3
+ let r = {};
4
+ for (var i in e) t(r, i, {
5
+ get: e[i],
6
+ enumerable: !0
7
+ });
8
+ return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, l = (e, i, o, s) => {
10
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
11
+ get: ((e) => i[e]).bind(null, d),
12
+ enumerable: !(s = n(i, d)) || s.enumerable
13
+ });
14
+ return e;
15
+ }, u = (n, r, a) => (a = n == null ? {} : e(i(n)), l(r || !n || !n.__esModule ? t(a, "default", {
16
+ value: n,
17
+ enumerable: !0
18
+ }) : a, n)), d = (e) => a.call(e, "module.exports") ? e["module.exports"] : l(t({}, "__esModule", { value: !0 }), e);
19
+ //#endregion
20
+ export { u as a, d as i, o as n, c as r, s as t };
@@ -0,0 +1,77 @@
1
+ import { l as e, u as t } from "./chunk.YHLNUJ7P-D-kanrCf.js";
2
+ import { t as n } from "./chunk.6CTB5ZDJ-DjZrBd6Y.js";
3
+ import { css as r, html as i } from "lit";
4
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.7DUCI5S4.js
5
+ var a = r`
6
+ :host {
7
+ --track-width: 2px;
8
+ --track-color: rgb(128 128 128 / 25%);
9
+ --indicator-color: var(--sl-color-primary-600);
10
+ --speed: 2s;
11
+
12
+ display: inline-flex;
13
+ width: 1em;
14
+ height: 1em;
15
+ flex: none;
16
+ }
17
+
18
+ .spinner {
19
+ flex: 1 1 auto;
20
+ height: 100%;
21
+ width: 100%;
22
+ }
23
+
24
+ .spinner__track,
25
+ .spinner__indicator {
26
+ fill: none;
27
+ stroke-width: var(--track-width);
28
+ r: calc(0.5em - var(--track-width) / 2);
29
+ cx: 0.5em;
30
+ cy: 0.5em;
31
+ transform-origin: 50% 50%;
32
+ }
33
+
34
+ .spinner__track {
35
+ stroke: var(--track-color);
36
+ transform-origin: 0% 0%;
37
+ }
38
+
39
+ .spinner__indicator {
40
+ stroke: var(--indicator-color);
41
+ stroke-linecap: round;
42
+ stroke-dasharray: 150% 75%;
43
+ animation: spin var(--speed) linear infinite;
44
+ }
45
+
46
+ @keyframes spin {
47
+ 0% {
48
+ transform: rotate(0deg);
49
+ stroke-dasharray: 0.05em, 3em;
50
+ }
51
+
52
+ 50% {
53
+ transform: rotate(450deg);
54
+ stroke-dasharray: 1.375em, 1.375em;
55
+ }
56
+
57
+ 100% {
58
+ transform: rotate(1080deg);
59
+ stroke-dasharray: 0.05em, 3em;
60
+ }
61
+ }
62
+ `, o = class extends e {
63
+ constructor() {
64
+ super(...arguments), this.localize = new n(this);
65
+ }
66
+ render() {
67
+ return i`
68
+ <svg part="base" class="spinner" role="progressbar" aria-label=${this.localize.term("loading")}>
69
+ <circle class="spinner__track"></circle>
70
+ <circle class="spinner__indicator"></circle>
71
+ </svg>
72
+ `;
73
+ }
74
+ };
75
+ o.styles = [t, a];
76
+ //#endregion
77
+ export { o as t };
@@ -0,0 +1,138 @@
1
+ import { m as e, p as t } from "./chunk.YHLNUJ7P-D-kanrCf.js";
2
+ //#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.3RPBFEDE.js
3
+ var n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakSet(), o = /* @__PURE__ */ new WeakMap(), s = class {
4
+ constructor(t, r) {
5
+ this.handleFormData = (e) => {
6
+ let t = this.options.disabled(this.host), n = this.options.name(this.host), r = this.options.value(this.host), i = this.host.tagName.toLowerCase() === "sl-button";
7
+ this.host.isConnected && !t && !i && typeof n == "string" && n.length > 0 && r !== void 0 && (Array.isArray(r) ? r.forEach((t) => {
8
+ e.formData.append(n, t.toString());
9
+ }) : e.formData.append(n, r.toString()));
10
+ }, this.handleFormSubmit = (e) => {
11
+ var t;
12
+ let r = this.options.disabled(this.host), i = this.options.reportValidity;
13
+ this.form && !this.form.noValidate && ((t = n.get(this.form)) == null || t.forEach((e) => {
14
+ this.setUserInteracted(e, !0);
15
+ })), this.form && !this.form.noValidate && !r && !i(this.host) && (e.preventDefault(), e.stopImmediatePropagation());
16
+ }, this.handleFormReset = () => {
17
+ this.options.setValue(this.host, this.options.defaultValue(this.host)), this.setUserInteracted(this.host, !1), o.set(this.host, []);
18
+ }, this.handleInteraction = (e) => {
19
+ let t = o.get(this.host);
20
+ t.includes(e.type) || t.push(e.type), t.length === this.options.assumeInteractionOn.length && this.setUserInteracted(this.host, !0);
21
+ }, this.checkFormValidity = () => {
22
+ if (this.form && !this.form.noValidate) {
23
+ let e = this.form.querySelectorAll("*");
24
+ for (let t of e) if (typeof t.checkValidity == "function" && !t.checkValidity()) return !1;
25
+ }
26
+ return !0;
27
+ }, this.reportFormValidity = () => {
28
+ if (this.form && !this.form.noValidate) {
29
+ let e = this.form.querySelectorAll("*");
30
+ for (let t of e) if (typeof t.reportValidity == "function" && !t.reportValidity()) return !1;
31
+ }
32
+ return !0;
33
+ }, (this.host = t).addController(this), this.options = e({
34
+ form: (e) => {
35
+ let t = e.form;
36
+ if (t) {
37
+ let n = e.getRootNode().querySelector(`#${t}`);
38
+ if (n) return n;
39
+ }
40
+ return e.closest("form");
41
+ },
42
+ name: (e) => e.name,
43
+ value: (e) => e.value,
44
+ defaultValue: (e) => e.defaultValue,
45
+ disabled: (e) => e.disabled ?? !1,
46
+ reportValidity: (e) => typeof e.reportValidity == "function" ? e.reportValidity() : !0,
47
+ checkValidity: (e) => typeof e.checkValidity == "function" ? e.checkValidity() : !0,
48
+ setValue: (e, t) => e.value = t,
49
+ assumeInteractionOn: ["sl-input"]
50
+ }, r);
51
+ }
52
+ hostConnected() {
53
+ let e = this.options.form(this.host);
54
+ e && this.attachForm(e), o.set(this.host, []), this.options.assumeInteractionOn.forEach((e) => {
55
+ this.host.addEventListener(e, this.handleInteraction);
56
+ });
57
+ }
58
+ hostDisconnected() {
59
+ this.detachForm(), o.delete(this.host), this.options.assumeInteractionOn.forEach((e) => {
60
+ this.host.removeEventListener(e, this.handleInteraction);
61
+ });
62
+ }
63
+ hostUpdated() {
64
+ let e = this.options.form(this.host);
65
+ e || this.detachForm(), e && this.form !== e && (this.detachForm(), this.attachForm(e)), this.host.hasUpdated && this.setValidity(this.host.validity.valid);
66
+ }
67
+ attachForm(e) {
68
+ e ? (this.form = e, n.has(this.form) ? n.get(this.form).add(this.host) : n.set(this.form, /* @__PURE__ */ new Set([this.host])), this.form.addEventListener("formdata", this.handleFormData), this.form.addEventListener("submit", this.handleFormSubmit), this.form.addEventListener("reset", this.handleFormReset), r.has(this.form) || (r.set(this.form, this.form.reportValidity), this.form.reportValidity = () => this.reportFormValidity()), i.has(this.form) || (i.set(this.form, this.form.checkValidity), this.form.checkValidity = () => this.checkFormValidity())) : this.form = void 0;
69
+ }
70
+ detachForm() {
71
+ if (!this.form) return;
72
+ let e = n.get(this.form);
73
+ e && (e.delete(this.host), e.size <= 0 && (this.form.removeEventListener("formdata", this.handleFormData), this.form.removeEventListener("submit", this.handleFormSubmit), this.form.removeEventListener("reset", this.handleFormReset), r.has(this.form) && (this.form.reportValidity = r.get(this.form), r.delete(this.form)), i.has(this.form) && (this.form.checkValidity = i.get(this.form), i.delete(this.form)), this.form = void 0));
74
+ }
75
+ setUserInteracted(e, t) {
76
+ t ? a.add(e) : a.delete(e), e.requestUpdate();
77
+ }
78
+ doAction(e, t) {
79
+ if (this.form) {
80
+ let n = document.createElement("button");
81
+ n.type = e, n.style.position = "absolute", n.style.width = "0", n.style.height = "0", n.style.clipPath = "inset(50%)", n.style.overflow = "hidden", n.style.whiteSpace = "nowrap", t && (n.name = t.name, n.value = t.value, [
82
+ "formaction",
83
+ "formenctype",
84
+ "formmethod",
85
+ "formnovalidate",
86
+ "formtarget"
87
+ ].forEach((e) => {
88
+ t.hasAttribute(e) && n.setAttribute(e, t.getAttribute(e));
89
+ })), this.form.append(n), n.click(), n.remove();
90
+ }
91
+ }
92
+ getForm() {
93
+ return this.form ?? null;
94
+ }
95
+ reset(e) {
96
+ this.doAction("reset", e);
97
+ }
98
+ submit(e) {
99
+ this.doAction("submit", e);
100
+ }
101
+ setValidity(e) {
102
+ let t = this.host, n = !!a.has(t), r = !!t.required;
103
+ t.toggleAttribute("data-required", r), t.toggleAttribute("data-optional", !r), t.toggleAttribute("data-invalid", !e), t.toggleAttribute("data-valid", e), t.toggleAttribute("data-user-invalid", !e && n), t.toggleAttribute("data-user-valid", e && n);
104
+ }
105
+ updateValidity() {
106
+ let e = this.host;
107
+ this.setValidity(e.validity.valid);
108
+ }
109
+ emitInvalidEvent(e) {
110
+ let t = new CustomEvent("sl-invalid", {
111
+ bubbles: !1,
112
+ composed: !1,
113
+ cancelable: !0,
114
+ detail: {}
115
+ });
116
+ e || t.preventDefault(), this.host.dispatchEvent(t) || e?.preventDefault();
117
+ }
118
+ }, c = Object.freeze({
119
+ badInput: !1,
120
+ customError: !1,
121
+ patternMismatch: !1,
122
+ rangeOverflow: !1,
123
+ rangeUnderflow: !1,
124
+ stepMismatch: !1,
125
+ tooLong: !1,
126
+ tooShort: !1,
127
+ typeMismatch: !1,
128
+ valid: !0,
129
+ valueMissing: !1
130
+ }), l = Object.freeze(t(e({}, c), {
131
+ valid: !1,
132
+ valueMissing: !0
133
+ })), u = Object.freeze(t(e({}, c), {
134
+ valid: !1,
135
+ customError: !0
136
+ }));
137
+ //#endregion
138
+ export { l as i, u as n, c as r, s as t };