@arenarium/maps 1.3.12 → 1.3.14
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/dist/main.css +2 -1
- package/dist/main.js +2 -3470
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1,3470 +1,2 @@
|
|
|
1
|
-
class Ft {
|
|
2
|
-
invoked = !1;
|
|
3
|
-
running = !1;
|
|
4
|
-
interval;
|
|
5
|
-
timeout;
|
|
6
|
-
callback;
|
|
7
|
-
constructor(e, n) {
|
|
8
|
-
if ((n ?? 0) < 0) throw new Error("Invalid interval");
|
|
9
|
-
this.interval = n ?? (navigator?.hardwareConcurrency ? 200 / navigator.hardwareConcurrency : 100), this.callback = e;
|
|
10
|
-
}
|
|
11
|
-
async process() {
|
|
12
|
-
this.invoked = !1, await this.callback() || !this.invoked ? this.stop() : this.timeout = window.setTimeout(this.process.bind(this), this.interval);
|
|
13
|
-
}
|
|
14
|
-
run() {
|
|
15
|
-
this.invoked = !0, this.running || (this.running = !0, this.timeout = window.setTimeout(this.process.bind(this), 0));
|
|
16
|
-
}
|
|
17
|
-
stop() {
|
|
18
|
-
this.invoked = !1, this.running = !1, this.timeout && window.clearTimeout(this.timeout), this.timeout = void 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
class pi {
|
|
22
|
-
properites;
|
|
23
|
-
state;
|
|
24
|
-
constructor(e, n, r, i, s, a, u) {
|
|
25
|
-
this.properites = { id: e, lat: n, lng: r, rank: i, pin: s, tooltip: a, popup: u }, this.state = void 0;
|
|
26
|
-
}
|
|
27
|
-
get input() {
|
|
28
|
-
const e = this.properites, n = e.tooltip.dimensions;
|
|
29
|
-
return {
|
|
30
|
-
id: e.id,
|
|
31
|
-
lat: e.lat,
|
|
32
|
-
lng: e.lng,
|
|
33
|
-
rank: e.rank,
|
|
34
|
-
width: n.width + 2 * n.padding,
|
|
35
|
-
height: n.height + 2 * n.padding
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
class di {
|
|
40
|
-
callback;
|
|
41
|
-
timeout;
|
|
42
|
-
id;
|
|
43
|
-
constructor(e, n) {
|
|
44
|
-
if (n <= 0) throw new Error("Invalid timeout");
|
|
45
|
-
this.callback = e, this.timeout = n;
|
|
46
|
-
}
|
|
47
|
-
start() {
|
|
48
|
-
this.id == null && (this.id = window.setInterval(this.callback, this.timeout));
|
|
49
|
-
}
|
|
50
|
-
stop() {
|
|
51
|
-
this.id != null && (window.clearInterval(this.id), this.id = void 0);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const mi = 100;
|
|
55
|
-
class vi {
|
|
56
|
-
viewport = void 0;
|
|
57
|
-
state = "idle";
|
|
58
|
-
provider;
|
|
59
|
-
interval;
|
|
60
|
-
onCancel;
|
|
61
|
-
onError;
|
|
62
|
-
onMove;
|
|
63
|
-
onIdle;
|
|
64
|
-
onClick;
|
|
65
|
-
constructor(e, n, r, i, s, a) {
|
|
66
|
-
this.provider = e, this.interval = new di(this.onInterval.bind(this), mi / (navigator?.hardwareConcurrency ?? 1)), this.onCancel = n, this.onError = r, this.onMove = i, this.onIdle = s, this.onClick = a;
|
|
67
|
-
}
|
|
68
|
-
start() {
|
|
69
|
-
this.interval.start(), this.provider.getContainer().addEventListener("click", this.onClick.bind(this));
|
|
70
|
-
}
|
|
71
|
-
stop() {
|
|
72
|
-
this.interval.stop(), this.provider.getContainer().removeEventListener("click", this.onClick.bind(this));
|
|
73
|
-
}
|
|
74
|
-
idle() {
|
|
75
|
-
return this.state == "idle";
|
|
76
|
-
}
|
|
77
|
-
onInterval() {
|
|
78
|
-
try {
|
|
79
|
-
if (this.onCancel()) {
|
|
80
|
-
this.interval.stop();
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const e = this.provider.getViewport(), n = this.state, r = JSON.stringify(e) !== JSON.stringify(this.viewport) ? "move" : "idle";
|
|
84
|
-
r == "move" && this.onMove(), r == "idle" && n == "move" && this.onIdle(), this.state = r, this.viewport = e;
|
|
85
|
-
} catch (e) {
|
|
86
|
-
this.onError("Failed to process map state interval", e);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
class Yn {
|
|
91
|
-
worker;
|
|
92
|
-
workerInvocations;
|
|
93
|
-
workerInvocationCounter = 0;
|
|
94
|
-
constructor(e) {
|
|
95
|
-
this.worker = e, this.workerInvocations = /* @__PURE__ */ new Map(), this.worker.onmessage = this.onmessage.bind(this), this.worker.onerror = this.onerror.bind(this);
|
|
96
|
-
}
|
|
97
|
-
onmessage(e) {
|
|
98
|
-
const n = this.workerInvocations.get(e.data.id);
|
|
99
|
-
if (!n) throw new Error(`Unknown invocation: ${e.data.id}`);
|
|
100
|
-
e.data.error ? n.reject(new Error(e.data.error)) : n.resolve(e.data.result), this.workerInvocations.delete(e.data.id);
|
|
101
|
-
}
|
|
102
|
-
onerror(e) {
|
|
103
|
-
this.workerInvocations.forEach((n) => n.reject(new Error(e.message))), this.workerInvocations.clear();
|
|
104
|
-
}
|
|
105
|
-
invoke(e, ...n) {
|
|
106
|
-
return new Promise((r, i) => {
|
|
107
|
-
const s = `${e.toString()}_${this.workerInvocationCounter++}_${performance.now()}`, a = { id: s, method: e.toString(), args: n };
|
|
108
|
-
this.workerInvocations.set(s, { resolve: r, reject: i }), this.worker.postMessage(a);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
terminate() {
|
|
112
|
-
this.workerInvocations.forEach((e) => e.reject(new Error("Terminated"))), this.workerInvocations.clear(), this.worker.terminate();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
class Oe {
|
|
116
|
-
remove;
|
|
117
|
-
insert;
|
|
118
|
-
constructor(e, n) {
|
|
119
|
-
this.remove = e, this.insert = n;
|
|
120
|
-
}
|
|
121
|
-
static from(e, n) {
|
|
122
|
-
const r = new Set(e), i = new Set(n), s = Array.from(r.difference(i)), a = Array.from(i.difference(r));
|
|
123
|
-
return new Oe(s, a);
|
|
124
|
-
}
|
|
125
|
-
static empty() {
|
|
126
|
-
return new Oe([], []);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const Jn = '(function(){"use strict";class T{methods;constructor(t){this.methods=t}listen(){self.onmessage=this.onmessage.bind(this)}async onmessage(t){const{id:e,method:n,args:s}=t.data;try{const r=this.methods[n];if(typeof r!="function")throw new Error(`Unknown method: ${n}`);const o=await r(...s),i={id:e,result:o};self.postMessage(i)}catch(r){const o=r instanceof Error?r.message:String(r),i={id:e,error:o};self.postMessage(i)}}}function w(l,t,e){return{x:I(t)*e,y:P(l)*e}}function m(l,t,e){return{lat:x(t/e),lng:R(l/e)}}function I(l){return(180+l)/360}function P(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function R(l){return l*360-180}function x(l){return 360/Math.PI*Math.atan(Math.exp((180-l*360)*Math.PI/180))-90}class c{sw;ne;constructor(t,e,n,s){if(n<t)throw new Error(`Invalid bounds: ${t}, ${e}, ${n}, ${s}`);if(s<e)throw new Error(`Invalid bounds: ${t}, ${e}, ${n}, ${s}`);this.sw={lat:t,lng:e},this.ne={lat:n,lng:s}}contains(t,e){return!(t<this.sw.lat||this.ne.lat<t||e<this.sw.lng||this.ne.lng<e)}intersects(t){return!(t.ne.lat<this.sw.lat||this.ne.lat<t.sw.lat||t.ne.lng<this.sw.lng||this.ne.lng<t.sw.lng)}}class h{blockL;blockR;sw;ne;constructor(t,e,n,s){if(n<t)throw new Error(`Invalid bounds: ${t}, ${e}, ${n}, ${s}`);this.sw={lat:t,lng:e},this.ne={lat:n,lng:s},e<s?(this.blockL=new c(t,e,n,s),this.blockR=new c(0,0,0,0)):(this.blockL=new c(t,-180,n,s),this.blockR=new c(t,e,n,180))}static bounds(t){const e=t.bounds,n=t.center;return e.sw.lng<=n.lng&&e.ne.lng<=n.lng?{sw:{lat:e.sw.lat,lng:-180},ne:{lat:e.ne.lat,lng:180}}:e.sw.lng>=n.lng&&e.ne.lng>=n.lng?{sw:{lat:e.sw.lat,lng:-180},ne:{lat:e.ne.lat,lng:180}}:Math.abs(e.ne.lng-n.lng)+Math.abs(e.sw.lng-n.lng)>360?{sw:{lat:e.sw.lat,lng:-180},ne:{lat:e.ne.lat,lng:180}}:e.ne.lng-e.sw.lng>360?{sw:{lat:e.sw.lat,lng:-180},ne:{lat:e.ne.lat,lng:180}}:t.bounds}static create(t){const e=this.bounds(t),n=e.sw,s=e.ne;return new h(n.lat,n.lng,s.lat,s.lng)}static offset(t,e,n){const s=this.bounds(t),r=t.zoom,o=e*Math.pow(2,r),i=w(s.sw.lat,s.sw.lng,o),a=w(s.ne.lat,s.ne.lng,o);let g=Math.max(i.x-n.left,0),f=Math.min(i.y+n.bottom,o),D=Math.min(a.x+n.right,o),N=Math.max(a.y-n.top,0);const z=m(g,f,o),C=m(D,N,o);return new h(z.lat,z.lng,C.lat,C.lng)}contains(t,e){return this.blockL.contains(t,e)||this.blockR.contains(t,e)}intersects(t){return this.blockL.intersects(t)||this.blockR.intersects(t)}}class A{id;bounds;markers;constructor(t,e){this.id=t,this.bounds=e,this.markers=[]}belongs(t){const e=this.bounds.sw;if(t.lat<e.lat||t.lng<e.lng)return!1;const n=this.bounds.ne;return!(n.lat<t.lat||n.lng<t.lng)}neighbours(t,e){const n=Math.abs(t.id.length-this.id.length);if(n>e)return!1;const s=Math.min(this.id.length,t.id.length)-e+n;for(let r=0;r<s;r++)if(this.id[r]!=t.id[r])return!1;return!0}}class u{tree;zoom;cell;branches;constructor(t,e,n,s){this.tree=t,this.zoom=n,this.cell=new A(e,s),this.branches=new Array}split(){const t=this.cell.bounds,e=Math.pow(2,this.tree.depth),n=(t.ne.lat-t.sw.lat)/e,s=(t.ne.lng-t.sw.lng)/e;for(let r=0;r<e;r++)for(let o=0;o<e;o++){const i=t.sw.lat+r*n,a=t.sw.lng+o*s,g=i+n,f=a+s;this.branches.push(new u(this.tree,`${this.cell.id}${r*2+o}`,this.zoom+this.tree.depth,{sw:{lat:i,lng:a},ne:{lat:g,lng:f}}))}}add(t){if(this.cell.belongs(t)==!1)return!1;if(this.cell.markers.length<this.tree.capacity)return this.cell.markers.push(t),!0;this.branches.length==0&&this.split();for(let e=0;e<this.branches.length;e++)if(this.branches[e].add(t))return!0;throw new Error("Failed to add marker to branch")}compact(){if(this.branches.length==0)return;for(let s=0;s<this.branches.length;s++)this.branches[s].compact();const t=new Array,e=new Array;for(let s=0;s<this.branches.length;s++){const r=this.branches[s];t.push(...r.branches),e.push(...r.cell.markers)}const n=new u(this.tree,this.cell.id,this.zoom+this.tree.depth,this.cell.bounds);n.branches=t,n.cell.markers=e,this.branches=[n]}cells(t,e,n){if(t<this.zoom||e.intersects(this.cell.bounds)==!1)return n;n.push(this.cell);for(let s=0;s<this.branches.length;s++)this.branches[s].cells(t,e,n);return n}print(t){console.log(`${"---".repeat(t)}|${this.cell.id} zoom=[${this.zoom}] markers=[${this.cell.markers.length}]`);for(let e=0;e<this.branches.length;e++)this.branches[e].print(t+1)}count(){return this.cell.markers.length+this.branches.reduce((t,e)=>t+e.count(),0)}}class S{capacity;depth;root;constructor(t,e,n){this.capacity=n,this.depth=e,this.root=new u(this,"R",t,{sw:{lat:-90,lng:-180},ne:{lat:90,lng:180}})}add(t){return this.root.add(t)}compact(){this.root.compact()}cells(t,e){const n=new Array;return this.root.cells(t,e,n),n}print(){this.root.print(0)}}const v=16,p=2,k=1,M=v*4;let b,d,E=p,$=k,y=M;const _={update(l,t,e){const n=-Math.floor(Math.log2(l.size/y)),s=new S(n,$,E);for(let o=0;o<t.length;o++){const i=t[o];if(!s.add(i))throw new Error("Failed to add marker to tree")}const r=-n;for(let o=0;o<r;o++)s.compact();b=s,d=e},configure(l){E=l?.process?.visibility?.cell?.capacity??p,$=l?.process?.visibility?.cell?.depth??k,y=l?.process?.visibility?.cell?.size??M},filter(l,t){if(!b||!d)return[];const e=h.create(t);let n=[],s=t.zoom;for(;s<l.zoom.max&&n.length<d;)n=b.cells(s,e).flatMap(r=>r.markers),s++;return n.map(r=>r.index)}};new T(_).listen()})();\n', _n = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Jn], { type: "text/javascript;charset=utf-8" });
|
|
130
|
-
function gi(t) {
|
|
131
|
-
let e;
|
|
132
|
-
try {
|
|
133
|
-
if (e = _n && (self.URL || self.webkitURL).createObjectURL(_n), !e) throw "";
|
|
134
|
-
const n = new Worker(e, {
|
|
135
|
-
name: t?.name
|
|
136
|
-
});
|
|
137
|
-
return n.addEventListener("error", () => {
|
|
138
|
-
(self.URL || self.webkitURL).revokeObjectURL(e);
|
|
139
|
-
}), n;
|
|
140
|
-
} catch {
|
|
141
|
-
return new Worker(
|
|
142
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(Jn),
|
|
143
|
-
{
|
|
144
|
-
name: t?.name
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function Xe(t, e, n) {
|
|
150
|
-
return { x: wi(e) * n, y: ki(t) * n };
|
|
151
|
-
}
|
|
152
|
-
function Mn(t, e, n) {
|
|
153
|
-
return { lat: bi(e / n), lng: yi(t / n) };
|
|
154
|
-
}
|
|
155
|
-
function wi(t) {
|
|
156
|
-
return (180 + t) / 360;
|
|
157
|
-
}
|
|
158
|
-
function ki(t) {
|
|
159
|
-
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t * Math.PI / 360))) / 360;
|
|
160
|
-
}
|
|
161
|
-
function yi(t) {
|
|
162
|
-
return t * 360 - 180;
|
|
163
|
-
}
|
|
164
|
-
function bi(t) {
|
|
165
|
-
return 360 / Math.PI * Math.atan(Math.exp((180 - t * 360) * Math.PI / 180)) - 90;
|
|
166
|
-
}
|
|
167
|
-
class pt {
|
|
168
|
-
sw;
|
|
169
|
-
ne;
|
|
170
|
-
constructor(e, n, r, i) {
|
|
171
|
-
if (r < e) throw new Error(`Invalid bounds: ${e}, ${n}, ${r}, ${i}`);
|
|
172
|
-
if (i < n) throw new Error(`Invalid bounds: ${e}, ${n}, ${r}, ${i}`);
|
|
173
|
-
this.sw = { lat: e, lng: n }, this.ne = { lat: r, lng: i };
|
|
174
|
-
}
|
|
175
|
-
contains(e, n) {
|
|
176
|
-
return !(e < this.sw.lat || this.ne.lat < e || n < this.sw.lng || this.ne.lng < n);
|
|
177
|
-
}
|
|
178
|
-
intersects(e) {
|
|
179
|
-
return !(e.ne.lat < this.sw.lat || this.ne.lat < e.sw.lat || e.ne.lng < this.sw.lng || this.ne.lng < e.sw.lng);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
class Qe {
|
|
183
|
-
blockL;
|
|
184
|
-
blockR;
|
|
185
|
-
sw;
|
|
186
|
-
ne;
|
|
187
|
-
constructor(e, n, r, i) {
|
|
188
|
-
if (r < e) throw new Error(`Invalid bounds: ${e}, ${n}, ${r}, ${i}`);
|
|
189
|
-
this.sw = { lat: e, lng: n }, this.ne = { lat: r, lng: i }, n < i ? (this.blockL = new pt(e, n, r, i), this.blockR = new pt(0, 0, 0, 0)) : (this.blockL = new pt(e, -180, r, i), this.blockR = new pt(e, n, r, 180));
|
|
190
|
-
}
|
|
191
|
-
static bounds(e) {
|
|
192
|
-
const n = e.bounds, r = e.center;
|
|
193
|
-
return n.sw.lng <= r.lng && n.ne.lng <= r.lng ? { sw: { lat: n.sw.lat, lng: -180 }, ne: { lat: n.ne.lat, lng: 180 } } : n.sw.lng >= r.lng && n.ne.lng >= r.lng ? { sw: { lat: n.sw.lat, lng: -180 }, ne: { lat: n.ne.lat, lng: 180 } } : Math.abs(n.ne.lng - r.lng) + Math.abs(n.sw.lng - r.lng) > 360 ? { sw: { lat: n.sw.lat, lng: -180 }, ne: { lat: n.ne.lat, lng: 180 } } : n.ne.lng - n.sw.lng > 360 ? { sw: { lat: n.sw.lat, lng: -180 }, ne: { lat: n.ne.lat, lng: 180 } } : e.bounds;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @param viewport - The viewport of the map.
|
|
197
|
-
*/
|
|
198
|
-
static create(e) {
|
|
199
|
-
const n = this.bounds(e), r = n.sw, i = n.ne;
|
|
200
|
-
return new Qe(r.lat, r.lng, i.lat, i.lng);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* @param viewport - The viewport of the map.
|
|
204
|
-
* @param size - The size of the map in pixels at zoom level 0.
|
|
205
|
-
* @param offsetX - The x offset of the map in pixels at zoom level n.
|
|
206
|
-
* @param offsetY - The y offset of the map in pixels at zoom level n.
|
|
207
|
-
*/
|
|
208
|
-
static offset(e, n, r) {
|
|
209
|
-
const i = this.bounds(e), s = e.zoom, a = n * Math.pow(2, s), u = Xe(i.sw.lat, i.sw.lng, a), o = Xe(i.ne.lat, i.ne.lng, a);
|
|
210
|
-
let l = Math.max(u.x - r.left, 0), c = Math.min(u.y + r.bottom, a), h = Math.min(o.x + r.right, a), f = Math.max(o.y - r.top, 0);
|
|
211
|
-
const m = Mn(l, c, a), d = Mn(h, f, a);
|
|
212
|
-
return new Qe(m.lat, m.lng, d.lat, d.lng);
|
|
213
|
-
}
|
|
214
|
-
contains(e, n) {
|
|
215
|
-
return this.blockL.contains(e, n) || this.blockR.contains(e, n);
|
|
216
|
-
}
|
|
217
|
-
intersects(e) {
|
|
218
|
-
return this.blockL.intersects(e) || this.blockR.intersects(e);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
const _i = 75, Mi = 125, En = 25e-5, Ei = 1e6, xi = 2e6, xn = 3e6, Xn = 10, Sn = 16, Si = 8, Pn = 2, ze = 0.5, Pi = "0px 2px 2px rgba(0, 0, 0, 0.5)", Ti = 8, Ii = 8, Ai = "drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.5))", Tn = "white", Ni = "darkgreen", In = 1024;
|
|
222
|
-
class Ci {
|
|
223
|
-
// State
|
|
224
|
-
markers;
|
|
225
|
-
markersVisible;
|
|
226
|
-
markerVisibilityTreeWorker;
|
|
227
|
-
markerVisibilityTreeWorkerClient;
|
|
228
|
-
markerVisibilityTreeLimit = In;
|
|
229
|
-
set configuration(e) {
|
|
230
|
-
this.markerVisibilityTreeWorkerClient?.invoke("configure", e), this.markerVisibilityTreeLimit = e?.process?.visibility?.limit ?? In;
|
|
231
|
-
}
|
|
232
|
-
getMarkers() {
|
|
233
|
-
return Array.from(this.markersVisible ?? []);
|
|
234
|
-
}
|
|
235
|
-
async getMarkersDelta(e, n) {
|
|
236
|
-
if (this.markerVisibilityTreeWorkerClient && this.markers) {
|
|
237
|
-
const r = await this.markerVisibilityTreeWorkerClient.invoke("filter", e, n), i = this.markersVisible, s = r.map((u) => this.markers[u]), a = Oe.from(i, s);
|
|
238
|
-
return this.markersVisible = s, a;
|
|
239
|
-
} else if (this.markers != this.markersVisible) {
|
|
240
|
-
const r = this.markersVisible, i = this.markers, s = Oe.from(r, i);
|
|
241
|
-
return this.markersVisible = i, s;
|
|
242
|
-
} else
|
|
243
|
-
return Oe.empty();
|
|
244
|
-
}
|
|
245
|
-
async updateMarkers(e, n) {
|
|
246
|
-
this.markers = n, n.length > this.markerVisibilityTreeLimit ? (this.markerVisibilityTreeWorker = new gi(), this.markerVisibilityTreeWorkerClient = new Yn(this.markerVisibilityTreeWorker), await this.markerVisibilityTreeWorkerClient.invoke(
|
|
247
|
-
"update",
|
|
248
|
-
e,
|
|
249
|
-
n.map((r, i) => ({ index: i, lat: r.properites.lat, lng: r.properites.lng })),
|
|
250
|
-
this.markerVisibilityTreeLimit
|
|
251
|
-
)) : (this.markerVisibilityTreeWorker = void 0, this.markerVisibilityTreeWorkerClient = void 0);
|
|
252
|
-
}
|
|
253
|
-
clearMarkers() {
|
|
254
|
-
this.markers = void 0, this.markersVisible = void 0, this.markerVisibilityTreeWorker = void 0, this.markerVisibilityTreeWorkerClient = void 0;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
const Ht = !1;
|
|
258
|
-
var Ri = Array.isArray, zi = Array.prototype.indexOf, Ve = Array.prototype.includes, Di = Array.from, Oi = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, Li = Object.prototype, Fi = Array.prototype, $i = Object.getPrototypeOf, An = Object.isExtensible;
|
|
259
|
-
const Vi = () => {
|
|
260
|
-
};
|
|
261
|
-
function Ui(t) {
|
|
262
|
-
for (var e = 0; e < t.length; e++)
|
|
263
|
-
t[e]();
|
|
264
|
-
}
|
|
265
|
-
function Gn() {
|
|
266
|
-
var t, e, n = new Promise((r, i) => {
|
|
267
|
-
t = r, e = i;
|
|
268
|
-
});
|
|
269
|
-
return { promise: n, resolve: t, reject: e };
|
|
270
|
-
}
|
|
271
|
-
const N = 2, rt = 4, Et = 8, Kn = 1 << 24, he = 16, Me = 32, Ce = 64, qt = 128, q = 512, A = 1024, C = 2048, Q = 4096, we = 8192, ke = 16384, Ue = 32768, _t = 65536, Nn = 1 << 17, Qn = 1 << 18, He = 1 << 19, ji = 1 << 20, Ne = 65536, Zt = 1 << 21, Qt = 1 << 22, ye = 1 << 23, wt = /* @__PURE__ */ Symbol("$state"), Pe = new class extends Error {
|
|
272
|
-
name = "StaleReactionError";
|
|
273
|
-
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
|
|
274
|
-
}();
|
|
275
|
-
function Wi() {
|
|
276
|
-
throw new Error("https://svelte.dev/e/async_derived_orphan");
|
|
277
|
-
}
|
|
278
|
-
function Bi() {
|
|
279
|
-
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
|
|
280
|
-
}
|
|
281
|
-
function Hi() {
|
|
282
|
-
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
|
|
283
|
-
}
|
|
284
|
-
function qi() {
|
|
285
|
-
throw new Error("https://svelte.dev/e/state_prototype_fixed");
|
|
286
|
-
}
|
|
287
|
-
function Zi() {
|
|
288
|
-
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
|
|
289
|
-
}
|
|
290
|
-
function Yi() {
|
|
291
|
-
throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
|
|
292
|
-
}
|
|
293
|
-
const I = /* @__PURE__ */ Symbol(), Ji = "http://www.w3.org/1999/xhtml";
|
|
294
|
-
function Xi() {
|
|
295
|
-
console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
|
|
296
|
-
}
|
|
297
|
-
function er(t) {
|
|
298
|
-
return t === this.v;
|
|
299
|
-
}
|
|
300
|
-
let Gi = !1, ee = null;
|
|
301
|
-
function je(t) {
|
|
302
|
-
ee = t;
|
|
303
|
-
}
|
|
304
|
-
function en(t, e = !1, n) {
|
|
305
|
-
ee = {
|
|
306
|
-
p: ee,
|
|
307
|
-
i: !1,
|
|
308
|
-
c: null,
|
|
309
|
-
e: null,
|
|
310
|
-
s: t,
|
|
311
|
-
x: null,
|
|
312
|
-
l: null
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
function tn(t) {
|
|
316
|
-
var e = (
|
|
317
|
-
/** @type {ComponentContext} */
|
|
318
|
-
ee
|
|
319
|
-
), n = e.e;
|
|
320
|
-
if (n !== null) {
|
|
321
|
-
e.e = null;
|
|
322
|
-
for (var r of n)
|
|
323
|
-
ys(r);
|
|
324
|
-
}
|
|
325
|
-
return t !== void 0 && (e.x = t), e.i = !0, ee = e.p, t ?? /** @type {T} */
|
|
326
|
-
{};
|
|
327
|
-
}
|
|
328
|
-
function tr() {
|
|
329
|
-
return !0;
|
|
330
|
-
}
|
|
331
|
-
let De = [];
|
|
332
|
-
function Ki() {
|
|
333
|
-
var t = De;
|
|
334
|
-
De = [], Ui(t);
|
|
335
|
-
}
|
|
336
|
-
function Ie(t) {
|
|
337
|
-
if (De.length === 0) {
|
|
338
|
-
var e = De;
|
|
339
|
-
queueMicrotask(() => {
|
|
340
|
-
e === De && Ki();
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
De.push(t);
|
|
344
|
-
}
|
|
345
|
-
function nr(t) {
|
|
346
|
-
var e = y;
|
|
347
|
-
if (e === null)
|
|
348
|
-
return k.f |= ye, t;
|
|
349
|
-
if ((e.f & Ue) === 0 && (e.f & rt) === 0)
|
|
350
|
-
throw t;
|
|
351
|
-
ve(t, e);
|
|
352
|
-
}
|
|
353
|
-
function ve(t, e) {
|
|
354
|
-
for (; e !== null; ) {
|
|
355
|
-
if ((e.f & qt) !== 0) {
|
|
356
|
-
if ((e.f & Ue) === 0)
|
|
357
|
-
throw t;
|
|
358
|
-
try {
|
|
359
|
-
e.b.error(t);
|
|
360
|
-
return;
|
|
361
|
-
} catch (n) {
|
|
362
|
-
t = n;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
e = e.parent;
|
|
366
|
-
}
|
|
367
|
-
throw t;
|
|
368
|
-
}
|
|
369
|
-
const Qi = -7169;
|
|
370
|
-
function x(t, e) {
|
|
371
|
-
t.f = t.f & Qi | e;
|
|
372
|
-
}
|
|
373
|
-
function nn(t) {
|
|
374
|
-
(t.f & q) !== 0 || t.deps === null ? x(t, A) : x(t, Q);
|
|
375
|
-
}
|
|
376
|
-
function rr(t) {
|
|
377
|
-
if (t !== null)
|
|
378
|
-
for (const e of t)
|
|
379
|
-
(e.f & N) === 0 || (e.f & Ne) === 0 || (e.f ^= Ne, rr(
|
|
380
|
-
/** @type {Derived} */
|
|
381
|
-
e.deps
|
|
382
|
-
));
|
|
383
|
-
}
|
|
384
|
-
function ir(t, e, n) {
|
|
385
|
-
(t.f & C) !== 0 ? e.add(t) : (t.f & Q) !== 0 && n.add(t), rr(t.deps), x(t, A);
|
|
386
|
-
}
|
|
387
|
-
const dt = /* @__PURE__ */ new Set();
|
|
388
|
-
let E = null, G = null, B = [], rn = null, Yt = !1;
|
|
389
|
-
class be {
|
|
390
|
-
/**
|
|
391
|
-
* The current values of any sources that are updated in this batch
|
|
392
|
-
* They keys of this map are identical to `this.#previous`
|
|
393
|
-
* @type {Map<Source, any>}
|
|
394
|
-
*/
|
|
395
|
-
current = /* @__PURE__ */ new Map();
|
|
396
|
-
/**
|
|
397
|
-
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
398
|
-
* They keys of this map are identical to `this.#current`
|
|
399
|
-
* @type {Map<Source, any>}
|
|
400
|
-
*/
|
|
401
|
-
previous = /* @__PURE__ */ new Map();
|
|
402
|
-
/**
|
|
403
|
-
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
404
|
-
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
405
|
-
* @type {Set<() => void>}
|
|
406
|
-
*/
|
|
407
|
-
#r = /* @__PURE__ */ new Set();
|
|
408
|
-
/**
|
|
409
|
-
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
410
|
-
* @type {Set<(batch: Batch) => void>}
|
|
411
|
-
*/
|
|
412
|
-
#p = /* @__PURE__ */ new Set();
|
|
413
|
-
/**
|
|
414
|
-
* The number of async effects that are currently in flight
|
|
415
|
-
*/
|
|
416
|
-
#i = 0;
|
|
417
|
-
/**
|
|
418
|
-
* The number of async effects that are currently in flight, _not_ inside a pending boundary
|
|
419
|
-
*/
|
|
420
|
-
#o = 0;
|
|
421
|
-
/**
|
|
422
|
-
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
423
|
-
* TODO replace with Promise.withResolvers once supported widely enough
|
|
424
|
-
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
425
|
-
*/
|
|
426
|
-
#n = null;
|
|
427
|
-
/**
|
|
428
|
-
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
429
|
-
* @type {Set<Effect>}
|
|
430
|
-
*/
|
|
431
|
-
#s = /* @__PURE__ */ new Set();
|
|
432
|
-
/**
|
|
433
|
-
* Deferred effects that are MAYBE_DIRTY
|
|
434
|
-
* @type {Set<Effect>}
|
|
435
|
-
*/
|
|
436
|
-
#e = /* @__PURE__ */ new Set();
|
|
437
|
-
/**
|
|
438
|
-
* A map of branches that still exist, but will be destroyed when this batch
|
|
439
|
-
* is committed — we skip over these during `process`.
|
|
440
|
-
* The value contains child effects that were dirty/maybe_dirty before being reset,
|
|
441
|
-
* so they can be rescheduled if the branch survives.
|
|
442
|
-
* @type {Map<Effect, { d: Effect[], m: Effect[] }>}
|
|
443
|
-
*/
|
|
444
|
-
#t = /* @__PURE__ */ new Map();
|
|
445
|
-
is_fork = !1;
|
|
446
|
-
#a = !1;
|
|
447
|
-
#u() {
|
|
448
|
-
return this.is_fork || this.#o > 0;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Add an effect to the #skipped_branches map and reset its children
|
|
452
|
-
* @param {Effect} effect
|
|
453
|
-
*/
|
|
454
|
-
skip_effect(e) {
|
|
455
|
-
this.#t.has(e) || this.#t.set(e, { d: [], m: [] });
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Remove an effect from the #skipped_branches map and reschedule
|
|
459
|
-
* any tracked dirty/maybe_dirty child effects
|
|
460
|
-
* @param {Effect} effect
|
|
461
|
-
*/
|
|
462
|
-
unskip_effect(e) {
|
|
463
|
-
var n = this.#t.get(e);
|
|
464
|
-
if (n) {
|
|
465
|
-
this.#t.delete(e);
|
|
466
|
-
for (var r of n.d)
|
|
467
|
-
x(r, C), re(r);
|
|
468
|
-
for (r of n.m)
|
|
469
|
-
x(r, Q), re(r);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
*
|
|
474
|
-
* @param {Effect[]} root_effects
|
|
475
|
-
*/
|
|
476
|
-
process(e) {
|
|
477
|
-
B = [], this.apply();
|
|
478
|
-
var n = [], r = [];
|
|
479
|
-
for (const i of e)
|
|
480
|
-
this.#l(i, n, r);
|
|
481
|
-
if (this.#u()) {
|
|
482
|
-
this.#c(r), this.#c(n);
|
|
483
|
-
for (const [i, s] of this.#t)
|
|
484
|
-
or(i, s);
|
|
485
|
-
} else {
|
|
486
|
-
for (const i of this.#r) i();
|
|
487
|
-
this.#r.clear(), this.#i === 0 && this.#f(), E = null, Cn(r), Cn(n), this.#s.clear(), this.#e.clear(), this.#n?.resolve();
|
|
488
|
-
}
|
|
489
|
-
G = null;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Traverse the effect tree, executing effects or stashing
|
|
493
|
-
* them for later execution as appropriate
|
|
494
|
-
* @param {Effect} root
|
|
495
|
-
* @param {Effect[]} effects
|
|
496
|
-
* @param {Effect[]} render_effects
|
|
497
|
-
*/
|
|
498
|
-
#l(e, n, r) {
|
|
499
|
-
e.f ^= A;
|
|
500
|
-
for (var i = e.first; i !== null; ) {
|
|
501
|
-
var s = i.f, a = (s & (Me | Ce)) !== 0, u = a && (s & A) !== 0, o = u || (s & we) !== 0 || this.#t.has(i);
|
|
502
|
-
if (!o && i.fn !== null) {
|
|
503
|
-
a ? i.f ^= A : (s & rt) !== 0 ? n.push(i) : it(i) && ((s & he) !== 0 && this.#e.add(i), Be(i));
|
|
504
|
-
var l = i.first;
|
|
505
|
-
if (l !== null) {
|
|
506
|
-
i = l;
|
|
507
|
-
continue;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
for (; i !== null; ) {
|
|
511
|
-
var c = i.next;
|
|
512
|
-
if (c !== null) {
|
|
513
|
-
i = c;
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
i = i.parent;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* @param {Effect[]} effects
|
|
522
|
-
*/
|
|
523
|
-
#c(e) {
|
|
524
|
-
for (var n = 0; n < e.length; n += 1)
|
|
525
|
-
ir(e[n], this.#s, this.#e);
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Associate a change to a given source with the current
|
|
529
|
-
* batch, noting its previous and current values
|
|
530
|
-
* @param {Source} source
|
|
531
|
-
* @param {any} value
|
|
532
|
-
*/
|
|
533
|
-
capture(e, n) {
|
|
534
|
-
n !== I && !this.previous.has(e) && this.previous.set(e, n), (e.f & ye) === 0 && (this.current.set(e, e.v), G?.set(e, e.v));
|
|
535
|
-
}
|
|
536
|
-
activate() {
|
|
537
|
-
E = this, this.apply();
|
|
538
|
-
}
|
|
539
|
-
deactivate() {
|
|
540
|
-
E === this && (E = null, G = null);
|
|
541
|
-
}
|
|
542
|
-
flush() {
|
|
543
|
-
if (this.activate(), B.length > 0) {
|
|
544
|
-
if (es(), E !== null && E !== this)
|
|
545
|
-
return;
|
|
546
|
-
} else this.#i === 0 && this.process([]);
|
|
547
|
-
this.deactivate();
|
|
548
|
-
}
|
|
549
|
-
discard() {
|
|
550
|
-
for (const e of this.#p) e(this);
|
|
551
|
-
this.#p.clear();
|
|
552
|
-
}
|
|
553
|
-
#f() {
|
|
554
|
-
if (dt.size > 1) {
|
|
555
|
-
this.previous.clear();
|
|
556
|
-
var e = G, n = !0;
|
|
557
|
-
for (const i of dt) {
|
|
558
|
-
if (i === this) {
|
|
559
|
-
n = !1;
|
|
560
|
-
continue;
|
|
561
|
-
}
|
|
562
|
-
const s = [];
|
|
563
|
-
for (const [u, o] of this.current) {
|
|
564
|
-
if (i.current.has(u))
|
|
565
|
-
if (n && o !== i.current.get(u))
|
|
566
|
-
i.current.set(u, o);
|
|
567
|
-
else
|
|
568
|
-
continue;
|
|
569
|
-
s.push(u);
|
|
570
|
-
}
|
|
571
|
-
if (s.length === 0)
|
|
572
|
-
continue;
|
|
573
|
-
const a = [...i.current.keys()].filter((u) => !this.current.has(u));
|
|
574
|
-
if (a.length > 0) {
|
|
575
|
-
var r = B;
|
|
576
|
-
B = [];
|
|
577
|
-
const u = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
578
|
-
for (const l of s)
|
|
579
|
-
sr(l, a, u, o);
|
|
580
|
-
if (B.length > 0) {
|
|
581
|
-
E = i, i.apply();
|
|
582
|
-
for (const l of B)
|
|
583
|
-
i.#l(l, [], []);
|
|
584
|
-
i.deactivate();
|
|
585
|
-
}
|
|
586
|
-
B = r;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
E = null, G = e;
|
|
590
|
-
}
|
|
591
|
-
this.#t.clear(), dt.delete(this);
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
*
|
|
595
|
-
* @param {boolean} blocking
|
|
596
|
-
*/
|
|
597
|
-
increment(e) {
|
|
598
|
-
this.#i += 1, e && (this.#o += 1);
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
*
|
|
602
|
-
* @param {boolean} blocking
|
|
603
|
-
*/
|
|
604
|
-
decrement(e) {
|
|
605
|
-
this.#i -= 1, e && (this.#o -= 1), !this.#a && (this.#a = !0, Ie(() => {
|
|
606
|
-
this.#a = !1, this.#u() ? B.length > 0 && this.flush() : this.revive();
|
|
607
|
-
}));
|
|
608
|
-
}
|
|
609
|
-
revive() {
|
|
610
|
-
for (const e of this.#s)
|
|
611
|
-
this.#e.delete(e), x(e, C), re(e);
|
|
612
|
-
for (const e of this.#e)
|
|
613
|
-
x(e, Q), re(e);
|
|
614
|
-
this.flush();
|
|
615
|
-
}
|
|
616
|
-
/** @param {() => void} fn */
|
|
617
|
-
oncommit(e) {
|
|
618
|
-
this.#r.add(e);
|
|
619
|
-
}
|
|
620
|
-
/** @param {(batch: Batch) => void} fn */
|
|
621
|
-
ondiscard(e) {
|
|
622
|
-
this.#p.add(e);
|
|
623
|
-
}
|
|
624
|
-
settled() {
|
|
625
|
-
return (this.#n ??= Gn()).promise;
|
|
626
|
-
}
|
|
627
|
-
static ensure() {
|
|
628
|
-
if (E === null) {
|
|
629
|
-
const e = E = new be();
|
|
630
|
-
dt.add(E), Ie(() => {
|
|
631
|
-
E === e && e.flush();
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
return E;
|
|
635
|
-
}
|
|
636
|
-
apply() {
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
function es() {
|
|
640
|
-
Yt = !0;
|
|
641
|
-
var t = null;
|
|
642
|
-
try {
|
|
643
|
-
for (var e = 0; B.length > 0; ) {
|
|
644
|
-
var n = be.ensure();
|
|
645
|
-
if (e++ > 1e3) {
|
|
646
|
-
var r, i;
|
|
647
|
-
ts();
|
|
648
|
-
}
|
|
649
|
-
n.process(B), _e.clear();
|
|
650
|
-
}
|
|
651
|
-
} finally {
|
|
652
|
-
B = [], Yt = !1, rn = null;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
function ts() {
|
|
656
|
-
try {
|
|
657
|
-
Bi();
|
|
658
|
-
} catch (t) {
|
|
659
|
-
ve(t, rn);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
let oe = null;
|
|
663
|
-
function Cn(t) {
|
|
664
|
-
var e = t.length;
|
|
665
|
-
if (e !== 0) {
|
|
666
|
-
for (var n = 0; n < e; ) {
|
|
667
|
-
var r = t[n++];
|
|
668
|
-
if ((r.f & (ke | we)) === 0 && it(r) && (oe = /* @__PURE__ */ new Set(), Be(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && br(r), oe?.size > 0)) {
|
|
669
|
-
_e.clear();
|
|
670
|
-
for (const i of oe) {
|
|
671
|
-
if ((i.f & (ke | we)) !== 0) continue;
|
|
672
|
-
const s = [i];
|
|
673
|
-
let a = i.parent;
|
|
674
|
-
for (; a !== null; )
|
|
675
|
-
oe.has(a) && (oe.delete(a), s.push(a)), a = a.parent;
|
|
676
|
-
for (let u = s.length - 1; u >= 0; u--) {
|
|
677
|
-
const o = s[u];
|
|
678
|
-
(o.f & (ke | we)) === 0 && Be(o);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
oe.clear();
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
oe = null;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
function sr(t, e, n, r) {
|
|
688
|
-
if (!n.has(t) && (n.add(t), t.reactions !== null))
|
|
689
|
-
for (const i of t.reactions) {
|
|
690
|
-
const s = i.f;
|
|
691
|
-
(s & N) !== 0 ? sr(
|
|
692
|
-
/** @type {Derived} */
|
|
693
|
-
i,
|
|
694
|
-
e,
|
|
695
|
-
n,
|
|
696
|
-
r
|
|
697
|
-
) : (s & (Qt | he)) !== 0 && (s & C) === 0 && ar(i, e, r) && (x(i, C), re(
|
|
698
|
-
/** @type {Effect} */
|
|
699
|
-
i
|
|
700
|
-
));
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
function ar(t, e, n) {
|
|
704
|
-
const r = n.get(t);
|
|
705
|
-
if (r !== void 0) return r;
|
|
706
|
-
if (t.deps !== null)
|
|
707
|
-
for (const i of t.deps) {
|
|
708
|
-
if (Ve.call(e, i))
|
|
709
|
-
return !0;
|
|
710
|
-
if ((i.f & N) !== 0 && ar(
|
|
711
|
-
/** @type {Derived} */
|
|
712
|
-
i,
|
|
713
|
-
e,
|
|
714
|
-
n
|
|
715
|
-
))
|
|
716
|
-
return n.set(
|
|
717
|
-
/** @type {Derived} */
|
|
718
|
-
i,
|
|
719
|
-
!0
|
|
720
|
-
), !0;
|
|
721
|
-
}
|
|
722
|
-
return n.set(t, !1), !1;
|
|
723
|
-
}
|
|
724
|
-
function re(t) {
|
|
725
|
-
var e = rn = t, n = e.b;
|
|
726
|
-
if (n?.is_pending && (t.f & (rt | Et | Kn)) !== 0 && (t.f & Ue) === 0) {
|
|
727
|
-
n.defer_effect(t);
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
for (; e.parent !== null; ) {
|
|
731
|
-
e = e.parent;
|
|
732
|
-
var r = e.f;
|
|
733
|
-
if (Yt && e === y && (r & he) !== 0 && (r & Qn) === 0 && (r & Ue) !== 0)
|
|
734
|
-
return;
|
|
735
|
-
if ((r & (Ce | Me)) !== 0) {
|
|
736
|
-
if ((r & A) === 0)
|
|
737
|
-
return;
|
|
738
|
-
e.f ^= A;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
B.push(e);
|
|
742
|
-
}
|
|
743
|
-
function or(t, e) {
|
|
744
|
-
if (!((t.f & Me) !== 0 && (t.f & A) !== 0)) {
|
|
745
|
-
(t.f & C) !== 0 ? e.d.push(t) : (t.f & Q) !== 0 && e.m.push(t), x(t, A);
|
|
746
|
-
for (var n = t.first; n !== null; )
|
|
747
|
-
or(n, e), n = n.next;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
function ns(t) {
|
|
751
|
-
let e = 0, n = xt(0), r;
|
|
752
|
-
return () => {
|
|
753
|
-
on() && (M(n), wr(() => (e === 0 && (r = H(() => t(() => Ke(n)))), e += 1, () => {
|
|
754
|
-
Ie(() => {
|
|
755
|
-
e -= 1, e === 0 && (r?.(), r = void 0, Ke(n));
|
|
756
|
-
});
|
|
757
|
-
})));
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
var rs = _t | He;
|
|
761
|
-
function is(t, e, n, r) {
|
|
762
|
-
new ss(t, e, n, r);
|
|
763
|
-
}
|
|
764
|
-
class ss {
|
|
765
|
-
/** @type {Boundary | null} */
|
|
766
|
-
parent;
|
|
767
|
-
is_pending = !1;
|
|
768
|
-
/**
|
|
769
|
-
* API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
|
|
770
|
-
* Inherited from parent boundary, or defaults to identity.
|
|
771
|
-
* @type {(error: unknown) => unknown}
|
|
772
|
-
*/
|
|
773
|
-
transform_error;
|
|
774
|
-
/** @type {TemplateNode} */
|
|
775
|
-
#r;
|
|
776
|
-
/** @type {TemplateNode | null} */
|
|
777
|
-
#p = null;
|
|
778
|
-
/** @type {BoundaryProps} */
|
|
779
|
-
#i;
|
|
780
|
-
/** @type {((anchor: Node) => void)} */
|
|
781
|
-
#o;
|
|
782
|
-
/** @type {Effect} */
|
|
783
|
-
#n;
|
|
784
|
-
/** @type {Effect | null} */
|
|
785
|
-
#s = null;
|
|
786
|
-
/** @type {Effect | null} */
|
|
787
|
-
#e = null;
|
|
788
|
-
/** @type {Effect | null} */
|
|
789
|
-
#t = null;
|
|
790
|
-
/** @type {DocumentFragment | null} */
|
|
791
|
-
#a = null;
|
|
792
|
-
#u = 0;
|
|
793
|
-
#l = 0;
|
|
794
|
-
#c = !1;
|
|
795
|
-
/** @type {Set<Effect>} */
|
|
796
|
-
#f = /* @__PURE__ */ new Set();
|
|
797
|
-
/** @type {Set<Effect>} */
|
|
798
|
-
#d = /* @__PURE__ */ new Set();
|
|
799
|
-
/**
|
|
800
|
-
* A source containing the number of pending async deriveds/expressions.
|
|
801
|
-
* Only created if `$effect.pending()` is used inside the boundary,
|
|
802
|
-
* otherwise updating the source results in needless `Batch.ensure()`
|
|
803
|
-
* calls followed by no-op flushes
|
|
804
|
-
* @type {Source<number> | null}
|
|
805
|
-
*/
|
|
806
|
-
#h = null;
|
|
807
|
-
#k = ns(() => (this.#h = xt(this.#u), () => {
|
|
808
|
-
this.#h = null;
|
|
809
|
-
}));
|
|
810
|
-
/**
|
|
811
|
-
* @param {TemplateNode} node
|
|
812
|
-
* @param {BoundaryProps} props
|
|
813
|
-
* @param {((anchor: Node) => void)} children
|
|
814
|
-
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
815
|
-
*/
|
|
816
|
-
constructor(e, n, r, i) {
|
|
817
|
-
this.#r = e, this.#i = n, this.#o = (s) => {
|
|
818
|
-
var a = (
|
|
819
|
-
/** @type {Effect} */
|
|
820
|
-
y
|
|
821
|
-
);
|
|
822
|
-
a.b = this, a.f |= qt, r(s);
|
|
823
|
-
}, this.parent = /** @type {Effect} */
|
|
824
|
-
y.b, this.transform_error = i ?? this.parent?.transform_error ?? ((s) => s), this.#n = Es(() => {
|
|
825
|
-
this.#g();
|
|
826
|
-
}, rs);
|
|
827
|
-
}
|
|
828
|
-
#y() {
|
|
829
|
-
try {
|
|
830
|
-
this.#s = Se(() => this.#o(this.#r));
|
|
831
|
-
} catch (e) {
|
|
832
|
-
this.error(e);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
|
-
* @param {unknown} error The deserialized error from the server's hydration comment
|
|
837
|
-
*/
|
|
838
|
-
#b(e) {
|
|
839
|
-
const n = this.#i.failed;
|
|
840
|
-
n && (this.#t = Se(() => {
|
|
841
|
-
n(
|
|
842
|
-
this.#r,
|
|
843
|
-
() => e,
|
|
844
|
-
() => () => {
|
|
845
|
-
}
|
|
846
|
-
);
|
|
847
|
-
}));
|
|
848
|
-
}
|
|
849
|
-
#_() {
|
|
850
|
-
const e = this.#i.pending;
|
|
851
|
-
e && (this.is_pending = !0, this.#e = Se(() => e(this.#r)), Ie(() => {
|
|
852
|
-
var n = this.#a = document.createDocumentFragment(), r = mr();
|
|
853
|
-
n.append(r), this.#s = this.#v(() => (be.ensure(), Se(() => this.#o(r)))), this.#l === 0 && (this.#r.before(n), this.#a = null, kt(
|
|
854
|
-
/** @type {Effect} */
|
|
855
|
-
this.#e,
|
|
856
|
-
() => {
|
|
857
|
-
this.#e = null;
|
|
858
|
-
}
|
|
859
|
-
), this.#m());
|
|
860
|
-
}));
|
|
861
|
-
}
|
|
862
|
-
#g() {
|
|
863
|
-
try {
|
|
864
|
-
if (this.is_pending = this.has_pending_snippet(), this.#l = 0, this.#u = 0, this.#s = Se(() => {
|
|
865
|
-
this.#o(this.#r);
|
|
866
|
-
}), this.#l > 0) {
|
|
867
|
-
var e = this.#a = document.createDocumentFragment();
|
|
868
|
-
Ps(this.#s, e);
|
|
869
|
-
const n = (
|
|
870
|
-
/** @type {(anchor: Node) => void} */
|
|
871
|
-
this.#i.pending
|
|
872
|
-
);
|
|
873
|
-
this.#e = Se(() => n(this.#r));
|
|
874
|
-
} else
|
|
875
|
-
this.#m();
|
|
876
|
-
} catch (n) {
|
|
877
|
-
this.error(n);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
#m() {
|
|
881
|
-
this.is_pending = !1;
|
|
882
|
-
for (const e of this.#f)
|
|
883
|
-
x(e, C), re(e);
|
|
884
|
-
for (const e of this.#d)
|
|
885
|
-
x(e, Q), re(e);
|
|
886
|
-
this.#f.clear(), this.#d.clear();
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* Defer an effect inside a pending boundary until the boundary resolves
|
|
890
|
-
* @param {Effect} effect
|
|
891
|
-
*/
|
|
892
|
-
defer_effect(e) {
|
|
893
|
-
ir(e, this.#f, this.#d);
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
|
|
897
|
-
* @returns {boolean}
|
|
898
|
-
*/
|
|
899
|
-
is_rendered() {
|
|
900
|
-
return !this.is_pending && (!this.parent || this.parent.is_rendered());
|
|
901
|
-
}
|
|
902
|
-
has_pending_snippet() {
|
|
903
|
-
return !!this.#i.pending;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* @template T
|
|
907
|
-
* @param {() => T} fn
|
|
908
|
-
*/
|
|
909
|
-
#v(e) {
|
|
910
|
-
var n = y, r = k, i = ee;
|
|
911
|
-
se(this.#n), Y(this.#n), je(this.#n.ctx);
|
|
912
|
-
try {
|
|
913
|
-
return e();
|
|
914
|
-
} catch (s) {
|
|
915
|
-
return nr(s), null;
|
|
916
|
-
} finally {
|
|
917
|
-
se(n), Y(r), je(i);
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
/**
|
|
921
|
-
* Updates the pending count associated with the currently visible pending snippet,
|
|
922
|
-
* if any, such that we can replace the snippet with content once work is done
|
|
923
|
-
* @param {1 | -1} d
|
|
924
|
-
*/
|
|
925
|
-
#w(e) {
|
|
926
|
-
if (!this.has_pending_snippet()) {
|
|
927
|
-
this.parent && this.parent.#w(e);
|
|
928
|
-
return;
|
|
929
|
-
}
|
|
930
|
-
this.#l += e, this.#l === 0 && (this.#m(), this.#e && kt(this.#e, () => {
|
|
931
|
-
this.#e = null;
|
|
932
|
-
}), this.#a && (this.#r.before(this.#a), this.#a = null));
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* Update the source that powers `$effect.pending()` inside this boundary,
|
|
936
|
-
* and controls when the current `pending` snippet (if any) is removed.
|
|
937
|
-
* Do not call from inside the class
|
|
938
|
-
* @param {1 | -1} d
|
|
939
|
-
*/
|
|
940
|
-
update_pending_count(e) {
|
|
941
|
-
this.#w(e), this.#u += e, !(!this.#h || this.#c) && (this.#c = !0, Ie(() => {
|
|
942
|
-
this.#c = !1, this.#h && Mt(this.#h, this.#u);
|
|
943
|
-
}));
|
|
944
|
-
}
|
|
945
|
-
get_effect_pending() {
|
|
946
|
-
return this.#k(), M(
|
|
947
|
-
/** @type {Source<number>} */
|
|
948
|
-
this.#h
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
/** @param {unknown} error */
|
|
952
|
-
error(e) {
|
|
953
|
-
var n = this.#i.onerror;
|
|
954
|
-
let r = this.#i.failed;
|
|
955
|
-
if (!n && !r)
|
|
956
|
-
throw e;
|
|
957
|
-
this.#s && (ie(this.#s), this.#s = null), this.#e && (ie(this.#e), this.#e = null), this.#t && (ie(this.#t), this.#t = null);
|
|
958
|
-
var i = !1, s = !1;
|
|
959
|
-
const a = () => {
|
|
960
|
-
if (i) {
|
|
961
|
-
Xi();
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
i = !0, s && Yi(), this.#t !== null && kt(this.#t, () => {
|
|
965
|
-
this.#t = null;
|
|
966
|
-
}), this.#v(() => {
|
|
967
|
-
be.ensure(), this.#g();
|
|
968
|
-
});
|
|
969
|
-
}, u = (o) => {
|
|
970
|
-
try {
|
|
971
|
-
s = !0, n?.(o, a), s = !1;
|
|
972
|
-
} catch (l) {
|
|
973
|
-
ve(l, this.#n && this.#n.parent);
|
|
974
|
-
}
|
|
975
|
-
r && (this.#t = this.#v(() => {
|
|
976
|
-
be.ensure();
|
|
977
|
-
try {
|
|
978
|
-
return Se(() => {
|
|
979
|
-
var l = (
|
|
980
|
-
/** @type {Effect} */
|
|
981
|
-
y
|
|
982
|
-
);
|
|
983
|
-
l.b = this, l.f |= qt, r(
|
|
984
|
-
this.#r,
|
|
985
|
-
() => o,
|
|
986
|
-
() => a
|
|
987
|
-
);
|
|
988
|
-
});
|
|
989
|
-
} catch (l) {
|
|
990
|
-
return ve(
|
|
991
|
-
l,
|
|
992
|
-
/** @type {Effect} */
|
|
993
|
-
this.#n.parent
|
|
994
|
-
), null;
|
|
995
|
-
}
|
|
996
|
-
}));
|
|
997
|
-
};
|
|
998
|
-
Ie(() => {
|
|
999
|
-
var o;
|
|
1000
|
-
try {
|
|
1001
|
-
o = this.transform_error(e);
|
|
1002
|
-
} catch (l) {
|
|
1003
|
-
ve(l, this.#n && this.#n.parent);
|
|
1004
|
-
return;
|
|
1005
|
-
}
|
|
1006
|
-
o !== null && typeof o == "object" && typeof /** @type {any} */
|
|
1007
|
-
o.then == "function" ? o.then(
|
|
1008
|
-
u,
|
|
1009
|
-
/** @param {unknown} e */
|
|
1010
|
-
(l) => ve(l, this.#n && this.#n.parent)
|
|
1011
|
-
) : u(o);
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
function as(t, e, n, r) {
|
|
1016
|
-
const i = us;
|
|
1017
|
-
var s = t.filter((h) => !h.settled);
|
|
1018
|
-
if (n.length === 0 && s.length === 0) {
|
|
1019
|
-
r(e.map(i));
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
var a = (
|
|
1023
|
-
/** @type {Effect} */
|
|
1024
|
-
y
|
|
1025
|
-
), u = os(), o = s.length === 1 ? s[0].promise : s.length > 1 ? Promise.all(s.map((h) => h.promise)) : null;
|
|
1026
|
-
function l(h) {
|
|
1027
|
-
u();
|
|
1028
|
-
try {
|
|
1029
|
-
r(h);
|
|
1030
|
-
} catch (f) {
|
|
1031
|
-
(a.f & ke) === 0 && ve(f, a);
|
|
1032
|
-
}
|
|
1033
|
-
Jt();
|
|
1034
|
-
}
|
|
1035
|
-
if (n.length === 0) {
|
|
1036
|
-
o.then(() => l(e.map(i)));
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
function c() {
|
|
1040
|
-
u(), Promise.all(n.map((h) => /* @__PURE__ */ cs(h))).then((h) => l([...e.map(i), ...h])).catch((h) => ve(h, a));
|
|
1041
|
-
}
|
|
1042
|
-
o ? o.then(c) : c();
|
|
1043
|
-
}
|
|
1044
|
-
function os() {
|
|
1045
|
-
var t = y, e = k, n = ee, r = E;
|
|
1046
|
-
return function(s = !0) {
|
|
1047
|
-
se(t), Y(e), je(n), s && r?.activate();
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
function Jt(t = !0) {
|
|
1051
|
-
se(null), Y(null), je(null), t && E?.deactivate();
|
|
1052
|
-
}
|
|
1053
|
-
function ls() {
|
|
1054
|
-
var t = (
|
|
1055
|
-
/** @type {Boundary} */
|
|
1056
|
-
/** @type {Effect} */
|
|
1057
|
-
y.b
|
|
1058
|
-
), e = (
|
|
1059
|
-
/** @type {Batch} */
|
|
1060
|
-
E
|
|
1061
|
-
), n = t.is_rendered();
|
|
1062
|
-
return t.update_pending_count(1), e.increment(n), () => {
|
|
1063
|
-
t.update_pending_count(-1), e.decrement(n);
|
|
1064
|
-
};
|
|
1065
|
-
}
|
|
1066
|
-
// @__NO_SIDE_EFFECTS__
|
|
1067
|
-
function us(t) {
|
|
1068
|
-
var e = N | C, n = k !== null && (k.f & N) !== 0 ? (
|
|
1069
|
-
/** @type {Derived} */
|
|
1070
|
-
k
|
|
1071
|
-
) : null;
|
|
1072
|
-
return y !== null && (y.f |= He), {
|
|
1073
|
-
ctx: ee,
|
|
1074
|
-
deps: null,
|
|
1075
|
-
effects: null,
|
|
1076
|
-
equals: er,
|
|
1077
|
-
f: e,
|
|
1078
|
-
fn: t,
|
|
1079
|
-
reactions: null,
|
|
1080
|
-
rv: 0,
|
|
1081
|
-
v: (
|
|
1082
|
-
/** @type {V} */
|
|
1083
|
-
I
|
|
1084
|
-
),
|
|
1085
|
-
wv: 0,
|
|
1086
|
-
parent: n ?? y,
|
|
1087
|
-
ac: null
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
// @__NO_SIDE_EFFECTS__
|
|
1091
|
-
function cs(t, e, n) {
|
|
1092
|
-
/** @type {Effect | null} */
|
|
1093
|
-
y === null && Wi();
|
|
1094
|
-
var i = (
|
|
1095
|
-
/** @type {Promise<V>} */
|
|
1096
|
-
/** @type {unknown} */
|
|
1097
|
-
void 0
|
|
1098
|
-
), s = xt(
|
|
1099
|
-
/** @type {V} */
|
|
1100
|
-
I
|
|
1101
|
-
), a = !k, u = /* @__PURE__ */ new Map();
|
|
1102
|
-
return Ms(() => {
|
|
1103
|
-
var o = Gn();
|
|
1104
|
-
i = o.promise;
|
|
1105
|
-
try {
|
|
1106
|
-
Promise.resolve(t()).then(o.resolve, o.reject).finally(Jt);
|
|
1107
|
-
} catch (f) {
|
|
1108
|
-
o.reject(f), Jt();
|
|
1109
|
-
}
|
|
1110
|
-
var l = (
|
|
1111
|
-
/** @type {Batch} */
|
|
1112
|
-
E
|
|
1113
|
-
);
|
|
1114
|
-
if (a) {
|
|
1115
|
-
var c = ls();
|
|
1116
|
-
u.get(l)?.reject(Pe), u.delete(l), u.set(l, o);
|
|
1117
|
-
}
|
|
1118
|
-
const h = (f, m = void 0) => {
|
|
1119
|
-
if (l.activate(), m)
|
|
1120
|
-
m !== Pe && (s.f |= ye, Mt(s, m));
|
|
1121
|
-
else {
|
|
1122
|
-
(s.f & ye) !== 0 && (s.f ^= ye), Mt(s, f);
|
|
1123
|
-
for (const [d, v] of u) {
|
|
1124
|
-
if (u.delete(d), d === l) break;
|
|
1125
|
-
v.reject(Pe);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
c && c();
|
|
1129
|
-
};
|
|
1130
|
-
o.promise.then(h, (f) => h(null, f || "unknown"));
|
|
1131
|
-
}), ks(() => {
|
|
1132
|
-
for (const o of u.values())
|
|
1133
|
-
o.reject(Pe);
|
|
1134
|
-
}), new Promise((o) => {
|
|
1135
|
-
function l(c) {
|
|
1136
|
-
function h() {
|
|
1137
|
-
c === i ? o(s) : l(i);
|
|
1138
|
-
}
|
|
1139
|
-
c.then(h, h);
|
|
1140
|
-
}
|
|
1141
|
-
l(i);
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
function hs(t) {
|
|
1145
|
-
var e = t.effects;
|
|
1146
|
-
if (e !== null) {
|
|
1147
|
-
t.effects = null;
|
|
1148
|
-
for (var n = 0; n < e.length; n += 1)
|
|
1149
|
-
ie(
|
|
1150
|
-
/** @type {Effect} */
|
|
1151
|
-
e[n]
|
|
1152
|
-
);
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
function fs(t) {
|
|
1156
|
-
for (var e = t.parent; e !== null; ) {
|
|
1157
|
-
if ((e.f & N) === 0)
|
|
1158
|
-
return (e.f & ke) === 0 ? (
|
|
1159
|
-
/** @type {Effect} */
|
|
1160
|
-
e
|
|
1161
|
-
) : null;
|
|
1162
|
-
e = e.parent;
|
|
1163
|
-
}
|
|
1164
|
-
return null;
|
|
1165
|
-
}
|
|
1166
|
-
function sn(t) {
|
|
1167
|
-
var e, n = y;
|
|
1168
|
-
se(fs(t));
|
|
1169
|
-
try {
|
|
1170
|
-
t.f &= ~Ne, hs(t), e = Sr(t);
|
|
1171
|
-
} finally {
|
|
1172
|
-
se(n);
|
|
1173
|
-
}
|
|
1174
|
-
return e;
|
|
1175
|
-
}
|
|
1176
|
-
function lr(t) {
|
|
1177
|
-
var e = sn(t);
|
|
1178
|
-
if (!t.equals(e) && (t.wv = Er(), (!E?.is_fork || t.deps === null) && (t.v = e, t.deps === null))) {
|
|
1179
|
-
x(t, A);
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
We || (G !== null ? (on() || E?.is_fork) && G.set(t, e) : nn(t));
|
|
1183
|
-
}
|
|
1184
|
-
function ps(t) {
|
|
1185
|
-
if (t.effects !== null)
|
|
1186
|
-
for (const e of t.effects)
|
|
1187
|
-
(e.teardown || e.ac) && (e.teardown?.(), e.ac?.abort(Pe), e.teardown = Vi, e.ac = null, et(e, 0), ln(e));
|
|
1188
|
-
}
|
|
1189
|
-
function ur(t) {
|
|
1190
|
-
if (t.effects !== null)
|
|
1191
|
-
for (const e of t.effects)
|
|
1192
|
-
e.teardown && Be(e);
|
|
1193
|
-
}
|
|
1194
|
-
let Xt = /* @__PURE__ */ new Set();
|
|
1195
|
-
const _e = /* @__PURE__ */ new Map();
|
|
1196
|
-
let cr = !1;
|
|
1197
|
-
function xt(t, e) {
|
|
1198
|
-
var n = {
|
|
1199
|
-
f: 0,
|
|
1200
|
-
// TODO ideally we could skip this altogether, but it causes type errors
|
|
1201
|
-
v: t,
|
|
1202
|
-
reactions: null,
|
|
1203
|
-
equals: er,
|
|
1204
|
-
rv: 0,
|
|
1205
|
-
wv: 0
|
|
1206
|
-
};
|
|
1207
|
-
return n;
|
|
1208
|
-
}
|
|
1209
|
-
// @__NO_SIDE_EFFECTS__
|
|
1210
|
-
function z(t, e) {
|
|
1211
|
-
const n = xt(t);
|
|
1212
|
-
return Ts(n), n;
|
|
1213
|
-
}
|
|
1214
|
-
function O(t, e, n = !1) {
|
|
1215
|
-
k !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
|
|
1216
|
-
// to ensure we error if state is set inside an inspect effect
|
|
1217
|
-
(!K || (k.f & Nn) !== 0) && tr() && (k.f & (N | he | Qt | Nn)) !== 0 && (Z === null || !Ve.call(Z, t)) && Zi();
|
|
1218
|
-
let r = n ? Ze(e) : e;
|
|
1219
|
-
return Mt(t, r);
|
|
1220
|
-
}
|
|
1221
|
-
function Mt(t, e) {
|
|
1222
|
-
if (!t.equals(e)) {
|
|
1223
|
-
var n = t.v;
|
|
1224
|
-
We ? _e.set(t, e) : _e.set(t, n), t.v = e;
|
|
1225
|
-
var r = be.ensure();
|
|
1226
|
-
if (r.capture(t, n), (t.f & N) !== 0) {
|
|
1227
|
-
const i = (
|
|
1228
|
-
/** @type {Derived} */
|
|
1229
|
-
t
|
|
1230
|
-
);
|
|
1231
|
-
(t.f & C) !== 0 && sn(i), nn(i);
|
|
1232
|
-
}
|
|
1233
|
-
t.wv = Er(), hr(t, C), y !== null && (y.f & A) !== 0 && (y.f & (Me | Ce)) === 0 && (W === null ? Is([t]) : W.push(t)), !r.is_fork && Xt.size > 0 && !cr && ds();
|
|
1234
|
-
}
|
|
1235
|
-
return e;
|
|
1236
|
-
}
|
|
1237
|
-
function ds() {
|
|
1238
|
-
cr = !1;
|
|
1239
|
-
for (const t of Xt)
|
|
1240
|
-
(t.f & A) !== 0 && x(t, Q), it(t) && Be(t);
|
|
1241
|
-
Xt.clear();
|
|
1242
|
-
}
|
|
1243
|
-
function Ke(t) {
|
|
1244
|
-
O(t, t.v + 1);
|
|
1245
|
-
}
|
|
1246
|
-
function hr(t, e) {
|
|
1247
|
-
var n = t.reactions;
|
|
1248
|
-
if (n !== null)
|
|
1249
|
-
for (var r = n.length, i = 0; i < r; i++) {
|
|
1250
|
-
var s = n[i], a = s.f, u = (a & C) === 0;
|
|
1251
|
-
if (u && x(s, e), (a & N) !== 0) {
|
|
1252
|
-
var o = (
|
|
1253
|
-
/** @type {Derived} */
|
|
1254
|
-
s
|
|
1255
|
-
);
|
|
1256
|
-
G?.delete(o), (a & Ne) === 0 && (a & q && (s.f |= Ne), hr(o, Q));
|
|
1257
|
-
} else u && ((a & he) !== 0 && oe !== null && oe.add(
|
|
1258
|
-
/** @type {Effect} */
|
|
1259
|
-
s
|
|
1260
|
-
), re(
|
|
1261
|
-
/** @type {Effect} */
|
|
1262
|
-
s
|
|
1263
|
-
));
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
function Ze(t) {
|
|
1267
|
-
if (typeof t != "object" || t === null || wt in t)
|
|
1268
|
-
return t;
|
|
1269
|
-
const e = $i(t);
|
|
1270
|
-
if (e !== Li && e !== Fi)
|
|
1271
|
-
return t;
|
|
1272
|
-
var n = /* @__PURE__ */ new Map(), r = Ri(t), i = /* @__PURE__ */ z(0), s = Ae, a = (u) => {
|
|
1273
|
-
if (Ae === s)
|
|
1274
|
-
return u();
|
|
1275
|
-
var o = k, l = Ae;
|
|
1276
|
-
Y(null), On(s);
|
|
1277
|
-
var c = u();
|
|
1278
|
-
return Y(o), On(l), c;
|
|
1279
|
-
};
|
|
1280
|
-
return r && n.set("length", /* @__PURE__ */ z(
|
|
1281
|
-
/** @type {any[]} */
|
|
1282
|
-
t.length
|
|
1283
|
-
)), new Proxy(
|
|
1284
|
-
/** @type {any} */
|
|
1285
|
-
t,
|
|
1286
|
-
{
|
|
1287
|
-
defineProperty(u, o, l) {
|
|
1288
|
-
(!("value" in l) || l.configurable === !1 || l.enumerable === !1 || l.writable === !1) && Hi();
|
|
1289
|
-
var c = n.get(o);
|
|
1290
|
-
return c === void 0 ? a(() => {
|
|
1291
|
-
var h = /* @__PURE__ */ z(l.value);
|
|
1292
|
-
return n.set(o, h), h;
|
|
1293
|
-
}) : O(c, l.value, !0), !0;
|
|
1294
|
-
},
|
|
1295
|
-
deleteProperty(u, o) {
|
|
1296
|
-
var l = n.get(o);
|
|
1297
|
-
if (l === void 0) {
|
|
1298
|
-
if (o in u) {
|
|
1299
|
-
const c = a(() => /* @__PURE__ */ z(I));
|
|
1300
|
-
n.set(o, c), Ke(i);
|
|
1301
|
-
}
|
|
1302
|
-
} else
|
|
1303
|
-
O(l, I), Ke(i);
|
|
1304
|
-
return !0;
|
|
1305
|
-
},
|
|
1306
|
-
get(u, o, l) {
|
|
1307
|
-
if (o === wt)
|
|
1308
|
-
return t;
|
|
1309
|
-
var c = n.get(o), h = o in u;
|
|
1310
|
-
if (c === void 0 && (!h || Ge(u, o)?.writable) && (c = a(() => {
|
|
1311
|
-
var m = Ze(h ? u[o] : I), d = /* @__PURE__ */ z(m);
|
|
1312
|
-
return d;
|
|
1313
|
-
}), n.set(o, c)), c !== void 0) {
|
|
1314
|
-
var f = M(c);
|
|
1315
|
-
return f === I ? void 0 : f;
|
|
1316
|
-
}
|
|
1317
|
-
return Reflect.get(u, o, l);
|
|
1318
|
-
},
|
|
1319
|
-
getOwnPropertyDescriptor(u, o) {
|
|
1320
|
-
var l = Reflect.getOwnPropertyDescriptor(u, o);
|
|
1321
|
-
if (l && "value" in l) {
|
|
1322
|
-
var c = n.get(o);
|
|
1323
|
-
c && (l.value = M(c));
|
|
1324
|
-
} else if (l === void 0) {
|
|
1325
|
-
var h = n.get(o), f = h?.v;
|
|
1326
|
-
if (h !== void 0 && f !== I)
|
|
1327
|
-
return {
|
|
1328
|
-
enumerable: !0,
|
|
1329
|
-
configurable: !0,
|
|
1330
|
-
value: f,
|
|
1331
|
-
writable: !0
|
|
1332
|
-
};
|
|
1333
|
-
}
|
|
1334
|
-
return l;
|
|
1335
|
-
},
|
|
1336
|
-
has(u, o) {
|
|
1337
|
-
if (o === wt)
|
|
1338
|
-
return !0;
|
|
1339
|
-
var l = n.get(o), c = l !== void 0 && l.v !== I || Reflect.has(u, o);
|
|
1340
|
-
if (l !== void 0 || y !== null && (!c || Ge(u, o)?.writable)) {
|
|
1341
|
-
l === void 0 && (l = a(() => {
|
|
1342
|
-
var f = c ? Ze(u[o]) : I, m = /* @__PURE__ */ z(f);
|
|
1343
|
-
return m;
|
|
1344
|
-
}), n.set(o, l));
|
|
1345
|
-
var h = M(l);
|
|
1346
|
-
if (h === I)
|
|
1347
|
-
return !1;
|
|
1348
|
-
}
|
|
1349
|
-
return c;
|
|
1350
|
-
},
|
|
1351
|
-
set(u, o, l, c) {
|
|
1352
|
-
var h = n.get(o), f = o in u;
|
|
1353
|
-
if (r && o === "length")
|
|
1354
|
-
for (var m = l; m < /** @type {Source<number>} */
|
|
1355
|
-
h.v; m += 1) {
|
|
1356
|
-
var d = n.get(m + "");
|
|
1357
|
-
d !== void 0 ? O(d, I) : m in u && (d = a(() => /* @__PURE__ */ z(I)), n.set(m + "", d));
|
|
1358
|
-
}
|
|
1359
|
-
if (h === void 0)
|
|
1360
|
-
(!f || Ge(u, o)?.writable) && (h = a(() => /* @__PURE__ */ z(void 0)), O(h, Ze(l)), n.set(o, h));
|
|
1361
|
-
else {
|
|
1362
|
-
f = h.v !== I;
|
|
1363
|
-
var v = a(() => Ze(l));
|
|
1364
|
-
O(h, v);
|
|
1365
|
-
}
|
|
1366
|
-
var g = Reflect.getOwnPropertyDescriptor(u, o);
|
|
1367
|
-
if (g?.set && g.set.call(c, l), !f) {
|
|
1368
|
-
if (r && typeof o == "string") {
|
|
1369
|
-
var P = (
|
|
1370
|
-
/** @type {Source<number>} */
|
|
1371
|
-
n.get("length")
|
|
1372
|
-
), U = Number(o);
|
|
1373
|
-
Number.isInteger(U) && U >= P.v && O(P, U + 1);
|
|
1374
|
-
}
|
|
1375
|
-
Ke(i);
|
|
1376
|
-
}
|
|
1377
|
-
return !0;
|
|
1378
|
-
},
|
|
1379
|
-
ownKeys(u) {
|
|
1380
|
-
M(i);
|
|
1381
|
-
var o = Reflect.ownKeys(u).filter((h) => {
|
|
1382
|
-
var f = n.get(h);
|
|
1383
|
-
return f === void 0 || f.v !== I;
|
|
1384
|
-
});
|
|
1385
|
-
for (var [l, c] of n)
|
|
1386
|
-
c.v !== I && !(l in u) && o.push(l);
|
|
1387
|
-
return o;
|
|
1388
|
-
},
|
|
1389
|
-
setPrototypeOf() {
|
|
1390
|
-
qi();
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
);
|
|
1394
|
-
}
|
|
1395
|
-
var Rn, fr, pr, dr;
|
|
1396
|
-
function ms() {
|
|
1397
|
-
if (Rn === void 0) {
|
|
1398
|
-
Rn = window, fr = /Firefox/.test(navigator.userAgent);
|
|
1399
|
-
var t = Element.prototype, e = Node.prototype, n = Text.prototype;
|
|
1400
|
-
pr = Ge(e, "firstChild").get, dr = Ge(e, "nextSibling").get, An(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), An(n) && (n.__t = void 0);
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
function mr(t = "") {
|
|
1404
|
-
return document.createTextNode(t);
|
|
1405
|
-
}
|
|
1406
|
-
// @__NO_SIDE_EFFECTS__
|
|
1407
|
-
function vr(t) {
|
|
1408
|
-
return (
|
|
1409
|
-
/** @type {TemplateNode | null} */
|
|
1410
|
-
pr.call(t)
|
|
1411
|
-
);
|
|
1412
|
-
}
|
|
1413
|
-
// @__NO_SIDE_EFFECTS__
|
|
1414
|
-
function an(t) {
|
|
1415
|
-
return (
|
|
1416
|
-
/** @type {TemplateNode | null} */
|
|
1417
|
-
dr.call(t)
|
|
1418
|
-
);
|
|
1419
|
-
}
|
|
1420
|
-
function zn(t, e) {
|
|
1421
|
-
return /* @__PURE__ */ vr(t);
|
|
1422
|
-
}
|
|
1423
|
-
function vs(t, e = 1, n = !1) {
|
|
1424
|
-
let r = t;
|
|
1425
|
-
for (; e--; )
|
|
1426
|
-
r = /** @type {TemplateNode} */
|
|
1427
|
-
/* @__PURE__ */ an(r);
|
|
1428
|
-
return r;
|
|
1429
|
-
}
|
|
1430
|
-
function gs(t, e, n) {
|
|
1431
|
-
return (
|
|
1432
|
-
/** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
|
|
1433
|
-
document.createElementNS(Ji, t, void 0)
|
|
1434
|
-
);
|
|
1435
|
-
}
|
|
1436
|
-
function gr(t) {
|
|
1437
|
-
var e = k, n = y;
|
|
1438
|
-
Y(null), se(null);
|
|
1439
|
-
try {
|
|
1440
|
-
return t();
|
|
1441
|
-
} finally {
|
|
1442
|
-
Y(e), se(n);
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
function ws(t, e) {
|
|
1446
|
-
var n = e.last;
|
|
1447
|
-
n === null ? e.last = e.first = t : (n.next = t, t.prev = n, e.last = t);
|
|
1448
|
-
}
|
|
1449
|
-
function fe(t, e, n) {
|
|
1450
|
-
var r = y;
|
|
1451
|
-
r !== null && (r.f & we) !== 0 && (t |= we);
|
|
1452
|
-
var i = {
|
|
1453
|
-
ctx: ee,
|
|
1454
|
-
deps: null,
|
|
1455
|
-
nodes: null,
|
|
1456
|
-
f: t | C | q,
|
|
1457
|
-
first: null,
|
|
1458
|
-
fn: e,
|
|
1459
|
-
last: null,
|
|
1460
|
-
next: null,
|
|
1461
|
-
parent: r,
|
|
1462
|
-
b: r && r.b,
|
|
1463
|
-
prev: null,
|
|
1464
|
-
teardown: null,
|
|
1465
|
-
wv: 0,
|
|
1466
|
-
ac: null
|
|
1467
|
-
};
|
|
1468
|
-
if (n)
|
|
1469
|
-
try {
|
|
1470
|
-
Be(i);
|
|
1471
|
-
} catch (u) {
|
|
1472
|
-
throw ie(i), u;
|
|
1473
|
-
}
|
|
1474
|
-
else e !== null && re(i);
|
|
1475
|
-
var s = i;
|
|
1476
|
-
if (n && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
|
|
1477
|
-
(s.f & He) === 0 && (s = s.first, (t & he) !== 0 && (t & _t) !== 0 && s !== null && (s.f |= _t)), s !== null && (s.parent = r, r !== null && ws(s, r), k !== null && (k.f & N) !== 0 && (t & Ce) === 0)) {
|
|
1478
|
-
var a = (
|
|
1479
|
-
/** @type {Derived} */
|
|
1480
|
-
k
|
|
1481
|
-
);
|
|
1482
|
-
(a.effects ??= []).push(s);
|
|
1483
|
-
}
|
|
1484
|
-
return i;
|
|
1485
|
-
}
|
|
1486
|
-
function on() {
|
|
1487
|
-
return k !== null && !K;
|
|
1488
|
-
}
|
|
1489
|
-
function ks(t) {
|
|
1490
|
-
const e = fe(Et, null, !1);
|
|
1491
|
-
return x(e, A), e.teardown = t, e;
|
|
1492
|
-
}
|
|
1493
|
-
function ys(t) {
|
|
1494
|
-
return fe(rt | ji, t, !1);
|
|
1495
|
-
}
|
|
1496
|
-
function bs(t) {
|
|
1497
|
-
be.ensure();
|
|
1498
|
-
const e = fe(Ce | He, t, !0);
|
|
1499
|
-
return (n = {}) => new Promise((r) => {
|
|
1500
|
-
n.outro ? kt(e, () => {
|
|
1501
|
-
ie(e), r(void 0);
|
|
1502
|
-
}) : (ie(e), r(void 0));
|
|
1503
|
-
});
|
|
1504
|
-
}
|
|
1505
|
-
function _s(t) {
|
|
1506
|
-
return fe(rt, t, !1);
|
|
1507
|
-
}
|
|
1508
|
-
function Ms(t) {
|
|
1509
|
-
return fe(Qt | He, t, !0);
|
|
1510
|
-
}
|
|
1511
|
-
function wr(t, e = 0) {
|
|
1512
|
-
return fe(Et | e, t, !0);
|
|
1513
|
-
}
|
|
1514
|
-
function kr(t, e = [], n = [], r = []) {
|
|
1515
|
-
as(r, e, n, (i) => {
|
|
1516
|
-
fe(Et, () => t(...i.map(M)), !0);
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
function Es(t, e = 0) {
|
|
1520
|
-
var n = fe(he | e, t, !0);
|
|
1521
|
-
return n;
|
|
1522
|
-
}
|
|
1523
|
-
function Se(t) {
|
|
1524
|
-
return fe(Me | He, t, !0);
|
|
1525
|
-
}
|
|
1526
|
-
function yr(t) {
|
|
1527
|
-
var e = t.teardown;
|
|
1528
|
-
if (e !== null) {
|
|
1529
|
-
const n = We, r = k;
|
|
1530
|
-
Dn(!0), Y(null);
|
|
1531
|
-
try {
|
|
1532
|
-
e.call(null);
|
|
1533
|
-
} finally {
|
|
1534
|
-
Dn(n), Y(r);
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
function ln(t, e = !1) {
|
|
1539
|
-
var n = t.first;
|
|
1540
|
-
for (t.first = t.last = null; n !== null; ) {
|
|
1541
|
-
const i = n.ac;
|
|
1542
|
-
i !== null && gr(() => {
|
|
1543
|
-
i.abort(Pe);
|
|
1544
|
-
});
|
|
1545
|
-
var r = n.next;
|
|
1546
|
-
(n.f & Ce) !== 0 ? n.parent = null : ie(n, e), n = r;
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
function xs(t) {
|
|
1550
|
-
for (var e = t.first; e !== null; ) {
|
|
1551
|
-
var n = e.next;
|
|
1552
|
-
(e.f & Me) === 0 && ie(e), e = n;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
function ie(t, e = !0) {
|
|
1556
|
-
var n = !1;
|
|
1557
|
-
(e || (t.f & Qn) !== 0) && t.nodes !== null && t.nodes.end !== null && (Ss(
|
|
1558
|
-
t.nodes.start,
|
|
1559
|
-
/** @type {TemplateNode} */
|
|
1560
|
-
t.nodes.end
|
|
1561
|
-
), n = !0), ln(t, e && !n), et(t, 0), x(t, ke);
|
|
1562
|
-
var r = t.nodes && t.nodes.t;
|
|
1563
|
-
if (r !== null)
|
|
1564
|
-
for (const s of r)
|
|
1565
|
-
s.stop();
|
|
1566
|
-
yr(t);
|
|
1567
|
-
var i = t.parent;
|
|
1568
|
-
i !== null && i.first !== null && br(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = null;
|
|
1569
|
-
}
|
|
1570
|
-
function Ss(t, e) {
|
|
1571
|
-
for (; t !== null; ) {
|
|
1572
|
-
var n = t === e ? null : /* @__PURE__ */ an(t);
|
|
1573
|
-
t.remove(), t = n;
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
function br(t) {
|
|
1577
|
-
var e = t.parent, n = t.prev, r = t.next;
|
|
1578
|
-
n !== null && (n.next = r), r !== null && (r.prev = n), e !== null && (e.first === t && (e.first = r), e.last === t && (e.last = n));
|
|
1579
|
-
}
|
|
1580
|
-
function kt(t, e, n = !0) {
|
|
1581
|
-
var r = [];
|
|
1582
|
-
_r(t, r, !0);
|
|
1583
|
-
var i = () => {
|
|
1584
|
-
n && ie(t), e && e();
|
|
1585
|
-
}, s = r.length;
|
|
1586
|
-
if (s > 0) {
|
|
1587
|
-
var a = () => --s || i();
|
|
1588
|
-
for (var u of r)
|
|
1589
|
-
u.out(a);
|
|
1590
|
-
} else
|
|
1591
|
-
i();
|
|
1592
|
-
}
|
|
1593
|
-
function _r(t, e, n) {
|
|
1594
|
-
if ((t.f & we) === 0) {
|
|
1595
|
-
t.f ^= we;
|
|
1596
|
-
var r = t.nodes && t.nodes.t;
|
|
1597
|
-
if (r !== null)
|
|
1598
|
-
for (const u of r)
|
|
1599
|
-
(u.is_global || n) && e.push(u);
|
|
1600
|
-
for (var i = t.first; i !== null; ) {
|
|
1601
|
-
var s = i.next, a = (i.f & _t) !== 0 || // If this is a branch effect without a block effect parent,
|
|
1602
|
-
// it means the parent block effect was pruned. In that case,
|
|
1603
|
-
// transparency information was transferred to the branch effect.
|
|
1604
|
-
(i.f & Me) !== 0 && (t.f & he) !== 0;
|
|
1605
|
-
_r(i, e, a ? n : !1), i = s;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
function Ps(t, e) {
|
|
1610
|
-
if (t.nodes)
|
|
1611
|
-
for (var n = t.nodes.start, r = t.nodes.end; n !== null; ) {
|
|
1612
|
-
var i = n === r ? null : /* @__PURE__ */ an(n);
|
|
1613
|
-
e.append(n), n = i;
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
let yt = !1, We = !1;
|
|
1617
|
-
function Dn(t) {
|
|
1618
|
-
We = t;
|
|
1619
|
-
}
|
|
1620
|
-
let k = null, K = !1;
|
|
1621
|
-
function Y(t) {
|
|
1622
|
-
k = t;
|
|
1623
|
-
}
|
|
1624
|
-
let y = null;
|
|
1625
|
-
function se(t) {
|
|
1626
|
-
y = t;
|
|
1627
|
-
}
|
|
1628
|
-
let Z = null;
|
|
1629
|
-
function Ts(t) {
|
|
1630
|
-
k !== null && (Z === null ? Z = [t] : Z.push(t));
|
|
1631
|
-
}
|
|
1632
|
-
let D = null, F = 0, W = null;
|
|
1633
|
-
function Is(t) {
|
|
1634
|
-
W = t;
|
|
1635
|
-
}
|
|
1636
|
-
let Mr = 1, Te = 0, Ae = Te;
|
|
1637
|
-
function On(t) {
|
|
1638
|
-
Ae = t;
|
|
1639
|
-
}
|
|
1640
|
-
function Er() {
|
|
1641
|
-
return ++Mr;
|
|
1642
|
-
}
|
|
1643
|
-
function it(t) {
|
|
1644
|
-
var e = t.f;
|
|
1645
|
-
if ((e & C) !== 0)
|
|
1646
|
-
return !0;
|
|
1647
|
-
if (e & N && (t.f &= ~Ne), (e & Q) !== 0) {
|
|
1648
|
-
for (var n = (
|
|
1649
|
-
/** @type {Value[]} */
|
|
1650
|
-
t.deps
|
|
1651
|
-
), r = n.length, i = 0; i < r; i++) {
|
|
1652
|
-
var s = n[i];
|
|
1653
|
-
if (it(
|
|
1654
|
-
/** @type {Derived} */
|
|
1655
|
-
s
|
|
1656
|
-
) && lr(
|
|
1657
|
-
/** @type {Derived} */
|
|
1658
|
-
s
|
|
1659
|
-
), s.wv > t.wv)
|
|
1660
|
-
return !0;
|
|
1661
|
-
}
|
|
1662
|
-
(e & q) !== 0 && // During time traveling we don't want to reset the status so that
|
|
1663
|
-
// traversal of the graph in the other batches still happens
|
|
1664
|
-
G === null && x(t, A);
|
|
1665
|
-
}
|
|
1666
|
-
return !1;
|
|
1667
|
-
}
|
|
1668
|
-
function xr(t, e, n = !0) {
|
|
1669
|
-
var r = t.reactions;
|
|
1670
|
-
if (r !== null && !(Z !== null && Ve.call(Z, t)))
|
|
1671
|
-
for (var i = 0; i < r.length; i++) {
|
|
1672
|
-
var s = r[i];
|
|
1673
|
-
(s.f & N) !== 0 ? xr(
|
|
1674
|
-
/** @type {Derived} */
|
|
1675
|
-
s,
|
|
1676
|
-
e,
|
|
1677
|
-
!1
|
|
1678
|
-
) : e === s && (n ? x(s, C) : (s.f & A) !== 0 && x(s, Q), re(
|
|
1679
|
-
/** @type {Effect} */
|
|
1680
|
-
s
|
|
1681
|
-
));
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
function Sr(t) {
|
|
1685
|
-
var e = D, n = F, r = W, i = k, s = Z, a = ee, u = K, o = Ae, l = t.f;
|
|
1686
|
-
D = /** @type {null | Value[]} */
|
|
1687
|
-
null, F = 0, W = null, k = (l & (Me | Ce)) === 0 ? t : null, Z = null, je(t.ctx), K = !1, Ae = ++Te, t.ac !== null && (gr(() => {
|
|
1688
|
-
t.ac.abort(Pe);
|
|
1689
|
-
}), t.ac = null);
|
|
1690
|
-
try {
|
|
1691
|
-
t.f |= Zt;
|
|
1692
|
-
var c = (
|
|
1693
|
-
/** @type {Function} */
|
|
1694
|
-
t.fn
|
|
1695
|
-
), h = c();
|
|
1696
|
-
t.f |= Ue;
|
|
1697
|
-
var f = t.deps, m = E?.is_fork;
|
|
1698
|
-
if (D !== null) {
|
|
1699
|
-
var d;
|
|
1700
|
-
if (m || et(t, F), f !== null && F > 0)
|
|
1701
|
-
for (f.length = F + D.length, d = 0; d < D.length; d++)
|
|
1702
|
-
f[F + d] = D[d];
|
|
1703
|
-
else
|
|
1704
|
-
t.deps = f = D;
|
|
1705
|
-
if (on() && (t.f & q) !== 0)
|
|
1706
|
-
for (d = F; d < f.length; d++)
|
|
1707
|
-
(f[d].reactions ??= []).push(t);
|
|
1708
|
-
} else !m && f !== null && F < f.length && (et(t, F), f.length = F);
|
|
1709
|
-
if (tr() && W !== null && !K && f !== null && (t.f & (N | Q | C)) === 0)
|
|
1710
|
-
for (d = 0; d < /** @type {Source[]} */
|
|
1711
|
-
W.length; d++)
|
|
1712
|
-
xr(
|
|
1713
|
-
W[d],
|
|
1714
|
-
/** @type {Effect} */
|
|
1715
|
-
t
|
|
1716
|
-
);
|
|
1717
|
-
if (i !== null && i !== t) {
|
|
1718
|
-
if (Te++, i.deps !== null)
|
|
1719
|
-
for (let v = 0; v < n; v += 1)
|
|
1720
|
-
i.deps[v].rv = Te;
|
|
1721
|
-
if (e !== null)
|
|
1722
|
-
for (const v of e)
|
|
1723
|
-
v.rv = Te;
|
|
1724
|
-
W !== null && (r === null ? r = W : r.push(.../** @type {Source[]} */
|
|
1725
|
-
W));
|
|
1726
|
-
}
|
|
1727
|
-
return (t.f & ye) !== 0 && (t.f ^= ye), h;
|
|
1728
|
-
} catch (v) {
|
|
1729
|
-
return nr(v);
|
|
1730
|
-
} finally {
|
|
1731
|
-
t.f ^= Zt, D = e, F = n, W = r, k = i, Z = s, je(a), K = u, Ae = o;
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
function As(t, e) {
|
|
1735
|
-
let n = e.reactions;
|
|
1736
|
-
if (n !== null) {
|
|
1737
|
-
var r = zi.call(n, t);
|
|
1738
|
-
if (r !== -1) {
|
|
1739
|
-
var i = n.length - 1;
|
|
1740
|
-
i === 0 ? n = e.reactions = null : (n[r] = n[i], n.pop());
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
if (n === null && (e.f & N) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
|
|
1744
|
-
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
|
1745
|
-
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
|
1746
|
-
(D === null || !Ve.call(D, e))) {
|
|
1747
|
-
var s = (
|
|
1748
|
-
/** @type {Derived} */
|
|
1749
|
-
e
|
|
1750
|
-
);
|
|
1751
|
-
(s.f & q) !== 0 && (s.f ^= q, s.f &= ~Ne), nn(s), ps(s), et(s, 0);
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
function et(t, e) {
|
|
1755
|
-
var n = t.deps;
|
|
1756
|
-
if (n !== null)
|
|
1757
|
-
for (var r = e; r < n.length; r++)
|
|
1758
|
-
As(t, n[r]);
|
|
1759
|
-
}
|
|
1760
|
-
function Be(t) {
|
|
1761
|
-
var e = t.f;
|
|
1762
|
-
if ((e & ke) === 0) {
|
|
1763
|
-
x(t, A);
|
|
1764
|
-
var n = y, r = yt;
|
|
1765
|
-
y = t, yt = !0;
|
|
1766
|
-
try {
|
|
1767
|
-
(e & (he | Kn)) !== 0 ? xs(t) : ln(t), yr(t);
|
|
1768
|
-
var i = Sr(t);
|
|
1769
|
-
t.teardown = typeof i == "function" ? i : null, t.wv = Mr;
|
|
1770
|
-
var s;
|
|
1771
|
-
Ht && Gi && (t.f & C) !== 0 && t.deps;
|
|
1772
|
-
} finally {
|
|
1773
|
-
yt = r, y = n;
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
function M(t) {
|
|
1778
|
-
var e = t.f, n = (e & N) !== 0;
|
|
1779
|
-
if (k !== null && !K) {
|
|
1780
|
-
var r = y !== null && (y.f & ke) !== 0;
|
|
1781
|
-
if (!r && (Z === null || !Ve.call(Z, t))) {
|
|
1782
|
-
var i = k.deps;
|
|
1783
|
-
if ((k.f & Zt) !== 0)
|
|
1784
|
-
t.rv < Te && (t.rv = Te, D === null && i !== null && i[F] === t ? F++ : D === null ? D = [t] : D.push(t));
|
|
1785
|
-
else {
|
|
1786
|
-
(k.deps ??= []).push(t);
|
|
1787
|
-
var s = t.reactions;
|
|
1788
|
-
s === null ? t.reactions = [k] : Ve.call(s, k) || s.push(k);
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
if (We && _e.has(t))
|
|
1793
|
-
return _e.get(t);
|
|
1794
|
-
if (n) {
|
|
1795
|
-
var a = (
|
|
1796
|
-
/** @type {Derived} */
|
|
1797
|
-
t
|
|
1798
|
-
);
|
|
1799
|
-
if (We) {
|
|
1800
|
-
var u = a.v;
|
|
1801
|
-
return ((a.f & A) === 0 && a.reactions !== null || Tr(a)) && (u = sn(a)), _e.set(a, u), u;
|
|
1802
|
-
}
|
|
1803
|
-
var o = (a.f & q) === 0 && !K && k !== null && (yt || (k.f & q) !== 0), l = (a.f & Ue) === 0;
|
|
1804
|
-
it(a) && (o && (a.f |= q), lr(a)), o && !l && (ur(a), Pr(a));
|
|
1805
|
-
}
|
|
1806
|
-
if (G?.has(t))
|
|
1807
|
-
return G.get(t);
|
|
1808
|
-
if ((t.f & ye) !== 0)
|
|
1809
|
-
throw t.v;
|
|
1810
|
-
return t.v;
|
|
1811
|
-
}
|
|
1812
|
-
function Pr(t) {
|
|
1813
|
-
if (t.f |= q, t.deps !== null)
|
|
1814
|
-
for (const e of t.deps)
|
|
1815
|
-
(e.reactions ??= []).push(t), (e.f & N) !== 0 && (e.f & q) === 0 && (ur(
|
|
1816
|
-
/** @type {Derived} */
|
|
1817
|
-
e
|
|
1818
|
-
), Pr(
|
|
1819
|
-
/** @type {Derived} */
|
|
1820
|
-
e
|
|
1821
|
-
));
|
|
1822
|
-
}
|
|
1823
|
-
function Tr(t) {
|
|
1824
|
-
if (t.v === I) return !0;
|
|
1825
|
-
if (t.deps === null) return !1;
|
|
1826
|
-
for (const e of t.deps)
|
|
1827
|
-
if (_e.has(e) || (e.f & N) !== 0 && Tr(
|
|
1828
|
-
/** @type {Derived} */
|
|
1829
|
-
e
|
|
1830
|
-
))
|
|
1831
|
-
return !0;
|
|
1832
|
-
return !1;
|
|
1833
|
-
}
|
|
1834
|
-
function H(t) {
|
|
1835
|
-
var e = K;
|
|
1836
|
-
try {
|
|
1837
|
-
return K = !0, t();
|
|
1838
|
-
} finally {
|
|
1839
|
-
K = e;
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
const Ns = ["touchstart", "touchmove"];
|
|
1843
|
-
function Cs(t) {
|
|
1844
|
-
return Ns.includes(t);
|
|
1845
|
-
}
|
|
1846
|
-
const mt = /* @__PURE__ */ Symbol("events"), Rs = /* @__PURE__ */ new Set(), Ln = /* @__PURE__ */ new Set();
|
|
1847
|
-
let Fn = null;
|
|
1848
|
-
function $n(t) {
|
|
1849
|
-
var e = this, n = (
|
|
1850
|
-
/** @type {Node} */
|
|
1851
|
-
e.ownerDocument
|
|
1852
|
-
), r = t.type, i = t.composedPath?.() || [], s = (
|
|
1853
|
-
/** @type {null | Element} */
|
|
1854
|
-
i[0] || t.target
|
|
1855
|
-
);
|
|
1856
|
-
Fn = t;
|
|
1857
|
-
var a = 0, u = Fn === t && t[mt];
|
|
1858
|
-
if (u) {
|
|
1859
|
-
var o = i.indexOf(u);
|
|
1860
|
-
if (o !== -1 && (e === document || e === /** @type {any} */
|
|
1861
|
-
window)) {
|
|
1862
|
-
t[mt] = e;
|
|
1863
|
-
return;
|
|
1864
|
-
}
|
|
1865
|
-
var l = i.indexOf(e);
|
|
1866
|
-
if (l === -1)
|
|
1867
|
-
return;
|
|
1868
|
-
o <= l && (a = o);
|
|
1869
|
-
}
|
|
1870
|
-
if (s = /** @type {Element} */
|
|
1871
|
-
i[a] || t.target, s !== e) {
|
|
1872
|
-
Oi(t, "currentTarget", {
|
|
1873
|
-
configurable: !0,
|
|
1874
|
-
get() {
|
|
1875
|
-
return s || n;
|
|
1876
|
-
}
|
|
1877
|
-
});
|
|
1878
|
-
var c = k, h = y;
|
|
1879
|
-
Y(null), se(null);
|
|
1880
|
-
try {
|
|
1881
|
-
for (var f, m = []; s !== null; ) {
|
|
1882
|
-
var d = s.assignedSlot || s.parentNode || /** @type {any} */
|
|
1883
|
-
s.host || null;
|
|
1884
|
-
try {
|
|
1885
|
-
var v = s[mt]?.[r];
|
|
1886
|
-
v != null && (!/** @type {any} */
|
|
1887
|
-
s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
|
1888
|
-
// -> the target could not have been disabled because it emits the event in the first place
|
|
1889
|
-
t.target === s) && v.call(s, t);
|
|
1890
|
-
} catch (g) {
|
|
1891
|
-
f ? m.push(g) : f = g;
|
|
1892
|
-
}
|
|
1893
|
-
if (t.cancelBubble || d === e || d === null)
|
|
1894
|
-
break;
|
|
1895
|
-
s = d;
|
|
1896
|
-
}
|
|
1897
|
-
if (f) {
|
|
1898
|
-
for (let g of m)
|
|
1899
|
-
queueMicrotask(() => {
|
|
1900
|
-
throw g;
|
|
1901
|
-
});
|
|
1902
|
-
throw f;
|
|
1903
|
-
}
|
|
1904
|
-
} finally {
|
|
1905
|
-
t[mt] = e, delete t.currentTarget, Y(c), se(h);
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
const zs = (
|
|
1910
|
-
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
1911
|
-
globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
|
|
1912
|
-
/** @param {string} html */
|
|
1913
|
-
createHTML: (t) => t
|
|
1914
|
-
})
|
|
1915
|
-
);
|
|
1916
|
-
function Ds(t) {
|
|
1917
|
-
return (
|
|
1918
|
-
/** @type {string} */
|
|
1919
|
-
zs?.createHTML(t) ?? t
|
|
1920
|
-
);
|
|
1921
|
-
}
|
|
1922
|
-
function Os(t) {
|
|
1923
|
-
var e = gs("template");
|
|
1924
|
-
return e.innerHTML = Ds(t.replaceAll("<!>", "<!---->")), e.content;
|
|
1925
|
-
}
|
|
1926
|
-
function Ls(t, e) {
|
|
1927
|
-
var n = (
|
|
1928
|
-
/** @type {Effect} */
|
|
1929
|
-
y
|
|
1930
|
-
);
|
|
1931
|
-
n.nodes === null && (n.nodes = { start: t, end: e, a: null, t: null });
|
|
1932
|
-
}
|
|
1933
|
-
// @__NO_SIDE_EFFECTS__
|
|
1934
|
-
function Ir(t, e) {
|
|
1935
|
-
var n, r = !t.startsWith("<!>");
|
|
1936
|
-
return () => {
|
|
1937
|
-
n === void 0 && (n = Os(r ? t : "<!>" + t), n = /** @type {TemplateNode} */
|
|
1938
|
-
/* @__PURE__ */ vr(n));
|
|
1939
|
-
var i = (
|
|
1940
|
-
/** @type {TemplateNode} */
|
|
1941
|
-
fr ? document.importNode(n, !0) : n.cloneNode(!0)
|
|
1942
|
-
);
|
|
1943
|
-
return Ls(i, i), i;
|
|
1944
|
-
};
|
|
1945
|
-
}
|
|
1946
|
-
function Ar(t, e) {
|
|
1947
|
-
t !== null && t.before(
|
|
1948
|
-
/** @type {Node} */
|
|
1949
|
-
e
|
|
1950
|
-
);
|
|
1951
|
-
}
|
|
1952
|
-
function un(t, e) {
|
|
1953
|
-
return Fs(t, e);
|
|
1954
|
-
}
|
|
1955
|
-
const vt = /* @__PURE__ */ new Map();
|
|
1956
|
-
function Fs(t, { target: e, anchor: n, props: r = {}, events: i, context: s, intro: a = !0, transformError: u }) {
|
|
1957
|
-
ms();
|
|
1958
|
-
var o = void 0, l = bs(() => {
|
|
1959
|
-
var c = n ?? e.appendChild(mr());
|
|
1960
|
-
is(
|
|
1961
|
-
/** @type {TemplateNode} */
|
|
1962
|
-
c,
|
|
1963
|
-
{
|
|
1964
|
-
pending: () => {
|
|
1965
|
-
}
|
|
1966
|
-
},
|
|
1967
|
-
(m) => {
|
|
1968
|
-
en({});
|
|
1969
|
-
var d = (
|
|
1970
|
-
/** @type {ComponentContext} */
|
|
1971
|
-
ee
|
|
1972
|
-
);
|
|
1973
|
-
s && (d.c = s), i && (r.$$events = i), o = t(m, r) || {}, tn();
|
|
1974
|
-
},
|
|
1975
|
-
u
|
|
1976
|
-
);
|
|
1977
|
-
var h = /* @__PURE__ */ new Set(), f = (m) => {
|
|
1978
|
-
for (var d = 0; d < m.length; d++) {
|
|
1979
|
-
var v = m[d];
|
|
1980
|
-
if (!h.has(v)) {
|
|
1981
|
-
h.add(v);
|
|
1982
|
-
var g = Cs(v);
|
|
1983
|
-
for (const te of [e, document]) {
|
|
1984
|
-
var P = vt.get(te);
|
|
1985
|
-
P === void 0 && (P = /* @__PURE__ */ new Map(), vt.set(te, P));
|
|
1986
|
-
var U = P.get(v);
|
|
1987
|
-
U === void 0 ? (te.addEventListener(v, $n, { passive: g }), P.set(v, 1)) : P.set(v, U + 1);
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
};
|
|
1992
|
-
return f(Di(Rs)), Ln.add(f), () => {
|
|
1993
|
-
for (var m of h)
|
|
1994
|
-
for (const g of [e, document]) {
|
|
1995
|
-
var d = (
|
|
1996
|
-
/** @type {Map<string, number>} */
|
|
1997
|
-
vt.get(g)
|
|
1998
|
-
), v = (
|
|
1999
|
-
/** @type {number} */
|
|
2000
|
-
d.get(m)
|
|
2001
|
-
);
|
|
2002
|
-
--v == 0 ? (g.removeEventListener(m, $n), d.delete(m), d.size === 0 && vt.delete(g)) : d.set(m, v);
|
|
2003
|
-
}
|
|
2004
|
-
Ln.delete(f), c !== n && c.parentNode?.removeChild(c);
|
|
2005
|
-
};
|
|
2006
|
-
});
|
|
2007
|
-
return $s.set(o, l), o;
|
|
2008
|
-
}
|
|
2009
|
-
let $s = /* @__PURE__ */ new WeakMap();
|
|
2010
|
-
function Nr(t) {
|
|
2011
|
-
var e, n, r = "";
|
|
2012
|
-
if (typeof t == "string" || typeof t == "number") r += t;
|
|
2013
|
-
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
2014
|
-
var i = t.length;
|
|
2015
|
-
for (e = 0; e < i; e++) t[e] && (n = Nr(t[e])) && (r && (r += " "), r += n);
|
|
2016
|
-
} else for (n in t) t[n] && (r && (r += " "), r += n);
|
|
2017
|
-
return r;
|
|
2018
|
-
}
|
|
2019
|
-
function Vs() {
|
|
2020
|
-
for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = Nr(t)) && (r && (r += " "), r += e);
|
|
2021
|
-
return r;
|
|
2022
|
-
}
|
|
2023
|
-
function Cr(t) {
|
|
2024
|
-
return typeof t == "object" ? Vs(t) : t ?? "";
|
|
2025
|
-
}
|
|
2026
|
-
function Us(t, e, n) {
|
|
2027
|
-
var r = t == null ? "" : "" + t;
|
|
2028
|
-
return e && (r = r ? r + " " + e : e), r === "" ? null : r;
|
|
2029
|
-
}
|
|
2030
|
-
function Vn(t, e = !1) {
|
|
2031
|
-
var n = e ? " !important;" : ";", r = "";
|
|
2032
|
-
for (var i of Object.keys(t)) {
|
|
2033
|
-
var s = t[i];
|
|
2034
|
-
s != null && s !== "" && (r += " " + i + ": " + s + n);
|
|
2035
|
-
}
|
|
2036
|
-
return r;
|
|
2037
|
-
}
|
|
2038
|
-
function js(t, e) {
|
|
2039
|
-
if (e) {
|
|
2040
|
-
var n = "", r, i;
|
|
2041
|
-
return Array.isArray(e) ? (r = e[0], i = e[1]) : r = e, r && (n += Vn(r)), i && (n += Vn(i, !0)), n = n.trim(), n === "" ? null : n;
|
|
2042
|
-
}
|
|
2043
|
-
return String(t);
|
|
2044
|
-
}
|
|
2045
|
-
function Rr(t, e, n, r, i, s) {
|
|
2046
|
-
var a = t.__className;
|
|
2047
|
-
if (a !== n || a === void 0) {
|
|
2048
|
-
var u = Us(n, r);
|
|
2049
|
-
u == null ? t.removeAttribute("class") : t.className = u, t.__className = n;
|
|
2050
|
-
}
|
|
2051
|
-
return s;
|
|
2052
|
-
}
|
|
2053
|
-
function $t(t, e = {}, n, r) {
|
|
2054
|
-
for (var i in n) {
|
|
2055
|
-
var s = n[i];
|
|
2056
|
-
e[i] !== s && (n[i] == null ? t.style.removeProperty(i) : t.style.setProperty(i, s, r));
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
function Ye(t, e, n, r) {
|
|
2060
|
-
var i = t.__style;
|
|
2061
|
-
if (i !== e) {
|
|
2062
|
-
var s = js(e, r);
|
|
2063
|
-
s == null ? t.removeAttribute("style") : t.style.cssText = s, t.__style = e;
|
|
2064
|
-
} else r && (Array.isArray(r) ? ($t(t, n?.[0], r[0]), $t(t, n?.[1], r[1], "important")) : $t(t, n, r));
|
|
2065
|
-
return r;
|
|
2066
|
-
}
|
|
2067
|
-
function Un(t, e) {
|
|
2068
|
-
return t === e || t?.[wt] === e;
|
|
2069
|
-
}
|
|
2070
|
-
function Je(t = {}, e, n, r) {
|
|
2071
|
-
return _s(() => {
|
|
2072
|
-
var i, s;
|
|
2073
|
-
return wr(() => {
|
|
2074
|
-
i = s, s = [], H(() => {
|
|
2075
|
-
t !== n(...s) && (e(t, ...s), i && Un(n(...i), t) && e(null, ...i));
|
|
2076
|
-
});
|
|
2077
|
-
}), () => {
|
|
2078
|
-
Ie(() => {
|
|
2079
|
-
s && Un(n(...s), t) && e(null, ...s);
|
|
2080
|
-
});
|
|
2081
|
-
};
|
|
2082
|
-
}), t;
|
|
2083
|
-
}
|
|
2084
|
-
class cn {
|
|
2085
|
-
div;
|
|
2086
|
-
marker;
|
|
2087
|
-
constructor(e, n, r, i) {
|
|
2088
|
-
this.div = document.createElement("div"), this.marker = e.createMarker(this.div, n, r, i);
|
|
2089
|
-
}
|
|
2090
|
-
insert() {
|
|
2091
|
-
this.marker.inserted() != !0 && this.marker.insert();
|
|
2092
|
-
}
|
|
2093
|
-
remove() {
|
|
2094
|
-
this.marker.inserted() != !1 && this.marker.remove();
|
|
2095
|
-
}
|
|
2096
|
-
update(e) {
|
|
2097
|
-
this.marker.update(e);
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
class st {
|
|
2101
|
-
shown;
|
|
2102
|
-
id;
|
|
2103
|
-
lat;
|
|
2104
|
-
lng;
|
|
2105
|
-
rank;
|
|
2106
|
-
marker;
|
|
2107
|
-
constructor(e, n, r, i, s) {
|
|
2108
|
-
if (new.target === st) throw new Error("Unsupported code");
|
|
2109
|
-
this.shown = !0, this.id = e, this.lat = n, this.lng = r, this.rank = i, this.marker = s;
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
const Ws = "5";
|
|
2113
|
-
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Ws);
|
|
2114
|
-
function zr(t) {
|
|
2115
|
-
return -0.5 * (Math.cos(Math.PI * t) - 1);
|
|
2116
|
-
}
|
|
2117
|
-
class Dr {
|
|
2118
|
-
animating;
|
|
2119
|
-
animationEasing;
|
|
2120
|
-
animationCallback;
|
|
2121
|
-
value;
|
|
2122
|
-
time;
|
|
2123
|
-
constructor(e) {
|
|
2124
|
-
if (e.max <= e.min) throw new Error("Invalid min or max");
|
|
2125
|
-
if (e.value < e.min || e.max < e.value) throw new Error("Invalid value");
|
|
2126
|
-
this.animationEasing = e.easing, this.animationCallback = e.callback, this.animating = !1, this.value = { current: e.value, start: e.value, end: e.value, min: e.min, max: e.max }, this.time = { start: 0, end: 0, span: e.timespan };
|
|
2127
|
-
}
|
|
2128
|
-
animationFrame() {
|
|
2129
|
-
const e = performance.now();
|
|
2130
|
-
if (e > this.time.end)
|
|
2131
|
-
this.value.current = this.value.end;
|
|
2132
|
-
else {
|
|
2133
|
-
const n = (e - this.time.start) / (this.time.end - this.time.start), r = this.animationEasing(n);
|
|
2134
|
-
this.value.current = this.value.start + (this.value.end - this.value.start) * r;
|
|
2135
|
-
}
|
|
2136
|
-
if (this.animationCallback(this.value.current), this.value.current === this.value.end) {
|
|
2137
|
-
this.animating = !1;
|
|
2138
|
-
return;
|
|
2139
|
-
}
|
|
2140
|
-
window.requestAnimationFrame(this.animationFrame.bind(this));
|
|
2141
|
-
}
|
|
2142
|
-
target(e) {
|
|
2143
|
-
if (e === this.value.end) return;
|
|
2144
|
-
this.value.start = this.value.current, this.value.end = e;
|
|
2145
|
-
const n = performance.now(), r = Math.abs(this.value.start - this.value.end), i = this.value.max - this.value.min;
|
|
2146
|
-
this.time.start = n, this.time.end = n + this.time.span * Math.sqrt(r / i), !this.animating && (this.animating = !0, window.requestAnimationFrame(this.animationFrame.bind(this)));
|
|
2147
|
-
}
|
|
2148
|
-
set(e) {
|
|
2149
|
-
if (e === this.value.end) return;
|
|
2150
|
-
this.value.current = e, this.value.start = e, this.value.end = e;
|
|
2151
|
-
const n = performance.now();
|
|
2152
|
-
this.time.start = n, this.time.end = n, window.requestAnimationFrame(this.animationCallback.bind(this, e));
|
|
2153
|
-
}
|
|
2154
|
-
end() {
|
|
2155
|
-
this.set(this.value.end);
|
|
2156
|
-
}
|
|
2157
|
-
expired() {
|
|
2158
|
-
return performance.now() > this.time.end;
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
var Bs = /* @__PURE__ */ Ir("<div></div>");
|
|
2162
|
-
function Hs(t, e) {
|
|
2163
|
-
en(e, !0);
|
|
2164
|
-
let n = H(() => e.id), r = H(() => e.element), i = H(() => e.style), s = H(() => e.dimensions), a = H(() => e.initialize), u = {
|
|
2165
|
-
setDisplayed: U,
|
|
2166
|
-
getDisplayed: te,
|
|
2167
|
-
setSuppressed: ae,
|
|
2168
|
-
setCollapsed: de,
|
|
2169
|
-
getCollapsed: me,
|
|
2170
|
-
setScale: St
|
|
2171
|
-
};
|
|
2172
|
-
function o() {
|
|
2173
|
-
return u;
|
|
2174
|
-
}
|
|
2175
|
-
let l, c = s.width, h = s.height, f = s.padding, m = i?.background ?? Ni, d = i?.radius ?? Si, v = i?.shadow ?? Pi, g = /* @__PURE__ */ z(!1), P = !1;
|
|
2176
|
-
function U(b) {
|
|
2177
|
-
b == !0 && (l && r && r.parentElement != l && l.appendChild(r), P == !1 && a && r && (P = !0, setTimeout(async () => await a(n, r), 0))), b != M(g) && (O(g, b, !0), b == !1 && R.end());
|
|
2178
|
-
}
|
|
2179
|
-
function te() {
|
|
2180
|
-
return M(g);
|
|
2181
|
-
}
|
|
2182
|
-
let Ee = /* @__PURE__ */ z(!0);
|
|
2183
|
-
function ae(b) {
|
|
2184
|
-
b != M(Ee) && (O(Ee, b, !0), b && (X = ze, R.set(ze)));
|
|
2185
|
-
}
|
|
2186
|
-
let J = /* @__PURE__ */ z(!0);
|
|
2187
|
-
function de(b) {
|
|
2188
|
-
b != M(J) && (O(J, b, !0), R.target(M(J) ? 0 : X));
|
|
2189
|
-
}
|
|
2190
|
-
function me() {
|
|
2191
|
-
return M(g) ? R.expired() : !0;
|
|
2192
|
-
}
|
|
2193
|
-
let X = ze, R = new Dr({
|
|
2194
|
-
value: ze,
|
|
2195
|
-
min: 0,
|
|
2196
|
-
max: 1,
|
|
2197
|
-
timespan: _i,
|
|
2198
|
-
easing: zr,
|
|
2199
|
-
callback: Pt
|
|
2200
|
-
});
|
|
2201
|
-
function St(b) {
|
|
2202
|
-
X = b, R.target(b);
|
|
2203
|
-
}
|
|
2204
|
-
function Pt(b) {
|
|
2205
|
-
l.style.scale = b.toString(), l.style.filter = `brightness(${at(b)})`;
|
|
2206
|
-
}
|
|
2207
|
-
function at(b) {
|
|
2208
|
-
return 0.25 + 0.75 * b;
|
|
2209
|
-
}
|
|
2210
|
-
var Tt = { invoke: o }, j = Bs();
|
|
2211
|
-
let ot;
|
|
2212
|
-
return Je(j, (b) => l = b, () => l), kr(
|
|
2213
|
-
(b) => {
|
|
2214
|
-
Rr(
|
|
2215
|
-
j,
|
|
2216
|
-
1,
|
|
2217
|
-
Cr([
|
|
2218
|
-
"pin",
|
|
2219
|
-
M(g) && "displayed",
|
|
2220
|
-
M(Ee) && "suppressed"
|
|
2221
|
-
]),
|
|
2222
|
-
"svelte-10kxbrm"
|
|
2223
|
-
), ot = Ye(j, "", ot, b);
|
|
2224
|
-
},
|
|
2225
|
-
[
|
|
2226
|
-
() => ({
|
|
2227
|
-
width: `${c}px`,
|
|
2228
|
-
height: `${h}px`,
|
|
2229
|
-
padding: `${f}px`,
|
|
2230
|
-
"border-radius": `${d}px`,
|
|
2231
|
-
"background-color": `rgb(from ${m} r g b / 1)`,
|
|
2232
|
-
"box-shadow": v,
|
|
2233
|
-
scale: ze,
|
|
2234
|
-
filter: `brightness(${at(ze)})`
|
|
2235
|
-
})
|
|
2236
|
-
]
|
|
2237
|
-
), Ar(t, j), tn(Tt);
|
|
2238
|
-
}
|
|
2239
|
-
class qs extends st {
|
|
2240
|
-
width;
|
|
2241
|
-
height;
|
|
2242
|
-
zoom;
|
|
2243
|
-
component;
|
|
2244
|
-
constructor(e, n, r, i, s, a) {
|
|
2245
|
-
super(n, r, i, s, new cn(e, r, i, s)), this.width = a.dimensions.width, this.height = a.dimensions.height, this.zoom = NaN, this.component = un(Hs, {
|
|
2246
|
-
target: this.marker.div,
|
|
2247
|
-
props: a
|
|
2248
|
-
});
|
|
2249
|
-
}
|
|
2250
|
-
get zIndex() {
|
|
2251
|
-
return Number.isNaN(this.zoom) ? this.rank : Math.round(-this.zoom * Xn) + Ei;
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
class jn {
|
|
2255
|
-
animating;
|
|
2256
|
-
animationTimestamp;
|
|
2257
|
-
animationEnd;
|
|
2258
|
-
animationCallback;
|
|
2259
|
-
speed;
|
|
2260
|
-
value;
|
|
2261
|
-
constructor(e) {
|
|
2262
|
-
this.animating = !1, this.animationTimestamp = 0, this.animationEnd = 0, this.animationCallback = e.callback, this.speed = { current: 0, spring: { stiffness: e.stiffness, damping: 2 * Math.sqrt(e.stiffness) } }, this.value = { current: e.value, target: e.value, precision: e.precision, min: e.min, max: e.max };
|
|
2263
|
-
}
|
|
2264
|
-
animationFrame() {
|
|
2265
|
-
try {
|
|
2266
|
-
const e = performance.now(), n = e - this.animationTimestamp;
|
|
2267
|
-
if (this.animationTimestamp = e, e >= this.animationEnd) {
|
|
2268
|
-
this.speed.current = 0, this.value.current = this.value.target;
|
|
2269
|
-
return;
|
|
2270
|
-
}
|
|
2271
|
-
const r = this.value.target - this.value.current;
|
|
2272
|
-
if (Math.abs(r) < this.value.precision) {
|
|
2273
|
-
this.speed.current = 0, this.value.current = this.value.target;
|
|
2274
|
-
return;
|
|
2275
|
-
}
|
|
2276
|
-
const i = r * this.speed.spring.stiffness - this.speed.spring.damping * this.speed.current;
|
|
2277
|
-
if (this.speed.current += i * n, this.value.current += this.speed.current * n, this.value.current < this.value.min) {
|
|
2278
|
-
this.value.current = this.value.target, this.speed.current = 0;
|
|
2279
|
-
return;
|
|
2280
|
-
}
|
|
2281
|
-
if (this.value.current > this.value.max) {
|
|
2282
|
-
this.value.current = this.value.target, this.speed.current = 0;
|
|
2283
|
-
return;
|
|
2284
|
-
}
|
|
2285
|
-
} finally {
|
|
2286
|
-
if (this.animationCallback(this.value.current), this.value.current === this.value.target) {
|
|
2287
|
-
this.animating = !1;
|
|
2288
|
-
return;
|
|
2289
|
-
}
|
|
2290
|
-
window.requestAnimationFrame(this.animationFrame.bind(this));
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
target(e) {
|
|
2294
|
-
if (e === this.value.target) return;
|
|
2295
|
-
const n = Math.sqrt(2 * Math.abs(e - this.value.current) / this.speed.spring.stiffness);
|
|
2296
|
-
this.animationEnd = performance.now() + n, this.value.target = e, !this.animating && (this.animating = !0, this.animationTimestamp = performance.now(), window.requestAnimationFrame(this.animationFrame.bind(this)));
|
|
2297
|
-
}
|
|
2298
|
-
set(e) {
|
|
2299
|
-
e !== this.value.target && (this.animationEnd = performance.now(), this.value.current = e, this.value.target = e, this.speed.current = 0, window.requestAnimationFrame(this.animationCallback.bind(this, e)));
|
|
2300
|
-
}
|
|
2301
|
-
end() {
|
|
2302
|
-
this.set(this.value.target);
|
|
2303
|
-
}
|
|
2304
|
-
expired() {
|
|
2305
|
-
return performance.now() > this.animationEnd;
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
function Gt(t, e, n) {
|
|
2309
|
-
if (t <= 0 || e <= 0) return { x: 0, y: 0 };
|
|
2310
|
-
let r = t / 2, i = e / 2, s = Math.sqrt(r * r + i * i), a = Math.atan(i / r) * (180 / Math.PI), u = n * (Math.PI / 180);
|
|
2311
|
-
return n < 180 ? n < 90 ? n < a ? { x: 0, y: s * Math.sin(u) - i } : { x: s * Math.cos(u) - r, y: 0 } : n < 180 - a ? { x: s * Math.cos(u) - r, y: 0 } : { x: -t, y: s * Math.sin(u) - i } : n < 270 ? n < 180 + a ? { x: -t, y: s * Math.sin(u) - i } : { x: s * Math.cos(u) - r, y: -e } : n < 360 - a ? { x: s * Math.cos(u) - r, y: -e } : { x: 0, y: s * Math.sin(u) - i };
|
|
2312
|
-
}
|
|
2313
|
-
var Zs = /* @__PURE__ */ Ir('<div><div class="element pointer svelte-1no6o2a"></div> <div class="element bubble svelte-1no6o2a"><div class="element body svelte-1no6o2a"></div></div></div>');
|
|
2314
|
-
function Or(t, e) {
|
|
2315
|
-
en(e, !0);
|
|
2316
|
-
let n = H(() => e.id), r = H(() => e.element), i = H(() => e.style), s = H(() => e.dimensions), a = H(() => e.initialize), u = {
|
|
2317
|
-
setDisplayed: Kr,
|
|
2318
|
-
getDisplayed: Qr,
|
|
2319
|
-
setCollapsed: ei,
|
|
2320
|
-
getCollapsed: ti,
|
|
2321
|
-
getExpanded: ni,
|
|
2322
|
-
setAngle: ii
|
|
2323
|
-
};
|
|
2324
|
-
function o() {
|
|
2325
|
-
return u;
|
|
2326
|
-
}
|
|
2327
|
-
let l, c, h, f;
|
|
2328
|
-
const m = Math.min(4, 1 + 3 * (s.width * s.height) / 65536), d = i?.filter ?? Ai, v = s.width + 2 * s.padding, g = s.height + 2 * s.padding, P = s.padding, U = s.width, te = s.height, Ee = i?.radius ?? 0, ae = s.width, J = s.height, de = Math.min(i?.radius ?? Ti, Math.min(ae, J) / 2), me = Math.min(1, 2 * de / Math.min(J, ae)), X = i?.background ?? Tn, R = s.padding * 2, St = s.padding * 0.5 * me, Pt = i?.background ?? Tn, at = g < v ? g / v : 1, Tt = v < g ? v / g : 1, j = Math.min(v, g) / 2, ot = j * Math.SQRT2, b = 15, Gr = 15 * Math.SQRT2;
|
|
2329
|
-
let fn = !1, Re = /* @__PURE__ */ z(!1);
|
|
2330
|
-
function Kr(w) {
|
|
2331
|
-
w != M(Re) && (O(Re, w, !0), w == !0 && (r && r.parentElement != c && c.appendChild(r), fn == !1 && a && r && (fn = !0, setTimeout(async () => await a(n, r), 0))), w == !1 && (lt.end(), Ct.end(), zt.end()));
|
|
2332
|
-
}
|
|
2333
|
-
function Qr() {
|
|
2334
|
-
return M(Re);
|
|
2335
|
-
}
|
|
2336
|
-
let It = /* @__PURE__ */ z(!0);
|
|
2337
|
-
function ei(w) {
|
|
2338
|
-
w != M(It) && (O(It, w, !0), lt.target(M(It) ? 0 : 1));
|
|
2339
|
-
}
|
|
2340
|
-
function ti() {
|
|
2341
|
-
return M(Re) ? lt.expired() : !0;
|
|
2342
|
-
}
|
|
2343
|
-
function ni() {
|
|
2344
|
-
return M(Re) ? lt.expired() : !1;
|
|
2345
|
-
}
|
|
2346
|
-
let lt = new Dr({
|
|
2347
|
-
value: 0,
|
|
2348
|
-
min: 0,
|
|
2349
|
-
max: 1,
|
|
2350
|
-
timespan: Mi * Math.cbrt(m),
|
|
2351
|
-
easing: zr,
|
|
2352
|
-
callback: ri
|
|
2353
|
-
});
|
|
2354
|
-
function ri(w) {
|
|
2355
|
-
l.style.opacity = `${w}`, l.style.scale = `${w}`, c.style.opacity = `${w}`;
|
|
2356
|
-
}
|
|
2357
|
-
let ut = NaN, At = /* @__PURE__ */ z(!1), Nt = -v / 2, Ct = new jn({
|
|
2358
|
-
value: -v / 2,
|
|
2359
|
-
min: -v,
|
|
2360
|
-
max: 0,
|
|
2361
|
-
precision: 1,
|
|
2362
|
-
stiffness: En / m,
|
|
2363
|
-
callback: si
|
|
2364
|
-
}), Rt = -g / 2, zt = new jn({
|
|
2365
|
-
value: -g / 2,
|
|
2366
|
-
min: -g,
|
|
2367
|
-
max: 0,
|
|
2368
|
-
precision: 1,
|
|
2369
|
-
stiffness: En / m,
|
|
2370
|
-
callback: ai
|
|
2371
|
-
});
|
|
2372
|
-
function ii(w, ct) {
|
|
2373
|
-
if (Number.isNaN(w)) {
|
|
2374
|
-
ut = NaN, O(At, !1);
|
|
2375
|
-
return;
|
|
2376
|
-
}
|
|
2377
|
-
if (M(At) == !1 || ct == !0) {
|
|
2378
|
-
O(At, !0), ut = w;
|
|
2379
|
-
const xe = Gt(v, g, w);
|
|
2380
|
-
Ct.set(Math.round(xe.x)), zt.set(Math.round(xe.y));
|
|
2381
|
-
return;
|
|
2382
|
-
}
|
|
2383
|
-
if (ut != w) {
|
|
2384
|
-
ut = w;
|
|
2385
|
-
const xe = Gt(v, g, w);
|
|
2386
|
-
Ct.target(Math.round(xe.x)), zt.target(Math.round(xe.y));
|
|
2387
|
-
return;
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
function si(w) {
|
|
2391
|
-
Nt = w, pn(Nt, Rt);
|
|
2392
|
-
}
|
|
2393
|
-
function ai(w) {
|
|
2394
|
-
Rt = w, pn(Nt, Rt);
|
|
2395
|
-
}
|
|
2396
|
-
function pn(w, ct) {
|
|
2397
|
-
const xe = w + v / 2, li = ct + g / 2, ht = xe * at, ft = li * Tt, Lt = Math.sqrt(ht * ht + ft * ft), kn = (Lt - j) / (ot - j), ui = Math.atan2(ft, ht) / Math.PI * 180 - 45, yn = b + kn * (Gr - b), ci = Lt < j ? Lt / j : 1, bn = 0.5 * ((1 + 0.5 * me) * kn), hi = w + P * (1 - bn * (ht / j)), fi = ct + P * (1 - bn * (ft / j));
|
|
2398
|
-
f.style.transform = `scale(${ci}) rotate(${ui}deg) skew(${yn}deg, ${yn}deg)`, h.style.transform = `translate(${Math.round(hi)}px, ${Math.round(fi)}px)`;
|
|
2399
|
-
}
|
|
2400
|
-
var oi = { invoke: o }, qe = Zs();
|
|
2401
|
-
let dn;
|
|
2402
|
-
var Dt = zn(qe);
|
|
2403
|
-
let mn;
|
|
2404
|
-
Je(Dt, (w) => f = w, () => f);
|
|
2405
|
-
var Ot = vs(Dt, 2);
|
|
2406
|
-
let vn;
|
|
2407
|
-
var gn = zn(Ot);
|
|
2408
|
-
let wn;
|
|
2409
|
-
return Je(gn, (w) => c = w, () => c), Je(Ot, (w) => h = w, () => h), Je(qe, (w) => l = w, () => l), kr(() => {
|
|
2410
|
-
Rr(qe, 1, Cr(["element anchor", M(Re) && "displayed"]), "svelte-1no6o2a"), dn = Ye(qe, "", dn, { filter: d }), mn = Ye(Dt, "", mn, {
|
|
2411
|
-
width: `${R}px`,
|
|
2412
|
-
height: `${R}px`,
|
|
2413
|
-
"border-radius": `${St}px`,
|
|
2414
|
-
"background-color": `rgb(from ${Pt} r g b / 1)`
|
|
2415
|
-
}), vn = Ye(Ot, "", vn, {
|
|
2416
|
-
width: `${ae}px`,
|
|
2417
|
-
height: `${J}px`,
|
|
2418
|
-
"border-radius": `${de}px`,
|
|
2419
|
-
"background-color": `rgb(from ${X} r g b / 1)`
|
|
2420
|
-
}), wn = Ye(gn, "", wn, {
|
|
2421
|
-
width: `${U}px`,
|
|
2422
|
-
height: `${te}px`,
|
|
2423
|
-
"border-radius": `${Ee}px`
|
|
2424
|
-
});
|
|
2425
|
-
}), Ar(t, qe), tn(oi);
|
|
2426
|
-
}
|
|
2427
|
-
class Ys extends st {
|
|
2428
|
-
width;
|
|
2429
|
-
height;
|
|
2430
|
-
zoom;
|
|
2431
|
-
angle;
|
|
2432
|
-
directions;
|
|
2433
|
-
component;
|
|
2434
|
-
constructor(e, n, r, i, s, a) {
|
|
2435
|
-
super(n, r, i, s, new cn(e, r, i, s)), this.width = a.dimensions.width + a.dimensions.padding * 2, this.height = a.dimensions.height + a.dimensions.padding * 2, this.zoom = NaN, this.angle = NaN, this.directions = [], this.component = un(Or, {
|
|
2436
|
-
target: this.marker.div,
|
|
2437
|
-
props: a
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
get zIndex() {
|
|
2441
|
-
return Number.isNaN(this.zoom) ? this.rank : Math.round(-this.zoom * Xn) + xi;
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
class Js extends st {
|
|
2445
|
-
width;
|
|
2446
|
-
height;
|
|
2447
|
-
padding;
|
|
2448
|
-
angle;
|
|
2449
|
-
component;
|
|
2450
|
-
constructor(e, n, r, i, s, a) {
|
|
2451
|
-
super(n, r, i, s, new cn(e, r, i, xn)), this.width = a.dimensions.width, this.height = a.dimensions.height, this.padding = a.dimensions.padding, this.angle = NaN, this.shown = !1, this.component = un(Or, {
|
|
2452
|
-
target: this.marker.div,
|
|
2453
|
-
props: a
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
get zIndex() {
|
|
2457
|
-
return xn;
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2460
|
-
class Xs {
|
|
2461
|
-
id;
|
|
2462
|
-
state = void 0;
|
|
2463
|
-
pin;
|
|
2464
|
-
tooltip;
|
|
2465
|
-
popup;
|
|
2466
|
-
constructor(e, n) {
|
|
2467
|
-
const r = n.properites.id, i = n.properites.lat, s = n.properites.lng, a = n.properites.rank, u = n.properites.pin, o = n.properites.tooltip, l = n.properites.popup;
|
|
2468
|
-
this.id = r, this.pin = new qs(e, r, i, s, a, u), this.tooltip = new Ys(e, r, i, s, a, o), this.popup = l ? new Js(e, r, i, s, a, l) : void 0;
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
const Vt = 4;
|
|
2472
|
-
class Gs {
|
|
2473
|
-
// Elements
|
|
2474
|
-
pins = /* @__PURE__ */ new Set();
|
|
2475
|
-
// Configuration
|
|
2476
|
-
pinMaxWidth = 0;
|
|
2477
|
-
pinMaxHeight = 0;
|
|
2478
|
-
pinFade = !1;
|
|
2479
|
-
pinZoomMax = Vt;
|
|
2480
|
-
pinZoomDelta = Vt;
|
|
2481
|
-
set configuration(e) {
|
|
2482
|
-
this.pinFade = e?.pin?.fade ?? !0, this.pinZoomMax = e?.pin?.maxZoom ?? Vt, this.pinZoomDelta = this.pinZoomMax;
|
|
2483
|
-
}
|
|
2484
|
-
insert(e, n) {
|
|
2485
|
-
this.update(e, n), this.pins.add(e);
|
|
2486
|
-
}
|
|
2487
|
-
update(e, n) {
|
|
2488
|
-
e.zoom = n?.zoom ?? NaN, e.marker.update(e.zIndex);
|
|
2489
|
-
}
|
|
2490
|
-
remove(e) {
|
|
2491
|
-
e.shown = !0, e.zoom = NaN, e.component.invoke().setCollapsed(!1), e.component.invoke().setSuppressed(!0), e.component.invoke().setDisplayed(!1), e.marker.update(e.zIndex), e.marker.remove(), this.pins.delete(e);
|
|
2492
|
-
}
|
|
2493
|
-
clear() {
|
|
2494
|
-
this.pins.forEach((e) => e.marker.remove()), this.pins.clear();
|
|
2495
|
-
}
|
|
2496
|
-
refresh() {
|
|
2497
|
-
const e = Array.from(this.pins);
|
|
2498
|
-
this.pinMaxWidth = e.reduce((n, r) => Math.max(n, r.width), 0), this.pinMaxHeight = e.reduce((n, r) => Math.max(n, r.height), 0), this.pinZoomDelta = Math.max(1, this.pinZoomMax - Math.log10(e.length));
|
|
2499
|
-
}
|
|
2500
|
-
render(e, n) {
|
|
2501
|
-
const r = e.zoom, i = n.size, s = Qe.offset(e, i, {
|
|
2502
|
-
top: this.pinMaxHeight,
|
|
2503
|
-
bottom: this.pinMaxHeight,
|
|
2504
|
-
right: this.pinMaxWidth,
|
|
2505
|
-
left: this.pinMaxWidth
|
|
2506
|
-
});
|
|
2507
|
-
for (const a of this.pins)
|
|
2508
|
-
s.contains(a.lat, a.lng) ? Number.isNaN(a.zoom) ? (a.component.invoke().setDisplayed(!0), a.component.invoke().setSuppressed(!0), a.component.invoke().setCollapsed(!1), a.marker.insert()) : (a.component.invoke().setSuppressed(!1), a.shown && r < a.zoom && a.zoom < r + this.pinZoomDelta ? (a.component.invoke().setDisplayed(!0), a.component.invoke().setCollapsed(!1), a.component.invoke().setScale(this.pinFade ? Math.max(0, 1 - (a.zoom - r) * 0.2) : 1), a.marker.insert()) : (a.component.invoke().setCollapsed(!0), a.component.invoke().getCollapsed() && (a.component.invoke().setDisplayed(!1), a.marker.remove()))) : (a.component.invoke().setDisplayed(!1), a.marker.remove());
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
class Ks {
|
|
2512
|
-
// Elements
|
|
2513
|
-
tooltips = /* @__PURE__ */ new Set();
|
|
2514
|
-
// Configuration
|
|
2515
|
-
tooltipMaxWidth = 0;
|
|
2516
|
-
tooltipMaxHeight = 0;
|
|
2517
|
-
insert(e, n) {
|
|
2518
|
-
this.update(e, n), this.tooltips.add(e);
|
|
2519
|
-
}
|
|
2520
|
-
update(e, n) {
|
|
2521
|
-
n ? (e.zoom = n.zoom, e.directions = n.directions) : (e.zoom = NaN, e.directions = []), e.marker.update(e.zIndex);
|
|
2522
|
-
}
|
|
2523
|
-
remove(e) {
|
|
2524
|
-
e.shown = !0, e.zoom = NaN, e.angle = NaN, e.directions = [], e.component.invoke().setAngle(NaN), e.component.invoke().setCollapsed(!0), e.component.invoke().setDisplayed(!1), e.marker.update(e.zIndex), e.marker.remove(), this.tooltips.delete(e);
|
|
2525
|
-
}
|
|
2526
|
-
clear() {
|
|
2527
|
-
this.tooltips.forEach((e) => e.marker.remove()), this.tooltips.clear();
|
|
2528
|
-
}
|
|
2529
|
-
refresh() {
|
|
2530
|
-
const e = Array.from(this.tooltips);
|
|
2531
|
-
this.tooltipMaxWidth = e.reduce((n, r) => Math.max(n, r.width), 0), this.tooltipMaxHeight = e.reduce((n, r) => Math.max(n, r.height), 0);
|
|
2532
|
-
}
|
|
2533
|
-
render(e, n) {
|
|
2534
|
-
const r = e.zoom, i = n.size, s = Qe.offset(e, i, {
|
|
2535
|
-
top: this.tooltipMaxHeight,
|
|
2536
|
-
bottom: this.tooltipMaxHeight,
|
|
2537
|
-
right: this.tooltipMaxWidth,
|
|
2538
|
-
left: this.tooltipMaxWidth
|
|
2539
|
-
});
|
|
2540
|
-
for (const a of this.tooltips)
|
|
2541
|
-
if (s.contains(a.lat, a.lng))
|
|
2542
|
-
if (Number.isNaN(a.zoom) == !1 && a.shown && a.zoom <= r) {
|
|
2543
|
-
const u = a.directions.findLast((o) => o.zoom <= r)?.angle;
|
|
2544
|
-
if (u == null) throw new Error("Failed to find angle");
|
|
2545
|
-
a.angle = u, a.component.invoke().setDisplayed(!0), a.component.invoke().setCollapsed(!1), a.component.invoke().setAngle(u), a.marker.insert();
|
|
2546
|
-
} else
|
|
2547
|
-
a.component.invoke().setCollapsed(!0), a.component.invoke().getCollapsed() && (a.component.invoke().setDisplayed(!1), a.marker.remove());
|
|
2548
|
-
else
|
|
2549
|
-
a.component.invoke().setDisplayed(!1), a.marker.remove();
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
class Qs {
|
|
2553
|
-
// Elements
|
|
2554
|
-
popups = /* @__PURE__ */ new Set();
|
|
2555
|
-
// Configuration
|
|
2556
|
-
pan = !0;
|
|
2557
|
-
set configuration(e) {
|
|
2558
|
-
this.pan = e?.popup?.pan ?? !0;
|
|
2559
|
-
}
|
|
2560
|
-
insert(e) {
|
|
2561
|
-
this.popups.add(e);
|
|
2562
|
-
}
|
|
2563
|
-
remove(e) {
|
|
2564
|
-
e.angle = NaN, e.shown = !1, e.marker.remove(), e.component.invoke().setAngle(NaN), e.component.invoke().setCollapsed(!0), e.component.invoke().setDisplayed(!1), this.popups.delete(e);
|
|
2565
|
-
}
|
|
2566
|
-
clear() {
|
|
2567
|
-
this.popups.forEach((e) => e.marker.remove()), this.popups.clear();
|
|
2568
|
-
}
|
|
2569
|
-
show(e, n) {
|
|
2570
|
-
if (!e.popup || !e.tooltip || !e.pin || (e.pin.shown = !1, e.tooltip.shown = !1, e.popup.angle = e.tooltip.angle, e.popup.shown = !0, this.pan == !1)) return;
|
|
2571
|
-
const r = e.popup, i = n.getViewport(), s = i.bounds, a = i.zoom, o = n.getParameters().size * Math.pow(2, a), l = Xe(s.ne.lat, s.sw.lng, o), c = Xe(s.sw.lat, s.ne.lng, o), h = c.x - l.x, f = c.y - l.y, m = r.width + r.padding * 8, d = r.height + r.padding * 8, v = Xe(r.lat, r.lng, o), g = Gt(m, d, e.tooltip.angle), P = v.x + g.x, U = P + m, te = v.y + g.y, Ee = te + d, ae = P - l.x, J = c.x - U, de = te - l.y, me = c.y - Ee;
|
|
2572
|
-
let X = 0;
|
|
2573
|
-
h < m ? X = (ae - J) / 2 : (ae < 0 && (X = ae), J < 0 && (X = -J));
|
|
2574
|
-
let R = 0;
|
|
2575
|
-
f < d ? R = (de - me) / 2 : (de < 0 && (R = de), me < 0 && (R = -me)), (X != 0 || R != 0) && n.panBy(X, R);
|
|
2576
|
-
}
|
|
2577
|
-
hide(e) {
|
|
2578
|
-
!e.popup || !e.tooltip || !e.pin || (e.pin.shown = !0, e.tooltip.shown = !0, e.popup.shown = !1);
|
|
2579
|
-
}
|
|
2580
|
-
render() {
|
|
2581
|
-
for (const e of this.popups)
|
|
2582
|
-
e.shown ? (e.component.invoke().setDisplayed(!0), e.component.invoke().setCollapsed(!1), e.component.invoke().setAngle(e.angle, !0), e.marker.insert()) : (e.component.invoke().setCollapsed(!0), e.component.invoke().getCollapsed() && (e.component.invoke().setDisplayed(!1), e.marker.remove()));
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
|
-
class ea {
|
|
2586
|
-
provider;
|
|
2587
|
-
pinManager;
|
|
2588
|
-
tooltipManager;
|
|
2589
|
-
popupManager;
|
|
2590
|
-
elementsStore;
|
|
2591
|
-
constructor(e) {
|
|
2592
|
-
this.provider = e, this.pinManager = new Gs(), this.tooltipManager = new Ks(), this.popupManager = new Qs(), this.elementsStore = /* @__PURE__ */ new Map();
|
|
2593
|
-
}
|
|
2594
|
-
set configuration(e) {
|
|
2595
|
-
this.pinManager.configuration = e, this.popupManager.configuration = e;
|
|
2596
|
-
}
|
|
2597
|
-
//#region Elements
|
|
2598
|
-
clearElements() {
|
|
2599
|
-
this.elementsStore.clear(), this.pinManager.clear(), this.tooltipManager.clear(), this.popupManager.clear();
|
|
2600
|
-
}
|
|
2601
|
-
removeElements(e) {
|
|
2602
|
-
for (const n of e) {
|
|
2603
|
-
let r = this.elementsStore.get(n.properites.id);
|
|
2604
|
-
r != null && (this.pinManager.remove(r.pin), this.tooltipManager.remove(r.tooltip), r.popup != null && this.popupManager.remove(r.popup));
|
|
2605
|
-
}
|
|
2606
|
-
this.pinManager.refresh(), this.tooltipManager.refresh();
|
|
2607
|
-
}
|
|
2608
|
-
updateElements(e) {
|
|
2609
|
-
for (const n of e) {
|
|
2610
|
-
let r = this.elementsStore.get(n.properites.id);
|
|
2611
|
-
r != null && (this.pinManager.update(r.pin, n.state), this.tooltipManager.update(r.tooltip, n.state));
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
insertElements(e, n) {
|
|
2615
|
-
for (const r of e) {
|
|
2616
|
-
let i = this.elementsStore.get(r.properites.id);
|
|
2617
|
-
i == null && (i = new Xs(this.provider, r), i.tooltip.marker.div.addEventListener("click", (s) => n(s, r.properites.id)), this.elementsStore.set(r.properites.id, i)), this.pinManager.insert(i.pin, r.state), this.tooltipManager.insert(i.tooltip, r.state), i.popup != null && this.popupManager.insert(i.popup);
|
|
2618
|
-
}
|
|
2619
|
-
this.pinManager.refresh(), this.tooltipManager.refresh();
|
|
2620
|
-
}
|
|
2621
|
-
renderElements(e, n) {
|
|
2622
|
-
this.popupManager.render(), this.tooltipManager.render(e, n), this.pinManager.render(e, n);
|
|
2623
|
-
}
|
|
2624
|
-
//#endregion
|
|
2625
|
-
//#region Popups
|
|
2626
|
-
showPopup(e) {
|
|
2627
|
-
const n = this.elementsStore.values();
|
|
2628
|
-
for (const r of n)
|
|
2629
|
-
r.id == e ? this.popupManager.show(r, this.provider) : this.popupManager.hide(r);
|
|
2630
|
-
}
|
|
2631
|
-
hidePopup(e) {
|
|
2632
|
-
const n = this.elementsStore.get(e);
|
|
2633
|
-
n != null && this.popupManager.hide(n);
|
|
2634
|
-
}
|
|
2635
|
-
hidePopups() {
|
|
2636
|
-
const e = this.elementsStore.values();
|
|
2637
|
-
for (const n of e)
|
|
2638
|
-
this.popupManager.hide(n);
|
|
2639
|
-
}
|
|
2640
|
-
//#endregion
|
|
2641
|
-
}
|
|
2642
|
-
const Lr = '(function(){"use strict";class h{methods;constructor(t){this.methods=t}listen(){self.onmessage=this.onmessage.bind(this)}async onmessage(t){const{id:n,method:o,args:s}=t.data;try{const r=this.methods[o];if(typeof r!="function")throw new Error(`Unknown method: ${o}`);const a=await r(...s),c={id:n,result:a};self.postMessage(c)}catch(r){const a=r instanceof Error?r.message:String(r),c={id:n,error:a};self.postMessage(c)}}}var l=e=>new Promise(t=>setTimeout(t,e));async function f(e,t){let n=0,o=Math.max(1,t?.retry?.times??1);for(;n<o;)try{return{data:await e(),error:null}}catch(s){if(n++,n==o){if(s instanceof Error)return(!t?.exceptions||t.exceptions.some(r=>s instanceof r)==!1)&&t?.catch?.(s),{data:null,error:s};throw t?.catch?.(s),s}else t?.retry?.delay&&await l(t.retry.delay)}throw Error("Unreachable code")}async function m(e,t,n,o,s){let r=await f(async()=>await fetch(e,{...n,method:"POST",body:t?JSON.stringify(t):void 0}),{retry:{times:o,delay:s}});if(r.error)throw r.error;let a=r.data;if(!a.ok)throw Error(await a.text());return await a.json()}var d=[0,30,60,90,120,150,180,210,240,270,300,330],u=",";function i(e,t){return parseFloat(e[t]+e[t+1]+"."+e[t+2])}function w(e,t){return d[parseInt(e[t],16)]}function y(e){if(!e||e.length===0)return[];let t=[],n=e.split(u);for(let o=0;o<n.length;o++){let s=n[o],r=i(s,0),a=[];for(let c=3;c<s.length;c+=4){let v=i(s,c),T=w(s,c+3);a.push({zoom:v,angle:T})}t.push({zoom:r,directions:a})}return t}const p="https://maps.api.arenarium.dev/states",E=3,S=500,k={async fetch(e){const n={headers:{"Cache-Control":self?.location.host.startsWith("localhost")||self?.location.host.startsWith("127.0.0.1")?"no-cache":""}},o=await m(p,e,n,E,S),s=y(o.states),r=o.jwt;return{states:s,jwt:r}}};new h(k).listen()})();\n', Wn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Lr], { type: "text/javascript;charset=utf-8" });
|
|
2643
|
-
function ta(t) {
|
|
2644
|
-
let e;
|
|
2645
|
-
try {
|
|
2646
|
-
if (e = Wn && (self.URL || self.webkitURL).createObjectURL(Wn), !e) throw "";
|
|
2647
|
-
const n = new Worker(e, {
|
|
2648
|
-
name: t?.name
|
|
2649
|
-
});
|
|
2650
|
-
return n.addEventListener("error", () => {
|
|
2651
|
-
(self.URL || self.webkitURL).revokeObjectURL(e);
|
|
2652
|
-
}), n;
|
|
2653
|
-
} catch {
|
|
2654
|
-
return new Worker(
|
|
2655
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(Lr),
|
|
2656
|
-
{
|
|
2657
|
-
name: t?.name
|
|
2658
|
-
}
|
|
2659
|
-
);
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
var na = (t) => new Promise((e) => setTimeout(e, t));
|
|
2663
|
-
async function Fr(t, e) {
|
|
2664
|
-
let n = 0, r = Math.max(1, e?.retry?.times ?? 1);
|
|
2665
|
-
for (; n < r; ) try {
|
|
2666
|
-
return { data: await t(), error: null };
|
|
2667
|
-
} catch (i) {
|
|
2668
|
-
if (n++, n == r) {
|
|
2669
|
-
if (i instanceof Error)
|
|
2670
|
-
return (!e?.exceptions || e.exceptions.some((s) => i instanceof s) == !1) && e?.catch?.(i), { data: null, error: i };
|
|
2671
|
-
throw e?.catch?.(i), i;
|
|
2672
|
-
} else e?.retry?.delay && await na(e.retry.delay);
|
|
2673
|
-
}
|
|
2674
|
-
throw Error("Unreachable code");
|
|
2675
|
-
}
|
|
2676
|
-
async function ra(t, e, n, r, i) {
|
|
2677
|
-
let s = await Fr(async () => await fetch(t, { ...n, method: "POST", body: e ? JSON.stringify(e) : void 0 }), { retry: { times: r, delay: i } });
|
|
2678
|
-
if (s.error) throw s.error;
|
|
2679
|
-
let a = s.data;
|
|
2680
|
-
if (!a.ok) throw Error(await a.text());
|
|
2681
|
-
return await a.json();
|
|
2682
|
-
}
|
|
2683
|
-
async function ia(t, e, n, r, i) {
|
|
2684
|
-
let s = await Fr(async () => await fetch(t, { ...n, method: "PUT", body: e ? JSON.stringify(e) : void 0 }), { retry: { times: r, delay: i } });
|
|
2685
|
-
if (s.error) throw s.error;
|
|
2686
|
-
let a = s.data;
|
|
2687
|
-
if (!a.ok) throw Error(await a.text());
|
|
2688
|
-
}
|
|
2689
|
-
const Le = 0xc3a5c85c97cb3127n, ne = 0xb492b66fbe98f273n, Fe = 0x9ae16a3b2f90404fn, $r = 0xc949d7c7509e6557n, L = 0xffffffffffffffffn;
|
|
2690
|
-
function p(t) {
|
|
2691
|
-
return t & L;
|
|
2692
|
-
}
|
|
2693
|
-
function T(t, e) {
|
|
2694
|
-
return e === 0 ? t & L : (t = t & L, (t >> BigInt(e) | t << BigInt(64 - e)) & L);
|
|
2695
|
-
}
|
|
2696
|
-
function sa(t, e) {
|
|
2697
|
-
return t = t & L, (t >> BigInt(e) | t << BigInt(64 - e)) & L;
|
|
2698
|
-
}
|
|
2699
|
-
function tt(t) {
|
|
2700
|
-
return p(t ^ t >> 47n);
|
|
2701
|
-
}
|
|
2702
|
-
function _(t, e = 0) {
|
|
2703
|
-
let n = 0n;
|
|
2704
|
-
for (let r = 0; r < 8; r++)
|
|
2705
|
-
e + r < t.length && (n |= BigInt(t[e + r]) << BigInt(r * 8));
|
|
2706
|
-
return n & L;
|
|
2707
|
-
}
|
|
2708
|
-
function Bn(t, e = 0) {
|
|
2709
|
-
let n = 0n;
|
|
2710
|
-
for (let r = 0; r < 4; r++)
|
|
2711
|
-
e + r < t.length && (n |= BigInt(t[e + r]) << BigInt(r * 8));
|
|
2712
|
-
return n & 0xffffffffn;
|
|
2713
|
-
}
|
|
2714
|
-
function aa(t) {
|
|
2715
|
-
const e = 0x9ddfea08eb382d69n;
|
|
2716
|
-
let n = (t.first ^ t.second) * e & L;
|
|
2717
|
-
n ^= n >> 47n, n = n & L;
|
|
2718
|
-
let r = (t.second ^ n) * e & L;
|
|
2719
|
-
return r ^= r >> 47n, r = r * e & L, r;
|
|
2720
|
-
}
|
|
2721
|
-
function $e(t, e) {
|
|
2722
|
-
return aa({ first: t, second: e });
|
|
2723
|
-
}
|
|
2724
|
-
function oa(t) {
|
|
2725
|
-
const e = t.length;
|
|
2726
|
-
if (e > 8) {
|
|
2727
|
-
const n = _(t), r = _(t, e - 8);
|
|
2728
|
-
return ($e(n, sa(r + BigInt(e) & L, e)) ^ r) & L;
|
|
2729
|
-
}
|
|
2730
|
-
if (e >= 4) {
|
|
2731
|
-
const n = Bn(t);
|
|
2732
|
-
return $e(BigInt(e) + (n << 3n) & L, Bn(t, e - 4));
|
|
2733
|
-
}
|
|
2734
|
-
if (e > 0) {
|
|
2735
|
-
const n = BigInt(t[0]), r = BigInt(t[e >> 1]), i = BigInt(t[e - 1]), s = p(n + (r << 8n)), a = p(BigInt(e) + (i << 2n));
|
|
2736
|
-
return p(tt(p(s * Fe) ^ p(a * $r)) * Fe);
|
|
2737
|
-
}
|
|
2738
|
-
return Fe;
|
|
2739
|
-
}
|
|
2740
|
-
function la(t) {
|
|
2741
|
-
const e = t.length, n = p(_(t) * ne), r = _(t, 8), i = p(_(t, e - 8) * Fe), s = p(_(t, e - 16) * Le);
|
|
2742
|
-
return $e(p(T(p(n - r), 43) + T(i, 30) + s), p(n + T(r ^ $r, 20) - i + BigInt(e)));
|
|
2743
|
-
}
|
|
2744
|
-
function ua(t, e, n, r, i, s) {
|
|
2745
|
-
i = p(i + t), s = T(p(s + i + r), 21);
|
|
2746
|
-
const a = i;
|
|
2747
|
-
return i = p(i + e), i = p(i + n), s = p(s + T(i, 44)), { first: p(i + r), second: p(s + a) };
|
|
2748
|
-
}
|
|
2749
|
-
function gt(t, e, n, r) {
|
|
2750
|
-
return ua(_(t, e), _(t, e + 8), _(t, e + 16), _(t, e + 24), n, r);
|
|
2751
|
-
}
|
|
2752
|
-
function ca(t) {
|
|
2753
|
-
const e = t.length, n = _(t, 24);
|
|
2754
|
-
let r = p(_(t) + p((BigInt(e) + _(t, e - 16)) * Le)), i = T(p(r + n), 52), s = T(r, 37);
|
|
2755
|
-
r = p(r + _(t, 8)), s = p(s + T(r, 7)), r = p(r + _(t, 16));
|
|
2756
|
-
const a = p(r + n), u = p(i + T(r, 31) + s);
|
|
2757
|
-
r = p(_(t, 16) + _(t, e - 32));
|
|
2758
|
-
const o = _(t, e - 8);
|
|
2759
|
-
i = T(p(r + o), 52), s = T(r, 37), r = p(r + _(t, e - 24)), s = p(s + T(r, 7)), r = p(r + _(t, e - 16));
|
|
2760
|
-
const l = p(r + o), c = p(i + T(r, 31) + s), h = tt(p(p(a + c) * Fe + p(l + u) * Le));
|
|
2761
|
-
return p(tt(p(h * Le + u)) * Fe);
|
|
2762
|
-
}
|
|
2763
|
-
function ha(t) {
|
|
2764
|
-
let e;
|
|
2765
|
-
typeof t == "string" ? e = new TextEncoder().encode(t) : e = t;
|
|
2766
|
-
const n = e.length;
|
|
2767
|
-
if (n <= 32)
|
|
2768
|
-
return n <= 16 ? oa(e) : la(e);
|
|
2769
|
-
if (n <= 64)
|
|
2770
|
-
return ca(e);
|
|
2771
|
-
let r = _(e), i = p(_(e, n - 16) ^ ne), s = p(_(e, n - 56) ^ Le), a = gt(e, n - 64, BigInt(n), i), u = gt(e, n - 32, p(BigInt(n) * ne), Le);
|
|
2772
|
-
s = p(s + tt(a.second) * ne), r = p(T(p(s + r), 39) * ne), i = p(T(i, 33) * ne);
|
|
2773
|
-
let o = n - 1 & -64, l = 0;
|
|
2774
|
-
for (; o > 0; )
|
|
2775
|
-
r = p(T(p(r + i + a.first + _(e, l + 16)), 37) * ne), i = p(T(p(i + a.second + _(e, l + 48)), 42) * ne), r ^= u.second, i ^= a.first, s = T(s ^ u.first, 33), a = gt(e, l, p(a.second * ne), p(r + u.first)), u = gt(e, l + 32, p(s + u.second), i), [s, r] = [r, s], l += 64, o -= 64;
|
|
2776
|
-
return $e($e(a.first, u.first) + p(tt(i) * ne) + s, $e(a.second, u.second) + r);
|
|
2777
|
-
}
|
|
2778
|
-
function fa(t) {
|
|
2779
|
-
return ha(JSON.stringify(t)).toString();
|
|
2780
|
-
}
|
|
2781
|
-
var pa = (t) => 9;
|
|
2782
|
-
let Ut;
|
|
2783
|
-
// @__NO_SIDE_EFFECTS__
|
|
2784
|
-
function Vr(t) {
|
|
2785
|
-
return {
|
|
2786
|
-
lang: Ut?.lang,
|
|
2787
|
-
message: t?.message,
|
|
2788
|
-
abortEarly: Ut?.abortEarly,
|
|
2789
|
-
abortPipeEarly: Ut?.abortPipeEarly
|
|
2790
|
-
};
|
|
2791
|
-
}
|
|
2792
|
-
let da;
|
|
2793
|
-
// @__NO_SIDE_EFFECTS__
|
|
2794
|
-
function ma(t) {
|
|
2795
|
-
return da?.get(t);
|
|
2796
|
-
}
|
|
2797
|
-
let va;
|
|
2798
|
-
// @__NO_SIDE_EFFECTS__
|
|
2799
|
-
function ga(t) {
|
|
2800
|
-
return va?.get(t);
|
|
2801
|
-
}
|
|
2802
|
-
let wa;
|
|
2803
|
-
// @__NO_SIDE_EFFECTS__
|
|
2804
|
-
function ka(t, e) {
|
|
2805
|
-
return wa?.get(t)?.get(e);
|
|
2806
|
-
}
|
|
2807
|
-
// @__NO_SIDE_EFFECTS__
|
|
2808
|
-
function nt(t) {
|
|
2809
|
-
const e = typeof t;
|
|
2810
|
-
return e === "string" ? `"${t}"` : e === "number" || e === "bigint" || e === "boolean" ? `${t}` : e === "object" || e === "function" ? (t && Object.getPrototypeOf(t)?.constructor?.name) ?? "null" : e;
|
|
2811
|
-
}
|
|
2812
|
-
function V(t, e, n, r, i) {
|
|
2813
|
-
const s = i && "input" in i ? i.input : n.value, a = i?.expected ?? t.expects ?? null, u = i?.received ?? /* @__PURE__ */ nt(s), o = {
|
|
2814
|
-
kind: t.kind,
|
|
2815
|
-
type: t.type,
|
|
2816
|
-
input: s,
|
|
2817
|
-
expected: a,
|
|
2818
|
-
received: u,
|
|
2819
|
-
message: `Invalid ${e}: ${a ? `Expected ${a} but r` : "R"}eceived ${u}`,
|
|
2820
|
-
requirement: t.requirement,
|
|
2821
|
-
path: i?.path,
|
|
2822
|
-
issues: i?.issues,
|
|
2823
|
-
lang: r.lang,
|
|
2824
|
-
abortEarly: r.abortEarly,
|
|
2825
|
-
abortPipeEarly: r.abortPipeEarly
|
|
2826
|
-
}, l = t.kind === "schema", c = i?.message ?? t.message ?? /* @__PURE__ */ ka(t.reference, o.lang) ?? (l ? /* @__PURE__ */ ga(o.lang) : null) ?? r.message ?? /* @__PURE__ */ ma(o.lang);
|
|
2827
|
-
c !== void 0 && (o.message = typeof c == "function" ? c(o) : c), l && (n.typed = !1), n.issues ? n.issues.push(o) : n.issues = [o];
|
|
2828
|
-
}
|
|
2829
|
-
// @__NO_SIDE_EFFECTS__
|
|
2830
|
-
function pe(t) {
|
|
2831
|
-
return {
|
|
2832
|
-
version: 1,
|
|
2833
|
-
vendor: "valibot",
|
|
2834
|
-
validate(e) {
|
|
2835
|
-
return t["~run"]({ value: e }, /* @__PURE__ */ Vr());
|
|
2836
|
-
}
|
|
2837
|
-
};
|
|
2838
|
-
}
|
|
2839
|
-
var Ur = class extends Error {
|
|
2840
|
-
/**
|
|
2841
|
-
* Creates a Valibot error with useful information.
|
|
2842
|
-
*
|
|
2843
|
-
* @param issues The error issues.
|
|
2844
|
-
*/
|
|
2845
|
-
constructor(t) {
|
|
2846
|
-
super(t[0].message), this.name = "ValiError", this.issues = t;
|
|
2847
|
-
}
|
|
2848
|
-
};
|
|
2849
|
-
// @__NO_SIDE_EFFECTS__
|
|
2850
|
-
function jr(t) {
|
|
2851
|
-
return {
|
|
2852
|
-
kind: "transformation",
|
|
2853
|
-
type: "args",
|
|
2854
|
-
reference: jr,
|
|
2855
|
-
async: !1,
|
|
2856
|
-
schema: t,
|
|
2857
|
-
"~run"(e, n) {
|
|
2858
|
-
const r = e.value;
|
|
2859
|
-
return e.value = (...i) => {
|
|
2860
|
-
const s = this.schema["~run"]({ value: i }, n);
|
|
2861
|
-
if (s.issues) throw new Ur(s.issues);
|
|
2862
|
-
return r(...s.value);
|
|
2863
|
-
}, e;
|
|
2864
|
-
}
|
|
2865
|
-
};
|
|
2866
|
-
}
|
|
2867
|
-
// @__NO_SIDE_EFFECTS__
|
|
2868
|
-
function Wr(t, e) {
|
|
2869
|
-
return {
|
|
2870
|
-
kind: "validation",
|
|
2871
|
-
type: "check",
|
|
2872
|
-
reference: Wr,
|
|
2873
|
-
async: !1,
|
|
2874
|
-
expects: null,
|
|
2875
|
-
requirement: t,
|
|
2876
|
-
message: e,
|
|
2877
|
-
"~run"(n, r) {
|
|
2878
|
-
return n.typed && !this.requirement(n.value) && V(this, "input", n, r), n;
|
|
2879
|
-
}
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2882
|
-
// @__NO_SIDE_EFFECTS__
|
|
2883
|
-
function Br(t, e) {
|
|
2884
|
-
return {
|
|
2885
|
-
kind: "validation",
|
|
2886
|
-
type: "length",
|
|
2887
|
-
reference: Br,
|
|
2888
|
-
async: !1,
|
|
2889
|
-
expects: `${t}`,
|
|
2890
|
-
requirement: t,
|
|
2891
|
-
message: e,
|
|
2892
|
-
"~run"(n, r) {
|
|
2893
|
-
return n.typed && n.value.length !== this.requirement && V(this, "length", n, r, { received: `${n.value.length}` }), n;
|
|
2894
|
-
}
|
|
2895
|
-
};
|
|
2896
|
-
}
|
|
2897
|
-
// @__NO_SIDE_EFFECTS__
|
|
2898
|
-
function Kt(t, e) {
|
|
2899
|
-
return {
|
|
2900
|
-
kind: "validation",
|
|
2901
|
-
type: "max_value",
|
|
2902
|
-
reference: Kt,
|
|
2903
|
-
async: !1,
|
|
2904
|
-
expects: `<=${t instanceof Date ? t.toJSON() : /* @__PURE__ */ nt(t)}`,
|
|
2905
|
-
requirement: t,
|
|
2906
|
-
message: e,
|
|
2907
|
-
"~run"(n, r) {
|
|
2908
|
-
return n.typed && !(n.value <= this.requirement) && V(this, "value", n, r, { received: n.value instanceof Date ? n.value.toJSON() : /* @__PURE__ */ nt(n.value) }), n;
|
|
2909
|
-
}
|
|
2910
|
-
};
|
|
2911
|
-
}
|
|
2912
|
-
// @__NO_SIDE_EFFECTS__
|
|
2913
|
-
function hn(t, e) {
|
|
2914
|
-
return {
|
|
2915
|
-
kind: "validation",
|
|
2916
|
-
type: "min_length",
|
|
2917
|
-
reference: hn,
|
|
2918
|
-
async: !1,
|
|
2919
|
-
expects: `>=${t}`,
|
|
2920
|
-
requirement: t,
|
|
2921
|
-
message: e,
|
|
2922
|
-
"~run"(n, r) {
|
|
2923
|
-
return n.typed && n.value.length < this.requirement && V(this, "length", n, r, { received: `${n.value.length}` }), n;
|
|
2924
|
-
}
|
|
2925
|
-
};
|
|
2926
|
-
}
|
|
2927
|
-
// @__NO_SIDE_EFFECTS__
|
|
2928
|
-
function le(t, e) {
|
|
2929
|
-
return {
|
|
2930
|
-
kind: "validation",
|
|
2931
|
-
type: "min_value",
|
|
2932
|
-
reference: le,
|
|
2933
|
-
async: !1,
|
|
2934
|
-
expects: `>=${t instanceof Date ? t.toJSON() : /* @__PURE__ */ nt(t)}`,
|
|
2935
|
-
requirement: t,
|
|
2936
|
-
message: e,
|
|
2937
|
-
"~run"(n, r) {
|
|
2938
|
-
return n.typed && !(n.value >= this.requirement) && V(this, "value", n, r, { received: n.value instanceof Date ? n.value.toJSON() : /* @__PURE__ */ nt(n.value) }), n;
|
|
2939
|
-
}
|
|
2940
|
-
};
|
|
2941
|
-
}
|
|
2942
|
-
// @__NO_SIDE_EFFECTS__
|
|
2943
|
-
function ya(t, e, n) {
|
|
2944
|
-
return typeof t.fallback == "function" ? t.fallback(e, n) : t.fallback;
|
|
2945
|
-
}
|
|
2946
|
-
// @__NO_SIDE_EFFECTS__
|
|
2947
|
-
function Hr(t, e, n) {
|
|
2948
|
-
return typeof t.default == "function" ? t.default(e, n) : t.default;
|
|
2949
|
-
}
|
|
2950
|
-
// @__NO_SIDE_EFFECTS__
|
|
2951
|
-
function qr(t, e) {
|
|
2952
|
-
return {
|
|
2953
|
-
kind: "schema",
|
|
2954
|
-
type: "array",
|
|
2955
|
-
reference: qr,
|
|
2956
|
-
expects: "Array",
|
|
2957
|
-
async: !1,
|
|
2958
|
-
item: t,
|
|
2959
|
-
message: e,
|
|
2960
|
-
get "~standard"() {
|
|
2961
|
-
return /* @__PURE__ */ pe(this);
|
|
2962
|
-
},
|
|
2963
|
-
"~run"(n, r) {
|
|
2964
|
-
const i = n.value;
|
|
2965
|
-
if (Array.isArray(i)) {
|
|
2966
|
-
n.typed = !0, n.value = [];
|
|
2967
|
-
for (let s = 0; s < i.length; s++) {
|
|
2968
|
-
const a = i[s], u = this.item["~run"]({ value: a }, r);
|
|
2969
|
-
if (u.issues) {
|
|
2970
|
-
const o = {
|
|
2971
|
-
type: "array",
|
|
2972
|
-
origin: "value",
|
|
2973
|
-
input: i,
|
|
2974
|
-
key: s,
|
|
2975
|
-
value: a
|
|
2976
|
-
};
|
|
2977
|
-
for (const l of u.issues)
|
|
2978
|
-
l.path ? l.path.unshift(o) : l.path = [o], n.issues?.push(l);
|
|
2979
|
-
if (n.issues || (n.issues = u.issues), r.abortEarly) {
|
|
2980
|
-
n.typed = !1;
|
|
2981
|
-
break;
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
u.typed || (n.typed = !1), n.value.push(u.value);
|
|
2985
|
-
}
|
|
2986
|
-
} else V(this, "type", n, r);
|
|
2987
|
-
return n;
|
|
2988
|
-
}
|
|
2989
|
-
};
|
|
2990
|
-
}
|
|
2991
|
-
// @__NO_SIDE_EFFECTS__
|
|
2992
|
-
function Zr(t, e) {
|
|
2993
|
-
return {
|
|
2994
|
-
kind: "schema",
|
|
2995
|
-
type: "custom",
|
|
2996
|
-
reference: Zr,
|
|
2997
|
-
expects: "unknown",
|
|
2998
|
-
async: !1,
|
|
2999
|
-
check: t,
|
|
3000
|
-
message: e,
|
|
3001
|
-
get "~standard"() {
|
|
3002
|
-
return /* @__PURE__ */ pe(this);
|
|
3003
|
-
},
|
|
3004
|
-
"~run"(n, r) {
|
|
3005
|
-
return this.check(n.value) ? n.typed = !0 : V(this, "type", n, r), n;
|
|
3006
|
-
}
|
|
3007
|
-
};
|
|
3008
|
-
}
|
|
3009
|
-
// @__NO_SIDE_EFFECTS__
|
|
3010
|
-
function Yr(t) {
|
|
3011
|
-
return {
|
|
3012
|
-
kind: "schema",
|
|
3013
|
-
type: "function",
|
|
3014
|
-
reference: Yr,
|
|
3015
|
-
expects: "Function",
|
|
3016
|
-
async: !1,
|
|
3017
|
-
message: t,
|
|
3018
|
-
get "~standard"() {
|
|
3019
|
-
return /* @__PURE__ */ pe(this);
|
|
3020
|
-
},
|
|
3021
|
-
"~run"(e, n) {
|
|
3022
|
-
return typeof e.value == "function" ? e.typed = !0 : V(this, "type", e, n), e;
|
|
3023
|
-
}
|
|
3024
|
-
};
|
|
3025
|
-
}
|
|
3026
|
-
// @__NO_SIDE_EFFECTS__
|
|
3027
|
-
function ue(t) {
|
|
3028
|
-
return {
|
|
3029
|
-
kind: "schema",
|
|
3030
|
-
type: "number",
|
|
3031
|
-
reference: ue,
|
|
3032
|
-
expects: "number",
|
|
3033
|
-
async: !1,
|
|
3034
|
-
message: t,
|
|
3035
|
-
get "~standard"() {
|
|
3036
|
-
return /* @__PURE__ */ pe(this);
|
|
3037
|
-
},
|
|
3038
|
-
"~run"(e, n) {
|
|
3039
|
-
return typeof e.value == "number" && !isNaN(e.value) ? e.typed = !0 : V(this, "type", e, n), e;
|
|
3040
|
-
}
|
|
3041
|
-
};
|
|
3042
|
-
}
|
|
3043
|
-
// @__NO_SIDE_EFFECTS__
|
|
3044
|
-
function ge(t, e) {
|
|
3045
|
-
return {
|
|
3046
|
-
kind: "schema",
|
|
3047
|
-
type: "object",
|
|
3048
|
-
reference: ge,
|
|
3049
|
-
expects: "Object",
|
|
3050
|
-
async: !1,
|
|
3051
|
-
entries: t,
|
|
3052
|
-
message: e,
|
|
3053
|
-
get "~standard"() {
|
|
3054
|
-
return /* @__PURE__ */ pe(this);
|
|
3055
|
-
},
|
|
3056
|
-
"~run"(n, r) {
|
|
3057
|
-
const i = n.value;
|
|
3058
|
-
if (i && typeof i == "object") {
|
|
3059
|
-
n.typed = !0, n.value = {};
|
|
3060
|
-
for (const s in this.entries) {
|
|
3061
|
-
const a = this.entries[s];
|
|
3062
|
-
if (s in i || (a.type === "exact_optional" || a.type === "optional" || a.type === "nullish") && a.default !== void 0) {
|
|
3063
|
-
const u = s in i ? i[s] : /* @__PURE__ */ Hr(a), o = a["~run"]({ value: u }, r);
|
|
3064
|
-
if (o.issues) {
|
|
3065
|
-
const l = {
|
|
3066
|
-
type: "object",
|
|
3067
|
-
origin: "value",
|
|
3068
|
-
input: i,
|
|
3069
|
-
key: s,
|
|
3070
|
-
value: u
|
|
3071
|
-
};
|
|
3072
|
-
for (const c of o.issues)
|
|
3073
|
-
c.path ? c.path.unshift(l) : c.path = [l], n.issues?.push(c);
|
|
3074
|
-
if (n.issues || (n.issues = o.issues), r.abortEarly) {
|
|
3075
|
-
n.typed = !1;
|
|
3076
|
-
break;
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
o.typed || (n.typed = !1), n.value[s] = o.value;
|
|
3080
|
-
} else if (a.fallback !== void 0) n.value[s] = /* @__PURE__ */ ya(a);
|
|
3081
|
-
else if (a.type !== "exact_optional" && a.type !== "optional" && a.type !== "nullish" && (V(this, "key", n, r, {
|
|
3082
|
-
input: void 0,
|
|
3083
|
-
expected: `"${s}"`,
|
|
3084
|
-
path: [{
|
|
3085
|
-
type: "object",
|
|
3086
|
-
origin: "key",
|
|
3087
|
-
input: i,
|
|
3088
|
-
key: s,
|
|
3089
|
-
value: i[s]
|
|
3090
|
-
}]
|
|
3091
|
-
}), r.abortEarly))
|
|
3092
|
-
break;
|
|
3093
|
-
}
|
|
3094
|
-
} else V(this, "type", n, r);
|
|
3095
|
-
return n;
|
|
3096
|
-
}
|
|
3097
|
-
};
|
|
3098
|
-
}
|
|
3099
|
-
// @__NO_SIDE_EFFECTS__
|
|
3100
|
-
function S(t, e) {
|
|
3101
|
-
return {
|
|
3102
|
-
kind: "schema",
|
|
3103
|
-
type: "optional",
|
|
3104
|
-
reference: S,
|
|
3105
|
-
expects: `(${t.expects} | undefined)`,
|
|
3106
|
-
async: !1,
|
|
3107
|
-
wrapped: t,
|
|
3108
|
-
default: e,
|
|
3109
|
-
get "~standard"() {
|
|
3110
|
-
return /* @__PURE__ */ pe(this);
|
|
3111
|
-
},
|
|
3112
|
-
"~run"(n, r) {
|
|
3113
|
-
return n.value === void 0 && (this.default !== void 0 && (n.value = /* @__PURE__ */ Hr(this, n, r)), n.value === void 0) ? (n.typed = !0, n) : this.wrapped["~run"](n, r);
|
|
3114
|
-
}
|
|
3115
|
-
};
|
|
3116
|
-
}
|
|
3117
|
-
// @__NO_SIDE_EFFECTS__
|
|
3118
|
-
function ce(t) {
|
|
3119
|
-
return {
|
|
3120
|
-
kind: "schema",
|
|
3121
|
-
type: "string",
|
|
3122
|
-
reference: ce,
|
|
3123
|
-
expects: "string",
|
|
3124
|
-
async: !1,
|
|
3125
|
-
message: t,
|
|
3126
|
-
get "~standard"() {
|
|
3127
|
-
return /* @__PURE__ */ pe(this);
|
|
3128
|
-
},
|
|
3129
|
-
"~run"(e, n) {
|
|
3130
|
-
return typeof e.value == "string" ? e.typed = !0 : V(this, "type", e, n), e;
|
|
3131
|
-
}
|
|
3132
|
-
};
|
|
3133
|
-
}
|
|
3134
|
-
// @__NO_SIDE_EFFECTS__
|
|
3135
|
-
function Jr(t, e) {
|
|
3136
|
-
return {
|
|
3137
|
-
kind: "schema",
|
|
3138
|
-
type: "tuple",
|
|
3139
|
-
reference: Jr,
|
|
3140
|
-
expects: "Array",
|
|
3141
|
-
async: !1,
|
|
3142
|
-
items: t,
|
|
3143
|
-
message: e,
|
|
3144
|
-
get "~standard"() {
|
|
3145
|
-
return /* @__PURE__ */ pe(this);
|
|
3146
|
-
},
|
|
3147
|
-
"~run"(n, r) {
|
|
3148
|
-
const i = n.value;
|
|
3149
|
-
if (Array.isArray(i)) {
|
|
3150
|
-
n.typed = !0, n.value = [];
|
|
3151
|
-
for (let s = 0; s < this.items.length; s++) {
|
|
3152
|
-
const a = i[s], u = this.items[s]["~run"]({ value: a }, r);
|
|
3153
|
-
if (u.issues) {
|
|
3154
|
-
const o = {
|
|
3155
|
-
type: "array",
|
|
3156
|
-
origin: "value",
|
|
3157
|
-
input: i,
|
|
3158
|
-
key: s,
|
|
3159
|
-
value: a
|
|
3160
|
-
};
|
|
3161
|
-
for (const l of u.issues)
|
|
3162
|
-
l.path ? l.path.unshift(o) : l.path = [o], n.issues?.push(l);
|
|
3163
|
-
if (n.issues || (n.issues = u.issues), r.abortEarly) {
|
|
3164
|
-
n.typed = !1;
|
|
3165
|
-
break;
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
u.typed || (n.typed = !1), n.value.push(u.value);
|
|
3169
|
-
}
|
|
3170
|
-
} else V(this, "type", n, r);
|
|
3171
|
-
return n;
|
|
3172
|
-
}
|
|
3173
|
-
};
|
|
3174
|
-
}
|
|
3175
|
-
function jt(t, e, n) {
|
|
3176
|
-
const r = t["~run"]({ value: e }, /* @__PURE__ */ Vr(n));
|
|
3177
|
-
if (r.issues) throw new Ur(r.issues);
|
|
3178
|
-
return r.value;
|
|
3179
|
-
}
|
|
3180
|
-
// @__NO_SIDE_EFFECTS__
|
|
3181
|
-
function $(...t) {
|
|
3182
|
-
return {
|
|
3183
|
-
...t[0],
|
|
3184
|
-
pipe: t,
|
|
3185
|
-
get "~standard"() {
|
|
3186
|
-
return /* @__PURE__ */ pe(this);
|
|
3187
|
-
},
|
|
3188
|
-
"~run"(e, n) {
|
|
3189
|
-
for (const r of t) if (r.kind !== "metadata") {
|
|
3190
|
-
if (e.issues && (r.kind === "schema" || r.kind === "transformation")) {
|
|
3191
|
-
e.typed = !1;
|
|
3192
|
-
break;
|
|
3193
|
-
}
|
|
3194
|
-
(!e.issues || !n.abortEarly && !n.abortPipeEarly) && (e = r["~run"](e, n));
|
|
3195
|
-
}
|
|
3196
|
-
return e;
|
|
3197
|
-
}
|
|
3198
|
-
};
|
|
3199
|
-
}
|
|
3200
|
-
var ba = /* @__PURE__ */ $(/* @__PURE__ */ ce(), /* @__PURE__ */ Br(32)), _a = /* @__PURE__ */ $(/* @__PURE__ */ ce(), /* @__PURE__ */ hn(1)), bt = /* @__PURE__ */ Zr((t) => t instanceof HTMLElement, "Must be an HTMLElement"), Wt = /* @__PURE__ */ $(/* @__PURE__ */ Yr(), /* @__PURE__ */ jr(/* @__PURE__ */ Jr([/* @__PURE__ */ ce(), bt]))), Bt = /* @__PURE__ */ $(/* @__PURE__ */ ge({ width: /* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(0)), height: /* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(0)), padding: /* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(0)) }), /* @__PURE__ */ Wr((t) => Math.min(t.width, t.height) / t.padding >= 4, "Minimum of width or height must be greater than or equal to 4 * padding")), Ma = /* @__PURE__ */ ge({ background: /* @__PURE__ */ S(/* @__PURE__ */ ce()), radius: /* @__PURE__ */ S(/* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(0))), shadow: /* @__PURE__ */ S(/* @__PURE__ */ ce()) }), Hn = /* @__PURE__ */ ge({ background: /* @__PURE__ */ S(/* @__PURE__ */ ce()), radius: /* @__PURE__ */ S(/* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(0))), filter: /* @__PURE__ */ S(/* @__PURE__ */ ce()) }), Ea = /* @__PURE__ */ ge({ id: /* @__PURE__ */ $(/* @__PURE__ */ ce(), /* @__PURE__ */ hn(1)), rank: /* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(0)), lat: /* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(-90), /* @__PURE__ */ Kt(90)), lng: /* @__PURE__ */ $(/* @__PURE__ */ ue(), /* @__PURE__ */ le(-180), /* @__PURE__ */ Kt(180)), tooltip: /* @__PURE__ */ ge({ element: bt, style: /* @__PURE__ */ S(Hn), dimensions: /* @__PURE__ */ S(Bt), initialize: /* @__PURE__ */ S(Wt) }), pin: /* @__PURE__ */ S(/* @__PURE__ */ ge({ element: /* @__PURE__ */ S(bt), style: /* @__PURE__ */ S(Ma), dimensions: /* @__PURE__ */ S(Bt), initialize: /* @__PURE__ */ S(Wt) })), popup: /* @__PURE__ */ S(/* @__PURE__ */ ge({ element: bt, style: /* @__PURE__ */ S(Hn), dimensions: /* @__PURE__ */ S(Bt), initialize: /* @__PURE__ */ S(Wt) })) });
|
|
3201
|
-
const xa = "1.3.11";
|
|
3202
|
-
class Sa {
|
|
3203
|
-
apiKey;
|
|
3204
|
-
apiJwt;
|
|
3205
|
-
markerStatesStore;
|
|
3206
|
-
markerStatesWorker;
|
|
3207
|
-
markerStatesWorkerClient;
|
|
3208
|
-
constructor(e, n) {
|
|
3209
|
-
this.apiKey = e, this.apiJwt = n, this.markerStatesStore = /* @__PURE__ */ new Map(), this.markerStatesWorker = new ta(), this.markerStatesWorkerClient = new Yn(this.markerStatesWorker);
|
|
3210
|
-
}
|
|
3211
|
-
clearStates() {
|
|
3212
|
-
this.markerStatesStore.clear();
|
|
3213
|
-
}
|
|
3214
|
-
resetStates(e) {
|
|
3215
|
-
for (let n = 0; n < e.length; n++) {
|
|
3216
|
-
const r = e[n];
|
|
3217
|
-
r.state = void 0;
|
|
3218
|
-
}
|
|
3219
|
-
}
|
|
3220
|
-
async updateStates(e, n) {
|
|
3221
|
-
if (e.length == 0)
|
|
3222
|
-
return;
|
|
3223
|
-
if (e.length == 1) {
|
|
3224
|
-
e[0].state = { zoom: 0, directions: [{ zoom: 0, angle: pa() }] };
|
|
3225
|
-
return;
|
|
3226
|
-
}
|
|
3227
|
-
e.sort((i, s) => i.properites.id.localeCompare(s.properites.id));
|
|
3228
|
-
const r = await this.getStates(e, n);
|
|
3229
|
-
for (let i = 0; i < e.length; i++) {
|
|
3230
|
-
const s = e[i];
|
|
3231
|
-
s.state = r[i];
|
|
3232
|
-
}
|
|
3233
|
-
}
|
|
3234
|
-
async getStates(e, n) {
|
|
3235
|
-
const r = e.map((l) => l.input), i = fa(r), s = this.markerStatesStore.get(i);
|
|
3236
|
-
if (s) return s;
|
|
3237
|
-
const a = {
|
|
3238
|
-
mapSize: n.size,
|
|
3239
|
-
zoomMin: n.zoom.min,
|
|
3240
|
-
zoomMax: n.zoom.max,
|
|
3241
|
-
zoomScale: n.zoom.scale
|
|
3242
|
-
}, u = {
|
|
3243
|
-
key: this.apiKey,
|
|
3244
|
-
jwt: this.apiJwt,
|
|
3245
|
-
version: xa,
|
|
3246
|
-
input: r,
|
|
3247
|
-
parameters: a
|
|
3248
|
-
}, o = await this.markerStatesWorkerClient.invoke("fetch", u);
|
|
3249
|
-
return o.jwt && (this.apiJwt = o.jwt), this.markerStatesStore.set(i, o.states), o.states;
|
|
3250
|
-
}
|
|
3251
|
-
}
|
|
3252
|
-
class Pa {
|
|
3253
|
-
static create(e, n, r) {
|
|
3254
|
-
throw Error("Must override static create method!");
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3257
|
-
const qn = "1.3.11", Ta = "https://maps.api.arenarium.dev/auth", Ia = "https://maps.api.arenarium.dev/log", Zn = 500;
|
|
3258
|
-
class Xr extends Pa {
|
|
3259
|
-
apiKey;
|
|
3260
|
-
mapProvider;
|
|
3261
|
-
mapStateProvider;
|
|
3262
|
-
markers;
|
|
3263
|
-
markerVisibilityManager;
|
|
3264
|
-
markerElementsManager;
|
|
3265
|
-
markerStatesManager;
|
|
3266
|
-
markerVisibilityProcessor;
|
|
3267
|
-
markerElementsProcessor;
|
|
3268
|
-
markerStateProcessor;
|
|
3269
|
-
markerStatesProcessDelay = Zn;
|
|
3270
|
-
markerStatesProcessTimeout = void 0;
|
|
3271
|
-
constructor(e, n, r, i) {
|
|
3272
|
-
super(), jt(ba, e), jt(_a, n), this.apiKey = e, this.mapProvider = r, this.mapStateProvider = new vi(
|
|
3273
|
-
this.mapProvider,
|
|
3274
|
-
this.detached.bind(this),
|
|
3275
|
-
this.error.bind(this),
|
|
3276
|
-
this.onMapMove.bind(this),
|
|
3277
|
-
this.onMapIdle.bind(this),
|
|
3278
|
-
this.onMapClick.bind(this)
|
|
3279
|
-
), this.markers = /* @__PURE__ */ new Map(), this.markerVisibilityManager = new Ci(), this.markerElementsManager = new ea(this.mapProvider), this.markerStatesManager = new Sa(e, n), this.markerVisibilityProcessor = new Ft(this.onMarkersVisiblityProcess.bind(this)), this.markerElementsProcessor = new Ft(this.onMarkersRenderProcess.bind(this)), this.markerStateProcessor = new Ft(this.onMarkersStateProcess.bind(this)), this.update(i);
|
|
3280
|
-
}
|
|
3281
|
-
//#region Core
|
|
3282
|
-
static async create(e, n, r) {
|
|
3283
|
-
const a = (await ra(Ta, { key: e, version: qn })).jwt;
|
|
3284
|
-
if (!a) throw new Error("Failed to get api jwt");
|
|
3285
|
-
return new Xr(e, a, n, r);
|
|
3286
|
-
}
|
|
3287
|
-
update(e) {
|
|
3288
|
-
this.markerStatesProcessDelay = e?.process?.states?.delay ?? Zn, this.markerVisibilityManager.configuration = e, this.markerElementsManager.configuration = e;
|
|
3289
|
-
}
|
|
3290
|
-
clear() {
|
|
3291
|
-
this.markers.clear(), this.markerVisibilityManager.clearMarkers(), this.markerStatesManager.clearStates(), this.markerElementsManager.clearElements(), this.mapStateProvider.stop(), this.markerVisibilityProcessor.stop(), this.markerStateProcessor.stop(), this.markerElementsProcessor.stop();
|
|
3292
|
-
}
|
|
3293
|
-
detached() {
|
|
3294
|
-
return this.mapProvider.getContainer().parentElement == null;
|
|
3295
|
-
}
|
|
3296
|
-
error(e, n) {
|
|
3297
|
-
this.log("error", e, n);
|
|
3298
|
-
}
|
|
3299
|
-
async log(e, n, r) {
|
|
3300
|
-
switch (e) {
|
|
3301
|
-
case "info":
|
|
3302
|
-
console.info(r);
|
|
3303
|
-
break;
|
|
3304
|
-
case "warning":
|
|
3305
|
-
console.warn(r);
|
|
3306
|
-
break;
|
|
3307
|
-
case "error":
|
|
3308
|
-
console.error(r);
|
|
3309
|
-
break;
|
|
3310
|
-
}
|
|
3311
|
-
if (r instanceof Error)
|
|
3312
|
-
try {
|
|
3313
|
-
const i = {
|
|
3314
|
-
title: n,
|
|
3315
|
-
level: e,
|
|
3316
|
-
content: {
|
|
3317
|
-
version: qn,
|
|
3318
|
-
key: this.apiKey,
|
|
3319
|
-
name: r.name,
|
|
3320
|
-
message: r.message,
|
|
3321
|
-
cause: r.cause,
|
|
3322
|
-
stack: r.stack
|
|
3323
|
-
}
|
|
3324
|
-
};
|
|
3325
|
-
await ia(Ia, i);
|
|
3326
|
-
} catch (i) {
|
|
3327
|
-
console.error(i);
|
|
3328
|
-
}
|
|
3329
|
-
}
|
|
3330
|
-
//#endregion
|
|
3331
|
-
//#region Events
|
|
3332
|
-
onMapMove() {
|
|
3333
|
-
this.markerVisibilityProcessor.run();
|
|
3334
|
-
}
|
|
3335
|
-
onMapIdle() {
|
|
3336
|
-
this.markerStatesProcessTimeout ? window.clearTimeout(this.markerStatesProcessTimeout) : this.markerStateProcessor.run(), this.markerStatesProcessTimeout = window.setTimeout(() => {
|
|
3337
|
-
this.markerStateProcessor.run();
|
|
3338
|
-
}, this.markerStatesProcessDelay);
|
|
3339
|
-
}
|
|
3340
|
-
onMapClick() {
|
|
3341
|
-
this.hidePopup();
|
|
3342
|
-
}
|
|
3343
|
-
onMapMarkerClick(e, n) {
|
|
3344
|
-
e.stopPropagation(), this.showPopup(n);
|
|
3345
|
-
}
|
|
3346
|
-
async onMarkersVisiblityProcess() {
|
|
3347
|
-
try {
|
|
3348
|
-
if (this.detached()) return !0;
|
|
3349
|
-
const e = this.mapProvider.getParameters(), n = this.mapProvider.getViewport(), r = await this.markerVisibilityManager.getMarkersDelta(e, n);
|
|
3350
|
-
return this.markerStatesManager.resetStates(r.remove), this.markerElementsManager.removeElements(r.remove), this.markerElementsManager.insertElements(r.insert, this.onMapMarkerClick.bind(this)), this.markerElementsProcessor.run(), this.mapStateProvider.idle() && this.markerStateProcessor.run(), !1;
|
|
3351
|
-
} catch (e) {
|
|
3352
|
-
return this.clear(), this.error("Process markers visibility error", e), !0;
|
|
3353
|
-
}
|
|
3354
|
-
}
|
|
3355
|
-
async onMarkersStateProcess() {
|
|
3356
|
-
try {
|
|
3357
|
-
if (this.detached()) return !0;
|
|
3358
|
-
const e = this.mapProvider.getParameters(), n = this.markerVisibilityManager.getMarkers();
|
|
3359
|
-
return await this.markerStatesManager.updateStates(n, e), this.markerElementsManager.updateElements(n), this.markerElementsProcessor.run(), !1;
|
|
3360
|
-
} catch (e) {
|
|
3361
|
-
return this.clear(), this.error("Process markers state error", e), !0;
|
|
3362
|
-
}
|
|
3363
|
-
}
|
|
3364
|
-
async onMarkersRenderProcess() {
|
|
3365
|
-
try {
|
|
3366
|
-
if (this.detached()) return !0;
|
|
3367
|
-
const e = this.mapProvider.getParameters(), n = this.mapProvider.getViewport();
|
|
3368
|
-
return this.markerElementsManager.renderElements(n, e), !1;
|
|
3369
|
-
} catch (e) {
|
|
3370
|
-
return this.clear(), this.error("Process markers render error", e), !0;
|
|
3371
|
-
}
|
|
3372
|
-
}
|
|
3373
|
-
//#endregion
|
|
3374
|
-
//#region Markers
|
|
3375
|
-
getMarkers(e) {
|
|
3376
|
-
const n = new Array(), r = new Array();
|
|
3377
|
-
for (const o of e) {
|
|
3378
|
-
const l = this.markers.get(o.id);
|
|
3379
|
-
l ? n.push(l) : r.push(o);
|
|
3380
|
-
}
|
|
3381
|
-
const i = this.mapProvider.getContainer(), s = (o) => {
|
|
3382
|
-
const l = document.createElement("div");
|
|
3383
|
-
l.style.position = "absolute", l.style.visibility = "hidden", l.style.width = "max-content", l.style.zIndex = "-1";
|
|
3384
|
-
try {
|
|
3385
|
-
return l.appendChild(o), i.appendChild(l), l.getBoundingClientRect();
|
|
3386
|
-
} finally {
|
|
3387
|
-
i.removeChild(l);
|
|
3388
|
-
}
|
|
3389
|
-
}, a = (o, l) => {
|
|
3390
|
-
if (l) return l;
|
|
3391
|
-
if (o) {
|
|
3392
|
-
const c = s(o), h = c.width, f = c.height;
|
|
3393
|
-
return { width: h, height: f, padding: Pn };
|
|
3394
|
-
} else
|
|
3395
|
-
return { width: Sn, height: Sn, padding: Pn };
|
|
3396
|
-
}, u = (o, l) => {
|
|
3397
|
-
if (l) return l;
|
|
3398
|
-
const c = s(o), h = c.width, f = c.height, m = Math.min(Math.round(Math.min(h, f) / 4), Ii);
|
|
3399
|
-
return { width: h, height: f, padding: m };
|
|
3400
|
-
};
|
|
3401
|
-
for (const o of r) {
|
|
3402
|
-
const l = o.id, c = o.lat, h = o.lng, f = o.rank;
|
|
3403
|
-
let m = {
|
|
3404
|
-
id: l,
|
|
3405
|
-
initialize: o.pin?.initialize,
|
|
3406
|
-
element: o.pin?.element,
|
|
3407
|
-
style: o.pin?.style,
|
|
3408
|
-
dimensions: a(o.pin?.element, o.pin?.dimensions)
|
|
3409
|
-
}, d = {
|
|
3410
|
-
id: l,
|
|
3411
|
-
initialize: o.tooltip.initialize,
|
|
3412
|
-
element: o.tooltip.element,
|
|
3413
|
-
style: o.tooltip.style,
|
|
3414
|
-
dimensions: u(o.tooltip.element, o.tooltip.dimensions)
|
|
3415
|
-
}, v;
|
|
3416
|
-
o.popup && (v = {
|
|
3417
|
-
id: l,
|
|
3418
|
-
initialize: o.popup.initialize,
|
|
3419
|
-
element: o.popup.element,
|
|
3420
|
-
style: o.popup.style,
|
|
3421
|
-
dimensions: u(o.popup.element, o.popup.dimensions)
|
|
3422
|
-
});
|
|
3423
|
-
const g = new pi(l, c, h, f, m, d, v);
|
|
3424
|
-
n.push(g);
|
|
3425
|
-
}
|
|
3426
|
-
return n.forEach((o) => this.markers.set(o.properites.id, o)), n.sort((o, l) => l.properites.rank - o.properites.rank), n;
|
|
3427
|
-
}
|
|
3428
|
-
async updateMarkers(e) {
|
|
3429
|
-
jt(/* @__PURE__ */ qr(Ea), e);
|
|
3430
|
-
try {
|
|
3431
|
-
const n = this.mapProvider.getParameters(), r = this.getMarkers(e);
|
|
3432
|
-
await this.markerVisibilityManager.updateMarkers(n, r), this.mapStateProvider.start(), this.markerVisibilityProcessor.run();
|
|
3433
|
-
} catch (n) {
|
|
3434
|
-
throw this.clear(), this.error("Failed to update markers", n), n;
|
|
3435
|
-
}
|
|
3436
|
-
}
|
|
3437
|
-
async removeMarkers() {
|
|
3438
|
-
try {
|
|
3439
|
-
this.clear();
|
|
3440
|
-
} catch (e) {
|
|
3441
|
-
throw this.error("Failed to remove markers", e), e;
|
|
3442
|
-
}
|
|
3443
|
-
}
|
|
3444
|
-
//#endregion
|
|
3445
|
-
//#region Popups
|
|
3446
|
-
showPopup(e) {
|
|
3447
|
-
if (!this.detached())
|
|
3448
|
-
try {
|
|
3449
|
-
this.markerElementsManager.showPopup(e);
|
|
3450
|
-
} catch (n) {
|
|
3451
|
-
throw this.markerElementsManager.hidePopups(), this.error("Failed to show popup", n), n;
|
|
3452
|
-
} finally {
|
|
3453
|
-
this.markerElementsProcessor.run();
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
hidePopup() {
|
|
3457
|
-
if (!this.detached())
|
|
3458
|
-
try {
|
|
3459
|
-
this.markerElementsManager.hidePopups();
|
|
3460
|
-
} catch (e) {
|
|
3461
|
-
throw this.error("Failed to hide popup", e), e;
|
|
3462
|
-
} finally {
|
|
3463
|
-
this.markerElementsProcessor.run();
|
|
3464
|
-
}
|
|
3465
|
-
}
|
|
3466
|
-
//#endregion
|
|
3467
|
-
}
|
|
3468
|
-
export {
|
|
3469
|
-
Xr as MapManager
|
|
3470
|
-
};
|
|
1
|
+
var e=class{invoked=!1;running=!1;interval;timeout;callback;constructor(e,t){if((t??0)<0)throw Error(`Invalid interval`);this.interval=t??(navigator?.hardwareConcurrency?200/navigator.hardwareConcurrency:100),this.callback=e}async process(){this.invoked=!1,await this.callback()||!this.invoked?this.stop():this.timeout=window.setTimeout(this.process.bind(this),this.interval)}run(){this.invoked=!0,this.running||(this.running=!0,this.timeout=window.setTimeout(this.process.bind(this),0))}stop(){this.invoked=!1,this.running=!1,this.timeout&&window.clearTimeout(this.timeout),this.timeout=void 0}},t=class{properites;state;constructor(e,t,n,r,i,a,o){this.properites={id:e,lat:t,lng:n,rank:r,pin:i,tooltip:a,popup:o},this.state=void 0}get input(){let e=this.properites,t=e.tooltip.dimensions;return{id:e.id,lat:e.lat,lng:e.lng,rank:e.rank,width:t.width+2*t.padding,height:t.height+2*t.padding}}},n=class{callback;timeout;id;constructor(e,t){if(t<=0)throw Error(`Invalid timeout`);this.callback=e,this.timeout=t}start(){this.id??=window.setInterval(this.callback,this.timeout)}stop(){this.id!=null&&(window.clearInterval(this.id),this.id=void 0)}},r=100,i=class{viewport=void 0;state=`idle`;provider;interval;onCancel;onError;onMove;onIdle;onClick;constructor(e,t,i,a,o,s){this.provider=e,this.interval=new n(this.onInterval.bind(this),r/(navigator?.hardwareConcurrency??1)),this.onCancel=t,this.onError=i,this.onMove=a,this.onIdle=o,this.onClick=s}start(){this.interval.start(),this.provider.getContainer().addEventListener(`click`,this.onClick.bind(this))}stop(){this.interval.stop(),this.provider.getContainer().removeEventListener(`click`,this.onClick.bind(this))}idle(){return this.state==`idle`}onInterval(){try{if(this.onCancel()){this.interval.stop();return}let e=this.provider.getViewport(),t=this.state,n=JSON.stringify(e)===JSON.stringify(this.viewport)?`idle`:`move`;n==`move`&&this.onMove(),n==`idle`&&t==`move`&&this.onIdle(),this.state=n,this.viewport=e}catch(e){this.onError(`Failed to process map state interval`,e)}}},a=class{worker;workerInvocations;workerInvocationCounter=0;constructor(e){this.worker=e,this.workerInvocations=new Map,this.worker.onmessage=this.onmessage.bind(this),this.worker.onerror=this.onerror.bind(this)}onmessage(e){let t=this.workerInvocations.get(e.data.id);if(!t)throw Error(`Unknown invocation: ${e.data.id}`);e.data.error?t.reject(Error(e.data.error)):t.resolve(e.data.result),this.workerInvocations.delete(e.data.id)}onerror(e){this.workerInvocations.forEach(t=>t.reject(Error(e.message))),this.workerInvocations.clear()}invoke(e,...t){return new Promise((n,r)=>{let i=`${e.toString()}_${this.workerInvocationCounter++}_${performance.now()}`,a={id:i,method:e.toString(),args:t};this.workerInvocations.set(i,{resolve:n,reject:r}),this.worker.postMessage(a)})}terminate(){this.workerInvocations.forEach(e=>e.reject(Error(`Terminated`))),this.workerInvocations.clear(),this.worker.terminate()}},o=class e{remove;insert;constructor(e,t){this.remove=e,this.insert=t}static from(t,n){let r=new Set(t),i=new Set(n);return new e(Array.from(r.difference(i)),Array.from(i.difference(r)))}static empty(){return new e([],[])}},s="(function(){var e=class{methods;constructor(e){this.methods=e}listen(){self.onmessage=this.onmessage.bind(this)}async onmessage(e){let{id:t,method:n,args:r}=e.data;try{let e=this.methods[n];if(typeof e!=`function`)throw Error(`Unknown method: ${n}`);let i={id:t,result:await e(...r)};self.postMessage(i)}catch(e){let n={id:t,error:e instanceof Error?e.message:String(e)};self.postMessage(n)}}};function t(e,t,n){return{x:r(t)*n,y:i(e)*n}}function n(e,t,n){return{lat:o(t/n),lng:a(e/n)}}function r(e){return(180+e)/360}function i(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function a(e){return e*360-180}function o(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}var s=class{sw;ne;constructor(e,t,n,r){if(n<e||r<t)throw Error(`Invalid bounds: ${e}, ${t}, ${n}, ${r}`);this.sw={lat:e,lng:t},this.ne={lat:n,lng:r}}contains(e,t){return!(e<this.sw.lat||this.ne.lat<e||t<this.sw.lng||this.ne.lng<t)}intersects(e){return!(e.ne.lat<this.sw.lat||this.ne.lat<e.sw.lat||e.ne.lng<this.sw.lng||this.ne.lng<e.sw.lng)}},c=class e{blockL;blockR;sw;ne;constructor(e,t,n,r){if(n<e)throw Error(`Invalid bounds: ${e}, ${t}, ${n}, ${r}`);this.sw={lat:e,lng:t},this.ne={lat:n,lng:r},t<r?(this.blockL=new s(e,t,n,r),this.blockR=new s(0,0,0,0)):(this.blockL=new s(e,-180,n,r),this.blockR=new s(e,t,n,180))}static bounds(e){let t=e.bounds,n=e.center;return t.sw.lng<=n.lng&&t.ne.lng<=n.lng||t.sw.lng>=n.lng&&t.ne.lng>=n.lng||Math.abs(t.ne.lng-n.lng)+Math.abs(t.sw.lng-n.lng)>360||t.ne.lng-t.sw.lng>360?{sw:{lat:t.sw.lat,lng:-180},ne:{lat:t.ne.lat,lng:180}}:e.bounds}static create(t){let n=this.bounds(t),r=n.sw,i=n.ne;return new e(r.lat,r.lng,i.lat,i.lng)}static offset(r,i,a){let o=this.bounds(r),s=i*2**r.zoom,c=t(o.sw.lat,o.sw.lng,s),l=t(o.ne.lat,o.ne.lng,s),u=Math.max(c.x-a.left,0),d=Math.min(c.y+a.bottom,s),f=Math.min(l.x+a.right,s),p=Math.max(l.y-a.top,0),m=n(u,d,s),h=n(f,p,s);return new e(m.lat,m.lng,h.lat,h.lng)}contains(e,t){return this.blockL.contains(e,t)||this.blockR.contains(e,t)}intersects(e){return this.blockL.intersects(e)||this.blockR.intersects(e)}},l=class{id;bounds;markers;constructor(e,t){this.id=e,this.bounds=t,this.markers=[]}belongs(e){let t=this.bounds.sw;if(e.lat<t.lat||e.lng<t.lng)return!1;let n=this.bounds.ne;return!(n.lat<e.lat||n.lng<e.lng)}neighbours(e,t){let n=Math.abs(e.id.length-this.id.length);if(n>t)return!1;let r=Math.min(this.id.length,e.id.length)-t+n;for(let t=0;t<r;t++)if(this.id[t]!=e.id[t])return!1;return!0}},u=class e{tree;zoom;cell;branches;constructor(e,t,n,r){this.tree=e,this.zoom=n,this.cell=new l(t,r),this.branches=[]}split(){let t=this.cell.bounds,n=2**this.tree.depth,r=(t.ne.lat-t.sw.lat)/n,i=(t.ne.lng-t.sw.lng)/n;for(let a=0;a<n;a++)for(let o=0;o<n;o++){let n=t.sw.lat+a*r,s=t.sw.lng+o*i,c=n+r,l=s+i;this.branches.push(new e(this.tree,`${this.cell.id}${a*2+o}`,this.zoom+this.tree.depth,{sw:{lat:n,lng:s},ne:{lat:c,lng:l}}))}}add(e){if(this.cell.belongs(e)==0)return!1;if(this.cell.markers.length<this.tree.capacity)return this.cell.markers.push(e),!0;this.branches.length==0&&this.split();for(let t=0;t<this.branches.length;t++)if(this.branches[t].add(e))return!0;throw Error(`Failed to add marker to branch`)}compact(){if(this.branches.length==0)return;for(let e=0;e<this.branches.length;e++)this.branches[e].compact();let t=[],n=[];for(let e=0;e<this.branches.length;e++){let r=this.branches[e];t.push(...r.branches),n.push(...r.cell.markers)}let r=new e(this.tree,this.cell.id,this.zoom+this.tree.depth,this.cell.bounds);r.branches=t,r.cell.markers=n,this.branches=[r]}cells(e,t,n){if(e<this.zoom||t.intersects(this.cell.bounds)==0)return n;n.push(this.cell);for(let r=0;r<this.branches.length;r++)this.branches[r].cells(e,t,n);return n}print(e){console.log(`${`---`.repeat(e)}|${this.cell.id} zoom=[${this.zoom}] markers=[${this.cell.markers.length}]`);for(let t=0;t<this.branches.length;t++)this.branches[t].print(e+1)}count(){return this.cell.markers.length+this.branches.reduce((e,t)=>e+t.count(),0)}},d=class{capacity;depth;root;constructor(e,t,n){this.capacity=n,this.depth=t,this.root=new u(this,`R`,e,{sw:{lat:-90,lng:-180},ne:{lat:90,lng:180}})}add(e){return this.root.add(e)}compact(){this.root.compact()}cells(e,t){let n=[];return this.root.cells(e,t,n),n}print(){this.root.print(0)}};let f,p,m=2,h=1,g=64;new e({update(e,t,n){let r=-Math.floor(Math.log2(e.size/g)),i=new d(r,h,m);for(let e=0;e<t.length;e++){let n=t[e];if(!i.add(n))throw Error(`Failed to add marker to tree`)}let a=-r;for(let e=0;e<a;e++)i.compact();f=i,p=n},configure(e){m=e?.process?.visibility?.cell?.capacity??2,h=e?.process?.visibility?.cell?.depth??1,g=e?.process?.visibility?.cell?.size??64},filter(e,t){if(!f||!p)return[];let n=c.create(t),r=[],i=t.zoom;for(;i<e.zoom.max&&r.length<p;)r=f.cells(i,n).flatMap(e=>e.markers),i++;return r.map(e=>e.index)}}).listen()})();",c=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,s],{type:`text/javascript;charset=utf-8`});function l(e){let t;try{if(t=c&&(self.URL||self.webkitURL).createObjectURL(c),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(s),{name:e?.name})}}function u(e,t,n){return{x:f(t)*n,y:p(e)*n}}function d(e,t,n){return{lat:h(t/n),lng:m(e/n)}}function f(e){return(180+e)/360}function p(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function m(e){return e*360-180}function h(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}var g=class{sw;ne;constructor(e,t,n,r){if(n<e||r<t)throw Error(`Invalid bounds: ${e}, ${t}, ${n}, ${r}`);this.sw={lat:e,lng:t},this.ne={lat:n,lng:r}}contains(e,t){return!(e<this.sw.lat||this.ne.lat<e||t<this.sw.lng||this.ne.lng<t)}intersects(e){return!(e.ne.lat<this.sw.lat||this.ne.lat<e.sw.lat||e.ne.lng<this.sw.lng||this.ne.lng<e.sw.lng)}},ee=class e{blockL;blockR;sw;ne;constructor(e,t,n,r){if(n<e)throw Error(`Invalid bounds: ${e}, ${t}, ${n}, ${r}`);this.sw={lat:e,lng:t},this.ne={lat:n,lng:r},t<r?(this.blockL=new g(e,t,n,r),this.blockR=new g(0,0,0,0)):(this.blockL=new g(e,-180,n,r),this.blockR=new g(e,t,n,180))}static bounds(e){let t=e.bounds,n=e.center;return t.sw.lng<=n.lng&&t.ne.lng<=n.lng||t.sw.lng>=n.lng&&t.ne.lng>=n.lng||Math.abs(t.ne.lng-n.lng)+Math.abs(t.sw.lng-n.lng)>360||t.ne.lng-t.sw.lng>360?{sw:{lat:t.sw.lat,lng:-180},ne:{lat:t.ne.lat,lng:180}}:e.bounds}static create(t){let n=this.bounds(t),r=n.sw,i=n.ne;return new e(r.lat,r.lng,i.lat,i.lng)}static offset(t,n,r){let i=this.bounds(t),a=n*2**t.zoom,o=u(i.sw.lat,i.sw.lng,a),s=u(i.ne.lat,i.ne.lng,a),c=Math.max(o.x-r.left,0),l=Math.min(o.y+r.bottom,a),f=Math.min(s.x+r.right,a),p=Math.max(s.y-r.top,0),m=d(c,l,a),h=d(f,p,a);return new e(m.lat,m.lng,h.lat,h.lng)}contains(e,t){return this.blockL.contains(e,t)||this.blockR.contains(e,t)}intersects(e){return this.blockL.intersects(e)||this.blockR.intersects(e)}},te=25e-5,ne=1e6,re=2e6,ie=3e6,_=.5,v=1024,ae=class{markers;markersVisible;markerVisibilityTreeWorker;markerVisibilityTreeWorkerClient;markerVisibilityTreeLimit=v;set configuration(e){this.markerVisibilityTreeWorkerClient?.invoke(`configure`,e),this.markerVisibilityTreeLimit=e?.process?.visibility?.limit??v}getMarkers(){return Array.from(this.markersVisible??[])}async getMarkersDelta(e,t){if(this.markerVisibilityTreeWorkerClient&&this.markers){let n=await this.markerVisibilityTreeWorkerClient.invoke(`filter`,e,t),r=this.markersVisible,i=n.map(e=>this.markers[e]),a=o.from(r,i);return this.markersVisible=i,a}else if(this.markers!=this.markersVisible){let e=this.markersVisible,t=this.markers,n=o.from(e,t);return this.markersVisible=t,n}else return o.empty()}async updateMarkers(e,t){this.markers=t,t.length>this.markerVisibilityTreeLimit?(this.markerVisibilityTreeWorker=new l,this.markerVisibilityTreeWorkerClient=new a(this.markerVisibilityTreeWorker),await this.markerVisibilityTreeWorkerClient.invoke(`update`,e,t.map((e,t)=>({index:t,lat:e.properites.lat,lng:e.properites.lng})),this.markerVisibilityTreeLimit)):(this.markerVisibilityTreeWorker=void 0,this.markerVisibilityTreeWorkerClient=void 0)}clearMarkers(){this.markers=void 0,this.markersVisible=void 0,this.markerVisibilityTreeWorker=void 0,this.markerVisibilityTreeWorkerClient=void 0}},oe=Array.isArray,se=Array.prototype.indexOf,y=Array.prototype.includes,ce=Array.from;Object.keys;var le=Object.defineProperty,ue=Object.getOwnPropertyDescriptor,de=Object.prototype,b=Array.prototype,fe=Object.getPrototypeOf,pe=Object.isExtensible,me=()=>{};function he(e){for(var t=0;t<e.length;t++)e[t]()}function ge(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var x=1024,S=2048,_e=4096,ve=8192,ye=16384,be=32768,xe=1<<25,Se=65536,Ce=1<<19,we=1<<20,Te=65536,Ee=1<<21,De=1<<22,Oe=1<<23,ke=Symbol(`$state`),C=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"};globalThis.document?.contentType;function Ae(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function je(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Me(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ne(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Pe(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Fe(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ie={},w=Symbol();function Le(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Re(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var T=!1,E;function ze(e){if(e===null)throw Le(),Ie;return E=e}function Be(){return ze(on(E))}function Ve(e){if(T){if(on(E)!==null)throw Le(),Ie;E=e}}function He(e=1){if(T){for(var t=e,n=E;t--;)n=on(n);E=n}}function Ue(e=!0){for(var t=0,n=E;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=on(n);e&&n.remove(),n=i}}function We(e){return e===this.v}function Ge(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ke(e){return!Ge(e,this.v)}var qe=!1,Je=!1,D=null;function Ye(e){D=e}function Xe(e,t=!1,n){D={p:D,i:!1,c:null,e:null,s:e,x:null,r:L,l:Je&&!t?{s:null,u:null,$:[]}:null}}function Ze(e){var t=D,n=t.e;if(n!==null){t.e=null;for(var r of n)gn(r)}return e!==void 0&&(t.x=e),t.i=!0,D=t.p,e??{}}function Qe(){return!Je||D!==null&&D.l===null}var $e=[];function et(){var e=$e;$e=[],he(e)}function tt(e){if($e.length===0&&!dt){var t=$e;queueMicrotask(()=>{t===$e&&et()})}$e.push(e)}function nt(e){var t=L;if(t===null)return P.f|=Oe,e;if(!(t.f&32768)&&!(t.f&4))throw e;rt(e,t)}function rt(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var it=~(S|_e|x);function O(e,t){e.f=e.f&it|t}function at(e){e.f&512||e.deps===null?O(e,x):O(e,_e)}function ot(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=Te,ot(t.deps))}function st(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ot(e.deps),O(e,x)}var ct=!1,lt=new Set,k=null,A=null,ut=null,dt=!1,ft=!1,pt=null,mt=null,ht=0,gt=1,_t=class e{id=gt++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=0;#r=0;#i=null;#a=[];#o=new Set;#s=new Set;#c=new Map;is_fork=!1;#l=!1;#u(){return this.is_fork||this.#r>0}skip_effect(e){this.#c.has(e)||this.#c.set(e,{d:[],m:[]})}unskip_effect(e){var t=this.#c.get(e);if(t){this.#c.delete(e);for(var n of t.d)O(n,S),this.schedule(n);for(n of t.m)O(n,_e),this.schedule(n)}}#d(){ht++>1e3&&vt();let t=this.#a;this.#a=[],this.apply();var n=pt=[],r=[],i=mt=[];for(let e of t)try{this.#f(e,n,r)}catch(t){throw Tt(e),t}if(k=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(pt=null,mt=null,this.#u()){this.#p(r),this.#p(n);for(let[e,t]of this.#c)wt(e,t)}else{this.#n===0&<.delete(this),this.#o.clear(),this.#s.clear();for(let e of this.#e)e(this);this.#e.clear(),bt(r),bt(n),this.#i?.resolve()}var o=k;if(this.#a.length>0){let e=o??=this;e.#a.push(...this.#a.filter(t=>!e.#a.includes(t)))}o!==null&&(lt.add(o),o.#d()),lt.has(this)||this.#m()}#f(e,t,n){e.f^=x;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#c.has(r))&&r.fn!==null){a?r.f^=x:i&4?t.push(r):qe&&i&16777224?n.push(r):Un(r)&&(i&16&&this.#s.add(r),Jn(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#p(e){for(var t=0;t<e.length;t+=1)st(e[t],this.#o,this.#s)}capture(e,t){t!==w&&!this.previous.has(e)&&this.previous.set(e,t),e.f&8388608||(this.current.set(e,e.v),A?.set(e,e.v))}activate(){k=this}deactivate(){k=null,A=null}flush(){try{if(ft=!0,k=this,!this.#u()){for(let e of this.#o)this.#s.delete(e),O(e,S),this.schedule(e);for(let e of this.#s)O(e,_e),this.schedule(e)}this.#d()}finally{ht=0,ut=null,pt=null,mt=null,ft=!1,k=null,A=null,Wt.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear()}#m(){for(let s of lt){var e=s.id<this.id,t=[];for(let[n,r]of this.current){if(s.current.has(n))if(e&&r!==s.current.get(n))s.current.set(n,r);else continue;t.push(n)}if(t.length!==0){var n=[...s.current.keys()].filter(e=>!this.current.has(e));if(n.length>0){s.activate();var r=new Set,i=new Map;for(var a of t)xt(a,n,r,i);if(s.#a.length>0){s.apply();for(var o of s.#a)s.#f(o,[],[])}s.deactivate()}}}}increment(e){this.#n+=1,e&&(this.#r+=1)}decrement(e,t){--this.#n,e&&--this.#r,!(this.#l||t)&&(this.#l=!0,tt(()=>{this.#l=!1,this.flush()}))}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=ge()).promise}static ensure(){if(k===null){let t=k=new e;ft||(lt.add(k),dt||tt(()=>{k===t&&t.flush()}))}return k}apply(){if(!qe||!this.is_fork&<.size===1){A=null;return}A=new Map(this.current);for(let e of lt)if(e!==this)for(let[t,n]of e.previous)A.has(t)||A.set(t,n)}schedule(e){if(ut=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(pt!==null&&t===L&&(qe||(P===null||!(P.f&2))&&!ct))return;if(n&96){if(!(n&1024))return;t.f^=x}}this.#a.push(t)}};function vt(){try{je()}catch(e){rt(e,ut)}}var yt=null;function bt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Un(r)&&(yt=new Set,Jn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&On(r),yt?.size>0)){Wt.clear();for(let e of yt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)yt.has(n)&&(yt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Jn(n)}}yt.clear()}}yt=null}}function xt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?xt(i,t,n,r):e&4194320&&!(e&2048)&&St(i,t,r)&&(O(i,S),Ct(i))}}function St(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(y.call(t,r))return!0;if(r.f&2&&St(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function Ct(e){k.schedule(e)}function wt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),O(e,x);for(var n=e.first;n!==null;)wt(n,t),n=n.next}}function Tt(e){O(e,x);for(var t=e.first;t!==null;)Tt(t),t=t.next}function Et(e){let t=0,n=Kt(0),r;return()=>{mn()&&(U(n),bn(()=>(t===0&&(r=W(()=>e(()=>Yt(n)))),t+=1,()=>{tt(()=>{--t,t===0&&(r?.(),r=void 0,Yt(n))})})))}}var Dt=Se|Ce;function Ot(e,t,n,r){new kt(e,t,n,r)}var kt=class{parent;is_pending=!1;transform_error;#e;#t=T?E:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Et(()=>(this.#m=Kt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=L;t.b=this,t.f|=128,n(e)},this.parent=L.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Sn(()=>{if(T){let e=this.#t;Be();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},Dt),T&&(this.#e=E)}#g(){try{this.#a=Cn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Cn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Cn(()=>e(this.#e)),tt(()=>{var e=this.#c=document.createDocumentFragment(),t=rn();e.append(t),this.#a=this.#x(()=>Cn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,kn(this.#o,()=>{this.#o=null}),this.#b(k))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Cn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();jn(this.#a,e);let t=this.#n.pending;this.#o=Cn(()=>t(this.#e))}else this.#b(k)}catch(e){this.error(e)}}#b(e){this.is_pending=!1;for(let t of this.#f)O(t,S),e.schedule(t);for(let t of this.#p)O(t,_e),e.schedule(t);this.#f.clear(),this.#p.clear()}defer_effect(e){st(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=L,n=P,r=D;R(this.#i),I(this.#i),Ye(this.#i.ctx);try{return _t.ensure(),e()}catch(e){return nt(e),null}finally{R(t),I(n),Ye(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&kn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,tt(()=>{this.#d=!1,this.#m&&qt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),U(this.#m)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(!t&&!n)throw e;this.#a&&=(N(this.#a),null),this.#o&&=(N(this.#o),null),this.#s&&=(N(this.#s),null),T&&(ze(this.#t),He(),ze(Ue()));var r=!1,i=!1;let a=()=>{if(r){Re();return}r=!0,i&&Fe(),this.#s!==null&&kn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){rt(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Cn(()=>{var t=L;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return rt(e,this.#i.parent),null}}))};tt(()=>{var t;try{t=this.transform_error(e)}catch(e){rt(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>rt(e,this.#i&&this.#i.parent)):o(t)})}};function At(e,t,n,r){let i=Qe()?Pt:It;var a=e.filter(e=>!e.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=L,s=jt(),c=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function l(e){s();try{r(e)}catch(e){o.f&16384||rt(e,o)}Mt()}if(n.length===0){c.then(()=>l(t.map(i)));return}var u=Nt();function d(){Promise.all(n.map(e=>Ft(e))).then(e=>l([...t.map(i),...e])).catch(e=>rt(e,o)).finally(()=>u())}c?c.then(()=>{s(),d(),Mt()}):d()}function jt(){var e=L,t=P,n=D,r=k;return function(i=!0){R(e),I(t),Ye(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Mt(e=!0){R(null),I(null),Ye(null),e&&k?.deactivate()}function Nt(){var e=L.b,t=k,n=e.is_rendered();return e.update_pending_count(1,t),t.increment(n),(r=!1)=>{e.update_pending_count(-1,t),t.decrement(n,r)}}function Pt(e){var t=2|S,n=P!==null&&P.f&2?P:null;return L!==null&&(L.f|=Ce),{ctx:D,deps:null,effects:null,equals:We,f:t,fn:e,reactions:null,rv:0,v:w,wv:0,parent:n??L,ac:null}}function Ft(e,t,n){let r=L;r===null&&Ae();var i=void 0,a=Kt(w),o=!P,s=new Map;return yn(()=>{var t=L,n=ge();i=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).finally(Mt)}catch(e){n.reject(e),Mt()}var c=k;if(o){if(t.f&32768)var l=Nt();if(r.b.is_rendered())s.get(c)?.reject(C),s.delete(c);else{for(let e of s.values())e.reject(C);s.clear()}s.set(c,n)}let u=(e,n=void 0)=>{if(l&&l(n===C),!(n===C||t.f&16384)){if(c.activate(),n)a.f|=Oe,qt(a,n);else{a.f&8388608&&(a.f^=Oe),qt(a,e);for(let[e,t]of s){if(s.delete(e),e===c)break;t.reject(C)}}c.deactivate()}};n.promise.then(u,e=>u(null,e||`unknown`))}),hn(()=>{for(let e of s.values())e.reject(C)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function It(e){let t=Pt(e);return t.equals=Ke,t}function Lt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)N(t[n])}}function Rt(e){for(var t=e.parent;t!==null;){if(!(t.f&2))return t.f&16384?null:t;t=t.parent}return null}function zt(e){var t,n=L;R(Rt(e));try{e.f&=~Te,Lt(e),t=Gn(e)}finally{R(n)}return t}function Bt(e){var t=zt(e);if(!e.equals(t)&&(e.wv=Hn(),(!k?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){O(e,x);return}Pn||(A===null?at(e):(mn()||k?.is_fork)&&A.set(e,t))}function Vt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(C),t.teardown=me,t.ac=null,qn(t,0),Tn(t))}function Ht(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&Jn(t)}var Ut=new Set,Wt=new Map,Gt=!1;function Kt(e,t){return{f:0,v:e,reactions:null,equals:We,rv:0,wv:0}}function j(e,t){let n=Kt(e,t);return In(n),n}function M(e,t,n=!1){return P!==null&&(!F||P.f&131072)&&Qe()&&P.f&4325394&&(z===null||!y.call(z,e))&&Pe(),qt(e,n?Zt(t):t,mt)}function qt(e,t,n=null){if(!e.equals(t)){var r=e.v;Pn?Wt.set(e,t):Wt.set(e,r),e.v=t;var i=_t.ensure();if(i.capture(e,r),e.f&2){let t=e;e.f&2048&&zt(t),at(t)}e.wv=Hn(),Xt(e,S,n),Qe()&&L!==null&&L.f&1024&&!(L.f&96)&&(H===null?Ln([e]):H.push(e)),!i.is_fork&&Ut.size>0&&!Gt&&Jt()}return t}function Jt(){Gt=!1;for(let e of Ut)e.f&1024&&O(e,_e),Un(e)&&Jn(e);Ut.clear()}function Yt(e){M(e,e.v+1)}function Xt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Qe(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===L)){var l=(c&S)===0;if(l&&O(s,t),c&2){var u=s;A?.delete(u),c&65536||(c&512&&(s.f|=Te),Xt(u,_e,n))}else if(l){var d=s;c&16&&yt!==null&&yt.add(d),n===null?Ct(d):n.push(d)}}}}function Zt(e){if(typeof e!=`object`||!e||ke in e)return e;let t=fe(e);if(t!==de&&t!==b)return e;var n=new Map,r=oe(e),i=j(0),a=null,o=Bn,s=e=>{if(Bn===o)return e();var t=P,n=Bn;I(null),Vn(o);var r=e();return I(t),Vn(n),r};return r&&n.set(`length`,j(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&Me();var i=n.get(t);return i===void 0?s(()=>{var e=j(r.value,a);return n.set(t,e),e}):M(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>j(w,a));n.set(t,e),Yt(i)}}else M(r,w),Yt(i);return!0},get(t,r,i){if(r===ke)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||ue(t,r)?.writable)&&(o=s(()=>j(Zt(c?t[r]:w),a)),n.set(r,o)),o!==void 0){var l=U(o);return l===w?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var i=n.get(t);i&&(r.value=U(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==w)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===ke)return!0;var r=n.get(t),i=r!==void 0&&r.v!==w||Reflect.has(e,t);return(r!==void 0||L!==null&&(!i||ue(e,t)?.writable))&&(r===void 0&&(r=s(()=>j(i?Zt(e[t]):w,a)),n.set(t,r)),U(r)===w)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var f=n.get(d+``);f===void 0?d in e&&(f=s(()=>j(w,a)),n.set(d+``,f)):M(f,w)}if(l===void 0)(!u||ue(e,t)?.writable)&&(l=s(()=>j(void 0,a)),M(l,Zt(o)),n.set(t,l));else{u=l.v!==w;var p=s(()=>Zt(o));M(l,p)}var m=Reflect.getOwnPropertyDescriptor(e,t);if(m?.set&&m.set.call(c,o),!u){if(r&&typeof t==`string`){var h=n.get(`length`),g=Number(t);Number.isInteger(g)&&g>=h.v&&M(h,g+1)}Yt(i)}return!0},ownKeys(e){U(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==w});for(var[r,a]of n)a.v!==w&&!(r in e)&&t.push(r);return t},setPrototypeOf(){Ne()}})}var Qt,$t,en,tn;function nn(){if(Qt===void 0){Qt=window,document,$t=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;en=ue(t,`firstChild`).get,tn=ue(t,`nextSibling`).get,pe(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),pe(n)&&(n.__t=void 0)}}function rn(e=``){return document.createTextNode(e)}function an(e){return en.call(e)}function on(e){return tn.call(e)}function sn(e,t){if(!T)return an(e);var n=an(E);if(n===null)n=E.appendChild(rn());else if(t&&n.nodeType!==3){var r=rn();return n?.before(r),ze(r),r}return t&&un(n),ze(n),n}function cn(e,t=1,n=!1){let r=T?E:e;for(var i;t--;)i=r,r=on(r);if(!T)return r;if(n){if(r?.nodeType!==3){var a=rn();return r===null?i?.after(a):r.before(a),ze(a),a}un(r)}return ze(r),r}function ln(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function un(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function dn(e){var t=P,n=L;I(null),R(null);try{return e()}finally{I(t),R(n)}}function fn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function pn(e,t){var n=L;n!==null&&n.f&8192&&(e|=ve);var r={ctx:D,deps:null,nodes:null,f:e|S|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},i=r;if(e&4)pt===null?_t.ensure().schedule(r):pt.push(r);else if(t!==null){try{Jn(r)}catch(e){throw N(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=Se))}if(i!==null&&(i.parent=n,n!==null&&fn(i,n),P!==null&&P.f&2&&!(e&64))){var a=P;(a.effects??=[]).push(i)}return r}function mn(){return P!==null&&!F}function hn(e){let t=pn(8,null);return O(t,x),t.teardown=e,t}function gn(e){return pn(4|we,e)}function _n(e){_t.ensure();let t=pn(64|Ce,e);return(e={})=>new Promise(n=>{e.outro?kn(t,()=>{N(t),n(void 0)}):(N(t),n(void 0))})}function vn(e){return pn(4,e)}function yn(e){return pn(De|Ce,e)}function bn(e,t=0){return pn(8|t,e)}function xn(e,t=[],n=[],r=[]){At(r,t,n,t=>{pn(8,()=>e(...t.map(U)))})}function Sn(e,t=0){return pn(16|t,e)}function Cn(e){return pn(32|Ce,e)}function wn(e){var t=e.teardown;if(t!==null){let e=Pn,n=P;Fn(!0),I(null);try{t.call(null)}finally{Fn(e),I(n)}}}function Tn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&dn(()=>{e.abort(C)});var r=n.next;n.f&64?n.parent=null:N(n,t),n=r}}function En(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||N(t),t=n}}function N(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Dn(e.nodes.start,e.nodes.end),n=!0),O(e,xe),Tn(e,t&&!n),qn(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();wn(e),e.f^=xe,e.f|=ye;var i=e.parent;i!==null&&i.first!==null&&On(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function Dn(e,t){for(;e!==null;){var n=e===t?null:on(e);e.remove(),e=n}}function On(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function kn(e,t,n=!0){var r=[];An(e,r,!0);var i=()=>{n&&N(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function An(e,t,n){if(!(e.f&8192)){e.f^=ve;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next,o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;An(i,t,o?n:!1),i=a}}}function jn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:on(n);t.append(n),n=i}}var Mn=null,Nn=!1,Pn=!1;function Fn(e){Pn=e}var P=null,F=!1;function I(e){P=e}var L=null;function R(e){L=e}var z=null;function In(e){P!==null&&(!qe||P.f&2)&&(z===null?z=[e]:z.push(e))}var B=null,V=0,H=null;function Ln(e){H=e}var Rn=1,zn=0,Bn=zn;function Vn(e){Bn=e}function Hn(){return++Rn}function Un(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~Te),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Un(a)&&Bt(a),a.wv>e.wv)return!0}t&512&&A===null&&O(e,x)}return!1}function Wn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!qe&&z!==null&&y.call(z,e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Wn(a,t,!1):t===a&&(n?O(a,S):a.f&1024&&O(a,_e),Ct(a))}}function Gn(e){var t=B,n=V,r=H,i=P,a=z,o=D,s=F,c=Bn,l=e.f;B=null,V=0,H=null,P=l&96?null:e,z=null,Ye(e.ctx),F=!1,Bn=++zn,e.ac!==null&&(dn(()=>{e.ac.abort(C)}),e.ac=null);try{e.f|=Ee;var u=e.fn,d=u();e.f|=be;var f=e.deps,p=k?.is_fork;if(B!==null){var m;if(p||qn(e,V),f!==null&&V>0)for(f.length=V+B.length,m=0;m<B.length;m++)f[V+m]=B[m];else e.deps=f=B;if(mn()&&e.f&512)for(m=V;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&V<f.length&&(qn(e,V),f.length=V);if(Qe()&&H!==null&&!F&&f!==null&&!(e.f&6146))for(m=0;m<H.length;m++)Wn(H[m],e);if(i!==null&&i!==e){if(zn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=zn;if(t!==null)for(let e of t)e.rv=zn;H!==null&&(r===null?r=H:r.push(...H))}return e.f&8388608&&(e.f^=Oe),d}catch(e){return nt(e)}finally{e.f^=Ee,B=t,V=n,H=r,P=i,z=a,Ye(o),F=s,Bn=c}}function Kn(e,t){let n=t.reactions;if(n!==null){var r=se.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(B===null||!y.call(B,t))){var a=t;a.f&512&&(a.f^=512,a.f&=~Te),at(a),Vt(a),qn(a,0)}}function qn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Kn(e,n[r])}function Jn(e){var t=e.f;if(!(t&16384)){O(e,x);var n=L,r=Nn;L=e,Nn=!0;try{t&16777232?En(e):Tn(e),wn(e);var i=Gn(e);e.teardown=typeof i==`function`?i:null,e.wv=Rn}finally{Nn=r,L=n}}}function U(e){var t=(e.f&2)!=0;if(Mn?.add(e),P!==null&&!F&&!(L!==null&&L.f&16384)&&(z===null||!y.call(z,e))){var n=P.deps;if(P.f&2097152)e.rv<zn&&(e.rv=zn,B===null&&n!==null&&n[V]===e?V++:B===null?B=[e]:B.push(e));else{(P.deps??=[]).push(e);var r=e.reactions;r===null?e.reactions=[P]:y.call(r,P)||r.push(P)}}if(Pn&&Wt.has(e))return Wt.get(e);if(t){var i=e;if(Pn){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Xn(i))&&(a=zt(i)),Wt.set(i,a),a}var o=(i.f&512)==0&&!F&&P!==null&&(Nn||(P.f&512)!=0),s=(i.f&be)===0;Un(i)&&(o&&(i.f|=512),Bt(i)),o&&!s&&(Ht(i),Yn(i))}if(A?.has(e))return A.get(e);if(e.f&8388608)throw e.v;return e.v}function Yn(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(Ht(t),Yn(t))}function Xn(e){if(e.v===w)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Wt.has(t)||t.f&2&&Xn(t))return!0;return!1}function W(e){var t=F;try{return F=!0,e()}finally{F=t}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var Zn=[`touchstart`,`touchmove`];function Qn(e){return Zn.includes(e)}var $n=Symbol(`events`),er=new Set,tr=new Set,nr=null;function rr(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;nr=e;var o=0,s=nr===e&&e[$n];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[$n]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){le(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=P,d=L;I(null),R(null);try{for(var f,p=[];a!==null;){var m=a.assignedSlot||a.parentNode||a.host||null;try{var h=a[$n]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){f?p.push(e):f=e}if(e.cancelBubble||m===t||m===null)break;a=m}if(f){for(let e of p)queueMicrotask(()=>{throw e});throw f}}finally{e[$n]=t,delete e.currentTarget,I(u),R(d)}}}var ir=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function ar(e){return ir?.createHTML(e)??e}function or(e){var t=ln(`template`);return t.innerHTML=ar(e.replaceAll(`<!>`,`<!---->`)),t.content}function sr(e,t){var n=L;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function cr(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(T)return sr(E,null),E;i===void 0&&(i=or(a?e:`<!>`+e),n||(i=an(i)));var t=r||$t?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=an(t),s=t.lastChild;sr(o,s)}else sr(t,t);return t}}function lr(e,t){if(T){var n=L;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=E),Be();return}e!==null&&e.before(t)}function ur(e,t){return fr(e,t)}var dr=new Map;function fr(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){nn();var c=void 0,l=_n(()=>{var o=n??t.appendChild(rn());Ot(o,{pending:()=>{}},t=>{Xe({});var n=D;if(a&&(n.c=a),i&&(r.$$events=i),T&&sr(t,null),c=e(t,r)||{},T&&(L.nodes.end=E,E===null||E.nodeType!==8||E.data!==`]`))throw Le(),Ie;Ze()},s);var l=new Set,u=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=Qn(r);for(let e of[t,document]){var a=dr.get(e);a===void 0&&(a=new Map,dr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,rr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(ce(er)),tr.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=dr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,rr),r.delete(e),r.size===0&&dr.delete(n)):r.set(e,i)}tr.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return pr.set(c,l),c}var pr=new WeakMap;function mr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=mr(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function hr(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=mr(e))&&(r&&(r+=` `),r+=t);return r}function gr(e){return typeof e==`object`?hr(e):e??``}var _r=[...`
|
|
2
|
+
\r\f\xA0\v`];function vr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||_r.includes(r[o-1]))&&(s===r.length||_r.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function yr(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function br(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function xr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(br)),i&&c.push(...Object.keys(i).map(br));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=br(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=yr(r)),i&&(n+=yr(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Sr(e,t,n,r,i,a){var o=e.__className;if(T||o!==n||o===void 0){var s=vr(n,r,a);(!T||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e.__className=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Cr(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function wr(e,t,n,r){var i=e.__style;if(T||i!==t){var a=xr(t,r);(!T||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e.__style=t}else r&&(Array.isArray(r)?(Cr(e,n?.[0],r[0]),Cr(e,n?.[1],r[1],`important`)):Cr(e,n,r));return r}function Tr(e,t){return e===t||e?.[ke]===t}function Er(e={},t,n,r){var i=D.r,a=L;return vn(()=>{var o,s;return bn(()=>{o=s,s=r?.()||[],W(()=>{e!==n(...s)&&(t(e,...s),o&&Tr(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Tr(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}var Dr=class{div;marker;constructor(e,t,n,r){this.div=document.createElement(`div`),this.marker=e.createMarker(this.div,t,n,r)}insert(){this.marker.inserted()!=1&&this.marker.insert()}remove(){this.marker.inserted()!=0&&this.marker.remove()}update(e){this.marker.update(e)}},Or=class e{shown;id;lat;lng;rank;marker;constructor(t,n,r,i,a){if(new.target===e)throw Error(`Unsupported code`);this.shown=!0,this.id=t,this.lat=n,this.lng=r,this.rank=i,this.marker=a}};typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function kr(e){return-.5*(Math.cos(Math.PI*e)-1)}var Ar=class{animating;animationEasing;animationCallback;value;time;constructor(e){if(e.max<=e.min)throw Error(`Invalid min or max`);if(e.value<e.min||e.max<e.value)throw Error(`Invalid value`);this.animationEasing=e.easing,this.animationCallback=e.callback,this.animating=!1,this.value={current:e.value,start:e.value,end:e.value,min:e.min,max:e.max},this.time={start:0,end:0,span:e.timespan}}animationFrame(){let e=performance.now();if(e>this.time.end)this.value.current=this.value.end;else{let t=(e-this.time.start)/(this.time.end-this.time.start),n=this.animationEasing(t);this.value.current=this.value.start+(this.value.end-this.value.start)*n}if(this.animationCallback(this.value.current),this.value.current===this.value.end){this.animating=!1;return}window.requestAnimationFrame(this.animationFrame.bind(this))}target(e){if(e===this.value.end)return;this.value.start=this.value.current,this.value.end=e;let t=performance.now(),n=Math.abs(this.value.start-this.value.end),r=this.value.max-this.value.min;this.time.start=t,this.time.end=t+this.time.span*Math.sqrt(n/r),!this.animating&&(this.animating=!0,window.requestAnimationFrame(this.animationFrame.bind(this)))}set(e){if(e===this.value.end)return;this.value.current=e,this.value.start=e,this.value.end=e;let t=performance.now();this.time.start=t,this.time.end=t,window.requestAnimationFrame(this.animationCallback.bind(this,e))}end(){this.set(this.value.end)}expired(){return performance.now()>this.time.end}},jr=cr(`<div></div>`);function Mr(e,t){Xe(t,!0);let n=W(()=>t.id),r=W(()=>t.element),i=W(()=>t.style),a=W(()=>t.dimensions),o=W(()=>t.initialize),s={setDisplayed:te,getDisplayed:ne,setSuppressed:ie,setCollapsed:ae,getCollapsed:oe,setScale:ce};function c(){return s}let l,u=a.width,d=a.height,f=a.padding,p=i?.background??`darkgreen`,m=i?.radius??8,h=i?.shadow??`0px 2px 2px rgba(0, 0, 0, 0.5)`,g=j(!1),ee=!1;function te(e){e==1&&(l&&r&&r.parentElement!=l&&l.appendChild(r),ee==0&&o&&r&&(ee=!0,setTimeout(async()=>await o(n,r),0))),e!=U(g)&&(M(g,e,!0),e==0&&y.end())}function ne(){return U(g)}let re=j(!0);function ie(e){e!=U(re)&&(M(re,e,!0),e&&(se=_,y.set(_)))}let v=j(!0);function ae(e){e!=U(v)&&(M(v,e,!0),y.target(U(v)?0:se))}function oe(){return U(g)?y.expired():!0}let se=_,y=new Ar({value:_,min:0,max:1,timespan:75,easing:kr,callback:le});function ce(e){se=e,y.target(e)}function le(e){l.style.scale=e.toString(),l.style.filter=`brightness(${ue(e)})`}function ue(e){return .25+.75*e}var de={invoke:c},b=jr();let fe;return Er(b,e=>l=e,()=>l),xn(e=>{Sr(b,1,gr([`pin`,U(g)&&`displayed`,U(re)&&`suppressed`]),`svelte-10kxbrm`),fe=wr(b,``,fe,e)},[()=>({width:`${u}px`,height:`${d}px`,padding:`${f}px`,"border-radius":`${m}px`,"background-color":`rgb(from ${p} r g b / 1)`,"box-shadow":h,scale:_,filter:`brightness(${ue(_)})`})]),lr(e,b),Ze(de)}var Nr=class extends Or{width;height;zoom;component;constructor(e,t,n,r,i,a){super(t,n,r,i,new Dr(e,n,r,i)),this.width=a.dimensions.width,this.height=a.dimensions.height,this.zoom=NaN,this.component=ur(Mr,{target:this.marker.div,props:a})}get zIndex(){return Number.isNaN(this.zoom)?this.rank:Math.round(-this.zoom*10)+ne}},Pr=class{animating;animationTimestamp;animationEnd;animationCallback;speed;value;constructor(e){this.animating=!1,this.animationTimestamp=0,this.animationEnd=0,this.animationCallback=e.callback,this.speed={current:0,spring:{stiffness:e.stiffness,damping:2*Math.sqrt(e.stiffness)}},this.value={current:e.value,target:e.value,precision:e.precision,min:e.min,max:e.max}}animationFrame(){try{let e=performance.now(),t=e-this.animationTimestamp;if(this.animationTimestamp=e,e>=this.animationEnd){this.speed.current=0,this.value.current=this.value.target;return}let n=this.value.target-this.value.current;if(Math.abs(n)<this.value.precision){this.speed.current=0,this.value.current=this.value.target;return}let r=n*this.speed.spring.stiffness-this.speed.spring.damping*this.speed.current;if(this.speed.current+=r*t,this.value.current+=this.speed.current*t,this.value.current<this.value.min){this.value.current=this.value.target,this.speed.current=0;return}if(this.value.current>this.value.max){this.value.current=this.value.target,this.speed.current=0;return}}finally{if(this.animationCallback(this.value.current),this.value.current===this.value.target){this.animating=!1;return}window.requestAnimationFrame(this.animationFrame.bind(this))}}target(e){if(e===this.value.target)return;let t=Math.sqrt(2*Math.abs(e-this.value.current)/this.speed.spring.stiffness);this.animationEnd=performance.now()+t,this.value.target=e,!this.animating&&(this.animating=!0,this.animationTimestamp=performance.now(),window.requestAnimationFrame(this.animationFrame.bind(this)))}set(e){e!==this.value.target&&(this.animationEnd=performance.now(),this.value.current=e,this.value.target=e,this.speed.current=0,window.requestAnimationFrame(this.animationCallback.bind(this,e)))}end(){this.set(this.value.target)}expired(){return performance.now()>this.animationEnd}};function Fr(e,t,n){if(e<=0||t<=0)return{x:0,y:0};let r=e/2,i=t/2,a=Math.sqrt(r*r+i*i),o=Math.atan(i/r)*(180/Math.PI),s=n*(Math.PI/180);return n<180?n<90?n<o?{x:0,y:a*Math.sin(s)-i}:{x:a*Math.cos(s)-r,y:0}:n<180-o?{x:a*Math.cos(s)-r,y:0}:{x:-e,y:a*Math.sin(s)-i}:n<270?n<180+o?{x:-e,y:a*Math.sin(s)-i}:{x:a*Math.cos(s)-r,y:-t}:n<360-o?{x:a*Math.cos(s)-r,y:-t}:{x:0,y:a*Math.sin(s)-i}}var Ir=cr(`<div><div class="element pointer svelte-1no6o2a"></div> <div class="element bubble svelte-1no6o2a"><div class="element body svelte-1no6o2a"></div></div></div>`);function Lr(e,t){Xe(t,!0);let n=W(()=>t.id),r=W(()=>t.element),i=W(()=>t.style),a=W(()=>t.dimensions),o=W(()=>t.initialize),s={setDisplayed:ge,getDisplayed:x,setCollapsed:_e,getCollapsed:ve,getExpanded:ye,setAngle:Oe};function c(){return s}let l,u,d,f,p=Math.min(4,1+3*(a.width*a.height)/65536),m=i?.filter??`drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.5))`,h=a.width+2*a.padding,g=a.height+2*a.padding,ee=a.padding,ne=a.width,re=a.height,ie=i?.radius??0,_=a.width,v=a.height,ae=Math.min(i?.radius??8,Math.min(_,v)/2),oe=Math.min(1,2*ae/Math.min(v,_)),se=i?.background??`white`,y=a.padding*2,ce=a.padding*.5*oe,le=i?.background??`white`,ue=g<h?g/h:1,de=h<g?h/g:1,b=Math.min(h,g)/2,fe=b*Math.SQRT2,pe=15*Math.SQRT2,me=!1,he=j(!1);function ge(e){e!=U(he)&&(M(he,e,!0),e==1&&(r&&r.parentElement!=u&&u.appendChild(r),me==0&&o&&r&&(me=!0,setTimeout(async()=>await o(n,r),0))),e==0&&(be.end(),Te.end(),De.end()))}function x(){return U(he)}let S=j(!0);function _e(e){e!=U(S)&&(M(S,e,!0),be.target(U(S)?0:1))}function ve(){return U(he)?be.expired():!0}function ye(){return U(he)?be.expired():!1}let be=new Ar({value:0,min:0,max:1,timespan:125*Math.cbrt(p),easing:kr,callback:xe});function xe(e){l.style.opacity=`${e}`,l.style.scale=`${e}`,u.style.opacity=`${e}`}let Se=NaN,Ce=j(!1),we=-h/2,Te=new Pr({value:-h/2,min:-h,max:0,precision:1,stiffness:te/p,callback:ke}),Ee=-g/2,De=new Pr({value:-g/2,min:-g,max:0,precision:1,stiffness:te/p,callback:C});function Oe(e,t){if(Number.isNaN(e)){Se=NaN,M(Ce,!1);return}if(U(Ce)==0||t==1){M(Ce,!0),Se=e;let t=Fr(h,g,e);Te.set(Math.round(t.x)),De.set(Math.round(t.y));return}if(Se!=e){Se=e;let t=Fr(h,g,e);Te.target(Math.round(t.x)),De.target(Math.round(t.y));return}}function ke(e){we=e,Ae(we,Ee)}function C(e){Ee=e,Ae(we,Ee)}function Ae(e,t){let n=e+h/2,r=t+g/2,i=n*ue,a=r*de,o=Math.sqrt(i*i+a*a),s=(o-b)/(fe-b),c=Math.atan2(a,i)/Math.PI*180-45,l=15+s*(pe-15),u=o<b?o/b:1,p=.5*((1+.5*oe)*s),m=e+ee*(1-i/b*p),te=t+ee*(1-a/b*p);f.style.transform=`scale(${u}) rotate(${c}deg) skew(${l}deg, ${l}deg)`,d.style.transform=`translate(${Math.round(m)}px, ${Math.round(te)}px)`}var je={invoke:c},Me=Ir();let Ne;var Pe=sn(Me);let Fe;Er(Pe,e=>f=e,()=>f);var Ie=cn(Pe,2);let w;var Le=sn(Ie);let Re;return Er(Le,e=>u=e,()=>u),Ve(Ie),Er(Ie,e=>d=e,()=>d),Ve(Me),Er(Me,e=>l=e,()=>l),xn(()=>{Sr(Me,1,gr([`element anchor`,U(he)&&`displayed`]),`svelte-1no6o2a`),Ne=wr(Me,``,Ne,{filter:m}),Fe=wr(Pe,``,Fe,{width:`${y}px`,height:`${y}px`,"border-radius":`${ce}px`,"background-color":`rgb(from ${le} r g b / 1)`}),w=wr(Ie,``,w,{width:`${_}px`,height:`${v}px`,"border-radius":`${ae}px`,"background-color":`rgb(from ${se} r g b / 1)`}),Re=wr(Le,``,Re,{width:`${ne}px`,height:`${re}px`,"border-radius":`${ie}px`})}),lr(e,Me),Ze(je)}var Rr=class extends Or{width;height;zoom;angle;directions;component;constructor(e,t,n,r,i,a){super(t,n,r,i,new Dr(e,n,r,i)),this.width=a.dimensions.width+a.dimensions.padding*2,this.height=a.dimensions.height+a.dimensions.padding*2,this.zoom=NaN,this.angle=NaN,this.directions=[],this.component=ur(Lr,{target:this.marker.div,props:a})}get zIndex(){return Number.isNaN(this.zoom)?this.rank:Math.round(-this.zoom*10)+re}},zr=class extends Or{width;height;padding;angle;component;constructor(e,t,n,r,i,a){super(t,n,r,i,new Dr(e,n,r,ie)),this.width=a.dimensions.width,this.height=a.dimensions.height,this.padding=a.dimensions.padding,this.angle=NaN,this.shown=!1,this.component=ur(Lr,{target:this.marker.div,props:a})}get zIndex(){return ie}},Br=class{id;state=void 0;pin;tooltip;popup;constructor(e,t){let n=t.properites.id,r=t.properites.lat,i=t.properites.lng,a=t.properites.rank,o=t.properites.pin,s=t.properites.tooltip,c=t.properites.popup;this.id=n,this.pin=new Nr(e,n,r,i,a,o),this.tooltip=new Rr(e,n,r,i,a,s),this.popup=c?new zr(e,n,r,i,a,c):void 0}},Vr=4,Hr=class{pins=new Set;pinMaxWidth=0;pinMaxHeight=0;pinFade=!1;pinZoomMax=Vr;pinZoomDelta=Vr;set configuration(e){this.pinFade=e?.pin?.fade??!0,this.pinZoomMax=e?.pin?.maxZoom??Vr,this.pinZoomDelta=this.pinZoomMax}insert(e,t){this.update(e,t),this.pins.add(e)}update(e,t){e.zoom=t?.zoom??NaN,e.marker.update(e.zIndex)}remove(e){e.shown=!0,e.zoom=NaN,e.component.invoke().setCollapsed(!1),e.component.invoke().setSuppressed(!0),e.component.invoke().setDisplayed(!1),e.marker.update(e.zIndex),e.marker.remove(),this.pins.delete(e)}clear(){this.pins.forEach(e=>e.marker.remove()),this.pins.clear()}refresh(){let e=Array.from(this.pins);this.pinMaxWidth=e.reduce((e,t)=>Math.max(e,t.width),0),this.pinMaxHeight=e.reduce((e,t)=>Math.max(e,t.height),0),this.pinZoomDelta=Math.max(1,this.pinZoomMax-Math.log10(e.length))}render(e,t){let n=e.zoom,r=t.size,i=ee.offset(e,r,{top:this.pinMaxHeight,bottom:this.pinMaxHeight,right:this.pinMaxWidth,left:this.pinMaxWidth});for(let e of this.pins)i.contains(e.lat,e.lng)?Number.isNaN(e.zoom)?(e.component.invoke().setDisplayed(!0),e.component.invoke().setSuppressed(!0),e.component.invoke().setCollapsed(!1),e.marker.insert()):(e.component.invoke().setSuppressed(!1),e.shown&&n<e.zoom&&e.zoom<n+this.pinZoomDelta?(e.component.invoke().setDisplayed(!0),e.component.invoke().setCollapsed(!1),e.component.invoke().setScale(this.pinFade?Math.max(0,1-(e.zoom-n)*.2):1),e.marker.insert()):(e.component.invoke().setCollapsed(!0),e.component.invoke().getCollapsed()&&(e.component.invoke().setDisplayed(!1),e.marker.remove()))):(e.component.invoke().setDisplayed(!1),e.marker.remove())}},Ur=class{tooltips=new Set;tooltipMaxWidth=0;tooltipMaxHeight=0;insert(e,t){this.update(e,t),this.tooltips.add(e)}update(e,t){t?(e.zoom=t.zoom,e.directions=t.directions):(e.zoom=NaN,e.directions=[]),e.marker.update(e.zIndex)}remove(e){e.shown=!0,e.zoom=NaN,e.angle=NaN,e.directions=[],e.component.invoke().setAngle(NaN),e.component.invoke().setCollapsed(!0),e.component.invoke().setDisplayed(!1),e.marker.update(e.zIndex),e.marker.remove(),this.tooltips.delete(e)}clear(){this.tooltips.forEach(e=>e.marker.remove()),this.tooltips.clear()}refresh(){let e=Array.from(this.tooltips);this.tooltipMaxWidth=e.reduce((e,t)=>Math.max(e,t.width),0),this.tooltipMaxHeight=e.reduce((e,t)=>Math.max(e,t.height),0)}render(e,t){let n=e.zoom,r=t.size,i=ee.offset(e,r,{top:this.tooltipMaxHeight,bottom:this.tooltipMaxHeight,right:this.tooltipMaxWidth,left:this.tooltipMaxWidth});for(let e of this.tooltips)if(i.contains(e.lat,e.lng))if(Number.isNaN(e.zoom)==0&&e.shown&&e.zoom<=n){let t=e.directions.findLast(e=>e.zoom<=n)?.angle;if(t==null)throw Error(`Failed to find angle`);e.angle=t,e.component.invoke().setDisplayed(!0),e.component.invoke().setCollapsed(!1),e.component.invoke().setAngle(t),e.marker.insert()}else e.component.invoke().setCollapsed(!0),e.component.invoke().getCollapsed()&&(e.component.invoke().setDisplayed(!1),e.marker.remove());else e.component.invoke().setDisplayed(!1),e.marker.remove()}},Wr=class{popups=new Set;pan=!0;set configuration(e){this.pan=e?.popup?.pan??!0}insert(e){this.popups.add(e)}remove(e){e.angle=NaN,e.shown=!1,e.marker.remove(),e.component.invoke().setAngle(NaN),e.component.invoke().setCollapsed(!0),e.component.invoke().setDisplayed(!1),this.popups.delete(e)}clear(){this.popups.forEach(e=>e.marker.remove()),this.popups.clear()}show(e,t){if(!e.popup||!e.tooltip||!e.pin||(e.pin.shown=!1,e.tooltip.shown=!1,e.popup.angle=e.tooltip.angle,e.popup.shown=!0,this.pan==0))return;let n=e.popup,r=t.getViewport(),i=r.bounds,a=r.zoom,o=t.getParameters().size*2**a,s=u(i.ne.lat,i.sw.lng,o),c=u(i.sw.lat,i.ne.lng,o),l=c.x-s.x,d=c.y-s.y,f=n.width+n.padding*8,p=n.height+n.padding*8,m=u(n.lat,n.lng,o),h=Fr(f,p,e.tooltip.angle),g=m.x+h.x,ee=g+f,te=m.y+h.y,ne=te+p,re=g-s.x,ie=c.x-ee,_=te-s.y,v=c.y-ne,ae=0;l<f?ae=(re-ie)/2:(re<0&&(ae=re),ie<0&&(ae=-ie));let oe=0;d<p?oe=(_-v)/2:(_<0&&(oe=_),v<0&&(oe=-v)),(ae!=0||oe!=0)&&t.panBy(ae,oe)}hide(e){!e.popup||!e.tooltip||!e.pin||(e.pin.shown=!0,e.tooltip.shown=!0,e.popup.shown=!1)}render(){for(let e of this.popups)e.shown?(e.component.invoke().setDisplayed(!0),e.component.invoke().setCollapsed(!1),e.component.invoke().setAngle(e.angle,!0),e.marker.insert()):(e.component.invoke().setCollapsed(!0),e.component.invoke().getCollapsed()&&(e.component.invoke().setDisplayed(!1),e.marker.remove()))}},Gr=class{provider;pinManager;tooltipManager;popupManager;elementsStore;constructor(e){this.provider=e,this.pinManager=new Hr,this.tooltipManager=new Ur,this.popupManager=new Wr,this.elementsStore=new Map}set configuration(e){this.pinManager.configuration=e,this.popupManager.configuration=e}clearElements(){this.elementsStore.clear(),this.pinManager.clear(),this.tooltipManager.clear(),this.popupManager.clear()}removeElements(e){for(let t of e){let e=this.elementsStore.get(t.properites.id);e!=null&&(this.pinManager.remove(e.pin),this.tooltipManager.remove(e.tooltip),e.popup!=null&&this.popupManager.remove(e.popup))}this.pinManager.refresh(),this.tooltipManager.refresh()}updateElements(e){for(let t of e){let e=this.elementsStore.get(t.properites.id);e!=null&&(this.pinManager.update(e.pin,t.state),this.tooltipManager.update(e.tooltip,t.state))}}insertElements(e,t){for(let n of e){let e=this.elementsStore.get(n.properites.id);e??(e=new Br(this.provider,n),e.tooltip.marker.div.addEventListener(`click`,e=>t(e,n.properites.id)),this.elementsStore.set(n.properites.id,e)),this.pinManager.insert(e.pin,n.state),this.tooltipManager.insert(e.tooltip,n.state),e.popup!=null&&this.popupManager.insert(e.popup)}this.pinManager.refresh(),this.tooltipManager.refresh()}renderElements(e,t){this.popupManager.render(),this.tooltipManager.render(e,t),this.pinManager.render(e,t)}showPopup(e){let t=this.elementsStore.values();for(let n of t)n.id==e?this.popupManager.show(n,this.provider):this.popupManager.hide(n)}hidePopup(e){let t=this.elementsStore.get(e);t!=null&&this.popupManager.hide(t)}hidePopups(){let e=this.elementsStore.values();for(let t of e)this.popupManager.hide(t)}},Kr='(function(){var e=class{methods;constructor(e){this.methods=e}listen(){self.onmessage=this.onmessage.bind(this)}async onmessage(e){let{id:t,method:n,args:r}=e.data;try{let e=this.methods[n];if(typeof e!=`function`)throw Error(`Unknown method: ${n}`);let i={id:t,result:await e(...r)};self.postMessage(i)}catch(e){let n={id:t,error:e instanceof Error?e.message:String(e)};self.postMessage(n)}}},t=e=>new Promise(t=>setTimeout(t,e));async function n(e,n){let r=0,i=Math.max(1,n?.retry?.times??1);for(;r<i;)try{return{data:await e(),error:null}}catch(e){if(r++,r==i){if(e instanceof Error)return(!n?.exceptions||n.exceptions.some(t=>e instanceof t)==0)&&n?.catch?.(e),{data:null,error:e};throw n?.catch?.(e),e}else n?.retry?.delay&&await t(n.retry.delay)}throw Error(`Unreachable code`)}async function r(e,t,r,i,a){let o=await n(async()=>await fetch(e,{...r,method:`POST`,body:t?JSON.stringify(t):void 0}),{retry:{times:i,delay:a}});if(o.error)throw o.error;let s=o.data;if(!s.ok)throw Error(await s.text());return await s.json()}var i=[0,30,60,90,120,150,180,210,240,270,300,330],a=`,`;function o(e,t){return parseFloat(e[t]+e[t+1]+`.`+e[t+2])}function s(e,t){return i[parseInt(e[t],16)]}function c(e){if(!e||e.length===0)return[];let t=[],n=e.split(a);for(let e=0;e<n.length;e++){let r=n[e],i=o(r,0),a=[];for(let e=3;e<r.length;e+=4){let t=o(r,e),n=s(r,e+3);a.push({zoom:t,angle:n})}t.push({zoom:i,directions:a})}return t}new e({async fetch(e){let t=self?.location.host.startsWith(`localhost`)||self?.location.host.startsWith(`127.0.0.1`),n=await r(`https://maps.api.arenarium.dev/states`,e,{headers:{"Cache-Control":t?`no-cache`:``}},3,500);return{states:c(n.states),jwt:n.jwt}}}).listen()})();',qr=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Kr],{type:`text/javascript;charset=utf-8`});function Jr(e){let t;try{if(t=qr&&(self.URL||self.webkitURL).createObjectURL(qr),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Kr),{name:e?.name})}}var Yr=e=>new Promise(t=>setTimeout(t,e));async function Xr(e,t){let n=0,r=Math.max(1,t?.retry?.times??1);for(;n<r;)try{return{data:await e(),error:null}}catch(e){if(n++,n==r){if(e instanceof Error)return(!t?.exceptions||t.exceptions.some(t=>e instanceof t)==0)&&t?.catch?.(e),{data:null,error:e};throw t?.catch?.(e),e}else t?.retry?.delay&&await Yr(t.retry.delay)}throw Error(`Unreachable code`)}async function Zr(e,t,n,r,i){let a=await Xr(async()=>await fetch(e,{...n,method:`POST`,body:t?JSON.stringify(t):void 0}),{retry:{times:r,delay:i}});if(a.error)throw a.error;let o=a.data;if(!o.ok)throw Error(await o.text());return await o.json()}async function Qr(e,t,n,r,i){let a=await Xr(async()=>await fetch(e,{...n,method:`PUT`,body:t?JSON.stringify(t):void 0}),{retry:{times:r,delay:i}});if(a.error)throw a.error;let o=a.data;if(!o.ok)throw Error(await o.text())}var $r=14097894508562428199n,G=13011662864482103923n,ei=11160318154034397263n,ti=14504361325974414679n,K=18446744073709551615n;function q(e){return e&K}function J(e,t){return t===0?e&K:(e&=K,(e>>BigInt(t)|e<<BigInt(64-t))&K)}function ni(e,t){return e&=K,(e>>BigInt(t)|e<<BigInt(64-t))&K}function ri(e){return q(e^e>>47n)}function Y(e,t=0){let n=0n;for(let r=0;r<8;r++)t+r<e.length&&(n|=BigInt(e[t+r])<<BigInt(r*8));return n&K}function ii(e,t=0){let n=0n;for(let r=0;r<4;r++)t+r<e.length&&(n|=BigInt(e[t+r])<<BigInt(r*8));return n&4294967295n}function ai(e){let t=11376068507788127593n,n=(e.first^e.second)*t&K;n^=n>>47n,n&=K;let r=(e.second^n)*t&K;return r^=r>>47n,r=r*t&K,r}function oi(e,t){return ai({first:e,second:t})}function si(e){let t=e.length;if(t>8){let n=Y(e),r=Y(e,t-8);return(oi(n,ni(r+BigInt(t)&K,t))^r)&K}if(t>=4){let n=ii(e);return oi(BigInt(t)+(n<<3n)&K,ii(e,t-4))}if(t>0){let n=BigInt(e[0]),r=BigInt(e[t>>1]),i=BigInt(e[t-1]),a=q(n+(r<<8n)),o=q(BigInt(t)+(i<<2n));return q(ri(q(a*ei)^q(o*ti))*ei)}return ei}function ci(e){let t=e.length,n=q(Y(e)*G),r=Y(e,8),i=q(Y(e,t-8)*ei),a=q(Y(e,t-16)*$r);return oi(q(J(q(n-r),43)+J(i,30)+a),q(n+J(r^ti,20)-i+BigInt(t)))}function li(e,t,n,r,i,a){i=q(i+e),a=J(q(a+i+r),21);let o=i;return i=q(i+t),i=q(i+n),a=q(a+J(i,44)),{first:q(i+r),second:q(a+o)}}function ui(e,t,n,r){return li(Y(e,t),Y(e,t+8),Y(e,t+16),Y(e,t+24),n,r)}function di(e){let t=e.length,n=Y(e,24),r=q(Y(e)+q((BigInt(t)+Y(e,t-16))*$r)),i=J(q(r+n),52),a=J(r,37);r=q(r+Y(e,8)),a=q(a+J(r,7)),r=q(r+Y(e,16));let o=q(r+n),s=q(i+J(r,31)+a);r=q(Y(e,16)+Y(e,t-32));let c=Y(e,t-8);i=J(q(r+c),52),a=J(r,37),r=q(r+Y(e,t-24)),a=q(a+J(r,7)),r=q(r+Y(e,t-16));let l=q(r+c);return q(ri(q(ri(q(q(o+q(i+J(r,31)+a))*ei+q(l+s)*$r))*$r+s))*ei)}function fi(e){let t;t=typeof e==`string`?new TextEncoder().encode(e):e;let n=t.length;if(n<=32)return n<=16?si(t):ci(t);if(n<=64)return di(t);let r=Y(t),i=q(Y(t,n-16)^G),a=q(Y(t,n-56)^$r),o=ui(t,n-64,BigInt(n),i),s=ui(t,n-32,q(BigInt(n)*G),$r);a=q(a+ri(o.second)*G),r=q(J(q(a+r),39)*G),i=q(J(i,33)*G);let c=n-1&-64,l=0;for(;c>0;)r=q(J(q(r+i+o.first+Y(t,l+16)),37)*G),i=q(J(q(i+o.second+Y(t,l+48)),42)*G),r^=s.second,i^=o.first,a=J(a^s.first,33),o=ui(t,l,q(o.second*G),q(r+s.first)),s=ui(t,l+32,q(a+s.second),i),[a,r]=[r,a],l+=64,c-=64;return oi(oi(o.first,s.first)+q(ri(i)*G)+a,oi(o.second,s.second)+r)}function pi(e){return fi(JSON.stringify(e)).toString()}var mi=e=>e<180?e<90?e<30?0:e==30?1:2:e<120?3:e==120?4:5:e<270?e<210?6:e==210?7:8:e<300?9:e==300?10:11,hi;function gi(e){return{lang:e?.lang??hi?.lang,message:e?.message,abortEarly:e?.abortEarly??hi?.abortEarly,abortPipeEarly:e?.abortPipeEarly??hi?.abortPipeEarly}}var _i;function vi(e){return _i?.get(e)}var yi;function bi(e){return yi?.get(e)}var xi;function Si(e,t){return xi?.get(e)?.get(t)}function Ci(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function X(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??Ci(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??Si(e.reference,c.lang)??(l?bi(c.lang):null)??r.message??vi(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function Z(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},gi())}}}function wi(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var Ti=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function Ei(e){return{kind:`transformation`,type:`args`,reference:Ei,async:!1,schema:e,"~run"(e,t){let n=e.value;return e.value=(...e)=>{let r=this.schema[`~run`]({value:e},t);if(r.issues)throw new Ti(r.issues);return n(...r.value)},e}}}function Di(e,t){return{kind:`validation`,type:`check`,reference:Di,async:!1,expects:null,requirement:e,message:t,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&X(this,`input`,e,t),e}}}function Oi(e,t){return{kind:`validation`,type:`length`,reference:Oi,async:!1,expects:`${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length!==this.requirement&&X(this,`length`,e,t,{received:`${e.value.length}`}),e}}}function ki(e,t){return{kind:`validation`,type:`max_value`,reference:ki,async:!1,expects:`<=${e instanceof Date?e.toJSON():Ci(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value<=this.requirement)&&X(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():Ci(e.value)}),e}}}function Ai(e,t){return{kind:`validation`,type:`min_length`,reference:Ai,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(e,t){return e.typed&&e.value.length<this.requirement&&X(this,`length`,e,t,{received:`${e.value.length}`}),e}}}function ji(e,t){return{kind:`validation`,type:`min_value`,reference:ji,async:!1,expects:`>=${e instanceof Date?e.toJSON():Ci(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value>=this.requirement)&&X(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():Ci(e.value)}),e}}}function Mi(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Ni(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Pi(){return{kind:`schema`,type:`any`,reference:Pi,expects:`any`,async:!1,get"~standard"(){return Z(this)},"~run"(e){return e.typed=!0,e}}}function Fi(e,t){return{kind:`schema`,type:`array`,reference:Fi,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return Z(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else X(this,`type`,e,t);return e}}}function Ii(e){return{kind:`schema`,type:`boolean`,reference:Ii,expects:`boolean`,async:!1,message:e,get"~standard"(){return Z(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:X(this,`type`,e,t),e}}}function Li(e,t){return{kind:`schema`,type:`custom`,reference:Li,expects:`unknown`,async:!1,check:e,message:t,get"~standard"(){return Z(this)},"~run"(e,t){return this.check(e.value)?e.typed=!0:X(this,`type`,e,t),e}}}function Ri(e){return{kind:`schema`,type:`function`,reference:Ri,expects:`Function`,async:!1,message:e,get"~standard"(){return Z(this)},"~run"(e,t){return typeof e.value==`function`?e.typed=!0:X(this,`type`,e,t),e}}}function zi(e,t){return{kind:`schema`,type:`literal`,reference:zi,expects:Ci(e),async:!1,literal:e,message:t,get"~standard"(){return Z(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:X(this,`type`,e,t),e}}}function Bi(e){return{kind:`schema`,type:`number`,reference:Bi,expects:`number`,async:!1,message:e,get"~standard"(){return Z(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:X(this,`type`,e,t),e}}}function Vi(e,t){return{kind:`schema`,type:`object`,reference:Vi,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return Z(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Ni(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=Mi(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(X(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else X(this,`type`,e,t);return e}}}function Q(e,t){return{kind:`schema`,type:`optional`,reference:Q,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return Z(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Ni(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Hi(e){return{kind:`schema`,type:`string`,reference:Hi,expects:`string`,async:!1,message:e,get"~standard"(){return Z(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:X(this,`type`,e,t),e}}}function Ui(e,t){return{kind:`schema`,type:`tuple`,reference:Ui,expects:`Array`,async:!1,items:e,message:t,get"~standard"(){return Z(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<this.items.length;r++){let i=n[r],a=this.items[r][`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else X(this,`type`,e,t);return e}}}function Wi(e){let t;if(e)for(let n of e)t?t.push(...n.issues):t=n.issues;return t}function Gi(e,t){return{kind:`schema`,type:`union`,reference:Gi,expects:wi(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,get"~standard"(){return Z(this)},"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed)if(o.issues)r?r.push(o):r=[o];else{n=o;break}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];X(this,`type`,e,t,{issues:Wi(r)}),e.typed=!0}else if(i?.length===1)return i[0];else X(this,`type`,e,t,{issues:Wi(i)});return e}}}function Ki(e,t,n){let r=e[`~run`]({value:t},gi(n));if(r.issues)throw new Ti(r.issues);return r.value}function $(...e){return{...e[0],pipe:e,get"~standard"(){return Z(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}var qi=$(Hi(),Oi(32)),Ji=$(Hi(),Ai(1)),Yi=Li(e=>e instanceof HTMLElement,`Must be an HTMLElement`),Xi=$(Ri(),Ei(Ui([Hi(),Yi]))),Zi=$(Vi({width:$(Bi(),ji(0)),height:$(Bi(),ji(0)),padding:$(Bi(),ji(0))}),Di(e=>Math.min(e.width,e.height)/e.padding>=4,`Minimum of width or height must be greater than or equal to 4 * padding`)),Qi=Vi({background:Q(Hi()),radius:Q($(Bi(),ji(0))),shadow:Q(Hi())}),$i=Vi({background:Q(Hi()),radius:Q($(Bi(),ji(0))),filter:Q(Hi())}),ea=Vi({id:$(Hi(),Ai(1)),rank:$(Bi(),ji(0)),lat:$(Bi(),ji(-90),ki(90)),lng:$(Bi(),ji(-180),ki(180)),tooltip:Vi({element:Yi,style:Q($i),dimensions:Q(Zi),initialize:Q(Xi)}),pin:Q(Vi({element:Q(Yi),style:Q(Qi),dimensions:Q(Zi),initialize:Q(Xi)})),popup:Q(Vi({element:Yi,style:Q($i),dimensions:Q(Zi),initialize:Q(Xi)}))}),ta=`1.3.13`,na=class{apiKey;apiJwt;markerStatesStore;markerStatesWorker;markerStatesWorkerClient;constructor(e,t){this.apiKey=e,this.apiJwt=t,this.markerStatesStore=new Map,this.markerStatesWorker=new Jr,this.markerStatesWorkerClient=new a(this.markerStatesWorker)}clearStates(){this.markerStatesStore.clear()}resetStates(e){for(let t=0;t<e.length;t++){let n=e[t];n.state=void 0}}async updateStates(e,t){if(e.length==0)return;if(e.length==1){e[0].state={zoom:0,directions:[{zoom:0,angle:mi(270)}]};return}e.sort((e,t)=>e.properites.id.localeCompare(t.properites.id));let n=await this.getStates(e,t);for(let t=0;t<e.length;t++){let r=e[t];r.state=n[t]}}async getStates(e,t){let n=e.map(e=>e.input),r=pi(n),i=this.markerStatesStore.get(r);if(i)return i;let a={mapSize:t.size,zoomMin:t.zoom.min,zoomMax:t.zoom.max,zoomScale:t.zoom.scale},o={key:this.apiKey,jwt:this.apiJwt,version:ta,input:n,parameters:a},s=await this.markerStatesWorkerClient.invoke(`fetch`,o);return s.jwt&&(this.apiJwt=s.jwt),this.markerStatesStore.set(r,s.states),s.states}},ra=class{static create(e,t,n){throw Error(`Must override static create method!`)}},ia=`1.3.13`,aa=`https://maps.api.arenarium.dev/auth`,oa=`https://maps.api.arenarium.dev/log`,sa=500,ca=class n extends ra{apiKey;mapProvider;mapStateProvider;markers;markerVisibilityManager;markerElementsManager;markerStatesManager;markerVisibilityProcessor;markerElementsProcessor;markerStateProcessor;markerStatesProcessDelay=sa;markerStatesProcessTimeout=void 0;constructor(t,n,r,a){super(),Ki(qi,t),Ki(Ji,n),this.apiKey=t,this.mapProvider=r,this.mapStateProvider=new i(this.mapProvider,this.detached.bind(this),this.error.bind(this),this.onMapMove.bind(this),this.onMapIdle.bind(this),this.onMapClick.bind(this)),this.markers=new Map,this.markerVisibilityManager=new ae,this.markerElementsManager=new Gr(this.mapProvider),this.markerStatesManager=new na(t,n),this.markerVisibilityProcessor=new e(this.onMarkersVisiblityProcess.bind(this)),this.markerElementsProcessor=new e(this.onMarkersRenderProcess.bind(this)),this.markerStateProcessor=new e(this.onMarkersStateProcess.bind(this)),this.update(a)}static async create(e,t,r){let i=(await Zr(aa,{key:e,version:ia})).jwt;if(!i)throw Error(`Failed to get api jwt`);return new n(e,i,t,r)}update(e){this.markerStatesProcessDelay=e?.process?.states?.delay??sa,this.markerVisibilityManager.configuration=e,this.markerElementsManager.configuration=e}clear(){this.markers.clear(),this.markerVisibilityManager.clearMarkers(),this.markerStatesManager.clearStates(),this.markerElementsManager.clearElements(),this.mapStateProvider.stop(),this.markerVisibilityProcessor.stop(),this.markerStateProcessor.stop(),this.markerElementsProcessor.stop()}detached(){return this.mapProvider.getContainer().parentElement==null}error(e,t){this.log(`error`,e,t)}async log(e,t,n){switch(e){case`info`:console.info(n);break;case`warning`:console.warn(n);break;case`error`:console.error(n);break}if(n instanceof Error!=0)try{await Qr(oa,{title:t,level:e,content:{version:ia,key:this.apiKey,name:n.name,message:n.message,cause:n.cause,stack:n.stack}})}catch(e){console.error(e)}}onMapMove(){this.markerVisibilityProcessor.run()}onMapIdle(){this.markerStatesProcessTimeout?window.clearTimeout(this.markerStatesProcessTimeout):this.markerStateProcessor.run(),this.markerStatesProcessTimeout=window.setTimeout(()=>{this.markerStateProcessor.run()},this.markerStatesProcessDelay)}onMapClick(){this.hidePopup()}onMapMarkerClick(e,t){e.stopPropagation(),this.showPopup(t)}async onMarkersVisiblityProcess(){try{if(this.detached())return!0;let e=this.mapProvider.getParameters(),t=this.mapProvider.getViewport(),n=await this.markerVisibilityManager.getMarkersDelta(e,t);return this.markerStatesManager.resetStates(n.remove),this.markerElementsManager.removeElements(n.remove),this.markerElementsManager.insertElements(n.insert,this.onMapMarkerClick.bind(this)),this.markerElementsProcessor.run(),this.mapStateProvider.idle()&&this.markerStateProcessor.run(),!1}catch(e){return this.clear(),this.error(`Process markers visibility error`,e),!0}}async onMarkersStateProcess(){try{if(this.detached())return!0;let e=this.mapProvider.getParameters(),t=this.markerVisibilityManager.getMarkers();return await this.markerStatesManager.updateStates(t,e),this.markerElementsManager.updateElements(t),this.markerElementsProcessor.run(),!1}catch(e){return this.clear(),this.error(`Process markers state error`,e),!0}}async onMarkersRenderProcess(){try{if(this.detached())return!0;let e=this.mapProvider.getParameters(),t=this.mapProvider.getViewport();return this.markerElementsManager.renderElements(t,e),!1}catch(e){return this.clear(),this.error(`Process markers render error`,e),!0}}getMarkers(e){let n=[],r=[];for(let t of e){let e=this.markers.get(t.id);e?n.push(e):r.push(t)}let i=this.mapProvider.getContainer(),a=e=>{let t=document.createElement(`div`);t.style.position=`absolute`,t.style.visibility=`hidden`,t.style.width=`max-content`,t.style.zIndex=`-1`;try{return t.appendChild(e),i.appendChild(t),t.getBoundingClientRect()}finally{i.removeChild(t)}},o=(e,t)=>{if(t)return t;if(e){let t=a(e);return{width:t.width,height:t.height,padding:2}}else return{width:16,height:16,padding:2}},s=(e,t)=>{if(t)return t;let n=a(e),r=n.width,i=n.height;return{width:r,height:i,padding:Math.min(Math.round(Math.min(r,i)/4),8)}};for(let e of r){let r=e.id,i=e.lat,a=e.lng,c=e.rank,l={id:r,initialize:e.pin?.initialize,element:e.pin?.element,style:e.pin?.style,dimensions:o(e.pin?.element,e.pin?.dimensions)},u={id:r,initialize:e.tooltip.initialize,element:e.tooltip.element,style:e.tooltip.style,dimensions:s(e.tooltip.element,e.tooltip.dimensions)},d;e.popup&&(d={id:r,initialize:e.popup.initialize,element:e.popup.element,style:e.popup.style,dimensions:s(e.popup.element,e.popup.dimensions)});let f=new t(r,i,a,c,l,u,d);n.push(f)}return n.forEach(e=>this.markers.set(e.properites.id,e)),n.sort((e,t)=>t.properites.rank-e.properites.rank),n}async updateMarkers(e){Ki(Fi(ea),e);try{let t=this.mapProvider.getParameters(),n=this.getMarkers(e);await this.markerVisibilityManager.updateMarkers(t,n),this.mapStateProvider.start(),this.markerVisibilityProcessor.run()}catch(e){throw this.clear(),this.error(`Failed to update markers`,e),e}}async removeMarkers(){try{this.clear()}catch(e){throw this.error(`Failed to remove markers`,e),e}}showPopup(e){if(!this.detached())try{this.markerElementsManager.showPopup(e)}catch(e){throw this.markerElementsManager.hidePopups(),this.error(`Failed to show popup`,e),e}finally{this.markerElementsProcessor.run()}}hidePopup(){if(!this.detached())try{this.markerElementsManager.hidePopups()}catch(e){throw this.error(`Failed to hide popup`,e),e}finally{this.markerElementsProcessor.run()}}};export{ca as MapManager};
|