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