@arenarium/maps 1.3.14 → 1.4.2

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 CHANGED
@@ -1,2 +1,2 @@
1
- .pin.svelte-10kxbrm{box-sizing:border-box;transform-origin:0 0;backface-visibility:hidden;will-change:scale;content-visibility:hidden;border-style:solid;display:none;position:absolute;transform:translate(-50%,-50%)}.pin.displayed.svelte-10kxbrm{display:initial;content-visibility:initial}.pin.svelte-10kxbrm{opacity:1}.pin.suppressed.svelte-10kxbrm{opacity:.5;box-shadow:none!important}.element.svelte-1no6o2a{box-sizing:border-box;transform-style:flat;transform-origin:0 0;width:0;height:0;position:absolute}.body.svelte-1no6o2a{cursor:pointer;width:max-content}.anchor.svelte-1no6o2a{opacity:0;will-change:opacity, scale;scale:0}.pointer.svelte-1no6o2a,.bubble.svelte-1no6o2a{will-change:transform}.body.svelte-1no6o2a{opacity:0;will-change:opacity}.anchor.svelte-1no6o2a{content-visibility:hidden;display:none}.anchor.displayed.svelte-1no6o2a{display:initial;content-visibility:initial}.body.svelte-1no6o2a{display:initial}.body.svelte-1no6o2a:hover{display:table}
1
+ .pin.svelte-10kxbrm{box-sizing:border-box;transform-origin:0 0;backface-visibility:hidden;will-change:scale, opacity;content-visibility:hidden;border-style:solid;justify-content:center;align-items:center;display:none;position:absolute;transform:translate(-50%,-50%)}.pin.displayed.svelte-10kxbrm{content-visibility:initial;display:flex}.element.svelte-1no6o2a{box-sizing:border-box;transform-style:flat;transform-origin:0 0;width:0;height:0;position:absolute}.body.svelte-1no6o2a{cursor:pointer;width:max-content}.anchor.svelte-1no6o2a{opacity:0;will-change:opacity, scale;scale:0}.pointer.svelte-1no6o2a,.bubble.svelte-1no6o2a{will-change:transform}.body.svelte-1no6o2a{opacity:0;will-change:opacity}.anchor.svelte-1no6o2a{content-visibility:hidden;display:none}.anchor.displayed.svelte-1no6o2a{display:initial;content-visibility:initial}.body.svelte-1no6o2a{display:initial}.body.svelte-1no6o2a:hover{display:table}
2
2
  /*$vite$:1*/
package/dist/main.d.ts CHANGED
@@ -11,31 +11,25 @@ export declare class MapManager extends IMapManager {
11
11
  private mapProvider;
12
12
  private mapStateProvider;
13
13
  private markers;
14
- private markerVisibilityManager;
15
- private markerElementsManager;
16
- private markerStatesManager;
17
- private markerVisibilityProcessor;
18
- private markerElementsProcessor;
19
- private markerStateProcessor;
20
- private markerStatesProcessDelay;
21
- private markerStatesProcessTimeout;
14
+ private markersElementRenderer;
15
+ private markersElementManager;
16
+ private markersStateManager;
22
17
  private constructor();
23
18
  static create(apiKey: string, mapProvider: MapProvider, mapConfiguration?: MapConfiguration): Promise<MapManager>;
24
- update(configuration?: MapConfiguration): void;
25
- private clear;
19
+ private static deprecated;
20
+ clear(): void;
26
21
  private detached;
27
22
  private error;
28
23
  private log;
29
24
  private onMapMove;
30
25
  private onMapIdle;
31
26
  private onMapClick;
32
- private onMapMarkerClick;
33
- private onMarkersVisiblityProcess;
34
- private onMarkersStateProcess;
35
- private onMarkersRenderProcess;
36
- private getMarkers;
27
+ private onMarkerClick;
28
+ private createMarkers;
29
+ private renderMarkers;
37
30
  updateMarkers(properties: MapMarkerProperties[]): Promise<void>;
38
31
  removeMarkers(): Promise<void>;
32
+ showTooltip(id: string): void;
39
33
  showPopup(id: string): void;
40
34
  hidePopup(): void;
41
35
  }
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
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&&lt.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&&lt.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};
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,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{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)}running(){return this.id!=null}},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.running()==0&&(this.interval.start(),this.provider.getContainer().addEventListener(`click`,this.onClick.bind(this)))}stop(){this.interval.running()==1&&(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=Array.isArray,o=Array.prototype.indexOf,s=Array.prototype.includes,c=Array.from,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.prototype,f=Array.prototype,p=Object.getPrototypeOf,m=Object.isExtensible,h=()=>{};function g(e){for(var t=0;t<e.length;t++)e[t]()}function _(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var v=1024,y=2048,b=4096,ee=8192,te=16384,x=32768,S=1<<25,ne=65536,re=1<<19,ie=1<<20,ae=65536,oe=1<<21,se=1<<22,C=1<<23,ce=Symbol(`$state`),w=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"};globalThis.document?.contentType;function le(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function ue(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function de(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function fe(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function pe(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function me(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var he={},T=Symbol();function ge(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function _e(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var E=!1,D;function O(e){if(e===null)throw ge(),he;return D=e}function ve(){return O(It(D))}function ye(e){if(E){if(It(D)!==null)throw ge(),he;D=e}}function be(e=1){if(E){for(var t=e,n=D;t--;)n=It(n);D=n}}function xe(e=!0){for(var t=0,n=D;;){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=It(n);e&&n.remove(),n=i}}function Se(e){return e===this.v}function Ce(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function we(e){return!Ce(e,this.v)}var Te=!1,Ee=!1,k=null;function De(e){k=e}function Oe(e,t=!1,n){k={p:k,i:!1,c:null,e:null,s:e,x:null,r:z,l:Ee&&!t?{s:null,u:null,$:[]}:null}}function ke(e){var t=k,n=t.e;if(n!==null){t.e=null;for(var r of n)Kt(r)}return e!==void 0&&(t.x=e),t.i=!0,k=t.p,e??{}}function Ae(){return!Ee||k!==null&&k.l===null}var je=[];function Me(){var e=je;je=[],g(e)}function Ne(e){if(je.length===0&&!He){var t=je;queueMicrotask(()=>{t===je&&Me()})}je.push(e)}function Pe(e){var t=z;if(t===null)return I.f|=C,e;if(!(t.f&32768)&&!(t.f&4))throw e;Fe(e,t)}function Fe(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 Ie=~(y|b|v);function A(e,t){e.f=e.f&Ie|t}function Le(e){e.f&512||e.deps===null?A(e,v):A(e,b)}function Re(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=ae,Re(t.deps))}function ze(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Re(e.deps),A(e,v)}var Be=!1,j=new Set,M=null,N=null,Ve=null,He=!1,Ue=!1,We=null,Ge=null,Ke=0,qe=1,Je=class e{id=qe++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=new Map;#r=new Map;#i=null;#a=[];#o=new Set;#s=new Set;#c=new Map;is_fork=!1;#l=!1;#u=new Set;#d(){return this.is_fork||this.#r.size>0}#f(){for(let n of this.#u)for(let r of n.#r.keys()){for(var e=!1,t=r;t.parent!==null;){if(this.#c.has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}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)A(n,y),this.schedule(n);for(n of t.m)A(n,b),this.schedule(n)}}#p(){if(Ke++>1e3&&(j.delete(this),Ye()),!this.#d()){for(let e of this.#o)this.#s.delete(e),A(e,y),this.schedule(e);for(let e of this.#s)A(e,b),this.schedule(e)}let t=this.#a;this.#a=[],this.apply();var n=We=[],r=[],i=Ge=[];for(let e of t)try{this.#m(e,n,r)}catch(t){throw nt(e),t}if(M=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(We=null,Ge=null,this.#d()||this.#f()){this.#h(r),this.#h(n);for(let[e,t]of this.#c)tt(e,t)}else{this.#n.size===0&&j.delete(this),this.#o.clear(),this.#s.clear();for(let e of this.#e)e(this);this.#e.clear(),Ze(r),Ze(n),this.#i?.resolve()}var o=M;if(this.#a.length>0){let e=o??=this;e.#a.push(...this.#a.filter(t=>!e.#a.includes(t)))}o!==null&&(j.add(o),o.#p()),j.has(this)||this.#g()}#m(e,t,n){e.f^=v;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^=v:i&4?t.push(r):Te&&i&16777224?n.push(r):Sn(r)&&(i&16&&this.#s.add(r),Dn(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}}}#h(e){for(var t=0;t<e.length;t+=1)ze(e[t],this.#o,this.#s)}capture(e,t,n=!1){t!==T&&!this.previous.has(e)&&this.previous.set(e,t),e.f&8388608||(this.current.set(e,[e.v,n]),N?.set(e,e.v))}activate(){M=this}deactivate(){M=null,N=null}flush(){try{Ue=!0,M=this,this.#p()}finally{Ke=0,Ve=null,We=null,Ge=null,Ue=!1,M=null,N=null,xt.clear()}}discard(){for(let e of this.#t)e(this);this.#t.clear(),j.delete(this)}#g(){for(let c of j){var e=c.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(c.current.has(r)){var n=c.current.get(r)[0];if(e&&i!==n)c.current.set(r,[i,a]);else continue}t.push(r)}var r=[...c.current.keys()].filter(e=>!this.current.has(e));if(r.length===0)e&&c.discard();else if(t.length>0){c.activate();var i=new Set,a=new Map;for(var o of t)Qe(o,r,i,a);if(c.#a.length>0){c.apply();for(var s of c.#a)c.#m(s,[],[]);c.#a=[]}c.deactivate()}}for(let e of j)e.#u.has(this)&&(e.#u.delete(this),e.#u.size===0&&!e.#d()&&(e.activate(),e.#p()))}increment(e,t){let n=this.#n.get(t)??0;if(this.#n.set(t,n+1),e){let e=this.#r.get(t)??0;this.#r.set(t,e+1)}}decrement(e,t,n){let r=this.#n.get(t)??0;if(r===1?this.#n.delete(t):this.#n.set(t,r-1),e){let e=this.#r.get(t)??0;e===1?this.#r.delete(t):this.#r.set(t,e-1)}this.#l||n||(this.#l=!0,Ne(()=>{this.#l=!1,this.flush()}))}transfer_effects(e,t){for(let t of e)this.#o.add(t);for(let e of t)this.#s.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=_()).promise}static ensure(){if(M===null){let t=M=new e;Ue||(j.add(M),He||Ne(()=>{M===t&&t.flush()}))}return M}apply(){if(!Te||!this.is_fork&&j.size===1){N=null;return}N=new Map;for(let[e,[t]]of this.current)N.set(e,t);for(let n of j)if(!(n===this||n.is_fork)){var e=!1,t=!1;if(n.id<this.id)for(let[r,[,i]]of n.current)i||(e||=this.current.has(r),t||=!this.current.has(r));if(e&&t)this.#u.add(n);else for(let[e,t]of n.previous)N.has(e)||N.set(e,t)}}schedule(e){if(Ve=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(We!==null&&t===z&&(Te||(I===null||!(I.f&2))&&!Be))return;if(n&96){if(!(n&1024))return;t.f^=v}}this.#a.push(t)}};function Ye(){try{ue()}catch(e){Fe(e,Ve)}}var Xe=null;function Ze(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Sn(r)&&(Xe=new Set,Dn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&on(r),Xe?.size>0)){xt.clear();for(let e of Xe){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Xe.has(n)&&(Xe.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Dn(n)}}Xe.clear()}}Xe=null}}function Qe(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?Qe(i,t,n,r):e&4194320&&!(e&2048)&&$e(i,t,r)&&(A(i,y),et(i))}}function $e(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(s.call(t,r))return!0;if(r.f&2&&$e(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function et(e){M.schedule(e)}function tt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),A(e,v);for(var n=e.first;n!==null;)tt(n,t),n=n.next}}function nt(e){A(e,v);for(var t=e.first;t!==null;)nt(t),t=t.next}function rt(e){let t=0,n=Ct(0),r;return()=>{Wt()&&(W(n),Xt(()=>(t===0&&(r=G(()=>e(()=>Et(n)))),t+=1,()=>{Ne(()=>{--t,t===0&&(r?.(),r=void 0,Et(n))})})))}}var it=ne|re;function at(e,t,n,r){new ot(e,t,n,r)}var ot=class{parent;is_pending=!1;transform_error;#e;#t=E?D: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=rt(()=>(this.#m=Ct(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=z;t.b=this,t.f|=128,n(e)},this.parent=z.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Qt(()=>{if(E){let e=this.#t;ve();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()},it),E&&(this.#e=D)}#g(){try{this.#a=$t(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=$t(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=$t(()=>e(this.#e)),Ne(()=>{var e=this.#c=document.createDocumentFragment(),t=Pt();e.append(t),this.#a=this.#x(()=>$t(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,sn(this.#o,()=>{this.#o=null}),this.#b(M))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=$t(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();ln(this.#a,e);let t=this.#n.pending;this.#o=$t(()=>t(this.#e))}else this.#b(M)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){ze(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=z,n=I,r=k;mn(this.#i),R(this.#i),De(this.#i.ctx);try{return Je.ensure(),e()}catch(e){return Pe(e),null}finally{mn(t),R(n),De(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&&sn(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,Ne(()=>{this.#d=!1,this.#m&&wt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(!t&&!n)throw e;this.#a&&=(rn(this.#a),null),this.#o&&=(rn(this.#o),null),this.#s&&=(rn(this.#s),null),E&&(O(this.#t),be(),O(xe()));var r=!1,i=!1;let a=()=>{if(r){_e();return}r=!0,i&&me(),this.#s!==null&&sn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){Fe(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return $t(()=>{var t=z;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return Fe(e,this.#i.parent),null}}))};Ne(()=>{var t;try{t=this.transform_error(e)}catch(e){Fe(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>Fe(e,this.#i&&this.#i.parent)):o(t)})}};function st(e,t,n,r){let i=Ae()?dt:pt;var a=e.filter(e=>!e.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=z,s=ct(),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||Fe(e,o)}lt()}if(n.length===0){c.then(()=>l(t.map(i)));return}var u=ut();function d(){Promise.all(n.map(e=>ft(e))).then(e=>l([...t.map(i),...e])).catch(e=>Fe(e,o)).finally(()=>u())}c?c.then(()=>{s(),d(),lt()}):d()}function ct(){var e=z,t=I,n=k,r=M;return function(i=!0){mn(e),R(t),De(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function lt(e=!0){mn(null),R(null),De(null),e&&M?.deactivate()}function ut(){var e=z,t=e.b,n=M,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(i=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,i)}}function dt(e){var t=2|y,n=I!==null&&I.f&2?I:null;return z!==null&&(z.f|=re),{ctx:k,deps:null,effects:null,equals:Se,f:t,fn:e,reactions:null,rv:0,v:T,wv:0,parent:n??z,ac:null}}function ft(e,t,n){let r=z;r===null&&le();var i=void 0,a=Ct(T),o=!I,s=new Map;return Yt(()=>{var t=z,n=_();i=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).finally(lt)}catch(e){n.reject(e),lt()}var c=M;if(o){if(t.f&32768)var l=ut();if(r.b.is_rendered())s.get(c)?.reject(w),s.delete(c);else{for(let e of s.values())e.reject(w);s.clear()}s.set(c,n)}let u=(e,n=void 0)=>{if(l&&l(n===w),!(n===w||t.f&16384)){if(c.activate(),n)a.f|=C,wt(a,n);else{a.f&8388608&&(a.f^=C),wt(a,e);for(let[e,t]of s){if(s.delete(e),e===c)break;t.reject(w)}}c.deactivate()}};n.promise.then(u,e=>u(null,e||`unknown`))}),Gt(()=>{for(let e of s.values())e.reject(w)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function pt(e){let t=dt(e);return t.equals=we,t}function mt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)rn(t[n])}}function ht(e){for(var t=e.parent;t!==null;){if(!(t.f&2))return t.f&16384?null:t;t=t.parent}return null}function gt(e){var t,n=z;mn(ht(e));try{e.f&=~ae,mt(e),t=wn(e)}finally{mn(n)}return t}function _t(e){var t=e.v,n=gt(e);if(!e.equals(n)&&(e.wv=xn(),(!M?.is_fork||e.deps===null)&&(e.v=n,M?.capture(e,t,!0),e.deps===null))){A(e,v);return}fn||(N===null?Le(e):(Wt()||M?.is_fork)&&N.set(e,n))}function vt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(w),t.teardown=h,t.ac=null,En(t,0),tn(t))}function yt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&Dn(t)}var bt=new Set,xt=new Map,St=!1;function Ct(e,t){return{f:0,v:e,reactions:null,equals:Se,rv:0,wv:0}}function P(e,t){let n=Ct(e,t);return hn(n),n}function F(e,t,n=!1){return I!==null&&(!L||I.f&131072)&&Ae()&&I.f&4325394&&(B===null||!s.call(B,e))&&pe(),wt(e,n?Ot(t):t,Ge)}function wt(e,t,n=null){if(!e.equals(t)){var r=e.v;fn?xt.set(e,t):xt.set(e,r),e.v=t;var i=Je.ensure();if(i.capture(e,r),e.f&2){let t=e;e.f&2048&&gt(t),N===null&&Le(t)}e.wv=xn(),Dt(e,y,n),Ae()&&z!==null&&z.f&1024&&!(z.f&96)&&(U===null?gn([e]):U.push(e)),!i.is_fork&&bt.size>0&&!St&&Tt()}return t}function Tt(){St=!1;for(let e of bt)e.f&1024&&A(e,b),Sn(e)&&Dn(e);bt.clear()}function Et(e){F(e,e.v+1)}function Dt(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ae(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===z)){var l=(c&y)===0;if(l&&A(s,t),c&2){var u=s;N?.delete(u),c&65536||(c&512&&(s.f|=ae),Dt(u,b,n))}else if(l){var d=s;c&16&&Xe!==null&&Xe.add(d),n===null?et(d):n.push(d)}}}}function Ot(e){if(typeof e!=`object`||!e||ce in e)return e;let t=p(e);if(t!==d&&t!==f)return e;var n=new Map,r=a(e),i=P(0),o=null,s=yn,c=e=>{if(yn===s)return e();var t=I,n=yn;R(null),bn(s);var r=e();return R(t),bn(n),r};return r&&n.set(`length`,P(e.length,o)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&de();var i=n.get(t);return i===void 0?c(()=>{var e=P(r.value,o);return n.set(t,e),e}):F(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=c(()=>P(T,o));n.set(t,e),Et(i)}}else F(r,T),Et(i);return!0},get(t,r,i){if(r===ce)return e;var a=n.get(r),s=r in t;if(a===void 0&&(!s||u(t,r)?.writable)&&(a=c(()=>P(Ot(s?t[r]:T),o)),n.set(r,a)),a!==void 0){var l=W(a);return l===T?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=W(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==T)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===ce)return!0;var r=n.get(t),i=r!==void 0&&r.v!==T||Reflect.has(e,t);return(r!==void 0||z!==null&&(!i||u(e,t)?.writable))&&(r===void 0&&(r=c(()=>P(i?Ot(e[t]):T,o)),n.set(t,r)),W(r)===T)?!1:i},set(e,t,a,s){var l=n.get(t),d=t in e;if(r&&t===`length`)for(var f=a;f<l.v;f+=1){var p=n.get(f+``);p===void 0?f in e&&(p=c(()=>P(T,o)),n.set(f+``,p)):F(p,T)}if(l===void 0)(!d||u(e,t)?.writable)&&(l=c(()=>P(void 0,o)),F(l,Ot(a)),n.set(t,l));else{d=l.v!==T;var m=c(()=>Ot(a));F(l,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,a),!d){if(r&&typeof t==`string`){var g=n.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&F(g,_+1)}Et(i)}return!0},ownKeys(e){W(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==T});for(var[r,a]of n)a.v!==T&&!(r in e)&&t.push(r);return t},setPrototypeOf(){fe()}})}var kt,At,jt,Mt;function Nt(){if(kt===void 0){kt=window,At=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;jt=u(t,`firstChild`).get,Mt=u(t,`nextSibling`).get,m(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),m(n)&&(n.__t=void 0)}}function Pt(e=``){return document.createTextNode(e)}function Ft(e){return jt.call(e)}function It(e){return Mt.call(e)}function Lt(e,t){if(!E)return Ft(e);var n=Ft(D);if(n===null)n=D.appendChild(Pt());else if(t&&n.nodeType!==3){var r=Pt();return n?.before(r),O(r),r}return t&&Bt(n),O(n),n}function Rt(e,t=1,n=!1){let r=E?D:e;for(var i;t--;)i=r,r=It(r);if(!E)return r;if(n){if(r?.nodeType!==3){var a=Pt();return r===null?i?.after(a):r.before(a),O(a),a}Bt(r)}return O(r),r}function zt(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function Bt(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 Vt(e){var t=I,n=z;R(null),mn(null);try{return e()}finally{R(t),mn(n)}}function Ht(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Ut(e,t){var n=z;n!==null&&n.f&8192&&(e|=ee);var r={ctx:k,deps:null,nodes:null,f:e|y|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)We===null?Je.ensure().schedule(r):We.push(r);else if(t!==null){try{Dn(r)}catch(e){throw rn(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|=ne))}if(i!==null&&(i.parent=n,n!==null&&Ht(i,n),I!==null&&I.f&2&&!(e&64))){var a=I;(a.effects??=[]).push(i)}return r}function Wt(){return I!==null&&!L}function Gt(e){let t=Ut(8,null);return A(t,v),t.teardown=e,t}function Kt(e){return Ut(4|ie,e)}function qt(e){Je.ensure();let t=Ut(64|re,e);return(e={})=>new Promise(n=>{e.outro?sn(t,()=>{rn(t),n(void 0)}):(rn(t),n(void 0))})}function Jt(e){return Ut(4,e)}function Yt(e){return Ut(se|re,e)}function Xt(e,t=0){return Ut(8|t,e)}function Zt(e,t=[],n=[],r=[]){st(r,t,n,t=>{Ut(8,()=>e(...t.map(W)))})}function Qt(e,t=0){return Ut(16|t,e)}function $t(e){return Ut(32|re,e)}function en(e){var t=e.teardown;if(t!==null){let e=fn,n=I;pn(!0),R(null);try{t.call(null)}finally{pn(e),R(n)}}}function tn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Vt(()=>{e.abort(w)});var r=n.next;n.f&64?n.parent=null:rn(n,t),n=r}}function nn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||rn(t),t=n}}function rn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(an(e.nodes.start,e.nodes.end),n=!0),A(e,S),tn(e,t&&!n),En(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();en(e),e.f^=S,e.f|=te;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=e.b=null}function an(e,t){for(;e!==null;){var n=e===t?null:It(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 sn(e,t,n=!0){var r=[];cn(e,r,!0);var i=()=>{n&&rn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function cn(e,t,n){if(!(e.f&8192)){e.f^=ee;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;cn(i,t,o?n:!1),i=a}}}function ln(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:It(n);t.append(n),n=i}}var un=null,dn=!1,fn=!1;function pn(e){fn=e}var I=null,L=!1;function R(e){I=e}var z=null;function mn(e){z=e}var B=null;function hn(e){I!==null&&(!Te||I.f&2)&&(B===null?B=[e]:B.push(e))}var V=null,H=0,U=null;function gn(e){U=e}var _n=1,vn=0,yn=vn;function bn(e){yn=e}function xn(){return++_n}function Sn(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~ae),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Sn(a)&&_t(a),a.wv>e.wv)return!0}t&512&&N===null&&A(e,v)}return!1}function Cn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Te&&B!==null&&s.call(B,e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Cn(a,t,!1):t===a&&(n?A(a,y):a.f&1024&&A(a,b),et(a))}}function wn(e){var t=V,n=H,r=U,i=I,a=B,o=k,s=L,c=yn,l=e.f;V=null,H=0,U=null,I=l&96?null:e,B=null,De(e.ctx),L=!1,yn=++vn,e.ac!==null&&(Vt(()=>{e.ac.abort(w)}),e.ac=null);try{e.f|=oe;var u=e.fn,d=u();e.f|=x;var f=e.deps,p=M?.is_fork;if(V!==null){var m;if(p||En(e,H),f!==null&&H>0)for(f.length=H+V.length,m=0;m<V.length;m++)f[H+m]=V[m];else e.deps=f=V;if(Wt()&&e.f&512)for(m=H;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&H<f.length&&(En(e,H),f.length=H);if(Ae()&&U!==null&&!L&&f!==null&&!(e.f&6146))for(m=0;m<U.length;m++)Cn(U[m],e);if(i!==null&&i!==e){if(vn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=vn;if(t!==null)for(let e of t)e.rv=vn;U!==null&&(r===null?r=U:r.push(...U))}return e.f&8388608&&(e.f^=C),d}catch(e){return Pe(e)}finally{e.f^=oe,V=t,H=n,U=r,I=i,B=a,De(o),L=s,yn=c}}function Tn(e,t){let n=t.reactions;if(n!==null){var r=o.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&&(V===null||!s.call(V,t))){var a=t;a.f&512&&(a.f^=512,a.f&=~ae),Le(a),vt(a),En(a,0)}}function En(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Tn(e,n[r])}function Dn(e){var t=e.f;if(!(t&16384)){A(e,v);var n=z,r=dn;z=e,dn=!0;try{t&16777232?nn(e):tn(e),en(e);var i=wn(e);e.teardown=typeof i==`function`?i:null,e.wv=_n}finally{dn=r,z=n}}}function W(e){var t=(e.f&2)!=0;if(un?.add(e),I!==null&&!L&&!(z!==null&&z.f&16384)&&(B===null||!s.call(B,e))){var n=I.deps;if(I.f&2097152)e.rv<vn&&(e.rv=vn,V===null&&n!==null&&n[H]===e?H++:V===null?V=[e]:V.push(e));else{(I.deps??=[]).push(e);var r=e.reactions;r===null?e.reactions=[I]:s.call(r,I)||r.push(I)}}if(fn&&xt.has(e))return xt.get(e);if(t){var i=e;if(fn){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||kn(i))&&(a=gt(i)),xt.set(i,a),a}var o=(i.f&512)==0&&!L&&I!==null&&(dn||(I.f&512)!=0),c=(i.f&x)===0;Sn(i)&&(o&&(i.f|=512),_t(i)),o&&!c&&(yt(i),On(i))}if(N?.has(e))return N.get(e);if(e.f&8388608)throw e.v;return e.v}function On(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(yt(t),On(t))}function kn(e){if(e.v===T)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(xt.has(t)||t.f&2&&kn(t))return!0;return!1}function G(e){var t=L;try{return L=!0,e()}finally{L=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 An=[`touchstart`,`touchmove`];function jn(e){return An.includes(e)}var Mn=Symbol(`events`),Nn=new Set,Pn=new Set,Fn=null;function In(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;Fn=e;var o=0,s=Fn===e&&e[Mn];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[Mn]=t;return}var u=i.indexOf(t);if(u===-1)return;c<=u&&(o=c)}if(a=i[o]||e.target,a!==t){l(e,`currentTarget`,{configurable:!0,get(){return a||n}});var d=I,f=z;R(null),mn(null);try{for(var p,m=[];a!==null;){var h=a.assignedSlot||a.parentNode||a.host||null;try{var g=a[Mn]?.[r];g!=null&&(!a.disabled||e.target===a)&&g.call(a,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble||h===t||h===null)break;a=h}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Mn]=t,delete e.currentTarget,R(d),mn(f)}}}var Ln=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Rn(e){return Ln?.createHTML(e)??e}function zn(e){var t=zt(`template`);return t.innerHTML=Rn(e.replaceAll(`<!>`,`<!---->`)),t.content}function Bn(e,t){var n=z;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Vn(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(E)return Bn(D,null),D;i===void 0&&(i=zn(a?e:`<!>`+e),n||(i=Ft(i)));var t=r||At?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Ft(t),s=t.lastChild;Bn(o,s)}else Bn(t,t);return t}}function Hn(e,t){if(E){var n=z;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=D),ve();return}e!==null&&e.before(t)}function Un(e,t){return Gn(e,t)}var Wn=new Map;function Gn(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){Nt();var l=void 0,u=qt(()=>{var o=n??t.appendChild(Pt());at(o,{pending:()=>{}},t=>{Oe({});var n=k;if(a&&(n.c=a),i&&(r.$$events=i),E&&Bn(t,null),l=e(t,r)||{},E&&(z.nodes.end=D,D===null||D.nodeType!==8||D.data!==`]`))throw ge(),he;ke()},s);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=jn(r);for(let e of[t,document]){var a=Wn.get(e);a===void 0&&(a=new Map,Wn.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,In,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(c(Nn)),Pn.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=Wn.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,In),r.delete(e),r.size===0&&Wn.delete(n)):r.set(e,i)}Pn.delete(d),o!==n&&o.parentNode?.removeChild(o)}});return Kn.set(l,u),l}var Kn=new WeakMap;function qn(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=qn(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Jn(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=qn(e))&&(r&&(r+=` `),r+=t);return r}function Yn(e){return typeof e==`object`?Jn(e):e??``}var Xn=[...`
2
+ \r\f\xA0\v`];function Zn(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||Xn.includes(r[o-1]))&&(s===r.length||Xn.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Qn(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 $n(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function er(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($n)),i&&c.push(...Object.keys(i).map($n));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=$n(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+=Qn(r)),i&&(n+=Qn(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function tr(e,t,n,r,i,a){var o=e.__className;if(E||o!==n||o===void 0){var s=Zn(n,r,a);(!E||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 nr(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 rr(e,t,n,r){var i=e.__style;if(E||i!==t){var a=er(t,r);(!E||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e.__style=t}else r&&(Array.isArray(r)?(nr(e,n?.[0],r[0]),nr(e,n?.[1],r[1],`important`)):nr(e,n,r));return r}function ir(e,t){return e===t||e?.[ce]===t}function ar(e={},t,n,r){var i=k.r,a=z;return Jt(()=>{var o,s;return Xt(()=>{o=s,s=r?.()||[],G(()=>{e!==n(...s)&&(t(e,...s),o&&ir(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&&ir(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}var or=25e-5,sr=.2,cr=1e6,lr=2e6,ur=3e6,dr=class{div;marker;constructor(e,t,n,r){this.div=document.createElement(`div`),this.marker=e.createMarker({element:this.div,lat:t,lng:n,z:r})}insert(){this.marker.inserted()!=1&&this.marker.insert()}remove(){this.marker.inserted()!=0&&this.marker.remove()}update(e){this.marker.update(e)}},fr=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 pr(e){return-.5*(Math.cos(Math.PI*e)-1)}var mr=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}},hr=Vn(`<div></div>`);function gr(e,t){Oe(t,!0);let n=G(()=>t.id),r=G(()=>t.element),i=G(()=>t.style),a=G(()=>t.dimensions),o=G(()=>t.initialize),s={setDisplayed:_,getDisplayed:v,setCollapsed:b,getCollapsed:ee,setScale:ne};function c(){return s}let l,u=a.radius*2,d=a.stroke,f=i?.background??`darkgreen`,p=i?.stroke??`white`,m=i?.shadow??`0px 2px 2px rgba(0, 0, 0, 0.5)`,h=P(!1),g=!1;function _(e){e==1&&(l&&r&&r.parentElement!=l&&l.appendChild(r),g==0&&o&&r&&(g=!0,setTimeout(async()=>await o(n,r),0))),e!=W(h)&&(F(h,e,!0),e==0&&S.end())}function v(){return W(h)}let y=P(!0);function b(e){e!=W(y)&&(F(y,e,!0),S.target(W(y)?0:te))}function ee(){return W(h)?S.expired():!0}let te=0,x=1,S=new mr({value:0,min:0,max:1,timespan:75,easing:pr,callback:re});function ne(e,t){te=e,x=t,S.target(e)}function re(e){l.style.scale=e.toString(),l.style.opacity=e.toString(),l.style.filter=`brightness(${ie(e)})`}function ie(e){return 1-x*(1-e)}var ae={invoke:c},oe=hr();let se;return ar(oe,e=>l=e,()=>l),Zt(e=>{tr(oe,1,Yn([`pin`,W(h)&&`displayed`]),`svelte-10kxbrm`),se=rr(oe,``,se,e)},[()=>({width:`${u}px`,height:`${u}px`,"border-radius":`${u/2}px`,"border-color":p,"border-width":`${d}px`,"background-color":`rgb(from ${f} r g b / 1)`,"box-shadow":m,scale:0,filter:`brightness(${ie(0)})`})]),Hn(e,oe),ke(ae)}var _r=class extends fr{properties;zoom;component;constructor(e,t,n,r,i,a){super(t,n,r,i,new dr(e,n,r,i)),this.properties=a,this.zoom=NaN,this.component=Un(gr,{target:this.marker.div,props:a})}get zIndex(){return Number.isNaN(this.zoom)?this.rank:Math.round(-this.zoom*5)+cr}},vr=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 yr(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=Math.PI/180*n;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 br=Vn(`<div><div class="element pointer svelte-1no6o2a"></div> <div class="element bubble svelte-1no6o2a"><div class="element body svelte-1no6o2a"></div></div></div>`);function xr(e,t){Oe(t,!0);let n=G(()=>t.id),r=G(()=>t.element),i=G(()=>t.style),a=G(()=>t.dimensions),o=G(()=>t.initialize),s={setDisplayed:de,getDisplayed:fe,setCollapsed:me,getCollapsed:he,getExpanded:T,setAngle:Se};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,_=a.padding,v=a.width,y=a.height,b=i?.radius??0,ee=a.width,te=a.height,x=Math.min(i?.radius??8,Math.min(ee,te)/2),S=Math.min(1,2*x/Math.min(te,ee)),ne=i?.background??`white`,re=a.padding*2,ie=a.padding*.5*S,ae=i?.background??`white`,oe=g<h?g/h:1,se=h<g?h/g:1,C=Math.min(h,g)/2,ce=C*Math.SQRT2,w=15*Math.SQRT2,le=!1,ue=P(!1);function de(e){e!=W(ue)&&(F(ue,e,!0),e==1&&(r&&r.parentElement!=u&&u.appendChild(r),le==0&&o&&r&&(le=!0,setTimeout(async()=>await o(n,r),0))),e==0&&(ge.end(),ve.end(),xe.end()))}function fe(){return W(ue)}let pe=P(!0);function me(e){e!=W(pe)&&(F(pe,e,!0),ge.target(W(pe)?0:1))}function he(){return W(ue)?ge.expired():!0}function T(){return W(ue)?ge.expired():!1}let ge=new mr({value:0,min:0,max:1,timespan:125*Math.cbrt(p),easing:pr,callback:_e});function _e(e){l.style.opacity=`${e}`,l.style.scale=`${e}`,u.style.opacity=`${e}`}let E=NaN,D=P(!1),O=-h/2,ve=new vr({value:-h/2,min:-h,max:0,precision:1,stiffness:or/p,callback:Ce}),be=-g/2,xe=new vr({value:-g/2,min:-g,max:0,precision:1,stiffness:or/p,callback:we});function Se(e,t){if(Number.isNaN(e)){E=NaN,F(D,!1);return}if(W(D)==0||t==1){F(D,!0),E=e;let t=yr(h,g,e);ve.set(Math.round(t.x)),xe.set(Math.round(t.y));return}if(E!=e){E=e;let t=yr(h,g,e);ve.target(Math.round(t.x)),xe.target(Math.round(t.y));return}}function Ce(e){O=e,Te(O,be)}function we(e){be=e,Te(O,be)}function Te(e,t){let n=e+h/2,r=t+g/2,i=n*oe,a=r*se,o=Math.sqrt(i*i+a*a),s=(o-C)/(ce-C),c=Math.atan2(a,i)/Math.PI*180-45,l=15+s*(w-15),u=o<C?o/C:1,p=.5*((1+.5*S)*s),m=e+_*(1-i/C*p),v=t+_*(1-a/C*p);f.style.transform=`scale(${u}) rotate(${c}deg) skew(${l}deg, ${l}deg)`,d.style.transform=`translate(${Math.round(m)}px, ${Math.round(v)}px)`}var Ee={invoke:c},k=br();let De;var Ae=Lt(k);let je;ar(Ae,e=>f=e,()=>f);var Me=Rt(Ae,2);let Ne;var Pe=Lt(Me);let Fe;return ar(Pe,e=>u=e,()=>u),ye(Me),ar(Me,e=>d=e,()=>d),ye(k),ar(k,e=>l=e,()=>l),Zt(()=>{tr(k,1,Yn([`element anchor`,W(ue)&&`displayed`]),`svelte-1no6o2a`),De=rr(k,``,De,{filter:m}),je=rr(Ae,``,je,{width:`${re}px`,height:`${re}px`,"border-radius":`${ie}px`,"background-color":`rgb(from ${ae} r g b / 1)`}),Ne=rr(Me,``,Ne,{width:`${ee}px`,height:`${te}px`,"border-radius":`${x}px`,"background-color":`rgb(from ${ne} r g b / 1)`}),Fe=rr(Pe,``,Fe,{width:`${v}px`,height:`${y}px`,"border-radius":`${b}px`})}),Hn(e,k),ke(Ee)}var Sr=class extends fr{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=Un(xr,{target:this.marker.div,props:a})}get zIndex(){return Number.isNaN(this.zoom)?this.rank:Math.round(-this.zoom*5)+lr}},Cr=class extends fr{width;height;padding;angle;component;constructor(e,t,n,r,i,a){super(t,n,r,i,new dr(e,n,r,ur)),this.width=a.dimensions.width,this.height=a.dimensions.height,this.padding=a.dimensions.padding,this.angle=NaN,this.shown=!1,this.component=Un(xr,{target:this.marker.div,props:a})}get zIndex(){return ur}},wr=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 _r(e,n,r,i,a,o),this.tooltip=new Sr(e,n,r,i,a,s),this.popup=c?new Cr(e,n,r,i,a,c):void 0}};function Tr(e,t,n){return{x:Dr(t)*n,y:Or(e)*n}}function Er(e,t,n){return{lat:Ar(t/n),lng:kr(e/n)}}function Dr(e){return(180+e)/360}function Or(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function kr(e){return e*360-180}function Ar(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}var jr=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)}},Mr=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 jr(e,t,n,r),this.blockR=new jr(0,0,0,0)):(this.blockL=new jr(e,-180,n,r),this.blockR=new jr(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=Tr(i.sw.lat,i.sw.lng,a),s=Tr(i.ne.lat,i.ne.lng,a),c=Math.max(o.x-r.left,0),l=Math.min(o.y+r.bottom,a),u=Math.min(s.x+r.right,a),d=Math.max(s.y-r.top,0),f=Er(c,l,a),p=Er(u,d,a);return new e(f.lat,f.lng,p.lat,p.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)}};function Nr(e,t,n){let r=e.replace(/^#/,``),i,a,o,s;return r.length===8?(i=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),o=parseInt(r.substring(4,6),16),s=parseInt(r.substring(6,8),16)):(i=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),o=parseInt(r.substring(4,6),16),s=255),i=Math.round(i*(1-t)),a=Math.round(a*(1-t)),o=Math.round(o*(1-t)),s=s*n/255,i=Math.max(0,Math.min(255,i)),a=Math.max(0,Math.min(255,a)),o=Math.max(0,Math.min(255,o)),s=Math.max(0,Math.min(1,s)),`rgba(${i}, ${a}, ${o}, ${s.toFixed(2)})`}var Pr=class{provider;pinMaxSize=0;pinFadeoutColor=sr;pinFadeoutScale=sr;pinFadeoutOpacity=1;pinFadeoutModifier=1;pinMaxDepth=3;pinDepth=3;pins=new Set;constructor(e,t){this.provider=e,this.pinFadeoutColor=t?.pin?.fadeout?.color??.2,this.pinFadeoutScale=t?.pin?.fadeout?.scale??.2,this.pinFadeoutOpacity=t?.pin?.fadeout?.opacity??1,this.pinFadeoutModifier=this.pinFadeoutColor<this.pinFadeoutScale?this.pinFadeoutColor/this.pinFadeoutScale:1,this.pinMaxDepth=t?.pin?.depth??3,this.pinDepth=this.pinMaxDepth}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().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(),this.provider.updateCircles([],this.pinMaxDepth)}refresh(){let e=Array.from(this.pins);this.pinMaxSize=e.reduce((e,t)=>Math.max(e,t.properties.dimensions.radius*2),0),this.pinDepth=Math.max(1,this.pinMaxDepth-Math.log10(e.length))}draw(){let e=Array.from(this.pins),t=[];for(let n=0;n<e.length;n++){let r=e[n],i=Math.max(0,Math.min(1,this.pinFadeoutColor*this.pinMaxDepth)),a=Math.max(0,Math.min(1,this.pinFadeoutScale*this.pinMaxDepth)),o=Math.max(0,Math.min(1,this.pinFadeoutOpacity*this.pinMaxDepth)),s=r.properties.style?.background??`darkgreen`,c=Nr(s,0,1),l=Nr(s,i,o),u=r.properties.dimensions.radius-r.properties.dimensions.stroke,d=u*(1-a),f=r.properties.style?.stroke??`white`,p=Nr(f,0,1),m=Nr(f,i,o),h=r.properties.dimensions.stroke,g=h*(1-a),_={color:{min:l,max:c},radius:{min:d,max:u},stroke:{color:{min:m,max:p},width:{min:g,max:h}},lat:r.lat,lng:r.lng,rank:r.rank,zoom:r.zoom};t.push(_)}this.provider.updateCircles(t,this.pinMaxDepth)}render(e,t){let n=e.zoom,r=Mr.offset(e,t.size,{top:this.pinMaxSize,bottom:this.pinMaxSize,right:this.pinMaxSize,left:this.pinMaxSize});for(let e of this.pins)if(r.contains(e.lat,e.lng))if(Number.isNaN(e.zoom)==0&&e.shown&&n<e.zoom&&e.zoom<n+this.pinDepth){let t=(e.zoom-n)/this.pinDepth;e.component.invoke().setDisplayed(!0),e.component.invoke().setCollapsed(!1),e.component.invoke().setScale(Math.max(0,1-t*this.pinFadeoutScale),this.pinFadeoutModifier),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()}},Fr=class{tooltipMaxWidth=0;tooltipMaxHeight=0;tooltips=new Set;constructor(e,t){}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=Mr.offset(e,t.size,{top:this.tooltipMaxHeight,bottom:this.tooltipMaxHeight,right:this.tooltipMaxWidth,left:this.tooltipMaxWidth});for(let e of this.tooltips)if(r.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()}},Ir=class{provider;pan=!0;popups=new Set;constructor(e,t){this.provider=e,this.pan=t?.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){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 t=this.provider.getViewport(),n=this.provider.getParameters().size,r=t.bounds,i=t.zoom,a=e.popup,o=n*2**i,s=Tr(r.ne.lat,r.sw.lng,o),c=Tr(r.sw.lat,r.ne.lng,o),l=c.x-s.x,u=c.y-s.y,d=a.width+a.padding*8,f=a.height+a.padding*8,p=Tr(a.lat,a.lng,o),m=yr(d,f,e.tooltip.angle),h=p.x+m.x,g=h+d,_=p.y+m.y,v=_+f,y=h-s.x,b=c.x-g,ee=_-s.y,te=c.y-v,x=0;l<d?x=(y-b)/2:(y<0&&(x=y),b<0&&(x=-b));let S=0;u<f?S=(ee-te)/2:(ee<0&&(S=ee),te<0&&(S=-te)),(x!=0||S!=0)&&this.provider.panBy(x,S)}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()))}},Lr=class{provider;pinManager;tooltipManager;popupManager;elementsStore;constructor(e,t){this.provider=e,this.pinManager=new Pr(e,t),this.tooltipManager=new Fr(e,t),this.popupManager=new Ir(e,t),this.elementsStore=new Map}clearElements(){this.elementsStore.clear(),this.pinManager.clear(),this.tooltipManager.clear(),this.popupManager.clear()}removeElements(e){if(e.length!==0){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(),this.pinManager.draw()}}updateElements(e){if(e.length!==0){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))}this.pinManager.draw()}}insertElements(e,t){if(e.length!==0){for(let n of e){let e=this.elementsStore.get(n.properites.id);e??(e=new wr(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(),this.pinManager.draw()}}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.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)}},Rr=14097894508562428199n,zr=13011662864482103923n,Br=11160318154034397263n,Vr=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 Hr(e,t){return e&=K,(e>>BigInt(t)|e<<BigInt(64-t))&K}function Ur(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 Wr(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 Gr(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 Kr(e,t){return Gr({first:e,second:t})}function qr(e){let t=e.length;if(t>8){let n=Y(e),r=Y(e,t-8);return(Kr(n,Hr(r+BigInt(t)&K,t))^r)&K}if(t>=4){let n=Wr(e);return Kr(BigInt(t)+(n<<3n)&K,Wr(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(Ur(q(a*Br)^q(o*Vr))*Br)}return Br}function Jr(e){let t=e.length,n=q(Y(e)*zr),r=Y(e,8),i=q(Y(e,t-8)*Br),a=q(Y(e,t-16)*Rr);return Kr(q(J(q(n-r),43)+J(i,30)+a),q(n+J(r^Vr,20)-i+BigInt(t)))}function Yr(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 Xr(e,t,n,r){return Yr(Y(e,t),Y(e,t+8),Y(e,t+16),Y(e,t+24),n,r)}function Zr(e){let t=e.length,n=Y(e,24),r=q(Y(e)+q((BigInt(t)+Y(e,t-16))*Rr)),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(Ur(q(Ur(q(q(o+q(i+J(r,31)+a))*Br+q(l+s)*Rr))*Rr+s))*Br)}function Qr(e){let t;t=typeof e==`string`?new TextEncoder().encode(e):e;let n=t.length;if(n<=32)return n<=16?qr(t):Jr(t);if(n<=64)return Zr(t);let r=Y(t),i=q(Y(t,n-16)^zr),a=q(Y(t,n-56)^Rr),o=Xr(t,n-64,BigInt(n),i),s=Xr(t,n-32,q(BigInt(n)*zr),Rr);a=q(a+Ur(o.second)*zr),r=q(J(q(a+r),39)*zr),i=q(J(i,33)*zr);let c=n-1&-64,l=0;for(;c>0;)r=q(J(q(r+i+o.first+Y(t,l+16)),37)*zr),i=q(J(q(i+o.second+Y(t,l+48)),42)*zr),r^=s.second,i^=o.first,a=J(a^s.first,33),o=Xr(t,l,q(o.second*zr),q(r+s.first)),s=Xr(t,l+32,q(a+s.second),i),[a,r]=[r,a],l+=64,c-=64;return Kr(Kr(o.first,s.first)+q(Ur(i)*zr)+a,Kr(o.second,s.second)+r)}function $r(e){return Qr(e).toString()}var ei=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,ti=e=>new Promise(t=>setTimeout(t,e));async function ni(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 ti(t.retry.delay)}throw Error(`Unreachable code`)}var ri=[0,30,60,90,120,150,180,210,240,270,300,330],ii=256,ai=1e6,oi=100,si=5,ci=4,li=16;function ui(e){let t=new ArrayBuffer(ci+e.items.length*li),n=new DataView(t);n.setUint8(0,e.parameters.size/ii),n.setUint8(1,e.parameters.zoom.min),n.setUint8(2,e.parameters.zoom.max),n.setUint8(3,e.parameters.zoom.scale);let r=e.items.length,i=e.items,a=ci;for(let e=0;e<r;e++){let t=i[e];n.setUint32(a+0,t.rank,!0),n.setInt32(a+4,Math.round(t.lat*ai),!0),n.setInt32(a+8,Math.round(t.lng*ai),!0),n.setUint16(a+12,Math.round(t.width*oi),!0),n.setUint16(a+14,Math.round(t.height*oi),!0),a+=li}return t}var di=4,fi=2,pi=2;function mi(e){let t=new DataView(e),n=t.getUint32(0,!0),r=0;r+=di;let i=Array(n);for(let e=0;e<n;e++){let n=t.getUint8(r)/si,a=t.getUint8(r+1),o=Array(a);r+=fi;for(let e=0;e<a;e++){let n=t.getUint8(r)/si,i=t.getUint8(r+1);r+=pi,o[e]={zoom:n,angle:ri[i]}}i[e]={zoom:n,directions:o}}return i}var hi=`X-Key`,gi=`X-Token`,_i=`X-Version`,vi=`Cache-Control`,yi=`Content-Type`,bi;function xi(e){return{lang:e?.lang??bi?.lang,message:e?.message,abortEarly:e?.abortEarly??bi?.abortEarly,abortPipeEarly:e?.abortPipeEarly??bi?.abortPipeEarly}}var Si;function Ci(e){return Si?.get(e)}var wi;function Ti(e){return wi?.get(e)}var Ei;function Di(e,t){return Ei?.get(e)?.get(t)}function Oi(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??Oi(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??Di(e.reference,c.lang)??(l?Ti(c.lang):null)??r.message??Ci(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},xi())}}}function ki(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var Ai=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function ji(e){return{kind:`transformation`,type:`args`,reference:ji,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 Ai(r.issues);return n(...r.value)},e}}}var Mi=/^#(?:[\da-fA-F]{3,4}|[\da-fA-F]{6}|[\da-fA-F]{8})$/u;function Ni(e,t){return{kind:`validation`,type:`check`,reference:Ni,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 Pi(e){return{kind:`validation`,type:`hex_color`,reference:Pi,async:!1,expects:null,requirement:Mi,message:e,"~run"(e,t){return e.typed&&!this.requirement.test(e.value)&&X(this,`hex color`,e,t),e}}}function Fi(e,t){return{kind:`validation`,type:`length`,reference:Fi,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 Ii(e,t){return{kind:`validation`,type:`max_value`,reference:Ii,async:!1,expects:`<=${e instanceof Date?e.toJSON():Oi(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():Oi(e.value)}),e}}}function Li(e,t){return{kind:`validation`,type:`min_length`,reference:Li,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 Ri(e,t){return{kind:`validation`,type:`min_value`,reference:Ri,async:!1,expects:`>=${e instanceof Date?e.toJSON():Oi(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():Oi(e.value)}),e}}}function zi(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Bi(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Vi(){return{kind:`schema`,type:`any`,reference:Vi,expects:`any`,async:!1,get"~standard"(){return Z(this)},"~run"(e){return e.typed=!0,e}}}function Hi(e,t){return{kind:`schema`,type:`array`,reference:Hi,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 Ui(e){return{kind:`schema`,type:`boolean`,reference:Ui,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 Wi(e,t){return{kind:`schema`,type:`custom`,reference:Wi,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 Gi(e){return{kind:`schema`,type:`function`,reference:Gi,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 Ki(e,t){return{kind:`schema`,type:`literal`,reference:Ki,expects:Oi(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 qi(e){return{kind:`schema`,type:`number`,reference:qi,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 Ji(e,t){return{kind:`schema`,type:`object`,reference:Ji,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]:Bi(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]=zi(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=Bi(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Yi(e){return{kind:`schema`,type:`string`,reference:Yi,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 Xi(e,t){return{kind:`schema`,type:`tuple`,reference:Xi,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 Zi(e){let t;if(e)for(let n of e)t?t.push(...n.issues):t=n.issues;return t}function Qi(e,t){return{kind:`schema`,type:`union`,reference:Qi,expects:ki(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:Zi(r)}),e.typed=!0}else if(i?.length===1)return i[0];else X(this,`type`,e,t,{issues:Zi(i)});return e}}}function $i(e,t,n){let r=e[`~run`]({value:t},xi(n));if(r.issues)throw new Ai(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 ea=$(Yi(),Fi(32)),ta=$(Yi(),Li(1)),na=Wi(e=>e instanceof HTMLElement,`Must be an HTMLElement`),ra=$(Gi(),ji(Xi([Yi(),na]))),ia=$(Ji({radius:$(qi(),Ri(0),Ii(128)),stroke:$(qi(),Ri(0),Ii(128))}),Ni(e=>e.stroke<=e.radius,`Stroke must be less than or equal to radius`)),aa=Ji({background:Q($(Yi(),Pi())),stroke:Q($(Yi(),Pi())),shadow:Q(Yi())}),oa=$(Ji({width:$(qi(),Ri(0),Ii(655.36)),height:$(qi(),Ri(0),Ii(655.36)),padding:$(qi(),Ri(0))}),Ni(e=>Math.min(e.width,e.height)/e.padding>=4,`Padding must be less that 4 times the minimum of width or height`)),sa=Ji({background:Q($(Yi(),Pi())),radius:Q($(qi(),Ri(0))),filter:Q(Yi())}),ca=Ji({id:$(Yi(),Li(1)),rank:$(qi(),Ri(0),Ii(4294967295)),lat:$(qi(),Ri(-90),Ii(90)),lng:$(qi(),Ri(-180),Ii(180)),tooltip:Ji({element:na,style:Q(sa),dimensions:Q(oa),initialize:Q(ra)}),pin:Q(Ji({element:Q(na),style:Q(aa),dimensions:Q(ia),initialize:Q(ra)})),popup:Q(Ji({element:na,style:Q(sa),dimensions:Q(oa),initialize:Q(ra)}))}),la=`1.4.1`,ua=`https://4.1.api.maps.arenarium.dev/states`,da=3,fa=500,pa=class{apiKey;apiJwt;apiCache;constructor(e,t){this.apiKey=e,this.apiJwt=t,this.apiCache=new Map}clearStates(){this.apiCache.clear()}async updateStates(e,t){if(t.length==0)return;if(t.length==1){t[0].state={zoom:0,directions:[{zoom:0,angle:ei(270)}]};return}t.sort((e,t)=>e.properites.id.localeCompare(t.properites.id));let n=t.map(e=>e.input),r=$r(JSON.stringify(n)),i=this.apiCache.get(r);if(i==null){let t=ui({parameters:e,items:n}),a=window.location.host.startsWith(`localhost`)||window.location.host.startsWith(`127.0.0.1`),o=await ni(async()=>await fetch(ua,{method:`POST`,headers:{[_i]:la,[hi]:this.apiKey,[gi]:this.apiJwt,[vi]:a?`no-cache`:``,[yi]:`application/octet-stream`},body:t}),{retry:{times:da,delay:fa}});if(o.error)throw o.error;let s=o.data;if(!s.ok)throw Error(await s.text());i=mi(await s.arrayBuffer()),this.apiJwt=s.headers.get(`X-Token`)??``,this.apiCache.set(r,i)}for(let e=0;e<t.length;e++){let n=t[e];n.state=i[e]}}},ma=e=>new Promise(t=>setTimeout(t,e));async function ha(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 ma(t.retry.delay)}throw Error(`Unreachable code`)}async function ga(e,t,n,r,i){let a=await ha(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 _a(e,t,n,r,i){let a=await ha(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 va=class{static create(e,t,n){throw Error(`Must override static create method!`)}},ya=`1.4.1`,ba=`https://4.1.api.maps.arenarium.dev/auth`,xa=`https://4.1.api.maps.arenarium.dev/log`,Sa=class n extends va{apiKey;mapProvider;mapStateProvider;markers;markersElementRenderer;markersElementManager;markersStateManager;constructor(t,n,r,a){super(),$i(ea,t),$i(ta,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.markersElementRenderer=new e(this.renderMarkers.bind(this)),this.markersElementManager=new Lr(r,a),this.markersStateManager=new pa(t,n)}static async create(e,t,r){let i=await ga(ba,{key:e},{headers:{[_i]:ya}});this.deprecated(ya,i.version)&&console.warn(`This version of @arenarium/maps is deprecated and may not work correctly. Please upgrade to the latest version.`);let a=i.jwt;if(!a)throw Error(`Failed to get api jwt`);return new n(e,a,t,r)}static deprecated(e,t){if(!t)return!1;let n=t.split(`.`).map(e=>Number(e)),r=e.split(`.`).map(e=>Number(e));return n.length===r.length?n.some((e,t)=>e>r[t]):!0}clear(){this.mapStateProvider.stop(),this.markersElementRenderer.stop(),this.markers.clear(),this.markersStateManager.clearStates(),this.markersElementManager.clearElements()}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 _a(xa,{title:t,level:e,content:{version:ya,key:this.apiKey,name:n.name,message:n.message,cause:n.cause,stack:n.stack}},{headers:{[_i]:ya}})}catch(e){console.error(e)}}onMapMove(){this.markersElementRenderer.run()}onMapIdle(){this.markersElementRenderer.run()}onMapClick(){this.hidePopup()}onMarkerClick(e,t){e.stopPropagation(),this.showPopup(t)}createMarkers(e){let n=[],r=this.mapProvider.getContainer(),i=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),r.appendChild(t),t.getBoundingClientRect()}finally{r.removeChild(t)}},a=(e,t)=>{if(t)return t;if(e){let t=i(e),n=t.width,r=t.height;return{radius:Math.max(n,r)/2,stroke:2}}else return{radius:8,stroke:2}},o=(e,t)=>{if(t)return t;let n=i(e),r=n.width,a=n.height;return{width:r,height:a,padding:Math.min(Math.round(Math.min(r,a)/4),8)}};for(let r of e){let e=r.id,i=r.lat,s=r.lng,c=r.rank,l={id:e,initialize:r.pin?.initialize,element:r.pin?.element,style:r.pin?.style,dimensions:a(r.pin?.element,r.pin?.dimensions)},u={id:e,initialize:r.tooltip.initialize,element:r.tooltip.element,style:r.tooltip.style,dimensions:o(r.tooltip.element,r.tooltip.dimensions)},d;r.popup&&(d={id:e,initialize:r.popup.initialize,element:r.popup.element,style:r.popup.style,dimensions:o(r.popup.element,r.popup.dimensions)});let f=new t(e,i,s,c,l,u,d);n.push(f)}return n}renderMarkers(){try{this.detached();let e=this.mapProvider.getParameters(),t=this.mapProvider.getViewport();return this.markersElementManager.renderElements(t,e),!1}catch(e){return this.clear(),this.error(`Process markers render error`,e),!0}}async updateMarkers(e){$i(Hi(ca),e);try{let t=[];for(let n of e)this.markers.has(n.id)||t.push(n);let n=this.createMarkers(t);for(let e of n)this.markers.set(e.properites.id,e);this.markersElementManager.insertElements(n,this.onMarkerClick.bind(this)),this.markersElementRenderer.run();let r=this.mapProvider.getParameters(),i=Array.from(this.markers.values());await this.markersStateManager.updateStates(r,i),this.markersElementManager.updateElements(i),this.markersElementRenderer.run(),this.mapStateProvider.start()}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}}showTooltip(e){if(!this.detached())try{let t=this.markers.get(e);if(!t)return;let n=t.properites.lat,r=t.properites.lng,i=t.state?.zoom;if(!i)return;this.mapProvider.moveTo(n,r,i)}catch(e){throw this.error(`Failed to show tooltip`,e),e}}showPopup(e){if(!this.detached())try{this.markersElementManager.showPopup(e)}catch(e){throw this.markersElementManager.hidePopups(),this.error(`Failed to show popup`,e),e}finally{this.markersElementRenderer.run()}}hidePopup(){if(!this.detached())try{this.markersElementManager.hidePopups()}catch(e){throw this.error(`Failed to hide popup`,e),e}finally{this.markersElementRenderer.run()}}};export{Sa as MapManager};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arenarium/maps",
3
- "version": "1.3.14",
3
+ "version": "1.4.2",
4
4
  "license": "MIT",
5
5
  "author": "arenarium",
6
6
  "description": "Visualize complex map markers clearly. A JavaScript library for effective display of map markers, compatible with MapLibre, Mapbox, and Google Maps.",
@@ -38,9 +38,9 @@
38
38
  "**/*.css"
39
39
  ],
40
40
  "dependencies": {
41
- "@arenarium/maps-core": "1.0.19",
42
- "svelte": "^5.53.11",
43
- "valibot": "^1.2.0"
41
+ "@arenarium/maps-core": "1.0.22",
42
+ "svelte": "^5.55.0",
43
+ "valibot": "^1.3.1"
44
44
  },
45
45
  "clean-package": {
46
46
  "indent": 2,