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