@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.
- package/README.md +149 -0
- package/dist-lib/WMTS-DCN4zX0-.js +1169 -0
- package/dist-lib/alert-GeHlqlN8.js +310 -0
- package/dist-lib/assets/epsg-lookup.worker-J7TVnHDq.js +1 -0
- package/dist-lib/assets/shapefile.worker-kQfZj6G2.js +4 -0
- package/dist-lib/attribution-format-B4f05_u0.js +62 -0
- package/dist-lib/button-DFdGkRPQ.js +741 -0
- package/dist-lib/cesium-adapter-BHXNytkU.js +1488 -0
- package/dist-lib/checkbox-QoR4S8tV.js +284 -0
- package/dist-lib/chunk-HEgqtunE.js +20 -0
- package/dist-lib/chunk.36O46B5H-B6ZL7Sm1.js +77 -0
- package/dist-lib/chunk.3RPBFEDE-BFO1fHVm.js +138 -0
- package/dist-lib/chunk.5JY5FUCG-DTXsslmx.js +1090 -0
- package/dist-lib/chunk.6CTB5ZDJ-DjZrBd6Y.js +99 -0
- package/dist-lib/chunk.AJ3ENQ5C-Ci7Gm2b6.js +175 -0
- package/dist-lib/chunk.LD4M4QGE-CiCfhE8r.js +8 -0
- package/dist-lib/chunk.NYIIDP5N-BikXIStD.js +99 -0
- package/dist-lib/chunk.RWUUFNUL-DFztA4uV.js +43 -0
- package/dist-lib/chunk.SI4ACBFK-CLb9VfMG.js +61 -0
- package/dist-lib/chunk.YHLNUJ7P-D-kanrCf.js +503 -0
- package/dist-lib/core-CMAlSR68.js +22 -0
- package/dist-lib/decorate-CWgUV1hU.js +1139 -0
- package/dist-lib/decorators-B35AgiCU.js +351 -0
- package/dist-lib/deferred-query-service-BJDcngw6.js +386 -0
- package/dist-lib/dist-Dm6b7XCs.js +12318 -0
- package/dist-lib/dist-Ha9LQCut.js +244 -0
- package/dist-lib/dist-c1PlDAd1.js +2359 -0
- package/dist-lib/dist-kKlmcBXq.js +50 -0
- package/dist-lib/divider-CPm675yY.js +41 -0
- package/dist-lib/dropped-config-C_GyVa8o.js +17 -0
- package/dist-lib/dropped-layer-builder-DAaYgUPk.js +396 -0
- package/dist-lib/epsg-definitions-BZLZWa8Q.js +668 -0
- package/dist-lib/esm-CTuscnN5.js +46 -0
- package/dist-lib/file-sniff-Dhxj3KTF.js +251 -0
- package/dist-lib/geo-calculations-DbFJAUoI.js +30 -0
- package/dist-lib/icon-CEOgWlro.js +9 -0
- package/dist-lib/icon-button-Da_nBTy3.js +408 -0
- package/dist-lib/input-CeGntPlT.js +590 -0
- package/dist-lib/layer-discovery-afWzu5hY.js +2825 -0
- package/dist-lib/leaflet-adapter-D9djjrKv.js +1227 -0
- package/dist-lib/lib-CdHVicAE.js +4074 -0
- package/dist-lib/map-layer-registry-2cmkiRDK.js +62 -0
- package/dist-lib/maplibre-adapter-TFc3e0G9.js +1190 -0
- package/dist-lib/maplibre-expression-evaluator-DCWUcpwf.js +7233 -0
- package/dist-lib/marker-utils-DztWXeop.js +12 -0
- package/dist-lib/ol-tilegrid-9VtyxaLG.js +64 -0
- package/dist-lib/openlayers-adapter-DVW1KCRv.js +13307 -0
- package/dist-lib/option-CBxl1mZP.js +1106 -0
- package/dist-lib/papaparse.min-B7v3c0D7.js +501 -0
- package/dist-lib/rbush-C8k41T4z.js +254 -0
- package/dist-lib/shapefile-SawVY6xg.js +207 -0
- package/dist-lib/spinner-DysxdNG9.js +6 -0
- package/dist-lib/src-CL94RDe3.js +111 -0
- package/dist-lib/throttle-BeneRNYK.js +16 -0
- package/dist-lib/toast-Cm28o9U6.js +15 -0
- package/dist-lib/togeojson.es-DAgiTBvg.js +579 -0
- package/dist-lib/tooltip-Cucn1SiD.js +197 -0
- package/dist-lib/webmapx-3d-tool-D4CTD2gB.js +176 -0
- package/dist-lib/webmapx-base-tool-Dm9NAWLD.js +75 -0
- package/dist-lib/webmapx-config-edit-tool-DCTyxqTk.js +389 -0
- package/dist-lib/webmapx-coordinates-tool-jeWohup9.js +648 -0
- package/dist-lib/webmapx-core-bundle-BDImi1RE.js +8203 -0
- package/dist-lib/webmapx-draw-tool-DooAV8cF.js +4336 -0
- package/dist-lib/webmapx-geolocation-tool-Rw3-Iad1.js +788 -0
- package/dist-lib/webmapx-import-layer-tool-DRYviHd5.js +250 -0
- package/dist-lib/webmapx-info-tool-BJA157cy.js +412 -0
- package/dist-lib/webmapx-language-osmvector-M5y_lwOg.js +489 -0
- package/dist-lib/webmapx-measure-tool-BXhMJFC6.js +590 -0
- package/dist-lib/webmapx-modal-tool-eF6Naluv.js +84 -0
- package/dist-lib/webmapx-plugin-tool-D2Hghf9n.js +45 -0
- package/dist-lib/webmapx-print-tool-ob1bOsR5.js +348 -0
- package/dist-lib/webmapx-search-tool-Cv8BrYvY.js +437 -0
- package/dist-lib/webmapx-settings-DDEJ8aoV.js +479 -0
- package/dist-lib/webmapx-truearea-tool-CMB4Orm-.js +615 -0
- package/dist-lib/webmapx-view-mode-tool-CUpLNjOj.js +106 -0
- package/dist-lib/webmapx.css +2 -0
- package/dist-lib/webmapx.js +1321 -0
- package/dist-lib/wms-feature-info-C0RVMEQC.js +145 -0
- package/dist-lib/wms-url-builder-DIJLQ1v2.js +54 -0
- package/dist-lib/zip.js-DVhmtjxZ.js +3615 -0
- package/package.json +107 -0
- package/public/data/country-epsg-codes.json +297 -0
- package/public/data/world-countries-simplified.topojson +1 -0
- package/src/locales/en/core.json +20 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { a as e, i as t, n } from "./decorators-B35AgiCU.js";
|
|
2
|
+
import { t as r } from "./chunk.LD4M4QGE-CiCfhE8r.js";
|
|
3
|
+
import { a as i, c as a, i as o, o as s, s as c, t as l } from "./chunk.AJ3ENQ5C-Ci7Gm2b6.js";
|
|
4
|
+
import { d as u, f as d, l as f, u as p } from "./chunk.YHLNUJ7P-D-kanrCf.js";
|
|
5
|
+
import { a as m, t as h } from "./chunk.NYIIDP5N-BikXIStD.js";
|
|
6
|
+
import { t as g } from "./chunk.6CTB5ZDJ-DjZrBd6Y.js";
|
|
7
|
+
import { css as _, html as v } from "lit";
|
|
8
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.HPCLRZ2S.js
|
|
9
|
+
var y = _`
|
|
10
|
+
:host {
|
|
11
|
+
display: contents;
|
|
12
|
+
|
|
13
|
+
/* For better DX, we'll reset the margin here so the base part can inherit it */
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.alert {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: stretch;
|
|
21
|
+
background-color: var(--sl-panel-background-color);
|
|
22
|
+
border: solid var(--sl-panel-border-width) var(--sl-panel-border-color);
|
|
23
|
+
border-top-width: calc(var(--sl-panel-border-width) * 3);
|
|
24
|
+
border-radius: var(--sl-border-radius-medium);
|
|
25
|
+
font-family: var(--sl-font-sans);
|
|
26
|
+
font-size: var(--sl-font-size-small);
|
|
27
|
+
font-weight: var(--sl-font-weight-normal);
|
|
28
|
+
line-height: 1.6;
|
|
29
|
+
color: var(--sl-color-neutral-700);
|
|
30
|
+
margin: inherit;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.alert:not(.alert--has-icon) .alert__icon,
|
|
35
|
+
.alert:not(.alert--closable) .alert__close-button {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.alert__icon {
|
|
40
|
+
flex: 0 0 auto;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
font-size: var(--sl-font-size-large);
|
|
44
|
+
padding-inline-start: var(--sl-spacing-large);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.alert--has-countdown {
|
|
48
|
+
border-bottom: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.alert--primary {
|
|
52
|
+
border-top-color: var(--sl-color-primary-600);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.alert--primary .alert__icon {
|
|
56
|
+
color: var(--sl-color-primary-600);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.alert--success {
|
|
60
|
+
border-top-color: var(--sl-color-success-600);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.alert--success .alert__icon {
|
|
64
|
+
color: var(--sl-color-success-600);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.alert--neutral {
|
|
68
|
+
border-top-color: var(--sl-color-neutral-600);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.alert--neutral .alert__icon {
|
|
72
|
+
color: var(--sl-color-neutral-600);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.alert--warning {
|
|
76
|
+
border-top-color: var(--sl-color-warning-600);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.alert--warning .alert__icon {
|
|
80
|
+
color: var(--sl-color-warning-600);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.alert--danger {
|
|
84
|
+
border-top-color: var(--sl-color-danger-600);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.alert--danger .alert__icon {
|
|
88
|
+
color: var(--sl-color-danger-600);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.alert__message {
|
|
92
|
+
flex: 1 1 auto;
|
|
93
|
+
display: block;
|
|
94
|
+
padding: var(--sl-spacing-large);
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.alert__close-button {
|
|
99
|
+
flex: 0 0 auto;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
font-size: var(--sl-font-size-medium);
|
|
103
|
+
margin-inline-end: var(--sl-spacing-medium);
|
|
104
|
+
align-self: center;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.alert__countdown {
|
|
108
|
+
position: absolute;
|
|
109
|
+
bottom: 0;
|
|
110
|
+
left: 0;
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: calc(var(--sl-panel-border-width) * 3);
|
|
113
|
+
background-color: var(--sl-panel-border-color);
|
|
114
|
+
display: flex;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.alert__countdown--ltr {
|
|
118
|
+
justify-content: flex-end;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.alert__countdown .alert__countdown-elapsed {
|
|
122
|
+
height: 100%;
|
|
123
|
+
width: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.alert--primary .alert__countdown-elapsed {
|
|
127
|
+
background-color: var(--sl-color-primary-600);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.alert--success .alert__countdown-elapsed {
|
|
131
|
+
background-color: var(--sl-color-success-600);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.alert--neutral .alert__countdown-elapsed {
|
|
135
|
+
background-color: var(--sl-color-neutral-600);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.alert--warning .alert__countdown-elapsed {
|
|
139
|
+
background-color: var(--sl-color-warning-600);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.alert--danger .alert__countdown-elapsed {
|
|
143
|
+
background-color: var(--sl-color-danger-600);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.alert__timer {
|
|
147
|
+
display: none;
|
|
148
|
+
}
|
|
149
|
+
`, b = class e extends f {
|
|
150
|
+
constructor() {
|
|
151
|
+
super(...arguments), this.hasSlotController = new h(this, "icon", "suffix"), this.localize = new g(this), this.open = !1, this.closable = !1, this.variant = "primary", this.duration = Infinity, this.remainingTime = this.duration;
|
|
152
|
+
}
|
|
153
|
+
static get toastStack() {
|
|
154
|
+
return this.currentToastStack ||= Object.assign(document.createElement("div"), { className: "sl-toast-stack" }), this.currentToastStack;
|
|
155
|
+
}
|
|
156
|
+
firstUpdated() {
|
|
157
|
+
this.base.hidden = !this.open;
|
|
158
|
+
}
|
|
159
|
+
restartAutoHide() {
|
|
160
|
+
this.handleCountdownChange(), clearTimeout(this.autoHideTimeout), clearInterval(this.remainingTimeInterval), this.open && this.duration < Infinity && (this.autoHideTimeout = window.setTimeout(() => this.hide(), this.duration), this.remainingTime = this.duration, this.remainingTimeInterval = window.setInterval(() => {
|
|
161
|
+
this.remainingTime -= 100;
|
|
162
|
+
}, 100));
|
|
163
|
+
}
|
|
164
|
+
pauseAutoHide() {
|
|
165
|
+
var e;
|
|
166
|
+
(e = this.countdownAnimation) == null || e.pause(), clearTimeout(this.autoHideTimeout), clearInterval(this.remainingTimeInterval);
|
|
167
|
+
}
|
|
168
|
+
resumeAutoHide() {
|
|
169
|
+
var e;
|
|
170
|
+
this.duration < Infinity && (this.autoHideTimeout = window.setTimeout(() => this.hide(), this.remainingTime), this.remainingTimeInterval = window.setInterval(() => {
|
|
171
|
+
this.remainingTime -= 100;
|
|
172
|
+
}, 100), (e = this.countdownAnimation) == null || e.play());
|
|
173
|
+
}
|
|
174
|
+
handleCountdownChange() {
|
|
175
|
+
if (this.open && this.duration < Infinity && this.countdown) {
|
|
176
|
+
let { countdownElement: e } = this;
|
|
177
|
+
this.countdownAnimation = e.animate([{ width: "100%" }, { width: "0" }], {
|
|
178
|
+
duration: this.duration,
|
|
179
|
+
easing: "linear"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
handleCloseClick() {
|
|
184
|
+
this.hide();
|
|
185
|
+
}
|
|
186
|
+
async handleOpenChange() {
|
|
187
|
+
if (this.open) {
|
|
188
|
+
this.emit("sl-show"), this.duration < Infinity && this.restartAutoHide(), await o(this.base), this.base.hidden = !1;
|
|
189
|
+
let { keyframes: e, options: t } = s(this, "alert.show", { dir: this.localize.dir() });
|
|
190
|
+
await l(this.base, e, t), this.emit("sl-after-show");
|
|
191
|
+
} else {
|
|
192
|
+
r(this), this.emit("sl-hide"), clearTimeout(this.autoHideTimeout), clearInterval(this.remainingTimeInterval), await o(this.base);
|
|
193
|
+
let { keyframes: e, options: t } = s(this, "alert.hide", { dir: this.localize.dir() });
|
|
194
|
+
await l(this.base, e, t), this.base.hidden = !0, this.emit("sl-after-hide");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
handleDurationChange() {
|
|
198
|
+
this.restartAutoHide();
|
|
199
|
+
}
|
|
200
|
+
async show() {
|
|
201
|
+
if (!this.open) return this.open = !0, i(this, "sl-after-show");
|
|
202
|
+
}
|
|
203
|
+
async hide() {
|
|
204
|
+
if (this.open) return this.open = !1, i(this, "sl-after-hide");
|
|
205
|
+
}
|
|
206
|
+
async toast() {
|
|
207
|
+
return new Promise((t) => {
|
|
208
|
+
this.handleCountdownChange(), e.toastStack.parentElement === null && document.body.append(e.toastStack), e.toastStack.appendChild(this), requestAnimationFrame(() => {
|
|
209
|
+
this.clientWidth, this.show();
|
|
210
|
+
}), this.addEventListener("sl-after-hide", () => {
|
|
211
|
+
e.toastStack.removeChild(this), t(), e.toastStack.querySelector("sl-alert") === null && e.toastStack.remove();
|
|
212
|
+
}, { once: !0 });
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
render() {
|
|
216
|
+
return v`
|
|
217
|
+
<div
|
|
218
|
+
part="base"
|
|
219
|
+
class=${m({
|
|
220
|
+
alert: !0,
|
|
221
|
+
"alert--open": this.open,
|
|
222
|
+
"alert--closable": this.closable,
|
|
223
|
+
"alert--has-countdown": !!this.countdown,
|
|
224
|
+
"alert--has-icon": this.hasSlotController.test("icon"),
|
|
225
|
+
"alert--primary": this.variant === "primary",
|
|
226
|
+
"alert--success": this.variant === "success",
|
|
227
|
+
"alert--neutral": this.variant === "neutral",
|
|
228
|
+
"alert--warning": this.variant === "warning",
|
|
229
|
+
"alert--danger": this.variant === "danger"
|
|
230
|
+
})}
|
|
231
|
+
role="alert"
|
|
232
|
+
aria-hidden=${this.open ? "false" : "true"}
|
|
233
|
+
@mouseenter=${this.pauseAutoHide}
|
|
234
|
+
@mouseleave=${this.resumeAutoHide}
|
|
235
|
+
>
|
|
236
|
+
<div part="icon" class="alert__icon">
|
|
237
|
+
<slot name="icon"></slot>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div part="message" class="alert__message" aria-live="polite">
|
|
241
|
+
<slot></slot>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
${this.closable ? v`
|
|
245
|
+
<sl-icon-button
|
|
246
|
+
part="close-button"
|
|
247
|
+
exportparts="base:close-button__base"
|
|
248
|
+
class="alert__close-button"
|
|
249
|
+
name="x-lg"
|
|
250
|
+
library="system"
|
|
251
|
+
label=${this.localize.term("close")}
|
|
252
|
+
@click=${this.handleCloseClick}
|
|
253
|
+
></sl-icon-button>
|
|
254
|
+
` : ""}
|
|
255
|
+
|
|
256
|
+
<div role="timer" class="alert__timer">${this.remainingTime}</div>
|
|
257
|
+
|
|
258
|
+
${this.countdown ? v`
|
|
259
|
+
<div
|
|
260
|
+
class=${m({
|
|
261
|
+
alert__countdown: !0,
|
|
262
|
+
"alert__countdown--ltr": this.countdown === "ltr"
|
|
263
|
+
})}
|
|
264
|
+
>
|
|
265
|
+
<div class="alert__countdown-elapsed"></div>
|
|
266
|
+
</div>
|
|
267
|
+
` : ""}
|
|
268
|
+
</div>
|
|
269
|
+
`;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
b.styles = [p, y], b.dependencies = { "sl-icon-button": a }, d([n("[part~=\"base\"]")], b.prototype, "base", 2), d([n(".alert__countdown-elapsed")], b.prototype, "countdownElement", 2), d([e({
|
|
273
|
+
type: Boolean,
|
|
274
|
+
reflect: !0
|
|
275
|
+
})], b.prototype, "open", 2), d([e({
|
|
276
|
+
type: Boolean,
|
|
277
|
+
reflect: !0
|
|
278
|
+
})], b.prototype, "closable", 2), d([e({ reflect: !0 })], b.prototype, "variant", 2), d([e({ type: Number })], b.prototype, "duration", 2), d([e({
|
|
279
|
+
type: String,
|
|
280
|
+
reflect: !0
|
|
281
|
+
})], b.prototype, "countdown", 2), d([t()], b.prototype, "remainingTime", 2), d([u("open", { waitUntilFirstUpdate: !0 })], b.prototype, "handleOpenChange", 1), d([u("duration")], b.prototype, "handleDurationChange", 1);
|
|
282
|
+
var x = b;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region node_modules/@shoelace-style/shoelace/dist/chunks/chunk.R45OWEVP.js
|
|
285
|
+
c("alert.show", {
|
|
286
|
+
keyframes: [{
|
|
287
|
+
opacity: 0,
|
|
288
|
+
scale: .8
|
|
289
|
+
}, {
|
|
290
|
+
opacity: 1,
|
|
291
|
+
scale: 1
|
|
292
|
+
}],
|
|
293
|
+
options: {
|
|
294
|
+
duration: 250,
|
|
295
|
+
easing: "ease"
|
|
296
|
+
}
|
|
297
|
+
}), c("alert.hide", {
|
|
298
|
+
keyframes: [{
|
|
299
|
+
opacity: 1,
|
|
300
|
+
scale: 1
|
|
301
|
+
}, {
|
|
302
|
+
opacity: 0,
|
|
303
|
+
scale: .8
|
|
304
|
+
}],
|
|
305
|
+
options: {
|
|
306
|
+
duration: 250,
|
|
307
|
+
easing: "ease"
|
|
308
|
+
}
|
|
309
|
+
}), x.define("sl-alert");
|
|
310
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){let e=null,t=null,n=!1,r=``;async function i(i){r=i;try{let i=await fetch(`${r}/data/country-epsg-codes.json`);if(!i.ok)throw Error(`Failed to load country EPSG codes: ${i.status}`);e=await i.json();let o=await fetch(`${r}/data/world-countries-simplified.topojson`);if(!o.ok)throw Error(`Failed to load world countries TopoJSON: ${o.status}`);t=a(await o.json()),console.log(`Loaded ${t.features.length} countries`),n=!0}catch(e){throw n=!1,e}}function a(e){let t=[],n=Object.keys(e.objects)[0],r=e.objects[n];if(!r.geometries)throw Error(`Invalid TopoJSON: no geometries found`);function i(t){let n=t<0,r=e.arcs[Math.abs(t)],i=[],a=0,o=0;for(let[e,t]of r)a+=e,o+=t,i.push([a,o]);if(e.transform){let{scale:t,translate:r}=e.transform,a=i.map(([e,n])=>[e*t[0]+r[0],n*t[1]+r[1]]);return n?a.reverse():a}return n?i.reverse():i}function a(e){let t=[];for(let n=0;n<e.length;n++){let r=i(e[n]);n===0?t.push(...r):t.push(...r.slice(1))}return t}function o(e){return e.map(e=>a(e))}for(let e of r.geometries)if(e.type===`Polygon`){let n=o(e.arcs);t.push({type:`Feature`,properties:e.properties||{},geometry:{type:`Polygon`,coordinates:n}})}else if(e.type===`MultiPolygon`){let n=e.arcs.map(e=>o(e));t.push({type:`Feature`,properties:e.properties||{},geometry:{type:`MultiPolygon`,coordinates:n}})}if(console.log(`Converted ${t.length} features from TopoJSON`),t.length>0){let e=t[0];console.log(`Sample feature: ${e.properties.NAME}, type: ${e.geometry.type}, rings: ${e.geometry.type===`Polygon`?e.geometry.coordinates.length:`N/A`}`)}return{type:`FeatureCollection`,features:t}}function o(e,t){let[n,r]=e,i=t[0],a=!1;for(let e=0,t=i.length-1;e<i.length;t=e++){let o=i[e][0],s=i[e][1],c=i[t][0],l=i[t][1];s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(a=!a)}return a}function s(e){let t=0,n=e.length;for(let r=0;r<n-1;r++)t+=e[r][0]*e[r+1][1]-e[r+1][0]*e[r][1];return Math.abs(t)/2}function c(e){let t=0;if(e.geometry.type===`Polygon`){let n=e.geometry.coordinates;t=s(n[0])}else if(e.geometry.type===`MultiPolygon`){let n=e.geometry.coordinates;for(let e of n)t+=s(e[0])}return t}function l(e,n){if(!t)return[];let r=[e,n],i=[];for(let e of t.features){let t=!1;if(e.geometry.type===`Polygon`)t=o(r,e.geometry.coordinates);else if(e.geometry.type===`MultiPolygon`){let n=e.geometry.coordinates;for(let e of n)if(o(r,e)){t=!0;break}}if(t){let t=c(e);i.push({feature:e,area:t})}}if(i.sort((e,t)=>e.area-t.area),i.length>0){let e=i.map(e=>`${e.feature.properties.NAME} (${e.feature.properties.ISO_A3})`).join(`, `);console.log(`Matched countries: ${e}`)}return i.map(e=>e.feature)}function u(r,i){if(!n||!e||!t)return{success:!1,error:`Data not loaded`};if(r<-90||r>90||i<-180||i>180)return{success:!1,error:`Invalid coordinates`};let a=l(i,r);if(a.length===0)return{success:!1,error:`Coordinates not found in any country`};let o=a[0],s=o.properties.ISO_A3,c=e.countries[s];if(!c)return{success:!1,error:`No EPSG data for country: ${s}`,countryCode:s,countryName:o.properties.NAME};let u=a.slice(1).map(t=>{let n=t.properties.ISO_A3;if(!e)return null;let r=e.countries[n];return r?{countryCode:n,countryName:r.name,epsgCodes:r.epsgCodes,primaryEpsg:r.primary}:null}).filter(Boolean);return{success:!0,countryCode:s,countryName:c.name,epsgCodes:c.epsgCodes,primaryEpsg:c.primary,...u.length>0&&{alternativeMatches:u}}}function d(){e=null,t=null,n=!1}self.onmessage=async e=>{let t=e.data;try{switch(t.type){case`loadData`:await i(t.baseUrl),self.postMessage({type:`ready`,success:!0});break;case`lookup`:{let e=u(t.lat,t.lng),n={type:`lookup-result`,requestId:t.requestId,...e};self.postMessage(n);break}case`shutdown`:d(),self.postMessage({type:`shutdown-complete`});break;default:console.warn(`Unknown message type:`,t.type)}}catch(e){if(t.type===`loadData`){let t={type:`ready`,success:!1,error:e instanceof Error?e.message:String(e)};self.postMessage(t)}else if(t.type===`lookup`){let n={type:`lookup-result`,requestId:t.requestId,success:!1,error:e instanceof Error?e.message:String(e)};self.postMessage(n)}}},console.log(`EPSG Lookup Worker v2 initialized`),self.postMessage({type:`worker-initialized`})})();
|