mapplic 10.0.0-alpha.15 → 10.0.0-alpha.16

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.
Files changed (2) hide show
  1. package/mapplic.js +43 -9
  2. package/package.json +1 -1
package/mapplic.js CHANGED
@@ -1,3 +1,36 @@
1
+ /*! Mapplic X v10.0.0-alpha.16 | https://mapplic.com
2
+
3
+ Copyright © 2013-2026 VIRTUALSENSE SRL. All rights reserved.
4
+
5
+ Mapplic is proprietary software. It may be used only as the terms at
6
+ https://mapplic.com/terms#license allow. Except as those terms allow, no part
7
+ of it may be copied, modified or redistributed.
8
+
9
+ mapplic.js includes three.js, under the following license:
10
+
11
+ The MIT License
12
+
13
+ Copyright © 2010-2026 three.js authors
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in
23
+ all copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31
+ THE SOFTWARE.
32
+ */
33
+
1
34
  var Mapplic=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};globalThis.MAPPLIC_BUNDLE=!0;var r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},i={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=`attached`,o=`detached`,s=1e3,c=1001,l=1002,u=1003,d=1004,f=1004,p=1005,m=1005,h=1006,g=1007,_=1007,v=1008,y=1008,b=1009,x=1010,S=1011,C=1012,w=1013,T=1014,E=1015,D=1016,O=1017,k=1018,A=1020,j=35902,M=35899,N=1021,P=1022,F=1023,I=1026,ee=1027,L=1028,R=1029,z=1030,te=1031,B=1032,V=1033,H=33776,ne=33777,re=33778,ie=33779,ae=35840,oe=35841,se=35842,U=35843,ce=36196,le=37492,ue=37496,de=37488,fe=37489,pe=37490,me=37491,he=37808,ge=37809,_e=37810,ve=37811,ye=37812,be=37813,xe=37814,W=37815,G=37816,Se=37817,Ce=37818,K=37819,we=37820,Te=37821,Ee=36492,De=36494,Oe=36495,ke=36283,Ae=36284,je=36285,Me=36286,Ne=2200,Pe=2201,Fe=2202,Ie=2300,Le=2301,Re=2302,ze=2303,Be=2400,Ve=2401,He=2402,Ue=2500,We=2501,Ge=3200,Ke=3201,qe=3202,Je=3203,Ye=`srgb`,Xe=`srgb-linear`,Ze=`linear`,Qe=`srgb`,$e=7680,et=7681,tt=7682,nt=7683,rt=34055,it=34056,at=5386,ot=35044,st=35048,ct=35040,lt=35045,ut=35049,dt=35041,ft=35046,pt=35050,mt=35042,ht=`300 es`,gt=2e3,_t=2001,vt={COMPUTE:`compute`,RENDER:`render`},yt={PERSPECTIVE:`perspective`,LINEAR:`linear`,FLAT:`flat`},bt={NORMAL:`normal`,CENTROID:`centroid`,SAMPLE:`sample`,FIRST:`first`,EITHER:`either`},xt={TEXTURE_COMPARE:`depthTextureCompare`};function St(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var Ct={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function wt(e,t){return new Ct[e](t)}function Tt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Et(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Dt(){let e=Et(`canvas`);return e.style.display=`block`,e}var Ot={},kt=null;function At(e){kt=e}function jt(){return kt}function Mt(...e){let t=`THREE.`+e.shift();kt?kt(`log`,t,...e):console.log(t,...e)}function Nt(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function q(...e){e=Nt(e);let t=`THREE.`+e.shift();if(kt)kt(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function J(...e){e=Nt(e);let t=`THREE.`+e.shift();if(kt)kt(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function Pt(...e){let t=e.join(` `);t in Ot||(Ot[t]=!0,q(...e))}function Ft(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}var It={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},Lt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},Rt=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),zt=1234567,Bt=Math.PI/180,Vt=180/Math.PI;function Ht(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Rt[e&255]+Rt[e>>8&255]+Rt[e>>16&255]+Rt[e>>24&255]+`-`+Rt[t&255]+Rt[t>>8&255]+`-`+Rt[t>>16&15|64]+Rt[t>>24&255]+`-`+Rt[n&63|128]+Rt[n>>8&255]+`-`+Rt[n>>16&255]+Rt[n>>24&255]+Rt[r&255]+Rt[r>>8&255]+Rt[r>>16&255]+Rt[r>>24&255]).toLowerCase()}function Ut(e,t,n){return Math.max(t,Math.min(n,e))}function Wt(e,t){return(e%t+t)%t}function Gt(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Kt(e,t,n){return e===t?0:(n-e)/(t-e)}function qt(e,t,n){return(1-n)*e+n*t}function Jt(e,t,n,r){return qt(e,t,1-Math.exp(-n*r))}function Yt(e,t=1){return t-Math.abs(Wt(e,t*2)-t)}function Xt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Zt(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Qt(e,t){return e+Math.floor(Math.random()*(t-e+1))}function $t(e,t){return e+Math.random()*(t-e)}function en(e){return e*(.5-Math.random())}function tn(e){e!==void 0&&(zt=e);let t=zt+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function nn(e){return e*Bt}function rn(e){return e*Vt}function an(e){return!(e&e-1)&&e!==0}function on(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function sn(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function cn(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:q(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function ln(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function un(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var dn={DEG2RAD:Bt,RAD2DEG:Vt,generateUUID:Ht,clamp:Ut,euclideanModulo:Wt,mapLinear:Gt,inverseLerp:Kt,lerp:qt,damp:Jt,pingpong:Yt,smoothstep:Xt,smootherstep:Zt,randInt:Qt,randFloat:$t,randFloatSpread:en,seededRandom:tn,degToRad:nn,radToDeg:rn,isPowerOfTwo:an,ceilPowerOfTwo:on,floorPowerOfTwo:sn,setQuaternionFromProperEuler:cn,normalize:un,denormalize:ln},Y=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ut(this.x,e.x,t.x),this.y=Ut(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ut(this.x,e,t),this.y=Ut(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ut(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ut(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},fn=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:q(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ut(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},X=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(mn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(mn.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ut(this.x,e.x,t.x),this.y=Ut(this.y,e.y,t.y),this.z=Ut(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ut(this.x,e,t),this.y=Ut(this.y,e,t),this.z=Ut(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ut(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return pn.copy(this).projectOnVector(e),this.sub(pn)}reflect(e){return this.sub(pn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ut(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},pn=new X,mn=new fn,hn=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(gn.makeScale(e,t)),this}rotate(e){return this.premultiply(gn.makeRotation(-e)),this}translate(e,t){return this.premultiply(gn.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},gn=new hn,_n=new hn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),vn=new hn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function yn(){let e={enabled:!0,workingColorSpace:Xe,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n||(this.spaces[t].transfer===`srgb`&&(e.r=xn(e.r),e.g=xn(e.g),e.b=xn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Sn(e.r),e.g=Sn(e.g),e.b=Sn(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?Ze:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Pt(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Pt(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Xe]:{primaries:t,whitePoint:r,transfer:Ze,toXYZ:_n,fromXYZ:vn,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ye},outputColorSpaceConfig:{drawingBufferColorSpace:Ye}},[Ye]:{primaries:t,whitePoint:r,transfer:Qe,toXYZ:_n,fromXYZ:vn,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ye}}}),e}var bn=yn();function xn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Sn(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var Cn,wn=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Cn===void 0&&(Cn=Et(`canvas`)),Cn.width=e.width,Cn.height=e.height;let t=Cn.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Cn}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=Et(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=xn(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(xn(t[e]/255)*255):t[e]=xn(t[e]);return{data:t,width:e.width,height:e.height}}return q(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Tn=0,En=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Tn++}),this.uuid=Ht(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Dn(r[t].image)):e.push(Dn(r[t]))}else e=Dn(r);n.url=e}return t||(e.images[this.uuid]=n),n}};function Dn(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?wn.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(q(`Texture: Unable to serialize Texture.`),{})}var On=0,kn=new X,An=class e extends Lt{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=c,i=c,a=h,o=v,s=F,l=b,u=e.DEFAULT_ANISOTROPY,d=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:On++}),this.uuid=Ht(),this.name=``,this.source=new En(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=u,this.format=s,this.internalFormat=null,this.type=l,this.offset=new Y(0,0),this.repeat=new Y(1,1),this.center=new Y(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new hn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(kn).x}get height(){return this.source.getSize(kn).y}get depth(){return this.source.getSize(kn).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){q(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?q(`Texture.setValues(): property '${t}' does not exist.`):r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case s:e.x-=Math.floor(e.x);break;case c:e.x=e.x<0?0:1;break;case l:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case s:e.y-=Math.floor(e.y);break;case c:e.y=e.y<0?0:1;break;case l:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};An.DEFAULT_IMAGE=null,An.DEFAULT_MAPPING=300,An.DEFAULT_ANISOTROPY=1;var jn=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ut(this.x,e.x,t.x),this.y=Ut(this.y,e.y,t.y),this.z=Ut(this.z,e.z,t.z),this.w=Ut(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ut(this.x,e,t),this.y=Ut(this.y,e,t),this.z=Ut(this.z,e,t),this.w=Ut(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ut(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Mn=class extends Lt{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:h,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new jn(0,0,e,t),this.scissorTest=!1,this.viewport=new jn(0,0,e,t),this.textures=[];let r=new An({width:e,height:t,depth:n.depth}),i=n.count;for(let e=0;e<i;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){let t={minFilter:h,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new En(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:`dispose`})}},Nn=class extends Mn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Pn=class extends An{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=u,this.minFilter=u,this.wrapR=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Fn=class extends Nn{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Pn(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},In=class extends An{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=u,this.minFilter=u,this.wrapR=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ln=class extends Nn{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new In(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},Rn=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,r=1/zn.setFromMatrixColumn(e,0).length(),i=1/zn.setFromMatrixColumn(e,1).length(),a=1/zn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Vn,e,Hn)}lookAt(e,t,n){let r=this.elements;return Gn.subVectors(e,t),Gn.lengthSq()===0&&(Gn.z=1),Gn.normalize(),Un.crossVectors(n,Gn),Un.lengthSq()===0&&(Math.abs(n.z)===1?Gn.x+=1e-4:Gn.z+=1e-4,Gn.normalize(),Un.crossVectors(n,Gn)),Un.normalize(),Wn.crossVectors(Gn,Un),r[0]=Un.x,r[4]=Wn.x,r[8]=Gn.x,r[1]=Un.y,r[5]=Wn.y,r[9]=Gn.y,r[2]=Un.z,r[6]=Wn.z,r[10]=Gn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinant();if(i===0)return n.set(1,1,1),t.identity(),this;let a=zn.set(r[0],r[1],r[2]).length(),o=zn.set(r[4],r[5],r[6]).length(),s=zn.set(r[8],r[9],r[10]).length();i<0&&(a=-a),Bn.copy(this);let c=1/a,l=1/o,u=1/s;return Bn.elements[0]*=c,Bn.elements[1]*=c,Bn.elements[2]*=c,Bn.elements[4]*=l,Bn.elements[5]*=l,Bn.elements[6]*=l,Bn.elements[8]*=u,Bn.elements[9]*=u,Bn.elements[10]*=u,t.setFromRotationMatrix(Bn),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=gt,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=gt,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},zn=new X,Bn=new Rn,Vn=new X(0,0,0),Hn=new X(1,1,1),Un=new X,Wn=new X,Gn=new X,Kn=new Rn,qn=new fn,Jn=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(Ut(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-Ut(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(Ut(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-Ut(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(Ut(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-Ut(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:q(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Kn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Kn,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qn.setFromEuler(this),this.setFromQuaternion(qn,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Jn.DEFAULT_ORDER=`XYZ`;var Yn=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&1<<e)}},Xn=0,Zn=new X,Qn=new fn,$n=new Rn,er=new X,tr=new X,nr=new X,rr=new fn,ir=new X(1,0,0),ar=new X(0,1,0),or=new X(0,0,1),sr={type:`added`},cr={type:`removed`},lr={type:`childadded`,child:null},ur={type:`childremoved`,child:null},dr=class e extends Lt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xn++}),this.uuid=Ht(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new X,n=new Jn,r=new fn,i=new X(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Rn},normalMatrix:{value:new hn}}),this.matrix=new Rn,this.matrixWorld=new Rn,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qn.setFromAxisAngle(e,t),this.quaternion.multiply(Qn),this}rotateOnWorldAxis(e,t){return Qn.setFromAxisAngle(e,t),this.quaternion.premultiply(Qn),this}rotateX(e){return this.rotateOnAxis(ir,e)}rotateY(e){return this.rotateOnAxis(ar,e)}rotateZ(e){return this.rotateOnAxis(or,e)}translateOnAxis(e,t){return Zn.copy(e).applyQuaternion(this.quaternion),this.position.add(Zn.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ir,e)}translateY(e){return this.translateOnAxis(ar,e)}translateZ(e){return this.translateOnAxis(or,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4($n.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?er.copy(e):er.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),tr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$n.lookAt(tr,er,this.up):$n.lookAt(er,tr,this.up),this.quaternion.setFromRotationMatrix($n),r&&($n.extractRotation(r.matrixWorld),Qn.setFromRotationMatrix($n),this.quaternion.premultiply(Qn.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(J(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(sr),lr.child=e,this.dispatchEvent(lr),lr.child=null):J(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(cr),ur.child=e,this.dispatchEvent(ur),ur.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),$n.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),$n.multiply(e.parent.matrixWorld)),e.applyMatrix4($n),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(sr),lr.child=e,this.dispatchEvent(lr),lr.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tr,e,nr),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tr,rr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){let e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}};dr.DEFAULT_UP=new X(0,1,0),dr.DEFAULT_MATRIX_AUTO_UPDATE=!0,dr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var fr=class extends dr{constructor(){super(),this.isGroup=!0,this.type=`Group`}},pr={type:`move`},mr=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new fr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(pr)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new fr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},hr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},gr={h:0,s:0,l:0},_r={h:0,s:0,l:0};function vr(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Z=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ye){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,bn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=bn.workingColorSpace){return this.r=e,this.g=t,this.b=n,bn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=bn.workingColorSpace){if(e=Wt(e,1),t=Ut(t,0,1),n=Ut(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=vr(i,r,e+1/3),this.g=vr(i,r,e),this.b=vr(i,r,e-1/3)}return bn.colorSpaceToWorking(this,r),this}setStyle(e,t=Ye){function n(t){t!==void 0&&parseFloat(t)<1&&q(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:q(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);q(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ye){let n=hr[e.toLowerCase()];return n===void 0?q(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=xn(e.r),this.g=xn(e.g),this.b=xn(e.b),this}copyLinearToSRGB(e){return this.r=Sn(e.r),this.g=Sn(e.g),this.b=Sn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ye){return bn.workingToColorSpace(yr.copy(this),e),Math.round(Ut(yr.r*255,0,255))*65536+Math.round(Ut(yr.g*255,0,255))*256+Math.round(Ut(yr.b*255,0,255))}getHexString(e=Ye){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bn.workingColorSpace){bn.workingToColorSpace(yr.copy(this),t);let n=yr.r,r=yr.g,i=yr.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=bn.workingColorSpace){return bn.workingToColorSpace(yr.copy(this),t),e.r=yr.r,e.g=yr.g,e.b=yr.b,e}getStyle(e=Ye){bn.workingToColorSpace(yr.copy(this),e);let t=yr.r,n=yr.g,r=yr.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(gr),this.setHSL(gr.h+e,gr.s+t,gr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(gr),e.getHSL(_r);let n=qt(gr.h,_r.h,t),r=qt(gr.s,_r.s,t),i=qt(gr.l,_r.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},yr=new Z;Z.NAMES=hr;var br=class e{constructor(e,t=25e-5){this.isFogExp2=!0,this.name=``,this.color=new Z(e),this.density=t}clone(){return new e(this.color,this.density)}toJSON(){return{type:`FogExp2`,name:this.name,color:this.color.getHex(),density:this.density}}},xr=class e{constructor(e,t=1,n=1e3){this.isFog=!0,this.name=``,this.color=new Z(e),this.near=t,this.far=n}clone(){return new e(this.color,this.near,this.far)}toJSON(){return{type:`Fog`,name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Sr=class extends dr{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Jn,this.environmentIntensity=1,this.environmentRotation=new Jn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Cr=new X,wr=new X,Tr=new X,Er=new X,Dr=new X,Or=new X,kr=new X,Ar=new X,jr=new X,Mr=new X,Nr=new jn,Pr=new jn,Fr=new jn,Ir=class e{constructor(e=new X,t=new X,n=new X){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Cr.subVectors(e,t),r.cross(Cr);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Cr.subVectors(r,t),wr.subVectors(n,t),Tr.subVectors(e,t);let a=Cr.dot(Cr),o=Cr.dot(wr),s=Cr.dot(Tr),c=wr.dot(wr),l=wr.dot(Tr),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Er)!==null&&Er.x>=0&&Er.y>=0&&Er.x+Er.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Er)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Er.x),s.addScaledVector(a,Er.y),s.addScaledVector(o,Er.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Nr.setScalar(0),Pr.setScalar(0),Fr.setScalar(0),Nr.fromBufferAttribute(e,t),Pr.fromBufferAttribute(e,n),Fr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Nr,i.x),a.addScaledVector(Pr,i.y),a.addScaledVector(Fr,i.z),a}static isFrontFacing(e,t,n,r){return Cr.subVectors(n,t),wr.subVectors(e,t),Cr.cross(wr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Cr.subVectors(this.c,this.b),wr.subVectors(this.a,this.b),Cr.cross(wr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Dr.subVectors(r,n),Or.subVectors(i,n),Ar.subVectors(e,n);let s=Dr.dot(Ar),c=Or.dot(Ar);if(s<=0&&c<=0)return t.copy(n);jr.subVectors(e,r);let l=Dr.dot(jr),u=Or.dot(jr);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Dr,a);Mr.subVectors(e,i);let f=Dr.dot(Mr),p=Or.dot(Mr);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Or,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return kr.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(kr,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Dr,a).addScaledVector(Or,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Lr=class{constructor(e=new X(1/0,1/0,1/0),t=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(zr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(zr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=zr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,zr):zr.fromBufferAttribute(r,t),zr.applyMatrix4(e.matrixWorld),this.expandByPoint(zr);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),Br.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),Br.copy(e.boundingBox)),Br.applyMatrix4(e.matrixWorld),this.union(Br)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,zr),zr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qr),Jr.subVectors(this.max,qr),Vr.subVectors(e.a,qr),Hr.subVectors(e.b,qr),Ur.subVectors(e.c,qr),Wr.subVectors(Hr,Vr),Gr.subVectors(Ur,Hr),Kr.subVectors(Vr,Ur);let t=[0,-Wr.z,Wr.y,0,-Gr.z,Gr.y,0,-Kr.z,Kr.y,Wr.z,0,-Wr.x,Gr.z,0,-Gr.x,Kr.z,0,-Kr.x,-Wr.y,Wr.x,0,-Gr.y,Gr.x,0,-Kr.y,Kr.x,0];return!Zr(t,Vr,Hr,Ur,Jr)||(t=[1,0,0,0,1,0,0,0,1],!Zr(t,Vr,Hr,Ur,Jr))?!1:(Yr.crossVectors(Wr,Gr),t=[Yr.x,Yr.y,Yr.z],Zr(t,Vr,Hr,Ur,Jr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(zr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Rr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Rr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Rr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Rr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Rr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Rr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Rr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Rr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Rr)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Rr=[new X,new X,new X,new X,new X,new X,new X,new X],zr=new X,Br=new Lr,Vr=new X,Hr=new X,Ur=new X,Wr=new X,Gr=new X,Kr=new X,qr=new X,Jr=new X,Yr=new X,Xr=new X;function Zr(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Xr.fromArray(e,a);let o=i.x*Math.abs(Xr.x)+i.y*Math.abs(Xr.y)+i.z*Math.abs(Xr.z),s=t.dot(Xr),c=n.dot(Xr),l=r.dot(Xr);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Qr=$r();function $r(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[e|256]=32768,i[e]=24,i[e|256]=24):t<-14?(r[e]=1024>>-t-14,r[e|256]=1024>>-t-14|32768,i[e]=-t-1,i[e|256]=-t-1):t<=15?(r[e]=t+15<<10,r[e|256]=t+15<<10|32768,i[e]=13,i[e|256]=13):t<128?(r[e]=31744,r[e|256]=64512,i[e]=24,i[e|256]=24):(r[e]=31744,r[e|256]=64512,i[e]=13,i[e|256]=13)}let a=new Uint32Array(2048),o=new Uint32Array(64),s=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(t&8388608);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:o,offsetTable:s}}function ei(e){Math.abs(e)>65504&&q(`DataUtils.toHalfFloat(): Value out of range.`),e=Ut(e,-65504,65504),Qr.floatView[0]=e;let t=Qr.uint32View[0],n=t>>23&511;return Qr.baseTable[n]+((t&8388607)>>Qr.shiftTable[n])}function ti(e){let t=e>>10;return Qr.uint32View[0]=Qr.mantissaTable[Qr.offsetTable[t]+(e&1023)]+Qr.exponentTable[t],Qr.floatView[0]}var ni=class{static toHalfFloat(e){return ei(e)}static fromHalfFloat(e){return ti(e)}},ri=new X,ii=new Y,ai=0,oi=class extends Lt{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ai++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=ot,this.updateRanges=[],this.gpuType=E,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ii.fromBufferAttribute(this,t),ii.applyMatrix3(e),this.setXY(t,ii.x,ii.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ri.fromBufferAttribute(this,t),ri.applyMatrix3(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ri.fromBufferAttribute(this,t),ri.applyMatrix4(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ri.fromBufferAttribute(this,t),ri.applyNormalMatrix(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ri.fromBufferAttribute(this,t),ri.transformDirection(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ln(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=un(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ln(t,this.array)),t}setX(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ln(t,this.array)),t}setY(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ln(t,this.array)),t}setZ(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ln(t,this.array)),t}setW(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=un(t,this.array),n=un(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=un(t,this.array),n=un(n,this.array),r=un(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=un(t,this.array),n=un(n,this.array),r=un(r,this.array),i=un(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==35044&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}},si=class extends oi{constructor(e,t,n){super(new Int8Array(e),t,n)}},ci=class extends oi{constructor(e,t,n){super(new Uint8Array(e),t,n)}},li=class extends oi{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},ui=class extends oi{constructor(e,t,n){super(new Int16Array(e),t,n)}},di=class extends oi{constructor(e,t,n){super(new Uint16Array(e),t,n)}},fi=class extends oi{constructor(e,t,n){super(new Int32Array(e),t,n)}},pi=class extends oi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},mi=class extends oi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ti(this.array[e*this.itemSize]);return this.normalized&&(t=ln(t,this.array)),t}setX(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize]=ei(t),this}getY(e){let t=ti(this.array[e*this.itemSize+1]);return this.normalized&&(t=ln(t,this.array)),t}setY(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize+1]=ei(t),this}getZ(e){let t=ti(this.array[e*this.itemSize+2]);return this.normalized&&(t=ln(t,this.array)),t}setZ(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize+2]=ei(t),this}getW(e){let t=ti(this.array[e*this.itemSize+3]);return this.normalized&&(t=ln(t,this.array)),t}setW(e,t){return this.normalized&&(t=un(t,this.array)),this.array[e*this.itemSize+3]=ei(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=un(t,this.array),n=un(n,this.array)),this.array[e+0]=ei(t),this.array[e+1]=ei(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=un(t,this.array),n=un(n,this.array),r=un(r,this.array)),this.array[e+0]=ei(t),this.array[e+1]=ei(n),this.array[e+2]=ei(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=un(t,this.array),n=un(n,this.array),r=un(r,this.array),i=un(i,this.array)),this.array[e+0]=ei(t),this.array[e+1]=ei(n),this.array[e+2]=ei(r),this.array[e+3]=ei(i),this}},Q=class extends oi{constructor(e,t,n){super(new Float32Array(e),t,n)}},hi=new Lr,gi=new X,_i=new X,vi=class{constructor(e=new X,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?hi.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;gi.subVectors(e,this.center);let t=gi.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(gi,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(_i.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gi.copy(e.center).add(_i)),this.expandByPoint(gi.copy(e.center).sub(_i))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},yi=0,bi=new Rn,xi=new dr,Si=new X,Ci=new Lr,wi=new Lr,Ti=new X,Ei=class e extends Lt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:yi++}),this.uuid=Ht(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(St(e)?pi:di)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new hn().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return bi.makeRotationFromQuaternion(e),this.applyMatrix4(bi),this}rotateX(e){return bi.makeRotationX(e),this.applyMatrix4(bi),this}rotateY(e){return bi.makeRotationY(e),this.applyMatrix4(bi),this}rotateZ(e){return bi.makeRotationZ(e),this.applyMatrix4(bi),this}translate(e,t,n){return bi.makeTranslation(e,t,n),this.applyMatrix4(bi),this}scale(e,t,n){return bi.makeScale(e,t,n),this.applyMatrix4(bi),this}lookAt(e){return xi.lookAt(e),xi.updateMatrix(),this.applyMatrix4(xi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Si).negate(),this.translate(Si.x,Si.y,Si.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new Q(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&q(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Lr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)J(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new X(-1/0,-1/0,-1/0),new X(1/0,1/0,1/0));else{if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ci.setFromBufferAttribute(n),this.morphTargetsRelative?(Ti.addVectors(this.boundingBox.min,Ci.min),this.boundingBox.expandByPoint(Ti),Ti.addVectors(this.boundingBox.max,Ci.max),this.boundingBox.expandByPoint(Ti)):(this.boundingBox.expandByPoint(Ci.min),this.boundingBox.expandByPoint(Ci.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&J(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)J(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new X,1/0);else if(e){let n=this.boundingSphere.center;if(Ci.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];wi.setFromBufferAttribute(n),this.morphTargetsRelative?(Ti.addVectors(Ci.min,wi.min),Ci.expandByPoint(Ti),Ti.addVectors(Ci.max,wi.max),Ci.expandByPoint(Ti)):(Ci.expandByPoint(wi.min),Ci.expandByPoint(wi.max))}Ci.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Ti.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Ti));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Ti.fromBufferAttribute(a,t),o&&(Si.fromBufferAttribute(e,t),Ti.add(Si)),r=Math.max(r,n.distanceToSquared(Ti))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&J(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){J(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv;this.hasAttribute(`tangent`)===!1&&this.setAttribute(`tangent`,new oi(new Float32Array(4*n.count),4));let a=this.getAttribute(`tangent`),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new X,s[e]=new X;let c=new X,l=new X,u=new X,d=new Y,f=new Y,p=new Y,m=new X,h=new X;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new X,y=new X,b=new X,x=new X;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0)n=new oi(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new X,i=new X,a=new X,o=new X,s=new X,c=new X,l=new X,u=new X;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ti.fromBufferAttribute(e,t),Ti.normalize(),e.setXYZ(t,Ti.x,Ti.y,Ti.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new oi(a,r,i)}if(this.index===null)return q(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:`dispose`})}},Di=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=ot,this.updateRanges=[],this.version=0,this.uuid=Ht()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ht()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ht()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Oi=new X,ki=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Oi.fromBufferAttribute(this,t),Oi.applyMatrix4(e),this.setXYZ(t,Oi.x,Oi.y,Oi.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Oi.fromBufferAttribute(this,t),Oi.applyNormalMatrix(e),this.setXYZ(t,Oi.x,Oi.y,Oi.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Oi.fromBufferAttribute(this,t),Oi.transformDirection(e),this.setXYZ(t,Oi.x,Oi.y,Oi.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ln(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=un(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=un(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=un(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=un(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=un(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ln(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ln(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ln(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ln(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=un(t,this.array),n=un(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=un(t,this.array),n=un(n,this.array),r=un(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=un(t,this.array),n=un(n,this.array),r=un(r,this.array),i=un(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){Mt(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new oi(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Mt(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Ai=0,ji=class extends Lt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ai++}),this.uuid=Ht(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Z(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$e,this.stencilZFail=$e,this.stencilZPass=$e,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){q(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?q(`Material: '${t}' is not a property of THREE.${this.type}.`):r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Mi=class extends ji{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new Z(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Ni,Pi=new X,Fi=new X,Ii=new X,Li=new Y,Ri=new Y,zi=new Rn,Bi=new X,Vi=new X,Hi=new X,Ui=new Y,Wi=new Y,Gi=new Y,Ki=class extends dr{constructor(e=new Mi){if(super(),this.isSprite=!0,this.type=`Sprite`,Ni===void 0){Ni=new Ei;let e=new Di(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Ni.setIndex([0,1,2,0,2,3]),Ni.setAttribute(`position`,new ki(e,3,0,!1)),Ni.setAttribute(`uv`,new ki(e,2,3,!1))}this.geometry=Ni,this.material=e,this.center=new Y(.5,.5),this.count=1}raycast(e,t){e.camera===null&&J(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Fi.setFromMatrixScale(this.matrixWorld),zi.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ii.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fi.multiplyScalar(-Ii.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;qi(Bi.set(-.5,-.5,0),Ii,a,Fi,r,i),qi(Vi.set(.5,-.5,0),Ii,a,Fi,r,i),qi(Hi.set(.5,.5,0),Ii,a,Fi,r,i),Ui.set(0,0),Wi.set(1,0),Gi.set(1,1);let o=e.ray.intersectTriangle(Bi,Vi,Hi,!1,Pi);if(o===null&&(qi(Vi.set(-.5,.5,0),Ii,a,Fi,r,i),Wi.set(0,1),o=e.ray.intersectTriangle(Bi,Hi,Vi,!1,Pi),o===null))return;let s=e.ray.origin.distanceTo(Pi);s<e.near||s>e.far||t.push({distance:s,point:Pi.clone(),uv:Ir.getInterpolation(Pi,Bi,Vi,Hi,Ui,Wi,Gi,new Y),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function qi(e,t,n,r,i,a){Li.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Ri.copy(Li):(Ri.x=a*Li.x-i*Li.y,Ri.y=i*Li.x+a*Li.y),e.copy(t),e.x+=Ri.x,e.y+=Ri.y,e.applyMatrix4(zi)}var Ji=new X,Yi=new X,Xi=class extends dr{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);let r=this.levels,i=0;for(;i<r.length&&!(t<r[i].distance);i++);return r.splice(i,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){let e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Ji.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(Ji);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){Ji.setFromMatrixPosition(e.matrixWorld),Yi.setFromMatrixPosition(this.matrixWorld);let n=Ji.distanceTo(Yi)/e.zoom;t[0].object.visible=!0;let r,i;for(r=1,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),n>=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){let t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let e=0,r=n.length;e<r;e++){let r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance,hysteresis:r.hysteresis})}return t}},Zi=new X,Qi=new X,$i=new X,ea=new X,ta=new X,na=new X,ra=new X,ia=class{constructor(e=new X,t=new X(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Zi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Zi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Zi.copy(this.origin).addScaledVector(this.direction,t),Zi.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Qi.copy(e).add(t).multiplyScalar(.5),$i.copy(t).sub(e).normalize(),ea.copy(this.origin).sub(Qi);let i=e.distanceTo(t)*.5,a=-this.direction.dot($i),o=ea.dot(this.direction),s=-ea.dot($i),c=ea.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Qi).addScaledVector($i,d),f}intersectSphere(e,t){Zi.subVectors(e.center,this.origin);let n=Zi.dot(this.direction),r=Zi.dot(Zi)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Zi)!==null}intersectTriangle(e,t,n,r,i){ta.subVectors(t,e),na.subVectors(n,e),ra.crossVectors(ta,na);let a=this.direction.dot(ra),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ea.subVectors(this.origin,e);let s=o*this.direction.dot(na.crossVectors(ea,na));if(s<0)return null;let c=o*this.direction.dot(ta.cross(ea));if(c<0||s+c>a)return null;let l=-o*ea.dot(ra);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},aa=class extends ji{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},oa=new Rn,sa=new ia,ca=new vi,la=new X,ua=new X,da=new X,fa=new X,pa=new X,ma=new X,ha=new X,ga=new X,_a=class extends dr{constructor(e=new Ei,t=new aa){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){ma.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(pa.fromBufferAttribute(s,e),a?ma.addScaledVector(pa,r):ma.addScaledVector(pa.sub(t),r))}t.add(ma)}return t}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ca.copy(n.boundingSphere),ca.applyMatrix4(i),sa.copy(e.ray).recast(e.near),!(ca.containsPoint(sa.origin)===!1&&(sa.intersectSphere(ca,la)===null||sa.origin.distanceToSquared(la)>(e.far-e.near)**2))&&(oa.copy(i).invert(),sa.copy(e.ray).applyMatrix4(oa),(n.boundingBox===null||sa.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,sa)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=ya(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=ya(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=ya(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=ya(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}};function va(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;ga.copy(s),ga.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(ga);return l<n.near||l>n.far?null:{distance:l,point:ga.clone(),object:e}}function ya(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,ua),e.getVertexPosition(c,da),e.getVertexPosition(l,fa);let u=va(e,t,n,r,ua,da,fa,ha);if(u){let e=new X;Ir.getBarycoord(ha,ua,da,fa,e),i&&(u.uv=Ir.getInterpolatedAttribute(i,s,c,l,e,new Y)),a&&(u.uv1=Ir.getInterpolatedAttribute(a,s,c,l,e,new Y)),o&&(u.normal=Ir.getInterpolatedAttribute(o,s,c,l,e,new X),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new X,materialIndex:0};Ir.getNormal(ua,da,fa,t.normal),u.face=t,u.barycoord=e}return u}var ba=new jn,xa=new jn,Sa=new jn,Ca=new jn,wa=new Rn,Ta=new X,Ea=new vi,Da=new Rn,Oa=new ia,ka=class extends _a{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=a,this.bindMatrix=new Rn,this.bindMatrixInverse=new Rn,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Lr),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,Ta),this.boundingBox.expandByPoint(Ta)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new vi),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,Ta),this.boundingSphere.expandByPoint(Ta)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ea.copy(this.boundingSphere),Ea.applyMatrix4(r),e.ray.intersectsSphere(Ea)!==!1&&(Da.copy(r).invert(),Oa.copy(e.ray).applyMatrix4(Da),(this.boundingBox===null||Oa.intersectsBox(this.boundingBox)!==!1)&&this._computeIntersections(e,t,Oa)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new jn,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r===1/0?e.set(1,0,0,0):e.multiplyScalar(r),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===`attached`?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===`detached`?this.bindMatrixInverse.copy(this.bindMatrix).invert():q(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;xa.fromBufferAttribute(r.attributes.skinIndex,e),Sa.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(ba.copy(t),t.set(0,0,0,0)):(ba.set(...t,1),t.set(0,0,0)),ba.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let r=Sa.getComponent(e);if(r!==0){let i=xa.getComponent(e);wa.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Ca.copy(ba).applyMatrix4(wa),r)}}return t.isVector4&&(t.w=ba.w),t.applyMatrix4(this.bindMatrixInverse)}},Aa=class extends dr{constructor(){super(),this.isBone=!0,this.type=`Bone`}},ja=class extends An{constructor(e=null,t=1,n=1,r,i,a,o,s,c=u,l=u,d,f){super(null,a,o,s,c,l,r,i,d,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ma=new Rn,Na=new Rn,Pa=class e{constructor(e=[],t=[]){this.uuid=Ht(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){q(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new Rn)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new Rn;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:Na;Ma.multiplyMatrices(i,t[r]),Ma.toArray(n,r*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new e(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new ja(t,e,e,F,E);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];i===void 0&&(q(`Skeleton: No bone found with UUID:`,r),i=new Aa),this.bones.push(i),this.boneInverses.push(new Rn().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}},Fa=class extends oi{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Ia=new Rn,La=new Rn,Ra=[],za=new Lr,Ba=new Rn,Va=new _a,Ha=new vi,Ua=class extends _a{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Fa(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Ba)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Lr),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ia),za.copy(e.boundingBox).applyMatrix4(Ia),this.boundingBox.union(za)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new vi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Ia),Ha.copy(e.boundingSphere).applyMatrix4(Ia),this.boundingSphere.union(Ha)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if(Va.geometry=this.geometry,Va.material=this.material,Va.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ha.copy(this.boundingSphere),Ha.applyMatrix4(n),e.ray.intersectsSphere(Ha)!==!1))for(let i=0;i<r;i++){this.getMatrixAt(i,Ia),La.multiplyMatrices(n,Ia),Va.matrixWorld=La,Va.raycast(e,Ra);for(let e=0,n=Ra.length;e<n;e++){let n=Ra[e];n.instanceId=i,n.object=this,t.push(n)}Ra.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Fa(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new ja(new Float32Array(r*this.count),r,this.count,L,E));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let o=this.geometry.morphTargetsRelative?1:1-a,s=r*e;return i[s]=o,i.set(n,s+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:`dispose`}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Wa=new X,Ga=new X,Ka=new hn,qa=class{constructor(e=new X(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Wa.subVectors(n,t).cross(Ga.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(Wa),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Ka.getNormalMatrix(e),r=this.coplanarPoint(Wa).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Ja=new vi,Ya=new Y(.5,.5),Xa=new X,Za=class{constructor(e=new qa,t=new qa,n=new qa,r=new qa,i=new qa,a=new qa){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=gt,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ja.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ja.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ja)}intersectsSprite(e){return Ja.center.set(0,0,0),Ja.radius=.7071067811865476+Ya.distanceTo(e.center),Ja.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ja)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(Xa.x=r.normal.x>0?e.max.x:e.min.x,Xa.y=r.normal.y>0?e.max.y:e.min.y,Xa.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Xa)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Qa=new Rn,$a=new Za,eo=class e{constructor(){this.coordinateSystem=gt}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(Qa.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),$a.setFromProjectionMatrix(Qa,r.coordinateSystem,r.reversedDepth),$a.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(Qa.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),$a.setFromProjectionMatrix(Qa,r.coordinateSystem,r.reversedDepth),$a.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(Qa.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),$a.setFromProjectionMatrix(Qa,r.coordinateSystem,r.reversedDepth),$a.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(Qa.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),$a.setFromProjectionMatrix(Qa,r.coordinateSystem,r.reversedDepth),$a.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){let r=t.cameras[n];if(Qa.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),$a.setFromProjectionMatrix(Qa,r.coordinateSystem,r.reversedDepth),$a.containsPoint(e))return!0}return!1}clone(){return new e}};function to(e,t){return e-t}function no(e,t){return e.z-t.z}function ro(e,t){return t.z-e.z}var io=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){let i=this.pool,a=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let o=i[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}},ao=new Rn,oo=new Z(1,1,1),so=new Za,co=new eo,lo=new Lr,uo=new vi,fo=new X,po=new X,mo=new X,ho=new io,go=new _a,_o=[];function vo(e,t,n=0){let r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a<i;a++)for(let i=0;i<r;i++)t.setComponent(a+n,i,e.getComponent(a,i))}else t.array.set(e.array,n*r);t.needsUpdate=!0}function yo(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)t[r]=e[r]}else{let n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}var bo=class extends _a{constructor(e,t,n=t*2,r){super(new Ei,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new ja(new Float32Array(e*e*4),e,e,F,E);this._matricesTexture=t}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new ja(new Uint32Array(e*e),e,e,R,T);this._indirectTexture=t}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new ja(new Float32Array(e*e*4).fill(1),e,e,F,E);t.colorSpace=bn.workingColorSpace,this._colorsTexture=t}_initializeGeometry(e){let t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in e.attributes){let{array:i,itemSize:a,normalized:o}=e.getAttribute(r),s=new oi(new i.constructor(n*a),a,o);t.setAttribute(r,s)}if(e.getIndex()!==null){let e=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new oi(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error(`THREE.BatchedMesh: All geometries must consistently have "index".`);for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error(`THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.`)}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Lr);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,ao),this.getBoundingBoxAt(r,lo).applyMatrix4(ao),e.union(lo)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vi);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,ao),this.getBoundingSphereAt(r,uo).applyMatrix4(ao),e.union(uo)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error(`THREE.BatchedMesh: Maximum item count reached.`);let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(to),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;ao.identity().toArray(r.image.data,n*16),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(oo.toArray(i.image.data,n*4),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute(`position`).count:t;let a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error(`THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.`);let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(to),o=this._availableGeometryIds.shift(),i[o]=r):(o=this._geometryCount,this._geometryCount++,i.push(r)),this.setGeometryAt(o,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error(`THREE.BatchedMesh: Maximum geometry count reached.`);this._validateGeometry(t);let n=this.geometry,r=n.getIndex()!==null,i=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw Error(`THREE.BatchedMesh: Reserved space not large enough for provided geometry.`);let s=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute(`position`).count;for(let e in n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);vo(r,i,s);let a=r.itemSize;for(let e=r.count,t=c;e<t;e++){let t=s+e;for(let e=0;e<a;e++)i.setComponent(t,e,0)}i.needsUpdate=!0,i.addUpdateRange(s*a,c*a)}if(r){let e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)i.setX(e+t,s+a.getX(t));for(let t=a.count,r=n;t<r;t++)i.setX(e+t,s);i.needsUpdate=!0,i.addUpdateRange(e,o.reservedIndexCount)}return o.start=r?o.indexStart:o.vertexStart,o.count=r?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;let n=this._instanceInfo;for(let t=0,r=n.length;t<r;t++)n[t].active&&n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,n=this._geometryInfo,r=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,o=n.length;a<o;a++){let o=n[r[a]];if(o.active!==!1){if(i.index!==null){if(o.indexStart!==t){let{indexStart:n,vertexStart:r,reservedIndexCount:a}=o,s=i.index,c=s.array,l=e-r;for(let e=n;e<n+a;e++)c[e]=c[e]+l;s.array.copyWithin(t,n,n+a),s.addUpdateRange(t,a),s.needsUpdate=!0,o.indexStart=t}t+=o.reservedIndexCount}if(o.vertexStart!==e){let{vertexStart:t,reservedVertexCount:n}=o,r=i.attributes;for(let i in r){let a=r[i],{array:o,itemSize:s}=a;o.copyWithin(e*s,t*s,(t+n)*s),a.addUpdateRange(e*s,n*s),a.needsUpdate=!0}o.vertexStart=e}e+=o.reservedVertexCount,o.start=i.index?o.indexStart:o.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){let e=new Lr,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n<a;n++){let r=n;t&&(r=t.getX(r)),e.expandByPoint(fo.fromBufferAttribute(i,r))}r.boundingBox=e}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){let t=new vi;this.getBoundingBoxAt(e,lo),lo.getCenter(t.center);let i=n.index,a=n.attributes.position,o=0;for(let e=r.start,n=r.start+r.count;e<n;e++){let n=e;i&&(n=i.getX(n)),fo.fromBufferAttribute(a,n),o=Math.max(o,t.center.distanceToSquared(fo))}t.radius=Math.sqrt(o),r.boundingSphere=t}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(to);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);let r=new Int32Array(e),i=new Int32Array(e);yo(this._multiDrawCounts,r),yo(this._multiDrawStarts,i),this._multiDrawCounts=r,this._multiDrawStarts=i,this._maxInstanceCount=e;let a=this._indirectTexture,o=this._matricesTexture,s=this._colorsTexture;a.dispose(),this._initIndirectTexture(),yo(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),yo(o.image.data,this._matricesTexture.image.data),s&&(s.dispose(),this._initColorsTexture(),yo(s.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){let n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Ei,this._initializeGeometry(r));let i=this.geometry;r.index&&yo(r.index.array,i.index.array);for(let e in r.attributes)yo(r.attributes[e].array,i.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;go.material=this.material,go.geometry.index=a.index,go.geometry.attributes=a.attributes,go.geometry.boundingBox===null&&(go.geometry.boundingBox=new Lr),go.geometry.boundingSphere===null&&(go.geometry.boundingSphere=new vi);for(let a=0,o=n.length;a<o;a++){if(!n[a].visible||!n[a].active)continue;let o=n[a].geometryIndex,s=r[o];go.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(a,go.matrixWorld).premultiply(i),this.getBoundingBoxAt(o,go.geometry.boundingBox),this.getBoundingSphereAt(o,go.geometry.boundingSphere),go.raycast(e,_o);for(let e=0,n=_o.length;e<n;e++){let n=_o[e];n.object=this,n.batchId=a,t.push(n)}_o.length=0}go.material=null,go.geometry.index=null,go.geometry.attributes={},go.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox===null?null:e.boundingBox.clone(),boundingSphere:e.boundingSphere===null?null:e.boundingSphere.clone()})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=r.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,s=1;i.wireframe&&(s=2,o=r.attributes.position.count>65535?4:2);let c=this._instanceInfo,l=this._multiDrawStarts,u=this._multiDrawCounts,d=this._geometryInfo,f=this.perObjectFrustumCulled,p=this._indirectTexture,m=p.image.data,h=n.isArrayCamera?co:so;f&&!n.isArrayCamera&&(ao.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),so.setFromProjectionMatrix(ao,n.coordinateSystem,n.reversedDepth));let g=0;if(this.sortObjects){ao.copy(this.matrixWorld).invert(),fo.setFromMatrixPosition(n.matrixWorld).applyMatrix4(ao),po.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(ao);for(let e=0,t=c.length;e<t;e++)if(c[e].visible&&c[e].active){let t=c[e].geometryIndex;this.getMatrixAt(e,ao),this.getBoundingSphereAt(t,uo).applyMatrix4(ao);let r=!1;if(f&&(r=!h.intersectsSphere(uo,n)),!r){let n=d[t],r=mo.subVectors(uo.center,fo).dot(po);ho.push(n.start,n.count,r,e)}}let e=ho.list,t=this.customSort;t===null?e.sort(i.transparent?ro:no):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){let n=e[t];l[g]=n.start*o*s,u[g]=n.count*s,m[g]=n.index,g++}ho.reset()}else for(let e=0,t=c.length;e<t;e++)if(c[e].visible&&c[e].active){let t=c[e].geometryIndex,r=!1;if(f&&(this.getMatrixAt(e,ao),this.getBoundingSphereAt(t,uo).applyMatrix4(ao),r=!h.intersectsSphere(uo,n)),!r){let n=d[t];l[g]=n.start*o*s,u[g]=n.count*s,m[g]=e,g++}}p.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,r,i,a){this.onBeforeRender(e,null,r,i,a)}},xo=class extends ji{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new Z(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},So=new X,Co=new X,wo=new Rn,To=new ia,Eo=new vi,Do=new X,Oo=new X,ko=class extends dr{constructor(e=new Ei,t=new xo){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)So.fromBufferAttribute(t,e-1),Co.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=So.distanceTo(Co);e.setAttribute(`lineDistance`,new Q(n,1))}else q(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Eo.copy(n.boundingSphere),Eo.applyMatrix4(r),Eo.radius+=i,e.ray.intersectsSphere(Eo)===!1)return;wo.copy(r).invert(),To.copy(e.ray).applyMatrix4(wo);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=Ao(this,e,To,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=Ao(this,e,To,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=Ao(this,e,To,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=Ao(this,e,To,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function Ao(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(So.fromBufferAttribute(s,i),Co.fromBufferAttribute(s,a),n.distanceSqToSegment(So,Co,Do,Oo)>r)return;Do.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Do);if(!(c<t.near||c>t.far))return{distance:c,point:Oo.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var jo=new X,Mo=new X,No=class extends ko{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)jo.fromBufferAttribute(t,e),Mo.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+jo.distanceTo(Mo);e.setAttribute(`lineDistance`,new Q(n,1))}else q(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},Po=class extends ko{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}},Fo=class extends ji{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new Z(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Io=new Rn,Lo=new ia,Ro=new vi,zo=new X,Bo=class extends dr{constructor(e=new Ei,t=new Fo){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ro.copy(n.boundingSphere),Ro.applyMatrix4(r),Ro.radius+=i,e.ray.intersectsSphere(Ro)===!1)return;Io.copy(r).invert(),Lo.copy(e.ray).applyMatrix4(Io);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);zo.fromBufferAttribute(l,n),Vo(zo,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)zo.fromBufferAttribute(l,a),Vo(zo,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}};function Vo(e,t,n,r,i,a,o){let s=Lo.distanceSqToPoint(e);if(s<n){let n=new X;Lo.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Ho=class extends An{constructor(e,t,n,r,i=h,a=h,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},Uo=class extends Ho{constructor(e,t,n,r,i,a,o,s){super({},e,t,n,r,i,a,o,s),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},Wo=class extends An{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=u,this.minFilter=u,this.generateMipmaps=!1,this.needsUpdate=!0}},Go=class extends An{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},Ko=class extends Go{constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=c,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},qo=class extends Go{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},Jo=class extends An{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Yo=class extends An{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},Xo=class extends An{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let l=e?e.parentNode:null;l!==null&&`requestPaint`in l&&(l.onpaint=()=>{this.needsUpdate=!0},l.requestPaint())}dispose(){let e=this.image?this.image.parentNode:null;e!==null&&`onpaint`in e&&(e.onpaint=null),super.dispose()}},Zo=class extends An{constructor(e,t,n=T,r,i,a,o=u,s=u,c,l=I,d=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:d},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new En(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Qo=class extends Zo{constructor(e,t=T,n=301,r,i,a=u,o=u,s,c=I){let l={width:e,height:e,depth:1},d=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},$o=class extends An{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},es=class e extends Ei{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new Q(c,3)),this.setAttribute(`normal`,new Q(l,3)),this.setAttribute(`uv`,new Q(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new X;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},ts=class e extends Ei{constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type=`CapsuleGeometry`,this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),i=Math.max(1,Math.floor(i));let a=[],o=[],s=[],c=[],l=t/2,u=Math.PI/2*e,d=t,f=2*u+d,p=n*2+i,m=r+1,h=new X,g=new X;for(let _=0;_<=p;_++){let v=0,y=0,b=0,x=0;if(_<=n){let t=_/n,r=t*Math.PI/2;y=-l-e*Math.cos(r),b=e*Math.sin(r),x=-e*Math.cos(r),v=t*u}else if(_<=n+i){let r=(_-n)/i;y=-l+r*t,b=e,x=0,v=u+r*d}else{let t=(_-n-i)/n,r=t*Math.PI/2;y=l+e*Math.sin(r),b=e*Math.cos(r),x=e*Math.sin(r),v=u+d+t*u}let S=Math.max(0,Math.min(1,v/f)),C=0;_===0?C=.5/r:_===p&&(C=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-b*a,g.y=y,g.z=b*i,o.push(g.x,g.y,g.z),h.set(-b*a,x,b*i),h.normalize(),s.push(h.x,h.y,h.z),c.push(t+C,S)}if(_>0){let e=(_-1)*m;for(let t=0;t<r;t++){let n=e+t,r=e+t+1,i=_*m+t,o=_*m+t+1;a.push(n,r,i),a.push(r,o,i)}}}this.setIndex(a),this.setAttribute(`position`,new Q(o,3)),this.setAttribute(`normal`,new Q(s,3)),this.setAttribute(`uv`,new Q(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},ns=class e extends Ei{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new X,l=new Y;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new Q(a,3)),this.setAttribute(`normal`,new Q(o,3)),this.setAttribute(`uv`,new Q(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},rs=class e extends Ei{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new Q(u,3)),this.setAttribute(`normal`,new Q(d,3)),this.setAttribute(`uv`,new Q(f,2));function _(){let a=new X,_=new X,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new Y,m=new X,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},is=class e extends rs{constructor(e=1,t=1,n=32,r=1,i=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}static fromJSON(t){return new e(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},as=class e extends Ei{constructor(e=[],t=[],n=1,r=0){super(),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new Q(i,3)),this.setAttribute(`normal`,new Q(i.slice(),3)),this.setAttribute(`uv`,new Q(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){let n=new X,r=new X,i=new X;for(let a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){let i=r+1,a=[];for(let r=0;r<=i;r++){a[r]=[];let o=e.clone().lerp(n,r/i),s=t.clone().lerp(n,r/i),c=i-r;for(let e=0;e<=c;e++)e===0&&r===i?a[r][e]=o:a[r][e]=o.clone().lerp(s,e/c)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){let n=Math.floor(t/2);t%2==0?(d(a[e][n+1]),d(a[e+1][n]),d(a[e][n])):(d(a[e][n+1]),d(a[e+1][n+1]),d(a[e+1][n]))}}function c(e){let t=new X;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){let e=new X;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];let n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(let e=0;e<a.length;e+=6){let t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){let r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){let e=new X,t=new X,n=new X,r=new X,o=new Y,s=new Y,c=new Y;for(let l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);let d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.vertices,t.indices,t.radius,t.detail)}},os=class e extends as{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];super(i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},ss=new X,cs=new X,ls=new X,us=new Ir,ds=class extends Ei{constructor(e=null,t=1){if(super(),this.type=`EdgesGeometry`,this.parameters={geometry:e,thresholdAngle:t},e!==null){let n=1e4,r=Math.cos(Bt*t),i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=[0,0,0],c=[`a`,`b`,`c`],l=[,,,],u={},d=[];for(let e=0;e<o;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:o,c:f}=us;if(t.fromBufferAttribute(a,s[0]),o.fromBufferAttribute(a,s[1]),f.fromBufferAttribute(a,s[2]),us.getNormal(ls),l[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,l[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,l[2]=`${Math.round(f.x*n)},${Math.round(f.y*n)},${Math.round(f.z*n)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,n=l[e],i=l[t],a=us[c[e]],o=us[c[t]],f=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(ls.dot(u[p].normal)<=r&&(d.push(a.x,a.y,a.z),d.push(o.x,o.y,o.z)),u[p]=null):f in u||(u[f]={index0:s[e],index1:s[t],normal:ls.clone()})}}for(let e in u)if(u[e]){let{index0:t,index1:n}=u[e];ss.fromBufferAttribute(a,t),cs.fromBufferAttribute(a,n),d.push(ss.x,ss.y,ss.z),d.push(cs.x,cs.y,cs.z)}this.setAttribute(`position`,new Q(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},fs=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){q(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new Y:new X);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new X,r=[],i=[],a=[],o=new X,s=new Rn;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new X)}i[0]=new X,a[0]=new X;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(Ut(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(Ut(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},ps=class extends fs{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new Y){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},ms=class extends ps{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}};function hs(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}var gs=new X,_s=new X,vs=new hs,ys=new hs,bs=new hs,xs=class extends fs{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new X){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(_s.subVectors(r[0],r[1]).add(r[0]),c=_s);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(gs.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=gs),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),vs.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),ys.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),bs.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(vs.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),ys.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),bs.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(vs.calc(s),ys.calc(s),bs.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new X().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Ss(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Cs(e,t){let n=1-e;return n*n*t}function ws(e,t){return 2*(1-e)*e*t}function Ts(e,t){return e*e*t}function Es(e,t,n,r){return Cs(e,t)+ws(e,n)+Ts(e,r)}function Ds(e,t){let n=1-e;return n*n*n*t}function Os(e,t){let n=1-e;return 3*n*n*e*t}function ks(e,t){return 3*(1-e)*e*e*t}function As(e,t){return e*e*e*t}function js(e,t,n,r,i){return Ds(e,t)+Os(e,n)+ks(e,r)+As(e,i)}var Ms=class extends fs{constructor(e=new Y,t=new Y,n=new Y,r=new Y){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Y){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(js(e,r.x,i.x,a.x,o.x),js(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Ns=class extends fs{constructor(e=new X,t=new X,n=new X,r=new X){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new X){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(js(e,r.x,i.x,a.x,o.x),js(e,r.y,i.y,a.y,o.y),js(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Ps=class extends fs{constructor(e=new Y,t=new Y){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new Y){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Y){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Fs=class extends fs{constructor(e=new X,t=new X){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new X){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new X){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Is=class extends fs{constructor(e=new Y,t=new Y,n=new Y){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Y){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Es(e,r.x,i.x,a.x),Es(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ls=class extends fs{constructor(e=new X,t=new X,n=new X){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new X){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Es(e,r.x,i.x,a.x),Es(e,r.y,i.y,a.y),Es(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Rs=class extends fs{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new Y){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ss(o,s.x,c.x,l.x,u.x),Ss(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new Y().fromArray(n))}return this}},zs=Object.freeze({__proto__:null,ArcCurve:ms,CatmullRomCurve3:xs,CubicBezierCurve:Ms,CubicBezierCurve3:Ns,EllipseCurve:ps,LineCurve:Ps,LineCurve3:Fs,QuadraticBezierCurve:Is,QuadraticBezierCurve3:Ls,SplineCurve:Rs}),Bs=class extends fs{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new zs[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new zs[n.type]().fromJSON(n))}return this}},Vs=class extends Bs{constructor(e){super(),this.type=`Path`,this.currentPoint=new Y,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new Ps(this.currentPoint.clone(),new Y(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new Is(this.currentPoint.clone(),new Y(e,t),new Y(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new Ms(this.currentPoint.clone(),new Y(e,t),new Y(n,r),new Y(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=new Rs([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new ps(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Hs=class extends Vs{constructor(e){super(e),this.uuid=Ht(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new Vs().fromJSON(n))}return this}};function Us(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Ws(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=Zs(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Ks(a,o,n,s,c,l,0),o}function Ws(e,t,n,r,i){let a;if(i===xc(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=vc(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=vc(i/r|0,e[i],e[i+1],a);return a&&uc(a,a.next)&&(yc(a),a=a.next),a}function Gs(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(uc(n,n.next)||lc(n.prev,n,n.next)===0)){if(yc(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Ks(e,t,n,r,i,a,o){if(!e)return;!o&&a&&nc(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Js(e,r,i,a):qs(e))t.push(c.i,e.i,l.i),yc(e),e=l.next,s=l.next;else if(e=l,e===s){o?o===1?(e=Ys(Gs(e),t),Ks(e,t,n,r,i,a,2)):o===2&&Xs(e,t,n,r,i,a):Ks(Gs(e),t,n,r,i,a,1);break}}}function qs(e){let t=e.prev,n=e,r=e.next;if(lc(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&sc(i,s,a,c,o,l,m.x,m.y)&&lc(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Js(e,t,n,r){let i=e.prev,a=e,o=e.next;if(lc(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=ic(p,m,t,n,r),v=ic(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&sc(s,u,c,d,l,f,y.x,y.y)&&lc(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&sc(s,u,c,d,l,f,b.x,b.y)&&lc(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&sc(s,u,c,d,l,f,y.x,y.y)&&lc(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&sc(s,u,c,d,l,f,b.x,b.y)&&lc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ys(e,t){let n=e;do{let r=n.prev,i=n.next.next;!uc(r,i)&&dc(r,n,n.next,i)&&hc(r,i)&&hc(i,r)&&(t.push(r.i,n.i,i.i),yc(n),yc(n.next),n=e=i),n=n.next}while(n!==e);return Gs(n)}function Xs(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&cc(o,e)){let s=_c(o,e);o=Gs(o,o.next),s=Gs(s,s.next),Ks(o,t,n,r,i,a,0),Ks(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Zs(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Ws(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(ac(o))}i.sort(Qs);for(let e=0;e<i.length;e++)n=$s(i[e],n);return n}function Qs(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function $s(e,t){let n=ec(e,t);if(!n)return t;let r=_c(n,e);return Gs(r,r.next),Gs(n,n.next)}function ec(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(uc(e,n))return n;do{if(uc(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&oc(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);hc(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&tc(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function tc(e,t){return lc(e.prev,e,t.prev)<0&&lc(t.next,e,e.next)<0}function nc(e,t,n,r){let i=e;do i.z===0&&(i.z=ic(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,rc(i)}function rc(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function ic(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function ac(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function oc(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function sc(e,t,n,r,i,a,o,s){return(e!==o||t!==s)&&oc(e,t,n,r,i,a,o,s)}function cc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!mc(e,t)&&(hc(e,t)&&hc(t,e)&&gc(e,t)&&(lc(e.prev,e,t.prev)||lc(e,t.prev,t))||uc(e,t)&&lc(e.prev,e,e.next)>0&&lc(t.prev,t,t.next)>0)}function lc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function uc(e,t){return e.x===t.x&&e.y===t.y}function dc(e,t,n,r){let i=pc(lc(e,t,n)),a=pc(lc(e,t,r)),o=pc(lc(n,r,e)),s=pc(lc(n,r,t));return!!(i!==a&&o!==s||i===0&&fc(e,n,t)||a===0&&fc(e,r,t)||o===0&&fc(n,e,r)||s===0&&fc(n,t,r))}function fc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function pc(e){return e>0?1:e<0?-1:0}function mc(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&dc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function hc(e,t){return lc(e.prev,e,e.next)<0?lc(e,t,e.next)>=0&&lc(e,e.prev,t)>=0:lc(e,t,e.prev)<0||lc(e,e.next,t)<0}function gc(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function _c(e,t){let n=bc(e.i,e.x,e.y),r=bc(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function vc(e,t,n,r){let i=bc(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function yc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function bc(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xc(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var Sc=class{static triangulate(e,t,n=2){return Us(e,t,n)}},Cc=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];wc(e),Tc(n,e);let a=e.length;t.forEach(wc);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,Tc(n,t[e]);let o=Sc.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}};function wc(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Tc(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Ec=class e extends Ei{constructor(e=new Hs([new Y(.5,.5),new Y(-.5,.5),new Y(-.5,-.5),new Y(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new Q(r,3)),this.setAttribute(`uv`,new Q(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0||t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Dc:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new X,b=new X,x=new X}l||(p=0,u=0,d=0,f=0);let S=e.extractPoints(o),C=S.shape,w=S.holes;if(!Cc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];Cc.isClockWise(t)&&(w[e]=t.reverse())}}function T(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));s<=10000000000000001e-36*c*c?(e.splice(r,1),n--):t=i}}T(C),w.forEach(T);let E=w.length,D=C;for(let e=0;e<E;e++){let t=w[e];C=C.concat(t)}function O(e,t,n){return t||J(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let k=C.length;function A(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new Y(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new Y(r/a,i/a)}let j=[];for(let e=0,t=D.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),j[e]=A(D[e],D[n],D[r]);let M=[],N,P=j.concat();for(let e=0,t=E;e<t;e++){let t=w[e];N=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),N[e]=A(t[e],t[r],t[i]);M.push(N),P=P.concat(N)}let F;if(p===0)F=Cc.triangulateShape(D,w);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=D.length;t<n;t++){let n=O(D[t],j[t],a);te(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=E;e<n;e++){let n=w[e];N=M[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=O(n[e],N[e],a);te(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}F=Cc.triangulateShape(e,t)}let I=F.length,ee=d+f;for(let e=0;e<k;e++){let t=l?O(C[e],P[e],ee):C[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),te(x.x,x.y,x.z)):te(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<k;t++){let n=l?O(C[t],P[t],ee):C[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),te(x.x,x.y,x.z)):te(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=D.length;e<t;e++){let t=O(D[e],j[e],r);te(t.x,t.y,c+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];N=M[e];for(let e=0,i=t.length;e<i;e++){let i=O(t[e],N[e],r);_?te(i.x,i.y+g[s-1].y,g[s-1].x+n):te(i.x,i.y,c+n)}}}L(),R();function L(){let e=r.length/3;if(l){let e=0,t=k*e;for(let e=0;e<I;e++){let n=F[e];B(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=k*e;for(let e=0;e<I;e++){let n=F[e];B(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<I;e++){let t=F[e];B(t[2],t[1],t[0])}for(let e=0;e<I;e++){let t=F[e];B(t[0]+k*s,t[1]+k*s,t[2]+k*s)}}n.addGroup(e,r.length/3-e,0)}function R(){let e=r.length/3,t=0;z(D,t),t+=D.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];z(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function z(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=k*e,a=k*(e+1);V(t+r+n,t+i+n,t+i+a,t+r+a)}}}function te(e,t,n){a.push(e),a.push(t),a.push(n)}function B(e,t,i){H(e),H(t),H(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);ne(o[0]),ne(o[1]),ne(o[2])}function V(e,t,i,a){H(e),H(t),H(a),H(t),H(i),H(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);ne(s[0]),ne(s[1]),ne(s[3]),ne(s[1]),ne(s[2]),ne(s[3])}function H(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function ne(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Oc(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new zs[i.type]().fromJSON(i)),new e(r,t.options)}},Dc={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new Y(a,o),new Y(s,c),new Y(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new Y(o,1-c),new Y(l,1-d),new Y(f,1-m),new Y(h,1-_)]:[new Y(s,1-c),new Y(u,1-d),new Y(p,1-m),new Y(g,1-_)]}};function Oc(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}var kc=class e extends as{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];super(r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},Ac=class e extends Ei{constructor(e=[new Y(0,-.5),new Y(.5,0),new Y(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=Ut(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new X,d=new Y,f=new X,p=new X,m=new X,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new Q(a,3)),this.setAttribute(`uv`,new Q(o,2)),this.setAttribute(`normal`,new Q(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},jc=class e extends as{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},Mc=class e extends Ei{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new Q(p,3)),this.setAttribute(`normal`,new Q(m,3)),this.setAttribute(`uv`,new Q(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},Nc=class e extends Ei{constructor(e=.5,t=1,n=32,r=1,i=0,a=Math.PI*2){super(),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);let o=[],s=[],c=[],l=[],u=e,d=(t-e)/r,f=new X,p=new Y;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;f.x=u*Math.cos(r),f.y=u*Math.sin(r),s.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,l.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r,a=r+n+1,s=r+n+2,c=r+1;o.push(i,a,c),o.push(a,s,c)}}this.setIndex(o),this.setAttribute(`position`,new Q(s,3)),this.setAttribute(`normal`,new Q(c,3)),this.setAttribute(`uv`,new Q(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Pc=class e extends Ei{constructor(e=new Hs([new Y(0,.5),new Y(-.5,-.5),new Y(.5,-.5)]),t=12){super(),this.type=`ShapeGeometry`,this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(let t=0;t<e.length;t++)c(e[t]),this.addGroup(o,s,t),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new Q(r,3)),this.setAttribute(`normal`,new Q(i,3)),this.setAttribute(`uv`,new Q(a,2));function c(e){let o=r.length/3,c=e.extractPoints(t),l=c.shape,u=c.holes;Cc.isClockWise(l)===!1&&(l=l.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];Cc.isClockWise(t)===!0&&(u[e]=t.reverse())}let d=Cc.triangulateShape(l,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];l=l.concat(t)}for(let e=0,t=l.length;e<t;e++){let t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],r=t[0]+o,i=t[1]+o,a=t[2]+o;n.push(r,i,a),s+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return Fc(t,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}return new e(r,t.curveSegments)}};function Fc(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}var Ic=class e extends Ei{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new X,d=new X,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=0;f===0&&a===0?v=.5/t:f===n&&s===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){let s=n/t;u.x=-e*Math.cos(r+s*i)*Math.sin(a+_*o),u.y=e*Math.cos(a+_*o),u.z=e*Math.sin(r+s*i)*Math.sin(a+_*o),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(s+v,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new Q(p,3)),this.setAttribute(`normal`,new Q(m,3)),this.setAttribute(`uv`,new Q(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Lc=class e extends as{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},Rc=class e extends Ei{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new X,f=new X,p=new X;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new Q(c,3)),this.setAttribute(`normal`,new Q(l,3)),this.setAttribute(`uv`,new Q(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},zc=class e extends Ei{constructor(e=1,t=.4,n=64,r=8,i=2,a=3){super(),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},n=Math.floor(n),r=Math.floor(r);let o=[],s=[],c=[],l=[],u=new X,d=new X,f=new X,p=new X,m=new X,h=new X,g=new X;for(let o=0;o<=n;++o){let v=o/n*i*Math.PI*2;_(v,i,a,e,f),_(v+.01,i,a,e,p),h.subVectors(p,f),g.addVectors(p,f),m.crossVectors(h,g),g.crossVectors(m,h),m.normalize(),g.normalize();for(let e=0;e<=r;++e){let i=e/r*Math.PI*2,a=-t*Math.cos(i),p=t*Math.sin(i);u.x=f.x+(a*g.x+p*m.x),u.y=f.y+(a*g.y+p*m.y),u.z=f.z+(a*g.z+p*m.z),s.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),l.push(o/n),l.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,s=(r+1)*(e-1)+t;o.push(n,i,s),o.push(i,a,s)}this.setIndex(o),this.setAttribute(`position`,new Q(s,3)),this.setAttribute(`normal`,new Q(c,3)),this.setAttribute(`uv`,new Q(l,2));function _(e,t,n,r,i){let a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Bc=class e extends Ei{constructor(e=new Ls(new X(-1,-1,0),new X(-1,1,0),new X(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new X,s=new X,c=new Y,l=new X,u=[],d=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute(`position`,new Q(u,3)),this.setAttribute(`normal`,new Q(d,3)),this.setAttribute(`uv`,new Q(f,2));function m(){for(let e=0;e<t;e++)h(e);h(i===!1?t:0),_(),g()}function h(i){l=e.getPointAt(i/t,l);let c=a.normals[i],f=a.binormals[i];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);s.x=a*c.x+i*f.x,s.y=a*c.y+i*f.y,s.z=a*c.z+i*f.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}function g(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;p.push(n,i,o),p.push(i,a,o)}}function _(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(t){return new e(new zs[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},Vc=class extends Ei{constructor(e=null){if(super(),this.type=`WireframeGeometry`,this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new X,i=new X;if(e.index!==null){let a=e.attributes.position,o=e.index,s=e.groups;s.length===0&&(s=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,c=s.length;e<c;++e){let c=s[e],l=c.start,u=c.count;for(let e=l,s=l+u;e<s;e+=3)for(let s=0;s<3;s++){let c=o.getX(e+s),l=o.getX(e+(s+1)%3);r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,l),Hc(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let a=e.attributes.position;for(let e=0,o=a.count/3;e<o;e++)for(let o=0;o<3;o++){let s=3*e+o,c=3*e+(o+1)%3;r.fromBufferAttribute(a,s),i.fromBufferAttribute(a,c),Hc(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute(`position`,new Q(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function Hc(e,t,n){let r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}var Uc=Object.freeze({__proto__:null,BoxGeometry:es,CapsuleGeometry:ts,CircleGeometry:ns,ConeGeometry:is,CylinderGeometry:rs,DodecahedronGeometry:os,EdgesGeometry:ds,ExtrudeGeometry:Ec,IcosahedronGeometry:kc,LatheGeometry:Ac,OctahedronGeometry:jc,PlaneGeometry:Mc,PolyhedronGeometry:as,RingGeometry:Nc,ShapeGeometry:Pc,SphereGeometry:Ic,TetrahedronGeometry:Lc,TorusGeometry:Rc,TorusKnotGeometry:zc,TubeGeometry:Bc,WireframeGeometry:Vc}),Wc=class extends ji{constructor(e){super(),this.isShadowMaterial=!0,this.type=`ShadowMaterial`,this.color=new Z(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function Gc(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(qc(i))i.isRenderTargetTexture?(q(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i)){if(qc(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice()}else t[n][r]=i}}return t}function Kc(e){let t={};for(let n=0;n<e.length;n++){let r=Gc(e[n]);for(let e in r)t[e]=r[e]}return t}function qc(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Jc(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Yc(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:bn.workingColorSpace}var Xc={clone:Gc,merge:Kc},Zc=`void main() {
2
35
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
36
  }`,Qc=`void main() {
@@ -4115,7 +4148,7 @@ void main() {`).replace(`#include <project_vertex>`,`#include <project_vertex>
4115
4148
  vec4 cc = corner.x > 0.5 ? cb : ca;
4116
4149
  cc.xy += (vec2(-dd.y, dd.x) * corner.y + dd * (corner.x * 2.0 - 1.0)) * uWidth * 0.5 / (uRes * 0.5) * cc.w;
4117
4150
  cc.z -= 2e-4 * cc.w;
4118
- gl_Position = cc;`),n.userData.wideU=e.uniforms},n.customProgramCacheKey=()=>`unit-outline-wide`,r.onBeforeRender=e=>{e.getDrawingBufferSize(o);let t=n.userData.wideU;t&&(t.uWidth.value=a.unitStrokePx*e.getPixelRatio())},r.castShadow=r.receiveShadow=!1,r.raycast=()=>{},r}static labelMax=0;static unitStroke=0;static labelSnap=45;static levelNames=[];static levelShortNames=[];static markers=[];static fixtures=[];static homeCenter=[0,0];static bounds=[0,0,0,0];static scale=.5;static storeyHeight=2.4;static groundLevel=0;static title=null;static _venueName=``;static _venueTail=``;static get venueText(){let e=r;return e._venueTail?`${String(e.title||``).trim()||e._venueName||`this venue`}, ${e._venueTail}`:``}static sceneText=``;static boundsText=``;static homeExtent=[56,36];static homeHull=[];static topHull=[];static convexHull(e){let t=(e||[]).filter(e=>e&&isFinite(e[0])&&isFinite(e[1])).slice().sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(t.length<3)return t;let n=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),r=[],i=[];t.forEach(e=>{for(;r.length>=2&&n(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)});for(let e=t.length-1;e>=0;e--){let r=t[e];for(;i.length>=2&&n(i[i.length-2],i[i.length-1],r)<=0;)i.pop();i.push(r)}return r.slice(0,-1).concat(i.slice(0,-1))}static unitGap=.14;static unitRadius=0;static floorRadius=0;static voidBarriers=!0;static unitHeightScale=1;static unitBase=null;static levelSpan=0;static floorColors=[`#f4f4f5`,`#e4e4e7`];static groundColors=[`#f4f4f5`,`#e4e4e7`];static categoryHours={};static defaultHours=``;static amenityHours=``;static UNIT_PALETTE_KEYS={nb:`default`,hv:`hover`,ft:`focus`,fs:`focus_hover`,am:`amenity`,sv:`service`};static UNIT_PALETTE_DEFAULT={nb:[`#ffffff`,`#d4d4d8`,`#a1a1aa`],hv:[`#f2f6fd`,`#c3d0e3`,`#3f3f46`],ft:[`#e1ecff`,`#a9bddb`,`#0a2a5e`],fs:[`#cfe0fb`,`#93acd6`,`#0a2a5e`],am:[`#f4f4f5`,`#d4d4d8`,`#71717a`],sv:[`#ececee`,`#d4d4d8`,`#71717a`]};static unitPalette=r.UNIT_PALETTE_DEFAULT;static UNIT_PALETTE_DARK={nb:[`#27272a`,`#3f3f46`,`#a1a1aa`],hv:[`#424249`,`#5a5a63`,`#fafafa`],ft:[`#1a4380`,`#3164ad`,`#e6f0ff`],fs:[`#2256a0`,`#4579c2`,`#ffffff`],am:[`#202023`,`#3f3f46`,`#a1a1aa`],sv:[`#1c1c1f`,`#3f3f46`,`#a1a1aa`]};static SCENE_PALETTE={light:{floor:[`#f4f4f5`,`#e4e4e7`],ground:[`#f4f4f5`,`#e4e4e7`],background:`#ffffff`,ink:`#09090b`,glass:`#f6f9fe`,rail:`#ccd5e2`,fixture:`#ffffff`,fixtureAlt:`#ececee`,fixtureEdge:`#d4d4d8`,step:[`#ffffff`,`#e4e4e7`,`#d4d4d8`],lift:[`#fafafa`,`#52525b`],escalator:[`#e4e4e7`,`#ffffff`,`#d4d4d8`],escalatorActive:[`#3f3f46`,`#52525b`,`#27272a`],storefront:`#e4e4e7`,routeHalo:`#ffffff`,groundLight:`#e4e4e7`},dark:{floor:[`#18181b`,`#27272a`],ground:[`#111113`,`#27272a`],background:`#09090b`,ink:`#fafafa`,glass:`#2f2f35`,rail:`#3f3f46`,fixture:`#3f3f46`,fixtureAlt:`#27272a`,fixtureEdge:`#52525b`,step:[`#3f3f46`,`#27272a`,`#52525b`],lift:[`#3f3f46`,`#d4d4d8`],escalator:[`#3f3f46`,`#27272a`,`#52525b`],escalatorActive:[`#d4d4d8`,`#a1a1aa`,`#e4e4e7`],storefront:`#3f3f46`,routeHalo:`#3f3f46`,groundLight:`#3f3f46`}};static scheme=`light`;static ACCENT_DEFAULT=`#1476ff`;static accent=`#1476ff`;static accentTokens(e,t){let n=r,i=n.toOklch(e);if(!i)return null;let[a,o,s]=i,c=(e,t)=>n.fromOklch(e,t,s),l=`#ffffff`,u=`#09090b`,d=n.contrast(e,l)>=n.contrast(e,u)?l:u,f=n.hexRgb(e),p=e=>`rgba(`+f.join(`,`)+`,`+e+`)`;if(!t){let t=c(.96,o*.22),r=c(.92,o*.32);return{accent:e,"accent-hover":c(a-.07,o),"accent-subtle":t,"accent-subtle-hover":r,"accent-subtle-fg":n.readableOn(t,c(Math.min(a,.52),o)),"accent-ring":p(.25),"fg-on-accent":d,focus:t,"focus-hover":r,"focus-fg":n.readableOn(t,c(.3,o*.6))}}let m=c(.28,o*.38),h=c(.33,o*.42);return{accent:e,"accent-hover":c(a+.07,o),"accent-subtle":m,"accent-subtle-hover":h,"accent-subtle-fg":n.readableOn(m,c(.82,o*.6)),"accent-ring":p(.45),"fg-on-accent":d,focus:m,"focus-hover":h,"focus-fg":n.readableOn(m,c(.92,o*.3))}}static accentUnits(e,t){let n=r,i=n.toOklch(e);if(!i)return null;let[,a,o]=i,s=(e,t)=>n.fromOklch(e,t,o);return t?{hv:[s(.3,a*.35),s(.42,a*.4),n.readableOn(s(.3,a*.35),s(.92,a*.25))],ft:[s(.33,a*.45),s(.45,a*.5),n.readableOn(s(.33,a*.45),s(.92,a*.25))],fs:[s(.39,a*.5),s(.52,a*.55),n.readableOn(s(.39,a*.5),`#ffffff`)]}:{hv:[s(.96,a*.2),s(.85,a*.3),n.readableOn(s(.96,a*.2),s(.3,a*.6))],ft:[s(.93,a*.3),s(.8,a*.4),n.readableOn(s(.93,a*.3),s(.3,a*.6))],fs:[s(.88,a*.4),s(.72,a*.5),n.readableOn(s(.88,a*.4),s(.3,a*.6))]}}static scenePalette=r.SCENE_PALETTE.light;static applyScheme(e){let t=r,n=e&&e.theme||{},i=t.scheme===`dark`,a=i&&n.dark||{},o=t.SCENE_PALETTE[i?`dark`:`light`],s=n.units||{},c=a.units||{};t.scenePalette=o;let l=(e,n)=>n!==`nb`&&s[e]&&String(s[e][0]).toLowerCase()===t.UNIT_PALETTE_DEFAULT[n][0];t.unitPalette=Object.fromEntries(Object.entries(t.UNIT_PALETTE_KEYS).map(([e,n])=>[e,i?c[n]||(s[n]&&!l(n,e)?t.darkColors(s[n]):t.UNIT_PALETTE_DARK[e]):s[n]||t.UNIT_PALETTE_DEFAULT[e]]));let u=t.accent&&t.accent.toLowerCase()!==t.ACCENT_DEFAULT?t.accentUnits(t.accent,i):null;u&&[[`ft`,`focus`],[`fs`,`focus_hover`]].forEach(([e,n])=>{i&&c[n]||s[n]||(t.unitPalette[e]=u[e])});let d=e=>a[e]||(n[e]?i?n[e].map(e=>t.toDark(e)):n[e]:o[e]);t.floorColors=d(`floor`),t.groundColors=d(`ground`);let f=Object.assign({},t.STOREFRONT_DEFAULT,n.storefront||{});i&&f.color&&(f.color=t.toDark(f.color)),t.storefront=Object.assign(f,a.storefront||{})}static hexRgb(e){let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(e||``).trim());if(!t)return null;let n=t[1].length===3?t[1].replace(/./g,e=>e+e):t[1];return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}static toOklch(e){let t=r.hexRgb(e);if(!t)return null;let[n,i,a]=t.map(e=>(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4),o=Math.cbrt(.4122214708*n+.5363325363*i+.0514459929*a),s=Math.cbrt(.2119034982*n+.6806995451*i+.1073969566*a),c=Math.cbrt(.0883024619*n+.2817188376*i+.6299787005*a),l=.2104542553*o+.793617785*s-.0040720468*c,u=1.9779984951*o-2.428592205*s+.4505937099*c,d=.0259040371*o+.7827717662*s-.808675766*c;return[l,Math.hypot(u,d),Math.atan2(d,u)]}static fromOklch(e,t,n){let r=t=>{let r=t*Math.cos(n),i=t*Math.sin(n),a=(e+.3963377774*r+.2158037573*i)**3,o=(e-.1055613458*r-.0638541728*i)**3,s=(e-.0894841775*r-1.291485548*i)**3,c=[4.0767416621*a-3.3077115913*o+.2309699292*s,-1.2684380046*a+2.6097574011*o-.3413193965*s,-.0041960863*a-.7034186147*o+1.707614701*s];return c.some(e=>e<-5e-4||e>1.0005)?null:`#`+c.map(e=>(e=Math.max(0,Math.min(1,e)),e=e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,Math.round(e*255).toString(16).padStart(2,`0`))).join(``)};e=Math.max(0,Math.min(1,e));for(let e=t;e>.001;e*=.9){let t=r(e);if(t)return t}return r(0)}static luminance(e){let t=r.hexRgb(e);if(!t)return null;let[n,i,a]=t.map(e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*n+.7152*i+.0722*a}static contrast(e,t){let n=r.luminance(e),i=r.luminance(t);return n==null||i==null?21:(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}static toDark(e){let t=r.toOklch(e);if(!t)return e;let[n,i,a]=t,o=n>=.75?.17+.52*(n-.75):.17+(.75-n)*.6;return r.fromOklch(o,i*(n>=.75?.9:.75),a)}static isAchromatic(e){let t=r.toOklch(e);return!!t&&t[1]<.04}static svgIsMono(e){let t=String(e||``),n=/(?:fill|stroke|stop-color|color)\s*[:=]\s*["']?([a-z]+)/gi,i=[`none`,`currentcolor`,`black`,`white`,`transparent`,`inherit`,`gray`,`grey`,`url`],a;for(;a=n.exec(t);)if(!i.includes(a[1].toLowerCase()))return!1;return!(t.match(/rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+/gi)||[]).map(e=>e.replace(/rgba?\(/i,``).split(`,`).map(Number)).some(([e,t,n])=>Math.max(e,t,n)-Math.min(e,t,n)>24)&&(t.match(/#[0-9a-f]{6}\b|#[0-9a-f]{3}\b/gi)||[]).every(e=>r.isAchromatic(e))}static imageIsMono(e){try{let t=document.createElement(`canvas`);t.width=t.height=48;let n=t.getContext(`2d`,{willReadFrequently:!0});n.drawImage(e,0,0,48,48);let r=n.getImageData(0,0,48,48).data,i=0,a=0;for(let e=0;e<r.length;e+=4)r[e+3]<32||(i++,Math.max(r[e],r[e+1],r[e+2])-Math.min(r[e],r[e+1],r[e+2])>40&&a++);return i>0&&a/i<.04}catch{return!1}}static THEME_DARK_MAP={surface:{"#3f3f46":`#d4d4d8`,"#52525b":`#a1a1aa`,"#27272a":`#e4e4e7`,"#dcefe0":`#1d5434`},edge:{"#a1a1aa":`#52525b`,"#d4d4d8":`#3f3f46`},line:{"#ffffff":`#52525b`},label:{"#ffffff":`#71717a`}};static themeSpec(e,t){return`theme:`+(t||`surface`)+`:`+(e??``)}static parseThemeSpec(e){if(typeof e!=`string`||e.slice(0,6)!==`theme:`)return null;let t=e.slice(6),n=t.lastIndexOf(`:`);return{role:t.slice(0,n),hex:t.slice(n+1)}}static themeColor(e,t){let n=r,i=n.scheme===`dark`,a=t||`surface`;if(a.slice(0,8)===`palette:`){let[e,t]=a.slice(8).split(`.`),r=n.scenePalette[e];return Array.isArray(r)?r[+t||0]:r}if(a.slice(0,6)===`floor.`)return n.floorColors[+a.slice(6)||0];if(a.slice(0,7)===`ground.`)return n.groundColors[+a.slice(7)||0];if(a===`accent`)return n.accent;if(a===`accent-dot`){let e=n.toOklch(n.accent);return i&&e?n.fromOklch(.86,e[1]*.45,e[2]):`#ffffff`}return a===`logo`?i&&(n.toOklch(e)||[0])[0]<.6?n.invertLightness(e):e:i?(n.THEME_DARK_MAP[a]||{})[String(e).toLowerCase()]||n.toDark(e):e}static resolveColor(e){let t=r.parseThemeSpec(e);return t?r.themeColor(t.hex,t.role):e}static invertLightness(e){let t=r.toOklch(e);return t?r.fromOklch(1-t[0]*.92,t[1],t[2]):e}static readableOn(e,t,n){let i=r,a=n||4.5,o=i.toOklch(t)||[.5,0,0],s=(i.toOklch(e)||[.5])[0];if(i.contrast(e,t)>=a)return t;let c=s<.6;for(let t=o[0];c?t<=1:t>=0;t+=c?.02:-.02){let n=i.fromOklch(t,o[1],o[2]);if(i.contrast(e,n)>=a)return n}return c?`#fafafa`:`#09090b`}static darkColors(e){let t=r,[n,i,a]=e||[],o=t.toDark(n),s=t.toOklch(o),c=t.toOklch(i||n);return[o,s&&c?t.fromOklch(s[0]+.08,Math.min(c[1],.12),c[1]>.02?c[2]:s[2]):i,t.readableOn(o,a?t.invertLightness(a):`#a1a1aa`)]}static pointInPolygon(e,t,n){let i=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){let o=e[r],s=e[a];o[1]>n!=s[1]>n&&t<(s[0]-o[0])*(n-o[1])/(s[1]-o[1])+o[0]&&(i=!i)}return i&&e.holes?!e.holes.some(e=>r.pointInPolygon(e,t,n)):i}static holeRings(e,t){return(e.coordinates||[]).slice(1).map(e=>r.dedupeRing(e.slice(0,-1).map(t))).filter(e=>e.length>=3)}static closestPointOnPolygon(e,t){let n=null,r=1e9;return e.forEach((i,a)=>{let o=e[(a+1)%e.length],s=o[0]-i[0],c=o[1]-i[1],l=s*s+c*c||1,u=Math.max(0,Math.min(1,((t[0]-i[0])*s+(t[1]-i[1])*c)/l)),d=[i[0]+s*u,i[1]+c*u],f=Math.hypot(d[0]-t[0],d[1]-t[1]);f<r&&(r=f,n=d)}),[n,r]}static rectPoints(e,t,n,r){return[[e,n],[t,n],[t,r],[e,r]]}static polygonBounds(e){return[Math.min(...e.map(e=>e[0])),Math.max(...e.map(e=>e[0])),Math.min(...e.map(e=>e[1])),Math.max(...e.map(e=>e[1]))]}static hashRandom(e,t){let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)}static slugify(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/&/g,`and`).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}static signedArea(e){let t=0;return e.forEach((n,r)=>{let i=e[(r+1)%e.length];t+=n[0]*i[1]-i[0]*n[1]}),t/2}static edgeNormal(e,t,n){let r=t[0]-e[0],i=t[1]-e[1],a=Math.hypot(r,i),o=i/a,s=-r/a;return n<0&&(o=-o,s=-s),[o,s]}static untangle(e){let t=(e,t,n,r)=>{let i=[t[0]-e[0],t[1]-e[1]],a=[r[0]-n[0],r[1]-n[1]],o=i[0]*a[1]-i[1]*a[0];if(Math.abs(o)<1e-12)return null;let s=((n[0]-e[0])*a[1]-(n[1]-e[1])*a[0])/o,c=((n[0]-e[0])*i[1]-(n[1]-e[1])*i[0])/o;return s>1e-9&&s<1-1e-9&&c>1e-9&&c<1-1e-9?[e[0]+i[0]*s,e[1]+i[1]*s]:null},n=e.slice();for(let e=0;e<200&&n.length>3;e++){let e=n.length,i=null;for(let r=0;r<e&&!i;r++){let a=n[r],o=n[(r+1)%e],s=Math.min(a[0],o[0]),c=Math.max(a[0],o[0]),l=Math.min(a[1],o[1]),u=Math.max(a[1],o[1]);for(let d=r+2;d<e;d++){if(r===0&&d===e-1)continue;let f=n[d],p=n[(d+1)%e];if(Math.max(f[0],p[0])<s||Math.min(f[0],p[0])>c||Math.max(f[1],p[1])<l||Math.min(f[1],p[1])>u)continue;let m=t(a,o,f,p);if(m){i=[r,d,m];break}}}if(!i)break;let[a,o,s]=i,c=[s].concat(n.slice(a+1,o+1)),l=n.slice(0,a+1).concat([s],n.slice(o+1));n=Math.abs(r.signedArea(c))>Math.abs(r.signedArea(l))?c:l}return n}static insetPolygon(e,t){let n=e.length,i=r.signedArea(e),a=e.map((a,o)=>{let s=e[(o+1)%n],[c,l]=r.edgeNormal(a,s,i);return{p:[a[0]-c*t,a[1]-l*t],d:[s[0]-a[0],s[1]-a[1]]}});return e.map((r,i)=>{let o=a[(i-1+n)%n],s=a[i],c=o.d[0]*s.d[1]-o.d[1]*s.d[0];if(Math.abs(c)<1e-9)return s.p;let l=((s.p[0]-o.p[0])*s.d[1]-(s.p[1]-o.p[1])*s.d[0])/c,u=[o.p[0]+o.d[0]*l,o.p[1]+o.d[1]*l];return Math.hypot(u[0]-e[i][0],u[1]-e[i][1])>4*Math.abs(t)?s.p:u})}static vecBetween(e,t){return[t[0]-e[0],t[1]-e[1]]}static unitVector(e){let t=Math.hypot(e[0],e[1])||1;return[e[0]/t,e[1]/t]}static filletPolyline(e,t,n=14){let i=r.vecBetween,a=r.unitVector,o=[e[0]];for(let r=1;r<e.length-1;r++){let s=e[r],c=a(i(s,e[r-1])),l=a(i(s,e[r+1])),u=Math.acos(Math.max(-1,Math.min(1,c[0]*l[0]+c[1]*l[1]))),d=t/Math.tan(u/2),f=a([c[0]+l[0],c[1]+l[1]]),p=t/Math.sin(u/2),m=[s[0]+f[0]*p,s[1]+f[1]*p],h=[s[0]+c[0]*d,s[1]+c[1]*d],g=[s[0]+l[0]*d,s[1]+l[1]*d],_=Math.atan2(h[1]-m[1],h[0]-m[0]),v=Math.atan2(g[1]-m[1],g[0]-m[0])-_;for(;v>Math.PI;)v-=2*Math.PI;for(;v<-Math.PI;)v+=2*Math.PI;for(let e=0;e<=n;e++){let r=_+v*e/n;o.push([m[0]+t*Math.cos(r),m[1]+t*Math.sin(r)])}}return o.push(e[e.length-1]),o}static dashQuads(e,t,n,i){let a=[];for(let o=n/2;o+t<e.L;o+=t+n){let n=r.pointAlong(e,o),s=r.pointAlong(e,o+t),c=[-n.t[1],n.t[0]],l=[-s.t[1],s.t[0]];a.push([[n.p[0]+c[0]*i/2,n.p[1]+c[1]*i/2],[s.p[0]+l[0]*i/2,s.p[1]+l[1]*i/2],[s.p[0]-l[0]*i/2,s.p[1]-l[1]*i/2],[n.p[0]-c[0]*i/2,n.p[1]-c[1]*i/2]])}return a}static cornerFillet(e,t,n,r,i=8){let a=[e[0]+(t[0]+n[0])*r,e[1]+(t[1]+n[1])*r],o=[[e[0]+t[0]*r,e[1]+t[1]*r],e,[e[0]+n[0]*r,e[1]+n[1]*r]];for(let e=1;e<i;e++){let s=e/i*Math.PI/2;o.push([a[0]-t[0]*r*Math.cos(s)-n[0]*r*Math.sin(s),a[1]-t[1]*r*Math.cos(s)-n[1]*r*Math.sin(s)])}return o}static roundRectPoints(e,t,n,r,i){let a=[];return[[t-i,n+i,-Math.PI/2],[t-i,r-i,0],[e+i,r-i,Math.PI/2],[e+i,n+i,Math.PI]].forEach(([e,t,n])=>{for(let r=0;r<=3;r++){let o=n+r*Math.PI/6;a.push([e+Math.cos(o)*i,t+Math.sin(o)*i])}}),a}static VIEW_FIELDS=[`plugins`,`view`,`default_layer`];static applyView(e,t){let n=JSON.parse(JSON.stringify(e||{})),r=t?(n.views||[]).find(e=>e&&e.id===t):null;if(!r)return t&&console.warn(`mapplic: no view "`+t+`", showing Default`),n;let i=(e,t)=>(Object.entries(t||{}).forEach(([t,n])=>{n===null?delete e[t]:e[t]=JSON.parse(JSON.stringify(n))}),e),a=(r.plugins||{}).builtin||{};if(Object.keys(a).length){let e=n.plugins=n.plugins&&!Array.isArray(n.plugins)?n.plugins:{version:2,custom:[]},t=e.builtin=e.builtin||{};Object.entries(a).forEach(([e,n])=>{if(!n)return;let r=t[e]=t[e]||{};n.enabled===null?delete r.enabled:n.enabled!==void 0&&(r.enabled=!!n.enabled),n.settings&&(r.settings=i(Object.assign({},r.settings),n.settings))})}return r.view&&(n.view=i(Object.assign({},n.view),r.view)),r.default_layer===null?delete n.default_layer:r.default_layer!==void 0&&(n.default_layer=r.default_layer),n}static viewOverrides(e,t){let n=e=>JSON.stringify(e===void 0?null:e),r=(e,t)=>[...new Set(Object.keys(e||{}).concat(Object.keys(t||{})))],i=(e,t)=>{let i={};return r(e,t).forEach(r=>{n((e||{})[r])!==n((t||{})[r])&&(i[r]=(t||{})[r]===void 0?null:JSON.parse(n(t[r])))}),i},a=((e||{}).plugins||{}).builtin||{},o=((t||{}).plugins||{}).builtin||{},s={},c={};r(a,o).forEach(e=>{let t=a[e]||{},r=o[e]||{},c={};n(t.enabled)!==n(r.enabled)&&(c.enabled=r.enabled===void 0?null:!!r.enabled);let l=i(t.settings,r.settings);Object.keys(l).length&&(c.settings=l),Object.keys(c).length&&(s[e]=c)}),Object.keys(s).length&&(c.plugins={builtin:s});let l=i((e||{}).view,(t||{}).view);return Object.keys(l).length&&(c.view=l),n((e||{}).default_layer)!==n((t||{}).default_layer)&&(c.default_layer=(t||{}).default_layer===void 0?null:t.default_layer),c}static viewCount(e){let t=0;return Object.values(((e||{}).plugins||{}).builtin||{}).forEach(e=>{e&&(e.enabled!==void 0&&t++,t+=Object.keys(e.settings||{}).length)}),e&&e.view&&Object.keys(e.view).length&&t++,e&&e.default_layer!==void 0&&t++,t}static escapeHtml(e){let t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};return String(e??``).replace(/[&<>"]/g,e=>t[e])}static svgIcon(e,t=16,n=2){return`<svg width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="`+n+`" stroke-linecap="round" stroke-linejoin="round">`+e+`</svg>`}static pointAlong(e,t){let{P:n,cum:r}=e,i=1;for(;i<r.length-1&&r[i]<t;)i++;let a=n[i-1],o=n[i],s=r[i]-r[i-1]||1,c=(t-r[i-1])/s,l=Math.hypot(o[0]-a[0],o[1]-a[1])||1;return{p:[a[0]+(o[0]-a[0])*c,a[1]+(o[1]-a[1])*c],t:[(o[0]-a[0])/l,(o[1]-a[1])/l]}}static measurePolyline(e){let t=[0];for(let n=1;n<e.length;n++)t.push(t[n-1]+Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]));return{P:e,cum:t,L:t[t.length-1]}}static resample(e,t){if(e.length<2)return e.concat(e);let n=[e[0]];for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.max(1,Math.ceil(Math.hypot(a[0]-i[0],a[1]-i[1])/t));for(let e=1;e<=o;e++)n.push([i[0]+(a[0]-i[0])*e/o,i[1]+(a[1]-i[1])*e/o])}return n}static offsetPolyline(e,t){return e.map((n,r)=>{let i=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],o=Math.hypot(a[0]-i[0],a[1]-i[1])||1,s=[(a[0]-i[0])/o,(a[1]-i[1])/o];return[n[0]-s[1]*t,n[1]+s[0]*t]})}static PROJECTIONS=[`albers-usa`,`albers`,`lambert-conformal`,`mercator`,`equirectangular`];static projection(e,t,n){let r=6378137/(n||1),i=Math.PI/180,a=typeof e==`string`?{type:e}:e||{},o=a.center||t||[0,0],s=a.type||`mercator`,c=e=>{for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e},l=e=>Math.tan(Math.PI/4+Math.max(-1.5,Math.min(1.5,e))/2),u=(e,t,n,r,a)=>{let o=e*i;n*=i,r*=i;let s,u,d;if(a){s=(Math.sin(n)+Math.sin(r))/2;let e=Math.cos(n)**2+2*s*Math.sin(n);u=t=>Math.sqrt(Math.max(0,e-2*s*Math.sin(t)))/s,d=t=>Math.asin(Math.max(-1,Math.min(1,(e-(t*s)**2)/(2*s))))}else{s=Math.abs(n-r)<1e-9?Math.sin(n):Math.log(Math.cos(n)/Math.cos(r))/Math.log(l(r)/l(n));let e=Math.cos(n)*l(n)**s/s;u=t=>e/l(t)**s,d=t=>2*Math.atan((e/t)**(1/s))-Math.PI/2}let f=(e,t)=>{let n=s*c(e*i-o),r=u(t*i);return[r*Math.sin(n),-r*Math.cos(n)]},p=f(t[0],t[1]),m=Math.sign(s)||1;return{f:(e,t)=>{let n=f(e,t);return[n[0]-p[0],n[1]-p[1]]},inv:([e,t])=>{let n=e+p[0],r=t+p[1],a=m*Math.hypot(n,r),c=Math.atan2(n*m,-r*m);return[(o+c/s)/i,d(a)/i]}}},d=a.parallels||[o[1]-8,o[1]+8],f;if(s===`albers`||s===`lambert-conformal`)f=u(o[0],o,d[0],d[1],s===`albers`);else if(s===`equirectangular`){let e=Math.cos((a.parallel||0)*i);f={f:(t,n)=>[c((t-o[0])*i)*e,(n-o[1])*i],inv:([t,n])=>[o[0]+t/e/i,o[1]+n/i]}}else if(s===`albers-usa`){let e=(e,t,n,r)=>({f:(i,a)=>{let o=e.f(i,a);return[o[0]*t+n,o[1]*t+r]},inv:([i,a])=>e.inv([(i-n)/t,(a-r)/t])}),t=u(-96,[-96.6,38.7],29.5,45.5,!0),n=e(u(-154,[-156,58.5],55,65,!0),.35,-.307,-.201),i=e(u(-157,[-160,19.9],8,18,!0),1,-.205,-.212),a=e(u(-66,[-66,18],8,18,!0),1,.35,-.224),o=([e,r])=>r>50.5?n:r<30&&e<-150?i:r<19&&e>-68&&e<-64?a:t,s=e=>([t,n])=>{let i=e.f(t,n);return[i[0]*r,i[1]*r]},c=[[n,-180,-129,50.5,72],[i,-160.6,-154.6,18.8,22.4],[a,-68,-65,17.5,18.7]];return{pt:e=>s(o(e))(e),ring:e=>{let t=s(o(e[0]||[0,0]));return e.map(t)},inv:([e,i])=>{let a=[e/r,i/r];for(let[e,t,r,i,o]of c){let s=e.inv(a),c=s[0]>180?s[0]-360:s[0]<-180?s[0]+360:s[0];if((c>=t&&c<=r||e===n&&c>=170)&&s[1]>=i&&s[1]<=o)return[c,s[1]]}return t.inv(a)}}}else{let e=Math.log(l(o[1]*i));f={f:(t,n)=>[c((t-o[0])*i),Math.log(l(Math.max(-85,Math.min(85,n))*i))-e],inv:([t,n])=>[o[0]+t/i,(2*Math.atan(Math.exp(n+e))-Math.PI/2)/i]}}let p=([e,t])=>{let n=f.f(e,t);return[n[0]*r,n[1]*r]};return{pt:p,ring:e=>e.map(p),inv:([e,t])=>f.inv([e/r,t/r])}}static dedupeRing(e){let t=(e,t)=>Math.abs(e[0]-t[0])<1e-9&&Math.abs(e[1]-t[1])<1e-9,n=[];for(e.forEach(e=>{(!n.length||!t(n[n.length-1],e))&&n.push(e)});n.length>1&&t(n[0],n[n.length-1]);)n.pop();return n}static simplify(e,t){let n=(r,i)=>{let a=0,o=0,s=e[r],c=e[i],l=c[0]-s[0],u=c[1]-s[1],d=Math.hypot(l,u)||1e-9;for(let t=r+1;t<i;t++){let n=Math.abs(u*e[t][0]-l*e[t][1]+c[0]*s[1]-c[1]*s[0])/d;n>a&&(a=n,o=t)}return a>t?n(r,o).concat(n(o,i).slice(1)):[s,c]},r=0,i=0;if(e.forEach((t,n)=>{let a=Math.hypot(t[0]-e[0][0],t[1]-e[0][1]);a>i&&(i=a,r=n)}),!r)return e;let a=e.concat([e[0]]),o=function(t,r){let i=e;e=a;let o=n(t,r);return e=i,o},s=o(0,r).concat(o(r,e.length).slice(1));return s.pop(),s.length>=3?s:e}static localProjection(e){let t=e.origin||[0,0],n=6378137,r=Math.PI/180,i=(+e.rotation||0)*r,a=+e.scale||1,o=Math.cos(t[1]*r);return([e,s])=>{let c=(e-t[0])*r*n*o,l=(s-t[1])*r*n;return[(c*Math.cos(i)-l*Math.sin(i))/a,(c*Math.sin(i)+l*Math.cos(i))/a]}}static projectGeographic(e,t){let n=e.georef||{},i=(e.crs||{}).type===`geographic`,a=n.projection;try{let e=new URL(t,document.baseURI).searchParams.get(`projection`);e&&(a=e)}catch{}r.projectionName=i?typeof a==`string`?a:a&&a.type||`mercator`:null;let o=i?r.projection(a,n.origin,+n.scale||1):null;r.fromLngLat=o?o.pt:r.localProjection(n),r.toLngLat=o?o.inv:null;let s=e=>o.ring(e),c=(e,t)=>t===`Point`?o.pt(e):t===`LineString`||t===`MultiPoint`?s(e):t===`Polygon`||t===`MultiLineString`?e.map(s):e.map(e=>e.map(s)),l=[];(e.features||[]).forEach(e=>{let t=e.geometry,n=(e.properties||{}).mapplic||{};if(!t)return void l.push(e);o?t={type:t.type,coordinates:c(t.coordinates,t.type)}:t.type===`Point`&&Array.isArray(n.lngLat)&&(t={type:`Point`,coordinates:r.fromLngLat(n.lngLat)}),t.type===`MultiPolygon`?t.coordinates.forEach((t,n)=>l.push(Object.assign({},e,{id:n?e.id+`~`+n:e.id,geometry:{type:`Polygon`,coordinates:t}}))):l.push(t===e.geometry?e:Object.assign({},e,{geometry:t}))});let u=Object.assign({},e,{features:l});if(r.generatedBuilding=r.generatedSite=!1,!o)return u;let d=l.filter(e=>e.geometry&&e.geometry.type===`Polygon`).flatMap(e=>e.geometry.coordinates[0]);if(!d.length)return u;let f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=[Math.min(...f),Math.max(...f),Math.min(...p),Math.max(...p)],h=Math.max(m[1]-m[0],m[3]-m[2])*((e.theme||{}).site_padding??.06),g=[[m[0]-h,m[2]-h],[m[1]+h,m[2]-h],[m[1]+h,m[3]+h],[m[0]-h,m[3]+h],[m[0]-h,m[2]-h]],_=(e.layers||[]).map(e=>e.id);!l.some(e=>e.properties.feature_type===`site`)&&(r.generatedSite=!0)&&l.unshift({type:`Feature`,id:`geo-site`,geometry:{type:`Polygon`,coordinates:[g]},properties:{feature_type:`site`}}),!l.some(e=>e.properties.feature_type===`building`)&&(r.generatedBuilding=!0)&&l.unshift({type:`Feature`,id:`geo-building`,geometry:{type:`Polygon`,coordinates:[g]},properties:{feature_type:`building`,layers:_}});let v=e.view||{};return u.view=Object.assign({},v,{center:v.center?o.pt(v.center):[(m[0]+m[1])/2,(m[2]+m[3])/2]}),v.fit||(u.view.fit=[m[1]-m[0],m[3]-m[2]]),u}static placeLngLatLocations(e){let t=r.fromLngLat,n=e.default_layer||((e.layers||[])[0]||{}).id;t&&(e.locations||[]).forEach(r=>{let i=r.lngLat;if(!Array.isArray(i)||!isFinite(i[0])||!isFinite(i[1]))return;let a=(r.mapplic||{}).marker||{};e.features.push({type:`Feature`,id:`loc:`+r.id,geometry:{type:`Point`,coordinates:t(i)},properties:{feature_type:`marker`,layer:r.layer||n,name:r.name||r.id,mapplic:Object.assign({style:`dot`,label:`hover`,subtitle:r.subtitle,description:r.description,hours:r.hours},a)}})})}static load(e,t){return r._sourceUrl===e&&r._sourcePromise?r._sourcePromise:(r._source=null,r._sourceUrl=e,r._sourcePromise=r._loadSource(e,t))}static storageName=`mapplic`;static _openDb(){return r._dbStalled?Promise.reject(Error(`saved-copy storage is blocked by another tab`)):r._dbPromise||=new Promise((e,t)=>{let n=indexedDB.open(r.storageName,1),i=setTimeout(()=>{r._dbStalled=!0,r._dbPromise=null,t(Error(`saved-copy storage did not open within 3 s`))},3e3);n.onupgradeneeded=()=>n.result.createObjectStore(`maps`),n.onsuccess=()=>{clearTimeout(i);let t=n.result;t.onversionchange=()=>{t.close(),r._dbPromise=null},r._dbStalled&&(r._dbStalled=!1,r._dbPromise=Promise.resolve(t)),e(t)},n.onerror=()=>{clearTimeout(i),r._dbStalled=!1,r._dbPromise=null,t(n.error)}})}static async savedStore(e,t,n){try{let i=await r._openDb();return await new Promise((r,a)=>{let o=i.transaction(`maps`,e===`get`?`readonly`:`readwrite`).objectStore(`maps`),s=e===`get`?o.get(t):e===`put`?o.put(n,t):o.delete(t);s.onsuccess=()=>r(s.result),s.onerror=()=>a(s.error)})}catch(t){if(console.warn(`mapplic storage`,t),e!==`get`)throw t;return null}}static savedKey(e){return new URL(e,document.baseURI).pathname}static hash(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t.toString(36)+e.length.toString(36)}static async _loadSource(e,t){t||={};let n;if(t.data)n=JSON.stringify(t.data);else if(typeof t.load==`function`){let e=await t.load();n=typeof e==`string`?e:JSON.stringify(e)}else{let t=await fetch(e);if(!t.ok)throw Error(`Could not load the map (`+t.status+`)`);n=await t.text()}if(r._sourceUrl!==e)return r._sourcePromise;let i=JSON.parse(n);r.baseUpdatedAt=r.hash(n),r.savedCopy=null;let a=t.saved===!1?null:await r.savedStore(`get`,r.savedKey(e));return r._sourceUrl===e?(a&&a.map&&(a.base===r.baseUpdatedAt?(i=a.map,r.savedCopy={at:a.at}):(r.savedCopy={at:a.at,stale:!0},console.warn(`Mapplic: the saved copy of `+e+` is based on an older version of the file and was not loaded`))),t.view&&(i=r.applyView(i,t.view)),r.parse(i,e)):r._sourcePromise}static async parse(e,t){e.models=e.models||[],e.models.some(e=>e.id===`car`)||e.models.unshift(JSON.parse(JSON.stringify(r.DEFAULT_CAR))),r.raw=e,r.models=e.models,e=r.projectGeographic(e,t);let n=e.features,i=r.setFrame(e),a=e=>r.dedupeRing(e.coordinates[0].slice(0,-1).map(i)),o=e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]};r.originalLocations=JSON.stringify(e.locations||[]),await r.loadSources(e,t),r.placeLngLatLocations(e);let s=e.layers.slice().sort((e,t)=>(e.ordinal??0)-(t.ordinal??0)),c=Object.fromEntries(s.map((e,t)=>[e.id,t])),l=Object.fromEntries((e.categories||[]).map(e=>[e.id,e.name])),u=Object.fromEntries((e.locations||[]).map(e=>[e.id,e]));r.configure(e,s);let d=e=>n.filter(t=>t.properties.feature_type===e),f=s.map(()=>[]),p=s.map(()=>[]);r.locations=u,r.categoryNames=l,r.categories=(e.categories||[]).slice(),r.levelIds=s.map(e=>e.id),r.locationsOwnUnits=e.locations.some(e=>e.units);let m=r.unitLocations(e.locations),h=e.edits&&e.edits.units||{};d(`shape`).forEach(e=>{if(a(e.geometry).length<3)return;let t=e.properties,n=t.mapplic||{},s=r.resolveUnit({points:a(e.geometry),featureId:e.id,loc:(h[e.id]||{}).vacant?null:r.locationsOwnUnits?m[e.id]||null:t.location||null,fileCategory:t.category||null}),l=r.holeRings(e.geometry,i);if(l.length&&(s.holes=l),n.height&&(s.height=n.height*r.scale*10),t.kiosk&&(s.kiosk=!0),t.storefront&&typeof t.storefront==`object`&&(s.storefront=t.storefront),n.label_box){let e=n.label_box.map(i);s.labelBox=o(e)}n.label_angle!=null&&(s.labelAngle=-n.label_angle*Math.PI/180),n.label===!1&&(s.noLabel=!0),n.label_text!=null&&(s.labelText=String(n.label_text)),n.interactive===!1&&(s.inert=!0),f[c[t.layer]].push(s)});{let e=d(`opening`).filter(e=>e.geometry&&e.geometry.type===`LineString`);if(e.length){let t={};f.forEach(e=>e.forEach(e=>{t[e.featureId]=e})),e.forEach(e=>{let n=e.properties,a=t[n.unit];if(!a||!a.points)return;let o;if(n.edge!=null&&Array.isArray(n.t))o={edge:n.edge|0,start:+n.t[0],end:+n.t[1]},(n.span|0)>1&&(o.span=n.span|0);else if(e.geometry.coordinates.length>2){let t=e.geometry.coordinates.map(i),n=a.points.length,s=r.ringMeasure(a.points),c=t.reduce((e,n,r)=>r?e+Math.hypot(n[0]-t[r-1][0],n[1]-t[r-1][1]):0,0),l=r.ringProject(a.points,t[0]),u=r.ringProject(a.points,t[t.length-1]),d=[l,u<l?u+n:u],f=[u,l<u?l+n:l],p=e=>s.dist(e[1])-s.dist(e[0]),m=Math.abs(p(d)-c)<=Math.abs(p(f)-c)?d:f;m[1]>m[0]&&(o=r.openingFromRange(n,m[0],m[1]))}else{let t=i(e.geometry.coordinates[0]),n=i(e.geometry.coordinates[e.geometry.coordinates.length-1]),r=null;a.points.forEach((e,i)=>{let o=a.points[(i+1)%a.points.length],s=o[0]-e[0],c=o[1]-e[1],l=s*s+c*c||1,u=t=>((t[0]-e[0])*s+(t[1]-e[1])*c)/l,d=t=>{let n=Math.max(0,Math.min(1,u(t)));return Math.hypot(e[0]+s*n-t[0],e[1]+c*n-t[1])},f=d(t)+d(n);(!r||f<r.sc)&&(r={sc:f,edge:i,start:Math.max(0,Math.min(u(t),u(n))),end:Math.min(1,Math.max(u(t),u(n)))})}),o=r&&{edge:r.edge,start:r.start,end:r.end}}o&&o.edge<a.points.length&&(o.span>1||o.end>o.start)&&(a.openings=a.openings||[]).push(o)})}}let g=s.map(()=>[]),_=s.map(()=>[]);d(`void`).forEach(e=>{p[c[e.properties.layer]].push(a(e.geometry)),g[c[e.properties.layer]].push(e.id),e.properties.barrier===!1&&_[c[e.properties.layer]].push(a(e.geometry))});let v=d(`building`),y=s.map(e=>v.findIndex(t=>(t.properties.layers||[t.properties.layer]).includes(e.id)));for(let e=0;e<y.length;e++)y[e]<0&&(y[e]=e?y[e-1]:0);let b=()=>{let t=[],r=[];n.forEach(e=>{let n=e.geometry;n&&n.type===`Polygon`&&n.coordinates[0].forEach(e=>{t.push(e[0]),r.push(e[1])})});let a=(e.view||{}).center||[0,0],o=t.length?[Math.min(...t)-5,Math.min(...r)-5,Math.max(...t)+5,Math.max(...r)+5]:[a[0]-20,a[1]-20,a[0]+20,a[1]+20];return[[o[0],o[1]],[o[2],o[1]],[o[2],o[3]],[o[0],o[3]]].map(i)},x=y.map(e=>v[e]?a(v[e].geometry):b()),S=y.map((e,t)=>!t||e!==y[t-1]),C=d(`connector`).map(e=>{let t=e.properties,n=r.fitConnector(a(e.geometry)),o=(t.layers||[]).map(e=>c[e]).filter(e=>e!=null).sort((e,t)=>e-t),s=t.connector_type===`elevator`?`elevator`:t.connector_type===`stairs`?`stairs`:`escalator`,l=Object.assign({id:e.id,type:s,layers:s===`elevator`?o:[o[0],o[0]+1],dir:t.direction===`down`?`down`:`up`,upSign:1,shape:t.stair_shape||`straight`,turn:t.turn===`left`?`left`:`right`,accessible:t.accessible!==!1},n);if(s!==`elevator`){let e=(t.landings||[]).find(e=>c[e.layer]===l.layers[1]);if(e){let[t,n]=i(e.point);l.upSign=(t-l.centerX)*l.axisX+(n-l.centerZ)*l.axisZ>=0?1:-1}}return l.loadedKey=r.connectorKey(l),l}),w=C.filter(e=>e.type===`elevator`).map(e=>r.connectorPolygon(e));return r.levelNames=s.map(e=>e.name),r.locations=u,r.fixtures=d(`fixture`).map(e=>{let[t,n]=i(e.geometry.coordinates);return{id:e.id,kind:e.properties.kind,levelIndex:c[e.properties.layer],u:t,v:n}}),r.markers=d(`marker`).concat(d(`annotation`)).map((e,t)=>{let n=e.properties||{},a=n.mapplic||{},o=n.feature_type===`annotation`,[s,l]=i(e.geometry.coordinates);return Object.assign({style:o?`callout`:`pin`},a,{id:String(e.id==null?`marker-`+t:e.id),name:n.name||``,level:c[n.layer]==null?0:c[n.layer],x:s,z:l,y:(a.elevation||0)*r.scale,legacy:o})}),r._source={unitRows:f,voidPolys:p,voidIds:g,voidOpen:_,floorPolys:x,floorOwn:S,connectors:C,lifts:w,footprint:x[0],sitePoly:d(`site`)[0]?a(d(`site`)[0].geometry):x[0],noSite:!d(`site`)[0]||r.generatedSite,sceneryFeatures:r.sceneryOf(n),logoSrcs:[...new Set(Object.values(u).map(e=>e.mapplic&&e.mapplic.logo).filter(Boolean))]}}static union(e,t){let n=.001,r=(e,t)=>Math.abs(e[0]-t[0])<n&&Math.abs(e[1]-t[1])<n,i=e=>{let t=0;return e.forEach((n,r)=>{let i=e[(r+1)%e.length];t+=n[0]*i[1]-i[0]*n[1]}),t<0?e.slice().reverse():e.slice()},a=(e,t,r)=>{let i=r[0]-t[0],a=r[1]-t[1],o=i*i+a*a;if(Math.abs(i*(e[1]-t[1])-a*(e[0]-t[0]))>n*Math.sqrt(o))return 0;let s=((e[0]-t[0])*i+(e[1]-t[1])*a)/o;return s>1e-6&&s<1-1e-6?s:0},o=(e,t)=>{let n=[];return e.forEach((r,i)=>{let o=e[(i+1)%e.length],s=[];t.forEach(e=>{let t=a(e,r,o);t&&s.push([t,e])}),s.sort((e,t)=>e[0]-t[0]);let c=r;s.forEach(([,e])=>{n.push([c,e]),c=e}),n.push([c,o])}),n},s=i(e),c=i(t),l=o(s,c).concat(o(c,s)),u=l.filter(e=>!l.some(t=>r(e[0],t[1])&&r(e[1],t[0])));if(u.length===l.length||!u.length)return null;let d=[u[0][0]],f=new Set([0]),p=u[0];for(;;){let e=u.findIndex((e,t)=>!f.has(t)&&r(e[0],p[1]));if(e<0)break;f.add(e),p=u[e],d.push(p[0])}return f.size!==u.length||!r(p[1],u[0][0])?null:d.filter((e,t)=>{let n=d[(t-1+d.length)%d.length],r=d[(t+1)%d.length];return Math.abs((e[0]-n[0])*(r[1]-e[1])-(e[1]-n[1])*(r[0]-e[0]))>1e-6})}static source(){return r._source}static roundCorners(e,t){if(!t||e.length<3)return e;let n=e.length,r=[];for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=[o[0]-a[0],o[1]-a[1]],l=[s[0]-o[0],s[1]-o[1]],u=Math.hypot(...c),d=Math.hypot(...l),f=u&&d?Math.abs(Math.atan2(c[0]*l[1]-c[1]*l[0],c[0]*l[0]+c[1]*l[1])):0,p=Math.min(t,.45*u,.45*d);if(f<.35||p<.001){r.push(o);continue}let m=[o[0]-c[0]/u*p,o[1]-c[1]/u*p],h=[o[0]+l[0]/d*p,o[1]+l[1]/d*p],g=Math.max(2,Math.ceil(f/.26));for(let e=0;e<=g;e++){let t=e/g,n=1-t;r.push([n*n*m[0]+2*n*t*o[0]+t*t*h[0],n*n*m[1]+2*n*t*o[1]+t*t*h[1]])}}return r}static DEFAULT_CAR={id:`car`,name:`Car`,parts:[{shape:`roundbox`,size:[1.8,.62,4.2],radius:.48,at:[0,.06,0],color:`paint`},{shape:`box`,size:[.34,.12,.06],at:[-.46,.4,2.09],color:`paint`,night:{color:`#ffffff`,halo:.45,beam:{length:10,spread:40,width:1.4,strength:.16,at:[0,2.15]}}},{shape:`box`,size:[.34,.12,.06],at:[.46,.4,2.09],color:`paint`,night:{color:`#ffffff`,halo:.45}},{shape:`box`,size:[.3,.1,.06],at:[-.5,.42,-2.09],color:`paint`,night:{color:`#ff3b30`,halo:.18}},{shape:`box`,size:[.3,.1,.06],at:[.5,.42,-2.09],color:`paint`,night:{color:`#ff3b30`,halo:.18}}]};static sceneryOf(e){let t=r.toScene,n=r.scale,i=e=>e.coordinates[0].slice(0,-1).map(t);return e.filter(e=>e.properties.feature_type===`scenery`).map(e=>{let r=e.properties,a=e.geometry,o={kind:r.kind,name:r.name,location:r.location,variant:r.variant,scale:r.scale,edge:r.edge_line,ev:r.ev_stalls,occ:r.occupancy??.6,vehicle:r.vehicle,id:e.id,model:r.model,rot:r.rotation||0,anim:r.anim,recede:r.recede===!0};return a.type===`Polygon`?o.poly=i(a):a.type===`LineString`?o.line=a.coordinates.map(t):o.pt=t(a.coordinates),[[`width`,`width`],[`verge`,`verge`],[`corner_radius`,`radius`],[`curb_radius`,`curb`],[`stall_width`,`stall_width`],[`height`,`height`],[`label_size`,`label_size`]].forEach(([e,t])=>{r[e]!=null&&(o[t]=r[e]*n)}),r.label_at&&(o.label_at=t(r.label_at)),r.markings&&(o.markings={dash:r.markings.dash*n,gap:r.markings.gap*n,width:r.markings.width*n}),r.traffic&&(o.traffic={cars:r.traffic.cars,speed:r.traffic.speed*n}),r.posts&&(o.posts=r.posts.map(t)),o.anim&&Array.isArray(o.anim.points)&&(o.anim=Object.assign({},o.anim,{pts:o.anim.points.map(t)})),o})}static amenityLabels={};static amenityNames={};static currentLanguage=null;static languageStrings=null;static categoryTranslations={};static amenityTranslations={};static I18N_KINDS=[`ui`,`levels`,`categories`,`amenities`,`locations`,`markers`,`holidays`];static UI={directions:`Directions`,view_store:`View store`,close:`Close`,previous:`Previous`,next:`Next`,show_more:`More`,show_less:`Less`,swap:`Swap`,choose_start:`Select from`,choose_destination:`Select to`,pick_start:`Click a store on the map to start from`,pick_destination:`Click a store on the map to go to`,no_route:`No route between these stores`,accessible_route:`Step-free route`,not_accessible:`{place} is not accessible`,no_step_free:`No step-free route. This one uses stairs or escalators.`,minutes:`{n} min`,metres:`{n} m`,feet:`{n} ft`,walk_to:`Walk {distance} to {place}`,walk_to_lift:`Walk {distance} to the lift`,walk_to_stairs:`Walk {distance} to the stairs`,walk_to_escalator:`Walk {distance} to the escalator`,lift_up:`Lift up to {level}`,lift_down:`Lift down to {level}`,stairs_up:`Stairs up to {level}`,stairs_down:`Stairs down to {level}`,escalator_up:`Escalator up to {level}`,escalator_down:`Escalator down to {level}`,tag_lift:`LIFT`,tag_stairs:`STAIRS`,tag_escalator:`ESC`,via_lift:`via lift`,via_escalator:`via escalator`,via_both:`via escalator and lift`,open_now:`Open now`,from_here:`From here`,to_here:`To here`,elevator:`Elevator`,go_upstairs:`Go upstairs`,go_downstairs:`Go downstairs`,bus_stop:`Bus stop`,now:`Now`,amenity:`Amenity`,zoom_in:`Zoom in`,zoom_out:`Zoom out`,reset_view:`Reset view`,reset_rotation:`Reset rotation`,view_2d:`2D view`,view_3d:`3D view`,hint_touch_2d:`Drag to pan · Pinch to zoom`,hint_mouse_2d:`Drag to pan · Scroll to zoom`,hint_mouse_ctrl_2d:`Drag to pan · Ctrl + scroll to zoom`,hint_mouse_off_2d:`Drag to pan`,wheel_hint:`Use {key} + scroll to zoom`,full_screen:`Full screen`,exit_full_screen:`Exit full screen`,all_levels:`All levels`,hint_touch:`Drag to pan · Pinch to zoom · Twist to rotate · Two-finger drag to tilt`,hint_mouse:`Drag to pan · Double-click and drag to rotate · Scroll to zoom`,hint_mouse_ctrl:`Drag to pan · Double-click and drag to rotate · Ctrl + scroll to zoom`,hint_mouse_off:`Drag to pan · Double-click and drag to rotate`,language:`Language`,search_placeholder:`Search places`,search_clear:`Clear`,search_clear_all:`Clear search and filters`,search_filters:`Filters`,search_results:`{n} results`,search_result_one:`1 result`,search_none:`No places match`,search_did_you_mean:`Did you mean`,search_without_filters:`Show {n} without filters`,search_recent:`Recent`,search_popular:`Popular`,search_level:`Level`,search_showing:`Showing`,search_route:`Route from {from} to {to}`,search_route_to:`Route to {to}`,search_show_route:`Show route`,search_use_filters:`Use as filters`,search_ask:`Smart search`,search_asking:`Thinking…`,search_ask_none:`Smart search found nothing either`,search_ask_failed:`Smart search is not available right now`,search_smart_found:`Found by smart search`,search_categories:`Categories`,search_places:`Places`,search_open_now:`Open now`,search_any:`Any`,search_locations:`{n} locations`,search_places_count:`{n} places`,directory_places:`{n} places`,directory_filtered:`{n} of {total} places`,directory_matches:`Best matches`,directory_other:`Other`,directory_amenities:`Amenities`,directory_collapse:`Hide list`,directory_expand:`Show list`,touch_to_explore:`Touch to explore`,tour_stop:`{n} / {total}`,start_tour:`Start tour`};static t(e,t){let n=r.languageStrings,i=n&&n.ui&&n.ui[e]||r.UI[e]||e;return t?i.replace(/\{(\w+)\}/g,(e,n)=>t[n]==null?e:t[n]):i}static translation(e,t){let n=r.languageStrings,i=n&&n[e]&&t!=null?n[e][t]:null;return i==null?null:typeof i==`string`?{name:i}:i}static unitName(e){let t=r,n=e.loc&&typeof e.loc==`object`?e.loc.id:e.loc,i=n&&t.translation(`locations`,n);return i&&i.name||e.name||(e.amenity?t.amenityTranslations[e.amenity]||t.amenityNames[e.amenity]||e.amenity:``)}static categoryName(e){return e==null?e:r.categoryTranslations[e]||(e===`Amenity`?r.t(`amenity`):e)}static location(e){let t=r,n=(t.locations||{})[e]||null,i=n&&t.translation(`locations`,e);return i?Object.assign({},n,i):n}static localize(){let e=r,t=e.raw||{},n=t.i18n,i=e._source;if(e.languageStrings=e.currentLanguage&&n&&n.languages&&n.languages[e.currentLanguage]?n.languages[e.currentLanguage].strings||{}:null,!i)return;i.levelNamesOrig=i.levelNamesOrig||e.levelNames.slice(),i.levelShortNamesOrig=i.levelShortNamesOrig||e.levelShortNames.slice();let a=e.levelIds||[],o=t=>e.translation(`levels`,a[t])||{};e.levelNames=i.levelNamesOrig.map((e,t)=>o(t).name||e),e.levelShortNames=i.levelShortNamesOrig.map((e,t)=>o(t).short||e),e.categoryTranslations={},(e.categories||[]).forEach(t=>{let n=e.translation(`categories`,t.id);n&&n.name&&(e.categoryTranslations[t.name]=n.name)}),e.amenityTranslations={},Object.entries(t.amenities||{}).forEach(([t,n])=>{let r=e.translation(`amenities`,t);r&&r.name&&(e.amenityTranslations[n.label||t]=r.name)}),(e.markers||[]).forEach(t=>{let n=t._src=t._src||{name:t.name,subtitle:t.subtitle,description:t.description,text:t.text},r=e.translation(`markers`,t.id)||{};[`name`,`subtitle`,`description`,`text`].forEach(e=>{let i=r[e]||n[e];i==null?delete t[e]:t[e]=i})})}static RICH_TAGS=[`p`,`br`,`b`,`strong`,`i`,`em`,`a`,`ul`,`ol`,`li`,`span`];static cleanHtml(e){let t=new Set(a.RICH_TAGS),n=new Set([`script`,`style`,`iframe`,`object`,`embed`,`template`,`svg`,`math`,`noscript`,`link`,`meta`,`head`,`title`]),r=new DOMParser().parseFromString(`<body>`+String(e??``)+`</body>`,`text/html`).body,i=document.createElement(`div`),o=(e,r)=>e.childNodes.forEach(e=>{if(e.nodeType===3)return void r.append(e.textContent);if(e.nodeType!==1)return;let i=e.tagName.toLowerCase();if(n.has(i))return;if(i===`div`&&(i=`p`),!t.has(i)||i===`p`&&r.closest&&r.closest(`p`))return o(e,r);let a=document.createElement(i),s=(e.getAttribute(`class`)||``).replace(/[^\w\- ]/g,``).trim();if(s&&(a.className=s),i===`a`){let t=(e.getAttribute(`href`)||``).trim();/^(https?:|mailto:|tel:)/i.test(t)&&a.setAttribute(`href`,t)}r.append(a),o(e,a)});return o(r,i),i.innerHTML.replace(/<p>(<br>)?<\/p>$/g,``).trim()}static plainText(e){let t=String(e??``);if(!/[<&]/.test(t))return t;let n=document.createElement(`div`);return n.innerHTML=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,` `).replace(/<[^>]*>/g,` `),(n.textContent||``).replace(/\s+/g,` `).trim()}static categoryList(e){return[].concat(e??[]).flatMap(e=>String(e).split(`;`)).map(e=>e.trim()).filter(Boolean)}static mainCategory(e){return r.categoryList(e)[0]||null}static formatHours(e){let t=e&&e.match(/^Mo-Su (\d\d:\d\d)-(\d\d:\d\d)$/);return t?t[1]+`–`+t[2]:e}static resolveUnit(e){let t=e.loc&&r.locations[e.loc],n=r.categoryNames||{};if([`name`,`category`,`amenity`,`hours`,`logo`,`service`,`image`,`group`,`loc`].forEach(t=>delete e[t]),t){e.name=t.name||``;let i=r.mainCategory(t.category);e.category=t.amenity?`Amenity`:n[i]||i||null,t.amenity&&(e.amenity=r.amenityLabels[t.amenity]||t.amenity),t.hours===!1?e.hours=!1:t.hours&&(e.hours=r.formatHours(t.hours)),t.mapplic&&t.mapplic.logo&&(e.logo=t.mapplic.logo),(t.logo||t.image)&&(e.image=t.logo||t.image),e.loc=t,t.group&&(e.group=String(t.group).split(/[;,]/).map(e=>e.trim()).filter(Boolean).join(` · `))}else e.name=``,e.category=null,e.service=!0;return e}static CSV_COLUMNS=[`id`,`name`,`category`,`amenity`,`hours`,`unit`,`logo`,`description`];static isAccessible(e){return!e||e.accessible==null||!(e.accessible===!1||/^(false|0|no)$/i.test(String(e.accessible).trim()))}static unitLocations(e){let t={};return(e||[]).forEach(e=>(e.units||[]).forEach(n=>{t[n]||(t[n]=e.id)})),t}static parseCsv(e){let t=[],n=[],r=``,i=!1;e=String(e).replace(/^\uFEFF/,``);for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(r+=`"`,a++):i=!1:r+=o:o===`"`?i=!0:o===`,`?(n.push(r),r=``):o===`
4151
+ gl_Position = cc;`),n.userData.wideU=e.uniforms},n.customProgramCacheKey=()=>`unit-outline-wide`,r.onBeforeRender=e=>{e.getDrawingBufferSize(o);let t=n.userData.wideU;t&&(t.uWidth.value=a.unitStrokePx*e.getPixelRatio())},r.castShadow=r.receiveShadow=!1,r.raycast=()=>{},r}static labelMax=0;static unitStroke=0;static labelSnap=45;static levelNames=[];static levelShortNames=[];static markers=[];static fixtures=[];static homeCenter=[0,0];static bounds=[0,0,0,0];static scale=.5;static storeyHeight=2.4;static groundLevel=0;static title=null;static _venueName=``;static _venueTail=``;static get venueText(){let e=r;return e._venueTail?`${String(e.title||``).trim()||e._venueName||`this venue`}, ${e._venueTail}`:``}static sceneText=``;static boundsText=``;static homeExtent=[56,36];static homeHull=[];static topHull=[];static convexHull(e){let t=(e||[]).filter(e=>e&&isFinite(e[0])&&isFinite(e[1])).slice().sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(t.length<3)return t;let n=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),r=[],i=[];t.forEach(e=>{for(;r.length>=2&&n(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)});for(let e=t.length-1;e>=0;e--){let r=t[e];for(;i.length>=2&&n(i[i.length-2],i[i.length-1],r)<=0;)i.pop();i.push(r)}return r.slice(0,-1).concat(i.slice(0,-1))}static unitGap=.14;static unitRadius=0;static floorRadius=0;static voidBarriers=!0;static unitHeightScale=1;static unitBase=null;static levelSpan=0;static floorColors=[`#f4f4f5`,`#e4e4e7`];static groundColors=[`#f4f4f5`,`#e4e4e7`];static categoryHours={};static defaultHours=``;static amenityHours=``;static UNIT_PALETTE_KEYS={nb:`default`,hv:`hover`,ft:`focus`,fs:`focus_hover`,am:`amenity`,sv:`service`};static UNIT_PALETTE_DEFAULT={nb:[`#ffffff`,`#d4d4d8`,`#a1a1aa`],hv:[`#f2f6fd`,`#c3d0e3`,`#3f3f46`],ft:[`#e1ecff`,`#a9bddb`,`#0a2a5e`],fs:[`#cfe0fb`,`#93acd6`,`#0a2a5e`],am:[`#f4f4f5`,`#d4d4d8`,`#71717a`],sv:[`#ececee`,`#d4d4d8`,`#71717a`]};static unitPalette=r.UNIT_PALETTE_DEFAULT;static UNIT_PALETTE_DARK={nb:[`#27272a`,`#3f3f46`,`#a1a1aa`],hv:[`#424249`,`#5a5a63`,`#fafafa`],ft:[`#1a4380`,`#3164ad`,`#e6f0ff`],fs:[`#2256a0`,`#4579c2`,`#ffffff`],am:[`#202023`,`#3f3f46`,`#a1a1aa`],sv:[`#1c1c1f`,`#3f3f46`,`#a1a1aa`]};static SCENE_PALETTE={light:{floor:[`#f4f4f5`,`#e4e4e7`],ground:[`#f4f4f5`,`#e4e4e7`],background:`#ffffff`,ink:`#09090b`,glass:`#f6f9fe`,rail:`#ccd5e2`,fixture:`#ffffff`,fixtureAlt:`#ececee`,fixtureEdge:`#d4d4d8`,step:[`#ffffff`,`#e4e4e7`,`#d4d4d8`],lift:[`#fafafa`,`#52525b`],escalator:[`#e4e4e7`,`#ffffff`,`#d4d4d8`],escalatorActive:[`#3f3f46`,`#52525b`,`#27272a`],storefront:`#e4e4e7`,routeHalo:`#ffffff`,groundLight:`#e4e4e7`},dark:{floor:[`#18181b`,`#27272a`],ground:[`#111113`,`#27272a`],background:`#09090b`,ink:`#fafafa`,glass:`#2f2f35`,rail:`#3f3f46`,fixture:`#3f3f46`,fixtureAlt:`#27272a`,fixtureEdge:`#52525b`,step:[`#3f3f46`,`#27272a`,`#52525b`],lift:[`#3f3f46`,`#d4d4d8`],escalator:[`#3f3f46`,`#27272a`,`#52525b`],escalatorActive:[`#d4d4d8`,`#a1a1aa`,`#e4e4e7`],storefront:`#3f3f46`,routeHalo:`#3f3f46`,groundLight:`#3f3f46`}};static scheme=`light`;static ACCENT_DEFAULT=`#1476ff`;static accent=`#1476ff`;static accentTokens(e,t){let n=r,i=n.toOklch(e);if(!i)return null;let[a,o,s]=i,c=(e,t)=>n.fromOklch(e,t,s),l=`#ffffff`,u=`#09090b`,d=n.contrast(e,l)>=n.contrast(e,u)?l:u,f=n.hexRgb(e),p=e=>`rgba(`+f.join(`,`)+`,`+e+`)`;if(!t){let t=c(.96,o*.22),r=c(.92,o*.32);return{accent:e,"accent-hover":c(a-.07,o),"accent-subtle":t,"accent-subtle-hover":r,"accent-subtle-fg":n.readableOn(t,c(Math.min(a,.52),o)),"accent-ring":p(.25),"fg-on-accent":d,focus:t,"focus-hover":r,"focus-fg":n.readableOn(t,c(.3,o*.6))}}let m=c(.28,o*.38),h=c(.33,o*.42);return{accent:e,"accent-hover":c(a+.07,o),"accent-subtle":m,"accent-subtle-hover":h,"accent-subtle-fg":n.readableOn(m,c(.82,o*.6)),"accent-ring":p(.45),"fg-on-accent":d,focus:m,"focus-hover":h,"focus-fg":n.readableOn(m,c(.92,o*.3))}}static accentUnits(e,t){let n=r,i=n.toOklch(e);if(!i)return null;let[,a,o]=i,s=(e,t)=>n.fromOklch(e,t,o);return t?{hv:[s(.3,a*.35),s(.42,a*.4),n.readableOn(s(.3,a*.35),s(.92,a*.25))],ft:[s(.33,a*.45),s(.45,a*.5),n.readableOn(s(.33,a*.45),s(.92,a*.25))],fs:[s(.39,a*.5),s(.52,a*.55),n.readableOn(s(.39,a*.5),`#ffffff`)]}:{hv:[s(.96,a*.2),s(.85,a*.3),n.readableOn(s(.96,a*.2),s(.3,a*.6))],ft:[s(.93,a*.3),s(.8,a*.4),n.readableOn(s(.93,a*.3),s(.3,a*.6))],fs:[s(.88,a*.4),s(.72,a*.5),n.readableOn(s(.88,a*.4),s(.3,a*.6))]}}static unitRowFrom(e,t){let n=r,i=n.toOklch(e);if(!i)return null;let[a,o,s]=i,c=a<.6,l=Math.min(1,Math.max(0,a+(t||0)*(c?1:-1))),u=t?n.fromOklch(l,o,s):e;return[u,n.fromOklch(Math.min(1,Math.max(0,l+(c?.12:-.13))),Math.min(o*1.1,.2),s),n.readableOn(u,c?n.fromOklch(.95,o*.25,s):n.fromOklch(.3,o*.6,s))]}static scenePalette=r.SCENE_PALETTE.light;static applyScheme(e){let t=r,n=e&&e.theme||{},i=t.scheme===`dark`,a=i&&n.dark||{},o=t.SCENE_PALETTE[i?`dark`:`light`],s=n.units||{},c=a.units||{};t.scenePalette=o;let l=(e,n)=>n!==`nb`&&s[e]&&String(s[e][0]).toLowerCase()===t.UNIT_PALETTE_DEFAULT[n][0];t.unitPalette=Object.fromEntries(Object.entries(t.UNIT_PALETTE_KEYS).map(([e,n])=>[e,i?c[n]||(s[n]&&!l(n,e)?t.darkColors(s[n]):t.UNIT_PALETTE_DARK[e]):s[n]||t.UNIT_PALETTE_DEFAULT[e]]));let u=t.accent&&t.accent.toLowerCase()!==t.ACCENT_DEFAULT?t.accentUnits(t.accent,i):null;u&&[[`ft`,`focus`],[`fs`,`focus_hover`]].forEach(([e,n])=>{i&&c[n]||s[n]||(t.unitPalette[e]=u[e])});let d=e=>a[e]||(n[e]?i?n[e].map(e=>t.toDark(e)):n[e]:o[e]);t.floorColors=d(`floor`),t.groundColors=d(`ground`);let f=Object.assign({},t.STOREFRONT_DEFAULT,n.storefront||{});i&&f.color&&(f.color=t.toDark(f.color)),t.storefront=Object.assign(f,a.storefront||{})}static hexRgb(e){let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(e||``).trim());if(!t)return null;let n=t[1].length===3?t[1].replace(/./g,e=>e+e):t[1];return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))}static toOklch(e){let t=r.hexRgb(e);if(!t)return null;let[n,i,a]=t.map(e=>(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4),o=Math.cbrt(.4122214708*n+.5363325363*i+.0514459929*a),s=Math.cbrt(.2119034982*n+.6806995451*i+.1073969566*a),c=Math.cbrt(.0883024619*n+.2817188376*i+.6299787005*a),l=.2104542553*o+.793617785*s-.0040720468*c,u=1.9779984951*o-2.428592205*s+.4505937099*c,d=.0259040371*o+.7827717662*s-.808675766*c;return[l,Math.hypot(u,d),Math.atan2(d,u)]}static fromOklch(e,t,n){let r=t=>{let r=t*Math.cos(n),i=t*Math.sin(n),a=(e+.3963377774*r+.2158037573*i)**3,o=(e-.1055613458*r-.0638541728*i)**3,s=(e-.0894841775*r-1.291485548*i)**3,c=[4.0767416621*a-3.3077115913*o+.2309699292*s,-1.2684380046*a+2.6097574011*o-.3413193965*s,-.0041960863*a-.7034186147*o+1.707614701*s];return c.some(e=>e<-5e-4||e>1.0005)?null:`#`+c.map(e=>(e=Math.max(0,Math.min(1,e)),e=e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,Math.round(e*255).toString(16).padStart(2,`0`))).join(``)};e=Math.max(0,Math.min(1,e));for(let e=t;e>.001;e*=.9){let t=r(e);if(t)return t}return r(0)}static luminance(e){let t=r.hexRgb(e);if(!t)return null;let[n,i,a]=t.map(e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*n+.7152*i+.0722*a}static contrast(e,t){let n=r.luminance(e),i=r.luminance(t);return n==null||i==null?21:(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}static toDark(e){let t=r.toOklch(e);if(!t)return e;let[n,i,a]=t,o=n>=.75?.17+.52*(n-.75):.17+(.75-n)*.6;return r.fromOklch(o,i*(n>=.75?.9:.75),a)}static isAchromatic(e){let t=r.toOklch(e);return!!t&&t[1]<.04}static svgIsMono(e){let t=String(e||``),n=/(?:fill|stroke|stop-color|color)\s*[:=]\s*["']?([a-z]+)/gi,i=[`none`,`currentcolor`,`black`,`white`,`transparent`,`inherit`,`gray`,`grey`,`url`],a;for(;a=n.exec(t);)if(!i.includes(a[1].toLowerCase()))return!1;return!(t.match(/rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+/gi)||[]).map(e=>e.replace(/rgba?\(/i,``).split(`,`).map(Number)).some(([e,t,n])=>Math.max(e,t,n)-Math.min(e,t,n)>24)&&(t.match(/#[0-9a-f]{6}\b|#[0-9a-f]{3}\b/gi)||[]).every(e=>r.isAchromatic(e))}static imageIsMono(e){try{let t=document.createElement(`canvas`);t.width=t.height=48;let n=t.getContext(`2d`,{willReadFrequently:!0});n.drawImage(e,0,0,48,48);let r=n.getImageData(0,0,48,48).data,i=0,a=0;for(let e=0;e<r.length;e+=4)r[e+3]<32||(i++,Math.max(r[e],r[e+1],r[e+2])-Math.min(r[e],r[e+1],r[e+2])>40&&a++);return i>0&&a/i<.04}catch{return!1}}static THEME_DARK_MAP={surface:{"#3f3f46":`#d4d4d8`,"#52525b":`#a1a1aa`,"#27272a":`#e4e4e7`,"#dcefe0":`#1d5434`},edge:{"#a1a1aa":`#52525b`,"#d4d4d8":`#3f3f46`},line:{"#ffffff":`#52525b`},label:{"#ffffff":`#71717a`}};static themeSpec(e,t){return`theme:`+(t||`surface`)+`:`+(e??``)}static parseThemeSpec(e){if(typeof e!=`string`||e.slice(0,6)!==`theme:`)return null;let t=e.slice(6),n=t.lastIndexOf(`:`);return{role:t.slice(0,n),hex:t.slice(n+1)}}static themeColor(e,t){let n=r,i=n.scheme===`dark`,a=t||`surface`;if(a.slice(0,8)===`palette:`){let[e,t]=a.slice(8).split(`.`),r=n.scenePalette[e];return Array.isArray(r)?r[+t||0]:r}if(a.slice(0,6)===`floor.`)return n.floorColors[+a.slice(6)||0];if(a.slice(0,7)===`ground.`)return n.groundColors[+a.slice(7)||0];if(a===`accent`)return n.accent;if(a===`accent-dot`){let e=n.toOklch(n.accent);return i&&e?n.fromOklch(.86,e[1]*.45,e[2]):`#ffffff`}return a===`logo`?i&&(n.toOklch(e)||[0])[0]<.6?n.invertLightness(e):e:i?(n.THEME_DARK_MAP[a]||{})[String(e).toLowerCase()]||n.toDark(e):e}static resolveColor(e){let t=r.parseThemeSpec(e);return t?r.themeColor(t.hex,t.role):e}static invertLightness(e){let t=r.toOklch(e);return t?r.fromOklch(1-t[0]*.92,t[1],t[2]):e}static readableOn(e,t,n){let i=r,a=n||4.5,o=i.toOklch(t)||[.5,0,0],s=(i.toOklch(e)||[.5])[0];if(i.contrast(e,t)>=a)return t;let c=s<.6;for(let t=o[0];c?t<=1:t>=0;t+=c?.02:-.02){let n=i.fromOklch(t,o[1],o[2]);if(i.contrast(e,n)>=a)return n}return c?`#fafafa`:`#09090b`}static darkColors(e){let t=r,[n,i,a]=e||[],o=t.toDark(n),s=t.toOklch(o),c=t.toOklch(i||n);return[o,s&&c?t.fromOklch(s[0]+.08,Math.min(c[1],.12),c[1]>.02?c[2]:s[2]):i,t.readableOn(o,a?t.invertLightness(a):`#a1a1aa`)]}static pointInPolygon(e,t,n){let i=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){let o=e[r],s=e[a];o[1]>n!=s[1]>n&&t<(s[0]-o[0])*(n-o[1])/(s[1]-o[1])+o[0]&&(i=!i)}return i&&e.holes?!e.holes.some(e=>r.pointInPolygon(e,t,n)):i}static holeRings(e,t){return(e.coordinates||[]).slice(1).map(e=>r.dedupeRing(e.slice(0,-1).map(t))).filter(e=>e.length>=3)}static closestPointOnPolygon(e,t){let n=null,r=1e9;return e.forEach((i,a)=>{let o=e[(a+1)%e.length],s=o[0]-i[0],c=o[1]-i[1],l=s*s+c*c||1,u=Math.max(0,Math.min(1,((t[0]-i[0])*s+(t[1]-i[1])*c)/l)),d=[i[0]+s*u,i[1]+c*u],f=Math.hypot(d[0]-t[0],d[1]-t[1]);f<r&&(r=f,n=d)}),[n,r]}static rectPoints(e,t,n,r){return[[e,n],[t,n],[t,r],[e,r]]}static polygonBounds(e){return[Math.min(...e.map(e=>e[0])),Math.max(...e.map(e=>e[0])),Math.min(...e.map(e=>e[1])),Math.max(...e.map(e=>e[1]))]}static hashRandom(e,t){let n=Math.sin(e*127.1+t*311.7)*43758.5453;return n-Math.floor(n)}static slugify(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/&/g,`and`).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}static signedArea(e){let t=0;return e.forEach((n,r)=>{let i=e[(r+1)%e.length];t+=n[0]*i[1]-i[0]*n[1]}),t/2}static edgeNormal(e,t,n){let r=t[0]-e[0],i=t[1]-e[1],a=Math.hypot(r,i),o=i/a,s=-r/a;return n<0&&(o=-o,s=-s),[o,s]}static untangle(e){let t=(e,t,n,r)=>{let i=[t[0]-e[0],t[1]-e[1]],a=[r[0]-n[0],r[1]-n[1]],o=i[0]*a[1]-i[1]*a[0];if(Math.abs(o)<1e-12)return null;let s=((n[0]-e[0])*a[1]-(n[1]-e[1])*a[0])/o,c=((n[0]-e[0])*i[1]-(n[1]-e[1])*i[0])/o;return s>1e-9&&s<1-1e-9&&c>1e-9&&c<1-1e-9?[e[0]+i[0]*s,e[1]+i[1]*s]:null},n=e.slice();for(let e=0;e<200&&n.length>3;e++){let e=n.length,i=null;for(let r=0;r<e&&!i;r++){let a=n[r],o=n[(r+1)%e],s=Math.min(a[0],o[0]),c=Math.max(a[0],o[0]),l=Math.min(a[1],o[1]),u=Math.max(a[1],o[1]);for(let d=r+2;d<e;d++){if(r===0&&d===e-1)continue;let f=n[d],p=n[(d+1)%e];if(Math.max(f[0],p[0])<s||Math.min(f[0],p[0])>c||Math.max(f[1],p[1])<l||Math.min(f[1],p[1])>u)continue;let m=t(a,o,f,p);if(m){i=[r,d,m];break}}}if(!i)break;let[a,o,s]=i,c=[s].concat(n.slice(a+1,o+1)),l=n.slice(0,a+1).concat([s],n.slice(o+1));n=Math.abs(r.signedArea(c))>Math.abs(r.signedArea(l))?c:l}return n}static insetPolygon(e,t){let n=e.length,i=r.signedArea(e),a=e.map((a,o)=>{let s=e[(o+1)%n],[c,l]=r.edgeNormal(a,s,i);return{p:[a[0]-c*t,a[1]-l*t],d:[s[0]-a[0],s[1]-a[1]]}});return e.map((r,i)=>{let o=a[(i-1+n)%n],s=a[i],c=o.d[0]*s.d[1]-o.d[1]*s.d[0];if(Math.abs(c)<1e-9)return s.p;let l=((s.p[0]-o.p[0])*s.d[1]-(s.p[1]-o.p[1])*s.d[0])/c,u=[o.p[0]+o.d[0]*l,o.p[1]+o.d[1]*l];return Math.hypot(u[0]-e[i][0],u[1]-e[i][1])>4*Math.abs(t)?s.p:u})}static vecBetween(e,t){return[t[0]-e[0],t[1]-e[1]]}static unitVector(e){let t=Math.hypot(e[0],e[1])||1;return[e[0]/t,e[1]/t]}static filletPolyline(e,t,n=14){let i=r.vecBetween,a=r.unitVector,o=[e[0]];for(let r=1;r<e.length-1;r++){let s=e[r],c=a(i(s,e[r-1])),l=a(i(s,e[r+1])),u=Math.acos(Math.max(-1,Math.min(1,c[0]*l[0]+c[1]*l[1]))),d=t/Math.tan(u/2),f=a([c[0]+l[0],c[1]+l[1]]),p=t/Math.sin(u/2),m=[s[0]+f[0]*p,s[1]+f[1]*p],h=[s[0]+c[0]*d,s[1]+c[1]*d],g=[s[0]+l[0]*d,s[1]+l[1]*d],_=Math.atan2(h[1]-m[1],h[0]-m[0]),v=Math.atan2(g[1]-m[1],g[0]-m[0])-_;for(;v>Math.PI;)v-=2*Math.PI;for(;v<-Math.PI;)v+=2*Math.PI;for(let e=0;e<=n;e++){let r=_+v*e/n;o.push([m[0]+t*Math.cos(r),m[1]+t*Math.sin(r)])}}return o.push(e[e.length-1]),o}static dashQuads(e,t,n,i){let a=[];for(let o=n/2;o+t<e.L;o+=t+n){let n=r.pointAlong(e,o),s=r.pointAlong(e,o+t),c=[-n.t[1],n.t[0]],l=[-s.t[1],s.t[0]];a.push([[n.p[0]+c[0]*i/2,n.p[1]+c[1]*i/2],[s.p[0]+l[0]*i/2,s.p[1]+l[1]*i/2],[s.p[0]-l[0]*i/2,s.p[1]-l[1]*i/2],[n.p[0]-c[0]*i/2,n.p[1]-c[1]*i/2]])}return a}static cornerFillet(e,t,n,r,i=8){let a=[e[0]+(t[0]+n[0])*r,e[1]+(t[1]+n[1])*r],o=[[e[0]+t[0]*r,e[1]+t[1]*r],e,[e[0]+n[0]*r,e[1]+n[1]*r]];for(let e=1;e<i;e++){let s=e/i*Math.PI/2;o.push([a[0]-t[0]*r*Math.cos(s)-n[0]*r*Math.sin(s),a[1]-t[1]*r*Math.cos(s)-n[1]*r*Math.sin(s)])}return o}static roundRectPoints(e,t,n,r,i){let a=[];return[[t-i,n+i,-Math.PI/2],[t-i,r-i,0],[e+i,r-i,Math.PI/2],[e+i,n+i,Math.PI]].forEach(([e,t,n])=>{for(let r=0;r<=3;r++){let o=n+r*Math.PI/6;a.push([e+Math.cos(o)*i,t+Math.sin(o)*i])}}),a}static VIEW_FIELDS=[`plugins`,`view`,`default_layer`];static applyView(e,t){let n=JSON.parse(JSON.stringify(e||{})),r=t?(n.views||[]).find(e=>e&&e.id===t):null;if(!r)return t&&console.warn(`mapplic: no view "`+t+`", showing Default`),n;let i=(e,t)=>(Object.entries(t||{}).forEach(([t,n])=>{n===null?delete e[t]:e[t]=JSON.parse(JSON.stringify(n))}),e),a=(r.plugins||{}).builtin||{};if(Object.keys(a).length){let e=n.plugins=n.plugins&&!Array.isArray(n.plugins)?n.plugins:{version:2,custom:[]},t=e.builtin=e.builtin||{};Object.entries(a).forEach(([e,n])=>{if(!n)return;let r=t[e]=t[e]||{};n.enabled===null?delete r.enabled:n.enabled!==void 0&&(r.enabled=!!n.enabled),n.settings&&(r.settings=i(Object.assign({},r.settings),n.settings))})}return r.view&&(n.view=i(Object.assign({},n.view),r.view)),r.default_layer===null?delete n.default_layer:r.default_layer!==void 0&&(n.default_layer=r.default_layer),n}static viewOverrides(e,t){let n=e=>JSON.stringify(e===void 0?null:e),r=(e,t)=>[...new Set(Object.keys(e||{}).concat(Object.keys(t||{})))],i=(e,t)=>{let i={};return r(e,t).forEach(r=>{n((e||{})[r])!==n((t||{})[r])&&(i[r]=(t||{})[r]===void 0?null:JSON.parse(n(t[r])))}),i},a=((e||{}).plugins||{}).builtin||{},o=((t||{}).plugins||{}).builtin||{},s={},c={};r(a,o).forEach(e=>{let t=a[e]||{},r=o[e]||{},c={};n(t.enabled)!==n(r.enabled)&&(c.enabled=r.enabled===void 0?null:!!r.enabled);let l=i(t.settings,r.settings);Object.keys(l).length&&(c.settings=l),Object.keys(c).length&&(s[e]=c)}),Object.keys(s).length&&(c.plugins={builtin:s});let l=i((e||{}).view,(t||{}).view);return Object.keys(l).length&&(c.view=l),n((e||{}).default_layer)!==n((t||{}).default_layer)&&(c.default_layer=(t||{}).default_layer===void 0?null:t.default_layer),c}static viewCount(e){let t=0;return Object.values(((e||{}).plugins||{}).builtin||{}).forEach(e=>{e&&(e.enabled!==void 0&&t++,t+=Object.keys(e.settings||{}).length)}),e&&e.view&&Object.keys(e.view).length&&t++,e&&e.default_layer!==void 0&&t++,t}static escapeHtml(e){let t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};return String(e??``).replace(/[&<>"]/g,e=>t[e])}static svgIcon(e,t=16,n=2){return`<svg width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="`+n+`" stroke-linecap="round" stroke-linejoin="round">`+e+`</svg>`}static pointAlong(e,t){let{P:n,cum:r}=e,i=1;for(;i<r.length-1&&r[i]<t;)i++;let a=n[i-1],o=n[i],s=r[i]-r[i-1]||1,c=(t-r[i-1])/s,l=Math.hypot(o[0]-a[0],o[1]-a[1])||1;return{p:[a[0]+(o[0]-a[0])*c,a[1]+(o[1]-a[1])*c],t:[(o[0]-a[0])/l,(o[1]-a[1])/l]}}static measurePolyline(e){let t=[0];for(let n=1;n<e.length;n++)t.push(t[n-1]+Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]));return{P:e,cum:t,L:t[t.length-1]}}static resample(e,t){if(e.length<2)return e.concat(e);let n=[e[0]];for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.max(1,Math.ceil(Math.hypot(a[0]-i[0],a[1]-i[1])/t));for(let e=1;e<=o;e++)n.push([i[0]+(a[0]-i[0])*e/o,i[1]+(a[1]-i[1])*e/o])}return n}static offsetPolyline(e,t){return e.map((n,r)=>{let i=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],o=Math.hypot(a[0]-i[0],a[1]-i[1])||1,s=[(a[0]-i[0])/o,(a[1]-i[1])/o];return[n[0]-s[1]*t,n[1]+s[0]*t]})}static PROJECTIONS=[`albers-usa`,`albers`,`lambert-conformal`,`mercator`,`equirectangular`];static projection(e,t,n){let r=6378137/(n||1),i=Math.PI/180,a=typeof e==`string`?{type:e}:e||{},o=a.center||t||[0,0],s=a.type||`mercator`,c=e=>{for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e},l=e=>Math.tan(Math.PI/4+Math.max(-1.5,Math.min(1.5,e))/2),u=(e,t,n,r,a)=>{let o=e*i;n*=i,r*=i;let s,u,d;if(a){s=(Math.sin(n)+Math.sin(r))/2;let e=Math.cos(n)**2+2*s*Math.sin(n);u=t=>Math.sqrt(Math.max(0,e-2*s*Math.sin(t)))/s,d=t=>Math.asin(Math.max(-1,Math.min(1,(e-(t*s)**2)/(2*s))))}else{s=Math.abs(n-r)<1e-9?Math.sin(n):Math.log(Math.cos(n)/Math.cos(r))/Math.log(l(r)/l(n));let e=Math.cos(n)*l(n)**s/s;u=t=>e/l(t)**s,d=t=>2*Math.atan((e/t)**(1/s))-Math.PI/2}let f=(e,t)=>{let n=s*c(e*i-o),r=u(t*i);return[r*Math.sin(n),-r*Math.cos(n)]},p=f(t[0],t[1]),m=Math.sign(s)||1;return{f:(e,t)=>{let n=f(e,t);return[n[0]-p[0],n[1]-p[1]]},inv:([e,t])=>{let n=e+p[0],r=t+p[1],a=m*Math.hypot(n,r),c=Math.atan2(n*m,-r*m);return[(o+c/s)/i,d(a)/i]}}},d=a.parallels||[o[1]-8,o[1]+8],f;if(s===`albers`||s===`lambert-conformal`)f=u(o[0],o,d[0],d[1],s===`albers`);else if(s===`equirectangular`){let e=Math.cos((a.parallel||0)*i);f={f:(t,n)=>[c((t-o[0])*i)*e,(n-o[1])*i],inv:([t,n])=>[o[0]+t/e/i,o[1]+n/i]}}else if(s===`albers-usa`){let e=(e,t,n,r)=>({f:(i,a)=>{let o=e.f(i,a);return[o[0]*t+n,o[1]*t+r]},inv:([i,a])=>e.inv([(i-n)/t,(a-r)/t])}),t=u(-96,[-96.6,38.7],29.5,45.5,!0),n=e(u(-154,[-156,58.5],55,65,!0),.35,-.307,-.201),i=e(u(-157,[-160,19.9],8,18,!0),1,-.205,-.212),a=e(u(-66,[-66,18],8,18,!0),1,.35,-.224),o=([e,r])=>r>50.5?n:r<30&&e<-150?i:r<19&&e>-68&&e<-64?a:t,s=e=>([t,n])=>{let i=e.f(t,n);return[i[0]*r,i[1]*r]},c=[[n,-180,-129,50.5,72],[i,-160.6,-154.6,18.8,22.4],[a,-68,-65,17.5,18.7]];return{pt:e=>s(o(e))(e),ring:e=>{let t=s(o(e[0]||[0,0]));return e.map(t)},inv:([e,i])=>{let a=[e/r,i/r];for(let[e,t,r,i,o]of c){let s=e.inv(a),c=s[0]>180?s[0]-360:s[0]<-180?s[0]+360:s[0];if((c>=t&&c<=r||e===n&&c>=170)&&s[1]>=i&&s[1]<=o)return[c,s[1]]}return t.inv(a)}}}else{let e=Math.log(l(o[1]*i));f={f:(t,n)=>[c((t-o[0])*i),Math.log(l(Math.max(-85,Math.min(85,n))*i))-e],inv:([t,n])=>[o[0]+t/i,(2*Math.atan(Math.exp(n+e))-Math.PI/2)/i]}}let p=([e,t])=>{let n=f.f(e,t);return[n[0]*r,n[1]*r]};return{pt:p,ring:e=>e.map(p),inv:([e,t])=>f.inv([e/r,t/r])}}static dedupeRing(e){let t=(e,t)=>Math.abs(e[0]-t[0])<1e-9&&Math.abs(e[1]-t[1])<1e-9,n=[];for(e.forEach(e=>{(!n.length||!t(n[n.length-1],e))&&n.push(e)});n.length>1&&t(n[0],n[n.length-1]);)n.pop();return n}static simplify(e,t){let n=(r,i)=>{let a=0,o=0,s=e[r],c=e[i],l=c[0]-s[0],u=c[1]-s[1],d=Math.hypot(l,u)||1e-9;for(let t=r+1;t<i;t++){let n=Math.abs(u*e[t][0]-l*e[t][1]+c[0]*s[1]-c[1]*s[0])/d;n>a&&(a=n,o=t)}return a>t?n(r,o).concat(n(o,i).slice(1)):[s,c]},r=0,i=0;if(e.forEach((t,n)=>{let a=Math.hypot(t[0]-e[0][0],t[1]-e[0][1]);a>i&&(i=a,r=n)}),!r)return e;let a=e.concat([e[0]]),o=function(t,r){let i=e;e=a;let o=n(t,r);return e=i,o},s=o(0,r).concat(o(r,e.length).slice(1));return s.pop(),s.length>=3?s:e}static localProjection(e){let t=e.origin||[0,0],n=6378137,r=Math.PI/180,i=(+e.rotation||0)*r,a=+e.scale||1,o=Math.cos(t[1]*r);return([e,s])=>{let c=(e-t[0])*r*n*o,l=(s-t[1])*r*n;return[(c*Math.cos(i)-l*Math.sin(i))/a,(c*Math.sin(i)+l*Math.cos(i))/a]}}static projectGeographic(e,t){let n=e.georef||{},i=(e.crs||{}).type===`geographic`,a=n.projection;try{let e=new URL(t,document.baseURI).searchParams.get(`projection`);e&&(a=e)}catch{}r.projectionName=i?typeof a==`string`?a:a&&a.type||`mercator`:null;let o=i?r.projection(a,n.origin,+n.scale||1):null;r.fromLngLat=o?o.pt:r.localProjection(n),r.toLngLat=o?o.inv:null;let s=e=>o.ring(e),c=(e,t)=>t===`Point`?o.pt(e):t===`LineString`||t===`MultiPoint`?s(e):t===`Polygon`||t===`MultiLineString`?e.map(s):e.map(e=>e.map(s)),l=[];(e.features||[]).forEach(e=>{let t=e.geometry,n=(e.properties||{}).mapplic||{};if(!t)return void l.push(e);o?t={type:t.type,coordinates:c(t.coordinates,t.type)}:t.type===`Point`&&Array.isArray(n.lngLat)&&(t={type:`Point`,coordinates:r.fromLngLat(n.lngLat)}),t.type===`MultiPolygon`?t.coordinates.forEach((t,n)=>l.push(Object.assign({},e,{id:n?e.id+`~`+n:e.id,geometry:{type:`Polygon`,coordinates:t}}))):l.push(t===e.geometry?e:Object.assign({},e,{geometry:t}))});let u=Object.assign({},e,{features:l});if(r.generatedBuilding=r.generatedSite=!1,!o)return u;let d=l.filter(e=>e.geometry&&e.geometry.type===`Polygon`).flatMap(e=>e.geometry.coordinates[0]);if(!d.length)return u;let f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=[Math.min(...f),Math.max(...f),Math.min(...p),Math.max(...p)],h=Math.max(m[1]-m[0],m[3]-m[2])*((e.theme||{}).site_padding??.06),g=[[m[0]-h,m[2]-h],[m[1]+h,m[2]-h],[m[1]+h,m[3]+h],[m[0]-h,m[3]+h],[m[0]-h,m[2]-h]],_=(e.layers||[]).map(e=>e.id);!l.some(e=>e.properties.feature_type===`site`)&&(r.generatedSite=!0)&&l.unshift({type:`Feature`,id:`geo-site`,geometry:{type:`Polygon`,coordinates:[g]},properties:{feature_type:`site`}}),!l.some(e=>e.properties.feature_type===`building`)&&(r.generatedBuilding=!0)&&l.unshift({type:`Feature`,id:`geo-building`,geometry:{type:`Polygon`,coordinates:[g]},properties:{feature_type:`building`,layers:_}});let v=e.view||{};return u.view=Object.assign({},v,{center:v.center?o.pt(v.center):[(m[0]+m[1])/2,(m[2]+m[3])/2]}),v.fit||(u.view.fit=[m[1]-m[0],m[3]-m[2]]),u}static MARKER_FIELDS=[`style`,`shape`,`label`,`icon`,`text`,`color`,`ink`,`class`,`elevation`,`min_zoom`,`max_zoom`,`priority`,`all_levels`,`cluster`,`cluster_group`,`feature`];static migrateMarkers(e){let t=e&&e.features||[];if(!t.some(e=>e&&e.properties&&e.properties.feature_type===`marker`))return!1;let n=e.locations=e.locations||[],i=Object.fromEntries(n.filter(e=>e&&e.id!=null).map(e=>[String(e.id),e])),a=[`subtitle`,`description`,`logo`,`images`,`hours`,`phone`,`website`,`data`],o=0;return e.features=t.filter(e=>{let t=e&&e.properties;if(!t||t.feature_type!==`marker`)return!0;let s=t.mapplic||{},c=e.geometry&&e.geometry.coordinates,l=String(t.location||(e.id==null?`marker-`+ ++o:e.id)),u=i[l];u||n.push(u=i[l]={id:l});let d=t.name||s.name;d&&!u.name&&(u.name=d);let f={};return Array.isArray(c)&&c.length>=2&&(f.at=c.slice(0,2)),t.layer&&(f.layer=t.layer),r.MARKER_FIELDS.forEach(e=>{s[e]!=null&&(f[e]=s[e])}),f.style??=`pin`,s.unit&&(f.on=s.unit,(!s.action||s.action===`select`)&&!u.highlight&&(u.highlight=s.unit)),a.forEach(e=>{s[e]!=null&&u[e]==null&&(u[e]=s[e])}),s.popup&&(u.mapplic=Object.assign({},u.mapplic),u.mapplic.popup||(u.mapplic.popup=s.popup)),s.action===`none`?u.click=`none`:s.action===`link`&&(u.click=`link`,s.url&&(u.url=s.url),s.target&&(u.target=s.target)),u.markers?u.markers.push(f):u.marker?(u.markers=[u.marker,f],delete u.marker):u.marker=f,!1}),!0}static migrateMarkerStrings(e){let t=(e&&e.i18n||{}).languages||{},n=new Set((e&&e.locations||[]).filter(e=>e&&e.id!=null).map(e=>String(e.id))),r=!1;return Object.values(t).forEach(e=>{let t=e&&e.strings,i=t&&t.markers;i&&typeof i==`object`&&(Object.keys(i).forEach(e=>{let a=String(e).replace(/^loc:/,``).replace(/~\d+$/,``);if(!n.has(a))return;let o=typeof i[e]==`string`?{name:i[e]}:Object.assign({},i[e]),s=t.locations=t.locations||{},c=typeof s[a]==`string`?{name:s[a]}:Object.assign({},s[a]);[`name`,`subtitle`,`description`].forEach(e=>{o[e]!=null&&c[e]==null&&(c[e]=o[e]),delete o[e]}),Object.keys(c).length&&(s[a]=c),Object.keys(o).length?i[e]=o:delete i[e],r=!0}),Object.keys(i).length||delete t.markers)}),r}static locationMarkers(e){if(!e)return[];if(Array.isArray(e.markers))return e.markers.filter(e=>e&&typeof e==`object`);if(e.marker&&typeof e.marker==`object`)return[e.marker];let t=e.lngLat;return Array.isArray(t)&&isFinite(t[0])&&isFinite(t[1])?[Object.assign({},(e.mapplic||{}).marker,{lngLat:t})]:[]}static placeLocationMarkers(e){let t=(e.crs||{}).type===`geographic`,n=r.fromLngLat,i=e.default_layer||((e.layers||[])[0]||{}).id,a=new Set((e.features||[]).filter(e=>e.properties&&e.properties.feature_type===`shape`&&e.properties.location).map(e=>String(e.properties.location)));(e.locations||[]).forEach(o=>{let s=r.locationMarkers(o);if(!s.length)return;let c=a.has(String(o.id))||Array.isArray(o.units)&&o.units.length>0,l=o.mapplic||{};s.forEach((r,a)=>{let s=r.lngLat?n?n(r.lngLat):null:Array.isArray(r.at)?t&&n?n(r.at):r.at.slice(0,2):null,u=r.on||(c&&!s?o.id:null);if(!s&&!u)return;let d=Object.assign({},r);[`at`,`lngLat`,`layer`,`on`].forEach(e=>delete d[e]);let f=Object.assign(r.lngLat?{style:`dot`,label:`hover`}:{style:`pin`},d,{name:o.name||o.id,location:String(o.id),subtitle:o.subtitle,description:o.description,hours:o.hours,logo:l.logo||o.logo,images:o.images,phone:o.phone,website:o.website,popup:l.popup});u&&(f.on=u),s||(f.no_point=!0),o.highlight&&(f.highlight=o.highlight),o.click===`none`?f.action=`none`:o.click===`link`?Object.assign(f,{action:`link`,url:o.url,target:o.target}):c?Object.assign(f,{action:`select`,target:String(o.id)}):f.action=f.feature?`select`:`popup`,e.features.push({type:`Feature`,id:(c?`loc:`:``)+o.id+(a?`~`+a:``),geometry:{type:`Point`,coordinates:s||[0,0]},properties:{feature_type:`marker`,layer:r.layer||o.layer||i,name:f.name,mapplic:f}})})})}static load(e,t){return r._sourceUrl===e&&r._sourcePromise?r._sourcePromise:(r._source=null,r._sourceUrl=e,r._sourcePromise=r._loadSource(e,t))}static storageName=`mapplic`;static _openDb(){return r._dbStalled?Promise.reject(Error(`saved-copy storage is blocked by another tab`)):r._dbPromise||=new Promise((e,t)=>{let n=indexedDB.open(r.storageName,1),i=setTimeout(()=>{r._dbStalled=!0,r._dbPromise=null,t(Error(`saved-copy storage did not open within 3 s`))},3e3);n.onupgradeneeded=()=>n.result.createObjectStore(`maps`),n.onsuccess=()=>{clearTimeout(i);let t=n.result;t.onversionchange=()=>{t.close(),r._dbPromise=null},r._dbStalled&&(r._dbStalled=!1,r._dbPromise=Promise.resolve(t)),e(t)},n.onerror=()=>{clearTimeout(i),r._dbStalled=!1,r._dbPromise=null,t(n.error)}})}static async savedStore(e,t,n){try{let i=await r._openDb();return await new Promise((r,a)=>{let o=i.transaction(`maps`,e===`get`?`readonly`:`readwrite`).objectStore(`maps`),s=e===`get`?o.get(t):e===`put`?o.put(n,t):o.delete(t);s.onsuccess=()=>r(s.result),s.onerror=()=>a(s.error)})}catch(t){if(console.warn(`mapplic storage`,t),e!==`get`)throw t;return null}}static savedKey(e){return new URL(e,document.baseURI).pathname}static hash(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t.toString(36)+e.length.toString(36)}static async _loadSource(e,t){t||={};let n;if(t.data)n=JSON.stringify(t.data);else if(typeof t.load==`function`){let e=await t.load();n=typeof e==`string`?e:JSON.stringify(e)}else{let t=await fetch(e);if(!t.ok)throw Error(`Could not load the map (`+t.status+`)`);n=await t.text()}if(r._sourceUrl!==e)return r._sourcePromise;let i=JSON.parse(n);r.baseUpdatedAt=r.hash(n),r.savedCopy=null;let a=t.saved===!1?null:await r.savedStore(`get`,r.savedKey(e));return r._sourceUrl===e?(a&&a.map&&(a.base===r.baseUpdatedAt?(i=a.map,r.savedCopy={at:a.at}):(r.savedCopy={at:a.at,stale:!0},console.warn(`Mapplic: the saved copy of `+e+` is based on an older version of the file and was not loaded`))),t.view&&(i=r.applyView(i,t.view)),r.parse(i,e)):r._sourcePromise}static async parse(e,t){e.models=e.models||[],e.models.some(e=>e.id===`car`)||e.models.unshift(JSON.parse(JSON.stringify(r.DEFAULT_CAR))),r.raw=e,r.models=e.models,r.migrateMarkers(e),r.migrateMarkerStrings(e),e=r.projectGeographic(e,t);let n=e.features,i=r.setFrame(e),a=e=>r.dedupeRing(e.coordinates[0].slice(0,-1).map(i)),o=e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]};r.originalLocations=JSON.stringify(e.locations||[]),await r.loadSources(e,t),r.placeLocationMarkers(e);let s=e.layers.slice().sort((e,t)=>(e.ordinal??0)-(t.ordinal??0)),c=Object.fromEntries(s.map((e,t)=>[e.id,t])),l=Object.fromEntries((e.categories||[]).map(e=>[e.id,e.name])),u=Object.fromEntries((e.locations||[]).map(e=>[e.id,e]));r.configure(e,s);let d=e=>n.filter(t=>t.properties.feature_type===e),f=s.map(()=>[]),p=s.map(()=>[]);r.locations=u,r.categoryNames=l,r.categories=(e.categories||[]).slice(),r.levelIds=s.map(e=>e.id),r.locationsOwnUnits=e.locations.some(e=>e.units);let m=r.unitLocations(e.locations),h=e.edits&&e.edits.units||{};d(`shape`).forEach(e=>{if(a(e.geometry).length<3)return;let t=e.properties,n=t.mapplic||{},s=r.resolveUnit({points:a(e.geometry),featureId:e.id,loc:(h[e.id]||{}).vacant?null:r.locationsOwnUnits?m[e.id]||null:t.location||null,fileCategory:t.category||null}),l=r.holeRings(e.geometry,i);if(l.length&&(s.holes=l),n.height&&(s.height=n.height*r.scale*10),t.kiosk&&(s.kiosk=!0),t.storefront&&typeof t.storefront==`object`&&(s.storefront=t.storefront),n.label_box){let e=n.label_box.map(i);s.labelBox=o(e)}n.label_angle!=null&&(s.labelAngle=-n.label_angle*Math.PI/180),n.label===!1&&(s.noLabel=!0),n.label_text!=null&&(s.labelText=String(n.label_text)),n.interactive===!1&&(s.inert=!0),f[c[t.layer]].push(s)});{let e=d(`opening`).filter(e=>e.geometry&&e.geometry.type===`LineString`);if(e.length){let t={};f.forEach(e=>e.forEach(e=>{t[e.featureId]=e})),e.forEach(e=>{let n=e.properties,a=t[n.unit];if(!a||!a.points)return;let o;if(n.edge!=null&&Array.isArray(n.t))o={edge:n.edge|0,start:+n.t[0],end:+n.t[1]},(n.span|0)>1&&(o.span=n.span|0);else if(e.geometry.coordinates.length>2){let t=e.geometry.coordinates.map(i),n=a.points.length,s=r.ringMeasure(a.points),c=t.reduce((e,n,r)=>r?e+Math.hypot(n[0]-t[r-1][0],n[1]-t[r-1][1]):0,0),l=r.ringProject(a.points,t[0]),u=r.ringProject(a.points,t[t.length-1]),d=[l,u<l?u+n:u],f=[u,l<u?l+n:l],p=e=>s.dist(e[1])-s.dist(e[0]),m=Math.abs(p(d)-c)<=Math.abs(p(f)-c)?d:f;m[1]>m[0]&&(o=r.openingFromRange(n,m[0],m[1]))}else{let t=i(e.geometry.coordinates[0]),n=i(e.geometry.coordinates[e.geometry.coordinates.length-1]),r=null;a.points.forEach((e,i)=>{let o=a.points[(i+1)%a.points.length],s=o[0]-e[0],c=o[1]-e[1],l=s*s+c*c||1,u=t=>((t[0]-e[0])*s+(t[1]-e[1])*c)/l,d=t=>{let n=Math.max(0,Math.min(1,u(t)));return Math.hypot(e[0]+s*n-t[0],e[1]+c*n-t[1])},f=d(t)+d(n);(!r||f<r.sc)&&(r={sc:f,edge:i,start:Math.max(0,Math.min(u(t),u(n))),end:Math.min(1,Math.max(u(t),u(n)))})}),o=r&&{edge:r.edge,start:r.start,end:r.end}}o&&o.edge<a.points.length&&(o.span>1||o.end>o.start)&&(a.openings=a.openings||[]).push(o)})}}let g=s.map(()=>[]),_=s.map(()=>[]);d(`void`).forEach(e=>{p[c[e.properties.layer]].push(a(e.geometry)),g[c[e.properties.layer]].push(e.id),e.properties.barrier===!1&&_[c[e.properties.layer]].push(a(e.geometry))});let v=d(`building`),y=s.map(e=>v.findIndex(t=>(t.properties.layers||[t.properties.layer]).includes(e.id)));for(let e=0;e<y.length;e++)y[e]<0&&(y[e]=e?y[e-1]:0);let b=()=>{let t=[],r=[];n.forEach(e=>{let n=e.geometry;n&&n.type===`Polygon`&&n.coordinates[0].forEach(e=>{t.push(e[0]),r.push(e[1])})});let a=(e.view||{}).center||[0,0],o=t.length?[Math.min(...t)-5,Math.min(...r)-5,Math.max(...t)+5,Math.max(...r)+5]:[a[0]-20,a[1]-20,a[0]+20,a[1]+20];return[[o[0],o[1]],[o[2],o[1]],[o[2],o[3]],[o[0],o[3]]].map(i)},x=y.map(e=>v[e]?a(v[e].geometry):b()),S=y.map((e,t)=>!t||e!==y[t-1]),C=d(`connector`).map(e=>{let t=e.properties,n=r.fitConnector(a(e.geometry)),o=(t.layers||[]).map(e=>c[e]).filter(e=>e!=null).sort((e,t)=>e-t),s=t.connector_type===`elevator`?`elevator`:t.connector_type===`stairs`?`stairs`:`escalator`,l=Object.assign({id:e.id,type:s,layers:s===`elevator`?o:[o[0],o[0]+1],dir:t.direction===`down`?`down`:`up`,upSign:1,shape:t.stair_shape||`straight`,turn:t.turn===`left`?`left`:`right`,accessible:t.accessible!==!1},n);if(s!==`elevator`){let e=(t.landings||[]).find(e=>c[e.layer]===l.layers[1]);if(e){let[t,n]=i(e.point);l.upSign=(t-l.centerX)*l.axisX+(n-l.centerZ)*l.axisZ>=0?1:-1}}return l.loadedKey=r.connectorKey(l),l}),w=C.filter(e=>e.type===`elevator`).map(e=>r.connectorPolygon(e));return r.levelNames=s.map(e=>e.name),r.locations=u,r.fixtures=d(`fixture`).map(e=>{let[t,n]=i(e.geometry.coordinates);return{id:e.id,kind:e.properties.kind,levelIndex:c[e.properties.layer],u:t,v:n}}),r.markers=d(`marker`).concat(d(`annotation`)).map((e,t)=>{let n=e.properties||{},a=n.mapplic||{},o=n.feature_type===`annotation`,[s,l]=i(e.geometry.coordinates);return Object.assign({style:o?`callout`:`pin`},a,{id:String(e.id==null?`marker-`+t:e.id),name:n.name||``,level:c[n.layer]==null?0:c[n.layer],x:s,z:l,y:(a.elevation||0)*r.scale,legacy:o})}),r._source={unitRows:f,voidPolys:p,voidIds:g,voidOpen:_,floorPolys:x,floorOwn:S,connectors:C,lifts:w,footprint:x[0],sitePoly:d(`site`)[0]?a(d(`site`)[0].geometry):x[0],noSite:!d(`site`)[0]||r.generatedSite,sceneryFeatures:r.sceneryOf(n),logoSrcs:[...new Set(Object.values(u).map(e=>e.mapplic&&e.mapplic.logo).filter(Boolean))]}}static union(e,t){let n=.001,r=(e,t)=>Math.abs(e[0]-t[0])<n&&Math.abs(e[1]-t[1])<n,i=e=>{let t=0;return e.forEach((n,r)=>{let i=e[(r+1)%e.length];t+=n[0]*i[1]-i[0]*n[1]}),t<0?e.slice().reverse():e.slice()},a=(e,t,r)=>{let i=r[0]-t[0],a=r[1]-t[1],o=i*i+a*a;if(Math.abs(i*(e[1]-t[1])-a*(e[0]-t[0]))>n*Math.sqrt(o))return 0;let s=((e[0]-t[0])*i+(e[1]-t[1])*a)/o;return s>1e-6&&s<1-1e-6?s:0},o=(e,t)=>{let n=[];return e.forEach((r,i)=>{let o=e[(i+1)%e.length],s=[];t.forEach(e=>{let t=a(e,r,o);t&&s.push([t,e])}),s.sort((e,t)=>e[0]-t[0]);let c=r;s.forEach(([,e])=>{n.push([c,e]),c=e}),n.push([c,o])}),n},s=i(e),c=i(t),l=o(s,c).concat(o(c,s)),u=l.filter(e=>!l.some(t=>r(e[0],t[1])&&r(e[1],t[0])));if(u.length===l.length||!u.length)return null;let d=[u[0][0]],f=new Set([0]),p=u[0];for(;;){let e=u.findIndex((e,t)=>!f.has(t)&&r(e[0],p[1]));if(e<0)break;f.add(e),p=u[e],d.push(p[0])}return f.size!==u.length||!r(p[1],u[0][0])?null:d.filter((e,t)=>{let n=d[(t-1+d.length)%d.length],r=d[(t+1)%d.length];return Math.abs((e[0]-n[0])*(r[1]-e[1])-(e[1]-n[1])*(r[0]-e[0]))>1e-6})}static source(){return r._source}static roundCorners(e,t){if(!t||e.length<3)return e;let n=e.length,r=[];for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=[o[0]-a[0],o[1]-a[1]],l=[s[0]-o[0],s[1]-o[1]],u=Math.hypot(...c),d=Math.hypot(...l),f=u&&d?Math.abs(Math.atan2(c[0]*l[1]-c[1]*l[0],c[0]*l[0]+c[1]*l[1])):0,p=Math.min(t,.45*u,.45*d);if(f<.35||p<.001){r.push(o);continue}let m=[o[0]-c[0]/u*p,o[1]-c[1]/u*p],h=[o[0]+l[0]/d*p,o[1]+l[1]/d*p],g=Math.max(2,Math.ceil(f/.26));for(let e=0;e<=g;e++){let t=e/g,n=1-t;r.push([n*n*m[0]+2*n*t*o[0]+t*t*h[0],n*n*m[1]+2*n*t*o[1]+t*t*h[1]])}}return r}static DEFAULT_CAR={id:`car`,name:`Car`,parts:[{shape:`roundbox`,size:[1.8,.62,4.2],radius:.48,at:[0,.06,0],color:`paint`},{shape:`box`,size:[.34,.12,.06],at:[-.46,.4,2.09],color:`paint`,night:{color:`#ffffff`,halo:.45,beam:{length:10,spread:40,width:1.4,strength:.16,at:[0,2.15]}}},{shape:`box`,size:[.34,.12,.06],at:[.46,.4,2.09],color:`paint`,night:{color:`#ffffff`,halo:.45}},{shape:`box`,size:[.3,.1,.06],at:[-.5,.42,-2.09],color:`paint`,night:{color:`#ff3b30`,halo:.18}},{shape:`box`,size:[.3,.1,.06],at:[.5,.42,-2.09],color:`paint`,night:{color:`#ff3b30`,halo:.18}}]};static sceneryOf(e){let t=r.toScene,n=r.scale,i=e=>e.coordinates[0].slice(0,-1).map(t);return e.filter(e=>e.properties.feature_type===`scenery`).map(e=>{let r=e.properties,a=e.geometry,o={kind:r.kind,name:r.name,location:r.location,variant:r.variant,scale:r.scale,edge:r.edge_line,ev:r.ev_stalls,occ:r.occupancy??.6,vehicle:r.vehicle,id:e.id,model:r.model,rot:r.rotation||0,anim:r.anim,recede:r.recede===!0};return a.type===`Polygon`?o.poly=i(a):a.type===`LineString`?o.line=a.coordinates.map(t):o.pt=t(a.coordinates),[[`width`,`width`],[`verge`,`verge`],[`corner_radius`,`radius`],[`curb_radius`,`curb`],[`stall_width`,`stall_width`],[`height`,`height`],[`label_size`,`label_size`]].forEach(([e,t])=>{r[e]!=null&&(o[t]=r[e]*n)}),r.label_at&&(o.label_at=t(r.label_at)),r.markings&&(o.markings={dash:r.markings.dash*n,gap:r.markings.gap*n,width:r.markings.width*n}),r.traffic&&(o.traffic={cars:r.traffic.cars,speed:r.traffic.speed*n}),r.posts&&(o.posts=r.posts.map(t)),o.anim&&Array.isArray(o.anim.points)&&(o.anim=Object.assign({},o.anim,{pts:o.anim.points.map(t)})),o})}static amenityLabels={};static amenityNames={};static currentLanguage=null;static languageStrings=null;static categoryTranslations={};static amenityTranslations={};static I18N_KINDS=[`ui`,`levels`,`categories`,`amenities`,`locations`,`markers`,`holidays`];static UI={directions:`Directions`,view_store:`View store`,close:`Close`,previous:`Previous`,next:`Next`,show_more:`More`,show_less:`Less`,swap:`Swap`,choose_start:`Select from`,choose_destination:`Select to`,pick_start:`Click a store on the map to start from`,pick_destination:`Click a store on the map to go to`,no_route:`No route between these stores`,accessible_route:`Step-free route`,not_accessible:`{place} is not accessible`,no_step_free:`No step-free route. This one uses stairs or escalators.`,minutes:`{n} min`,metres:`{n} m`,feet:`{n} ft`,walk_to:`Walk {distance} to {place}`,walk_to_lift:`Walk {distance} to the lift`,walk_to_stairs:`Walk {distance} to the stairs`,walk_to_escalator:`Walk {distance} to the escalator`,lift_up:`Lift up to {level}`,lift_down:`Lift down to {level}`,stairs_up:`Stairs up to {level}`,stairs_down:`Stairs down to {level}`,escalator_up:`Escalator up to {level}`,escalator_down:`Escalator down to {level}`,tag_lift:`LIFT`,tag_stairs:`STAIRS`,tag_escalator:`ESC`,via_lift:`via lift`,via_escalator:`via escalator`,via_both:`via escalator and lift`,open_now:`Open now`,from_here:`From here`,to_here:`To here`,elevator:`Elevator`,go_upstairs:`Go upstairs`,go_downstairs:`Go downstairs`,bus_stop:`Bus stop`,now:`Now`,amenity:`Amenity`,zoom_in:`Zoom in`,zoom_out:`Zoom out`,reset_view:`Reset view`,reset_rotation:`Reset rotation`,view_2d:`2D view`,view_3d:`3D view`,hint_touch_2d:`Drag to pan · Pinch to zoom`,hint_mouse_2d:`Drag to pan · Scroll to zoom`,hint_mouse_ctrl_2d:`Drag to pan · Ctrl + scroll to zoom`,hint_mouse_off_2d:`Drag to pan`,wheel_hint:`Use {key} + scroll to zoom`,full_screen:`Full screen`,exit_full_screen:`Exit full screen`,all_levels:`All levels`,hint_touch:`Drag to pan · Pinch to zoom · Twist to rotate · Two-finger drag to tilt`,hint_mouse:`Drag to pan · Double-click and drag to rotate · Scroll to zoom`,hint_mouse_ctrl:`Drag to pan · Double-click and drag to rotate · Ctrl + scroll to zoom`,hint_mouse_off:`Drag to pan · Double-click and drag to rotate`,language:`Language`,search_placeholder:`Search places`,search_clear:`Clear`,search_clear_all:`Clear search and filters`,search_filters:`Filters`,search_results:`{n} results`,search_result_one:`1 result`,search_none:`No places match`,search_did_you_mean:`Did you mean`,search_without_filters:`Show {n} without filters`,search_recent:`Recent`,search_popular:`Popular`,search_level:`Level`,search_showing:`Showing`,search_route:`Route from {from} to {to}`,search_route_to:`Route to {to}`,search_show_route:`Show route`,search_use_filters:`Use as filters`,search_ask:`Smart search`,search_asking:`Thinking…`,search_ask_none:`Smart search found nothing either`,search_ask_failed:`Smart search is not available right now`,search_smart_found:`Found by smart search`,search_categories:`Categories`,search_places:`Places`,search_open_now:`Open now`,search_any:`Any`,search_locations:`{n} locations`,search_places_count:`{n} places`,directory_places:`{n} places`,directory_filtered:`{n} of {total} places`,directory_matches:`Best matches`,directory_other:`Other`,directory_amenities:`Amenities`,directory_collapse:`Hide list`,directory_expand:`Show list`,touch_to_explore:`Touch to explore`,tour_stop:`{n} / {total}`,start_tour:`Start tour`};static t(e,t){let n=r.languageStrings,i=n&&n.ui&&n.ui[e]||r.UI[e]||e;return t?i.replace(/\{(\w+)\}/g,(e,n)=>t[n]==null?e:t[n]):i}static translation(e,t){let n=r.languageStrings,i=n&&n[e]&&t!=null?n[e][t]:null;return i==null?null:typeof i==`string`?{name:i}:i}static unitName(e){let t=r,n=e.loc&&typeof e.loc==`object`?e.loc.id:e.loc,i=n&&t.translation(`locations`,n);return i&&i.name||e.name||(e.amenity?t.amenityTranslations[e.amenity]||t.amenityNames[e.amenity]||e.amenity:``)}static categoryName(e){return e==null?e:r.categoryTranslations[e]||(e===`Amenity`?r.t(`amenity`):e)}static location(e){let t=r,n=(t.locations||{})[e]||null,i=n&&t.translation(`locations`,e);return i?Object.assign({},n,i):n}static localize(){let e=r,t=e.raw||{},n=t.i18n,i=e._source;if(e.languageStrings=e.currentLanguage&&n&&n.languages&&n.languages[e.currentLanguage]?n.languages[e.currentLanguage].strings||{}:null,!i)return;i.levelNamesOrig=i.levelNamesOrig||e.levelNames.slice(),i.levelShortNamesOrig=i.levelShortNamesOrig||e.levelShortNames.slice();let a=e.levelIds||[],o=t=>e.translation(`levels`,a[t])||{};e.levelNames=i.levelNamesOrig.map((e,t)=>o(t).name||e),e.levelShortNames=i.levelShortNamesOrig.map((e,t)=>o(t).short||e),e.categoryTranslations={},(e.categories||[]).forEach(t=>{let n=e.translation(`categories`,t.id);n&&n.name&&(e.categoryTranslations[t.name]=n.name)}),e.amenityTranslations={},Object.entries(t.amenities||{}).forEach(([t,n])=>{let r=e.translation(`amenities`,t);r&&r.name&&(e.amenityTranslations[n.label||t]=r.name)}),(e.markers||[]).forEach(t=>{let n=t._src=t._src||{name:t.name,subtitle:t.subtitle,description:t.description,text:t.text},r=e.translation(`markers`,t.id)||{},i=t.location!=null&&e.translation(`locations`,t.location)||{};[`name`,`subtitle`,`description`,`text`].forEach(e=>{let a=e!==`text`&&i[e]||r[e]||n[e];a==null?delete t[e]:t[e]=a})})}static RICH_TAGS=[`p`,`br`,`b`,`strong`,`i`,`em`,`a`,`ul`,`ol`,`li`,`span`];static cleanHtml(e){let t=new Set(a.RICH_TAGS),n=new Set([`script`,`style`,`iframe`,`object`,`embed`,`template`,`svg`,`math`,`noscript`,`link`,`meta`,`head`,`title`]),r=new DOMParser().parseFromString(`<body>`+String(e??``)+`</body>`,`text/html`).body,i=document.createElement(`div`),o=(e,r)=>e.childNodes.forEach(e=>{if(e.nodeType===3)return void r.append(e.textContent);if(e.nodeType!==1)return;let i=e.tagName.toLowerCase();if(n.has(i))return;if(i===`div`&&(i=`p`),!t.has(i)||i===`p`&&r.closest&&r.closest(`p`))return o(e,r);let a=document.createElement(i),s=(e.getAttribute(`class`)||``).replace(/[^\w\- ]/g,``).trim();if(s&&(a.className=s),i===`a`){let t=(e.getAttribute(`href`)||``).trim();/^(https?:|mailto:|tel:)/i.test(t)&&a.setAttribute(`href`,t)}r.append(a),o(e,a)});return o(r,i),i.innerHTML.replace(/<p>(<br>)?<\/p>$/g,``).trim()}static plainText(e){let t=String(e??``);if(!/[<&]/.test(t))return t;let n=document.createElement(`div`);return n.innerHTML=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,` `).replace(/<[^>]*>/g,` `),(n.textContent||``).replace(/\s+/g,` `).trim()}static categoryList(e){return[].concat(e??[]).flatMap(e=>String(e).split(`;`)).map(e=>e.trim()).filter(Boolean)}static mainCategory(e){return r.categoryList(e)[0]||null}static formatHours(e){let t=e&&e.match(/^Mo-Su (\d\d:\d\d)-(\d\d:\d\d)$/);return t?t[1]+`–`+t[2]:e}static resolveUnit(e){let t=e.loc&&r.locations[e.loc],n=r.categoryNames||{};if([`name`,`category`,`amenity`,`hours`,`logo`,`service`,`image`,`group`,`loc`].forEach(t=>delete e[t]),t){e.name=t.name||``;let i=r.mainCategory(t.category);e.category=t.amenity?`Amenity`:n[i]||i||null,t.amenity&&(e.amenity=r.amenityLabels[t.amenity]||t.amenity),t.hours===!1?e.hours=!1:t.hours&&(e.hours=r.formatHours(t.hours)),t.mapplic&&t.mapplic.logo&&(e.logo=t.mapplic.logo),(t.logo||t.image)&&(e.image=t.logo||t.image),e.loc=t,t.group&&(e.group=String(t.group).split(/[;,]/).map(e=>e.trim()).filter(Boolean).join(` · `))}else e.name=``,e.category=null,e.service=!0;return e}static CSV_COLUMNS=[`id`,`name`,`category`,`amenity`,`hours`,`unit`,`logo`,`description`];static isAccessible(e){return!e||e.accessible==null||!(e.accessible===!1||/^(false|0|no)$/i.test(String(e.accessible).trim()))}static unitLocations(e){let t={};return(e||[]).forEach(e=>(e.units||[]).forEach(n=>{t[n]||(t[n]=e.id)})),t}static parseCsv(e){let t=[],n=[],r=``,i=!1;e=String(e).replace(/^\uFEFF/,``);for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(r+=`"`,a++):i=!1:r+=o:o===`"`?i=!0:o===`,`?(n.push(r),r=``):o===`
4119
4152
  `||o===`\r`?(o===`\r`&&e[a+1]===`
4120
4153
  `&&a++,n.push(r),r=``,n.some(e=>e!==``)&&t.push(n),n=[]):r+=o}n.push(r),n.some(e=>e!==``)&&t.push(n);let a=(t.shift()||[]).map(e=>e.trim().toLowerCase());return t.map(e=>Object.fromEntries(a.map((t,n)=>[t,(e[n]||``).trim()])))}static mergeLocations(e,t,n){let r=Object.fromEntries(e.map(e=>[e.id,e])),i=0,a=0;return(t||[]).forEach(t=>{let o=t&&String(t.id||``).trim();if(!o)return;let s=r[o],c=!s;c&&(s=r[o]={id:o},e.push(s),i++);let l=!1;Object.keys(t).forEach(e=>{let r=t[e];if(e!==`id`&&r!==``&&r!=null&&!(n&&n(o,e))){if(e===`logo`)(s.mapplic||{}).logo!==r&&(s.mapplic=Object.assign({},s.mapplic,{logo:r}),l=!0);else if(/^(lat|latitude|lng|lon|long|longitude)$/.test(e)){let t=(s.lngLat||[NaN,NaN]).slice(),n=+r;if(!isFinite(n))return;t[+!!/^la/.test(e)]=n,String(s.lngLat)!==String(t)&&(s.lngLat=t,l=!0)}else if(e===`unit`||e===`units`){let e=Array.isArray(r)?r.map(String):String(r).split(/[;|]/).map(e=>e.trim()).filter(Boolean);(s.units||[]).join(`;`)!==e.join(`;`)&&(s.units&&(l=!0),s.units=e)}else s[e]!==r&&(s[e]=r,l=!0)}}),l&&!c&&a++}),{added:i,changed:a}}static toCsv(e){let t=r.CSV_COLUMNS.concat(e.some(e=>e.lngLat)?[`lat`,`lng`]:[],e.some(e=>e.keywords)?[`keywords`]:[],e.some(e=>e.featured)?[`featured`]:[],e.some(e=>e.accessible!=null&&e.accessible!==``)?[`accessible`]:[]),n=e=>(e=e==null?``:String(e),/[",\n]/.test(e)?`"`+e.replace(/"/g,`""`)+`"`:e);return[t.join(`,`)].concat(e.map(e=>t.map(t=>n(t===`lat`?(e.lngLat||[])[1]:t===`lng`?(e.lngLat||[])[0]:t===`logo`?(e.mapplic||{}).logo:t===`unit`?(e.units||[]).join(`;`):e[t])).join(`,`))).join(`
4121
4154
  `)+`
@@ -4141,19 +4174,20 @@ void main() {`).replace(`#include <project_vertex>`,`#include <project_vertex>
4141
4174
  </div>
4142
4175
  </div></sc-for>
4143
4176
  <div ref="{{ plugRef }}" style="position:absolute;inset:0;z-index:6;pointer-events:none;font-family:'Onest',sans-serif"></div>
4144
- <div ref="{{ slotRef }}" style="display:contents"></div></div>`;constructor(e){e||={},this.opts=e,this.props=Object.assign({},e.options),this._afterPaint=[],this._pendingState=null,this._paintQueued=!1,this._views=[]}mount(t){return a.lastMounted=this,this.props.shadow&&(this.props.frame||(this.props=Object.assign({},this.props,{frame:t})),t=a.shadowBox(t)),this._styleRoot&&e.release(this._styleRoot),this._styleRoot=e.use(e.rootOf(t)),this.el=t,t.innerHTML=``,t._mpCtx||(t._mpCtx=!0,t.addEventListener(`contextmenu`,e=>e.preventDefault(),!0),t.addEventListener(`pointerdown`,e=>{e.button===2&&(this._rightDrag=!0)},!0),window.addEventListener(`contextmenu`,e=>{(this._rightDrag||this._drag||performance.now()-(this._rightDragEnd||0)<600)&&e.preventDefault()},!0),window.addEventListener(`pointerup`,e=>{this._rightDrag&&(this._rightDrag=!1,this._rightDragEnd=performance.now())},!0)),this.view(a.TEMPLATE,t).render(this.renderVals()),this.extraViews&&this.extraViews(),this._paint(!0),this.componentDidMount(),this}view(e,t){let n=new i(e,t);return this._views.push(n),n}setOptions(e){let t=e&&`scheme`in e&&e.scheme!==this.props.scheme,n=e&&[`lightCards`,`lightTooltips`,`glassPopups`,`glassControls`,`uiRadius`].some(t=>t in e);this.props=Object.assign({},this.props,e),t?this.setScheme(this.props.scheme||`light`).catch(e=>console.warn(e)):(n||e&&`selected`in e)&&this.applySchemeAttrs(),e&&`accent`in e&&this.setAccent(e.accent).catch(e=>console.warn(e)),this._schedulePaint()}destroy(){this.componentWillUnmount&&this.componentWillUnmount(),this._destroyed=!0,this._bleedWatch&&this._bleedWatch(),this._bleedWatch=null,this._bleedHost&&this._bleedHost.remove(),this._bleedHost=null,this.el&&(this.el.innerHTML=``),this._styleRoot&&e.release(this._styleRoot),this._styleRoot=null}static shadowBox(e,t){let n=e.shadowRoot||e.attachShadow({mode:`open`}),r=n.querySelector(`style[data-mp-host]`);r||(r=document.createElement(`style`),r.setAttribute(`data-mp-host`,``),n.prepend(r)),r.textContent=(t||`:host{position:relative}`)+`:host([hidden]){display:none}.mp-embed{all:initial;visibility:inherit;display:block;position:absolute;inset:0}`,Array.from(n.children).forEach(e=>e.classList.contains(`mp-embed`)&&e.remove());let i=document.createElement(`div`);return i.className=`mp-embed`,i.style.cssText=`position:absolute;inset:0`,n.appendChild(i),i}setState(e,t){let n=this._pendingState||this.state,r=typeof e==`function`?e(n,this.props):e;r!=null&&(this._pendingState=Object.assign({},n,r)),t&&this._afterPaint.push(t),this._schedulePaint()}forceUpdate(e){e&&this._afterPaint.push(e),this._schedulePaint()}_schedulePaint(){this._paintQueued||(this._paintQueued=!0,queueMicrotask(()=>this._paint()))}_paint(e){if(this._paintQueued=!1,this._pendingState&&=(this.state=this._pendingState,null),this._destroyed)return;let t=this.renderVals();this._views.forEach(e=>e.render(t)),this._viewport&&(this._viewport.style.cursor=t.cursor||``);let n=this._prevProps||this.props;this._prevProps=this.props,!e&&this.componentDidUpdate&&this.componentDidUpdate(n),this._flushCallbacks()}_flushCallbacks(){let e=this._afterPaint;this._afterPaint=[],e.forEach(e=>e())}mapSource(){let e=this.props,t=this.ownsViews?null:e.view||null;if(e.data||typeof e.load==`function`)return this._dataUrl||=(a._dataLoads=(a._dataLoads||0)+1,new URL(e.src||`map.mapplic.json`,document.baseURI).href+`#data-`+a._dataLoads),{url:this._dataUrl,from:{data:e.data||null,load:e.data?null:e.load,saved:!1,view:t}};let n=e.src||`mall.mapplic.json`;return{url:t?n+(n.includes(`#`)?`&`:`#`)+`view-`+encodeURIComponent(t):n,from:{saved:e.savedCopies!==!1&&typeof e.onSave!=`function`,view:t}}}static async loadThree(){let[e,t]=await Promise.all([import(`https://esm.sh/three@0.184.0`),import(`https://esm.sh/three@0.184.0/examples/jsm/loaders/SVGLoader.js`).then(e=>e.SVGLoader,()=>null)]);return{THREE:e,SVGLoader:t}}async boot(){try{let{url:e,from:t}=this.mapSource();if(r.title=this.props.title||null,await a.load(e,t),this._destroyed||(await a.pluginsReady,this._destroyed))return;let{THREE:n,SVGLoader:i}=await a.loadThree();if(this._destroyed||(r._sourceUrl!==e&&await a.load(e,t),this.beforeBuild&&(await this.beforeBuild(e),this._destroyed)))return;try{if(!i)throw Error(`SVGLoader is not available`);this._svgLoader=new i,this._svgLoader.SVG=i,this._logos={},await Promise.all(a._source.logoSrcs.map(async e=>{this._logos[e]=await(await fetch(e)).text()}))}catch(e){console.warn(`logos`,e)}try{await document.fonts.load(`700 64px Onest`)}catch{}if(this._destroyed)return;let o=r.startLevel||0;this.state.level=o,this._pendingState&&(this._pendingState.level=o),this.init(n)}catch(e){console.error(e);let t=String(e&&e.stack||``).split(`
4145
- `).map(e=>/([\w.-]+\.(?:js|json))(?:\?[^:]*)?:(\d+)/.exec(e)).find(Boolean);this.setState({err:this.props.errorText||`Map failed to load: `+(e&&e.message||String(e))+(t?` (`+t[1]+`:`+t[2]+`)`:``)})}}init(e){this.prepareScheme();let t=a,n=t.source(),i=t.FLOOR_TOP,o=this._glEl;if(!o||(this.THREE=e,t.currentLanguage=this.pickLanguage(),t.localize(),!this.setupRenderer(e,o)))return;let s=this.scene;this.camera;let{rectPoints:c,polygonBounds:l,hashRandom:u,slugify:d,insetPolygon:f,vecBetween:p,unitVector:m,filletPolyline:h,dashQuads:g,cornerFillet:_,roundRectPoints:v}=r,y=t.offsetPolyline,b=(e,t)=>y(e,t/2).concat(y(e,-t/2).reverse()),x=t.measurePolyline,S=t.pointAlong,C=n.sitePoly,w=e=>t.pointInPolygon(C,e[0],e[1]),T=this.siteClipPlanes(e,C),E=t=>new e.Vector2(t[0],-t[1]),D=(t,n)=>{let r=t.map(E);e.ShapeUtils.isClockWise(r)&&r.reverse();let i=new e.Shape(r);return(n||[]).forEach(t=>{let n=t.map(E);e.ShapeUtils.isClockWise(n)||n.reverse(),i.holes.push(new e.Path(n))}),i},O=(t,n,r,i)=>{let a=new e.ExtrudeGeometry(D(t,i),{depth:r-n,bevelEnabled:!1,curveSegments:1});return a.rotateX(-Math.PI/2),a.translate(0,n,0),a},k=(t,n)=>this.themed(new e.MeshLambertMaterial(Object.assign({},n||{})),t),A=this.levelViews=a.levelNames.map((t,n)=>{let r=new e.Group;return s.add(r),{group:r,depthMaterial:n?new e.MeshDepthMaterial({alphaHash:!0}):null,mats:[],units:[],occluders:[],lifts:[],escs:[],y:0,opacity:1,appliedOpacity:1,transparent:!1,fadingOut:!1,placed:!1}}),j=(e,t)=>(A[e].mats.includes(t)||A[e].mats.push(t),t),M=(t,n,r,i,a)=>{let o=new e.Mesh(n,Array.isArray(r)?r.map(e=>j(t,e)):j(t,r));return o.castShadow=!!i,i&&A[t].depthMaterial&&(o.customDepthMaterial=A[t].depthMaterial),o.receiveShadow=!0,(a||A[t].group).add(o),o},N=(n,r,i,a)=>{let o=t.outlineGeo(e,r),s=t.outlineObject(e,o,j(n,this.themed(o.userData.wide?new e.MeshBasicMaterial:new e.LineBasicMaterial,i)));return(a||A[n].group).add(s),s};this._geomKit={rect:c,rnd:u,V:p,Nz:m,fillet:h,thick:b,routeOf:x,at:S,dashes:g,fp2:_,rr:v,shp:D,ext:O,lam:k,CP:T,inPl:w},this._textures=[],this._stepCanvases=[],this._themedMats=new Set,this._escalatorTextures=[],this._extrude=O,this._inset=f,this._unitById={},this._amenityList=[],this._units=[],this._tallUnits=null,this._byId={},this._stores=[],this._escalators=[],this._escalatorById={},this._explodeBlend=0,this._liftMaterials=[],this._liftColors=t.scenePalette.lift.map(t=>new e.Color(t)),this._escalatorPalette={n:t.scenePalette.escalator.map(t=>new e.Color(t)),h:t.scenePalette.escalatorActive.map(t=>new e.Color(t))};for(let a=0;a<t.levelNames.length;a++){let o=A[a],s=n.voidPolys[a],u=t.unionAll(s),p=M(a,O(t.roundCorners(n.floorPolys[a],t.floorRadius),0,i,u),k(t.floorColors[0]));o.slab=p,p.renderOrder=-1,r.generatedBuilding&&(p.visible=!1);{let e=p.geometry.attributes.position,t=Math.max(1,Math.ceil(e.count/160)),n=[];for(let r=0;r<e.count;r+=t)n.push([e.getX(r),-e.getZ(r)]);p.geometry.computeBoundingBox();let r=p.geometry.boundingBox;o.footprint=n,o.footprintCenter=[(r.min.x+r.max.x)/2,-(r.min.z+r.max.z)/2]}if(o.occluders.push(p),s.length&&(this.opt(`barriers`,null)??t.voidBarriers)){let s=[],l=[],d=.9,f=[];n.connectors.forEach(e=>{if(e.type===`elevator`){if(!e.layers.includes(a))return;let t=e.axisX,n=e.axisZ,r=-n,i=t,o=e.length/2+.15,s=e.width/2+.15;f.push([[e.centerX-t*o-r*s,e.centerZ-n*o-i*s],[e.centerX+t*o-r*s,e.centerZ+n*o-i*s],[e.centerX+t*o+r*s,e.centerZ+n*o+i*s],[e.centerX-t*o+r*s,e.centerZ-n*o+i*s]]);return}if(a!==e.layers[0]&&a!==e.layers[1])return;let n=a===e.layers[1],r,i,o,s,c;if(e.type===`stairs`){let a=t.stairLayout(e);[r,i]=n?a.end:a.start,[o,s]=n?a.ed:a.sd,c=a.w}else{let t=n?1:-1;o=e.axisX*e.upSign,s=e.axisZ*e.upSign,r=e.centerX+o*t*e.length/2,i=e.centerZ+s*t*e.length/2,c=e.width}let l=-s,u=o,d=c/2+.15,p=1.2;f.push([[r-o*p-l*d,i-s*p-u*d],[r+o*p-l*d,i+s*p-u*d],[r+o*p+l*d,i+s*p+u*d],[r-o*p+l*d,i-s*p+u*d]])});let p=n.voidOpen&&n.voidOpen[a]||[],m=.05*r.scale,h=([e,t])=>p.some(n=>{let r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let[o,s]=n[i],[c,l]=n[a],u=c-o,d=l-s,f=u*u+d*d||1,p=Math.max(0,Math.min(1,((e-o)*u+(t-s)*d)/f));if(Math.hypot(e-o-u*p,t-s-d*p)<m)return!0;s>t!=l>t&&e<u*(t-s)/(d||1e-12)+o&&(r=!r)}return r}),g=n.unitRows[a].map(e=>e.points||c(e.u0,e.u1,e.v0,e.v1)).map(e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return{P:e,box:[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]}}),_=1*r.scale,v=.5*r.scale,y=(e,t)=>g.some(({P:n,box:r})=>{if(e<r[0]-_||e>r[1]+_||t<r[2]-_||t>r[3]+_)return!1;let i=!1;for(let r=0,a=n.length-1;r<n.length;a=r++){let[o,s]=n[r],[c,l]=n[a],u=c-o,d=l-s,f=u*u+d*d||1,p=Math.max(0,Math.min(1,((e-o)*u+(t-s)*d)/f));if(Math.hypot(e-o-u*p,t-s-d*p)<_)return!0;s>t!=l>t&&e<u*(t-s)/(d||1e-12)+o&&(i=!i)}return i}),b=(e,t)=>{let n=Math.hypot(t[0]-e[0],t[1]-e[1]),r=Math.max(1,Math.ceil(n/v)),i=n=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],a=[],o=null;for(let e=0;e<r;e++){let t=i((e+.5)/r),n=!y(t[0],t[1]);n&&o==null&&(o=e),!n&&o!=null&&(a.push([i(o/r),i(e/r)]),o=null)}return o!=null&&a.push([i(o/r),t]),a};u.forEach(e=>e.forEach((n,r)=>t.clipOutside(n,e[(r+1)%e.length],f).flatMap(([e,t])=>b(e,t)).forEach(([e,t])=>{p.length&&h([(e[0]+t[0])/2,(e[1]+t[1])/2])||(s.push(e[0],i,e[1],t[0],i,t[1],t[0],i+d,t[1],e[0],i,e[1],t[0],i+d,t[1],e[0],i+d,e[1]),l.push(e[0],i+d,e[1],t[0],i+d,t[1]))})));let x=new e.BufferGeometry;x.setAttribute(`position`,new e.Float32BufferAttribute(s,3));let S=new e.MeshBasicMaterial({transparent:!0,opacity:.6,side:e.DoubleSide,depthWrite:!1});S.userData.o0=.6,this.themed(S,null,`palette:glass`),M(a,x,S,!1);let C=new e.BufferGeometry;C.setAttribute(`position`,new e.Float32BufferAttribute(l,3)),o.group.add(new e.LineSegments(C,j(a,this.themed(new e.LineBasicMaterial,null,`palette:rail`))))}let m=t.walkTester(n.floorPolys[a],n.voidPolys[a].concat((n.connectors||[]).filter(e=>e.type===`elevator`?e.layers.includes(a):e.layers[0]===a).map(e=>t.connectorPolygon(e))),n.unitRows[a].map(e=>e.points||c(e.u0,e.u1,e.v0,e.v1))),h=null,g=null,_=()=>h||=t.openingSpace(n.floorPolys[a],n.voidPolys[a].concat((n.connectors||[]).filter(e=>e.type===`elevator`?e.layers.includes(a):e.layers[0]===a).map(e=>t.connectorPolygon(e))),n.unitRows[a].map(e=>({points:e.points||c(e.u0,e.u1,e.v0,e.v1),kiosk:e.kiosk})));n.unitRows[a].forEach(s=>{let u=(e=>t.unitGap&&e.length>24?r.untangle(e):e)(f(s.points&&s.points.length>24&&t.unitGap?r.simplify(s.points,t.unitGap*1.5):s.points||c(s.u0,s.u1,s.v0,s.v1),t.unitGap)),p=s.holes?s.holes.map(e=>t.unitGap?r.untangle(f(e.length>24?r.simplify(e,t.unitGap*1.5):e,-t.unitGap)):e):null,h=t.unitsFlat?.002:(s.height||(s.kiosk?8:14))/10*t.unitHeightScale,v=s.service?`sv`:s.amenity?`am`:`nb`,y=t.unitsFlat?(t.unitBase??i)+.005:t.unitBase??i,b=t.unitsFlat?y+h:i+h,x=O(t.roundCorners(u,t.unitRadius),y,b,p);p&&(u.holes=p);let S=new e.Group;o.group.add(S);let C=M(a,x,k(t.unitPalette[v][0]),!t.unitsFlat,S);t.unitsFlat&&C.material&&!Array.isArray(C.material)?Object.assign(C.material,{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-80}):C.material&&!Array.isArray(C.material)&&Object.assign(C.material,{polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});let w=N(a,x,t.unitPalette[v][1],C);t.unitOutlineNone?w.visible=!1:t.unitsFlat&&!(w.geometry.userData||{}).wide&&(w.material.onBeforeCompile=e=>{e.vertexShader=e.vertexShader.replace(`#include <project_vertex>`,`#include <project_vertex>
4146
- gl_Position.z -= 2e-4 * gl_Position.w;`)},w.material.customProgramCacheKey=()=>`unit-outline-flat`);let T=s.labelBox||l(u),E=s.labelBox?t.clipToRect(u,T):u,D=T[1]-T[0],A=T[3]-T[2],j=A>=D;Math.max(D,A)*10,Math.min(D,A)*10;let P=s.service||s.logo&&this._logos&&this._logos[s.logo]?``:s.amenity?s.amenity:this.pluginSetting(`labels`,`uppercase`)===!1?String(s.labelText??s.name):String(s.labelText??s.name).toUpperCase(),F=t.fitLabelWrapped(E,P,!!s.amenity,s.labelAngle),I=F.centerX,ee=F.centerZ,L={r:s,grp:S,m:C,line:w,kind:v,levelIndex:a,am:!!s.amenity,base:y,top:b,centerX:I,centerZ:ee,boxWidth:D,boxDepth:A,alongV:j,heightOrig:h,nameOrig:s.name,heightScale:1,logoSvgOrig:s.logo&&this._logos?this._logos[s.logo]:null,raw:s.points,poly0:u,centerXOrig:I,centerZOrig:ee,boxWidthOrig:D,boxDepthOrig:A,av0:j,lp:E,lp0:E,labelOrig:!s.noLabel,merged:[]};if(!s.service&&!s.amenity){let e={id:(e=>{let t=e,n=2;for(;this._byId[t];)t=e+`-`+n++;return t})(d(s.name)+`-`+a),name:t.unitName(s),cat:s.category,img:s.image,grp:s.group,level:a,hours:s.hours===!1?``:s.hours||t.categoryHours[s.category]||t.defaultHours,loc:s.loc};L.id=e.id,C.userData.id=e.id,s.inert&&(C.userData.inert=!0),this._unitById[e.id]=L,L.catOrig=e.cat,L.hoursOrig=e.hours,this._stores.push(e),this._byId[e.id]={item:{poly:u,cx:I,cz:ee,top:i+h,store:e},levelIndex:a},o.units.push(C)}else if(s.amenity){let e={id:`am-`+d(String(s.amenity))+`-`+a+`-`+this._amenityList.length,name:t.unitName(s),cat:`Amenity`,type:String(s.amenity),level:a,hours:s.hours===!1?``:s.hours||t.amenityHours};L.id=e.id,C.userData.id=e.id,this._unitById[e.id]=L,L.catOrig=e.cat,L.hoursOrig=e.hours,L.nameOrig=e.name,this._amenityList.push(e),this._byId[e.id]={item:{poly:u,cx:I,cz:ee,top:i+h,store:e},levelIndex:a},o.units.push(C)}else o.occluders.push(C);let R=!r.projectionName;if((this.opt(`openings`,null)??!0)&&s.points&&(s.openings||R)){let r=s.openings||=(s.openingsAuto=!0,t.autoOpenings(s.points,m,s.kiosk,s.kiosk?null:_())),c=t.mapOpenings(s.points,u,r.flatMap(e=>t.openingPieces(s.points.length,e))),l=t.polygonEdges(u),d=[];c.forEach(e=>{let n=l[e.edge];if(!n)return;let r=[t.lerp(n.a,n.b,e.start),t.lerp(n.a,n.b,e.end)];r.n=[-n.n[0],-n.n[1]],d.push(r)}),L.storefrontGroup=new e.Group,L.storefrontGroup.position.y=i,o.group.add(L.storefrontGroup),L.storefrontSegments=d,L.storefrontPaths=t.openingPaths(u,c.filter(e=>l[e.edge]),t.unitRadius),L.storefrontPoly=u,L.storefrontHeight=h,L.storefrontPatch=s.storefront||null,L.storefrontAlpha=0,this._buildStorefront(L),d.length&&L.id&&this._byId[L.id]?this._byId[L.id].item.ops=d:!s.kiosk&&L.id&&this._byId[L.id]&&(this._byId[L.id].item.faceDir=t.fallbackFront(u,[m,g||=t.walkTester(n.floorPolys[a],[],[])]))}this._units.push(L)});let v=t.fixtures.filter(e=>e.levelIndex===a&&e.kind===`table`);if(v.length){let n=new e.CylinderGeometry(.3,.3,.24,20),r=new e.BoxGeometry(.2,.13,.2);n.translate(0,i+.12,0),r.translate(0,i+.065,0);let o=k(t.themeSpec(null,`palette:fixture`)),s=k(t.themeSpec(null,`palette:fixtureAlt`));v.forEach(({u:e,v:i})=>{let c=M(a,n,o,!0);c.position.set(e,0,i),N(a,n,t.themeSpec(null,`palette:fixtureEdge`),c),[[.5,0],[-.5,0],[0,.5],[0,-.5]].forEach(([t,n])=>M(a,r,s,!0).position.set(e+t,0,i+n))})}}this._levelRise=t.storeyHeight,this._tmpVec=new e.Vector3,this._raycaster=new e.Raycaster,this._pointerNdc=new e.Vector2(-9,-9);let P=()=>this.fitToViewport();P(),this._fitSize=P,this._resizeObserver=new ResizeObserver(P),this._resizeObserver.observe(this._viewport),this.camView=this.home(!1),this.camGoal=this.home(!1),this.applyProps(),this._frameId=requestAnimationFrame(this.loop),this.applyProps(),setTimeout(()=>this.revealWhenReady(),60)}setupRenderer(e,t){let n=a,r;try{r=new e.WebGLRenderer({antialias:!0,alpha:!0})}catch{return this.setState({err:this.props.errorText||`3D needs WebGL, which is not available here`}),!1}this.renderer=r,r.setPixelRatio(Math.min(2,window.devicePixelRatio||1)),r.shadowMap.enabled=!0,r.shadowMap.type=e.PCFShadowMap,r.localClippingEnabled=!0,r.setClearColor(n.scenePalette.background,0),r.domElement.style.cssText=`position:absolute;inset:0;width:100%;height:100%;display:block`,t.appendChild(r.domElement);let i=this.scene=new e.Scene;this.camera=new e.PerspectiveCamera(30,1,4,2e3),i.add(this._hemiLight=new e.HemisphereLight(16777215,n.scenePalette.groundLight,2.4));let o=this.sun=new e.DirectionalLight(16777215,.9),s=new e.Vector3(.45,.85,-.28).normalize(),c=n.bounds,l=Math.hypot(c[1]-c[0],c[3]-c[2])/2*1.28,u=Math.max(150,l*1.6);return o.target.position.set((c[0]+c[1])/2,0,(c[2]+c[3])/2),o.position.copy(o.target.position).addScaledVector(s,u),i.add(o,o.target),o.castShadow=this.opt(`shadows`,!0),Object.assign(o.shadow.camera,{left:-l,right:l,top:l,bottom:-l,near:10,far:u+l*2}),o.shadow.camera.updateProjectionMatrix(),o.shadow.mapSize.set(2048,2048),o.shadow.radius=5,o.shadow.bias=-4e-4,o.shadow.normalBias=.03,this._paletteColors={},Object.keys(n.unitPalette).forEach(t=>this._paletteColors[t]=n.unitPalette[t].map(t=>new e.Color(t))),!0}siteClipPlanes(e,t){let n=(()=>{let e=t.slice().sort((e,t)=>e[0]-t[0]||e[1]-t[1]),n=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),r=[],i=[];for(let t of e){for(;r.length>1&&n(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}for(let t of e.reverse()){for(;i.length>1&&n(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}return r.slice(0,-1).concat(i.slice(0,-1))})(),r=n.reduce((e,t)=>[e[0]+t[0]/n.length,e[1]+t[1]/n.length],[0,0]);return n.map((t,i)=>{let a=n[(i+1)%n.length],o=-(a[1]-t[1]),s=a[0]-t[0],c=Math.hypot(o,s);return o/=c,s/=c,o*(r[0]-t[0])+s*(r[1]-t[1])<0&&(o=-o,s=-s),new e.Plane(new e.Vector3(o,0,s),-(o*t[0]+s*t[1]))})}fitToViewport(){if(this._bleedSetting&&!this._bleedBusy){this._bleedBusy=!0;try{this.applyBleed()}finally{this._bleedBusy=!1}}let e=Math.max(1,this._viewport.clientWidth),t=Math.max(1,this._viewport.clientHeight);this._width=e,this._height=t;let n=e<640,r=Math.max(e,this.el&&this.el.clientWidth||0)<640;(n!==!!this.state.narrow||r!==!!this.state.hostNarrow)&&this.setState({narrow:n,hostNarrow:r});let i=this._bleed||{l:0,t:0,r:0,b:0};this.renderer.setSize(e+i.l+i.r,t+i.t+i.b,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this._shiftKey=null,this.camView&&(this.applyViewShift(this.camera,0),this.camera.updateMatrixWorld(),this.plugFrame(0,performance.now()),this.renderFrame(this.camera),this.overlays())}revealWhenReady(){if(this._destroyed)return;this.setState({ready:!0}),this.syncBuiltins();let e=performance.now(),t=null,n=0,r=()=>{if(!this._destroyed){if(this._slotSig!==void 0&&!this._slotRaf&&this._slotSig===t?n++:n=0,t=this._slotSig,n>=2||performance.now()-e>a.SHOW_WAIT_MS)return this.setState({shown:!0});requestAnimationFrame(r)}};requestAnimationFrame(r)}home(e){let t=a,n=Math.max(1,this._width||1200),r=Math.max(1,this._height||780),i=n/r,o=t.FOV_TAN,s=(t.raw||{}).view||{},c=this.is2d(),l=!this._uiHidden&&this._insets||{},u=[n,r,+!!e,+!!c,s.bearing,s.pitch,s.bearing_2d,+!!s.fixed,t.homeCenter.join(),t.homeExtent.join(),t.bounds.join(),t.homeHull.length,t.storeyHeight,e?this.levelGapPx():0,(t.levelShortNames||[]).length,l.left,l.right,l.top,l.bottom,this._uiHidden?``:this._slotSig||``,+!!this.THREE].join(`|`),d=this._homeCache=this._homeCache||{};if(d[u])return Object.assign({},d[u]);let f={targetX:t.homeCenter[0],targetY:e?0:t.FLOOR_TOP,targetZ:t.homeCenter[1],azimuth:c?this.bearing2d():-(s.bearing??-45)*Math.PI/180,polar:c?0:(s.pitch??56)*Math.PI/180+(e?.1:0),distance:Math.max(1.18*t.homeExtent[0]/(o*i),(e?1.39:1)*t.homeExtent[1]/o)};return this.fitHome(f,e,n,r,l),Object.keys(d).length>8&&(this._homeCache={}),this._homeCache[u]=f,Object.assign({},f)}static HOME_MARGIN=24;static HOME_CLEARANCE=8;fitHome(e,t,n,r,i){let o=a,s=this.THREE,c=(o.raw||{}).view||{};if(!s)return e;let l=o.homeHull,u=o.topHull;if(c.fixed&&c.fit){let[e,t]=o.homeCenter,[n,r]=o.homeExtent;l=[[e-n,t-r],[e+n,t-r],[e+n,t+r],[e-n,t+r]],u=[]}if(!l||l.length<3)return e;let d=Math.max(1,(o.levelShortNames||[]).length),f=t?(d-1)*this.levelGapPx()/20:0,p=o.FLOOR_TOP+o.storeyHeight+f,m=l.map(e=>new s.Vector3(e[0],-f,e[1])).concat((u||[]).map(e=>new s.Vector3(e[0],p,e[1]))),h=((i.left||0)-(i.right||0))/2,g=((i.top||0)-(i.bottom||0))/2,_=Math.round(Math.min(o.HOME_MARGIN,Math.min(n,r)*.04)),v=o.HOME_CLEARANCE,y={L:_+(i.left||0),R:n-_-(i.right||0),T:_+(i.top||0),B:r-_-(i.bottom||0)},b=n*.35,x=r*.35;(y.R-y.L<b||y.B-y.T<x)&&Object.assign(y,{L:_,R:n-_,T:_,B:r-_});let S=this._homeCam=this._homeCam||new s.PerspectiveCamera(30,1,.5,1e6),C=new s.Vector3,w=new s.Vector3,T=new s.Vector3;S.aspect=n/r;let E=()=>(this.aimCamera(S,e),m.map(e=>(C.copy(e).project(S),[(C.x+1)/2*n+h,(1-C.y)/2*r+g]))),D=()=>{for(let t=0;t<10;t++){let t=E(),n=t.map(e=>e[0]),i=t.map(e=>e[1]),a=Math.min(...n),s=Math.max(...n),c=Math.min(...i),l=Math.max(...i),u=2*e.distance*o.FOV_TAN/r;w.setFromMatrixColumn(S.matrixWorld,0),T.setFromMatrixColumn(S.matrixWorld,1);let d=((a+s)/2-(y.L+y.R)/2)*u,f=-((c+l)/2-(y.T+y.B)/2)*u,p=Math.max(.05,T.x*T.x+T.z*T.z);e.targetX+=w.x*d+T.x*f/p,e.targetZ+=w.z*d+T.z*f/p;let m=Math.max((s-a)/(y.R-y.L),(l-c)/(y.B-y.T));isFinite(m)&&m>0&&(e.distance*=m)}};D();let O=this._uiHidden?[]:this._slotRects||[];for(let e=0;e<8&&O.length;e++){let e=o.convexHull(E()),t=null,n=1/0;if(O.forEach(r=>{let i=[r.x-v,r.y-v,r.x+r.w+v,r.y+r.h+v];if(!o.polyHitsRect(e,[i[0]+1,i[1]+1,i[2]-1,i[3]-1]))return;let a=[r.edge===`top`?[`T`,i[3]]:[`B`,i[1]]];r.side===`left`?a.push([`L`,i[2]]):r.side===`right`&&a.push([`R`,i[0]]),a.forEach(([e,r])=>{let i=Object.assign({},y,{[e]:r});if(i.R-i.L<b||i.B-i.T<x)return;let a=1-(i.R-i.L)*(i.B-i.T)/((y.R-y.L)*(y.B-y.T));a>0&&a<n&&(n=a,t=[e,r])})}),!t)break;y[t[0]]=t[1],D()}return e}static polyHitsRect(e,t){if(!e||e.length<3)return!1;let n=e.map(e=>e[0]),r=e.map(e=>e[1]);if(Math.max(...n)<=t[0]||Math.min(...n)>=t[2]||Math.max(...r)<=t[1]||Math.min(...r)>=t[3])return!1;let i=[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]];for(let t=0;t<e.length;t++){let n=e[t],r=e[(t+1)%e.length],a=r[1]-n[1],o=n[0]-r[0],s=1/0,c=-1/0,l=1/0,u=-1/0;if(e.forEach(e=>{let t=e[0]*a+e[1]*o;s=Math.min(s,t),c=Math.max(c,t)}),i.forEach(e=>{let t=e[0]*a+e[1]*o;l=Math.min(l,t),u=Math.max(u,t)}),u<=s||l>=c)return!1}return!0}is2d(){return this._mode2d??((a.raw||{}).view||{}).mode===`2d`}bearing2d(){return-(((a.raw||{}).view||{}).bearing_2d||0)*Math.PI/180}minDist(){let e=(a.raw||{}).view||{};return e.max_zoom_in?Math.max(a.MIN_DISTANCE,this.home(!0).distance/e.max_zoom_in):a.MIN_DISTANCE}maxDist(){let e=(a.raw||{}).view||{},t=this.home(!0).distance;return e.max_zoom_out?t*e.max_zoom_out:Math.max(320,t*1.6)}fitDist(e,t){if(t||=this.home(!1),!e||!e.length)return t.distance/1.9;let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.hypot(Math.max(...n)-Math.min(...n),Math.max(...r)-Math.min(...r))*.85,o=Math.min(1,(this._width||1200)/(this._height||780));return Math.max(this.minDist(),Math.min(t.distance/1.25,a.FOCUS_MIN_DISTANCE),Math.min(t.distance/1.25,i/(2*a.FOV_TAN*o*.35)))}static FOCUS_MIN_DISTANCE=70;static TILT_RESET_MS=1200;static GLASS_REST_MS=200;static flightEase(e,t){return e&&e.ease===`out`?1-(1-t)**3:t<.5?4*t*t*t:1-(-2*t+2)**3/2}goHome(e){this._drift=null;let t=this.home(e),n=this.camView;n&&!this._reducedMotion&&(this._flight={t0:performance.now(),dur:800,a:Object.assign({},n)}),t.azimuth+=2*Math.PI*Math.round((n.azimuth-t.azimuth)/(2*Math.PI)),Object.assign(this.camGoal,t)}applyViewShift(e,t){let n=!this._uiHidden&&this._insets||{},r=((n.left||0)-(n.right||0))/2,i=((n.top||0)-(n.bottom||0))/2,o=this._shift=this._shift||{x:0,y:0},s=this._flight,c=this._reducedMotion?1:1-Math.exp(-(t||.016)/.06);if(s&&!this._reducedMotion){let e=Math.min(1,(performance.now()-s.t0)/s.dur),t=a.flightEase(s,e),n=s.shiftE||0;c=t>=1||n>=1?1:Math.max(0,(t-n)/(1-n)),s.shiftE=t}o.x+=(r-o.x)*c,o.y+=(i-o.y)*c,Math.abs(r-o.x)<.5&&(o.x=r),Math.abs(i-o.y)<.5&&(o.y=i);let l=e.uuid+`|`+o.x.toFixed(1)+`|`+o.y.toFixed(1);if(l===this._shiftKey)return;this._shiftKey=l;let u=Math.max(1,this._width||1),d=Math.max(1,this._height||1);!o.x&&!o.y?e.clearViewOffset&&e.clearViewOffset():e.setViewOffset(u,d,-o.x,-o.y,u,d),e.updateProjectionMatrix()}applyProps(){this.renderer&&(this.sun.castShadow=this.opt(`shadows`,!0),this.sun.shadow.intensity=Math.max(0,Math.min(1,(+this.opt(`shadowStrength`,100)||100)/100)))}static SLAB_CLEARANCE=.02;squashUnits(){let e=a,t=this.levelViews;if(!(e.unitsFlat||!this._units||t.length<2)){if(!this._tallUnits){let n=e.storeyHeight-e.FLOOR_TOP-e.SLAB_CLEARANCE;this._tallUnits=this._units.filter(r=>r.grp&&r.levelIndex<t.length-1&&r.top-(r.base??e.FLOOR_TOP)>n)}this._tallUnits.forEach(n=>{let r=t[n.levelIndex+1],i=n.base??e.FLOOR_TOP,a=n.top-i,o=r.group.visible?r.y-t[n.levelIndex].y-i-e.SLAB_CLEARANCE:1/0,s=o<a?Math.max(.05,o/a):1;Math.abs(n.grp.scale.y-s)<1e-4||(n.grp.scale.y=s,n.grp.position.y=i*(1-s))})}}levelGoal(e,t,n){if(t.all)return{y:(e-(a.levelNames.length-1)/2)*n,opacity:1};let r=e-t.level;return r<=0?{y:r*a.storeyHeight,opacity:1}:{y:r*a.storeyHeight+8,opacity:0}}unitColorsOf(e,t){let n=a,i=e.r||{},o=i.loc&&(typeof i.loc==`object`?i.loc:n.locations[i.loc]),s=o&&r.mainCategory(o.category)||i.fileCategory,c=(o&&o.id||``)+`|`+(s||``)+`|`+r.scheme;if(e.pcK!==c){e.pcK=c;let t=s&&(n.categories||[]).find(e=>e.id===s),i=o&&o.mapplic&&o.mapplic.colors||t&&t.colors,a=r.scheme===`dark`,l=i&&a?i.dark||n.darkColorSet(i):i,u=this.THREE,d=e=>e.map(e=>new u.Color(e));e.pc=l&&l.default?{n:d(l.default),h:d(l.hover||l.default),f:l.focus&&d(l.focus),fh:(l.focus_hover||l.focus)&&d(l.focus_hover||l.focus)}:null}let l=e.pc;return l&&(t===`nb`||t===`am`)?l.n:l&&t===`hv`?l.h:l&&t===`ft`&&l.f?l.f:l&&t===`fs`&&l.fh?l.fh:this._paletteColors[t]}static darkColorSet(e){let t={};return[`default`,`hover`,`focus`,`focus_hover`].forEach(n=>{Array.isArray(e[n])&&(t[n]=r.darkColors(e[n]))}),t}levelSpacing(){let e=a,t=this.appearanceOwn(`level_spacing`);if(t!=null)return+t;let n=this.opt(`spacing`,null);if(n!=null)return+n;let r=this.opt(`gap`,null);return r!=null&&e.levelSpan?r/10/e.levelSpan*100:12}levelGapPx(){let e=a;return e.levelSpan?this.levelSpacing()/100*e.levelSpan*10:this.opt(`gap`,140)}groupKeyOf(e){let t=e&&this._unitById&&this._unitById[e];if(!t)return e;if(t.groupKey===void 0){let n=t.r&&t.r.featureId;t.groupKey=n==null?e:String(n).replace(/~\d+$/,``)}return t.groupKey}groupParts(e){let t=this._byId||{};return this._groupsSource!==t&&(this._groupsSource=t,this._groupMembers={},this._groupRepCache={},Object.keys(t).forEach(e=>{let t=this.groupKeyOf(e);(this._groupMembers[t]=this._groupMembers[t]||[]).push(e)})),this._groupMembers[this.groupKeyOf(e)]||[e]}linkKeyOf(e){let t=this._byId||{};if(this._linkKeySource!==t&&(this._linkKeySource=t,this._linkKeys={}),!(e in this._linkKeys)){let n=t[e]&&t[e].item&&t[e].item.store;this._linkKeys[e]=n&&n.loc&&n.loc.id||null}return this._linkKeys[e]}groupRep(e){if(!e||!this._byId||!this._byId[e])return e;let t=this.groupParts(e);if(t.length<2)return e;let n=this._groupRepCache,r=this.groupKeyOf(e);return n[r]||(n[r]=t.reduce((e,t)=>this.unitArea(t)>this.unitArea(e)?t:e))}unitArea(e){let t=((this._byId[e]||{}).item||{}).poly||[],n=0;for(let e=0,r=t.length-1;e<t.length;r=e++)n+=(t[r][0]-t[e][0])*(t[r][1]+t[e][1]);return Math.abs(n)}paletteKeyOf(e,t){if(!e.id)return e.kind;let n=this.groupKeyOf(e.id),r=a.LINKED_HIGHLIGHT?this.linkKeyOf(e.id):null,i=e.id===t.selected||t.selected&&n===this.groupKeyOf(t.selected)||r&&t.selected&&r===this.linkKeyOf(t.selected),o=!i&&!!(this._highlights&&(this._highlights.has(e.id)||[...this._highlights].some(e=>this.groupKeyOf(e)===n))),s=i||o,c=e.id===t.hovered||t.hovered&&n===this.groupKeyOf(t.hovered)||r&&t.hovered&&r===this.linkKeyOf(t.hovered),l=o&&this._highlightTints&&this._highlightTints.get(n);return e.highlightTint=l?this.highlightPalette(l):this.categoryPaletteOf(e),s?c?`fs`:`ft`:e.am?c?`hv`:`am`:c?`hv`:`nb`}highlightPalette(e){let t=e+`|`+r.scheme,n=this._highlightPalettes=this._highlightPalettes||{};if(!n[t]){let i=r.accentUnits(e,r.scheme===`dark`),a=this.THREE;n[t]={hv:i.hv.map(e=>new a.Color(e)),ft:i.ft.map(e=>new a.Color(e)),fs:i.fs.map(e=>new a.Color(e))}}return n[t]}unitStates(){let e=this.props.unitStates||this.appearanceOwn(`unit_states`);return[`category_hover`,`category`].includes(e)?e:`accent`}setUnitStates(e){if(![`accent`,`category_hover`,`category`].includes(e))throw Error(`unitStates must be 'accent', 'category_hover' or 'category'`);return this.props=Object.assign({},this.props,{unitStates:e}),e}categoryPaletteOf(e){let t=this.unitStates();if(t===`accent`||e.am)return null;let n=this._byId&&this._byId[e.id],i=n&&n.item&&n.item.store,a=i&&i.loc;if(!a||a.amenity)return null;let o=String(a.category||``);if(!e._category||e._category.key!==o){let t=r.categoryList(a.category)[0],n=t&&(r.categories||[]).find(e=>e.id===t);e._category={key:o,color:n&&r.hexRgb(n.color)?n.color:null}}let s=e._category.color;if(!s)return null;let c=this.highlightPalette(s);return t===`category`?c:{hv:c.hv}}hitTest(e){let t=this.state,n=[];this._raycaster.setFromCamera(e,this.camera),this.levelViews.forEach((e,r)=>{!e.group.visible||e.opacity<.5||(n.push(...e.occluders.filter(e=>e.visible)),(t.all||r===t.level)&&n.push(...e.units.filter(e=>e.visible&&!e.userData.inert)))}),(this._features||new Map).forEach(e=>{if(e.meshes){let t=e.meshes();t&&t.length&&n.push(...t)}}),this.levelViews[0].group.visible&&this.levelViews[0].opacity>.5&&this.levelViews[0].group.traverse(e=>{e.userData&&e.userData.scn&&n.push(e)});let r=this._raycaster.intersectObjects(n,!1)[0],i=r&&r.object.userData,a=i&&i.feat&&this._features&&this._features.get(i.feat);return r?{id:i.id||i.scn||(a?a.resolve?a.resolve(r.object):i.feat:null),point:r.point}:null}loop=e=>{if(this._frameId=requestAnimationFrame(this.loop),this._themeTween&&this.stepThemeTween(e),!this.renderer||(document.hidden||!this._visible)&&!this._forceFrame){this._lastFrameTime=e;return}let t=a;this.THREE;let n=Math.min(.05,(e-(this._lastFrameTime||e))/1e3),r=this._flight,i=r&&r.explode&&!this._reducedMotion&&e-r.t0<r.dur*r.explode?Object.assign({},this.state,{all:!0}):this.state,o=this._reducedMotion;t.FLOOR_TOP,this._lastFrameTime=e;let s=o?1:1-Math.exp(-n*7),c=o?1:1-Math.exp(-n*9),l=o?1:1-Math.exp(-n*15),u=this.levelGapPx()/10,d=!o&&this.settingOn(`scenery`,`connectorsMoving`),f=!o&&this.settingOn(`scenery`,`carsMoving`);this.levelViews.forEach((e,t)=>{let n=this.levelGoal(t,i,u),r=e.placed?s:1;e.placed=!0,e.y+=(n.y-e.y)*r,e.opacity+=(n.opacity-e.opacity)*r,Math.abs(n.y-e.y)<.001&&(e.y=n.y),Math.abs(n.opacity-e.opacity)<.001&&(e.opacity=n.opacity),e.group.position.y=e.y,e.group.visible=e.opacity>.01,(e.y!==n.y||e.opacity!==n.opacity)&&(this._busyFrame=!0);let a=e.opacity<.999,o=a&&n.opacity<.5;(a!==e.transparent||o!==e.fadingOut)&&(e.transparent=a,e.fadingOut=o,e.mats.forEach(e=>{e.transparent=a||(e.userData.o0??1)<1,e.userData.dw0===void 0&&(e.userData.dw0=e.depthWrite),e.depthWrite=!o&&e.userData.dw0,e.needsUpdate=!0}),e.group.traverse(t=>{let n=t.material;if(!n||Array.isArray(n))return;let r=n.userData.o0===void 0?!(n.transparent&&!e.mats.includes(n)):n.userData.o0>=1;a&&r&&t.userData.ro0===void 0?(t.userData.ro0=t.renderOrder,t.renderOrder-=10):!a&&t.userData.ro0!==void 0&&(t.renderOrder=t.userData.ro0,delete t.userData.ro0)})),e.opacity!==e.appliedOpacity&&(e.appliedOpacity=e.opacity,e.depthMaterial&&(e.depthMaterial.opacity=e.opacity),e.mats.forEach(t=>t.opacity=(t.userData.o0??1)*e.opacity))}),this.squashUnits(),this._levelRise+=((i.all?u:t.storeyHeight)-this._levelRise)*s,this._explodeBlend+=(+!!i.all-this._explodeBlend)*s,Math.abs(+!!i.all-this._explodeBlend)<.001&&(this._explodeBlend=+!!i.all);let p=this._inertia;if(p&&!this._drag){let e=(e,t,n)=>Math.max(t,Math.min(n,e));p.pan?this.panBy(p.vx*n,p.vz*n):(this.camGoal.azimuth+=p.va*n,this.camGoal.polar=e(this.camGoal.polar+p.vp*n,.12,1.38));let t=Math.exp(-n*(p.pan?6:9));p.vx*=t,p.vz*=t,p.va*=t,p.vp*=t,Math.abs(p.vx)+Math.abs(p.vz)<.2&&Math.abs(p.va)+Math.abs(p.vp)<.01&&(this._inertia=null)}if(!this._drag&&this.camGoal){let e=this.camGoal,[t,r,i,a]=this.panLimit(),s=Math.max(t,Math.min(r,e.targetX)),c=Math.max(i,Math.min(a,e.targetZ));if(s!==e.targetX||c!==e.targetZ){let t=o?1:1-Math.exp(-n*12);e.targetX+=(s-e.targetX)*t,e.targetZ+=(c-e.targetZ)*t,Math.abs(s-e.targetX)+Math.abs(c-e.targetZ)<.01&&(e.targetX=s,e.targetZ=c)}}let m=this._approach;if(m&&this.state.shown&&this.camView&&this.camGoal){this._approach=null;let t=this.camGoal,n=this.is2d(),r=this._drift;r&&r.t0!=null&&(t.azimuth=r.azimuth,t.polar=r.polar,r.t0=null);let i=Object.assign({},t,{distance:t.distance*m.height,polar:n?t.polar:Math.min(t.polar,a.APPROACH_POLAR),azimuth:t.azimuth+(n?0:m.turn)});Object.assign(this.camView,i),this._flight={t0:e,dur:m.dur,a:i,ease:`out`,log:!0,approach:!0},this._busyFrame=!0}let h=this.camView,g=this.camGoal,_=this._flight;if(this.is2d()){let e=this.bearing2d();g.polar=0,g.azimuth=e+2*Math.PI*Math.round((g.azimuth-e)/(2*Math.PI))}_&&(o||i.drag||this._inertia)&&(this._flight=null);let v=this._tiltEase;if(v&&(o||this.is2d()||this._flight))this._tiltEase=null;else if(v){let t=Math.min(1,(e-v.t0)/a.TILT_RESET_MS),n=t*t*(3-2*t);g.polar=h.polar=v.from+(v.to-v.from)*n,t>=1&&(this._tiltEase=null)}let y=this._drift;if(y&&(o||i.drag||this._inertia||this.is2d()))this._drift=null;else if(y&&!this._flight){y.t0??Object.assign(y,{t0:e,azimuth:g.azimuth,polar:g.polar});let t=Math.min(1,(e-y.t0)/y.dur),n=t*t*(3-2*t);g.azimuth=y.azimuth+y.turn*n,y.tilt&&(g.polar=Math.max(.12,Math.min(1.38,y.polar+y.tilt*n)))}if(this._flight){let t=Math.min(1,(e-_.t0)/_.dur),n=a.flightEase(_,t);for(let e in g)h[e]=_.a[e]+(g[e]-_.a[e])*n;_.log&&_.a.distance>0&&g.distance>0&&(h.distance=_.a.distance*(g.distance/_.a.distance)**+n),_.peak&&(h.distance+=_.peak*Math.sin(Math.PI*n)),t>=1&&(this._flight=null)}else for(let e in g)h[e]+=(g[e]-h[e])*c;let b=this.camera,x=Math.sin(h.polar);b.position.set(h.targetX+h.distance*x*Math.sin(h.azimuth),h.targetY+h.distance*Math.cos(h.polar),h.targetZ+h.distance*x*Math.cos(h.azimuth)),h.polar<.05?b.up.set(-Math.sin(h.azimuth),0,-Math.cos(h.azimuth)):b.up.set(0,1,0),b.lookAt(h.targetX,h.targetY,h.targetZ);{let e=.2,t=Math.cos(h.azimuth),n=Math.sin(h.azimuth);t<-.2?this._flipH=!0:t>e&&(this._flipH=!1),n<-.2?this._flipV=!0:n>e&&(this._flipV=!1)}let S=i.all?0:Math.max(0,Math.min(1,(+this.opt(`dimBelow`,70)||0)/100)),C=this._washColor||=new this.THREE.Color(t.scenePalette.background),w=this._floorColor||=new this.THREE.Color(t.floorColors[0]),T=this._tmpColor0||=new this.THREE.Color,E=this._tmpColor1||=new this.THREE.Color;(this.levelViews||[]).forEach((e,t)=>{e.slab&&e.slab.material.color.lerp(t<i.level&&S?T.copy(w).lerp(C,S):w,l)});let D=this.settingOn(`wayfinding`,`storefronts`);this._units.forEach(e=>{let t=this.paletteKeyOf(e,i),n=(t===`nb`||t===`hv`||t===`am`)&&this._tints&&this._tints[e.id]?this._tints[e.id]:e.highlightTint&&e.highlightTint[t]?e.highlightTint[t]:this.unitColorsOf(e,t),r=e.levelIndex<i.level?S:0;e.m.material.color.lerp(r?T.copy(n[0]).lerp(C,r):n[0],l),e.line.material.color.lerp(r?E.copy(n[1]).lerp(C,r*.85):n[1],l);{let n=t===`fs`||t===`ft`?2:+(t===`hv`);e.fr!==n&&(e.fr=n,e.line.position.y=n*.004,[e.line,e.m].forEach(e=>{e.userData.ro0===void 0?e.renderOrder=n:(e.userData.ro0=n,e.renderOrder=n-10)}))}if(e.opM){let n=e.storefrontStyle.show,r=D&&!e.hid&&(n===`always`||t===`hv`||t===`fs`||t===`ft`),i=+e.storefrontStyle.tint||0;e.storefrontAlpha+=(+!!r-e.storefrontAlpha)*l,e.opFix?e.opM.color.copy(e.opFix):(e.opM.color.copy(e.m.material.color),i<0?e.opM.color.multiplyScalar(1+i):i>0&&e.opM.color.lerp(this._white||=new this.THREE.Color(`#ffffff`),i)),e.opM.opacity=e.storefrontAlpha*(this.levelViews[e.levelIndex].opacity??1),e.storefrontGroup.visible=e.storefrontAlpha>.01}(e.ink||=n[2].clone()).lerp(n[2],l)}),o||(this._clock=(this._clock||0)+n),d&&(this._escalatorTime=(this._escalatorTime||0)+n),f&&(this._carTime=(this._carTime||0)+n);{let e=(this._escalatorTime||0)*1.4%1;(this._escalatorTextures||[]).forEach(t=>{t.still||(t.t.offset.x=t.up?e:1-e)})}if(this._clock,this._hoverDirty&&!this._drag){this._hoverDirty=!1;let e=this._hovOver?null:this.hitTest(this._pointerNdc),t=this.groupRep(this._hovOver||(e?e.id:null));t!==i.hovered&&this.setState({hovered:t})}let O=this.home(i.all),k=this._homePrev;k&&!this._awayFromHome&&!this._flight&&!this._drag&&!this._inertia&&(Math.abs(k.distance-O.distance)>.001||Math.abs(k.targetX-O.targetX)+Math.abs(k.targetZ-O.targetZ)>.001)&&(Object.assign(g,{targetX:O.targetX,targetY:O.targetY,targetZ:O.targetZ,distance:O.distance}),(!i.ready||e-(this._homeT0||e)<a.HOME_SNAP_MS)&&Object.assign(h,{targetX:O.targetX,targetY:O.targetY,targetZ:O.targetZ,distance:O.distance})),i.ready&&!this._homeT0&&(this._homeT0=e),this._homePrev=O;let A=Math.abs(g.distance-O.distance)>1||Math.abs(((g.azimuth-O.azimuth)%(2*Math.PI)+3*Math.PI)%(2*Math.PI)-Math.PI)>.02||Math.abs(g.polar-O.polar)>.02||Math.hypot(g.targetX-O.targetX,g.targetZ-O.targetZ)>.5;if(this._awayFromHome=A,A!==i.awayFromHome&&this.setState({awayFromHome:A}),b.updateMatrixWorld(),this.busyTick(b,e),this.camTick(),this.applyViewShift(b,n),this.plugFrame(n,e),b.isPerspectiveCamera){let e=this._focusTarget=this._focusTarget||new this.THREE.Vector3;e.set(this.camView.targetX||0,this.camView.targetY||0,this.camView.targetZ||0);let t=b.position.distanceTo(e),n=Math.max(.5,Math.min(4,t*.02)),r=Math.max(2e3,t*4);(Math.abs(b.near-n)>.001||Math.abs(b.far-r)>1)&&(b.near=n,b.far=r,b.updateProjectionMatrix())}this.renderFrame(b),this.overlays()};isBusy(){return!!this._busyOn}busyTick(e,t){let n=e.matrixWorld.elements,r=this._busyMat||=n.slice(),i=e.projectionMatrix.elements,o=this._busyProj||=i.slice(),s=!!(this._busyFrame||this._drag||this._themeTween);this._busyFrame=!1;for(let e=0;e<16;e++)(Math.abs(n[e]-r[e])>1e-6||Math.abs(i[e]-o[e])>1e-6)&&(s=!0),r[e]=n[e],o[e]=i[e];s&&(this._busyUntil=t+a.GLASS_REST_MS);let c=t<(this._busyUntil||0);c!==!!this._busyOn&&(this._busyOn=c,this._viewport&&(c?this._viewport.setAttribute(`data-mp-busy`,`1`):this._viewport.removeAttribute(`data-mp-busy`)))}selectedId(){let e=this.state;return e.popupOpen&&e.selected?e.selected:e.scenerySelected||null}featureInfo(e){if(!e)return null;if(this.state,this._byId&&this._byId[e])return Object.assign({kind:`store`},this.info(this._byId[e].item.store));let t=this._features&&this._features.get(e);return t?Object.assign({kind:t.kind},t.info?t.info():{},{id:e}):null}anchor(e){if(!this.levelViews||!e)return null;this.state;let t=this._tmpVec,n=()=>(t.project(this.camera),{x:(t.x+1)/2*this._width,y:(1-t.y)/2*this._height,visible:t.z<1&&(!this._bleed||this.ndcVisible(t))}),r=this._features&&this._features.get(e);if(r&&r.anchor){let e=r.anchor();return e?(t.set(e[0],e[1],e[2]),n()):null}let i=this._byId&&this._byId[e];if(!i)return null;let a=this._unitById&&this._unitById[e]&&this._unitById[e].grp;return a?(a.updateWorldMatrix(!0,!1),t.set(i.item.cx,i.item.top,i.item.cz).applyMatrix4(a.matrixWorld)):t.set(i.item.cx,this.levelViews[i.levelIndex].y+i.item.top,i.item.cz),n()}overlays(){this.state;let e=this._width,t=this._height,n=this.camera,r=this._tmpVec,i=a.FLOOR_TOP,o=this.levelViews,s=this._byId,c=(i,a,o)=>(r.set(i,a,o).project(n),[(r.x+1)/2*e,(1-r.y)/2*t]),l=(e,t)=>{e&&(e.style.transform=`translate(`+t[0].toFixed(1)+`px,`+t[1].toFixed(1)+`px)`)},u=e=>{let t=s[e],n=this._unitById&&this._unitById[e]&&this._unitById[e].grp;return n?(n.updateWorldMatrix(!0,!1),r.set(t.item.cx,t.item.top,t.item.cz).applyMatrix4(n.matrixWorld),c(r.x,r.y,r.z)):c(t.item.cx,o[t.levelIndex].y+t.item.top,t.item.cz)},d=e=>this._features&&this._features.get(e),f=e=>{let t=e.anchor();return t?c(t[0],t[1],t[2]):null},p=e=>s[e]?u(e):d(e)&&d(e).anchor?f(d(e)):null,m=this._builtinPlugins&&this._builtinPlugins.markers&&this._builtinPlugins.markers.active&&this._builtinPlugins.markers.exports&&this._builtinPlugins.markers.exports.top;this._tooltipSlots&&this._tooltipSlots.s.forEach((e,t)=>{let n=e&&p(e);if(!n)return;let r=m?m(e):null;r!=null&&r-2<n[1]&&(n[1]=r-2),l(this._tE[t],n)}),(this._tg||[]).forEach((e,t)=>{let n=o[t];if(!n)return;if(!n.footprint)return l(e,c(0,n.y+i,37));let a=n.slab.matrixWorld,s=(e,t)=>(r.set(e,i,t).applyMatrix4(a),c(r.x,r.y,r.z));n.slab.updateWorldMatrix(!0,!1);let u=1/0;n.footprint.forEach(e=>{let t=s(e[0],-e[1]);t[0]<u&&(u=t[0])}),l(e,[u,s(n.footprintCenter[0],-n.footprintCenter[1])[1]])})}navGrid(){if(this._navGrid)return this._navGrid;let e=a,t=e.source(),n=.5,r=t.floorPolys.flat(),i=Math.floor(Math.min(...r.map(e=>e[0])))-2,o=Math.floor(Math.min(...r.map(e=>e[1])))-2,s=Math.ceil((Math.max(...r.map(e=>e[0]))+2-i)/n),c=Math.ceil((Math.max(...r.map(e=>e[1]))+2-o)/n),l=s*c,u=[],d=[],f=(e,t,n,r)=>[[e,n],[t,n],[t,r],[e,r]],p=(t,r,a)=>{let l=r.map(e=>e[0]),u=r.map(e=>e[1]),d=Math.max(0,Math.floor((Math.min(...l)-i)/n)),f=Math.min(s-1,Math.ceil((Math.max(...l)-i)/n)),p=Math.max(0,Math.floor((Math.min(...u)-o)/n)),m=Math.min(c-1,Math.ceil((Math.max(...u)-o)/n));for(let c=p;c<=m;c++)for(let l=d;l<=f;l++)e.pointInPolygon(r,i+(l+.5)*n,o+(c+.5)*n)&&(t[c*s+l]=a)},m=[];for(let n=0;n<e.levelNames.length;n++){let r=new Uint8Array(l),i=[],o=e=>{p(r,e,0);let t=e.map(e=>e[0]),n=e.map(e=>e[1]);i.push({P:e,u0:Math.min(...t),u1:Math.max(...t),v0:Math.min(...n),v1:Math.max(...n)})};p(r,t.floorPolys[n],1),t.unitRows[n].forEach(e=>o(e.points||f(e.u0,e.u1,e.v0,e.v1))),t.voidPolys[n].forEach(e=>o(e)),t.connectors.forEach(t=>{(t.type===`elevator`?t.layers.includes(n):t.layers[0]===n)&&o(e.connectorPolygon(t))}),a.fixtures.filter(e=>e.levelIndex===n&&e.kind===`table`).forEach(({u:e,v:t})=>o(f(e-.6,e+.6,t-.6,t+.6))),m.push(i);let h=new Uint8Array(l).fill(255),g=new Int32Array(l),_=0,v=0;for(let e=0;e<l;e++)r[e]||(h[e]=0,g[v++]=e);for(;_<v;){let e=g[_++],t=e%s,n=(e-t)/s,r=h[e]+1;if(!(r>6))for(let e=-1;e<=1;e++)for(let i=-1;i<=1;i++){let a=t+i,o=n+e;if(a<0||o<0||a>=s||o>=c)continue;let l=o*s+a;h[l]>r&&(h[l]=r,g[v++]=l)}}u.push(r),d.push(h)}let h=(e,t,r)=>{let a=Math.floor((t-i)/n),c=Math.floor((r-o)/n);for(let t=0;t<16;t++){let n=-1,r=1e9;for(let i=-t;i<=t;i++)for(let o=-t;o<=t;o++){if(Math.max(Math.abs(o),Math.abs(i))!==t)continue;let l=(c+i)*s+a+o;if(u[e][l]){let e=o*o+i*i;e<r&&(r=e,n=l)}}if(n>=0)return n}return-1};for(let t=0;t<e.levelNames.length;t++){let e=u[t],n=new Int32Array(l),r=new Int32Array(l),i=0,a=0,o=0;for(let t=0;t<l;t++){if(!e[t]||n[t])continue;i++;let l=0,u=0;for(n[t]=i,r[u++]=t;l<u;){let t=r[l++],a=t%s,o=(t-a)/s;a+1<s&&e[t+1]&&!n[t+1]&&(n[t+1]=i,r[u++]=t+1),a>0&&e[t-1]&&!n[t-1]&&(n[t-1]=i,r[u++]=t-1),o+1<c&&e[t+s]&&!n[t+s]&&(n[t+s]=i,r[u++]=t+s),o>0&&e[t-s]&&!n[t-s]&&(n[t-s]=i,r[u++]=t-s)}u>o&&(o=u,a=i)}for(let t=0;t<l;t++)e[t]&&n[t]!==a&&(e[t]=0)}let g=new Map,_=(e,t,n,r,i,a)=>{[[e,t],[t,e]].forEach(([e,t])=>{g.has(e)||g.set(e,[]),g.get(e).push({to:t,cost:n,kind:r,lp:i,stepFree:a})})};return t.connectors.forEach(t=>{if(t.type===`elevator`)return;let[n,r]=t.layers,i=t.axisX*t.upSign,a=t.axisZ*t.upSign,o=t.length/2+.6,s=t.type===`stairs`?e.stairLayout(t):null,c=s?s.low:[t.centerX-i*o,t.centerZ-a*o],u=s?s.high:[t.centerX+i*o,t.centerZ+a*o],d=h(n,c[0],c[1]),f=h(r,u[0],u[1]);if(d<0||f<0)return;let p=n*l+d,m=r*l+f,_=t.type===`stairs`,v=_?`stairs`:`esc`,y=_?30:22,b=e=>{let t=Math.hypot(e[0],e[1])||1;return[e[0]/t,e[1]/t]},x=t.length/2,S=s?[s.start,b([-s.sd[0],-s.sd[1]])]:[[t.centerX-i*x,t.centerZ-a*x],[-i,-a]],C=s?[s.end,b(s.ed)]:[[t.centerX+i*x,t.centerZ+a*x],[i,a]],w=(e,n,r,i)=>{g.has(e)||g.set(e,[]),g.get(e).push({to:n,cost:y,kind:v,m0:r,m1:i,cid:t.id})};_?(w(p,m,S,C),w(m,p,C,S)):t.dir===`down`?w(m,p,C,S):w(p,m,S,C)}),t.connectors.filter(e=>e.type===`elevator`).forEach(t=>{let n=a.levelNames.map((e,n)=>t.layers.includes(n)?h(n,t.centerX,t.centerZ):-1),r=e.connectorPolygon(t),i=t.accessible!==!1;for(let e=0;e<3;e++)for(let t=e+1;t<3;t++)n[e]>=0&&n[t]>=0&&_(e*l+n[e],t*l+n[t],28+8*(t-e),`lift`,r,i)}),this._navGrid={cellSize:n,originU:i,originV:o,cols:s,rows:c,cellCount:l,walk:u,clearance:d,conn:g,obstacles:m}}doors(e){let t=a,n=this.navGrid(),r=this._byId[e];if(!r)return[];let{cellSize:i,originU:o,originV:s,cols:c,rows:l,cellCount:u,walk:d}=n,f=r.item.poly,p=d[r.levelIndex],m=r.item.ops,h=f.map(e=>e[0]),g=f.map(e=>e[1]);for(let e of[1.1,2.5,5,9]){let n=[],a=[],d=Math.max(0,Math.floor((Math.min(...h)-e-o)/i)),_=Math.min(c-1,Math.ceil((Math.max(...h)+e-o)/i)),v=Math.max(0,Math.floor((Math.min(...g)-e-s)/i)),y=Math.min(l-1,Math.ceil((Math.max(...g)+e-s)/i));for(let l=v;l<=y;l++)for(let h=d;h<=_;h++){let d=l*c+h;if(!p[d])continue;let g=o+(h+.5)*i,_=s+(l+.5)*i;if(t.pointInPolygon(f,g,_))continue;let v=m?Math.min(...m.map(e=>t.closestPointOnPolygon(e,[g,_])[1])):t.closestPointOnPolygon(f,[g,_])[1];v<=e&&(n.push(r.levelIndex*u+d),a.push(v))}if(!n.length)continue;if(e===1.1)return n;let b=Math.min(...a);return n.filter((e,t)=>a[t]<=b+1.5*i)}return[]}route(e,t,n){let r=!!(n&&n.stepFree),i=a,{cellSize:o,originU:s,originV:c,cols:l,rows:u,cellCount:d,walk:f,clearance:p,conn:m,obstacles:h}=this.navGrid(),g=f.length*d,_=this.doors(e),v=new Set(this.doors(t));if(!_.length||!v.size)return null;let y=(e,t)=>{let n=new Float64Array(g).fill(1/0),i=new Int32Array(g).fill(-1),a=[],o=[],s=(e,t)=>{let n=a.length;for(a.push(e),o.push(t);n>0;){let e=n-1>>1;if(o[e]<=t)break;a[n]=a[e],o[n]=o[e],n=e}a[n]=e,o[n]=t},c=()=>{let e=a[0],t=a.pop(),n=o.pop();if(a.length){let e=0,r=a.length;for(;;){let t=2*e+1;if(t>=r||(t+1<r&&o[t+1]<o[t]&&t++,o[t]>=n))break;a[e]=a[t],o[e]=o[t],e=t}a[e]=t,o[e]=n}return e};e.forEach(e=>{n[e]=0,s(e,0)});let h=-1;for(;a.length;){let e=o[0],a=c();if(e>n[a])continue;if(t.has(a)){h=a;break}let g=Math.floor(a/d),_=a-g*d,v=_%l,y=(_-v)/l,b=f[g],x=p[g];for(let t=-1;t<=1;t++)for(let r=-1;r<=1;r++){if(!r&&!t)continue;let o=v+r,c=y+t;if(o<0||c<0||o>=l||c>=u)continue;let f=c*l+o;if(!b[f]||r&&t&&(!b[y*l+o]||!b[c*l+v]))continue;let p=x[f],m=e+(r&&t?1.4142:1)*(1+(p<=1?2.5:p===2?.8:p===3?.25:0)),h=g*d+f;m<n[h]&&(n[h]=m,i[h]=a,s(h,m))}(m.get(a)||[]).forEach(t=>{if(r&&!t.stepFree)return;let o=e+t.cost;o<n[t.to]&&(n[t.to]=o,i[t.to]=a,s(t.to,o))})}if(h<0)return null;let _=[];for(let e=h;e>=0;e=i[e])_.push(e);return _.reverse()},b=this._byId[e].levelIndex,x=null;if(b===this._byId[t].levelIndex&&String(e)>String(t)){let e=y(this.doors(t),new Set(_));e&&e.every(e=>Math.floor(e/d)===b)&&(x=e.reverse())}if(x||=y(_,v),!x)return null;let S=e=>[s+(e%l+.5)*o,c+(Math.floor(e/l)+.5)*o],C=(e,t)=>Math.floor((t-c)/o)*l+Math.floor((e-s)/o),w=[],T=null;x.forEach((e,t)=>{let n=Math.floor(e/d),r=e-n*d;if(!T||T.levelIndex!==n){if(T){let i=(m.get(x[t-1])||[]).find(t=>t.to===e);w.push({kind:i?i.kind:`esc`,from:T.levelIndex,to:n,a:T.cells[T.cells.length-1],b:r,mA:i&&i.m0,mB:i&&i.m1,cid:i&&i.cid,lp:i&&i.lp,stepFree:!!(i&&i.stepFree)})}T={kind:`walk`,levelIndex:n,cells:[]},w.push(T)}T.cells.push(r)});let E=(e,t,n,r=2)=>{let i=f[e],a=p[e],o=Math.min(r,a[C(...t)],a[C(...n)]),s=Math.hypot(n[0]-t[0],n[1]-t[1]),c=Math.ceil(s/.2);for(let e=0;e<=c;e++){let r=C(t[0]+(n[0]-t[0])*e/c,t[1]+(n[1]-t[1])*e/c);if(!i[r]||a[r]<o)return!1}return!0},D=(e,t,n)=>{let r=n[0]-t[0],i=n[1]-t[1],a=r*r+i*i,o=a?Math.max(0,Math.min(1,((e[0]-t[0])*r+(e[1]-t[1])*i)/a)):0;return Math.hypot(e[0]-t[0]-r*o,e[1]-t[1]-i*o)},O=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),k=(e,t,n,r)=>{let i=O(e,t,n),a=O(e,t,r),o=O(n,r,e),s=O(n,r,t);return i*a<0&&o*s<0?0:Math.min(D(e,n,r),D(t,n,r),D(n,e,t),D(r,e,t))},A=(e,t,n,r)=>{let a=Math.min(t[0],n[0])-r,o=Math.max(t[0],n[0])+r,s=Math.min(t[1],n[1])-r,c=Math.max(t[1],n[1])+r,l=r;for(let r of h[e])if(!(r.u1<a||r.u0>o||r.v1<s||r.v0>c)){if(i.pointInPolygon(r.P,t[0],t[1])||i.pointInPolygon(r.P,n[0],n[1]))return 0;for(let e=0;e<r.P.length;e++){let i=k(t,n,r.P[e],r.P[(e+1)%r.P.length]);if(i<l&&(l=i,!l))return 0}}return l},j=.55,M=(e,t,n)=>{let r=Math.min(j,A(e,t,t,j),A(e,n,n,j));return A(e,t,n,j)>=r-1e-6},N=(e,t)=>{if(t.length<3)return t;let n=t.map(t=>A(e,t,t,j)),r=t.map(t=>p[e][C(...t)]),i=[t[0]],a=0;for(;a<t.length-1;){let o=a+1,s=Math.min(n[a],n[o]),c=Math.min(r[a],r[o]);for(;o+1<t.length&&E(e,t[a],t[o+1],Math.min(2,c))&&A(e,t[a],t[o+1],j)>=Math.min(s,n[o+1])-1e-6;)s=Math.min(s,n[++o]),c=Math.min(c,r[o]);i.push(t[o]),a=o}return i},P=(e,t,n)=>{if(t.length<3)return t;let r=[t[0]];for(let i=1;i<t.length-1;i++){let a=t[i-1],o=t[i],s=t[i+1],c=Math.hypot(a[0]-o[0],a[1]-o[1]),l=Math.hypot(s[0]-o[0],s[1]-o[1]);if(c<1e-6||l<1e-6){r.push(o);continue}let u=i===1?c*.8:c/2,d=i===t.length-2?l*.8:l/2,f=null;for(let t=0,r=Math.min(n,u,d);t<4&&!f;t++,r/=2){let t=[o[0]+(a[0]-o[0])/c*r,o[1]+(a[1]-o[1])/c*r],n=[o[0]+(s[0]-o[0])/l*r,o[1]+(s[1]-o[1])/l*r],i=Math.max(1e-4,Math.min(A(e,t,o,j),A(e,o,n,j))*.8),u=[];for(let e=0;e<=6;e++){let r=e/6,i=1-r;u.push([i*i*t[0]+2*i*r*o[0]+r*r*n[0],i*i*t[1]+2*i*r*o[1]+r*r*n[1]])}u.every((t,n)=>!n||A(e,u[n-1],t,j)>=i)&&(f=u)}f?r.push(...f):r.push(o)}return r.push(t[t.length-1]),r},F=this._byId[e].item,I=this._byId[t].item,ee=(e,t)=>e.ops&&e.ops.length?e.ops.map(e=>i.closestPointOnPolygon(e,t)).sort((e,t)=>e[1]-t[1])[0][0]:i.closestPointOnPolygon(e.poly,t)[0],L=w.filter(e=>e.kind===`walk`),R=(e,t)=>{let n=null;return e.forEach((r,a)=>{let o=e[(a+1)%e.length],s=Math.hypot(o[0]-r[0],o[1]-r[1]);if(s<1e-6)return;let c=(o[0]-r[0])/s,l=(o[1]-r[1])/s,u=Math.min(s/2,.5*i.scale),d=Math.max(u,Math.min(s-u,(t[0]-r[0])*c+(t[1]-r[1])*l)),f=[r[0]+c*d,r[1]+l*d],p=Math.hypot(t[0]-f[0],t[1]-f[1]);(!n||p<n.d)&&(n={d:p,q:f})}),n?n.q:i.closestPointOnPolygon(e,t)[0]},z=2*i.scale,te=(e,t)=>{if(!(e.ops&&e.ops.length))return null;let n=e.ops.map(e=>[e,i.closestPointOnPolygon(e,t)[1]]).sort((e,t)=>e[1]-t[1])[0][0],r=n[0],a=n[1],o=Math.hypot(a[0]-r[0],a[1]-r[1])||1,s=(a[0]-r[0])/o,c=(a[1]-r[1])/o,l=Math.min(o/2,.5*i.scale),u=Math.max(l,Math.min(o-l,(t[0]-r[0])*s+(t[1]-r[1])*c)),d=[r[0]+s*u,r[1]+c*u];return n.n?[d,[d[0]+n.n[0]*B,d[1]+n.n[1]*B]]:null},B=z,V=0,H=(e,t,n)=>{let r=-1,i=0;for(let a=0;a<e.length&&(a&&(i+=Math.hypot(e[a][0]-e[a-1][0],e[a][1]-e[a-1][1])),!(i>3*z));a++)(e[a][0]-t[0])*n[0]+(e[a][1]-t[1])*n[1]<B*.999&&(r=a);let a=[t[0]+n[0]*B,t[1]+n[1]*B];for(;r>=0&&r+1<e.length&&!(E(V,a,e[r+1])&&M(V,a,e[r+1]));)r--;return e.slice(Math.min(r+1,e.length-1))},ne=(e,t)=>{if(!t.length)return t;let n=te(e,t[0]);if(!n){if(e.ops&&e.ops.length)return[ee(e,t[0]),...t];let n=R(e.poly,t[0]);return Math.hypot(n[0]-t[0][0],n[1]-t[0][1])>1.5*i.scale?t:[n,...t]}let r=n[0],a=[(n[1][0]-r[0])/B,(n[1][1]-r[1])/B];return[r,n[1],...H(t,r,a)]},re=(e,t)=>{let n=e[0],r=e[1],a=e=>(e[0]-n[0])*-r[1]+(e[1]-n[1])*r[0],o=e=>(e[0]-n[0])*r[0]+(e[1]-n[1])*r[1],s=Math.min(B,.75*i.scale),c=3*z,l=.25*i.scale,u=-1,d=0,f=0;for(let e=0;e+1<t.length&&(f+=Math.hypot(t[e+1][0]-t[e][0],t[e+1][1]-t[e][1]),!(f>6*z));e++){let n=a(t[e]),r=a(t[e+1]);if(n*r>0&&Math.min(Math.abs(n),Math.abs(r))>l)continue;let i=n===r?0:Math.max(0,Math.min(1,n/(n-r))),f=o(t[e])+i*(o(t[e+1])-o(t[e]));f>=s&&f<=c&&(u=e,d=f)}return u>=0?[n,[n[0]+r[0]*d,n[1]+r[1]*d],...t.slice(u+1)]:[n,[n[0]+r[0]*B,n[1]+r[1]*B],...H(t,n,r)]},ie=(e,t,n)=>{if(!e||!t.length)return null;let r=t.find(t=>i.closestPointOnPolygon(e,t)[1]>=z*1.2)||t[t.length-1],a=e.reduce((e,t)=>e+t[0],0)/e.length,o=e.reduce((e,t)=>e+t[1],0)/e.length,s=null;return e.forEach((t,c)=>{let l=e[(c+1)%e.length],u=Math.hypot(l[0]-t[0],l[1]-t[1]);if(u<1e-6)return;let p=(l[0]-t[0])/u,m=(l[1]-t[1])/u,h=(t[0]+l[0])/2,g=(t[1]+l[1])/2,_=[-m,p];(h-a)*_[0]+(g-o)*_[1]<0&&(_=[m,-p]);let v=Math.min(u/2,.5*i.scale),y=Math.max(v,Math.min(u-v,(r[0]-t[0])*p+(r[1]-t[1])*m)),b=[t[0]+p*y,t[1]+m*y],x=(r[0]-h)*_[0]+(r[1]-g)*_[1]>0,S=[1,1.5].every(e=>{let t=C(b[0]+_[0]*e*i.scale,b[1]+_[1]*e*i.scale);return t>=0&&t<d&&f[n][t]}),w=Math.hypot(r[0]-b[0],r[1]-b[1])+(x?0:1e6)+(S?0:1e7);(!s||w<s.d)&&(s={d:w,m:[b,_]})}),s&&s.m};w.forEach((e,t)=>{if(e.kind!==`lift`||!e.lp)return;let n=w[t-1],r=w[t+1];n&&n.cells&&(e.mA=ie(e.lp,n.cells.slice().reverse().map(S),e.from)),r&&r.cells&&(e.mB=ie(e.lp,r.cells.map(S),e.to))}),w.forEach((n,r)=>{if(n.kind===`walk`){let a=n.cells.map(S),o=a.reduce((e,t,n)=>n?e+Math.hypot(t[0]-a[n-1][0],t[1]-a[n-1][1]):0,0);B=Math.min(z,Math.max(.75*i.scale,o/3)),V=n.levelIndex;let s=w[r-1],c=w[r+1],l=n===L[0]?{item:F,key:`d:`+e}:s&&s.mB?{m:s.mB}:null,u=n===L[L.length-1]?{item:I,key:`d:`+t}:c&&c.mA?{m:c.mA}:null,d=e=>e?e.key||`m:`+e.m[0][0].toFixed(2)+`,`+e.m[0][1].toFixed(2):``,f=(e,t)=>e.item?[ne(e.item,t),1]:[re(e.m,t),2],p=(e,t,r)=>{let i=[],a=[];if(t){let[n,r]=f(t,e);e=n,i=e.splice(0,r)}if(r){let[t,n]=f(r,e.slice().reverse());e=t.reverse(),a=e.splice(-n)}return P(n.levelIndex,[...i,...N(n.levelIndex,e),...a],1.5)},m=d(l)>d(u)?p(a.slice().reverse(),u,l).reverse():p(a,l,u);n.uv=i.resample(m,.25),n.R=i.measurePolyline(n.uv),n.cum=n.R.cum,n.lenU=n.R.L,n.len=n.lenU}else n.A=n.mA?n.mA[0]:S(n.a),n.B=n.mB?n.mB[0]:S(n.b),n.len=5});let ae=0;w.forEach(e=>{e.s0=ae,ae+=e.len});let oe=i.levelNames,se=a.levelShortNames,U=this._byId[t].item.store.name,ce=[],le=[],ue=0,de=0,fe=0;w.forEach((e,t)=>{if(e.kind===`walk`){let n=Math.round(e.lenU/a.scale);if(ue+=n,n<4&&t>0&&t<w.length-1)return;let r=w[t+1],o=r?`walk_to_`+(r.kind===`lift`?`lift`:r.kind===`stairs`?`stairs`:`escalator`):`walk_to`;ce.push({tag:se[e.levelIndex],levelIndex:e.levelIndex,walkKey:o,metres:n,place:U,text:i.walkText(o,n,U)});return}e.kind===`lift`?fe++:de++;let n=e.to>e.from,r=ce[ce.length-1];if(r&&r.conn&&r.kind===e.kind&&r.up===n)r.to=e.to,r.badge.go=e.to;else{let t={levelIndex:e.from,p:e.A,go:e.to,kind:e.kind,up:n};le.push(t),ce.push({conn:!0,kind:e.kind,up:n,to:e.to,badge:t})}}),ce.forEach(e=>{if(!e.conn)return;let t=e.kind===`lift`?`lift`:e.kind===`stairs`?`stairs`:`escalator`,n=i.t(t+(e.up?`_up`:`_down`),{level:oe[e.to]});e.text=n,e.tag=i.t(`tag_`+t),e.levelIndex=e.to,e.badge.text=n});let pe=L[0],me=L[L.length-1];return{segs:w,total:ae,dur:Math.max(900,Math.min(2400,ae*28)),steps:ce,badges:le,A:{p:pe.uv[0],levelIndex:pe.levelIndex},B:{p:me.uv[me.uv.length-1],levelIndex:me.levelIndex},m:ue,min:Math.max(1,Math.round((ue/1.2+de*25+fe*45)/60)),via:fe&&de?i.t(`via_both`):fe?i.t(`via_lift`):de?i.t(`via_escalator`):``,stepFree:w.every(e=>e.kind===`walk`||e.stepFree)}}closePopups(e,t){clearTimeout(this._popupSwapTimer),this._liftPx=0,this.setState(Object.assign({popupOpen:!1,selected:null,scenerySelected:null},e||{}),t)}frontAzimuth(e){let t=this._byId&&this._byId[e],n=t&&t.item.ops,r=this.camGoal;if(!r||!t)return null;let i=e=>e+2*Math.PI*Math.round((r.azimuth-e)/(2*Math.PI)),a=t.item.faceDir;if((!n||!n.length)&&a)return i(Math.atan2(a[0],a[1]));if(!n||!n.length)return null;let o=0,s=0,c=0;return n.forEach(e=>{if(!e.n)return;let t=Math.hypot(e[1][0]-e[0][0],e[1][1]-e[0][1]);o+=e.n[0]*t,s+=e.n[1]*t,c+=t}),!c||Math.hypot(o,s)<.3*c?null:i(Math.atan2(o,s))}pick(e){if(this._drift&&this._drift.polar!=null&&this.camGoal&&(this.camGoal.polar=this._drift.polar),this._drift=null,this.camView&&!this._reducedMotion&&(this._flight={t0:performance.now(),dur:800,a:Object.assign({},this.camView)}),typeof e==`string`&&this._features&&this._features.has(e)){let t=this._features.get(e);if(t.pick&&t.pick()===!0)return;if(this.state.scenerySelected===e)return this.closePopups();let n=t.focus?t.focus():t.anchor?t.anchor():null;if(n&&this.camGoal){let e=this.home(!1);Object.assign(this.camGoal,{targetX:n[0],targetY:n[1],targetZ:n[2],distance:Math.min(this.state.all?e.distance:this.camGoal.distance,e.distance/1.9)})}return this.swapPopup({scenerySelected:e,popupOpen:!1,selected:null,hovered:null})}let t=this.state,n=this.groupParts(e);n.length>1&&(e=this.groupRep(e));let r=this._byId[e];if(!r||(this._pickHandlers||[]).some(t=>{try{return t.fn(e)===!0}catch(e){return console.error(e),!1}}))return;if(!t.all&&t.selected===e&&t.popupOpen)return this.closePopups();let i=this.home(!1),a=n.length>1?n.flatMap(e=>(this._byId[e]||{}).item?this._byId[e].item.poly:[]):null,o=a&&[Math.min(...a.map(e=>e[0])),Math.max(...a.map(e=>e[0])),Math.min(...a.map(e=>e[1])),Math.max(...a.map(e=>e[1]))];if(Object.assign(this.camGoal,{targetX:o?(o[0]+o[1])/2:r.item.cx,targetY:r.item.top,targetZ:o?(o[2]+o[3])/2:r.item.cz,distance:this.fitDist(a||r.item.poly,i)}),this._focusBase={x:this.camGoal.targetX,z:this.camGoal.targetZ,dx:0,dz:0},t.all&&(this.camGoal.polar=i.polar),this.opt(`focusFront`,!1)||this._faceFront){let t=this.frontAzimuth(e);t!=null&&(this.camGoal.azimuth=t)}let s=t.popupOpen&&!t.all&&this._liftPx;this._liftPx=0,s&&this.liftFocus(s),this.swapPopup({all:!1,level:r.levelIndex,selected:e,popId:e,popupOpen:!0})}swapPopup(e){clearTimeout(this._popupSwapTimer);let t=this.state;if(!(t.popupOpen&&!t.all||t.scenerySelected!=null)||this._reducedMotion)return this.setState(e);this.setState({popupOpen:!1,scenerySelected:null}),this._popupSwapTimer=setTimeout(()=>this.setState(e),180)}componentDidMount(){this._reducedMotion=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,this._langObserver=new MutationObserver(()=>{this._langUser=null,this.applyLanguage()}),this._langObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`lang`]}),this.baseCss(`core`,a.CORE_CSS),this._scheme=this.resolvedScheme(),this.applySchemeAttrs(),window.matchMedia&&!this._schemeQuery&&(this._schemeQuery=window.matchMedia(`(prefers-color-scheme: dark)`),this._schemeListener=()=>{this.schemeSetting()===`auto`&&this.resolvedScheme()!==this._scheme&&this.setScheme(`auto`).catch(e=>console.warn(e))},this._schemeQuery.addEventListener&&this._schemeQuery.addEventListener(`change`,this._schemeListener)),this.baseCss(`keyframes`,`@keyframes mpSpin{to{transform:rotate(360deg)}}@keyframes mpPop{from{opacity:0;transform:scale(0.6)}to{opacity:1;transform:none}}@keyframes mpDirIn{from{opacity:0;transform:translateY(-6px) scale(0.98)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){@keyframes mpDirIn{from{opacity:1}to{opacity:1}}@keyframes mpPop{from{opacity:1}to{opacity:1}}}`),this._visible=!0,this._pointers=new Map,this._mq=window.matchMedia(`(pointer: coarse)`),this._mqf=()=>this.setState({coarse:this._mq.matches}),this._mqf(),this._mq.addEventListener&&this._mq.addEventListener(`change`,this._mqf),this._preventGesture=e=>e.preventDefault();let e=this._viewport;e&&(this._wheelHandler=e=>{if(this.wheelHook&&this.wheelHook(e)||!this.camGoal)return;if(this.wheelPasses(e)){this.wheelMode()===`modifier`&&Math.abs(e.deltaY)>Math.abs(e.deltaX)&&this.showWheelHint();return}e.preventDefault();let t=e.deltaY*(e.deltaMode===1?33:e.deltaMode===2?400:1);e.ctrlKey&&!e.metaKey&&e.deltaMode===0&&Math.abs(t)<25&&(t*=5),t=Math.max(-100,Math.min(100,t)),this.zoomAt(e.clientX,e.clientY,Math.exp(t*.0018))},e.addEventListener(`wheel`,this._wheelHandler,{passive:!1}),e.addEventListener(`gesturestart`,this._preventGesture),window.IntersectionObserver&&(this._intersectionObserver=new IntersectionObserver(e=>{this._visible=e.some(e=>e.isIntersecting)}),this._intersectionObserver.observe(e)),this.boot())}twoPointers(){let[e,t]=[...this._pointers.values()];return{d:Math.hypot(t.x-e.x,t.y-e.y),a:Math.atan2(t.y-e.y,t.x-e.x),mx:(e.x+t.x)/2,my:(e.y+t.y)/2}}panPixels(e,t){let n=this.camView,r=a,i=n.distance*2*r.FOV_TAN/this._height,o=n.azimuth,s=Math.cos(o),c=-Math.sin(o),l=-Math.sin(o),u=-Math.cos(o),d=1/Math.max(.45,Math.cos(n.polar)),f=-s*e*i+l*t*i*d,p=-c*e*i+u*t*i*d;return this.panBy(f,p),[f,p]}panBy(e,t){let n=this.camGoal,r=this.camView,[i,a,o,s]=this.panLimit(),c=!!this._drag,l=Math.max(4,n.distance*.12),u=(e,t,n,r)=>{let i=e+t;if(i>=n&&i<=r)return i;let a=i>r?1:-1,o=a>0?r:n;if(a*t<=0)return i;if(!c)return a*(e-o)>0?e:o;let s=a>0?Math.max(e,r):Math.min(e,n),u=Math.min(l,a*(s-o)),d=a*(i-s);return o+a*l*(1-(1-u/l)*Math.exp(-d/l))};n.targetX=u(n.targetX,e,i,a),n.targetZ=u(n.targetZ,t,o,s),r.targetX=u(r.targetX,e,i,a),r.targetZ=u(r.targetZ,t,o,s)}panLimit(){let e=a.bounds;return[e[0]-5,e[1]+5,e[2]-5,e[3]+6]}zoomAt(e,t,n){this._flight=null,this._drift=null;let r=this.camGoal,i=r.distance,a=Math.max(this.minDist(),Math.min(this.maxDist(),i*n));if(r.distance=a,!this.renderer||!this._viewport)return;let o=this.THREE,s=this._viewport.getBoundingClientRect(),c=new o.Vector2((e-s.left)/s.width*2-1,-((t-s.top)/s.height)*2+1);this._raycaster.setFromCamera(c,this.camera);let l=new o.Vector3;if(!this._raycaster.ray.intersectPlane(new o.Plane(new o.Vector3(0,1,0),-r.targetY),l))return;let u=l.x-r.targetX,d=l.z-r.targetZ,f=Math.hypot(u,d),p=i*.6;f>p&&(u*=p/f,d*=p/f);let m=1-a/i,h=(e,t,n)=>Math.max(t,Math.min(n,e)),[g,_,v,y]=this.panLimit();r.targetX=h(r.targetX+u*m,g,_),r.targetZ=h(r.targetZ+d*m,v,y)}componentDidUpdate(e){let t=this.state,n=this._prevSnapshot||{};this._prevSnapshot={selected:t.selected,hovered:t.hovered,level:t.level,all:t.all,optionOverrides:t.optionOverrides,ready:t.ready},e||={},(e.shadows!==this.props.shadows||e.cars!==this.props.cars||n.optionOverrides!==t.optionOverrides)&&this.applyProps();let r=+!!t.coarse+(t.narrow?2:0);t.ready&&r!==this._lastLayout&&(this._lastLayout=r,this.emit(`layout`,this.env()));let i=this.selectedId();this._lastSelectKey!==i&&(this._lastSelectKey=i,this.emit(`select`,this.featureInfo(i))),n.hovered!==t.hovered&&this.emit(`hover`,t.hovered),(n.level!==t.level||n.all!==t.all)&&this.emit(`level`,{level:t.level,allLevels:t.all}),t.ready&&!n.ready&&(this._pluginsAtLoad=JSON.stringify((a.raw||{}).plugins||null),this.applyEdits(),this.applyCss(),this.bootPlugins(),this.syncBuiltins(),this.emit(`ready`,this.getState()))}static HOOKS=[`extraViews`,`notify`,`wheelHook`,`tapHook`,`aiTools`,`renderVals`,`componentWillUnmount`,`setState`,`state`,`forceUpdate`,`props`];get core(){if(this._core)return this._core;let e=this;return this._core=Object.freeze({get renderer(){return e.renderer},get width(){return e._width},get height(){return e._height},get dead(){return!!e._destroyed},get reducedMotion(){return!!e._reducedMotion},get slot(){return e._slot},get options(){return e.opts},get shapesEdited(){return!!e._shapesEd},set shapesEdited(t){e._shapesEd=!!t},camera:Object.freeze({get goal(){return e.camGoal},set goal(t){e.camGoal=t},get view(){return e.camView},set view(t){e.camView=t},home:t=>e.goHome(t),homeNow:t=>{let n=e.home(t);e._flight=e._inertia=null,e.camGoal&&Object.assign(e.camGoal,n),e.camView&&Object.assign(e.camView,n)},stopInertia:()=>{e._inertia=null}}),layout:Object.freeze({get levels(){return e.levelViews},gap:()=>e.levelGapPx(),spacing:()=>e.levelSpacing(),levelGoal:(...t)=>e.levelGoal(...t)}),pointer:Object.freeze({get viewport(){return e._viewport},ground:(t,n,r)=>{if(!e.renderer||!e._viewport||!e.camera)return null;let i=e.THREE,a=e._viewport.getBoundingClientRect(),o=new i.Vector2((t-a.left)/a.width*2-1,-((n-a.top)/a.height)*2+1),s=new i.Vector3;return e._raycaster.setFromCamera(o,e.camera),e._raycaster.ray.intersectPlane(new i.Plane(new i.Vector3(0,1,0),-r),s)?[s.x,s.z]:null},project:(t,n,r)=>{if(!e.camera)return{x:0,y:0,visible:!1};let i=new e.THREE.Vector3(t,n,r).project(e.camera);return{x:(i.x+1)/2*e._width,y:(1-i.y)/2*e._height,visible:e.ndcVisible(i)}}}),scene:Object.freeze({rebuild:()=>e.rebuildScene()}),data:Object.freeze({get units(){return e._units},get byId(){return e._byId},get unitById(){return e._unitById},get storeList(){return e._stores},get amenityList(){return e._amenityList},get tints(){return e._tints},set tints(t){e._tints=t},applyStore:(t,n)=>e.applyStore(t,n),resetNav:()=>{e._navGrid=null},resetTallUnits:()=>{e._tallUnits=null}}),plugins:Object.freeze({get registry(){return e._plugReg},set registry(t){e._plugReg=t},get active(){return e._plugins},config:()=>e._pluginConfig(),changed:t=>e._plugChanged(t),builtin:t=>e.builtin(t),install:t=>e.install(t),uninstall:t=>e.uninstall(t),save:()=>e.savePlugins(),sync:(t,n)=>e.syncPlugins(t,n)}),controls:()=>e.ui(),closePopups:(t,n)=>e.closePopups(t,n),render:(t,n)=>e.view(t,n)})}notify(e){this.emit(`message`,String(e))}static PUBLIC=`languages.language.setLanguage.translatable.langCoverage.setTranslations.removeLanguage.applyLanguage.on.off.emit.whenReady.getState.levels.levelOf.stores.amenities.find.findAll.match.feature.features.select.deselect.setLevel.showAll.wayfindingApi.showRoute.hideRoute.routeInfo.setCamera.focusFeature.setDisplay.updateStore.setLogo.logoOf.tint.mergeUnits.splitUnit.reset.css.setCss.exportMap.saveMap.discardSaved.downloadMap.snapshot.applyEdits.plugins.setPlugin.findPlugin.installCustom.toggleCustom.removeCustom.mount.destroy.setOptions.core.notify`.split(`.`);feature(e){return this.featureInfo(e)}features(e){return[...(this._features||new Map).entries()].filter(([,t])=>!e||t.kind===e).map(([e])=>this.featureInfo(e)).filter(Boolean)}on(e,t){let n={ev:e,fn:t};return(this._handlers=this._handlers||[]).push(n),()=>{this._handlers=this._handlers.filter(e=>e!==n)}}off(e,t){this._handlers=(this._handlers||[]).filter(n=>n.ev!==e||!!t&&n.fn!==t)}whenReady(){return this.state.ready?Promise.resolve(this):new Promise(e=>{let t=this.on(`ready`,()=>{t(),e(this)})})}getState(){let e=this._pendingState||this.state;return{ready:!!e.ready,level:e.level,allLevels:e.all,selected:e.popupOpen&&e.selected?e.selected:e.scenerySelected||null,hovered:e.hovered,editing:!!this._uiHidden,...this.wayfindingState()}}wayfindingState(){let e=this.wayfindingApi(),t=e&&e.state?e.state():{};return{routeShown:!!t.routeShown,routeFrom:t.from||null,routeTo:t.to||null,routeAccessible:!!t.accessible,wayfindingOpen:!!t.open}}i18n(){let e=a.raw;return e&&e.i18n||null}langName(e){let t=(this.i18n()||{}).languages||{};if(t[e]&&t[e].name)return t[e].name;if(e===(this.i18n()||{}).source&&this.i18n().source_name)return this.i18n().source_name;try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e);return t?t[0].toUpperCase()+t.slice(1):e}catch{return e}}languages(){let e=this.i18n();if(!e)return[];let t=e.source||`en`;return[t].concat(Object.keys(e.languages||{}).filter(e=>e!==t)).map(e=>({code:e,name:this.langName(e),source:e===t}))}language(){let e=this.i18n();return a.currentLanguage||e&&e.source||`en`}pickLanguage(){let e=this.i18n(),t=e&&e.languages||{},n=e&&e.source||`en`;if(!e||!this.pluginOn(`localization`))return null;let r=e=>String(e).split(`-`)[0].toLowerCase(),i=e=>e?(e=String(e),e===n||t[e]?e:r(e)===r(n)?n:Object.keys(t).find(t=>r(t)===r(e))||null):null,a=i(this._langUser)||i(this.props.language);return!a&&this.pluginSetting(`localization`,`page`)!==!1&&(a=i(document.documentElement.lang)),a=a||i(this.pluginSetting(`localization`,`language`))||n,a===n?null:a}async setLanguage(e){let t=this.languages();if(e=e?String(e):null,e&&!t.some(t=>t.code===e))throw Error(`No language `+e+(t.length?`. Languages: `+t.map(e=>e.code).join(`, `):``));return this._langUser=e,await this.applyLanguage(),this.language()}async applyLanguage(e){let t=a,n=this.pickLanguage();if(!e&&n===t.currentLanguage||(t.currentLanguage=n,t.localize(),this._viewport&&(this._viewport.lang=this.language()),!this.renderer))return;let r=((t.raw||{}).edits||{}).units||{};(this._units||[]).forEach(e=>{let n=e.id&&this._byId[e.id];if(!n||!e.r)return;let i=r[e.r.featureId];n.item.store.name=i&&i.name!=null?i.name:t.unitName(e.r)});let i=this.wayfindingState(),o=Object.values(this._builtinPlugins||{}).filter(e=>e.active&&![`scenery`,`localization`,`attract`].includes(e.id));o.forEach(e=>this.uninstall(e));for(let e of o)try{await this.install(e)}catch(t){console.error(`Plugin `+e.name,t)}let s=this.wayfindingApi();s&&s.restore&&(i.wayfindingOpen||i.routeAccessible)&&s.restore({open:i.wayfindingOpen,from:i.routeFrom,to:i.routeTo,accessible:i.routeAccessible}),this.emit(`language`,{language:this.language(),name:this.langName(this.language())}),this.forceUpdate()}translatable(e,t){let n=a,r=n.raw||{},i=n.source()||{},o=e&&((this.i18n()||{}).languages||{})[e],s=o&&o.strings||{},c={},l=(e,t,n)=>{let r=(s[e]||{})[t];return r!=null&&(typeof r==`string`?n===`name`:!!r[n])},u=(n,r,i)=>{let a={};Object.entries(i).forEach(([i,o])=>{o!=null&&o!==``&&(t||!e||!l(n,r,i))&&(a[i]=String(o))}),Object.keys(a).length&&((c[n]=c[n]||{})[r]=Object.keys(a).length===1&&a.name!=null&&n!==`levels`&&n!==`locations`&&n!==`markers`?a.name:a)};return Object.entries(n.UI).forEach(([n,r])=>{(t||!e||!(s.ui||{})[n])&&((c.ui=c.ui||{})[n]=r)}),(n.levelIds||[]).forEach((e,t)=>u(`levels`,e,{name:(i.levelNamesOrig||n.levelNames)[t],short:(i.levelShortNamesOrig||n.levelShortNames)[t]})),(r.categories||[]).forEach(e=>u(`categories`,e.id,{name:e.name})),Object.entries(r.amenities||{}).forEach(([e,t])=>u(`amenities`,e,{name:t.name||e})),Object.values(n.locations||{}).forEach(e=>u(`locations`,e.id,{name:e.name,description:e.description})),(n.markers||[]).forEach(e=>{let t=e._src||e;u(`markers`,e.id,{name:t.name,subtitle:t.subtitle,description:t.description,text:t.text})}),(r.holidays||[]).forEach(e=>e&&e.date&&u(`holidays`,e.date,{name:e.name})),c}langCoverage(e){let t=e=>Object.values(e).reduce((e,t)=>e+Object.values(t).reduce((e,t)=>e+(typeof t==`string`?1:Object.keys(t).length),0),0),n=t(this.translatable());return{total:n,translated:n-t(this.translatable(e))}}async setTranslations(e,t){if(t||={},e=String(e||``).trim(),!/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e))throw Error(`Language code must be BCP 47, e.g. de, fr, pt-BR, zh-Hans`);let n=a.raw;if(!n)throw Error(`Map not loaded`);let r=n.i18n=n.i18n||{};if(r.source||=t.source?String(t.source):`en`,e===r.source)throw Error(e+` is the map's own language; change the map text itself`);let i=r.languages=r.languages||{},o=i[e]=i[e]||{};t.name&&(o.name=String(t.name));let s=o.strings=o.strings||{},c=0;return Object.entries(t.strings||{}).forEach(([e,t])=>{if(!a.I18N_KINDS.includes(e)||!t||typeof t!=`object`)return;let n=s[e]=s[e]||{};Object.entries(t).forEach(([e,t])=>{if(t==null||t===``)delete n[e];else if(typeof t==`object`){let r=Object.assign({},typeof n[e]==`object`?n[e]:n[e]?{name:n[e]}:{});Object.entries(t).forEach(([e,t])=>{t==null||t===``?delete r[e]:(r[e]=String(t),c++)}),Object.keys(r).length?n[e]=r:delete n[e]}else n[e]=String(t),c++}),Object.keys(n).length||delete s[e]}),await this.applyLanguage(!0),c}async removeLanguage(e){let t=this.i18n();if(!t||!t.languages||!t.languages[e])throw Error(`No translations for `+e);delete t.languages[e],this._langUser===e&&(this._langUser=null),await this.applyLanguage(!0)}levels(){return a.levelNames.map((e,t)=>({index:t,name:e,short:a.levelShortNames[t]}))}levelOf(e){if(typeof e==`number`)return e>=0&&e<a.levelNames.length?e:null;let t=String(e).toLowerCase().trim(),n=a.levelShortNames.map(e=>String(e).toLowerCase()),r=a.levelNames.map(e=>String(e).toLowerCase()),i=t.match(/\d+/);if(t===`all`)return`all`;let o=n.indexOf(t);return o<0&&(o=r.indexOf(t)),o<0&&/^\d+$/.test(t)&&+t<r.length&&(o=+t),o<0&&(o=r.findIndex(e=>e.startsWith(t)||t.startsWith(e))),o<0&&i&&(o=n.findIndex(e=>e.replace(/\D/g,``)===i[0])),o<0?null:o}stores(){return(this._stores||[]).filter(e=>!(this._unitById[e.id]||{}).hid).map(e=>this.info(e))}amenities(){return(this._amenityList||[]).map(e=>this.info(e))}find(e){let t=null;try{t=this._resolveStore(e)}catch{}return t?this.info(t):null}match(e){e||={};let t=(this._stores||[]).filter(e=>!(this._unitById[e.id]||{}).hid),n=new Set;if(e.all&&t.forEach(e=>n.add(e)),e.category){let r=String(e.category).toLowerCase();t.filter(e=>(e.cat||``).toLowerCase()===r).forEach(e=>n.add(e))}return(e.stores||[]).forEach(e=>{let t=null;if(e&&typeof e==`object`)try{t=this._resolveStore(e)}catch{}else t=this.findStore(e);t&&n.add(t)}),[...n].map(e=>this.info(e))}_resolveStore(e){let t=e&&typeof e==`object`?e.id&&this._byId&&this._byId[e.id]?this._byId[e.id].item.store:e.id?this._onLevel(this._storesById(e.id)):null:this.findStore(e);if(!t)throw Error(`No store matches "`+(e&&e.name||e)+`"`);return t}select(e,t){let n=typeof e==`string`?e:e&&typeof e==`object`&&!e.name?e.id:null;if(n&&this._features&&this._features.has(n)&&!(this._byId&&this._byId[n]))return this.state.scenerySelected!==n&&this.pick(n),this.featureInfo(n);let r=this._resolveStore(e);t||={};let i=this.state.all?null:this.state.level;t.face&&this.state.selected===r.id&&this.state.popupOpen&&this.closePopups();let o=null;if(!(this.state.selected===r.id&&this.state.popupOpen)){this._faceFront=!!t.face;try{this.pick(r.id)}finally{this._faceFront=!1}o=this._flight}t.duration&&this._flight&&(this._flight.dur=Math.max(0,+t.duration));let s=this.camGoal;if(o&&s){let e=this._byId&&this._byId[this.groupParts(r.id).length>1?this.groupRep(r.id):r.id],n=(o.a.distance+s.distance)/2;if(t.arc){let e=Math.hypot(s.targetX-o.a.targetX,s.targetZ-o.a.targetZ),t=Math.min(this.maxDist(),e*.75/a.FOV_TAN);o.peak=Math.max(0,t-n)}t.explode&&e&&i!=null&&e.levelIndex!==i&&this.canExplode()&&(o.explode=.55,o.dur=Math.max(o.dur,3e3),o.peak=Math.max(o.peak||0,Math.min(this.maxDist(),this.home(!0).distance*.75)-n))}return this.info(r)}drift(e,t,n){let r=(+e||0)*Math.PI/180,i=(+n||0)*Math.PI/180;return this._drift=(r||i)&&!this._reducedMotion&&this.camGoal&&!this.is2d()?{turn:-r,tilt:i,dur:Math.max(1,+t||8)*1e3,t0:null}:null,!!this._drift}static APPROACH_POLAR=.12;approach(e){let t=e||{},n=(e,t,n,r)=>e!=null&&e!==``&&Number.isFinite(+e)?Math.min(r,Math.max(n,+e)):t;return e===!1||this._reducedMotion||!this.camGoal?(this._approach=null,!1):(this._approach={dur:n(t.seconds,1.6,.3,6)*1e3,height:n(t.height,5,1.2,20),turn:n(t.turn,0,-360,360)*Math.PI/180},!0)}approaching(){return!!this._approach||!!(this._flight&&this._flight.approach)}drifting(){let e=this._drift;return!!e&&(e.t0==null||performance.now()-e.t0<e.dur)}deselect(){this.closePopups()}setLevel(e){let t=this.levelOf(e);if(t===null)throw Error(`Unknown level `+e);if(t===`all`)return this.canExplode()?(this.closePopups({all:!0}),this.camGoal&&this.goHome(!0),`all`):this.state.level;let n=this.state.all;return this.closePopups({all:!1,level:t}),n&&this.camGoal&&this.goHome(!1),t}showAll(){return this.setLevel(`all`)}explodeOn(){return(r.levelNames||[]).length>1&&this.pluginSetting(`appearance`,`exploded_view`)!==!1}canExplode(){return this.explodeOn()&&!this.is2d()}deeplinkApi(){let e=this._builtinPlugins&&this._builtinPlugins.deeplink;return e&&e.active&&e.exports||null}wayfindingApi(){let e=this._builtinPlugins&&this._builtinPlugins.wayfinding;return e&&e.active&&e.exports||null}async showRoute(e,t){let n=this.wayfindingApi();if(!n)throw Error(`Wayfinding is off`);return n.show(e,t)}hideRoute(){let e=this.wayfindingApi();e&&e.hide()}routeInfo(){let e=this.wayfindingApi();return e?e.info():null}static distanceText(e,t){return t===`imperial`?a.t(`feet`,{n:Math.round(e*3.28084)}):a.t(`metres`,{n:e})}static walkText(e,t,n,r){let i=r===`imperial`?Math.round(t*3.28084):t;return a.t(e,{n:i,distance:a.distanceText(t,r),place:n})}routeData(e,t,n){let r=n&&n.units===`imperial`?`imperial`:`metric`,i=!!(n&&n.accessible)&&this.route(e,t,{stepFree:!0})||this.route(e,t);return i?{from:e,to:t,minutes:i.min,metres:i.m,via:i.via,stepFree:i.stepFree,start:{level:i.A.levelIndex,at:i.A.p},end:{level:i.B.levelIndex,at:i.B.p},distance:a.distanceText(i.m,r),steps:i.steps.map(e=>({tag:e.tag,text:e.walkKey?a.walkText(e.walkKey,e.metres,e.place,r):e.text,level:e.levelIndex})),badges:i.badges.map(e=>({level:e.levelIndex,at:e.p,goTo:e.go,text:e.text,up:!!e.up,kind:e.kind,levelName:a.levelNames[e.go]})),legs:i.segs.map(e=>e.kind===`walk`?{kind:`walk`,level:e.levelIndex,points:e.uv,length:e.lenU}:{kind:e.kind,from:e.from,to:e.to,a:e.A,b:e.B,connector:e.cid==null?null:`esc-`+e.cid})}:null}fitView(e,t,n){n||={};let r=this.state.all;if(this.closePopups({all:!1,level:e}),!this.camGoal)return;if(!t||t.length<2){r&&this.goHome(!1);return}let i=a,o=this.THREE,s=this.camGoal,c=this.is2d(),l=this.home(!1),u=Math.min(1,Math.max(.2,n.fill||.8));if(n.rotation!=null&&!c){let e=-n.rotation*Math.PI/180,t=Math.atan2(Math.sin(e-s.azimuth),Math.cos(e-s.azimuth));Math.abs(t)*180/Math.PI>(n.minTurn||0)&&(s.azimuth+=t)}let d=t.map(e=>e[0]),f=t.map(e=>e[1]),p=(Math.min(...d)+Math.max(...d))/2,m=(Math.min(...f)+Math.max(...f))/2,h=t.concat([[p-6,m-6],[p+6,m+6]]),g={targetX:p,targetY:i.FLOOR_TOP,targetZ:m,azimuth:s.azimuth,polar:c?s.polar:l.polar,distance:s.distance||l.distance},_=Math.max(1,this._width||1),v=Math.max(1,this._height||1),y=!this._uiHidden&&this._insets||{},b=Math.max(.2,(_-(y.left||0)-(y.right||0))/_),x=Math.max(.2,(v-(y.top||0)-(y.bottom||0))/v),S=this.minDist(),C=this.maxDist();if(o){let e=new o.PerspectiveCamera(30,_/v,.5,1e6),t=new o.Vector3,n=new o.Vector3,r=new o.Vector3;for(let a=0;a<8;a++){this.aimCamera(e,g);let a=1/0,o=-1/0,s=1/0,c=-1/0;h.forEach(n=>{t.set(n[0],i.FLOOR_TOP,n[1]).project(e),a=Math.min(a,t.x),o=Math.max(o,t.x),s=Math.min(s,t.y),c=Math.max(c,t.y)});let l=g.distance*i.FOV_TAN,d=_/v*l;n.setFromMatrixColumn(e.matrixWorld,0),r.setFromMatrixColumn(e.matrixWorld,1);let f=(a+o)/2*d,p=(s+c)/2*l,m=Math.max(.05,r.x*r.x+r.z*r.z);g.targetX+=n.x*f+r.x*p/m,g.targetZ+=n.z*f+r.z*p/m;let y=Math.max((o-a)/2/(u*b),(c-s)/2/(u*x));g.distance=Math.max(S,Math.min(C,g.distance*y))}}else g.distance=Math.max(S,Math.min(C,Math.max(...d.map(e=>Math.abs(e-p)),...f.map(e=>Math.abs(e-m)))*2/i.FOV_TAN));Object.assign(s,{targetX:g.targetX,targetZ:g.targetZ,targetY:i.FLOOR_TOP,polar:g.polar,distance:g.distance})}liftFocus(e){let t=this.camGoal,n=this._focusBase;if(!t||!n||Math.abs(t.targetX-(n.x+n.dx))>1e-6||Math.abs(t.targetZ-(n.z+n.dz))>1e-6)return 0;e=Math.max(0,+e||0);let r=Math.max(1,this._height||1),i=2*t.distance*a.FOV_TAN/r,o=e*i/Math.max(.2,Math.cos(t.polar));n.dx=-Math.sin(t.azimuth)*o,n.dz=-Math.cos(t.azimuth)*o;let s=this._flight,c=this.camView;if(s&&c){let e=Math.min(1,(performance.now()-s.t0)/s.dur),t=e<.5?4*e*e*e:1-(-2*e+2)**3/2;t<.98&&(s.a.targetX=(c.targetX-(n.x+n.dx)*t)/(1-t),s.a.targetZ=(c.targetZ-(n.z+n.dz)*t)/(1-t))}return t.targetX=n.x+n.dx,t.targetZ=n.z+n.dz,this._liftPx=e,e}setCamera(e){let t=this.camGoal;if(!t)throw Error(`Map not ready`);if(e||={},[`mode`,`reset`,`resetRotation`,`resetTilt`,`rotateBy`,`tilt`,`zoom`].some(t=>e[t]!=null&&e[t]!==!1)&&(this._drift=null),e.mode===`2d`&&!this.is2d())this._savedPitch3d=t.polar,this._savedAzimuth3d=t.azimuth,this._mode2d=!0,this.state.all&&this.setLevel(this.state.level);else if(e.mode===`3d`&&this.is2d()){this._mode2d=!1;let e=this.home(this.state.all);t.polar=this._savedPitch3d??e.polar;let n=this._savedAzimuth3d??e.azimuth;t.azimuth=n+2*Math.PI*Math.round((t.azimuth-n)/(2*Math.PI))}if(e.reset&&this.goHome(this.state.all),e.resetRotation){let e=this.home(this.state.all);this._inertia=null,t.azimuth=e.azimuth+2*Math.PI*Math.round((t.azimuth-e.azimuth)/(2*Math.PI)),t.polar=e.polar}if([`mode`,`reset`,`resetRotation`,`tilt`].some(t=>e[t]!=null&&e[t]!==!1)&&(this._tiltEase=null),e.resetTilt&&!this.is2d()){let e=this.home(this.state.all).polar;this._tiltEase=this._reducedMotion?null:{t0:performance.now(),from:this.camView.polar,to:e},t.polar=e}return e.rotateBy&&(t.azimuth-=e.rotateBy*Math.PI/180),e.tilt!=null&&(t.polar=Math.max(.12,Math.min(1.38,e.tilt*Math.PI/180))),e.zoom>0&&(this._flight=null,t.distance=Math.max(this.minDist(),Math.min(this.maxDist(),t.distance/e.zoom))),{mode:this.is2d()?`2d`:`3d`,rotation:Math.round(-t.azimuth*180/Math.PI),tilt:Math.round(t.polar*180/Math.PI),distance:t.distance}}async focusFeature(e,t,n){let r=t==null?this.state.all?0:this.state.level:this.levelOf(t),i=r===null||r===`all`?0:r,o=Math.max(0,n|0),s=e=>new Promise(t=>this.closePopups({all:!1,level:e},t)),c=e=>[...(this._features||new Map).entries()].filter(([,t])=>[].concat(e).includes(t.kind));if(e===`elevator`){let t=c(`elevator`);if(!t.length)throw Error(`No elevators`);let n=Math.min(o,t.length-1);return await s(i),t[n][1].at&&t[n][1].at(i),this.pick(t[n][0]),{type:e,level:i,index:n}}if(e===`bus_stop`){let t=[...(this._features||new Map).entries()].filter(([,e])=>e.kind===`bus_stop`).map(([e])=>({id:e}));if(!t.length)throw Error(`No bus stops`);let n=Math.min(o,t.length-1);return await s(0),this.pick(t[n].id),{type:e,level:0,index:n}}if(e!==`escalator`)throw Error(`Unknown feature `+e);let l=c([`escalator`,`stairs`]).map(e=>e[1]).filter(e=>e.meshes&&e.lo===Math.min(i,1));if(!l.length)throw Error(`No escalators`);await s(i);let u=this.home(!1);return Object.assign(this.camGoal,{targetX:l.reduce((e,t)=>e+t.x,0)/l.length,targetZ:l.reduce((e,t)=>e+t.z,0)/l.length,targetY:a.FLOOR_TOP,distance:u.distance/1.9}),{type:e,level:i,index:0}}setDisplay(e){let t={};[`labels`,`shadows`,`cars`,`motion`].forEach(n=>{typeof e[n]==`boolean`&&(t[n]=e[n])}),e.spacing!=null&&(t.spacing=Math.max(0,Math.min(100,+e.spacing))),e.gap!=null&&(t.gap=Math.max(90,Math.min(220,+e.gap)));let n={},r={};return Object.entries(t).forEach(([e,t])=>{let i=!1;a.BUILTINS.forEach(r=>Object.entries(r.settings||{}).forEach(([a,o])=>{o.opt===e&&((n[r.id]=n[r.id]||{})[a]=t,i=!0)})),i||(r[e]=t)}),Object.entries(n).forEach(([e,t])=>this.setPlugin(e,{settings:t}).catch(e=>console.warn(e))),Object.keys(r).length&&this.setState(e=>({optionOverrides:Object.assign({},e.optionOverrides,r)})),t}updateStore(e,t){let n=this._resolveStore(e),r=this._unitById[n.id],i={};return t||={},t.name&&(i.name=String(t.name).trim().slice(0,40)),t.category&&(i.cat=t.category),t.hours&&(i.hours=t.hours),t.height!=null&&(i.heightScale=Math.max(.3,Math.min(4,+t.height||1))),t.labelScale!=null&&(i.labelScale=Math.max(.3,Math.min(3,+t.labelScale||1))),t.labelRotation!=null&&(i.labelRotation=(Math.round(+t.labelRotation||0)%360+360)%360),t.labelOffset!==void 0&&(i.labelOffset=a.labelOffsetOf(t.labelOffset)),t.label!=null&&(i.label=!!t.label),i.name&&i.name!==n.name&&r&&(r.logo||`orig`)===`orig`&&r.logoSvgOrig&&(i.logo=`none`),this.applyStore(n.id,i),this.forceUpdate(),this.info(n)}async setLogo(e,t){let n=this._resolveStore(e);if(t!==`none`&&t!==`orig`){/^\s*(\x60\x60\x60|<)/.test(t)&&(t=this.normSvg(t));try{await this.loadImg(t)}catch{throw Error(`That image could not be loaded`)}}return this.applyStore(n.id,{logo:t}),this.info(n)}logoOf(e){let t=this._resolveStore(e),n=this._unitById[t.id];return n?(n.logo&&n.logo!==`orig`&&n.logo!==`none`?n.logo:null)||(n.logoSvgOrig?this.normSvg(n.logoSvgOrig):null):null}css(){return String(((a.raw||{}).theme||{}).css||``)}setCss(e){let t=a.raw;if(!t)throw Error(`Map not loaded`);return e=String(e||``).trim(),t.theme=Object.assign({},t.theme),e?t.theme.css=e:delete t.theme.css,this.applyCss(),e}appearanceOwn(e){let t=this._pluginConfig().builtin.appearance;return(t&&t.settings?t.settings[e]:void 0)??void 0}schemeSetting(){return this.props.scheme||this.appearanceOwn(`scheme`)||`light`}resolvedScheme(){let e=this.schemeSetting();return e===`auto`?window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e===`dark`?`dark`:`light`}scheme(){return this._scheme||this.resolvedScheme()}accent(){let e=(a.raw||{}).theme||{},t=this.props.accent||e.accent;return r.hexRgb(t)?String(t).trim():r.ACCENT_DEFAULT}selectedStyle(){return(this.props.selected||this.appearanceOwn(`selected`))===`accent`?`accent`:`neutral`}lightCards(){let e=this.props,t=this.appearanceOwn(`light_cards`),n=e=>e===`dark`||e===`white`;return n(e.lightCards)?e.lightCards:n(t)?t:`dark`}lightTooltips(){let e=this.props,t=this.appearanceOwn(`light_tooltips`),n=e=>e===`dark`||e===`white`;return n(e.lightTooltips)?e.lightTooltips:n(t)?t:this.lightCards()}uiRadius(){let e=this.props.uiRadius,t=this.appearanceOwn(`ui_radius`),n=Number.isFinite(+e)&&e!==null&&e!==``?+e:Number.isFinite(+t)&&t!==null&&t!==``?+t:4;return Math.max(0,Math.min(8,Math.round(n)))}hidePluginPanels(e){this._uiHidden=!!e,this._viewport&&this._viewport.querySelectorAll(`:scope > [data-mp-top]:not([data-mp-edit])`).forEach(t=>t.style.visibility=e?`hidden`:``),this._layoutDocks&&this._layoutDocks(),this._slots&&this._slotSchedule(),this.applyBleed(),this.emit&&this.emit(`layout`,this.env()),e&&(this._shift={x:0,y:0},this._shiftKey=null,this._fitSize&&this._fitSize())}applyUiRadius(){let e=this.uiRadius();this.el&&(this.el.style.borderRadius=e*a.UI_RADIUS_OUTER+`px`),[this._viewport,...(this._docks||[]).map(e=>e.wrap)].forEach(t=>t&&t.style.setProperty(`--mp-rk`,String(e/4)))}glassPopups(){return(this.props.glassPopups==null?this.appearanceOwn(`glass_popups`):this.props.glassPopups)===!0}glassControls(){return(this.props.glassControls==null?this.appearanceOwn(`glass_controls`):this.props.glassControls)===!0}applyContainer(){let e=this._viewport;if(!e)return;let t=this.props._snapshot?0:+this.pluginSetting(`appearance`,`bleed`)||0,n=Math.max(0,+this.pluginSetting(`appearance`,`edge_fade`)||0),r=a.raw?this.pluginSetting(`appearance`,`background`):this.props.background;e.toggleAttribute(`data-mp-nobg`,r===!1),e.toggleAttribute(`data-mp-fade`,n>0),e.style.setProperty(`--mp-fade`,n+`px`),this._bleedSetting=t;let i=t!==0;if(i&&!this._bleedWatch){let e=!1,t=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1,this._destroyed||this.applyBleed()}))};window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,t,{passive:!0}),this._bleedWatch=()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,t)}}else!i&&this._bleedWatch&&(this._bleedWatch(),this._bleedWatch=null);this.applyBleed(),this.applyHeight()}static NARROW_HOST=640;static HEIGHT_KEYS=[`height`,`aspectRatio`,`minHeight`,`maxHeight`];static parseRatio(e){let t=/^\s*(\d+(?:\.\d+)?)\s*[:/x]\s*(\d+(?:\.\d+)?)\s*$/.exec(String(e??``));return t&&+t[1]>0&&+t[2]>0?[+t[1],+t[2]]:null}heightSpec(e){let t=e=>this.pluginSetting(`size`,e),n=this.props.frame||this.el,r=e??(n?n.clientWidth:0),i=[`container`,`screen`,`ratio`,`fixed`],o=t(`narrow_mode`),s=i.includes(o)&&r>0&&r<a.NARROW_HOST,c=s?o:t(`mode`);return{mode:i.includes(c)?c:`container`,narrow:s,screen:Math.min(100,Math.max(1,+t(s?`narrow_screen`:`screen`)||80)),offset:Math.max(0,+t(`offset`)||0),ratio:a.parseRatio(t(s?`narrow_ratio`:`ratio`))||(s?[3,4]:[16,9]),px:Math.max(1,+t(s?`narrow_px`:`px`)||600),min:Math.max(0,+t(`min`)||0),max:Math.max(0,+t(`max`)||0)}}static heightCss(e,t){let n={height:``,aspectRatio:``,minHeight:``,maxHeight:``},r=e=>t?`min(`+e+`, `+t+`)`:e;if(e.mode===`fixed`)n.height=r(e.px+`px`);else if(e.mode===`screen`){let t=e.offset?`calc(`+e.screen+`svh - `+e.offset+`px)`:e.screen+`svh`;e.max&&(t=`min(`+t+`, `+e.max+`px)`),e.min&&(t=`max(`+t+`, `+e.min+`px)`),n.height=r(t)}else e.mode===`ratio`?(n.height=`auto`,n.aspectRatio=e.ratio[0]+` / `+e.ratio[1],e.min&&(n.minHeight=r(e.min+`px`)),n.maxHeight=e.max?r(e.max+`px`):t||``):t&&(n.height=t);return n}static heightPx(e,t){let n=t=>Math.max(e.min||0,e.max?Math.min(e.max,t):t);return e.mode===`fixed`?e.px:e.mode===`screen`?Math.round(n(window.innerHeight*e.screen/100-e.offset)):e.mode===`ratio`?Math.round(n(t*e.ratio[1]/e.ratio[0])):0}applyHeight(){let e=this.el;if(!e||this.props._snapshot)return;let t=this.props.frame||null;this._hostSize||={el:Object.fromEntries(a.HEIGHT_KEYS.concat([`position`,`inset`]).map(t=>[t,e.style[t]])),frame:t?t.style.height:``};let n=this.heightSpec();this._heightCssNow=null,this._putHeight();let r=null;this._heightFallback=!1,n.mode===`container`?!t&&e.clientWidth>0&&e.clientHeight<2&&(this._heightFallback=!0,r=a.heightCss(Object.assign({},n,{mode:`screen`,screen:80,offset:0})),this._heightWarned||(this._heightWarned=!0,console.warn(`mapplic: the map's element has no height, so it shows at 80% of the screen. Give the element a height, or pick one in the Size settings.`))):r=a.heightCss(n),this._heightCssNow=r,this._putHeight(),this._heightMode=n.mode,this._heightNarrow=n.narrow,this._watchHeight(t||e),this._layoutDocks&&this._layoutDocks()}_putHeight(){let e=this.el,t=this._hostSize,n=this._heightCssNow,r=this.props.frame||null;if(e&&t&&(a.HEIGHT_KEYS.forEach(r=>e.style[r]=n?n[r]:t.el[r]),r)){if(!n&&this._belowOpen){r.style.height=t.frame;let n=r.getBoundingClientRect().height;r.style.height=`auto`,e.style.height=n+`px`,e.style.position=`relative`,e.style.inset=`auto`}else r.style.height=n?`auto`:t.frame,e.style.position=n?`relative`:t.el.position,e.style.inset=n?`auto`:t.el.inset}}_watchHeight(e){!this._heightObs&&window.ResizeObserver&&e&&(this._heightObs=new ResizeObserver(()=>{!this._destroyed&&this.el&&this.heightSpec().narrow!==this._heightNarrow&&this.applyHeight()}),this._heightObs.observe(e))}bleedSides(){let e=this._uiHidden?0:this._bleedSetting||0,t=this._viewport;if(!e||!t)return{l:0,t:0,r:0,b:0};let n=t.getBoundingClientRect(),r=0,i=0,a=window.innerWidth,o=window.innerHeight;for(let e=t.parentElement;e&&e!==document.documentElement;e=e.parentElement){let t=getComputedStyle(e),n=t.overflowX!==`visible`,s=t.overflowY!==`visible`;if(!n&&!s)continue;let c=e.getBoundingClientRect(),l=c.left+e.clientLeft,u=c.top+e.clientTop;n&&(r=Math.max(r,l),a=Math.min(a,l+e.clientWidth)),s&&(i=Math.max(i,u),o=Math.min(o,u+e.clientHeight))}let s=n.width/(t.offsetWidth||n.width||1)||1,c=t=>Math.min(e>0?e:4e3,Math.max(0,Math.floor(t/s)));return{l:c(n.left-r),t:c(n.top-i),r:c(a-n.right),b:c(o-n.bottom)}}applyBleed(){let e=this._viewport;if(!e)return;let t=this.bleedSides(),n=[t.l,t.t,t.r,t.b].join(),r=!!(t.l||t.t||t.r||t.b),i=!!this._bleedSetting&&!this._uiHidden&&!!this.renderer;e.toggleAttribute(`data-mp-bleed`,i),[`l`,`t`,`r`,`b`].forEach(n=>e.style.setProperty(`--mp-bleed-`+n,t[n]+`px`)),this.placeBleedHost(i?t:null),n!==(this._bleedKey||`0,0,0,0`)&&(this._bleedKey=n,this._bleed=r?t:null,this.renderer&&this.camView&&this.fitToViewport())}placeBleedHost(e){let t=this.renderer,n=this._glEl,r=this.el,i=this._viewport;if(!t||!n||!r||!i)return;let o=t.domElement;if(!e){o.parentElement!==n&&n.appendChild(o),this._bleedHost&&this._bleedHost.remove(),this._bleedHost=null;return}let s=this._bleedHost;if(!s){s=this._bleedHost=document.createElement(`div`),s.setAttribute(`data-mp-bleed-host`,``),s.setAttribute(`aria-hidden`,`true`),s.style.cssText=`position:absolute;z-index:0;pointer-events:none;opacity:0;transition:opacity 300ms ease`;let e=document.createElement(`div`);e.style.cssText=`position:absolute`,s.appendChild(e),a.injectCss(`bleed`,`[data-mp-bleed-host][data-mp-fade]{`+[`-webkit-mask-image`,`mask-image`].map(e=>e+`:linear-gradient(to right,transparent,#000 var(--mp-fade),#000 calc(100% - var(--mp-fade)),transparent),linear-gradient(to bottom,transparent,#000 var(--mp-fade),#000 calc(100% - var(--mp-fade)),transparent)`).join(`;`)+`;-webkit-mask-composite:source-in;mask-composite:intersect}`)}s.parentElement!==n&&n.insertBefore(s,n.firstChild),o.parentElement!==s&&s.appendChild(o);let c=i.offsetWidth,l=i.offsetHeight,u=Math.max(0,+this.pluginSetting(`appearance`,`edge_fade`)||0),d=this.pluginSetting(`appearance`,`background`)!==!1;Object.assign(s.style,{left:0-e.l+`px`,top:0-e.t+`px`,width:c+e.l+e.r+`px`,height:l+e.t+e.b+`px`,opacity:this.state&&this.state.ready?`1`:`0`}),s.style.setProperty(`--mp-fade`,u+`px`),s.toggleAttribute(`data-mp-fade`,u>0),Object.assign(s.firstChild.style,{left:e.l+`px`,top:e.t+`px`,width:c+`px`,height:l+`px`,borderRadius:getComputedStyle(r).borderRadius,background:d?getComputedStyle(i).getPropertyValue(`--mp-bg`).trim():`transparent`})}ndcVisible(e){if(!(e.z<1))return!1;let t=this._bleed;if(!t)return Math.abs(e.x)<=1.2&&Math.abs(e.y)<=1.2;let n=this._width||1,r=this._height||1,i=(e.x+1)/2*n,a=(1-e.y)/2*r;return i>=-t.l&&i<=n+t.r&&a>=-t.t&&a<=r+t.b}applyAppearance(){this.resolvedScheme()!==this._scheme&&this.renderer?this.applyThemeLive():(this.applySchemeAttrs(),this.emitScheme()),(this._units||[]).forEach(e=>e.pcK=null)}renderFrame(e){let t=this._bleed,n=this._bleedHost;if(n){let e=this.state.ready?`1`:`0`;n.style.opacity!==e&&(n.style.opacity=e)}if(!t)return this.renderer.render(this.scene,e);let r=Math.max(1,this._width||1),i=Math.max(1,this._height||1),a=e.view&&e.view.enabled?Object.assign({},e.view):null;e.setViewOffset(r,i,(a?a.offsetX:0)-t.l,(a?a.offsetY:0)-t.t,r+t.l+t.r,i+t.t+t.b),e.updateProjectionMatrix(),this.renderer.render(this.scene,e),a?e.setViewOffset(a.fullWidth,a.fullHeight,a.offsetX,a.offsetY,a.width,a.height):e.clearViewOffset(),e.updateProjectionMatrix()}prepareScheme(){this._scheme=this.resolvedScheme(),r.scheme=this._scheme,r.accent=this.accent(),a.raw&&r.applyScheme(a.raw),this._washColor=this._floorColor=this._white=null,this.applySchemeAttrs()}cardSurfaceVars(){let e=r,t=this.scheme()===`dark`||this.lightCards()===`dark`,n=e.unitPalette||{},i=t=>e.luminance(t)!=null,o=[(e.floorColors||[])[0],(e.groundColors||[])[0],...Object.values(n).map(e=>e&&e[0])].filter(i),s=[(e.floorColors||[])[0],(e.groundColors||[])[0],(n.nb||[])[0]].filter(i),c=(t,n)=>{if(!s.length)return null;let r=Math.min(...s.map(n=>e.contrast(t,n))),i=Math.max(0,Math.min(1,(r-1.1)/.5));return`rgba(`+n+`,`+(.16-i*.1).toFixed(3)+`)`},l={"ring-on-light":c(`#ffffff`,`9,9,11`),"ring-on-dark":c(a.CARD_TOKENS.raised[`card-bg`],`255,255,255`)};if(o.length){let n=t?`#09090b`:`#ffffff`,r=a.CARD_TOKENS[t?`raised`:`paper`][`card-fg-muted`],i=this.scheme()!==`dark`,c=(t&&!i||!s.length?o:s).map(t=>[t,e.luminance(t)]).sort((e,t)=>e[1]-t[1]),u=(t?c[c.length-1]:c[0])[0],d=e.hexRgb(n),f=e.hexRgb(u),p=e=>`#`+d.map((t,n)=>Math.round(t*e+f[n]*(1-e)).toString(16).padStart(2,`0`)).join(``),m=t?.62:.55;for(;m<.9&&e.contrast(p(m),r)<4.5;)m+=.02;l[`glass-tint`]=Math.round(m*100)+`%`,l[`glass-tail`]=Math.round(Math.max(.3,m-.16)*100)+`%`}return l}applySchemeAttrs(){let e=this.cardSurfaceVars(),t=this.accent(),n=t.toLowerCase()===r.ACCENT_DEFAULT?null:r.accentTokens(t,this.scheme()===`dark`),i=window.matchMedia&&window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches,o=this.glassPopups()&&!i,s=this.glassControls()&&!i;[this._viewport,...(this._docks||[]).map(e=>e.wrap)].forEach(t=>{t&&(t.setAttribute(`data-mp-scheme`,this.scheme()),t.setAttribute(`data-mp-cards`,this.lightCards()),t.setAttribute(`data-mp-tips`,this.lightTooltips()),t.setAttribute(`data-mp-selected`,this.selectedStyle()),t.setAttribute(`data-mp-glass`,o?`1`:`0`),t.setAttribute(`data-mp-glass-ctl`,s?`1`:`0`),Object.entries(e).forEach(([e,n])=>n?t.style.setProperty(`--mp-`+e,n):t.style.removeProperty(`--mp-`+e)),t.style.setProperty(`--mp-rk`,String(this.uiRadius()/4)),Object.keys(a.TOKENS.light).filter(e=>/^(accent|focus|fg-on-accent)/.test(e)).forEach(e=>n?t.style.setProperty(`--mp-`+e,n[e]):t.style.removeProperty(`--mp-`+e)))}),this.el&&(this.el.style.borderRadius=this.uiRadius()*a.UI_RADIUS_OUTER+`px`),this.applyContainer()}async setScheme(e){if(![`light`,`dark`,`auto`].includes(e))throw Error(`scheme must be 'light', 'dark' or 'auto'`);this.props=Object.assign({},this.props,{scheme:e});let t=this.resolvedScheme();return t===this._scheme||!this.renderer?(this.applySchemeAttrs(),t):(this.applyThemeLive(),t)}async setAccent(e){if(e!=null&&!r.hexRgb(e))throw Error(`accent must be a hex colour such as #1476ff`);return this.props=Object.assign({},this.props,{accent:e||null}),this.applySchemeAttrs(),this.renderer&&this.accent()!==r.accent?this.applyThemeLive():this.emitScheme(),this.accent()}setSelectedStyle(e){if(![`neutral`,`accent`].includes(e))throw Error(`selected must be 'neutral' or 'accent'`);return this.props=Object.assign({},this.props,{selected:e}),this.applySchemeAttrs(),e}themed(e,t,n){if(!e||!e.color)return e;let i=r.parseThemeSpec(t)||(n?{hex:t,role:n}:null);return i?(e.userData.theme=i,(this._themedMats=this._themedMats||new Set).add(e),e.color.set(r.themeColor(i.hex,i.role))):t!=null&&e.color.set(t),e}applyThemeLive(){if(!this.renderer||!this.scene)return;let e=this.THREE,t=a;this.prepareScheme(),Object.keys(t.unitPalette).forEach(n=>{let r=this._paletteColors[n]=this._paletteColors[n]||[];t.unitPalette[n].forEach((t,n)=>r[n]?r[n].set(t):r[n]=new e.Color(t))}),(this._units||[]).forEach(e=>e.pcK=null);let n=t.scenePalette;(this._liftColors||[]).forEach((e,t)=>n.lift[t]&&e.set(n.lift[t])),this._escalatorPalette&&(this._escalatorPalette.n.forEach((e,t)=>e.set(n.escalator[t])),this._escalatorPalette.h.forEach((e,t)=>e.set(n.escalatorActive[t]))),this._hemiLight&&this._hemiLight.groundColor.set(n.groundLight),this.renderer.setClearColor(n.background,0),(this._stepCanvases||[]).forEach(e=>e.draw());let i=[],o=new Set(this._themedMats||[]);this.scene.traverse(e=>[].concat(e.material||[]).forEach(e=>e&&o.add(e))),o.forEach(t=>{let n=t.userData&&t.userData.theme;if(!n||!t.color)return;let a=new e.Color(r.themeColor(n.hex,n.role));t.color.equals(a)||i.push({color:t.color,from:t.color.clone(),to:a})}),this._themeTween=i.length?{items:i,start:performance.now(),ms:this._reducedMotion?0:200}:null,this._themeTween&&!this._themeTween.ms&&this.stepThemeTween(1/0),this.emitScheme()}stepThemeTween(e){let t=this._themeTween;if(!t)return;let n=t.ms?Math.min(1,(e-t.start)/t.ms):1,r=n*n*(3-2*n);t.items.forEach(e=>e.color.copy(e.from).lerp(e.to,r)),n>=1&&(this._themeTween=null)}emitScheme(){this.emit(`scheme`,{scheme:this.scheme(),lightCards:this.lightCards(),lightTooltips:this.lightTooltips(),accent:this.accent()})}setLightCards(e){if(![`dark`,`white`].includes(e))throw Error(`lightCards must be 'dark' or 'white'`);return this.props=Object.assign({},this.props,{lightCards:e}),this.applySchemeAttrs(),this.emitScheme(),e}setLightTooltips(e){if(e!=null&&![`dark`,`white`].includes(e))throw Error(`lightTooltips must be 'dark', 'white' or null`);return this.props=Object.assign({},this.props,{lightTooltips:e??null}),this.applySchemeAttrs(),this.emitScheme(),this.lightTooltips()}setGlassPopups(e){return this.props=Object.assign({},this.props,{glassPopups:!!e}),this.applySchemeAttrs(),this.emitScheme(),!!e}setGlassControls(e){return this.props=Object.assign({},this.props,{glassControls:!!e}),this.applySchemeAttrs(),this.emitScheme(),!!e}baseCss(t,n){t!==`tokens`&&!e.sheets.has(`tokens`)&&this.baseCss(`tokens`,a.tokenCss());let r=e=>e.split(`,`).map(e=>e.trim()).map(e=>e===`&`?`.mp-map`:e[0]===`&`?`.mp-map`+e.slice(1):`.mp-map `+e).join(`, `),i=typeof n==`string`?n:Object.entries(n).map(([e,t])=>r(e)+` { `+t+` }`).join(`
4177
+ <div ref="{{ slotRef }}" style="display:contents"></div></div>`;constructor(e){e||={},this.opts=e,this.props=Object.assign({},e.options),this._afterPaint=[],this._pendingState=null,this._paintQueued=!1,this._views=[]}mount(t){return a.lastMounted=this,this.props.shadow&&(this.props.frame||(this.props=Object.assign({},this.props,{frame:t})),t=a.shadowBox(t)),this._styleRoot&&e.release(this._styleRoot),this._styleRoot=e.use(e.rootOf(t)),this.el=t,t.innerHTML=``,t._mpCtx||(t._mpCtx=!0,t.addEventListener(`contextmenu`,e=>e.preventDefault(),!0),t.addEventListener(`pointerdown`,e=>{e.button===2&&(this._rightDrag=!0)},!0),window.addEventListener(`contextmenu`,e=>{(this._rightDrag||this._drag||performance.now()-(this._rightDragEnd||0)<600)&&e.preventDefault()},!0),window.addEventListener(`pointerup`,e=>{this._rightDrag&&(this._rightDrag=!1,this._rightDragEnd=performance.now())},!0)),this.view(a.TEMPLATE,t).render(this.renderVals()),this.extraViews&&this.extraViews(),this._paint(!0),this.componentDidMount(),this}view(e,t){let n=new i(e,t);return this._views.push(n),n}setOptions(e){let t=e&&`scheme`in e&&e.scheme!==this.props.scheme,n=e&&[`lightCards`,`lightTooltips`,`glassPopups`,`glassControls`,`uiRadius`].some(t=>t in e);this.props=Object.assign({},this.props,e),t?this.setScheme(this.props.scheme||`light`).catch(e=>console.warn(e)):(n||e&&`selected`in e)&&this.applySchemeAttrs(),e&&`accent`in e&&this.setAccent(e.accent).catch(e=>console.warn(e)),this._schedulePaint()}destroy(){this.componentWillUnmount&&this.componentWillUnmount(),this._destroyed=!0,this._bleedWatch&&this._bleedWatch(),this._bleedWatch=null,this._bleedHost&&this._bleedHost.remove(),this._bleedHost=null,this.el&&(this.el.innerHTML=``),this._styleRoot&&e.release(this._styleRoot),this._styleRoot=null}static shadowBox(e,t){let n=e.shadowRoot||e.attachShadow({mode:`open`}),r=n.querySelector(`style[data-mp-host]`);r||(r=document.createElement(`style`),r.setAttribute(`data-mp-host`,``),n.prepend(r)),r.textContent=(t||`:host{position:relative}`)+`:host([hidden]){display:none}.mp-embed{all:initial;visibility:inherit;display:block;position:absolute;inset:0}`,Array.from(n.children).forEach(e=>e.classList.contains(`mp-embed`)&&e.remove());let i=document.createElement(`div`);return i.className=`mp-embed`,i.style.cssText=`position:absolute;inset:0`,n.appendChild(i),i}setState(e,t){let n=this._pendingState||this.state,r=typeof e==`function`?e(n,this.props):e;r!=null&&(this._pendingState=Object.assign({},n,r)),t&&this._afterPaint.push(t),this._schedulePaint()}forceUpdate(e){e&&this._afterPaint.push(e),this._schedulePaint()}_schedulePaint(){this._paintQueued||(this._paintQueued=!0,queueMicrotask(()=>this._paint()))}_paint(e){if(this._paintQueued=!1,this._pendingState&&=(this.state=this._pendingState,null),this._destroyed)return;let t=this.renderVals();this._views.forEach(e=>e.render(t)),this._viewport&&(this._viewport.style.cursor=t.cursor||``);let n=this._prevProps||this.props;this._prevProps=this.props,!e&&this.componentDidUpdate&&this.componentDidUpdate(n),this._flushCallbacks()}_flushCallbacks(){let e=this._afterPaint;this._afterPaint=[],e.forEach(e=>e())}mapSource(){let e=this.props,t=this.ownsViews?null:e.view||null;if(e.data||typeof e.load==`function`)return this._dataUrl||=(a._dataLoads=(a._dataLoads||0)+1,new URL(e.src||`map.mapplic.json`,document.baseURI).href+`#data-`+a._dataLoads),{url:this._dataUrl,from:{data:e.data||null,load:e.data?null:e.load,saved:!1,view:t}};let n=e.src||`mall.mapplic.json`;return{url:t?n+(n.includes(`#`)?`&`:`#`)+`view-`+encodeURIComponent(t):n,from:{saved:e.savedCopies!==!1&&typeof e.onSave!=`function`,view:t}}}static async loadThree(){let[e,t]=await Promise.all([import(`https://cdn.jsdelivr.net/npm/three@0.184.0/+esm`),import(`https://cdn.jsdelivr.net/npm/three@0.184.0/examples/jsm/loaders/SVGLoader.js/+esm`).then(e=>e.SVGLoader,()=>null)]);return{THREE:e,SVGLoader:t}}async boot(){try{let{url:e,from:t}=this.mapSource();if(r.title=this.props.title||null,await a.load(e,t),this._destroyed||(await a.pluginsReady,this._destroyed))return;let{THREE:n,SVGLoader:i}=await a.loadThree();if(this._destroyed||(r._sourceUrl!==e&&await a.load(e,t),this.beforeBuild&&(await this.beforeBuild(e),this._destroyed)))return;try{if(!i)throw Error(`SVGLoader is not available`);this._svgLoader=new i,this._svgLoader.SVG=i,this._logos={},await Promise.all(a._source.logoSrcs.map(async e=>{this._logos[e]=await(await fetch(e)).text()}))}catch(e){console.warn(`logos`,e)}try{await document.fonts.load(`700 64px Onest`)}catch{}if(this._destroyed)return;let o=r.startLevel||0;this.state.level=o,this._pendingState&&(this._pendingState.level=o),this.init(n)}catch(e){console.error(e);let t=String(e&&e.stack||``).split(`
4178
+ `).map(e=>/([\w.-]+\.(?:js|json))(?:\?[^:]*)?:(\d+)/.exec(e)).find(Boolean);this.setState({err:this.props.errorText||`Map failed to load: `+(e&&e.message||String(e))+(t?` (`+t[1]+`:`+t[2]+`)`:``)})}}init(e){this.prepareScheme();let t=a,n=t.source(),i=t.FLOOR_TOP,o=this._glEl;if(!o||(this.THREE=e,t.currentLanguage=this.pickLanguage(),t.localize(),!this.setupRenderer(e,o)))return;let s=this.scene;this.camera;let{rectPoints:c,polygonBounds:l,hashRandom:u,slugify:d,insetPolygon:f,vecBetween:p,unitVector:m,filletPolyline:h,dashQuads:g,cornerFillet:_,roundRectPoints:v}=r,y=t.offsetPolyline,b=(e,t)=>y(e,t/2).concat(y(e,-t/2).reverse()),x=t.measurePolyline,S=t.pointAlong,C=n.sitePoly,w=e=>t.pointInPolygon(C,e[0],e[1]),T=this.siteClipPlanes(e,C),E=t=>new e.Vector2(t[0],-t[1]),D=(t,n)=>{let r=t.map(E);e.ShapeUtils.isClockWise(r)&&r.reverse();let i=new e.Shape(r);return(n||[]).forEach(t=>{let n=t.map(E);e.ShapeUtils.isClockWise(n)||n.reverse(),i.holes.push(new e.Path(n))}),i},O=(t,n,r,i)=>{let a=new e.ExtrudeGeometry(D(t,i),{depth:r-n,bevelEnabled:!1,curveSegments:1});return a.rotateX(-Math.PI/2),a.translate(0,n,0),a},k=(t,n)=>this.themed(new e.MeshLambertMaterial(Object.assign({},n||{})),t),A=this.levelViews=a.levelNames.map((t,n)=>{let r=new e.Group;return s.add(r),{group:r,depthMaterial:n?new e.MeshDepthMaterial({alphaHash:!0}):null,mats:[],units:[],occluders:[],lifts:[],escs:[],y:0,opacity:1,appliedOpacity:1,transparent:!1,fadingOut:!1,placed:!1}}),j=(e,t)=>(A[e].mats.includes(t)||A[e].mats.push(t),t),M=(t,n,r,i,a)=>{let o=new e.Mesh(n,Array.isArray(r)?r.map(e=>j(t,e)):j(t,r));return o.castShadow=!!i,i&&A[t].depthMaterial&&(o.customDepthMaterial=A[t].depthMaterial),o.receiveShadow=!0,(a||A[t].group).add(o),o},N=(n,r,i,a)=>{let o=t.outlineGeo(e,r),s=t.outlineObject(e,o,j(n,this.themed(o.userData.wide?new e.MeshBasicMaterial:new e.LineBasicMaterial,i)));return(a||A[n].group).add(s),s};this._geomKit={rect:c,rnd:u,V:p,Nz:m,fillet:h,thick:b,routeOf:x,at:S,dashes:g,fp2:_,rr:v,shp:D,ext:O,lam:k,CP:T,inPl:w},this._textures=[],this._stepCanvases=[],this._themedMats=new Set,this._escalatorTextures=[],this._extrude=O,this._inset=f,this._unitById={},this._amenityList=[],this._units=[],this._tallUnits=null,this._byId={},this._stores=[],this._escalators=[],this._escalatorById={},this._explodeBlend=0,this._liftMaterials=[],this._liftColors=t.scenePalette.lift.map(t=>new e.Color(t)),this._escalatorPalette={n:t.scenePalette.escalator.map(t=>new e.Color(t)),h:t.scenePalette.escalatorActive.map(t=>new e.Color(t))};for(let a=0;a<t.levelNames.length;a++){let o=A[a],s=n.voidPolys[a],u=t.unionAll(s),p=M(a,O(t.roundCorners(n.floorPolys[a],t.floorRadius),0,i,u),k(t.floorColors[0]));o.slab=p,p.renderOrder=-1,r.generatedBuilding&&(p.visible=!1);{let e=p.geometry.attributes.position,t=Math.max(1,Math.ceil(e.count/160)),n=[];for(let r=0;r<e.count;r+=t)n.push([e.getX(r),-e.getZ(r)]);p.geometry.computeBoundingBox();let r=p.geometry.boundingBox;o.footprint=n,o.footprintCenter=[(r.min.x+r.max.x)/2,-(r.min.z+r.max.z)/2]}if(o.occluders.push(p),s.length&&(this.opt(`barriers`,null)??t.voidBarriers)){let s=[],l=[],d=.9,f=[];n.connectors.forEach(e=>{if(e.type===`elevator`){if(!e.layers.includes(a))return;let t=e.axisX,n=e.axisZ,r=-n,i=t,o=e.length/2+.15,s=e.width/2+.15;f.push([[e.centerX-t*o-r*s,e.centerZ-n*o-i*s],[e.centerX+t*o-r*s,e.centerZ+n*o-i*s],[e.centerX+t*o+r*s,e.centerZ+n*o+i*s],[e.centerX-t*o+r*s,e.centerZ-n*o+i*s]]);return}if(a!==e.layers[0]&&a!==e.layers[1])return;let n=a===e.layers[1],r,i,o,s,c;if(e.type===`stairs`){let a=t.stairLayout(e);[r,i]=n?a.end:a.start,[o,s]=n?a.ed:a.sd,c=a.w}else{let t=n?1:-1;o=e.axisX*e.upSign,s=e.axisZ*e.upSign,r=e.centerX+o*t*e.length/2,i=e.centerZ+s*t*e.length/2,c=e.width}let l=-s,u=o,d=c/2+.15,p=1.2;f.push([[r-o*p-l*d,i-s*p-u*d],[r+o*p-l*d,i+s*p-u*d],[r+o*p+l*d,i+s*p+u*d],[r-o*p+l*d,i-s*p+u*d]])});let p=n.voidOpen&&n.voidOpen[a]||[],m=.05*r.scale,h=([e,t])=>p.some(n=>{let r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let[o,s]=n[i],[c,l]=n[a],u=c-o,d=l-s,f=u*u+d*d||1,p=Math.max(0,Math.min(1,((e-o)*u+(t-s)*d)/f));if(Math.hypot(e-o-u*p,t-s-d*p)<m)return!0;s>t!=l>t&&e<u*(t-s)/(d||1e-12)+o&&(r=!r)}return r}),g=n.unitRows[a].map(e=>e.points||c(e.u0,e.u1,e.v0,e.v1)).map(e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return{P:e,box:[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]}}),_=1*r.scale,v=.5*r.scale,y=(e,t)=>g.some(({P:n,box:r})=>{if(e<r[0]-_||e>r[1]+_||t<r[2]-_||t>r[3]+_)return!1;let i=!1;for(let r=0,a=n.length-1;r<n.length;a=r++){let[o,s]=n[r],[c,l]=n[a],u=c-o,d=l-s,f=u*u+d*d||1,p=Math.max(0,Math.min(1,((e-o)*u+(t-s)*d)/f));if(Math.hypot(e-o-u*p,t-s-d*p)<_)return!0;s>t!=l>t&&e<u*(t-s)/(d||1e-12)+o&&(i=!i)}return i}),b=(e,t)=>{let n=Math.hypot(t[0]-e[0],t[1]-e[1]),r=Math.max(1,Math.ceil(n/v)),i=n=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],a=[],o=null;for(let e=0;e<r;e++){let t=i((e+.5)/r),n=!y(t[0],t[1]);n&&o==null&&(o=e),!n&&o!=null&&(a.push([i(o/r),i(e/r)]),o=null)}return o!=null&&a.push([i(o/r),t]),a};u.forEach(e=>e.forEach((n,r)=>t.clipOutside(n,e[(r+1)%e.length],f).flatMap(([e,t])=>b(e,t)).forEach(([e,t])=>{p.length&&h([(e[0]+t[0])/2,(e[1]+t[1])/2])||(s.push(e[0],i,e[1],t[0],i,t[1],t[0],i+d,t[1],e[0],i,e[1],t[0],i+d,t[1],e[0],i+d,e[1]),l.push(e[0],i+d,e[1],t[0],i+d,t[1]))})));let x=new e.BufferGeometry;x.setAttribute(`position`,new e.Float32BufferAttribute(s,3));let S=new e.MeshBasicMaterial({transparent:!0,opacity:.6,side:e.DoubleSide,depthWrite:!1});S.userData.o0=.6,this.themed(S,null,`palette:glass`),M(a,x,S,!1);let C=new e.BufferGeometry;C.setAttribute(`position`,new e.Float32BufferAttribute(l,3)),o.group.add(new e.LineSegments(C,j(a,this.themed(new e.LineBasicMaterial,null,`palette:rail`))))}let m=t.walkTester(n.floorPolys[a],n.voidPolys[a].concat((n.connectors||[]).filter(e=>e.type===`elevator`?e.layers.includes(a):e.layers[0]===a).map(e=>t.connectorPolygon(e))),n.unitRows[a].map(e=>e.points||c(e.u0,e.u1,e.v0,e.v1))),h=null,g=null,_=()=>h||=t.openingSpace(n.floorPolys[a],n.voidPolys[a].concat((n.connectors||[]).filter(e=>e.type===`elevator`?e.layers.includes(a):e.layers[0]===a).map(e=>t.connectorPolygon(e))),n.unitRows[a].map(e=>({points:e.points||c(e.u0,e.u1,e.v0,e.v1),kiosk:e.kiosk})));n.unitRows[a].forEach(s=>{let u=(e=>t.unitGap&&e.length>24?r.untangle(e):e)(f(s.points&&s.points.length>24&&t.unitGap?r.simplify(s.points,t.unitGap*1.5):s.points||c(s.u0,s.u1,s.v0,s.v1),t.unitGap)),p=s.holes?s.holes.map(e=>t.unitGap?r.untangle(f(e.length>24?r.simplify(e,t.unitGap*1.5):e,-t.unitGap)):e):null,h=t.unitsFlat?.002:(s.height||(s.kiosk?8:14))/10*t.unitHeightScale,v=s.service?`sv`:s.amenity?`am`:`nb`,y=t.unitsFlat?(t.unitBase??i)+.005:t.unitBase??i,b=t.unitsFlat?y+h:i+h,x=O(t.roundCorners(u,t.unitRadius),y,b,p);p&&(u.holes=p);let S=new e.Group;o.group.add(S);let C=M(a,x,k(t.unitPalette[v][0]),!t.unitsFlat,S);t.unitsFlat&&C.material&&!Array.isArray(C.material)?Object.assign(C.material,{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-80}):C.material&&!Array.isArray(C.material)&&Object.assign(C.material,{polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});let w=N(a,x,t.unitPalette[v][1],C);if(t.unitOutlineNone)w.visible=!1;else if(t.unitsFlat&&!(w.geometry.userData||{}).wide){let e=w.userData.rankU={value:0};w.material.onBeforeCompile=t=>{t.uniforms.uRank=e,t.vertexShader=`uniform float uRank;
4179
+ `+t.vertexShader.replace(`#include <project_vertex>`,`#include <project_vertex>
4180
+ gl_Position.z -= (2e-4 + uRank * 5e-5) * gl_Position.w;`)},w.material.customProgramCacheKey=()=>`unit-outline-flat`}let T=s.labelBox||l(u),E=s.labelBox?t.clipToRect(u,T):u,D=T[1]-T[0],A=T[3]-T[2],j=A>=D;Math.max(D,A)*10,Math.min(D,A)*10;let P=s.service||s.logo&&this._logos&&this._logos[s.logo]?``:s.amenity?s.amenity:this.pluginSetting(`labels`,`uppercase`)===!1?String(s.labelText??s.name):String(s.labelText??s.name).toUpperCase(),F=t.fitLabelWrapped(E,P,!!s.amenity,s.labelAngle),I=F.centerX,ee=F.centerZ,L={r:s,grp:S,m:C,line:w,kind:v,levelIndex:a,am:!!s.amenity,base:y,top:b,centerX:I,centerZ:ee,boxWidth:D,boxDepth:A,alongV:j,heightOrig:h,nameOrig:s.name,heightScale:1,logoSvgOrig:s.logo&&this._logos?this._logos[s.logo]:null,raw:s.points,poly0:u,centerXOrig:I,centerZOrig:ee,boxWidthOrig:D,boxDepthOrig:A,av0:j,lp:E,lp0:E,labelOrig:!s.noLabel,merged:[]};if(!s.service&&!s.amenity){let e={id:(e=>{let t=e,n=2;for(;this._byId[t];)t=e+`-`+n++;return t})(d(s.name)+`-`+a),name:t.unitName(s),cat:s.category,img:s.image,grp:s.group,level:a,hours:s.hours===!1?``:s.hours||t.categoryHours[s.category]||t.defaultHours,loc:s.loc};L.id=e.id,C.userData.id=e.id,s.inert&&(C.userData.inert=!0),this._unitById[e.id]=L,L.catOrig=e.cat,L.hoursOrig=e.hours,this._stores.push(e),this._byId[e.id]={item:{poly:u,cx:I,cz:ee,top:i+h,store:e},levelIndex:a},o.units.push(C)}else if(s.amenity){let e={id:`am-`+d(String(s.amenity))+`-`+a+`-`+this._amenityList.length,name:t.unitName(s),cat:`Amenity`,type:String(s.amenity),level:a,hours:s.hours===!1?``:s.hours||t.amenityHours};L.id=e.id,C.userData.id=e.id,this._unitById[e.id]=L,L.catOrig=e.cat,L.hoursOrig=e.hours,L.nameOrig=e.name,this._amenityList.push(e),this._byId[e.id]={item:{poly:u,cx:I,cz:ee,top:i+h,store:e},levelIndex:a},o.units.push(C)}else o.occluders.push(C);let R=!r.projectionName;if((this.opt(`openings`,null)??!0)&&s.points&&(s.openings||R)){let r=s.openings||=(s.openingsAuto=!0,t.autoOpenings(s.points,m,s.kiosk,s.kiosk?null:_())),c=t.mapOpenings(s.points,u,r.flatMap(e=>t.openingPieces(s.points.length,e))),l=t.polygonEdges(u),d=[];c.forEach(e=>{let n=l[e.edge];if(!n)return;let r=[t.lerp(n.a,n.b,e.start),t.lerp(n.a,n.b,e.end)];r.n=[-n.n[0],-n.n[1]],d.push(r)}),L.storefrontGroup=new e.Group,L.storefrontGroup.position.y=i,o.group.add(L.storefrontGroup),L.storefrontSegments=d,L.storefrontPaths=t.openingPaths(u,c.filter(e=>l[e.edge]),t.unitRadius),L.storefrontPoly=u,L.storefrontHeight=h,L.storefrontPatch=s.storefront||null,L.storefrontAlpha=0,this._buildStorefront(L),d.length&&L.id&&this._byId[L.id]?this._byId[L.id].item.ops=d:!s.kiosk&&L.id&&this._byId[L.id]&&(this._byId[L.id].item.faceDir=t.fallbackFront(u,[m,g||=t.walkTester(n.floorPolys[a],[],[])]))}this._units.push(L)});let v=t.fixtures.filter(e=>e.levelIndex===a&&e.kind===`table`);if(v.length){let n=new e.CylinderGeometry(.3,.3,.24,20),r=new e.BoxGeometry(.2,.13,.2);n.translate(0,i+.12,0),r.translate(0,i+.065,0);let o=k(t.themeSpec(null,`palette:fixture`)),s=k(t.themeSpec(null,`palette:fixtureAlt`));v.forEach(({u:e,v:i})=>{let c=M(a,n,o,!0);c.position.set(e,0,i),N(a,n,t.themeSpec(null,`palette:fixtureEdge`),c),[[.5,0],[-.5,0],[0,.5],[0,-.5]].forEach(([t,n])=>M(a,r,s,!0).position.set(e+t,0,i+n))})}}this._levelRise=t.storeyHeight,this._tmpVec=new e.Vector3,this._raycaster=new e.Raycaster,this._pointerNdc=new e.Vector2(-9,-9);let P=()=>this.fitToViewport();P(),this._fitSize=P,this._resizeObserver=new ResizeObserver(P),this._resizeObserver.observe(this._viewport),this.camView=this.home(!1),this.camGoal=this.home(!1),this.applyProps(),this._frameId=requestAnimationFrame(this.loop),this.applyProps(),setTimeout(()=>this.revealWhenReady(),60)}setupRenderer(e,t){let n=a,r;try{r=new e.WebGLRenderer({antialias:!0,alpha:!0})}catch{return this.setState({err:this.props.errorText||`3D needs WebGL, which is not available here`}),!1}this.renderer=r,r.setPixelRatio(Math.min(2,window.devicePixelRatio||1)),r.shadowMap.enabled=!0,r.shadowMap.type=e.PCFShadowMap,r.localClippingEnabled=!0,r.setClearColor(n.scenePalette.background,0),r.domElement.style.cssText=`position:absolute;inset:0;width:100%;height:100%;display:block`,t.appendChild(r.domElement);let i=this.scene=new e.Scene;this.camera=new e.PerspectiveCamera(30,1,4,2e3),i.add(this._hemiLight=new e.HemisphereLight(16777215,n.scenePalette.groundLight,2.4));let o=this.sun=new e.DirectionalLight(16777215,.9),s=new e.Vector3(.45,.85,-.28).normalize(),c=n.bounds,l=Math.hypot(c[1]-c[0],c[3]-c[2])/2*1.28,u=Math.max(150,l*1.6);return o.target.position.set((c[0]+c[1])/2,0,(c[2]+c[3])/2),o.position.copy(o.target.position).addScaledVector(s,u),i.add(o,o.target),o.castShadow=this.opt(`shadows`,!0),Object.assign(o.shadow.camera,{left:-l,right:l,top:l,bottom:-l,near:10,far:u+l*2}),o.shadow.camera.updateProjectionMatrix(),o.shadow.mapSize.set(2048,2048),o.shadow.radius=5,o.shadow.bias=-4e-4,o.shadow.normalBias=.03,this._paletteColors={},Object.keys(n.unitPalette).forEach(t=>this._paletteColors[t]=n.unitPalette[t].map(t=>new e.Color(t))),!0}siteClipPlanes(e,t){let n=(()=>{let e=t.slice().sort((e,t)=>e[0]-t[0]||e[1]-t[1]),n=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),r=[],i=[];for(let t of e){for(;r.length>1&&n(r[r.length-2],r[r.length-1],t)<=0;)r.pop();r.push(t)}for(let t of e.reverse()){for(;i.length>1&&n(i[i.length-2],i[i.length-1],t)<=0;)i.pop();i.push(t)}return r.slice(0,-1).concat(i.slice(0,-1))})(),r=n.reduce((e,t)=>[e[0]+t[0]/n.length,e[1]+t[1]/n.length],[0,0]);return n.map((t,i)=>{let a=n[(i+1)%n.length],o=-(a[1]-t[1]),s=a[0]-t[0],c=Math.hypot(o,s);return o/=c,s/=c,o*(r[0]-t[0])+s*(r[1]-t[1])<0&&(o=-o,s=-s),new e.Plane(new e.Vector3(o,0,s),-(o*t[0]+s*t[1]))})}fitToViewport(){if(this._bleedSetting&&!this._bleedBusy){this._bleedBusy=!0;try{this.applyBleed()}finally{this._bleedBusy=!1}}let e=Math.max(1,this._viewport.clientWidth),t=Math.max(1,this._viewport.clientHeight);this._width=e,this._height=t;let n=e<640,r=Math.max(e,this.el&&this.el.clientWidth||0)<640;(n!==!!this.state.narrow||r!==!!this.state.hostNarrow)&&this.setState({narrow:n,hostNarrow:r});let i=this._bleed||{l:0,t:0,r:0,b:0};this.renderer.setSize(e+i.l+i.r,t+i.t+i.b,!1),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this._shiftKey=null,this.camView&&(this.applyViewShift(this.camera,0),this.camera.updateMatrixWorld(),this.plugFrame(0,performance.now()),this.renderFrame(this.camera),this.overlays())}revealWhenReady(){if(this._destroyed)return;this.setState({ready:!0}),this.syncBuiltins();let e=performance.now(),t=null,n=0,r=()=>{if(!this._destroyed){if(this._slotSig!==void 0&&!this._slotRaf&&this._slotSig===t?n++:n=0,t=this._slotSig,n>=2||performance.now()-e>a.SHOW_WAIT_MS)return this.setState({shown:!0});requestAnimationFrame(r)}};requestAnimationFrame(r)}home(e){let t=a,n=Math.max(1,this._width||1200),r=Math.max(1,this._height||780),i=n/r,o=t.FOV_TAN,s=(t.raw||{}).view||{},c=this.is2d(),l=!this._uiHidden&&this._insets||{},u=[n,r,+!!e,+!!c,s.bearing,s.pitch,s.bearing_2d,+!!s.fixed,t.homeCenter.join(),t.homeExtent.join(),t.bounds.join(),t.homeHull.length,t.storeyHeight,e?this.levelGapPx():0,(t.levelShortNames||[]).length,l.left,l.right,l.top,l.bottom,this._uiHidden?``:this._slotSig||``,+!!this.THREE].join(`|`),d=this._homeCache=this._homeCache||{};if(d[u])return Object.assign({},d[u]);let f={targetX:t.homeCenter[0],targetY:e?0:t.FLOOR_TOP,targetZ:t.homeCenter[1],azimuth:c?this.bearing2d():-(s.bearing??-45)*Math.PI/180,polar:c?0:(s.pitch??56)*Math.PI/180+(e?.1:0),distance:Math.max(1.18*t.homeExtent[0]/(o*i),(e?1.39:1)*t.homeExtent[1]/o)};return this.fitHome(f,e,n,r,l),Object.keys(d).length>8&&(this._homeCache={}),this._homeCache[u]=f,Object.assign({},f)}static HOME_MARGIN=24;static HOME_CLEARANCE=8;fitHome(e,t,n,r,i){let o=a,s=this.THREE,c=(o.raw||{}).view||{};if(!s)return e;let l=o.homeHull,u=o.topHull;if(c.fixed&&c.fit){let[e,t]=o.homeCenter,[n,r]=o.homeExtent;l=[[e-n,t-r],[e+n,t-r],[e+n,t+r],[e-n,t+r]],u=[]}if(!l||l.length<3)return e;let d=Math.max(1,(o.levelShortNames||[]).length),f=t?(d-1)*this.levelGapPx()/20:0,p=o.FLOOR_TOP+o.storeyHeight+f,m=l.map(e=>new s.Vector3(e[0],-f,e[1])).concat((u||[]).map(e=>new s.Vector3(e[0],p,e[1]))),h=((i.left||0)-(i.right||0))/2,g=((i.top||0)-(i.bottom||0))/2,_=Math.round(Math.min(o.HOME_MARGIN,Math.min(n,r)*.04)),v=o.HOME_CLEARANCE,y={L:_+(i.left||0),R:n-_-(i.right||0),T:_+(i.top||0),B:r-_-(i.bottom||0)},b=n*.35,x=r*.35;(y.R-y.L<b||y.B-y.T<x)&&Object.assign(y,{L:_,R:n-_,T:_,B:r-_});let S=this._homeCam=this._homeCam||new s.PerspectiveCamera(30,1,.5,1e6),C=new s.Vector3,w=new s.Vector3,T=new s.Vector3;S.aspect=n/r;let E=()=>(this.aimCamera(S,e),m.map(e=>(C.copy(e).project(S),[(C.x+1)/2*n+h,(1-C.y)/2*r+g]))),D=()=>{for(let t=0;t<10;t++){let t=E(),n=t.map(e=>e[0]),i=t.map(e=>e[1]),a=Math.min(...n),s=Math.max(...n),c=Math.min(...i),l=Math.max(...i),u=2*e.distance*o.FOV_TAN/r;w.setFromMatrixColumn(S.matrixWorld,0),T.setFromMatrixColumn(S.matrixWorld,1);let d=((a+s)/2-(y.L+y.R)/2)*u,f=-((c+l)/2-(y.T+y.B)/2)*u,p=Math.max(.05,T.x*T.x+T.z*T.z);e.targetX+=w.x*d+T.x*f/p,e.targetZ+=w.z*d+T.z*f/p;let m=Math.max((s-a)/(y.R-y.L),(l-c)/(y.B-y.T));isFinite(m)&&m>0&&(e.distance*=m)}};D();let O=this._uiHidden?[]:this._slotRects||[];for(let e=0;e<8&&O.length;e++){let e=o.convexHull(E()),t=null,n=1/0;if(O.forEach(r=>{let i=[r.x-v,r.y-v,r.x+r.w+v,r.y+r.h+v];if(!o.polyHitsRect(e,[i[0]+1,i[1]+1,i[2]-1,i[3]-1]))return;let a=[r.edge===`top`?[`T`,i[3]]:[`B`,i[1]]];r.side===`left`?a.push([`L`,i[2]]):r.side===`right`&&a.push([`R`,i[0]]),a.forEach(([e,r])=>{let i=Object.assign({},y,{[e]:r});if(i.R-i.L<b||i.B-i.T<x)return;let a=1-(i.R-i.L)*(i.B-i.T)/((y.R-y.L)*(y.B-y.T));a>0&&a<n&&(n=a,t=[e,r])})}),!t)break;y[t[0]]=t[1],D()}return e}static polyHitsRect(e,t){if(!e||e.length<3)return!1;let n=e.map(e=>e[0]),r=e.map(e=>e[1]);if(Math.max(...n)<=t[0]||Math.min(...n)>=t[2]||Math.max(...r)<=t[1]||Math.min(...r)>=t[3])return!1;let i=[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]];for(let t=0;t<e.length;t++){let n=e[t],r=e[(t+1)%e.length],a=r[1]-n[1],o=n[0]-r[0],s=1/0,c=-1/0,l=1/0,u=-1/0;if(e.forEach(e=>{let t=e[0]*a+e[1]*o;s=Math.min(s,t),c=Math.max(c,t)}),i.forEach(e=>{let t=e[0]*a+e[1]*o;l=Math.min(l,t),u=Math.max(u,t)}),u<=s||l>=c)return!1}return!0}is2d(){return this._mode2d??((a.raw||{}).view||{}).mode===`2d`}bearing2d(){return-(((a.raw||{}).view||{}).bearing_2d||0)*Math.PI/180}minDist(){let e=(a.raw||{}).view||{};return this.zoomLocked()?this.home(!1).distance:e.max_zoom_in>0?Math.max(a.MIN_ZOOM_DISTANCE,this.home(!0).distance/e.max_zoom_in):a.MIN_DISTANCE}zoomLocked(){let e=+((a.raw||{}).view||{}).max_zoom_in;return e>0&&e<=1}holdLockedCamera(){if(!this.camGoal||!this.zoomLocked()||this._approach||this._flight&&this._flight.approach)return;let e=this.home(!1);[`targetX`,`targetY`,`targetZ`,`distance`,`azimuth`,`polar`].forEach(t=>{e[t]!=null&&(this.camGoal[t]=e[t])}),this._drift=null,this._inertia=null}maxZoomIn(){return this.home(!0).distance/this.minDist()}static MIN_ZOOM_DISTANCE=4;maxDist(){let e=(a.raw||{}).view||{},t=this.home(!0).distance;return this.zoomLocked()?this.home(!1).distance:e.max_zoom_out?t*e.max_zoom_out:Math.max(320,t*1.6)}fitDist(e,t,n){return this.zoomedFocus(this.autoFocusDist(e,t),n)}autoFocusDist(e,t){if(t||=this.home(!1),!e||!e.length)return t.distance/1.9;let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.hypot(Math.max(...n)-Math.min(...n),Math.max(...r)-Math.min(...r))*.85,o=Math.min(1,(this._width||1200)/(this._height||780));return Math.max(this.minDist(),Math.min(t.distance/1.25,a.FOCUS_MIN_DISTANCE),Math.min(t.distance/1.25,i/(2*a.FOV_TAN*o*.35)))}placeMaxZoom(e){let t=!(this._byId&&this._byId[e])&&this.pointStore(e);t&&(e=t.pts[0].id);let n=this._byId&&this._byId[e],r=!n&&this._features&&this._features.get(e);if(!n&&!r)return 100;let i=n&&n.item?this.autoFocusDist(n.item.poly,this.home(!1)):this.home(!1).distance/1.9;return Math.max(100,Math.ceil(i/this.minDist()*100/5)*5)}focusZoomFactor(e){let t=this._pickZoom;if(t!=null&&+t>0)return+t;let n=e&&this._unitById&&this._unitById[e],r=e&&this._byId&&this._byId[e],i=!r&&e&&this._features&&this._features.get(e),o=r&&r.item&&r.item.store?r.item.store.loc:i&&i.location?(a.locations||{})[i.location]:null,s=+(n&&n.focusZoom||o&&typeof o==`object`&&o.zoom||100);return s>0?Math.max(.25,s/100):1}focusAbs(e){let t=e&&this._unitById&&this._unitById[e],n=e&&this._byId&&this._byId[e],r=!n&&e&&this._features&&this._features.get(e),i=n&&n.item&&n.item.store?n.item.store.loc:r&&r.location?(a.locations||{})[r.location]:null;return+(t&&t.focusX)||+(i&&typeof i==`object`&&i.focus_zoom)||0}zoomedFocus(e,t){let n=e=>Math.max(this.minDist(),Math.min(this.maxDist(),e)),r=this._pickZoom;if(r!=null&&+r>0)return n(e/+r);let i=this.focusAbs(t);if(i>0)return n(this.home(!0).distance/i);let a=this.focusZoomFactor(t);return a===1?e:n(e/a)}static FOCUS_MIN_DISTANCE=70;static TILT_RESET_MS=1200;static GLASS_REST_MS=200;static flightEase(e,t){return e&&e.ease===`out`?1-(1-t)**3:t<.5?4*t*t*t:1-(-2*t+2)**3/2}goHome(e){this._drift=null;let t=this.home(e),n=this.camView;n&&!this._reducedMotion&&(this._flight={t0:performance.now(),dur:800,a:Object.assign({},n)}),t.azimuth+=2*Math.PI*Math.round((n.azimuth-t.azimuth)/(2*Math.PI)),Object.assign(this.camGoal,t)}applyViewShift(e,t){let n=!this._uiHidden&&this._insets||{},r=((n.left||0)-(n.right||0))/2,i=((n.top||0)-(n.bottom||0))/2,o=this._shift=this._shift||{x:0,y:0},s=this._flight,c=this._reducedMotion?1:1-Math.exp(-(t||.016)/.06);if(s&&!this._reducedMotion){let e=Math.min(1,(performance.now()-s.t0)/s.dur),t=a.flightEase(s,e),n=s.shiftE||0;c=t>=1||n>=1?1:Math.max(0,(t-n)/(1-n)),s.shiftE=t}o.x+=(r-o.x)*c,o.y+=(i-o.y)*c,Math.abs(r-o.x)<.5&&(o.x=r),Math.abs(i-o.y)<.5&&(o.y=i);let l=e.uuid+`|`+o.x.toFixed(1)+`|`+o.y.toFixed(1);if(l===this._shiftKey)return;this._shiftKey=l;let u=Math.max(1,this._width||1),d=Math.max(1,this._height||1);!o.x&&!o.y?e.clearViewOffset&&e.clearViewOffset():e.setViewOffset(u,d,-o.x,-o.y,u,d),e.updateProjectionMatrix()}applyProps(){this.renderer&&(this.sun.castShadow=this.opt(`shadows`,!0),this.sun.shadow.intensity=Math.max(0,Math.min(1,(+this.opt(`shadowStrength`,100)||100)/100)))}static SLAB_CLEARANCE=.02;squashUnits(){let e=a,t=this.levelViews;if(!(e.unitsFlat||!this._units||t.length<2)){if(!this._tallUnits){let n=e.storeyHeight-e.FLOOR_TOP-e.SLAB_CLEARANCE;this._tallUnits=this._units.filter(r=>r.grp&&r.levelIndex<t.length-1&&r.top-(r.base??e.FLOOR_TOP)>n)}this._tallUnits.forEach(n=>{let r=t[n.levelIndex+1],i=n.base??e.FLOOR_TOP,a=n.top-i,o=r.group.visible?r.y-t[n.levelIndex].y-i-e.SLAB_CLEARANCE:1/0,s=o<a?Math.max(.05,o/a):1;Math.abs(n.grp.scale.y-s)<1e-4||(n.grp.scale.y=s,n.grp.position.y=i*(1-s))})}}levelGoal(e,t,n){if(t.all)return{y:(e-(a.levelNames.length-1)/2)*n,opacity:1};let r=e-t.level;return r<=0?{y:r*a.storeyHeight,opacity:1}:{y:r*a.storeyHeight+8,opacity:0}}unitColorsOf(e,t){let n=a,i=e.r||{},o=i.loc&&(typeof i.loc==`object`?i.loc:n.locations[i.loc]),s=o&&r.mainCategory(o.category)||i.fileCategory,c=(o&&o.id||``)+`|`+(s||``)+`|`+r.scheme;if(e.pcK!==c){e.pcK=c;let t=s&&(n.categories||[]).find(e=>e.id===s),i=o&&o.mapplic&&o.mapplic.colors||t&&t.colors,a=r.scheme===`dark`,l=i&&a?i.dark||n.darkColorSet(i):i,u=this.THREE,d=e=>e.map(e=>new u.Color(e));e.pc=l&&l.default?{n:d(l.default),h:d(l.hover||l.default),f:l.focus&&d(l.focus),fh:(l.focus_hover||l.focus)&&d(l.focus_hover||l.focus)}:null}let l=e.pc;return l&&(t===`nb`||t===`am`)?l.n:l&&t===`hv`?l.h:l&&t===`ft`&&l.f?l.f:l&&t===`fs`&&l.fh?l.fh:this._paletteColors[t]}static darkColorSet(e){let t={};return[`default`,`hover`,`focus`,`focus_hover`].forEach(n=>{Array.isArray(e[n])&&(t[n]=r.darkColors(e[n]))}),t}levelSpacing(){let e=a,t=this.appearanceOwn(`level_spacing`);if(t!=null)return+t;let n=this.opt(`spacing`,null);if(n!=null)return+n;let r=this.opt(`gap`,null);return r!=null&&e.levelSpan?r/10/e.levelSpan*100:12}levelGapPx(){let e=a;return e.levelSpan?this.levelSpacing()/100*e.levelSpan*10:this.opt(`gap`,140)}groupKeyOf(e){let t=e&&this._unitById&&this._unitById[e];if(!t)return e;if(t.groupKey===void 0){let n=t.r&&t.r.featureId;t.groupKey=n==null?e:String(n).replace(/~\d+$/,``)}return t.groupKey}groupParts(e){let t=this._byId||{};return this._groupsSource!==t&&(this._groupsSource=t,this._groupMembers={},this._groupRepCache={},Object.keys(t).forEach(e=>{let t=this.groupKeyOf(e);(this._groupMembers[t]=this._groupMembers[t]||[]).push(e)})),this._groupMembers[this.groupKeyOf(e)]||[e]}linkKeyOf(e){let t=this._byId||{};if(this._linkKeySource!==t&&(this._linkKeySource=t,this._linkKeys={}),!(e in this._linkKeys)){let n=t[e]&&t[e].item&&t[e].item.store;this._linkKeys[e]=n&&n.loc&&n.loc.id||null}return this._linkKeys[e]}groupRep(e){if(!e||!this._byId||!this._byId[e])return e;let t=this.groupParts(e);if(t.length<2)return e;let n=this._groupRepCache,r=this.groupKeyOf(e);return n[r]||(n[r]=t.reduce((e,t)=>this.unitArea(t)>this.unitArea(e)?t:e))}unitArea(e){let t=((this._byId[e]||{}).item||{}).poly||[],n=0;for(let e=0,r=t.length-1;e<t.length;r=e++)n+=(t[r][0]-t[e][0])*(t[r][1]+t[e][1]);return Math.abs(n)}paletteKeyOf(e,t){if(!e.id)return e.kind;let n=this.groupKeyOf(e.id),r=a.LINKED_HIGHLIGHT?this.linkKeyOf(e.id):null,i=e.id===t.selected||t.selected&&n===this.groupKeyOf(t.selected)||r&&t.selected&&r===this.linkKeyOf(t.selected),o=!i&&!!(this._highlights&&(this._highlights.has(e.id)||[...this._highlights].some(e=>this.groupKeyOf(e)===n))),s=i||o,c=e.id===t.hovered||t.hovered&&n===this.groupKeyOf(t.hovered)||r&&t.hovered&&r===this.linkKeyOf(t.hovered),l=o&&this._highlightTints&&this._highlightTints.get(n);return e.highlightTint=l?this.highlightPalette(l):this.categoryPaletteOf(e),s?c?`fs`:`ft`:e.am?c?`hv`:`am`:c?`hv`:`nb`}highlightPalette(e){let t=e+`|`+r.scheme,n=this._highlightPalettes=this._highlightPalettes||{};if(!n[t]){let i=r.accentUnits(e,r.scheme===`dark`),a=this.THREE;n[t]={hv:i.hv.map(e=>new a.Color(e)),ft:i.ft.map(e=>new a.Color(e)),fs:i.fs.map(e=>new a.Color(e))}}return n[t]}unitStates(){let e=this.props.unitStates||this.appearanceOwn(`unit_states`);return[`category_hover`,`category`].includes(e)?e:`accent`}setUnitStates(e){if(![`accent`,`category_hover`,`category`].includes(e))throw Error(`unitStates must be 'accent', 'category_hover' or 'category'`);return this.props=Object.assign({},this.props,{unitStates:e}),e}categoryPaletteOf(e){let t=this.unitStates();if(t===`accent`||e.am)return null;let n=this._byId&&this._byId[e.id],i=n&&n.item&&n.item.store,a=i&&i.loc;if(!a||a.amenity)return null;let o=String(a.category||``);if(!e._category||e._category.key!==o){let t=r.categoryList(a.category)[0],n=t&&(r.categories||[]).find(e=>e.id===t);e._category={key:o,color:n&&r.hexRgb(n.color)?n.color:null}}let s=e._category.color;if(!s)return null;let c=this.highlightPalette(s);return t===`category`?c:{hv:c.hv}}hitTest(e){let t=this.state,n=[];this._raycaster.setFromCamera(e,this.camera),this.levelViews.forEach((e,r)=>{!e.group.visible||e.opacity<.5||(n.push(...e.occluders.filter(e=>e.visible)),(t.all||r===t.level)&&n.push(...e.units.filter(e=>e.visible&&!e.userData.inert)))}),(this._features||new Map).forEach(e=>{if(e.meshes){let t=e.meshes();t&&t.length&&n.push(...t)}}),this.levelViews[0].group.visible&&this.levelViews[0].opacity>.5&&this.levelViews[0].group.traverse(e=>{e.userData&&e.userData.scn&&n.push(e)});let r=this._raycaster.intersectObjects(n,!1)[0],i=r&&r.object.userData,a=i&&i.feat&&this._features&&this._features.get(i.feat);return r?{id:i.id||i.scn||(a?a.resolve?a.resolve(r.object):i.feat:null),point:r.point}:null}loop=e=>{if(this._frameId=requestAnimationFrame(this.loop),this._themeTween&&this.stepThemeTween(e),!this.renderer||(document.hidden||!this._visible)&&!this._forceFrame){this._lastFrameTime=e;return}let t=a;this.THREE;let n=Math.min(.05,(e-(this._lastFrameTime||e))/1e3),r=this._flight,i=r&&r.explode&&!this._reducedMotion&&e-r.t0<r.dur*r.explode?Object.assign({},this.state,{all:!0}):this.state,o=this._reducedMotion;t.FLOOR_TOP,this._lastFrameTime=e,this.holdLockedCamera();let s=o?1:1-Math.exp(-n*7),c=o?1:1-Math.exp(-n*9),l=o?1:1-Math.exp(-n*15),u=this.levelGapPx()/10,d=!o&&this.settingOn(`scenery`,`connectorsMoving`),f=!o&&this.settingOn(`scenery`,`carsMoving`);this.levelViews.forEach((e,t)=>{let n=this.levelGoal(t,i,u),r=e.placed?s:1;e.placed=!0,e.y+=(n.y-e.y)*r,e.opacity+=(n.opacity-e.opacity)*r,Math.abs(n.y-e.y)<.001&&(e.y=n.y),Math.abs(n.opacity-e.opacity)<.001&&(e.opacity=n.opacity),e.group.position.y=e.y,e.group.visible=e.opacity>.01,(e.y!==n.y||e.opacity!==n.opacity)&&(this._busyFrame=!0);let a=e.opacity<.999,o=a&&n.opacity<.5;(a!==e.transparent||o!==e.fadingOut)&&(e.transparent=a,e.fadingOut=o,e.mats.forEach(e=>{e.transparent=a||(e.userData.o0??1)<1,e.userData.dw0===void 0&&(e.userData.dw0=e.depthWrite),e.depthWrite=!o&&e.userData.dw0,e.needsUpdate=!0}),e.group.traverse(t=>{let n=t.material;if(!n||Array.isArray(n))return;let r=n.userData.o0===void 0?!(n.transparent&&!e.mats.includes(n)):n.userData.o0>=1;a&&r&&t.userData.ro0===void 0?(t.userData.ro0=t.renderOrder,t.renderOrder-=10):!a&&t.userData.ro0!==void 0&&(t.renderOrder=t.userData.ro0,delete t.userData.ro0)})),e.opacity!==e.appliedOpacity&&(e.appliedOpacity=e.opacity,e.depthMaterial&&(e.depthMaterial.opacity=e.opacity),e.mats.forEach(t=>t.opacity=(t.userData.o0??1)*e.opacity))}),this.squashUnits(),this._levelRise+=((i.all?u:t.storeyHeight)-this._levelRise)*s,this._explodeBlend+=(+!!i.all-this._explodeBlend)*s,Math.abs(+!!i.all-this._explodeBlend)<.001&&(this._explodeBlend=+!!i.all);let p=this._inertia;if(p&&!this._drag){let e=(e,t,n)=>Math.max(t,Math.min(n,e));p.pan?this.panBy(p.vx*n,p.vz*n):(this.camGoal.azimuth+=p.va*n,this.camGoal.polar=e(this.camGoal.polar+p.vp*n,.12,1.38));let t=Math.exp(-n*(p.pan?6:9));p.vx*=t,p.vz*=t,p.va*=t,p.vp*=t,Math.abs(p.vx)+Math.abs(p.vz)<.2&&Math.abs(p.va)+Math.abs(p.vp)<.01&&(this._inertia=null)}if(!this._drag&&this.camGoal){let e=this.camGoal,[t,r,i,a]=this.panLimit(),s=Math.max(t,Math.min(r,e.targetX)),c=Math.max(i,Math.min(a,e.targetZ));if(s!==e.targetX||c!==e.targetZ){let t=o?1:1-Math.exp(-n*12);e.targetX+=(s-e.targetX)*t,e.targetZ+=(c-e.targetZ)*t,Math.abs(s-e.targetX)+Math.abs(c-e.targetZ)<.01&&(e.targetX=s,e.targetZ=c)}}let m=this._approach;if(m&&this.state.shown&&this.camView&&this.camGoal){this._approach=null;let t=this.camGoal,n=this.is2d(),r=this._drift;r&&r.t0!=null&&(t.azimuth=r.azimuth,t.polar=r.polar,r.t0=null);let i=Object.assign({},t,{distance:t.distance*m.height,polar:n?t.polar:Math.min(t.polar,a.APPROACH_POLAR),azimuth:t.azimuth+(n?0:m.turn)});Object.assign(this.camView,i),this._flight={t0:e,dur:m.dur,a:i,ease:`out`,log:!0,approach:!0},this._busyFrame=!0}let h=this.camView,g=this.camGoal,_=this._flight;if(this.is2d()){let e=this.bearing2d();g.polar=0,g.azimuth=e+2*Math.PI*Math.round((g.azimuth-e)/(2*Math.PI))}_&&(o||i.drag||this._inertia)&&(this._flight=null);let v=this._tiltEase;if(v&&(o||this.is2d()||this._flight))this._tiltEase=null;else if(v){let t=Math.min(1,(e-v.t0)/a.TILT_RESET_MS),n=t*t*(3-2*t);g.polar=h.polar=v.from+(v.to-v.from)*n,t>=1&&(this._tiltEase=null)}let y=this._drift;if(y&&(o||i.drag||this._inertia||this.is2d()))this._drift=null;else if(y&&!this._flight){y.t0??Object.assign(y,{t0:e,azimuth:g.azimuth,polar:g.polar});let t=Math.min(1,(e-y.t0)/y.dur),n=t*t*(3-2*t);g.azimuth=y.azimuth+y.turn*n,y.tilt&&(g.polar=Math.max(.12,Math.min(1.38,y.polar+y.tilt*n)))}if(this._flight){let t=Math.min(1,(e-_.t0)/_.dur),n=a.flightEase(_,t);for(let e in g)h[e]=_.a[e]+(g[e]-_.a[e])*n;_.log&&_.a.distance>0&&g.distance>0&&(h.distance=_.a.distance*(g.distance/_.a.distance)**+n),_.peak&&(h.distance+=_.peak*Math.sin(Math.PI*n)),t>=1&&(this._flight=null)}else for(let e in g)h[e]+=(g[e]-h[e])*c;let b=this.camera,x=Math.sin(h.polar);b.position.set(h.targetX+h.distance*x*Math.sin(h.azimuth),h.targetY+h.distance*Math.cos(h.polar),h.targetZ+h.distance*x*Math.cos(h.azimuth)),h.polar<.05?b.up.set(-Math.sin(h.azimuth),0,-Math.cos(h.azimuth)):b.up.set(0,1,0),b.lookAt(h.targetX,h.targetY,h.targetZ);{let e=.2,t=Math.cos(h.azimuth),n=Math.sin(h.azimuth);t<-.2?this._flipH=!0:t>e&&(this._flipH=!1),n<-.2?this._flipV=!0:n>e&&(this._flipV=!1)}let S=i.all?0:Math.max(0,Math.min(1,(+this.opt(`dimBelow`,70)||0)/100)),C=this._washColor||=new this.THREE.Color(t.scenePalette.background),w=this._floorColor||=new this.THREE.Color(t.floorColors[0]),T=this._tmpColor0||=new this.THREE.Color,E=this._tmpColor1||=new this.THREE.Color;(this.levelViews||[]).forEach((e,t)=>{e.slab&&e.slab.material.color.lerp(t<i.level&&S?T.copy(w).lerp(C,S):w,l)});let D=this.settingOn(`wayfinding`,`storefronts`);this._units.forEach(e=>{let t=this.paletteKeyOf(e,i),n=(t===`nb`||t===`hv`||t===`am`)&&this._tints&&this._tints[e.id]?this._tints[e.id]:e.highlightTint&&e.highlightTint[t]?e.highlightTint[t]:this.unitColorsOf(e,t),r=e.levelIndex<i.level?S:0;e.m.material.color.lerp(r?T.copy(n[0]).lerp(C,r):n[0],l),e.line.material.color.lerp(r?E.copy(n[1]).lerp(C,r*.85):n[1],l);{let n=t===`fs`?3:t===`hv`?2:+(t===`ft`);e.fr!==n&&(e.fr=n,e.line.position.y=n*.004,e.line.userData.rankU&&(e.line.userData.rankU.value=n),[e.line,e.m].forEach(e=>{e.userData.ro0===void 0?e.renderOrder=n:(e.userData.ro0=n,e.renderOrder=n-10)}))}if(e.opM){let n=e.storefrontStyle.show,r=D&&!e.hid&&(n===`always`||t===`hv`||t===`fs`||t===`ft`),i=+e.storefrontStyle.tint||0;e.storefrontAlpha+=(+!!r-e.storefrontAlpha)*l,e.opFix?e.opM.color.copy(e.opFix):(e.opM.color.copy(e.m.material.color),i<0?e.opM.color.multiplyScalar(1+i):i>0&&e.opM.color.lerp(this._white||=new this.THREE.Color(`#ffffff`),i)),e.opM.opacity=e.storefrontAlpha*(this.levelViews[e.levelIndex].opacity??1),e.storefrontGroup.visible=e.storefrontAlpha>.01}(e.ink||=n[2].clone()).lerp(n[2],l)}),o||(this._clock=(this._clock||0)+n),d&&(this._escalatorTime=(this._escalatorTime||0)+n),f&&(this._carTime=(this._carTime||0)+n);{let e=(this._escalatorTime||0)*1.4%1;(this._escalatorTextures||[]).forEach(t=>{t.still||(t.t.offset.x=t.up?e:1-e)})}if(this._clock,this._hoverDirty&&!this._drag){this._hoverDirty=!1;let e=this._hovOver?null:this.hitTest(this._pointerNdc),t=this.groupRep(this._hovOver||(e?e.id:null));t!==i.hovered&&this.setState({hovered:t})}let O=this.home(i.all),k=this._homePrev;k&&!this._awayFromHome&&!this._flight&&!this._drag&&!this._inertia&&(Math.abs(k.distance-O.distance)>.001||Math.abs(k.targetX-O.targetX)+Math.abs(k.targetZ-O.targetZ)>.001)&&(Object.assign(g,{targetX:O.targetX,targetY:O.targetY,targetZ:O.targetZ,distance:O.distance}),(!i.ready||e-(this._homeT0||e)<a.HOME_SNAP_MS)&&Object.assign(h,{targetX:O.targetX,targetY:O.targetY,targetZ:O.targetZ,distance:O.distance})),i.ready&&!this._homeT0&&(this._homeT0=e),this._homePrev=O;let A=Math.abs(g.distance-O.distance)>1||Math.abs(((g.azimuth-O.azimuth)%(2*Math.PI)+3*Math.PI)%(2*Math.PI)-Math.PI)>.02||Math.abs(g.polar-O.polar)>.02||Math.hypot(g.targetX-O.targetX,g.targetZ-O.targetZ)>.5;if(this._awayFromHome=A,A!==i.awayFromHome&&this.setState({awayFromHome:A}),b.updateMatrixWorld(),this.busyTick(b,e),this.camTick(),this.applyViewShift(b,n),this.plugFrame(n,e),b.isPerspectiveCamera){let e=this._focusTarget=this._focusTarget||new this.THREE.Vector3;e.set(this.camView.targetX||0,this.camView.targetY||0,this.camView.targetZ||0);let t=b.position.distanceTo(e),n=Math.max(.5,Math.min(4,t*.02)),r=Math.max(2e3,t*4);(Math.abs(b.near-n)>.001||Math.abs(b.far-r)>1)&&(b.near=n,b.far=r,b.updateProjectionMatrix())}this.renderFrame(b),this.overlays()};isBusy(){return!!this._busyOn}busyTick(e,t){let n=e.matrixWorld.elements,r=this._busyMat||=n.slice(),i=e.projectionMatrix.elements,o=this._busyProj||=i.slice(),s=!!(this._busyFrame||this._drag||this._themeTween);this._busyFrame=!1;for(let e=0;e<16;e++)(Math.abs(n[e]-r[e])>1e-6||Math.abs(i[e]-o[e])>1e-6)&&(s=!0),r[e]=n[e],o[e]=i[e];s&&(this._busyUntil=t+a.GLASS_REST_MS);let c=t<(this._busyUntil||0);c!==!!this._busyOn&&(this._busyOn=c,this._viewport&&(c?this._viewport.setAttribute(`data-mp-busy`,`1`):this._viewport.removeAttribute(`data-mp-busy`)))}selectedId(){let e=this.state;return e.popupOpen&&e.selected?e.selected:e.scenerySelected||null}featureInfo(e){if(!e)return null;if(this.state,this._byId&&this._byId[e])return Object.assign({kind:`store`},this.info(this._byId[e].item.store));let t=this._features&&this._features.get(e);return t?Object.assign({kind:t.kind},t.info?t.info():{},{id:e}):null}spotOf(e){let t=this._byId&&this._byId[e],n=this._builtinPlugins&&this._builtinPlugins.labels,r=n&&n.active&&n.exports&&n.exports.at;return(r?r(e):null)||(t?[t.item.cx,t.item.cz]:null)}anchor(e){if(!this.levelViews||!e)return null;this.state;let t=this._tmpVec,n=()=>(t.project(this.camera),{x:(t.x+1)/2*this._width,y:(1-t.y)/2*this._height,visible:t.z<1&&(!this._bleed||this.ndcVisible(t))}),r=this._features&&this._features.get(e);if(r&&r.anchor){let e=r.anchor();return e?(t.set(e[0],e[1],e[2]),n()):null}let i=this._byId&&this._byId[e];if(!i)return null;let a=this._unitById&&this._unitById[e]&&this._unitById[e].grp,[o,s]=this.spotOf(e);return a?(a.updateWorldMatrix(!0,!1),t.set(o,i.item.top,s).applyMatrix4(a.matrixWorld)):t.set(o,this.levelViews[i.levelIndex].y+i.item.top,s),n()}overlays(){this.state;let e=this._width,t=this._height,n=this.camera,r=this._tmpVec,i=a.FLOOR_TOP,o=this.levelViews,s=this._byId,c=(i,a,o)=>(r.set(i,a,o).project(n),[(r.x+1)/2*e,(1-r.y)/2*t]),l=(e,t)=>{e&&(e.style.transform=`translate(`+t[0].toFixed(1)+`px,`+t[1].toFixed(1)+`px)`)},u=e=>{let t=s[e],n=this._unitById&&this._unitById[e]&&this._unitById[e].grp,[i,a]=this.spotOf(e);return n?(n.updateWorldMatrix(!0,!1),r.set(i,t.item.top,a).applyMatrix4(n.matrixWorld),c(r.x,r.y,r.z)):c(i,o[t.levelIndex].y+t.item.top,a)},d=e=>this._features&&this._features.get(e),f=e=>{let t=e.anchor();return t?c(t[0],t[1],t[2]):null},p=e=>s[e]?u(e):d(e)&&d(e).anchor?f(d(e)):null,m=this._builtinPlugins&&this._builtinPlugins.markers&&this._builtinPlugins.markers.active&&this._builtinPlugins.markers.exports&&this._builtinPlugins.markers.exports.top;this._tooltipSlots&&this._tooltipSlots.s.forEach((e,t)=>{let n=e&&p(e);if(!n)return;let r=m?m(e):null;r!=null&&r-2<n[1]&&(n[1]=r-2),l(this._tE[t],n)}),(this._tg||[]).forEach((e,t)=>{let n=o[t];if(!n)return;if(!n.footprint)return l(e,c(0,n.y+i,37));let a=n.slab.matrixWorld,s=(e,t)=>(r.set(e,i,t).applyMatrix4(a),c(r.x,r.y,r.z));n.slab.updateWorldMatrix(!0,!1);let u=1/0;n.footprint.forEach(e=>{let t=s(e[0],-e[1]);t[0]<u&&(u=t[0])}),l(e,[u,s(n.footprintCenter[0],-n.footprintCenter[1])[1]])})}navGrid(){if(this._navGrid)return this._navGrid;let e=a,t=e.source(),n=.5,r=t.floorPolys.flat(),i=Math.floor(Math.min(...r.map(e=>e[0])))-2,o=Math.floor(Math.min(...r.map(e=>e[1])))-2,s=Math.ceil((Math.max(...r.map(e=>e[0]))+2-i)/n),c=Math.ceil((Math.max(...r.map(e=>e[1]))+2-o)/n),l=s*c,u=[],d=[],f=(e,t,n,r)=>[[e,n],[t,n],[t,r],[e,r]],p=(t,r,a)=>{let l=r.map(e=>e[0]),u=r.map(e=>e[1]),d=Math.max(0,Math.floor((Math.min(...l)-i)/n)),f=Math.min(s-1,Math.ceil((Math.max(...l)-i)/n)),p=Math.max(0,Math.floor((Math.min(...u)-o)/n)),m=Math.min(c-1,Math.ceil((Math.max(...u)-o)/n));for(let c=p;c<=m;c++)for(let l=d;l<=f;l++)e.pointInPolygon(r,i+(l+.5)*n,o+(c+.5)*n)&&(t[c*s+l]=a)},m=[];for(let n=0;n<e.levelNames.length;n++){let r=new Uint8Array(l),i=[],o=e=>{p(r,e,0);let t=e.map(e=>e[0]),n=e.map(e=>e[1]);i.push({P:e,u0:Math.min(...t),u1:Math.max(...t),v0:Math.min(...n),v1:Math.max(...n)})};p(r,t.floorPolys[n],1),t.unitRows[n].forEach(e=>o(e.points||f(e.u0,e.u1,e.v0,e.v1))),t.voidPolys[n].forEach(e=>o(e)),t.connectors.forEach(t=>{(t.type===`elevator`?t.layers.includes(n):t.layers[0]===n)&&o(e.connectorPolygon(t))}),a.fixtures.filter(e=>e.levelIndex===n&&e.kind===`table`).forEach(({u:e,v:t})=>o(f(e-.6,e+.6,t-.6,t+.6))),m.push(i);let h=new Uint8Array(l).fill(255),g=new Int32Array(l),_=0,v=0;for(let e=0;e<l;e++)r[e]||(h[e]=0,g[v++]=e);for(;_<v;){let e=g[_++],t=e%s,n=(e-t)/s,r=h[e]+1;if(!(r>6))for(let e=-1;e<=1;e++)for(let i=-1;i<=1;i++){let a=t+i,o=n+e;if(a<0||o<0||a>=s||o>=c)continue;let l=o*s+a;h[l]>r&&(h[l]=r,g[v++]=l)}}u.push(r),d.push(h)}let h=(e,t,r)=>{let a=Math.floor((t-i)/n),c=Math.floor((r-o)/n);for(let t=0;t<16;t++){let n=-1,r=1e9;for(let i=-t;i<=t;i++)for(let o=-t;o<=t;o++){if(Math.max(Math.abs(o),Math.abs(i))!==t)continue;let l=(c+i)*s+a+o;if(u[e][l]){let e=o*o+i*i;e<r&&(r=e,n=l)}}if(n>=0)return n}return-1};for(let t=0;t<e.levelNames.length;t++){let e=u[t],n=new Int32Array(l),r=new Int32Array(l),i=0,a=0,o=0;for(let t=0;t<l;t++){if(!e[t]||n[t])continue;i++;let l=0,u=0;for(n[t]=i,r[u++]=t;l<u;){let t=r[l++],a=t%s,o=(t-a)/s;a+1<s&&e[t+1]&&!n[t+1]&&(n[t+1]=i,r[u++]=t+1),a>0&&e[t-1]&&!n[t-1]&&(n[t-1]=i,r[u++]=t-1),o+1<c&&e[t+s]&&!n[t+s]&&(n[t+s]=i,r[u++]=t+s),o>0&&e[t-s]&&!n[t-s]&&(n[t-s]=i,r[u++]=t-s)}u>o&&(o=u,a=i)}for(let t=0;t<l;t++)e[t]&&n[t]!==a&&(e[t]=0)}let g=new Map,_=(e,t,n,r,i,a)=>{[[e,t],[t,e]].forEach(([e,t])=>{g.has(e)||g.set(e,[]),g.get(e).push({to:t,cost:n,kind:r,lp:i,stepFree:a})})};return t.connectors.forEach(t=>{if(t.type===`elevator`)return;let[n,r]=t.layers,i=t.axisX*t.upSign,a=t.axisZ*t.upSign,o=t.length/2+.6,s=t.type===`stairs`?e.stairLayout(t):null,c=s?s.low:[t.centerX-i*o,t.centerZ-a*o],u=s?s.high:[t.centerX+i*o,t.centerZ+a*o],d=h(n,c[0],c[1]),f=h(r,u[0],u[1]);if(d<0||f<0)return;let p=n*l+d,m=r*l+f,_=t.type===`stairs`,v=_?`stairs`:`esc`,y=_?30:22,b=e=>{let t=Math.hypot(e[0],e[1])||1;return[e[0]/t,e[1]/t]},x=t.length/2,S=s?[s.start,b([-s.sd[0],-s.sd[1]])]:[[t.centerX-i*x,t.centerZ-a*x],[-i,-a]],C=s?[s.end,b(s.ed)]:[[t.centerX+i*x,t.centerZ+a*x],[i,a]],w=(e,n,r,i)=>{g.has(e)||g.set(e,[]),g.get(e).push({to:n,cost:y,kind:v,m0:r,m1:i,cid:t.id})};_?(w(p,m,S,C),w(m,p,C,S)):t.dir===`down`?w(m,p,C,S):w(p,m,S,C)}),t.connectors.filter(e=>e.type===`elevator`).forEach(t=>{let n=a.levelNames.map((e,n)=>t.layers.includes(n)?h(n,t.centerX,t.centerZ):-1),r=e.connectorPolygon(t),i=t.accessible!==!1;for(let e=0;e<3;e++)for(let t=e+1;t<3;t++)n[e]>=0&&n[t]>=0&&_(e*l+n[e],t*l+n[t],28+8*(t-e),`lift`,r,i)}),this._navGrid={cellSize:n,originU:i,originV:o,cols:s,rows:c,cellCount:l,walk:u,clearance:d,conn:g,obstacles:m}}doors(e){let t=a,n=this.navGrid(),r=this._byId[e];if(!r)return[];let{cellSize:i,originU:o,originV:s,cols:c,rows:l,cellCount:u,walk:d}=n,f=r.item.poly,p=d[r.levelIndex],m=r.item.ops,h=f.map(e=>e[0]),g=f.map(e=>e[1]);for(let e of[1.1,2.5,5,9]){let n=[],a=[],d=Math.max(0,Math.floor((Math.min(...h)-e-o)/i)),_=Math.min(c-1,Math.ceil((Math.max(...h)+e-o)/i)),v=Math.max(0,Math.floor((Math.min(...g)-e-s)/i)),y=Math.min(l-1,Math.ceil((Math.max(...g)+e-s)/i));for(let l=v;l<=y;l++)for(let h=d;h<=_;h++){let d=l*c+h;if(!p[d])continue;let g=o+(h+.5)*i,_=s+(l+.5)*i;if(t.pointInPolygon(f,g,_))continue;let v=m?Math.min(...m.map(e=>t.closestPointOnPolygon(e,[g,_])[1])):t.closestPointOnPolygon(f,[g,_])[1];v<=e&&(n.push(r.levelIndex*u+d),a.push(v))}if(!n.length)continue;if(e===1.1)return n;let b=Math.min(...a);return n.filter((e,t)=>a[t]<=b+1.5*i)}return[]}route(e,t,n){let r=!!(n&&n.stepFree),i=a,{cellSize:o,originU:s,originV:c,cols:l,rows:u,cellCount:d,walk:f,clearance:p,conn:m,obstacles:h}=this.navGrid(),g=f.length*d,_=this.doors(e),v=new Set(this.doors(t));if(!_.length||!v.size)return null;let y=(e,t)=>{let n=new Float64Array(g).fill(1/0),i=new Int32Array(g).fill(-1),a=[],o=[],s=(e,t)=>{let n=a.length;for(a.push(e),o.push(t);n>0;){let e=n-1>>1;if(o[e]<=t)break;a[n]=a[e],o[n]=o[e],n=e}a[n]=e,o[n]=t},c=()=>{let e=a[0],t=a.pop(),n=o.pop();if(a.length){let e=0,r=a.length;for(;;){let t=2*e+1;if(t>=r||(t+1<r&&o[t+1]<o[t]&&t++,o[t]>=n))break;a[e]=a[t],o[e]=o[t],e=t}a[e]=t,o[e]=n}return e};e.forEach(e=>{n[e]=0,s(e,0)});let h=-1;for(;a.length;){let e=o[0],a=c();if(e>n[a])continue;if(t.has(a)){h=a;break}let g=Math.floor(a/d),_=a-g*d,v=_%l,y=(_-v)/l,b=f[g],x=p[g];for(let t=-1;t<=1;t++)for(let r=-1;r<=1;r++){if(!r&&!t)continue;let o=v+r,c=y+t;if(o<0||c<0||o>=l||c>=u)continue;let f=c*l+o;if(!b[f]||r&&t&&(!b[y*l+o]||!b[c*l+v]))continue;let p=x[f],m=e+(r&&t?1.4142:1)*(1+(p<=1?2.5:p===2?.8:p===3?.25:0)),h=g*d+f;m<n[h]&&(n[h]=m,i[h]=a,s(h,m))}(m.get(a)||[]).forEach(t=>{if(r&&!t.stepFree)return;let o=e+t.cost;o<n[t.to]&&(n[t.to]=o,i[t.to]=a,s(t.to,o))})}if(h<0)return null;let _=[];for(let e=h;e>=0;e=i[e])_.push(e);return _.reverse()},b=this._byId[e].levelIndex,x=null;if(b===this._byId[t].levelIndex&&String(e)>String(t)){let e=y(this.doors(t),new Set(_));e&&e.every(e=>Math.floor(e/d)===b)&&(x=e.reverse())}if(x||=y(_,v),!x)return null;let S=e=>[s+(e%l+.5)*o,c+(Math.floor(e/l)+.5)*o],C=(e,t)=>Math.floor((t-c)/o)*l+Math.floor((e-s)/o),w=[],T=null;x.forEach((e,t)=>{let n=Math.floor(e/d),r=e-n*d;if(!T||T.levelIndex!==n){if(T){let i=(m.get(x[t-1])||[]).find(t=>t.to===e);w.push({kind:i?i.kind:`esc`,from:T.levelIndex,to:n,a:T.cells[T.cells.length-1],b:r,mA:i&&i.m0,mB:i&&i.m1,cid:i&&i.cid,lp:i&&i.lp,stepFree:!!(i&&i.stepFree)})}T={kind:`walk`,levelIndex:n,cells:[]},w.push(T)}T.cells.push(r)});let E=(e,t,n,r=2)=>{let i=f[e],a=p[e],o=Math.min(r,a[C(...t)],a[C(...n)]),s=Math.hypot(n[0]-t[0],n[1]-t[1]),c=Math.ceil(s/.2);for(let e=0;e<=c;e++){let r=C(t[0]+(n[0]-t[0])*e/c,t[1]+(n[1]-t[1])*e/c);if(!i[r]||a[r]<o)return!1}return!0},D=(e,t,n)=>{let r=n[0]-t[0],i=n[1]-t[1],a=r*r+i*i,o=a?Math.max(0,Math.min(1,((e[0]-t[0])*r+(e[1]-t[1])*i)/a)):0;return Math.hypot(e[0]-t[0]-r*o,e[1]-t[1]-i*o)},O=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),k=(e,t,n,r)=>{let i=O(e,t,n),a=O(e,t,r),o=O(n,r,e),s=O(n,r,t);return i*a<0&&o*s<0?0:Math.min(D(e,n,r),D(t,n,r),D(n,e,t),D(r,e,t))},A=(e,t,n,r)=>{let a=Math.min(t[0],n[0])-r,o=Math.max(t[0],n[0])+r,s=Math.min(t[1],n[1])-r,c=Math.max(t[1],n[1])+r,l=r;for(let r of h[e])if(!(r.u1<a||r.u0>o||r.v1<s||r.v0>c)){if(i.pointInPolygon(r.P,t[0],t[1])||i.pointInPolygon(r.P,n[0],n[1]))return 0;for(let e=0;e<r.P.length;e++){let i=k(t,n,r.P[e],r.P[(e+1)%r.P.length]);if(i<l&&(l=i,!l))return 0}}return l},j=.55,M=(e,t,n)=>{let r=Math.min(j,A(e,t,t,j),A(e,n,n,j));return A(e,t,n,j)>=r-1e-6},N=(e,t)=>{if(t.length<3)return t;let n=t.map(t=>A(e,t,t,j)),r=t.map(t=>p[e][C(...t)]),i=[t[0]],a=0;for(;a<t.length-1;){let o=a+1,s=Math.min(n[a],n[o]),c=Math.min(r[a],r[o]);for(;o+1<t.length&&E(e,t[a],t[o+1],Math.min(2,c))&&A(e,t[a],t[o+1],j)>=Math.min(s,n[o+1])-1e-6;)s=Math.min(s,n[++o]),c=Math.min(c,r[o]);i.push(t[o]),a=o}return i},P=(e,t,n)=>{if(t.length<3)return t;let r=[t[0]];for(let i=1;i<t.length-1;i++){let a=t[i-1],o=t[i],s=t[i+1],c=Math.hypot(a[0]-o[0],a[1]-o[1]),l=Math.hypot(s[0]-o[0],s[1]-o[1]);if(c<1e-6||l<1e-6){r.push(o);continue}let u=i===1?c*.8:c/2,d=i===t.length-2?l*.8:l/2,f=null;for(let t=0,r=Math.min(n,u,d);t<4&&!f;t++,r/=2){let t=[o[0]+(a[0]-o[0])/c*r,o[1]+(a[1]-o[1])/c*r],n=[o[0]+(s[0]-o[0])/l*r,o[1]+(s[1]-o[1])/l*r],i=Math.max(1e-4,Math.min(A(e,t,o,j),A(e,o,n,j))*.8),u=[];for(let e=0;e<=6;e++){let r=e/6,i=1-r;u.push([i*i*t[0]+2*i*r*o[0]+r*r*n[0],i*i*t[1]+2*i*r*o[1]+r*r*n[1]])}u.every((t,n)=>!n||A(e,u[n-1],t,j)>=i)&&(f=u)}f?r.push(...f):r.push(o)}return r.push(t[t.length-1]),r},F=this._byId[e].item,I=this._byId[t].item,ee=(e,t)=>e.ops&&e.ops.length?e.ops.map(e=>i.closestPointOnPolygon(e,t)).sort((e,t)=>e[1]-t[1])[0][0]:i.closestPointOnPolygon(e.poly,t)[0],L=w.filter(e=>e.kind===`walk`),R=(e,t)=>{let n=null;return e.forEach((r,a)=>{let o=e[(a+1)%e.length],s=Math.hypot(o[0]-r[0],o[1]-r[1]);if(s<1e-6)return;let c=(o[0]-r[0])/s,l=(o[1]-r[1])/s,u=Math.min(s/2,.5*i.scale),d=Math.max(u,Math.min(s-u,(t[0]-r[0])*c+(t[1]-r[1])*l)),f=[r[0]+c*d,r[1]+l*d],p=Math.hypot(t[0]-f[0],t[1]-f[1]);(!n||p<n.d)&&(n={d:p,q:f})}),n?n.q:i.closestPointOnPolygon(e,t)[0]},z=2*i.scale,te=(e,t)=>{if(!(e.ops&&e.ops.length))return null;let n=e.ops.map(e=>[e,i.closestPointOnPolygon(e,t)[1]]).sort((e,t)=>e[1]-t[1])[0][0],r=n[0],a=n[1],o=Math.hypot(a[0]-r[0],a[1]-r[1])||1,s=(a[0]-r[0])/o,c=(a[1]-r[1])/o,l=Math.min(o/2,.5*i.scale),u=Math.max(l,Math.min(o-l,(t[0]-r[0])*s+(t[1]-r[1])*c)),d=[r[0]+s*u,r[1]+c*u];return n.n?[d,[d[0]+n.n[0]*B,d[1]+n.n[1]*B]]:null},B=z,V=0,H=(e,t,n)=>{let r=-1,i=0;for(let a=0;a<e.length&&(a&&(i+=Math.hypot(e[a][0]-e[a-1][0],e[a][1]-e[a-1][1])),!(i>3*z));a++)(e[a][0]-t[0])*n[0]+(e[a][1]-t[1])*n[1]<B*.999&&(r=a);let a=[t[0]+n[0]*B,t[1]+n[1]*B];for(;r>=0&&r+1<e.length&&!(E(V,a,e[r+1])&&M(V,a,e[r+1]));)r--;return e.slice(Math.min(r+1,e.length-1))},ne=(e,t)=>{if(!t.length)return t;let n=te(e,t[0]);if(!n){if(e.ops&&e.ops.length)return[ee(e,t[0]),...t];let n=R(e.poly,t[0]);return Math.hypot(n[0]-t[0][0],n[1]-t[0][1])>1.5*i.scale?t:[n,...t]}let r=n[0],a=[(n[1][0]-r[0])/B,(n[1][1]-r[1])/B];return[r,n[1],...H(t,r,a)]},re=(e,t)=>{let n=e[0],r=e[1],a=e=>(e[0]-n[0])*-r[1]+(e[1]-n[1])*r[0],o=e=>(e[0]-n[0])*r[0]+(e[1]-n[1])*r[1],s=Math.min(B,.75*i.scale),c=3*z,l=.25*i.scale,u=-1,d=0,f=0;for(let e=0;e+1<t.length&&(f+=Math.hypot(t[e+1][0]-t[e][0],t[e+1][1]-t[e][1]),!(f>6*z));e++){let n=a(t[e]),r=a(t[e+1]);if(n*r>0&&Math.min(Math.abs(n),Math.abs(r))>l)continue;let i=n===r?0:Math.max(0,Math.min(1,n/(n-r))),f=o(t[e])+i*(o(t[e+1])-o(t[e]));f>=s&&f<=c&&(u=e,d=f)}return u>=0?[n,[n[0]+r[0]*d,n[1]+r[1]*d],...t.slice(u+1)]:[n,[n[0]+r[0]*B,n[1]+r[1]*B],...H(t,n,r)]},ie=(e,t,n)=>{if(!e||!t.length)return null;let r=t.find(t=>i.closestPointOnPolygon(e,t)[1]>=z*1.2)||t[t.length-1],a=e.reduce((e,t)=>e+t[0],0)/e.length,o=e.reduce((e,t)=>e+t[1],0)/e.length,s=null;return e.forEach((t,c)=>{let l=e[(c+1)%e.length],u=Math.hypot(l[0]-t[0],l[1]-t[1]);if(u<1e-6)return;let p=(l[0]-t[0])/u,m=(l[1]-t[1])/u,h=(t[0]+l[0])/2,g=(t[1]+l[1])/2,_=[-m,p];(h-a)*_[0]+(g-o)*_[1]<0&&(_=[m,-p]);let v=Math.min(u/2,.5*i.scale),y=Math.max(v,Math.min(u-v,(r[0]-t[0])*p+(r[1]-t[1])*m)),b=[t[0]+p*y,t[1]+m*y],x=(r[0]-h)*_[0]+(r[1]-g)*_[1]>0,S=[1,1.5].every(e=>{let t=C(b[0]+_[0]*e*i.scale,b[1]+_[1]*e*i.scale);return t>=0&&t<d&&f[n][t]}),w=Math.hypot(r[0]-b[0],r[1]-b[1])+(x?0:1e6)+(S?0:1e7);(!s||w<s.d)&&(s={d:w,m:[b,_]})}),s&&s.m};w.forEach((e,t)=>{if(e.kind!==`lift`||!e.lp)return;let n=w[t-1],r=w[t+1];n&&n.cells&&(e.mA=ie(e.lp,n.cells.slice().reverse().map(S),e.from)),r&&r.cells&&(e.mB=ie(e.lp,r.cells.map(S),e.to))}),w.forEach((n,r)=>{if(n.kind===`walk`){let a=n.cells.map(S),o=a.reduce((e,t,n)=>n?e+Math.hypot(t[0]-a[n-1][0],t[1]-a[n-1][1]):0,0);B=Math.min(z,Math.max(.75*i.scale,o/3)),V=n.levelIndex;let s=w[r-1],c=w[r+1],l=n===L[0]?{item:F,key:`d:`+e}:s&&s.mB?{m:s.mB}:null,u=n===L[L.length-1]?{item:I,key:`d:`+t}:c&&c.mA?{m:c.mA}:null,d=e=>e?e.key||`m:`+e.m[0][0].toFixed(2)+`,`+e.m[0][1].toFixed(2):``,f=(e,t)=>e.item?[ne(e.item,t),1]:[re(e.m,t),2],p=(e,t,r)=>{let i=[],a=[];if(t){let[n,r]=f(t,e);e=n,i=e.splice(0,r)}if(r){let[t,n]=f(r,e.slice().reverse());e=t.reverse(),a=e.splice(-n)}return P(n.levelIndex,[...i,...N(n.levelIndex,e),...a],1.5)},m=d(l)>d(u)?p(a.slice().reverse(),u,l).reverse():p(a,l,u);n.uv=i.resample(m,.25),n.R=i.measurePolyline(n.uv),n.cum=n.R.cum,n.lenU=n.R.L,n.len=n.lenU}else n.A=n.mA?n.mA[0]:S(n.a),n.B=n.mB?n.mB[0]:S(n.b),n.len=5});let ae=0;w.forEach(e=>{e.s0=ae,ae+=e.len});let oe=i.levelNames,se=a.levelShortNames,U=this._byId[t].item.store.name,ce=[],le=[],ue=0,de=0,fe=0;w.forEach((e,t)=>{if(e.kind===`walk`){let n=Math.round(e.lenU/a.scale);if(ue+=n,n<4&&t>0&&t<w.length-1)return;let r=w[t+1],o=r?`walk_to_`+(r.kind===`lift`?`lift`:r.kind===`stairs`?`stairs`:`escalator`):`walk_to`;ce.push({tag:se[e.levelIndex],levelIndex:e.levelIndex,walkKey:o,metres:n,place:U,text:i.walkText(o,n,U)});return}e.kind===`lift`?fe++:de++;let n=e.to>e.from,r=ce[ce.length-1];if(r&&r.conn&&r.kind===e.kind&&r.up===n)r.to=e.to,r.badge.go=e.to;else{let t={levelIndex:e.from,p:e.A,go:e.to,kind:e.kind,up:n};le.push(t),ce.push({conn:!0,kind:e.kind,up:n,to:e.to,badge:t})}}),ce.forEach(e=>{if(!e.conn)return;let t=e.kind===`lift`?`lift`:e.kind===`stairs`?`stairs`:`escalator`,n=i.t(t+(e.up?`_up`:`_down`),{level:oe[e.to]});e.text=n,e.tag=i.t(`tag_`+t),e.levelIndex=e.to,e.badge.text=n});let pe=L[0],me=L[L.length-1];return{segs:w,total:ae,dur:Math.max(900,Math.min(2400,ae*28)),steps:ce,badges:le,A:{p:pe.uv[0],levelIndex:pe.levelIndex},B:{p:me.uv[me.uv.length-1],levelIndex:me.levelIndex},m:ue,min:Math.max(1,Math.round((ue/1.2+de*25+fe*45)/60)),via:fe&&de?i.t(`via_both`):fe?i.t(`via_lift`):de?i.t(`via_escalator`):``,stepFree:w.every(e=>e.kind===`walk`||e.stepFree)}}closePopups(e,t){clearTimeout(this._popupSwapTimer),this._liftPx=0,this.setState(Object.assign({popupOpen:!1,selected:null,scenerySelected:null},e||{}),t)}frontAzimuth(e){let t=this._byId&&this._byId[e],n=t&&t.item.ops,r=this.camGoal;if(!r||!t)return null;let i=e=>e+2*Math.PI*Math.round((r.azimuth-e)/(2*Math.PI)),a=t.item.faceDir;if((!n||!n.length)&&a)return i(Math.atan2(a[0],a[1]));if(!n||!n.length)return null;let o=0,s=0,c=0;return n.forEach(e=>{if(!e.n)return;let t=Math.hypot(e[1][0]-e[0][0],e[1][1]-e[0][1]);o+=e.n[0]*t,s+=e.n[1]*t,c+=t}),!c||Math.hypot(o,s)<.3*c?null:i(Math.atan2(o,s))}pick(e){if(this._drift&&this._drift.polar!=null&&this.camGoal&&(this.camGoal.polar=this._drift.polar),this._drift=null,this.camView&&!this._reducedMotion&&(this._flight={t0:performance.now(),dur:800,a:Object.assign({},this.camView)}),typeof e==`string`&&this._features&&this._features.has(e)){let t=this._features.get(e);if(t.pick&&t.pick()===!0)return;if((this._pendingState||this.state).scenerySelected===e)return this.closePopups();let n=t.focus?t.focus():t.anchor?t.anchor():null;if(n&&this.camGoal){let r=this.home(!1);Object.assign(this.camGoal,{targetX:n[0],targetY:n[1],targetZ:n[2],distance:t.location?this.zoomedFocus(r.distance/1.9,e):Math.min(this.state.all?r.distance:this.camGoal.distance,this.zoomedFocus(r.distance/1.9))})}return this.swapPopup({scenerySelected:e,popupOpen:!1,selected:null,hovered:null})}let t=this._pendingState||this.state,n=this.groupParts(e);n.length>1&&(e=this.groupRep(e));let r=this._byId[e];if(!r||(this._pickHandlers||[]).some(t=>{try{return t.fn(e)===!0}catch(e){return console.error(e),!1}}))return;if(!t.all&&t.selected===e&&t.popupOpen)return this.closePopups();let i=this.home(!1),a=n.length>1?n.flatMap(e=>(this._byId[e]||{}).item?this._byId[e].item.poly:[]):null,o=a&&[Math.min(...a.map(e=>e[0])),Math.max(...a.map(e=>e[0])),Math.min(...a.map(e=>e[1])),Math.max(...a.map(e=>e[1]))];if(Object.assign(this.camGoal,{targetX:o?(o[0]+o[1])/2:this.spotOf(r.item.store.id)[0],targetY:r.item.top,targetZ:o?(o[2]+o[3])/2:this.spotOf(r.item.store.id)[1],distance:this.fitDist(a||r.item.poly,i,e)}),this._focusBase={x:this.camGoal.targetX,z:this.camGoal.targetZ,dx:0,dz:0},t.all&&(this.camGoal.polar=i.polar),this.opt(`focusFront`,!1)||this._faceFront){let t=this.frontAzimuth(e);t!=null&&(this.camGoal.azimuth=t)}let s=t.popupOpen&&!t.all&&this._liftPx;this._liftPx=0,s&&this.liftFocus(s),this.swapPopup({all:!1,level:r.levelIndex,selected:e,popId:e,popupOpen:!0})}swapPopup(e){clearTimeout(this._popupSwapTimer);let t=this.state;if(!(t.popupOpen&&!t.all||t.scenerySelected!=null)||this._reducedMotion)return this.setState(e);this.setState({popupOpen:!1,scenerySelected:null}),this._popupSwapTimer=setTimeout(()=>this.setState(e),180)}componentDidMount(){this._reducedMotion=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,this._langObserver=new MutationObserver(()=>{this._langUser=null,this.applyLanguage()}),this._langObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`lang`]}),this.baseCss(`core`,a.CORE_CSS),this._scheme=this.resolvedScheme(),this.applySchemeAttrs(),window.matchMedia&&!this._schemeQuery&&(this._schemeQuery=window.matchMedia(`(prefers-color-scheme: dark)`),this._schemeListener=()=>{this.schemeSetting()===`auto`&&this.resolvedScheme()!==this._scheme&&this.setScheme(`auto`).catch(e=>console.warn(e))},this._schemeQuery.addEventListener&&this._schemeQuery.addEventListener(`change`,this._schemeListener)),this.baseCss(`keyframes`,`@keyframes mpSpin{to{transform:rotate(360deg)}}@keyframes mpPop{from{opacity:0;transform:scale(0.6)}to{opacity:1;transform:none}}@keyframes mpDirIn{from{opacity:0;transform:translateY(-6px) scale(0.98)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){@keyframes mpDirIn{from{opacity:1}to{opacity:1}}@keyframes mpPop{from{opacity:1}to{opacity:1}}}`),this._visible=!0,this._pointers=new Map,this._mq=window.matchMedia(`(pointer: coarse)`),this._mqf=()=>this.setState({coarse:this._mq.matches}),this._mqf(),this._mq.addEventListener&&this._mq.addEventListener(`change`,this._mqf),this._preventGesture=e=>e.preventDefault();let e=this._viewport;e&&(this._wheelHandler=e=>{if(this.wheelHook&&this.wheelHook(e)||!this.camGoal)return;if(this.wheelPasses(e)){this.wheelMode()===`modifier`&&Math.abs(e.deltaY)>Math.abs(e.deltaX)&&this.showWheelHint();return}e.preventDefault();let t=e.deltaY*(e.deltaMode===1?33:e.deltaMode===2?400:1);e.ctrlKey&&!e.metaKey&&e.deltaMode===0&&Math.abs(t)<25&&(t*=5),t=Math.max(-100,Math.min(100,t)),this.zoomAt(e.clientX,e.clientY,Math.exp(t*.0018))},e.addEventListener(`wheel`,this._wheelHandler,{passive:!1}),e.addEventListener(`gesturestart`,this._preventGesture),window.IntersectionObserver&&(this._intersectionObserver=new IntersectionObserver(e=>{this._visible=e.some(e=>e.isIntersecting)}),this._intersectionObserver.observe(e)),this.boot())}twoPointers(){let[e,t]=[...this._pointers.values()];return{d:Math.hypot(t.x-e.x,t.y-e.y),a:Math.atan2(t.y-e.y,t.x-e.x),mx:(e.x+t.x)/2,my:(e.y+t.y)/2}}panPixels(e,t){let n=this.camView,r=a,i=n.distance*2*r.FOV_TAN/this._height,o=n.azimuth,s=Math.cos(o),c=-Math.sin(o),l=-Math.sin(o),u=-Math.cos(o),d=1/Math.max(.45,Math.cos(n.polar)),f=-s*e*i+l*t*i*d,p=-c*e*i+u*t*i*d;return this.panBy(f,p),[f,p]}panBy(e,t){if(this.zoomLocked())return;let n=this.camGoal,r=this.camView,[i,a,o,s]=this.panLimit(),c=!!this._drag,l=Math.max(4,n.distance*.12),u=(e,t,n,r)=>{let i=e+t;if(i>=n&&i<=r)return i;let a=i>r?1:-1,o=a>0?r:n;if(a*t<=0)return i;if(!c)return a*(e-o)>0?e:o;let s=a>0?Math.max(e,r):Math.min(e,n),u=Math.min(l,a*(s-o)),d=a*(i-s);return o+a*l*(1-(1-u/l)*Math.exp(-d/l))};n.targetX=u(n.targetX,e,i,a),n.targetZ=u(n.targetZ,t,o,s),r.targetX=u(r.targetX,e,i,a),r.targetZ=u(r.targetZ,t,o,s)}panLimit(){let e=a.bounds;return[e[0]-5,e[1]+5,e[2]-5,e[3]+6]}zoomAt(e,t,n){if(this.zoomLocked())return;this._flight=null,this._drift=null;let r=this.camGoal,i=r.distance,a=Math.max(this.minDist(),Math.min(this.maxDist(),i*n));if(r.distance=a,!this.renderer||!this._viewport)return;let o=this.THREE,s=this._viewport.getBoundingClientRect(),c=new o.Vector2((e-s.left)/s.width*2-1,-((t-s.top)/s.height)*2+1);this._raycaster.setFromCamera(c,this.camera);let l=new o.Vector3;if(!this._raycaster.ray.intersectPlane(new o.Plane(new o.Vector3(0,1,0),-r.targetY),l))return;let u=l.x-r.targetX,d=l.z-r.targetZ,f=Math.hypot(u,d),p=i*.6;f>p&&(u*=p/f,d*=p/f);let m=1-a/i,h=(e,t,n)=>Math.max(t,Math.min(n,e)),[g,_,v,y]=this.panLimit();r.targetX=h(r.targetX+u*m,g,_),r.targetZ=h(r.targetZ+d*m,v,y)}componentDidUpdate(e){let t=this.state,n=this._prevSnapshot||{};this._prevSnapshot={selected:t.selected,hovered:t.hovered,level:t.level,all:t.all,optionOverrides:t.optionOverrides,ready:t.ready},e||={},(e.shadows!==this.props.shadows||e.cars!==this.props.cars||n.optionOverrides!==t.optionOverrides)&&this.applyProps();let r=+!!t.coarse+(t.narrow?2:0);t.ready&&r!==this._lastLayout&&(this._lastLayout=r,this.emit(`layout`,this.env()));let i=this.selectedId();this._lastSelectKey!==i&&(this._lastSelectKey=i,this.emit(`select`,this.featureInfo(i))),n.hovered!==t.hovered&&this.emit(`hover`,t.hovered),(n.level!==t.level||n.all!==t.all)&&this.emit(`level`,{level:t.level,allLevels:t.all}),t.ready&&!n.ready&&(this._pluginsAtLoad=JSON.stringify((a.raw||{}).plugins||null),this.applyEdits(),this.applyCss(),this.bootPlugins(),this.syncBuiltins(),this.emit(`ready`,this.getState()))}static HOOKS=[`extraViews`,`notify`,`wheelHook`,`tapHook`,`aiTools`,`renderVals`,`componentWillUnmount`,`setState`,`state`,`forceUpdate`,`props`];get core(){if(this._core)return this._core;let e=this;return this._core=Object.freeze({get renderer(){return e.renderer},get width(){return e._width},get height(){return e._height},get dead(){return!!e._destroyed},get reducedMotion(){return!!e._reducedMotion},get slot(){return e._slot},get options(){return e.opts},get shapesEdited(){return!!e._shapesEd},set shapesEdited(t){e._shapesEd=!!t},camera:Object.freeze({get goal(){return e.camGoal},set goal(t){e.camGoal=t},get view(){return e.camView},set view(t){e.camView=t},home:t=>e.goHome(t),homeNow:t=>{let n=e.home(t);e._flight=e._inertia=null,e.camGoal&&Object.assign(e.camGoal,n),e.camView&&Object.assign(e.camView,n)},stopInertia:()=>{e._inertia=null}}),layout:Object.freeze({get levels(){return e.levelViews},gap:()=>e.levelGapPx(),spacing:()=>e.levelSpacing(),levelGoal:(...t)=>e.levelGoal(...t)}),pointer:Object.freeze({get viewport(){return e._viewport},ground:(t,n,r)=>{if(!e.renderer||!e._viewport||!e.camera)return null;let i=e.THREE,a=e._viewport.getBoundingClientRect(),o=new i.Vector2((t-a.left)/a.width*2-1,-((n-a.top)/a.height)*2+1),s=new i.Vector3;return e._raycaster.setFromCamera(o,e.camera),e._raycaster.ray.intersectPlane(new i.Plane(new i.Vector3(0,1,0),-r),s)?[s.x,s.z]:null},project:(t,n,r)=>{if(!e.camera)return{x:0,y:0,visible:!1};let i=new e.THREE.Vector3(t,n,r).project(e.camera);return{x:(i.x+1)/2*e._width,y:(1-i.y)/2*e._height,visible:e.ndcVisible(i)}}}),scene:Object.freeze({rebuild:()=>e.rebuildScene()}),data:Object.freeze({get units(){return e._units},get byId(){return e._byId},get unitById(){return e._unitById},get storeList(){return e._stores},get amenityList(){return e._amenityList},get tints(){return e._tints},set tints(t){e._tints=t},applyStore:(t,n)=>e.applyStore(t,n),resetNav:()=>{e._navGrid=null},resetTallUnits:()=>{e._tallUnits=null}}),plugins:Object.freeze({get registry(){return e._plugReg},set registry(t){e._plugReg=t},get active(){return e._plugins},config:()=>e._pluginConfig(),changed:t=>e._plugChanged(t),builtin:t=>e.builtin(t),install:t=>e.install(t),uninstall:t=>e.uninstall(t),save:()=>e.savePlugins(),sync:(t,n)=>e.syncPlugins(t,n)}),controls:()=>e.ui(),closePopups:(t,n)=>e.closePopups(t,n),render:(t,n)=>e.view(t,n)})}notify(e){this.emit(`message`,String(e))}static PUBLIC=`languages.language.setLanguage.translatable.langCoverage.setTranslations.removeLanguage.applyLanguage.on.off.emit.whenReady.getState.levels.levelOf.stores.amenities.find.findAll.match.feature.features.select.deselect.setLevel.showAll.wayfindingApi.showRoute.hideRoute.routeInfo.setCamera.focusFeature.setDisplay.updateStore.setLogo.logoOf.tint.mergeUnits.splitUnit.reset.css.setCss.exportMap.saveMap.discardSaved.downloadMap.snapshot.applyEdits.plugins.setPlugin.findPlugin.installCustom.toggleCustom.removeCustom.mount.destroy.setOptions.core.notify`.split(`.`);feature(e){return this.featureInfo(e)}features(e){return[...(this._features||new Map).entries()].filter(([,t])=>!e||t.kind===e).map(([e])=>this.featureInfo(e)).filter(Boolean)}on(e,t){let n={ev:e,fn:t};return(this._handlers=this._handlers||[]).push(n),()=>{this._handlers=this._handlers.filter(e=>e!==n)}}off(e,t){this._handlers=(this._handlers||[]).filter(n=>n.ev!==e||!!t&&n.fn!==t)}whenReady(){return this.state.ready?Promise.resolve(this):new Promise(e=>{let t=this.on(`ready`,()=>{t(),e(this)})})}getState(){let e=this._pendingState||this.state;return{ready:!!e.ready,level:e.level,allLevels:e.all,selected:e.popupOpen&&e.selected?e.selected:e.scenerySelected||null,hovered:e.hovered,editing:!!this._uiHidden,...this.wayfindingState()}}wayfindingState(){let e=this.wayfindingApi(),t=e&&e.state?e.state():{};return{routeShown:!!t.routeShown,routeFrom:t.from||null,routeTo:t.to||null,routeAccessible:!!t.accessible,wayfindingOpen:!!t.open}}i18n(){let e=a.raw;return e&&e.i18n||null}langName(e){let t=(this.i18n()||{}).languages||{};if(t[e]&&t[e].name)return t[e].name;if(e===(this.i18n()||{}).source&&this.i18n().source_name)return this.i18n().source_name;try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e);return t?t[0].toUpperCase()+t.slice(1):e}catch{return e}}languages(){let e=this.i18n();if(!e)return[];let t=e.source||`en`;return[t].concat(Object.keys(e.languages||{}).filter(e=>e!==t)).map(e=>({code:e,name:this.langName(e),source:e===t}))}language(){let e=this.i18n();return a.currentLanguage||e&&e.source||`en`}pickLanguage(){let e=this.i18n(),t=e&&e.languages||{},n=e&&e.source||`en`;if(!e||!this.pluginOn(`localization`))return null;let r=e=>String(e).split(`-`)[0].toLowerCase(),i=e=>e?(e=String(e),e===n||t[e]?e:r(e)===r(n)?n:Object.keys(t).find(t=>r(t)===r(e))||null):null,a=i(this._langUser)||i(this.props.language);return!a&&this.pluginSetting(`localization`,`page`)!==!1&&(a=i(document.documentElement.lang)),a=a||i(this.pluginSetting(`localization`,`language`))||n,a===n?null:a}async setLanguage(e){let t=this.languages();if(e=e?String(e):null,e&&!t.some(t=>t.code===e))throw Error(`No language `+e+(t.length?`. Languages: `+t.map(e=>e.code).join(`, `):``));return this._langUser=e,await this.applyLanguage(),this.language()}async applyLanguage(e){let t=a,n=this.pickLanguage();if(!e&&n===t.currentLanguage||(t.currentLanguage=n,t.localize(),this._viewport&&(this._viewport.lang=this.language()),!this.renderer))return;let r=((t.raw||{}).edits||{}).units||{};(this._units||[]).forEach(e=>{let n=e.id&&this._byId[e.id];if(!n||!e.r)return;let i=r[e.r.featureId];n.item.store.name=i&&i.name!=null?i.name:t.unitName(e.r)});let i=this.wayfindingState(),o=Object.values(this._builtinPlugins||{}).filter(e=>e.active&&![`scenery`,`localization`,`attract`].includes(e.id));o.forEach(e=>this.uninstall(e));for(let e of o)try{await this.install(e)}catch(t){console.error(`Plugin `+e.name,t)}let s=this.wayfindingApi();s&&s.restore&&(i.wayfindingOpen||i.routeAccessible)&&s.restore({open:i.wayfindingOpen,from:i.routeFrom,to:i.routeTo,accessible:i.routeAccessible}),this.emit(`language`,{language:this.language(),name:this.langName(this.language())}),this.forceUpdate()}translatable(e,t){let n=a,r=n.raw||{},i=n.source()||{},o=e&&((this.i18n()||{}).languages||{})[e],s=o&&o.strings||{},c={},l=(e,t,n)=>{let r=(s[e]||{})[t];return r!=null&&(typeof r==`string`?n===`name`:!!r[n])},u=(n,r,i)=>{let a={};Object.entries(i).forEach(([i,o])=>{o!=null&&o!==``&&(t||!e||!l(n,r,i))&&(a[i]=String(o))}),Object.keys(a).length&&((c[n]=c[n]||{})[r]=Object.keys(a).length===1&&a.name!=null&&n!==`levels`&&n!==`locations`&&n!==`markers`?a.name:a)};return Object.entries(n.UI).forEach(([n,r])=>{(t||!e||!(s.ui||{})[n])&&((c.ui=c.ui||{})[n]=r)}),(n.levelIds||[]).forEach((e,t)=>u(`levels`,e,{name:(i.levelNamesOrig||n.levelNames)[t],short:(i.levelShortNamesOrig||n.levelShortNames)[t]})),(r.categories||[]).forEach(e=>u(`categories`,e.id,{name:e.name})),Object.entries(r.amenities||{}).forEach(([e,t])=>u(`amenities`,e,{name:t.name||e})),Object.values(n.locations||{}).forEach(e=>u(`locations`,e.id,{name:e.name,subtitle:e.subtitle,description:e.description})),(n.markers||[]).forEach(e=>{let t=e._src||e;u(`markers`,e.id,e.location==null?{name:t.name,subtitle:t.subtitle,description:t.description,text:t.text}:{text:t.text})}),(r.holidays||[]).forEach(e=>e&&e.date&&u(`holidays`,e.date,{name:e.name})),c}langCoverage(e){let t=e=>Object.values(e).reduce((e,t)=>e+Object.values(t).reduce((e,t)=>e+(typeof t==`string`?1:Object.keys(t).length),0),0),n=t(this.translatable());return{total:n,translated:n-t(this.translatable(e))}}async setTranslations(e,t){if(t||={},e=String(e||``).trim(),!/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e))throw Error(`Language code must be BCP 47, e.g. de, fr, pt-BR, zh-Hans`);let n=a.raw;if(!n)throw Error(`Map not loaded`);let r=n.i18n=n.i18n||{};if(r.source||=t.source?String(t.source):`en`,e===r.source)throw Error(e+` is the map's own language; change the map text itself`);let i=r.languages=r.languages||{},o=i[e]=i[e]||{};t.name&&(o.name=String(t.name));let s=o.strings=o.strings||{},c=0;return Object.entries(t.strings||{}).forEach(([e,t])=>{if(!a.I18N_KINDS.includes(e)||!t||typeof t!=`object`)return;let n=s[e]=s[e]||{};Object.entries(t).forEach(([e,t])=>{if(t==null||t===``)delete n[e];else if(typeof t==`object`){let r=Object.assign({},typeof n[e]==`object`?n[e]:n[e]?{name:n[e]}:{});Object.entries(t).forEach(([e,t])=>{t==null||t===``?delete r[e]:(r[e]=String(t),c++)}),Object.keys(r).length?n[e]=r:delete n[e]}else n[e]=String(t),c++}),Object.keys(n).length||delete s[e]}),await this.applyLanguage(!0),c}async removeLanguage(e){let t=this.i18n();if(!t||!t.languages||!t.languages[e])throw Error(`No translations for `+e);delete t.languages[e],this._langUser===e&&(this._langUser=null),await this.applyLanguage(!0)}levels(){return a.levelNames.map((e,t)=>({index:t,name:e,short:a.levelShortNames[t]}))}levelOf(e){if(typeof e==`number`)return e>=0&&e<a.levelNames.length?e:null;let t=String(e).toLowerCase().trim(),n=a.levelShortNames.map(e=>String(e).toLowerCase()),r=a.levelNames.map(e=>String(e).toLowerCase()),i=t.match(/\d+/);if(t===`all`)return`all`;let o=n.indexOf(t);return o<0&&(o=r.indexOf(t)),o<0&&/^\d+$/.test(t)&&+t<r.length&&(o=+t),o<0&&(o=r.findIndex(e=>e.startsWith(t)||t.startsWith(e))),o<0&&i&&(o=n.findIndex(e=>e.replace(/\D/g,``)===i[0])),o<0?null:o}stores(){return(this._stores||[]).filter(e=>!(this._unitById[e.id]||{}).hid).concat(this.pointStores()).map(e=>this.info(e))}pointStores(){let e=a,t=e.markers||[],n=this._byId||{};if(this._ptSrc===t&&this._ptBy===n&&this._ptList)return this._ptList;let i=e.locations||{},o=[],s={};return t.forEach(e=>{let t=e.location;if(t==null||String(e.id).startsWith(`loc:`)||e.action!==`popup`)return;let a=i[t];if(!a)return;let c=s[t];if(!c){let n=r.categoryList(a.category);c=s[t]={id:String(t),name:a.name||String(t),cat:n.length?(r.categoryNames||{})[n[0]]||n[0]:null,level:e.level,hours:a.hours===!1?``:a.hours||``,loc:a,point:!0,pts:[]},o.push(c)}let l=e.x,u=e.z,d=e.level,f=null;if(e.on){let t=this._storesById(e.on,this._stores||[])[0],r=t&&n[t.id];r&&(l=r.item.cx,u=r.item.cz,d=r.levelIndex,f=t.id)}c.pts.push({id:String(e.id),level:d,x:l,z:u,unit:f})}),o.forEach(e=>e.level=e.pts[0].level),this._ptSrc=t,this._ptBy=n,this._ptList=o}pointStore(e){let t=String(e);return this.pointStores().find(e=>e.id===t)||null}pointPick(e){let t=this.state.all?null:this.state.level,n=e.pts.filter(e=>e.level===t),r=n.length?n:e.pts,i=this.camGoal;return!i||r.length<2?r[0]:r.reduce((e,t)=>Math.hypot(t.x-i.targetX,t.z-i.targetZ)<Math.hypot(e.x-i.targetX,e.z-i.targetZ)?t:e)}amenities(){return(this._amenityList||[]).map(e=>this.info(e))}find(e){let t=null;try{t=this._resolveStore(e)}catch{}return t?this.info(t):null}match(e){e||={};let t=(this._stores||[]).filter(e=>!(this._unitById[e.id]||{}).hid).concat(this.pointStores()),n=new Set;if(e.all&&t.forEach(e=>n.add(e)),e.category){let r=String(e.category).toLowerCase();t.filter(e=>(e.cat||``).toLowerCase()===r).forEach(e=>n.add(e))}return(e.stores||[]).forEach(e=>{let t=null;if(e&&typeof e==`object`)try{t=this._resolveStore(e)}catch{}else t=this.findStore(e);t&&n.add(t)}),[...n].map(e=>this.info(e))}_resolveStore(e){let t=e&&typeof e==`object`?e.id&&this._byId&&this._byId[e.id]?this._byId[e.id].item.store:e.id?this._onLevel(this._storesById(e.id)):null:this.findStore(e);if(!t)throw Error(`No store matches "`+(e&&e.name||e)+`"`);return t}select(e,t){let n=typeof e==`string`?e:e&&typeof e==`object`&&!e.name?e.id:null;{let t=n==null?null:this.pointStore(n);if(t)n=this.pointPick(t).id;else if(!(n&&this._features&&this._features.has(n))){let t=null;try{t=this._resolveStore(e)}catch{}t&&t.point&&(n=this.pointPick(t).id)}}let r=this._pendingState||this.state;if(n&&this._features&&this._features.has(n)&&!(this._byId&&this._byId[n])){if(r.scenerySelected!==n){let e=(a.markers||[]).find(e=>e.id===n);e&&e.location!=null&&!this.state.all&&e.level!==this.state.level&&this.closePopups({all:!1,level:e.level}),this._pickZoom=t&&t.zoom;try{this.pick(n)}finally{this._pickZoom=null}}return this.featureInfo(n)}let i=this._resolveStore(e);t||={};let o=this.state.all?null:this.state.level;t.face&&r.selected===i.id&&r.popupOpen&&this.closePopups();let s=null,c=this._pendingState||this.state;if(!(c.selected===i.id&&c.popupOpen)){this._faceFront=!!t.face,this._pickZoom=t.zoom;try{this.pick(i.id)}finally{this._faceFront=!1,this._pickZoom=null}s=this._flight}t.duration&&this._flight&&(this._flight.dur=Math.max(0,+t.duration));let l=this.camGoal;if(s&&l){let e=this._byId&&this._byId[this.groupParts(i.id).length>1?this.groupRep(i.id):i.id],n=(s.a.distance+l.distance)/2;if(t.arc){let e=Math.hypot(l.targetX-s.a.targetX,l.targetZ-s.a.targetZ),t=Math.min(this.maxDist(),e*.75/a.FOV_TAN);s.peak=Math.max(0,t-n)}t.explode&&e&&o!=null&&e.levelIndex!==o&&this.canExplode()&&(s.explode=.55,s.dur=Math.max(s.dur,3e3),s.peak=Math.max(s.peak||0,Math.min(this.maxDist(),this.home(!0).distance*.75)-n))}return this.info(i)}drift(e,t,n){let r=(+e||0)*Math.PI/180,i=(+n||0)*Math.PI/180;return this._drift=(r||i)&&!this._reducedMotion&&this.camGoal&&!this.is2d()?{turn:-r,tilt:i,dur:Math.max(1,+t||8)*1e3,t0:null}:null,!!this._drift}static APPROACH_POLAR=.12;approach(e){let t=e||{},n=(e,t,n,r)=>e!=null&&e!==``&&Number.isFinite(+e)?Math.min(r,Math.max(n,+e)):t;return e===!1||this._reducedMotion||!this.camGoal?(this._approach=null,!1):(this._approach={dur:n(t.seconds,1.6,.3,6)*1e3,height:n(t.height,5,1.2,20),turn:n(t.turn,0,-360,360)*Math.PI/180},!0)}approaching(){return!!this._approach||!!(this._flight&&this._flight.approach)}drifting(){let e=this._drift;return!!e&&(e.t0==null||performance.now()-e.t0<e.dur)}deselect(){this.closePopups()}setLevel(e){let t=this.levelOf(e);if(t===null)throw Error(`Unknown level `+e);if(t===`all`)return this.canExplode()?(this.closePopups({all:!0}),this.camGoal&&this.goHome(!0),`all`):this.state.level;let n=this.state.all;return this.closePopups({all:!1,level:t}),n&&this.camGoal&&this.goHome(!1),t}showAll(){return this.setLevel(`all`)}explodeOn(){return(r.levelNames||[]).length>1&&this.pluginSetting(`appearance`,`exploded_view`)!==!1}canExplode(){return this.explodeOn()&&!this.is2d()}deeplinkApi(){let e=this._builtinPlugins&&this._builtinPlugins.deeplink;return e&&e.active&&e.exports||null}wayfindingApi(){let e=this._builtinPlugins&&this._builtinPlugins.wayfinding;return e&&e.active&&e.exports||null}async showRoute(e,t){let n=this.wayfindingApi();if(!n)throw Error(`Wayfinding is off`);return n.show(e,t)}hideRoute(){let e=this.wayfindingApi();e&&e.hide()}routeInfo(){let e=this.wayfindingApi();return e?e.info():null}static distanceText(e,t){return t===`imperial`?a.t(`feet`,{n:Math.round(e*3.28084)}):a.t(`metres`,{n:e})}static walkText(e,t,n,r){let i=r===`imperial`?Math.round(t*3.28084):t;return a.t(e,{n:i,distance:a.distanceText(t,r),place:n})}routeVia(e,t,n){let r=this._byId[e]?null:this.pointStore(e),i=this._byId[t]?null:this.pointStore(t);if(!r&&!i)return this.route(e,t,n);this.navGrid();let a=[],o=e=>e.pts.slice(0,8).map(t=>{if(t.unit&&this._byId[t.unit])return t.unit;let n=`pt|`+t.id,r=.4;return this._byId[n]={item:{poly:[[t.x-r,t.z-r],[t.x+r,t.z-r],[t.x+r,t.z+r],[t.x-r,t.z+r]],cx:t.x,cz:t.z,top:0,store:{id:n,name:e.name,level:t.level}},levelIndex:t.level},a.push(n),n});try{let a=r?o(r):[e],s=i?o(i):[t],c=null;return a.forEach(e=>s.forEach(t=>{if(e===t)return;let r=this.route(e,t,n);r&&(!c||r.m<c.m)&&(c=r)})),c}finally{a.forEach(e=>delete this._byId[e])}}routeData(e,t,n){let r=n&&n.units===`imperial`?`imperial`:`metric`,i=!!(n&&n.accessible)&&this.routeVia(e,t,{stepFree:!0})||this.routeVia(e,t);return i?{from:e,to:t,minutes:i.min,metres:i.m,via:i.via,stepFree:i.stepFree,start:{level:i.A.levelIndex,at:i.A.p},end:{level:i.B.levelIndex,at:i.B.p},distance:a.distanceText(i.m,r),steps:i.steps.map(e=>({tag:e.tag,text:e.walkKey?a.walkText(e.walkKey,e.metres,e.place,r):e.text,level:e.levelIndex})),badges:i.badges.map(e=>({level:e.levelIndex,at:e.p,goTo:e.go,text:e.text,up:!!e.up,kind:e.kind,levelName:a.levelNames[e.go]})),legs:i.segs.map(e=>e.kind===`walk`?{kind:`walk`,level:e.levelIndex,points:e.uv,length:e.lenU}:{kind:e.kind,from:e.from,to:e.to,a:e.A,b:e.B,connector:e.cid==null?null:`esc-`+e.cid})}:null}fitView(e,t,n){n||={};let r=this.state.all;if(this.closePopups({all:!1,level:e}),!this.camGoal)return;if(!t||t.length<2){r&&this.goHome(!1);return}let i=a,o=this.THREE,s=this.camGoal,c=this.is2d(),l=this.home(!1),u=Math.min(1,Math.max(.2,n.fill||.8));if(n.rotation!=null&&!c){let e=-n.rotation*Math.PI/180,t=Math.atan2(Math.sin(e-s.azimuth),Math.cos(e-s.azimuth));Math.abs(t)*180/Math.PI>(n.minTurn||0)&&(s.azimuth+=t)}let d=t.map(e=>e[0]),f=t.map(e=>e[1]),p=(Math.min(...d)+Math.max(...d))/2,m=(Math.min(...f)+Math.max(...f))/2,h=t.concat([[p-6,m-6],[p+6,m+6]]),g={targetX:p,targetY:i.FLOOR_TOP,targetZ:m,azimuth:s.azimuth,polar:c?s.polar:l.polar,distance:s.distance||l.distance},_=Math.max(1,this._width||1),v=Math.max(1,this._height||1),y=!this._uiHidden&&this._insets||{},b=Math.max(.2,(_-(y.left||0)-(y.right||0))/_),x=Math.max(.2,(v-(y.top||0)-(y.bottom||0))/v),S=this.minDist(),C=this.maxDist();if(o){let e=new o.PerspectiveCamera(30,_/v,.5,1e6),t=new o.Vector3,n=new o.Vector3,r=new o.Vector3;for(let a=0;a<8;a++){this.aimCamera(e,g);let a=1/0,o=-1/0,s=1/0,c=-1/0;h.forEach(n=>{t.set(n[0],i.FLOOR_TOP,n[1]).project(e),a=Math.min(a,t.x),o=Math.max(o,t.x),s=Math.min(s,t.y),c=Math.max(c,t.y)});let l=g.distance*i.FOV_TAN,d=_/v*l;n.setFromMatrixColumn(e.matrixWorld,0),r.setFromMatrixColumn(e.matrixWorld,1);let f=(a+o)/2*d,p=(s+c)/2*l,m=Math.max(.05,r.x*r.x+r.z*r.z);g.targetX+=n.x*f+r.x*p/m,g.targetZ+=n.z*f+r.z*p/m;let y=Math.max((o-a)/2/(u*b),(c-s)/2/(u*x));g.distance=Math.max(S,Math.min(C,g.distance*y))}}else g.distance=Math.max(S,Math.min(C,Math.max(...d.map(e=>Math.abs(e-p)),...f.map(e=>Math.abs(e-m)))*2/i.FOV_TAN));Object.assign(s,{targetX:g.targetX,targetZ:g.targetZ,targetY:i.FLOOR_TOP,polar:g.polar,distance:g.distance})}liftFocus(e){let t=this.camGoal,n=this._focusBase;if(!t||!n||Math.abs(t.targetX-(n.x+n.dx))>1e-6||Math.abs(t.targetZ-(n.z+n.dz))>1e-6)return 0;e=Math.max(0,+e||0);let r=Math.max(1,this._height||1),i=2*t.distance*a.FOV_TAN/r,o=e*i/Math.max(.2,Math.cos(t.polar));n.dx=-Math.sin(t.azimuth)*o,n.dz=-Math.cos(t.azimuth)*o;let s=this._flight,c=this.camView;if(s&&c){let e=Math.min(1,(performance.now()-s.t0)/s.dur),t=e<.5?4*e*e*e:1-(-2*e+2)**3/2;t<.98&&(s.a.targetX=(c.targetX-(n.x+n.dx)*t)/(1-t),s.a.targetZ=(c.targetZ-(n.z+n.dz)*t)/(1-t))}return t.targetX=n.x+n.dx,t.targetZ=n.z+n.dz,this._liftPx=e,e}setCamera(e){let t=this.camGoal;if(!t)throw Error(`Map not ready`);if(e||={},[`mode`,`reset`,`resetRotation`,`resetTilt`,`rotateBy`,`tilt`,`zoom`].some(t=>e[t]!=null&&e[t]!==!1)&&(this._drift=null),e.mode===`2d`&&!this.is2d())this._savedPitch3d=t.polar,this._savedAzimuth3d=t.azimuth,this._mode2d=!0,this.state.all&&this.setLevel(this.state.level);else if(e.mode===`3d`&&this.is2d()){this._mode2d=!1;let e=this.home(this.state.all);t.polar=this._savedPitch3d??e.polar;let n=this._savedAzimuth3d??e.azimuth;t.azimuth=n+2*Math.PI*Math.round((t.azimuth-n)/(2*Math.PI))}if(e.reset&&this.goHome(this.state.all),e.resetRotation){let e=this.home(this.state.all);this._inertia=null,t.azimuth=e.azimuth+2*Math.PI*Math.round((t.azimuth-e.azimuth)/(2*Math.PI)),t.polar=e.polar}if([`mode`,`reset`,`resetRotation`,`tilt`].some(t=>e[t]!=null&&e[t]!==!1)&&(this._tiltEase=null),e.resetTilt&&!this.is2d()){let e=this.home(this.state.all).polar;this._tiltEase=this._reducedMotion?null:{t0:performance.now(),from:this.camView.polar,to:e},t.polar=e}return e.rotateBy&&(t.azimuth-=e.rotateBy*Math.PI/180),e.tilt!=null&&(t.polar=Math.max(.12,Math.min(1.38,e.tilt*Math.PI/180))),e.zoom>0&&(this._flight=null,t.distance=Math.max(this.minDist(),Math.min(this.maxDist(),t.distance/e.zoom))),{mode:this.is2d()?`2d`:`3d`,rotation:Math.round(-t.azimuth*180/Math.PI),tilt:Math.round(t.polar*180/Math.PI),distance:t.distance}}async focusFeature(e,t,n){let r=t==null?this.state.all?0:this.state.level:this.levelOf(t),i=r===null||r===`all`?0:r,o=Math.max(0,n|0),s=e=>new Promise(t=>this.closePopups({all:!1,level:e},t)),c=e=>[...(this._features||new Map).entries()].filter(([,t])=>[].concat(e).includes(t.kind));if(e===`elevator`){let t=c(`elevator`);if(!t.length)throw Error(`No elevators`);let n=Math.min(o,t.length-1);return await s(i),t[n][1].at&&t[n][1].at(i),this.pick(t[n][0]),{type:e,level:i,index:n}}if(e===`bus_stop`){let t=[...(this._features||new Map).entries()].filter(([,e])=>e.kind===`bus_stop`).map(([e])=>({id:e}));if(!t.length)throw Error(`No bus stops`);let n=Math.min(o,t.length-1);return await s(0),this.pick(t[n].id),{type:e,level:0,index:n}}if(e!==`escalator`)throw Error(`Unknown feature `+e);let l=c([`escalator`,`stairs`]).map(e=>e[1]).filter(e=>e.meshes&&e.lo===Math.min(i,1));if(!l.length)throw Error(`No escalators`);await s(i);let u=this.home(!1);return Object.assign(this.camGoal,{targetX:l.reduce((e,t)=>e+t.x,0)/l.length,targetZ:l.reduce((e,t)=>e+t.z,0)/l.length,targetY:a.FLOOR_TOP,distance:u.distance/1.9}),{type:e,level:i,index:0}}setDisplay(e){let t={};[`labels`,`shadows`,`cars`,`motion`].forEach(n=>{typeof e[n]==`boolean`&&(t[n]=e[n])}),e.spacing!=null&&(t.spacing=Math.max(0,Math.min(100,+e.spacing))),e.gap!=null&&(t.gap=Math.max(90,Math.min(220,+e.gap)));let n={},r={};return Object.entries(t).forEach(([e,t])=>{let i=!1;a.BUILTINS.forEach(r=>Object.entries(r.settings||{}).forEach(([a,o])=>{o.opt===e&&((n[r.id]=n[r.id]||{})[a]=t,i=!0)})),i||(r[e]=t)}),Object.entries(n).forEach(([e,t])=>this.setPlugin(e,{settings:t}).catch(e=>console.warn(e))),Object.keys(r).length&&this.setState(e=>({optionOverrides:Object.assign({},e.optionOverrides,r)})),t}updateStore(e,t){let n=this._resolveStore(e);if(n.point){if(t&&t.zoom!==void 0){let e=t.zoom==null||!(+t.zoom>0)?0:Math.round(Math.max(.25,Math.min(100,+t.zoom))*10)/10;e?n.loc.focus_zoom=e:delete n.loc.focus_zoom,delete n.loc.zoom}return this.info(n)}let r=n,i=this._unitById[r.id],o={};return t||={},t.name&&(o.name=String(t.name).trim().slice(0,40)),t.category&&(o.cat=t.category),t.hours&&(o.hours=t.hours),t.height!=null&&(o.heightScale=Math.max(.3,Math.min(4,+t.height||1))),t.labelScale!=null&&(o.labelScale=Math.max(.3,Math.min(3,+t.labelScale||1))),t.labelRotation!=null&&(o.labelRotation=(Math.round(+t.labelRotation||0)%360+360)%360),t.labelOffset!==void 0&&(o.labelOffset=a.labelOffsetOf(t.labelOffset)),t.label!=null&&(o.label=!!t.label),t.zoom!==void 0&&(o.focusX=t.zoom==null||!(+t.zoom>0)?0:Math.round(Math.max(.25,Math.min(100,+t.zoom))*10)/10,o.focusZoom=0),o.name&&o.name!==r.name&&i&&(i.logo||`orig`)===`orig`&&i.logoSvgOrig&&(o.logo=`none`),this.applyStore(r.id,o),this.forceUpdate(),this.info(r)}async setLogo(e,t){let n=this._resolveStore(e);if(t!==`none`&&t!==`orig`){/^\s*(\x60\x60\x60|<)/.test(t)&&(t=this.normSvg(t));try{await this.loadImg(t)}catch{throw Error(`That image could not be loaded`)}}return this.applyStore(n.id,{logo:t}),this.info(n)}logoOf(e){let t=this._resolveStore(e),n=this._unitById[t.id];return n?(n.logo&&n.logo!==`orig`&&n.logo!==`none`?n.logo:null)||(n.logoSvgOrig?this.normSvg(n.logoSvgOrig):null):null}css(){return String(((a.raw||{}).theme||{}).css||``)}setCss(e){let t=a.raw;if(!t)throw Error(`Map not loaded`);return e=String(e||``).trim(),t.theme=Object.assign({},t.theme),e?t.theme.css=e:delete t.theme.css,this.applyCss(),e}appearanceOwn(e){let t=this._pluginConfig().builtin.appearance;return(t&&t.settings?t.settings[e]:void 0)??void 0}schemeSetting(){return this.props.scheme||this.appearanceOwn(`scheme`)||`light`}resolvedScheme(){let e=this.schemeSetting();return e===`auto`?window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e===`dark`?`dark`:`light`}scheme(){return this._scheme||this.resolvedScheme()}accent(){let e=(a.raw||{}).theme||{},t=this.props.accent||e.accent;return r.hexRgb(t)?String(t).trim():r.ACCENT_DEFAULT}selectedStyle(){return(this.props.selected||this.appearanceOwn(`selected`))===`accent`?`accent`:`neutral`}lightCards(){let e=this.props,t=this.appearanceOwn(`light_cards`),n=e=>e===`dark`||e===`white`;return n(e.lightCards)?e.lightCards:n(t)?t:`dark`}lightTooltips(){let e=this.props,t=this.appearanceOwn(`light_tooltips`),n=e=>e===`dark`||e===`white`;return n(e.lightTooltips)?e.lightTooltips:n(t)?t:this.lightCards()}uiRadius(){let e=this.props.uiRadius,t=this.appearanceOwn(`ui_radius`),n=Number.isFinite(+e)&&e!==null&&e!==``?+e:Number.isFinite(+t)&&t!==null&&t!==``?+t:4;return Math.max(0,Math.min(8,Math.round(n)))}hidePluginPanels(e){this._uiHidden=!!e,this._viewport&&this._viewport.querySelectorAll(`:scope > [data-mp-top]:not([data-mp-edit])`).forEach(t=>t.style.visibility=e?`hidden`:``),this._layoutDocks&&this._layoutDocks(),this._slots&&this._slotSchedule(),this.applyBleed(),this.emit&&this.emit(`layout`,this.env()),e&&(this._shift={x:0,y:0},this._shiftKey=null,this._fitSize&&this._fitSize())}applyUiRadius(){let e=this.uiRadius();this.el&&(this.el.style.borderRadius=e*a.UI_RADIUS_OUTER+`px`),[this._viewport,...(this._docks||[]).map(e=>e.wrap)].forEach(t=>t&&t.style.setProperty(`--mp-rk`,String(e/4)))}glassPopups(){return(this.props.glassPopups==null?this.appearanceOwn(`glass_popups`):this.props.glassPopups)===!0}glassControls(){return(this.props.glassControls==null?this.appearanceOwn(`glass_controls`):this.props.glassControls)===!0}applyContainer(){let e=this._viewport;if(!e)return;let t=this.props._snapshot?0:+this.pluginSetting(`appearance`,`bleed`)||0,n=Math.max(0,+this.pluginSetting(`appearance`,`edge_fade`)||0),r=a.raw?this.pluginSetting(`appearance`,`background`):this.props.background;e.toggleAttribute(`data-mp-nobg`,r===!1),e.toggleAttribute(`data-mp-fade`,n>0),e.style.setProperty(`--mp-fade`,n+`px`),this._bleedSetting=t;let i=t!==0;if(i&&!this._bleedWatch){let e=!1,t=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1,this._destroyed||this.applyBleed()}))};window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,t,{passive:!0}),this._bleedWatch=()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,t)}}else!i&&this._bleedWatch&&(this._bleedWatch(),this._bleedWatch=null);this.applyBleed(),this.applyHeight()}static NARROW_HOST=640;static HEIGHT_KEYS=[`height`,`aspectRatio`,`minHeight`,`maxHeight`];static parseRatio(e){let t=/^\s*(\d+(?:\.\d+)?)\s*[:/x]\s*(\d+(?:\.\d+)?)\s*$/.exec(String(e??``));return t&&+t[1]>0&&+t[2]>0?[+t[1],+t[2]]:null}heightSpec(e){let t=e=>this.pluginSetting(`size`,e),n=this.props.frame||this.el,r=e??(n?n.clientWidth:0),i=[`container`,`screen`,`ratio`,`fixed`],o=t(`narrow_mode`),s=i.includes(o)&&r>0&&r<a.NARROW_HOST,c=s?o:t(`mode`);return{mode:i.includes(c)?c:`container`,narrow:s,screen:Math.min(100,Math.max(1,+t(s?`narrow_screen`:`screen`)||80)),offset:Math.max(0,+t(`offset`)||0),ratio:a.parseRatio(t(s?`narrow_ratio`:`ratio`))||(s?[3,4]:[16,9]),px:Math.max(1,+t(s?`narrow_px`:`px`)||600),min:Math.max(0,+t(`min`)||0),max:Math.max(0,+t(`max`)||0)}}static heightCss(e,t){let n={height:``,aspectRatio:``,minHeight:``,maxHeight:``},r=e=>t?`min(`+e+`, `+t+`)`:e;if(e.mode===`fixed`)n.height=r(e.px+`px`);else if(e.mode===`screen`){let t=e.offset?`calc(`+e.screen+`svh - `+e.offset+`px)`:e.screen+`svh`;e.max&&(t=`min(`+t+`, `+e.max+`px)`),e.min&&(t=`max(`+t+`, `+e.min+`px)`),n.height=r(t)}else e.mode===`ratio`?(n.height=`auto`,n.aspectRatio=e.ratio[0]+` / `+e.ratio[1],e.min&&(n.minHeight=r(e.min+`px`)),n.maxHeight=e.max?r(e.max+`px`):t||``):t&&(n.height=t);return n}static heightPx(e,t){let n=t=>Math.max(e.min||0,e.max?Math.min(e.max,t):t);return e.mode===`fixed`?e.px:e.mode===`screen`?Math.round(n(window.innerHeight*e.screen/100-e.offset)):e.mode===`ratio`?Math.round(n(t*e.ratio[1]/e.ratio[0])):0}applyHeight(){let e=this.el;if(!e||this.props._snapshot)return;let t=this.props.frame||null;this._hostSize||={el:Object.fromEntries(a.HEIGHT_KEYS.concat([`position`,`inset`]).map(t=>[t,e.style[t]])),frame:t?t.style.height:``};let n=this.heightSpec();this._heightCssNow=null,this._putHeight();let r=null;this._heightFallback=!1,n.mode===`container`?!t&&e.clientWidth>0&&e.clientHeight<2&&(this._heightFallback=!0,r=a.heightCss(Object.assign({},n,{mode:`screen`,screen:80,offset:0})),this._heightWarned||(this._heightWarned=!0,console.warn(`mapplic: the map's element has no height, so it shows at 80% of the screen. Give the element a height, or pick one in the Size settings.`))):r=a.heightCss(n),this._heightCssNow=r,this._putHeight(),this._heightMode=n.mode,this._heightNarrow=n.narrow,this._watchHeight(t||e),this._layoutDocks&&this._layoutDocks()}_putHeight(){let e=this.el,t=this._hostSize,n=this._heightCssNow,r=this.props.frame||null;if(e&&t&&(a.HEIGHT_KEYS.forEach(r=>e.style[r]=n?n[r]:t.el[r]),r)){if(!n&&this._belowOpen){r.style.height=t.frame;let n=r.getBoundingClientRect().height;r.style.height=`auto`,e.style.height=n+`px`,e.style.position=`relative`,e.style.inset=`auto`}else r.style.height=n?`auto`:t.frame,e.style.position=n?`relative`:t.el.position,e.style.inset=n?`auto`:t.el.inset}}_watchHeight(e){!this._heightObs&&window.ResizeObserver&&e&&(this._heightObs=new ResizeObserver(()=>{!this._destroyed&&this.el&&this.heightSpec().narrow!==this._heightNarrow&&this.applyHeight()}),this._heightObs.observe(e))}bleedSides(){let e=this._uiHidden?0:this._bleedSetting||0,t=this._viewport;if(!e||!t)return{l:0,t:0,r:0,b:0};let n=t.getBoundingClientRect(),r=0,i=0,a=window.innerWidth,o=window.innerHeight;for(let e=t.parentElement;e&&e!==document.documentElement;e=e.parentElement){let t=getComputedStyle(e),n=t.overflowX!==`visible`,s=t.overflowY!==`visible`;if(!n&&!s)continue;let c=e.getBoundingClientRect(),l=c.left+e.clientLeft,u=c.top+e.clientTop;n&&(r=Math.max(r,l),a=Math.min(a,l+e.clientWidth)),s&&(i=Math.max(i,u),o=Math.min(o,u+e.clientHeight))}let s=n.width/(t.offsetWidth||n.width||1)||1,c=t=>Math.min(e>0?e:4e3,Math.max(0,Math.floor(t/s)));return{l:c(n.left-r),t:c(n.top-i),r:c(a-n.right),b:c(o-n.bottom)}}applyBleed(){let e=this._viewport;if(!e)return;let t=this.bleedSides(),n=[t.l,t.t,t.r,t.b].join(),r=!!(t.l||t.t||t.r||t.b),i=!!this._bleedSetting&&!this._uiHidden&&!!this.renderer;e.toggleAttribute(`data-mp-bleed`,i),[`l`,`t`,`r`,`b`].forEach(n=>e.style.setProperty(`--mp-bleed-`+n,t[n]+`px`)),this.placeBleedHost(i?t:null),n!==(this._bleedKey||`0,0,0,0`)&&(this._bleedKey=n,this._bleed=r?t:null,this.renderer&&this.camView&&this.fitToViewport())}placeBleedHost(e){let t=this.renderer,n=this._glEl,r=this.el,i=this._viewport;if(!t||!n||!r||!i)return;let o=t.domElement;if(!e){o.parentElement!==n&&n.appendChild(o),this._bleedHost&&this._bleedHost.remove(),this._bleedHost=null;return}let s=this._bleedHost;if(!s){s=this._bleedHost=document.createElement(`div`),s.setAttribute(`data-mp-bleed-host`,``),s.setAttribute(`aria-hidden`,`true`),s.style.cssText=`position:absolute;z-index:0;pointer-events:none;opacity:0;transition:opacity 300ms ease`;let e=document.createElement(`div`);e.style.cssText=`position:absolute`,s.appendChild(e),a.injectCss(`bleed`,`[data-mp-bleed-host][data-mp-fade]{`+[`-webkit-mask-image`,`mask-image`].map(e=>e+`:linear-gradient(to right,transparent,#000 var(--mp-fade),#000 calc(100% - var(--mp-fade)),transparent),linear-gradient(to bottom,transparent,#000 var(--mp-fade),#000 calc(100% - var(--mp-fade)),transparent)`).join(`;`)+`;-webkit-mask-composite:source-in;mask-composite:intersect}`)}s.parentElement!==n&&n.insertBefore(s,n.firstChild),o.parentElement!==s&&s.appendChild(o);let c=i.offsetWidth,l=i.offsetHeight,u=Math.max(0,+this.pluginSetting(`appearance`,`edge_fade`)||0),d=this.pluginSetting(`appearance`,`background`)!==!1;Object.assign(s.style,{left:0-e.l+`px`,top:0-e.t+`px`,width:c+e.l+e.r+`px`,height:l+e.t+e.b+`px`,opacity:this.state&&this.state.ready?`1`:`0`}),s.style.setProperty(`--mp-fade`,u+`px`),s.toggleAttribute(`data-mp-fade`,u>0),Object.assign(s.firstChild.style,{left:e.l+`px`,top:e.t+`px`,width:c+`px`,height:l+`px`,borderRadius:getComputedStyle(r).borderRadius,background:d?getComputedStyle(i).getPropertyValue(`--mp-bg`).trim():`transparent`})}ndcVisible(e){if(!(e.z<1))return!1;let t=this._bleed;if(!t)return Math.abs(e.x)<=1.2&&Math.abs(e.y)<=1.2;let n=this._width||1,r=this._height||1,i=(e.x+1)/2*n,a=(1-e.y)/2*r;return i>=-t.l&&i<=n+t.r&&a>=-t.t&&a<=r+t.b}applyAppearance(){this.resolvedScheme()!==this._scheme&&this.renderer?this.applyThemeLive():(this.applySchemeAttrs(),this.emitScheme()),(this._units||[]).forEach(e=>e.pcK=null)}renderFrame(e){let t=this._bleed,n=this._bleedHost;if(n){let e=this.state.ready?`1`:`0`;n.style.opacity!==e&&(n.style.opacity=e)}if(!t)return this.renderer.render(this.scene,e);let r=Math.max(1,this._width||1),i=Math.max(1,this._height||1),a=e.view&&e.view.enabled?Object.assign({},e.view):null;e.setViewOffset(r,i,(a?a.offsetX:0)-t.l,(a?a.offsetY:0)-t.t,r+t.l+t.r,i+t.t+t.b),e.updateProjectionMatrix(),this.renderer.render(this.scene,e),a?e.setViewOffset(a.fullWidth,a.fullHeight,a.offsetX,a.offsetY,a.width,a.height):e.clearViewOffset(),e.updateProjectionMatrix()}prepareScheme(){this._scheme=this.resolvedScheme(),r.scheme=this._scheme,r.accent=this.accent(),a.raw&&r.applyScheme(a.raw),this._washColor=this._floorColor=this._white=null,this.applySchemeAttrs()}cardSurfaceVars(){let e=r,t=this.scheme()===`dark`||this.lightCards()===`dark`,n=e.unitPalette||{},i=t=>e.luminance(t)!=null,o=[(e.floorColors||[])[0],(e.groundColors||[])[0],...Object.values(n).map(e=>e&&e[0])].filter(i),s=[(e.floorColors||[])[0],(e.groundColors||[])[0],(n.nb||[])[0]].filter(i),c=(t,n)=>{if(!s.length)return null;let r=Math.min(...s.map(n=>e.contrast(t,n))),i=Math.max(0,Math.min(1,(r-1.1)/.5));return`rgba(`+n+`,`+(.16-i*.1).toFixed(3)+`)`},l={"ring-on-light":c(`#ffffff`,`9,9,11`),"ring-on-dark":c(a.CARD_TOKENS.raised[`card-bg`],`255,255,255`)};if(o.length){let n=t?`#09090b`:`#ffffff`,r=a.CARD_TOKENS[t?`raised`:`paper`][`card-fg-muted`],i=this.scheme()!==`dark`,c=(t&&!i||!s.length?o:s).map(t=>[t,e.luminance(t)]).sort((e,t)=>e[1]-t[1]),u=(t?c[c.length-1]:c[0])[0],d=e.hexRgb(n),f=e.hexRgb(u),p=e=>`#`+d.map((t,n)=>Math.round(t*e+f[n]*(1-e)).toString(16).padStart(2,`0`)).join(``),m=t?.62:.55;for(;m<.9&&e.contrast(p(m),r)<4.5;)m+=.02;l[`glass-tint`]=Math.round(m*100)+`%`,l[`glass-tail`]=Math.round(Math.max(.3,m-.16)*100)+`%`}return l}applySchemeAttrs(){let e=this.cardSurfaceVars(),t=this.accent(),n=t.toLowerCase()===r.ACCENT_DEFAULT?null:r.accentTokens(t,this.scheme()===`dark`),i=window.matchMedia&&window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches,o=this.glassPopups()&&!i,s=this.glassControls()&&!i;[this._viewport,...(this._docks||[]).map(e=>e.wrap)].forEach(t=>{t&&(t.setAttribute(`data-mp-scheme`,this.scheme()),t.setAttribute(`data-mp-cards`,this.lightCards()),t.setAttribute(`data-mp-tips`,this.lightTooltips()),t.setAttribute(`data-mp-selected`,this.selectedStyle()),t.setAttribute(`data-mp-glass`,o?`1`:`0`),t.setAttribute(`data-mp-glass-ctl`,s?`1`:`0`),Object.entries(e).forEach(([e,n])=>n?t.style.setProperty(`--mp-`+e,n):t.style.removeProperty(`--mp-`+e)),t.style.setProperty(`--mp-rk`,String(this.uiRadius()/4)),Object.keys(a.TOKENS.light).filter(e=>/^(accent|focus|fg-on-accent)/.test(e)).forEach(e=>n?t.style.setProperty(`--mp-`+e,n[e]):t.style.removeProperty(`--mp-`+e)))}),this.el&&(this.el.style.borderRadius=this.uiRadius()*a.UI_RADIUS_OUTER+`px`),this.applyContainer()}async setScheme(e){if(![`light`,`dark`,`auto`].includes(e))throw Error(`scheme must be 'light', 'dark' or 'auto'`);this.props=Object.assign({},this.props,{scheme:e});let t=this.resolvedScheme();return t===this._scheme||!this.renderer?(this.applySchemeAttrs(),t):(this.applyThemeLive(),t)}async setAccent(e){if(e!=null&&!r.hexRgb(e))throw Error(`accent must be a hex colour such as #1476ff`);return this.props=Object.assign({},this.props,{accent:e||null}),this.applySchemeAttrs(),this.renderer&&this.accent()!==r.accent?this.applyThemeLive():this.emitScheme(),this.accent()}setSelectedStyle(e){if(![`neutral`,`accent`].includes(e))throw Error(`selected must be 'neutral' or 'accent'`);return this.props=Object.assign({},this.props,{selected:e}),this.applySchemeAttrs(),e}themed(e,t,n){if(!e||!e.color)return e;let i=r.parseThemeSpec(t)||(n?{hex:t,role:n}:null);return i?(e.userData.theme=i,(this._themedMats=this._themedMats||new Set).add(e),e.color.set(r.themeColor(i.hex,i.role))):t!=null&&e.color.set(t),e}applyThemeLive(){if(!this.renderer||!this.scene)return;let e=this.THREE,t=a;this.prepareScheme(),Object.keys(t.unitPalette).forEach(n=>{let r=this._paletteColors[n]=this._paletteColors[n]||[];t.unitPalette[n].forEach((t,n)=>r[n]?r[n].set(t):r[n]=new e.Color(t))}),(this._units||[]).forEach(e=>e.pcK=null);let n=t.scenePalette;(this._liftColors||[]).forEach((e,t)=>n.lift[t]&&e.set(n.lift[t])),this._escalatorPalette&&(this._escalatorPalette.n.forEach((e,t)=>e.set(n.escalator[t])),this._escalatorPalette.h.forEach((e,t)=>e.set(n.escalatorActive[t]))),this._hemiLight&&this._hemiLight.groundColor.set(n.groundLight),this.renderer.setClearColor(n.background,0),(this._stepCanvases||[]).forEach(e=>e.draw());let i=[],o=new Set(this._themedMats||[]);this.scene.traverse(e=>[].concat(e.material||[]).forEach(e=>e&&o.add(e))),o.forEach(t=>{let n=t.userData&&t.userData.theme;if(!n||!t.color)return;let a=new e.Color(r.themeColor(n.hex,n.role));t.color.equals(a)||i.push({color:t.color,from:t.color.clone(),to:a})}),this._themeTween=i.length?{items:i,start:performance.now(),ms:this._reducedMotion?0:200}:null,this._themeTween&&!this._themeTween.ms&&this.stepThemeTween(1/0),this.emitScheme()}stepThemeTween(e){let t=this._themeTween;if(!t)return;let n=t.ms?Math.min(1,(e-t.start)/t.ms):1,r=n*n*(3-2*n);t.items.forEach(e=>e.color.copy(e.from).lerp(e.to,r)),n>=1&&(this._themeTween=null)}emitScheme(){this.emit(`scheme`,{scheme:this.scheme(),lightCards:this.lightCards(),lightTooltips:this.lightTooltips(),accent:this.accent()})}setLightCards(e){if(![`dark`,`white`].includes(e))throw Error(`lightCards must be 'dark' or 'white'`);return this.props=Object.assign({},this.props,{lightCards:e}),this.applySchemeAttrs(),this.emitScheme(),e}setLightTooltips(e){if(e!=null&&![`dark`,`white`].includes(e))throw Error(`lightTooltips must be 'dark', 'white' or null`);return this.props=Object.assign({},this.props,{lightTooltips:e??null}),this.applySchemeAttrs(),this.emitScheme(),this.lightTooltips()}setGlassPopups(e){return this.props=Object.assign({},this.props,{glassPopups:!!e}),this.applySchemeAttrs(),this.emitScheme(),!!e}setGlassControls(e){return this.props=Object.assign({},this.props,{glassControls:!!e}),this.applySchemeAttrs(),this.emitScheme(),!!e}baseCss(t,n){t!==`tokens`&&!e.sheets.has(`tokens`)&&this.baseCss(`tokens`,a.tokenCss());let r=e=>e.split(`,`).map(e=>e.trim()).map(e=>e===`&`?`.mp-map`:e[0]===`&`?`.mp-map`+e.slice(1):`.mp-map `+e).join(`, `),i=typeof n==`string`?n:Object.entries(n).map(([e,t])=>r(e)+` { `+t+` }`).join(`
4147
4181
  `);e.define(t,i)}applyCss(){let t=this._viewport;if(!t)return;let n=this._cssId=this._cssId||`mp`+Math.random().toString(36).slice(2,8),r=this.css();t.setAttribute(`data-mp-id`,n),t.classList.add(`mp-map`),this.applySchemeAttrs();let i=this._cssEl;if(!r)i&&(i.remove(),this._cssEl=null);else{if(!i){i=this._cssEl=document.createElement(`style`),i.setAttribute(`data-mapplic-css`,n);let t=this._styleRoot||document,r=e.parent(t);r.insertBefore(i,r.querySelector(`style[data-mapplic-page],style[data-mp-rules]`))}i.textContent=`.mp-map[data-mp-id="`+n+`"] {
4148
4182
  `+r+`
4149
- }`}}tint(e,t){let n=this.match(e),r=t?this.tintOf(t):null;return this._tints=this._tints||{},n.forEach(e=>{r?this._tints[e.id]=r:delete this._tints[e.id]}),n.length}mergeUnits(e,t){let n=(e||[]).map(e=>this._resolveStore(e)),r=n[0],i=n.slice(1).filter(e=>e.id!==r.id);if(!i.length)throw Error(`Need at least two different units`);if(i.some(e=>e.level!==r.level))throw Error(`Units must be on the same floor`);let a=this._unitById[r.id],o=[];if(i.forEach(e=>o.push(e.id,...this._unitById[e.id].merged)),!this.applyMerge(r.id,[...new Set(a.merged.concat(o))]))throw Error(`These units do not share a wall, so they cannot be merged`);i.forEach(e=>{this._unitById[e.id].merged=[]});let s=n.map(e=>e.name);return this.updateStore(r,t),this.closePopups(),Object.assign(this.info(r),{merged:s})}splitUnit(e){let t=this._resolveStore(e),n=this._unitById[t.id];if(!n||!n.merged.length)throw Error(t.name+` is not a merged unit`);let r=n.merged.length+1;return this.applyMerge(t.id,[]),this.closePopups(),r}reset(){(this._plugins||[]).filter(e=>!e.builtin).forEach(e=>this.uninstall(e)),this._plugReg=[],this._tints={},a.raw&&this._pluginsAtLoad!==void 0&&(a.raw.plugins=JSON.parse(this._pluginsAtLoad)),Object.keys(this._unitById||{}).forEach(e=>{let t=this._unitById[e];this.applyStore(e,{name:t.nameOrig,cat:t.catOrig,hours:t.hoursOrig,heightScale:1,labelScale:1,labelRotation:0,labelOffset:[0,0],label:t.labelOrig!==!1,logo:`orig`,merged:[]})}),this.hideRoute(),this.closePopups({optionOverrides:null,all:!1,level:r.startLevel||0}),this.camGoal&&this.goHome(!1),this.bootPlugins(),this._plugChanged(null)}exportMap(){let e=a,t=e.raw;if(!t)throw Error(`Map not loaded`);this._pluginConfig();let n=JSON.parse(JSON.stringify(t)),i=e=>Math.round(e*100)/100,o=e=>Math.round(e*1e6)/1e6,s=e.toLngLat||(((e.raw||{}).crs||{}).type===`geographic`?(()=>{let t=(e.raw||{}).georef||{},n=t.projection;return r.projection(n,t.origin,+t.scale||1).inv})():null),c=s?(t,n)=>s(e.toMetres(t,n)).map(o):(t,n)=>e.toMetres(t,n).map(i);e.originalLocations&&((n.sources||{}).locations||[]).length&&(n.locations=JSON.parse(e.originalLocations)),this._shapesEd&&this._writeShapes(n,e=>{let t=e.map(e=>c(e[0],e[1]));return t.push(t[0].slice()),[t]},c);let l={};Object.values(this._unitById||{}).forEach(e=>{let t=this._byId&&this._byId[e.id],n=t&&t.item.store,r=e.r&&e.r.featureId;if(!r)return;let i={};n&&(n.name!==e.nameOrig&&!(e.r&&n.name===a.unitName(e.r))&&(i.name=n.name),e.catOrig!==void 0&&n.cat!==e.catOrig&&(i.category=n.cat),(n.hours||``)!==(e.hoursOrig||``)&&(i.hours=n.hours)),e.heightScale&&e.heightScale!==1&&(i.height=e.heightScale),e.logo&&e.logo!==`orig`&&(i.logo=e.logo),e.labelScale&&e.labelScale!==1&&(i.label_scale=e.labelScale),e.labelRotation&&(i.label_rotation=e.labelRotation),e.labelOffset&&(e.labelOffset[0]||e.labelOffset[1])&&(i.label_offset=e.labelOffset.slice()),e.r&&e.labelOrig!==void 0&&!e.r.noLabel!==e.labelOrig&&(i.label=!e.r.noLabel),e.merged&&e.merged.length&&(i.merge=e.merged.map(e=>((this._unitById[e]||{}).r||{}).featureId).filter(Boolean));let o=this._tints&&this._tints[e.id];o&&o.hex&&(i.tint=o.hex),Object.keys(i).length&&(l[r]=i)});let u=new Set(Object.values(this._unitById||{}).map(e=>e.r&&e.r.featureId).filter(Boolean));Object.entries(((e.raw||{}).edits||{}).units||{}).forEach(([e,t])=>{t&&(u.has(e)?t.vacant&&(l[e]=Object.assign({},l[e],{vacant:!0})):l[e]=Object.assign({},t,l[e]))}),n.edits=Object.assign({},n.edits),Object.keys(l).length?n.edits.units=l:delete n.edits.units,Object.keys(n.edits).length||delete n.edits;let d=this.state.optionOverrides||{},f=n.plugins;return this.builtinList().forEach(e=>{e.opt&&d[e.opt]!==void 0&&((f.builtin[e.id]=f.builtin[e.id]||{}).enabled=!!d[e.opt])}),this.prunePluginDefaults(f),!Object.keys(f.builtin).length&&!f.custom.length&&delete n.plugins,n}prunePluginDefaults(e){let t=e&&e.builtin||{},n=(e,t)=>JSON.stringify(e)===JSON.stringify(t);return Object.keys(t).forEach(e=>{let r=t[e],i=this.builtin(e);if(!r||typeof r!=`object`)return delete t[e];i&&!i.internal&&(r.enabled!==void 0&&!!r.enabled===(i.locked||i.def!==!1)&&delete r.enabled,r.settings&&(Object.keys(r.settings).forEach(e=>{let t=(i.settings||{})[e];t&&t.default!==void 0&&n(r.settings[e],t.default)&&delete r.settings[e]}),Object.keys(r.settings).length||delete r.settings),Object.keys(r).length||delete t[e])}),e}async saveMap(e,t){let n=a,r=e||this.exportMap(),i=Date.now();if(typeof this.props.onSave==`function`){let e=await this.props.onSave(r,{etag:this.etag(),overwrite:!!(t&&t.overwrite),summary:(t&&Array.isArray(t.summary)?t.summary:[]).map(String)})||{};return e.etag&&(this._etag=e.etag),n.savedCopy={at:i,host:!0},i}return await n.savedStore(`put`,n.savedKey(this.props.src||`mall.mapplic.json`),{map:r,at:i,base:n.baseUpdatedAt}),n.savedCopy={at:i},i}etag(){return this._etag||this.props.etag||null}static SAVE_ERRORS=[`conflict`,`unauthorized`,`invalid`,`notFound`,`failed`];static saveErrorCode(e){let t=e&&(e.code||e.type);return a.SAVE_ERRORS.includes(t)?t:`failed`}async discardSaved(){let e=a;await e.savedStore(`delete`,e.savedKey(this.props.src||`mall.mapplic.json`)),e.savedCopy=null}downloadMap(e){let t=this.exportMap(),n=e||String(this.props.src||`map.mapplic.json`).split(`/`).pop().split(`?`)[0],r=document.createElement(`a`);return r.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:`application/json`})),r.download=n,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(r.href),4e3),n}snapshot(e){let t=e||{},n=Math.round(t.width??600),r=Math.round(t.height??600),i=String(t.type||`image/webp`),a=t.quality??.85;if(!(n>=1&&r>=1&&n<=4096&&r<=4096))return Promise.reject(Error(`snapshot: width and height must be 1 to 4096 px`));let o=()=>this._snapshot(n,r,i,+a),s=(this._snapshotQueue||Promise.resolve()).then(o,o);return this._snapshotQueue=s.catch(()=>{}),s}async _snapshot(e,t,n,r){let i=e=>new Promise(t=>setTimeout(t,e)),o=()=>this._destroyed||!this.el,s=()=>{if(o())throw Error(`snapshot: the map is not mounted`)},c=async(e,t)=>{let n=performance.now();for(;;){if(s(),e._destroyed)throw Error(`snapshot: the map is not mounted`);if(e.state.err)throw Error(`snapshot: `+e.state.err);if(e.state.ready)return;if(t&&performance.now()-n>t)throw Error(`snapshot: the map did not load in time`);await i(50)}};if(s(),!a.webglAvailable())throw Error(`snapshot: WebGL is not available`);await c(this);let l={};Object.keys(this.props).forEach(e=>typeof this.props[e]!=`function`&&(l[e]=this.props[e])),Object.assign(l,{data:JSON.parse(JSON.stringify(this.exportMap())),load:null,scheme:`light`,language:this.language(),savedCopies:!1,plugins:!1,_snapshot:!0});let u=document.createElement(`div`);u.setAttribute(`aria-hidden`,`true`),u.style.cssText=`position:fixed;left:0;top:0;width:`+e+`px;height:`+t+`px;visibility:hidden;pointer-events:none;z-index:-1;overflow:hidden;contain:strict`,document.body.appendChild(u);let d=new(a.isolated())({options:l});try{d.mount(a.shadowBox(u,`:host{display:block}`)),await c(d,3e4),await i(80);try{d.plugins().some(e=>e.id===`attract`&&e.enabled)&&await d.setPlugin(`attract`,{enabled:!1})}catch{}await d.loadsSettled();try{await document.fonts.ready}catch{}if(s(),!d.renderer)throw Error(`snapshot: WebGL is not available`);cancelAnimationFrame(d._frameId),d._reducedMotion=!0;let o=Math.max(e,t)*2<=4096?2:1;d.renderer.setPixelRatio(o);let l=d.snapshotView(e,t),f=()=>{d._insets={},d._flight=null,d._inertia=null,d.camGoal=Object.assign({},l),d.camView=Object.assign({},l),d._forceFrame=!0,d.loop(performance.now()),d._forceFrame=!1,cancelAnimationFrame(d._frameId)};f(),await i(0),f(),await i(0),s();let p=document.createElement(`canvas`);p.width=e,p.height=t;let m=p.getContext(`2d`);m.fillStyle=d.constructor.scenePalette.background||`#ffffff`,m.fillRect(0,0,e,t),f(),m.drawImage(d.renderer.domElement,0,0,e,t);let h=await new Promise(e=>p.toBlob(e,n,r));if(s(),!h)throw Error(`snapshot: the image could not be encoded`);return h}finally{try{d.destroy()}catch{}u.remove()}}static webglAvailable(){try{let e=document.createElement(`canvas`),t=e.getContext(`webgl2`)||e.getContext(`webgl`);if(!t)return!1;let n=t.getExtension(`WEBGL_lose_context`);return n&&n.loseContext(),!0}catch{return!1}}snapshotView(e,t){let n=a,r=this.THREE,i=e/t,o=n.bounds,s=this.home(!1);if(s.distance=Math.max(1.18*n.homeExtent[0]/(n.FOV_TAN*i),n.homeExtent[1]/n.FOV_TAN),!r||!(o[1]-o[0]>.5&&o[3]-o[2]>.5))return s;let c=n.FLOOR_TOP+n.storeyHeight,l=[];[o[0],o[1]].forEach(e=>[o[2],o[3]].forEach(t=>[0,c].forEach(n=>l.push(new r.Vector3(e,n,t)))));let u=new r.PerspectiveCamera(30,i,.5,1e6),d=new r.Vector3,f=new r.Vector3,p=new r.Vector3;for(let e=0;e<8;e++){this.aimCamera(u,s);let e=1/0,t=-1/0,r=1/0,a=-1/0;l.forEach(n=>{d.copy(n).project(u),e=Math.min(e,d.x),t=Math.max(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.y)});let o=s.distance*n.FOV_TAN,c=o*i;f.setFromMatrixColumn(u.matrixWorld,0),p.setFromMatrixColumn(u.matrixWorld,1);let m=(e+t)/2*c,h=(r+a)/2*o;s.targetX+=f.x*m+p.x*h,s.targetY+=f.y*m+p.y*h,s.targetZ+=f.z*m+p.z*h,s.distance*=Math.max((t-e)/2,(a-r)/2)/.9}return s}aimCamera(e,t){let n=Math.sin(t.polar);return e.position.set(t.targetX+t.distance*n*Math.sin(t.azimuth),t.targetY+t.distance*Math.cos(t.polar),t.targetZ+t.distance*n*Math.cos(t.azimuth)),t.polar<.05?e.up.set(-Math.sin(t.azimuth),0,-Math.cos(t.azimuth)):e.up.set(0,1,0),e.lookAt(t.targetX,t.targetY,t.targetZ),e.updateMatrixWorld(),e.updateProjectionMatrix(),e}trackLoad(e){let t=this._loads=this._loads||new Set,n=Promise.resolve(e);t.add(n);let r=()=>t.delete(n);return n.then(r,r),e}async loadsSettled(){for(let e=0;e<20&&this._loads&&this._loads.size;e++)await Promise.allSettled([...this._loads])}_writeShapes(e,t,n){let i=a,o=i.source(),s=i.levelIds,c=e=>e.properties.feature_type,l={},u={shape:[],opening:[],void:[],connector:[]};e.features.forEach(e=>{l[e.id]=e});let d=(e,t)=>{let n=l[e];return n&&c(n)===t?n:{type:`Feature`,id:e,properties:{feature_type:t}}},f=i.toLngLat||((i.raw||{}).crs||{}).type===`geographic`?2e-6:.006,p=(e,t)=>Math.abs(e[0]-t[0])<=f&&Math.abs(e[1]-t[1])<=f,m=e=>e.length>1&&p(e[0],e[e.length-1])?e.slice(0,-1):e,h=(e,t,n)=>{e=m(e),t=m(t);let r=e.length;if(r!==t.length||!r)return!1;for(let i=0;i<(n?r:1);i++)for(let a of n?[1,-1]:[1])if(e.every((e,n)=>p(e,t[((i+a*n)%r+r)%r])))return!0;return!1},g=(e,t,n)=>{let r=e.geometry;return!!(r&&r.type===`Polygon`&&r.coordinates&&r.coordinates.length===t.length&&t.every((e,t)=>h(r.coordinates[t],e,n||t>0)))};o.unitRows.forEach((e,i)=>e.forEach(e=>{let a=d(e.featureId,`shape`),o=a.properties,c=!l[e.featureId],f=t(e.points).concat((e.holes||[]).map(e=>t(e)[0]));(c||!g(a,f))&&(a.geometry={type:`Polygon`,coordinates:f}),o.layer=s[i],e.kiosk?o.kiosk=!0:delete o.kiosk,c&&e.fileCategory&&(o.category=e.fileCategory),u.shape.push(a),e.openings&&!e.openingsAuto&&e.openings.forEach((t,i)=>{if(!e.points[t.edge])return;let a=e=>Math.round(e*1e4)/1e4,o=Math.max(1,t.span|0),[s,c]=r.openingRange(t),l={feature_type:`opening`,unit:e.featureId,edge:t.edge,t:[a(t.start),a(t.end)]};o>1&&(l.span=o),u.opening.push({type:`Feature`,id:e.featureId+`-op-`+(i+1),geometry:{type:`LineString`,coordinates:r.ringPath(e.points,s,c).map(e=>n(e[0],e[1]))},properties:l})})})),o.voidPolys.forEach((e,n)=>e.forEach((e,r)=>{let i=d((o.voidIds[n]||[])[r]||s[n]+`-void-`+(r+1),`void`),a=t(e);g(i,a)||(i.geometry={type:`Polygon`,coordinates:a}),i.properties.layer=s[n],u.void.push(i)})),o.connectors.forEach(e=>{if(l[e.id]&&c(l[e.id])===`connector`&&e.loadedKey&&e.loadedKey===i.connectorKey(e)){u.connector.push(l[e.id]);return}let n=d(e.id,`connector`),r=n.properties,a=e,o=t(i.connectorPolygon(a)),f=i.fitConnector(o[0].slice(0,-1).map(i.toScene));f.axisX*a.axisX+f.axisZ*a.axisZ<0&&(o=[o[0].slice().reverse()]);let p=n.geometry,m=g(n,o,!0)&&i.fitConnector(p.coordinates[0].slice(0,-1).map(i.toScene));m&&m.axisX*a.axisX+m.axisZ*a.axisZ>.99||(n.geometry={type:`Polygon`,coordinates:o}),r.connector_type=e.type,r.layers=e.layers.map(e=>s[e]),e.type!==`elevator`&&(e.dir===`down`||r.direction)&&(r.direction=e.dir),e.type===`stairs`&&(r.stair_shape=e.shape,(e.shape!==`straight`||r.turn)&&(r.turn=e.turn)),u.connector.push(n)});let _=e.features.filter(e=>c(e)===`building`),v=new Set,y=[];o.floorPolys.forEach((e,t)=>{!t||o.floorOwn[t]?y.push({levelIndex:t,lids:[s[t]],P:e}):y[y.length-1].lids.push(s[t])});let b=y.map(e=>{let n=_.find(t=>!v.has(t)&&(t.properties.layers||[t.properties.layer]).includes(s[e.levelIndex]));return n||={type:`Feature`,id:s[e.levelIndex]+`-building`,properties:{feature_type:`building`}},v.add(n),n.geometry={type:`Polygon`,coordinates:t(e.P)},delete n.properties.layer,n.properties.layers=e.lids,n});if(i.toLngLat){let e={},t=[];u.shape.forEach(n=>{let r=/^(.*)~(\d+)$/.exec(String(n.id)),i=r?r[1]:String(n.id);e[i]||(e[i]=[],t.push(i)),e[i].push([r?+r[2]:0,n])}),u.shape=t.map(t=>{let n=e[t].sort((e,t)=>e[0]-t[0]),r=l[t]||n[0][1];return r.id=t,r.geometry=n.length>1?{type:`MultiPolygon`,coordinates:n.map(e=>e[1].geometry.coordinates)}:n[0][1].geometry,r}),b.length=0,_.forEach(e=>b.push(e))}e.features=e.features.filter(e=>!u[c(e)]&&c(e)!==`building`).concat(b,u.shape,u.opening,u.void,u.connector)}applyEdits(e){if(e||=((a.raw||{}).edits||{}).units,!e)return;let t={};Object.values(this._unitById||{}).forEach(e=>{e.r&&e.r.featureId&&(t[e.r.featureId]=e)}),Object.entries(e).forEach(([e,n])=>{let r=t[e];r&&n&&(n.merge&&this.applyMerge(r.id,n.merge.map(e=>t[e]&&t[e].id).filter(Boolean)),this.applyStore(r.id,{name:n.name,cat:n.category,hours:n.hours,heightScale:n.height,labelScale:n.label_scale,labelRotation:n.label_rotation,labelOffset:n.label_offset?a.labelOffsetOf(n.label_offset):void 0,label:typeof n.label==`boolean`?n.label:void 0,logo:n.logo}),n.tint&&((this._tints=this._tints||{})[r.id]=this.tintOf(n.tint)))})}static PLUGIN_ICONS={sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,"map-pin":`<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>`,phone:`<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>`,globe:`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`,map:`<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>`,box:`<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>`,shapes:`<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>`,database:`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>`,focus:`<circle cx="12" cy="12" r="3"/><path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/>`,plug:`<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/>`,tag:`<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>`,"circle-dot":`<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="1"/>`,clock:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,"message-square":`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,route:`<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>`,trees:`<path d="M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z"/><path d="M7 16v6"/><path d="M13 19v3"/><path d="M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5"/>`,pointer:`<path d="M22 14a8 8 0 0 1-8 8"/><path d="M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"/><path d="M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"/><path d="M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>`,search:`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,list:`<path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/>`,"monitor-play":`<path d="M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z"/><path d="M12 17v4"/><path d="M8 21h8"/><rect x="2" y="3" width="20" height="14" rx="2"/>`,"plane-landing":`<path d="M2 22h20"/><path d="M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z"/>`,orbit:`<path d="M20.341 6.484A10 10 0 0 1 10.266 21.85"/><path d="M3.659 17.516A10 10 0 0 1 13.74 2.152"/><circle cx="12" cy="12" r="3"/><circle cx="19" cy="5" r="2"/><circle cx="5" cy="19" r="2"/>`,grip:`<circle cx="12" cy="5" r="1"/><circle cx="19" cy="5" r="1"/><circle cx="5" cy="5" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="12" cy="19" r="1"/><circle cx="19" cy="19" r="1"/><circle cx="5" cy="19" r="1"/>`,link:`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,layers:`<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>`,languages:`<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>`,ruler:`<path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"/><path d="m14.5 12.5 2-2"/><path d="m11.5 9.5 2-2"/><path d="m8.5 6.5 2-2"/><path d="m17.5 15.5 2-2"/>`,palette:`<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/>`,puzzle:`<path d="M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"/>`};static pluginIconSvg(e,t=16){let n=a.PLUGIN_ICONS[e]||a.PLUGIN_ICONS.puzzle;return`<svg xmlns="http://www.w3.org/2000/svg" width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="`+(t>16?1.75:2)+`" stroke-linecap="round" stroke-linejoin="round">`+n+`</svg>`}static BUILTINS=[{id:`core`,icon:`box`,name:`Renderer`,category:`Core`,help:`Draws the 3D map and runs the camera: pan, zoom, rotate, tilt, the all-levels view and 2D mode (top-down, fixed heading). Sun shadows are a setting.`,desc:`3D drawing, lighting and the camera`,locked:!0,settings:{shadows:{type:`boolean`,default:!0,label:`Sun shadows`,opt:`shadows`,help:`Buildings and stores cast soft sun shadows. Off draws faster on slow devices.`},shadow_strength:{type:`number`,default:100,min:10,max:100,step:5,unit:`%`,label:`Shadow strength`,when:{shadows:!0},opt:`shadowStrength`,help:`How dark the shadows are. Lower suits light, airy styles.`},wheel:{type:`choice`,options:[`zoom`,`modifier`,`off`],default:`zoom`,input:`select`,labels:{zoom:`Zoom`,modifier:`With Ctrl / ⌘`,off:`Off`},label:`Mouse wheel`,opt:`wheel`,help:`What the mouse wheel does over the map. Ctrl / ⌘ + wheel lets the page scroll and shows how to zoom. Off: zoom with the buttons or a pinch.`,hint:`Trackpad pinch still zooms with the modifier; full screen always zooms.`}}},{id:`data`,icon:`database`,name:`Map data`,category:`Core`,help:`Reads the map file: units, levels, floor links, doors, merged units, tints and heights. Also works out walking routes, which Wayfinding draws.`,desc:`Units, levels, floor links, doors, merged units, tints and heights`,locked:!0},{id:`selection`,icon:`focus`,name:`Selection`,category:`Core`,help:`Tracks what is hovered and selected, colours it and flies the camera to it. Popups, Labels and Wayfinding build on it.`,desc:`Hover, select and focus a place`,locked:!0},{id:`api`,icon:`plug`,name:`Plugin API`,category:`Core`,help:`The calls and events that plugins and host pages use. Built-in and custom plugins share the same API.`,desc:`Events and calls for plugins and the host page`,locked:!0},{id:`appearance`,icon:`palette`,name:`Appearance`,category:`Core`,help:`How the map looks: colour scheme, cards, roundness, store colours on hover and selection, the level gap, and the map's box (background, drawing past its edges, edge fade). Always on; each view can set it differently.`,desc:`Colour scheme, cards, roundness and the map's box`,always:!0,main:`theme`,panels:{theme:{label:`Theme`,keys:[`scheme`,`selected`,`light_cards`,`light_tooltips`,`unit_states`,`glass_popups`,`glass_controls`,`ui_radius`],breaks:[`glass_popups`]},container:{label:`Container`,keys:[`background`,`bleed`,`edge_fade`]}},settings:{scheme:{type:`choice`,options:[`light`,`dark`,`auto`],default:`light`,label:`Colour scheme`,icons:{light:`sun`,dark:`moon`},help:`Light or dark map. Auto follows the visitor's device setting.`},selected:{type:`choice`,options:[`neutral`,`accent`],default:`neutral`,label:`Selected controls`,help:`How selected controls look, such as the active level: grey, or tinted with the accent colour.`},light_cards:{type:`choice`,options:[`dark`,`white`],default:`dark`,label:`Light-scheme cards`,help:`Popup card colour on the light scheme.`},light_tooltips:{type:`choice`,options:[`cards`,`dark`,`white`],default:`cards`,input:`select`,labels:{cards:`Same as cards`,dark:`Dark`,white:`White`},label:`Light-scheme tooltips`,help:`Colour of hover tooltips and level tags on the light scheme.`},unit_states:{type:`choice`,options:[`accent`,`category_hover`,`category`],default:`accent`,input:`select`,labels:{accent:`Accent`,category_hover:`Category on hover`,category:`Category`},label:`Store colours`,help:`Store colours on hover and selection: the accent colour, or each store's category colour.`,hint:`accent: built-in hover, selection in the accent. category_hover: hover tints in the category colour, selection stays the accent. category: both. Only stores whose main category has a colour.`},glass_popups:{type:`boolean`,default:!1,label:`Glass popups`,help:`Popup cards get a frosted glass look.`},glass_controls:{type:`boolean`,default:!1,label:`Glass controls`,help:`Map controls, the search box and its filters, and the Directions button get a frosted glass look.`},ui_radius:{type:`number`,default:4,min:0,max:8,step:1,label:`Roundness`,help:`How rounded the map, its controls, cards and panels are. 0 is square, 4 the default.`},exploded_view:{type:`boolean`,default:!0,multiLevel:!0,label:`Exploded view`,help:`All levels can show at once, opened apart: the All levels button, Attract mode, category zoom.`,hint:`Off: one level at a time everywhere. The editor shows it in the Levels panel.`},level_spacing:{type:`number`,default:12,min:0,max:50,step:1,unit:`%`,label:`Level gap`,explode:!0,help:`Space between floors when all levels show at once.`,hint:`A share of the map size; the exploded (all levels) view.`},background:{type:`boolean`,default:!0,label:`Background`,help:`Fills the map's box with colour. Off: transparent, so the page shows through.`},bleed:{type:`number`,default:0,min:0,max:600,step:10,unit:`px`,zero:`None`,unlimited:`No limit`,label:`Overflow`,help:`Lets the 3D map draw past its box on every side. Controls stay inside the box.`,hint:`No limit: up to the nearest parent that clips, else the window. The page under the overflow stays clickable.`},edge_fade:{type:`number`,default:0,min:0,max:400,step:10,unit:`px`,zero:`None`,label:`Edge fade`,help:`Fades the map out towards its outer edges over this distance.`,hint:`With overflow: the overflow edges.`}}},{id:`size`,icon:`ruler`,name:`Size`,category:`Core`,help:`The map's height: fill the element it sits in, a share of the screen, an aspect ratio or fixed pixels, with limits and a separate choice for narrow screens. The map's own UI never changes it. Always on; each view can set it differently.`,desc:`The map's height, also on narrow screens`,always:!0,panels:{size:{label:`Size`,keys:[`mode`,`screen`,`offset`,`ratio`,`px`,`min`,`max`,`narrow_mode`,`narrow_screen`,`narrow_ratio`,`narrow_px`],breaks:[`min`,`narrow_mode`]}},settings:{mode:{type:`choice`,options:[`container`,`screen`,`ratio`,`fixed`],default:`container`,input:`select`,labels:{container:`Fill container`,screen:`Share of screen`,ratio:`Aspect ratio`,fixed:`Fixed`},label:`Height`,help:`How the map's height is set: by the element it sits in, a share of the screen, an aspect ratio, or a fixed height.`,hint:`Fill container with a container that has no height falls back to 80% of the screen.`},screen:{type:`number`,default:80,min:20,max:100,step:5,unit:`%`,when:{mode:`screen`},label:`Screen share`,help:`Map height as a share of the window's height.`},offset:{type:`number`,default:0,min:0,max:400,step:4,unit:`px`,zero:`None`,when:[{mode:`screen`},{narrow_mode:`screen`}],label:`Minus`,help:`Taken off the screen share, for example the height of a sticky site header.`},ratio:{type:`choice`,options:[`21:9`,`16:9`,`3:2`,`4:3`,`1:1`,`3:4`,`9:16`],default:`16:9`,input:`select`,when:{mode:`ratio`},label:`Ratio`,help:`Width to height; the map's height follows its width.`},px:{type:`number`,default:600,min:200,max:1600,step:10,unit:`px`,when:{mode:`fixed`},label:`Height`,help:`The map's height in pixels.`},min:{type:`number`,default:480,min:0,max:1200,step:10,unit:`px`,zero:`None`,when:[{mode:[`screen`,`ratio`]},{narrow_mode:[`screen`,`ratio`]}],label:`Min height`,help:`The map never gets shorter than this.`,hint:`Applies to share of screen and aspect ratio.`},max:{type:`number`,default:900,min:0,max:2e3,step:10,unit:`px`,zero:`None`,when:[{mode:[`screen`,`ratio`]},{narrow_mode:[`screen`,`ratio`]}],label:`Max height`,help:`The map never gets taller than this.`,hint:`Applies to share of screen and aspect ratio.`},narrow_mode:{type:`choice`,options:[`same`,`container`,`screen`,`ratio`,`fixed`],default:`same`,input:`select`,labels:{same:`Same as wide`,container:`Fill container`,screen:`Share of screen`,ratio:`Aspect ratio`,fixed:`Fixed`},label:`Narrow screens`,help:`The map's height on screens under 640 px wide, such as phones.`,hint:`640 px is also where the Directory moves below the map. Not adjustable.`},narrow_screen:{type:`number`,default:60,min:20,max:100,step:5,unit:`%`,when:{narrow_mode:`screen`},label:`Narrow share`,help:`Map height on narrow screens, as a share of the window's height.`},narrow_ratio:{type:`choice`,options:[`21:9`,`16:9`,`3:2`,`4:3`,`1:1`,`3:4`,`9:16`],default:`3:4`,input:`select`,when:{narrow_mode:`ratio`},label:`Narrow ratio`,help:`Width to height on narrow screens.`},narrow_px:{type:`number`,default:480,min:200,max:1600,step:10,unit:`px`,when:{narrow_mode:`fixed`},label:`Narrow height`,help:`The map's height in pixels on screens under 640 px wide.`}}},{id:`labels`,icon:`tag`,name:`Labels`,category:`Plugin`,help:`Shows each location's logo or name on its roof, as large as fits inside the shape. Sizes are set for the map and can be changed per category or location; each label can also be scaled, rotated or moved per store. Names fade out when they get too small to read.`,desc:`Name and logo over each location`,main:`labels`,panels:{labels:{label:`Labels`,keys:[`name`,`logo`,`text_fill`,`text_height`,`text_max`,`logo_fill`,`logo_max`,`min_px`,`logo_min_px`],breaks:[`text_fill`,`min_px`]},layout:{label:`Label layout`,keys:[`uppercase`,`snap`,`wrap`,`wrap_gain`]}},settings:{name:{type:`boolean`,default:!0,label:`Name`,opt:`labels`,help:`Store names are drawn on the map.`},logo:{type:`boolean`,default:!0,label:`Logo`,help:`Store logos are drawn on the map where a store has one.`},text_fill:{type:`number`,default:70,min:20,max:100,step:1,unit:`%`,label:`Name size`,help:`How much of the store's space a name may fill.`,hint:`Share of the largest box of its proportions that fits inside the unit.`},text_height:{type:`number`,default:29,min:10,max:100,step:1,unit:`%`,label:`Name height`,help:`Limits letter size in square stores, so short names don't get oversized.`,hint:`Largest letter size as a share of the box height.`},text_max:{type:`number`,default:1.92,min:.5,max:8,step:.1,unit:`m`,label:`Largest name`,help:`Largest letter size, in metres. Raise it for short labels such as lot numbers.`},logo_fill:{type:`number`,default:30,min:10,max:100,step:1,unit:`%`,label:`Logo size`,help:`Logo size relative to its store. Wide and compact logos come out equally heavy.`,hint:`Logos are sized by area.`},logo_max:{type:`number`,default:20,min:0,max:60,step:1,unit:`m`,zero:`No limit`,label:`Largest logo`,help:`Limits logo size in big stores, in metres. 0 = no limit.`,hint:`The side of a square of the same area.`},uppercase:{type:`boolean`,default:!0,label:`Capital letters`,help:`Names are drawn in capital letters. Off: as written.`},snap:{type:`number`,default:45,min:0,max:90,step:15,unit:`°`,zero:`Free`,label:`Angle step`,help:`Label angles snap to this step. 0 follows each shape exactly.`},wrap:{type:`boolean`,default:!0,label:`Wrap names`,help:`Names of several words may break onto 2 or 3 lines.`},wrap_gain:{type:`number`,default:15,min:0,max:100,step:5,unit:`%`,label:`Wrap when larger by`,help:`A name only wraps when that makes it at least this much larger.`},min_px:{type:`number`,default:5.5,min:0,max:20,step:.5,unit:`px`,zero:`Never`,label:`Hide names below`,help:`Names fade out when they would be smaller than this on screen. 0 = never.`},logo_min_px:{type:`number`,default:12,min:0,max:40,step:1,unit:`px`,zero:`Never`,label:`Hide logos below`,help:`Logos fade out when they would be smaller than this on screen. 0 = never.`,hint:`Measured as the square root of the area, so wide wordmarks count like compact logos.`}}},{id:`markers`,icon:`circle-dot`,name:`Markers`,category:`Plugin`,help:`Points on the map: entrances, parking, amenities or any place. Callouts, pins, badges or dots, clickable or not. Optionally, close markers merge into one until you zoom in, with or without a count.`,desc:`Callouts, pins, badges and dots, with clustering`,breaks:[`cluster`],settings:{amenities:{type:`boolean`,default:!0,label:`Amenities as markers`,help:`Restrooms, information desks and other amenities show as icons on the map.`},scale:{type:`number`,default:1,min:.5,max:2,step:.05,label:`Marker size`,help:`Marker size. 1 is the default.`,unit:`×`},min_zoom:{type:`number`,default:.7,min:0,max:1.5,step:.05,label:`Hide below zoom`,help:`Marker names hide when zoomed out past this. 1 is the start view, 0 = never.`,zero:`Never`},cluster:{type:`boolean`,default:!1,label:`Cluster markers`,help:`Markers close together merge into one until you zoom in. Useful on busy maps.`},radius:{type:`number`,default:44,min:16,max:160,label:`Cluster radius`,help:`How close markers must be, in screen pixels, to merge.`,unit:`px`,when:{cluster:!0}},count:{type:`boolean`,default:!0,label:`Count on clusters`,help:`Clusters show how many markers they hold. Off: the closest marker shows instead.`,when:{cluster:!0}}}},{id:`hours`,icon:`clock`,name:`Opening hours`,category:`Plugin`,help:`Works out whether each place is open, closing soon, opening soon or closed, from its hours. Popups show the status and open the week table on click; other plugins can show the status too.`,desc:`Open now status and the week table`,settings:{timezone:{type:`string`,default:``,input:`timezone`,label:`Time zone`,help:`The venue's time zone, for open and closed status. Empty = the visitor's time zone.`,hint:`IANA name, e.g. Europe/Budapest.`},hour12:{type:`boolean`,default:!1,label:`12-hour clock`,help:`Times show as 8 PM instead of 20:00.`},soon:{type:`number`,default:60,min:0,max:240,step:5,label:`Soon within`,help:`Minutes before closing or opening that a place shows "Closing soon" or "Opening soon".`,unit:`min`}}},{id:`popups`,icon:`message-square`,name:`Popups`,category:`Plugin`,help:`Shows a card over the selected store, elevator or bus stop, with its name, hours, floors or departures.`,desc:`Card with name, category and hours when a place is selected`,settings:{open_now:{type:`boolean`,default:!0,label:`Open now status`,help:`Popups show whether the place is open now.`},category_chips:{type:`boolean`,default:!0,label:`Category chips`,help:`Popups show the place's categories as chips; clicking one filters the search.`},directions:{type:`choice`,options:[`primary`,`secondary`],default:`primary`,label:`Directions button`,help:`How the Directions button looks when the place has no link button.`},start_here:{type:`boolean`,default:!1,label:`Start here button`,help:`A button that starts a route from the place.`},style:{type:`choice`,options:[`auto`,`floating`,`sheet`],default:`auto`,label:`Card style`,help:`How popups appear. Auto: a bottom sheet on small touch screens, else a card next to the place.`,labels:{auto:`Auto`,floating:`Floating`,sheet:`Sheet`},hint:`auto: a sheet on touch screens with the map under 480 px, and on any map under 360 px.`}}},{id:`wayfinding`,icon:`route`,name:`Wayfinding`,category:`Plugin`,help:`Adds the Directions button and route panel. Pick a start and a destination to draw an animated walking route across floors.`,desc:`Directions button, route panel and walking routes`,ui:`wayfinding`,settings:{button_label:{type:`boolean`,default:!0,label:`Button label`,help:`The Directions button shows its label. Off: icon only.`},button_position:{type:`choice`,input:`position`,options:[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],default:`top-left`,label:`Button position`,help:`Where the Directions button sits; the route panel opens there.`,labels:{"top-left":`Top left`,"top-center":`Top centre`,"top-right":`Top right`,"bottom-left":`Bottom left`,"bottom-center":`Bottom centre`,"bottom-right":`Bottom right`},hint:`Bottom left: under the compass. On a bottom edge the panel grows upwards.`},layout:{type:`choice`,options:[`auto`,`inline`,`wrapped`],default:`auto`,label:`Panel layout`,help:`Start and destination in one row (Inline) or two (Wrapped). Auto picks by the map width.`},storefronts:{type:`boolean`,default:!0,label:`Storefronts at route ends`,help:`Storefronts are drawn on the stores at both ends of a route.`},units:{type:`choice`,options:[`metric`,`imperial`],default:`metric`,label:`Distance units`,help:`Distances in metres or feet.`},accessible:{type:`boolean`,default:!1,label:`Step-free toggle`,help:`A switch in the directions panel for routes without stairs or escalators.`}}},{id:`scenery`,icon:`trees`,name:`Scenery`,category:`Plugin`,help:`The outdoor site, 3D models, parked and moving cars, bus stops, and the escalator, stair and elevator models.`,desc:`Grass, roads, parking, trees, models, cars and bus stops; escalator and elevator models`,breaks:[`cars`,`connectors`],settings:{trees:{type:`boolean`,default:!0,label:`Trees`,help:`Trees around the site. Off for a cleaner map that draws faster on slow devices.`},cars:{type:`boolean`,default:!0,label:`Cars`,opt:`cars`,help:`Cars on the roads and in the parking areas.`},carsMoving:{type:`boolean`,default:!0,label:`Animate cars`,when:{cars:!0},opt:`motion`,help:`Cars drive along the roads.`},connectors:{type:`boolean`,default:!0,label:`Escalators and elevators`,help:`3D escalators, stairs and elevators.`},connectorsMoving:{type:`boolean`,default:!0,label:`Animate escalators`,when:{connectors:!0},opt:`motion`,help:`Escalator steps move.`}}},{id:`controls`,icon:`pointer`,name:`Controls`,category:`Plugin`,help:`Level switcher, zoom, reset view, full screen, compass, 2D / 3D switch and gesture hint. Each one can be turned off and placed in any of six spots: top or bottom, left, centre or right.`,desc:`Buttons and hints on the map`,main:`buttons`,panels:{buttons:{label:`Controls`,keys:[`levels`,`zoom`,`reset`,`fullscreen`,`compass`,`dimension`,`hint`],breaks:[`hint`]},positions:{label:`Controls position`,keys:[`levels_position`,`zoom_position`,`reset_position`,`fullscreen_position`,`compass_position`,`dimension_position`]}},settings:{levels:{type:`boolean`,default:!0,label:`Level switcher`,ui:`levels`,help:`Buttons for switching between floors.`},zoom:{type:`boolean`,default:!0,label:`Zoom buttons`,ui:`zoom`,help:`Plus and minus buttons for zooming.`},reset:{type:`boolean`,default:!0,label:`Reset view button`,ui:`reset`,help:`A button that goes back to the start view.`},fullscreen:{type:`boolean`,default:!0,label:`Full screen button`,ui:`fullscreen`,help:`A button that shows the map full screen.`},compass:{type:`boolean`,default:!0,label:`Compass`,ui:`compass`,help:`Shows which way is north.`},dimension:{type:`boolean`,default:!0,label:`2D / 3D switch`,ui:`dimension`,help:`A button that switches between the flat 2D map and the 3D view.`},hint:{type:`boolean`,default:!1,label:`Gesture hint`,ui:`hint`,help:`A short note on how to move around the map with a mouse or touch.`},...Object.fromEntries([[`levels`,`Level switcher`,`top-right`],[`zoom`,`Zoom buttons`,`bottom-right`],[`reset`,`Reset view button`,`bottom-right`],[`fullscreen`,`Full screen button`,`bottom-left`],[`compass`,`Compass`,`bottom-left`],[`dimension`,`2D / 3D switch`,`bottom-left`]].map(([e,t,n])=>[e+`_position`,{type:`choice`,input:`position`,options:[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],default:n,label:t.replace(/ button$/,``)+` position`,help:`Where it sits on the map. Controls on the same spot stack away from the edge.`,labels:{"top-left":`Top left`,"top-center":`Top centre`,"top-right":`Top right`,"bottom-left":`Bottom left`,"bottom-center":`Bottom centre`,"bottom-right":`Bottom right`}}]))}},{id:`search`,icon:`search`,name:`Search`,category:`Plugin`,help:`Finds places by name, category, keyword or amenity, forgiving accents and small typos. Filters (category chips, open now, level, custom fields) narrow the results on the map and in the Directory. Without the Directory it is a search box on the map with a dropdown.`,desc:`Search box, filters and map highlight`,main:`main`,panels:{main:{label:`Search`,keys:[`position`,`filters`,`max_width`,`highlight`,`suggestions`,`fuzzy`]},box:{label:`Search box`,keys:[`position`,`max_width`,`blur`,`shortcut`,`filters`,`chip_icons`],breaks:[`filters`]},results:{label:`Search results`,keys:[`highlight`,`highlight_tint`,`fit_category`,`limit`,`suggestions`,`fuzzy`,`intents`,`smart`,`filter_category`,`filter_open`],breaks:[`limit`,`filter_category`]}},def:!1,settings:{position:{type:`choice`,options:[`top-left`,`top-center`,`top-right`,`bottom-center`],default:`top-left`,label:`Position`,help:`Where the search box sits when the Directory is off.`},max_width:{type:`number`,default:0,min:0,max:640,step:10,label:`Max width`,help:`Widest the search box gets. 0 = automatic.`,unit:`px`,zero:`Auto`,hint:`Auto: 360, or 420 when centred. The box shrinks below it to share its row with other controls.`},blur:{type:`boolean`,default:!1,label:`Frosted blur`,help:`Blurs the map behind the search box.`},chip_icons:{type:`boolean`,default:!0,label:`Icons on filter chips`,help:`Category icons on the filter chips.`},highlight:{type:`boolean`,default:!0,label:`Highlight results`,help:`Matching places light up on the map while searching.`},highlight_tint:{type:`boolean`,default:!0,label:`Tint in category colour`,help:`Highlighted places take their category colour.`},fit_category:{type:`boolean`,default:!0,label:`Zoom to category`,help:`Picking a category zooms to its places. On several levels, the levels open (with Exploded view on).`,hint:`Only for a category on its own (no search text or other filter). No zoom when the places cover most of the map.`},filters:{type:`choice`,options:[`chips`,`menu`,`off`],default:`chips`,label:`Filters`,help:`Filters under the search box as chips, behind a filter button, or none.`},filter_category:{type:`boolean`,default:!0,label:`Category filter`,help:`A filter by category.`,hint:`Used when the map file has no search.filters.`},filter_open:{type:`boolean`,default:!0,label:`Open now filter`,help:`A filter for places open now.`,hint:`Used when the map file has no search.filters.`},fuzzy:{type:`boolean`,default:!0,label:`Forgive typos`,help:`Finds names despite small typos.`},limit:{type:`number`,default:0,min:0,max:50,label:`Dropdown results`,help:`Most results in the dropdown. 0 = all; the list scrolls.`,input:`stepper`,zero:`All`},suggestions:{type:`boolean`,default:!0,label:`Suggestions when empty`,help:`Recent and popular places show before typing.`},shortcut:{type:`boolean`,default:!0,label:`"/" shortcut`,help:`Pressing "/" jumps to the search box; a hint shows in it.`},intents:{type:`boolean`,default:!0,label:`Understand phrases`,help:`Understands phrases like "coffee open now on level 2" when the words alone find nothing.`},smart:{type:`boolean`,default:!0,label:`Smart search`,help:`Offers an AI search when nothing matches.`,hint:`Needs MapplicMap.smartSearch from the host page.`}}},{id:`directory`,icon:`list`,name:`Directory`,category:`Plugin`,help:`A browsable list of places next to, below or over the map. Clicking one selects it on the map; selecting on the map scrolls the list to it. List or grid layouts, four item styles, grouping by category, level or letter. With Search on, the search box and filters sit at the top of the list.`,desc:`List of places beside, below or over the map`,main:`main`,panels:{main:{label:`Directory`,keys:[`placement`,`width`,`item`,`columns`,`group`,`sort`,`reel`]},layout:{label:`Directory layout`,keys:[`placement`,`width`,`height`,`max_height`,`map_share`,`sticky_search`,`columns`,`count`,`toggle`,`collapsed`,`title`,`reel`],breaks:[`toggle`]},items:{label:`Directory items`,keys:[`item`,`columns`,`show_category`,`category_style`,`show_level`,`show_hours`,`amenities`,`every_category`],breaks:[`show_category`,`amenities`]},groups:{label:`Directory groups`,keys:[`group`,`sort`,`category_icons`,`counts`,`collapsible`,`rail`,`this_level`],breaks:[`category_icons`]}},def:!1,settings:{placement:{type:`choice`,options:[`left`,`right`,`bottom`,`floating-left`,`floating-right`],default:`left`,label:`Placement`,help:`Where the list sits: beside the map, below it, or floating over it.`,hint:`Narrow screens list below the map, or use a sheet when floating.`},width:{type:`number`,default:340,min:240,max:560,step:10,label:`Width`,help:`Width of the list beside or over the map.`,unit:`px`},height:{type:`choice`,options:[`auto`,`fixed`,`map`],default:`auto`,input:`segmented`,labels:{auto:`Auto`,fixed:`Fixed`,map:`% of map`},label:`List height`,help:`Height of the list below the map. Auto grows with the list and the page scrolls; Fixed and % of map scroll inside.`,hint:`Applies to bottom placement and narrow screens; Size sets the map only. Fixed / % of map pin the search on top.`},max_height:{type:`number`,default:600,min:160,max:1600,step:20,unit:`px`,when:{height:`fixed`},label:`Max height`,help:`Height of the list below the map; it scrolls inside.`},map_share:{type:`number`,default:50,min:20,max:200,step:5,unit:`%`,when:{height:`map`},label:`Share of map`,help:`The list's height as a share of the map's height; it scrolls inside.`,hint:`50% under a 600 px map: 300 px.`},sticky_search:{type:`boolean`,default:!0,when:{height:`auto`},label:`Sticky search`,help:`The search box stays at the top of the window while the list scrolls.`},count:{type:`boolean`,default:!0,label:`Place count`,help:`The "97 places" line above the list. Off: shows only while filtering.`},columns:{type:`number`,default:1,min:0,max:6,label:`Columns`,help:`Most items per row; fewer when space is tight. 1 = a list, 0 = as many as fit.`,input:`stepper`,zero:`Auto`},item:{type:`choice`,options:[`text`,`logo`,`card`,`tile`],default:`logo`,label:`Item style`,help:`How each place looks: text, logo, card or tile.`},group:{type:`choice`,options:[`none`,`category`,`level`,`letter`],default:`category`,label:`Group by`,help:`Groups the list by category, level or first letter.`},sort:{type:`choice`,options:[`name`,`level`,`open`],default:`name`,label:`Sort`,help:`Order within each group: by name, by level, or open places first.`},show_category:{type:`boolean`,default:!0,label:`Category on items`,help:`Items show their category.`},category_style:{type:`choice`,options:[`pips`,`text`],labels:{pips:`Icons`,text:`Names`},default:`pips`,label:`Item categories`,help:`Item categories as small icons or as names.`},show_level:{type:`boolean`,default:!0,label:`Level on items`,help:`Items show their level.`},show_hours:{type:`boolean`,default:!0,label:`Open status on items`,help:`Items show whether the place is open.`},amenities:{type:`boolean`,default:!0,label:`Include amenities`,help:`Restrooms, information desks and other amenities are listed too.`},category_icons:{type:`boolean`,default:!0,label:`Group icons`,help:`Category icons on group titles.`},every_category:{type:`boolean`,default:!0,label:`Under each category`,help:`A place with several categories is listed under each one.`},this_level:{type:`boolean`,default:!1,label:`This level only`,help:`Lists only places on the level being shown.`},counts:{type:`boolean`,default:!0,label:`Group counts`,help:`Place counts on group titles.`},collapsible:{type:`boolean`,default:!1,label:`Collapsible groups`,help:`Clicking a group title opens and closes the group.`},rail:{type:`boolean`,default:!0,label:`A–Z rail`,help:`A strip of letters for jumping through the list. Only when grouped by letter.`},toggle:{type:`boolean`,default:!0,label:`Collapse button`,help:`A button that opens and closes the list.`},collapsed:{type:`boolean`,default:!1,when:{toggle:!0},label:`Start collapsed`,help:`The panel opens closed; the collapse button opens it.`},title:{type:`string`,default:``,label:`Title`,help:`A heading above the list. Empty = none.`},reel:{type:`boolean`,default:!0,label:`Featured reel`,help:`Featured places in a row above the list.`,hint:`Hidden while searching.`},reel_item:{type:`choice`,options:[`card`,`tile`,`logo`],default:`tile`,label:`Reel item style`,help:`How places in the featured row look.`}}},{id:`attract`,icon:`monitor-play`,name:`Attract mode`,category:`Motion`,help:`When the map sits idle, it tours stores one by one until someone touches it. For kiosks, landing pages and hero sections.`,desc:`Tours stores after the map has been idle`,opt:`attract`,def:!1,breaks:[`hold`,`progress`],settings:{after:{type:`number`,default:3,min:0,max:180,label:`Start after`,help:`Seconds without input before the tour starts. 0 = only the play button starts it.`,unit:`s`,opt:`attractAfter`,hint:`At least 3, up to 180.`},page:{type:`boolean`,default:!1,label:`Whole page counts`,help:`Activity anywhere on the page restarts the wait. Off: only on the map.`},button:{type:`boolean`,default:!1,label:`Play button`,help:`A play button that starts the tour at once. It hides while the tour runs.`},hold:{type:`number`,default:8,min:3,max:60,label:`Per stop`,help:`Seconds at each store.`,unit:`s`,opt:`attractHold`,hint:`After the flight lands.`},arc:{type:`boolean`,default:!0,label:`Fly over`,help:`Zooms out between stores, then back in.`},drift:{type:`boolean`,default:!0,label:`Drift`,help:`Slowly circles each store while it's shown.`},explode:{type:`boolean`,default:!1,label:`Explode levels`,explode:!0,help:`Opens the levels apart when flying to a store on another floor.`},overview:{type:`number`,default:5,min:0,max:50,label:`Overview every`,explode:!0,help:`Every this many stops, the levels open and slowly turn. 0 = off.`,unit:`stops`,hint:`Maps with several levels, 3D only; the overview lasts 10 s.`},progress:{type:`choice`,options:[`off`,`bar`,`pill`],default:`bar`,input:`select`,labels:{off:`Off`,bar:`Bar`,pill:`Bar + pill`},label:`Progress`,help:`How the tour shows its progress: a bar on the popup, or also a "Touch to explore" pill.`}}},{id:`intro`,icon:`plane-landing`,name:`Fly in`,category:`Motion`,help:`When the map loads, the camera starts high above it and descends to the start view, or to the place opened with the page. Any input ends it at once. Off with reduced motion.`,desc:`The camera descends onto the map on load`,def:!1,settings:{seconds:{type:`number`,default:1.6,min:.5,max:5,step:.1,label:`Duration`,help:`Seconds from the top to the start view. Short feels quick, long feels cinematic.`,unit:`s`},height:{type:`number`,default:5,min:2,max:12,step:.5,label:`Start height`,help:`How far out it starts, in times the start view's distance.`,unit:`×`},turn:{type:`number`,default:30,min:0,max:180,step:5,zero:`None`,label:`Turn`,help:`How far the map turns on the way down. 3D only.`,unit:`°`}}},{id:`drift`,icon:`orbit`,name:`Drift`,category:`Motion`,help:`After load the camera slowly sways side to side, so the map doesn't stand still, until someone uses it. For hero sections and landing pages. Off with reduced motion and in 2D; waits while an Attract mode tour runs.`,desc:`The camera slowly sways after load`,def:!1,settings:{angle:{type:`number`,default:30,min:0,max:180,label:`Sway`,help:`How far the camera turns from side to side.`,unit:`°`},tilt:{type:`number`,default:6,min:0,max:30,label:`Tilt`,help:`How far the camera dips and rises with each sway. 0 = level.`,unit:`°`},seconds:{type:`number`,default:20,min:4,max:120,label:`Sway time`,help:`Seconds for one sway. Longer is calmer.`,unit:`s`},resume:{type:`number`,default:0,min:0,max:600,zero:`Never`,label:`Resume after`,help:`Seconds after the last input before it sways again. 0 = never: the first input stops it for good.`,unit:`s`}}},{id:`deeplink`,icon:`link`,name:`Deep linking`,category:`Plugin`,help:`Links that open the map on a store, level, route or category (map-select, map-level, map-from, map-category in the page address), and an address that follows the map so visitors can share what they see. On a page with several maps, a map whose element has an id uses map-<id>-select and so on.`,desc:`Open the map from links; keep the page address in step`,panels:{links:{label:`Deep linking`,keys:[`read`,`write`,`style`,`history`]}},def:!0,settings:{read:{type:`list`,options:[`select`,`level`,`route`,`category`],default:[`select`,`level`,`route`,`category`],labels:{select:`Store`,level:`Level`,route:`Route`,category:`Category`},input:`links`,label:`Open from links`,help:`What a link to the page can open the map on. Empty = links are ignored.`},write:{type:`list`,options:[`select`,`level`,`route`,`category`],default:[],labels:{select:`Store`,level:`Level`,route:`Route`,category:`Category`},input:`links`,of:`read`,label:`Update address`,help:`What the page address follows, so visitors can share it. Empty = never changed.`,hint:`Only items that links also open.`},style:{type:`choice`,options:[`query`,`hash`],default:`query`,labels:{query:`?map-…`,hash:`#map-…`},label:`Address style`,help:`How the address is written. Hash suits single-page sites.`,hint:`Both are read. Hash suits single-page sites whose router reacts to query changes.`},history:{type:`choice`,options:[`replace`,`push`],default:`replace`,labels:{replace:`Quiet`,push:`Steps back`},label:`Back button`,help:`Whether Back steps through map changes, or the address just updates in place.`}}},{id:`localization`,icon:`languages`,name:`Localization`,category:`Plugin`,help:`Shows the map in more languages: place names, categories, levels, markers, popups, directions and buttons. Translations are stored in the map file. The map follows the host page's language (the lang attribute on <html>), so the page's own language switcher drives it.`,desc:`Translations that follow the page language`,def:!1,settings:{language:{type:`string`,default:``,label:`Default language`,help:`The language the map opens in. Empty = the map's own.`,input:`language`},page:{type:`boolean`,default:!0,label:`Follow page language`,help:`Uses the page's language when the map has it.`,hint:`Follows the lang attribute on <html>.`}}},{id:`grids`,name:`Grid`,internal:!0,settings:{density:{type:`number`,default:160,min:20,max:600,step:10,label:`Density`,help:`How many dots across the longer side of the map.`,unit:`dots`},size:{type:`number`,default:60,min:5,max:100,step:5,label:`Dot size`,help:`Dot size, as a share of the distance between dots.`,unit:`%`},shape:{type:`choice`,options:[`round`,`square`,`hexagon`],default:`round`,label:`Shape`,labels:{round:`Round`,square:`Square`,hexagon:`Hexagon`},help:`Shape of each dot.`},layout:{type:`choice`,options:[`square`,`staggered`],default:`square`,label:`Layout`,help:`Staggered shifts every second row half a step, like a honeycomb.`,labels:{square:`Rows`,staggered:`Staggered`}},small:{type:`boolean`,default:!1,label:`Keep small places`,help:`A place too small for the grid still gets one dot at its centre.`},zoom_steps:{type:`number`,default:0,min:0,max:3,step:1,label:`Zoom detail`,help:`Adds detail as you zoom in, up to this many times. 0 = one grid.`,unit:`steps`,hint:`Doubles the density each time the view zooms in 2×, so dots keep their size on screen.`}}}];builtinList(){return a.BUILTINS.concat(this.constructor.EXTRA_BUILTINS||[])}builtin(e){return this.builtinList().find(t=>t.id===e)||null}_pluginConfig(){let e=a.raw;if(!e)return this._pluginConfigFallback||={builtin:{},custom:[]};let t=e.plugins;(!t||Array.isArray(t))&&(t=e.plugins={builtin:{},custom:Array.isArray(t)?t:[]}),t.builtin=t.builtin||{},t.custom=t.custom||[],t.version>=2||this._migratePlugins(e,t),t.builtin.directions&&(t.builtin.wayfinding=Object.assign({},t.builtin.directions,t.builtin.wayfinding),delete t.builtin.directions);let n=t.builtin.directory&&t.builtin.directory.settings;n&&(n.height===`limit`&&(n.height=`fixed`),n.height==null&&n.max_height!=null&&(+n.max_height>0?n.height=`fixed`:delete n.max_height),delete n.list_share);let r=e.theme;if(r&&(r.label_max!=null||r.label_snap!=null)){let e=t.builtin.labels=t.builtin.labels||{},n=e.settings=e.settings||{};r.label_max!=null&&n.text_max==null&&(n.text_max=r.label_max),r.label_snap!=null&&n.snap==null&&(n.snap=r.label_snap),delete r.label_max,delete r.label_snap}let i=t.builtin.search&&t.builtin.search.settings;if(i&&i.width!=null&&(i.max_width??=i.width,delete i.width),i&&`url`in i){if(i.url===!0){let e=t.builtin.deeplink=t.builtin.deeplink||{},n=e.settings=e.settings||{};n.write??=[`select`,`category`],e.settings.style??(n.style=`hash`)}delete i.url}return t}_migratePlugins(e,t){t.version=2;let n=t.builtin,r=Object.assign({},n),i=e.ui||{},a=e=>r[e]&&r[e].enabled,o=(e,t,r)=>{if(r==null)return;let i=n[e]=n[e]||{};i.settings=Object.assign({},i.settings,{[t]:!!r})};[`labels`,`logos`,`storefronts`,`cars`,`motion`,`shadows`,`zoom`,`fullscreen`,`compass`,`hint`,`levels`,`routing`,`info-cards`,`tints`,`merge`,`connectors`].forEach(e=>delete n[e]),o(`labels`,`name`,a(`labels`)),o(`wayfinding`,`storefronts`,a(`storefronts`)),o(`scenery`,`cars`,a(`cars`)),o(`scenery`,`carsMoving`,a(`motion`)),o(`scenery`,`connectorsMoving`,a(`motion`)),o(`core`,`shadows`,a(`shadows`)),[`levels`,`zoom`,`fullscreen`,`compass`,`hint`].forEach(e=>o(`controls`,e,i[e]==null?a(e):i[e])),o(`controls`,`reset`,i.zoom==null?a(`zoom`):i.zoom),i.directions!=null&&((n.wayfinding=n.wayfinding||{}).enabled=!!i.directions),delete e.ui}allowCustom(){let e=this.props.plugins;return e===!0||e==null&&!!this.constructor.TRUSTED}pluginOn(e){let t=this.builtin(e);if(!t){let t=(this._plugReg||[]).find(t=>t.id===e);return!!(t&&t.active)}if(t.internal)return a.unitStyle===`grid`;if(t.locked||t.always)return!0;let n=this.state.optionOverrides;if(t.opt&&n&&n[t.opt]!==void 0)return!!n[t.opt];let r=this._pluginConfig().builtin[e];return r&&r.enabled!=null?!!r.enabled:this._pluginDefault(t)}_pluginDefault(e){if(e.locked||e.always)return!0;if(e.opt&&this.props[e.opt]!=null)return!!this.props[e.opt];let t=this.props.controls;return e.ui&&t&&t[e.ui]!=null?!!t[e.ui]:e.def!==!1}pluginSetting(e,t){let n=this.builtin(e),r=n&&n.settings&&n.settings[t];return n&&n.internal?(((a.raw||{}).theme||{}).grid||{})[t]??(r?r.default:void 0):this._pluginSetting(n,r,e,t)}_pluginSetting(e,t,n,r){let i=this._pluginConfig().builtin[n],a=this.state.optionOverrides,o=this.props.controls;return t&&t.opt&&a&&a[t.opt]!==void 0?a[t.opt]:i&&i.settings&&i.settings[r]!=null?i.settings[r]:t&&t.opt&&this.props[t.opt]!=null?this.props[t.opt]:t&&t.ui&&o&&o[t.ui]!=null?o[t.ui]:t?t.default:void 0}settingOn(e,t){return this.pluginOn(e)&&!!this.pluginSetting(e,t)}plugins(){let e=this.builtinList().filter(e=>!e.internal).map(e=>({id:e.id,name:e.name,icon:e.icon||`puzzle`,category:e.category,desc:e.desc||``,help:e.help||``,builtin:!0,locked:!!e.locked,always:!!e.always,enabled:this.pluginOn(e.id),defaultOn:this._pluginDefault(e),settings:e.settings?Object.fromEntries(Object.keys(e.settings).map(t=>[t,this.pluginSetting(e.id,t)])):{},schema:e.settings||{},panels:e.panels||{},breaks:e.breaks||[],main:e.main||null}));return(this._plugReg||[]).map(e=>({id:e.id,name:e.name,icon:`puzzle`,category:`Custom`,desc:e.desc||``,builtin:!1,locked:!1,enabled:!!e.active,saved:e.enabled!==!1,forkOf:e.forkOf||null,settings:e.config||{}})).concat(e)}findPlugin(e){let t=this.plugins(),n=String(e||``).toLowerCase().trim();return t.find(e=>e.id===n)||t.find(e=>e.name.toLowerCase()===n)||t.find(e=>e.name.toLowerCase().includes(n)||e.id.includes(n))||null}async installCustom(e){e||={};let t=String(e.name||``).trim().slice(0,40);if(!t||!e.code)return`Error: name and code are required`;let n=(this._plugReg||[]).find(e=>e.name.toLowerCase()===t.toLowerCase());n&&(n.wasOn=n.active,this.uninstall(n));let r={id:n?n.id:`pl`+Date.now(),name:t,desc:e.description||``,enabled:!0,code:String(e.code).replace(/^```\w*\n?|```\s*$/g,``),config:n&&n.config||{}};try{await this.install(r)}catch(e){return this._plugReg=(this._plugReg||[]).filter(e=>e!==r),n&&n.wasOn&&await this.install(n).catch(()=>{}),`Error: `+(e&&e.message||e)+`. Fix the code and call create_plugin again.`}if(n){let e=this._plugReg.filter(e=>e!==r),t=e.indexOf(n);e.splice(t<0?e.length:t,t<0?0:1,r),this._plugReg=e}return this.savePlugins(),(n?`Updated plugin `:`Installed plugin `)+t}async toggleCustom(e,t){let n=this.findPlug(e);if(!n)return`No plugin named `+e;if(n.userSet=!1,n.enabled=!!t,this.savePlugins(),t&&!n.active)try{await this.install(n)}catch(e){return`Error starting plugin: `+(e&&e.message||e)}return!t&&n.active&&this.uninstall(n),`Turned `+(t?`on `:`off `)+n.name}removeCustom(e){let t=this.findPlug(e);return t?(this.uninstall(t),this._plugReg=(this._plugReg||[]).filter(e=>e!==t),this.savePlugins(),this.forceUpdate(),`Deleted plugin `+t.name):`No plugin named `+e}async setPlugin(e,t){let n=this.findPlugin(e);if(!n)throw Error(`No plugin named `+e);if(t||={},!n.builtin){let e=this._plugReg.find(e=>e.id===n.id);return t.settings&&(e.config=Object.assign({},e.config,t.settings)),e.userSet=!1,t.enabled==null?t.settings&&e.active&&(this.uninstall(e),await this.install(e)):(e.enabled=!!t.enabled,e.enabled&&!e.active&&await this.install(e),!e.enabled&&e.active&&this.uninstall(e)),this.savePlugins(),this.plugins().find(e=>e.id===n.id)}let r=this.builtin(n.id),i=this._pluginConfig();if((r.locked||r.always)&&t.enabled===!1)throw Error(r.name+(r.locked?` is part of the core and`:``)+` is always on`);if(t.enabled!=null&&((i.builtin[r.id]=i.builtin[r.id]||{}).enabled=!!t.enabled,r.opt&&this.state.optionOverrides&&this.state.optionOverrides[r.opt]!==void 0&&this.setState(e=>{let t=Object.assign({},e.optionOverrides);return delete t[r.opt],{optionOverrides:t}})),t.settings){let e=r.settings||{},n=Object.keys(t.settings).filter(t=>!e[t]);if(n.length)throw Error(r.name+` has no setting `+n.join(`, `)+(Object.keys(e).length?`. Settings: `+Object.keys(e).join(`, `):``));let a=i.builtin[r.id]=i.builtin[r.id]||{};a.settings=Object.assign({},a.settings),Object.entries(t.settings).forEach(([t,n])=>{let r=e[t];if(r.type===`number`){if(n=+n,!isFinite(n))throw Error(t+` must be a number`);r.unlimited&&n<0?n=-1:(r.min!=null&&(n=Math.max(r.min,n)),r.max!=null&&(n=Math.min(r.max,n)))}else if(r.type===`boolean`)n=!!n;else if(r.type===`string`)n=n==null?``:String(n).trim();else if(r.type===`choice`){if(n=String(n),!r.options.includes(n))throw Error(t+` must be one of `+r.options.join(`, `))}else if(r.type===`list`){n=(Array.isArray(n)?n:String(n??``).split(`,`)).map(e=>String(e).trim()).filter(Boolean);let e=n.filter(e=>!r.options.includes(e));if(e.length)throw Error(t+` takes `+r.options.join(`, `)+` (not `+e.join(`, `)+`)`);n=r.options.filter(e=>n.includes(e))}a.settings[t]=n}),Object.entries(e).forEach(([n,i])=>{if(i.type!==`list`||!i.of)return;let o=a.settings[i.of]==null?this.pluginSetting(r.id,i.of):a.settings[i.of],s=a.settings[n]==null?this.pluginSetting(r.id,n):a.settings[n];Array.isArray(o)&&Array.isArray(s)&&(n in t.settings&&!(i.of in t.settings)?s.some(e=>!o.includes(e))&&(a.settings[i.of]=e[i.of].options.filter(e=>o.includes(e)||s.includes(e))):s.some(e=>!o.includes(e))&&(a.settings[n]=s.filter(e=>o.includes(e))))});let o=Object.keys(t.settings).map(t=>e[t].opt).filter(e=>e&&this.state.optionOverrides&&this.state.optionOverrides[e]!==void 0);o.length&&this.setState(e=>{let t=Object.assign({},e.optionOverrides);return o.forEach(e=>delete t[e]),{optionOverrides:t}})}return this._plugChanged(r),this.plugins().find(e=>e.id===r.id)}savePlugins(){this._pluginConfig().custom=(this._plugReg||[]).map(e=>Object.assign({id:e.id,name:e.name,desc:e.desc||``,enabled:e.enabled!==!1,api:1,code:e.code},e.config&&Object.keys(e.config).length?{config:e.config}:{},e.forkOf?{forkOf:e.forkOf}:{}))}bootPlugins(){let e=this._pluginConfig();this._plugReg=this._plugReg||[];let t=this.allowCustom();e.custom.forEach(e=>{if(!e||!e.code||this._plugReg.some(t=>t.id===e.id))return;let n=Object.assign({},e,{config:Object.assign({},e.config)});this._plugReg.push(n),n.enabled!==!1&&t&&this.install(n).catch(e=>console.warn(`Plugin `+n.name,e))}),e.custom.length&&!t&&console.info(`Mapplic: `+e.custom.length+` custom plugin(s) in the map file are not run. Pass options.plugins = true to allow them.`),this.forceUpdate()}grid(){let e=this.builtin(`grids`).settings,t=((a.raw||{}).theme||{}).grid||{};return Object.fromEntries(Object.keys(e).map(n=>[n,t[n]==null?e[n].default:t[n]]))}setGrid(e){let t=this.builtin(`grids`).settings,n=a.raw;if(!n)throw Error(`No map loaded`);let r=Object.keys(e||{}).filter(e=>!t[e]);if(r.length)throw Error(`The grid has no setting `+r.join(`, `)+`. Settings: `+Object.keys(t).join(`, `));let i=n.theme=n.theme||{},o=i.grid=Object.assign({},i.grid);return Object.entries(e||{}).forEach(([e,n])=>{let r=t[e];if(r.type===`number`){if(n=+n,!isFinite(n))throw Error(e+` must be a number`);n=Math.min(r.max,Math.max(r.min,n))}else if(r.type===`boolean`)n=!!n;else if(!r.options.includes(String(n)))throw Error(e+` must be one of `+r.options.join(`, `));o[e]=n}),this._plugChanged(this.builtin(`grids`)),this.grid()}_plugChanged(e){this.emit(`plugin`,{id:e?e.id:`controls`,enabled:e?e.builtin===!1||!this.builtin(e.id)?!!e.active:this.pluginOn(e.id):this.pluginOn(`controls`)}),this.applyProps(),this.syncBuiltins(),(!e||e.id===`appearance`)&&this.state.all&&!this.canExplode()&&this.setLevel(this.state.level),(!e||e.id===`wayfinding`)&&(this._units||[]).forEach(e=>this._buildStorefront(e)),(!e||e.id===`localization`)&&this.applyLanguage(),!e||e.id===`appearance`?this.applyAppearance():e.id===`size`&&this.applyHeight(),this.forceUpdate()}info(e){let t=this._byId[e.id],n=a.categoryName(e.cat),i=e.loc&&!e.loc.amenity?r.categoryList(e.loc.category):[];if(i.length&&e.cat!=null){let t=r.categoryNames||{},n=i.includes(e.cat)?e.cat:Object.keys(t).find(n=>t[n]===e.cat)||((r.categories||[]).find(t=>t.name===e.cat||t.id===e.cat)||{}).id;n&&n!==i[0]&&(i=[n].concat(i.filter(e=>e!==n)))}return{id:e.id,location:e.loc&&e.loc.id||null,name:e.name,category:n,categories:i.length>1?i.map(e=>a.categoryName((r.categoryNames||{})[e]||e)):n?[n]:[],categoryTags:i.map(e=>{let t=(r.categories||[]).find(t=>t.id===e)||{};return{id:e,name:a.categoryName(t.name||e),color:t.color||null,icon:t.icon||null}}),group:e.grp||null,accessible:r.isAccessible(this.locationOf(e)),image:e.img||null,level:e.level,hours:e.hours,type:e.type,x:t.item.cx,z:t.item.cz,top:t.item.top,footprint:t.item.poly.map(e=>[e[0],e[1]]),...a.popupFields(e.loc,e.cat),logo:e.img||null,linked:this.linkedUnits(e.id).map(e=>({id:e,level:this._byId[e].item.store.level})),parts:this.groupParts(e.id).filter(t=>t!==e.id)}}locationOf(e){let t=this._unitById&&this._unitById[e.id],n=e.loc||t&&t.r&&t.r.loc||null;return!n||typeof n==`object`?n:(r.locations||{})[n]||null}linkedUnits(e){let t=this._byId||{};this._linkSource!==t&&(this._linkSource=t,this._linkMembers={},Object.keys(t).forEach(e=>{let n=t[e].item&&t[e].item.store,r=n&&n.loc&&n.loc.id;r&&(this._linkMembers[r]=this._linkMembers[r]||[]).push(e)}));let n=t[e]&&t[e].item&&t[e].item.store,r=n&&n.loc&&n.loc.id,i=this.groupKeyOf(e);if(!r)return[];let a=new Set([i]);return(this._linkMembers[r]||[]).filter(e=>{let t=this.groupKeyOf(e);return!a.has(t)&&(a.add(t),!0)})}static popupFields(e,t){e||={};let n=r,i=e.mapplic&&e.mapplic.popup||e.popup,o=n.categoryPopups&&t?n.categoryPopups[t]:null;return{subtitle:e.subtitle||null,description:e.description||null,images:e.images||null,action:e.action===!1?!1:e.action||null,phone:e.phone||null,email:e.email||null,website:e.website||null,details:e.details||null,popup:a.mergePopupLayouts([n.popupTheme,o,i])}}static mergePopupLayouts(e){let t=e.filter(e=>e&&typeof e==`object`);if(!t.length)return null;let n=Object.assign({},...t),r=t.map(e=>e.link).filter(e=>e&&typeof e==`object`);return r.length&&(n.link=Object.assign({},...r)),n}emit(e,t){(this._handlers||[]).slice().forEach(n=>{if(n.ev===e)try{n.fn(t)}catch(t){console.error(`Mapplic `+e+` handler`,t)}}),(this._pluginEvents||[]).slice().forEach(n=>{if(n.event===e)try{n.fn(t)}catch(e){this.plugErr(n.plugin,e)}})}camTick(){let e=this.camView||this.camGoal;if(!e||!(this._handlers||this._pluginEvents))return;let t=e=>Math.round(e*10)/10,n={mode:this.is2d()?`2d`:`3d`,rotation:t(-e.azimuth*180/Math.PI),tilt:t(e.polar*180/Math.PI),distance:t(e.distance),x:t(e.targetX),z:t(e.targetZ),home:!this._awayFromHome},r=JSON.stringify(n);r!==this._lastCameraKey&&(this._lastCameraKey=r,this.emit(`camera`,n))}plugFrame(e,t){let n=this._pluginFrames;n&&n.length&&n.slice().forEach(n=>{try{n.fn(e,t)}catch(e){this.plugErr(n.plugin,e)}})}plugErr(e,t){console.error(`Plugin `+e.name,t),e.active&&(this.uninstall(e),this.notify(`Plugin "`+e.name+`" crashed and was turned off: `+(t&&t.message||t)))}static API_VERSION=1;static EVENTS=[`ready`,`select`,`hover`,`level`,`route`,`camera`,`plugin`,`layout`,`units`,`marker`,`language`,`hours`,`search`,`scheme`];static pluginFactories={};static EVENT_OWNERS={route:`wayfinding`,marker:`markers`,hours:`hours`,search:`search`};static PLUGIN_ORDER=[`labels`,`scenery`,`wayfinding`,`markers`,`hours`,`popups`,`attract`,`intro`,`drift`,`controls`,`search`,`directory`,`deeplink`,`localization`,`grids`];static orderedFactories(){let e=a.PLUGIN_ORDER,t=t=>e.includes(t)?e.indexOf(t):e.length;return Object.entries(a.pluginFactories).sort((e,n)=>t(e[0])-t(n[0]))}static focused(){let e=document.activeElement;for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}static injectCss(e,t){return a.prototype.baseCss(e,t)}static plugin(e,t){a.pluginFactories[e]=t}wheelMode(){let e=((this._pluginConfig().builtin.core||{}).settings||{}).wheel,t=this.state.optionOverrides||{};if(e==null&&t.wheel===void 0&&this.props.wheel==null&&this.props.wheelCtrl)return`modifier`;let n=this.pluginSetting(`core`,`wheel`);return n===`modifier`||n===`off`?n:`zoom`}wheelPasses(e){let t=this._viewport;if(!t||!e||!t.contains(e.target))return!1;let n=this.wheelMode();return n===`off`||n===`modifier`&&!(e.ctrlKey||e.metaKey)&&!this.isFullscreen()}isFullscreen(){let e=this._viewport,t=e?e.getRootNode():null,n=t&&t!==document&&t.fullscreenElement||document.fullscreenElement||document.webkitFullscreenElement;return!!e&&(!!n&&(n===e||n.contains(e))||e.style.position===`fixed`||!!this.el&&this.el.contains(e)&&this.el.style.position===`fixed`&&this.el.style.zIndex===`1000`)}showWheelHint(){let e=this._viewport;if(!e||this.state.coarse)return;let t=this._wheelHintEl;if(!t||!t.isConnected){t=this._wheelHintEl=document.createElement(`div`),t.className=`mp-wheel-hint`,t.setAttribute(`role`,`status`),t.style.cssText=`position:absolute;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;pointer-events:none;color:#fff;font-family:Onest,sans-serif;text-align:center;padding:24px;opacity:0;`+(this._reducedMotion?``:`transition:opacity .18s ease`);let n=document.createElement(`div`);n.className=`mp-wheel-hint-pill`,n.style.cssText=`position:relative;max-width:100%;box-sizing:border-box;padding:10px 18px;border-radius:9999px;background:rgba(9,9,11,.45);-webkit-backdrop-filter:blur(12px) saturate(1.2);backdrop-filter:blur(12px) saturate(1.2);box-shadow:0 0 0 1px rgba(255,255,255,.08),0 8px 24px rgba(0,0,0,.12);font-size:14px;font-weight:500;line-height:1.4;text-wrap:balance`,t.append(n),e.appendChild(t)}let n=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||``)?`⌘`:`Ctrl`,r=a.t(`wheel_hint`,{key:``}),i=r.indexOf(``),o=i<0?null:r.slice(i).match(/^\u0001(\s*\+\s*[^\s.,;:!?]+)?/),s=document.createElement(`strong`),c=t.querySelector(`.mp-wheel-hint-pill`);c.textContent=``,o?(s.style.fontWeight=`700`,s.textContent=n+(o[1]||``),c.append(r.slice(0,i),s,r.slice(i+o[0].length))):c.textContent=r,t.style.opacity=`1`,clearTimeout(this._wheelHintTimer),this._wheelHintTimer=setTimeout(()=>{t.style.opacity=`0`},1200)}env(){let e=this.state;return{touch:!!e.coarse,narrow:!!e.narrow,hostNarrow:!!e.hostNarrow,ctrlZoom:this.wheelMode()===`modifier`,wheel:this.wheelMode(),reducedMotion:!!this._reducedMotion,editor:!!this.constructor.EDITOR}}syncBuiltins(){if(!this.renderer||!this._plugEl)return;let e=this._builtinPlugins=this._builtinPlugins||{};a.orderedFactories().forEach(([t,n])=>{let r=this.builtin(t);if(!r)return;let i=this.pluginOn(t),a=e[t]=e[t]||{id:t,name:r.name,builtin:!0,fn:n,config:{}};i&&!a.active&&!a.busy?(a.busy=!0,this.trackLoad(this.install(a).catch(e=>console.error(`Plugin `+r.name,e)).finally(()=>{a.busy=!1}))):!i&&a.active&&this.uninstall(a)})}plugApi(e,t){let n=a,i=this.THREE,o=(t,r)=>{if(!n.EVENTS.includes(t))throw Error(`Unknown event "`+t+`". Events: `+n.EVENTS.join(`, `));let i={plugin:e,event:t,fn:r};return this._pluginEvents.push(i),()=>{this._pluginEvents=this._pluginEvents.filter(e=>e!==i)}},s=t=>{let n={plugin:e,fn:t};return this._pluginFrames.push(n),()=>{this._pluginFrames=this._pluginFrames.filter(e=>e!==n)}},c=(e,n)=>((n==null?this.scene:this.levelViews[n].group).add(e),t.objs.push(e),e),l=e=>{let n=this._unitById[e];if(!n)return null;let r=n.grp;return t.grps.some(e=>e.group===r)||t.grps.push({group:r,position:r.position.clone(),quaternion:r.quaternion.clone(),scale:r.scale.clone()}),{group:r,body:n.m,outline:n.line,conceal:(e=!0)=>{let r=[n.m,n.line].filter(Boolean).flatMap(e=>Array.isArray(e.material)?e.material:[e.material]);t.concealed.has(n)||t.concealed.set(n,r.map(e=>[e,e.colorWrite,e.depthWrite])),r.forEach(t=>{t.colorWrite=!e,t.depthWrite=!e})}}},u=e=>{[`pointerdown`,`pointerup`,`click`,`dblclick`,`contextmenu`].forEach(t=>e.addEventListener(t,e=>{(t!==`pointerdown`&&t!==`pointerup`||!e.target.closest||!e.target.closest(`[data-mp-drag]`))&&e.stopPropagation()})),e.addEventListener(`wheel`,t=>{for(let n=t.target;n&&n!==e.parentNode;n=n.parentNode){if(n.nodeType!==1)continue;let e=getComputedStyle(n),r=/(auto|scroll)/.test(e.overflowY),i=/(auto|scroll)/.test(e.overflowX);if(r&&n.scrollHeight>n.clientHeight||i&&n.scrollWidth>n.clientWidth){t.stopPropagation();return}}})},d=e=>{if(e!==`bottom-left`)throw Error(`Unknown zone "`+e+`" (bottom-left)`);let t=this._zones=this._zones||{};if(t[e]&&t[e].isConnected)return t[e];let n=document.createElement(`div`);return n.className=`mp-zone mp-zone-`+e,n.style.cssText=`position:absolute;left:calc(16px + var(--mp-inset-bl, 0px));bottom:calc(16px + var(--mp-inset-b, 0px));display:flex;flex-direction:column;align-items:flex-start;gap:8px;pointer-events:none;z-index:8;transition:left 200ms ease,bottom 200ms ease`,u(n),this._plugEl.appendChild(n),t[e]=n},f=(e,n)=>{let r=!!(n&&n.layer===`top`),i=!!(n&&n.layer===`scene`);return u(e),e.style.pointerEvents||(e.style.pointerEvents=`auto`),r?(e.setAttribute(`data-mp-top`,``),n.editing&&e.setAttribute(`data-mp-edit`,``),e.style.zIndex||(e.style.zIndex=`8`),this._viewport.appendChild(e)):i&&this._sceneEl?this._sceneEl.appendChild(e):this._plugEl.appendChild(e),t.els.push(e),e},p=(e,t,n)=>{let r=new i.Vector3(e,t,n).project(this.camera);return{x:(r.x+1)/2*this._width,y:(1-r.y)/2*this._height,visible:this.ndcVisible(r)}},m=()=>({width:this._width,height:this._height}),h=e=>this.notify(String(e)),g=e=>this.levelViews[e].y,_=e=>this.levelViews[e].opacity,v=(e,n)=>{let r=this.levelViews[n];return r&&(e.userData.o0===void 0&&(e.userData.o0=e.opacity??1),r.mats.includes(e)||r.mats.push(e),e.opacity=e.userData.o0*r.opacity,e.transparent=r.transparent||e.userData.o0<1,t.mats.push([r,e])),e},y=n=>{let r={p:e,fn:n};(this._pickHandlers=this._pickHandlers||[]).push(r);let i=()=>{this._pickHandlers=this._pickHandlers.filter(e=>e!==r)};return t.offs.push(i),i},b=e=>typeof e==`number`?e+`px`:String(e||0),x=()=>{let e=this.el,t=this._viewport,n=!!this._uiHidden,r=n?[]:(this._docks||[]).filter(e=>e.side!==`below`);if(!e||!t)return;this._layoutDocks=x,(this._docks||[]).forEach(e=>{e.side!==`below`&&(e.wrap.style.display=n?`none`:`flex`)});let i=!1;(this._docks||[]).filter(e=>e.side===`below`).forEach(e=>{let t=!n&&e.size!==0,r=e.size===`auto`||e.size==null;t&&(i=!0);let a=e.wrap,o=e.shown;e.shown=t,t&&(a.style.maxHeight=r?`none`:b(e.size));let s=r?`visible`:`hidden`;if(o!==void 0&&o!==t&&!this.env().reducedMotion){clearTimeout(e.animTimer),a.style.display=`flex`,a.style.overflow=`hidden`,a.style.overflow=`clip`,a.style.transition=`none`;let n=()=>Math.min(a.offsetHeight,Math.max(0,(window.innerHeight||0)-a.getBoundingClientRect().top)),r=t?0:n();a.style.height=``;let i=t?n():0;Object.assign(a.style,{height:r+`px`,marginTop:t?`0px`:`12px`,opacity:t?`0`:`1`}),a.offsetHeight,a.style.transition=`height 200ms ease, margin-top 200ms ease, opacity 200ms ease`,Object.assign(a.style,{height:i+`px`,marginTop:t?`12px`:`0px`,opacity:t?`1`:`0`}),e.animTimer=setTimeout(()=>{e.animTimer=0,Object.assign(a.style,{transition:``,height:``,marginTop:`12px`,opacity:``,overflow:e.shown&&(e.size===`auto`||e.size==null)?`visible`:`hidden`}),a.style.display=e.shown?`flex`:`none`},220)}else e.animTimer||(a.style.display=t?`flex`:`none`,a.style.overflow!==s&&(a.style.overflow=s))}),i!==!!this._belowOpen&&(this._belowOpen=i,this.props.frame&&this._putHeight());let a=e=>r.some(t=>t.side===e&&b(t.size)!==`0px`&&b(t.size)!==`0`);if(Object.entries({borderTopLeftRadius:[`left`,`top`],borderTopRightRadius:[`right`,`top`],borderBottomLeftRadius:[`left`,`bottom`],borderBottomRightRadius:[`right`,`bottom`]}).forEach(([e,n])=>t.style[e]=n.some(a)?`0`:``),!r.length){this._hostCss!=null&&(e.style.cssText=this._hostCss),this._hostCss=null,this._putHeight(),this.applyUiRadius(),t.style.gridArea=``,t.style.transition=``;return}t.style.transition=this.env().reducedMotion?``:`border-radius 200ms ease`,this._hostCss??=e.style.cssText;let o=e=>{let t=r.find(t=>t.side===e);return t?b(t.size):`0px`},s={left:`1 / 1 / 4 / 2`,right:`1 / 3 / 4 / 4`,top:`1 / 2 / 2 / 3`,bottom:`3 / 2 / 4 / 3`};Object.assign(e.style,{display:`grid`,gridTemplateColumns:o(`left`)+` minmax(0, 1fr) `+o(`right`),gridTemplateRows:o(`top`)+` minmax(0, 1fr) `+o(`bottom`),transition:this.env().reducedMotion?``:`grid-template-columns 200ms ease, grid-template-rows 200ms ease`}),t.style.gridArea=`2 / 2 / 3 / 3`,r.forEach(e=>{Object.assign(e.wrap.style,{gridArea:s[e.side],minWidth:`0`,minHeight:`0`,overflow:`hidden`})})},S=e=>{let n=this._insetsBy=this._insetsBy||new Map;e?n.set(t,e):n.delete(t);let r={left:0,right:0,top:0,bottom:0};n.forEach(e=>Object.keys(r).forEach(t=>r[t]+=Math.max(0,+e[t]||0))),this._insets=r};t.offs.push(()=>S(null));let C=(e,n)=>this._slotAdd(e,n,t),w=(e,n)=>{if(!this.el||!this._viewport)throw Error(`The map is not mounted`);let r=[`left`,`right`,`top`,`bottom`,`below`],i=document.createElement(`div`),a={el:e,wrap:i,side:`left`,size:320},o=e=>{if(e||={},e.side!=null){if(!r.includes(e.side))throw Error(`side must be one of `+r.join(`, `));a.side=e.side}e.size!=null&&(a.size=e.size)};o(n),(this._docks||[]).filter(t=>t.side===a.side||t.el===e).forEach(e=>e.wrap.remove()),this._docks=(this._docks||[]).filter(t=>t.side!==a.side&&t.el!==e).concat(a);let s=a.side===`below`;i.className=`mp-map mp-dock`+(s?` mp-dock-below`:``),i.style.cssText=`position:relative;display:flex;flex-direction:column;font-family:Onest,system-ui,sans-serif`+(s?`;margin-top:12px;min-height:0;overflow:hidden`:``);let c=this._viewport.getAttribute(`data-mp-id`);c&&i.setAttribute(`data-mp-id`,c),i.setAttribute(`data-mp-scheme`,this.scheme()),i.setAttribute(`data-mp-cards`,this.lightCards()),i.setAttribute(`data-mp-tips`,this.lightTooltips()),e.style.flex=`1 1 auto`,e.style.minHeight=`0`,i.appendChild(e),s?this.el.after(i):this.el.appendChild(i),x();let l=()=>{this._docks=(this._docks||[]).filter(e=>e!==a),i.remove(),x()};return t.offs.push(l),{update:e=>{o(e),x()},remove:l}},T=e=>{let t=null;e!=null&&(t=typeof e==`object`?e.id||null:this._byId&&this._byId[e]||this._features&&this._features.has(e)?e:(this.find(e)||{}).id||null),this._hovOver=t,this._hoverDirty=!0},E=(t,n)=>{let r=this._highlightsBy=this._highlightsBy||new Map;t&&t.length?r.set(e,{ids:new Set(t),color:n&&n.color||null,colors:n&&n.colors||null}):r.delete(e),this._highlights=new Set([...r.values()].flatMap(e=>[...e.ids]));let i=new Map;r.forEach(e=>e.ids.forEach(t=>{let n=e.colors&&e.colors[t]||e.color;n&&i.set(this.groupKeyOf(t),n)})),this._highlightTints=i.size?i:null};t.offs.push(()=>E(null));let D={version:n.API_VERSION,on:o,onFrame:s,getState:()=>this.getState(),data:{units:()=>(this._units||[]).filter(e=>e.id).map(e=>{let t=this._byId[e.id],n=t&&t.item.store,r=e.logo||`orig`,i=e.r&&e.r.loc;return{id:e.id,location:(i&&typeof i==`object`?i.id:i)||null,feature:e.r&&e.r.featureId||null,kind:e.am?`amenity`:`store`,name:n?n.name:e.nameOrig,text:e.am?String(e.r.amenity):null,level:e.levelIndex,top:e.top,box:(e.lp||e.poly0).map(e=>[e[0],e[1]]),labelAngle:e.r.labelAngle??null,label:!e.r.noLabel,labelText:e.r.labelText??null,center:[e.centerX,e.centerZ],size:[e.boxWidth,e.boxDepth],hidden:!!e.hid,interactive:!e.r.inert,labelScale:e.labelScale||1,labelRotation:e.labelRotation||0,labelOffset:e.labelOffset&&(e.labelOffset[0]||e.labelOffset[1])?e.labelOffset.slice():null,category:n?n.cat??null:null,logo:r===`none`?null:r===`orig`?e.logoSvgOrig?{svg:e.logoSvgOrig}:null:{image:r},thumb:e.r&&e.r.image?{image:e.r.image}:null}}),markers:()=>(n.markers||[]).map(e=>Object.assign({},e)),amenityTypes:()=>JSON.parse(JSON.stringify((n.raw||{}).amenities||{})),markerStyles:()=>JSON.parse(JSON.stringify(((n.raw||{}).theme||{}).markers||{})),unitAt:(e,t,n)=>{let r=this._unitUnder(e,t,n);return r&&r.id||null},surface:(e,t,n)=>{let r=this._unitUnder(e,t,n);return r?r.top:0},groundLevel:()=>n.groundLevel||0,north:()=>{let e=n.raw||{};return((e.crs||{}).type===`geographic`?0:+((e.georef||{}).rotation||0))||0},site:()=>{let e=n.source();return e.noSite?null:{outline:e.sitePoly.map(e=>e.slice()),colors:n.groundColors.slice(),shadow:+((n.raw||{}).theme||{}).site_shadow||0}},connectors:()=>(n.source().connectors||[]).map(e=>Object.assign({},e)),scenery:()=>(n.source().sceneryFeatures||[]).slice(),models:()=>(n.models||[]).slice(),location:e=>n.location(e),popupFields:(e,t)=>a.popupFields(e,t),categoryName:e=>r.categoryName(e),holidays:()=>{let e=(r.languageStrings||{}).holidays||{};return JSON.parse(JSON.stringify((n.raw||{}).holidays||[])).map(t=>e[t.date]?Object.assign(t,{name:typeof e[t.date]==`string`?e[t.date]:e[t.date].name||t.name}):t)},feature:e=>this.featureInfo(e),section:e=>{let t=(n.raw||{})[e];return t==null?null:JSON.parse(JSON.stringify(t))},findAll:e=>this.findAll(e).map(e=>this.info(e)),route:(e,t,n)=>this.routeData(this._resolveStore(e).id,this._resolveStore(t).id,n),levels:()=>this.levels(),levelOf:e=>this.levelOf(e),stores:()=>this.stores(),amenities:()=>this.amenities(),find:e=>this.find(e),match:e=>this.match(e)},view:{onPick:y,highlight:E,hover:T,feature:(e,n)=>{let r=this._features=this._features||new Map;r.set(e,n||{});let i=()=>{r.get(e)===n&&(r.delete(e),this.state.scenerySelected===e&&this.closePopups())};return t.offs.push(i),i},fit:(e,t,n)=>this.fitView(e,t,n),select:(e,t)=>this.select(e,t),deselect:()=>this.deselect(),setLevel:e=>this.setLevel(e),showAll:()=>this.showAll(),canExplode:()=>this.canExplode(),camera:e=>this.setCamera(e),lift:e=>this.liftFocus(e),drift:(e,t,n)=>this.drift(e,t,n),drifting:()=>this.drifting(),approach:e=>this.approach(e),approaching:()=>this.approaching(),skipTap:()=>{this._skipTap=!0},wheelPasses:e=>this.wheelPasses(e),focus:(e,t,n)=>this.focusFeature(e,t,n)},three:{THREE:i,SVGLoader:this._svgLoader&&this._svgLoader.SVG,scene:this.scene,camera:this.camera,renderer:this.renderer,add:c,unit:l,ink:e=>(this._unitById[e]||{}).ink||null,kit:e=>{let t=this._geomKit,n=this.levelViews,r=(e,t)=>v(t,e),o=(t,n,r)=>{let i=r||e;return i?i.add(t):c(t,n),t},s=(e,t,a,s,c)=>{let l=new i.Mesh(t,Array.isArray(a)?a.map(t=>r(e,t)):r(e,a));return l.castShadow=!!s,s&&n[e].depthMaterial&&(l.customDepthMaterial=n[e].depthMaterial),l.receiveShadow=!0,o(l,e,c)},l=(e,t,n,a)=>o(new i.LineSegments(new i.EdgesGeometry(t,25),r(e,this.themed(new i.LineBasicMaterial,n))),e,a),u=(e,n,r,a,o)=>{let c=new i.ShapeGeometry(n.map(e=>t.shp(e)),1);c.rotateX(-Math.PI/2),c.translate(0,r,0);let l=Math.max(1,Math.round(r*1e3));return s(e,c,t.lam(a,Object.assign({polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-2*l},o?{clippingPlanes:t.CP,clipShadows:!0}:null)))},d=(e,n,r,i,o)=>{let c=a.groundLevel||0,u=s(c,t.ext(e,n,r),t.lam(i),!0);return o&&l(c,u.geometry,o,u),u},f={};return Object.assign({},t,{reg:r,mesh:s,edges:l,flat:u,BX:d,put:(e,t,n,r,a,o)=>{(f[e]=f[e]||{geo:t,mat:n,ms:[]}).ms.push(new i.Matrix4().compose(new i.Vector3(...r),new i.Quaternion().setFromEuler(new i.Euler(0,o||0,0)),new i.Vector3(...a)))},inst:f})},explode:()=>this._explodeBlend||0,storey:n.storeyHeight,floorTop:n.FLOOR_TOP,rise:()=>this._levelRise||n.storeyHeight,fade:v,levelY:g,levelOpacity:_,project:p,loading:e=>this.trackLoad(e)},geo:{fit:(e,t,r,i,a,o)=>n.fitLabel(e,t,r,i,a,o),offset:(e,t)=>n.offsetPolyline(e,t),metres:e=>(+e||0)*r.scale,stair:e=>n.stairLayout(e)},announce:(t,r)=>{if((n.EVENT_OWNERS||{})[t]!==e.id)throw Error(`Event "`+t+`" is not owned by this plugin`);this.emit(t,r)},theme:Object.freeze({scheme:()=>this.scheme(),dark:()=>this.scheme()===`dark`,lightCards:()=>this.lightCards(),lightTooltips:()=>this.lightTooltips(),glassPopups:()=>this.glassPopups(),glassControls:()=>this.glassControls(),uiRadius:()=>this.uiRadius(),accent:()=>r.accent,accentTint:e=>{let t=r.toOklch(r.accent);return t?r.fromOklch(e,t[1]*.45,t[2]):r.accent},palette:()=>r.scenePalette,toDark:e=>r.toDark(e),invert:e=>r.invertLightness(e),color:(e,t)=>r.themeSpec(e,t),resolve:e=>r.resolveColor(e),tag:(e,t,n)=>this.themed(e,t,n),monoSvg:e=>r.svgIsMono(e),monoImage:e=>r.imageIsMono(e),readable:(e,t,n)=>r.readableOn(e,t,n),contrast:(e,t)=>r.contrast(e,t)}),provide:t=>{e.exports=Object.assign(e.exports||{},t)},ui:{container:this._viewport,mount:f,zone:d,dock:w,inset:S,slot:C,size:m,style:t=>this.baseCss(e.id,t),env:()=>this.env(),anchor:e=>{let t=e&&typeof e==`object`?e.id:this._features&&this._features.has(e)?e:(this.find(e)||{}).id||e;return t?this.anchor(t):null},toast:h,t:(e,t)=>n.t(e,t),language:()=>this.language(),languages:()=>this.languages(),setLanguage:e=>this.setLanguage(e)},plugin:e=>{let t=this.builtin(e);if(t){let e={id:t.id,name:t.name,core:!!t.locked,enabled:()=>this.pluginOn(t.id),setting:e=>this.pluginSetting(t.id,e)};return new Proxy(e,{get:(e,n)=>{if(n in e||typeof n!=`string`)return e[n];let r=this._builtinPlugins&&this._builtinPlugins[t.id],i=r&&r.active&&r.exports;return i&&typeof i[n]==`function`?(...e)=>{let r=this._builtinPlugins[t.id];if(!r||!r.active||!r.exports)throw Error(t.name+` is off`);return r.exports[n](...e)}:i&&n in i?i[n]:(...e)=>{throw Error(t.name+` is off`)}}})}let n=(this._plugReg||[]).find(t=>t.id===e||t.name===e);if(!n)throw Error(`No plugin "`+e+`"`);return{id:n.id,name:n.name,core:!1,enabled:()=>!!n.active,setting:e=>(n.config||{})[e]}},config:e.config=e.config||{},memory:e.mem=e.mem||{}},O=this.aiTools?async(e,t)=>{let n=this.aiTools().find(t=>t.name===e);if(!n)throw Error(`No tool `+e);return n.run(t||{})}:null;return O&&(D.editor={run:O}),D}static SLOT_ANCHORS=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`];static SLOT_MARGIN=16;static HOME_SNAP_MS=1500;static SHOW_WAIT_MS=1500;static SLOT_GAP=8;_slotAdd(e,t,n){let r=a,i=this._slots=this._slots||[],o={el:null,anchor:`top-left`,order:0,min:0,max:0,priority:0,compact:!1,compactWidth:0,width:0,height:0,box:null,onLayout:null,isCompact:!1},s=e=>{e&&([`left`,`right`,`top`,`bottom`,`visibility`].concat(o.ownWidth?[`width`]:[]).forEach(t=>e.style[t]=``),o.ownWidth=!1,e.classList.remove(`mp-slot-compact`))},c=(e,t)=>{t&&this._slotObs&&this._slotObs[e?`observe`:`unobserve`](t)},l=e=>{e||={};let t=!1;if(e.anchor!=null&&e.anchor!==o.anchor){if(!r.SLOT_ANCHORS.includes(e.anchor))throw Error(`anchor must be one of `+r.SLOT_ANCHORS.join(`, `));o.anchor=e.anchor,t=!0}[`order`,`min`,`max`,`priority`,`compactWidth`,`width`,`height`].forEach(n=>{e[n]!=null&&+e[n]!==o[n]&&(o[n]=+e[n]||0,t=!0)}),e.compact!==void 0&&!!e.compact!==o.compact&&(o.compact=!!e.compact,t=!0),e.onLayout!==void 0&&(o.onLayout=e.onLayout);let n=`el`in e?e.el||null:o.el,i=e.box===void 0?o.box:e.box||null;if(n!==o.el||i!==o.box){if(c(!1,o.box||o.el),n!==o.el){let e=o.el;e&&(o.ownWidth&&(e.style.width=``),o.ownWidth=!1,e.classList.remove(`mp-slot-compact`),e.style.visibility=``),o.isCompact=!1,n&&e&&e.style.left?[`left`,`right`,`top`,`bottom`].forEach(t=>n.style[t]=e.style[t]):n&&(n.style.visibility=`hidden`)}o.el=n,o.box=i,c(!0,o.box||o.el),t=!0}return t&&this._slotSchedule(),t};!this._slotObs&&window.ResizeObserver&&(this._slotObs=new ResizeObserver(()=>this._slotSchedule()),this._slotObs.observe(this._viewport),this._slotMut=new MutationObserver(()=>this._slotSchedule()),this._slotMut.observe(this._viewport,{attributes:!0,attributeFilter:[`style`]})),i.push(o),l(Object.assign({},t,{el:e}));let u=()=>{let e=i.indexOf(o);e<0||(i.splice(e,1),c(!1,o.box||o.el),s(o.el),!i.length&&this._slotObs&&(this._slotObs.disconnect(),this._slotMut.disconnect(),this._slotObs=this._slotMut=null),this._slotSchedule())};return n&&n.offs.push(u),{update:l,remove:u,compact:()=>o.isCompact,layout:()=>{cancelAnimationFrame(this._slotRaf),this._slotLayout()}}}_slotSchedule(){!this._slotRaf&&this._viewport&&(this._slotRaf=requestAnimationFrame(()=>this._slotLayout()))}_slotLayout(){this._slotRaf=0;let e=a,t=this._viewport,n=t?t.clientWidth:0,r=[],i=()=>{let e=r.map(e=>[e.x,e.y,e.w,e.h].map(Math.round).join(`,`)).join(`;`);this._slotRects=r,this._slotSig=e};if(!n||!this._slots||!this._slots.length)return i();let o=t.clientHeight,s=getComputedStyle(t),c=e=>parseFloat(s.getPropertyValue(e))||0,l=e.SLOT_MARGIN,u=e.SLOT_GAP,d=[`left`,`center`,`right`],f=(e,t)=>{e.isCompact=t,e.el&&e.el.classList.toggle(`mp-slot-compact`,t)},p=e=>e.max>0&&!e.isCompact,m=e=>e.el?e.isCompact&&e.compactWidth?e.compactWidth:(e.ownWidth&&(e.el.style.width=``),e.ownWidth=!1,e.el.offsetWidth):e.width,h=(e,t)=>p(e)?e.max-(e.max-Math.min(e.min||e.max,e.max))*t:e.natural;[`top`,`bottom`].forEach(e=>{let t=this._slots.filter(t=>t.anchor.startsWith(e)&&(t.el?t.el.isConnected&&t.el.offsetParent!==null&&!(this._uiHidden&&t.el.closest(`[data-mp-top]:not([data-mp-edit])`)):t.width>0));if(!t.length)return;let i=e===`top`,a=l+c(i?`--mp-inset-l`:`--mp-inset-bl`),s=n-l-c(i?`--mp-inset-r`:`--mp-inset-br`),g=s-a,_=l+(i?0:c(`--mp-inset-b`)),v=d.map(e=>t.filter(t=>t.anchor.endsWith(e)).sort((e,t)=>e.order-t.order));t.forEach(e=>f(e,!1)),t.forEach(e=>e.natural=p(e)?0:m(e));let y=e=>v.map(t=>t.length?Math.max(...t.map(t=>h(t,e))):0),b=e=>{let t=y(e);return t[0]+t[1]+t[2]+u*Math.max(0,t.filter(Boolean).length-1)},x=0;for(;!(b(0)<=g);){if(b(1)<=g){let e=0,t=1;for(let n=0;n<14;n++){let n=(e+t)/2;b(n)<=g?t=n:e=n}x=t;break}let e=t.filter(e=>e.compact&&!e.isCompact).sort((e,t)=>e.priority-t.priority)[0];if(!e){x=1;break}f(e,!0),e.natural=m(e)}let[S,,C]=y(x),w=a+(S?S+u:0),T=s-(C?C+u:0);v.forEach((t,c)=>{let l=d[c],f=_;t.forEach(t=>{let c=h(t,x);l===`center`&&p(t)&&(c=Math.min(c,Math.max(T-w,t.min||0))),c=Math.round(c);let d=l===`left`?a:l===`right`?s-c:(a+s)/2-c/2;if(l===`center`&&(d=Math.max(w,Math.min(d,T-c))),d=Math.round(d),t.el){let e=t.el.style;p(t)?e.width=c+`px`:t.ownWidth&&(e.width=``),t.ownWidth=p(t),e.left=l===`right`?`auto`:d+`px`,e.right=l===`right`?Math.round(n-s)+`px`:`auto`,e.top=i?f+`px`:`auto`,e.bottom=i?`auto`:f+`px`,e.visibility=``}if(t.onLayout)try{t.onLayout({edge:e,side:l,x:d,y:f,width:c,compact:t.isCompact})}catch(e){console.warn(e)}let m=t.el?(t.box||t.el).offsetHeight:t.height;c>0&&m>0&&r.push({x:d,y:i?f:o-f-m,w:c,h:m,edge:e,side:l}),m&&(f+=m+u)})})}),i()}async install(e){this._pluginFrames=this._pluginFrames||[],this._pluginEvents=this._pluginEvents||[],this._plugins=this._plugins||[];let t={objs:[],els:[],grps:[],mats:[],offs:[],concealed:new Map};e.dispose=()=>{this._pluginFrames=this._pluginFrames.filter(t=>t.plugin!==e),this._pluginEvents=this._pluginEvents.filter(t=>t.plugin!==e),t.els.forEach(e=>e.remove()),t.offs.forEach(e=>{try{e()}catch{}}),t.objs.forEach(e=>e.parent&&e.parent.remove(e)),t.mats.forEach(([e,t])=>{e.mats=e.mats.filter(e=>e!==t)}),t.concealed.forEach(e=>e.forEach(([e,t,n])=>{e.colorWrite=t,e.depthWrite=n})),t.grps.forEach(e=>{e.group.position.copy(e.position),e.group.quaternion.copy(e.quaternion),e.group.scale.copy(e.scale)});try{typeof e.ret==`function`&&e.ret()}catch(e){console.warn(e)}},e.active=!0,this._lastCameraKey=null,this._plugins.push(e),this._plugReg=this._plugReg||[],!e.builtin&&!this._plugReg.includes(e)&&this._plugReg.push(e);try{let n=Object.getPrototypeOf(async function(){}).constructor;e.exports=null,e.ret=e.fn?await e.fn(this.plugApi(e,t)):await new n(`api`,e.code)(this.plugApi(e,t))}catch(t){throw this.uninstall(e),t}this.forceUpdate()}uninstall(e){if(e.active){e.active=!1;try{e.dispose()}catch(e){console.warn(e)}this._plugins=(this._plugins||[]).filter(t=>t!==e),this.forceUpdate()}}findPlug(e){let t=this._plugReg||[],n=String(e).toLowerCase();return t.find(e=>e.name.toLowerCase()===n)||t.find(e=>e.name.toLowerCase().includes(n))}syncPlugins(e,t){(this._plugins||[]).filter(n=>!n.builtin&&!e.includes(n)&&!(n.userSet&&(!t||t.includes(n)))).forEach(e=>this.uninstall(e)),e.filter(e=>!e.active&&!(e.userSet&&(!t||t.includes(e)))).forEach(e=>this.install(e).catch(e=>console.warn(e)))}opt(e,t){let n=a;if(n.optionPlugins||(n.optionPlugins={},n.optionSettings={},n.BUILTINS.forEach(e=>{e.opt&&(n.optionPlugins[e.opt]=e.id),Object.entries(e.settings||{}).forEach(([t,r])=>{r.opt&&(n.optionSettings[r.opt]=[e.id,t])})})),n.optionPlugins[e])return this.pluginOn(n.optionPlugins[e]);if(n.optionSettings[e]){let[r,i]=n.optionSettings[e],a=this.pluginSetting(r,i);return typeof a==`boolean`?this.pluginOn(r)&&a:a??t}let r=this.state.optionOverrides;return r&&r[e]!==void 0?r[e]:this.props[e]??t}findAll(e){let t=(this._stores||[]).concat(this._amenityList||[]).filter(e=>!(this._unitById[e.id]||{}).hid),n=String(e||``).toLowerCase().trim();if(!n)return[];let r=this._storesById(n,t);if(r.length)return r;let i=n.match(/\s*\(?\b(g|l1|l2|ground floor|level 1|level 2)\)?$/),a=i?{g:0,"ground floor":0,l1:1,"level 1":1,l2:2,"level 2":2}[i[1]]:null,o=(i?n.slice(0,i.index).trim():n).replace(/^(the|nearest|closest|a|an)\s+/,``),s={toilet:`wc`,toilets:`wc`,restroom:`wc`,restrooms:`wc`,bathroom:`wc`,bathrooms:`wc`,information:`i`,info:`i`,"information desk":`i`,"info desk":`i`}[o]||o,c=t.filter(e=>e.name.toLowerCase()===o||e.type&&e.type.toLowerCase()===s),l=c.length?c:t.filter(e=>e.name.toLowerCase().includes(o)||o.includes(e.name.toLowerCase()));return a!=null&&l.some(e=>e.level===a)?l.filter(e=>e.level===a):l}_storesById(e,t){let n=String(e||``).toLowerCase().trim();if(!n)return[];t||=(this._stores||[]).concat(this._amenityList||[]).filter(e=>!(this._unitById[e.id]||{}).hid);let r=e=>String(e??``).toLowerCase(),i=t.find(e=>r(e.id)===n);if(i)return[i];let a=t.find(e=>r(((this._unitById[e.id]||{}).r||{}).featureId)===n);return a?[a]:t.filter(e=>r(e.loc&&typeof e.loc==`object`?e.loc.id:e.loc)===n).sort((e,t)=>e.level-t.level)}findStore(e){return this._onLevel(this.findAll(e))}_onLevel(e){return e.find(e=>e.level===this.state.level)||e[0]||null}tintOf(e){let t=this.THREE,n=r.scheme===`dark`,i=n?r.toDark(e):e,a=new t.Color(i),o=a.clone().lerp(new t.Color(n?`#fafafa`:`#09090b`),n?.15:.3),s=.2126*a.r+.7152*a.g+.0722*a.b,c=n?r.readableOn(i,`#fafafa`):s>.2?`#09090b`:`#ffffff`;return Object.assign([a,o,new t.Color(c)],{hex:e})}draw(e){e.logoOwn=void 0,this.emit(`units`,{ids:[e.id]})}normSvg(e){let t=String(e).trim().replace(/^```\w*|```$/g,``).trim();/xmlns=/.test(t)||(t=t.replace(`<svg`,`<svg xmlns="http://www.w3.org/2000/svg"`));let n=t.match(/viewBox=["']([^"']+)["']/);if(n&&!/<svg[^>]*\swidth=/.test(t)){let e=n[1].trim().split(/[\s,]+/).map(Number);t=t.replace(`<svg`,`<svg width="`+e[2]*8+`" height="`+e[3]*8+`"`)}return t}loadImg(e){let t=this._imageCache=this._imageCache||{};return t[e]?Promise.resolve(t[e]):new Promise((n,r)=>{let i=new Image;i.onload=()=>{t[e]=i,n(i)},i.onerror=r,i.src=/^(data:|blob:|https?:)/.test(e)?e:`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e)})}setHeight(e,t){if(a.unitsFlat){e.heightScale=t;return}let n=this.THREE,r=a.FLOOR_TOP,i=this._byId[e.id],o=e.heightOrig*t,s=this._extrude(i.item.poly,r,r+o,i.item.poly.holes);e.m.geometry.dispose(),e.m.geometry=s,e.line.geometry.dispose(),e.line.geometry=a.outlineGeo(n,s),r+o-e.top,e.top=r+o,i.item.top=e.top,this._tallUnits=null,e.storefrontGroup&&(e.storefrontHeight=o,e.storefrontGroup.scale.y=e.opDH?Math.min(1,o*.9/e.opDH):1),e.heightScale=t,this.draw(e)}storefrontStyle(e){let t=a,n=Object.assign({},t.STOREFRONT_DEFAULT,t.storefront||{},this._storefrontOverride||{},this.opt(`storefront`,null)||{},e&&e.storefrontPatch||{});return this.settingOn(`wayfinding`,`storefronts`)||(n.show=`never`),n}storefront(){return this.storefrontStyle(null)}setStorefront(e,t){if(t){let n=this._unitById&&this._unitById[t];if(!n)return!1;n.storefrontPatch=e?Object.assign({},n.storefrontPatch||{},e):null,n.r&&(n.r.storefront=n.storefrontPatch),this._buildStorefront(n)}else this._storefrontOverride=e?Object.assign({},this._storefrontOverride||{},e):null,(this._units||[]).forEach(e=>this._buildStorefront(e));return!0}_buildStorefront(e){let t=this.THREE,n=a.scale,i=e.storefrontGroup;if(!i)return;let o=e.storefrontStyle=this.storefrontStyle(e);if(i.children.slice().forEach(e=>{i.remove(e),e.geometry&&e.geometry.dispose()}),e.opM&&=(e.opM.dispose(),null),o.show===`never`||!e.storefrontSegments.length){i.visible=!1;return}let s=e.opDH=Math.max(.3*n,Math.min(+o.height*n,e.storefrontHeight*.9)),c=Math.max(0,+o.depth||0)*n,l=Math.max(0,+o.inset||0)*n,u=e.opM=new t.MeshLambertMaterial({color:o.color||a.scenePalette.storefront,transparent:!0,opacity:0,depthWrite:!1,side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});e.opFix=o.color?new t.Color(o.color):null;let d=e.storefrontPoly||[],f=d.reduce((e,t,n)=>{let r=d[(n+1)%d.length];return e+t[0]*r[1]-r[0]*t[1]},0)>0?1:-1,p=.006;(e.storefrontPaths||[]).forEach(e=>{let a=e.pts.slice(),d=e.closed,m=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r)||1;return[f*r/i,-f*n/i]},h=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]);return t};if(!d){let e=h(a),t=Math.min(l,Math.max(0,(e-.4*n)/2));if(e-2*t<=.01)return;if(t>0){let e=(e,t)=>{let n=0;for(let i=1;i<e.length;i++){let a=Math.hypot(e[i][0]-e[i-1][0],e[i][1]-e[i-1][1]);if(n+a>t)return[r.lerp(e[i-1],e[i],(t-n)/a)].concat(e.slice(i));n+=a}return e.slice(-1)};a=e(e(a,t).reverse(),t).reverse()}}a.length;let g=d?a.concat([a[0]]):a,_=[];for(let e=0;e<g.length-1;e++)_.push(m(g[e],g[e+1]));let v=h(g),y=d?0:Math.min(Math.max(0,+o.radius||0)*n,v/2,s/2),b=e=>{if(y<=0)return s;let t=e<y?y-e:e>v-y?e-(v-y):0;return s-y+Math.sqrt(Math.max(0,y*y-t*t))},x=(e,t)=>{let n=[e[0]+t[0],e[1]+t[1]],r=Math.hypot(...n)||1,i=[n[0]/r,n[1]/r],a=Math.max(.3,i[0]*e[0]+i[1]*e[1]);return[i[0]/a,i[1]/a]},S=[],C=0;for(let e=0;e<g.length;e++){e&&(C+=Math.hypot(g[e][0]-g[e-1][0],g[e][1]-g[e-1][1]));let t=e?_[e-1]:d?_[_.length-1]:null,n=e<_.length?_[e]:d?_[0]:null,i=t&&n?x(t,n):t||n,a=t&&n&&t[0]*n[0]+t[1]*n[1]<Math.cos(.5);if(e&&y>0){let t=C-Math.hypot(g[e][0]-g[e-1][0],g[e][1]-g[e-1][1]);for(let n=1;n<8;n++)[n/8*y,v-n/8*y].forEach(n=>{if(n>t+1e-6&&n<C-1e-6){let i=(n-t)/(C-t);S.push({p:r.lerp(g[e-1],g[e],i),d:n,n:_[e-1]})}});S.sort((e,t)=>e.d-t.d)}a?(S.push({p:g[e],d:C,n:i}),S.push({p:g[e],d:C,n:i,brk:!0})):S.push({p:g[e],d:C,n:i})}let w=[],T=[],E=(e,t,n,r)=>(w.push(e[0]+t[0]*n,r,e[1]+t[1]*n),w.length/3-1),D=(e,t,n)=>{let r=S.map(t=>{let r=b(t.d);return n?[E(t.p,t.n,e,r),E(t.p,t.n,e+c,r)]:[E(t.p,t.n,e,0),E(t.p,t.n,e,r)]});for(let e=0;e<r.length-1;e++){if(S[e+1].brk)continue;let[n,i]=r[e],[a,o]=r[e+1];t?T.push(n,i,a,a,i,o):T.push(n,a,i,a,o,i)}};D(p,!1,!1),c>0&&(D(p+c,!0,!1),D(p,!0,!0),d||[S[0],S[S.length-1]].forEach((e,t)=>{let n=b(e.d),r=E(e.p,e.n,p,0),i=E(e.p,e.n,p+c,0),a=E(e.p,e.n,p+c,n),o=E(e.p,e.n,p,n);t?T.push(r,i,a,r,a,o):T.push(r,a,i,r,o,a)}));let O=new t.BufferGeometry;O.setAttribute(`position`,new t.Float32BufferAttribute(w,3)),O.setIndex(T),O.computeVertexNormals();let k=new t.Mesh(O,u);k.renderOrder=1,c>0&&(k.castShadow=!0,u.depthWrite=!0),i.add(k)}),i.visible=o.show===`always`,e.storefrontAlpha=+(o.show===`always`),i.scale.y=1}rebuild(e){let t=a,n=this.THREE,r=t.FLOOR_TOP,i=this._byId[e.id],o=e.poly0;if(e.merged.length){let n=e.raw,r=e.merged.slice();for(;r.length;){let e=r.findIndex(e=>this._unitById[e]&&t.union(n,this._unitById[e].raw));if(e<0)return!1;n=t.union(n,this._unitById[r[e]].raw),r.splice(e,1)}o=this._inset(n,.14)}let s=o.map(e=>e[0]),c=o.map(e=>e[1]),l=[Math.min(...s),Math.max(...s),Math.min(...c),Math.max(...c)],u=e.merged.length,d=u?t.fitLabel(o,(e.r.name||``).length,e.am):null;e.lp=u?o:e.lp0,e.centerX=u?d.centerX:e.centerXOrig,e.centerZ=u?d.centerZ:e.centerZOrig,e.boxWidth=u?l[1]-l[0]:e.boxWidthOrig,e.boxDepth=u?l[3]-l[2]:e.boxDepthOrig,e.alongV=u?e.boxDepth>=e.boxWidth:e.av0,i.item.poly=o,i.item.cx=e.centerX,i.item.cz=e.centerZ;let f=this._extrude(o,e.base??r,e.top,o.holes);return e.m.geometry.dispose(),e.m.geometry=f,e.line.geometry.dispose(),e.line.geometry=a.outlineGeo(n,f),this.draw(e),!0}applyMerge(e,t){let n=this._unitById[e];if(!n)return!1;let r=n.merged;return n.merged=t.slice(),this.rebuild(n)?(r.filter(e=>!t.includes(e)).forEach(e=>this.showUnit(e,!0)),t.filter(e=>!r.includes(e)).forEach(e=>this.showUnit(e,!1)),!0):(n.merged=r,this.rebuild(n),!1)}showUnit(e,t){let n=this._unitById[e];n&&(n.hid=!t,n.m.visible=t,this.draw(n))}applyStore(e,t){let n=this._unitById[e],r=this._byId[e];if(!n||!r)return;let i=r.item.store,a=!1;t.merged&&t.merged.join()!==n.merged.join()&&this.applyMerge(e,t.merged),t.heightScale!=null&&t.heightScale!==n.heightScale&&this.setHeight(n,t.heightScale),t.name!=null&&t.name!==i.name&&(i.name=t.name,a=!0),t.logo!=null&&t.logo!==(n.logo||`orig`)&&(n.logo=t.logo,a=!0),t.labelScale!=null&&t.labelScale!==(n.labelScale||1)&&(n.labelScale=t.labelScale,a=!0),t.labelRotation!=null&&t.labelRotation!==(n.labelRotation||0)&&(n.labelRotation=t.labelRotation,a=!0),t.labelOffset!=null&&t.labelOffset.join()!==(n.labelOffset||[0,0]).join()&&(n.labelOffset=t.labelOffset,a=!0),t.label!=null&&n.r&&!!t.label==!!n.r.noLabel&&(n.r.noLabel=!t.label,a=!0);let o=!1;t.cat!=null&&t.cat!==i.cat&&(i.cat=t.cat,o=!0),t.hours!=null&&t.hours!==i.hours&&(i.hours=t.hours,o=!0),a?this.draw(n):o&&this.emit(`units`,{ids:[e]})}componentWillUnmount(){this._destroyed=!0,this._langObserver&&this._langObserver.disconnect(),this._schemeQuery&&this._schemeQuery.removeEventListener&&this._schemeQuery.removeEventListener(`change`,this._schemeListener),this._cssEl&&=(this._cssEl.remove(),null),(this._plugins||[]).forEach(e=>{try{e.dispose()}catch{}}),cancelAnimationFrame(this._frameId),this._intersectionObserver&&this._intersectionObserver.disconnect(),this._resizeObserver&&this._resizeObserver.disconnect(),this._heightObs&&this._heightObs.disconnect(),this._heightObs=null,clearTimeout(this._wheelHintTimer),this._viewport&&this._viewport.removeEventListener(`wheel`,this._wheelHandler),this._viewport&&this._viewport.removeEventListener(`gesturestart`,this._preventGesture),this._mq&&this._mq.removeEventListener&&this._mq.removeEventListener(`change`,this._mqf),this.renderer&&=(this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),null)}rebuildScene(){let e=(this._rebuildRun||Promise.resolve()).catch(()=>{}).then(()=>this.rebuildSceneNow());return this._rebuildRun=e,e}async rebuildSceneNow(){if(!this.renderer)return;this.applyCss();let e=this._logos=this._logos||{},t=[...new Set(a.source().unitRows.flat().map(e=>e.logo).filter(t=>t&&!(t in e)))];await Promise.all(t.map(async t=>{try{let n=await fetch(t);e[t]=n.ok?await n.text():null}catch{e[t]=null}})),(this._plugins||[]).slice().forEach(e=>this.uninstall(e)),this._navGrid=null,cancelAnimationFrame(this._frameId),this._resizeObserver&&this._resizeObserver.disconnect();let n=e=>(Array.isArray(e)?e:e?[e]:[]).forEach(e=>{e.map&&e.map.dispose(),e.dispose()});this.scene.traverse(e=>{e.geometry&&e.geometry.dispose(),n(e.material),e.customDepthMaterial&&e.customDepthMaterial.dispose()}),(this._textures||[]).forEach(e=>e.dispose()),this.renderer&&(this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),this.renderer=null,this.init(this.THREE))}defaultControls(){return Object.assign({wayfinding:!0,levels:!0,zoom:!0,fullscreen:!0,compass:!0,hint:!0},(a.raw||{}).ui,this.props.controls)}ui(){let e=e=>this.settingOn(`controls`,e);return{wayfinding:this.pluginOn(`wayfinding`),levels:e(`levels`)&&(a.levelNames||[]).length>1,zoom:e(`zoom`),reset:e(`reset`),fullscreen:e(`fullscreen`),compass:e(`compass`),dimension:e(`dimension`),hint:e(`hint`)}}setControls(e){let t=this._pluginConfig().builtin,n=Object.keys(a.BUILTINS.find(e=>e.id===`controls`).settings);return Object.entries(e||{}).forEach(([e,r])=>{if(r!=null){if(e===`wayfinding`)(t.wayfinding=t.wayfinding||{}).enabled=!!r;else if(n.includes(e)){let n=t.controls=t.controls||{};n.settings=Object.assign({},n.settings,{[e]:!!r})}}}),this._plugChanged(null),this.ui()}renderVals(){let e=this.baseVals();return e.ui=this.ui(),e}baseVals(){let e=this.state,t=a,n=e.all,r=e.level,i=this._byId||{},o=e.ready;e.popId&&i[e.popId];let s=e=>this._features&&this._features.get(e),c=e=>(((t.locations||{})[e]||{}).mapplic||{}).tooltip===!1,l=(e=>!!e&&!!(i[e]&&!c(e)||s(e)&&s(e).tip&&s(e).tip()))(e.hovered)&&!e.drag&&(!e.popupOpen||e.popId!==e.hovered||n)&&!(e.scenerySelected&&e.hovered===e.scenerySelected)&&(n||!i[e.hovered]||i[e.hovered].item.store.level===r)?e.hovered:null,u=this._tooltipSlots=this._tooltipSlots||{s:[null,null],a:0,v:null};if(l&&u.s[u.a]!==l){let e=1-u.a;(u.s[e]===l||u.v&&u.s[u.a])&&(u.a=e),u.s[u.a]=l}u.v=l,t.locations;let d=e.scenerySelected&&this.featureInfo(e.scenerySelected);d&&d.name;let f=e=>(this._stores||[]).filter(t=>t.level===e).length,p=e=>()=>{let t=this.state.all;this.closePopups({all:!1,level:e}),t&&this.camGoal&&this.goHome(!1)},m=e=>{let t=this._viewport.getBoundingClientRect();this._pointerNdc&&this._pointerNdc.set((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1)};return{vpRef:e=>{this._viewport=e},glRef:e=>{this._glEl=e},ready:o&&e.shown?1:0,loading:!(o&&e.shown),loadText:e.err?typeof e.err==`string`?e.err:`3D needs WebGL, which is not available here`:`Loading map`,loadAnim:!e.err,tags:a.levelNames.map((e,r)=>({label:t.levelNames[r],op:o&&n?1:0,pe:n?`auto`:`none`,pick:p(r),ref:e=>{this._tg[r]=e}})),tips:[0,1].map(e=>{let t=u.s[e],n=!!l&&e===u.a,r=t&&i[t],a=!r&&t&&s(t),o=a&&a.tip&&a.tip()||{};return{ref:this._tRef[e],op:+!!n,sc:n||this._reducedMotion?1:.9,up:!!o.up,dn:!!o.down,name:r?r.item.store.name:o.text||``}}),closeP:e=>{e.stopPropagation(),this.closePopups()},chipT:n?`All levels`:t.levelNames[r],chipS:n?(this._stores||[]).length+` units · pick a store to open its level`:f(r)+` units`,allBg:n?`var(--mp-selected-bg)`:`var(--mp-surface)`,allFg:n?`var(--mp-selected-fg)`:`var(--mp-fg-muted)`,toggleAll:()=>{let e=!this.state.all;(!e||this.canExplode())&&(this.closePopups({all:e}),this.camGoal&&this.goHome(e))},lvBtns:a.levelNames.map((e,t)=>t).reverse().map(e=>{let i=!n&&r===e;return{label:a.levelShortNames[e],title:t.levelNames[e],bg:i?`var(--mp-selected-bg)`:`var(--mp-surface)`,fg:i?`var(--mp-selected-fg)`:`var(--mp-fg-muted)`,div:`var(--mp-border-subtle)`,pick:p(e)}}),rzOp:+!!e.awayFromHome,rzPe:e.awayFromHome?`auto`:`none`,rzY:e.awayFromHome||this._reducedMotion?0:4,resetView:e=>{e.stopPropagation(),this.camGoal&&this.goHome(this.state.all),this.closePopups()},zoomIn:()=>{this._flight=null,this.camGoal&&(this.camGoal.distance=Math.max(this.minDist(),this.camGoal.distance/1.4))},zoomOut:()=>{this._flight=null,this.camGoal&&(this.camGoal.distance=Math.min(this.maxDist(),this.camGoal.distance*1.4))},plugRef:e=>{this._plugEl=e},sceneRef:e=>{this._sceneEl=e},slotRef:e=>{this._slot=e},resetRot:e=>{if(e.stopPropagation(),!this.camGoal)return;let t=this.home(this.state.all),n=this.camGoal;this._inertia=null,n.azimuth=t.azimuth+2*Math.PI*Math.round((n.azimuth-t.azimuth)/(2*Math.PI)),n.polar=t.polar},cs:40,dirGap:80,hintText:e.coarse?`Drag to pan · Pinch to zoom · Twist to rotate · Two-finger drag to tilt`:`Drag to pan · Double-click and drag to rotate · `+({modifier:`Ctrl + scroll to zoom`,off:``,zoom:`Scroll to zoom`}[this.wheelMode()]||``),stop:e=>e.stopPropagation(),cursor:e.drag?`grabbing`:e.hovered?`pointer`:`grab`,ctx:e=>e.preventDefault(),down:e=>{if(!this.camGoal||e.button>2)return;let t=this._pointers;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),e.pointerType===`mouse`&&this._pendingDrag&&this._pendingDrag.btn===e.button&&performance.now()-this._pendingDrag.t<90){let t=this._pendingDrag.d;this._pendingDrag=null,t.lx=e.clientX,t.ly=e.clientY,t.hs=[],this._drag=t,this._inertia=null,this._moved=!0,this._lastUp=null;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}this.state.drag||this.setState({drag:!0,hovered:null});return}if(e.pointerType===`touch`&&(this._pointerNdc&&this._pointerNdc.set(-9,-9),t.size>=2)){try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}this._drag=null,this._inertia=null,this._moved=!0,this._lastUp=null,this._touchNow=this.twoPointers(),this._touchStart=this._touchNow,this._touchMode=null,this.state.drag||this.setState({drag:!0,hovered:null});return}let n=this._lastUp,r=!(e.button===0&&n&&performance.now()-n.t<350&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<8||e.button===2&&!this.is2d()||e.button===0&&(e.shiftKey||(e.metaKey||e.ctrlKey)&&!this.is2d()));this._inertia=null;let i=e.target.closest&&e.target.closest(`[data-mp-drag]`)||null;this._drag={x:e.clientX,y:e.clientY,lx:e.clientX,ly:e.clientY,pan:i?!0:r,btn:e.button,hs:[],through:i},this._moved=!1;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},move:e=>{let t=this._pointers,n=e.pointerType===`touch`;if(t.has(e.pointerId)&&t.set(e.pointerId,{x:e.clientX,y:e.clientY}),!n){let t=this._plugEl&&e.target!==this._plugEl&&this._plugEl.contains(e.target)||!!(e.target.closest&&e.target.closest(`[data-mp-top]`)),n=t&&e.target.closest&&e.target.closest(`[data-mp-hover]`);this._hovOver=n?n.getAttribute(`data-mp-hover`):null,t?this._pointerNdc&&this._pointerNdc.set(-9,-9):m(e),this._hoverDirty=!0}if(!n&&e.buttons===0&&this._drag&&!(this._drag.hs.length&&e.timeStamp-this._drag.hs[this._drag.hs.length-1].t<50)){this._drag=null,t.delete(e.pointerId),this._lastUp=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}this.state.drag&&this.setState({drag:!1});return}if(this._touchNow){if(t.size<2)return;let e=this.twoPointers(),n=this.camGoal,r=e=>Math.atan2(Math.sin(e),Math.cos(e));if(!this._touchMode){let t=this._touchStart,n=Math.abs(e.d-t.d),i=Math.abs(r(e.a-t.a))*e.d/2,a=Math.abs(e.mx-t.mx),o=Math.abs(e.my-t.my);if(Math.max(n,i,a,o)<12)return;this._touchMode=o>1.5*a&&o>n&&o>i?`tilt`:`xf`,this._touchNow=t}let i=this._touchNow;this._touchNow=e;let a=e.my-i.my,o=e.mx-i.mx;if(this._touchMode===`tilt`){n.polar=Math.max(.12,Math.min(1.38,n.polar-a*.006));return}i.d>0&&e.d>0&&this.zoomAt(e.mx,e.my,i.d/e.d),n.azimuth+=r(e.a-i.a),this.panPixels(o,a);return}let r=this._drag;if(!r||!this._moved&&Math.abs(e.clientX-r.x)+Math.abs(e.clientY-r.y)<(n?10:4))return;this._moved||(this._moved=!0,this.setState({drag:!0,hovered:null}));let i=e.clientX-r.lx,a=e.clientY-r.ly,o=this.camGoal;if(this.camView,r.lx=e.clientX,r.ly=e.clientY,!n&&e.buttons===0)return;let s=e.timeStamp,c=r.hs;for(;c.length&&s-c[0].t>120;)c.shift();if(!r.pan){let e=.0035,t=.003;o.azimuth-=i*e,o.polar=Math.max(.12,Math.min(1.38,o.polar-a*t)),c.push({t:s,px:i,py:a,a:-i*e,p:-a*t,x:0,z:0});return}let[l,u]=this.panPixels(i,a);c.push({t:s,px:i,py:a,a:0,p:0,x:l,z:u})},up:e=>{let t=this._pointers;t.delete(e.pointerId);let n=this._skipTap;if(this._skipTap=!1,e.pointerType===`touch`&&this._pointerNdc&&this._pointerNdc.set(-9,-9),this._touchNow){if(t.size<2){this._touchNow=null,this._drag=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.size||this.setState({drag:!1})}return}let r=this._drag;if(!r)return;this._drag=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(this._lastUp=this._moved||r.through?null:{t:performance.now(),x:e.clientX,y:e.clientY},this._moved&&e.pointerType===`mouse`&&(this._pendingDrag={d:r,btn:r.btn,t:performance.now()}),this._moved){let t=e.timeStamp,n=r.hs.filter(e=>t-e.t<=100),i=n.filter(e=>t-e.t<=60).reduce((e,t)=>e+Math.abs(t.px)+Math.abs(t.py),0);if(!this._reducedMotion&&n.length>=2&&i>=3){let e=Math.max(16,t-n[0].t+8)/1e3,i=.55,a=n.reduce((e,t)=>(e.x+=t.x,e.z+=t.z,e.a+=t.a,e.p+=t.p,e),{x:0,z:0,a:0,p:0});this._inertia={pan:r.pan,vx:a.x/e*i,vz:a.z/e*i,va:a.a/e*i,vp:a.p/e*i}}this.setState({drag:!1});return}if(r.btn!==0||!this.renderer||n)return;if(r.through){r.through.isConnected&&r.through.click();return}if(this.tapHook&&this.tapHook(e))return;m(e);let i=this.hitTest(this._pointerNdc);i&&i.id?this.pick(i.id):(this.state.selected||this.state.popupOpen||this.state.scenerySelected)&&this.closePopups()},leave:()=>{this._hovOver=null,!this._drag&&this.state.hovered&&this.setState({hovered:null}),this._pointerNdc&&this._pointerNdc.set(-9,-9)},dbl:e=>{!this._moved&&this.renderer&&(e.preventDefault(),m(e),this.zoomAt(e.clientX,e.clientY,1/1.6))}}}}n&&(a.pluginFactories=n.MapplicMap.pluginFactories,r.UI=n.MapplicData.UI,[`PLUGIN_FILES`,`pluginsReady`,`loadThree`,`MAP_URL`,`EMBED_ERROR`,`smartSearch`,`PLACE`,`POPUP`,`HOURS`,`SEARCH`,`API_DOC`].forEach(e=>Object.defineProperty(a,e,{configurable:!0,get:()=>n.MapplicMap[e],set:t=>{n.MapplicMap[e]=t}})));let o={MapplicData:r,MapplicView:i,MapplicMap:a};return a.isolated=()=>t(n||o).MapplicMap,o}let{MapplicData:n,MapplicView:r,MapplicMap:i}=t(null);if(window.MapplicData=n,window.MapplicView=r,window.MapplicMap=i,i.plugin(`grids`,e=>{let t=e.plugin(`grids`),n=e.three.THREE,r=(e,n,r,i)=>{let a=+t.setting(e);return Math.max(r,Math.min(i,isFinite(a)&&a>0?a:n))},i=(e,t,n)=>{let r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let[o,s]=n[i],[c,l]=n[a];s>t!=l>t&&e<(c-o)*(t-s)/(l-s)+o&&(r=!r)}return r},a=e=>e&&isFinite(e[0])&&isFinite(e[1]),o=e.data.units().filter(e=>!e.hidden&&e.box&&e.box.length>=3&&e.box.every(a));if(!o.length)return;let s=o.map(e=>{let t=e.box.map(e=>e[0]),n=e.box.map(e=>e[1]);return[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]}),c=s.reduce((e,t)=>[Math.min(e[0],t[0]),Math.max(e[1],t[1]),Math.min(e[2],t[2]),Math.max(e[3],t[3])],[1/0,-1/0,1/0,-1/0]),l=new Set,u=t=>{if(l.has(t))return;let n=e.three.unit(t);n&&(l.add(t),n.conceal())};o.forEach(e=>u(e.id));let d=[],f=[],p=0,m=``,h=0,g=0,_=0,v=()=>JSON.stringify([`density`,`size`,`shape`,`layout`,`small`,`zoom_steps`].map(e=>t.setting(e))),y=()=>!!(e.ui&&e.ui.env&&e.ui.env().reducedMotion),b=l=>{let d=[`square`,`hexagon`].includes(t.setting(`shape`))?t.setting(`shape`):`round`,f=t.setting(`layout`)===`staggered`,p=t.setting(`small`)===!0,m=Math.max(c[1]-c[0],c[3]-c[2])/l,h=m*r(`size`,60,5,100)/200,g=f?m*Math.sqrt(3)/2:m,_=e=>f&&e%2?m/2:0,v=new Map;o.forEach((e,t)=>{let n=v.get(e.level)||v.set(e.level,{taken:new Set,points:[],ranges:[]}).get(e.level),r=s[t],o=Math.ceil((r[2]-c[2])/g-.5),l=Math.floor((r[3]-c[2])/g-.5),u=n.points.length,d=(e.top||0)+.01;for(let t=o;t<=l;t++){let a=_(t),o=Math.ceil((r[0]-c[0]-a)/m-.5),s=Math.floor((r[1]-c[0]-a)/m-.5);for(let r=o;r<=s;r++){let o=t*100003+r;if(n.taken.has(o))continue;let s=c[0]+a+(r+.5)*m,l=c[2]+(t+.5)*g;i(s,l,e.box)&&(n.taken.add(o),n.points.push([s,d,l]))}}n.points.length===u&&p&&a(e.center)&&n.points.push([e.center[0],d,e.center[1]]),n.points.length>u&&n.ranges.push({id:e.id,from:u,to:n.points.length,hex:-1})});let y=d===`square`?new n.PlaneGeometry(h*2,h*2):d===`hexagon`?new n.CircleGeometry(h/Math.cos(Math.PI/6),6,Math.PI/6):new n.CircleGeometry(h,20);y.rotateX(-Math.PI/2);let b=[],x=new n.Matrix4,S=new n.Color;return v.forEach((t,r)=>{if(!t.points.length)return;let i=new n.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}),a=new n.InstancedMesh(y,i,t.points.length);t.points.forEach((e,t)=>a.setMatrixAt(t,x.makeTranslation(e[0],e[1],e[2]))),a.setColorAt(0,S.set(16777215)),a.instanceMatrix.needsUpdate=!0,a.frustumCulled=!1,a.visible=!1,a.raycast=()=>{},e.three.add(a,r),t.ranges.forEach(t=>{let n=e.three.unit(t.id);t.body=n&&n.body,u(t.id)}),b.push({mesh:a,L:t,level:r})}),{density:l,spacing:m,geometry:y,meshes:b,mix:0}},x=e=>d[e]||(d[e]=b(f[e])),S=()=>{clearTimeout(_),d.forEach(e=>{e&&(e.meshes.forEach(e=>{e.mesh.parent&&e.mesh.parent.remove(e.mesh),e.mesh.material.dispose(),e.mesh.dispose()}),e.geometry.dispose())}),d=[]},C=()=>{clearTimeout(_);let e=f.findIndex((e,t)=>!d[t]);e<0||(_=setTimeout(()=>{x(e),C()},600))},w=()=>{m=v();let e=Math.round(r(`density`,160,20,600)),n=Math.round(Math.max(0,Math.min(3,+t.setting(`zoom_steps`)||0)));f=[e];for(let t=1;t<=n;t++){let n=Math.min(600,e*2**t);if(n<=f[f.length-1])break;f.push(n)}p=Math.min(p,f.length-1);let i=x(p);i.mix=1,i.meshes.forEach(e=>e.mesh.visible=!0),C()},T=()=>{let e=p;for(;e<f.length-1&&g>=e+1;)e++;for(;e>0&&g<e-.15;)e--;return e};w(),e.on(`plugin`,()=>{v()!==m&&(S(),w())});let E=null,D=e=>{g=Math.log2(h/e);let t=T();t!==p&&(x(t).meshes.forEach(e=>{e.mesh.visible=!0,e.L.ranges.forEach(e=>e.hex=-1)}),p=t)};e.on(`camera`,e=>{e&&e.distance>0&&(h||=e.distance,E=e.home?{distance:e.distance,frames:0}:null,D(e.distance))});let O=e=>{let t=e&&(Array.isArray(e.material)?e.material[0]:e.material);return t&&t.color};e.onFrame(t=>{E&&++E.frames>2&&(h=E.distance,E=null,D(h));let n=y()?1:Math.min(1,(t||.016)/.18);d.forEach((t,r)=>{if(!t)return;let i=+(r===p);t.mix!==i&&(t.mix=i>t.mix?Math.min(1,t.mix+n):Math.max(0,t.mix-n)),t.meshes.forEach(({mesh:n,L:r,level:i})=>{if(n.visible=t.mix>0,!n.visible)return;n.material.opacity=t.mix*e.three.levelOpacity(i);let a=!1;r.ranges.forEach(e=>{let t=O(e.body);if(!t)return;let r=t.getHex();if(r!==e.hex){e.hex=r;for(let r=e.from;r<e.to;r++)n.setColorAt(r,t);a=!0}}),a&&(n.instanceColor.needsUpdate=!0)})})});let k=()=>d[p]||null;return e.provide({count:()=>k()?k().meshes.reduce((e,t)=>e+t.L.points.length,0):0,spacing:()=>k()?k().spacing:0,step:()=>p,density:()=>k()?k().density:0}),S}),i.PLUGIN_FILES=[`labels`,`scenery`,`wayfinding`,`markers`,`hours`,`popups`,`attract`,`intro`,`drift`,`controls`,`search`,`directory`,`deeplink`,`localization`],i.pluginsReady=new Promise(e=>{let t=()=>{if(globalThis.MAPPLIC_BUNDLE)return e();let t=i.PLUGIN_FILES.filter(e=>!i.pluginFactories[e]);if(!t.length)return e();let n=t.length,r=()=>{n--,n||e()},a=Date.now();t.forEach(e=>{let t=document.createElement(`script`);t.src=new URL(`plugins/`+e+`.js?v=`+a,document.baseURI).href,t.async=!1,t.onload=r,t.onerror=()=>{console.warn(`mapplic: could not load plugin`,e),r()},document.head.appendChild(t)})};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,t):queueMicrotask(t)}),i.MAP_URL=`https://mapplicusercontent.com/maps/{id}`,i.EMBED_ERROR=`Map not available`,i.EMBED_PLACE=[`data-select`,`data-level`,`data-from`],i.LINK_ITEMS=[`select`,`level`,`route`,`category`],i.EMBED_HOST_CSS=`:host{display:block;position:relative;height:480px}`,window.customElements&&!customElements.get(`mapplic-map`)){let e=e=>String(e??``);customElements.define(`mapplic-map`,class extends HTMLElement{static get observedAttributes(){return[`data-map`,`data-src`,`data-api`,`data-view`,`data-background`,`data-select`,`data-level`,`data-from`]}shadow(){if(!this.shadowRoot){let e=this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.setAttribute(`data-mapplic-page`,`template`),e.append(t)}return this.shadowRoot}syncCss(){let e=Array.from(this.children).filter(e=>e.localName===`template`&&e.hasAttribute(`data-css`)).map(e=>e.content.textContent).join(`
4183
+ }`}}tint(e,t){let n=this.match(e).filter(e=>!e.markers),r=t?this.tintOf(t):null;return this._tints=this._tints||{},n.forEach(e=>{r?this._tints[e.id]=r:delete this._tints[e.id]}),n.length}mergeUnits(e,t){let n=(e||[]).map(e=>this._resolveStore(e)),r=n[0],i=n.slice(1).filter(e=>e.id!==r.id);if(!i.length)throw Error(`Need at least two different units`);if(i.some(e=>e.level!==r.level))throw Error(`Units must be on the same floor`);let a=this._unitById[r.id],o=[];if(i.forEach(e=>o.push(e.id,...this._unitById[e.id].merged)),!this.applyMerge(r.id,[...new Set(a.merged.concat(o))]))throw Error(`These units do not share a wall, so they cannot be merged`);i.forEach(e=>{this._unitById[e.id].merged=[]});let s=n.map(e=>e.name);return this.updateStore(r,t),this.closePopups(),Object.assign(this.info(r),{merged:s})}splitUnit(e){let t=this._resolveStore(e),n=this._unitById[t.id];if(!n||!n.merged.length)throw Error(t.name+` is not a merged unit`);let r=n.merged.length+1;return this.applyMerge(t.id,[]),this.closePopups(),r}reset(){(this._plugins||[]).filter(e=>!e.builtin).forEach(e=>this.uninstall(e)),this._plugReg=[],this._tints={},a.raw&&this._pluginsAtLoad!==void 0&&(a.raw.plugins=JSON.parse(this._pluginsAtLoad)),Object.keys(this._unitById||{}).forEach(e=>{let t=this._unitById[e];this.applyStore(e,{name:t.nameOrig,cat:t.catOrig,hours:t.hoursOrig,heightScale:1,labelScale:1,labelRotation:0,labelOffset:[0,0],focusZoom:0,focusX:0,label:t.labelOrig!==!1,logo:`orig`,merged:[]})}),this.hideRoute(),this.closePopups({optionOverrides:null,all:!1,level:r.startLevel||0}),this.camGoal&&this.goHome(!1),this.bootPlugins(),this._plugChanged(null)}exportMap(){let e=a,t=e.raw;if(!t)throw Error(`Map not loaded`);this._pluginConfig();let n=JSON.parse(JSON.stringify(t)),i=e=>Math.round(e*100)/100,o=e=>Math.round(e*1e6)/1e6,s=e.toLngLat||(((e.raw||{}).crs||{}).type===`geographic`?(()=>{let t=(e.raw||{}).georef||{},n=t.projection;return r.projection(n,t.origin,+t.scale||1).inv})():null),c=s?(t,n)=>s(e.toMetres(t,n)).map(o):(t,n)=>e.toMetres(t,n).map(i);e.originalLocations&&((n.sources||{}).locations||[]).length&&(n.locations=JSON.parse(e.originalLocations)),this._shapesEd&&this._writeShapes(n,e=>{let t=e.map(e=>c(e[0],e[1]));return t.push(t[0].slice()),[t]},c);let l={};Object.values(this._unitById||{}).forEach(e=>{let t=this._byId&&this._byId[e.id],n=t&&t.item.store,r=e.r&&e.r.featureId;if(!r)return;let i={};n&&(n.name!==e.nameOrig&&!(e.r&&n.name===a.unitName(e.r))&&(i.name=n.name),e.catOrig!==void 0&&n.cat!==e.catOrig&&(i.category=n.cat),(n.hours||``)!==(e.hoursOrig||``)&&(i.hours=n.hours)),e.heightScale&&e.heightScale!==1&&(i.height=e.heightScale),e.logo&&e.logo!==`orig`&&(i.logo=e.logo),e.labelScale&&e.labelScale!==1&&(i.label_scale=e.labelScale),e.focusX?i.focus_zoom=e.focusX:e.focusZoom&&(i.zoom=e.focusZoom),e.labelRotation&&(i.label_rotation=e.labelRotation),e.labelOffset&&(e.labelOffset[0]||e.labelOffset[1])&&(i.label_offset=e.labelOffset.slice()),e.r&&e.labelOrig!==void 0&&!e.r.noLabel!==e.labelOrig&&(i.label=!e.r.noLabel),e.merged&&e.merged.length&&(i.merge=e.merged.map(e=>((this._unitById[e]||{}).r||{}).featureId).filter(Boolean));let o=this._tints&&this._tints[e.id];o&&o.hex&&(i.tint=o.hex),Object.keys(i).length&&(l[r]=i)});let u=new Set(Object.values(this._unitById||{}).map(e=>e.r&&e.r.featureId).filter(Boolean));Object.entries(((e.raw||{}).edits||{}).units||{}).forEach(([e,t])=>{t&&(u.has(e)?t.vacant&&(l[e]=Object.assign({},l[e],{vacant:!0})):l[e]=Object.assign({},t,l[e]))}),n.edits=Object.assign({},n.edits),Object.keys(l).length?n.edits.units=l:delete n.edits.units,Object.keys(n.edits).length||delete n.edits;let d=this.state.optionOverrides||{},f=n.plugins;return this.builtinList().forEach(e=>{e.opt&&d[e.opt]!==void 0&&((f.builtin[e.id]=f.builtin[e.id]||{}).enabled=!!d[e.opt])}),this.prunePluginDefaults(f),!Object.keys(f.builtin).length&&!f.custom.length&&delete n.plugins,n}prunePluginDefaults(e){let t=e&&e.builtin||{},n=(e,t)=>JSON.stringify(e)===JSON.stringify(t);return Object.keys(t).forEach(e=>{let r=t[e],i=this.builtin(e);if(!r||typeof r!=`object`)return delete t[e];i&&!i.internal&&(r.enabled!==void 0&&!!r.enabled===(i.locked||i.def!==!1)&&delete r.enabled,r.settings&&(Object.keys(r.settings).forEach(e=>{let t=(i.settings||{})[e];t&&t.default!==void 0&&n(r.settings[e],t.default)&&delete r.settings[e]}),Object.keys(r.settings).length||delete r.settings),Object.keys(r).length||delete t[e])}),e}async saveMap(e,t){let n=a,r=e||this.exportMap(),i=Date.now();if(typeof this.props.onSave==`function`){let e=await this.props.onSave(r,{etag:this.etag(),overwrite:!!(t&&t.overwrite),summary:(t&&Array.isArray(t.summary)?t.summary:[]).map(String)})||{};return e.etag&&(this._etag=e.etag),n.savedCopy={at:i,host:!0},i}return await n.savedStore(`put`,n.savedKey(this.props.src||`mall.mapplic.json`),{map:r,at:i,base:n.baseUpdatedAt}),n.savedCopy={at:i},i}etag(){return this._etag||this.props.etag||null}static SAVE_ERRORS=[`conflict`,`unauthorized`,`invalid`,`notFound`,`failed`];static saveErrorCode(e){let t=e&&(e.code||e.type);return a.SAVE_ERRORS.includes(t)?t:`failed`}async discardSaved(){let e=a;await e.savedStore(`delete`,e.savedKey(this.props.src||`mall.mapplic.json`)),e.savedCopy=null}downloadMap(e){let t=this.exportMap(),n=e||String(this.props.src||`map.mapplic.json`).split(`/`).pop().split(`?`)[0],r=document.createElement(`a`);return r.href=URL.createObjectURL(new Blob([JSON.stringify(t,null,2)],{type:`application/json`})),r.download=n,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(r.href),4e3),n}snapshot(e){let t=e||{},n=Math.round(t.width??600),r=Math.round(t.height??600),i=String(t.type||`image/webp`),a=t.quality??.85;if(!(n>=1&&r>=1&&n<=4096&&r<=4096))return Promise.reject(Error(`snapshot: width and height must be 1 to 4096 px`));let o=()=>this._snapshot(n,r,i,+a),s=(this._snapshotQueue||Promise.resolve()).then(o,o);return this._snapshotQueue=s.catch(()=>{}),s}async _snapshot(e,t,n,r){let i=e=>new Promise(t=>setTimeout(t,e)),o=()=>this._destroyed||!this.el,s=()=>{if(o())throw Error(`snapshot: the map is not mounted`)},c=async(e,t)=>{let n=performance.now();for(;;){if(s(),e._destroyed)throw Error(`snapshot: the map is not mounted`);if(e.state.err)throw Error(`snapshot: `+e.state.err);if(e.state.ready)return;if(t&&performance.now()-n>t)throw Error(`snapshot: the map did not load in time`);await i(50)}};if(s(),!a.webglAvailable())throw Error(`snapshot: WebGL is not available`);await c(this);let l={};Object.keys(this.props).forEach(e=>typeof this.props[e]!=`function`&&(l[e]=this.props[e])),Object.assign(l,{data:JSON.parse(JSON.stringify(this.exportMap())),load:null,scheme:`light`,language:this.language(),savedCopies:!1,plugins:!1,_snapshot:!0});let u=document.createElement(`div`);u.setAttribute(`aria-hidden`,`true`),u.style.cssText=`position:fixed;left:0;top:0;width:`+e+`px;height:`+t+`px;visibility:hidden;pointer-events:none;z-index:-1;overflow:hidden;contain:strict`,document.body.appendChild(u);let d=new(a.isolated())({options:l});try{d.mount(a.shadowBox(u,`:host{display:block}`)),await c(d,3e4),await i(80);try{d.plugins().some(e=>e.id===`attract`&&e.enabled)&&await d.setPlugin(`attract`,{enabled:!1})}catch{}await d.loadsSettled();try{await document.fonts.ready}catch{}if(s(),!d.renderer)throw Error(`snapshot: WebGL is not available`);cancelAnimationFrame(d._frameId),d._reducedMotion=!0;let o=Math.max(e,t)*2<=4096?2:1;d.renderer.setPixelRatio(o);let l=d.snapshotView(e,t),f=()=>{d._insets={},d._flight=null,d._inertia=null,d.camGoal=Object.assign({},l),d.camView=Object.assign({},l),d._forceFrame=!0,d.loop(performance.now()),d._forceFrame=!1,cancelAnimationFrame(d._frameId)};f(),await i(0),f(),await i(0),s();let p=document.createElement(`canvas`);p.width=e,p.height=t;let m=p.getContext(`2d`);m.fillStyle=d.constructor.scenePalette.background||`#ffffff`,m.fillRect(0,0,e,t),f(),m.drawImage(d.renderer.domElement,0,0,e,t);let h=await new Promise(e=>p.toBlob(e,n,r));if(s(),!h)throw Error(`snapshot: the image could not be encoded`);return h}finally{try{d.destroy()}catch{}u.remove()}}static webglAvailable(){try{let e=document.createElement(`canvas`),t=e.getContext(`webgl2`)||e.getContext(`webgl`);if(!t)return!1;let n=t.getExtension(`WEBGL_lose_context`);return n&&n.loseContext(),!0}catch{return!1}}snapshotView(e,t){let n=a,r=this.THREE,i=e/t,o=n.bounds,s=this.home(!1);if(s.distance=Math.max(1.18*n.homeExtent[0]/(n.FOV_TAN*i),n.homeExtent[1]/n.FOV_TAN),!r||!(o[1]-o[0]>.5&&o[3]-o[2]>.5))return s;let c=n.FLOOR_TOP+n.storeyHeight,l=[];[o[0],o[1]].forEach(e=>[o[2],o[3]].forEach(t=>[0,c].forEach(n=>l.push(new r.Vector3(e,n,t)))));let u=new r.PerspectiveCamera(30,i,.5,1e6),d=new r.Vector3,f=new r.Vector3,p=new r.Vector3;for(let e=0;e<8;e++){this.aimCamera(u,s);let e=1/0,t=-1/0,r=1/0,a=-1/0;l.forEach(n=>{d.copy(n).project(u),e=Math.min(e,d.x),t=Math.max(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.y)});let o=s.distance*n.FOV_TAN,c=o*i;f.setFromMatrixColumn(u.matrixWorld,0),p.setFromMatrixColumn(u.matrixWorld,1);let m=(e+t)/2*c,h=(r+a)/2*o;s.targetX+=f.x*m+p.x*h,s.targetY+=f.y*m+p.y*h,s.targetZ+=f.z*m+p.z*h,s.distance*=Math.max((t-e)/2,(a-r)/2)/.9}return s}aimCamera(e,t){let n=Math.sin(t.polar);return e.position.set(t.targetX+t.distance*n*Math.sin(t.azimuth),t.targetY+t.distance*Math.cos(t.polar),t.targetZ+t.distance*n*Math.cos(t.azimuth)),t.polar<.05?e.up.set(-Math.sin(t.azimuth),0,-Math.cos(t.azimuth)):e.up.set(0,1,0),e.lookAt(t.targetX,t.targetY,t.targetZ),e.updateMatrixWorld(),e.updateProjectionMatrix(),e}trackLoad(e){let t=this._loads=this._loads||new Set,n=Promise.resolve(e);t.add(n);let r=()=>t.delete(n);return n.then(r,r),e}async loadsSettled(){for(let e=0;e<20&&this._loads&&this._loads.size;e++)await Promise.allSettled([...this._loads])}_writeShapes(e,t,n){let i=a,o=i.source(),s=i.levelIds,c=e=>e.properties.feature_type,l={},u={shape:[],opening:[],void:[],connector:[]};e.features.forEach(e=>{l[e.id]=e});let d=(e,t)=>{let n=l[e];return n&&c(n)===t?n:{type:`Feature`,id:e,properties:{feature_type:t}}},f=i.toLngLat||((i.raw||{}).crs||{}).type===`geographic`?2e-6:.006,p=(e,t)=>Math.abs(e[0]-t[0])<=f&&Math.abs(e[1]-t[1])<=f,m=e=>e.length>1&&p(e[0],e[e.length-1])?e.slice(0,-1):e,h=(e,t,n)=>{e=m(e),t=m(t);let r=e.length;if(r!==t.length||!r)return!1;for(let i=0;i<(n?r:1);i++)for(let a of n?[1,-1]:[1])if(e.every((e,n)=>p(e,t[((i+a*n)%r+r)%r])))return!0;return!1},g=(e,t,n)=>{let r=e.geometry;return!!(r&&r.type===`Polygon`&&r.coordinates&&r.coordinates.length===t.length&&t.every((e,t)=>h(r.coordinates[t],e,n||t>0)))};o.unitRows.forEach((e,i)=>e.forEach(e=>{let a=d(e.featureId,`shape`),o=a.properties,c=!l[e.featureId],f=t(e.points).concat((e.holes||[]).map(e=>t(e)[0]));(c||!g(a,f))&&(a.geometry={type:`Polygon`,coordinates:f}),o.layer=s[i],e.kiosk?o.kiosk=!0:delete o.kiosk,c&&e.fileCategory&&(o.category=e.fileCategory),u.shape.push(a),e.openings&&!e.openingsAuto&&e.openings.forEach((t,i)=>{if(!e.points[t.edge])return;let a=e=>Math.round(e*1e4)/1e4,o=Math.max(1,t.span|0),[s,c]=r.openingRange(t),l={feature_type:`opening`,unit:e.featureId,edge:t.edge,t:[a(t.start),a(t.end)]};o>1&&(l.span=o),u.opening.push({type:`Feature`,id:e.featureId+`-op-`+(i+1),geometry:{type:`LineString`,coordinates:r.ringPath(e.points,s,c).map(e=>n(e[0],e[1]))},properties:l})})})),o.voidPolys.forEach((e,n)=>e.forEach((e,r)=>{let i=d((o.voidIds[n]||[])[r]||s[n]+`-void-`+(r+1),`void`),a=t(e);g(i,a)||(i.geometry={type:`Polygon`,coordinates:a}),i.properties.layer=s[n],u.void.push(i)})),o.connectors.forEach(e=>{if(l[e.id]&&c(l[e.id])===`connector`&&e.loadedKey&&e.loadedKey===i.connectorKey(e)){u.connector.push(l[e.id]);return}let n=d(e.id,`connector`),r=n.properties,a=e,o=t(i.connectorPolygon(a)),f=i.fitConnector(o[0].slice(0,-1).map(i.toScene));f.axisX*a.axisX+f.axisZ*a.axisZ<0&&(o=[o[0].slice().reverse()]);let p=n.geometry,m=g(n,o,!0)&&i.fitConnector(p.coordinates[0].slice(0,-1).map(i.toScene));m&&m.axisX*a.axisX+m.axisZ*a.axisZ>.99||(n.geometry={type:`Polygon`,coordinates:o}),r.connector_type=e.type,r.layers=e.layers.map(e=>s[e]),e.type!==`elevator`&&(e.dir===`down`||r.direction)&&(r.direction=e.dir),e.type===`stairs`&&(r.stair_shape=e.shape,(e.shape!==`straight`||r.turn)&&(r.turn=e.turn)),u.connector.push(n)});let _=e.features.filter(e=>c(e)===`building`),v=new Set,y=[];o.floorPolys.forEach((e,t)=>{!t||o.floorOwn[t]?y.push({levelIndex:t,lids:[s[t]],P:e}):y[y.length-1].lids.push(s[t])});let b=y.map(e=>{let n=_.find(t=>!v.has(t)&&(t.properties.layers||[t.properties.layer]).includes(s[e.levelIndex]));return n||={type:`Feature`,id:s[e.levelIndex]+`-building`,properties:{feature_type:`building`}},v.add(n),n.geometry={type:`Polygon`,coordinates:t(e.P)},delete n.properties.layer,n.properties.layers=e.lids,n});if(i.toLngLat){let e={},t=[];u.shape.forEach(n=>{let r=/^(.*)~(\d+)$/.exec(String(n.id)),i=r?r[1]:String(n.id);e[i]||(e[i]=[],t.push(i)),e[i].push([r?+r[2]:0,n])}),u.shape=t.map(t=>{let n=e[t].sort((e,t)=>e[0]-t[0]),r=l[t]||n[0][1];return r.id=t,r.geometry=n.length>1?{type:`MultiPolygon`,coordinates:n.map(e=>e[1].geometry.coordinates)}:n[0][1].geometry,r}),b.length=0,_.forEach(e=>b.push(e))}e.features=e.features.filter(e=>!u[c(e)]&&c(e)!==`building`).concat(b,u.shape,u.opening,u.void,u.connector)}applyEdits(e){if(e||=((a.raw||{}).edits||{}).units,!e)return;let t={};Object.values(this._unitById||{}).forEach(e=>{e.r&&e.r.featureId&&(t[e.r.featureId]=e)}),Object.entries(e).forEach(([e,n])=>{let r=t[e];r&&n&&(n.merge&&this.applyMerge(r.id,n.merge.map(e=>t[e]&&t[e].id).filter(Boolean)),this.applyStore(r.id,{name:n.name,cat:n.category,hours:n.hours,heightScale:n.height,labelScale:n.label_scale,focusZoom:n.zoom,focusX:n.focus_zoom,labelRotation:n.label_rotation,labelOffset:n.label_offset?a.labelOffsetOf(n.label_offset):void 0,label:typeof n.label==`boolean`?n.label:void 0,logo:n.logo}),n.tint&&((this._tints=this._tints||{})[r.id]=this.tintOf(n.tint)))})}static PLUGIN_ICONS={sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,"map-pin":`<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>`,phone:`<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>`,globe:`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`,map:`<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>`,box:`<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>`,shapes:`<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>`,database:`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>`,focus:`<circle cx="12" cy="12" r="3"/><path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/>`,plug:`<path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/>`,tag:`<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>`,"circle-dot":`<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="1"/>`,clock:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,"message-square":`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,route:`<circle cx="6" cy="19" r="3"/><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"/><circle cx="18" cy="5" r="3"/>`,trees:`<path d="M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z"/><path d="M7 16v6"/><path d="M13 19v3"/><path d="M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5"/>`,pointer:`<path d="M22 14a8 8 0 0 1-8 8"/><path d="M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"/><path d="M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"/><path d="M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>`,search:`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,list:`<path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/>`,"monitor-play":`<path d="M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z"/><path d="M12 17v4"/><path d="M8 21h8"/><rect x="2" y="3" width="20" height="14" rx="2"/>`,"plane-landing":`<path d="M2 22h20"/><path d="M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z"/>`,orbit:`<path d="M20.341 6.484A10 10 0 0 1 10.266 21.85"/><path d="M3.659 17.516A10 10 0 0 1 13.74 2.152"/><circle cx="12" cy="12" r="3"/><circle cx="19" cy="5" r="2"/><circle cx="5" cy="19" r="2"/>`,grip:`<circle cx="12" cy="5" r="1"/><circle cx="19" cy="5" r="1"/><circle cx="5" cy="5" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="12" cy="19" r="1"/><circle cx="19" cy="19" r="1"/><circle cx="5" cy="19" r="1"/>`,link:`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,layers:`<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>`,languages:`<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>`,ruler:`<path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"/><path d="m14.5 12.5 2-2"/><path d="m11.5 9.5 2-2"/><path d="m8.5 6.5 2-2"/><path d="m17.5 15.5 2-2"/>`,palette:`<circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/>`,puzzle:`<path d="M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"/>`};static pluginIconSvg(e,t=16){let n=a.PLUGIN_ICONS[e]||a.PLUGIN_ICONS.puzzle;return`<svg xmlns="http://www.w3.org/2000/svg" width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="`+(t>16?1.75:2)+`" stroke-linecap="round" stroke-linejoin="round">`+n+`</svg>`}static BUILTINS=[{id:`core`,icon:`box`,name:`Renderer`,category:`Core`,help:`Draws the 3D map and runs the camera: pan, zoom, rotate, tilt, the all-levels view and 2D mode (top-down, fixed heading). Sun shadows are a setting.`,desc:`3D drawing, lighting and the camera`,locked:!0,settings:{shadows:{type:`boolean`,default:!0,label:`Sun shadows`,opt:`shadows`,help:`Buildings and stores cast soft sun shadows. Off draws faster on slow devices.`},shadow_strength:{type:`number`,default:100,min:10,max:100,step:5,unit:`%`,label:`Shadow strength`,when:{shadows:!0},opt:`shadowStrength`,help:`How dark the shadows are. Lower suits light, airy styles.`},wheel:{type:`choice`,options:[`zoom`,`modifier`,`off`],default:`zoom`,input:`select`,labels:{zoom:`Zoom`,modifier:`With Ctrl / ⌘`,off:`Off`},label:`Mouse wheel`,opt:`wheel`,help:`What the mouse wheel does over the map. Ctrl / ⌘ + wheel lets the page scroll and shows how to zoom. Off: zoom with the buttons or a pinch.`,hint:`Trackpad pinch still zooms with the modifier; full screen always zooms.`}}},{id:`data`,icon:`database`,name:`Map data`,category:`Core`,help:`Reads the map file: units, levels, floor links, doors, merged units, tints and heights. Also works out walking routes, which Wayfinding draws.`,desc:`Units, levels, floor links, doors, merged units, tints and heights`,locked:!0},{id:`selection`,icon:`focus`,name:`Selection`,category:`Core`,help:`Tracks what is hovered and selected, colours it and flies the camera to it. Popups, Labels and Wayfinding build on it.`,desc:`Hover, select and focus a place`,locked:!0},{id:`api`,icon:`plug`,name:`Plugin API`,category:`Core`,help:`The calls and events that plugins and host pages use. Built-in and custom plugins share the same API.`,desc:`Events and calls for plugins and the host page`,locked:!0},{id:`appearance`,icon:`palette`,name:`Appearance`,category:`Core`,help:`How the map looks: colour scheme, cards, roundness, store colours on hover and selection, the level gap, and the map's box (background, drawing past its edges, edge fade). Always on; each view can set it differently.`,desc:`Colour scheme, cards, roundness and the map's box`,always:!0,main:`theme`,panels:{theme:{label:`Theme`,keys:[`scheme`,`selected`,`light_cards`,`light_tooltips`,`unit_states`,`glass_popups`,`glass_controls`,`ui_radius`],breaks:[`glass_popups`]},container:{label:`Container`,keys:[`background`,`bleed`,`edge_fade`]}},settings:{scheme:{type:`choice`,options:[`light`,`dark`,`auto`],default:`light`,label:`Colour scheme`,icons:{light:`sun`,dark:`moon`},help:`Light or dark map. Auto follows the visitor's device setting.`},selected:{type:`choice`,options:[`neutral`,`accent`],default:`neutral`,label:`Selected controls`,help:`How selected controls look, such as the active level: grey, or tinted with the accent colour.`},light_cards:{type:`choice`,options:[`dark`,`white`],default:`dark`,label:`Light-scheme cards`,help:`Popup card colour on the light scheme.`},light_tooltips:{type:`choice`,options:[`cards`,`dark`,`white`],default:`cards`,input:`select`,labels:{cards:`Same as cards`,dark:`Dark`,white:`White`},label:`Light-scheme tooltips`,help:`Colour of hover tooltips and level tags on the light scheme.`},unit_states:{type:`choice`,options:[`accent`,`category_hover`,`category`],default:`accent`,input:`select`,labels:{accent:`Accent`,category_hover:`Category on hover`,category:`Category`},label:`Store colours`,help:`Store colours on hover and selection: the accent colour, or each store's category colour.`,hint:`accent: built-in hover, selection in the accent. category_hover: hover tints in the category colour, selection stays the accent. category: both. Only stores whose main category has a colour.`},glass_popups:{type:`boolean`,default:!1,label:`Glass popups`,help:`Popup cards get a frosted glass look.`},glass_controls:{type:`boolean`,default:!1,label:`Glass controls`,help:`Map controls, the search box and its filters, and the Directions button get a frosted glass look.`},ui_radius:{type:`number`,default:4,min:0,max:8,step:1,label:`Roundness`,help:`How rounded the map, its controls, cards and panels are. 0 is square, 4 the default.`},exploded_view:{type:`boolean`,default:!0,multiLevel:!0,label:`Exploded view`,help:`All levels can show at once, opened apart: the All levels button, Attract mode, category zoom.`,hint:`Off: one level at a time everywhere. The editor shows it in the Levels panel.`},level_spacing:{type:`number`,default:12,min:0,max:50,step:1,unit:`%`,label:`Level gap`,explode:!0,help:`Space between floors when all levels show at once.`,hint:`A share of the map size; the exploded (all levels) view.`},background:{type:`boolean`,default:!0,label:`Background`,help:`Fills the map's box with colour. Off: transparent, so the page shows through.`},bleed:{type:`number`,default:0,min:0,max:600,step:10,unit:`px`,zero:`None`,unlimited:`No limit`,label:`Overflow`,help:`Lets the 3D map draw past its box on every side. Controls stay inside the box.`,hint:`No limit: up to the nearest parent that clips, else the window. The page under the overflow stays clickable.`},edge_fade:{type:`number`,default:0,min:0,max:400,step:10,unit:`px`,zero:`None`,label:`Edge fade`,help:`Fades the map out towards its outer edges over this distance.`,hint:`With overflow: the overflow edges.`}}},{id:`size`,icon:`ruler`,name:`Size`,category:`Core`,help:`The map's height: fill the element it sits in, a share of the screen, an aspect ratio or fixed pixels, with limits and a separate choice for narrow screens. The map's own UI never changes it. Always on; each view can set it differently.`,desc:`The map's height, also on narrow screens`,always:!0,panels:{size:{label:`Size`,keys:[`mode`,`screen`,`offset`,`ratio`,`px`,`min`,`max`,`narrow_mode`,`narrow_screen`,`narrow_ratio`,`narrow_px`],breaks:[`min`,`narrow_mode`]}},settings:{mode:{type:`choice`,options:[`container`,`screen`,`ratio`,`fixed`],default:`container`,input:`select`,labels:{container:`Fill container`,screen:`Share of screen`,ratio:`Aspect ratio`,fixed:`Fixed`},label:`Height`,help:`How the map's height is set: by the element it sits in, a share of the screen, an aspect ratio, or a fixed height.`,hint:`Fill container with a container that has no height falls back to 80% of the screen.`},screen:{type:`number`,default:80,min:20,max:100,step:5,unit:`%`,when:{mode:`screen`},label:`Screen share`,help:`Map height as a share of the window's height.`},offset:{type:`number`,default:0,min:0,max:400,step:4,unit:`px`,zero:`None`,when:[{mode:`screen`},{narrow_mode:`screen`}],label:`Minus`,help:`Taken off the screen share, for example the height of a sticky site header.`},ratio:{type:`choice`,options:[`21:9`,`16:9`,`3:2`,`4:3`,`1:1`,`3:4`,`9:16`],default:`16:9`,input:`select`,when:{mode:`ratio`},label:`Ratio`,help:`Width to height; the map's height follows its width.`},px:{type:`number`,default:600,min:200,max:1600,step:10,unit:`px`,when:{mode:`fixed`},label:`Height`,help:`The map's height in pixels.`},min:{type:`number`,default:480,min:0,max:1200,step:10,unit:`px`,zero:`None`,when:[{mode:[`screen`,`ratio`]},{narrow_mode:[`screen`,`ratio`]}],label:`Min height`,help:`The map never gets shorter than this.`,hint:`Applies to share of screen and aspect ratio.`},max:{type:`number`,default:900,min:0,max:2e3,step:10,unit:`px`,zero:`None`,when:[{mode:[`screen`,`ratio`]},{narrow_mode:[`screen`,`ratio`]}],label:`Max height`,help:`The map never gets taller than this.`,hint:`Applies to share of screen and aspect ratio.`},narrow_mode:{type:`choice`,options:[`same`,`container`,`screen`,`ratio`,`fixed`],default:`same`,input:`select`,labels:{same:`Same as wide`,container:`Fill container`,screen:`Share of screen`,ratio:`Aspect ratio`,fixed:`Fixed`},label:`Narrow screens`,help:`The map's height on screens under 640 px wide, such as phones.`,hint:`640 px is also where the Directory moves below the map. Not adjustable.`},narrow_screen:{type:`number`,default:60,min:20,max:100,step:5,unit:`%`,when:{narrow_mode:`screen`},label:`Narrow share`,help:`Map height on narrow screens, as a share of the window's height.`},narrow_ratio:{type:`choice`,options:[`21:9`,`16:9`,`3:2`,`4:3`,`1:1`,`3:4`,`9:16`],default:`3:4`,input:`select`,when:{narrow_mode:`ratio`},label:`Narrow ratio`,help:`Width to height on narrow screens.`},narrow_px:{type:`number`,default:480,min:200,max:1600,step:10,unit:`px`,when:{narrow_mode:`fixed`},label:`Narrow height`,help:`The map's height in pixels on screens under 640 px wide.`}}},{id:`labels`,icon:`tag`,name:`Labels`,category:`Plugin`,help:`Shows each location's logo or name on its roof, as large as fits inside the shape. Sizes are set for the map and can be changed per category or location; each label can also be scaled, rotated or moved per store. Names fade out when they get too small to read.`,desc:`Name and logo over each location`,main:`labels`,panels:{labels:{label:`Labels`,keys:[`name`,`logo`,`text_fill`,`text_height`,`text_max`,`logo_fill`,`logo_max`,`min_px`,`logo_min_px`],breaks:[`text_fill`,`min_px`]},layout:{label:`Label layout`,keys:[`uppercase`,`snap`,`wrap`,`wrap_gain`]}},settings:{name:{type:`boolean`,default:!0,label:`Name`,opt:`labels`,help:`Store names are drawn on the map.`},logo:{type:`boolean`,default:!0,label:`Logo`,help:`Store logos are drawn on the map where a store has one.`},text_fill:{type:`number`,default:70,min:20,max:100,step:1,unit:`%`,label:`Name size`,help:`How much of the store's space a name may fill.`,hint:`Share of the largest box of its proportions that fits inside the unit.`},text_height:{type:`number`,default:29,min:10,max:100,step:1,unit:`%`,label:`Name height`,help:`Limits letter size in square stores, so short names don't get oversized.`,hint:`Largest letter size as a share of the box height.`},text_max:{type:`number`,default:1.92,min:.5,max:8,step:.1,unit:`m`,label:`Largest name`,help:`Largest letter size, in metres. Raise it for short labels such as lot numbers.`},logo_fill:{type:`number`,default:30,min:10,max:100,step:1,unit:`%`,label:`Logo size`,help:`Logo size relative to its store. Wide and compact logos come out equally heavy.`,hint:`Logos are sized by area.`},logo_max:{type:`number`,default:20,min:0,max:60,step:1,unit:`m`,zero:`No limit`,label:`Largest logo`,help:`Limits logo size in big stores, in metres. 0 = no limit.`,hint:`The side of a square of the same area.`},uppercase:{type:`boolean`,default:!0,label:`Capital letters`,help:`Names are drawn in capital letters. Off: as written.`},snap:{type:`number`,default:45,min:0,max:90,step:15,unit:`°`,zero:`Free`,label:`Angle step`,help:`Label angles snap to this step. 0 follows each shape exactly.`},wrap:{type:`boolean`,default:!0,label:`Wrap names`,help:`Names of several words may break onto 2 or 3 lines.`},wrap_gain:{type:`number`,default:15,min:0,max:100,step:5,unit:`%`,label:`Wrap when larger by`,help:`A name only wraps when that makes it at least this much larger.`},min_px:{type:`number`,default:5.5,min:0,max:20,step:.5,unit:`px`,zero:`Never`,label:`Hide names below`,help:`Names fade out when they would be smaller than this on screen. 0 = never.`},logo_min_px:{type:`number`,default:12,min:0,max:40,step:1,unit:`px`,zero:`Never`,label:`Hide logos below`,help:`Logos fade out when they would be smaller than this on screen. 0 = never.`,hint:`Measured as the square root of the area, so wide wordmarks count like compact logos.`}}},{id:`markers`,icon:`circle-dot`,name:`Markers`,category:`Plugin`,help:`Points on the map: entrances, parking, amenities or any place. Callouts, pins, badges or dots, clickable or not. Optionally, close markers merge into one until you zoom in, with or without a count.`,desc:`Callouts, pins, badges and dots, with clustering`,breaks:[`cluster`],settings:{amenities:{type:`boolean`,default:!0,label:`Amenities as markers`,help:`Restrooms, information desks and other amenities show as icons on the map.`},scale:{type:`number`,default:1,min:.5,max:2,step:.05,label:`Marker size`,help:`Marker size. 1 is the default.`,unit:`×`},min_zoom:{type:`number`,default:.7,min:0,max:1.5,step:.05,label:`Hide below zoom`,help:`Markers hide when zoomed out past this. 1 is the start view, 0 = never.`,zero:`Never`},cluster:{type:`boolean`,default:!1,label:`Cluster markers`,help:`Markers close together merge into one until you zoom in. Useful on busy maps.`},radius:{type:`number`,default:44,min:16,max:160,label:`Cluster radius`,help:`How close markers must be, in screen pixels, to merge.`,unit:`px`,when:{cluster:!0}},count:{type:`boolean`,default:!0,label:`Count on clusters`,help:`Clusters show how many markers they hold. Off: the closest marker shows instead.`,when:{cluster:!0}}}},{id:`hours`,icon:`clock`,name:`Opening hours`,category:`Plugin`,help:`Works out whether each place is open, closing soon, opening soon or closed, from its hours. Popups show the status and open the week table on click; other plugins can show the status too.`,desc:`Open now status and the week table`,settings:{timezone:{type:`string`,default:``,input:`timezone`,label:`Time zone`,help:`The venue's time zone, for open and closed status. Empty = the visitor's time zone.`,hint:`IANA name, e.g. Europe/Budapest.`},hour12:{type:`boolean`,default:!1,label:`12-hour clock`,help:`Times show as 8 PM instead of 20:00.`},soon:{type:`number`,default:60,min:0,max:240,step:5,label:`Soon within`,help:`Minutes before closing or opening that a place shows "Closing soon" or "Opening soon".`,unit:`min`}}},{id:`popups`,icon:`message-square`,name:`Popups`,category:`Plugin`,help:`Shows a card over the selected store, elevator or bus stop, with its name, hours, floors or departures.`,desc:`Card with name, category and hours when a place is selected`,settings:{open_now:{type:`boolean`,default:!0,label:`Open now status`,help:`Popups show whether the place is open now.`},category_chips:{type:`boolean`,default:!0,label:`Category chips`,help:`Popups show the place's categories as chips; clicking one filters the search.`},directions:{type:`choice`,options:[`primary`,`secondary`],default:`primary`,label:`Directions button`,help:`How the Directions button looks when the place has no link button.`},start_here:{type:`boolean`,default:!1,label:`Start here button`,help:`A button that starts a route from the place.`},style:{type:`choice`,options:[`auto`,`floating`,`sheet`],default:`auto`,label:`Card style`,help:`How popups appear. Auto: a bottom sheet on small touch screens, else a card next to the place.`,labels:{auto:`Auto`,floating:`Floating`,sheet:`Sheet`},hint:`auto: a sheet on touch screens with the map under 480 px, and on any map under 360 px.`}}},{id:`wayfinding`,icon:`route`,name:`Wayfinding`,category:`Plugin`,help:`Adds the Directions button and route panel. Pick a start and a destination to draw an animated walking route across floors.`,desc:`Directions button, route panel and walking routes`,ui:`wayfinding`,settings:{button_label:{type:`boolean`,default:!0,label:`Button label`,help:`The Directions button shows its label. Off: icon only.`},button_position:{type:`choice`,input:`position`,options:[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],default:`top-left`,label:`Button position`,help:`Where the Directions button sits; the route panel opens there.`,labels:{"top-left":`Top left`,"top-center":`Top centre`,"top-right":`Top right`,"bottom-left":`Bottom left`,"bottom-center":`Bottom centre`,"bottom-right":`Bottom right`},hint:`Bottom left: under the compass. On a bottom edge the panel grows upwards.`},layout:{type:`choice`,options:[`auto`,`inline`,`wrapped`],default:`auto`,label:`Panel layout`,help:`Start and destination in one row (Inline) or two (Wrapped). Auto picks by the map width.`},storefronts:{type:`boolean`,default:!0,label:`Storefronts at route ends`,help:`Storefronts are drawn on the stores at both ends of a route.`},units:{type:`choice`,options:[`metric`,`imperial`],default:`metric`,label:`Distance units`,help:`Distances in metres or feet.`},accessible:{type:`boolean`,default:!1,label:`Step-free toggle`,help:`A switch in the directions panel for routes without stairs or escalators.`}}},{id:`scenery`,icon:`trees`,name:`Scenery`,category:`Plugin`,help:`The outdoor site, 3D models, parked and moving cars, bus stops, and the escalator, stair and elevator models.`,desc:`Grass, roads, parking, trees, models, cars and bus stops; escalator and elevator models`,breaks:[`cars`,`connectors`],settings:{trees:{type:`boolean`,default:!0,label:`Trees`,help:`Trees around the site. Off for a cleaner map that draws faster on slow devices.`},cars:{type:`boolean`,default:!0,label:`Cars`,opt:`cars`,help:`Cars on the roads and in the parking areas.`},carsMoving:{type:`boolean`,default:!0,label:`Animate cars`,when:{cars:!0},opt:`motion`,help:`Cars drive along the roads.`},connectors:{type:`boolean`,default:!0,label:`Escalators and elevators`,help:`3D escalators, stairs and elevators.`},connectorsMoving:{type:`boolean`,default:!0,label:`Animate escalators`,when:{connectors:!0},opt:`motion`,help:`Escalator steps move.`}}},{id:`controls`,icon:`pointer`,name:`Controls`,category:`Plugin`,help:`Level switcher, zoom, reset view, full screen, compass, 2D / 3D switch and gesture hint. Each one can be turned off and placed in any of six spots: top or bottom, left, centre or right.`,desc:`Buttons and hints on the map`,main:`buttons`,panels:{buttons:{label:`Controls`,keys:[`levels`,`zoom`,`reset`,`fullscreen`,`compass`,`dimension`,`hint`],breaks:[`hint`]},positions:{label:`Controls position`,keys:[`levels_position`,`zoom_position`,`reset_position`,`fullscreen_position`,`compass_position`,`dimension_position`]}},settings:{levels:{type:`boolean`,default:!0,label:`Level switcher`,ui:`levels`,help:`Buttons for switching between floors.`},zoom:{type:`boolean`,default:!0,label:`Zoom buttons`,ui:`zoom`,help:`Plus and minus buttons for zooming.`},reset:{type:`boolean`,default:!0,label:`Reset view button`,ui:`reset`,help:`A button that goes back to the start view.`},fullscreen:{type:`boolean`,default:!0,label:`Full screen button`,ui:`fullscreen`,help:`A button that shows the map full screen.`},compass:{type:`boolean`,default:!0,label:`Compass`,ui:`compass`,help:`Shows which way is north.`},dimension:{type:`boolean`,default:!0,label:`2D / 3D switch`,ui:`dimension`,help:`A button that switches between the flat 2D map and the 3D view.`},hint:{type:`boolean`,default:!1,label:`Gesture hint`,ui:`hint`,help:`A short note on how to move around the map with a mouse or touch.`},...Object.fromEntries([[`levels`,`Level switcher`,`top-right`],[`zoom`,`Zoom buttons`,`bottom-right`],[`reset`,`Reset view button`,`bottom-right`],[`fullscreen`,`Full screen button`,`bottom-left`],[`compass`,`Compass`,`bottom-left`],[`dimension`,`2D / 3D switch`,`bottom-left`]].map(([e,t,n])=>[e+`_position`,{type:`choice`,input:`position`,options:[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],default:n,label:t.replace(/ button$/,``)+` position`,help:`Where it sits on the map. Controls on the same spot stack away from the edge.`,labels:{"top-left":`Top left`,"top-center":`Top centre`,"top-right":`Top right`,"bottom-left":`Bottom left`,"bottom-center":`Bottom centre`,"bottom-right":`Bottom right`}}]))}},{id:`search`,icon:`search`,name:`Search`,category:`Plugin`,help:`Finds places by name, category, keyword or amenity, forgiving accents and small typos. Filters (category chips, open now, level, custom fields) narrow the results on the map and in the Directory. Without the Directory it is a search box on the map with a dropdown.`,desc:`Search box, filters and map highlight`,main:`main`,panels:{main:{label:`Search`,keys:[`position`,`filters`,`max_width`,`highlight`,`suggestions`,`fuzzy`]},box:{label:`Search box`,keys:[`position`,`max_width`,`blur`,`shortcut`,`filters`,`chip_icons`],breaks:[`filters`]},results:{label:`Search results`,keys:[`highlight`,`highlight_tint`,`fit_category`,`limit`,`suggestions`,`fuzzy`,`intents`,`smart`,`filter_category`,`filter_open`],breaks:[`limit`,`filter_category`]}},def:!1,settings:{position:{type:`choice`,options:[`top-left`,`top-center`,`top-right`,`bottom-center`],default:`top-left`,label:`Position`,help:`Where the search box sits when the Directory is off.`},max_width:{type:`number`,default:0,min:0,max:640,step:10,label:`Max width`,help:`Widest the search box gets. 0 = automatic.`,unit:`px`,zero:`Auto`,hint:`Auto: 360, or 420 when centred. The box shrinks below it to share its row with other controls.`},blur:{type:`boolean`,default:!1,label:`Frosted blur`,help:`Blurs the map behind the search box.`},chip_icons:{type:`boolean`,default:!0,label:`Icons on filter chips`,help:`Category icons on the filter chips.`},highlight:{type:`boolean`,default:!0,label:`Highlight results`,help:`Matching places light up on the map while searching.`},highlight_tint:{type:`boolean`,default:!0,label:`Tint in category colour`,help:`Highlighted places take their category colour.`},fit_category:{type:`boolean`,default:!0,label:`Zoom to category`,help:`Picking a category zooms to its places. On several levels, the levels open (with Exploded view on).`,hint:`Only for a category on its own (no search text or other filter). No zoom when the places cover most of the map.`},filters:{type:`choice`,options:[`chips`,`menu`,`off`],default:`chips`,label:`Filters`,help:`Filters under the search box as chips, behind a filter button, or none.`},filter_category:{type:`boolean`,default:!0,label:`Category filter`,help:`A filter by category.`,hint:`Used when the map file has no search.filters.`},filter_open:{type:`boolean`,default:!0,label:`Open now filter`,help:`A filter for places open now.`,hint:`Used when the map file has no search.filters.`},fuzzy:{type:`boolean`,default:!0,label:`Forgive typos`,help:`Finds names despite small typos.`},limit:{type:`number`,default:0,min:0,max:50,label:`Dropdown results`,help:`Most results in the dropdown. 0 = all; the list scrolls.`,input:`stepper`,zero:`All`},suggestions:{type:`boolean`,default:!0,label:`Suggestions when empty`,help:`Recent and popular places show before typing.`},shortcut:{type:`boolean`,default:!0,label:`"/" shortcut`,help:`Pressing "/" jumps to the search box; a hint shows in it.`},intents:{type:`boolean`,default:!0,label:`Understand phrases`,help:`Understands phrases like "coffee open now on level 2" when the words alone find nothing.`},smart:{type:`boolean`,default:!0,label:`Smart search`,help:`Offers an AI search when nothing matches.`,hint:`Needs MapplicMap.smartSearch from the host page.`}}},{id:`directory`,icon:`list`,name:`Directory`,category:`Plugin`,help:`A browsable list of places next to, below or over the map. Clicking one selects it on the map; selecting on the map scrolls the list to it. List or grid layouts, four item styles, grouping by category, level or letter. With Search on, the search box and filters sit at the top of the list.`,desc:`List of places beside, below or over the map`,main:`main`,panels:{main:{label:`Directory`,keys:[`placement`,`width`,`item`,`columns`,`group`,`sort`,`reel`]},layout:{label:`Directory layout`,keys:[`placement`,`width`,`height`,`max_height`,`map_share`,`sticky_search`,`columns`,`count`,`toggle`,`collapsed`,`title`,`reel`],breaks:[`toggle`]},items:{label:`Directory items`,keys:[`item`,`columns`,`show_category`,`category_style`,`show_level`,`show_hours`,`amenities`,`every_category`],breaks:[`show_category`,`amenities`]},groups:{label:`Directory groups`,keys:[`group`,`sort`,`category_icons`,`counts`,`collapsible`,`rail`,`this_level`],breaks:[`category_icons`]}},def:!1,settings:{placement:{type:`choice`,options:[`left`,`right`,`bottom`,`floating-left`,`floating-right`],default:`left`,label:`Placement`,help:`Where the list sits: beside the map, below it, or floating over it.`,hint:`Narrow screens list below the map, or use a sheet when floating.`},width:{type:`number`,default:340,min:240,max:560,step:10,label:`Width`,help:`Width of the list beside or over the map.`,unit:`px`},height:{type:`choice`,options:[`auto`,`fixed`,`map`],default:`auto`,input:`segmented`,labels:{auto:`Auto`,fixed:`Fixed`,map:`% of map`},label:`List height`,help:`Height of the list below the map. Auto grows with the list and the page scrolls; Fixed and % of map scroll inside.`,hint:`Applies to bottom placement and narrow screens; Size sets the map only. Fixed / % of map pin the search on top.`},max_height:{type:`number`,default:600,min:160,max:1600,step:20,unit:`px`,when:{height:`fixed`},label:`Max height`,help:`Height of the list below the map; it scrolls inside.`},map_share:{type:`number`,default:50,min:20,max:200,step:5,unit:`%`,when:{height:`map`},label:`Share of map`,help:`The list's height as a share of the map's height; it scrolls inside.`,hint:`50% under a 600 px map: 300 px.`},sticky_search:{type:`boolean`,default:!0,when:{height:`auto`},label:`Sticky search`,help:`The search box stays at the top of the window while the list scrolls.`},count:{type:`boolean`,default:!0,label:`Place count`,help:`The "97 places" line above the list. Off: shows only while filtering.`},columns:{type:`number`,default:1,min:0,max:6,label:`Columns`,help:`Most items per row; fewer when space is tight. 1 = a list, 0 = as many as fit.`,input:`stepper`,zero:`Auto`},item:{type:`choice`,options:[`text`,`logo`,`card`,`tile`],default:`logo`,label:`Item style`,help:`How each place looks: text, logo, card or tile.`},group:{type:`choice`,options:[`none`,`category`,`level`,`letter`],default:`category`,label:`Group by`,help:`Groups the list by category, level or first letter.`},sort:{type:`choice`,options:[`name`,`level`,`open`],default:`name`,label:`Sort`,help:`Order within each group: by name, by level, or open places first.`},show_category:{type:`boolean`,default:!0,label:`Category on items`,help:`Items show their category.`},category_style:{type:`choice`,options:[`pips`,`text`],labels:{pips:`Icons`,text:`Names`},default:`pips`,label:`Item categories`,help:`Item categories as small icons or as names.`},show_level:{type:`boolean`,default:!0,label:`Level on items`,help:`Items show their level.`},show_hours:{type:`boolean`,default:!0,label:`Open status on items`,help:`Items show whether the place is open.`},amenities:{type:`boolean`,default:!0,label:`Include amenities`,help:`Restrooms, information desks and other amenities are listed too.`},category_icons:{type:`boolean`,default:!0,label:`Group icons`,help:`Category icons on group titles.`},every_category:{type:`boolean`,default:!0,label:`Under each category`,help:`A place with several categories is listed under each one.`},this_level:{type:`boolean`,default:!1,label:`This level only`,help:`Lists only places on the level being shown.`},counts:{type:`boolean`,default:!0,label:`Group counts`,help:`Place counts on group titles.`},collapsible:{type:`boolean`,default:!1,label:`Collapsible groups`,help:`Clicking a group title opens and closes the group.`},rail:{type:`boolean`,default:!0,label:`A–Z rail`,help:`A strip of letters for jumping through the list. Only when grouped by letter.`},toggle:{type:`boolean`,default:!0,label:`Collapse button`,help:`A button that opens and closes the list.`},collapsed:{type:`boolean`,default:!1,when:{toggle:!0},label:`Start collapsed`,help:`The panel opens closed; the collapse button opens it.`},title:{type:`string`,default:``,label:`Title`,help:`A heading above the list. Empty = none.`},reel:{type:`boolean`,default:!0,label:`Featured reel`,help:`Featured places in a row above the list.`,hint:`Hidden while searching.`},reel_item:{type:`choice`,options:[`card`,`tile`,`logo`],default:`tile`,label:`Reel item style`,help:`How places in the featured row look.`}}},{id:`attract`,icon:`monitor-play`,name:`Attract mode`,category:`Motion`,help:`When the map sits idle, it tours stores one by one until someone touches it. For kiosks, landing pages and hero sections.`,desc:`Tours stores after the map has been idle`,opt:`attract`,def:!1,breaks:[`hold`,`progress`],settings:{after:{type:`number`,default:3,min:0,max:180,label:`Start after`,help:`Seconds without input before the tour starts. 0 = only the play button starts it.`,unit:`s`,opt:`attractAfter`,hint:`At least 3, up to 180.`},page:{type:`boolean`,default:!1,label:`Whole page counts`,help:`Activity anywhere on the page restarts the wait. Off: only on the map.`},button:{type:`boolean`,default:!1,label:`Play button`,help:`A play button that starts the tour at once. It hides while the tour runs.`},hold:{type:`number`,default:8,min:3,max:60,label:`Per stop`,help:`Seconds at each store.`,unit:`s`,opt:`attractHold`,hint:`After the flight lands.`},arc:{type:`boolean`,default:!0,label:`Fly over`,help:`Zooms out between stores, then back in.`},drift:{type:`boolean`,default:!0,label:`Drift`,help:`Slowly circles each store while it's shown.`},explode:{type:`boolean`,default:!1,label:`Explode levels`,explode:!0,help:`Opens the levels apart when flying to a store on another floor.`},overview:{type:`number`,default:5,min:0,max:50,label:`Overview every`,explode:!0,help:`Every this many stops, the levels open and slowly turn. 0 = off.`,unit:`stops`,hint:`Maps with several levels, 3D only; the overview lasts 10 s.`},progress:{type:`choice`,options:[`off`,`bar`,`pill`],default:`bar`,input:`select`,labels:{off:`Off`,bar:`Bar`,pill:`Bar + pill`},label:`Progress`,help:`How the tour shows its progress: a bar on the popup, or also a "Touch to explore" pill.`}}},{id:`intro`,icon:`plane-landing`,name:`Fly in`,category:`Motion`,help:`When the map loads, the camera starts high above it and descends to the start view, or to the place opened with the page. Any input ends it at once. Off with reduced motion.`,desc:`The camera descends onto the map on load`,def:!1,settings:{seconds:{type:`number`,default:1.6,min:.5,max:5,step:.1,label:`Duration`,help:`Seconds from the top to the start view. Short feels quick, long feels cinematic.`,unit:`s`},height:{type:`number`,default:5,min:2,max:12,step:.5,label:`Start height`,help:`How far out it starts, in times the start view's distance.`,unit:`×`},turn:{type:`number`,default:30,min:0,max:180,step:5,zero:`None`,label:`Turn`,help:`How far the map turns on the way down. 3D only.`,unit:`°`}}},{id:`drift`,icon:`orbit`,name:`Drift`,category:`Motion`,help:`After load the camera slowly sways side to side, so the map doesn't stand still, until someone uses it. For hero sections and landing pages. Off with reduced motion and in 2D; waits while an Attract mode tour runs.`,desc:`The camera slowly sways after load`,def:!1,settings:{angle:{type:`number`,default:30,min:0,max:180,label:`Sway`,help:`How far the camera turns from side to side.`,unit:`°`},tilt:{type:`number`,default:6,min:0,max:30,label:`Tilt`,help:`How far the camera dips and rises with each sway. 0 = level.`,unit:`°`},seconds:{type:`number`,default:20,min:4,max:120,label:`Sway time`,help:`Seconds for one sway. Longer is calmer.`,unit:`s`},resume:{type:`number`,default:0,min:0,max:600,zero:`Never`,label:`Resume after`,help:`Seconds after the last input before it sways again. 0 = never: the first input stops it for good.`,unit:`s`}}},{id:`deeplink`,icon:`link`,name:`Deep linking`,category:`Plugin`,help:`Links that open the map on a store, level, route or category (map-select, map-level, map-from, map-category in the page address), and an address that follows the map so visitors can share what they see. On a page with several maps, a map whose element has an id uses map-<id>-select and so on.`,desc:`Open the map from links; keep the page address in step`,panels:{links:{label:`Deep linking`,keys:[`read`,`write`,`style`,`history`]}},def:!0,settings:{read:{type:`list`,options:[`select`,`level`,`route`,`category`],default:[`select`,`level`,`route`,`category`],labels:{select:`Store`,level:`Level`,route:`Route`,category:`Category`},input:`links`,label:`Open from links`,help:`What a link to the page can open the map on. Empty = links are ignored.`},write:{type:`list`,options:[`select`,`level`,`route`,`category`],default:[],labels:{select:`Store`,level:`Level`,route:`Route`,category:`Category`},input:`links`,of:`read`,label:`Update address`,help:`What the page address follows, so visitors can share it. Empty = never changed.`,hint:`Only items that links also open.`},style:{type:`choice`,options:[`query`,`hash`],default:`query`,labels:{query:`?map-…`,hash:`#map-…`},label:`Address style`,help:`How the address is written. Hash suits single-page sites.`,hint:`Both are read. Hash suits single-page sites whose router reacts to query changes.`},history:{type:`choice`,options:[`replace`,`push`],default:`replace`,labels:{replace:`Quiet`,push:`Steps back`},label:`Back button`,help:`Whether Back steps through map changes, or the address just updates in place.`}}},{id:`localization`,icon:`languages`,name:`Localization`,category:`Plugin`,help:`Shows the map in more languages: place names, categories, levels, markers, popups, directions and buttons. Translations are stored in the map file. The map follows the host page's language (the lang attribute on <html>), so the page's own language switcher drives it.`,desc:`Translations that follow the page language`,def:!1,settings:{language:{type:`string`,default:``,label:`Default language`,help:`The language the map opens in. Empty = the map's own.`,input:`language`},page:{type:`boolean`,default:!0,label:`Follow page language`,help:`Uses the page's language when the map has it.`,hint:`Follows the lang attribute on <html>.`}}},{id:`grids`,name:`Grid`,internal:!0,settings:{density:{type:`number`,default:160,min:20,max:600,step:10,label:`Density`,help:`How many dots across the longer side of the map.`,unit:`dots`},size:{type:`number`,default:60,min:5,max:100,step:5,label:`Dot size`,help:`Dot size, as a share of the distance between dots.`,unit:`%`},shape:{type:`choice`,options:[`round`,`square`,`hexagon`],default:`round`,label:`Shape`,labels:{round:`Round`,square:`Square`,hexagon:`Hexagon`},help:`Shape of each dot.`},layout:{type:`choice`,options:[`square`,`staggered`],default:`square`,label:`Layout`,help:`Staggered shifts every second row half a step, like a honeycomb.`,labels:{square:`Rows`,staggered:`Staggered`}},small:{type:`boolean`,default:!1,label:`Keep small places`,help:`A place too small for the grid still gets one dot at its centre.`},zoom_steps:{type:`number`,default:0,min:0,max:3,step:1,label:`Zoom detail`,help:`Adds detail as you zoom in, up to this many times. 0 = one grid.`,unit:`steps`,hint:`Doubles the density each time the view zooms in 2×, so dots keep their size on screen.`}}}];builtinList(){return a.BUILTINS.concat(this.constructor.EXTRA_BUILTINS||[])}builtin(e){return this.builtinList().find(t=>t.id===e)||null}_pluginConfig(){let e=a.raw;if(!e)return this._pluginConfigFallback||={builtin:{},custom:[]};let t=e.plugins;(!t||Array.isArray(t))&&(t=e.plugins={builtin:{},custom:Array.isArray(t)?t:[]}),t.builtin=t.builtin||{},t.custom=t.custom||[],t.version>=2||this._migratePlugins(e,t),t.builtin.directions&&(t.builtin.wayfinding=Object.assign({},t.builtin.directions,t.builtin.wayfinding),delete t.builtin.directions);let n=t.builtin.directory&&t.builtin.directory.settings;n&&(n.height===`limit`&&(n.height=`fixed`),n.height==null&&n.max_height!=null&&(+n.max_height>0?n.height=`fixed`:delete n.max_height),delete n.list_share);let r=e.theme;if(r&&(r.label_max!=null||r.label_snap!=null)){let e=t.builtin.labels=t.builtin.labels||{},n=e.settings=e.settings||{};r.label_max!=null&&n.text_max==null&&(n.text_max=r.label_max),r.label_snap!=null&&n.snap==null&&(n.snap=r.label_snap),delete r.label_max,delete r.label_snap}let i=t.builtin.search&&t.builtin.search.settings;if(i&&i.width!=null&&(i.max_width??=i.width,delete i.width),i&&`url`in i){if(i.url===!0){let e=t.builtin.deeplink=t.builtin.deeplink||{},n=e.settings=e.settings||{};n.write??=[`select`,`category`],e.settings.style??(n.style=`hash`)}delete i.url}return t}_migratePlugins(e,t){t.version=2;let n=t.builtin,r=Object.assign({},n),i=e.ui||{},a=e=>r[e]&&r[e].enabled,o=(e,t,r)=>{if(r==null)return;let i=n[e]=n[e]||{};i.settings=Object.assign({},i.settings,{[t]:!!r})};[`labels`,`logos`,`storefronts`,`cars`,`motion`,`shadows`,`zoom`,`fullscreen`,`compass`,`hint`,`levels`,`routing`,`info-cards`,`tints`,`merge`,`connectors`].forEach(e=>delete n[e]),o(`labels`,`name`,a(`labels`)),o(`wayfinding`,`storefronts`,a(`storefronts`)),o(`scenery`,`cars`,a(`cars`)),o(`scenery`,`carsMoving`,a(`motion`)),o(`scenery`,`connectorsMoving`,a(`motion`)),o(`core`,`shadows`,a(`shadows`)),[`levels`,`zoom`,`fullscreen`,`compass`,`hint`].forEach(e=>o(`controls`,e,i[e]==null?a(e):i[e])),o(`controls`,`reset`,i.zoom==null?a(`zoom`):i.zoom),i.directions!=null&&((n.wayfinding=n.wayfinding||{}).enabled=!!i.directions),delete e.ui}allowCustom(){let e=this.props.plugins;return e===!0||e==null&&!!this.constructor.TRUSTED}pluginOn(e){let t=this.builtin(e);if(!t){let t=(this._plugReg||[]).find(t=>t.id===e);return!!(t&&t.active)}if(t.internal)return a.unitStyle===`grid`;if(t.locked||t.always)return!0;let n=this.state.optionOverrides;if(t.opt&&n&&n[t.opt]!==void 0)return!!n[t.opt];let r=this._pluginConfig().builtin[e];return r&&r.enabled!=null?!!r.enabled:this._pluginDefault(t)}_pluginDefault(e){if(e.locked||e.always)return!0;if(e.opt&&this.props[e.opt]!=null)return!!this.props[e.opt];let t=this.props.controls;return e.ui&&t&&t[e.ui]!=null?!!t[e.ui]:e.def!==!1}pluginSetting(e,t){let n=this.builtin(e),r=n&&n.settings&&n.settings[t];return n&&n.internal?(((a.raw||{}).theme||{}).grid||{})[t]??(r?r.default:void 0):this._pluginSetting(n,r,e,t)}_pluginSetting(e,t,n,r){let i=this._pluginConfig().builtin[n],a=this.state.optionOverrides,o=this.props.controls;return t&&t.opt&&a&&a[t.opt]!==void 0?a[t.opt]:i&&i.settings&&i.settings[r]!=null?i.settings[r]:t&&t.opt&&this.props[t.opt]!=null?this.props[t.opt]:t&&t.ui&&o&&o[t.ui]!=null?o[t.ui]:t?t.default:void 0}settingOn(e,t){return this.pluginOn(e)&&!!this.pluginSetting(e,t)}plugins(){let e=this.builtinList().filter(e=>!e.internal).map(e=>({id:e.id,name:e.name,icon:e.icon||`puzzle`,category:e.category,desc:e.desc||``,help:e.help||``,builtin:!0,locked:!!e.locked,always:!!e.always,enabled:this.pluginOn(e.id),defaultOn:this._pluginDefault(e),settings:e.settings?Object.fromEntries(Object.keys(e.settings).map(t=>[t,this.pluginSetting(e.id,t)])):{},schema:e.settings||{},panels:e.panels||{},breaks:e.breaks||[],main:e.main||null}));return(this._plugReg||[]).map(e=>({id:e.id,name:e.name,icon:`puzzle`,category:`Custom`,desc:e.desc||``,builtin:!1,locked:!1,enabled:!!e.active,saved:e.enabled!==!1,forkOf:e.forkOf||null,settings:e.config||{}})).concat(e)}findPlugin(e){let t=this.plugins(),n=String(e||``).toLowerCase().trim();return t.find(e=>e.id===n)||t.find(e=>e.name.toLowerCase()===n)||t.find(e=>e.name.toLowerCase().includes(n)||e.id.includes(n))||null}async installCustom(e){e||={};let t=String(e.name||``).trim().slice(0,40);if(!t||!e.code)return`Error: name and code are required`;let n=(this._plugReg||[]).find(e=>e.name.toLowerCase()===t.toLowerCase());n&&(n.wasOn=n.active,this.uninstall(n));let r={id:n?n.id:`pl`+Date.now(),name:t,desc:e.description||``,enabled:!0,code:String(e.code).replace(/^```\w*\n?|```\s*$/g,``),config:n&&n.config||{}};try{await this.install(r)}catch(e){return this._plugReg=(this._plugReg||[]).filter(e=>e!==r),n&&n.wasOn&&await this.install(n).catch(()=>{}),`Error: `+(e&&e.message||e)+`. Fix the code and call create_plugin again.`}if(n){let e=this._plugReg.filter(e=>e!==r),t=e.indexOf(n);e.splice(t<0?e.length:t,t<0?0:1,r),this._plugReg=e}return this.savePlugins(),(n?`Updated plugin `:`Installed plugin `)+t}async toggleCustom(e,t){let n=this.findPlug(e);if(!n)return`No plugin named `+e;if(n.userSet=!1,n.enabled=!!t,this.savePlugins(),t&&!n.active)try{await this.install(n)}catch(e){return`Error starting plugin: `+(e&&e.message||e)}return!t&&n.active&&this.uninstall(n),`Turned `+(t?`on `:`off `)+n.name}removeCustom(e){let t=this.findPlug(e);return t?(this.uninstall(t),this._plugReg=(this._plugReg||[]).filter(e=>e!==t),this.savePlugins(),this.forceUpdate(),`Deleted plugin `+t.name):`No plugin named `+e}async setPlugin(e,t){let n=this.findPlugin(e);if(!n)throw Error(`No plugin named `+e);if(t||={},!n.builtin){let e=this._plugReg.find(e=>e.id===n.id);return t.settings&&(e.config=Object.assign({},e.config,t.settings)),e.userSet=!1,t.enabled==null?t.settings&&e.active&&(this.uninstall(e),await this.install(e)):(e.enabled=!!t.enabled,e.enabled&&!e.active&&await this.install(e),!e.enabled&&e.active&&this.uninstall(e)),this.savePlugins(),this.plugins().find(e=>e.id===n.id)}let r=this.builtin(n.id),i=this._pluginConfig();if((r.locked||r.always)&&t.enabled===!1)throw Error(r.name+(r.locked?` is part of the core and`:``)+` is always on`);if(t.enabled!=null&&((i.builtin[r.id]=i.builtin[r.id]||{}).enabled=!!t.enabled,r.opt&&this.state.optionOverrides&&this.state.optionOverrides[r.opt]!==void 0&&this.setState(e=>{let t=Object.assign({},e.optionOverrides);return delete t[r.opt],{optionOverrides:t}})),t.settings){let e=r.settings||{},n=Object.keys(t.settings).filter(t=>!e[t]);if(n.length)throw Error(r.name+` has no setting `+n.join(`, `)+(Object.keys(e).length?`. Settings: `+Object.keys(e).join(`, `):``));let a=i.builtin[r.id]=i.builtin[r.id]||{};a.settings=Object.assign({},a.settings),Object.entries(t.settings).forEach(([t,n])=>{let r=e[t];if(r.type===`number`){if(n=+n,!isFinite(n))throw Error(t+` must be a number`);r.unlimited&&n<0?n=-1:(r.min!=null&&(n=Math.max(r.min,n)),r.max!=null&&(n=Math.min(r.max,n)))}else if(r.type===`boolean`)n=!!n;else if(r.type===`string`)n=n==null?``:String(n).trim();else if(r.type===`choice`){if(n=String(n),!r.options.includes(n))throw Error(t+` must be one of `+r.options.join(`, `))}else if(r.type===`list`){n=(Array.isArray(n)?n:String(n??``).split(`,`)).map(e=>String(e).trim()).filter(Boolean);let e=n.filter(e=>!r.options.includes(e));if(e.length)throw Error(t+` takes `+r.options.join(`, `)+` (not `+e.join(`, `)+`)`);n=r.options.filter(e=>n.includes(e))}a.settings[t]=n}),Object.entries(e).forEach(([n,i])=>{if(i.type!==`list`||!i.of)return;let o=a.settings[i.of]==null?this.pluginSetting(r.id,i.of):a.settings[i.of],s=a.settings[n]==null?this.pluginSetting(r.id,n):a.settings[n];Array.isArray(o)&&Array.isArray(s)&&(n in t.settings&&!(i.of in t.settings)?s.some(e=>!o.includes(e))&&(a.settings[i.of]=e[i.of].options.filter(e=>o.includes(e)||s.includes(e))):s.some(e=>!o.includes(e))&&(a.settings[n]=s.filter(e=>o.includes(e))))});let o=Object.keys(t.settings).map(t=>e[t].opt).filter(e=>e&&this.state.optionOverrides&&this.state.optionOverrides[e]!==void 0);o.length&&this.setState(e=>{let t=Object.assign({},e.optionOverrides);return o.forEach(e=>delete t[e]),{optionOverrides:t}})}return this._plugChanged(r),this.plugins().find(e=>e.id===r.id)}savePlugins(){this._pluginConfig().custom=(this._plugReg||[]).map(e=>Object.assign({id:e.id,name:e.name,desc:e.desc||``,enabled:e.enabled!==!1,api:1,code:e.code},e.config&&Object.keys(e.config).length?{config:e.config}:{},e.forkOf?{forkOf:e.forkOf}:{}))}bootPlugins(){let e=this._pluginConfig();this._plugReg=this._plugReg||[];let t=this.allowCustom();e.custom.forEach(e=>{if(!e||!e.code||this._plugReg.some(t=>t.id===e.id))return;let n=Object.assign({},e,{config:Object.assign({},e.config)});this._plugReg.push(n),n.enabled!==!1&&t&&this.install(n).catch(e=>console.warn(`Plugin `+n.name,e))}),e.custom.length&&!t&&console.info(`Mapplic: `+e.custom.length+` custom plugin(s) in the map file are not run. Pass options.plugins = true to allow them.`),this.forceUpdate()}grid(){let e=this.builtin(`grids`).settings,t=((a.raw||{}).theme||{}).grid||{};return Object.fromEntries(Object.keys(e).map(n=>[n,t[n]==null?e[n].default:t[n]]))}setGrid(e){let t=this.builtin(`grids`).settings,n=a.raw;if(!n)throw Error(`No map loaded`);let r=Object.keys(e||{}).filter(e=>!t[e]);if(r.length)throw Error(`The grid has no setting `+r.join(`, `)+`. Settings: `+Object.keys(t).join(`, `));let i=n.theme=n.theme||{},o=i.grid=Object.assign({},i.grid);return Object.entries(e||{}).forEach(([e,n])=>{let r=t[e];if(r.type===`number`){if(n=+n,!isFinite(n))throw Error(e+` must be a number`);n=Math.min(r.max,Math.max(r.min,n))}else if(r.type===`boolean`)n=!!n;else if(!r.options.includes(String(n)))throw Error(e+` must be one of `+r.options.join(`, `));o[e]=n}),this._plugChanged(this.builtin(`grids`)),this.grid()}_plugChanged(e){this.emit(`plugin`,{id:e?e.id:`controls`,enabled:e?e.builtin===!1||!this.builtin(e.id)?!!e.active:this.pluginOn(e.id):this.pluginOn(`controls`)}),this.applyProps(),this.syncBuiltins(),(!e||e.id===`appearance`)&&this.state.all&&!this.canExplode()&&this.setLevel(this.state.level),(!e||e.id===`wayfinding`)&&(this._units||[]).forEach(e=>this._buildStorefront(e)),(!e||e.id===`localization`)&&this.applyLanguage(),!e||e.id===`appearance`?this.applyAppearance():e.id===`size`&&this.applyHeight(),this.forceUpdate()}info(e){let t=e.point?this.pointPick(e):null,n=t?{item:{cx:t.x,cz:t.z,top:0,poly:[[t.x,t.z]]}}:this._byId[e.id],i=a.categoryName(e.cat),o=e.loc&&!e.loc.amenity?r.categoryList(e.loc.category):[];if(o.length&&e.cat!=null){let t=r.categoryNames||{},n=o.includes(e.cat)?e.cat:Object.keys(t).find(n=>t[n]===e.cat)||((r.categories||[]).find(t=>t.name===e.cat||t.id===e.cat)||{}).id;n&&n!==o[0]&&(o=[n].concat(o.filter(e=>e!==n)))}return{id:e.id,location:e.loc&&e.loc.id||null,name:t&&(r.translation(`locations`,e.id)||{}).name||e.name,category:i,categories:o.length>1?o.map(e=>a.categoryName((r.categoryNames||{})[e]||e)):i?[i]:[],categoryTags:o.map(e=>{let t=(r.categories||[]).find(t=>t.id===e)||{};return{id:e,name:a.categoryName(t.name||e),color:t.color||null,icon:t.icon||null}}),group:e.grp||null,accessible:r.isAccessible(this.locationOf(e)),image:e.img||null,level:e.level,hours:e.hours,type:e.type,x:n.item.cx,z:n.item.cz,top:n.item.top,footprint:n.item.poly.map(e=>[e[0],e[1]]),...a.popupFields(e.loc,e.cat),logo:e.img||null,linked:t?[]:this.linkedUnits(e.id).map(e=>({id:e,level:this._byId[e].item.store.level})),parts:t?[]:this.groupParts(e.id).filter(t=>t!==e.id),searchable:(this.locationOf(e)||{}).searchable!==!1,...t?{markers:e.pts.map(e=>({id:e.id,level:e.level,x:e.x,z:e.z}))}:{}}}locationOf(e){if(e.point)return e.loc;let t=this._unitById&&this._unitById[e.id],n=e.loc||t&&t.r&&t.r.loc||null;return!n||typeof n==`object`?n:(r.locations||{})[n]||null}linkedUnits(e){let t=this._byId||{};this._linkSource!==t&&(this._linkSource=t,this._linkMembers={},Object.keys(t).forEach(e=>{let n=t[e].item&&t[e].item.store,r=n&&n.loc&&n.loc.id;r&&(this._linkMembers[r]=this._linkMembers[r]||[]).push(e)}));let n=t[e]&&t[e].item&&t[e].item.store,r=n&&n.loc&&n.loc.id,i=this.groupKeyOf(e);if(!r)return[];let a=new Set([i]);return(this._linkMembers[r]||[]).filter(e=>{let t=this.groupKeyOf(e);return!a.has(t)&&(a.add(t),!0)})}static popupFields(e,t){e||={};let n=r,i=e.mapplic&&e.mapplic.popup||e.popup,o=n.categoryPopups&&t?n.categoryPopups[t]:null;return{subtitle:e.subtitle||null,description:e.description||null,images:e.images||null,action:e.action===!1?!1:e.action||null,phone:e.phone||null,email:e.email||null,website:e.website||null,details:e.details||null,popup:a.mergePopupLayouts([n.popupTheme,o,i])}}static mergePopupLayouts(e){let t=e.filter(e=>e&&typeof e==`object`);if(!t.length)return null;let n=Object.assign({},...t),r=t.map(e=>e.link).filter(e=>e&&typeof e==`object`);return r.length&&(n.link=Object.assign({},...r)),n}emit(e,t){(this._handlers||[]).slice().forEach(n=>{if(n.ev===e)try{n.fn(t)}catch(t){console.error(`Mapplic `+e+` handler`,t)}}),(this._pluginEvents||[]).slice().forEach(n=>{if(n.event===e)try{n.fn(t)}catch(e){this.plugErr(n.plugin,e)}})}camTick(){let e=this.camView||this.camGoal;if(!e||!(this._handlers||this._pluginEvents))return;let t=e=>Math.round(e*10)/10,n={mode:this.is2d()?`2d`:`3d`,rotation:t(-e.azimuth*180/Math.PI),tilt:t(e.polar*180/Math.PI),distance:t(e.distance),x:t(e.targetX),z:t(e.targetZ),home:!this._awayFromHome},r=JSON.stringify(n);r!==this._lastCameraKey&&(this._lastCameraKey=r,this.emit(`camera`,n))}plugFrame(e,t){let n=this._pluginFrames;n&&n.length&&n.slice().forEach(n=>{try{n.fn(e,t)}catch(e){this.plugErr(n.plugin,e)}})}plugErr(e,t){console.error(`Plugin `+e.name,t),e.active&&(this.uninstall(e),this.notify(`Plugin "`+e.name+`" crashed and was turned off: `+(t&&t.message||t)))}static API_VERSION=1;static EVENTS=[`ready`,`select`,`hover`,`level`,`route`,`camera`,`plugin`,`layout`,`units`,`marker`,`language`,`hours`,`search`,`scheme`];static pluginFactories={};static EVENT_OWNERS={route:`wayfinding`,marker:`markers`,hours:`hours`,search:`search`};static PLUGIN_ORDER=[`labels`,`scenery`,`wayfinding`,`markers`,`hours`,`popups`,`attract`,`intro`,`drift`,`controls`,`search`,`directory`,`deeplink`,`localization`,`grids`];static orderedFactories(){let e=a.PLUGIN_ORDER,t=t=>e.includes(t)?e.indexOf(t):e.length;return Object.entries(a.pluginFactories).sort((e,n)=>t(e[0])-t(n[0]))}static focused(){let e=document.activeElement;for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}static injectCss(e,t){return a.prototype.baseCss(e,t)}static plugin(e,t){a.pluginFactories[e]=t}wheelMode(){let e=((this._pluginConfig().builtin.core||{}).settings||{}).wheel,t=this.state.optionOverrides||{};if(e==null&&t.wheel===void 0&&this.props.wheel==null&&this.props.wheelCtrl)return`modifier`;let n=this.pluginSetting(`core`,`wheel`);return n===`modifier`||n===`off`?n:`zoom`}wheelPasses(e){let t=this._viewport;if(!t||!e||!t.contains(e.target))return!1;if(this.zoomLocked())return!0;let n=this.wheelMode();return n===`off`||n===`modifier`&&!(e.ctrlKey||e.metaKey)&&!this.isFullscreen()}isFullscreen(){let e=this._viewport,t=e?e.getRootNode():null,n=t&&t!==document&&t.fullscreenElement||document.fullscreenElement||document.webkitFullscreenElement;return!!e&&(!!n&&(n===e||n.contains(e))||e.style.position===`fixed`||!!this.el&&this.el.contains(e)&&this.el.style.position===`fixed`&&this.el.style.zIndex===`1000`)}showWheelHint(){let e=this._viewport;if(!e||this.state.coarse)return;let t=this._wheelHintEl;if(!t||!t.isConnected){t=this._wheelHintEl=document.createElement(`div`),t.className=`mp-wheel-hint`,t.setAttribute(`role`,`status`),t.style.cssText=`position:absolute;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;pointer-events:none;color:#fff;font-family:Onest,sans-serif;text-align:center;padding:24px;opacity:0;`+(this._reducedMotion?``:`transition:opacity .18s ease`);let n=document.createElement(`div`);n.className=`mp-wheel-hint-pill`,n.style.cssText=`position:relative;max-width:100%;box-sizing:border-box;padding:10px 18px;border-radius:9999px;background:rgba(9,9,11,.45);-webkit-backdrop-filter:blur(12px) saturate(1.2);backdrop-filter:blur(12px) saturate(1.2);box-shadow:0 0 0 1px rgba(255,255,255,.08),0 8px 24px rgba(0,0,0,.12);font-size:14px;font-weight:500;line-height:1.4;text-wrap:balance`,t.append(n),e.appendChild(t)}let n=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||``)?`⌘`:`Ctrl`,r=a.t(`wheel_hint`,{key:``}),i=r.indexOf(``),o=i<0?null:r.slice(i).match(/^\u0001(\s*\+\s*[^\s.,;:!?]+)?/),s=document.createElement(`strong`),c=t.querySelector(`.mp-wheel-hint-pill`);c.textContent=``,o?(s.style.fontWeight=`700`,s.textContent=n+(o[1]||``),c.append(r.slice(0,i),s,r.slice(i+o[0].length))):c.textContent=r,t.style.opacity=`1`,clearTimeout(this._wheelHintTimer),this._wheelHintTimer=setTimeout(()=>{t.style.opacity=`0`},1200)}env(){let e=this.state;return{touch:!!e.coarse,narrow:!!e.narrow,hostNarrow:!!e.hostNarrow,ctrlZoom:this.wheelMode()===`modifier`,wheel:this.wheelMode(),reducedMotion:!!this._reducedMotion,editor:!!this.constructor.EDITOR}}syncBuiltins(){if(!this.renderer||!this._plugEl)return;let e=this._builtinPlugins=this._builtinPlugins||{};a.orderedFactories().forEach(([t,n])=>{let r=this.builtin(t);if(!r)return;let i=this.pluginOn(t),a=e[t]=e[t]||{id:t,name:r.name,builtin:!0,fn:n,config:{}};i&&!a.active&&!a.busy?(a.busy=!0,this.trackLoad(this.install(a).catch(e=>console.error(`Plugin `+r.name,e)).finally(()=>{a.busy=!1}))):!i&&a.active&&this.uninstall(a)})}plugApi(e,t){let n=a,i=this.THREE,o=(t,r)=>{if(!n.EVENTS.includes(t))throw Error(`Unknown event "`+t+`". Events: `+n.EVENTS.join(`, `));let i={plugin:e,event:t,fn:r};return this._pluginEvents.push(i),()=>{this._pluginEvents=this._pluginEvents.filter(e=>e!==i)}},s=t=>{let n={plugin:e,fn:t};return this._pluginFrames.push(n),()=>{this._pluginFrames=this._pluginFrames.filter(e=>e!==n)}},c=(e,n)=>((n==null?this.scene:this.levelViews[n].group).add(e),t.objs.push(e),e),l=e=>{let n=this._unitById[e];if(!n)return null;let r=n.grp;return t.grps.some(e=>e.group===r)||t.grps.push({group:r,position:r.position.clone(),quaternion:r.quaternion.clone(),scale:r.scale.clone()}),{group:r,body:n.m,outline:n.line,conceal:(e=!0)=>{let r=[n.m,n.line].filter(Boolean).flatMap(e=>Array.isArray(e.material)?e.material:[e.material]);t.concealed.has(n)||t.concealed.set(n,r.map(e=>[e,e.colorWrite,e.depthWrite])),r.forEach(t=>{t.colorWrite=!e,t.depthWrite=!e})}}},u=e=>{[`pointerdown`,`pointerup`,`click`,`dblclick`,`contextmenu`].forEach(t=>e.addEventListener(t,e=>{(t!==`pointerdown`&&t!==`pointerup`||!e.target.closest||!e.target.closest(`[data-mp-drag]`))&&e.stopPropagation()})),e.addEventListener(`wheel`,t=>{for(let n=t.target;n&&n!==e.parentNode;n=n.parentNode){if(n.nodeType!==1)continue;let e=getComputedStyle(n),r=/(auto|scroll)/.test(e.overflowY),i=/(auto|scroll)/.test(e.overflowX);if(r&&n.scrollHeight>n.clientHeight||i&&n.scrollWidth>n.clientWidth){t.stopPropagation();return}}})},d=e=>{if(e!==`bottom-left`)throw Error(`Unknown zone "`+e+`" (bottom-left)`);let t=this._zones=this._zones||{};if(t[e]&&t[e].isConnected)return t[e];let n=document.createElement(`div`);return n.className=`mp-zone mp-zone-`+e,n.style.cssText=`position:absolute;left:calc(16px + var(--mp-inset-bl, 0px));bottom:calc(16px + var(--mp-inset-b, 0px));display:flex;flex-direction:column;align-items:flex-start;gap:8px;pointer-events:none;z-index:8;transition:left 200ms ease,bottom 200ms ease`,u(n),this._plugEl.appendChild(n),t[e]=n},f=(e,n)=>{let r=!!(n&&n.layer===`top`),i=!!(n&&n.layer===`scene`);return u(e),e.style.pointerEvents||(e.style.pointerEvents=`auto`),r?(e.setAttribute(`data-mp-top`,``),n.editing&&e.setAttribute(`data-mp-edit`,``),e.style.zIndex||(e.style.zIndex=`8`),this._viewport.appendChild(e)):i&&this._sceneEl?this._sceneEl.appendChild(e):this._plugEl.appendChild(e),t.els.push(e),e},p=(e,t,n)=>{let r=new i.Vector3(e,t,n).project(this.camera);return{x:(r.x+1)/2*this._width,y:(1-r.y)/2*this._height,visible:this.ndcVisible(r)}},m=()=>({width:this._width,height:this._height}),h=e=>this.notify(String(e)),g=e=>this.levelViews[e].y,_=e=>this.levelViews[e].opacity,v=(e,n)=>{let r=this.levelViews[n];return r&&(e.userData.o0===void 0&&(e.userData.o0=e.opacity??1),r.mats.includes(e)||r.mats.push(e),e.opacity=e.userData.o0*r.opacity,e.transparent=r.transparent||e.userData.o0<1,t.mats.push([r,e])),e},y=n=>{let r={p:e,fn:n};(this._pickHandlers=this._pickHandlers||[]).push(r);let i=()=>{this._pickHandlers=this._pickHandlers.filter(e=>e!==r)};return t.offs.push(i),i},b=e=>typeof e==`number`?e+`px`:String(e||0),x=()=>{let e=this.el,t=this._viewport,n=!!this._uiHidden,r=n?[]:(this._docks||[]).filter(e=>e.side!==`below`);if(!e||!t)return;this._layoutDocks=x,(this._docks||[]).forEach(e=>{e.side!==`below`&&(e.wrap.style.display=n?`none`:`flex`)});let i=!1;(this._docks||[]).filter(e=>e.side===`below`).forEach(e=>{let t=!n&&e.size!==0,r=e.size===`auto`||e.size==null;t&&(i=!0);let a=e.wrap,o=e.shown;e.shown=t,t&&(a.style.maxHeight=r?`none`:b(e.size));let s=r?`visible`:`hidden`;if(o!==void 0&&o!==t&&!this.env().reducedMotion){clearTimeout(e.animTimer),a.style.display=`flex`,a.style.overflow=`hidden`,a.style.overflow=`clip`,a.style.transition=`none`;let n=()=>Math.min(a.offsetHeight,Math.max(0,(window.innerHeight||0)-a.getBoundingClientRect().top)),r=t?0:n();a.style.height=``;let i=t?n():0;Object.assign(a.style,{height:r+`px`,marginTop:t?`0px`:`12px`,opacity:t?`0`:`1`}),a.offsetHeight,a.style.transition=`height 200ms ease, margin-top 200ms ease, opacity 200ms ease`,Object.assign(a.style,{height:i+`px`,marginTop:t?`12px`:`0px`,opacity:t?`1`:`0`}),e.animTimer=setTimeout(()=>{e.animTimer=0,Object.assign(a.style,{transition:``,height:``,marginTop:`12px`,opacity:``,overflow:e.shown&&(e.size===`auto`||e.size==null)?`visible`:`hidden`}),a.style.display=e.shown?`flex`:`none`},220)}else e.animTimer||(a.style.display=t?`flex`:`none`,a.style.overflow!==s&&(a.style.overflow=s))}),i!==!!this._belowOpen&&(this._belowOpen=i,this.props.frame&&this._putHeight());let a=e=>r.some(t=>t.side===e&&b(t.size)!==`0px`&&b(t.size)!==`0`);if(Object.entries({borderTopLeftRadius:[`left`,`top`],borderTopRightRadius:[`right`,`top`],borderBottomLeftRadius:[`left`,`bottom`],borderBottomRightRadius:[`right`,`bottom`]}).forEach(([e,n])=>t.style[e]=n.some(a)?`0`:``),!r.length){this._hostCss!=null&&(e.style.cssText=this._hostCss),this._hostCss=null,this._putHeight(),this.applyUiRadius(),t.style.gridArea=``,t.style.transition=``;return}t.style.transition=this.env().reducedMotion?``:`border-radius 200ms ease`,this._hostCss??=e.style.cssText;let o=e=>{let t=r.find(t=>t.side===e);return t?b(t.size):`0px`},s={left:`1 / 1 / 4 / 2`,right:`1 / 3 / 4 / 4`,top:`1 / 2 / 2 / 3`,bottom:`3 / 2 / 4 / 3`};Object.assign(e.style,{display:`grid`,gridTemplateColumns:o(`left`)+` minmax(0, 1fr) `+o(`right`),gridTemplateRows:o(`top`)+` minmax(0, 1fr) `+o(`bottom`),transition:this.env().reducedMotion?``:`grid-template-columns 200ms ease, grid-template-rows 200ms ease`}),t.style.gridArea=`2 / 2 / 3 / 3`,r.forEach(e=>{Object.assign(e.wrap.style,{gridArea:s[e.side],minWidth:`0`,minHeight:`0`,overflow:`hidden`})})},S=e=>{let n=this._insetsBy=this._insetsBy||new Map;e?n.set(t,e):n.delete(t);let r={left:0,right:0,top:0,bottom:0};n.forEach(e=>Object.keys(r).forEach(t=>r[t]+=Math.max(0,+e[t]||0))),this._insets=r};t.offs.push(()=>S(null));let C=(e,n)=>this._slotAdd(e,n,t),w=(e,n)=>{if(!this.el||!this._viewport)throw Error(`The map is not mounted`);let r=[`left`,`right`,`top`,`bottom`,`below`],i=document.createElement(`div`),a={el:e,wrap:i,side:`left`,size:320},o=e=>{if(e||={},e.side!=null){if(!r.includes(e.side))throw Error(`side must be one of `+r.join(`, `));a.side=e.side}e.size!=null&&(a.size=e.size)};o(n),(this._docks||[]).filter(t=>t.side===a.side||t.el===e).forEach(e=>e.wrap.remove()),this._docks=(this._docks||[]).filter(t=>t.side!==a.side&&t.el!==e).concat(a);let s=a.side===`below`;i.className=`mp-map mp-dock`+(s?` mp-dock-below`:``),i.style.cssText=`position:relative;display:flex;flex-direction:column;font-family:Onest,system-ui,sans-serif`+(s?`;margin-top:12px;min-height:0;overflow:hidden`:``);let c=this._viewport.getAttribute(`data-mp-id`);c&&i.setAttribute(`data-mp-id`,c),i.setAttribute(`data-mp-scheme`,this.scheme()),i.setAttribute(`data-mp-cards`,this.lightCards()),i.setAttribute(`data-mp-tips`,this.lightTooltips()),e.style.flex=`1 1 auto`,e.style.minHeight=`0`,i.appendChild(e),s?this.el.after(i):this.el.appendChild(i),x();let l=()=>{this._docks=(this._docks||[]).filter(e=>e!==a),i.remove(),x()};return t.offs.push(l),{update:e=>{o(e),x()},remove:l}},T=e=>{let t=null;e!=null&&(t=typeof e==`object`?e.id||null:this._byId&&this._byId[e]||this._features&&this._features.has(e)?e:(this.find(e)||{}).id||null),this._hovOver=t,this._hoverDirty=!0},E=(t,n)=>{let r=this._highlightsBy=this._highlightsBy||new Map;t&&t.length?r.set(e,{ids:new Set(t),color:n&&n.color||null,colors:n&&n.colors||null}):r.delete(e),this._highlights=new Set([...r.values()].flatMap(e=>[...e.ids]));let i=new Map;r.forEach(e=>e.ids.forEach(t=>{let n=e.colors&&e.colors[t]||e.color;n&&i.set(this.groupKeyOf(t),n)})),this._highlightTints=i.size?i:null};t.offs.push(()=>E(null));let D={version:n.API_VERSION,on:o,onFrame:s,getState:()=>this.getState(),data:{units:()=>(this._units||[]).filter(e=>e.id).map(e=>{let t=this._byId[e.id],n=t&&t.item.store,r=e.logo||`orig`,i=e.r&&e.r.loc;return{id:e.id,location:(i&&typeof i==`object`?i.id:i)||null,feature:e.r&&e.r.featureId||null,kind:e.am?`amenity`:`store`,name:n?n.name:e.nameOrig,text:e.am?String(e.r.amenity):null,level:e.levelIndex,top:e.top,box:(e.lp||e.poly0).map(e=>[e[0],e[1]]),labelAngle:e.r.labelAngle??null,label:!e.r.noLabel,labelText:e.r.labelText??null,center:[e.centerX,e.centerZ],size:[e.boxWidth,e.boxDepth],hidden:!!e.hid,interactive:!e.r.inert,labelScale:e.labelScale||1,zoom:e.focusX||null,labelRotation:e.labelRotation||0,labelOffset:e.labelOffset&&(e.labelOffset[0]||e.labelOffset[1])?e.labelOffset.slice():null,category:n?n.cat??null:null,logo:r===`none`?null:r===`orig`?e.logoSvgOrig?{svg:e.logoSvgOrig}:null:{image:r},thumb:e.r&&e.r.image?{image:e.r.image}:null}}),markers:()=>(n.markers||[]).map(e=>Object.assign({},e)),amenityTypes:()=>JSON.parse(JSON.stringify((n.raw||{}).amenities||{})),markerStyles:()=>JSON.parse(JSON.stringify(((n.raw||{}).theme||{}).markers||{})),unitAt:(e,t,n)=>{let r=this._unitUnder(e,t,n);return r&&r.id||null},surface:(e,t,n)=>{let r=this._unitUnder(e,t,n);return r?r.top:0},groundLevel:()=>n.groundLevel||0,north:()=>{let e=n.raw||{};return((e.crs||{}).type===`geographic`?0:+((e.georef||{}).rotation||0))||0},site:()=>{let e=n.source();return e.noSite?null:{outline:e.sitePoly.map(e=>e.slice()),colors:n.groundColors.slice(),shadow:+((n.raw||{}).theme||{}).site_shadow||0}},connectors:()=>(n.source().connectors||[]).map(e=>Object.assign({},e)),scenery:()=>(n.source().sceneryFeatures||[]).slice(),models:()=>(n.models||[]).slice(),location:e=>n.location(e),popupFields:(e,t)=>a.popupFields(e,t),categoryName:e=>r.categoryName(e),holidays:()=>{let e=(r.languageStrings||{}).holidays||{};return JSON.parse(JSON.stringify((n.raw||{}).holidays||[])).map(t=>e[t.date]?Object.assign(t,{name:typeof e[t.date]==`string`?e[t.date]:e[t.date].name||t.name}):t)},feature:e=>this.featureInfo(e),section:e=>{let t=(n.raw||{})[e];return t==null?null:JSON.parse(JSON.stringify(t))},findAll:e=>this.findAll(e).map(e=>this.info(e)),route:(e,t,n)=>this.routeData(this._resolveStore(e).id,this._resolveStore(t).id,n),levels:()=>this.levels(),levelOf:e=>this.levelOf(e),stores:()=>this.stores(),amenities:()=>this.amenities(),find:e=>this.find(e),match:e=>this.match(e)},view:{onPick:y,highlight:E,hover:T,feature:(e,n)=>{let r=this._features=this._features||new Map;r.set(e,n||{});let i=()=>{r.get(e)===n&&(r.delete(e),this.state.scenerySelected===e&&this.closePopups())};return t.offs.push(i),i},fit:(e,t,n)=>this.fitView(e,t,n),select:(e,t)=>this.select(e,t),deselect:()=>this.deselect(),setLevel:e=>this.setLevel(e),showAll:()=>this.showAll(),canExplode:()=>this.canExplode(),locked:()=>this.zoomLocked(),camera:e=>this.setCamera(e),lift:e=>this.liftFocus(e),drift:(e,t,n)=>this.drift(e,t,n),drifting:()=>this.drifting(),approach:e=>this.approach(e),approaching:()=>this.approaching(),skipTap:()=>{this._skipTap=!0},wheelPasses:e=>this.wheelPasses(e),focus:(e,t,n)=>this.focusFeature(e,t,n)},three:{THREE:i,SVGLoader:this._svgLoader&&this._svgLoader.SVG,scene:this.scene,camera:this.camera,renderer:this.renderer,add:c,unit:l,ink:e=>(this._unitById[e]||{}).ink||null,kit:e=>{let t=this._geomKit,n=this.levelViews,r=(e,t)=>v(t,e),o=(t,n,r)=>{let i=r||e;return i?i.add(t):c(t,n),t},s=(e,t,a,s,c)=>{let l=new i.Mesh(t,Array.isArray(a)?a.map(t=>r(e,t)):r(e,a));return l.castShadow=!!s,s&&n[e].depthMaterial&&(l.customDepthMaterial=n[e].depthMaterial),l.receiveShadow=!0,o(l,e,c)},l=(e,t,n,a)=>o(new i.LineSegments(new i.EdgesGeometry(t,25),r(e,this.themed(new i.LineBasicMaterial,n))),e,a),u=(e,n,r,a,o)=>{let c=new i.ShapeGeometry(n.map(e=>t.shp(e)),1);c.rotateX(-Math.PI/2),c.translate(0,r,0);let l=Math.max(1,Math.round(r*1e3));return s(e,c,t.lam(a,Object.assign({polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-2*l},o?{clippingPlanes:t.CP,clipShadows:!0}:null)))},d=(e,n,r,i,o)=>{let c=a.groundLevel||0,u=s(c,t.ext(e,n,r),t.lam(i),!0);return o&&l(c,u.geometry,o,u),u},f={};return Object.assign({},t,{reg:r,mesh:s,edges:l,flat:u,BX:d,put:(e,t,n,r,a,o)=>{(f[e]=f[e]||{geo:t,mat:n,ms:[]}).ms.push(new i.Matrix4().compose(new i.Vector3(...r),new i.Quaternion().setFromEuler(new i.Euler(0,o||0,0)),new i.Vector3(...a)))},inst:f})},explode:()=>this._explodeBlend||0,storey:n.storeyHeight,floorTop:n.FLOOR_TOP,rise:()=>this._levelRise||n.storeyHeight,fade:v,levelY:g,levelOpacity:_,project:p,loading:e=>this.trackLoad(e)},geo:{fit:(e,t,r,i,a,o)=>n.fitLabel(e,t,r,i,a,o),offset:(e,t)=>n.offsetPolyline(e,t),metres:e=>(+e||0)*r.scale,stair:e=>n.stairLayout(e)},announce:(t,r)=>{if((n.EVENT_OWNERS||{})[t]!==e.id)throw Error(`Event "`+t+`" is not owned by this plugin`);this.emit(t,r)},theme:Object.freeze({scheme:()=>this.scheme(),dark:()=>this.scheme()===`dark`,lightCards:()=>this.lightCards(),lightTooltips:()=>this.lightTooltips(),glassPopups:()=>this.glassPopups(),glassControls:()=>this.glassControls(),uiRadius:()=>this.uiRadius(),accent:()=>r.accent,accentTint:e=>{let t=r.toOklch(r.accent);return t?r.fromOklch(e,t[1]*.45,t[2]):r.accent},palette:()=>r.scenePalette,toDark:e=>r.toDark(e),invert:e=>r.invertLightness(e),color:(e,t)=>r.themeSpec(e,t),resolve:e=>r.resolveColor(e),tag:(e,t,n)=>this.themed(e,t,n),monoSvg:e=>r.svgIsMono(e),monoImage:e=>r.imageIsMono(e),readable:(e,t,n)=>r.readableOn(e,t,n),contrast:(e,t)=>r.contrast(e,t)}),provide:t=>{e.exports=Object.assign(e.exports||{},t)},ui:{container:this._viewport,mount:f,zone:d,dock:w,inset:S,slot:C,size:m,style:t=>this.baseCss(e.id,t),env:()=>this.env(),anchor:e=>{let t=e&&typeof e==`object`?e.id:this._features&&this._features.has(e)?e:(this.find(e)||{}).id||e;return t?this.anchor(t):null},toast:h,t:(e,t)=>n.t(e,t),language:()=>this.language(),languages:()=>this.languages(),setLanguage:e=>this.setLanguage(e)},plugin:e=>{let t=this.builtin(e);if(t){let e={id:t.id,name:t.name,core:!!t.locked,enabled:()=>this.pluginOn(t.id),setting:e=>this.pluginSetting(t.id,e)};return new Proxy(e,{get:(e,n)=>{if(n in e||typeof n!=`string`)return e[n];let r=this._builtinPlugins&&this._builtinPlugins[t.id],i=r&&r.active&&r.exports;return i&&typeof i[n]==`function`?(...e)=>{let r=this._builtinPlugins[t.id];if(!r||!r.active||!r.exports)throw Error(t.name+` is off`);return r.exports[n](...e)}:i&&n in i?i[n]:(...e)=>{throw Error(t.name+` is off`)}}})}let n=(this._plugReg||[]).find(t=>t.id===e||t.name===e);if(!n)throw Error(`No plugin "`+e+`"`);return{id:n.id,name:n.name,core:!1,enabled:()=>!!n.active,setting:e=>(n.config||{})[e]}},config:e.config=e.config||{},memory:e.mem=e.mem||{}},O=this.aiTools?async(e,t)=>{let n=this.aiTools().find(t=>t.name===e);if(!n)throw Error(`No tool `+e);return n.run(t||{})}:null;return O&&(D.editor={run:O}),D}static SLOT_ANCHORS=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`];static SLOT_MARGIN=16;static HOME_SNAP_MS=1500;static SHOW_WAIT_MS=1500;static SLOT_GAP=8;_slotAdd(e,t,n){let r=a,i=this._slots=this._slots||[],o={el:null,anchor:`top-left`,order:0,min:0,max:0,priority:0,compact:!1,compactWidth:0,width:0,height:0,box:null,onLayout:null,isCompact:!1},s=e=>{e&&([`left`,`right`,`top`,`bottom`,`visibility`].concat(o.ownWidth?[`width`]:[]).forEach(t=>e.style[t]=``),o.ownWidth=!1,e.classList.remove(`mp-slot-compact`))},c=(e,t)=>{t&&this._slotObs&&this._slotObs[e?`observe`:`unobserve`](t)},l=e=>{e||={};let t=!1;if(e.anchor!=null&&e.anchor!==o.anchor){if(!r.SLOT_ANCHORS.includes(e.anchor))throw Error(`anchor must be one of `+r.SLOT_ANCHORS.join(`, `));o.anchor=e.anchor,t=!0}[`order`,`min`,`max`,`priority`,`compactWidth`,`width`,`height`].forEach(n=>{e[n]!=null&&+e[n]!==o[n]&&(o[n]=+e[n]||0,t=!0)}),e.compact!==void 0&&!!e.compact!==o.compact&&(o.compact=!!e.compact,t=!0),e.onLayout!==void 0&&(o.onLayout=e.onLayout);let n=`el`in e?e.el||null:o.el,i=e.box===void 0?o.box:e.box||null;if(n!==o.el||i!==o.box){if(c(!1,o.box||o.el),n!==o.el){let e=o.el;e&&(o.ownWidth&&(e.style.width=``),o.ownWidth=!1,e.classList.remove(`mp-slot-compact`),e.style.visibility=``),o.isCompact=!1,n&&e&&e.style.left?[`left`,`right`,`top`,`bottom`].forEach(t=>n.style[t]=e.style[t]):n&&(n.style.visibility=`hidden`)}o.el=n,o.box=i,c(!0,o.box||o.el),t=!0}return t&&this._slotSchedule(),t};!this._slotObs&&window.ResizeObserver&&(this._slotObs=new ResizeObserver(()=>this._slotSchedule()),this._slotObs.observe(this._viewport),this._slotMut=new MutationObserver(()=>this._slotSchedule()),this._slotMut.observe(this._viewport,{attributes:!0,attributeFilter:[`style`]})),i.push(o),l(Object.assign({},t,{el:e}));let u=()=>{let e=i.indexOf(o);e<0||(i.splice(e,1),c(!1,o.box||o.el),s(o.el),!i.length&&this._slotObs&&(this._slotObs.disconnect(),this._slotMut.disconnect(),this._slotObs=this._slotMut=null),this._slotSchedule())};return n&&n.offs.push(u),{update:l,remove:u,compact:()=>o.isCompact,layout:()=>{cancelAnimationFrame(this._slotRaf),this._slotLayout()}}}_slotSchedule(){!this._slotRaf&&this._viewport&&(this._slotRaf=requestAnimationFrame(()=>this._slotLayout()))}_slotLayout(){this._slotRaf=0;let e=a,t=this._viewport,n=t?t.clientWidth:0,r=[],i=()=>{let e=r.map(e=>[e.x,e.y,e.w,e.h].map(Math.round).join(`,`)).join(`;`);this._slotRects=r,this._slotSig=e};if(!n||!this._slots||!this._slots.length)return i();let o=t.clientHeight,s=getComputedStyle(t),c=e=>parseFloat(s.getPropertyValue(e))||0,l=e.SLOT_MARGIN,u=e.SLOT_GAP,d=[`left`,`center`,`right`],f=(e,t)=>{e.isCompact=t,e.el&&e.el.classList.toggle(`mp-slot-compact`,t)},p=e=>e.max>0&&!e.isCompact,m=e=>e.el?e.isCompact&&e.compactWidth?e.compactWidth:(e.ownWidth&&(e.el.style.width=``),e.ownWidth=!1,e.el.offsetWidth):e.width,h=(e,t)=>p(e)?e.max-(e.max-Math.min(e.min||e.max,e.max))*t:e.natural;[`top`,`bottom`].forEach(e=>{let t=this._slots.filter(t=>t.anchor.startsWith(e)&&(t.el?t.el.isConnected&&t.el.offsetParent!==null&&!(this._uiHidden&&t.el.closest(`[data-mp-top]:not([data-mp-edit])`)):t.width>0));if(!t.length)return;let i=e===`top`,a=l+c(i?`--mp-inset-l`:`--mp-inset-bl`),s=n-l-c(i?`--mp-inset-r`:`--mp-inset-br`),g=s-a,_=l+(i?0:c(`--mp-inset-b`)),v=d.map(e=>t.filter(t=>t.anchor.endsWith(e)).sort((e,t)=>e.order-t.order));t.forEach(e=>f(e,!1)),t.forEach(e=>e.natural=p(e)?0:m(e));let y=e=>v.map(t=>t.length?Math.max(...t.map(t=>h(t,e))):0),b=e=>{let t=y(e);return t[0]+t[1]+t[2]+u*Math.max(0,t.filter(Boolean).length-1)},x=0;for(;!(b(0)<=g);){if(b(1)<=g){let e=0,t=1;for(let n=0;n<14;n++){let n=(e+t)/2;b(n)<=g?t=n:e=n}x=t;break}let e=t.filter(e=>e.compact&&!e.isCompact).sort((e,t)=>e.priority-t.priority)[0];if(!e){x=1;break}f(e,!0),e.natural=m(e)}let[S,,C]=y(x),w=a+(S?S+u:0),T=s-(C?C+u:0);v.forEach((t,c)=>{let l=d[c],f=_;t.forEach(t=>{let c=h(t,x);l===`center`&&p(t)&&(c=Math.min(c,Math.max(T-w,t.min||0))),c=Math.round(c);let d=l===`left`?a:l===`right`?s-c:(a+s)/2-c/2;if(l===`center`&&(d=Math.max(w,Math.min(d,T-c))),d=Math.round(d),t.el){let e=t.el.style;p(t)?e.width=c+`px`:t.ownWidth&&(e.width=``),t.ownWidth=p(t),e.left=l===`right`?`auto`:d+`px`,e.right=l===`right`?Math.round(n-s)+`px`:`auto`,e.top=i?f+`px`:`auto`,e.bottom=i?`auto`:f+`px`,e.visibility=``}if(t.onLayout)try{t.onLayout({edge:e,side:l,x:d,y:f,width:c,compact:t.isCompact})}catch(e){console.warn(e)}let m=t.el?(t.box||t.el).offsetHeight:t.height;c>0&&m>0&&r.push({x:d,y:i?f:o-f-m,w:c,h:m,edge:e,side:l}),m&&(f+=m+u)})})}),i()}async install(e){this._pluginFrames=this._pluginFrames||[],this._pluginEvents=this._pluginEvents||[],this._plugins=this._plugins||[];let t={objs:[],els:[],grps:[],mats:[],offs:[],concealed:new Map};e.dispose=()=>{this._pluginFrames=this._pluginFrames.filter(t=>t.plugin!==e),this._pluginEvents=this._pluginEvents.filter(t=>t.plugin!==e),t.els.forEach(e=>e.remove()),t.offs.forEach(e=>{try{e()}catch{}}),t.objs.forEach(e=>e.parent&&e.parent.remove(e)),t.mats.forEach(([e,t])=>{e.mats=e.mats.filter(e=>e!==t)}),t.concealed.forEach(e=>e.forEach(([e,t,n])=>{e.colorWrite=t,e.depthWrite=n})),t.grps.forEach(e=>{e.group.position.copy(e.position),e.group.quaternion.copy(e.quaternion),e.group.scale.copy(e.scale)});try{typeof e.ret==`function`&&e.ret()}catch(e){console.warn(e)}},e.active=!0,this._lastCameraKey=null,this._plugins.push(e),this._plugReg=this._plugReg||[],!e.builtin&&!this._plugReg.includes(e)&&this._plugReg.push(e);try{let n=Object.getPrototypeOf(async function(){}).constructor;e.exports=null,e.ret=e.fn?await e.fn(this.plugApi(e,t)):await new n(`api`,e.code)(this.plugApi(e,t))}catch(t){throw this.uninstall(e),t}this.forceUpdate()}uninstall(e){if(e.active){e.active=!1;try{e.dispose()}catch(e){console.warn(e)}this._plugins=(this._plugins||[]).filter(t=>t!==e),this.forceUpdate()}}findPlug(e){let t=this._plugReg||[],n=String(e).toLowerCase();return t.find(e=>e.name.toLowerCase()===n)||t.find(e=>e.name.toLowerCase().includes(n))}syncPlugins(e,t){(this._plugins||[]).filter(n=>!n.builtin&&!e.includes(n)&&!(n.userSet&&(!t||t.includes(n)))).forEach(e=>this.uninstall(e)),e.filter(e=>!e.active&&!(e.userSet&&(!t||t.includes(e)))).forEach(e=>this.install(e).catch(e=>console.warn(e)))}opt(e,t){let n=a;if(n.optionPlugins||(n.optionPlugins={},n.optionSettings={},n.BUILTINS.forEach(e=>{e.opt&&(n.optionPlugins[e.opt]=e.id),Object.entries(e.settings||{}).forEach(([t,r])=>{r.opt&&(n.optionSettings[r.opt]=[e.id,t])})})),n.optionPlugins[e])return this.pluginOn(n.optionPlugins[e]);if(n.optionSettings[e]){let[r,i]=n.optionSettings[e],a=this.pluginSetting(r,i);return typeof a==`boolean`?this.pluginOn(r)&&a:a??t}let r=this.state.optionOverrides;return r&&r[e]!==void 0?r[e]:this.props[e]??t}findAll(e){let t=(this._stores||[]).concat(this._amenityList||[]).filter(e=>!(this._unitById[e.id]||{}).hid).concat(this.pointStores()),n=String(e||``).toLowerCase().trim();if(!n)return[];let r=this._storesById(n,t);if(r.length)return r;let i=n.match(/\s*\(?\b(g|l1|l2|ground floor|level 1|level 2)\)?$/),a=i?{g:0,"ground floor":0,l1:1,"level 1":1,l2:2,"level 2":2}[i[1]]:null,o=(i?n.slice(0,i.index).trim():n).replace(/^(the|nearest|closest|a|an)\s+/,``),s={toilet:`wc`,toilets:`wc`,restroom:`wc`,restrooms:`wc`,bathroom:`wc`,bathrooms:`wc`,information:`i`,info:`i`,"information desk":`i`,"info desk":`i`}[o]||o,c=t.filter(e=>e.name.toLowerCase()===o||e.type&&e.type.toLowerCase()===s),l=c.length?c:t.filter(e=>e.name.toLowerCase().includes(o)||o.includes(e.name.toLowerCase()));return a!=null&&l.some(e=>e.level===a)?l.filter(e=>e.level===a):l}_storesById(e,t){let n=String(e||``).toLowerCase().trim();if(!n)return[];t||=(this._stores||[]).concat(this._amenityList||[]).filter(e=>!(this._unitById[e.id]||{}).hid).concat(this.pointStores());let r=e=>String(e??``).toLowerCase(),i=t.find(e=>r(e.id)===n);if(i)return[i];let a=t.find(e=>r(((this._unitById[e.id]||{}).r||{}).featureId)===n);return a?[a]:t.filter(e=>r(e.loc&&typeof e.loc==`object`?e.loc.id:e.loc)===n).sort((e,t)=>e.level-t.level)}findStore(e){return this._onLevel(this.findAll(e))}_onLevel(e){return e.find(e=>e.level===this.state.level)||e[0]||null}tintOf(e){let t=this.THREE,n=r.scheme===`dark`,i=n?r.toDark(e):e,a=new t.Color(i),o=a.clone().lerp(new t.Color(n?`#fafafa`:`#09090b`),n?.15:.3),s=.2126*a.r+.7152*a.g+.0722*a.b,c=n?r.readableOn(i,`#fafafa`):s>.2?`#09090b`:`#ffffff`;return Object.assign([a,o,new t.Color(c)],{hex:e})}draw(e){e.logoOwn=void 0,this.emit(`units`,{ids:[e.id]})}normSvg(e){let t=String(e).trim().replace(/^```\w*|```$/g,``).trim();/xmlns=/.test(t)||(t=t.replace(`<svg`,`<svg xmlns="http://www.w3.org/2000/svg"`));let n=t.match(/viewBox=["']([^"']+)["']/);if(n&&!/<svg[^>]*\swidth=/.test(t)){let e=n[1].trim().split(/[\s,]+/).map(Number);t=t.replace(`<svg`,`<svg width="`+e[2]*8+`" height="`+e[3]*8+`"`)}return t}loadImg(e){let t=this._imageCache=this._imageCache||{};return t[e]?Promise.resolve(t[e]):new Promise((n,r)=>{let i=new Image;i.onload=()=>{t[e]=i,n(i)},i.onerror=r,i.src=/^(data:|blob:|https?:)/.test(e)?e:`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e)})}setHeight(e,t){if(a.unitsFlat){e.heightScale=t;return}let n=this.THREE,r=a.FLOOR_TOP,i=this._byId[e.id],o=e.heightOrig*t,s=this._extrude(i.item.poly,r,r+o,i.item.poly.holes);e.m.geometry.dispose(),e.m.geometry=s,e.line.geometry.dispose(),e.line.geometry=a.outlineGeo(n,s),r+o-e.top,e.top=r+o,i.item.top=e.top,this._tallUnits=null,e.storefrontGroup&&(e.storefrontHeight=o,e.storefrontGroup.scale.y=e.opDH?Math.min(1,o*.9/e.opDH):1),e.heightScale=t,this.draw(e)}storefrontStyle(e){let t=a,n=Object.assign({},t.STOREFRONT_DEFAULT,t.storefront||{},this._storefrontOverride||{},this.opt(`storefront`,null)||{},e&&e.storefrontPatch||{});return this.settingOn(`wayfinding`,`storefronts`)||(n.show=`never`),n}storefront(){return this.storefrontStyle(null)}setStorefront(e,t){if(t){let n=this._unitById&&this._unitById[t];if(!n)return!1;n.storefrontPatch=e?Object.assign({},n.storefrontPatch||{},e):null,n.r&&(n.r.storefront=n.storefrontPatch),this._buildStorefront(n)}else this._storefrontOverride=e?Object.assign({},this._storefrontOverride||{},e):null,(this._units||[]).forEach(e=>this._buildStorefront(e));return!0}_buildStorefront(e){let t=this.THREE,n=a.scale,i=e.storefrontGroup;if(!i)return;let o=e.storefrontStyle=this.storefrontStyle(e);if(i.children.slice().forEach(e=>{i.remove(e),e.geometry&&e.geometry.dispose()}),e.opM&&=(e.opM.dispose(),null),o.show===`never`||!e.storefrontSegments.length){i.visible=!1;return}let s=e.opDH=Math.max(.3*n,Math.min(+o.height*n,e.storefrontHeight*.9)),c=Math.max(0,+o.depth||0)*n,l=Math.max(0,+o.inset||0)*n,u=e.opM=new t.MeshLambertMaterial({color:o.color||a.scenePalette.storefront,transparent:!0,opacity:0,depthWrite:!1,side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});e.opFix=o.color?new t.Color(o.color):null;let d=e.storefrontPoly||[],f=d.reduce((e,t,n)=>{let r=d[(n+1)%d.length];return e+t[0]*r[1]-r[0]*t[1]},0)>0?1:-1,p=.006;(e.storefrontPaths||[]).forEach(e=>{let a=e.pts.slice(),d=e.closed,m=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r)||1;return[f*r/i,-f*n/i]},h=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]);return t};if(!d){let e=h(a),t=Math.min(l,Math.max(0,(e-.4*n)/2));if(e-2*t<=.01)return;if(t>0){let e=(e,t)=>{let n=0;for(let i=1;i<e.length;i++){let a=Math.hypot(e[i][0]-e[i-1][0],e[i][1]-e[i-1][1]);if(n+a>t)return[r.lerp(e[i-1],e[i],(t-n)/a)].concat(e.slice(i));n+=a}return e.slice(-1)};a=e(e(a,t).reverse(),t).reverse()}}a.length;let g=d?a.concat([a[0]]):a,_=[];for(let e=0;e<g.length-1;e++)_.push(m(g[e],g[e+1]));let v=h(g),y=d?0:Math.min(Math.max(0,+o.radius||0)*n,v/2,s/2),b=e=>{if(y<=0)return s;let t=e<y?y-e:e>v-y?e-(v-y):0;return s-y+Math.sqrt(Math.max(0,y*y-t*t))},x=(e,t)=>{let n=[e[0]+t[0],e[1]+t[1]],r=Math.hypot(...n)||1,i=[n[0]/r,n[1]/r],a=Math.max(.3,i[0]*e[0]+i[1]*e[1]);return[i[0]/a,i[1]/a]},S=[],C=0;for(let e=0;e<g.length;e++){e&&(C+=Math.hypot(g[e][0]-g[e-1][0],g[e][1]-g[e-1][1]));let t=e?_[e-1]:d?_[_.length-1]:null,n=e<_.length?_[e]:d?_[0]:null,i=t&&n?x(t,n):t||n,a=t&&n&&t[0]*n[0]+t[1]*n[1]<Math.cos(.5);if(e&&y>0){let t=C-Math.hypot(g[e][0]-g[e-1][0],g[e][1]-g[e-1][1]);for(let n=1;n<8;n++)[n/8*y,v-n/8*y].forEach(n=>{if(n>t+1e-6&&n<C-1e-6){let i=(n-t)/(C-t);S.push({p:r.lerp(g[e-1],g[e],i),d:n,n:_[e-1]})}});S.sort((e,t)=>e.d-t.d)}a?(S.push({p:g[e],d:C,n:i}),S.push({p:g[e],d:C,n:i,brk:!0})):S.push({p:g[e],d:C,n:i})}let w=[],T=[],E=(e,t,n,r)=>(w.push(e[0]+t[0]*n,r,e[1]+t[1]*n),w.length/3-1),D=(e,t,n)=>{let r=S.map(t=>{let r=b(t.d);return n?[E(t.p,t.n,e,r),E(t.p,t.n,e+c,r)]:[E(t.p,t.n,e,0),E(t.p,t.n,e,r)]});for(let e=0;e<r.length-1;e++){if(S[e+1].brk)continue;let[n,i]=r[e],[a,o]=r[e+1];t?T.push(n,i,a,a,i,o):T.push(n,a,i,a,o,i)}};D(p,!1,!1),c>0&&(D(p+c,!0,!1),D(p,!0,!0),d||[S[0],S[S.length-1]].forEach((e,t)=>{let n=b(e.d),r=E(e.p,e.n,p,0),i=E(e.p,e.n,p+c,0),a=E(e.p,e.n,p+c,n),o=E(e.p,e.n,p,n);t?T.push(r,i,a,r,a,o):T.push(r,a,i,r,o,a)}));let O=new t.BufferGeometry;O.setAttribute(`position`,new t.Float32BufferAttribute(w,3)),O.setIndex(T),O.computeVertexNormals();let k=new t.Mesh(O,u);k.renderOrder=1,c>0&&(k.castShadow=!0,u.depthWrite=!0),i.add(k)}),i.visible=o.show===`always`,e.storefrontAlpha=+(o.show===`always`),i.scale.y=1}rebuild(e){let t=a,n=this.THREE,r=t.FLOOR_TOP,i=this._byId[e.id],o=e.poly0;if(e.merged.length){let n=e.raw,r=e.merged.slice();for(;r.length;){let e=r.findIndex(e=>this._unitById[e]&&t.union(n,this._unitById[e].raw));if(e<0)return!1;n=t.union(n,this._unitById[r[e]].raw),r.splice(e,1)}o=this._inset(n,.14)}let s=o.map(e=>e[0]),c=o.map(e=>e[1]),l=[Math.min(...s),Math.max(...s),Math.min(...c),Math.max(...c)],u=e.merged.length,d=u?t.fitLabel(o,(e.r.name||``).length,e.am):null;e.lp=u?o:e.lp0,e.centerX=u?d.centerX:e.centerXOrig,e.centerZ=u?d.centerZ:e.centerZOrig,e.boxWidth=u?l[1]-l[0]:e.boxWidthOrig,e.boxDepth=u?l[3]-l[2]:e.boxDepthOrig,e.alongV=u?e.boxDepth>=e.boxWidth:e.av0,i.item.poly=o,i.item.cx=e.centerX,i.item.cz=e.centerZ;let f=this._extrude(o,e.base??r,e.top,o.holes);return e.m.geometry.dispose(),e.m.geometry=f,e.line.geometry.dispose(),e.line.geometry=a.outlineGeo(n,f),this.draw(e),!0}applyMerge(e,t){let n=this._unitById[e];if(!n)return!1;let r=n.merged;return n.merged=t.slice(),this.rebuild(n)?(r.filter(e=>!t.includes(e)).forEach(e=>this.showUnit(e,!0)),t.filter(e=>!r.includes(e)).forEach(e=>this.showUnit(e,!1)),!0):(n.merged=r,this.rebuild(n),!1)}showUnit(e,t){let n=this._unitById[e];n&&(n.hid=!t,n.m.visible=t,this.draw(n))}refocus(e){let t=this._byId&&this._byId[e];t&&!this.state.all&&this.state.selected===e&&this.camGoal&&(this.camGoal.distance=this.fitDist(t.item.poly,this.home(!1),e))}applyStore(e,t){let n=this._unitById[e],r=this._byId[e];if(!n||!r)return;let i=r.item.store,a=!1;t.merged&&t.merged.join()!==n.merged.join()&&this.applyMerge(e,t.merged),t.heightScale!=null&&t.heightScale!==n.heightScale&&this.setHeight(n,t.heightScale),t.name!=null&&t.name!==i.name&&(i.name=t.name,a=!0),t.logo!=null&&t.logo!==(n.logo||`orig`)&&(n.logo=t.logo,a=!0),t.labelScale!=null&&t.labelScale!==(n.labelScale||1)&&(n.labelScale=t.labelScale,a=!0),t.focusZoom!=null&&(+t.focusZoom||0)!==(n.focusZoom||0)&&(n.focusZoom=+t.focusZoom||0,this.refocus(e)),t.focusX!=null&&(+t.focusX||0)!==(n.focusX||0)&&(n.focusX=+t.focusX||0,this.refocus(e)),t.labelRotation!=null&&t.labelRotation!==(n.labelRotation||0)&&(n.labelRotation=t.labelRotation,a=!0),t.labelOffset!=null&&t.labelOffset.join()!==(n.labelOffset||[0,0]).join()&&(n.labelOffset=t.labelOffset,a=!0),t.label!=null&&n.r&&!!t.label==!!n.r.noLabel&&(n.r.noLabel=!t.label,a=!0);let o=!1;t.cat!=null&&t.cat!==i.cat&&(i.cat=t.cat,o=!0),t.hours!=null&&t.hours!==i.hours&&(i.hours=t.hours,o=!0),a?this.draw(n):o&&this.emit(`units`,{ids:[e]})}componentWillUnmount(){this._destroyed=!0,this._langObserver&&this._langObserver.disconnect(),this._schemeQuery&&this._schemeQuery.removeEventListener&&this._schemeQuery.removeEventListener(`change`,this._schemeListener),this._cssEl&&=(this._cssEl.remove(),null),(this._plugins||[]).forEach(e=>{try{e.dispose()}catch{}}),cancelAnimationFrame(this._frameId),this._intersectionObserver&&this._intersectionObserver.disconnect(),this._resizeObserver&&this._resizeObserver.disconnect(),this._heightObs&&this._heightObs.disconnect(),this._heightObs=null,clearTimeout(this._wheelHintTimer),this._viewport&&this._viewport.removeEventListener(`wheel`,this._wheelHandler),this._viewport&&this._viewport.removeEventListener(`gesturestart`,this._preventGesture),this._mq&&this._mq.removeEventListener&&this._mq.removeEventListener(`change`,this._mqf),this.renderer&&=(this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),null)}rebuildScene(){let e=(this._rebuildRun||Promise.resolve()).catch(()=>{}).then(()=>this.rebuildSceneNow());return this._rebuildRun=e,e}async rebuildSceneNow(){if(!this.renderer)return;this.applyCss();let e=this._logos=this._logos||{},t=[...new Set(a.source().unitRows.flat().map(e=>e.logo).filter(t=>t&&!(t in e)))];await Promise.all(t.map(async t=>{try{let n=await fetch(t);e[t]=n.ok?await n.text():null}catch{e[t]=null}})),(this._plugins||[]).slice().forEach(e=>this.uninstall(e)),this._navGrid=null,cancelAnimationFrame(this._frameId),this._resizeObserver&&this._resizeObserver.disconnect();let n=e=>(Array.isArray(e)?e:e?[e]:[]).forEach(e=>{e.map&&e.map.dispose(),e.dispose()});this.scene.traverse(e=>{e.geometry&&e.geometry.dispose(),n(e.material),e.customDepthMaterial&&e.customDepthMaterial.dispose()}),(this._textures||[]).forEach(e=>e.dispose()),this.renderer&&(this.renderer.dispose(),this.renderer.forceContextLoss(),this.renderer.domElement.remove(),this.renderer=null,this.init(this.THREE))}defaultControls(){return Object.assign({wayfinding:!0,levels:!0,zoom:!0,fullscreen:!0,compass:!0,hint:!0},(a.raw||{}).ui,this.props.controls)}ui(){let e=e=>this.settingOn(`controls`,e);return{wayfinding:this.pluginOn(`wayfinding`),levels:e(`levels`)&&(a.levelNames||[]).length>1,zoom:e(`zoom`),reset:e(`reset`),fullscreen:e(`fullscreen`),compass:e(`compass`),dimension:e(`dimension`),hint:e(`hint`)}}setControls(e){let t=this._pluginConfig().builtin,n=Object.keys(a.BUILTINS.find(e=>e.id===`controls`).settings);return Object.entries(e||{}).forEach(([e,r])=>{if(r!=null){if(e===`wayfinding`)(t.wayfinding=t.wayfinding||{}).enabled=!!r;else if(n.includes(e)){let n=t.controls=t.controls||{};n.settings=Object.assign({},n.settings,{[e]:!!r})}}}),this._plugChanged(null),this.ui()}renderVals(){let e=this.baseVals();return e.ui=this.ui(),e}baseVals(){let e=this.state,t=a,n=e.all,r=e.level,i=this._byId||{},o=e.ready;e.popId&&i[e.popId];let s=e=>this._features&&this._features.get(e),c=e=>(((t.locations||{})[e]||{}).mapplic||{}).tooltip===!1,l=(e=>!!e&&!!(i[e]&&!c(e)||s(e)&&s(e).tip&&s(e).tip()))(e.hovered)&&!e.drag&&(!e.popupOpen||e.popId!==e.hovered||n)&&!(e.scenerySelected&&e.hovered===e.scenerySelected)&&(n||!i[e.hovered]||i[e.hovered].item.store.level===r)?e.hovered:null,u=this._tooltipSlots=this._tooltipSlots||{s:[null,null],a:0,v:null};if(l&&u.s[u.a]!==l){let e=1-u.a;(u.s[e]===l||u.v&&u.s[u.a])&&(u.a=e),u.s[u.a]=l}u.v=l,t.locations;let d=e.scenerySelected&&this.featureInfo(e.scenerySelected);d&&d.name;let f=e=>(this._stores||[]).filter(t=>t.level===e).length,p=e=>()=>{let t=this.state.all;this.closePopups({all:!1,level:e}),t&&this.camGoal&&this.goHome(!1)},m=e=>{let t=this._viewport.getBoundingClientRect();this._pointerNdc&&this._pointerNdc.set((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1)};return{vpRef:e=>{this._viewport=e},glRef:e=>{this._glEl=e},ready:o&&e.shown?1:0,loading:!(o&&e.shown),loadText:e.err?typeof e.err==`string`?e.err:`3D needs WebGL, which is not available here`:`Loading map`,loadAnim:!e.err,tags:a.levelNames.map((e,r)=>({label:t.levelNames[r],op:o&&n?1:0,pe:n?`auto`:`none`,pick:p(r),ref:e=>{this._tg[r]=e}})),tips:[0,1].map(e=>{let t=u.s[e],n=!!l&&e===u.a,r=t&&i[t],a=!r&&t&&s(t),o=a&&a.tip&&a.tip()||{};return{ref:this._tRef[e],op:+!!n,sc:n||this._reducedMotion?1:.9,up:!!o.up,dn:!!o.down,name:r?r.item.store.name:o.text||``}}),closeP:e=>{e.stopPropagation(),this.closePopups()},chipT:n?`All levels`:t.levelNames[r],chipS:n?(this._stores||[]).length+` units · pick a store to open its level`:f(r)+` units`,allBg:n?`var(--mp-selected-bg)`:`var(--mp-surface)`,allFg:n?`var(--mp-selected-fg)`:`var(--mp-fg-muted)`,toggleAll:()=>{let e=!this.state.all;(!e||this.canExplode())&&(this.closePopups({all:e}),this.camGoal&&this.goHome(e))},lvBtns:a.levelNames.map((e,t)=>t).reverse().map(e=>{let i=!n&&r===e;return{label:a.levelShortNames[e],title:t.levelNames[e],bg:i?`var(--mp-selected-bg)`:`var(--mp-surface)`,fg:i?`var(--mp-selected-fg)`:`var(--mp-fg-muted)`,div:`var(--mp-border-subtle)`,pick:p(e)}}),rzOp:+!!e.awayFromHome,rzPe:e.awayFromHome?`auto`:`none`,rzY:e.awayFromHome||this._reducedMotion?0:4,resetView:e=>{e.stopPropagation(),this.camGoal&&this.goHome(this.state.all),this.closePopups()},zoomIn:()=>{this._flight=null,this.camGoal&&(this.camGoal.distance=Math.max(this.minDist(),this.camGoal.distance/1.4))},zoomOut:()=>{this._flight=null,this.camGoal&&(this.camGoal.distance=Math.min(this.maxDist(),this.camGoal.distance*1.4))},plugRef:e=>{this._plugEl=e},sceneRef:e=>{this._sceneEl=e},slotRef:e=>{this._slot=e},resetRot:e=>{if(e.stopPropagation(),!this.camGoal)return;let t=this.home(this.state.all),n=this.camGoal;this._inertia=null,n.azimuth=t.azimuth+2*Math.PI*Math.round((n.azimuth-t.azimuth)/(2*Math.PI)),n.polar=t.polar},cs:40,dirGap:80,hintText:e.coarse?`Drag to pan · Pinch to zoom · Twist to rotate · Two-finger drag to tilt`:`Drag to pan · Double-click and drag to rotate · `+({modifier:`Ctrl + scroll to zoom`,off:``,zoom:`Scroll to zoom`}[this.wheelMode()]||``),stop:e=>e.stopPropagation(),cursor:e.drag?`grabbing`:e.hovered?`pointer`:`grab`,ctx:e=>e.preventDefault(),down:e=>{if(!this.camGoal||e.button>2)return;let t=this._pointers;if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),e.pointerType===`mouse`&&this._pendingDrag&&this._pendingDrag.btn===e.button&&performance.now()-this._pendingDrag.t<90){let t=this._pendingDrag.d;this._pendingDrag=null,t.lx=e.clientX,t.ly=e.clientY,t.hs=[],this._drag=t,this._inertia=null,this._moved=!0,this._lastUp=null;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}this.state.drag||this.setState({drag:!0,hovered:null});return}if(e.pointerType===`touch`&&(this._pointerNdc&&this._pointerNdc.set(-9,-9),t.size>=2)){try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}this._drag=null,this._inertia=null,this._moved=!0,this._lastUp=null,this._touchNow=this.twoPointers(),this._touchStart=this._touchNow,this._touchMode=null,this.state.drag||this.setState({drag:!0,hovered:null});return}let n=this._lastUp,r=!(e.button===0&&n&&performance.now()-n.t<350&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<8||e.button===2&&!this.is2d()||e.button===0&&(e.shiftKey||(e.metaKey||e.ctrlKey)&&!this.is2d()));this._inertia=null;let i=e.target.closest&&e.target.closest(`[data-mp-drag]`)||null;this._drag={x:e.clientX,y:e.clientY,lx:e.clientX,ly:e.clientY,pan:i?!0:r,btn:e.button,hs:[],through:i},this._moved=!1;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},move:e=>{let t=this._pointers,n=e.pointerType===`touch`;if(t.has(e.pointerId)&&t.set(e.pointerId,{x:e.clientX,y:e.clientY}),!n){let t=this._plugEl&&e.target!==this._plugEl&&this._plugEl.contains(e.target)||!!(e.target.closest&&e.target.closest(`[data-mp-top]`)),n=t&&e.target.closest&&e.target.closest(`[data-mp-hover]`);this._hovOver=n?n.getAttribute(`data-mp-hover`):null,t?this._pointerNdc&&this._pointerNdc.set(-9,-9):m(e),this._hoverDirty=!0}if(!n&&e.buttons===0&&this._drag&&!(this._drag.hs.length&&e.timeStamp-this._drag.hs[this._drag.hs.length-1].t<50)){this._drag=null,t.delete(e.pointerId),this._lastUp=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}this.state.drag&&this.setState({drag:!1});return}if(this._touchNow){if(t.size<2)return;let e=this.twoPointers(),n=this.camGoal,r=e=>Math.atan2(Math.sin(e),Math.cos(e));if(!this._touchMode){let t=this._touchStart,n=Math.abs(e.d-t.d),i=Math.abs(r(e.a-t.a))*e.d/2,a=Math.abs(e.mx-t.mx),o=Math.abs(e.my-t.my);if(Math.max(n,i,a,o)<12)return;this._touchMode=o>1.5*a&&o>n&&o>i?`tilt`:`xf`,this._touchNow=t}let i=this._touchNow;this._touchNow=e;let a=e.my-i.my,o=e.mx-i.mx;if(this._touchMode===`tilt`){n.polar=Math.max(.12,Math.min(1.38,n.polar-a*.006));return}i.d>0&&e.d>0&&this.zoomAt(e.mx,e.my,i.d/e.d),n.azimuth+=r(e.a-i.a),this.panPixels(o,a);return}let r=this._drag;if(!r||!this._moved&&Math.abs(e.clientX-r.x)+Math.abs(e.clientY-r.y)<(n?10:4))return;this._moved||(this._moved=!0,this.setState({drag:!0,hovered:null}));let i=e.clientX-r.lx,a=e.clientY-r.ly,o=this.camGoal;if(this.camView,r.lx=e.clientX,r.ly=e.clientY,!n&&e.buttons===0)return;let s=e.timeStamp,c=r.hs;for(;c.length&&s-c[0].t>120;)c.shift();if(!r.pan){let e=.0035,t=.003;o.azimuth-=i*e,o.polar=Math.max(.12,Math.min(1.38,o.polar-a*t)),c.push({t:s,px:i,py:a,a:-i*e,p:-a*t,x:0,z:0});return}let[l,u]=this.panPixels(i,a);c.push({t:s,px:i,py:a,a:0,p:0,x:l,z:u})},up:e=>{let t=this._pointers;t.delete(e.pointerId);let n=this._skipTap;if(this._skipTap=!1,e.pointerType===`touch`&&this._pointerNdc&&this._pointerNdc.set(-9,-9),this._touchNow){if(t.size<2){this._touchNow=null,this._drag=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.size||this.setState({drag:!1})}return}let r=this._drag;if(!r)return;this._drag=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(this._lastUp=this._moved||r.through?null:{t:performance.now(),x:e.clientX,y:e.clientY},this._moved&&e.pointerType===`mouse`&&(this._pendingDrag={d:r,btn:r.btn,t:performance.now()}),this._moved){let t=e.timeStamp,n=r.hs.filter(e=>t-e.t<=100),i=n.filter(e=>t-e.t<=60).reduce((e,t)=>e+Math.abs(t.px)+Math.abs(t.py),0);if(!this._reducedMotion&&n.length>=2&&i>=3){let e=Math.max(16,t-n[0].t+8)/1e3,i=.55,a=n.reduce((e,t)=>(e.x+=t.x,e.z+=t.z,e.a+=t.a,e.p+=t.p,e),{x:0,z:0,a:0,p:0});this._inertia={pan:r.pan,vx:a.x/e*i,vz:a.z/e*i,va:a.a/e*i,vp:a.p/e*i}}this.setState({drag:!1});return}if(r.btn!==0||!this.renderer||n)return;if(r.through){r.through.isConnected&&r.through.click();return}if(this.tapHook&&this.tapHook(e))return;m(e);let i=this.hitTest(this._pointerNdc);i&&i.id?this.pick(i.id):(this.state.selected||this.state.popupOpen||this.state.scenerySelected)&&this.closePopups()},leave:()=>{this._hovOver=null,!this._drag&&this.state.hovered&&this.setState({hovered:null}),this._pointerNdc&&this._pointerNdc.set(-9,-9)},dbl:e=>{!this._moved&&this.renderer&&(e.preventDefault(),m(e),this.zoomAt(e.clientX,e.clientY,1/1.6))}}}}n&&(a.pluginFactories=n.MapplicMap.pluginFactories,r.UI=n.MapplicData.UI,[`PLUGIN_FILES`,`pluginsReady`,`loadThree`,`MAP_URL`,`EMBED_ERROR`,`smartSearch`,`PLACE`,`POPUP`,`HOURS`,`SEARCH`,`API_DOC`].forEach(e=>Object.defineProperty(a,e,{configurable:!0,get:()=>n.MapplicMap[e],set:t=>{n.MapplicMap[e]=t}})));let o={MapplicData:r,MapplicView:i,MapplicMap:a};return a.isolated=()=>t(n||o).MapplicMap,o}let{MapplicData:n,MapplicView:r,MapplicMap:i}=t(null);if(window.MapplicData=n,window.MapplicView=r,window.MapplicMap=i,i.plugin(`grids`,e=>{let t=e.plugin(`grids`),n=e.three.THREE,r=(e,n,r,i)=>{let a=+t.setting(e);return Math.max(r,Math.min(i,isFinite(a)&&a>0?a:n))},i=(e,t,n)=>{let r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let[o,s]=n[i],[c,l]=n[a];s>t!=l>t&&e<(c-o)*(t-s)/(l-s)+o&&(r=!r)}return r},a=e=>e&&isFinite(e[0])&&isFinite(e[1]),o=e.data.units().filter(e=>!e.hidden&&e.box&&e.box.length>=3&&e.box.every(a));if(!o.length)return;let s=o.map(e=>{let t=e.box.map(e=>e[0]),n=e.box.map(e=>e[1]);return[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]}),c=s.reduce((e,t)=>[Math.min(e[0],t[0]),Math.max(e[1],t[1]),Math.min(e[2],t[2]),Math.max(e[3],t[3])],[1/0,-1/0,1/0,-1/0]),l=new Set,u=t=>{if(l.has(t))return;let n=e.three.unit(t);n&&(l.add(t),n.conceal())};o.forEach(e=>u(e.id));let d=[],f=[],p=0,m=``,h=0,g=0,_=0,v=()=>JSON.stringify([`density`,`size`,`shape`,`layout`,`small`,`zoom_steps`].map(e=>t.setting(e))),y=()=>!!(e.ui&&e.ui.env&&e.ui.env().reducedMotion),b=l=>{let d=[`square`,`hexagon`].includes(t.setting(`shape`))?t.setting(`shape`):`round`,f=t.setting(`layout`)===`staggered`,p=t.setting(`small`)===!0,m=Math.max(c[1]-c[0],c[3]-c[2])/l,h=m*r(`size`,60,5,100)/200,g=f?m*Math.sqrt(3)/2:m,_=e=>f&&e%2?m/2:0,v=new Map;o.forEach((e,t)=>{let n=v.get(e.level)||v.set(e.level,{taken:new Set,points:[],ranges:[]}).get(e.level),r=s[t],o=Math.ceil((r[2]-c[2])/g-.5),l=Math.floor((r[3]-c[2])/g-.5),u=n.points.length,d=(e.top||0)+.01;for(let t=o;t<=l;t++){let a=_(t),o=Math.ceil((r[0]-c[0]-a)/m-.5),s=Math.floor((r[1]-c[0]-a)/m-.5);for(let r=o;r<=s;r++){let o=t*100003+r;if(n.taken.has(o))continue;let s=c[0]+a+(r+.5)*m,l=c[2]+(t+.5)*g;i(s,l,e.box)&&(n.taken.add(o),n.points.push([s,d,l]))}}n.points.length===u&&p&&a(e.center)&&n.points.push([e.center[0],d,e.center[1]]),n.points.length>u&&n.ranges.push({id:e.id,from:u,to:n.points.length,hex:-1})});let y=d===`square`?new n.PlaneGeometry(h*2,h*2):d===`hexagon`?new n.CircleGeometry(h/Math.cos(Math.PI/6),6,Math.PI/6):new n.CircleGeometry(h,20);y.rotateX(-Math.PI/2);let b=[],x=new n.Matrix4,S=new n.Color;return v.forEach((t,r)=>{if(!t.points.length)return;let i=new n.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}),a=new n.InstancedMesh(y,i,t.points.length);t.points.forEach((e,t)=>a.setMatrixAt(t,x.makeTranslation(e[0],e[1],e[2]))),a.setColorAt(0,S.set(16777215)),a.instanceMatrix.needsUpdate=!0,a.frustumCulled=!1,a.visible=!1,a.raycast=()=>{},e.three.add(a,r),t.ranges.forEach(t=>{let n=e.three.unit(t.id);t.body=n&&n.body,u(t.id)}),b.push({mesh:a,L:t,level:r})}),{density:l,spacing:m,geometry:y,meshes:b,mix:0}},x=e=>d[e]||(d[e]=b(f[e])),S=()=>{clearTimeout(_),d.forEach(e=>{e&&(e.meshes.forEach(e=>{e.mesh.parent&&e.mesh.parent.remove(e.mesh),e.mesh.material.dispose(),e.mesh.dispose()}),e.geometry.dispose())}),d=[]},C=()=>{clearTimeout(_);let e=f.findIndex((e,t)=>!d[t]);e<0||(_=setTimeout(()=>{x(e),C()},600))},w=()=>{m=v();let e=Math.round(r(`density`,160,20,600)),n=Math.round(Math.max(0,Math.min(3,+t.setting(`zoom_steps`)||0)));f=[e];for(let t=1;t<=n;t++){let n=Math.min(600,e*2**t);if(n<=f[f.length-1])break;f.push(n)}p=Math.min(p,f.length-1);let i=x(p);i.mix=1,i.meshes.forEach(e=>e.mesh.visible=!0),C()},T=()=>{let e=p;for(;e<f.length-1&&g>=e+1;)e++;for(;e>0&&g<e-.15;)e--;return e};w(),e.on(`plugin`,()=>{v()!==m&&(S(),w())});let E=null,D=e=>{g=Math.log2(h/e);let t=T();t!==p&&(x(t).meshes.forEach(e=>{e.mesh.visible=!0,e.L.ranges.forEach(e=>e.hex=-1)}),p=t)};e.on(`camera`,e=>{e&&e.distance>0&&(h||=e.distance,E=e.home?{distance:e.distance,frames:0}:null,D(e.distance))});let O=e=>{let t=e&&(Array.isArray(e.material)?e.material[0]:e.material);return t&&t.color};e.onFrame(t=>{E&&++E.frames>2&&(h=E.distance,E=null,D(h));let n=y()?1:Math.min(1,(t||.016)/.18);d.forEach((t,r)=>{if(!t)return;let i=+(r===p);t.mix!==i&&(t.mix=i>t.mix?Math.min(1,t.mix+n):Math.max(0,t.mix-n)),t.meshes.forEach(({mesh:n,L:r,level:i})=>{if(n.visible=t.mix>0,!n.visible)return;n.material.opacity=t.mix*e.three.levelOpacity(i);let a=!1;r.ranges.forEach(e=>{let t=O(e.body);if(!t)return;let r=t.getHex();if(r!==e.hex){e.hex=r;for(let r=e.from;r<e.to;r++)n.setColorAt(r,t);a=!0}}),a&&(n.instanceColor.needsUpdate=!0)})})});let k=()=>d[p]||null;return e.provide({count:()=>k()?k().meshes.reduce((e,t)=>e+t.L.points.length,0):0,spacing:()=>k()?k().spacing:0,step:()=>p,density:()=>k()?k().density:0}),S}),i.PLUGIN_FILES=[`labels`,`scenery`,`wayfinding`,`markers`,`hours`,`popups`,`attract`,`intro`,`drift`,`controls`,`search`,`directory`,`deeplink`,`localization`],i.pluginsReady=new Promise(e=>{let t=()=>{if(globalThis.MAPPLIC_BUNDLE)return e();let t=i.PLUGIN_FILES.filter(e=>!i.pluginFactories[e]);if(!t.length)return e();let n=t.length,r=()=>{n--,n||e()},a=Date.now();t.forEach(e=>{let t=document.createElement(`script`);t.src=new URL(`plugins/`+e+`.js?v=`+a,document.baseURI).href,t.async=!1,t.onload=r,t.onerror=()=>{console.warn(`mapplic: could not load plugin`,e),r()},document.head.appendChild(t)})};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,t):queueMicrotask(t)}),i.MAP_URL=`https://mapplicusercontent.com/maps/{id}`,i.EMBED_ERROR=`Map not available`,i.EMBED_PLACE=[`data-select`,`data-level`,`data-from`],i.LINK_ITEMS=[`select`,`level`,`route`,`category`],i.EMBED_HOST_CSS=`:host{display:block;position:relative;height:480px}`,window.customElements&&!customElements.get(`mapplic-map`)){let e=e=>String(e??``);customElements.define(`mapplic-map`,class extends HTMLElement{static get observedAttributes(){return[`data-map`,`data-src`,`data-api`,`data-view`,`data-background`,`data-select`,`data-level`,`data-from`]}shadow(){if(!this.shadowRoot){let e=this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.setAttribute(`data-mapplic-page`,`template`),e.append(t)}return this.shadowRoot}syncCss(){let e=Array.from(this.children).filter(e=>e.localName===`template`&&e.hasAttribute(`data-css`)).map(e=>e.content.textContent).join(`
4150
4184
  `),t=this.shadow().querySelector(`style[data-mapplic-page="template"]`);t.textContent!==e&&(t.textContent=e)}addCss(t){let n=document.createElement(`style`);return n.setAttribute(`data-mapplic-page`,``),n.textContent=e(t),this.shadow().append(n),{update:t=>{n.textContent=e(t)},remove:()=>n.remove()}}connectedCallback(){clearTimeout(this._dropTimer),this.syncCss(),this._cssObserver=this._cssObserver||new MutationObserver(()=>this.syncCss()),this._cssObserver.observe(this,{childList:!0,subtree:!0,characterData:!0}),!this._started&&(this._started=!0,queueMicrotask(()=>this.start()))}disconnectedCallback(){this._cssObserver&&this._cssObserver.disconnect(),this._dropTimer=setTimeout(()=>!this.isConnected&&this.stop(),0)}attributeChangedCallback(e,t,n){this._started&&t!==n&&(i.EMBED_PLACE.includes(e)?this.map&&this._placed&&this.applyPlace(e):(this.stop(),this._started=!0,queueMicrotask(()=>this.start())))}mapUrl(){let e=this.getAttribute(`data-src`),t=(this.getAttribute(`data-map`)||``).trim();return e?new URL(e,document.baseURI).href:t?(this.getAttribute(`data-api`)||i.MAP_URL).replace(`{id}`,encodeURIComponent(t)):null}makeBox(){return this.shadow(),i.shadowBox(this,i.EMBED_HOST_CSS)}async start(){if(!this.isConnected)return this._started=!1;let e=this._run=(this._run||0)+1;this._placed=!1,this._failed=null;let t=this.makeBox(),n=this.mapUrl();try{if(!n)throw Error(`<mapplic-map> needs a data-map attribute`);let r=await fetch(n);if(!r.ok)throw Error(`HTTP `+r.status+` for `+n);let a=await r.json();if(e!==this._run)return;let o=i.isolated();if(this.map=new o({options:{src:n,data:a,view:(this.getAttribute(`data-view`)||``).trim()||null,background:{true:!0,false:!1}[(this.getAttribute(`data-background`)||``).trim()],savedCopies:!1,plugins:!0,errorText:i.EMBED_ERROR,frame:this}}),this.map.mount(t),await this.map.whenReady(),await this.whenShown(e),e!==this._run)return;this._placed=!0,this.applyPlace(null),this.dispatchEvent(new CustomEvent(`mapplic-ready`,{bubbles:!0,detail:{map:this.map}}))}catch(n){if(e!==this._run)return;console.warn(`mapplic: map not available`,n),this._failed=n,this.dispatchEvent(new CustomEvent(`mapplic-error`,{bubbles:!0,detail:{error:n}}));let r=document.createElement(`div`);r.setAttribute(`role`,`status`),r.textContent=i.EMBED_ERROR,r.style.cssText=`position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:inherit;background:#f4f4f5;color:#71717a;font:500 13px/1.4 Onest,system-ui,sans-serif`,t.replaceChildren(r)}}whenReady(){return this.map&&this._placed?Promise.resolve(this.map):this._failed?Promise.reject(this._failed):new Promise((e,t)=>{let n=t=>(i(),e(t.detail.map)),r=e=>(i(),t(e.detail.error)),i=()=>{this.removeEventListener(`mapplic-ready`,n),this.removeEventListener(`mapplic-error`,r)};this.addEventListener(`mapplic-ready`,n),this.addEventListener(`mapplic-error`,r)})}whenShown(e){return new Promise(t=>{let n=()=>{if(e!==this._run||!this.map)return t();if(this.map.state.shown)return requestAnimationFrame(()=>t());requestAnimationFrame(n)};n()})}applyPlace(e){let t=this.map,n=e=>(this.getAttribute(e)||``).trim(),r=n(`data-select`),i=n(`data-level`),a=n(`data-from`),o=t.wayfindingApi(),s=t.deeplinkApi(),c=e===null&&s?s.linked():{},l=!!(c.select||c.level||c.from),u=(e,t)=>{try{return t()}catch(t){console.warn(`mapplic: `+e,t)}};(e===null||e===`data-from`)&&(o&&!c.from?u(`data-from`,()=>o.origin(a||null)):a&&console.warn(`mapplic: data-from needs Wayfinding on`),e&&!r)||l||(r?a&&o?t.showRoute(a,r).catch(e=>{console.warn(`mapplic: route`,e),u(`data-select`,()=>t.select(r))}):u(`data-select`,()=>t.select(r)):(e===`data-select`&&(o&&t.routeInfo()&&t.hideRoute(),t.deselect()),i&&(e===null||e===`data-level`||e===`data-select`)&&u(`data-level`,()=>t.setLevel(i))))}stop(){this._run=(this._run||0)+1,this._started=!1,this._placed=!1,this.map&&this.map.destroy(),this.map=null,this.shadowRoot&&Array.from(this.shadowRoot.children).forEach(e=>e.classList.contains(`mp-embed`)&&e.remove())}})}})(),MapplicMap.plugin(`labels`,e=>{let t=e.plugin(`labels`),n=e.three.THREE,r=e.three.renderer,i=e.three.camera,a=e.three.SVGLoader?new e.three.SVGLoader:null,o=new n.Vector3,s={},c=e=>{e.font=`700 160px Onest, sans-serif`,`letterSpacing`in e&&(e.letterSpacing=`10px`)},l=document.createElement(`canvas`).getContext(`2d`),u=e=>{let t=String(e).split(`
4151
4185
  `);return c(l),{w:Math.ceil(Math.max(...t.map(e=>l.measureText(e).width)))+40,h:Math.ceil(208+176*(t.length-1))}},d=null,f=t=>{let n=Array.isArray(t.category)?t.category[0]:t.category,r=n&&typeof n==`object`?n.id||n.name:n;return r==null?null:(d=d||e.data.section(`categories`)||[],d.find(e=>e.id===r||e.name===r)||null)},p=n=>{let r=f(n),i=n.location?e.data.location(n.location):null,a=Object.assign({},r&&r.labels||{},i&&i.mapplic&&i.mapplic.labels||{}),o=e=>a[e]==null?+t.setting(e):+a[e],s=n.labelOffset||(Array.isArray(a.offset)?a.offset:null);return{textFill:o(`text_fill`)/100,textHeight:o(`text_height`)/100,textMax:e.geo.metres(o(`text_max`)),logoFill:o(`logo_fill`)/100,logoMax:o(`logo_max`)>0?e.geo.metres(o(`logo_max`)):0,dx:s?e.geo.metres(s[0]):0,dz:s?-e.geo.metres(s[1]):0}},m=e=>Object.assign({snap:+t.setting(`snap`)},e),h=(t,n,r,i,a)=>{let o=Math.min(.9,a/(.9*i));if(!(o<.9))return null;let s=e.geo.fit(t.box,1,!1,1,-r,m({aspect:n,fill:1,centre:o}));return s&&.9*s.fs>=a-1e-9?s:null},g=(n,r,i)=>{if(n.kind===`amenity`){let t=e.geo.fit(n.box,r.length||4,!0,1,n.labelAngle,m());return t.txt=r,t}let a=t=>{let r=u(t),a=r.h/160,o=String(t).split(`
4152
4186
  `).length,s=i.textHeight*a/(1+1.1*(o-1)),c=e.geo.fit(n.box,1,!1,1,n.labelAngle,m({aspect:r.w/r.h,fill:i.textFill,heightFill:s,max:i.textMax*a,centre:String(t).length<=3?.6:void 0}));if(c&&String(t).length>3){let t=e.geo.fit(n.box,1,!1,1,-c.ry,m({aspect:r.w/r.h,fill:1})),i=t&&h(n,r.w/r.h,c.ry,t.fs,c.fs);i&&(c.centerX=i.centerX,c.centerZ=i.centerZ)}return c&&(c.fs/=a,c.txt=t),c},o=a(r),s=r.split(` `);if(!t.setting(`wrap`)||s.length<2)return o;let c=1+(+t.setting(`wrap_gain`)||0)/100,l=e=>{if(e===2)return s.slice(1).map((e,t)=>[s.slice(0,t+1).join(` `),s.slice(t+1).join(` `)]);let t=[];for(let e=1;e<s.length-1;e++)for(let n=e+1;n<s.length;n++)t.push([s.slice(0,e).join(` `),s.slice(e,n).join(` `),s.slice(n).join(` `)]);return t};return[2,3].forEach(e=>{if(s.length<e)return;let t=l(e).sort((e,t)=>Math.max(...e.map(e=>e.length))-Math.max(...t.map(e=>e.length)))[0],n=a(t.join(`
4153
4187
  `));n&&o&&n.fs>o.fs*c&&(o=n)}),o},_=(t,n,r)=>{let i=n=>e.geo.fit(t.box,1,!1,1,t.labelAngle,m({aspect:n,fill:1,upright:!0})),a=i(n),o=Math.max(n*a.fs*a.fs,...[.5,1,2].map(e=>{let t=i(e);return t?e*t.fs*t.fs:0})),s=Math.min(r.logoFill*Math.sqrt(o),r.logoMax||1/0),c=Math.min(s/Math.sqrt(n),.9*a.fs),l=h(t,n,a.ry,a.fs,c*(t.labelScale||1))||a,u=a.ry;for(;u>Math.PI/2+1e-6;)u-=Math.PI;for(;u<=-Math.PI/2+1e-6;)u+=Math.PI;return{h:c*(t.labelScale||1),x:l.centerX+r.dx,z:l.centerZ+r.dz,ry:u-(t.labelRotation||0)*Math.PI/180}},v=(e,t,i,a,o,s)=>{let l=document.createElement(`canvas`),d=l.getContext(`2d`),f=String(e).split(`
4154
- `),{w:p,h:m}=u(e);l.width=p,l.height=m,c(d),d.fillStyle=`#fff`,d.textAlign=`center`,d.textBaseline=`middle`,f.forEach((e,t)=>d.fillText(e,p/2,104+t*176+7.52));let h=new n.CanvasTexture(l);h.colorSpace=n.SRGBColorSpace,h.anisotropy=r.capabilities.getMaxAnisotropy();let g=t/160,_=new n.Mesh(new n.PlaneGeometry(p*g,m*g),new n.MeshBasicMaterial({map:h,transparent:!0,depthWrite:!1,opacity:0,polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3}));return _.rotation.order=`YXZ`,_.rotation.y=s,_.userData.ry0=s,_.rotation.x=-Math.PI/2,_.position.set(i,o+.02,a),_.renderOrder=2,_},y=e.theme.dark(),b=(t,r,i,o)=>{if(!a)return[];let s=a.parse(r),c=s.xml.viewBox&&s.xml.viewBox.baseVal,l=s.paths.map(t=>{let r=e.three.SVGLoader.createShapes(t);if(!r.length)return null;let i=new n.ShapeGeometry(r,12);return i.computeBoundingBox(),{p:t,g:i}}).filter(Boolean),u=l.length?l.reduce((e,t)=>e.union(t.g.boundingBox),new n.Box3):new n.Box3(new n.Vector3(c&&c.x||0,c&&c.y||0,0),new n.Vector3((c&&c.x||0)+(c&&c.width||60),(c&&c.y||0)+(c&&c.height||60),0)),d=Math.max(1e-6,u.max.x-u.min.x),f=Math.max(1e-6,u.max.y-u.min.y),p=_(i,d/f,o),m=p.h/f,h=[],g=y&&s.paths.every(t=>e.theme.monoSvg(`#`+t.color.getHexString()))&&s.paths.some(e=>e.color.r+e.color.g+e.color.b<1.8);return l.forEach(({p:r,g:a},o)=>{a.translate(-u.min.x-d/2,-u.min.y-f/2,0),a.scale(m,m,1),a.rotateX(Math.PI/2),p.ry&&a.rotateY(p.ry),a.translate(0,i.top+.012+o*.006,0);let s=new n.Mesh(a,e.three.fade(new n.MeshBasicMaterial({color:g?new n.Color(e.theme.invert(`#`+r.color.getHexString())):r.color,side:n.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-1-o,polygonOffsetUnits:-1-o}),t));s.position.set(p.x,i.top,p.z),a.translate(0,-i.top,0),s.userData.ry0=p.ry,s.userData.h=p.h,s.userData.w=p.h*d/f,s.renderOrder=1,h.push(s)}),h},x={},S={},C=e=>x[e]=x[e]||new Promise((t,n)=>{let r=new Image;r.onload=()=>t(S[e]=r),r.onerror=n,r.src=/^(data:|blob:|https?:)/.test(e)?e:`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e)}),w=(e,t)=>{try{let n=e.getImageData(0,0,t.width,t.height).data,r=0,i=0;for(let e=0;e<n.length;e+=64)n[e+3]>32&&(r++,i+=n[e]+n[e+1]+n[e+2]);return r>0&&i/r>600}catch{return!1}},T=e=>{let t;try{t=e.getContext(`2d`).getImageData(0,0,e.width,e.height).data}catch{return e}let n=e.width,r=e.height,i=-1,a=-1;for(let o=0;o<e.height;o++)for(let s=0;s<e.width;s++)t[(o*e.width+s)*4+3]>8&&(s<n&&(n=s),s>i&&(i=s),o<r&&(r=o),o>a&&(a=o));if(i<0||n===0&&r===0&&i===e.width-1&&a===e.height-1)return e;let o=document.createElement(`canvas`);return n=Math.max(0,n-2),r=Math.max(0,r-2),i=Math.min(e.width-1,i+2),a=Math.min(e.height-1,a+2),o.width=i-n+1,o.height=a-r+1,o.getContext(`2d`).drawImage(e,n,r,o.width,o.height,0,0,o.width,o.height),o},E=(t,i,a,o)=>{let s=(i.naturalWidth||1)/(i.naturalHeight||1),c=1024,l=document.createElement(`canvas`);l.width=s>=1?c:Math.max(8,Math.round(c*s)),l.height=s>=1?Math.max(8,Math.round(c/s)):c;let u=l.getContext(`2d`);u.drawImage(i,0,0,l.width,l.height),y&&e.theme.monoImage(i)&&!w(u,l)&&(u.clearRect(0,0,l.width,l.height),u.filter=`invert(1) hue-rotate(180deg)`,u.drawImage(i,0,0,l.width,l.height));let d=T(l),f=d.width/d.height,p=new n.CanvasTexture(d);p.colorSpace=n.SRGBColorSpace,p.anisotropy=r.capabilities.getMaxAnisotropy();let m=_(a,f,o),h=new n.PlaneGeometry(f*m.h,m.h);h.rotateX(-Math.PI/2),m.ry&&h.rotateY(m.ry);let g=new n.MeshBasicMaterial({map:p,transparent:!0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3,opacity:.999});e.three.fade(g,t);let v=new n.Mesh(h,g);return v.position.set(m.x,a.top+.015,m.z),v.userData.ry0=m.ry,v.userData.h=m.h,v.userData.w=f*m.h,v.renderOrder=1,[v]},D=e=>{e&&[e.label,...e.logo||[]].forEach(e=>{e&&(e.parent&&e.parent.remove(e),e.geometry.dispose(),e.material.map&&e.material.map.dispose(),e.material.dispose())})},O=n=>{let r=s[n.id];D(r),delete s[n.id];let i=e.three.unit(n.id);if(!i||n.hidden)return;let a=i.group,o=s[n.id]={u:n,label:null,logo:null,lo:r?r.lo:0,logoLo:r?r.logoLo:0,fs:0},c=!!t.setting(`logo`),l=p(n);if(j(n.id))return;n.logo&&c&&(n.logo.svg?o.logo=b(n.level,n.logo.svg,n,l):S[n.logo.image]?o.logo=E(n.level,S[n.logo.image],n,l):(e.three.loading||(e=>e))(C(n.logo.image).then(e=>{s[n.id]===o&&(o.logo=E(n.level,e,n,l),o.logo.forEach(e=>a.add(e)))}).catch(()=>{}))),o.logo&&o.logo.forEach(e=>a.add(e));let u=n.logo&&c,d=String(n.labelText??n.name??``),f=n.kind===`amenity`?n.text:t.setting(`uppercase`)===!1?d:d.toUpperCase();if(f&&!u&&n.label!==!1&&!(n.kind===`amenity`&&M())){let e=g(n,f,l),t=n.labelScale||1;o.fs=e.fs*t,o.label=v(e.txt,o.fs,e.centerX+l.dx,e.centerZ+l.dz,n.top,e.ry-(n.labelRotation||0)*Math.PI/180),a.add(o.label)}},k=()=>{d=null,e.data.units().forEach(O)},A=t=>{d=null;let n={};e.data.units().forEach(e=>n[e.id]=e),t.forEach(e=>{n[e]?O(n[e]):(D(s[e]),delete s[e])})},j=t=>{try{return e.plugin(`markers`).covers(t)===!0}catch{return!1}},M=()=>{let t=e.plugin(`markers`);return t.enabled()&&!!t.setting(`amenities`)},N=()=>JSON.stringify([`logo`,`text_fill`,`text_height`,`text_max`,`logo_fill`,`logo_max`,`uppercase`,`snap`,`wrap`,`wrap_gain`].map(e=>t.setting(e)).concat([M(),e.plugin(`markers`).enabled()])),P=0,F=N();return k(),e.provide({refresh:e=>A(e||[]),of:e=>{let t=s[e];return t?{label:t.label,logos:(t.logo||[]).slice()}:null}}),e.on(`units`,e=>A(e.ids||[])),e.on(`scheme`,()=>{let t=e.theme.dark();t!==y&&(y=t,e.data.units().forEach(e=>e.logo&&O(e)))}),e.on(`camera`,e=>{P=-e.rotation*Math.PI/180}),e.on(`plugin`,()=>{let e=N();e!==F&&(F=e,k())}),e.onFrame(n=>{let r=e.getState(),a=e.ui.env().reducedMotion?1:1-Math.exp(-n*15),c=!!t.setting(`name`),l=!!t.setting(`logo`),u=+t.setting(`min_px`)||0,d=+t.setting(`logo_min_px`)||0,f=e.ui.size().height/(2*Math.tan(i.fov*Math.PI/360));for(let t in s){let n=s[t],p=n.u,m=r.allLevels||p.level===r.level,h=e.three.levelOpacity(p.level),g=t===r.selected||t===r.routeFrom||t===r.routeTo;if(n.logo&&n.logo.length){n.logo[0].getWorldPosition(o);let e=n.logo[0].userData,t=Math.sqrt((e.h||0)*(e.w||e.h||0))*f/i.position.distanceTo(o);n.logoLo+=((m&&l&&(g||t>=d)?1:0)-n.logoLo)*a;let r=n.logo[0]&&n.logo[0].userData.ry0||0,s=Math.cos(P-r);s<-.2?n.lfl=!0:s>.2&&(n.lfl=!1),n.logo.forEach(e=>{let t=e.material.userData.o0??1;e.material.opacity=t*h*n.logoLo,e.material.transparent=t<1||h<.999||n.logoLo<.999,e.visible=n.logoLo*h>.01,e.rotation.y=n.lfl?Math.PI:0})}let _=n.label;if(!_)continue;let v=_.userData,y=Math.cos(P-v.ry0);y<-.2?v.fl=!0:y>.2&&(v.fl=!1),_.rotation.y=v.ry0+(v.fl?Math.PI:0);let b=e.three.ink(t);b&&_.material.color.copy(b),_.getWorldPosition(o);let x=n.fs*f/i.position.distanceTo(o);n.lo+=((m&&(g||c&&x>=u)?1:0)-n.lo)*a,_.material.opacity=n.lo*h,_.visible=n.lo*h>.01}}),()=>{for(let e in s)D(s[e])}}),MapplicMap.plugin(`scenery`,e=>{let t=e.three.THREE,n=e.three.renderer,r=e.plugin(`scenery`),i=e.data.groundLevel?e.data.groundLevel():0,a=e.three.add(new t.Group,i),o={sceneryFeatures:e.data.scenery()},s=e.data.models(),c=s.find(e=>e.id===`car`),l=e.theme.palette(),u=(t,n)=>/^theme:/.test(t)?t:e.theme.color(t,n),d=t=>e.theme.resolve(t),f=(t,n)=>e.theme.tag(t,n),{rect:p,rnd:m,V:h,Nz:g,fillet:_,thick:v,routeOf:y,at:b,dashes:x,fp2:S,rr:C,shp:w,ext:T,lam:E,CP:D,reg:O,mesh:k,edges:A,flat:j,BX:M,put:N,inst:P}=e.three.kit(a),F=[],I=[],ee=[],L=[],R=null,z=[],te=[];{let n=e.data.site();if(n&&e.data.scenery().length){let r=k(i,T(n.outline,-.6,0),E(e.theme.color(null,`ground.0`)));A(i,r.geometry,e.theme.color(null,`ground.1`),r);let o=n.shadow||0;if(o>0){let e=n.outline,r=e.map(e=>e[0]),i=e.map(e=>e[1]),s=Math.min(...r)-18,c=Math.max(...r)+18,l=Math.min(...i)-18,u=Math.max(...i)+18,d=512/Math.max(c-s,u-l),f=document.createElement(`canvas`);f.width=Math.ceil((c-s)*d),f.height=Math.ceil((u-l)*d);let p=f.getContext(`2d`);p.fillStyle=`#000`,p.fillRect(0,0,f.width,f.height),p.filter=`blur(`+Math.round(9*d)+`px)`,p.fillStyle=`#fff`,p.beginPath(),e.forEach((e,t)=>p[t?`lineTo`:`moveTo`]((e[0]-s)*d,(e[1]-l)*d)),p.closePath(),p.fill();let m=new t.CanvasTexture(f),h=new t.Mesh(new t.PlaneGeometry(c-s,u-l),new t.MeshBasicMaterial({color:1579035,alphaMap:m,transparent:!0,opacity:Math.min(1,o),depthWrite:!1}));h.rotation.x=-Math.PI/2,h.position.set((s+c)/2+2,-7,(l+u)/2+3),h.renderOrder=-1,a.add(h)}}}let B=o.sceneryFeatures,V=e=>B.filter(t=>t.kind===e),H=e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]};[[`grass`,u(`#e6f0e8`),.004],[`parking`,u(`#eaeaec`),.008],[`sidewalk`,u(`#ffffff`),.008],[`planter`,u(`#e1eee4`),.014],[`sand`,u(`#efebe1`),.01],[`water`,u(`#c9e0ea`),.017]].forEach(([e,t,n])=>{[!1,!0].forEach(r=>{let i=V(e).filter(e=>!!e.recede===r);if(!i.length)return;let a=j(0,i.map(e=>e.poly),n,t);r&&a&&(a.userData.recede=!0)})});let ne=V(`road`).map(e=>({f:e,P:e.radius?_(e.line,e.radius):e.line}));ne.length&&j(0,ne.map(e=>v(e.P,e.f.width+2*(e.f.verge||0))),.012,u(`#ffffff`),!0);let re=ne.map(e=>v(e.P,e.f.width));V(`driveway`).forEach(e=>{let[t,n]=e.line,r=g(h(t,n)),i=[-r[1],r[0]],a=e.width/2,o=[t[0]-r[0],t[1]-r[1]];re.push([[o[0]+i[0]*a,o[1]+i[1]*a],[n[0]+i[0]*a,n[1]+i[1]*a],[n[0]-i[0]*a,n[1]-i[1]*a],[o[0]-i[0]*a,o[1]-i[1]*a]]),e.curb&&[1,-1].forEach(n=>re.push(S([t[0]+i[0]*a*n,t[1]+i[1]*a*n],[i[0]*n,i[1]*n],r,e.curb)))}),re.length&&j(i,re,.02,u(`#dedee2`),!0);let ie=e=>{if(!e.f.label_at)return null;let t=e.f.label_at,n=null;e.P.forEach(e=>{let r=Math.hypot(e[0]-t[0],e[1]-t[1]);(!n||r<n.d)&&(n={d:r,p:e})});let r=y(e.P),i=0,a=1e9;for(let e=0;e<=400;e++){let n=b(r,r.L*e/400),o=Math.hypot(n.p[0]-t[0],n.p[1]-t[1]);o<a&&(a=o,i=r.L*e/400)}return{s:i,p:b(r,i).p}},ae=ne.filter(e=>e.f.markings).flatMap(e=>{let t=e.f.name&&ie(e),n=t?(e.f.label_size||1.2)*String(e.f.name).length*.36+3:0;return x(y(e.P),e.f.markings.dash,e.f.markings.gap,e.f.markings.width).filter(e=>!t||Math.hypot(e[0][0]-t.p[0],e[0][1]-t.p[1])>n)});ae.length&&j(i,ae,.028,u(`#ffffff`,`line`),!0);{let e=ne.flatMap(e=>[e.P[0],e.P[e.P.length-1]]);ne.forEach((r,a)=>{if(!r.f.name)return;let o=r.P,s=y(o);b(s,s.L/2).t[0]<0&&(o=o.slice().reverse());let c=y(o),l=String(r.f.name).toUpperCase(),d=document.createElement(`canvas`),p=d.getContext(`2d`),m=()=>{p.font=`600 96px Onest, sans-serif`,p.letterSpacing=`11.52px`};m();let h=Math.ceil(p.measureText(l).width)+48;d.width=h,d.height=120,p.fillStyle=`#000`,p.fillRect(0,0,h,120),m(),p.fillStyle=`#fff`,p.textAlign=`center`,p.textBaseline=`middle`,p.fillText(l,h/2,64.8);let g=new t.CanvasTexture(d);g.anisotropy=n.capabilities.getMaxAnisotropy();let _=r.f.label_size||Math.min(1.32,r.f.width*.192),v=_*h/120,x=r.f.label_size&&r.f.label_size>r.f.width*.3?0:r.f.width/4,S=new t.MeshBasicMaterial({alphaMap:g,transparent:!0,opacity:.85,depthWrite:!1,side:t.DoubleSide,clippingPlanes:D,alphaTest:.02,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});S.userData.o0=.85,f(S,u(`#ffffff`,`label`));let C=ie({f:r.f,P:o}),w=C?[C.s-v/2]:null;for(let n=w?w[0]:22;w?n===w[0]:n+v<c.L-22;n+=Math.max(70,v+40)){let a=b(c,n+v/2).p;if(!w&&e.some(e=>e!==o[0]&&e!==o[o.length-1]&&Math.hypot(e[0]-a[0],e[1]-a[1])<v/2+r.f.width))continue;let s=[],l=[],u=[];for(let e=0;e<=24;e++){let t=b(c,n+v*e/24),r=[-t.t[1],t.t[0]],i=[t.p[0]-r[0]*x,t.p[1]-r[1]*x];if(s.push(i[0]-r[0]*_/2,.034,i[1]-r[1]*_/2,i[0]+r[0]*_/2,.034,i[1]+r[1]*_/2),l.push(e/24,1,e/24,0),e<24){let t=2*e;u.push(t,t+1,t+2,t+1,t+3,t+2)}}let d=new t.BufferGeometry;d.setAttribute(`position`,new t.Float32BufferAttribute(s,3)),d.setAttribute(`uv`,new t.Float32BufferAttribute(l,2)),d.setIndex(u);let f=k(i,d,S);f.renderOrder=1}})}let oe=[`#ffffff`,`#fafafa`,`#f1f1f3`,`#e9e9ec`,`#d4d4d8`].map(e=>u(e));oe.map(e=>E(e));let se=T(C(-.45,.45,-1.05,1.05,.24),.03,.34),U=Math.PI/180,ce=Object.fromEntries(s.map(e=>[e.id,e])),le=e=>ce[e]||(e===`car`?c:null),ue={},de={};F=[];let fe=(e,n,r)=>{let i=e+(n?`c`:``)+(r?`b`:``);return ue[i]=ue[i]||O(0,r?f(new t.MeshBasicMaterial(Object.assign({},n||{})),e):E(e,Object.assign({flatShading:!0},n||{})))},pe=(e,n)=>{let r=e+n;if(de[r])return de[r];let i;return i=e===`box`?new t.BoxGeometry(1,1,1):e===`cylinder`?new t.CylinderGeometry(.5,.5,1,n):e===`cone`?new t.ConeGeometry(.5,1,n):e===`pyramid`?new t.ConeGeometry(.5,1,4):new t.IcosahedronGeometry(.5,+(n>8)),i.translate(0,.5,0),de[r]=i},me=e=>{let t=e.size||[1,1,1];if(e.shape!==`roundbox`)return[pe(e.shape||`box`,ge(e)),t];let n=Math.max(0,Math.min(+e.radius||.2,t[0]/2-.001,t[2]/2-.001)),r=`rb`+t.join(`,`)+`,`+n;return[de[r]=de[r]||T(C(-t[0]/2,t[0]/2,-t[2]/2,t[2]/2,n),0,t[1]),[1,1,1]]},he=(e,t)=>u(e.color===`paint`?t||`#e4e4e7`:e.color||`#e4e4e7`),ge=e=>Math.max(3,Math.min(16,e.segments||8)),_e=(()=>{let e=document.createElement(`canvas`);e.width=e.height=64;let n=e.getContext(`2d`),r=n.createRadialGradient(32,32,0,32,32,32);return r.addColorStop(0,`rgba(255,255,255,1)`),r.addColorStop(.3,`rgba(255,255,255,0.4)`),r.addColorStop(1,`rgba(255,255,255,0)`),n.fillStyle=r,n.fillRect(0,0,64,64),new t.CanvasTexture(e)})(),ve=[],ye=()=>{let t=e.theme.dark();ve.forEach(e=>{e.m.material=t?e.lit:e.day,e.m.castShadow=e.m.receiveShadow=!t,e.fx.forEach(e=>e.visible=t)})};e.on(`scheme`,ye);let be=null,xe=null,W=()=>{if(xe)return xe;let e=document.createElement(`canvas`);e.width=e.height=128;let n=e.getContext(`2d`),r=n.createImageData(128,128);for(let e=0;e<128;e++)for(let t=0;t<128;t++){let n=Math.min(1,Math.hypot(t+.5-64,e+.5-64)/64),i=1-n*n,a=Math.exp(-n*n*2.6)*i*i,o=(e*128+t)*4;r.data[o]=r.data[o+1]=r.data[o+2]=Math.round(a*255),r.data[o+3]=255}return n.putImageData(r,0,0),xe=new t.CanvasTexture(e)},G=()=>{if(be)return be;let e=document.createElement(`canvas`);e.width=e.height=64;let n=e.getContext(`2d`),r=n.createImageData(64,64);for(let e=0;e<64;e++)for(let t=0;t<64;t++){let n=(t+.5)/64,i=1-(e+.5)/64,a=(1-i)**1.6*Math.sin(Math.PI*n)**.7*Math.min(1,i*8+.35),o=(e*64+t)*4;r.data[o]=r.data[o+1]=r.data[o+2]=Math.round(a*255),r.data[o+3]=255}return n.putImageData(r,0,0),be=new t.CanvasTexture(e)},Se=(e,n,r,i,a,o)=>{let s=e.night===!0?{}:e.night,c=/^#[0-9a-f]{6}$/i.test(s.color||``)?s.color:`#ffe2b0`,l=s.halo==null?1:Math.max(0,Math.min(1,+s.halo||0)),u=Math.max(0,+s.pool||0),d=s.pool_strength==null?.3:Math.max(0,Math.min(1,+s.pool_strength||0)),f=(e,t,n)=>(O(0,t),t.userData.o0=n,e.visible=!1,e.renderOrder=2,p.push(e),e),p=[];if(l){let e=new t.SpriteMaterial(Object.assign({map:_e,color:c,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:.9*l},o||{})),n=f(new t.Sprite(e),e,.9*l),r=Math.max(a[0],a[1],a[2])*4+1.6*l;n.scale.set(r,r,1),n.position.y=a[1]/2,i.add(n)}if(u){let n=e.at||[0,0,0],i=new t.MeshBasicMaterial(Object.assign({map:W(),color:c,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:d,polygonOffset:!0,polygonOffsetFactor:-4,polygonOffsetUnits:-4},o||{})),a=f(new t.Mesh(new t.PlaneGeometry(u*2,u*2),i),i,d),l=Array.isArray(s.pool_at)?s.pool_at:[n[0],n[2]];a.rotation.x=-Math.PI/2,a.position.set(+l[0]||0,.12,+l[1]||0),r.add(a)}if(s.beam){let n=s.beam===!0?{}:s.beam,i=Math.max(.5,+n.length||8),a=Math.max(5,Math.min(170,+n.spread||45))*Math.PI/180,l=n.strength==null?.3:Math.max(0,Math.min(1,+n.strength||0)),u=Math.max(0,+n.width||1.2),d=Array.isArray(n.at)?n.at:[(e.at||[0])[0],(e.at||[0,0,0])[2]],p=[],m=[],h=[];for(let e=0;e<=12;e++){let t=e/12,n=-a/2+a*t;p.push(u*(t-.5),0,0,Math.sin(n)*i,0,Math.cos(n)*i),m.push(t,0,t,1),e<12&&h.push(2*e,2*e+1,2*e+2,2*e+1,2*e+3,2*e+2)}let g=new t.BufferGeometry;g.setAttribute(`position`,new t.Float32BufferAttribute(p,3)),g.setAttribute(`uv`,new t.Float32BufferAttribute(m,2)),g.setIndex(h);let _=new t.MeshBasicMaterial(Object.assign({map:G(),color:c,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:l,side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-4,polygonOffsetUnits:-4},o||{})),v=f(new t.Mesh(g,_),_,l);v.position.set(+d[0]||0,.12,+d[1]||0),r.add(v)}ve.push({m:n,day:n.material,lit:O(0,new t.MeshBasicMaterial(Object.assign({color:c},o||{}))),fx:p})},Ce=(e,r)=>{let i=new t.Group,a=[],o=r&&r.clip?{clippingPlanes:D,clipShadows:!0}:null;return(e.parts||[]).slice(0,40).forEach(e=>{let s=new t.Group,c=e.at||[0,0,0],l=e.size||[1,1,1],u=e.rotate||[0,0,0],d=he(e,r&&r.paint),p=e.glow?Math.min(1,Math.max(.1,+e.glow||1)):0;if(e.shape===`text`){let r=String(e.text||``),a=document.createElement(`canvas`),p=a.getContext(`2d`),m=()=>{p.font=(e.weight||600)+` 128px Onest, sans-serif`,p.letterSpacing=(e.tracking??.04)*128+`px`};m();let h=Math.ceil(p.measureText(r).width)+32;a.width=h,a.height=167,m(),p.fillStyle=`#000`,p.fillRect(0,0,h,167),m(),p.fillStyle=`#fff`,p.textAlign=`center`,p.textBaseline=`middle`,p.fillText(r,h/2,88.62);let g=new t.CanvasTexture(a);g.anisotropy=n.capabilities.getMaxAnisotropy();let _=l[1]*1.3,v=_*h/167;l[0]&&v>l[0]&&(v=l[0],_=v*167/h);let y=new t.Mesh(new t.PlaneGeometry(v,_),new t.MeshBasicMaterial(Object.assign({alphaMap:g,transparent:!0,opacity:.95,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2},o||{})));f(y.material,d),s.position.set(c[0],c[1],c[2]),y.rotation.set(u[0]*U,u[1]*U,u[2]*U),s.add(y),i.add(s);return}let[m,h]=me(e),g=new t.Mesh(m,fe(d,o,!!p));if(e.night&&Se(e,g,i,s,l,o),s.position.set(c[0],c[1],c[2]),g.scale.set(h[0],h[1],h[2]),g.rotation.set(u[0]*U,u[1]*U,u[2]*U),g.castShadow=!p,g.receiveShadow=!p,s.add(g),p){let e=O(0,new t.SpriteMaterial(Object.assign({map:_e,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:.85*p},o||{})));e.userData.o0=.85*p,f(e,d);let n=new t.Sprite(e),r=Math.max(l[0],l[1],l[2])*3+1.4*p;n.scale.set(r,r,1),n.position.y=l[1]/2,s.add(n)}i.add(s),e.anim&&a.push({o:s,a:e.anim,u:1,p0:s.position.clone(),r0:s.rotation.clone(),s0:s.scale.clone()})}),{root:i,an:a}},K=[],we=[],Te=[],Ee=(e,t,n,r)=>we.push(p(e,t,n,r));V(`parking_row`).forEach((e,t)=>{let[n,r,i,a]=H(e.poly),o=r-n>=a-i,s=e.stall_width,c=Math.round((o?r-n:a-i)/s),l=(e,t,n,r)=>o?p(e,t,n,r):p(n,r,e,t),u=o?n:i,d=o?i:n,f=o?a:r;for(let n=0;n<c;n++){let r=u+n*s,i=!!e.ev&&n>=e.ev[0]&&n<=e.ev[1],a=r+s/2,c=(d+f)/2;if(i&&Te.push(l(r,r+s,d,f)),e.vehicle!==`bike`&&m(t+1.7,n+3.1)<e.occ*(i?.83:1)){let r=Math.floor(m(n*1.3,t*7.7)*oe.length);K.push({md:e.model||`car`,pos:o?[a,0,c]:[c,0,a],ry:o?0:Math.PI/2,pi:r})}}for(let e=0;e<=c;e++){let t=u+e*s;we.push(l(t-.05,t+.05,d,f))}e.edge===`north`&&Ee(n,r,i,i+.1),e.edge===`south`&&Ee(n,r,a-.05,a+.05)}),Te.length&&j(i,Te,.012,u(`#dcefe0`)),we.length&&j(i,we,.016,u(`#ffffff`,`line`));let De=[`#cfe5d6`,`#bddbc7`,`#dbece0`].map(e=>E(u(e),{flatShading:!0})),Oe=E(u(`#d4d4d8`)),ke=new t.IcosahedronGeometry(1,0),Ae=new t.ConeGeometry(1,1,6),je=new t.CylinderGeometry(.06,.08,1,5);Ae.translate(0,.5,0),je.translate(0,.5,0);let Me=(e,t,n,r)=>{let i=Math.floor(m(t*2.1,e*1.7)*3),a=m(e,t)*6.28;if(r===`cone`)N(`tk`,je,Oe,[e,0,t],[1,.4*n,1]),N(`cn`+i,Ae,De[i],[e,.3*n,t],[.34*n,1.35*n,.34*n],a);else if(r===`cluster`){let r=.72*n,o=.4*n;N(`tk`,je,Oe,[e,0,t],[1,r,1]),[[0,.06,1],[1,-.08,.8],[1,-.1,.72]].forEach(([s,c,l],u)=>{let d=a+u*2.3,f=(i+u)%3;N(`ic`+f,ke,De[f],[e+Math.cos(d)*o*.75*s,r+c*n,t+Math.sin(d)*o*.75*s],[o*l,o*l*.9,o*l],d)})}else{let r=.82*n,o=.48*n;N(`tk`,je,Oe,[e,0,t],[1,r,1]),N(`ic`+i,ke,De[i],[e,r,t],[o,o*.92,o],a)}};V(`tree`).forEach(e=>Me(e.pt[0],e.pt[1],e.scale||1.45,e.variant||`round`)),I=[],ee=[],Object.keys(P).forEach(e=>{let{geo:n,mat:r,ms:i}=P[e],o=new t.InstancedMesh(n,O(0,r),i.length);i.forEach((e,t)=>o.setMatrixAt(t,e)),o.castShadow=!0,o.receiveShadow=!0,a.add(o),e.startsWith(`car`)&&I.push(o),(e===`tk`||/^(cn|ic)\d$/.test(e))&&ee.push(o)});{let e={};K.forEach(t=>(e[t.md]=e[t.md]||[]).push(t)),Object.entries(e).forEach(([e,n])=>{let r=le(e);r&&(r.parts||[]).slice(0,40).forEach(e=>{let r=e.at||[0,0,0];e.size;let i=e.rotate||[0,0,0],[o,s]=me(e),c=new t.Matrix4().makeTranslation(r[0],r[1],r[2]).multiply(new t.Matrix4().compose(new t.Vector3,new t.Quaternion().setFromEuler(new t.Euler(i[0]*U,i[1]*U,i[2]*U)),new t.Vector3(s[0],s[1],s[2]))),l={};n.forEach(t=>{let n=he(e,oe[t.pi]);(l[n]=l[n]||[]).push(t)}),Object.entries(l).forEach(([e,n])=>{let r=new t.InstancedMesh(o,fe(e),n.length);n.forEach((e,n)=>r.setMatrixAt(n,new t.Matrix4().compose(new t.Vector3(...e.pos),new t.Quaternion().setFromEuler(new t.Euler(0,e.ry,0)),new t.Vector3(.5,.5,.5)).multiply(c))),r.castShadow=!0,r.receiveShadow=!0,a.add(r),I.push(r)})})})}V(`building`).forEach(t=>{let n=M(t.poly,0,t.height||9*e.geo.metres(1),u(`#f4f4f5`),u(`#d4d4d8`,`edge`));t.recede&&n&&n.traverse(e=>e.userData.recede=!0)}),V(`bench`).forEach(e=>{let[t,n,r,i]=H(e.poly);M(C(t,n,r,i,.3),.03,e.height||.42,u(`#ffffff`))}),L=[],V(`bus_stop`).forEach((e,t)=>{let[n,r,a,o]=H(e.poly),s=e.height||.5,c=`scn-`+(e.location||`bus-`+t),l={id:c,loc:e.location,mats:[],lines:[],pos:[(n+r)/2,s+.06,(a+o)/2]};[[p(n+.1,r-.1,a+.1,a+.25),0,s],[p(n,r,a,o),s,s+.06]].forEach(([e,t,n])=>{let r=E(u(`#fafafa`)),a=k(i,T(e,t,n),r,!0),o=A(i,a.geometry,u(`#a1a1aa`,`edge`),a);a.userData.scn=c,l.mats.push(r),l.lines.push(o.material)}),L.push(l)});let Ne=()=>({n:[new t.Color(d(u(`#fafafa`))),new t.Color(d(u(`#a1a1aa`,`edge`)))],h:[new t.Color(d(u(`#3f3f46`))),new t.Color(d(u(`#27272a`)))]});R=Ne(),e.on(`scheme`,()=>R=Ne()),V(`canopy`).forEach(e=>{let t=e.height||1.5;(e.posts||[]).forEach(e=>M(p(e[0]-.2,e[0]+.2,e[1]-.2,e[1]+.2),0,t,u(`#ffffff`),u(`#d4d4d8`,`edge`))),M(e.poly,t,t+.15,u(`#ffffff`),u(`#d4d4d8`,`edge`))}),V(`charger`).forEach(e=>M(p(e.pt[0]-.16,e.pt[0]+.16,e.pt[1]-.16,e.pt[1]+.16),0,.45,u(`#ffffff`),u(`#a1a1aa`,`edge`))),V(`model`).forEach(e=>{let t=le(e.model);if(!t||!e.pt)return;let n=Ce(t),r=n.root;r.position.set(e.pt[0],0,e.pt[1]),r.rotation.y=(e.rot||0)*U,r.scale.setScalar((e.scale||1)/2),a.add(r),F.push(...n.an);let i=e.anim||t.anim;i&&F.push({o:r,a:i,u:.5,rt:i.type===`path`&&i.pts&&i.pts.length>1?y(i.loop===!1?i.pts:i.pts.concat([i.pts[0]])):null,p0:r.position.clone(),r0:r.rotation.clone(),s0:r.scale.clone()})});let Pe=V(`lane`);z=Pe.map(e=>y(e.radius?_(e.line,e.radius):e.line)),te=Pe.flatMap((e,t)=>{let n=e.traffic||{cars:0,speed:10};return Array.from({length:n.cars},(e,r)=>({r:t,s0:(r/n.cars+m(t+.3,r+.7)*.2)%1,v:n.speed*(.92+m(r+.1,t+.9)*.16),pi:Math.floor(m(t*3.1,r*5.3)*oe.length)}))}).map(({r:e,s0:n,v:r,pi:i})=>{let o=le(Pe[e].model||`car`),s;if(o){let e=Ce(o,{paint:oe[i],clip:!0});s=e.root,s.scale.setScalar(.5),F.push(...e.an)}else s=new t.Mesh(se,E(oe[i],{clippingPlanes:D,clipShadows:!0})),s.castShadow=!0,s.receiveShadow=!0;return a.add(s),{r:e,s0:n,v:r,m:s}}),L.forEach(t=>{let n=()=>e.data.location(t.loc)||{};e.view.feature(t.id,{kind:`bus_stop`,anchor:()=>[t.pos[0],e.three.levelY(i)+t.pos[1],t.pos[2]],tip:()=>{let t=n();return(t.mapplic||{}).tooltip===!1?null:{text:t.name||e.ui.t(`bus_stop`)}},info:()=>{let t=n();return{name:t.name||e.ui.t(`bus_stop`),description:t.description||``,departures:((t.data||{}).departures||[]).map(e=>({line:e.line,to:e.to,minutes:e.min}))}}})});let Fe=()=>{let n=e.three.kit(),i=n.lam,a=e.data.connectors(),o=e.data.levels().length,s=e.three.floorTop??.3,c=e.three.storey,d=[],p=[],m=[],h={},g=[],_=l.lift.map(e=>new t.Color(e)),v={n:l.escalator.map(e=>new t.Color(e)),h:l.escalatorActive.map(e=>new t.Color(e))};e.on(`scheme`,()=>{let t=e.theme.palette();_.forEach((e,n)=>e.set(t.lift[n])),v.n.forEach((e,n)=>e.set(t.escalator[n])),v.h.forEach((e,n)=>e.set(t.escalatorActive[n]))});let y=t=>(e.three.add(t),p.push(t),t),b=null,x=null,S=0;for(let r=0;r<o;r++)if(a.filter(e=>e.type===`elevator`).forEach((e,a)=>{if(!e.layers.includes(r))return;let o=new t.BoxGeometry(1,1,1);o.translate(0,.5,0);let c=i(u(`#fafafa`),{transparent:!0,opacity:.55,depthWrite:!1});c.userData.o0=.55;let l=n.mesh(r,o,c,!1);p.push(l),l.position.set(e.centerX,s,e.centerZ),l.rotation.y=-Math.atan2(e.axisZ,e.axisX),l.scale.set(e.length,2,e.width),n.edges(r,o,u(`#a1a1aa`,`edge`),l),l.userData.feat=`lift-`+a,l.userData.levelIndex=r,(g[a]=g[a]||[])[r]=l}),r<o-1&&a.filter(e=>e.type===`stairs`&&e.layers[0]===r).forEach(n=>{let a=e.geo.stair(n),o=new t.Group;o.matrixAutoUpdate=!1,y(o);let s=i(u(`#e4e4e7`)),c=i(u(`#ffffff`)),l=f(new t.LineBasicMaterial,u(`#d4d4d8`,`edge`)),d=new t.MeshDepthMaterial({alphaHash:!0}),p=new t.BoxGeometry(1,1,1),g=new t.EdgesGeometry(p),_=[],v=`esc-`+n.id,b=(e,n,i,a,u,f,m)=>{let h=new t.Mesh(p,[s,s,c,s,s,s]);h.position.set(e,(i+a)/2,n),h.scale.set(u,Math.max(.02,a-i),f),m&&(h.rotation.y=m),h.castShadow=!0,h.receiveShadow=!0,h.customDepthMaterial=d,h.userData.esc=v,h.userData.feat=v,h.userData.escLo=r,h.add(new t.LineSegments(g,l)),o.add(h),_.push(h)};if(a.spiral){let e=a.th1-a.th0,n=new t.Mesh(new t.CylinderGeometry(.1,.1,a.H,12),s);n.position.y=a.H/2,n.castShadow=!0,n.userData.esc=v,n.userData.feat=v,n.userData.escLo=r,o.add(n),_.push(n);for(let t=0;t<a.n;t++){let n=a.th0+e*(t+.5)/a.n,r=(t+1)*a.H/a.n;b(Math.cos(n)*a.R/2,Math.sin(n)*a.R/2,r-.08,r,a.R,Math.abs(e)/a.n*a.R*.75,-n)}}else a.F.forEach(e=>{let t=Math.max(3,Math.round((e.y1-e.y0)/.1)),n=e.d[1]===0;for(let r=0;r<t;r++){let i=(r+.5)*e.L/t,a=e.y0+(r+1)*(e.y1-e.y0)/t;b(e.o[0]+e.d[0]*i,e.o[1]+e.d[1]*i,Math.max(0,a-.5),a,n?e.L/t:e.w,n?e.w:e.L/t)}}),a.LD.forEach(e=>b(e.c[0],e.c[1],Math.max(0,e.y-.5),e.y,e.sa,e.sb));let x={id:v,sw:a,m:o,hit:_,stair:!0,mats:[s,c,l],dm:d,lo:r,down:!1,ux:n.axisX*n.upSign,uz:n.axisZ*n.upSign,length:n.length,width:n.width,centerX:n.centerX,centerZ:n.centerZ,op:1,tr:!1,yc:0};m.push(x),h[v]=x}),r<o-1&&a.filter(e=>e.type===`escalator`&&e.layers[0]===r).forEach(e=>{let n=i(u(`#e4e4e7`)),a=i(u(`#f4f4f5`)),o=new t.BoxGeometry(e.length,.22,e.width),s=f(new t.LineBasicMaterial,u(`#d4d4d8`,`edge`)),c=new t.MeshDepthMaterial({alphaHash:!0}),l=new t.Mesh(o,[n,n,a,n,n,n]);l.castShadow=!0,l.receiveShadow=!0,l.customDepthMaterial=c,l.matrixAutoUpdate=!1,y(l),l.add(new t.LineSegments(new t.EdgesGeometry(o,25),s));let d=i(u(`#ffffff`)),p=new t.BoxGeometry(1,1,1),g=new t.Group;g.matrixAutoUpdate=!1,y(g);let _=Math.max(4,Math.round(e.length*4)),v=new t.InstancedMesh(p,d,_+1);v.castShadow=!0,v.receiveShadow=!0,v.customDepthMaterial=c,v.frustumCulled=!1,v.instanceMatrix.setUsage(t.DynamicDrawUsage),g.add(v);let b=new t.EdgesGeometry(p).attributes.position.array,x=new t.BufferGeometry,S=new t.BufferAttribute(new Float32Array(b.length*(_+1)),3);S.setUsage(t.DynamicDrawUsage),x.setAttribute(`position`,S);let C=new t.LineSegments(x,s);C.frustumCulled=!1,g.add(C);let w={im:v,ev:b,la:S,lg:x,mx:new t.Matrix4},T=`esc-`+e.id,E={id:T,m:l,sg:g,sts:w,sn:_,up:e.dir!==`down`,mats:[n,a,s,d],dm:c,lo:r,down:e.dir===`down`,ux:e.axisX*e.upSign,uz:e.axisZ*e.upSign,length:e.length,width:e.width,centerX:e.centerX,centerZ:e.centerZ,op:1,tr:!1,yc:0};l.userData.esc=T,l.userData.feat=T,l.userData.escLo=r,m.push(E),h[T]=E}),r<o-1){let e=m.filter(e=>e.lo===r&&!e.stair),t=new Set,n=(e,t)=>{let n=t.centerX-e.centerX,r=t.centerZ-e.centerZ,i=Math.abs(n*e.ux+r*e.uz),a=Math.abs(-n*e.uz+r*e.ux);return Math.abs(e.ux*t.ux+e.uz*t.uz)>.98&&Math.abs(e.length-t.length)<=.1*Math.max(e.length,t.length)&&i<.25*e.length&&a-(e.width+t.width)/2<Math.min(e.width,t.width)};e.forEach(i=>{if(t.has(i))return;let a=[i];t.add(i);for(let r=0;r<a.length;r++)e.forEach(e=>{!t.has(e)&&n(a[r],e)&&(a.push(e),t.add(e))});let o=a.length>1?`escp-`+r+`-`+i.id:null;a.forEach(e=>{e.gid=o||e.id}),o&&(h[o]={pair:!0,lo:r,down:!1,mem:a})}),m.filter(e=>e.lo===r&&e.stair).forEach(e=>{e.gid=e.id})}let C=e=>{let t=[];if(!e.stair){let n=e.length/2,r=.11+c/e.length*e.length/(e.sn||8)+.03;for(let e=0;e<=12;e++)t.push([-n+2*n*e/12,r,0]);return t}let n=e.sw;if(!n)return null;if(n.spiral){let e=n.R*.6,r=n.n*2;for(let i=0;i<=r;i++){let a=i/r,o=n.th0+(n.th1-n.th0)*a;t.push([Math.cos(o)*e,n.H*a+n.H/n.n+.03,Math.sin(o)*e])}return t}return n.F.forEach((e,r)=>{let i=Math.max(3,Math.round((e.y1-e.y0)/.1)),a=(e.y1-e.y0)/i+.03;if(r&&n.LD[r-1]){let e=n.LD[r-1];t.push([e.c[0],e.y+.03,e.c[1]])}for(let n=0;n<=8;n++){let r=n/8;t.push([e.o[0]+e.d[0]*e.L*r,e.y0+(e.y1-e.y0)*r+a,e.o[1]+e.d[1]*e.L*r])}}),t},w=t=>{let n=e.getState();return n.allLevels?t.down?t.lo:t.lo+1:n.level===t.lo?t.lo+1:t.lo},T=t=>{let n=e.getState(),r=n.allLevels?t.down?t.lo+1:t.lo:n.level;return w(t)>r};Object.entries(h).forEach(([t,n])=>{let r=n.pair?n.mem:[n],i=e=>r.reduce((t,n)=>t+n[e],0)/r.length;d.push(e.view.feature(t,{kind:n.stair||n.pair&&n.mem[0].stair?`stairs`:`escalator`,lo:n.lo,x:i(`centerX`),z:i(`centerZ`),pick:()=>(e.view.setLevel(w(n)),!0),tip:()=>{let t=T(n);return{text:(e.data.levels()[w(n)]||{}).name||e.ui.t(t?`go_upstairs`:`go_downstairs`),up:t,down:!t}},anchor:()=>[i(`centerX`),Math.max(...r.map(e=>e.yc))+.2,i(`centerZ`)],meshes:n.pair?null:()=>n.m.visible&&n.op>.5?n.hit||[n.m]:[],resolve:()=>e.getState().allLevels?n.id:n.gid||n.id}))});let E=a.filter(e=>e.type===`elevator`);return g.forEach((t,n)=>{let r=`lift-`+n,i=E[n],a=()=>{let t=e.getState();return(t.selected===r?x:null)??b??t.level},o=(n,r)=>{let i=t[n];return i?[i.position.x,e.three.levelY(n)+s+i.scale.y*r,i.position.z]:null};d.push(e.view.feature(r,{kind:`elevator`,at:e=>{b=e},meshes:()=>t.filter((t,n)=>t&&t.visible&&t.parent&&t.parent.visible&&e.three.levelOpacity(n)>.5),resolve:e=>{let t=e.userData.levelIndex??(e.parent&&e.parent.userData.levelIndex);return typeof t==`number`&&(b=t),r},pick:()=>(x=b??e.getState().level,!1),info:()=>{let t=e.getState(),n=a();return{name:e.ui.t(`elevator`),level:t.allLevels?null:n,floors:e.data.levels().filter(e=>!i||i.layers.includes(e.index)).map(e=>({index:e.index,name:e.name,short:e.short}))}},anchor:()=>o(a(),1),focus:()=>o(b??e.getState().level,.5),tip:()=>({text:e.ui.t(`elevator`)})}))}),d.push(e.onFrame(t=>{let n=e.getState(),i=e.ui.env(),a=i.reducedMotion?1:1-Math.exp(-t*15),o=e.three.explode(),l=e.three.levelY,u=e.three.levelOpacity,d=e.three.rise();!i.reducedMotion&&r.setting(`connectorsMoving`)&&(S+=t),g.forEach(e=>{let t=[];e.forEach((e,n)=>{e&&t.push(n)}),t.forEach((n,r)=>{let i=t[r+1],a=i==null?c:Math.max(.6,Math.min(l(i)-l(n),d*(i-n)));e[n].scale.y=a-s})}),m.forEach(e=>{let t={y:l(e.lo),op:u(e.lo)},r={y:l(e.lo+1),op:u(e.lo+1)},i=c,d=i/e.length,f=e.down?t.y+i+(r.y-t.y-i)*o:t.y,p=t.op*(1-o)+(e.down?r.op:t.op)*o,m=f+s+(e.down?-i/2:i/2);if(e.yc=m,e.stair)e.m.matrix.makeRotationY(-Math.atan2(e.uz,e.ux)).setPosition(e.centerX,f+s,e.centerZ);else if(e.m.matrix.set(e.ux,0,-e.uz,e.centerX,d,1,0,m,e.uz,0,e.ux,e.centerZ,0,0,0,1),e.sg){e.sg.matrix.set(e.ux,0,-e.uz,e.centerX,0,1,0,m,e.uz,0,e.ux,e.centerZ,0,0,0,1),e.sg.matrixWorldNeedsUpdate=!0,e.sg.visible=p>.01&&!0;let t=S*1.4%1,n=e.up?t:1-t,r=e.length/e.sn,i=e.length/2,a=e.sts,o=a.ev,s=a.la.array,c=e.width*.86,l=0;for(let t=0;t<=e.sn;t++){let e=Math.max(-i,-i+(t-1+n)*r),u=Math.min(i,-i+(t+n)*r),f=u-e;if(f<=.01)continue;let p=d*u+.11,m=d*e+.06,h=(e+u)/2,g=(p+m)/2,_=Math.max(.01,f-.015),v=p-m;a.im.setMatrixAt(l,a.mx.makeScale(_,v,c).setPosition(h,g,0));let y=l*o.length;for(let e=0;e<o.length;e+=3)s[y+e]=o[e]*_+h,s[y+e+1]=o[e+1]*v+g,s[y+e+2]=o[e+2]*c;l++}a.im.count=l,a.im.instanceMatrix.needsUpdate=!0,a.la.needsUpdate=!0,a.lg.setDrawRange(0,l*o.length/3)}e.m.matrixWorldNeedsUpdate=!0,e.m.visible=p>.01&&!0;let h=p<.999,g=h&&(p<e.op-1e-4||p===e.op&&e.out);(h!==e.tr||g!==e.out)&&(e.tr=h,e.out=g,e.mats.forEach(e=>{e.transparent=h,e.depthWrite=!g,e.needsUpdate=!0}),[e.m,e.sg].forEach(e=>e&&e.traverse(e=>e.renderOrder=h?-10:0))),p!==e.op&&(e.op=p,e.dm.opacity=p,e.mats.forEach(e=>e.opacity=p));let _=v[n.hovered===e.id||n.hovered===e.gid?`h`:`n`];e.mats.forEach((e,t)=>e.color.lerp(_[t]||_[1],a))}),g.forEach((e,t)=>{let r=`lift-`+t;e.forEach((e,t)=>{let i=n.hovered===r&&t===(b??n.level)||n.selected===r&&t===(x??n.level);e&&e.material.color.lerp(_[+!!i],a)})})})),{get:e=>{let t=h[e];return t&&!t.pair?{mesh:t.m,path:C(t)}:null},off:()=>{d.forEach(e=>e());let e=new Set,t=new Set;p.forEach(n=>{n.parent&&n.parent.remove(n),n.traverse(n=>{n.geometry&&e.add(n.geometry),[].concat(n.material||[]).forEach(e=>t.add(e))})}),e.forEach(e=>e.dispose()),t.forEach(e=>e.dispose()),m.forEach(e=>e.dm&&e.dm.dispose())}}},Ie=r.setting(`connectors`)?Fe():null;e.on(`plugin`,()=>{let e=!!r.setting(`connectors`);e&&!Ie?Ie=Fe():!e&&Ie&&(Ie.off(),Ie=null)}),e.provide({connector:e=>Ie?Ie.get(e):null});let Le=()=>{let e=!!r.setting(`cars`);I.forEach(t=>t.visible=e),te.forEach(t=>t.m.visible=e);let t=r.setting(`trees`)!==!1;ee.forEach(e=>e.visible=t)};Le(),ye(),e.on(`plugin`,Le);let Re=(e,t,n)=>{let r=Math.min(1.2,e.L/8),i=t=>(n?b(e,(t+e.L)%e.L):b(e,Math.max(0,Math.min(e.L,t)))).p,a=i(t-r),o=i(t+r);return Math.atan2(o[0]-a[0],o[1]-a[1])},ze=null,Be=1,Ve=-1;e.on(`camera`,e=>{(e.home||ze==null)&&(ze=e.distance),Be=ze/Math.max(1e-6,e.distance)});let He=t=>{let n=e.three.levelOpacity(i);a.traverse(e=>[].concat(e.userData.recede&&e.material||[]).forEach(e=>{e.userData.so0===void 0&&(e.userData.so0=e.userData.o0??e.opacity??1),e.userData.o0=e.userData.so0*t;let r=e.transparent;e.transparent=e.userData.o0<.999||n<.999,e.opacity=e.userData.o0*n,r!==e.transparent&&(e.needsUpdate=!0)}))},Ue=0,We=0,Ge=B.some(e=>e.recede);return e.onFrame(t=>{if(Ge){let t=Math.min(1,Math.max(0,(Be-1)/1.5)),n=(1-.85*t*t*(3-2*t))*(1-.8*(e.three.explode()||0));Math.abs(n-Ve)>.004&&(Ve=n,He(n))}let n=e.ui.env(),i=e.getState(),a=n.reducedMotion?1:1-Math.exp(-t*15);n.reducedMotion||(Ue+=t),!n.reducedMotion&&r.setting(`carsMoving`)&&(We+=t),L.forEach(e=>{let t=R[i.hovered===e.id||i.selected===e.id?`h`:`n`];e.mats.forEach(e=>e.color.lerp(t[0],a)),e.lines.forEach(e=>e.color.lerp(t[1],a))}),te.forEach(e=>{let t=z[e.r],n=(e.s0*t.L+We*e.v)%t.L,r=b(t,n);e.m.position.set(r.p[0],0,r.p[1]),e.m.rotation.y=Re(t,n,!0)}),F.forEach(e=>{let t=e.a,n=t.type,r=t.speed,i=2*Math.PI*(r??.5)*Ue+(t.phase||0),a=[`x`,`y`,`z`].includes(t.axis)?t.axis:n===`sway`?`z`:`y`;if(n===`spin`)e.o.rotation[a]=e.r0[a]+(r??45)*Math.PI/180*Ue;else if(n===`sway`)e.o.rotation[a]=e.r0[a]+Math.sin(i)*(t.amount??8)*Math.PI/180;else if(n===`bob`)e.o.position.y=e.p0.y+Math.sin(i)*(t.amount??.2)*e.u;else if(n===`pulse`)e.o.scale.copy(e.s0).multiplyScalar(1+Math.sin(i)*(t.amount??.08));else if(n===`path`&&e.rt){let t=b(e.rt,Ue*(r??1.5)/2%e.rt.L);e.o.position.set(t.p[0],e.p0.y,t.p[1]),e.o.rotation.y=Re(e.rt,Ue*(r??1.5)/2%e.rt.L,e.a.loop!==!1)}})}),()=>{Ie&&=(Ie.off(),null);let e=new Set,t=new Set;a.traverse(n=>{n.geometry&&e.add(n.geometry),[].concat(n.material||[]).forEach(e=>t.add(e))}),e.forEach(e=>e.dispose()),t.forEach(e=>{e.map&&e.map.dispose(),e.alphaMap&&e.alphaMap.dispose(),e.dispose()})}}),MapplicMap.plugin(`wayfinding`,e=>{let t=e.three.THREE,n=e.three.floorTop??.3,r=document,i=e.data.levels(),a=e.ui.container,o=e.plugin(`wayfinding`),s={open:!1,out:!1,from:null,to:null,picking:null,route:null,done:!1,accessible:!1,fromGroup:null,toGroup:null,steps:!1,compact:!1,collapseNext:!1},c=()=>!!o.setting(`accessible`)&&s.accessible,l=()=>{let e=c()?_(s.to):null;return e&&e.accessible===!1?e:null},u=null,d=0,f=0,p=null,m=MapplicMap.svgIcon,h={route:m(`<circle cx="6" cy="19" r="3"></circle><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"></path><circle cx="18" cy="5" r="3"></circle>`),x:m(`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`),swap:m(`<path d="m21 16-4 4-4-4"></path><path d="M17 20V4"></path><path d="m3 8 4-4 4 4"></path><path d="M7 4v16"></path>`),up:m(`<path d="m5 12 7-7 7 7"></path><path d="M12 19V5"></path>`),dn:m(`<path d="M12 5v14"></path><path d="m19 12-7 7-7-7"></path>`),wheelchair:m(`<circle cx="16" cy="4" r="1"></circle><path d="m18 19 1-7-6 1"></path><path d="m5 8 3-3 5.5 3-2.36 3.5"></path><circle cx="9" cy="16" r="5"></circle>`),chevron:m(`<path d="m6 9 6 6 6-6"></path>`),locate:m(`<path d="M2 12h3"></path><path d="M19 12h3"></path><path d="M12 2v3"></path><path d="M12 19v3"></path><circle cx="12" cy="12" r="7"></circle>`),flag:m(`<path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"></path><path d="M4 22v-7"></path>`),arrowRight:m(`<path d="M5 12h14"></path><path d="m12 5 7 7-7 7"></path>`),swapH:m(`<path d="M8 3 4 7l4 4"></path><path d="M4 7h16"></path><path d="m16 21 4-4-4-4"></path><path d="M20 17H4"></path>`),esc:`<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M18.92,7.85h-2.35l-6.52,11.76c-.25.43-.72.71-1.22.71h-3.75c-1.15,0-2.08-.93-2.08-2.08s.93-2.08,2.08-2.08h2.35l6.52-11.76c.25-.43.72-.71,1.22-.71h3.75c1.15,0,2.08.93,2.08,2.08s-.93,2.08-2.08,2.08Z"></path></svg>`,stairs:`<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M19.5,6h-2.13v4.99h-3.87v4.99h-3.87l.04,5.01h-5.17c-.83,0-1.5-.68-1.5-1.5s.67-1.5,1.5-1.5h2.13v-4.99h3.87v-5.01h3.87V3h5.13c.82,0,1.5.67,1.5,1.5s-.68,1.5-1.5,1.5Z"></path></svg>`,lift:`<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M7.05,3c1.03,0,1.88.84,1.88,1.88s-.84,1.88-1.88,1.88-1.88-.84-1.88-1.88.84-1.88,1.88-1.88ZM10.8,13.5c0,.83-.67,1.5-1.5,1.5v4.5c0,.82-.67,1.5-1.5,1.5h-1.5c-.83,0-1.5-.68-1.5-1.5v-4.5c-.83,0-1.5-.67-1.5-1.5v-2.25c0-1.65,1.35-3,3-3h1.5c1.65,0,3,1.35,3,3v2.25ZM20.58,14.64l-2.4,3.84c-.3.46-.97.46-1.28,0l-2.4-3.84c-.3-.49.06-1.14.65-1.14h4.8c.58,0,.94.65.63,1.14ZM19.95,10.5h-4.8c-.59,0-.95-.65-.63-1.16l2.4-3.84c.3-.46.97-.46,1.28,0l2.4,3.84c.3.51-.06,1.16-.65,1.16Z"></path></svg>`,warn:m(`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"></path><path d="M12 9v4"></path><path d="M12 17h.01"></path>`)},g=(e,t,n,i)=>{let a=r.createElement(e);return t&&(a.className=t),i&&(a.style.cssText=i),n!=null&&(a.innerHTML=n),a},_=t=>t?e.data.find({id:t}):null,v=e=>{if(!e)return``;let t=typeof e.level==`number`?i[e.level]:i.find(t=>t.name===e.level||t.short===e.level);return t?t.short:String(e.level||``)},y=new t.MeshBasicMaterial({side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),b=new t.MeshBasicMaterial({side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});e.theme.tag(y,null,`accent`),e.theme.tag(b,null,`palette:routeHalo`);let x=new t.CircleGeometry(.13,12);x.rotateX(-Math.PI/2);let S=new t.MeshBasicMaterial({polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3}),C=new t.CylinderGeometry(.17,.17,1,10);e.theme.tag(S,null,`accent-dot`);let w={},T=[[`blue`,y,`accent`],[`white`,b,`palette:routeHalo`],[`dot`,S,`accent-dot`]],E={blue:.38,white:0,dot:.38},D=(t,n)=>{if(t==null||!i[t])return{blue:y,white:b,dot:S};n??=t;let r=t+`:`+n;if(!w[r]){let i=w[r]={li:t,top:n,d:0};T.forEach(([n,r,a])=>{let o=r.clone();e.theme.tag(o,null,a),e.three.fade(o,t),i[n]=o})}return w[r]},O=0,k=(t,n,r)=>{let i=e.getState().level,a=n&&O?Math.min(1,(t-O)/60):1;O=t,Object.values(w).forEach(t=>{let n=+(!r&&t.top<i),o=t.d+(n-t.d)*a;if(Math.abs(n-o)<.01&&(o=n),o===t.d&&t.ok)return;t.d=o,t.ok=!0;let s=e.three.levelOpacity(t.li);[`blue`,`white`,`dot`].forEach(e=>{let n=t[e],r=1-(1-E[e])*o,i=r<1||s<.999;n.userData.o0=r,n.opacity=r*s,n.visible=r>.01,n.transparent!==i&&(n.transparent=i,n.needsUpdate=!0)})})},A=(e,n)=>{let r=new t.BufferGeometry;return r.setAttribute(`position`,new t.Float32BufferAttribute(e,3)),r.setIndex(n),r.setDrawRange(0,0),r},j=(t,n,r)=>{let i=e.geo.offset(t,n/2),a=e.geo.offset(t,-n/2),o=[],s=[];return t.forEach((e,t)=>{if(o.push(i[t][0],r,i[t][1],a[t][0],r,a[t][1]),t){let e=2*(t-1);s.push(e,e+1,e+2,e+1,e+3,e+2)}}),A(o,s)},M=(e,t,n)=>{let r=[],i=[];return e.forEach((a,o)=>{let s=e[Math.max(0,o-1)],c=e[Math.min(e.length-1,o+1)],l=c[0]-s[0],u=c[2]-s[2],d=Math.hypot(l,u)||1,f=-u/d*t/2,p=l/d*t/2;if(r.push(a[0]+f,a[1]+n,a[2]+p,a[0]-f,a[1]+n,a[2]-p),o){let e=2*(o-1);i.push(e,e+1,e+2,e+1,e+3,e+2)}}),A(r,i)},N=(e,t)=>{let n=[0];for(let r=1;r<e.length;r++)n.push(n[r-1]+(t?Math.hypot(e[r][0]-e[r-1][0],e[r][1]-e[r-1][1],e[r][2]-e[r-1][2]):Math.hypot(e[r][0]-e[r-1][0],e[r][1]-e[r-1][1])));return n},P=(e,t,n)=>{let r=1;for(;r<t.length-1&&t[r]<n;)r++;let i=e[r-1],a=e[r],o=(n-t[r-1])/(t[r]-t[r-1]||1);return[i[0]+(a[0]-i[0])*o,i[1]+(a[1]-i[1])*o,i[2]==null?0:i[2]+(a[2]-i[2])*o]},F=()=>{u&&=(u.objs.forEach(e=>{e.parent&&e.parent.remove(e),e.geometry&&e.geometry!==x&&e.geometry!==C&&e.geometry.dispose()}),null)},I=r=>{let i=[],a=0,o=r.legs.map(r=>{let o=Object.assign({},r);if(r.kind===`walk`){o.cum=N(r.points),o.len=o.cum[o.cum.length-1];let a=D(r.level);o.mW=new t.Mesh(j(r.points,.85,n+.03),a.white),o.mB=new t.Mesh(j(r.points,.45,n+.045),a.blue),[o.mW,o.mB].forEach(t=>{t.renderOrder=1,e.three.add(t,r.level),i.push(t)})}else{o.len=5;let n=null;try{n=r.connector?e.plugin(`scenery`).connector(r.connector):null}catch{}if(n&&n.path){let e=n.path.slice();r.to<r.from&&e.reverse(),o.cum3=N(e,!0),o.cL=o.cum3[o.cum3.length-1],o.cc=o.cum3.map(e=>e/o.cL),o.cp=e,o.E=n.mesh;let a=D(Math.min(r.from,r.to),Math.max(r.from,r.to));o.cW=new t.Mesh(M(e,.85,0),a.white),o.cB=new t.Mesh(M(e,.45,.015),a.blue),[o.cW,o.cB].forEach(e=>{e.renderOrder=2,n.mesh.add(e),i.push(e)})}o.line=new t.InstancedMesh(C,y,160),o.line.count=0,o.line.frustumCulled=!1,o.line.visible=!1,e.three.add(o.line),i.push(o.line)}return o.s0=a,a+=o.len,o});u={r,legs:o,objs:i,total:a,dur:Math.max(900,Math.min(2400,a*28)),t0:performance.now()+250,done:!1,dots:null};let s=o.filter(e=>e.kind===`walk`&&e.length>1.5);if([...new Set(s.map(e=>e.level))].length>1){let e=[];s.forEach(t=>{let n=t.s0+t.len,r=e[e.length-1];r&&r.levelIndex===t.level?r.b=r.c=n:(r&&(r.c=t.s0),e.push({levelIndex:t.level,a:r?t.s0:0,b:n,c:n}))}),e[e.length-1].b=e[e.length-1].c=a,e.forEach(e=>{e.dur=Math.max(900,Math.min(2400,(e.b-e.a)*28)),e.cdur=Math.max(400,Math.min(600,(e.c-e.b)*40))}),u.tour=e,u.st=0,u.hold=0}},ee=()=>{u.dots=[],u.legs.forEach(n=>{if(n.cp){let e=Math.max(1,Math.floor(n.cL/1.6));for(let r=0;r<e;r++){let e=new t.Mesh(x,D(Math.min(n.from,n.to),Math.max(n.from,n.to)).dot);e.renderOrder=3,n.E.add(e),u.objs.push(e),u.dots.push({m:e,s:n,i:r,c3:!0})}return}if(n.kind!==`walk`)return;let r=Math.floor(n.len/1.6);for(let i=0;i<r;i++){let r=new t.Mesh(x,D(n.level).dot);r.renderOrder=1,e.three.add(r,n.level),u.objs.push(r),u.dots.push({m:r,s:n,i})}})},L=t=>{let n=u?u.legs.filter(e=>e.kind===`walk`&&e.level===t&&e.points.length>1):[];if(!n.length)return null;let r=n[0].points,i=n[n.length-1].points,a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r)||1;return[n/i,r/i]},o=r[0],s=i[i.length-1];if(Math.hypot(s[0]-o[0],s[1]-o[1])<1)return null;let c=e.three.camera.matrixWorld.elements,l=(Math.hypot(c[4],c[6])>.001?Math.atan2(c[4],c[6]):d)-d,f=e.ui.container,p=a(o,s),m;if(f.clientHeight>f.clientWidth)m=p;else{let e=(e,t,n)=>{for(let r=t+n;r>=0&&r<e.length;r+=n)if(Math.hypot(e[r][0]-e[t][0],e[r][1]-e[t][1])>.2)return a(e[t],e[r]);return a(e[t],e[t+n]||e[t])},t=e(r,0,1),n=e(i,i.length-1,-1),o=[(t[0]+n[0])/2,(t[1]+n[1])/2];if(Math.hypot(o[0],o[1])>=.3)m=[-o[0],-o[1]];else{let e=[t[0]-n[0],t[1]-n[1]];m=[-e[1],e[0]],m[0]*p[0]+m[1]*p[1]<0&&(m=[-m[0],-m[1]])}}return Math.atan2(m[0],m[1])-l},R=t=>{let n=u?u.legs.filter(e=>e.kind===`walk`&&e.level===t).flatMap(e=>e.points):[],r=L(t);e.view.fit(t,n,r==null?{}:{rotation:-r*180/Math.PI,minTurn:20})},z={p:new t.Vector3,q:new t.Vector3,d:new t.Vector3,up:new t.Vector3(0,1,0),r:new t.Quaternion,s:new t.Vector3,m:new t.Matrix4,w0:new t.Vector3,w1:new t.Vector3},te=()=>{if(!u)return;let t=performance.now(),r=!e.ui.env().reducedMotion,i=e.getState().allLevels,a=e.three.levelY,o=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,c=e=>Math.max(0,Math.min(1,e)),l=r&&u.tour;k(t,r,i);let d,f;if(l){let e=l[u.st];if(d=c((t-u.t0)/e.dur),f=e.a+o(d)*(e.b-e.a),d>=1){if(u.st<l.length-1){u.cs||(u.cs=t);let n=c((t-u.cs)/e.cdur);f=e.b+o(n)*(e.c-e.b),d=0,n<1||(u.hold?t>=u.hold&&(u.hold=0,u.cs=0,u.st++,u.t0=t+450,R(l[u.st].levelIndex)):u.hold=t+700)}else u.tour=null}}else d=r?c((t-u.t0)/u.dur):1,f=o(d)*u.total;if(u.legs.forEach(e=>{let t=Math.max(0,Math.min(e.len,f-e.s0));if(e.kind===`walk`){let n=0;for(;n<e.cum.length&&e.cum[n]<=t+1e-6;)n++;let r=n>0&&n<e.cum.length?(t-e.cum[n-1])/(e.cum[n]-e.cum[n-1]||1):1;[e.mW,e.mB].forEach(t=>{let i=t.geometry,a=i.attributes.position,o=a.array,s=i.userData.base||(i.userData.base=o.slice());if(i.userData.tip!=null&&i.userData.tip!==n){let e=i.userData.tip*6;for(let t=0;t<6;t++)o[e+t]=s[e+t];i.userData.tip=null,a.needsUpdate=!0}if(n>0&&n<e.cum.length){let e=n*6,t=(n-1)*6;for(let n=0;n<6;n++)o[e+n]=s[t+n]+(s[e+n]-s[t+n])*r;i.userData.tip=n,a.needsUpdate=!0,i.setDrawRange(0,n*6)}else i.setDrawRange(0,Math.max(0,n-1)*6)});return}let r=t/e.len,o=r;if(e.cc){let t=e.cp;e.E.updateMatrixWorld(!0),z.w0.set(...t[0]).applyMatrix4(e.E.matrixWorld),z.w1.set(...t[t.length-1]).applyMatrix4(e.E.matrixWorld),e.gapAt=Math.hypot(z.w0.x-e.a[0],z.w0.y-(a(e.from)+n),z.w0.z-e.a[1])>Math.hypot(z.w1.x-e.b[0],z.w1.y-(a(e.to)+n),z.w1.z-e.b[1])?0:1,i&&(e.gapAt?(o=Math.max(0,r*2-1),r=Math.min(1,r*2)):(o=Math.min(1,r*2),r=Math.max(0,r*2-1)));let s=0;for(;s<e.cc.length&&e.cc[s]<=r+1e-6;)s++;let c=Math.max(0,s-1)*6;e.cW.geometry.setDrawRange(0,c),e.cB.geometry.setDrawRange(0,c)}let s=n+.05,c=i&&o>0;if(e.line.visible=c,!c)return;z.p.set(e.a[0],a(e.from)+s,e.a[1]),z.q.set(e.b[0],a(e.to)+s,e.b[1]),e.cc&&(e.gapAt?z.p.copy(z.w1):z.q.copy(z.w0)),z.d.subVectors(z.q,z.p);let l=z.d.length()*Math.min(1,o),u=Math.min(160,Math.ceil(l/1.5));z.d.normalize(),z.r.setFromUnitVectors(z.up,z.d);for(let t=0;t<u;t++){let n=t*1.5,r=Math.min(.9,l-n);z.s.set(1,Math.max(.01,r),1),z.m.compose(z.q.copy(z.p).addScaledVector(z.d,n+r/2),z.r,z.s),e.line.setMatrixAt(t,z.m)}e.line.count=u,e.line.instanceMatrix.needsUpdate=!0}),d>=1&&!u.done&&(u.done=!0,s.done=!0,ee()),u.dots){let e=r?t/1e3:0;u.dots.forEach(t=>{let r=t.s;if(t.c3){let n=P(r.cp,r.cum3,(t.i*1.6+e*1.6)%r.cL);t.m.position.set(n[0],n[1]+.03,n[2]);return}let i=P(r.points,r.cum,(t.i*1.6+e*1.6)%r.len);t.m.position.set(i[0],n+.055,i[1])})}};e.ui.style(Object.assign({},MapplicMap.PLACE?MapplicMap.PLACE.css:{},{".mp-route-end":`position:absolute;border-radius:9999px;transition:opacity 200ms ease`,".mp-route-start":`left:-7px;top:-7px;width:14px;height:14px;background:var(--mp-surface);box-shadow:inset 0 0 0 3.5px var(--mp-accent), 0 1px 3px rgba(0,0,0,0.2)`,".mp-route-finish":`left:-8px;top:-8px;width:16px;height:16px;background:var(--mp-accent);box-shadow:0 0 0 3px var(--mp-bg), 0 2px 6px rgba(0,0,0,0.2)`,".mp-route-badge":`position:absolute;left:0;top:0;height:28px;padding:0 10px 0 8px;display:flex;align-items:center;gap:6px;white-space:nowrap;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-accent);color:var(--mp-fg-on-accent);font-size:12px;font-weight:600;box-shadow:0 2px 6px var(--mp-accent-ring);transform:translate(-50%,calc(-100% - 12px));cursor:pointer;transition:opacity 200ms ease,background-color 150ms ease`,".mp-route-badge:hover":`background:var(--mp-accent-hover)`,".mp-route-badge-ic":`display:flex;align-items:center;gap:2px`,".mp-route-badge-ic svg":`flex:none`,".mp-wayfinding-btn":`position:absolute;height:32px;padding:0 12px;display:flex;align-items:center;gap:8px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);font-family:'Onest',sans-serif;font-size:14px;font-weight:600;color:var(--mp-fg-strong);cursor:pointer;pointer-events:auto;transition:background-color 150ms ease`,".mp-wayfinding-btn:hover":`background:var(--mp-bg-muted)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding-btn, &[data-mp-glass-ctl="1"] .mp-wayfinding':`background:var(--mp-ctl-glass);-webkit-backdrop-filter:var(--mp-ctl-blur);backdrop-filter:var(--mp-ctl-blur)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding-btn':`box-shadow:0 0 0 1px var(--mp-ctl-ring), var(--mp-shadow-sm)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding':`box-shadow:0 0 0 1px var(--mp-ctl-ring), var(--mp-shadow-panel)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding-btn:hover':`background:color-mix(in srgb, var(--mp-surface) 88%, transparent)`,".mp-wayfinding-btn:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:2px`,".mp-wayfinding-btn.mp-icon":`width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);padding:0;justify-content:center`,".mp-wayfinding-blwrap":`position:relative;pointer-events:auto;display:flex;flex-direction:column;align-items:flex-start`,".mp-wayfinding-blwrap > .mp-wayfinding-btn, .mp-wayfinding-blwrap > .mp-wayfinding":`position:relative;left:auto;top:auto;right:auto;bottom:auto`,".mp-wayfinding.mp-bl":`transform-origin:bottom left;max-width:min(420px, calc(100vw - 64px))`,".mp-bl .mp-wayfinding-drop":`top:auto;bottom:calc(100% + 4px)`,".mp-wayfinding.mp-at-bottom:not(.mp-sheet)":`transform-origin:bottom left`,".mp-wayfinding.mp-at-right:not(.mp-sheet)":`transform-origin:top right`,".mp-wayfinding.mp-at-center:not(.mp-sheet)":`transform-origin:top center`,".mp-wayfinding.mp-at-bottom.mp-at-right:not(.mp-sheet)":`transform-origin:bottom right`,".mp-wayfinding.mp-at-bottom.mp-at-center:not(.mp-sheet)":`transform-origin:bottom center`,".mp-at-bottom:not(.mp-sheet) .mp-wayfinding-drop":`top:auto;bottom:calc(100% + 4px)`,".mp-wayfinding-btn.mp-icon .mp-wayfinding-label":`display:none`,".mp-wayfinding-btn.mp-slot-compact":`width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);padding:0;justify-content:center`,".mp-wayfinding-btn.mp-slot-compact .mp-wayfinding-label":`display:none`,".mp-wayfinding":`position:absolute;max-width:calc(100% - var(--mp-cs, 40px) - 48px - var(--mp-inset-l, 0px));box-sizing:border-box;padding:6px;border-radius:calc(12px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-panel);display:flex;flex-direction:column;gap:4px;cursor:default;pointer-events:auto;font-family:Onest,sans-serif;color:var(--mp-fg);transform-origin:top left;transition:opacity 160ms ease, transform 160ms ease`,".mp-wayfinding.mp-wrapped":`width:240px`,".mp-wayfinding.mp-compact":`width:auto;max-width:min(360px, calc(100% - var(--mp-cs, 40px) - 48px - var(--mp-inset-l, 0px)))`,".mp-wayfinding.mp-compact:not(.mp-sheet)":`padding:4px;border-radius:calc(8px * var(--mp-rk, 1));box-shadow:var(--mp-shadow-sm)`,".mp-wayfinding.mp-compact:not(.mp-sheet) .mp-wayfinding-compact-btn":`height:28px;padding:0 6px 0 4px;border-radius:calc(6px * var(--mp-rk, 1))`,".mp-wayfinding.mp-compact:not(.mp-sheet) .mp-wayfinding-close":`width:28px;height:28px;border-radius:calc(6px * var(--mp-rk, 1))`,".mp-wayfinding-close svg":`width:14px;height:14px`,".mp-wayfinding.mp-slot-compact .mp-wayfinding-compact-from":`display:none`,".mp-wayfinding.mp-sheet":`left:8px;right:8px;top:auto;bottom:8px;width:auto;max-width:none;border-radius:calc(14px * var(--mp-rk, 1));transform-origin:bottom center`,".mp-sheet .mp-wayfinding-drop":`top:auto;bottom:calc(100% + 4px)`,".mp-sheet .mp-wayfinding-compact-btn":`height:40px`,".mp-sheet.mp-wrapped .mp-wayfinding-field":`height:42px`,".mp-sheet .mp-wayfinding-ibtn":`width:40px;height:40px`,".mp-sheet .mp-wayfinding-next":`width:28px;height:28px`,".mp-sheet .mp-wayfinding-input":`font-size:16px`,".mp-sheet .mp-wayfinding-option":`height:40px`,".mp-sheet .mp-wayfinding-steps":`overflow:auto;overscroll-behavior:contain`,".mp-wayfinding-compact":`display:flex;align-items:center;gap:2px;min-width:0`,".mp-wayfinding-compact-btn":`flex:1;min-width:0;height:32px;padding:0 8px 0 6px;display:flex;align-items:center;gap:6px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;font:inherit;font-size:13px;font-weight:600;color:var(--mp-fg-strong);cursor:pointer;text-align:left;transition:background-color 150ms ease`,".mp-wayfinding-compact-btn:hover .mp-wayfinding-compact-time":`color:var(--mp-fg-strong)`,".mp-wayfinding-compact-btn:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-wayfinding-compact-name":`min-width:0;max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-sheet .mp-wayfinding-compact-name":`max-width:none;flex:0 1 auto`,".mp-wayfinding-compact-arrow":`flex:none;display:flex;color:var(--mp-fg-subtle)`,".mp-wayfinding-compact-arrow svg":`width:14px;height:14px`,".mp-wayfinding-compact-time":`flex:none;margin-left:auto;padding-left:6px;font-size:12px;font-weight:500;color:var(--mp-fg-muted);transition:color 150ms ease`,".mp-wayfinding-head":`display:flex;align-items:flex-start;gap:4px`,".mp-wayfinding-ends":`position:relative;flex:1;min-width:0;display:flex;flex-direction:column;border-radius:calc(9px * var(--mp-rk, 1));box-shadow:inset 0 0 0 1px var(--mp-border)`,".mp-inline .mp-wayfinding-ends":`flex-direction:row`,".mp-inline .mp-wayfinding-field":`width:152px`,".mp-wayfinding-tools":`flex:none;display:flex;flex-direction:column;gap:4px`,".mp-inline .mp-wayfinding-tools":`flex-direction:row;align-items:center;height:32px`,".mp-wrapped .mp-wayfinding-field":`height:34px`,".mp-wayfinding-field":`position:relative;min-width:0;height:32px;padding:0 6px;box-sizing:border-box;display:flex;align-items:center;gap:8px;border-radius:calc(9px * var(--mp-rk, 1));cursor:text;transition:box-shadow 150ms ease,background-color 150ms ease`,".mp-wrapped .mp-wayfinding-from":`border-radius:calc(9px * var(--mp-rk, 1)) calc(9px * var(--mp-rk, 1)) 0 0;padding-right:36px`,".mp-wrapped .mp-wayfinding-to":`border-radius:0 0 calc(9px * var(--mp-rk, 1)) calc(9px * var(--mp-rk, 1));padding-right:36px;box-shadow:0 -1px 0 0 var(--mp-border-subtle, var(--mp-border))`,".mp-inline .mp-wayfinding-from":`border-radius:calc(9px * var(--mp-rk, 1)) 0 0 calc(9px * var(--mp-rk, 1));padding-right:18px`,".mp-inline .mp-wayfinding-to":`border-radius:0 calc(9px * var(--mp-rk, 1)) calc(9px * var(--mp-rk, 1)) 0;padding-left:18px;box-shadow:-1px 0 0 0 var(--mp-border-subtle, var(--mp-border))`,".mp-wayfinding-field:hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-field.mp-active, .mp-wayfinding-field.mp-active:hover":`background:var(--mp-surface);box-shadow:inset 0 0 0 2px var(--mp-accent);z-index:1`,".mp-wayfinding-mark":`flex:none;width:20px;height:20px;display:flex;align-items:center;justify-content:center;color:var(--mp-fg-subtle)`,".mp-wayfinding-mark svg":`width:15px;height:15px`,".mp-wayfinding-field.mp-active .mp-wayfinding-mark":`color:var(--mp-accent)`,".mp-wayfinding-input":`flex:1;min-width:0;height:100%;padding:0;border:0;outline:0;background:transparent;font:inherit;font-size:13px;font-weight:500;color:var(--mp-fg-strong);text-overflow:ellipsis`,".mp-wayfinding-input::placeholder":`color:var(--mp-fg-subtle);font-weight:400;opacity:1`,".mp-wayfinding-field.mp-filled .mp-wayfinding-input":`font-weight:600`,".mp-wayfinding .mp-dir-thumb":`flex:none;width:20px;height:20px;border-radius:calc(5px * var(--mp-rk, 1));font-size:9px`,".mp-wayfinding .mp-dir-thumb.mp-dir-icon svg":`width:12px;height:12px`,".mp-wayfinding-ibtn":`flex:none;width:32px;height:32px;padding:0;display:flex;align-items:center;justify-content:center;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;color:var(--mp-fg-muted);cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,".mp-wayfinding-ibtn:hover":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,".mp-wayfinding-ibtn:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,'.mp-wayfinding-a11y[aria-pressed="true"], .mp-wayfinding-a11y[aria-pressed="true"]:hover':`background:var(--mp-selected-bg);color:var(--mp-selected-fg)`,".mp-wayfinding-next":`position:absolute;z-index:2;right:6px;top:50%;width:24px;height:24px;transform:translateY(-50%);border-radius:9999px;background:var(--mp-surface);box-shadow:inset 0 0 0 1px var(--mp-border)`,".mp-inline .mp-wayfinding-next":`right:auto;left:152px;transform:translate(-50%,-50%)`,".mp-wayfinding-next:hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-next svg":`width:14px;height:14px`,".mp-wayfinding-drop":`position:absolute;left:0;top:calc(100% + 4px);z-index:3;width:100%;min-width:220px;box-sizing:border-box;padding:4px;border-radius:calc(10px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-panel);display:flex;flex-direction:column;gap:1px;cursor:default`,".mp-wayfinding-option":`height:32px;padding:0 6px;display:flex;align-items:center;gap:8px;border-radius:calc(6px * var(--mp-rk, 1));cursor:pointer;font-size:13px;font-weight:500;color:var(--mp-fg-strong);transition:background-color 150ms ease`,".mp-wayfinding-option.mp-hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-option-name":`flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-wayfinding-option-level":`flex:none;font-size:12px;font-weight:500;color:var(--mp-fg-muted)`,".mp-wayfinding-none":`padding:7px 6px;font-size:13px;color:var(--mp-fg-muted)`,".mp-wayfinding-info":`display:flex;flex-direction:column;gap:4px;min-width:0`,".mp-wayfinding-info.mp-empty":`display:none`,".mp-wayfinding-warn":`display:flex;align-items:flex-start;gap:8px;padding:6px 8px;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-warning-subtle);color:var(--mp-warning-fg);font-size:13px;line-height:1.4`,".mp-wayfinding-warn svg":`flex:none;margin-top:1px;color:var(--mp-warning)`,".mp-wayfinding-hint":`padding:2px 6px;font-size:13px;color:var(--mp-fg-muted)`,".mp-wayfinding-summary":`height:26px;padding:0 6px;display:flex;align-items:center;gap:6px;border:0;border-radius:calc(6px * var(--mp-rk, 1));background:transparent;font:inherit;font-size:12px;color:var(--mp-fg-muted);cursor:pointer;text-align:left;transition:background-color 150ms ease`,".mp-wayfinding-summary:hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-summary:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-wayfinding-summary b":`font-weight:600;color:var(--mp-fg-strong)`,".mp-wayfinding-summary-text":`flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-wayfinding-summary svg":`flex:none;width:14px;height:14px;transition:transform 150ms ease`,'.mp-wayfinding-summary[aria-expanded="true"] svg':`transform:rotate(180deg)`,".mp-wayfinding-steps":`display:flex;flex-direction:column;gap:2px`,".mp-wayfinding-step":`min-height:26px;padding:3px 6px;box-sizing:border-box;display:flex;align-items:center;gap:8px;border-radius:calc(6px * var(--mp-rk, 1));cursor:pointer;transition:background-color 150ms ease`,".mp-wayfinding-step:hover, .mp-wayfinding-step.mp-current":`background:var(--mp-bg-muted)`,".mp-wayfinding-step-tag":`flex:none;min-width:28px;height:18px;padding:0 4px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-radius:calc(4px * var(--mp-rk, 1));background:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg);font-size:9px;font-weight:600;letter-spacing:0.04em`,".mp-wayfinding-step-text":`min-width:0;font-size:12px;line-height:1.35;color:var(--mp-fg-secondary)`}));let B=e.ui.mount(g(`div`,``,null,`position:absolute;inset:0;pointer-events:none`),{layer:`scene`}),V=e=>{let t=g(`div`,``,null,`position:absolute;left:0;top:0;width:0;height:0;pointer-events:none`);return t.append(g(`span`,`mp-route-end `+e,null,`opacity:0`)),B.append(t),t},H=V(`mp-route-start`),ne=V(`mp-route-finish`),re=[],ie=(t,r,i)=>{let a=e.three.project(i[0],e.three.levelY(r)+n,i[1]);t.style.transform=`translate(`+a.x.toFixed(1)+`px,`+a.y.toFixed(1)+`px)`,t.style.visibility=a.visible?`visible`:`hidden`},ae=()=>{re.forEach(e=>e.w.remove()),re=[];let t=e.getState();u&&!t.allLevels&&u.r.badges.filter(e=>e.level===t.level).forEach(e=>{let t=g(`div`,``,null,`position:absolute;left:0;top:0;width:0;height:0;pointer-events:none`),n=g(`span`,`mp-route-badge`,null,`opacity:0;pointer-events:none`),r=g(`span`,`mp-route-badge-ic`,(h[e.kind]||h.esc)+(e.up?h.up:h.dn)),i=g(`span`,``);i.textContent=e.levelName==null?e.text:e.levelName,n.title=e.text,n.setAttribute(`role`,`button`),n.setAttribute(`aria-label`,e.text),n.append(r,i),n.addEventListener(`click`,t=>{t.stopPropagation(),R(e.goTo)}),[`pointerdown`,`dblclick`].forEach(e=>n.addEventListener(e,e=>e.stopPropagation())),t.append(n),B.append(t),re.push({w:t,t:n,b:e})})},oe=()=>{let t=e.getState(),n=t.allLevels;u?(ie(H,u.r.start.level,u.r.start.at),ie(ne,u.r.end.level,u.r.end.at),H.firstChild.style.opacity=n||u.r.start.level===t.level?1:0,ne.firstChild.style.opacity=u.done&&(n||u.r.end.level===t.level)?1:0,re.forEach(e=>{ie(e.w,e.b.level,e.b.at),e.t.style.opacity=+!!u.done,e.t.style.pointerEvents=u.done?`auto`:`none`})):(H.firstChild.style.opacity=0,ne.firstChild.style.opacity=0)},se=e.ui.mount(g(`div`,``,null,`position:absolute;inset:0;pointer-events:none;z-index:8`)),U=g(`button`,`mp-wayfinding-btn`);U.type=`button`;let ce=()=>{clearTimeout(f),s.open=!0,s.out=!1,s.picking=s.from?s.to?null:`to`:`from`,s.compact=!1,it(!0)};U.onclick=ce;let le=()=>{try{let t=e.plugin(`search`),n=e.plugin(`directory`);return t.enabled()&&!n.enabled()?t.setting(`position`)||`top-left`:null}catch{return null}},ue=()=>{let t=o.setting(`layout`)||`auto`;return t===`auto`?!e.ui.env().narrow&&a.clientWidth>=760&&le()!==`top-center`?`inline`:`wrapped`:t},de=e=>String(e||``).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,` `).trim(),fe=null,pe=()=>Object.fromEntries(e.data.units().map(e=>[e.id,e.logo||e.thumb||null])),me=()=>{let t=MapplicMap.PLACE,n=e.data.amenityTypes()||{},r=e.data.section(`categories`)||[],i=pe(),a=[];e.data.stores().forEach(e=>{e.name&&a.push({id:e.id,name:e.name,level:e.level,logo:i[e.id]||e.logo||null,words:de(e.name)})});let o={};return e.data.amenities().forEach(e=>{let r=t&&t.amenityKey?t.amenityKey(e.type,n):e.type||`amenity`;(o[r]=o[r]||[]).push(e)}),Object.entries(o).forEach(([e,i])=>{let o=n[e]||{},s=o.name||i[0].name||e,c=[e,o.label].concat(t&&t.SYNONYMS&&t.SYNONYMS[e]||[]);a.push({group:i.map(e=>e.id),name:s,cat:t&&t.amenityCategory?t.amenityCategory(e,n,r):null,words:de(s),keys:de(c.join(` `))})}),a};e.on(`units`,()=>fe=null),e.on(`language`,()=>fe=null);let he=e=>{let t=de(e);if(!t)return[];fe||=me();let n=[];return fe.forEach(e=>{let r=e.words,i=r.startsWith(t)?0:(` `+r).includes(` `+t)?1:e.keys&&(` `+e.keys).includes(` `+t)?2:r.includes(t)?3:-1;i>=0&&n.push([i,e])}),n.sort((e,t)=>e[0]-t[0]||e[1].name.localeCompare(t[1].name)||(e[1].level||0)-(t[1].level||0)),n.slice(0,6).map(e=>e[1])},ge=e=>{let t=MapplicMap.PLACE;if(!t)return g(`span`,``);if(e.group||e.cat){let n=e.cat;return t.tint(g(`div`,`mp-dir-thumb mp-dir-icon`,n&&t.icon(n.icon,14)||h.route),n)}return t.thumb({name:e.name,logo:e.logo},`logo`)},_e=e=>e?(fe||=me(),fe.find(t=>t.id===e)||fe.find(t=>t.group&&t.group.includes(e))||null):null,ve=(t,n)=>{let r=t.map(e=>_(e)).filter(Boolean),i=c()?r.filter(e=>e.accessible!==!1):r,a=i.length?i:r;if(!a.length)return null;if(!n)return a[0].id;let o=1e9,s=a[0].id;return a.slice(0,12).forEach(t=>{if(t.id===n)return;let r=e.data.route({id:n},{id:t.id},{accessible:c()});r&&r.metres<o&&(o=r.metres,s=t.id)}),s},ye=()=>{[`from`,`to`].forEach(e=>{let t=s[e+`Group`],n=s[e===`from`?`to`:`from`];t&&n&&(s[e]=ve(t,n))})},be=t=>{let n=g(`div`,`mp-wayfinding-field mp-wayfinding-`+t),r=g(`span`,``,null,`display:contents`),i=g(`input`,`mp-wayfinding-input`),a=g(`div`,`mp-wayfinding-drop`,null,`display:none`),o=`mp-wf-`+t+`-`+Math.random().toString(36).slice(2,7);i.type=`text`,i.autocomplete=`off`,i.spellcheck=!1,i.setAttribute(`role`,`combobox`),i.setAttribute(`aria-autocomplete`,`list`),i.setAttribute(`aria-expanded`,`false`),i.setAttribute(`aria-controls`,o),a.id=o,a.setAttribute(`role`,`listbox`),n.append(r,i,a);let c={f:t,el:n,input:i,slot:r,drop:a,typing:!1,results:[],active:0,sig:``},l=!1,u=null,d=()=>{let t=c.typing&&de(i.value)!==``,n=[{opacity:0,transform:`translateY(`+(G.classList.contains(`mp-sheet`)?4:-4)+`px)`},{opacity:1,transform:`none`}];if(i.setAttribute(`aria-expanded`,t?`true`:`false`),t!==l&&(u&&u.cancel(),u=null,l=t,t?(a.style.display=`flex`,u=W(a,n,160,`ease-out`)):(u=W(a,n.slice().reverse(),120,`ease-in`),u?u.onfinish=()=>{u=null,a.style.display=`none`}:a.style.display=`none`)),!t)return i.removeAttribute(`aria-activedescendant`);if(a.replaceChildren(),!c.results.length){let t=g(`div`,`mp-wayfinding-none`);return t.textContent=e.ui.t(`search_none`),a.append(t)}c.results.forEach((e,t)=>{let n=g(`div`,`mp-wayfinding-option`+(t===c.active?` mp-hover`:``)),r=g(`span`,`mp-wayfinding-option-name`);if(n.id=o+`-`+t,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,t===c.active?`true`:`false`),r.textContent=e.name,n.append(ge(e),r),!e.group&&e.level!=null){let t=g(`span`,`mp-wayfinding-option-level`);t.textContent=v(e),n.append(t)}n.onpointerdown=e=>e.preventDefault(),n.onpointerenter=()=>{c.active=t,[...a.children].forEach((e,n)=>{e.classList.toggle(`mp-hover`,n===t),e.setAttribute(`aria-selected`,n===t?`true`:`false`)}),i.setAttribute(`aria-activedescendant`,o+`-`+t)},n.onclick=()=>f(e),a.append(n)}),i.setAttribute(`aria-activedescendant`,o+`-`+c.active)},f=n=>{c.typing=!1,d();let r=t===`from`?`to`:`from`;n.group?(s[t+`Group`]=n.group,s[t]=ve(n.group,s[r])):(s[t+`Group`]=null,s[t]=n.id),s.picking=s[r]?null:r,s.collapseNext=!0,e.view.deselect(),bt();let a=s.picking&&Se[s.picking];a?a.input.focus():i.blur()};return i.addEventListener(`focus`,()=>{s.compact&&Me(!1),s.picking=t,i.select(),it()}),i.addEventListener(`input`,()=>{c.typing=!0,c.results=he(i.value),c.active=0,xe(c),d()}),i.addEventListener(`keydown`,e=>{let t=l&&c.results.length;if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!t)return;e.preventDefault();let n=c.results.length;c.active=(c.active+(e.key===`ArrowDown`?1:n-1))%n,d()}else e.key===`Enter`?t&&(e.preventDefault(),f(c.results[c.active])):e.key===`Escape`&&(e.stopPropagation(),c.typing?(c.typing=!1,xe(c),d(),i.select()):i.blur())}),i.addEventListener(`blur`,()=>{c.typing=!1,xe(c),d()}),n.addEventListener(`pointerdown`,e=>{e.target!==i&&!a.contains(e.target)&&(e.preventDefault(),i.focus())}),c},xe=t=>{let n=s[t.f],r=_e(n),i=_(n),a=i?i.name:``,o=!!i&&!t.typing;t.el.classList.toggle(`mp-filled`,o),t.el.classList.toggle(`mp-active`,s.open&&s.picking===t.f);let c=o?n:`-`;if(c!==t.sig){t.sig=c;let e=t.slot.firstChild,n=o?ge(r||{name:a,logo:null}):g(`span`,`mp-wayfinding-mark`,t.f===`from`?h.locate:h.flag);t.slot.replaceChildren(n),e&&o&&W(n,[{opacity:0,transform:`scale(0.6)`},{opacity:1,transform:`none`}],180)}let l=e.ui.t(t.f===`from`?`choose_start`:`choose_destination`);t.input.placeholder=l,t.input.setAttribute(`aria-label`,l),!t.typing&&t.input.value!==a&&(t.input.value=a)},W=(t,n,r,i)=>!e.ui.env().reducedMotion&&t&&t.animate?t.animate(n,{duration:r||180,easing:i||`cubic-bezier(.2,.8,.2,1)`}):null,G=g(`div`,`mp-wayfinding`,null,`display:none`),Se={from:be(`from`),to:be(`to`)},Ce=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-next`),K=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-a11y`,h.wheelchair),we=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-close`,h.x),Te=g(`div`,`mp-wayfinding-info mp-empty`),Ee=g(`div`,`mp-wayfinding-compact`),De=g(`button`,`mp-wayfinding-compact-btn`),Oe=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-close`,h.x);[Ce,K,we,De,Oe].forEach(e=>e.type=`button`),Ee.append(De,Oe);let ke=!1,Ae=null,je=e=>{if(ke||G.style.display===`none`)return e();let t=G.getBoundingClientRect();Ae&&Ae.cancel(),Ae=null,ke=!0;try{e()}finally{ke=!1}let n=G.getBoundingClientRect();if(Je(),!t.height||!n.height||t.width===n.width&&t.height===n.height)return;let r=W(G,[{width:t.width+`px`,height:t.height+`px`},{width:n.width+`px`,height:n.height+`px`}],200,`ease`);r&&(Ae=r,G.style.overflow=`hidden`,r.onfinish=()=>{Ae=null,G.style.overflow=``,Je()},r.oncancel=()=>G.style.overflow=``)},Me=e=>{!!s.compact!==e&&(e&&r.activeElement&&G.contains(r.activeElement)&&r.activeElement.blur(),je(()=>{s.compact=e,at()}),W(e?Ee:G.firstChild,[{opacity:0},{opacity:1}],160,`ease-out`),e||W(Te,[{opacity:0},{opacity:1}],160,`ease-out`))};De.onclick=e=>{let t=De.querySelector(`.mp-wayfinding-compact-arrow`),n=t&&t.getBoundingClientRect(),r=getComputedStyle(De).direction===`rtl`,i=n?n.left+n.width/2:0,a=n&&e.detail>0&&(r?e.clientX>i:e.clientX<i)?`from`:`to`;Me(!1);let o=Se[a];o&&(o.input.focus(),o.input.select())},Oe.onclick=()=>Ze(),Ce.onclick=()=>{[s.from,s.to]=[s.to,s.from],[s.fromGroup,s.toGroup]=[s.toGroup,s.fromGroup],bt();let e=G.classList.contains(`mp-inline`),t=e?Se.from.el.offsetWidth:Se.from.el.offsetHeight;[[Se.from,1],[Se.to,-1]].forEach(([n,r])=>[n.slot.firstChild,n.input].forEach(n=>W(n,[{transform:(e?`translateX(`:`translateY(`)+r*t+`px)`,opacity:.3},{transform:`none`,opacity:1}],200))),W(Ce.firstChild,[{transform:`rotate(-180deg)`},{transform:`none`}],200)},K.onclick=()=>{s.accessible=!s.accessible,St()},we.onclick=()=>Ze();let Ne=g(`div`,`mp-wayfinding-head`),Pe=g(`div`,`mp-wayfinding-ends`),Fe=g(`div`,`mp-wayfinding-tools`);Pe.append(Se.from.el,Se.to.el,Ce),Fe.append(we,K),Ne.append(Pe,Fe),G.append(Ne,Te,Ee),G.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.defaultPrevented&&Ze()}),se.append(U,G);let Ie=()=>{let e=o.setting(`button_position`);return MapplicMap.SLOT_ANCHORS.includes(e)?e:`top-left`},Le=e=>e.startsWith(`top`)?10:5,Re=e.ui.slot(U,{anchor:Ie(),order:Le(Ie()),priority:10,compact:!0}),ze=()=>Ie()===`bottom-left`,Be=()=>{let e=Ie();return G.classList.toggle(`mp-at-bottom`,e.startsWith(`bottom`)),G.classList.toggle(`mp-at-right`,e.endsWith(`right`)),G.classList.toggle(`mp-at-center`,e.endsWith(`center`)),Re.update({anchor:e,order:Le(e)})},Ve=g(`div`,`mp-wayfinding-blwrap`);Ve.style.order=`100`;let He=t=>{let n=ze()&&t!==`sheet`;if(U.classList.toggle(`mp-wayfinding-bl`,ze()),G.classList.toggle(`mp-bl`,n),Be(),Ie().startsWith(`bottom`)&&t!==`sheet`&&t!==`button`?a.style.setProperty(`--mp-hint-wf`,`hidden`):a.style.removeProperty(`--mp-hint-wf`),n){let n=e.ui.zone(`bottom-left`);Ve.parentNode!==n&&n.append(Ve),U.parentNode!==Ve&&Ve.append(U,G),Re.update({el:null}),[U,G].forEach(e=>[`left`,`top`,`right`,`bottom`,`visibility`].forEach(t=>e.style[t]=``)),U.style.position=``,t===`button`&&(U.style.width=``),G.style.maxWidth=Math.max(200,Math.min(t===`row`?360:420,a.clientWidth-32))+`px`,t===`panel`&&(G.style.width=``);return}U.parentNode!==se&&se.append(U,G),Ve.remove(),G.style.maxWidth=``;let r=t===`button`?Re.update({el:U,min:0,max:0,priority:10,compact:o.setting(`button_label`)!==!1}):t===`sheet`?Re.update({el:null}):t===`row`?Re.update({el:G,priority:30,compact:!0}):Re.update({el:G,min:0,max:0,priority:30,compact:!1});t===`sheet`?[`left`,`right`,`top`,`bottom`,`width`].forEach(e=>G.style[e]=``):r&&Re.layout()},Ue=e=>{s.open&&!s.compact&&s.route&&!s.picking&&(G.contains(e.target)||U.contains(e.target)||Me(!0))};a.addEventListener(`pointerdown`,Ue,!0);let We=()=>{try{let t=e.plugin(`directory`);return t.enabled()&&/^floating|sheet/.test(t.setting(`placement`)||``)}catch{return!1}},Ge=0,Ke=()=>{let e=a.clientHeight,t=parseFloat(getComputedStyle(a).getPropertyValue(`--mp-room-b`));return Math.max(0,Math.min(e*.45,isNaN(t)?e:t-8))},qe=e=>{if(!e||!G.classList.contains(`mp-sheet`))return;let t=e.style.display;e.style.display=`none`;let n=G.scrollHeight;e.style.display=t,e.style.maxHeight=Math.max(48,Math.floor(Ke()-n-4))+`px`},Je=()=>{let t=G.classList.contains(`mp-sheet`),n=G.querySelector(`.mp-wayfinding-steps`),r=Ke(),i=t&&s.open&&!s.out&&!We()?Math.round(Math.min(G.offsetHeight,Math.max(r,G.offsetHeight-(n?n.offsetHeight:0)))+8):0;i!==Ge&&(Ge=i,i?a.style.setProperty(`--mp-inset-b`,i+`px`):a.style.removeProperty(`--mp-inset-b`),e.ui.inset(i?{bottom:i}:null))},Ye=0,Xe=window.ResizeObserver?new ResizeObserver(()=>{cancelAnimationFrame(Ye),Ye=requestAnimationFrame(()=>G.getAnimations&&G.getAnimations().length?null:Je())}):null;Xe&&Xe.observe(G);let Ze=()=>{let t=()=>{Tt()};if(e.ui.env().reducedMotion)return t();s.out=!0,it(),clearTimeout(f),f=setTimeout(t,170)},Qe=null,$e=null,et=!1,tt=0,nt=()=>G.getAnimations&&G.getAnimations().forEach(e=>e.id===`mp-morph`&&e.cancel()),rt=(e,t,n)=>{let r=n||G.getBoundingClientRect();if(!e.width||!r.width)return;nt();let i=tt=(tt||0)+1,a=[...G.children].filter(e=>e.offsetParent!==null&&getComputedStyle(e).position!==`absolute`),o=U.cloneNode(!0);o.setAttribute(`aria-hidden`,`true`),o.tabIndex=-1;let s=(G.classList.contains(`mp-at-bottom`)?`bottom:0;`:`top:0;`)+(G.classList.contains(`mp-at-right`)?`right:0;`:`left:0;`);o.style.cssText=`position:absolute;`+s+`display:flex;margin:0;background:transparent;box-shadow:none;pointer-events:none;visibility:visible`,a.forEach(e=>e.style.width=e.offsetWidth+`px`),G.append(o),G.style.overflow=`hidden`;let c=parseFloat(getComputedStyle(G).getPropertyValue(`--mp-rk`)),l={width:e.width+`px`,height:e.height+`px`,borderRadius:8*(Number.isFinite(c)?c:1)+`px`},u={width:r.width+`px`,height:r.height+`px`,borderRadius:getComputedStyle(G).borderRadius},d=t?170:220,f=G.animate(t?[u,l]:[l,u],{id:`mp-morph`,duration:d,easing:`cubic-bezier(.2,.8,.2,1)`,fill:t?`forwards`:`none`});o.animate(t?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],{duration:t?110:90,delay:t?50:0,easing:`ease-out`,fill:`both`}),a.forEach(e=>e.animate(t?[{opacity:1},{opacity:0}]:[{opacity:0},{opacity:1}],{duration:t?90:150,delay:t?0:70,easing:`ease-out`,fill:t?`forwards`:`backwards`,id:`mp-morph-kid`}));let p=()=>{o.remove(),i===tt&&(a.forEach(e=>{e.style.width=``,e.getAnimations().forEach(e=>e.id===`mp-morph-kid`&&e.cancel())}),Ae||(G.style.overflow=``))};t?f.oncancel=p:f.onfinish=f.oncancel=p},it=e=>e?at(e):je(()=>at()),at=t=>{let n=e.ui.env(),r=e.getState(),i=r.allLevels,a=s.open,u=e.ui.t,d=!!n.narrow;e.view.highlight([s.from,s.to].filter(Boolean));let f=u(`directions`);U.innerHTML=h.route+`<span class="mp-wayfinding-label">`+f+`</span>`,U.title=f,U.setAttribute(`aria-label`,f),U.classList.toggle(`mp-icon`,o.setting(`button_label`)===!1);let p=G.style.display===`none`,m=d||Ie().startsWith(`bottom`)?`translateY(8px) scale(0.98)`:`translateY(-6px) scale(0.98)`,v=!d&&!n.reducedMotion&&!!G.animate,y=v&&U.style.display!==`none`?U.getBoundingClientRect():null,b=v&&s.out&&!p?G.getBoundingClientRect():null;if(U.style.display===`none`&&(!a||s.out)&&!b&&W(U,[{opacity:0,transform:`scale(0.96)`},{opacity:1,transform:`none`}],160,`ease-out`),U.style.display=!a||s.out?`flex`:`none`,G.classList.toggle(`mp-sheet`,d),(p||!a)&&nt(),G.style.display=a?`flex`:`none`,G.style.opacity=s.out&&!b?0:1,G.style.transform=s.out&&!b?m:`none`,t&&p&&y?queueMicrotask(()=>rt(y,!1)):b?queueMicrotask(()=>rt(U.getBoundingClientRect(),!0,b)):t&&p&&W(G,[{opacity:0,transform:m},{opacity:1,transform:`none`}]),(!a||s.out)&&He(`button`),b&&ze()&&Object.assign(U.style,{position:`absolute`,left:`0`,bottom:`0`,visibility:`hidden`}),!a)return Je();let x=!!s.compact&&!!s.route,S=d?`wrapped`:ue(),C=!!o.setting(`accessible`);G.classList.toggle(`mp-compact`,x),G.classList.toggle(`mp-inline`,S===`inline`),G.classList.toggle(`mp-wrapped`,S!==`inline`),Ne.style.display=x?`none`:``,Te.style.display=x?`none`:``,Ee.style.display=x?``:`none`,s.out||He(d?`sheet`:x?`row`:`panel`);let w=_(s.from),T=_(s.to),E=s.route;if(x){let e=[s.from,s.to,E.minutes].join(`|`);if(e!==$e){$e=e;let t=(e,t)=>{let n=g(`span`,`mp-wayfinding-compact-name`),r=ge(_e(t)||{name:e?e.name:``,logo:null});return n.textContent=e?e.name:``,[r,n]},n=g(`span`,`mp-wayfinding-compact-time`);n.textContent=u(`minutes`,{n:E.minutes});let r=[...t(w,s.from),g(`span`,`mp-wayfinding-compact-arrow`,h.arrowRight)];r.forEach(e=>e.classList.add(`mp-wayfinding-compact-from`)),De.replaceChildren(...r,...t(T,s.to),n),De.title=De.textContent,De.setAttribute(`aria-expanded`,`false`)}if(!d){let e=G.cloneNode(!1);e.classList.remove(`mp-slot-compact`),e.removeAttribute(`style`),e.style.cssText=`display:flex;visibility:hidden;left:0;top:0;pointer-events:none`,e.append(Ee.cloneNode(!0)),se.append(e);let t=Math.min(360,Math.ceil(e.getBoundingClientRect().width));e.remove(),ze()?G.style.width=t+`px`:Re.update({max:t,min:Math.min(220,t)})&&Re.layout()}return Oe.title=u(`close`),Oe.setAttribute(`aria-label`,u(`close`)),Je()}$e=null,Ce.innerHTML=S===`inline`?h.swapH:h.swap;let D=!!(s.from||s.to);Ce.style.display=D?``:`none`,D&&!et&&W(Ce,[{opacity:0,scale:`0.6`},{opacity:1,scale:`1`}],160,`ease-out`),et=D,S===`inline`&&Fe.firstChild!==K?Fe.prepend(K):S!==`inline`&&Fe.lastChild!==K&&Fe.append(K),Ce.title=u(`swap`),Ce.setAttribute(`aria-label`,u(`swap`)),K.style.display=C?``:`none`,K.title=u(`accessible_route`),K.setAttribute(`aria-label`,u(`accessible_route`)),K.setAttribute(`aria-pressed`,s.accessible?`true`:`false`),we.title=u(`close`),we.setAttribute(`aria-label`,u(`close`)),xe(Se.from),xe(Se.to),t&&p&&s.picking&&!n.touch&&Se[s.picking].input.focus();let O=!s.picking&&l(),k=JSON.stringify([O&&O.name,E&&[s.from,s.to,E.minutes,E.metres,E.distance,E.via,E.stepFree,c()],!E&&s.from&&s.to&&s.from!==s.to,s.steps,i?`all`:r.level,u(`minutes`,{n:1})]);if(k!==Qe){let e=Te.classList.contains(`mp-empty`);Qe=k,ht(O,E,i,r),e&&!Te.classList.contains(`mp-empty`)&&!t&&W(Te,[{opacity:0,transform:`translateY(-4px)`},{opacity:1,transform:`none`}],160,`ease-out`)}Je()},ot=()=>{let e=g(`div`,`mp-wayfinding-warn`,h.warn),t=g(`span`,``);return e.setAttribute(`role`,`status`),e.append(t),e._text=t,e},st=ot(),ct=ot(),lt=g(`div`,`mp-wayfinding-hint`),ut=g(`button`,`mp-wayfinding-summary`),dt=g(`span`,`mp-wayfinding-summary-text`),ft=g(`div`,`mp-wayfinding-steps`);ut.type=`button`,ut.append(dt),ut.insertAdjacentHTML(`beforeend`,h.chevron),ut.onclick=()=>{let e=!s.steps;je(()=>{s.steps=e,at()}),e&&W(ft,[{opacity:0},{opacity:1}],200,`ease-out`)},Te.append(st,ct,lt,ut,ft);let pt=null,mt=(e,t)=>{let n=t?``:`none`;e.style.display!==n&&(e.style.display=n)},ht=(t,n,i,a)=>{let o=e.ui.t;mt(st,!!t),t&&(st._text.textContent=o(`not_accessible`,{place:t.name}));let l=!t&&!!n;if(mt(lt,!t&&!n&&!!s.from&&!!s.to&&s.from!==s.to),lt.textContent=o(`no_route`),mt(ct,l&&c()&&!n.stepFree),ct._text.textContent=o(`no_step_free`),mt(ut,l),mt(ft,l&&s.steps),Te.classList.toggle(`mp-empty`,!t&&!n&&lt.style.display===`none`),!l)return;let u=g(`b`,``);if(u.textContent=o(`minutes`,{n:n.minutes}),dt.replaceChildren(u,r.createTextNode(` · `+(n.distance||o(`metres`,{n:n.metres}))+(n.via?` · `+n.via:``))),ut.setAttribute(`aria-expanded`,s.steps?`true`:`false`),!s.steps)return;let d=JSON.stringify(n.steps.map(e=>[e.tag,e.text,e.level]));d===pt?[...ft.children].forEach((e,t)=>e.classList.toggle(`mp-current`,!i&&n.steps[t]&&n.steps[t].level===a.level)):(pt=d,ft.replaceChildren(...n.steps.map(e=>{let t=g(`div`,`mp-wayfinding-step`+(!i&&e.level===a.level?` mp-current`:``)),n=g(`span`,`mp-wayfinding-step-tag`),r=g(`span`,`mp-wayfinding-step-text`);return n.textContent=e.tag,r.textContent=e.text,t.append(n,r),t.onclick=()=>R(e.level),t})),qe(ft))},gt=()=>{if(!s.route)return null;let e=_(s.from),t=_(s.to);return{from:e?e.name:s.from,to:t?t.name:s.to,minutes:s.route.minutes,metres:s.route.metres,via:s.route.via,stepFree:s.route.stepFree}},_t=t=>{let n=s.route?s.from+`>`+s.to:null;(n!==p||t)&&(p=n,e.announce(`route`,gt()))},vt=!1,yt=`metric`,bt=()=>{if(vt=c(),yt=o.setting(`units`)||`metric`,F(),s.done=!1,s.route=null,ye(),s.from&&s.to&&s.from!==s.to&&!l())try{s.route=e.data.route({id:s.from},{id:s.to},{accessible:c(),units:o.setting(`units`)})}catch{s.route=null}let t=s.collapseNext&&!!s.route&&s.open;s.collapseNext=!1,s.route||(s.compact=!1),t&&!s.compact?Me(!0):it(),Je(),s.route&&(e.view.deselect(),I(s.route),R(u.tour?u.tour[0].levelIndex:s.route.start.level)),ae(),_t()},xt=e=>e?JSON.stringify(e.legs.map(e=>e.kind===`walk`?[e.level,e.points.length,e.points[0],e.points[e.points.length-1]]:[e.kind,e.from,e.to,e.connector])):``,St=()=>{let t=s.route,n=l(),r=null;if(t&&!n)try{r=e.data.route({id:s.from},{id:s.to},{accessible:c(),units:o.setting(`units`)})}catch{}if(!t||!r||!u||xt(r)!==xt(t))return bt();vt=c(),s.route=r,it(),_t(!0)},Ct=null,wt=(t,n)=>{n&&(s[t]=n,s[t+`Group`]=null,s.collapseNext=!0,s.open=!0,s.out=!1,s.picking=s.to?s.from?null:`from`:`to`,e.view.deselect(),bt())},Tt=()=>{clearTimeout(f),F(),Object.assign(s,{open:!1,out:!1,from:Ct,to:null,picking:null,route:null,done:!1,fromGroup:null,toGroup:null,compact:!1,collapseNext:!1}),ae(),it(),_t()};e.view.onPick(t=>s.open&&s.picking&&e.data.find({id:t})?(wt(s.picking,t),!0):!1);let Et=()=>{u&&u.tour&&(u.tour=null,u.t0=-1e9)},Dt=[`pointerdown`,`wheel`,`touchstart`,`keydown`];Dt.forEach(e=>a.addEventListener(e,Et,{capture:!0,passive:!0})),e.provide({show:async(t,n)=>{let r=e.data.find(t);if(!r)throw Error(`No store matches "`+(t&&t.name||t)+`"`);let i=n&&typeof n==`object`?[e.data.find(n)].filter(Boolean):e.data.findAll(n);if(!i.length)throw Error(`No store matches "`+n+`"`);let a=c()?i.filter(e=>e.accessible!==!1):i,o=a.length?a:i,l=o[0];if(o.length>1){let t=1e9;o.slice(0,8).forEach(n=>{if(n.id===r.id)return;let i=e.data.route({id:r.id},{id:n.id},{accessible:c()});i&&i.metres<t&&(t=i.metres,l=n)})}if(r.id===l.id)throw Error(`Start and destination are the same`);return Object.assign(s,{open:!0,out:!1,from:r.id,to:l.id,picking:null,fromGroup:null,toGroup:null,collapseNext:!0}),bt(),gt()},hide:Tt,open:ce,close:()=>{s.open&&!s.out&&Ze()},info:gt,from:t=>{let n=e.data.find(t);n&&wt(`from`,n.id)},origin:t=>{let n=t==null||t===``?null:e.data.find(t),r=Ct;return Ct=n?n.id:null,!s.open&&(!s.from||s.from===r)&&(s.from=Ct),Ct},to:t=>{let n=e.data.find(t);n&&wt(`to`,n.id)},state:()=>({open:s.open&&!s.out,from:s.from,to:s.to,picking:s.picking,routeShown:!!s.route,accessible:s.accessible}),restore:e=>{e||={},Object.assign(s,{open:!!e.open,out:!1,from:e.from||null,to:e.to||null,picking:null,accessible:!!e.accessible,fromGroup:null,toGroup:null,compact:!1,collapseNext:!1}),bt()},accessible:e=>(e!==void 0&&!!e!==s.accessible&&(s.accessible=!!e,St()),s.accessible)}),e.onFrame(()=>{te(),oe()});let Ot=0;e.on(`plugin`,e=>{e&&e.id===`scenery`&&s.route&&(clearTimeout(Ot),Ot=setTimeout(()=>{s.route&&(F(),I(s.route),u.t0=-1e9,u.tour=null)},60))}),e.on(`camera`,e=>{d=-e.rotation*Math.PI/180}),e.on(`level`,()=>{ae(),it()}),e.on(`layout`,()=>it());let kt=0,At=window.ResizeObserver?new ResizeObserver(()=>{cancelAnimationFrame(kt),kt=requestAnimationFrame(()=>s.open&&it())}):null;return At&&At.observe(a),e.on(`plugin`,e=>{if(e&&[`search`,`directory`].includes(e.id))return it();e&&e.id===`wayfinding`&&((o.setting(`units`)||`metric`)===yt?c()===vt?it():St():bt())}),it(),()=>{At&&At.disconnect(),cancelAnimationFrame(kt),Xe&&Xe.disconnect(),cancelAnimationFrame(Ye),a.removeEventListener(`pointerdown`,Ue,!0),a.style.removeProperty(`--mp-inset-b`),a.style.removeProperty(`--mp-hint-wf`),Ve.remove(),clearTimeout(f),clearTimeout(Ot),Dt.forEach(e=>a.removeEventListener(e,Et,{capture:!0})),F(),[y,b,S].forEach(e=>e.dispose()),Object.values(w).forEach(e=>T.forEach(([t])=>e[t].dispose())),x.dispose(),C.dispose(),p&&e.announce(`route`,null)}}),MapplicMap.plugin(`markers`,e=>{let t=e.plugin(`markers`),n=e.three.THREE,r=document,i=new n.Vector3,a=MapplicMap.svgIcon,o=MapplicMap.PLACE?MapplicMap.PLACE.icon(`restroom`,16):``,s={info:`<circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path>`,bus:`<path d="M8 6v6"></path><path d="M15 6v6"></path><path d="M2 12h19.6"></path><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3"></path><circle cx="7" cy="18" r="2"></circle><path d="M9 18h5"></path><circle cx="16" cy="18" r="2"></circle>`,zap:`<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"></path>`,door:`<path d="M13 4h3a2 2 0 0 1 2 2v14"></path><path d="M2 20h3"></path><path d="M13 20h9"></path><path d="M10 12v.01"></path><path d="M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z"></path>`,parking:`<rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M9 17V7h4a3 3 0 0 1 0 6H9"></path>`,car:`<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"></path><circle cx="7" cy="17" r="2"></circle><path d="M9 17h6"></path><circle cx="17" cy="17" r="2"></circle>`,food:`<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"></path><path d="M7 2v20"></path><path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"></path>`,star:`<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"></path>`};s[`map-pin`]=`<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path><circle cx="12" cy="10" r="3"></circle>`;let c=(e,t,n)=>{let r=String(e.text||``).trim();return r&&r.length<=2?p(r):t.trim()?p(t.trim().slice(0,n)):`<span style="width:8px;height:8px;border-radius:9999px;background:currentColor;display:block"></span>`},l={callout:{shape:`callout`,label:`always`,cluster:`off`},pin:{shape:`pin`,label:`always`},badge:{shape:`badge`,label:`hover`},dot:{shape:`dot`,label:`hover`},amenity:{shape:`badge`,label:`hover`,action:`select`}},u={callout:62,pin:42,badge:22,dot:15},d={callout:54,pin:34,badge:14,dot:7};e.ui.style({".mp-marker":`position:absolute;left:0;top:0;width:0;height:0;z-index:3`,".mp-marker.mp-marker-callout":`z-index:4`,".mp-marker.mp-hover":`z-index:5`,".mp-marker-body":`position:absolute;left:0;top:0;transform-origin:0 0;opacity:0;transition:opacity 150ms ease;font-family:Onest,sans-serif`,".mp-marker.mp-on .mp-marker-body":`opacity:1`,".mp-marker.mp-anim .mp-marker-body":`transition:none`,".mp-marker.mp-anim .mp-marker-hit":`pointer-events:none`,".mp-marker-hit":`pointer-events:none`,".mp-marker.mp-on.mp-live .mp-marker-hit":`pointer-events:auto`,".mp-marker.mp-clickable .mp-marker-hit":`cursor:pointer`,".mp-callout-dot":`position:absolute;left:-2.5px;top:-2.5px;width:5px;height:5px;border-radius:9999px;background:var(--mp-fg)`,".mp-callout-stem":`position:absolute;left:0;bottom:0;width:1px;height:32px;background:var(--mp-fg-subtle)`,".mp-callout":`position:absolute;left:0;bottom:32px;transform:translateX(-50%);height:22px;padding:0 8px;display:flex;align-items:center;white-space:nowrap;border-radius:calc(6px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);font-size:11px;font-weight:600;letter-spacing:0.06em;text-transform:uppercase;color:var(--mp-fg-secondary)`,".mp-callout.mp-has-icon":`gap:5px;padding-left:6px`,".mp-callout > svg, .mp-callout > img":`width:14px;height:14px;flex:none;display:block`,".mp-pin":`position:absolute;left:0;bottom:6px;transform:translateX(-50%);height:28px;padding:0 10px;box-sizing:border-box;display:flex;align-items:center;gap:6px;white-space:nowrap;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-card-bg);color:var(--mp-card-fg);font-size:13px;font-weight:600;box-shadow:0 0 0 1px var(--mp-card-ring), var(--mp-shadow);transition:background-color 150ms ease`,".mp-pin.mp-icon-only":`width:28px;padding:0;justify-content:center`,".mp-pin-arrow":`position:absolute;left:50%;bottom:-4px;width:8px;height:8px;margin-left:-4px;background:inherit;box-shadow:1px 1px 0 0 var(--mp-card-ring);transform:rotate(45deg);border-radius:calc(1px * var(--mp-rk, 1))`,".mp-clickable .mp-pin:hover":`background:var(--mp-card-bg-hover)`,".mp-badge":`position:absolute;left:-14px;top:-14px;width:28px;height:28px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-radius:9999px;background:var(--mp-fg-secondary);color:var(--mp-bg);box-shadow:0 2px 6px rgba(0,0,0,0.25);font-size:11px;font-weight:700;letter-spacing:0.02em;transition:background-color 150ms ease`,".mp-clickable .mp-badge:hover":`background:var(--mp-fg-tertiary)`,".mp-dot":`position:absolute;left:-7px;top:-7px;width:14px;height:14px;box-sizing:border-box;border-radius:9999px;background:var(--mp-fg-secondary);border:2px solid var(--mp-bg);box-shadow:0 1px 4px rgba(0,0,0,0.3);transition:transform 150ms ease`,".mp-clickable .mp-dot:hover":`transform:scale(1.2)`,".mp-dot.mp-dot-text":`left:-11px;top:-11px;width:22px;height:22px;display:flex;align-items:center;justify-content:center;color:var(--mp-bg);font-size:11px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums`,".mp-dot.mp-dot-text > svg, .mp-dot.mp-dot-text > img":`width:12px;height:12px;display:block`,".mp-marker-label":`position:absolute;top:-11px;height:22px;padding:0 8px;display:flex;align-items:center;white-space:nowrap;border-radius:calc(6px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);font-size:12px;font-weight:600;color:var(--mp-fg);pointer-events:none`,".mp-marker-tip":`position:absolute;left:0;transform:translateX(-50%);opacity:0;transition:opacity 150ms ease;pointer-events:none`,".mp-marker-tip .mp-tooltip":`position:relative;color:var(--mp-card-fg);font-size:13px;font-weight:600`,".mp-marker.mp-hover .mp-marker-tip":`opacity:1`,".mp-marker.mp-hover.mp-open .mp-marker-tip":`opacity:0`,".mp-cluster":`position:absolute;left:0;top:0;width:0;height:0;z-index:4`,".mp-cluster-body":`position:absolute;left:0;top:0;transform:translate(-50%,-50%);min-width:30px;height:30px;padding:0 8px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-radius:9999px;background:var(--mp-card-bg);color:var(--mp-card-fg);border:2px solid var(--mp-bg);box-shadow:var(--mp-shadow);font-family:Onest,sans-serif;font-size:12px;font-weight:600;font-variant-numeric:tabular-nums;opacity:0;pointer-events:none;cursor:pointer;transition:opacity 200ms ease,background-color 150ms ease`,".mp-cluster.mp-on .mp-cluster-body":`opacity:1;pointer-events:auto`,".mp-cluster-body:hover":`background:var(--mp-card-bg-hover)`});let f=(e,t,n)=>{let i=r.createElement(e);return t&&(i.className=t),n!=null&&(i.innerHTML=n),i},p=MapplicMap.escapeHtml,m=e=>e?e===`wc`?o:s[e]?a(s[e]):/^\s*<svg/i.test(e)?e:`<img src="`+p(e)+`" alt="" style="width:16px;height:16px;object-fit:contain;display:block">`:``,h=t=>{let n=f(`div`,t);return n.style.pointerEvents=`none`,e.ui.mount(n,{layer:`scene`})},g=e.data.markerStyles(),_=[],v=[],y={},b=1,x=null,S={},C=new Set,w=null,T=0,E=1,D=new Map,O={sig:null,tier:null,of:new Map},k=e=>{let t=(g.styles||{})[e.style]||{},n=l[t.extends]||l[e.style]||l[t.shape]||l.dot;return Object.assign({},n,t,e)},A=()=>{if(!t.setting(`amenities`))return[];let n={},r=e.data.amenityTypes();return e.data.amenities().forEach(e=>{n[e.id]=e}),e.data.units().filter(e=>e.kind===`amenity`&&!e.hidden).map(e=>{let t=n[e.id]||{},i=String(e.text||``),a=Object.keys(r).find(e=>r[e].label===i)||null;return Object.assign({id:`amenity-`+e.id,name:t.name||i,text:i===`i`||a===`toilets`?``:i,icon:i===`i`?`info`:a===`toilets`?`wc`:null,level:e.level,unit:e.id,style:`amenity`,amenity:a||!0},(g.amenities||{})[a]||{})})},j=e=>{let t=e.c;return{id:e.id,name:t.name||``,level:e.level,style:t.style||null,action:e.act,unit:t.unit||null,feature:t.feature||null,url:t.url||null,description:t.description||null,data:t.data||null,x:e.at[0],z:e.at[1]}},M=e=>{e.root.remove(),e.o3&&e.o3.parent&&e.o3.parent.remove(e.o3),e.offF&&e.offF()},N=(t,r)=>{let a=k(t),o=u[a.shape]?a.shape:`dot`,s=String(a.name||``),l=m(a.icon),d=a.unit&&(S[a.unit]||e.data.units().find(e=>e.location===a.unit||e.feature===a.unit))||null;if(a.unit&&!d){if(a.x==null||a.z==null)return null;a.unit=null}d&&(a.unit=d.id);let g=a.action||(a.unit||a.feature?`select`:a.url?`link`:a.description||s.trim()?`popup`:`none`),_=g===`popup`&&!String(a.name||``).trim()&&!String(a.description||``).trim()?`none`:g,v=d?d.level:a.level==null?0:a.level,y=h(`mp-marker mp-marker-`+o+(a.class?` `+a.class:``)),b=f(`div`,`mp-marker-body`);y.append(b),E!==1&&(b.style.transform=`scale(`+E+`)`);let x;if(o===`callout`){if(b.append(f(`span`,`mp-callout-dot`),f(`span`,`mp-callout-stem`)),x=f(`span`,`mp-callout mp-marker-hit`+(l?` mp-has-icon`:``),l),s){let e=f(`span`,``);e.textContent=s,x.append(e)}}else if(o===`pin`){let e=a.label===`always`&&s;if(x=f(`span`,`mp-pin mp-marker-hit`+(e?``:` mp-icon-only`),l||(e?``:c(a,s,1))),e){let e=f(`span`,``);e.textContent=s,x.append(e)}x.append(f(`span`,`mp-pin-arrow`))}else if(o===`badge`)x=f(`span`,`mp-badge mp-marker-hit`,l||c(a,s.toUpperCase(),2));else{let e=String(a.text||``).trim(),t=l||(e&&e.length<=3?p(e):``);x=f(`span`,`mp-dot mp-marker-hit`+(t?` mp-dot-text`:``),t)}if(b.append(x),x.setAttribute(`data-mp-drag`,``),a.color&&(x.style.background=a.color),a.ink&&(x.style.color=a.ink),a.label===`always`&&(o===`badge`||o===`dot`)&&s){let e=f(`span`,`mp-marker-label`);e.textContent=s,e.style.left=(o===`badge`?20:x.classList.contains(`mp-dot-text`)?16:12)+`px`,b.append(e)}let C=a.unit||a.feature||null;C&&x.setAttribute(`data-mp-hover`,C);let w=_===`tooltip`?MapplicMap.plainText(a.description)||(o===`callout`?``:s):a.label===`hover`&&!C&&o!==`callout`?s:``;if(w){let e=f(`div`,`mp-marker-tip`),t=f(`div`,`mp-tooltip`),n=f(`span`,``);n.textContent=w,t.append(n,f(`span`,`mp-tooltip-arrow`)),e.append(t),e.style.bottom=u[o]+`px`,b.append(e)}(_!==`none`||w||C)&&y.classList.add(`mp-live`),_!==`none`&&_!==`tooltip`&&y.classList.add(`mp-clickable`);let T={id:String(a.id||`marker-`+r),c:a,sh:o,act:_,root:y,hit:x,level:v,idx:r,prio:+a.priority||0,on:!1,pos:null,at:d?d.center.slice():[+a.x||0,+a.z||0]};{let t=new n.Object3D;t.position.set(T.at[0],d?d.top:a.elevation==null?+a.y||e.data.surface(v,T.at[0],T.at[1]):a.y==null?e.geo.metres(+a.elevation||0):+a.y,T.at[1]),e.three.add(t,v),T.o3=t}return _===`popup`&&(T.offF=e.view.feature(T.id,{kind:`marker`,anchor:()=>(T.o3.getWorldPosition(i),[i.x,i.y,i.z]),info:()=>Object.assign(e.data.popupFields(a),{name:s,subtitle:a.subtitle||null,description:a.description||``,logo:a.logo||null,hours:a.hours||null,level:v,data:a.data||null})})),x.addEventListener(`pointerenter`,()=>y.classList.add(`mp-hover`)),x.addEventListener(`pointerleave`,()=>y.classList.remove(`mp-hover`)),x.addEventListener(`click`,e=>{e.stopPropagation(),P(T)}),T},P=t=>{let n=t.c;if(e.announce(`marker`,j(t)),t.act===`select`)try{e.view.select(n.unit?{id:n.unit}:n.feature)}catch(e){console.warn(`Marker `+t.id+`: `+e.message)}else t.act===`popup`?e.view.select(t.id):t.act===`link`&&n.url?window.open(n.url,n.target||`_blank`,`noopener`):t.act===`tooltip`&&e.ui.env().touch&&t.root.classList.toggle(`mp-hover`)},F=()=>{_.forEach(M),S={},e.data.units().forEach(e=>{S[e.id]=e}),w=!!t.setting(`amenities`),E=Math.max(.5,Math.min(2,+t.setting(`scale`)||1)),D.forEach(e=>e.root.remove()),D.clear(),O={sig:null,tier:null,of:new Map},_=e.data.markers().concat(A(),v).map(e=>Object.assign({},e,y[e.id])).filter(e=>!e.removed).map(N).filter(Boolean);let n=[...C].sort().join();C=new Set,_.forEach(t=>{if(t.c.style===`amenity`)return;let n=t.c.unit||e.data.unitAt(t.level,t.at[0],t.at[1]);n&&C.add(n)});let r=[...C].sort().join();if(r!==n)try{e.plugin(`labels`).refresh(n.split(`,`).concat(r.split(`,`)).filter(Boolean))}catch{}},I=e.three.camera,ee=t=>{if(t.o3.getWorldPosition(i),t.dist=i.distanceTo(I.position),t.c.unit){let n=e.ui.anchor(t.c.unit);return n&&n.visible?[n.x,n.y]:null}let n=e.three.project(i.x,i.y,i.z);return n.visible?[n.x,n.y]:null},L=t=>{let n=t.members.map(e=>e.at);n.length>1&&e.view.fit(t.lead.level,n)},R=()=>{let t=h(`mp-cluster`),n=f(`span`,`mp-cluster-body`);n.setAttribute(`data-mp-drag`,``),t.append(n),E!==1&&(n.style.transform=`translate(-50%,-50%) scale(`+E+`)`);let r={root:t,body:n,g:null,dead:0};return n.title=e.ui.t(`zoom_in`),n.addEventListener(`click`,e=>{e.stopPropagation(),r.g&&L(r.g)}),r};e.on(`camera`,e=>{(e.home||x==null)&&(x=e.distance),b=x/Math.max(1e-6,e.distance)});let z=!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),te=e=>1-(1-e)**3,B=e=>(e.o3.getWorldPosition(i),[i.x,i.y,i.z]),V=e=>{let t=[0,0,0];return e.members.forEach(e=>{let n=B(e);t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}),t.map(t=>t/e.members.length)},H=t=>{let n=e.three.project(t[0],t[1],t[2]);return n.visible?[n.x,n.y]:null},ne=t=>{let n=e.three.project(t[0],t[1],t[2]),r=e.three.project(t[0]+1,t[1],t[2]),i=e.three.project(t[0],t[1],t[2]+1);return Math.max(Math.hypot(r.x-n.x,r.y-n.y),Math.hypot(i.x-n.x,i.y-n.y))||1},re=(t,n,r,i,a,o)=>{let s=e.ui.size(),c=null,l=1/0,u=1;t.forEach(e=>{let t=H(B(e));if(!t)return;let n=Math.hypot(t[0]-s.width/2,t[1]-s.height/2);n<l&&(l=n,c=e)}),c&&(u=ne(B(c))*1.5**n/Math.max(1e-6,b));let d=i/u,f=new Map,p=new Map,m=[];t.slice().sort((e,t)=>t.prio-e.prio||e.idx-t.idx).forEach(e=>{let t=e.c,n=t.cluster===!1?`off`:t.cluster||a;if(n===`off`)return;let r=(t.cluster_group||t.style||``)+`|`+n+`|`+e.level,i=f.get(r)||f.set(r,[]).get(r),o=null,s=1/0;i.forEach(t=>{let n=Math.hypot(t.lead.at[0]-e.at[0],t.lead.at[1]-e.at[1]);n<d&&n<s&&(s=n,o=t)}),o?o.members.push(e):i.push({lead:e,members:[e],mode:n})}),f.forEach(e=>e.forEach(e=>{e.members.length<2||(e.cen=V(e),e.key=e.members.map(e=>e.id).sort().join(`|`),m.push(e),e.members.forEach(t=>p.set(t.id,e)))})),!z&&O.sig!=null&&t.forEach(e=>{let t=O.of.get(e.id),n=p.get(e.id),r=t&&t.mode===`count`,i=n&&n.mode===`count`;r&&!i?e.anim={from:t.cen,to:B(e),t0:o,out:!1}:!r&&i&&(e.anim={from:B(e),to:n.cen,t0:o,out:!0})});let h=new Set;m.forEach(e=>{if(e.mode!==`count`)return;h.add(e.key);let t=D.get(e.key);t||(D.set(e.key,t=R()),t.body.textContent=e.members.length),t.g=e,t.cen=e.cen,t.dead=0}),D.forEach((e,t)=>{!h.has(t)&&!e.dead&&(e.dead=o,e.root.classList.remove(`mp-on`),e.root._on=!1)}),O={sig:r,tier:n,of:p}};e.onFrame(()=>{let n=e.getState(),r=e.ui.size(),i=+t.setting(`radius`)||44,a=t.setting(`cluster`)?t.setting(`count`)?`count`:`hide`:`off`,o=performance.now(),s=+(t.setting(`min_zoom`)??.7)||0,c=[];_.forEach(t=>{let r=t.c,i=r.min_zoom??s,a=(n.allLevels?r.all_levels===`show`:t.level===n.level)&&e.three.levelOpacity(t.level)>.05;a&&(i>0&&b<i||r.max_zoom!=null&&b>r.max_zoom)&&(a=!1),t.ok=a,a&&c.push(t)});let l=Math.log(Math.max(1e-6,b))/Math.log(1.5),u=O.tier;(u==null||Math.abs(l-u)>.65)&&(u=Math.round(l));let d=u+`#`+c.map(e=>e.id).join(`,`);d!==O.sig&&re(c,u,d,i,a,o);let f=e=>!!e&&e[0]>-80&&e[1]>-80&&e[0]<r.width+80&&e[1]<r.height+80;_.forEach(e=>{let t=e.ok?O.of.get(e.id):null,r=e.ok&&(!t||t.mode===`hide`&&t.lead===e),i=null,a=null;if(e.anim){let t=Math.min(1,(o-e.anim.t0)/320),n=te(t),r=e.anim;t>=1||!e.ok?e.anim=null:(i=H([0,1,2].map(e=>r.from[e]+(r.to[e]-r.from[e])*n)),a=r.out?1-n*n:Math.min(1,n*1.6))}if(e.anim||(i=r||o-(e.offT||0)<220?ee(e):null),i&&(e.pos=i),e.want=(r||!!e.anim)&&f(i),e.pos){let t=`translate(`+e.pos[0].toFixed(1)+`px,`+e.pos[1].toFixed(1)+`px)`;e.root._t!==t&&(e.root.style.transform=t,e.root._t=t)}let s=a==null?``:a.toFixed(3);e.root._o!==s&&(e.root.style.opacity=s,e.root._o=s,e.root.classList.toggle(`mp-anim`,a!=null));let c=!!n.selected&&(n.selected===e.c.unit||n.selected===e.c.feature||n.selected===e.id);e.open!==c&&(e.open=c,e.root.classList.toggle(`mp-open`,c)),e.on!==e.want&&(e.on=e.want,e.root.classList.toggle(`mp-on`,e.on),e.on||(e.root.classList.remove(`mp-hover`),e.offT=o))}),D.forEach((e,t)=>{if(e.dead&&o-e.dead>260){e.root.remove(),D.delete(t);return}!e.dead&&e.g&&(e.cen=V(e.g));let n=H(e.cen);if(n){let t=`translate(`+n[0].toFixed(1)+`px,`+n[1].toFixed(1)+`px)`;e.root._t!==t&&(e.root.style.transform=t,e.root._t=t)}if(e.dead)return;let r=f(n)&&(e.fr=(e.fr||0)+1)>1;e.root._on!==r&&(e.root._on=r,e.root.classList.toggle(`mp-on`,r))})});let ie=t=>{let n=e.data.levelOf(t);if(n==null||n===`all`)throw Error(`Unknown level `+t);return n},ae=(t,n)=>{let r=Object.assign({},n,t);if(t.at!=null){let n=e.data.find(t.at);if(!n)throw Error(`No store matches "`+t.at+`"`);r.unit=n.id,delete r.at}if(t.level!=null&&(r.level=ie(t.level)),!r.unit&&(typeof r.x!=`number`||typeof r.z!=`number`))throw Error(`A marker needs x and z (floor-local map units) or at (a store)`);return r};e.provide({list:()=>_.map(j),covers:e=>C.has(e),top:t=>{let n=null;return _.forEach(r=>{if(r.on&&r.pos&&(r.c.unit===t||r.c.feature===t||r.id===t||r.c.legacy&&r.c.name===(e.data.feature(t)||{}).name)){let e=r.pos[1]-d[r.sh]*E;(n==null||e<n)&&(n=e)}}),n},add:t=>{t||={};let n=String(t.id||`marker-rt-`+ ++T);if(_.some(e=>e.id===n))throw Error(`Marker `+n+` exists`);return v.push(Object.assign(ae(t,{level:e.getState().level||0}),{id:n})),F(),n},update:(e,t)=>{let n=v.find(t=>t.id===e);if(n)Object.assign(n,ae(t||{},n));else if(_.some(t=>t.id===e))y[e]=Object.assign(y[e]||{},t);else throw Error(`No marker `+e);F()},remove:e=>{let t=v.length;if(v=v.filter(t=>t.id!==e),v.length===t){if(!_.some(t=>t.id===e))throw Error(`No marker `+e);y[e]={removed:!0}}F()},refresh:()=>{g=e.data.markerStyles(),F()}}),F();let oe=null,se=()=>{try{return JSON.stringify(A())}catch{return null}};return e.on(`units`,()=>{if(!t.setting(`amenities`))return;let e=se();(e==null||e!==oe)&&(oe=e,F())}),e.on(`plugin`,()=>{(!!t.setting(`amenities`)!==w||(+t.setting(`scale`)||1)!==E)&&F()}),()=>{_.forEach(M),D.forEach(e=>e.root.remove()),D.clear()}}),MapplicMap.HOURS=(()=>{let e=document,t=1440,n=[`mo`,`tu`,`we`,`th`,`fr`,`sa`,`su`],r={Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6};Object.entries({hours_open:`Open`,hours_closing:`Closing`,hours_opening:`Opening`,hours_closed:`Closed`,hours_until:`until {time}`,hours_at:`at {time}`,hours_24:`24 hours`,hours_every_day:`Every day`,hours_toggle:`Opening hours`}).forEach(([e,t])=>{MapplicMap.UI[e]??(MapplicMap.UI[e]=t)});let i=[`jan`,`feb`,`mar`,`apr`,`may`,`jun`,`jul`,`aug`,`sep`,`oct`,`nov`,`dec`],a=/^(?:(\d{4})\s+)?([a-z]{3})\s+(\d{1,2})(?:\s*-\s*(?:([a-z]{3})\s+)?(\d{1,2}))?/i,o=/^(\d{1,2})(?:\s*-\s*(\d{1,2}))?(?![\d:])/,s=(e,t)=>{let n=/^(\d{1,2}):(\d{2})$/.exec(String(e).trim());if(!n)return null;let r=n[1]*60+ +n[2];return+n[2]<60&&r<=t?r:null},c=e=>{let n=e.trim().toLowerCase();if(n===`off`||n===`closed`)return[];if(n===`24/7`)return[[0,t]];if(!n)return null;let r=[];for(let e of n.split(/\s*,\s*/)){let[n,i]=e.split(/\s*-\s*/),a=n==null?null:s(n,1439),o=i==null?null:s(i,2*t);if(a==null||o==null)return null;r.push([a,o<=a?o+t:o])}return r.sort((e,t)=>e[0]-t[0])},l=e=>{let t=[],n=e;for(;;){let e=t[t.length-1],r=a.exec(n),s=!r&&e?o.exec(n):null;if(r){let e=i.indexOf(r[2].toLowerCase()),a=r[4]?i.indexOf(r[4].toLowerCase()):e,o=+r[3],s=r[5]?+r[5]:o;if(e<0||a<0||o<1||o>31||s<1||s>31)return null;t.push({year:r[1]?+r[1]:null,from:(e+1)*100+o,to:(a+1)*100+s}),n=n.slice(r[0].length)}else if(s){let r=Math.floor(e.to/100),i=+s[1],a=s[2]?+s[2]:i;if(i<1||i>31||a<1||a>31)return null;t.push({year:e.year,from:r*100+i,to:r*100+a}),n=n.slice(s[0].length)}else return null;let c=/^\s*,\s*/.exec(n);if(!c)break;n=n.slice(c[0].length)}return{items:t,rest:n}},u=e=>{let t=[],r=[],i=e,a=!1,o=!1,s=e=>n.indexOf(e.toLowerCase());for(;;){let e;if(e=/^ph(?![a-z])/i.exec(i))a=!0;else if(e=/^([a-z]{2})(?![a-z])\s*\[([-\d,\s]+)\]/i.exec(i)){let t=s(e[1]),n=[];if(t<0)return!1;for(let t of e[2].split(`,`)){let e=/^\s*(-?\d)\s*(?:-\s*(\d))?\s*$/.exec(t);if(!e)return!1;for(let t=+e[1];t<=(e[2]?+e[2]:+e[1]);t++)t&&t>=-5&&t<=5&&n.push(t)}r.push({day:t,list:n})}else if(e=/^([a-z]{2})(?![a-z])(?:\s*-\s*([a-z]{2})(?![a-z]))?/i.exec(i)){let n=s(e[1]),r=e[2]?s(e[2]):n;if(n<0||r<0)return!o&&null;for(let e=n;t.includes(e)||t.push(e),e!==r;e=(e+1)%7);}else return!o&&null;o=!0,i=i.slice(e[0].length);let n=/^\s*,\s*/.exec(i);if(!n)break;i=i.slice(n[0].length)}return{weekdays:t,nth:r,ph:a,rest:i}},d=new Map,f=e=>{if(e&&typeof e==`object`&&Array.isArray(e.days))return e;let t=String(e??``).replace(/[\u2013\u2014]/g,`-`).trim();if(!t)return null;if(d.has(t))return d.get(t);let n=m(t,String(e));return d.size>500&&d.clear(),d.set(t,n),n},p=[0,1,2,3,4,5,6],m=(e,t)=>{let r=[];for(let t of e.split(/\s*;\s*|(?<=\d|off|closed)\s*,\s*(?=(?:mo|tu|we|th|fr|sa|su|ph)(?![a-z]))/i)){let e=t.trim();if(!e||/^sh(?![a-z])/i.test(e))continue;let n;if(/^(\d{4}\s+)?[a-z]{3}\s+\d/i.test(e)&&i.includes(e.replace(/^\d{4}\s+/,``).slice(0,3).toLowerCase())){let t=l(e);if(!t)return null;n={weekdays:[],nth:[],ph:!1,dates:t.items,times:t.rest}}else{let t=u(e);if(t===!1)return null;n=t?{weekdays:t.weekdays,nth:t.nth,ph:t.ph,dates:null,times:t.rest}:{weekdays:p,nth:[],ph:!1,dates:null,times:e}}let a=c(n.times);if(!a)return null;delete n.times,n.ranges=a,r.push(n)}if(!r.length)return null;let a=n.map(()=>[]);return r.forEach(e=>e.weekdays.forEach(t=>a[t]=e.ranges.map(e=>e.slice()))),{rules:r,days:a,ph:r.some(e=>e.ph),text:t}},h={},g=e=>e.y+`-`+x(e.m)+`-`+x(e.d),_=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||``));return t?{y:+t[1],m:+t[2],d:+t[3]}:null},v=e=>(new Date(Date.UTC(e.y,e.m-1,e.d)).getUTCDay()+6)%7,y=(e,t)=>{let n=new Date(Date.UTC(e.y,e.m-1,e.d+t));return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:n.getUTCDate()}},b=(e={})=>{let t=e.now;if(t&&(typeof t.day==`number`||t.date)){let e=_(t.date);return{day:e?v(e):t.day,minute:t.minute||0,date:e}}let n=t instanceof Date?t:new Date;if(e.timezone)try{let t=e.timezone,i=h[t]||(h[t]=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,weekday:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})),a=Object.fromEntries(i.formatToParts(n).map(e=>[e.type,e.value]));return{day:r[a.weekday],minute:a.hour%24*60+ +a.minute,date:{y:+a.year,m:+a.month,d:+a.day}}}catch{}return{day:(n.getDay()+6)%7,minute:n.getHours()*60+n.getMinutes(),date:{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()}}},x=e=>(e<10?`0`:``)+e,S=(e,t={})=>{let n=Math.floor(e/60),r=e%60;return t.hour12?(n%12||12)+(r?`:`+x(r):``)+` `+(n%24<12?`AM`:`PM`):n+`:`+x(r)},C=t=>t.lang||e.documentElement.lang||`en`,w=(e,t,n)=>{let r=t+`|`+e;return h[r]||(h[r]=new Intl.DateTimeFormat(e,Object.assign({timeZone:`UTC`},n)))},T=(e,t={})=>{try{return w(C(t),`day`,{weekday:`short`}).format(new Date(Date.UTC(2024,0,1+e)))}catch{return[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`][e]}},E=(e,t={})=>{let n=new Date(Date.UTC(e.y,e.m-1,e.d));try{return w(C(t),`date`,{weekday:`short`,day:`numeric`,month:`short`}).format(n)}catch{return T(v(e),t)+` `+g(e)}},D=e=>e.t||((e,t)=>MapplicMap.t(e,t)),O=(e,t)=>{if(!e||!t||!t.length)return null;let n=g(e),r=n.slice(5);return t.find(e=>e&&(e.date===n||e.date===r))||null},k=(e,t)=>{let n=t.m*100+t.d;return e.some(e=>{let r=e.from>e.to,i=r?n>=e.from||n<=e.to:n>=e.from&&n<=e.to;return!i||e.year==null?i:t.y===(r&&n<=e.to?e.year+1:e.year)})},A=(e,t,n)=>{if(!n||!e.length)return!1;let r=new Date(Date.UTC(n.y,n.m,0)).getUTCDate(),i=Math.ceil(n.d/7),a=-(Math.floor((r-n.d)/7)+1);return e.some(e=>e.day===t&&(e.list.includes(i)||e.list.includes(a)))},j=(e,t,n,r)=>{let i=O(n,r.holidays),a=[],o=`week`;if(e.rules.forEach(e=>{let r=null;e.dates?r=n&&k(e.dates,n)?`date`:null:e.ph&&i?r=`ph`:A(e.nth,t,n)?r=`nth`:e.weekdays.includes(t)&&(r=`week`),r&&(a=e.ranges,o=r)}),o===`week`&&i&&!e.ph&&i.hours!=null){let e=c(String(i.hours).replace(/[\u2013\u2014]/g,`-`));e&&(a=e,o=`holiday`)}return{ranges:a,special:o!==`week`,name:i&&(o===`ph`||o===`holiday`)&&i.name||null}},M=e=>{let t=[];return e.slice().sort((e,t)=>e[0]-t[0]).forEach(e=>{let n=t[t.length-1];n&&e[0]<=n[1]?n[1]=Math.max(n[1],e[1]):t.push(e.slice())}),t},N=(e,n,r)=>{let i=[];for(let a=-1;a<=8;a++){let o=((n.day+a)%7+7)%7,s=n.date?y(n.date,a):null;j(e,o,s,r).ranges.forEach(([e,n])=>i.push([a*t+e,a*t+n]))}return M(i)},P=(e,n={})=>{let r=f(e);if(!r)return{state:`unknown`,known:!1,open:null,always:!1,special:!1,minutes:null,change:null,text:e==null||typeof e==`object`?``:String(e)};let i=n.soon==null?60:+n.soon,a=b(n),o=a.minute,s=N(r,a,n),c=s.find(([e,t])=>e<=o&&o<t),l={known:!0,open:!!c,always:!1,special:j(r,a.day,a.date,n).special,minutes:null,change:null};if(c&&c[0]<=-1440&&c[1]>=9*t)Object.assign(l,{state:`open`,always:!0});else{let e=c?null:s.find(([e])=>e>o),n=c?c[1]:e?e[0]:null;if(n==null)l.state=`closed`;else{let e=(n%t+t)%t,r=Math.floor(n/t);c&&e===0&&r===1&&(e=t,r=0),l.minutes=n-o,l.change={minute:e,inDays:r,weekday:((a.day+r)%7+7)%7,date:a.date?g(y(a.date,r)):null},l.state=c?l.minutes<=i?`closing`:`open`:l.minutes<=i?`opening`:`closed`}}let u=F(l,n);return l.text=[u.word,u.before+u.time+u.after].join(` `).trim(),l},F=(e,n={})=>{let r=D(n);if(!e.known)return{word:``,before:``,time:e.text||``,after:``};let i=r(`hours_`+e.state);if(e.always)return{word:i,before:``,time:r(`hours_24`),after:``};if(!e.change)return{word:i,before:``,time:``,after:``};let a=e.state===`closing`||e.state===`opening`?`hours_at`:`hours_until`,[o,s=``]=String(r(a,{time:``})).split(``),c=e.change,l=S(c.minute,n);return{word:i,before:o,time:c.inDays&&e.minutes>=t?T(c.weekday,n)+` `+l:l,after:s}},I=(e,n)=>{let r=D(n);return e.length?e.length===1&&e[0][0]===0&&e[0][1]>=t?[r(`hours_24`)]:e.map(([e,r])=>S(e,n)+`–`+S(r>t?r-t:r,n)):[r(`hours_closed`)]},ee=(e,t={})=>{let n=f(e);if(!n)return[];let r=D(t),i=b(t),a=j(n,i.day,i.date,t).special?-1:i.day,o=[];return n.days.forEach((e,t)=>{let n=JSON.stringify(e),r=o[o.length-1];r&&r.key===n?r.to=t:o.push({from:t,to:t,key:n,ranges:e})}),o.map(e=>({from:e.from,to:e.to,days:e.from===0&&e.to===6?r(`hours_every_day`):e.from===e.to?T(e.from,t):T(e.from,t)+`–`+T(e.to,t),hours:I(e.ranges,t),closed:!e.ranges.length,today:a>=e.from&&a<=e.to}))},L=(e,t={})=>{let n=f(e),r=b(t);if(!n||!r.date)return[];let i=[],a=t.ahead==null?14:+t.ahead;for(let e=0;e<a;e++){let a=y(r.date,e),o=(r.day+e)%7,s=j(n,o,a,t);s.special&&(s.name||JSON.stringify(s.ranges)!==JSON.stringify(n.days[o]))&&i.push({date:g(a),label:E(a,t),name:s.name,hours:I(s.ranges,t),closed:!s.ranges.length,today:e===0})}return i},R=(t,n,r)=>{let i=e.createElement(t);return n&&(i.className=n),r!=null&&(i.innerHTML=r),i},z=MapplicMap.svgIcon,te={clock:z(`<circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path>`),chevron:z(`<path d="m6 9 6 6 6-6"></path>`)},B=e=>typeof e==`function`?e()||{}:e||{},V=new Set,H=(e,t)=>(e._mpHours={render:t,born:Date.now()},V.add(e),t(),e),ne=()=>V.forEach(e=>{e.isConnected?e._mpHours.render():Date.now()-e._mpHours.born>5e3&&V.delete(e)}),re=(e,t,n)=>{e.className=`mp-hours-badge mp-hours-`+t.state+(n.theme===`light`?` mp-hours-light`:``),e.replaceChildren(),e.title=n.variant===`dot`?t.text:``;let r=F(t,n);if(!t.known){let t=R(`span`,`mp-hours-label`);t.textContent=r.time,e.append(R(`span`,`mp-hours-icon`,te.clock),t);return}if(n.slot){let n=R(`span`,`mp-hours-slot`,t.state===`open`?null:te.clock);t.state===`open`&&n.append(R(`span`,`mp-hours-dot`)),e.append(n)}else e.append(R(`span`,`mp-hours-dot`));if(n.variant===`dot`)return;let i=R(`span`,`mp-hours-label`),a=R(`span`,`mp-hours-word`);if(a.textContent=r.word,i.append(a),n.variant!==`short`&&(r.before||r.time||r.after)){let e=R(`span`,`mp-hours-when`);if(r.before&&e.append(r.before),r.time){let t=R(`span`,`mp-hours-time`);t.textContent=r.time,e.append(t)}r.after&&e.append(r.after),i.append(` `,e)}e.append(i)},ie=(e,t)=>{let n=R(`span`,`mp-hours-badge`);return H(n,()=>{let r=B(t),i=P(e,r),a=JSON.stringify([i.state,i.text,r.variant,r.theme]);n._mpKey!==a&&(n._mpKey=a,re(n,i,r))})},ae=(e,t)=>{let n=R(`div`,`mp-hours`),r=`mp-hours-`+Math.random().toString(36).slice(2,9),i=!!B(t).expanded;return H(n,()=>{let a=B(t),o=P(e,a),s=ee(e,a),c=L(e,a),l=JSON.stringify([o.state,o.text,s,c,a.theme,!!a.reducedMotion]),u=R(`span`,`mp-hours-badge`);if(n._mpKey===l)return;if(n._mpKey=l,n.className=`mp-hours`+(a.theme===`light`?` mp-hours-light`:``)+(a.reducedMotion?` mp-still`:``),n.replaceChildren(),re(u,o,Object.assign({},a,{variant:`full`,theme:null,slot:!0})),!o.known||o.always||!s.length){let e=R(`div`,`mp-hours-line`);e.append(u),n.append(e);return}let d=R(`button`,`mp-hours-toggle`),f=R(`div`,`mp-hours-panel`),p=R(`div`,`mp-hours-inner`),m=R(`div`,`mp-hours-table`);if(d.type=`button`,d.setAttribute(`aria-controls`,r),d.setAttribute(`aria-label`,o.text+`. `+D(a)(`hours_toggle`)),d.append(u,R(`span`,`mp-hours-chev`,te.chevron)),f.id=r,s.forEach(e=>{let t=R(`div`,`mp-hours-row`+(e.today?` mp-today`:``)),n=R(`span`,`mp-hours-days`),r=R(`span`,`mp-hours-times`);n.textContent=e.days,e.hours.forEach(e=>{let t=R(`span`,``);t.textContent=e,r.append(t)}),e.today&&t.setAttribute(`aria-current`,`date`),t.append(n,r),m.append(t)}),c.length){let e=R(`div`,`mp-hours-special`);c.forEach(t=>{let n=R(`div`,`mp-hours-row`+(t.today?` mp-today`:``)),r=R(`span`,`mp-hours-days`),i=R(`span`,`mp-hours-times`);if(r.textContent=t.label,t.name){let e=R(`span`,`mp-hours-name`);e.textContent=t.name,r.append(e)}t.hours.forEach(e=>{let t=R(`span`,``);t.textContent=e,i.append(t)}),t.today&&n.setAttribute(`aria-current`,`date`),n.append(r,i),e.append(n)}),m.append(e)}p.append(m),f.append(p);let h=()=>{n.classList.toggle(`mp-open`,i),d.setAttribute(`aria-expanded`,i?`true`:`false`),f.setAttribute(`aria-hidden`,i?`false`:`true`),p.inert=!i};d.onclick=()=>{i=!i,h()},h(),n.append(d,f)})},oe={".mp-hours":`display:flex;flex-direction:column;font-family:Onest,sans-serif;font-size:12px;line-height:1.35;color:var(--mp-h-ink,var(--mp-card-fg))`,".mp-hours-light":`--mp-h-open:var(--mp-success);--mp-h-closing:var(--mp-warning);--mp-h-opening:var(--mp-accent-subtle-fg);--mp-h-closed:var(--mp-fg-muted);--mp-h-ink:var(--mp-fg);--mp-h-muted:var(--mp-fg-muted);--mp-h-hover:var(--mp-surface-hover);--mp-h-line:var(--mp-border)`,".mp-hours-badge":`display:inline-flex;align-items:center;gap:6px;min-width:0;font-family:Onest,sans-serif;font-size:13px;line-height:1.35;color:var(--mp-h-ink,var(--mp-card-fg));white-space:nowrap`,".mp-hours-open":`--mp-h-c:var(--mp-h-open,var(--mp-card-open))`,".mp-hours-closing":`--mp-h-c:var(--mp-h-closing,var(--mp-card-closing))`,".mp-hours-opening":`--mp-h-c:var(--mp-h-opening,var(--mp-card-opening))`,".mp-hours-closed":`--mp-h-c:var(--mp-h-closed,var(--mp-card-closed))`,".mp-hours-dot":`flex:none;width:8px;height:8px;box-sizing:border-box;border-radius:999px;background:var(--mp-h-c)`,".mp-hours-open .mp-hours-dot":`animation:mp-hours-pulse 1.6s ease-out infinite`,".mp-still .mp-hours-dot":`animation:none`,".mp-hours-opening .mp-hours-dot, .mp-hours-closed .mp-hours-dot":`background:transparent;border:2px solid var(--mp-h-c)`,".mp-hours-label":`min-width:0;overflow:hidden;text-overflow:ellipsis`,".mp-hours-word":`font-weight:600;color:var(--mp-h-c)`,".mp-hours-time":`font-weight:600`,".mp-hours-when":`white-space:nowrap`,".mp-hours-icon":`flex:none;width:16px;display:flex;align-items:center;justify-content:center;color:var(--mp-h-muted,var(--mp-card-fg-muted))`,".mp-hours-icon svg":`width:14px;height:14px;stroke-width:1.75`,".mp-hours-line":`min-height:28px;display:flex;align-items:center;justify-content:space-between;gap:12px`,".mp-hours .mp-hours-badge":`white-space:normal;gap:8px;font-size:12px`,".mp-hours-slot":`flex:none;width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--mp-h-c)`,".mp-hours-open .mp-hours-slot .mp-hours-dot":`animation-name:mp-hours-pulse-slot`,".mp-hours .mp-hours-label":`overflow:visible`,".mp-hours-toggle":`width:calc(100% + 16px);min-height:28px;margin:0 -8px;padding:4px 8px;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:12px;border:0;border-radius:calc(7px * var(--mp-rk, 1));background:transparent;font:inherit;color:inherit;text-align:start;cursor:pointer;transition:background-color 150ms ease`,".mp-hours-toggle:hover":`background:var(--mp-h-hover,var(--mp-card-bg-hover))`,".mp-hours-toggle:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-hours-chev":`flex:none;display:flex;color:var(--mp-h-muted,var(--mp-card-fg-muted));transition:transform 200ms ease`,".mp-hours-chev svg":`width:12px;height:12px`,".mp-hours.mp-open .mp-hours-chev":`transform:rotate(180deg)`,".mp-hours-panel":`display:grid;grid-template-rows:0fr;transition:grid-template-rows 200ms ease`,".mp-hours.mp-open .mp-hours-panel":`grid-template-rows:1fr`,".mp-hours.mp-still .mp-hours-panel, .mp-hours.mp-still .mp-hours-chev":`transition:none`,".mp-hours-inner":`min-height:0;overflow:hidden`,".mp-hours-table":`padding:2px 0 4px;display:flex;flex-direction:column`,".mp-hours-row":`display:flex;align-items:baseline;justify-content:space-between;gap:16px;padding:3px 0;color:var(--mp-h-muted,var(--mp-card-fg-muted))`,".mp-hours-row.mp-today":`color:var(--mp-h-ink,var(--mp-card-fg));font-weight:600`,".mp-hours-days":`flex:none;max-width:60%`,".mp-hours-name":`display:block;font-size:11px;font-weight:400;color:var(--mp-h-muted,var(--mp-card-fg-muted))`,".mp-hours-special":`margin-top:6px;padding-top:8px;border-top:1px solid var(--mp-h-line,var(--mp-card-border));display:flex;flex-direction:column`,".mp-hours-times":`min-width:0;display:flex;flex-direction:column;align-items:flex-end;text-align:end;font-variant-numeric:tabular-nums`},se=`@keyframes mp-hours-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mp-h-c) 55%, transparent) } 70%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--mp-h-c) 0%, transparent) } }
4188
+ `),{w:p,h:m}=u(e);l.width=p,l.height=m,c(d),d.fillStyle=`#fff`,d.textAlign=`center`,d.textBaseline=`middle`,f.forEach((e,t)=>d.fillText(e,p/2,104+t*176+7.52));let h=new n.CanvasTexture(l);h.colorSpace=n.SRGBColorSpace,h.anisotropy=r.capabilities.getMaxAnisotropy();let g=t/160,_=new n.Mesh(new n.PlaneGeometry(p*g,m*g),new n.MeshBasicMaterial({map:h,transparent:!0,depthWrite:!1,opacity:0,polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3}));return _.rotation.order=`YXZ`,_.rotation.y=s,_.userData.ry0=s,_.rotation.x=-Math.PI/2,_.position.set(i,o+.02,a),_.renderOrder=2,_},y=e.theme.dark(),b=(t,r,i,o)=>{if(!a)return[];let s=a.parse(r),c=s.xml.viewBox&&s.xml.viewBox.baseVal,l=s.paths.map(t=>{let r=e.three.SVGLoader.createShapes(t);if(!r.length)return null;let i=new n.ShapeGeometry(r,12);return i.computeBoundingBox(),{p:t,g:i}}).filter(Boolean),u=l.length?l.reduce((e,t)=>e.union(t.g.boundingBox),new n.Box3):new n.Box3(new n.Vector3(c&&c.x||0,c&&c.y||0,0),new n.Vector3((c&&c.x||0)+(c&&c.width||60),(c&&c.y||0)+(c&&c.height||60),0)),d=Math.max(1e-6,u.max.x-u.min.x),f=Math.max(1e-6,u.max.y-u.min.y),p=_(i,d/f,o),m=p.h/f,h=[],g=y&&s.paths.every(t=>e.theme.monoSvg(`#`+t.color.getHexString()))&&s.paths.some(e=>e.color.r+e.color.g+e.color.b<1.8);return l.forEach(({p:r,g:a},o)=>{a.translate(-u.min.x-d/2,-u.min.y-f/2,0),a.scale(m,m,1),a.rotateX(Math.PI/2),p.ry&&a.rotateY(p.ry),a.translate(0,i.top+.012+o*.006,0);let s=new n.Mesh(a,e.three.fade(new n.MeshBasicMaterial({color:g?new n.Color(e.theme.invert(`#`+r.color.getHexString())):r.color,side:n.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-1-o,polygonOffsetUnits:-1-o}),t));s.position.set(p.x,i.top,p.z),a.translate(0,-i.top,0),s.userData.ry0=p.ry,s.userData.h=p.h,s.userData.w=p.h*d/f,s.renderOrder=1,h.push(s)}),h},x={},S={},C=e=>x[e]=x[e]||new Promise((t,n)=>{let r=new Image;r.onload=()=>t(S[e]=r),r.onerror=n,r.src=/^(data:|blob:|https?:)/.test(e)?e:`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(e)}),w=(e,t)=>{try{let n=e.getImageData(0,0,t.width,t.height).data,r=0,i=0;for(let e=0;e<n.length;e+=64)n[e+3]>32&&(r++,i+=n[e]+n[e+1]+n[e+2]);return r>0&&i/r>600}catch{return!1}},T=e=>{let t;try{t=e.getContext(`2d`).getImageData(0,0,e.width,e.height).data}catch{return e}let n=e.width,r=e.height,i=-1,a=-1;for(let o=0;o<e.height;o++)for(let s=0;s<e.width;s++)t[(o*e.width+s)*4+3]>8&&(s<n&&(n=s),s>i&&(i=s),o<r&&(r=o),o>a&&(a=o));if(i<0||n===0&&r===0&&i===e.width-1&&a===e.height-1)return e;let o=document.createElement(`canvas`);return n=Math.max(0,n-2),r=Math.max(0,r-2),i=Math.min(e.width-1,i+2),a=Math.min(e.height-1,a+2),o.width=i-n+1,o.height=a-r+1,o.getContext(`2d`).drawImage(e,n,r,o.width,o.height,0,0,o.width,o.height),o},E=(t,i,a,o)=>{let s=(i.naturalWidth||1)/(i.naturalHeight||1),c=1024,l=document.createElement(`canvas`);l.width=s>=1?c:Math.max(8,Math.round(c*s)),l.height=s>=1?Math.max(8,Math.round(c/s)):c;let u=l.getContext(`2d`);u.drawImage(i,0,0,l.width,l.height),y&&e.theme.monoImage(i)&&!w(u,l)&&(u.clearRect(0,0,l.width,l.height),u.filter=`invert(1) hue-rotate(180deg)`,u.drawImage(i,0,0,l.width,l.height));let d=T(l),f=d.width/d.height,p=new n.CanvasTexture(d);p.colorSpace=n.SRGBColorSpace,p.anisotropy=r.capabilities.getMaxAnisotropy();let m=_(a,f,o),h=new n.PlaneGeometry(f*m.h,m.h);h.rotateX(-Math.PI/2),m.ry&&h.rotateY(m.ry);let g=new n.MeshBasicMaterial({map:p,transparent:!0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3,opacity:.999});e.three.fade(g,t);let v=new n.Mesh(h,g);return v.position.set(m.x,a.top+.015,m.z),v.userData.ry0=m.ry,v.userData.h=m.h,v.userData.w=f*m.h,v.renderOrder=1,[v]},D=e=>{e&&[e.label,...e.logo||[]].forEach(e=>{e&&(e.parent&&e.parent.remove(e),e.geometry.dispose(),e.material.map&&e.material.map.dispose(),e.material.dispose())})},O=n=>{let r=s[n.id];D(r),delete s[n.id];let i=e.three.unit(n.id);if(!i||n.hidden)return;let a=i.group,o=s[n.id]={u:n,label:null,logo:null,lo:r?r.lo:0,logoLo:r?r.logoLo:0,fs:0},c=!!t.setting(`logo`),l=p(n);if(j(n.id))return;n.logo&&c&&(n.logo.svg?o.logo=b(n.level,n.logo.svg,n,l):S[n.logo.image]?o.logo=E(n.level,S[n.logo.image],n,l):(e.three.loading||(e=>e))(C(n.logo.image).then(e=>{s[n.id]===o&&(o.logo=E(n.level,e,n,l),o.logo.forEach(e=>a.add(e)))}).catch(()=>{}))),o.logo&&o.logo.forEach(e=>a.add(e));let u=n.logo&&c,d=String(n.labelText??n.name??``),f=n.kind===`amenity`?n.text:t.setting(`uppercase`)===!1?d:d.toUpperCase();if(f&&!u&&n.label!==!1&&!(n.kind===`amenity`&&M())){let e=g(n,f,l),t=n.labelScale||1;o.fs=e.fs*t,o.label=v(e.txt,o.fs,e.centerX+l.dx,e.centerZ+l.dz,n.top,e.ry-(n.labelRotation||0)*Math.PI/180),a.add(o.label)}},k=()=>{d=null,e.data.units().forEach(O)},A=t=>{d=null;let n={};e.data.units().forEach(e=>n[e.id]=e),t.forEach(e=>{n[e]?O(n[e]):(D(s[e]),delete s[e])})},j=t=>{try{return e.plugin(`markers`).covers(t)===!0}catch{return!1}},M=()=>{let t=e.plugin(`markers`);return t.enabled()&&!!t.setting(`amenities`)},N=()=>JSON.stringify([`logo`,`text_fill`,`text_height`,`text_max`,`logo_fill`,`logo_max`,`uppercase`,`snap`,`wrap`,`wrap_gain`].map(e=>t.setting(e)).concat([M(),e.plugin(`markers`).enabled()])),P=0,F=N();return k(),e.provide({refresh:e=>A(e||[]),at:e=>{let t=s[e],n=t&&(t.label||t.logo&&t.logo[0]);return n?[n.position.x,n.position.z]:null},of:e=>{let t=s[e];return t?{label:t.label,logos:(t.logo||[]).slice()}:null}}),e.on(`units`,e=>A(e.ids||[])),e.on(`scheme`,()=>{let t=e.theme.dark();t!==y&&(y=t,e.data.units().forEach(e=>e.logo&&O(e)))}),e.on(`camera`,e=>{P=-e.rotation*Math.PI/180}),e.on(`plugin`,()=>{let e=N();e!==F&&(F=e,k())}),e.onFrame(n=>{let r=e.getState(),a=e.ui.env().reducedMotion?1:1-Math.exp(-n*15),c=!!t.setting(`name`),l=!!t.setting(`logo`),u=+t.setting(`min_px`)||0,d=+t.setting(`logo_min_px`)||0,f=e.ui.size().height/(2*Math.tan(i.fov*Math.PI/360));for(let t in s){let n=s[t],p=n.u,m=r.allLevels||p.level===r.level,h=e.three.levelOpacity(p.level),g=t===r.selected||t===r.routeFrom||t===r.routeTo;if(n.logo&&n.logo.length){n.logo[0].getWorldPosition(o);let e=n.logo[0].userData,t=Math.sqrt((e.h||0)*(e.w||e.h||0))*f/i.position.distanceTo(o);n.logoLo+=((m&&l&&(g||t>=d)?1:0)-n.logoLo)*a;let r=n.logo[0]&&n.logo[0].userData.ry0||0,s=Math.cos(P-r);s<-.2?n.lfl=!0:s>.2&&(n.lfl=!1),n.logo.forEach(e=>{let t=e.material.userData.o0??1;e.material.opacity=t*h*n.logoLo,e.material.transparent=t<1||h<.999||n.logoLo<.999,e.visible=n.logoLo*h>.01,e.rotation.y=n.lfl?Math.PI:0})}let _=n.label;if(!_)continue;let v=_.userData,y=Math.cos(P-v.ry0);y<-.2?v.fl=!0:y>.2&&(v.fl=!1),_.rotation.y=v.ry0+(v.fl?Math.PI:0);let b=e.three.ink(t);b&&_.material.color.copy(b),_.getWorldPosition(o);let x=n.fs*f/i.position.distanceTo(o);n.lo+=((m&&(g||c&&x>=u)?1:0)-n.lo)*a,_.material.opacity=n.lo*h,_.visible=n.lo*h>.01}}),()=>{for(let e in s)D(s[e])}}),MapplicMap.plugin(`scenery`,e=>{let t=e.three.THREE,n=e.three.renderer,r=e.plugin(`scenery`),i=e.data.groundLevel?e.data.groundLevel():0,a=e.three.add(new t.Group,i),o={sceneryFeatures:e.data.scenery()},s=e.data.models(),c=s.find(e=>e.id===`car`),l=e.theme.palette(),u=(t,n)=>/^theme:/.test(t)?t:e.theme.color(t,n),d=t=>e.theme.resolve(t),f=(t,n)=>e.theme.tag(t,n),{rect:p,rnd:m,V:h,Nz:g,fillet:_,thick:v,routeOf:y,at:b,dashes:x,fp2:S,rr:C,shp:w,ext:T,lam:E,CP:D,reg:O,mesh:k,edges:A,flat:j,BX:M,put:N,inst:P}=e.three.kit(a),F=[],I=[],ee=[],L=[],R=null,z=[],te=[];{let n=e.data.site();if(n&&e.data.scenery().length){let r=k(i,T(n.outline,-.6,0),E(e.theme.color(null,`ground.0`)));A(i,r.geometry,e.theme.color(null,`ground.1`),r);let o=n.shadow||0;if(o>0){let e=n.outline,r=e.map(e=>e[0]),i=e.map(e=>e[1]),s=Math.min(...r)-18,c=Math.max(...r)+18,l=Math.min(...i)-18,u=Math.max(...i)+18,d=512/Math.max(c-s,u-l),f=document.createElement(`canvas`);f.width=Math.ceil((c-s)*d),f.height=Math.ceil((u-l)*d);let p=f.getContext(`2d`);p.fillStyle=`#000`,p.fillRect(0,0,f.width,f.height),p.filter=`blur(`+Math.round(9*d)+`px)`,p.fillStyle=`#fff`,p.beginPath(),e.forEach((e,t)=>p[t?`lineTo`:`moveTo`]((e[0]-s)*d,(e[1]-l)*d)),p.closePath(),p.fill();let m=new t.CanvasTexture(f),h=new t.Mesh(new t.PlaneGeometry(c-s,u-l),new t.MeshBasicMaterial({color:1579035,alphaMap:m,transparent:!0,opacity:Math.min(1,o),depthWrite:!1}));h.rotation.x=-Math.PI/2,h.position.set((s+c)/2+2,-7,(l+u)/2+3),h.renderOrder=-1,a.add(h)}}}let B=o.sceneryFeatures,V=e=>B.filter(t=>t.kind===e),H=e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return[Math.min(...t),Math.max(...t),Math.min(...n),Math.max(...n)]};[[`grass`,u(`#e6f0e8`),.004],[`parking`,u(`#eaeaec`),.008],[`sidewalk`,u(`#ffffff`),.008],[`planter`,u(`#e1eee4`),.014],[`sand`,u(`#efebe1`),.01],[`water`,u(`#c9e0ea`),.017]].forEach(([e,t,n])=>{[!1,!0].forEach(r=>{let i=V(e).filter(e=>!!e.recede===r);if(!i.length)return;let a=j(0,i.map(e=>e.poly),n,t);r&&a&&(a.userData.recede=!0)})});let ne=V(`road`).map(e=>({f:e,P:e.radius?_(e.line,e.radius):e.line}));ne.length&&j(0,ne.map(e=>v(e.P,e.f.width+2*(e.f.verge||0))),.012,u(`#ffffff`),!0);let re=ne.map(e=>v(e.P,e.f.width));V(`driveway`).forEach(e=>{let[t,n]=e.line,r=g(h(t,n)),i=[-r[1],r[0]],a=e.width/2,o=[t[0]-r[0],t[1]-r[1]];re.push([[o[0]+i[0]*a,o[1]+i[1]*a],[n[0]+i[0]*a,n[1]+i[1]*a],[n[0]-i[0]*a,n[1]-i[1]*a],[o[0]-i[0]*a,o[1]-i[1]*a]]),e.curb&&[1,-1].forEach(n=>re.push(S([t[0]+i[0]*a*n,t[1]+i[1]*a*n],[i[0]*n,i[1]*n],r,e.curb)))}),re.length&&j(i,re,.02,u(`#dedee2`),!0);let ie=e=>{if(!e.f.label_at)return null;let t=e.f.label_at,n=null;e.P.forEach(e=>{let r=Math.hypot(e[0]-t[0],e[1]-t[1]);(!n||r<n.d)&&(n={d:r,p:e})});let r=y(e.P),i=0,a=1e9;for(let e=0;e<=400;e++){let n=b(r,r.L*e/400),o=Math.hypot(n.p[0]-t[0],n.p[1]-t[1]);o<a&&(a=o,i=r.L*e/400)}return{s:i,p:b(r,i).p}},ae=ne.filter(e=>e.f.markings).flatMap(e=>{let t=e.f.name&&ie(e),n=t?(e.f.label_size||1.2)*String(e.f.name).length*.36+3:0;return x(y(e.P),e.f.markings.dash,e.f.markings.gap,e.f.markings.width).filter(e=>!t||Math.hypot(e[0][0]-t.p[0],e[0][1]-t.p[1])>n)});ae.length&&j(i,ae,.028,u(`#ffffff`,`line`),!0);{let e=ne.flatMap(e=>[e.P[0],e.P[e.P.length-1]]);ne.forEach((r,a)=>{if(!r.f.name)return;let o=r.P,s=y(o);b(s,s.L/2).t[0]<0&&(o=o.slice().reverse());let c=y(o),l=String(r.f.name).toUpperCase(),d=document.createElement(`canvas`),p=d.getContext(`2d`),m=()=>{p.font=`600 96px Onest, sans-serif`,p.letterSpacing=`11.52px`};m();let h=Math.ceil(p.measureText(l).width)+48;d.width=h,d.height=120,p.fillStyle=`#000`,p.fillRect(0,0,h,120),m(),p.fillStyle=`#fff`,p.textAlign=`center`,p.textBaseline=`middle`,p.fillText(l,h/2,64.8);let g=new t.CanvasTexture(d);g.anisotropy=n.capabilities.getMaxAnisotropy();let _=r.f.label_size||Math.min(1.32,r.f.width*.192),v=_*h/120,x=r.f.label_size&&r.f.label_size>r.f.width*.3?0:r.f.width/4,S=new t.MeshBasicMaterial({alphaMap:g,transparent:!0,opacity:.85,depthWrite:!1,side:t.DoubleSide,clippingPlanes:D,alphaTest:.02,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});S.userData.o0=.85,f(S,u(`#ffffff`,`label`));let C=ie({f:r.f,P:o}),w=C?[C.s-v/2]:null;for(let n=w?w[0]:22;w?n===w[0]:n+v<c.L-22;n+=Math.max(70,v+40)){let a=b(c,n+v/2).p;if(!w&&e.some(e=>e!==o[0]&&e!==o[o.length-1]&&Math.hypot(e[0]-a[0],e[1]-a[1])<v/2+r.f.width))continue;let s=[],l=[],u=[];for(let e=0;e<=24;e++){let t=b(c,n+v*e/24),r=[-t.t[1],t.t[0]],i=[t.p[0]-r[0]*x,t.p[1]-r[1]*x];if(s.push(i[0]-r[0]*_/2,.034,i[1]-r[1]*_/2,i[0]+r[0]*_/2,.034,i[1]+r[1]*_/2),l.push(e/24,1,e/24,0),e<24){let t=2*e;u.push(t,t+1,t+2,t+1,t+3,t+2)}}let d=new t.BufferGeometry;d.setAttribute(`position`,new t.Float32BufferAttribute(s,3)),d.setAttribute(`uv`,new t.Float32BufferAttribute(l,2)),d.setIndex(u);let f=k(i,d,S);f.renderOrder=1}})}let oe=[`#ffffff`,`#fafafa`,`#f1f1f3`,`#e9e9ec`,`#d4d4d8`].map(e=>u(e));oe.map(e=>E(e));let se=T(C(-.45,.45,-1.05,1.05,.24),.03,.34),U=Math.PI/180,ce=Object.fromEntries(s.map(e=>[e.id,e])),le=e=>ce[e]||(e===`car`?c:null),ue={},de={};F=[];let fe=(e,n,r)=>{let i=e+(n?`c`:``)+(r?`b`:``);return ue[i]=ue[i]||O(0,r?f(new t.MeshBasicMaterial(Object.assign({},n||{})),e):E(e,Object.assign({flatShading:!0},n||{})))},pe=(e,n)=>{let r=e+n;if(de[r])return de[r];let i;return i=e===`box`?new t.BoxGeometry(1,1,1):e===`cylinder`?new t.CylinderGeometry(.5,.5,1,n):e===`cone`?new t.ConeGeometry(.5,1,n):e===`pyramid`?new t.ConeGeometry(.5,1,4):new t.IcosahedronGeometry(.5,+(n>8)),i.translate(0,.5,0),de[r]=i},me=e=>{let t=e.size||[1,1,1];if(e.shape!==`roundbox`)return[pe(e.shape||`box`,ge(e)),t];let n=Math.max(0,Math.min(+e.radius||.2,t[0]/2-.001,t[2]/2-.001)),r=`rb`+t.join(`,`)+`,`+n;return[de[r]=de[r]||T(C(-t[0]/2,t[0]/2,-t[2]/2,t[2]/2,n),0,t[1]),[1,1,1]]},he=(e,t)=>u(e.color===`paint`?t||`#e4e4e7`:e.color||`#e4e4e7`),ge=e=>Math.max(3,Math.min(16,e.segments||8)),_e=(()=>{let e=document.createElement(`canvas`);e.width=e.height=64;let n=e.getContext(`2d`),r=n.createRadialGradient(32,32,0,32,32,32);return r.addColorStop(0,`rgba(255,255,255,1)`),r.addColorStop(.3,`rgba(255,255,255,0.4)`),r.addColorStop(1,`rgba(255,255,255,0)`),n.fillStyle=r,n.fillRect(0,0,64,64),new t.CanvasTexture(e)})(),ve=[],ye=()=>{let t=e.theme.dark();ve.forEach(e=>{e.m.material=t?e.lit:e.day,e.m.castShadow=e.m.receiveShadow=!t,e.fx.forEach(e=>e.visible=t)})};e.on(`scheme`,ye);let be=null,xe=null,W=()=>{if(xe)return xe;let e=document.createElement(`canvas`);e.width=e.height=128;let n=e.getContext(`2d`),r=n.createImageData(128,128);for(let e=0;e<128;e++)for(let t=0;t<128;t++){let n=Math.min(1,Math.hypot(t+.5-64,e+.5-64)/64),i=1-n*n,a=Math.exp(-n*n*2.6)*i*i,o=(e*128+t)*4;r.data[o]=r.data[o+1]=r.data[o+2]=Math.round(a*255),r.data[o+3]=255}return n.putImageData(r,0,0),xe=new t.CanvasTexture(e)},G=()=>{if(be)return be;let e=document.createElement(`canvas`);e.width=e.height=64;let n=e.getContext(`2d`),r=n.createImageData(64,64);for(let e=0;e<64;e++)for(let t=0;t<64;t++){let n=(t+.5)/64,i=1-(e+.5)/64,a=(1-i)**1.6*Math.sin(Math.PI*n)**.7*Math.min(1,i*8+.35),o=(e*64+t)*4;r.data[o]=r.data[o+1]=r.data[o+2]=Math.round(a*255),r.data[o+3]=255}return n.putImageData(r,0,0),be=new t.CanvasTexture(e)},Se=(e,n,r,i,a,o)=>{let s=e.night===!0?{}:e.night,c=/^#[0-9a-f]{6}$/i.test(s.color||``)?s.color:`#ffe2b0`,l=s.halo==null?1:Math.max(0,Math.min(1,+s.halo||0)),u=Math.max(0,+s.pool||0),d=s.pool_strength==null?.3:Math.max(0,Math.min(1,+s.pool_strength||0)),f=(e,t,n)=>(O(0,t),t.userData.o0=n,e.visible=!1,e.renderOrder=2,p.push(e),e),p=[];if(l){let e=new t.SpriteMaterial(Object.assign({map:_e,color:c,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:.9*l},o||{})),n=f(new t.Sprite(e),e,.9*l),r=Math.max(a[0],a[1],a[2])*4+1.6*l;n.scale.set(r,r,1),n.position.y=a[1]/2,i.add(n)}if(u){let n=e.at||[0,0,0],i=new t.MeshBasicMaterial(Object.assign({map:W(),color:c,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:d,polygonOffset:!0,polygonOffsetFactor:-4,polygonOffsetUnits:-4},o||{})),a=f(new t.Mesh(new t.PlaneGeometry(u*2,u*2),i),i,d),l=Array.isArray(s.pool_at)?s.pool_at:[n[0],n[2]];a.rotation.x=-Math.PI/2,a.position.set(+l[0]||0,.12,+l[1]||0),r.add(a)}if(s.beam){let n=s.beam===!0?{}:s.beam,i=Math.max(.5,+n.length||8),a=Math.max(5,Math.min(170,+n.spread||45))*Math.PI/180,l=n.strength==null?.3:Math.max(0,Math.min(1,+n.strength||0)),u=Math.max(0,+n.width||1.2),d=Array.isArray(n.at)?n.at:[(e.at||[0])[0],(e.at||[0,0,0])[2]],p=[],m=[],h=[];for(let e=0;e<=12;e++){let t=e/12,n=-a/2+a*t;p.push(u*(t-.5),0,0,Math.sin(n)*i,0,Math.cos(n)*i),m.push(t,0,t,1),e<12&&h.push(2*e,2*e+1,2*e+2,2*e+1,2*e+3,2*e+2)}let g=new t.BufferGeometry;g.setAttribute(`position`,new t.Float32BufferAttribute(p,3)),g.setAttribute(`uv`,new t.Float32BufferAttribute(m,2)),g.setIndex(h);let _=new t.MeshBasicMaterial(Object.assign({map:G(),color:c,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:l,side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-4,polygonOffsetUnits:-4},o||{})),v=f(new t.Mesh(g,_),_,l);v.position.set(+d[0]||0,.12,+d[1]||0),r.add(v)}ve.push({m:n,day:n.material,lit:O(0,new t.MeshBasicMaterial(Object.assign({color:c},o||{}))),fx:p})},Ce=(e,r)=>{let i=new t.Group,a=[],o=r&&r.clip?{clippingPlanes:D,clipShadows:!0}:null;return(e.parts||[]).slice(0,40).forEach(e=>{let s=new t.Group,c=e.at||[0,0,0],l=e.size||[1,1,1],u=e.rotate||[0,0,0],d=he(e,r&&r.paint),p=e.glow?Math.min(1,Math.max(.1,+e.glow||1)):0;if(e.shape===`text`){let r=String(e.text||``),a=document.createElement(`canvas`),p=a.getContext(`2d`),m=()=>{p.font=(e.weight||600)+` 128px Onest, sans-serif`,p.letterSpacing=(e.tracking??.04)*128+`px`};m();let h=Math.ceil(p.measureText(r).width)+32;a.width=h,a.height=167,m(),p.fillStyle=`#000`,p.fillRect(0,0,h,167),m(),p.fillStyle=`#fff`,p.textAlign=`center`,p.textBaseline=`middle`,p.fillText(r,h/2,88.62);let g=new t.CanvasTexture(a);g.anisotropy=n.capabilities.getMaxAnisotropy();let _=l[1]*1.3,v=_*h/167;l[0]&&v>l[0]&&(v=l[0],_=v*167/h);let y=new t.Mesh(new t.PlaneGeometry(v,_),new t.MeshBasicMaterial(Object.assign({alphaMap:g,transparent:!0,opacity:.95,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-2},o||{})));f(y.material,d),s.position.set(c[0],c[1],c[2]),y.rotation.set(u[0]*U,u[1]*U,u[2]*U),s.add(y),i.add(s);return}let[m,h]=me(e),g=new t.Mesh(m,fe(d,o,!!p));if(e.night&&Se(e,g,i,s,l,o),s.position.set(c[0],c[1],c[2]),g.scale.set(h[0],h[1],h[2]),g.rotation.set(u[0]*U,u[1]*U,u[2]*U),g.castShadow=!p,g.receiveShadow=!p,s.add(g),p){let e=O(0,new t.SpriteMaterial(Object.assign({map:_e,blending:t.AdditiveBlending,depthWrite:!1,transparent:!0,opacity:.85*p},o||{})));e.userData.o0=.85*p,f(e,d);let n=new t.Sprite(e),r=Math.max(l[0],l[1],l[2])*3+1.4*p;n.scale.set(r,r,1),n.position.y=l[1]/2,s.add(n)}i.add(s),e.anim&&a.push({o:s,a:e.anim,u:1,p0:s.position.clone(),r0:s.rotation.clone(),s0:s.scale.clone()})}),{root:i,an:a}},K=[],we=[],Te=[],Ee=(e,t,n,r)=>we.push(p(e,t,n,r));V(`parking_row`).forEach((e,t)=>{let[n,r,i,a]=H(e.poly),o=r-n>=a-i,s=e.stall_width,c=Math.round((o?r-n:a-i)/s),l=(e,t,n,r)=>o?p(e,t,n,r):p(n,r,e,t),u=o?n:i,d=o?i:n,f=o?a:r;for(let n=0;n<c;n++){let r=u+n*s,i=!!e.ev&&n>=e.ev[0]&&n<=e.ev[1],a=r+s/2,c=(d+f)/2;if(i&&Te.push(l(r,r+s,d,f)),e.vehicle!==`bike`&&m(t+1.7,n+3.1)<e.occ*(i?.83:1)){let r=Math.floor(m(n*1.3,t*7.7)*oe.length);K.push({md:e.model||`car`,pos:o?[a,0,c]:[c,0,a],ry:o?0:Math.PI/2,pi:r})}}for(let e=0;e<=c;e++){let t=u+e*s;we.push(l(t-.05,t+.05,d,f))}e.edge===`north`&&Ee(n,r,i,i+.1),e.edge===`south`&&Ee(n,r,a-.05,a+.05)}),Te.length&&j(i,Te,.012,u(`#dcefe0`)),we.length&&j(i,we,.016,u(`#ffffff`,`line`));let De=[`#cfe5d6`,`#bddbc7`,`#dbece0`].map(e=>E(u(e),{flatShading:!0})),Oe=E(u(`#d4d4d8`)),ke=new t.IcosahedronGeometry(1,0),Ae=new t.ConeGeometry(1,1,6),je=new t.CylinderGeometry(.06,.08,1,5);Ae.translate(0,.5,0),je.translate(0,.5,0);let Me=(e,t,n,r)=>{let i=Math.floor(m(t*2.1,e*1.7)*3),a=m(e,t)*6.28;if(r===`cone`)N(`tk`,je,Oe,[e,0,t],[1,.4*n,1]),N(`cn`+i,Ae,De[i],[e,.3*n,t],[.34*n,1.35*n,.34*n],a);else if(r===`cluster`){let r=.72*n,o=.4*n;N(`tk`,je,Oe,[e,0,t],[1,r,1]),[[0,.06,1],[1,-.08,.8],[1,-.1,.72]].forEach(([s,c,l],u)=>{let d=a+u*2.3,f=(i+u)%3;N(`ic`+f,ke,De[f],[e+Math.cos(d)*o*.75*s,r+c*n,t+Math.sin(d)*o*.75*s],[o*l,o*l*.9,o*l],d)})}else{let r=.82*n,o=.48*n;N(`tk`,je,Oe,[e,0,t],[1,r,1]),N(`ic`+i,ke,De[i],[e,r,t],[o,o*.92,o],a)}};V(`tree`).forEach(e=>Me(e.pt[0],e.pt[1],e.scale||1.45,e.variant||`round`)),I=[],ee=[],Object.keys(P).forEach(e=>{let{geo:n,mat:r,ms:i}=P[e],o=new t.InstancedMesh(n,O(0,r),i.length);i.forEach((e,t)=>o.setMatrixAt(t,e)),o.castShadow=!0,o.receiveShadow=!0,a.add(o),e.startsWith(`car`)&&I.push(o),(e===`tk`||/^(cn|ic)\d$/.test(e))&&ee.push(o)});{let e={};K.forEach(t=>(e[t.md]=e[t.md]||[]).push(t)),Object.entries(e).forEach(([e,n])=>{let r=le(e);r&&(r.parts||[]).slice(0,40).forEach(e=>{let r=e.at||[0,0,0];e.size;let i=e.rotate||[0,0,0],[o,s]=me(e),c=new t.Matrix4().makeTranslation(r[0],r[1],r[2]).multiply(new t.Matrix4().compose(new t.Vector3,new t.Quaternion().setFromEuler(new t.Euler(i[0]*U,i[1]*U,i[2]*U)),new t.Vector3(s[0],s[1],s[2]))),l={};n.forEach(t=>{let n=he(e,oe[t.pi]);(l[n]=l[n]||[]).push(t)}),Object.entries(l).forEach(([e,n])=>{let r=new t.InstancedMesh(o,fe(e),n.length);n.forEach((e,n)=>r.setMatrixAt(n,new t.Matrix4().compose(new t.Vector3(...e.pos),new t.Quaternion().setFromEuler(new t.Euler(0,e.ry,0)),new t.Vector3(.5,.5,.5)).multiply(c))),r.castShadow=!0,r.receiveShadow=!0,a.add(r),I.push(r)})})})}V(`building`).forEach(t=>{let n=M(t.poly,0,t.height||9*e.geo.metres(1),u(`#f4f4f5`),u(`#d4d4d8`,`edge`));t.recede&&n&&n.traverse(e=>e.userData.recede=!0)}),V(`bench`).forEach(e=>{let[t,n,r,i]=H(e.poly);M(C(t,n,r,i,.3),.03,e.height||.42,u(`#ffffff`))}),L=[],V(`bus_stop`).forEach((e,t)=>{let[n,r,a,o]=H(e.poly),s=e.height||.5,c=`scn-`+(e.location||`bus-`+t),l={id:c,loc:e.location,mats:[],lines:[],pos:[(n+r)/2,s+.06,(a+o)/2]};[[p(n+.1,r-.1,a+.1,a+.25),0,s],[p(n,r,a,o),s,s+.06]].forEach(([e,t,n])=>{let r=E(u(`#fafafa`)),a=k(i,T(e,t,n),r,!0),o=A(i,a.geometry,u(`#a1a1aa`,`edge`),a);a.userData.scn=c,l.mats.push(r),l.lines.push(o.material)}),L.push(l)});let Ne=()=>({n:[new t.Color(d(u(`#fafafa`))),new t.Color(d(u(`#a1a1aa`,`edge`)))],h:[new t.Color(d(u(`#3f3f46`))),new t.Color(d(u(`#27272a`)))]});R=Ne(),e.on(`scheme`,()=>R=Ne()),V(`canopy`).forEach(e=>{let t=e.height||1.5;(e.posts||[]).forEach(e=>M(p(e[0]-.2,e[0]+.2,e[1]-.2,e[1]+.2),0,t,u(`#ffffff`),u(`#d4d4d8`,`edge`))),M(e.poly,t,t+.15,u(`#ffffff`),u(`#d4d4d8`,`edge`))}),V(`charger`).forEach(e=>M(p(e.pt[0]-.16,e.pt[0]+.16,e.pt[1]-.16,e.pt[1]+.16),0,.45,u(`#ffffff`),u(`#a1a1aa`,`edge`))),V(`model`).forEach(e=>{let t=le(e.model);if(!t||!e.pt)return;let n=Ce(t),r=n.root;r.position.set(e.pt[0],0,e.pt[1]),r.rotation.y=(e.rot||0)*U,r.scale.setScalar((e.scale||1)/2),a.add(r),F.push(...n.an);let i=e.anim||t.anim;i&&F.push({o:r,a:i,u:.5,rt:i.type===`path`&&i.pts&&i.pts.length>1?y(i.loop===!1?i.pts:i.pts.concat([i.pts[0]])):null,p0:r.position.clone(),r0:r.rotation.clone(),s0:r.scale.clone()})});let Pe=V(`lane`);z=Pe.map(e=>y(e.radius?_(e.line,e.radius):e.line)),te=Pe.flatMap((e,t)=>{let n=e.traffic||{cars:0,speed:10};return Array.from({length:n.cars},(e,r)=>({r:t,s0:(r/n.cars+m(t+.3,r+.7)*.2)%1,v:n.speed*(.92+m(r+.1,t+.9)*.16),pi:Math.floor(m(t*3.1,r*5.3)*oe.length)}))}).map(({r:e,s0:n,v:r,pi:i})=>{let o=le(Pe[e].model||`car`),s;if(o){let e=Ce(o,{paint:oe[i],clip:!0});s=e.root,s.scale.setScalar(.5),F.push(...e.an)}else s=new t.Mesh(se,E(oe[i],{clippingPlanes:D,clipShadows:!0})),s.castShadow=!0,s.receiveShadow=!0;return a.add(s),{r:e,s0:n,v:r,m:s}}),L.forEach(t=>{let n=()=>e.data.location(t.loc)||{};e.view.feature(t.id,{kind:`bus_stop`,anchor:()=>[t.pos[0],e.three.levelY(i)+t.pos[1],t.pos[2]],tip:()=>{let t=n();return(t.mapplic||{}).tooltip===!1?null:{text:t.name||e.ui.t(`bus_stop`)}},info:()=>{let t=n();return{name:t.name||e.ui.t(`bus_stop`),description:t.description||``,departures:((t.data||{}).departures||[]).map(e=>({line:e.line,to:e.to,minutes:e.min}))}}})});let Fe=()=>{let n=e.three.kit(),i=n.lam,a=e.data.connectors(),o=e.data.levels().length,s=e.three.floorTop??.3,c=e.three.storey,d=[],p=[],m=[],h={},g=[],_=l.lift.map(e=>new t.Color(e)),v={n:l.escalator.map(e=>new t.Color(e)),h:l.escalatorActive.map(e=>new t.Color(e))};e.on(`scheme`,()=>{let t=e.theme.palette();_.forEach((e,n)=>e.set(t.lift[n])),v.n.forEach((e,n)=>e.set(t.escalator[n])),v.h.forEach((e,n)=>e.set(t.escalatorActive[n]))});let y=t=>(e.three.add(t),p.push(t),t),b=null,x=null,S=0;for(let r=0;r<o;r++)if(a.filter(e=>e.type===`elevator`).forEach((e,a)=>{if(!e.layers.includes(r))return;let o=new t.BoxGeometry(1,1,1);o.translate(0,.5,0);let c=i(u(`#fafafa`),{transparent:!0,opacity:.55,depthWrite:!1});c.userData.o0=.55;let l=n.mesh(r,o,c,!1);p.push(l),l.position.set(e.centerX,s,e.centerZ),l.rotation.y=-Math.atan2(e.axisZ,e.axisX),l.scale.set(e.length,2,e.width),n.edges(r,o,u(`#a1a1aa`,`edge`),l),l.userData.feat=`lift-`+a,l.userData.levelIndex=r,(g[a]=g[a]||[])[r]=l}),r<o-1&&a.filter(e=>e.type===`stairs`&&e.layers[0]===r).forEach(n=>{let a=e.geo.stair(n),o=new t.Group;o.matrixAutoUpdate=!1,y(o);let s=i(u(`#e4e4e7`)),c=i(u(`#ffffff`)),l=f(new t.LineBasicMaterial,u(`#d4d4d8`,`edge`)),d=new t.MeshDepthMaterial({alphaHash:!0}),p=new t.BoxGeometry(1,1,1),g=new t.EdgesGeometry(p),_=[],v=`esc-`+n.id,b=(e,n,i,a,u,f,m)=>{let h=new t.Mesh(p,[s,s,c,s,s,s]);h.position.set(e,(i+a)/2,n),h.scale.set(u,Math.max(.02,a-i),f),m&&(h.rotation.y=m),h.castShadow=!0,h.receiveShadow=!0,h.customDepthMaterial=d,h.userData.esc=v,h.userData.feat=v,h.userData.escLo=r,h.add(new t.LineSegments(g,l)),o.add(h),_.push(h)};if(a.spiral){let e=a.th1-a.th0,n=new t.Mesh(new t.CylinderGeometry(.1,.1,a.H,12),s);n.position.y=a.H/2,n.castShadow=!0,n.userData.esc=v,n.userData.feat=v,n.userData.escLo=r,o.add(n),_.push(n);for(let t=0;t<a.n;t++){let n=a.th0+e*(t+.5)/a.n,r=(t+1)*a.H/a.n;b(Math.cos(n)*a.R/2,Math.sin(n)*a.R/2,r-.08,r,a.R,Math.abs(e)/a.n*a.R*.75,-n)}}else a.F.forEach(e=>{let t=Math.max(3,Math.round((e.y1-e.y0)/.1)),n=e.d[1]===0;for(let r=0;r<t;r++){let i=(r+.5)*e.L/t,a=e.y0+(r+1)*(e.y1-e.y0)/t;b(e.o[0]+e.d[0]*i,e.o[1]+e.d[1]*i,Math.max(0,a-.5),a,n?e.L/t:e.w,n?e.w:e.L/t)}}),a.LD.forEach(e=>b(e.c[0],e.c[1],Math.max(0,e.y-.5),e.y,e.sa,e.sb));let x={id:v,sw:a,m:o,hit:_,stair:!0,mats:[s,c,l],dm:d,lo:r,down:!1,ux:n.axisX*n.upSign,uz:n.axisZ*n.upSign,length:n.length,width:n.width,centerX:n.centerX,centerZ:n.centerZ,op:1,tr:!1,yc:0};m.push(x),h[v]=x}),r<o-1&&a.filter(e=>e.type===`escalator`&&e.layers[0]===r).forEach(e=>{let n=i(u(`#e4e4e7`)),a=i(u(`#f4f4f5`)),o=new t.BoxGeometry(e.length,.22,e.width),s=f(new t.LineBasicMaterial,u(`#d4d4d8`,`edge`)),c=new t.MeshDepthMaterial({alphaHash:!0}),l=new t.Mesh(o,[n,n,a,n,n,n]);l.castShadow=!0,l.receiveShadow=!0,l.customDepthMaterial=c,l.matrixAutoUpdate=!1,y(l),l.add(new t.LineSegments(new t.EdgesGeometry(o,25),s));let d=i(u(`#ffffff`)),p=new t.BoxGeometry(1,1,1),g=new t.Group;g.matrixAutoUpdate=!1,y(g);let _=Math.max(4,Math.round(e.length*4)),v=new t.InstancedMesh(p,d,_+1);v.castShadow=!0,v.receiveShadow=!0,v.customDepthMaterial=c,v.frustumCulled=!1,v.instanceMatrix.setUsage(t.DynamicDrawUsage),g.add(v);let b=new t.EdgesGeometry(p).attributes.position.array,x=new t.BufferGeometry,S=new t.BufferAttribute(new Float32Array(b.length*(_+1)),3);S.setUsage(t.DynamicDrawUsage),x.setAttribute(`position`,S);let C=new t.LineSegments(x,s);C.frustumCulled=!1,g.add(C);let w={im:v,ev:b,la:S,lg:x,mx:new t.Matrix4},T=`esc-`+e.id,E={id:T,m:l,sg:g,sts:w,sn:_,up:e.dir!==`down`,mats:[n,a,s,d],dm:c,lo:r,down:e.dir===`down`,ux:e.axisX*e.upSign,uz:e.axisZ*e.upSign,length:e.length,width:e.width,centerX:e.centerX,centerZ:e.centerZ,op:1,tr:!1,yc:0};l.userData.esc=T,l.userData.feat=T,l.userData.escLo=r,m.push(E),h[T]=E}),r<o-1){let e=m.filter(e=>e.lo===r&&!e.stair),t=new Set,n=(e,t)=>{let n=t.centerX-e.centerX,r=t.centerZ-e.centerZ,i=Math.abs(n*e.ux+r*e.uz),a=Math.abs(-n*e.uz+r*e.ux);return Math.abs(e.ux*t.ux+e.uz*t.uz)>.98&&Math.abs(e.length-t.length)<=.1*Math.max(e.length,t.length)&&i<.25*e.length&&a-(e.width+t.width)/2<Math.min(e.width,t.width)};e.forEach(i=>{if(t.has(i))return;let a=[i];t.add(i);for(let r=0;r<a.length;r++)e.forEach(e=>{!t.has(e)&&n(a[r],e)&&(a.push(e),t.add(e))});let o=a.length>1?`escp-`+r+`-`+i.id:null;a.forEach(e=>{e.gid=o||e.id}),o&&(h[o]={pair:!0,lo:r,down:!1,mem:a})}),m.filter(e=>e.lo===r&&e.stair).forEach(e=>{e.gid=e.id})}let C=e=>{let t=[];if(!e.stair){let n=e.length/2,r=.11+c/e.length*e.length/(e.sn||8)+.03;for(let e=0;e<=12;e++)t.push([-n+2*n*e/12,r,0]);return t}let n=e.sw;if(!n)return null;if(n.spiral){let e=n.R*.6,r=n.n*2;for(let i=0;i<=r;i++){let a=i/r,o=n.th0+(n.th1-n.th0)*a;t.push([Math.cos(o)*e,n.H*a+n.H/n.n+.03,Math.sin(o)*e])}return t}return n.F.forEach((e,r)=>{let i=Math.max(3,Math.round((e.y1-e.y0)/.1)),a=(e.y1-e.y0)/i+.03;if(r&&n.LD[r-1]){let e=n.LD[r-1];t.push([e.c[0],e.y+.03,e.c[1]])}for(let n=0;n<=8;n++){let r=n/8;t.push([e.o[0]+e.d[0]*e.L*r,e.y0+(e.y1-e.y0)*r+a,e.o[1]+e.d[1]*e.L*r])}}),t},w=t=>{let n=e.getState();return n.allLevels?t.down?t.lo:t.lo+1:n.level===t.lo?t.lo+1:t.lo},T=t=>{let n=e.getState(),r=n.allLevels?t.down?t.lo+1:t.lo:n.level;return w(t)>r};Object.entries(h).forEach(([t,n])=>{let r=n.pair?n.mem:[n],i=e=>r.reduce((t,n)=>t+n[e],0)/r.length;d.push(e.view.feature(t,{kind:n.stair||n.pair&&n.mem[0].stair?`stairs`:`escalator`,lo:n.lo,x:i(`centerX`),z:i(`centerZ`),pick:()=>(e.view.setLevel(w(n)),!0),tip:()=>{let t=T(n);return{text:(e.data.levels()[w(n)]||{}).name||e.ui.t(t?`go_upstairs`:`go_downstairs`),up:t,down:!t}},anchor:()=>[i(`centerX`),Math.max(...r.map(e=>e.yc))+.2,i(`centerZ`)],meshes:n.pair?null:()=>n.m.visible&&n.op>.5?n.hit||[n.m]:[],resolve:()=>e.getState().allLevels?n.id:n.gid||n.id}))});let E=a.filter(e=>e.type===`elevator`);return g.forEach((t,n)=>{let r=`lift-`+n,i=E[n],a=()=>{let t=e.getState();return(t.selected===r?x:null)??b??t.level},o=(n,r)=>{let i=t[n];return i?[i.position.x,e.three.levelY(n)+s+i.scale.y*r,i.position.z]:null};d.push(e.view.feature(r,{kind:`elevator`,at:e=>{b=e},meshes:()=>t.filter((t,n)=>t&&t.visible&&t.parent&&t.parent.visible&&e.three.levelOpacity(n)>.5),resolve:e=>{let t=e.userData.levelIndex??(e.parent&&e.parent.userData.levelIndex);return typeof t==`number`&&(b=t),r},pick:()=>(x=b??e.getState().level,!1),info:()=>{let t=e.getState(),n=a();return{name:e.ui.t(`elevator`),level:t.allLevels?null:n,floors:e.data.levels().filter(e=>!i||i.layers.includes(e.index)).map(e=>({index:e.index,name:e.name,short:e.short}))}},anchor:()=>o(a(),1),focus:()=>o(b??e.getState().level,.5),tip:()=>({text:e.ui.t(`elevator`)})}))}),d.push(e.onFrame(t=>{let n=e.getState(),i=e.ui.env(),a=i.reducedMotion?1:1-Math.exp(-t*15),o=e.three.explode(),l=e.three.levelY,u=e.three.levelOpacity,d=e.three.rise();!i.reducedMotion&&r.setting(`connectorsMoving`)&&(S+=t),g.forEach(e=>{let t=[];e.forEach((e,n)=>{e&&t.push(n)}),t.forEach((n,r)=>{let i=t[r+1],a=i==null?c:Math.max(.6,Math.min(l(i)-l(n),d*(i-n)));e[n].scale.y=a-s})}),m.forEach(e=>{let t={y:l(e.lo),op:u(e.lo)},r={y:l(e.lo+1),op:u(e.lo+1)},i=c,d=i/e.length,f=e.down?t.y+i+(r.y-t.y-i)*o:t.y,p=t.op*(1-o)+(e.down?r.op:t.op)*o,m=f+s+(e.down?-i/2:i/2);if(e.yc=m,e.stair)e.m.matrix.makeRotationY(-Math.atan2(e.uz,e.ux)).setPosition(e.centerX,f+s,e.centerZ);else if(e.m.matrix.set(e.ux,0,-e.uz,e.centerX,d,1,0,m,e.uz,0,e.ux,e.centerZ,0,0,0,1),e.sg){e.sg.matrix.set(e.ux,0,-e.uz,e.centerX,0,1,0,m,e.uz,0,e.ux,e.centerZ,0,0,0,1),e.sg.matrixWorldNeedsUpdate=!0,e.sg.visible=p>.01&&!0;let t=S*1.4%1,n=e.up?t:1-t,r=e.length/e.sn,i=e.length/2,a=e.sts,o=a.ev,s=a.la.array,c=e.width*.86,l=0;for(let t=0;t<=e.sn;t++){let e=Math.max(-i,-i+(t-1+n)*r),u=Math.min(i,-i+(t+n)*r),f=u-e;if(f<=.01)continue;let p=d*u+.11,m=d*e+.06,h=(e+u)/2,g=(p+m)/2,_=Math.max(.01,f-.015),v=p-m;a.im.setMatrixAt(l,a.mx.makeScale(_,v,c).setPosition(h,g,0));let y=l*o.length;for(let e=0;e<o.length;e+=3)s[y+e]=o[e]*_+h,s[y+e+1]=o[e+1]*v+g,s[y+e+2]=o[e+2]*c;l++}a.im.count=l,a.im.instanceMatrix.needsUpdate=!0,a.la.needsUpdate=!0,a.lg.setDrawRange(0,l*o.length/3)}e.m.matrixWorldNeedsUpdate=!0,e.m.visible=p>.01&&!0;let h=p<.999,g=h&&(p<e.op-1e-4||p===e.op&&e.out);(h!==e.tr||g!==e.out)&&(e.tr=h,e.out=g,e.mats.forEach(e=>{e.transparent=h,e.depthWrite=!g,e.needsUpdate=!0}),[e.m,e.sg].forEach(e=>e&&e.traverse(e=>e.renderOrder=h?-10:0))),p!==e.op&&(e.op=p,e.dm.opacity=p,e.mats.forEach(e=>e.opacity=p));let _=v[n.hovered===e.id||n.hovered===e.gid?`h`:`n`];e.mats.forEach((e,t)=>e.color.lerp(_[t]||_[1],a))}),g.forEach((e,t)=>{let r=`lift-`+t;e.forEach((e,t)=>{let i=n.hovered===r&&t===(b??n.level)||n.selected===r&&t===(x??n.level);e&&e.material.color.lerp(_[+!!i],a)})})})),{get:e=>{let t=h[e];return t&&!t.pair?{mesh:t.m,path:C(t)}:null},off:()=>{d.forEach(e=>e());let e=new Set,t=new Set;p.forEach(n=>{n.parent&&n.parent.remove(n),n.traverse(n=>{n.geometry&&e.add(n.geometry),[].concat(n.material||[]).forEach(e=>t.add(e))})}),e.forEach(e=>e.dispose()),t.forEach(e=>e.dispose()),m.forEach(e=>e.dm&&e.dm.dispose())}}},Ie=r.setting(`connectors`)?Fe():null;e.on(`plugin`,()=>{let e=!!r.setting(`connectors`);e&&!Ie?Ie=Fe():!e&&Ie&&(Ie.off(),Ie=null)}),e.provide({connector:e=>Ie?Ie.get(e):null});let Le=()=>{let e=!!r.setting(`cars`);I.forEach(t=>t.visible=e),te.forEach(t=>t.m.visible=e);let t=r.setting(`trees`)!==!1;ee.forEach(e=>e.visible=t)};Le(),ye(),e.on(`plugin`,Le);let Re=(e,t,n)=>{let r=Math.min(1.2,e.L/8),i=t=>(n?b(e,(t+e.L)%e.L):b(e,Math.max(0,Math.min(e.L,t)))).p,a=i(t-r),o=i(t+r);return Math.atan2(o[0]-a[0],o[1]-a[1])},ze=null,Be=1,Ve=-1;e.on(`camera`,e=>{(e.home||ze==null)&&(ze=e.distance),Be=ze/Math.max(1e-6,e.distance)});let He=t=>{let n=e.three.levelOpacity(i);a.traverse(e=>[].concat(e.userData.recede&&e.material||[]).forEach(e=>{e.userData.so0===void 0&&(e.userData.so0=e.userData.o0??e.opacity??1),e.userData.o0=e.userData.so0*t;let r=e.transparent;e.transparent=e.userData.o0<.999||n<.999,e.opacity=e.userData.o0*n,r!==e.transparent&&(e.needsUpdate=!0)}))},Ue=0,We=0,Ge=B.some(e=>e.recede);return e.onFrame(t=>{if(Ge){let t=Math.min(1,Math.max(0,(Be-1)/1.5)),n=(1-.85*t*t*(3-2*t))*(1-.8*(e.three.explode()||0));Math.abs(n-Ve)>.004&&(Ve=n,He(n))}let n=e.ui.env(),i=e.getState(),a=n.reducedMotion?1:1-Math.exp(-t*15);n.reducedMotion||(Ue+=t),!n.reducedMotion&&r.setting(`carsMoving`)&&(We+=t),L.forEach(e=>{let t=R[i.hovered===e.id||i.selected===e.id?`h`:`n`];e.mats.forEach(e=>e.color.lerp(t[0],a)),e.lines.forEach(e=>e.color.lerp(t[1],a))}),te.forEach(e=>{let t=z[e.r],n=(e.s0*t.L+We*e.v)%t.L,r=b(t,n);e.m.position.set(r.p[0],0,r.p[1]),e.m.rotation.y=Re(t,n,!0)}),F.forEach(e=>{let t=e.a,n=t.type,r=t.speed,i=2*Math.PI*(r??.5)*Ue+(t.phase||0),a=[`x`,`y`,`z`].includes(t.axis)?t.axis:n===`sway`?`z`:`y`;if(n===`spin`)e.o.rotation[a]=e.r0[a]+(r??45)*Math.PI/180*Ue;else if(n===`sway`)e.o.rotation[a]=e.r0[a]+Math.sin(i)*(t.amount??8)*Math.PI/180;else if(n===`bob`)e.o.position.y=e.p0.y+Math.sin(i)*(t.amount??.2)*e.u;else if(n===`pulse`)e.o.scale.copy(e.s0).multiplyScalar(1+Math.sin(i)*(t.amount??.08));else if(n===`path`&&e.rt){let t=b(e.rt,Ue*(r??1.5)/2%e.rt.L);e.o.position.set(t.p[0],e.p0.y,t.p[1]),e.o.rotation.y=Re(e.rt,Ue*(r??1.5)/2%e.rt.L,e.a.loop!==!1)}})}),()=>{Ie&&=(Ie.off(),null);let e=new Set,t=new Set;a.traverse(n=>{n.geometry&&e.add(n.geometry),[].concat(n.material||[]).forEach(e=>t.add(e))}),e.forEach(e=>e.dispose()),t.forEach(e=>{e.map&&e.map.dispose(),e.alphaMap&&e.alphaMap.dispose(),e.dispose()})}}),MapplicMap.plugin(`wayfinding`,e=>{let t=e.three.THREE,n=e.three.floorTop??.3,r=document,i=e.data.levels(),a=e.ui.container,o=e.plugin(`wayfinding`),s={open:!1,out:!1,from:null,to:null,picking:null,route:null,done:!1,accessible:!1,fromGroup:null,toGroup:null,steps:!1,compact:!1,collapseNext:!1},c=()=>!!o.setting(`accessible`)&&s.accessible,l=()=>{let e=c()?_(s.to):null;return e&&e.accessible===!1?e:null},u=null,d=0,f=0,p=null,m=MapplicMap.svgIcon,h={route:m(`<circle cx="6" cy="19" r="3"></circle><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"></path><circle cx="18" cy="5" r="3"></circle>`),x:m(`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`),swap:m(`<path d="m21 16-4 4-4-4"></path><path d="M17 20V4"></path><path d="m3 8 4-4 4 4"></path><path d="M7 4v16"></path>`),up:m(`<path d="m5 12 7-7 7 7"></path><path d="M12 19V5"></path>`),dn:m(`<path d="M12 5v14"></path><path d="m19 12-7 7-7-7"></path>`),wheelchair:m(`<circle cx="16" cy="4" r="1"></circle><path d="m18 19 1-7-6 1"></path><path d="m5 8 3-3 5.5 3-2.36 3.5"></path><circle cx="9" cy="16" r="5"></circle>`),chevron:m(`<path d="m6 9 6 6 6-6"></path>`),locate:m(`<path d="M2 12h3"></path><path d="M19 12h3"></path><path d="M12 2v3"></path><path d="M12 19v3"></path><circle cx="12" cy="12" r="7"></circle>`),flag:m(`<path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"></path><path d="M4 22v-7"></path>`),arrowRight:m(`<path d="M5 12h14"></path><path d="m12 5 7 7-7 7"></path>`),swapH:m(`<path d="M8 3 4 7l4 4"></path><path d="M4 7h16"></path><path d="m16 21 4-4-4-4"></path><path d="M20 17H4"></path>`),esc:`<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M18.92,7.85h-2.35l-6.52,11.76c-.25.43-.72.71-1.22.71h-3.75c-1.15,0-2.08-.93-2.08-2.08s.93-2.08,2.08-2.08h2.35l6.52-11.76c.25-.43.72-.71,1.22-.71h3.75c1.15,0,2.08.93,2.08,2.08s-.93,2.08-2.08,2.08Z"></path></svg>`,stairs:`<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M19.5,6h-2.13v4.99h-3.87v4.99h-3.87l.04,5.01h-5.17c-.83,0-1.5-.68-1.5-1.5s.67-1.5,1.5-1.5h2.13v-4.99h3.87v-5.01h3.87V3h5.13c.82,0,1.5.67,1.5,1.5s-.68,1.5-1.5,1.5Z"></path></svg>`,lift:`<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M7.05,3c1.03,0,1.88.84,1.88,1.88s-.84,1.88-1.88,1.88-1.88-.84-1.88-1.88.84-1.88,1.88-1.88ZM10.8,13.5c0,.83-.67,1.5-1.5,1.5v4.5c0,.82-.67,1.5-1.5,1.5h-1.5c-.83,0-1.5-.68-1.5-1.5v-4.5c-.83,0-1.5-.67-1.5-1.5v-2.25c0-1.65,1.35-3,3-3h1.5c1.65,0,3,1.35,3,3v2.25ZM20.58,14.64l-2.4,3.84c-.3.46-.97.46-1.28,0l-2.4-3.84c-.3-.49.06-1.14.65-1.14h4.8c.58,0,.94.65.63,1.14ZM19.95,10.5h-4.8c-.59,0-.95-.65-.63-1.16l2.4-3.84c.3-.46.97-.46,1.28,0l2.4,3.84c.3.51-.06,1.16-.65,1.16Z"></path></svg>`,warn:m(`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"></path><path d="M12 9v4"></path><path d="M12 17h.01"></path>`)},g=(e,t,n,i)=>{let a=r.createElement(e);return t&&(a.className=t),i&&(a.style.cssText=i),n!=null&&(a.innerHTML=n),a},_=t=>t?e.data.find({id:t}):null,v=e=>{if(!e)return``;let t=typeof e.level==`number`?i[e.level]:i.find(t=>t.name===e.level||t.short===e.level);return t?t.short:String(e.level||``)},y=new t.MeshBasicMaterial({side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),b=new t.MeshBasicMaterial({side:t.DoubleSide,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});e.theme.tag(y,null,`accent`),e.theme.tag(b,null,`palette:routeHalo`);let x=new t.CircleGeometry(.13,12);x.rotateX(-Math.PI/2);let S=new t.MeshBasicMaterial({polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3}),C=new t.CylinderGeometry(.17,.17,1,10);e.theme.tag(S,null,`accent-dot`);let w={},T=[[`blue`,y,`accent`],[`white`,b,`palette:routeHalo`],[`dot`,S,`accent-dot`]],E={blue:.38,white:0,dot:.38},D=(t,n)=>{if(t==null||!i[t])return{blue:y,white:b,dot:S};n??=t;let r=t+`:`+n;if(!w[r]){let i=w[r]={li:t,top:n,d:0};T.forEach(([n,r,a])=>{let o=r.clone();e.theme.tag(o,null,a),e.three.fade(o,t),i[n]=o})}return w[r]},O=0,k=(t,n,r)=>{let i=e.getState().level,a=n&&O?Math.min(1,(t-O)/60):1;O=t,Object.values(w).forEach(t=>{let n=+(!r&&t.top<i),o=t.d+(n-t.d)*a;if(Math.abs(n-o)<.01&&(o=n),o===t.d&&t.ok)return;t.d=o,t.ok=!0;let s=e.three.levelOpacity(t.li);[`blue`,`white`,`dot`].forEach(e=>{let n=t[e],r=1-(1-E[e])*o,i=r<1||s<.999;n.userData.o0=r,n.opacity=r*s,n.visible=r>.01,n.transparent!==i&&(n.transparent=i,n.needsUpdate=!0)})})},A=(e,n)=>{let r=new t.BufferGeometry;return r.setAttribute(`position`,new t.Float32BufferAttribute(e,3)),r.setIndex(n),r.setDrawRange(0,0),r},j=(t,n,r)=>{let i=e.geo.offset(t,n/2),a=e.geo.offset(t,-n/2),o=[],s=[];return t.forEach((e,t)=>{if(o.push(i[t][0],r,i[t][1],a[t][0],r,a[t][1]),t){let e=2*(t-1);s.push(e,e+1,e+2,e+1,e+3,e+2)}}),A(o,s)},M=(e,t,n)=>{let r=[],i=[];return e.forEach((a,o)=>{let s=e[Math.max(0,o-1)],c=e[Math.min(e.length-1,o+1)],l=c[0]-s[0],u=c[2]-s[2],d=Math.hypot(l,u)||1,f=-u/d*t/2,p=l/d*t/2;if(r.push(a[0]+f,a[1]+n,a[2]+p,a[0]-f,a[1]+n,a[2]-p),o){let e=2*(o-1);i.push(e,e+1,e+2,e+1,e+3,e+2)}}),A(r,i)},N=(e,t)=>{let n=[0];for(let r=1;r<e.length;r++)n.push(n[r-1]+(t?Math.hypot(e[r][0]-e[r-1][0],e[r][1]-e[r-1][1],e[r][2]-e[r-1][2]):Math.hypot(e[r][0]-e[r-1][0],e[r][1]-e[r-1][1])));return n},P=(e,t,n)=>{let r=1;for(;r<t.length-1&&t[r]<n;)r++;let i=e[r-1],a=e[r],o=(n-t[r-1])/(t[r]-t[r-1]||1);return[i[0]+(a[0]-i[0])*o,i[1]+(a[1]-i[1])*o,i[2]==null?0:i[2]+(a[2]-i[2])*o]},F=()=>{u&&=(u.objs.forEach(e=>{e.parent&&e.parent.remove(e),e.geometry&&e.geometry!==x&&e.geometry!==C&&e.geometry.dispose()}),null)},I=r=>{let i=[],a=0,o=r.legs.map(r=>{let o=Object.assign({},r);if(r.kind===`walk`){o.cum=N(r.points),o.len=o.cum[o.cum.length-1];let a=D(r.level);o.mW=new t.Mesh(j(r.points,.85,n+.03),a.white),o.mB=new t.Mesh(j(r.points,.45,n+.045),a.blue),[o.mW,o.mB].forEach(t=>{t.renderOrder=1,e.three.add(t,r.level),i.push(t)})}else{o.len=5;let n=null;try{n=r.connector?e.plugin(`scenery`).connector(r.connector):null}catch{}if(n&&n.path){let e=n.path.slice();r.to<r.from&&e.reverse(),o.cum3=N(e,!0),o.cL=o.cum3[o.cum3.length-1],o.cc=o.cum3.map(e=>e/o.cL),o.cp=e,o.E=n.mesh;let a=D(Math.min(r.from,r.to),Math.max(r.from,r.to));o.cW=new t.Mesh(M(e,.85,0),a.white),o.cB=new t.Mesh(M(e,.45,.015),a.blue),[o.cW,o.cB].forEach(e=>{e.renderOrder=2,n.mesh.add(e),i.push(e)})}o.line=new t.InstancedMesh(C,y,160),o.line.count=0,o.line.frustumCulled=!1,o.line.visible=!1,e.three.add(o.line),i.push(o.line)}return o.s0=a,a+=o.len,o});u={r,legs:o,objs:i,total:a,dur:Math.max(900,Math.min(2400,a*28)),t0:performance.now()+250,done:!1,dots:null};let s=o.filter(e=>e.kind===`walk`&&e.length>1.5);if([...new Set(s.map(e=>e.level))].length>1){let e=[];s.forEach(t=>{let n=t.s0+t.len,r=e[e.length-1];r&&r.levelIndex===t.level?r.b=r.c=n:(r&&(r.c=t.s0),e.push({levelIndex:t.level,a:r?t.s0:0,b:n,c:n}))}),e[e.length-1].b=e[e.length-1].c=a,e.forEach(e=>{e.dur=Math.max(900,Math.min(2400,(e.b-e.a)*28)),e.cdur=Math.max(400,Math.min(600,(e.c-e.b)*40))}),u.tour=e,u.st=0,u.hold=0}},ee=()=>{u.dots=[],u.legs.forEach(n=>{if(n.cp){let e=Math.max(1,Math.floor(n.cL/1.6));for(let r=0;r<e;r++){let e=new t.Mesh(x,D(Math.min(n.from,n.to),Math.max(n.from,n.to)).dot);e.renderOrder=3,n.E.add(e),u.objs.push(e),u.dots.push({m:e,s:n,i:r,c3:!0})}return}if(n.kind!==`walk`)return;let r=Math.floor(n.len/1.6);for(let i=0;i<r;i++){let r=new t.Mesh(x,D(n.level).dot);r.renderOrder=1,e.three.add(r,n.level),u.objs.push(r),u.dots.push({m:r,s:n,i})}})},L=t=>{let n=u?u.legs.filter(e=>e.kind===`walk`&&e.level===t&&e.points.length>1):[];if(!n.length)return null;let r=n[0].points,i=n[n.length-1].points,a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r)||1;return[n/i,r/i]},o=r[0],s=i[i.length-1];if(Math.hypot(s[0]-o[0],s[1]-o[1])<1)return null;let c=e.three.camera.matrixWorld.elements,l=(Math.hypot(c[4],c[6])>.001?Math.atan2(c[4],c[6]):d)-d,f=e.ui.container,p=a(o,s),m;if(f.clientHeight>f.clientWidth)m=p;else{let e=(e,t,n)=>{for(let r=t+n;r>=0&&r<e.length;r+=n)if(Math.hypot(e[r][0]-e[t][0],e[r][1]-e[t][1])>.2)return a(e[t],e[r]);return a(e[t],e[t+n]||e[t])},t=e(r,0,1),n=e(i,i.length-1,-1),o=[(t[0]+n[0])/2,(t[1]+n[1])/2];if(Math.hypot(o[0],o[1])>=.3)m=[-o[0],-o[1]];else{let e=[t[0]-n[0],t[1]-n[1]];m=[-e[1],e[0]],m[0]*p[0]+m[1]*p[1]<0&&(m=[-m[0],-m[1]])}}return Math.atan2(m[0],m[1])-l},R=t=>{let n=u?u.legs.filter(e=>e.kind===`walk`&&e.level===t).flatMap(e=>e.points):[],r=L(t);e.view.fit(t,n,r==null?{}:{rotation:-r*180/Math.PI,minTurn:20})},z={p:new t.Vector3,q:new t.Vector3,d:new t.Vector3,up:new t.Vector3(0,1,0),r:new t.Quaternion,s:new t.Vector3,m:new t.Matrix4,w0:new t.Vector3,w1:new t.Vector3},te=()=>{if(!u)return;let t=performance.now(),r=!e.ui.env().reducedMotion,i=e.getState().allLevels,a=e.three.levelY,o=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,c=e=>Math.max(0,Math.min(1,e)),l=r&&u.tour;k(t,r,i);let d,f;if(l){let e=l[u.st];if(d=c((t-u.t0)/e.dur),f=e.a+o(d)*(e.b-e.a),d>=1){if(u.st<l.length-1){u.cs||(u.cs=t);let n=c((t-u.cs)/e.cdur);f=e.b+o(n)*(e.c-e.b),d=0,n<1||(u.hold?t>=u.hold&&(u.hold=0,u.cs=0,u.st++,u.t0=t+450,R(l[u.st].levelIndex)):u.hold=t+700)}else u.tour=null}}else d=r?c((t-u.t0)/u.dur):1,f=o(d)*u.total;if(u.legs.forEach(e=>{let t=Math.max(0,Math.min(e.len,f-e.s0));if(e.kind===`walk`){let n=0;for(;n<e.cum.length&&e.cum[n]<=t+1e-6;)n++;let r=n>0&&n<e.cum.length?(t-e.cum[n-1])/(e.cum[n]-e.cum[n-1]||1):1;[e.mW,e.mB].forEach(t=>{let i=t.geometry,a=i.attributes.position,o=a.array,s=i.userData.base||(i.userData.base=o.slice());if(i.userData.tip!=null&&i.userData.tip!==n){let e=i.userData.tip*6;for(let t=0;t<6;t++)o[e+t]=s[e+t];i.userData.tip=null,a.needsUpdate=!0}if(n>0&&n<e.cum.length){let e=n*6,t=(n-1)*6;for(let n=0;n<6;n++)o[e+n]=s[t+n]+(s[e+n]-s[t+n])*r;i.userData.tip=n,a.needsUpdate=!0,i.setDrawRange(0,n*6)}else i.setDrawRange(0,Math.max(0,n-1)*6)});return}let r=t/e.len,o=r;if(e.cc){let t=e.cp;e.E.updateMatrixWorld(!0),z.w0.set(...t[0]).applyMatrix4(e.E.matrixWorld),z.w1.set(...t[t.length-1]).applyMatrix4(e.E.matrixWorld),e.gapAt=Math.hypot(z.w0.x-e.a[0],z.w0.y-(a(e.from)+n),z.w0.z-e.a[1])>Math.hypot(z.w1.x-e.b[0],z.w1.y-(a(e.to)+n),z.w1.z-e.b[1])?0:1,i&&(e.gapAt?(o=Math.max(0,r*2-1),r=Math.min(1,r*2)):(o=Math.min(1,r*2),r=Math.max(0,r*2-1)));let s=0;for(;s<e.cc.length&&e.cc[s]<=r+1e-6;)s++;let c=Math.max(0,s-1)*6;e.cW.geometry.setDrawRange(0,c),e.cB.geometry.setDrawRange(0,c)}let s=n+.05,c=i&&o>0;if(e.line.visible=c,!c)return;z.p.set(e.a[0],a(e.from)+s,e.a[1]),z.q.set(e.b[0],a(e.to)+s,e.b[1]),e.cc&&(e.gapAt?z.p.copy(z.w1):z.q.copy(z.w0)),z.d.subVectors(z.q,z.p);let l=z.d.length()*Math.min(1,o),u=Math.min(160,Math.ceil(l/1.5));z.d.normalize(),z.r.setFromUnitVectors(z.up,z.d);for(let t=0;t<u;t++){let n=t*1.5,r=Math.min(.9,l-n);z.s.set(1,Math.max(.01,r),1),z.m.compose(z.q.copy(z.p).addScaledVector(z.d,n+r/2),z.r,z.s),e.line.setMatrixAt(t,z.m)}e.line.count=u,e.line.instanceMatrix.needsUpdate=!0}),d>=1&&!u.done&&(u.done=!0,s.done=!0,ee()),u.dots){let e=r?t/1e3:0;u.dots.forEach(t=>{let r=t.s;if(t.c3){let n=P(r.cp,r.cum3,(t.i*1.6+e*1.6)%r.cL);t.m.position.set(n[0],n[1]+.03,n[2]);return}let i=P(r.points,r.cum,(t.i*1.6+e*1.6)%r.len);t.m.position.set(i[0],n+.055,i[1])})}};e.ui.style(Object.assign({},MapplicMap.PLACE?MapplicMap.PLACE.css:{},{".mp-route-end":`position:absolute;border-radius:9999px;transition:opacity 200ms ease`,".mp-route-start":`left:-7px;top:-7px;width:14px;height:14px;background:var(--mp-surface);box-shadow:inset 0 0 0 3.5px var(--mp-accent), 0 1px 3px rgba(0,0,0,0.2)`,".mp-route-finish":`left:-8px;top:-8px;width:16px;height:16px;background:var(--mp-accent);box-shadow:0 0 0 3px var(--mp-bg), 0 2px 6px rgba(0,0,0,0.2)`,".mp-route-badge":`position:absolute;left:0;top:0;height:28px;padding:0 10px 0 8px;display:flex;align-items:center;gap:6px;white-space:nowrap;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-accent);color:var(--mp-fg-on-accent);font-size:12px;font-weight:600;box-shadow:0 2px 6px var(--mp-accent-ring);transform:translate(-50%,calc(-100% - 12px));cursor:pointer;transition:opacity 200ms ease,background-color 150ms ease`,".mp-route-badge:hover":`background:var(--mp-accent-hover)`,".mp-route-badge-ic":`display:flex;align-items:center;gap:2px`,".mp-route-badge-ic svg":`flex:none`,".mp-wayfinding-btn":`position:absolute;height:32px;padding:0 12px;display:flex;align-items:center;gap:8px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);font-family:'Onest',sans-serif;font-size:14px;font-weight:600;color:var(--mp-fg-strong);cursor:pointer;pointer-events:auto;transition:background-color 150ms ease`,".mp-wayfinding-btn:hover":`background:var(--mp-bg-muted)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding-btn, &[data-mp-glass-ctl="1"] .mp-wayfinding':`background:var(--mp-ctl-glass);-webkit-backdrop-filter:var(--mp-ctl-blur);backdrop-filter:var(--mp-ctl-blur)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding-btn':`box-shadow:0 0 0 1px var(--mp-ctl-ring), var(--mp-shadow-sm)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding':`box-shadow:0 0 0 1px var(--mp-ctl-ring), var(--mp-shadow-panel)`,'&[data-mp-glass-ctl="1"] .mp-wayfinding-btn:hover':`background:color-mix(in srgb, var(--mp-surface) 88%, transparent)`,".mp-wayfinding-btn:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:2px`,".mp-wayfinding-btn.mp-icon":`width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);padding:0;justify-content:center`,".mp-wayfinding-blwrap":`position:relative;pointer-events:auto;display:flex;flex-direction:column;align-items:flex-start`,".mp-wayfinding-blwrap > .mp-wayfinding-btn, .mp-wayfinding-blwrap > .mp-wayfinding":`position:relative;left:auto;top:auto;right:auto;bottom:auto`,".mp-wayfinding.mp-bl":`transform-origin:bottom left;max-width:min(420px, calc(100vw - 64px))`,".mp-bl .mp-wayfinding-drop":`top:auto;bottom:calc(100% + 4px)`,".mp-wayfinding.mp-at-bottom:not(.mp-sheet)":`transform-origin:bottom left`,".mp-wayfinding.mp-at-right:not(.mp-sheet)":`transform-origin:top right`,".mp-wayfinding.mp-at-center:not(.mp-sheet)":`transform-origin:top center`,".mp-wayfinding.mp-at-bottom.mp-at-right:not(.mp-sheet)":`transform-origin:bottom right`,".mp-wayfinding.mp-at-bottom.mp-at-center:not(.mp-sheet)":`transform-origin:bottom center`,".mp-at-bottom:not(.mp-sheet) .mp-wayfinding-drop":`top:auto;bottom:calc(100% + 4px)`,".mp-wayfinding-btn.mp-icon .mp-wayfinding-label":`display:none`,".mp-wayfinding-btn.mp-slot-compact":`width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);padding:0;justify-content:center`,".mp-wayfinding-btn.mp-slot-compact .mp-wayfinding-label":`display:none`,".mp-wayfinding":`position:absolute;max-width:calc(100% - var(--mp-cs, 40px) - 48px - var(--mp-inset-l, 0px));box-sizing:border-box;padding:6px;border-radius:calc(12px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-panel);display:flex;flex-direction:column;gap:4px;cursor:default;pointer-events:auto;font-family:Onest,sans-serif;color:var(--mp-fg);transform-origin:top left;transition:opacity 160ms ease, transform 160ms ease`,".mp-wayfinding.mp-wrapped":`width:240px`,".mp-wayfinding.mp-compact":`width:auto;max-width:min(360px, calc(100% - var(--mp-cs, 40px) - 48px - var(--mp-inset-l, 0px)))`,".mp-wayfinding.mp-compact:not(.mp-sheet)":`padding:4px;border-radius:calc(8px * var(--mp-rk, 1));box-shadow:var(--mp-shadow-sm)`,".mp-wayfinding.mp-compact:not(.mp-sheet) .mp-wayfinding-compact-btn":`height:28px;padding:0 6px 0 4px;border-radius:calc(6px * var(--mp-rk, 1))`,".mp-wayfinding.mp-compact:not(.mp-sheet) .mp-wayfinding-close":`width:28px;height:28px;border-radius:calc(6px * var(--mp-rk, 1))`,".mp-wayfinding-close svg":`width:14px;height:14px`,".mp-wayfinding.mp-slot-compact .mp-wayfinding-compact-from":`display:none`,".mp-wayfinding.mp-sheet":`left:8px;right:8px;top:auto;bottom:8px;width:auto;max-width:none;border-radius:calc(14px * var(--mp-rk, 1));transform-origin:bottom center`,".mp-sheet .mp-wayfinding-drop":`top:auto;bottom:calc(100% + 4px)`,".mp-sheet .mp-wayfinding-compact-btn":`height:40px`,".mp-sheet.mp-wrapped .mp-wayfinding-field":`height:42px`,".mp-sheet .mp-wayfinding-ibtn":`width:40px;height:40px`,".mp-sheet .mp-wayfinding-next":`width:28px;height:28px`,".mp-sheet .mp-wayfinding-input":`font-size:16px`,".mp-sheet .mp-wayfinding-option":`height:40px`,".mp-sheet .mp-wayfinding-steps":`overflow:auto;overscroll-behavior:contain`,".mp-wayfinding-compact":`display:flex;align-items:center;gap:2px;min-width:0`,".mp-wayfinding-compact-btn":`flex:1;min-width:0;height:32px;padding:0 8px 0 6px;display:flex;align-items:center;gap:6px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;font:inherit;font-size:13px;font-weight:600;color:var(--mp-fg-strong);cursor:pointer;text-align:left;transition:background-color 150ms ease`,".mp-wayfinding-compact-btn:hover .mp-wayfinding-compact-time":`color:var(--mp-fg-strong)`,".mp-wayfinding-compact-btn:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-wayfinding-compact-name":`min-width:0;max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-sheet .mp-wayfinding-compact-name":`max-width:none;flex:0 1 auto`,".mp-wayfinding-compact-arrow":`flex:none;display:flex;color:var(--mp-fg-subtle)`,".mp-wayfinding-compact-arrow svg":`width:14px;height:14px`,".mp-wayfinding-compact-time":`flex:none;margin-left:auto;padding-left:6px;font-size:12px;font-weight:500;color:var(--mp-fg-muted);transition:color 150ms ease`,".mp-wayfinding-head":`display:flex;align-items:flex-start;gap:4px`,".mp-wayfinding-ends":`position:relative;flex:1;min-width:0;display:flex;flex-direction:column;border-radius:calc(9px * var(--mp-rk, 1));box-shadow:inset 0 0 0 1px var(--mp-border)`,".mp-inline .mp-wayfinding-ends":`flex-direction:row`,".mp-inline .mp-wayfinding-field":`width:152px`,".mp-wayfinding-tools":`flex:none;display:flex;flex-direction:column;gap:4px`,".mp-inline .mp-wayfinding-tools":`flex-direction:row;align-items:center;height:32px`,".mp-wrapped .mp-wayfinding-field":`height:34px`,".mp-wayfinding-field":`position:relative;min-width:0;height:32px;padding:0 6px;box-sizing:border-box;display:flex;align-items:center;gap:8px;border-radius:calc(9px * var(--mp-rk, 1));cursor:text;transition:box-shadow 150ms ease,background-color 150ms ease`,".mp-wrapped .mp-wayfinding-from":`border-radius:calc(9px * var(--mp-rk, 1)) calc(9px * var(--mp-rk, 1)) 0 0;padding-right:36px`,".mp-wrapped .mp-wayfinding-to":`border-radius:0 0 calc(9px * var(--mp-rk, 1)) calc(9px * var(--mp-rk, 1));padding-right:36px;box-shadow:0 -1px 0 0 var(--mp-border-subtle, var(--mp-border))`,".mp-inline .mp-wayfinding-from":`border-radius:calc(9px * var(--mp-rk, 1)) 0 0 calc(9px * var(--mp-rk, 1));padding-right:18px`,".mp-inline .mp-wayfinding-to":`border-radius:0 calc(9px * var(--mp-rk, 1)) calc(9px * var(--mp-rk, 1)) 0;padding-left:18px;box-shadow:-1px 0 0 0 var(--mp-border-subtle, var(--mp-border))`,".mp-wayfinding-field:hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-field.mp-active, .mp-wayfinding-field.mp-active:hover":`background:var(--mp-surface);box-shadow:inset 0 0 0 2px var(--mp-accent);z-index:1`,".mp-wayfinding-mark":`flex:none;width:20px;height:20px;display:flex;align-items:center;justify-content:center;color:var(--mp-fg-subtle)`,".mp-wayfinding-mark svg":`width:15px;height:15px`,".mp-wayfinding-field.mp-active .mp-wayfinding-mark":`color:var(--mp-accent)`,".mp-wayfinding-input":`flex:1;min-width:0;height:100%;padding:0;border:0;outline:0;background:transparent;font:inherit;font-size:13px;font-weight:500;color:var(--mp-fg-strong);text-overflow:ellipsis`,".mp-wayfinding-input::placeholder":`color:var(--mp-fg-subtle);font-weight:400;opacity:1`,".mp-wayfinding-field.mp-filled .mp-wayfinding-input":`font-weight:600`,".mp-wayfinding .mp-dir-thumb":`flex:none;width:20px;height:20px;border-radius:calc(5px * var(--mp-rk, 1));font-size:9px`,".mp-wayfinding .mp-dir-thumb.mp-dir-icon svg":`width:12px;height:12px`,".mp-wayfinding-ibtn":`flex:none;width:32px;height:32px;padding:0;display:flex;align-items:center;justify-content:center;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;color:var(--mp-fg-muted);cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,".mp-wayfinding-ibtn:hover":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,".mp-wayfinding-ibtn:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,'.mp-wayfinding-a11y[aria-pressed="true"], .mp-wayfinding-a11y[aria-pressed="true"]:hover':`background:var(--mp-selected-bg);color:var(--mp-selected-fg)`,".mp-wayfinding-next":`position:absolute;z-index:2;right:6px;top:50%;width:24px;height:24px;transform:translateY(-50%);border-radius:9999px;background:var(--mp-surface);box-shadow:inset 0 0 0 1px var(--mp-border)`,".mp-inline .mp-wayfinding-next":`right:auto;left:152px;transform:translate(-50%,-50%)`,".mp-wayfinding-next:hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-next svg":`width:14px;height:14px`,".mp-wayfinding-drop":`position:absolute;left:0;top:calc(100% + 4px);z-index:3;width:100%;min-width:220px;box-sizing:border-box;padding:4px;border-radius:calc(10px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-panel);display:flex;flex-direction:column;gap:1px;cursor:default`,".mp-wayfinding-option":`height:32px;padding:0 6px;display:flex;align-items:center;gap:8px;border-radius:calc(6px * var(--mp-rk, 1));cursor:pointer;font-size:13px;font-weight:500;color:var(--mp-fg-strong);transition:background-color 150ms ease`,".mp-wayfinding-option.mp-hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-option-name":`flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-wayfinding-option-level":`flex:none;font-size:12px;font-weight:500;color:var(--mp-fg-muted)`,".mp-wayfinding-none":`padding:7px 6px;font-size:13px;color:var(--mp-fg-muted)`,".mp-wayfinding-info":`display:flex;flex-direction:column;gap:4px;min-width:0`,".mp-wayfinding-info.mp-empty":`display:none`,".mp-wayfinding-warn":`display:flex;align-items:flex-start;gap:8px;padding:6px 8px;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-warning-subtle);color:var(--mp-warning-fg);font-size:13px;line-height:1.4`,".mp-wayfinding-warn svg":`flex:none;margin-top:1px;color:var(--mp-warning)`,".mp-wayfinding-hint":`padding:2px 6px;font-size:13px;color:var(--mp-fg-muted)`,".mp-wayfinding-summary":`height:26px;padding:0 6px;display:flex;align-items:center;gap:6px;border:0;border-radius:calc(6px * var(--mp-rk, 1));background:transparent;font:inherit;font-size:12px;color:var(--mp-fg-muted);cursor:pointer;text-align:left;transition:background-color 150ms ease`,".mp-wayfinding-summary:hover":`background:var(--mp-bg-muted)`,".mp-wayfinding-summary:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-wayfinding-summary b":`font-weight:600;color:var(--mp-fg-strong)`,".mp-wayfinding-summary-text":`flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-wayfinding-summary svg":`flex:none;width:14px;height:14px;transition:transform 150ms ease`,'.mp-wayfinding-summary[aria-expanded="true"] svg':`transform:rotate(180deg)`,".mp-wayfinding-steps":`display:flex;flex-direction:column;gap:2px`,".mp-wayfinding-step":`min-height:26px;padding:3px 6px;box-sizing:border-box;display:flex;align-items:center;gap:8px;border-radius:calc(6px * var(--mp-rk, 1));cursor:pointer;transition:background-color 150ms ease`,".mp-wayfinding-step:hover, .mp-wayfinding-step.mp-current":`background:var(--mp-bg-muted)`,".mp-wayfinding-step-tag":`flex:none;min-width:28px;height:18px;padding:0 4px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-radius:calc(4px * var(--mp-rk, 1));background:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg);font-size:9px;font-weight:600;letter-spacing:0.04em`,".mp-wayfinding-step-text":`min-width:0;font-size:12px;line-height:1.35;color:var(--mp-fg-secondary)`}));let B=e.ui.mount(g(`div`,``,null,`position:absolute;inset:0;pointer-events:none`),{layer:`scene`}),V=e=>{let t=g(`div`,``,null,`position:absolute;left:0;top:0;width:0;height:0;pointer-events:none`);return t.append(g(`span`,`mp-route-end `+e,null,`opacity:0`)),B.append(t),t},H=V(`mp-route-start`),ne=V(`mp-route-finish`),re=[],ie=(t,r,i)=>{let a=e.three.project(i[0],e.three.levelY(r)+n,i[1]);t.style.transform=`translate(`+a.x.toFixed(1)+`px,`+a.y.toFixed(1)+`px)`,t.style.visibility=a.visible?`visible`:`hidden`},ae=()=>{re.forEach(e=>e.w.remove()),re=[];let t=e.getState();u&&!t.allLevels&&u.r.badges.filter(e=>e.level===t.level).forEach(e=>{let t=g(`div`,``,null,`position:absolute;left:0;top:0;width:0;height:0;pointer-events:none`),n=g(`span`,`mp-route-badge`,null,`opacity:0;pointer-events:none`),r=g(`span`,`mp-route-badge-ic`,(h[e.kind]||h.esc)+(e.up?h.up:h.dn)),i=g(`span`,``);i.textContent=e.levelName==null?e.text:e.levelName,n.title=e.text,n.setAttribute(`role`,`button`),n.setAttribute(`aria-label`,e.text),n.append(r,i),n.addEventListener(`click`,t=>{t.stopPropagation(),R(e.goTo)}),[`pointerdown`,`dblclick`].forEach(e=>n.addEventListener(e,e=>e.stopPropagation())),t.append(n),B.append(t),re.push({w:t,t:n,b:e})})},oe=()=>{let t=e.getState(),n=t.allLevels;u?(ie(H,u.r.start.level,u.r.start.at),ie(ne,u.r.end.level,u.r.end.at),H.firstChild.style.opacity=n||u.r.start.level===t.level?1:0,ne.firstChild.style.opacity=u.done&&(n||u.r.end.level===t.level)?1:0,re.forEach(e=>{ie(e.w,e.b.level,e.b.at),e.t.style.opacity=+!!u.done,e.t.style.pointerEvents=u.done?`auto`:`none`})):(H.firstChild.style.opacity=0,ne.firstChild.style.opacity=0)},se=e.ui.mount(g(`div`,``,null,`position:absolute;inset:0;pointer-events:none;z-index:8`)),U=g(`button`,`mp-wayfinding-btn`);U.type=`button`;let ce=()=>{clearTimeout(f),s.open=!0,s.out=!1,s.picking=s.from?s.to?null:`to`:`from`,s.compact=!1,it(!0)};U.onclick=ce;let le=()=>{try{let t=e.plugin(`search`),n=e.plugin(`directory`);return t.enabled()&&!n.enabled()?t.setting(`position`)||`top-left`:null}catch{return null}},ue=()=>{let t=o.setting(`layout`)||`auto`;return t===`auto`?!e.ui.env().narrow&&a.clientWidth>=760&&le()!==`top-center`?`inline`:`wrapped`:t},de=e=>String(e||``).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,` `).trim(),fe=null,pe=()=>Object.fromEntries(e.data.units().map(e=>[e.id,e.logo||e.thumb||null])),me=()=>{let t=MapplicMap.PLACE,n=e.data.amenityTypes()||{},r=e.data.section(`categories`)||[],i=pe(),a=[];e.data.stores().forEach(e=>{e.name&&e.searchable!==!1&&a.push({id:e.id,name:e.name,level:e.level,logo:i[e.id]||e.logo||null,words:de(e.name)})});let o={};return e.data.amenities().forEach(e=>{let r=t&&t.amenityKey?t.amenityKey(e.type,n):e.type||`amenity`;(o[r]=o[r]||[]).push(e)}),Object.entries(o).forEach(([e,i])=>{let o=n[e]||{},s=o.name||i[0].name||e,c=[e,o.label].concat(t&&t.SYNONYMS&&t.SYNONYMS[e]||[]);a.push({group:i.map(e=>e.id),name:s,cat:t&&t.amenityCategory?t.amenityCategory(e,n,r):null,words:de(s),keys:de(c.join(` `))})}),a};e.on(`units`,()=>fe=null),e.on(`language`,()=>fe=null);let he=e=>{let t=de(e);if(!t)return[];fe||=me();let n=[];return fe.forEach(e=>{let r=e.words,i=r.startsWith(t)?0:(` `+r).includes(` `+t)?1:e.keys&&(` `+e.keys).includes(` `+t)?2:r.includes(t)?3:-1;i>=0&&n.push([i,e])}),n.sort((e,t)=>e[0]-t[0]||e[1].name.localeCompare(t[1].name)||(e[1].level||0)-(t[1].level||0)),n.slice(0,6).map(e=>e[1])},ge=e=>{let t=MapplicMap.PLACE;if(!t)return g(`span`,``);if(e.group||e.cat){let n=e.cat;return t.tint(g(`div`,`mp-dir-thumb mp-dir-icon`,n&&t.icon(n.icon,14)||h.route),n)}return t.thumb({name:e.name,logo:e.logo},`logo`)},_e=e=>e?(fe||=me(),fe.find(t=>t.id===e)||fe.find(t=>t.group&&t.group.includes(e))||null):null,ve=(t,n)=>{let r=t.map(e=>_(e)).filter(Boolean),i=c()?r.filter(e=>e.accessible!==!1):r,a=i.length?i:r;if(!a.length)return null;if(!n)return a[0].id;let o=1e9,s=a[0].id;return a.slice(0,12).forEach(t=>{if(t.id===n)return;let r=e.data.route({id:n},{id:t.id},{accessible:c()});r&&r.metres<o&&(o=r.metres,s=t.id)}),s},ye=()=>{[`from`,`to`].forEach(e=>{let t=s[e+`Group`],n=s[e===`from`?`to`:`from`];t&&n&&(s[e]=ve(t,n))})},be=t=>{let n=g(`div`,`mp-wayfinding-field mp-wayfinding-`+t),r=g(`span`,``,null,`display:contents`),i=g(`input`,`mp-wayfinding-input`),a=g(`div`,`mp-wayfinding-drop`,null,`display:none`),o=`mp-wf-`+t+`-`+Math.random().toString(36).slice(2,7);i.type=`text`,i.autocomplete=`off`,i.spellcheck=!1,i.setAttribute(`role`,`combobox`),i.setAttribute(`aria-autocomplete`,`list`),i.setAttribute(`aria-expanded`,`false`),i.setAttribute(`aria-controls`,o),a.id=o,a.setAttribute(`role`,`listbox`),n.append(r,i,a);let c={f:t,el:n,input:i,slot:r,drop:a,typing:!1,results:[],active:0,sig:``},l=!1,u=null,d=()=>{let t=c.typing&&de(i.value)!==``,n=[{opacity:0,transform:`translateY(`+(G.classList.contains(`mp-sheet`)?4:-4)+`px)`},{opacity:1,transform:`none`}];if(i.setAttribute(`aria-expanded`,t?`true`:`false`),t!==l&&(u&&u.cancel(),u=null,l=t,t?(a.style.display=`flex`,u=W(a,n,160,`ease-out`)):(u=W(a,n.slice().reverse(),120,`ease-in`),u?u.onfinish=()=>{u=null,a.style.display=`none`}:a.style.display=`none`)),!t)return i.removeAttribute(`aria-activedescendant`);if(a.replaceChildren(),!c.results.length){let t=g(`div`,`mp-wayfinding-none`);return t.textContent=e.ui.t(`search_none`),a.append(t)}c.results.forEach((e,t)=>{let n=g(`div`,`mp-wayfinding-option`+(t===c.active?` mp-hover`:``)),r=g(`span`,`mp-wayfinding-option-name`);if(n.id=o+`-`+t,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,t===c.active?`true`:`false`),r.textContent=e.name,n.append(ge(e),r),!e.group&&e.level!=null){let t=g(`span`,`mp-wayfinding-option-level`);t.textContent=v(e),n.append(t)}n.onpointerdown=e=>e.preventDefault(),n.onpointerenter=()=>{c.active=t,[...a.children].forEach((e,n)=>{e.classList.toggle(`mp-hover`,n===t),e.setAttribute(`aria-selected`,n===t?`true`:`false`)}),i.setAttribute(`aria-activedescendant`,o+`-`+t)},n.onclick=()=>f(e),a.append(n)}),i.setAttribute(`aria-activedescendant`,o+`-`+c.active)},f=n=>{c.typing=!1,d();let r=t===`from`?`to`:`from`;n.group?(s[t+`Group`]=n.group,s[t]=ve(n.group,s[r])):(s[t+`Group`]=null,s[t]=n.id),s.picking=s[r]?null:r,s.collapseNext=!0,e.view.deselect(),bt();let a=s.picking&&Se[s.picking];a?a.input.focus():i.blur()};return i.addEventListener(`focus`,()=>{s.compact&&Me(!1),s.picking=t,i.select(),it()}),i.addEventListener(`input`,()=>{c.typing=!0,c.results=he(i.value),c.active=0,xe(c),d()}),i.addEventListener(`keydown`,e=>{let t=l&&c.results.length;if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!t)return;e.preventDefault();let n=c.results.length;c.active=(c.active+(e.key===`ArrowDown`?1:n-1))%n,d()}else e.key===`Enter`?t&&(e.preventDefault(),f(c.results[c.active])):e.key===`Escape`&&(e.stopPropagation(),c.typing?(c.typing=!1,xe(c),d(),i.select()):i.blur())}),i.addEventListener(`blur`,()=>{c.typing=!1,xe(c),d()}),n.addEventListener(`pointerdown`,e=>{e.target!==i&&!a.contains(e.target)&&(e.preventDefault(),i.focus())}),c},xe=t=>{let n=s[t.f],r=_e(n),i=_(n),a=i?i.name:``,o=!!i&&!t.typing;t.el.classList.toggle(`mp-filled`,o),t.el.classList.toggle(`mp-active`,s.open&&s.picking===t.f);let c=o?n:`-`;if(c!==t.sig){t.sig=c;let e=t.slot.firstChild,n=o?ge(r||{name:a,logo:null}):g(`span`,`mp-wayfinding-mark`,t.f===`from`?h.locate:h.flag);t.slot.replaceChildren(n),e&&o&&W(n,[{opacity:0,transform:`scale(0.6)`},{opacity:1,transform:`none`}],180)}let l=e.ui.t(t.f===`from`?`choose_start`:`choose_destination`);t.input.placeholder=l,t.input.setAttribute(`aria-label`,l),!t.typing&&t.input.value!==a&&(t.input.value=a)},W=(t,n,r,i)=>!e.ui.env().reducedMotion&&t&&t.animate?t.animate(n,{duration:r||180,easing:i||`cubic-bezier(.2,.8,.2,1)`}):null,G=g(`div`,`mp-wayfinding`,null,`display:none`),Se={from:be(`from`),to:be(`to`)},Ce=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-next`),K=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-a11y`,h.wheelchair),we=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-close`,h.x),Te=g(`div`,`mp-wayfinding-info mp-empty`),Ee=g(`div`,`mp-wayfinding-compact`),De=g(`button`,`mp-wayfinding-compact-btn`),Oe=g(`button`,`mp-wayfinding-ibtn mp-wayfinding-close`,h.x);[Ce,K,we,De,Oe].forEach(e=>e.type=`button`),Ee.append(De,Oe);let ke=!1,Ae=null,je=e=>{if(ke||G.style.display===`none`)return e();let t=G.getBoundingClientRect();Ae&&Ae.cancel(),Ae=null,ke=!0;try{e()}finally{ke=!1}let n=G.getBoundingClientRect();if(Je(),!t.height||!n.height||t.width===n.width&&t.height===n.height)return;let r=W(G,[{width:t.width+`px`,height:t.height+`px`},{width:n.width+`px`,height:n.height+`px`}],200,`ease`);r&&(Ae=r,G.style.overflow=`hidden`,r.onfinish=()=>{Ae=null,G.style.overflow=``,Je()},r.oncancel=()=>G.style.overflow=``)},Me=e=>{!!s.compact!==e&&(e&&r.activeElement&&G.contains(r.activeElement)&&r.activeElement.blur(),je(()=>{s.compact=e,at()}),W(e?Ee:G.firstChild,[{opacity:0},{opacity:1}],160,`ease-out`),e||W(Te,[{opacity:0},{opacity:1}],160,`ease-out`))};De.onclick=e=>{let t=De.querySelector(`.mp-wayfinding-compact-arrow`),n=t&&t.getBoundingClientRect(),r=getComputedStyle(De).direction===`rtl`,i=n?n.left+n.width/2:0,a=n&&e.detail>0&&(r?e.clientX>i:e.clientX<i)?`from`:`to`;Me(!1);let o=Se[a];o&&(o.input.focus(),o.input.select())},Oe.onclick=()=>Ze(),Ce.onclick=()=>{[s.from,s.to]=[s.to,s.from],[s.fromGroup,s.toGroup]=[s.toGroup,s.fromGroup],bt();let e=G.classList.contains(`mp-inline`),t=e?Se.from.el.offsetWidth:Se.from.el.offsetHeight;[[Se.from,1],[Se.to,-1]].forEach(([n,r])=>[n.slot.firstChild,n.input].forEach(n=>W(n,[{transform:(e?`translateX(`:`translateY(`)+r*t+`px)`,opacity:.3},{transform:`none`,opacity:1}],200))),W(Ce.firstChild,[{transform:`rotate(-180deg)`},{transform:`none`}],200)},K.onclick=()=>{s.accessible=!s.accessible,St()},we.onclick=()=>Ze();let Ne=g(`div`,`mp-wayfinding-head`),Pe=g(`div`,`mp-wayfinding-ends`),Fe=g(`div`,`mp-wayfinding-tools`);Pe.append(Se.from.el,Se.to.el,Ce),Fe.append(we,K),Ne.append(Pe,Fe),G.append(Ne,Te,Ee),G.addEventListener(`keydown`,e=>{e.key===`Escape`&&!e.defaultPrevented&&Ze()}),se.append(U,G);let Ie=()=>{let e=o.setting(`button_position`);return MapplicMap.SLOT_ANCHORS.includes(e)?e:`top-left`},Le=e=>e.startsWith(`top`)?10:5,Re=e.ui.slot(U,{anchor:Ie(),order:Le(Ie()),priority:10,compact:!0}),ze=()=>Ie()===`bottom-left`,Be=()=>{let e=Ie();return G.classList.toggle(`mp-at-bottom`,e.startsWith(`bottom`)),G.classList.toggle(`mp-at-right`,e.endsWith(`right`)),G.classList.toggle(`mp-at-center`,e.endsWith(`center`)),Re.update({anchor:e,order:Le(e)})},Ve=g(`div`,`mp-wayfinding-blwrap`);Ve.style.order=`100`;let He=t=>{let n=ze()&&t!==`sheet`;if(U.classList.toggle(`mp-wayfinding-bl`,ze()),G.classList.toggle(`mp-bl`,n),Be(),Ie().startsWith(`bottom`)&&t!==`sheet`&&t!==`button`?a.style.setProperty(`--mp-hint-wf`,`hidden`):a.style.removeProperty(`--mp-hint-wf`),n){let n=e.ui.zone(`bottom-left`);Ve.parentNode!==n&&n.append(Ve),U.parentNode!==Ve&&Ve.append(U,G),Re.update({el:null}),[U,G].forEach(e=>[`left`,`top`,`right`,`bottom`,`visibility`].forEach(t=>e.style[t]=``)),U.style.position=``,t===`button`&&(U.style.width=``),G.style.maxWidth=Math.max(200,Math.min(t===`row`?360:420,a.clientWidth-32))+`px`,t===`panel`&&(G.style.width=``);return}U.parentNode!==se&&se.append(U,G),Ve.remove(),G.style.maxWidth=``;let r=t===`button`?Re.update({el:U,min:0,max:0,priority:10,compact:o.setting(`button_label`)!==!1}):t===`sheet`?Re.update({el:null}):t===`row`?Re.update({el:G,priority:30,compact:!0}):Re.update({el:G,min:0,max:0,priority:30,compact:!1});t===`sheet`?[`left`,`right`,`top`,`bottom`,`width`].forEach(e=>G.style[e]=``):r&&Re.layout()},Ue=e=>{s.open&&!s.compact&&s.route&&!s.picking&&(G.contains(e.target)||U.contains(e.target)||Me(!0))};a.addEventListener(`pointerdown`,Ue,!0);let We=()=>{try{let t=e.plugin(`directory`);return t.enabled()&&/^floating|sheet/.test(t.setting(`placement`)||``)}catch{return!1}},Ge=0,Ke=()=>{let e=a.clientHeight,t=parseFloat(getComputedStyle(a).getPropertyValue(`--mp-room-b`));return Math.max(0,Math.min(e*.45,isNaN(t)?e:t-8))},qe=e=>{if(!e||!G.classList.contains(`mp-sheet`))return;let t=e.style.display;e.style.display=`none`;let n=G.scrollHeight;e.style.display=t,e.style.maxHeight=Math.max(48,Math.floor(Ke()-n-4))+`px`},Je=()=>{let t=G.classList.contains(`mp-sheet`),n=G.querySelector(`.mp-wayfinding-steps`),r=Ke(),i=t&&s.open&&!s.out&&!We()?Math.round(Math.min(G.offsetHeight,Math.max(r,G.offsetHeight-(n?n.offsetHeight:0)))+8):0;i!==Ge&&(Ge=i,i?a.style.setProperty(`--mp-inset-b`,i+`px`):a.style.removeProperty(`--mp-inset-b`),e.ui.inset(i?{bottom:i}:null))},Ye=0,Xe=window.ResizeObserver?new ResizeObserver(()=>{cancelAnimationFrame(Ye),Ye=requestAnimationFrame(()=>G.getAnimations&&G.getAnimations().length?null:Je())}):null;Xe&&Xe.observe(G);let Ze=()=>{let t=()=>{Tt()};if(e.ui.env().reducedMotion)return t();s.out=!0,it(),clearTimeout(f),f=setTimeout(t,170)},Qe=null,$e=null,et=!1,tt=0,nt=()=>G.getAnimations&&G.getAnimations().forEach(e=>e.id===`mp-morph`&&e.cancel()),rt=(e,t,n)=>{let r=n||G.getBoundingClientRect();if(!e.width||!r.width)return;nt();let i=tt=(tt||0)+1,a=[...G.children].filter(e=>e.offsetParent!==null&&getComputedStyle(e).position!==`absolute`),o=U.cloneNode(!0);o.setAttribute(`aria-hidden`,`true`),o.tabIndex=-1;let s=(G.classList.contains(`mp-at-bottom`)?`bottom:0;`:`top:0;`)+(G.classList.contains(`mp-at-right`)?`right:0;`:`left:0;`);o.style.cssText=`position:absolute;`+s+`display:flex;margin:0;background:transparent;box-shadow:none;pointer-events:none;visibility:visible`,a.forEach(e=>e.style.width=e.offsetWidth+`px`),G.append(o),G.style.overflow=`hidden`;let c=parseFloat(getComputedStyle(G).getPropertyValue(`--mp-rk`)),l={width:e.width+`px`,height:e.height+`px`,borderRadius:8*(Number.isFinite(c)?c:1)+`px`},u={width:r.width+`px`,height:r.height+`px`,borderRadius:getComputedStyle(G).borderRadius},d=t?170:220,f=G.animate(t?[u,l]:[l,u],{id:`mp-morph`,duration:d,easing:`cubic-bezier(.2,.8,.2,1)`,fill:t?`forwards`:`none`});o.animate(t?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],{duration:t?110:90,delay:t?50:0,easing:`ease-out`,fill:`both`}),a.forEach(e=>e.animate(t?[{opacity:1},{opacity:0}]:[{opacity:0},{opacity:1}],{duration:t?90:150,delay:t?0:70,easing:`ease-out`,fill:t?`forwards`:`backwards`,id:`mp-morph-kid`}));let p=()=>{o.remove(),i===tt&&(a.forEach(e=>{e.style.width=``,e.getAnimations().forEach(e=>e.id===`mp-morph-kid`&&e.cancel())}),Ae||(G.style.overflow=``))};t?f.oncancel=p:f.onfinish=f.oncancel=p},it=e=>e?at(e):je(()=>at()),at=t=>{let n=e.ui.env(),r=e.getState(),i=r.allLevels,a=s.open,u=e.ui.t,d=!!n.narrow;e.view.highlight([s.from,s.to].filter(Boolean));let f=u(`directions`);U.innerHTML=h.route+`<span class="mp-wayfinding-label">`+f+`</span>`,U.title=f,U.setAttribute(`aria-label`,f),U.classList.toggle(`mp-icon`,o.setting(`button_label`)===!1);let p=G.style.display===`none`,m=d||Ie().startsWith(`bottom`)?`translateY(8px) scale(0.98)`:`translateY(-6px) scale(0.98)`,v=!d&&!n.reducedMotion&&!!G.animate,y=v&&U.style.display!==`none`?U.getBoundingClientRect():null,b=v&&s.out&&!p?G.getBoundingClientRect():null;if(U.style.display===`none`&&(!a||s.out)&&!b&&W(U,[{opacity:0,transform:`scale(0.96)`},{opacity:1,transform:`none`}],160,`ease-out`),U.style.display=!a||s.out?`flex`:`none`,G.classList.toggle(`mp-sheet`,d),(p||!a)&&nt(),G.style.display=a?`flex`:`none`,G.style.opacity=s.out&&!b?0:1,G.style.transform=s.out&&!b?m:`none`,t&&p&&y?queueMicrotask(()=>rt(y,!1)):b?queueMicrotask(()=>rt(U.getBoundingClientRect(),!0,b)):t&&p&&W(G,[{opacity:0,transform:m},{opacity:1,transform:`none`}]),(!a||s.out)&&He(`button`),b&&ze()&&Object.assign(U.style,{position:`absolute`,left:`0`,bottom:`0`,visibility:`hidden`}),!a)return Je();let x=!!s.compact&&!!s.route,S=d?`wrapped`:ue(),C=!!o.setting(`accessible`);G.classList.toggle(`mp-compact`,x),G.classList.toggle(`mp-inline`,S===`inline`),G.classList.toggle(`mp-wrapped`,S!==`inline`),Ne.style.display=x?`none`:``,Te.style.display=x?`none`:``,Ee.style.display=x?``:`none`,s.out||He(d?`sheet`:x?`row`:`panel`);let w=_(s.from),T=_(s.to),E=s.route;if(x){let e=[s.from,s.to,E.minutes].join(`|`);if(e!==$e){$e=e;let t=(e,t)=>{let n=g(`span`,`mp-wayfinding-compact-name`),r=ge(_e(t)||{name:e?e.name:``,logo:null});return n.textContent=e?e.name:``,[r,n]},n=g(`span`,`mp-wayfinding-compact-time`);n.textContent=u(`minutes`,{n:E.minutes});let r=[...t(w,s.from),g(`span`,`mp-wayfinding-compact-arrow`,h.arrowRight)];r.forEach(e=>e.classList.add(`mp-wayfinding-compact-from`)),De.replaceChildren(...r,...t(T,s.to),n),De.title=De.textContent,De.setAttribute(`aria-expanded`,`false`)}if(!d){let e=G.cloneNode(!1);e.classList.remove(`mp-slot-compact`),e.removeAttribute(`style`),e.style.cssText=`display:flex;visibility:hidden;left:0;top:0;pointer-events:none`,e.append(Ee.cloneNode(!0)),se.append(e);let t=Math.min(360,Math.ceil(e.getBoundingClientRect().width));e.remove(),ze()?G.style.width=t+`px`:Re.update({max:t,min:Math.min(220,t)})&&Re.layout()}return Oe.title=u(`close`),Oe.setAttribute(`aria-label`,u(`close`)),Je()}$e=null,Ce.innerHTML=S===`inline`?h.swapH:h.swap;let D=!!(s.from||s.to);Ce.style.display=D?``:`none`,D&&!et&&W(Ce,[{opacity:0,scale:`0.6`},{opacity:1,scale:`1`}],160,`ease-out`),et=D,S===`inline`&&Fe.firstChild!==K?Fe.prepend(K):S!==`inline`&&Fe.lastChild!==K&&Fe.append(K),Ce.title=u(`swap`),Ce.setAttribute(`aria-label`,u(`swap`)),K.style.display=C?``:`none`,K.title=u(`accessible_route`),K.setAttribute(`aria-label`,u(`accessible_route`)),K.setAttribute(`aria-pressed`,s.accessible?`true`:`false`),we.title=u(`close`),we.setAttribute(`aria-label`,u(`close`)),xe(Se.from),xe(Se.to),t&&p&&s.picking&&!n.touch&&Se[s.picking].input.focus();let O=!s.picking&&l(),k=JSON.stringify([O&&O.name,E&&[s.from,s.to,E.minutes,E.metres,E.distance,E.via,E.stepFree,c()],!E&&s.from&&s.to&&s.from!==s.to,s.steps,i?`all`:r.level,u(`minutes`,{n:1})]);if(k!==Qe){let e=Te.classList.contains(`mp-empty`);Qe=k,ht(O,E,i,r),e&&!Te.classList.contains(`mp-empty`)&&!t&&W(Te,[{opacity:0,transform:`translateY(-4px)`},{opacity:1,transform:`none`}],160,`ease-out`)}Je()},ot=()=>{let e=g(`div`,`mp-wayfinding-warn`,h.warn),t=g(`span`,``);return e.setAttribute(`role`,`status`),e.append(t),e._text=t,e},st=ot(),ct=ot(),lt=g(`div`,`mp-wayfinding-hint`),ut=g(`button`,`mp-wayfinding-summary`),dt=g(`span`,`mp-wayfinding-summary-text`),ft=g(`div`,`mp-wayfinding-steps`);ut.type=`button`,ut.append(dt),ut.insertAdjacentHTML(`beforeend`,h.chevron),ut.onclick=()=>{let e=!s.steps;je(()=>{s.steps=e,at()}),e&&W(ft,[{opacity:0},{opacity:1}],200,`ease-out`)},Te.append(st,ct,lt,ut,ft);let pt=null,mt=(e,t)=>{let n=t?``:`none`;e.style.display!==n&&(e.style.display=n)},ht=(t,n,i,a)=>{let o=e.ui.t;mt(st,!!t),t&&(st._text.textContent=o(`not_accessible`,{place:t.name}));let l=!t&&!!n;if(mt(lt,!t&&!n&&!!s.from&&!!s.to&&s.from!==s.to),lt.textContent=o(`no_route`),mt(ct,l&&c()&&!n.stepFree),ct._text.textContent=o(`no_step_free`),mt(ut,l),mt(ft,l&&s.steps),Te.classList.toggle(`mp-empty`,!t&&!n&&lt.style.display===`none`),!l)return;let u=g(`b`,``);if(u.textContent=o(`minutes`,{n:n.minutes}),dt.replaceChildren(u,r.createTextNode(` · `+(n.distance||o(`metres`,{n:n.metres}))+(n.via?` · `+n.via:``))),ut.setAttribute(`aria-expanded`,s.steps?`true`:`false`),!s.steps)return;let d=JSON.stringify(n.steps.map(e=>[e.tag,e.text,e.level]));d===pt?[...ft.children].forEach((e,t)=>e.classList.toggle(`mp-current`,!i&&n.steps[t]&&n.steps[t].level===a.level)):(pt=d,ft.replaceChildren(...n.steps.map(e=>{let t=g(`div`,`mp-wayfinding-step`+(!i&&e.level===a.level?` mp-current`:``)),n=g(`span`,`mp-wayfinding-step-tag`),r=g(`span`,`mp-wayfinding-step-text`);return n.textContent=e.tag,r.textContent=e.text,t.append(n,r),t.onclick=()=>R(e.level),t})),qe(ft))},gt=()=>{if(!s.route)return null;let e=_(s.from),t=_(s.to);return{from:e?e.name:s.from,to:t?t.name:s.to,minutes:s.route.minutes,metres:s.route.metres,via:s.route.via,stepFree:s.route.stepFree}},_t=t=>{let n=s.route?s.from+`>`+s.to:null;(n!==p||t)&&(p=n,e.announce(`route`,gt()))},vt=!1,yt=`metric`,bt=()=>{if(vt=c(),yt=o.setting(`units`)||`metric`,F(),s.done=!1,s.route=null,ye(),s.from&&s.to&&s.from!==s.to&&!l())try{s.route=e.data.route({id:s.from},{id:s.to},{accessible:c(),units:o.setting(`units`)})}catch{s.route=null}let t=s.collapseNext&&!!s.route&&s.open;s.collapseNext=!1,s.route||(s.compact=!1),t&&!s.compact?Me(!0):it(),Je(),s.route&&(e.view.deselect(),I(s.route),R(u.tour?u.tour[0].levelIndex:s.route.start.level)),ae(),_t()},xt=e=>e?JSON.stringify(e.legs.map(e=>e.kind===`walk`?[e.level,e.points.length,e.points[0],e.points[e.points.length-1]]:[e.kind,e.from,e.to,e.connector])):``,St=()=>{let t=s.route,n=l(),r=null;if(t&&!n)try{r=e.data.route({id:s.from},{id:s.to},{accessible:c(),units:o.setting(`units`)})}catch{}if(!t||!r||!u||xt(r)!==xt(t))return bt();vt=c(),s.route=r,it(),_t(!0)},Ct=null,wt=(t,n)=>{n&&(s[t]=n,s[t+`Group`]=null,s.collapseNext=!0,s.open=!0,s.out=!1,s.picking=s.to?s.from?null:`from`:`to`,e.view.deselect(),bt())},Tt=()=>{clearTimeout(f),F(),Object.assign(s,{open:!1,out:!1,from:Ct,to:null,picking:null,route:null,done:!1,fromGroup:null,toGroup:null,compact:!1,collapseNext:!1}),ae(),it(),_t()};e.view.onPick(t=>s.open&&s.picking&&e.data.find({id:t})?(wt(s.picking,t),!0):!1);let Et=()=>{u&&u.tour&&(u.tour=null,u.t0=-1e9)},Dt=[`pointerdown`,`wheel`,`touchstart`,`keydown`];Dt.forEach(e=>a.addEventListener(e,Et,{capture:!0,passive:!0})),e.provide({show:async(t,n)=>{let r=e.data.find(t);if(!r)throw Error(`No store matches "`+(t&&t.name||t)+`"`);let i=n&&typeof n==`object`?[e.data.find(n)].filter(Boolean):e.data.findAll(n);if(!i.length)throw Error(`No store matches "`+n+`"`);let a=c()?i.filter(e=>e.accessible!==!1):i,o=a.length?a:i,l=o[0];if(o.length>1){let t=1e9;o.slice(0,8).forEach(n=>{if(n.id===r.id)return;let i=e.data.route({id:r.id},{id:n.id},{accessible:c()});i&&i.metres<t&&(t=i.metres,l=n)})}if(r.id===l.id)throw Error(`Start and destination are the same`);return Object.assign(s,{open:!0,out:!1,from:r.id,to:l.id,picking:null,fromGroup:null,toGroup:null,collapseNext:!0}),bt(),gt()},hide:Tt,open:ce,close:()=>{s.open&&!s.out&&Ze()},info:gt,from:t=>{let n=e.data.find(t);n&&wt(`from`,n.id)},origin:t=>{let n=t==null||t===``?null:e.data.find(t),r=Ct;return Ct=n?n.id:null,!s.open&&(!s.from||s.from===r)&&(s.from=Ct),Ct},to:t=>{let n=e.data.find(t);n&&wt(`to`,n.id)},state:()=>({open:s.open&&!s.out,from:s.from,to:s.to,picking:s.picking,routeShown:!!s.route,accessible:s.accessible}),restore:e=>{e||={},Object.assign(s,{open:!!e.open,out:!1,from:e.from||null,to:e.to||null,picking:null,accessible:!!e.accessible,fromGroup:null,toGroup:null,compact:!1,collapseNext:!1}),bt()},accessible:e=>(e!==void 0&&!!e!==s.accessible&&(s.accessible=!!e,St()),s.accessible)}),e.onFrame(()=>{te(),oe()});let Ot=0;e.on(`plugin`,e=>{e&&e.id===`scenery`&&s.route&&(clearTimeout(Ot),Ot=setTimeout(()=>{s.route&&(F(),I(s.route),u.t0=-1e9,u.tour=null)},60))}),e.on(`camera`,e=>{d=-e.rotation*Math.PI/180}),e.on(`level`,()=>{ae(),it()}),e.on(`layout`,()=>it());let kt=0,At=window.ResizeObserver?new ResizeObserver(()=>{cancelAnimationFrame(kt),kt=requestAnimationFrame(()=>s.open&&it())}):null;return At&&At.observe(a),e.on(`plugin`,e=>{if(e&&[`search`,`directory`].includes(e.id))return it();e&&e.id===`wayfinding`&&((o.setting(`units`)||`metric`)===yt?c()===vt?it():St():bt())}),it(),()=>{At&&At.disconnect(),cancelAnimationFrame(kt),Xe&&Xe.disconnect(),cancelAnimationFrame(Ye),a.removeEventListener(`pointerdown`,Ue,!0),a.style.removeProperty(`--mp-inset-b`),a.style.removeProperty(`--mp-hint-wf`),Ve.remove(),clearTimeout(f),clearTimeout(Ot),Dt.forEach(e=>a.removeEventListener(e,Et,{capture:!0})),F(),[y,b,S].forEach(e=>e.dispose()),Object.values(w).forEach(e=>T.forEach(([t])=>e[t].dispose())),x.dispose(),C.dispose(),p&&e.announce(`route`,null)}}),MapplicMap.plugin(`markers`,e=>{let t=e.plugin(`markers`),n=e.three.THREE,r=document,i=new n.Vector3,a=MapplicMap.svgIcon,o=MapplicMap.PLACE?MapplicMap.PLACE.icon(`restroom`,16):``,s={info:`<circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path>`,bus:`<path d="M8 6v6"></path><path d="M15 6v6"></path><path d="M2 12h19.6"></path><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3"></path><circle cx="7" cy="18" r="2"></circle><path d="M9 18h5"></path><circle cx="16" cy="18" r="2"></circle>`,zap:`<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"></path>`,door:`<path d="M13 4h3a2 2 0 0 1 2 2v14"></path><path d="M2 20h3"></path><path d="M13 20h9"></path><path d="M10 12v.01"></path><path d="M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z"></path>`,parking:`<rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M9 17V7h4a3 3 0 0 1 0 6H9"></path>`,car:`<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"></path><circle cx="7" cy="17" r="2"></circle><path d="M9 17h6"></path><circle cx="17" cy="17" r="2"></circle>`,food:`<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"></path><path d="M7 2v20"></path><path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"></path>`,star:`<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"></path>`};s[`map-pin`]=`<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path><circle cx="12" cy="10" r="3"></circle>`;let c=(e,t,n)=>{let r=String(e.text||``).trim();return r&&r.length<=2?p(r):t.trim()?p(t.trim().slice(0,n)):`<span style="width:8px;height:8px;border-radius:9999px;background:currentColor;display:block"></span>`},l={callout:{shape:`callout`,label:`always`,cluster:`off`},pin:{shape:`pin`,label:`always`},badge:{shape:`badge`,label:`hover`},dot:{shape:`dot`,label:`hover`},amenity:{shape:`badge`,label:`hover`,action:`select`}},u={callout:62,pin:42,badge:22,dot:15},d={callout:54,pin:34,badge:14,dot:7};e.ui.style({".mp-marker":`position:absolute;left:0;top:0;width:0;height:0;z-index:3`,".mp-marker.mp-marker-callout":`z-index:4`,".mp-marker.mp-hover":`z-index:5`,".mp-marker-body":`position:absolute;left:0;top:0;transform-origin:0 0;opacity:0;transition:opacity 150ms ease;font-family:Onest,sans-serif`,".mp-marker.mp-on .mp-marker-body":`opacity:1`,".mp-marker.mp-anim .mp-marker-body":`transition:none`,".mp-marker.mp-anim .mp-marker-hit":`pointer-events:none`,".mp-marker-hit":`pointer-events:none`,".mp-marker.mp-on.mp-live .mp-marker-hit":`pointer-events:auto`,".mp-marker.mp-clickable .mp-marker-hit":`cursor:pointer`,".mp-callout-dot":`position:absolute;left:-2.5px;top:-2.5px;width:5px;height:5px;border-radius:9999px;background:var(--mp-fg)`,".mp-callout-stem":`position:absolute;left:0;bottom:0;width:1px;height:32px;background:var(--mp-fg-subtle)`,".mp-callout":`position:absolute;left:0;bottom:32px;transform:translateX(-50%);height:22px;padding:0 8px;display:flex;align-items:center;white-space:nowrap;border-radius:calc(6px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);font-size:11px;font-weight:600;letter-spacing:0.06em;text-transform:uppercase;color:var(--mp-fg-secondary)`,".mp-callout.mp-has-icon":`gap:5px;padding-left:6px`,".mp-callout > svg, .mp-callout > img":`width:14px;height:14px;flex:none;display:block`,".mp-pin":`position:absolute;left:0;bottom:6px;transform:translateX(-50%);height:28px;padding:0 10px;box-sizing:border-box;display:flex;align-items:center;gap:6px;white-space:nowrap;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-card-bg);color:var(--mp-card-fg);font-size:13px;font-weight:600;box-shadow:0 0 0 1px var(--mp-card-ring), var(--mp-shadow);transition:background-color 150ms ease`,".mp-pin.mp-icon-only":`width:28px;padding:0;justify-content:center`,".mp-pin-arrow":`position:absolute;left:50%;bottom:-4px;width:8px;height:8px;margin-left:-4px;background:inherit;box-shadow:1px 1px 0 0 var(--mp-card-ring);transform:rotate(45deg);border-radius:calc(1px * var(--mp-rk, 1))`,".mp-clickable .mp-pin:hover":`background:var(--mp-card-bg-hover)`,".mp-badge":`position:absolute;left:-14px;top:-14px;width:28px;height:28px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-radius:9999px;background:var(--mp-fg-secondary);color:var(--mp-bg);box-shadow:0 2px 6px rgba(0,0,0,0.25);font-size:11px;font-weight:700;letter-spacing:0.02em;transition:background-color 150ms ease`,".mp-clickable .mp-badge:hover":`background:var(--mp-fg-tertiary)`,".mp-dot":`position:absolute;left:-7px;top:-7px;width:14px;height:14px;box-sizing:border-box;border-radius:9999px;background:var(--mp-fg-secondary);border:2px solid var(--mp-bg);box-shadow:0 1px 4px rgba(0,0,0,0.3);transition:transform 150ms ease`,".mp-clickable .mp-dot:hover":`transform:scale(1.2)`,".mp-dot.mp-dot-text":`left:-11px;top:-11px;width:22px;height:22px;display:flex;align-items:center;justify-content:center;color:var(--mp-bg);font-size:11px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums`,".mp-dot.mp-dot-text > svg, .mp-dot.mp-dot-text > img":`width:12px;height:12px;display:block`,".mp-marker-label":`position:absolute;top:-11px;height:22px;padding:0 8px;display:flex;align-items:center;white-space:nowrap;border-radius:calc(6px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);font-size:12px;font-weight:600;color:var(--mp-fg);pointer-events:none`,".mp-marker-tip":`position:absolute;left:0;transform:translateX(-50%);opacity:0;transition:opacity 150ms ease;pointer-events:none`,".mp-marker-tip .mp-tooltip":`position:relative;color:var(--mp-card-fg);font-size:13px;font-weight:600`,".mp-marker.mp-hover .mp-marker-tip":`opacity:1`,".mp-marker.mp-hover.mp-open .mp-marker-tip":`opacity:0`,".mp-cluster":`position:absolute;left:0;top:0;width:0;height:0;z-index:4`,".mp-cluster-body":`position:absolute;left:0;top:0;transform:translate(-50%,-50%);min-width:30px;height:30px;padding:0 8px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;border-radius:9999px;background:var(--mp-card-bg);color:var(--mp-card-fg);border:2px solid var(--mp-bg);box-shadow:var(--mp-shadow);font-family:Onest,sans-serif;font-size:12px;font-weight:600;font-variant-numeric:tabular-nums;opacity:0;pointer-events:none;cursor:pointer;transition:opacity 200ms ease,background-color 150ms ease`,".mp-cluster.mp-on .mp-cluster-body":`opacity:1;pointer-events:auto`,".mp-cluster-body:hover":`background:var(--mp-card-bg-hover)`});let f=(e,t,n)=>{let i=r.createElement(e);return t&&(i.className=t),n!=null&&(i.innerHTML=n),i},p=MapplicMap.escapeHtml,m=e=>e?e===`wc`?o:s[e]?a(s[e]):/^\s*<svg/i.test(e)?e:`<img src="`+p(e)+`" alt="" style="width:16px;height:16px;object-fit:contain;display:block">`:``,h=t=>{let n=f(`div`,t);return n.style.pointerEvents=`none`,e.ui.mount(n,{layer:`scene`})},g=e.data.markerStyles(),_=[],v=[],y={},b=1,x=null,S={},C=new Set,w=null,T=0,E=1,D=new Map,O={sig:null,tier:null,of:new Map},k=e=>{let t=(g.styles||{})[e.style]||{},n=l[t.extends]||l[e.style]||l[t.shape]||l.dot;return Object.assign({},n,t,e)},A=()=>{if(!t.setting(`amenities`))return[];let n={},r=e.data.amenityTypes();return e.data.amenities().forEach(e=>{n[e.id]=e}),e.data.units().filter(e=>e.kind===`amenity`&&!e.hidden).map(e=>{let t=n[e.id]||{},i=String(e.text||``),a=Object.keys(r).find(e=>r[e].label===i)||null;return Object.assign({id:`amenity-`+e.id,name:t.name||i,text:i===`i`||a===`toilets`?``:i,icon:i===`i`?`info`:a===`toilets`?`wc`:null,level:e.level,unit:e.id,style:`amenity`,amenity:a||!0},(g.amenities||{})[a]||{})})},j=e=>{let t=e.c;return{id:e.id,name:t.name||``,level:e.level,style:t.style||null,action:e.act,unit:t.unit||null,location:t.location||null,on:t.on||null,feature:t.feature||null,url:t.url||null,description:t.description||null,data:t.data||null,x:e.at[0],z:e.at[1]}},M=e=>{e.root.remove(),e.o3&&e.o3.parent&&e.o3.parent.remove(e.o3),e.offF&&e.offF()},N=(t,r)=>{let a=k(t),o=u[a.shape]?a.shape:`dot`,s=String(a.name||``),l=m(a.icon),d=a.unit||a.on||null,g=d&&(S[d]||e.data.units().find(e=>e.location===d||e.feature===d))||null;if(d&&!g){if(a.x==null||a.z==null||a.no_point)return null;a.unit=null,a.on=null}g&&(a.unit?a.unit=g.id:a.on=g.id);let _=a.action||(a.unit||a.feature?`select`:a.url?`link`:a.description||s.trim()?`popup`:`none`),v=_===`popup`&&!String(a.name||``).trim()&&!String(a.description||``).trim()?`none`:_,y=g?g.level:a.level==null?0:a.level,b=h(`mp-marker mp-marker-`+o+(a.class?` `+a.class:``)),x=f(`div`,`mp-marker-body`);b.setAttribute(`data-mp-marker`,String(t.id==null?``:t.id)),b.append(x),E!==1&&(x.style.transform=`scale(`+E+`)`);let C;if(o===`callout`){if(x.append(f(`span`,`mp-callout-dot`),f(`span`,`mp-callout-stem`)),C=f(`span`,`mp-callout mp-marker-hit`+(l?` mp-has-icon`:``),l),s){let e=f(`span`,``);e.textContent=s,C.append(e)}}else if(o===`pin`){let e=a.label===`always`&&s;if(C=f(`span`,`mp-pin mp-marker-hit`+(e?``:` mp-icon-only`),l||(e?``:c(a,s,1))),e){let e=f(`span`,``);e.textContent=s,C.append(e)}C.append(f(`span`,`mp-pin-arrow`))}else if(o===`badge`)C=f(`span`,`mp-badge mp-marker-hit`,l||c(a,s.toUpperCase(),2));else{let e=String(a.text||``).trim(),t=l||(e&&e.length<=3?p(e):``);C=f(`span`,`mp-dot mp-marker-hit`+(t?` mp-dot-text`:``),t)}if(x.append(C),C.setAttribute(`data-mp-drag`,``),a.color&&(C.style.background=a.color),a.ink&&(C.style.color=a.ink),a.label===`always`&&(o===`badge`||o===`dot`)&&s){let e=f(`span`,`mp-marker-label`);e.textContent=s,e.style.left=(o===`badge`?20:C.classList.contains(`mp-dot-text`)?16:12)+`px`,x.append(e)}let w=a.target&&(e.data.units().find(e=>e.location===a.target)||{}).id||null,T=a.unit||a.feature||w||null;T&&C.setAttribute(`data-mp-hover`,T);let D=v===`tooltip`?MapplicMap.plainText(a.description)||(o===`callout`?``:s):a.label===`hover`&&!T&&o!==`callout`?s:``;if(D){let e=f(`div`,`mp-marker-tip`),t=f(`div`,`mp-tooltip`),n=f(`span`,``);n.textContent=D,t.append(n,f(`span`,`mp-tooltip-arrow`)),e.append(t),e.style.bottom=u[o]+`px`,x.append(e)}(v!==`none`||D||T)&&b.classList.add(`mp-live`),v!==`none`&&v!==`tooltip`&&b.classList.add(`mp-clickable`);let O={id:String(a.id||`marker-`+r),c:a,sh:o,act:v,root:b,hit:C,level:y,idx:r,ride:g?g.id:null,targetUnit:w,prio:+a.priority||0,on:!1,pos:null,at:g?g.center.slice():[+a.x||0,+a.z||0]};{let t=new n.Object3D;t.position.set(O.at[0],g?g.top:a.elevation==null?+a.y||e.data.surface(y,O.at[0],O.at[1]):a.y==null?e.geo.metres(+a.elevation||0):+a.y,O.at[1]),e.three.add(t,y),O.o3=t}return v===`popup`&&(O.offF=e.view.feature(O.id,{kind:`marker`,location:a.location||null,anchor:()=>(O.o3.getWorldPosition(i),[i.x,i.y,i.z]),info:()=>Object.assign(e.data.popupFields(a),{location:a.location||null,name:s,subtitle:a.subtitle||null,description:a.description||``,logo:a.logo||null,hours:a.hours||null,level:y,data:a.data||null})})),C.addEventListener(`pointerenter`,()=>b.classList.add(`mp-hover`)),C.addEventListener(`pointerleave`,()=>b.classList.remove(`mp-hover`)),C.addEventListener(`click`,e=>{e.stopPropagation(),ee(O)}),O},P=null,F=()=>{if(P){P=null;try{e.view.highlight([])}catch{}}},I=t=>{let n=t.c.highlight,r=e.data.units().filter(e=>e.id===n||e.location===n||e.feature===n).map(e=>e.id);if(r.length)try{e.view.highlight(r),P={id:t.id,n:0,sel:void 0}}catch{}},ee=t=>{let n=t.c;if(e.announce(`marker`,j(t)),n.highlight&&t.act!==`link`&&(P&&P.id===t.id&&t.act===`none`?F():I(t)),t.act===`select`)try{e.view.select(n.unit?{id:n.unit}:t.targetUnit?{id:t.targetUnit}:n.feature)}catch(e){console.warn(`Marker `+t.id+`: `+e.message)}else t.act===`popup`?e.view.select(t.id):t.act===`link`&&n.url?window.open(n.url,n.target||`_blank`,`noopener`):t.act===`tooltip`&&e.ui.env().touch&&t.root.classList.toggle(`mp-hover`)},L=()=>{_.forEach(M),S={},e.data.units().forEach(e=>{S[e.id]=e}),w=!!t.setting(`amenities`),E=Math.max(.5,Math.min(2,+t.setting(`scale`)||1)),D.forEach(e=>e.root.remove()),D.clear(),O={sig:null,tier:null,of:new Map},_=e.data.markers().concat(A(),v).map(e=>Object.assign({},e,y[e.id])).filter(e=>!e.removed).map(N).filter(Boolean);let n=[...C].sort().join();C=new Set,_.forEach(t=>{if(t.c.style===`amenity`)return;let n=t.ride||e.data.unitAt(t.level,t.at[0],t.at[1]);n&&C.add(n)});let r=[...C].sort().join();if(r!==n)try{e.plugin(`labels`).refresh(n.split(`,`).concat(r.split(`,`)).filter(Boolean))}catch{}},R=e.three.camera,z=t=>{if(t.o3.getWorldPosition(i),t.dist=i.distanceTo(R.position),t.ride){let n=e.ui.anchor(t.ride);return n&&n.visible?[n.x,n.y]:null}let n=e.three.project(i.x,i.y,i.z);return n.visible?[n.x,n.y]:null},te=t=>{let n=t.members.map(e=>e.at);n.length>1&&e.view.fit(t.lead.level,n)},B=()=>{let t=h(`mp-cluster`),n=f(`span`,`mp-cluster-body`);n.setAttribute(`data-mp-drag`,``),t.append(n),E!==1&&(n.style.transform=`translate(-50%,-50%) scale(`+E+`)`);let r={root:t,body:n,g:null,dead:0};return n.title=e.ui.t(`zoom_in`),n.addEventListener(`click`,e=>{e.stopPropagation(),r.g&&te(r.g)}),r};e.on(`camera`,e=>{(e.home||x==null)&&(x=e.distance),b=x/Math.max(1e-6,e.distance)});let V=!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),H=e=>1-(1-e)**3,ne=e=>(e.o3.getWorldPosition(i),[i.x,i.y,i.z]),re=e=>{let t=[0,0,0];return e.members.forEach(e=>{let n=ne(e);t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}),t.map(t=>t/e.members.length)},ie=t=>{let n=e.three.project(t[0],t[1],t[2]);return n.visible?[n.x,n.y]:null},ae=t=>{let n=e.three.project(t[0],t[1],t[2]),r=e.three.project(t[0]+1,t[1],t[2]),i=e.three.project(t[0],t[1],t[2]+1);return Math.max(Math.hypot(r.x-n.x,r.y-n.y),Math.hypot(i.x-n.x,i.y-n.y))||1},oe=(t,n,r,i,a,o)=>{let s=e.ui.size(),c=null,l=1/0,u=1;t.forEach(e=>{let t=ie(ne(e));if(!t)return;let n=Math.hypot(t[0]-s.width/2,t[1]-s.height/2);n<l&&(l=n,c=e)}),c&&(u=ae(ne(c))*1.5**n/Math.max(1e-6,b));let d=i/u,f=new Map,p=new Map,m=[];t.slice().sort((e,t)=>t.prio-e.prio||e.idx-t.idx).forEach(e=>{let t=e.c,n=t.cluster===!1?`off`:t.cluster||a;if(n===`off`)return;let r=(t.cluster_group||t.style||``)+`|`+n+`|`+e.level,i=f.get(r)||f.set(r,[]).get(r),o=null,s=1/0;i.forEach(t=>{let n=Math.hypot(t.lead.at[0]-e.at[0],t.lead.at[1]-e.at[1]);n<d&&n<s&&(s=n,o=t)}),o?o.members.push(e):i.push({lead:e,members:[e],mode:n})}),f.forEach(e=>e.forEach(e=>{e.members.length<2||(e.cen=re(e),e.key=e.members.map(e=>e.id).sort().join(`|`),m.push(e),e.members.forEach(t=>p.set(t.id,e)))})),!V&&O.sig!=null&&t.forEach(e=>{let t=O.of.get(e.id),n=p.get(e.id),r=t&&t.mode===`count`,i=n&&n.mode===`count`;r&&!i?e.anim={from:t.cen,to:ne(e),t0:o,out:!1}:!r&&i&&(e.anim={from:ne(e),to:n.cen,t0:o,out:!0})});let h=new Set;m.forEach(e=>{if(e.mode!==`count`)return;h.add(e.key);let t=D.get(e.key);t||(D.set(e.key,t=B()),t.body.textContent=e.members.length),t.g=e,t.cen=e.cen,t.dead=0}),D.forEach((e,t)=>{!h.has(t)&&!e.dead&&(e.dead=o,e.root.classList.remove(`mp-on`),e.root._on=!1)}),O={sig:r,tier:n,of:p}};e.onFrame(()=>{let n=e.getState(),r=e.ui.size(),i=+t.setting(`radius`)||44,a=t.setting(`cluster`)?t.setting(`count`)?`count`:`hide`:`off`,o=performance.now(),s=+(t.setting(`min_zoom`)??.7)||0,c=[];if(_.forEach(t=>{let r=t.c,i=r.min_zoom??s,a=(n.allLevels?r.all_levels===`show`:t.level===n.level)&&e.three.levelOpacity(t.level)>.05;a&&(i>0&&b<i||r.max_zoom!=null&&b>r.max_zoom)&&(a=!1),t.ok=a,a&&c.push(t)}),P){let e=n.selected||null;P.sel===void 0?(e===P.id||++P.n>3)&&(P.sel=e):e!==P.sel&&F()}let l=Math.log(Math.max(1e-6,b))/Math.log(1.5),u=O.tier;(u==null||Math.abs(l-u)>.65)&&(u=Math.round(l));let d=u+`#`+c.map(e=>e.id).join(`,`);d!==O.sig&&oe(c,u,d,i,a,o);let f=e=>!!e&&e[0]>-80&&e[1]>-80&&e[0]<r.width+80&&e[1]<r.height+80;_.forEach(e=>{let t=e.ok?O.of.get(e.id):null,r=e.ok&&(!t||t.mode===`hide`&&t.lead===e),i=null,a=null;if(e.anim){let t=Math.min(1,(o-e.anim.t0)/320),n=H(t),r=e.anim;t>=1||!e.ok?e.anim=null:(i=ie([0,1,2].map(e=>r.from[e]+(r.to[e]-r.from[e])*n)),a=r.out?1-n*n:Math.min(1,n*1.6))}if(e.anim||(i=r||o-(e.offT||0)<220?z(e):null),i&&(e.pos=i),e.want=(r||!!e.anim)&&f(i),e.pos){let t=`translate(`+e.pos[0].toFixed(1)+`px,`+e.pos[1].toFixed(1)+`px)`;e.root._t!==t&&(e.root.style.transform=t,e.root._t=t)}let s=a==null?``:a.toFixed(3);e.root._o!==s&&(e.root.style.opacity=s,e.root._o=s,e.root.classList.toggle(`mp-anim`,a!=null));let c=!!n.selected&&(n.selected===e.c.unit||n.selected===e.c.feature||n.selected===e.id||n.selected===e.targetUnit);e.open!==c&&(e.open=c,e.root.classList.toggle(`mp-open`,c)),e.on!==e.want&&(e.on=e.want,e.root.classList.toggle(`mp-on`,e.on),e.on||(e.root.classList.remove(`mp-hover`),e.offT=o))}),D.forEach((e,t)=>{if(e.dead&&o-e.dead>260){e.root.remove(),D.delete(t);return}!e.dead&&e.g&&(e.cen=re(e.g));let n=ie(e.cen);if(n){let t=`translate(`+n[0].toFixed(1)+`px,`+n[1].toFixed(1)+`px)`;e.root._t!==t&&(e.root.style.transform=t,e.root._t=t)}if(e.dead)return;let r=f(n)&&(e.fr=(e.fr||0)+1)>1;e.root._on!==r&&(e.root._on=r,e.root.classList.toggle(`mp-on`,r))})});let se=t=>{let n=e.data.levelOf(t);if(n==null||n===`all`)throw Error(`Unknown level `+t);return n},U=(t,n)=>{let r=Object.assign({},n,t);if(t.at!=null){let n=e.data.find(t.at);if(!n)throw Error(`No store matches "`+t.at+`"`);r.unit=n.id,delete r.at}if(t.level!=null&&(r.level=se(t.level)),!r.unit&&(typeof r.x!=`number`||typeof r.z!=`number`))throw Error(`A marker needs x and z (floor-local map units) or at (a store)`);return r};e.provide({list:()=>_.map(j),covers:e=>C.has(e),top:t=>{let n=null;return _.forEach(r=>{if(r.on&&r.pos&&(r.c.unit===t||r.targetUnit===t||r.c.feature===t||r.id===t||r.c.legacy&&r.c.name===(e.data.feature(t)||{}).name)){let e=r.pos[1]-d[r.sh]*E;(n==null||e<n)&&(n=e)}}),n},add:t=>{t||={};let n=String(t.id||`marker-rt-`+ ++T);if(_.some(e=>e.id===n))throw Error(`Marker `+n+` exists`);return v.push(Object.assign(U(t,{level:e.getState().level||0}),{id:n})),L(),n},update:(e,t)=>{let n=v.find(t=>t.id===e);if(n)Object.assign(n,U(t||{},n));else if(_.some(t=>t.id===e))y[e]=Object.assign(y[e]||{},t);else throw Error(`No marker `+e);L()},remove:e=>{let t=v.length;if(v=v.filter(t=>t.id!==e),v.length===t){if(!_.some(t=>t.id===e))throw Error(`No marker `+e);y[e]={removed:!0}}L()},refresh:()=>{g=e.data.markerStyles(),L()}}),L();let ce=null,le=()=>{try{return JSON.stringify(A())}catch{return null}};return e.on(`units`,()=>{if(!t.setting(`amenities`))return;let e=le();(e==null||e!==ce)&&(ce=e,L())}),e.on(`plugin`,()=>{(!!t.setting(`amenities`)!==w||(+t.setting(`scale`)||1)!==E)&&L()}),()=>{_.forEach(M),D.forEach(e=>e.root.remove()),D.clear()}}),MapplicMap.HOURS=(()=>{let e=document,t=1440,n=[`mo`,`tu`,`we`,`th`,`fr`,`sa`,`su`],r={Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6};Object.entries({hours_open:`Open`,hours_closing:`Closing`,hours_opening:`Opening`,hours_closed:`Closed`,hours_until:`until {time}`,hours_at:`at {time}`,hours_24:`24 hours`,hours_every_day:`Every day`,hours_toggle:`Opening hours`}).forEach(([e,t])=>{MapplicMap.UI[e]??(MapplicMap.UI[e]=t)});let i=[`jan`,`feb`,`mar`,`apr`,`may`,`jun`,`jul`,`aug`,`sep`,`oct`,`nov`,`dec`],a=/^(?:(\d{4})\s+)?([a-z]{3})\s+(\d{1,2})(?:\s*-\s*(?:([a-z]{3})\s+)?(\d{1,2}))?/i,o=/^(\d{1,2})(?:\s*-\s*(\d{1,2}))?(?![\d:])/,s=(e,t)=>{let n=/^(\d{1,2}):(\d{2})$/.exec(String(e).trim());if(!n)return null;let r=n[1]*60+ +n[2];return+n[2]<60&&r<=t?r:null},c=e=>{let n=e.trim().toLowerCase();if(n===`off`||n===`closed`)return[];if(n===`24/7`)return[[0,t]];if(!n)return null;let r=[];for(let e of n.split(/\s*,\s*/)){let[n,i]=e.split(/\s*-\s*/),a=n==null?null:s(n,1439),o=i==null?null:s(i,2*t);if(a==null||o==null)return null;r.push([a,o<=a?o+t:o])}return r.sort((e,t)=>e[0]-t[0])},l=e=>{let t=[],n=e;for(;;){let e=t[t.length-1],r=a.exec(n),s=!r&&e?o.exec(n):null;if(r){let e=i.indexOf(r[2].toLowerCase()),a=r[4]?i.indexOf(r[4].toLowerCase()):e,o=+r[3],s=r[5]?+r[5]:o;if(e<0||a<0||o<1||o>31||s<1||s>31)return null;t.push({year:r[1]?+r[1]:null,from:(e+1)*100+o,to:(a+1)*100+s}),n=n.slice(r[0].length)}else if(s){let r=Math.floor(e.to/100),i=+s[1],a=s[2]?+s[2]:i;if(i<1||i>31||a<1||a>31)return null;t.push({year:e.year,from:r*100+i,to:r*100+a}),n=n.slice(s[0].length)}else return null;let c=/^\s*,\s*/.exec(n);if(!c)break;n=n.slice(c[0].length)}return{items:t,rest:n}},u=e=>{let t=[],r=[],i=e,a=!1,o=!1,s=e=>n.indexOf(e.toLowerCase());for(;;){let e;if(e=/^ph(?![a-z])/i.exec(i))a=!0;else if(e=/^([a-z]{2})(?![a-z])\s*\[([-\d,\s]+)\]/i.exec(i)){let t=s(e[1]),n=[];if(t<0)return!1;for(let t of e[2].split(`,`)){let e=/^\s*(-?\d)\s*(?:-\s*(\d))?\s*$/.exec(t);if(!e)return!1;for(let t=+e[1];t<=(e[2]?+e[2]:+e[1]);t++)t&&t>=-5&&t<=5&&n.push(t)}r.push({day:t,list:n})}else if(e=/^([a-z]{2})(?![a-z])(?:\s*-\s*([a-z]{2})(?![a-z]))?/i.exec(i)){let n=s(e[1]),r=e[2]?s(e[2]):n;if(n<0||r<0)return!o&&null;for(let e=n;t.includes(e)||t.push(e),e!==r;e=(e+1)%7);}else return!o&&null;o=!0,i=i.slice(e[0].length);let n=/^\s*,\s*/.exec(i);if(!n)break;i=i.slice(n[0].length)}return{weekdays:t,nth:r,ph:a,rest:i}},d=new Map,f=e=>{if(e&&typeof e==`object`&&Array.isArray(e.days))return e;let t=String(e??``).replace(/[\u2013\u2014]/g,`-`).trim();if(!t)return null;if(d.has(t))return d.get(t);let n=m(t,String(e));return d.size>500&&d.clear(),d.set(t,n),n},p=[0,1,2,3,4,5,6],m=(e,t)=>{let r=[];for(let t of e.split(/\s*;\s*|(?<=\d|off|closed)\s*,\s*(?=(?:mo|tu|we|th|fr|sa|su|ph)(?![a-z]))/i)){let e=t.trim();if(!e||/^sh(?![a-z])/i.test(e))continue;let n;if(/^(\d{4}\s+)?[a-z]{3}\s+\d/i.test(e)&&i.includes(e.replace(/^\d{4}\s+/,``).slice(0,3).toLowerCase())){let t=l(e);if(!t)return null;n={weekdays:[],nth:[],ph:!1,dates:t.items,times:t.rest}}else{let t=u(e);if(t===!1)return null;n=t?{weekdays:t.weekdays,nth:t.nth,ph:t.ph,dates:null,times:t.rest}:{weekdays:p,nth:[],ph:!1,dates:null,times:e}}let a=c(n.times);if(!a)return null;delete n.times,n.ranges=a,r.push(n)}if(!r.length)return null;let a=n.map(()=>[]);return r.forEach(e=>e.weekdays.forEach(t=>a[t]=e.ranges.map(e=>e.slice()))),{rules:r,days:a,ph:r.some(e=>e.ph),text:t}},h={},g=e=>e.y+`-`+x(e.m)+`-`+x(e.d),_=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||``));return t?{y:+t[1],m:+t[2],d:+t[3]}:null},v=e=>(new Date(Date.UTC(e.y,e.m-1,e.d)).getUTCDay()+6)%7,y=(e,t)=>{let n=new Date(Date.UTC(e.y,e.m-1,e.d+t));return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:n.getUTCDate()}},b=(e={})=>{let t=e.now;if(t&&(typeof t.day==`number`||t.date)){let e=_(t.date);return{day:e?v(e):t.day,minute:t.minute||0,date:e}}let n=t instanceof Date?t:new Date;if(e.timezone)try{let t=e.timezone,i=h[t]||(h[t]=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,weekday:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})),a=Object.fromEntries(i.formatToParts(n).map(e=>[e.type,e.value]));return{day:r[a.weekday],minute:a.hour%24*60+ +a.minute,date:{y:+a.year,m:+a.month,d:+a.day}}}catch{}return{day:(n.getDay()+6)%7,minute:n.getHours()*60+n.getMinutes(),date:{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()}}},x=e=>(e<10?`0`:``)+e,S=(e,t={})=>{let n=Math.floor(e/60),r=e%60;return t.hour12?(n%12||12)+(r?`:`+x(r):``)+` `+(n%24<12?`AM`:`PM`):n+`:`+x(r)},C=t=>t.lang||e.documentElement.lang||`en`,w=(e,t,n)=>{let r=t+`|`+e;return h[r]||(h[r]=new Intl.DateTimeFormat(e,Object.assign({timeZone:`UTC`},n)))},T=(e,t={})=>{try{return w(C(t),`day`,{weekday:`short`}).format(new Date(Date.UTC(2024,0,1+e)))}catch{return[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`][e]}},E=(e,t={})=>{let n=new Date(Date.UTC(e.y,e.m-1,e.d));try{return w(C(t),`date`,{weekday:`short`,day:`numeric`,month:`short`}).format(n)}catch{return T(v(e),t)+` `+g(e)}},D=e=>e.t||((e,t)=>MapplicMap.t(e,t)),O=(e,t)=>{if(!e||!t||!t.length)return null;let n=g(e),r=n.slice(5);return t.find(e=>e&&(e.date===n||e.date===r))||null},k=(e,t)=>{let n=t.m*100+t.d;return e.some(e=>{let r=e.from>e.to,i=r?n>=e.from||n<=e.to:n>=e.from&&n<=e.to;return!i||e.year==null?i:t.y===(r&&n<=e.to?e.year+1:e.year)})},A=(e,t,n)=>{if(!n||!e.length)return!1;let r=new Date(Date.UTC(n.y,n.m,0)).getUTCDate(),i=Math.ceil(n.d/7),a=-(Math.floor((r-n.d)/7)+1);return e.some(e=>e.day===t&&(e.list.includes(i)||e.list.includes(a)))},j=(e,t,n,r)=>{let i=O(n,r.holidays),a=[],o=`week`;if(e.rules.forEach(e=>{let r=null;e.dates?r=n&&k(e.dates,n)?`date`:null:e.ph&&i?r=`ph`:A(e.nth,t,n)?r=`nth`:e.weekdays.includes(t)&&(r=`week`),r&&(a=e.ranges,o=r)}),o===`week`&&i&&!e.ph&&i.hours!=null){let e=c(String(i.hours).replace(/[\u2013\u2014]/g,`-`));e&&(a=e,o=`holiday`)}return{ranges:a,special:o!==`week`,name:i&&(o===`ph`||o===`holiday`)&&i.name||null}},M=e=>{let t=[];return e.slice().sort((e,t)=>e[0]-t[0]).forEach(e=>{let n=t[t.length-1];n&&e[0]<=n[1]?n[1]=Math.max(n[1],e[1]):t.push(e.slice())}),t},N=(e,n,r)=>{let i=[];for(let a=-1;a<=8;a++){let o=((n.day+a)%7+7)%7,s=n.date?y(n.date,a):null;j(e,o,s,r).ranges.forEach(([e,n])=>i.push([a*t+e,a*t+n]))}return M(i)},P=(e,n={})=>{let r=f(e);if(!r)return{state:`unknown`,known:!1,open:null,always:!1,special:!1,minutes:null,change:null,text:e==null||typeof e==`object`?``:String(e)};let i=n.soon==null?60:+n.soon,a=b(n),o=a.minute,s=N(r,a,n),c=s.find(([e,t])=>e<=o&&o<t),l={known:!0,open:!!c,always:!1,special:j(r,a.day,a.date,n).special,minutes:null,change:null};if(c&&c[0]<=-1440&&c[1]>=9*t)Object.assign(l,{state:`open`,always:!0});else{let e=c?null:s.find(([e])=>e>o),n=c?c[1]:e?e[0]:null;if(n==null)l.state=`closed`;else{let e=(n%t+t)%t,r=Math.floor(n/t);c&&e===0&&r===1&&(e=t,r=0),l.minutes=n-o,l.change={minute:e,inDays:r,weekday:((a.day+r)%7+7)%7,date:a.date?g(y(a.date,r)):null},l.state=c?l.minutes<=i?`closing`:`open`:l.minutes<=i?`opening`:`closed`}}let u=F(l,n);return l.text=[u.word,u.before+u.time+u.after].join(` `).trim(),l},F=(e,n={})=>{let r=D(n);if(!e.known)return{word:``,before:``,time:e.text||``,after:``};let i=r(`hours_`+e.state);if(e.always)return{word:i,before:``,time:r(`hours_24`),after:``};if(!e.change)return{word:i,before:``,time:``,after:``};let a=e.state===`closing`||e.state===`opening`?`hours_at`:`hours_until`,[o,s=``]=String(r(a,{time:``})).split(``),c=e.change,l=S(c.minute,n);return{word:i,before:o,time:c.inDays&&e.minutes>=t?T(c.weekday,n)+` `+l:l,after:s}},I=(e,n)=>{let r=D(n);return e.length?e.length===1&&e[0][0]===0&&e[0][1]>=t?[r(`hours_24`)]:e.map(([e,r])=>S(e,n)+`–`+S(r>t?r-t:r,n)):[r(`hours_closed`)]},ee=(e,t={})=>{let n=f(e);if(!n)return[];let r=D(t),i=b(t),a=j(n,i.day,i.date,t).special?-1:i.day,o=[];return n.days.forEach((e,t)=>{let n=JSON.stringify(e),r=o[o.length-1];r&&r.key===n?r.to=t:o.push({from:t,to:t,key:n,ranges:e})}),o.map(e=>({from:e.from,to:e.to,days:e.from===0&&e.to===6?r(`hours_every_day`):e.from===e.to?T(e.from,t):T(e.from,t)+`–`+T(e.to,t),hours:I(e.ranges,t),closed:!e.ranges.length,today:a>=e.from&&a<=e.to}))},L=(e,t={})=>{let n=f(e),r=b(t);if(!n||!r.date)return[];let i=[],a=t.ahead==null?14:+t.ahead;for(let e=0;e<a;e++){let a=y(r.date,e),o=(r.day+e)%7,s=j(n,o,a,t);s.special&&(s.name||JSON.stringify(s.ranges)!==JSON.stringify(n.days[o]))&&i.push({date:g(a),label:E(a,t),name:s.name,hours:I(s.ranges,t),closed:!s.ranges.length,today:e===0})}return i},R=(t,n,r)=>{let i=e.createElement(t);return n&&(i.className=n),r!=null&&(i.innerHTML=r),i},z=MapplicMap.svgIcon,te={clock:z(`<circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path>`),chevron:z(`<path d="m6 9 6 6 6-6"></path>`)},B=e=>typeof e==`function`?e()||{}:e||{},V=new Set,H=(e,t)=>(e._mpHours={render:t,born:Date.now()},V.add(e),t(),e),ne=()=>V.forEach(e=>{e.isConnected?e._mpHours.render():Date.now()-e._mpHours.born>5e3&&V.delete(e)}),re=(e,t,n)=>{e.className=`mp-hours-badge mp-hours-`+t.state+(n.theme===`light`?` mp-hours-light`:``),e.replaceChildren(),e.title=n.variant===`dot`?t.text:``;let r=F(t,n);if(!t.known){let t=R(`span`,`mp-hours-label`);t.textContent=r.time,e.append(R(`span`,`mp-hours-icon`,te.clock),t);return}if(n.slot){let n=R(`span`,`mp-hours-slot`,t.state===`open`?null:te.clock);t.state===`open`&&n.append(R(`span`,`mp-hours-dot`)),e.append(n)}else e.append(R(`span`,`mp-hours-dot`));if(n.variant===`dot`)return;let i=R(`span`,`mp-hours-label`),a=R(`span`,`mp-hours-word`);if(a.textContent=r.word,i.append(a),n.variant!==`short`&&(r.before||r.time||r.after)){let e=R(`span`,`mp-hours-when`);if(r.before&&e.append(r.before),r.time){let t=R(`span`,`mp-hours-time`);t.textContent=r.time,e.append(t)}r.after&&e.append(r.after),i.append(` `,e)}e.append(i)},ie=(e,t)=>{let n=R(`span`,`mp-hours-badge`);return H(n,()=>{let r=B(t),i=P(e,r),a=JSON.stringify([i.state,i.text,r.variant,r.theme]);n._mpKey!==a&&(n._mpKey=a,re(n,i,r))})},ae=(e,t)=>{let n=R(`div`,`mp-hours`),r=`mp-hours-`+Math.random().toString(36).slice(2,9),i=!!B(t).expanded;return H(n,()=>{let a=B(t),o=P(e,a),s=ee(e,a),c=L(e,a),l=JSON.stringify([o.state,o.text,s,c,a.theme,!!a.reducedMotion]),u=R(`span`,`mp-hours-badge`);if(n._mpKey===l)return;if(n._mpKey=l,n.className=`mp-hours`+(a.theme===`light`?` mp-hours-light`:``)+(a.reducedMotion?` mp-still`:``),n.replaceChildren(),re(u,o,Object.assign({},a,{variant:`full`,theme:null,slot:!0})),!o.known||o.always||!s.length){let e=R(`div`,`mp-hours-line`);e.append(u),n.append(e);return}let d=R(`button`,`mp-hours-toggle`),f=R(`div`,`mp-hours-panel`),p=R(`div`,`mp-hours-inner`),m=R(`div`,`mp-hours-table`);if(d.type=`button`,d.setAttribute(`aria-controls`,r),d.setAttribute(`aria-label`,o.text+`. `+D(a)(`hours_toggle`)),d.append(u,R(`span`,`mp-hours-chev`,te.chevron)),f.id=r,s.forEach(e=>{let t=R(`div`,`mp-hours-row`+(e.today?` mp-today`:``)),n=R(`span`,`mp-hours-days`),r=R(`span`,`mp-hours-times`);n.textContent=e.days,e.hours.forEach(e=>{let t=R(`span`,``);t.textContent=e,r.append(t)}),e.today&&t.setAttribute(`aria-current`,`date`),t.append(n,r),m.append(t)}),c.length){let e=R(`div`,`mp-hours-special`);c.forEach(t=>{let n=R(`div`,`mp-hours-row`+(t.today?` mp-today`:``)),r=R(`span`,`mp-hours-days`),i=R(`span`,`mp-hours-times`);if(r.textContent=t.label,t.name){let e=R(`span`,`mp-hours-name`);e.textContent=t.name,r.append(e)}t.hours.forEach(e=>{let t=R(`span`,``);t.textContent=e,i.append(t)}),t.today&&n.setAttribute(`aria-current`,`date`),n.append(r,i),e.append(n)}),m.append(e)}p.append(m),f.append(p);let h=()=>{n.classList.toggle(`mp-open`,i),d.setAttribute(`aria-expanded`,i?`true`:`false`),f.setAttribute(`aria-hidden`,i?`false`:`true`),p.inert=!i};d.onclick=()=>{i=!i,h()},h(),n.append(d,f)})},oe={".mp-hours":`display:flex;flex-direction:column;font-family:Onest,sans-serif;font-size:12px;line-height:1.35;color:var(--mp-h-ink,var(--mp-card-fg))`,".mp-hours-light":`--mp-h-open:var(--mp-success);--mp-h-closing:var(--mp-warning);--mp-h-opening:var(--mp-accent-subtle-fg);--mp-h-closed:var(--mp-fg-muted);--mp-h-ink:var(--mp-fg);--mp-h-muted:var(--mp-fg-muted);--mp-h-hover:var(--mp-surface-hover);--mp-h-line:var(--mp-border)`,".mp-hours-badge":`display:inline-flex;align-items:center;gap:6px;min-width:0;font-family:Onest,sans-serif;font-size:13px;line-height:1.35;color:var(--mp-h-ink,var(--mp-card-fg));white-space:nowrap`,".mp-hours-open":`--mp-h-c:var(--mp-h-open,var(--mp-card-open))`,".mp-hours-closing":`--mp-h-c:var(--mp-h-closing,var(--mp-card-closing))`,".mp-hours-opening":`--mp-h-c:var(--mp-h-opening,var(--mp-card-opening))`,".mp-hours-closed":`--mp-h-c:var(--mp-h-closed,var(--mp-card-closed))`,".mp-hours-dot":`flex:none;width:8px;height:8px;box-sizing:border-box;border-radius:999px;background:var(--mp-h-c)`,".mp-hours-open .mp-hours-dot":`animation:mp-hours-pulse 1.6s ease-out infinite`,".mp-still .mp-hours-dot":`animation:none`,".mp-hours-opening .mp-hours-dot, .mp-hours-closed .mp-hours-dot":`background:transparent;border:2px solid var(--mp-h-c)`,".mp-hours-label":`min-width:0;overflow:hidden;text-overflow:ellipsis`,".mp-hours-word":`font-weight:600;color:var(--mp-h-c)`,".mp-hours-time":`font-weight:600`,".mp-hours-when":`white-space:nowrap`,".mp-hours-icon":`flex:none;width:16px;display:flex;align-items:center;justify-content:center;color:var(--mp-h-muted,var(--mp-card-fg-muted))`,".mp-hours-icon svg":`width:14px;height:14px;stroke-width:1.75`,".mp-hours-line":`min-height:28px;display:flex;align-items:center;justify-content:space-between;gap:12px`,".mp-hours .mp-hours-badge":`white-space:normal;gap:8px;font-size:12px`,".mp-hours-slot":`flex:none;width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--mp-h-c)`,".mp-hours-open .mp-hours-slot .mp-hours-dot":`animation-name:mp-hours-pulse-slot`,".mp-hours .mp-hours-label":`overflow:visible`,".mp-hours-toggle":`width:calc(100% + 16px);min-height:28px;margin:0 -8px;padding:4px 8px;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:12px;border:0;border-radius:calc(7px * var(--mp-rk, 1));background:transparent;font:inherit;color:inherit;text-align:start;cursor:pointer;transition:background-color 150ms ease`,".mp-hours-toggle:hover":`background:var(--mp-h-hover,var(--mp-card-bg-hover))`,".mp-hours-toggle:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-hours-chev":`flex:none;display:flex;color:var(--mp-h-muted,var(--mp-card-fg-muted));transition:transform 200ms ease`,".mp-hours-chev svg":`width:12px;height:12px`,".mp-hours.mp-open .mp-hours-chev":`transform:rotate(180deg)`,".mp-hours-panel":`display:grid;grid-template-rows:0fr;transition:grid-template-rows 200ms ease`,".mp-hours.mp-open .mp-hours-panel":`grid-template-rows:1fr`,".mp-hours.mp-still .mp-hours-panel, .mp-hours.mp-still .mp-hours-chev":`transition:none`,".mp-hours-inner":`min-height:0;overflow:hidden`,".mp-hours-table":`padding:2px 0 4px;display:flex;flex-direction:column`,".mp-hours-row":`display:flex;align-items:baseline;justify-content:space-between;gap:16px;padding:3px 0;color:var(--mp-h-muted,var(--mp-card-fg-muted))`,".mp-hours-row.mp-today":`color:var(--mp-h-ink,var(--mp-card-fg));font-weight:600`,".mp-hours-days":`flex:none;max-width:60%`,".mp-hours-name":`display:block;font-size:11px;font-weight:400;color:var(--mp-h-muted,var(--mp-card-fg-muted))`,".mp-hours-special":`margin-top:6px;padding-top:8px;border-top:1px solid var(--mp-h-line,var(--mp-card-border));display:flex;flex-direction:column`,".mp-hours-times":`min-width:0;display:flex;flex-direction:column;align-items:flex-end;text-align:end;font-variant-numeric:tabular-nums`},se=`@keyframes mp-hours-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mp-h-c) 55%, transparent) } 70%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--mp-h-c) 0%, transparent) } }
4155
4189
  @keyframes mp-hours-pulse-slot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mp-h-c) 55%, transparent) } 70%, 100% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--mp-h-c) 0%, transparent) } }
4156
- @media (prefers-reduced-motion: reduce) { .mp-map .mp-hours-dot { animation: none !important } }`;return{parse:f,status:P,table:ee,special:L,badge:ie,widget:ae,tick:ne,formatTime:S,dayName:T,css:oe,keyframes:se,icons:te,inject:()=>{MapplicMap.injectCss(`hours`,oe),MapplicMap.injectCss(`hours-keyframes`,se)}}})(),MapplicMap.plugin(`hours`,e=>{let t=MapplicMap.HOURS,n=e.plugin(`hours`);e.ui.style(t.css),MapplicMap.injectCss(`hours-keyframes`,t.keyframes);let r=null,i=0,a=null,o=null,s=()=>a||=e.data.holidays(),c=()=>{let t=n.setting(`soon`);return{now:r||void 0,holidays:s(),timezone:n.setting(`timezone`)||``,soon:t==null?60:+t,hour12:!!n.setting(`hour12`),lang:e.ui.language()||void 0,t:e.ui.t,reducedMotion:!!e.ui.env().reducedMotion}},l=n=>{if(n&&typeof n==`object`)return`hours`in n?n.hours:n;if(t.parse(n))return n;try{let t=e.data.find(n);return t?t.hours:typeof n==`string`?n:null}catch{return typeof n==`string`?n:null}},u=(e,t)=>Object.assign(c(),t,e?{now:e}:null),d=n=>{let r=u(n);return e.data.stores().concat(e.data.amenities()).filter(e=>e.hours).map(e=>Object.assign({id:e.id,name:e.name},t.status(e.hours,r)))},f=()=>{let t=d(),n={},r=[];t.forEach(e=>{n[e.id]=e.state;let t=o&&o[e.id];t&&t!==e.state&&r.push({id:e.id,name:e.name,from:t,to:e.state,status:e})}),o=n,r.length&&e.announce(`hours`,{changes:r})},p=()=>{t.tick(),f()};e.provide({parse:e=>t.parse(e),status:(e,n)=>t.status(l(e),u(n)),table:(e,n)=>t.table(l(e),u(n)),special:(e,n)=>t.special(l(e),u(n)),statuses:e=>d(e),holidays:()=>s().map(e=>Object.assign({},e)),badge:(e,n)=>t.badge(l(e),()=>u(null,n)),widget:(e,n)=>t.widget(l(e),()=>u(null,n)),setTime:e=>{r=e||null,p()},options:c}),f(),e.onFrame(()=>{let e=Date.now();e-i<15e3||(i=e,p())}),e.on(`plugin`,()=>{a=null,p()}),e.on(`units`,()=>{a=null,p()}),e.on(`language`,()=>{a=null,t.tick()})}),MapplicMap.POPUP=(()=>{let e=document,t=[`gallery`,`header`,`description`,`hours`,`details`,`action`,`directions`],n=(t,n,r,i)=>{let a=e.createElement(t);return n&&(a.className=n),i&&(a.style.cssText=i),r!=null&&(a.innerHTML=r),a},r=MapplicMap.svgIcon,i=Object.fromEntries(Object.entries({up:`<path d="m5 12 7-7 7 7"></path><path d="M12 19V5"></path>`,dn:`<path d="M12 5v14"></path><path d="m19 12-7 7-7-7"></path>`,x:`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`,prev:`<path d="m15 18-6-6 6-6"></path>`,next:`<path d="m9 18 6-6-6-6"></path>`,phone:`<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path>`,mail:`<rect width="20" height="16" x="2" y="4" rx="2"></rect><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path>`,globe:`<circle cx="12" cy="12" r="10"></circle><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"></path><path d="M2 12h20"></path>`,clock:`<circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path>`,calendar:`<rect width="18" height="18" x="3" y="4" rx="2"></rect><path d="M16 2v4"></path><path d="M8 2v4"></path><path d="M3 10h18"></path>`,info:`<circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path>`,tag:`<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>`,layers:`<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"></path><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"></path><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"></path>`,star:`<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path>`,wifi:`<path d="M12 20h.01"></path><path d="M2 8.82a15 15 0 0 1 20 0"></path><path d="M5 12.86a10 10 0 0 1 14 0"></path><path d="M8.5 16.43a5 5 0 0 1 7 0"></path>`,start:`<circle cx="12" cy="12" r="8"></circle><circle cx="12" cy="12" r="3"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="M2 12h2"></path><path d="M20 12h2"></path>`}).map(([e,t])=>[e,r(t)])),a={".mp-popup":`position:absolute;left:0;top:0;box-sizing:border-box;width:var(--mp-pw,208px);border-radius:calc(16px * var(--mp-rk, 1));background:var(--mp-card-bg);color:var(--mp-card-fg);box-shadow:0 0 0 1px var(--mp-card-ring), var(--mp-card-shadow);transform-origin:50% calc(100% + 12px);will-change:opacity,transform;cursor:default;user-select:text;font-family:Onest,sans-serif;text-align:start`,".mp-popup-place:not(.mp-popup-sheet):not(.mp-media-side)":`width:max-content;min-width:var(--mp-pw,208px);max-width:max(var(--mp-pw,208px), 320px)`,".mp-popup-place:not(.mp-popup-sheet):not(.mp-media-side) .mp-sec:not(.mp-popup-head)":`contain:inline-size`,'&[data-mp-scheme="dark"] .mp-popup, .mp-popup[data-mp-scheme="dark"]':`--mp-card-shadow:0 24px 64px rgba(0,0,0,0.6), 0 8px 24px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3)`,'&[data-mp-scheme="dark"][data-mp-glass="1"], .mp-popup[data-mp-scheme="dark"][data-mp-glass="1"]':`--mp-glass-bg:#09090b;--mp-card-ring:rgba(255,255,255,0.07)`,'&[data-mp-glass="1"] .mp-popup, .mp-popup[data-mp-glass="1"]':`background:color-mix(in srgb, var(--mp-glass-bg, var(--mp-card-bg)) var(--mp-glass-tint, 62%), transparent);-webkit-backdrop-filter:blur(16px) saturate(1.15);backdrop-filter:blur(16px) saturate(1.15)`,'.mp-popup[data-mp-glass="1"] .mp-popup-arrow':`background:color-mix(in srgb, var(--mp-card-bg) 90%, transparent);clip-path:polygon(calc(100% + 1px) -2.5px,calc(100% + 1px) calc(100% + 1px),-2.5px calc(100% + 1px))`,'&[data-mp-glass="1"] .mp-popup-arrow':`display:none`,".mp-popup-tail":`position:absolute;left:4px;top:-4.5px;width:12px;height:12px;border-radius:calc(2px * var(--mp-rk, 1));transform-origin:6px 20px;transform:translateY(-14px) rotate(45deg) translateY(14px);will-change:opacity,transform;pointer-events:none;background:color-mix(in srgb, var(--mp-glass-bg, var(--mp-card-bg)) var(--mp-glass-tail, 44%), transparent);-webkit-backdrop-filter:blur(4px) saturate(1.15);backdrop-filter:blur(4px) saturate(1.15);box-shadow:1px 1px 0 0 var(--mp-card-ring)`,".mp-popup-tail-box":`display:none;position:absolute;left:-10px;top:-15.5px;width:20px;height:12px;overflow:hidden;pointer-events:none`,'&[data-mp-glass="1"] .mp-popup-tail-box':`display:block`,'&[data-mp-glass="1"] .mp-popup-scroll.mp-pinning > .mp-pin-top, &[data-mp-glass="1"] .mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom, .mp-popup[data-mp-glass="1"] .mp-popup-scroll.mp-pinning > .mp-pin-top, .mp-popup[data-mp-glass="1"] .mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom':`background:transparent`,'&[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-top::after, &[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-bottom::before, .mp-popup[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-top::after, .mp-popup[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-bottom::before':`display:none`,".mp-popup-elevator":`width:max-content`,".mp-popup-bus_stop":`width:240px`,".mp-popup-arrow":`position:absolute;left:50%;bottom:-6px;width:12px;height:12px;margin-left:-6px;background:var(--mp-card-bg);box-shadow:1px 1px 0 0 var(--mp-card-ring);transform:rotate(45deg);border-radius:calc(2px * var(--mp-rk, 1))`,".mp-popup-head":`display:flex;align-items:flex-start;justify-content:space-between;gap:8px`,".mp-popup-bus_stop .mp-popup-head":`align-items:center`,".mp-popup-elevator .mp-popup-head":`align-items:center;padding:4px 8px 6px`,".mp-popup-close":`flex:none;width:24px;height:24px;margin:-4px -6px 0 0;padding:0;border:0;background:transparent;font:inherit;display:flex;align-items:center;justify-content:center;border-radius:calc(6px * var(--mp-rk, 1));color:var(--mp-card-fg-muted);cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,".mp-popup-elevator .mp-popup-close":`margin:-2px -4px 0 0`,".mp-popup-close:focus-visible, .mp-popup-x:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:1px`,".mp-popup:focus":`outline:none`,".mp-popup:focus-visible":`box-shadow:0 0 0 2px var(--mp-accent), var(--mp-card-shadow, 0 4px 12px rgba(0,0,0,0.2))`,".mp-popup-close:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup-who":`min-width:0;display:flex;align-items:center;gap:10px`,".mp-popup-logo":`flex:none;width:40px;height:40px;box-sizing:border-box;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-card-bg-hover);display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background-color 150ms ease`,".mp-popup-logo img":`width:100%;height:100%;object-fit:cover;display:block;opacity:0;transition:opacity 150ms ease`,".mp-popup-logo.mp-loaded":`background:#fff`,".mp-popup-logo.mp-loaded.mp-logo-mono":`background:var(--mp-logo-bg)`,".mp-popup-logo.mp-logo-mono img":`filter:var(--mp-logo-filter)`,".mp-popup-logo.mp-loaded img":`opacity:1`,".mp-popup-names":`min-width:0;display:flex;flex-direction:column`,".mp-popup-title":`min-width:0;font-size:14px;font-weight:700;letter-spacing:-0.01em;color:var(--mp-card-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-popup-sub":`margin-top:1px;font-size:12px;color:var(--mp-card-fg-muted);overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical`,".mp-popup-label":`font-size:11px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-card-fg-muted)`,".mp-popup-hours":`min-width:0`,".mp-sec + .mp-popup-hours, .mp-popup-hours + .mp-sec":`margin-top:8px`,".mp-popup-hours.mp-sec + .mp-popup-details.mp-sec":`margin-top:0`,".mp-popup-scroll > .mp-popup-hours:last-child":`margin-bottom:-4px`,".mp-popup-hours-plain":`min-height:28px;display:flex;align-items:center;gap:8px;font-size:12px;color:var(--mp-card-fg-secondary)`,".mp-popup-hours-plain svg":`flex:none;color:var(--mp-card-fg-muted)`,".mp-popup-foot":`display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px`,".mp-popup-btn":`flex:0 1 auto;min-width:0;height:28px;padding:0 12px;box-sizing:border-box;border:0;border-radius:calc(7px * var(--mp-rk, 1));font-family:Onest,sans-serif;font-size:13px;font-weight:600;line-height:28px;text-align:center;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;transition:background-color 150ms ease,box-shadow 150ms ease`,".mp-popup-foot.mp-pair .mp-popup-btn":`flex:1 1 auto;padding:0 8px`,".mp-popup-foot .mp-popup-btn.mp-popup-icon":`flex:none;width:28px;padding:0;display:flex;align-items:center;justify-content:center`,".mp-popup-go":`background:var(--mp-accent);color:var(--mp-fg-on-accent)`,".mp-popup-go:hover":`background:var(--mp-accent-hover)`,".mp-popup-alt":`background:transparent;box-shadow:inset 0 0 0 1px var(--mp-card-border-hover);color:var(--mp-card-fg)`,".mp-popup-alt:hover":`box-shadow:inset 0 0 0 1px var(--mp-card-fg-muted)`,".mp-popup-floors":`min-width:160px;display:flex;flex-direction:column;gap:4px`,".mp-popup-floor":`height:36px;padding:0 8px 0 10px;display:flex;align-items:center;justify-content:space-between;gap:8px;border:0;border-radius:calc(7px * var(--mp-rk, 1));background:var(--mp-card-bg-hover);font-family:Onest,sans-serif;font-size:13px;font-weight:600;color:var(--mp-card-fg);cursor:pointer;transition:background-color 150ms ease`,".mp-popup-floor:hover":`background:var(--mp-card-bg-active)`,".mp-popup-floor-name":`display:flex;align-items:center;gap:8px;white-space:nowrap`,".mp-popup-meta":`display:flex;align-items:center;gap:6px;min-width:0;margin-top:4px;font-size:12px;color:var(--mp-card-fg-muted)`,".mp-popup-meta-text":`min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap`,".mp-popup-cats":`display:flex;flex-wrap:nowrap;align-items:center;gap:4px;margin-top:4px;min-width:0`,".mp-popup-meta-wrap":`flex-wrap:nowrap;gap:4px`,".mp-popup-meta-wrap > .mp-popup-tag":`flex:none`,".mp-popup-meta-wrap > .mp-popup-cats":`flex:0 1 auto;flex-wrap:nowrap;margin-top:0;margin-inline-start:4px;align-items:center`,".mp-popup-discs":`flex:none;display:inline-flex;align-items:center;gap:2px`,".mp-popup-discs + .mp-popup-cat":`flex:0 1 auto;min-width:0;margin-inline-start:2px`,".mp-popup-cat":`min-width:0;max-width:100%;height:20px;padding:0;display:inline-flex;align-items:center;gap:5px;border:0;background:transparent;font-family:Onest,sans-serif;font-size:12px;font-weight:500;line-height:1;color:var(--mp-card-fg-secondary)`,".mp-popup-cat-disc":`flex:none;width:20px;height:20px;padding:0;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:50%;font-family:Onest,sans-serif;font-size:10px;font-weight:700;line-height:1;background:var(--mp-cc, var(--mp-card-cat, #27272a));color:#fff`,".mp-popup-cat-disc svg, .mp-popup-cat-disc img":`display:block;width:12px;height:12px;object-fit:contain`,".mp-popup-cat-name":`min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap`,".mp-popup-cat-btn":`cursor:pointer;border-radius:999px;transition:color 150ms ease`,".mp-popup-cat-btn:hover":`color:var(--mp-card-fg)`,".mp-popup-cat-btn:focus-visible, .mp-popup-cat-dot:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:1px`,".mp-popup-catw":`position:relative;flex:none;display:inline-flex`,".mp-popup-cat-dot":`cursor:pointer;transition:filter 150ms ease`,".mp-popup-cat-dot:hover":`filter:brightness(0.9)`,".mp-popup-cat-tip":`position:absolute;left:50%;top:calc(100% + 4px);z-index:2;transform:translate(calc(-50% + var(--mp-tx, 0px)),-2px);padding:4px 8px;border:0;border-radius:calc(6px * var(--mp-rk, 1));white-space:nowrap;font-family:Onest,sans-serif;font-size:11px;font-weight:600;line-height:1.2;background:var(--mp-ct, var(--mp-card-fg));color:var(--mp-ct-ink, var(--mp-card-bg));opacity:0;pointer-events:none;transition:opacity 150ms ease,transform 150ms ease`,'.mp-popup-catw[style*="--mp-ct"]':`--mp-ct-ink:#fff`,".mp-popup-cat-tip::before":`content:'';position:absolute;left:calc(50% - var(--mp-tx, 0px));top:-3px;width:6px;height:6px;margin-left:-3px;transform:rotate(45deg);background:inherit;border-radius:calc(1px * var(--mp-rk, 1))`,"button.mp-popup-cat-tip":`cursor:pointer`,".mp-popup > .mp-popup-cat-tip":`z-index:3`,".mp-popup-cat-tip.mp-show":`opacity:1;transform:translate(calc(-50% + var(--mp-tx, 0px)),0);pointer-events:auto`,".mp-popup-meta .mp-popup-tag":`min-width:0;height:18px;padding:0 6px;display:inline-flex;align-items:center;line-height:1;background:transparent;box-shadow:inset 0 0 0 1px var(--mp-card-border);color:var(--mp-card-fg-muted)`,".mp-popup-meta .mp-popup-tag-btn:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup-tag-btn":`border:0;cursor:pointer;font-family:Onest,sans-serif;transition:background 150ms ease`,".mp-popup-tag-btn:hover":`background:var(--mp-card-bg-strong)`,".mp-popup-tag":`flex:none;min-width:28px;box-sizing:border-box;text-align:center;font-size:11px;font-weight:600;padding:2px 6px;border-radius:calc(4px * var(--mp-rk, 1));background:var(--mp-card-bg-active);color:var(--mp-card-fg-secondary)`,".mp-popup-desc":`margin-top:2px;font-size:12px;line-height:1.5;color:var(--mp-card-fg-muted);white-space:pre-line;overflow-wrap:anywhere`,".mp-popup-departures":`margin-top:10px;padding-top:4px;border-top:1px solid var(--mp-card-border);display:flex;flex-direction:column`,".mp-popup-departure":`height:28px;display:flex;align-items:center;gap:10px;font-size:12px`,".mp-popup-dest":`flex:1;min-width:0;color:var(--mp-card-fg);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-popup-mins":`flex:none;font-family:'Roboto Mono',monospace;font-size:12px;color:var(--mp-card-fg-muted)`,".mp-popup-mins.mp-soon":`color:var(--mp-card-success)`,".mp-popup-scroll":`clip-path:inset(0 round calc(16px * var(--mp-rk, 1)));box-sizing:border-box;padding:12px;max-height:inherit;overflow-x:hidden;overflow-y:auto;overscroll-behavior:none;border-radius:inherit;scrollbar-width:thin;scrollbar-color:var(--mp-card-border) transparent`,".mp-popup-elevator .mp-popup-scroll":`padding:8px`,".mp-popup-sheet .mp-popup-scroll":`clip-path:inset(0 round calc(18px * var(--mp-rk, 1)))`,".mp-popup.mp-media-side:not(.mp-media-end) > .mp-popup-scroll":`clip-path:inset(0 round 0 calc(16px * var(--mp-rk, 1)) calc(16px * var(--mp-rk, 1)) 0)`,".mp-popup.mp-media-end > .mp-popup-scroll":`clip-path:inset(0 round calc(16px * var(--mp-rk, 1)) 0 0 calc(16px * var(--mp-rk, 1)))`,".mp-popup-sheet":`border-radius:calc(18px * var(--mp-rk, 1));transform-origin:50% 100%`,".mp-popup-sheet .mp-popup-arrow":`display:none`,".mp-popup:not(.mp-popup-sheet):not(.mp-media-side) .mp-popup-slide":`aspect-ratio:auto;height:var(--mp-bh,calc(var(--mp-pw,264px) * 0.5625))`,".mp-popup-sheet .mp-popup-slide":`aspect-ratio:auto;height:min(calc(var(--mp-cw,480px) * 0.5625), var(--mp-mh,160px))`,".mp-popup-x":`position:absolute;top:10px;inset-inline-end:10px;z-index:2;width:20px;height:20px;display:flex;align-items:center;justify-content:center;border:0;padding:0;border-radius:calc(6px * var(--mp-rk, 1));background:transparent;color:var(--mp-card-fg-muted);cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,".mp-popup-x svg":`width:12px;height:12px`,".mp-popup-x:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup.mp-media-top .mp-popup-x":`background:rgba(24,24,27,0.72);color:#fff;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)`,".mp-popup.mp-media-top .mp-popup-x:hover":`background:var(--mp-card-bg)`,".mp-popup-place:not(.mp-media-top) .mp-popup-scroll > :first-child":`padding-inline-end:20px`,".mp-sec + .mp-sec":`margin-top:10px`,".mp-popup-scroll.mp-pinning > .mp-pin-top":`position:sticky;top:0;z-index:1;margin-left:-12px;margin-right:-12px;padding-inline-start:12px;padding-inline-end:32px;background:var(--mp-card-bg)`,".mp-popup-scroll.mp-pinning:has(> .mp-pin-top)":`padding-top:0`,".mp-popup-scroll.mp-pinning-foot:has(> .mp-pin-bottom)":`padding-bottom:0`,".mp-popup-scroll.mp-pinning:has(> .mp-pin-top) > .mp-popup-gallery.mp-first":`margin-top:0`,".mp-popup-scroll.mp-pinning > .mp-pin-top:first-child":`margin-top:0;padding-top:12px`,".mp-popup-scroll.mp-pinning > .mp-pin-top:not(:first-child)":`margin-top:0;padding-top:10px`,".mp-popup-place .mp-popup-scroll.mp-pinning > .mp-pin-top":`padding-inline-end:32px`,".mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom":`position:sticky;bottom:0;z-index:1;margin:0 -12px;padding:10px 12px 12px;background:var(--mp-card-bg)`,".mp-popup-scroll.mp-pinning > .mp-pin-top::after, .mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom::before":`content:'';position:absolute;left:0;right:0;height:16px;pointer-events:none;opacity:0;transition:opacity 150ms ease`,".mp-popup-scroll.mp-pinning > .mp-pin-top::after":`top:100%;background:linear-gradient(var(--mp-card-bg),transparent)`,".mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom::before":`bottom:100%;background:linear-gradient(transparent,var(--mp-card-bg))`,".mp-popup-scroll.mp-pinning.mp-under-top > .mp-pin-top::after, .mp-popup-scroll.mp-pinning-foot.mp-under-bottom > .mp-pin-bottom::before":`opacity:1`,".mp-popup-head + .mp-popup-text":`margin-top:8px`,".mp-popup-gallery":`position:relative;overflow:hidden;margin-left:-12px;margin-right:-12px;outline:none;background:var(--mp-card-bg-hover)`,".mp-popup-gallery.mp-first":`margin-top:-12px`,".mp-popup-gallery.mp-last":`margin-bottom:-12px`,".mp-popup-gallery:focus-visible":`box-shadow:inset 0 0 0 2px var(--mp-accent)`,".mp-popup.mp-media-side":`display:flex;width:calc(var(--mp-pw,264px) + var(--mp-mw,224px))`,".mp-popup.mp-media-end":`flex-direction:row-reverse`,".mp-popup.mp-media-side > .mp-popup-gallery":`flex:none;width:var(--mp-mw,224px);min-height:min(calc(var(--mp-mw,224px) * 1.25), var(--mp-room,9999px));margin:0;overflow:hidden;border-start-start-radius:inherit;border-end-start-radius:inherit`,".mp-popup.mp-media-end > .mp-popup-gallery":`border-start-start-radius:0;border-end-start-radius:0;border-start-end-radius:inherit;border-end-end-radius:inherit`,".mp-popup.mp-media-side > .mp-popup-scroll":`flex:1 1 auto;min-width:0;display:flex;flex-direction:column`,".mp-popup.mp-media-side > .mp-popup-scroll > *":`flex:none`,".mp-popup.mp-media-side > .mp-popup-scroll > :has(+ .mp-popup-foot:last-child)":`margin-bottom:auto`,".mp-popup.mp-media-side .mp-popup-track":`position:absolute;inset:0`,".mp-popup.mp-media-side .mp-popup-slide":`aspect-ratio:auto;height:100%`,".mp-popup.mp-media-end .mp-popup-x":`inset-inline-end:calc(var(--mp-mw,224px) + 10px)`,".mp-popup-track":`display:flex`,".mp-popup-gallery.mp-multi .mp-popup-track":`cursor:grab;touch-action:pan-y;will-change:transform;transition:transform 320ms cubic-bezier(0.22,0.8,0.24,1)`,".mp-popup-track.mp-drag":`cursor:grabbing;transition:none !important`,".mp-popup-slide":`flex:none;width:100%;aspect-ratio:16/9;position:relative;overflow:hidden;background:var(--mp-card-bg-hover)`,".mp-popup-slide img":`width:100%;height:100%;object-fit:cover;display:block;opacity:0;transition:opacity 200ms ease;-webkit-user-drag:none;user-select:none;pointer-events:none`,".mp-popup-slide.mp-loaded img":`opacity:1`,".mp-popup-slide.mp-broken img":`display:none`,".mp-popup-nav":`position:absolute;top:50%;width:24px;height:24px;margin-top:-12px;display:flex;align-items:center;justify-content:center;border:0;padding:0;border-radius:999px;background:rgba(24,24,27,0.28);-webkit-backdrop-filter:blur(8px) saturate(1.15);backdrop-filter:blur(8px) saturate(1.15);color:#fff;box-shadow:inset 0 0 0 1px rgba(255,255,255,0.22);cursor:pointer;opacity:0;pointer-events:none;transition:opacity 150ms ease,background-color 150ms ease`,".mp-popup-nav svg":`width:14px;height:14px`,".mp-popup-nav:hover":`background:rgba(24,24,27,0.45)`,".mp-popup-prev":`left:8px`,".mp-popup-next":`right:8px`,".mp-popup-gallery:hover .mp-popup-nav, .mp-popup-gallery:focus-visible .mp-popup-nav":`opacity:1;pointer-events:auto`,".mp-popup-nav:disabled":`opacity:0 !important;pointer-events:none !important`,".mp-popup-dots":`position:absolute;left:0;right:0;bottom:8px;display:flex;justify-content:center;gap:4px;pointer-events:none`,".mp-popup-dot":`width:6px;height:6px;padding:0;border:0;border-radius:calc(3px * var(--mp-rk, 1));background:rgba(255,255,255,0.55);box-shadow:0 0 2px rgba(0,0,0,0.3);pointer-events:auto;cursor:pointer;transition:width 150ms ease,background-color 150ms ease`,".mp-popup-dot.mp-on":`width:16px;background:#fff`,".mp-popup-text .mp-popup-desc":`margin-top:0`,".mp-popup-desc.mp-clamp":`display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden`,".mp-popup-more":`margin-top:4px;padding:0;border:0;background:none;font-family:Onest,sans-serif;font-size:12px;font-weight:600;color:var(--mp-card-fg);cursor:pointer`,".mp-popup-link":`color:var(--mp-card-fg);text-decoration:underline;text-decoration-color:var(--mp-card-border-strong);text-underline-offset:2px;transition:text-decoration-color 150ms ease`,".mp-popup-link:hover":`text-decoration-color:var(--mp-card-fg-muted)`,".mp-popup-details":`display:flex;flex-direction:column;margin-left:-8px;margin-right:-8px`,".mp-popup-row":`min-height:28px;padding:4px 8px;box-sizing:border-box;display:flex;align-items:center;gap:8px;border-radius:calc(7px * var(--mp-rk, 1));font-size:12px;line-height:1.35;color:var(--mp-card-fg-secondary);text-decoration:none;overflow-wrap:anywhere`,"a.mp-popup-row":`cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,"a.mp-popup-row:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup-row-icon":`flex:none;width:16px;display:flex;align-items:center;justify-content:center;color:var(--mp-card-fg-muted)`,".mp-popup-row-icon svg, .mp-popup-row-icon img":`width:14px;height:14px;stroke-width:1.75`,".mp-popup-row-label":`flex:1;min-width:0;color:var(--mp-card-fg-muted)`,".mp-popup-row-value":`flex:1;min-width:0`,".mp-popup-row-label + .mp-popup-row-value":`flex:0 1 auto;max-width:60%;text-align:end`},o=e=>e?/^\s*<svg/i.test(e)?e:i[e]||``:``,s=e=>{let t=n(`span`,`mp-popup-tag`);return t.textContent=e,t},c=(e,t)=>{let r=n(`span`,`mp-popup-names`),i=n(`span`,`mp-popup-title`);if(i.textContent=e,r.append(i),t){let e=n(`span`,`mp-popup-sub`);e.textContent=t,r.append(e)}return r},l=e=>{let t=n(`button`,`mp-popup-close`,i.x);return t.type=`button`,t.title=e.t(`close`),t.setAttribute(`aria-label`,e.t(`close`)),t.onclick=()=>e.close&&e.close(),t},u=e=>{let t=n(`button`,`mp-popup-x`,i.x);return t.type=`button`,t.title=e.t(`close`),t.setAttribute(`aria-label`,e.t(`close`)),t.onclick=()=>e.close&&e.close(),t},d=e=>[].concat(e.images||[]).map(e=>typeof e==`string`?{src:e}:e).filter(e=>e&&e.src),f=(e,t)=>{let r=/https?:\/\/[^\s<>"')]+/g,i=0,a;for(;a=r.exec(t);){a.index>i&&e.append(t.slice(i,a.index));let o=n(`a`,`mp-popup-link`);o.href=a[0],o.target=`_blank`,o.rel=`noopener`,o.textContent=a[0].replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``),e.append(o),i=r.lastIndex}i<t.length&&e.append(t.slice(i))},p=new Set([`p`,`br`,`b`,`strong`,`i`,`em`,`a`,`ul`,`ol`,`li`,`span`]),m=new Set([`script`,`style`,`iframe`,`object`,`embed`,`template`,`svg`,`math`,`noscript`,`link`,`meta`]),h=(t,n)=>{if(!/<\/?[a-z][^>]*>/i.test(n))return f(t,n);let r=new DOMParser().parseFromString(`<body>`+n+`</body>`,`text/html`).body,i=(t,n)=>t.childNodes.forEach(t=>{if(t.nodeType===3){n.closest&&n.closest(`a`)?n.append(t.textContent):f(n,t.textContent);return}if(t.nodeType!==1)return;let r=t.tagName.toLowerCase();if(m.has(r))return;if(!p.has(r))return i(t,n);let a=e.createElement(r),o=(t.getAttribute(`class`)||``).replace(/[^\w\- ]/g,``).trim();if(o&&(a.className=o),r===`a`){let e=(t.getAttribute(`href`)||``).trim();/^(https?:|mailto:|tel:)/i.test(e)&&(a.href=e,/^https?:/i.test(e)&&(a.target=`_blank`,a.rel=`noopener`)),a.classList.add(`mp-popup-link`)}n.append(a),i(t,a)});i(r,t)},g=(e,t)=>{let r=n(`div`,`mp-popup-gallery`),a=n(`div`,`mp-popup-track`);if(e.forEach((e,t)=>{let r=n(`div`,`mp-popup-slide`),i=n(`img`);i.alt=e.alt||``,i.decoding=`async`,t&&(i.loading=`lazy`),i.draggable=!1,i.onload=()=>r.classList.add(`mp-loaded`),i.onerror=()=>r.classList.add(`mp-broken`),i.src=e.src,r.append(i),a.append(r)}),r.append(a),[`pointerdown`,`touchstart`,`wheel`].forEach(e=>r.addEventListener(e,e=>e.stopPropagation(),{passive:!0})),e.length<2)return r;r.classList.add(`mp-multi`),r.tabIndex=0,r.setAttribute(`role`,`region`),r.setAttribute(`aria-roledescription`,`carousel`);let o=n(`div`,`mp-popup-dots`),s=n(`button`,`mp-popup-nav mp-popup-prev`,i.prev),c=n(`button`,`mp-popup-nav mp-popup-next`,i.next),l=-1;s.type=c.type=`button`,s.setAttribute(`aria-label`,t.t(`previous`)),c.setAttribute(`aria-label`,t.t(`next`));let u=()=>getComputedStyle(a).direction===`rtl`,d=()=>Math.max(1,r.clientWidth),f=e.length-1,p=0,m=e=>{let t=d(),n=.55;return Math.sign(e)*(Math.abs(e)*t*n/(t+n*Math.abs(e)))},h=e=>{let t=u()?-1:1,n=-(f-l)*d(),r=l*d(),i=e*t;return(i>r?r+m(i-r):i<n?n+m(i-n):i)*t},g=()=>{let e=u()?1:-1;a.style.transform=`translateX(calc(`+e*l*100+`% + `+p+`px))`},_=()=>{[...o.children].forEach((e,t)=>{e.classList.toggle(`mp-on`,t===l),e.setAttribute(`aria-current`,t===l?`true`:`false`)}),s.disabled=l===0,c.disabled=l===f},v=e=>{l=Math.max(0,Math.min(f,e)),p=0,a.style.transition=t.reducedMotion?`none`:``,g(),_()};e.forEach((t,r)=>{let i=n(`button`,`mp-popup-dot`);i.type=`button`,i.setAttribute(`aria-label`,r+1+` / `+e.length),i.onclick=()=>v(r),o.append(i)}),s.onclick=()=>v(l-1),c.onclick=()=>v(l+1),r.addEventListener(`keydown`,e=>{let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);t&&(e.preventDefault(),e.stopPropagation(),v(l+(u()?-t:t)))});let y=(e,t)=>{let n=(u()?-1:1)*(e<0?1:-1),r=Math.abs(e)>d()*.15||Math.abs(t)>.35&&Math.sign(t)===Math.sign(e);v(r?l+n:l)},b=null;a.addEventListener(`pointerdown`,e=>{e.button||(b={id:e.pointerId,x:e.clientX,y:e.clientY,on:!1,t:e.timeStamp,lx:e.clientX,v:0})}),a.addEventListener(`pointermove`,e=>{if(!b||e.pointerId!==b.id)return;let t=e.clientX-b.x,n=e.clientY-b.y;if(!b.on){if(Math.abs(t)<5&&Math.abs(n)<5)return;if(Math.abs(n)>Math.abs(t))return void(b=null);b.on=!0,b.x=e.clientX-Math.sign(t)*5,a.setPointerCapture(e.pointerId),a.classList.add(`mp-drag`)}let r=e.timeStamp-b.t;r>0&&(b.v=.8*((e.clientX-b.lx)/r)+.2*b.v),b.t=e.timeStamp,b.lx=e.clientX,p=h(e.clientX-b.x),g()});let x=e=>{if(!b||e.pointerId!==b.id)return;let t=b;b=null,t.on&&(a.classList.remove(`mp-drag`),e.timeStamp-t.t>80&&(t.v=0),y(e.type===`pointercancel`?0:e.clientX-t.x,t.v))};a.addEventListener(`pointerup`,x),a.addEventListener(`pointercancel`,x),a.addEventListener(`lostpointercapture`,x);let S=0,C=0,w=!1;return a.addEventListener(`wheel`,e=>{if(Math.abs(e.deltaX)<=Math.abs(e.deltaY)||(e.preventDefault(),clearTimeout(C),C=setTimeout(()=>{a.classList.remove(`mp-drag`),w||y(S,0),S=0,w=!1},140),w))return;S-=e.deltaX*(e.deltaMode===1?33:1);let t=h(S);Math.abs(S)>d()*.25&&t===S?(w=!0,a.classList.remove(`mp-drag`),y(S,0)):(a.classList.add(`mp-drag`),p=t,g())},{passive:!1}),r.append(s,c,o),l=0,g(),_(),r},_=(e,t,r)=>{let i=t&&t.levels||[];if(i.length<2||e.level==null)return null;let a=[{id:e.id,level:e.level}].concat((e.linked||[]).filter(e=>e.level!=null)),o=new Set,s=n(`span`,`mp-popup-meta`);if(a.slice().sort((e,t)=>e.level-t.level).forEach(r=>{if(o.has(r.level))return;o.add(r.level);let a=i.find(e=>e.index===r.level)||{},c=r.level!==e.level&&t.select,l=n(c?`button`:`span`,`mp-popup-tag`+(c?` mp-popup-tag-btn`:``));l.textContent=a.short||a.name||String(r.level),c&&(l.type=`button`,l.title=a.name||``,l.onclick=()=>t.select(r.id)),s.append(l)}),r){let e=n(`span`,`mp-popup-meta-text`);e.textContent=r,s.append(e)}return s},v=(e,t)=>{let r=(e.categoryTags||[]).filter(e=>e&&(e.name||e.id));if(!r.length||e.subtitle||e.group||!t||t.categoryChips===!1)return null;let i=MapplicMap.PLACE,a=t.filterCategory,o=n(`span`,`mp-popup-cats`),s=n(`span`,`mp-popup-discs`);return r.forEach((e,t)=>{let r=e.name||e.id,c=i&&e.icon?i.icon(e.icon,12):null,l=n(`span`,`mp-popup-catw`),u=n(`button`,`mp-popup-cat-disc mp-popup-cat-dot`,c||``),d=n(a?`button`:`span`,`mp-popup-cat-tip`);c||(u.textContent=r.trim().charAt(0).toUpperCase()),e.color&&(l.style.setProperty(`--mp-cc`,MapplicData.readableOn(`#ffffff`,e.color,3)),l.style.setProperty(`--mp-ct`,MapplicData.readableOn(`#ffffff`,e.color,4.5)),d.style.setProperty(`--mp-ct`,MapplicData.readableOn(`#ffffff`,e.color,4.5)),d.style.setProperty(`--mp-ct-ink`,`#fff`)),u.type=`button`,u.setAttribute(`aria-label`,r),u.setAttribute(`aria-expanded`,`false`),u.onclick=t=>{t.stopPropagation();let n=window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches;if(a&&(n||l.classList.contains(`mp-open`)))return a(e.id);let r=!l.classList.contains(`mp-open`);o.querySelectorAll(`.mp-popup-catw.mp-open`).forEach(e=>{e.classList.remove(`mp-open`),e.firstChild.setAttribute(`aria-expanded`,`false`),e.dispatchEvent(new Event(`mp-cat-hide`))}),l.classList.toggle(`mp-open`,r),u.setAttribute(`aria-expanded`,String(r)),r&&h()},d.textContent=r;let f=()=>{let e=l.closest(`.mp-popup`)||l;d.parentNode!==e&&e.append(d),d.style.transition=`none`,d.style.setProperty(`--mp-tx`,`0px`);let t=u.getBoundingClientRect(),n=e.getBoundingClientRect(),r=e.offsetWidth?n.width/e.offsetWidth:1;d.style.left=(t.left+t.width/2-n.left)/r+`px`,d.style.top=(t.bottom-n.top)/r+4+`px`;let i=d.getBoundingClientRect(),a=6*r,o=i.left<n.left+a?n.left+a-i.left:i.right>n.right-a?n.right-a-i.right:0;d.style.setProperty(`--mp-tx`,o/r+`px`),d.offsetWidth,d.style.transition=``},p=!1,m=0,h=()=>{clearTimeout(m),f(),d.classList.add(`mp-show`)},g=()=>{clearTimeout(m),m=setTimeout(()=>{p||l.classList.contains(`mp-open`)||MapplicMap.focused()===u||d.classList.remove(`mp-show`)},a?80:0)};l.addEventListener(`mouseenter`,h),l.addEventListener(`mouseleave`,g),d.addEventListener(`mouseenter`,()=>(p=!0,clearTimeout(m))),d.addEventListener(`mouseleave`,()=>(p=!1,g())),u.addEventListener(`focus`,()=>u.matches(`:focus-visible`)&&h()),u.addEventListener(`blur`,g),l.addEventListener(`mp-cat-hide`,()=>d.classList.remove(`mp-show`)),a?(d.type=`button`,d.tabIndex=-1,d.onclick=()=>a(e.id)):d.setAttribute(`aria-hidden`,`true`),l.append(u,d),s.append(l)}),o.append(s),requestAnimationFrame(()=>{let e=o.closest(`.mp-popup-scroll`);e&&e.addEventListener(`scroll`,()=>s.querySelectorAll(`.mp-popup-catw`).forEach(e=>e.dispatchEvent(new Event(`mp-cat-hide`))),{passive:!0})}),o},y=(e,t)=>{let r=v(e,t),i=r?null:e.subtitle||e.group||(e.categories&&e.categories.length>1?e.categories.join(`, `):e.category);if(!e.name&&!e.logo)return null;let a=n(`div`,`mp-popup-head`),o=n(`span`,`mp-popup-who`);if(e.logo){let t=n(`span`,`mp-popup-logo`),r=n(`img`,``);r.alt=``,r.decoding=`async`,r.onload=()=>{t.classList.toggle(`mp-logo-mono`,MapplicData.imageIsMono(r)),t.classList.add(`mp-loaded`)},r.onerror=()=>t.classList.remove(`mp-loaded`),r.src=e.logo,t.append(r),o.append(t)}let s=_(e,t,i),l=c(e.name||``,s?null:i);return s&&r&&(s.classList.add(`mp-popup-meta-wrap`),s.append(r)),s?l.append(s):r&&l.append(r),o.append(l),a.append(o),a},b=(e,t)=>{let r=n(`div`,`mp-popup-text`),i=n(`div`,`mp-popup-desc mp-clamp`);return h(i,e),r.append(i),requestAnimationFrame(()=>{if(i.scrollHeight-i.clientHeight<2)return i.classList.remove(`mp-clamp`);let e=n(`button`,`mp-popup-more`);e.type=`button`,e.textContent=t.t(`show_more`);let a=0;e.onclick=()=>{let n=!i.classList.contains(`mp-clamp`);if(e.textContent=t.t(n?`show_more`:`show_less`),clearTimeout(a),t.reducedMotion)return void i.classList.toggle(`mp-clamp`,n);let r=i.offsetHeight;i.style.transition=`none`,i.style.height=``,i.classList.toggle(`mp-clamp`,n);let o=i.offsetHeight;n&&i.classList.remove(`mp-clamp`),i.style.overflow=`hidden`,i.style.height=r+`px`,i.offsetHeight,i.style.transition=`height 200ms ease`,i.style.height=o+`px`,a=setTimeout(()=>{i.style.transition=i.style.height=i.style.overflow=``,i.classList.toggle(`mp-clamp`,n)},210)},r.append(e)}),r},x=(e,t)=>{let r=n(`div`,`mp-popup-hours`);if(t.hours)r.append(t.hours.widget(e.hours));else{let t=n(`div`,`mp-popup-hours-plain`,i.clock),a=n(`span`,``);a.textContent=e.hours,t.append(a),r.append(t)}return r},S=e=>{let t=[],r=String(e.website||``);if(e.phone&&t.push({icon:`phone`,value:e.phone,href:`tel:`+String(e.phone).replace(/[^\d+]/g,``)}),e.email&&t.push({icon:`mail`,value:e.email,href:`mailto:`+e.email}),r&&t.push({icon:`globe`,value:r.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``),href:/^https?:/i.test(r)?r:`https://`+r}),[].concat(e.details||[]).forEach(e=>{e&&(e.value!=null&&e.value!==``||e.label)&&t.push(e)}),!t.length)return null;let i=n(`div`,`mp-popup-details`);return t.forEach(e=>{let t=n(e.href?`a`:`div`,`mp-popup-row`),r=o(e.icon);if(e.href&&(t.href=e.href,/^https?:/i.test(e.href)&&(t.target=e.target||`_blank`,t.rel=`noopener`)),r&&t.append(n(`span`,`mp-popup-row-icon`,r)),e.label){let r=n(`span`,`mp-popup-row-label`);r.textContent=e.label,t.append(r)}if(e.value!=null&&e.value!==``){let r=n(`span`,`mp-popup-row-value`);r.textContent=String(e.value),t.append(r)}i.append(t)}),i},C=(e,t)=>{if(e.action===!1)return null;let n=e.kind===`store`&&e.popup&&e.popup.link&&typeof e.popup.link==`object`?e.popup.link:null,r=e.action&&typeof e.action==`object`?e.action:null;if(!n&&!r)return null;let i=Object.assign({},n,r);return!i.url&&!i.label?null:(i.url&&=String(i.url).replace(/\{(id|unit)\}/g,(t,n)=>encodeURIComponent(n===`unit`?e.id:e.location||e.id)),i.label||=t.t(`view_store`),i)},w=(e,t,r,i)=>{let a=n(`button`,`mp-popup-btn `+e,i);return a.type=`button`,i?a.setAttribute(`aria-label`,t):a.textContent=t,a.title=t,a.onclick=r,a},T=(e,t,r)=>{let i=n(r.url?`a`:`button`,`mp-popup-btn mp-popup-primary mp-popup-go`);return i.textContent=r.label,i.title=r.label,r.url?(i.href=r.url,i.target=r.target||`_blank`,i.target===`_blank`&&(i.rel=`noopener`)):i.type=`button`,i.addEventListener(`click`,n=>t.action&&t.action(e,r,n)),i},E=(e,t,r,a)=>{let o=r?C(e,t):null,s=a&&e.kind===`store`&&t.dirs;if(!o&&!s)return null;let c=n(`div`,`mp-popup-foot`);if(s){t.startHere&&c.append(w(`mp-popup-from mp-popup-alt mp-popup-icon`,t.t(`from_here`),()=>t.dirs.from(e),i.start));let n=o||t.directions===`secondary`?`mp-popup-alt`:`mp-popup-go`;c.append(w(`mp-popup-dir `+n,t.t(`directions`),()=>t.dirs.to(e)))}return o&&c.append(T(e,t,o)),c.classList.toggle(`mp-pair`,!!(o&&s)),c},D=e=>{let t=e.getBoundingClientRect(),n=e.classList.contains(`mp-pinning`)&&e.querySelector(`:scope > .mp-pin-top`),r=e.classList.contains(`mp-pinning-foot`)&&e.querySelector(`:scope > .mp-pin-bottom`),i=n&&n.getBoundingClientRect(),a=r&&r.getBoundingClientRect();[...e.children].forEach(o=>{if(o===n||o===r)return;let s=o.getBoundingClientRect(),c=s.height,l=[];if(i&&e.scrollTop>1&&i.bottom>s.top&&i.top<s.bottom){let e=i.top-s.top,t=i.bottom-s.top;l.push(`#000 `+e+`px`,`transparent `+e+`px`,`transparent `+t+`px`,`#000 `+(t+12)+`px`)}if(a&&a.top<s.bottom&&a.bottom>s.top&&a.top<t.bottom-1){let e=a.top-s.top,t=a.bottom-s.top;l.push(`#000 `+(e-12)+`px`,`transparent `+e+`px`,`transparent `+t+`px`,`#000 `+t+`px`)}let u=l.length?`linear-gradient(#000 0px, `+l.join(`, `)+`, #000 `+Math.max(c,0)+`px)`:``;o.style.maskImage!==u&&(o.style.webkitMaskImage=u,o.style.maskImage=u)})},O=(e,t)=>{let n=()=>{let n=parseFloat(e.style.maxHeight)||0,r=t.scrollHeight-t.clientHeight-t.scrollTop;t.classList.toggle(`mp-pinning`,!(n&&n<220)),t.classList.add(`mp-pinning-foot`),t.classList.toggle(`mp-under-top`,t.scrollTop>1),t.classList.toggle(`mp-under-bottom`,r>1),D(t)};if(t.addEventListener(`scroll`,n,{passive:!0}),e._pinObs&&e._pinObs.disconnect(),typeof ResizeObserver==`function`){let r=0;e._pinObs=new ResizeObserver(()=>{cancelAnimationFrame(r),r=requestAnimationFrame(n)}),e._pinObs.observe(t),[...t.children].forEach(t=>e._pinObs.observe(t))}e._pinUpdate=n,n()},k=(e,n,r,i)=>{let a=e.popup||{},o=d(e),s=(Array.isArray(a.sections)?a.sections:t).filter((e,n,r)=>t.includes(e)&&r.indexOf(e)===n),c=s.find(e=>e===`action`||e===`directions`),l={gallery:()=>o.length?g(o,n):null,header:()=>y(e,n),description:()=>e.description?b(String(e.description),n):null,hours:()=>e.hours&&n.openNow!==!1?x(e,n):null,details:()=>S(e),action:()=>c===`action`?E(e,n,!0,s.includes(`directions`)):null,directions:()=>c===`directions`?E(e,n,s.includes(`action`),!0):null},f=s.map(e=>l[e]()).filter(Boolean);f.forEach(e=>{e.classList.add(`mp-sec`),r.append(e)});let p=e=>e&&e.classList.contains(`mp-popup-gallery`),m=p(f[0]);m&&f[0].classList.add(`mp-first`),p(f[f.length-1])&&f[f.length-1].classList.add(`mp-last`);let h=f.find(e=>e.classList.contains(`mp-popup-head`)),_=f[f.length-1];h&&(f[0]===h||m&&f[1]===h)&&h.classList.add(`mp-pin-top`),_&&_.classList.contains(`mp-popup-foot`)&&_!==h&&_.classList.add(`mp-pin-bottom`),O(i,r),i.classList.toggle(`mp-media-top`,m),i._media=o.length?{mode:a.media===`top`||a.media===`side`?a.media:`auto`,side:a.media_side===`end`?`end`:`start`,gallery:f.find(p),top:m,mark:null}:null,i.append(u(n)),i.style.setProperty(`--mp-pw`,Math.max(180,Math.min(480,+a.width||(o.length?264:208)))+`px`)},A={elevator(e,t,r){let a=t.state||{},o=n(`div`,`mp-popup-head`),c=n(`span`,`mp-popup-label`);c.textContent=t.t(`elevator`),o.append(c,l(t));let u=n(`div`,`mp-popup-floors`);u.append(...(e.floors||[]).slice().reverse().filter(t=>a.allLevels||t.index!==e.level).map(r=>{let o=n(`button`,`mp-popup-floor`),c=n(`span`,`mp-popup-floor-name`,a.allLevels||e.level==null?``:r.index>e.level?i.up:i.dn),l=n(`span`,``);return l.textContent=r.name,c.append(l),o.append(c,s(r.short)),o.onclick=()=>t.setLevel&&t.setLevel(r.index),o})),r.append(o,u)},bus_stop(e,t,r){let i=n(`div`,`mp-popup-head`);if(i.append(c(e.name),l(t)),r.append(i),e.description){let t=n(`div`,`mp-popup-desc`);h(t,String(e.description)),r.append(t)}if((e.departures||[]).length){let i=n(`div`,`mp-popup-departures`);i.append(...e.departures.map(e=>{let r=n(`div`,`mp-popup-departure`),i=n(`span`,`mp-popup-dest`),a=n(`span`,`mp-popup-mins`+(e.minutes<=2?` mp-soon`:``));return i.textContent=e.to,a.textContent=e.minutes<=0?t.t(`now`):t.t(`minutes`,{n:e.minutes}),r.append(s(String(e.line)),i,a),r})),r.append(i)}}};return{css:a,fill:(e,t,r)=>{let i=t.kind||`store`;e._media=null,e._pinUpdate=null,e._pinObs&&e._pinObs.disconnect(),e._pinObs=null,e.className=`mp-popup `+(A[i]?``:`mp-popup-place `)+`mp-popup-`+i,e.replaceChildren(),e.style.removeProperty(`--mp-pw`);let a=n(`div`,`mp-popup-scroll`),o=n(`span`,`mp-popup-arrow`);return e.append(a,o),(A[i]||k)(t,r,a,e),{scroll:a,arrow:o}},fitMedia:(t,n)=>{let r=t._media,i=t.querySelector(`:scope > .mp-popup-scroll`);if(!r||!r.gallery||!i)return`none`;let a=n=>{t.classList.toggle(`mp-media-side`,n),t.classList.toggle(`mp-media-end`,n&&r.side===`end`),t.classList.toggle(`mp-media-top`,!n&&r.top),n&&r.gallery.parentNode!==t?(r.mark=r.mark||e.createComment(`media`),r.gallery.replaceWith(r.mark),t.insertBefore(r.gallery,i)):!n&&r.gallery.parentNode===t&&r.mark.replaceWith(r.gallery)};n||={};let o=parseFloat(t.style.getPropertyValue(`--mp-pw`))||264,s=(n.width||0)>=o+224+16&&!(n.height>0&&n.height<280),c=!1;if(r.mode===`side`)c=s;else if(r.mode===`auto`&&s){a(!1);let e=i.scrollHeight;c=e-r.gallery.offsetHeight>300||n.height>0&&e>n.height}return a(c),t._pinUpdate&&t._pinUpdate(),c?`side`:`top`},MEDIA_SIDE_H:280,el:n,icons:i,sections:t,inject:()=>MapplicMap.injectCss(`popups`,a)}})(),MapplicMap.plugin(`popups`,e=>{let t=e.plugin(`popups`),n=e.plugin(`wayfinding`),r=e.plugin(`hours`),i=()=>e.ui.env().reducedMotion,a=MapplicMap.POPUP,o=e.ui.container;e.ui.style(a.css);let s=e.ui.mount(a.el(`div`,``,null,`position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;z-index:10`)),c=a.el(`div`,`mp-popup`,null,`opacity:0;pointer-events:none`),l=a.el(`span`,`mp-popup-tail`,null,`opacity:0`),u=a.el(`span`,`mp-popup-tail-box`);u.append(l),s.append(c,u),c.addEventListener(`wheel`,e=>e.stopPropagation(),{passive:!0}),c.tabIndex=-1,c.setAttribute(`role`,`dialog`);let d=0,f=null,p=e=>{(e.key===`Enter`||e.key===` `)&&(d=performance.now())},m=()=>d=0;document.addEventListener(`keydown`,p,!0),document.addEventListener(`pointerdown`,m,!0);let h=()=>c.contains(MapplicMap.focused()),g=e=>!!e&&e!==document.body&&(o.contains(e)||!!(e.closest&&e.closest(`[class*="mp-"]`))),_=()=>{let e=MapplicMap.focused();!h()&&g(e)&&(f=e),(f||h())&&c.focus({preventScroll:!0})},v=()=>{let e=f&&f.isConnected&&f.offsetParent!==null?f:(o.parentElement||document).querySelector(`.mp-search-input`);f=null,e?e.focus({preventScroll:!0}):o.focus&&o.focus({preventScroll:!0})};c.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&(t.stopPropagation(),e.view.deselect()),t.key===`Tab`&&t.shiftKey&&f){let e=c.querySelector(`button, a[href], input, select, textarea, [tabindex="0"]`);(MapplicMap.focused()===c||MapplicMap.focused()===e)&&(t.preventDefault(),v())}});let y=()=>({t:e.ui.t,close:()=>e.view.deselect(),openNow:t.setting(`open_now`)!==!1,directions:t.setting(`directions`)===`secondary`?`secondary`:`primary`,startHere:t.setting(`start_here`)===!0,reducedMotion:i(),state:e.getState(),setLevel:t=>e.view.setLevel(t),levels:e.data.levels(),select:t=>e.view.select({id:t}),categoryChips:t.setting(`category_chips`)!==!1,filterCategory:e.plugin(`search`).enabled()?t=>{e.plugin(`search`).setQuery({text:``,category:[t]}),e.view.deselect()}:null,hours:r.enabled()?{widget:e=>r.widget(e)}:null,dirs:n.enabled()?{from:e=>n.from({id:e.id}),to:e=>n.to({id:e.id})}:null}),b=null,x=null,S=!1,C=0,w=0,T=!1,E=null,D=e=>{let t=!!(e&&b&&F===b&&b.kind===e.kind&&b.id===e.id);b=e,t&&(F=e,ee=``,P=performance.now()+500);let n=h();E=a.fill(c,e,y()).arrow,c.setAttribute(`aria-label`,e.name||e.title||``),n&&!h()&&c.focus({preventScroll:!0}),c.classList.toggle(`mp-popup-sheet`,T),w=c.offsetWidth,c._k=null,c._fit=null},O=t=>{t!==void 0&&(x=t);let n=e.getState(),r=x&&!(x.kind===`store`&&n.allLevels),i=S,a=t!==void 0&&performance.now()-d<400;if(r&&D(x),S=!!r,c.style.pointerEvents=S?`auto`:`none`,c.setAttribute(`aria-hidden`,S?`false`:`true`),S&&a)d=0,_();else if(!S&&i&&(h()||f&&document.activeElement===document.body)){let e=f;requestAnimationFrame(()=>{if(S)return;let t=MapplicMap.focused();if(t&&t!==document.body&&!c.contains(t))return f=null;e?(f=e,v()):(f=null,h()&&t.blur())})}else S||(f=null)},k=e.plugin(`markers`),A=e=>{if(!k.enabled())return null;try{return k.top(e)}catch{return null}},j=e=>Math.min(e,Math.max(c.scrollHeight,c.querySelector(`:scope > .mp-popup-scroll`)?.scrollHeight||0))+56,M=(e,t)=>Math.max(0,Math.min(t/2-64,Math.max(e/2-Math.min(40,t*.05),e-t/2))),N=0,P=0;c.addEventListener(`click`,()=>P=performance.now()+500);let F=null,I=0,ee=``,L=e=>{let t=c._media,n=c.querySelector(`:scope > .mp-popup-scroll`);if(!t||!t.gallery||!n||c.classList.contains(`mp-media-side`))return;let r=e+`|`+w;if(r===ee)return;ee=r;let i=n.scrollHeight-t.gallery.offsetHeight+(t.top?12:0),a=Math.round(w*.5625);c.style.setProperty(`--mp-bh`,Math.max(Math.min(56,a),Math.min(a,Math.round(e-i)))+`px`)};e.onFrame(n=>{let r=o.clientWidth,u=o.clientHeight,d=t.setting(`style`),f=(d===`sheet`||d!==`floating`&&(r<360||r<480&&!!e.ui.env().touch))&&!!b&&b.kind!==`elevator`,p=Math.round(Math.min(360,u*.6)),m=0;if(f!==T&&(T=f,c.classList.toggle(`mp-popup-sheet`,f),f||(c.style.width=``,c._w=0),w=c.offsetWidth),b){if(T){let e=Math.min(r-16,480);c._w!==e&&(c.style.width=e+`px`,c._w=e),s.style.transform=`translate(`+((r-e)/2).toFixed(1)+`px,`+(u-8)+`px)`;let t=Math.round(u*.5);c.style.maxHeight=t+`px`,c.style.setProperty(`--mp-cw`,e+`px`),c.style.setProperty(`--mp-mh`,Math.round(t*.45)+`px`),c._fit!==`sheet`&&(c._fit=`sheet`,a.fitMedia(c,{width:0}))}else{if(F!==b){F=b,ee=``,c.style.maxHeight=``,c.style.removeProperty(`--mp-room`),c.style.removeProperty(`--mp-bh`),a.fitMedia(c,{width:r}),N=j(p);let t=e.view.lift(M(N,u)),n=Math.max(160,Math.min(p,Math.round(u/2+t-30)));a.fitMedia(c,{width:r,height:n}),c._fit=r,w=c.offsetWidth}else if(performance.now()<P){let t=j(p);Math.abs(t-N)>8&&(N=t,e.view.lift(M(t,u)))}let t=e.ui.anchor(b.id);if(t){let e=A(b.id),n=(e==null?t.y:Math.min(t.y,e-2))-8,i=Math.max(160,Math.min(p,Math.round(n-30)));c.style.maxHeight=i+`px`,c.style.setProperty(`--mp-room`,i+`px`),c._fit!==r&&(c._fit=r,a.fitMedia(c,{width:r,height:i}),w=c.offsetWidth),L(i);let o=w/2,l=Math.max(0,o-22);s.style.transform=`translate(`+t.x.toFixed(1)+`px,`+n.toFixed(1)+`px)`,m=Math.max(-l,Math.min(l,Math.min(0,r-8-(t.x+o))+Math.max(0,8-(t.x-o))))}}}C=i()?+!!S:Math.max(0,Math.min(1,C+(S?n/.24:-n/.16)));let h=T&&b&&(S||C>0)?c.offsetHeight+16:0,g=C<.5?2*C*C:1-(-2*C+2)**2/2,_=Math.round(S?h:h*g);_!==I&&(I=_,e.ui.inset(_?{bottom:_}:null));let v=C.toFixed(3)+`|`+m.toFixed(1)+`|`+T;if(c._k===v)return;c._k=v;let y=e=>{let t=e-1;return 1+2.7*t*t*t+1.7*t*t};if(T){let e=i()?0:(S?(1-C)**3:1-C)*24;c.style.transform=`translate(0,calc(-100% + `+e.toFixed(1)+`px))`,c.style.transformOrigin=``,l.style.visibility=`hidden`}else{let e=i()?1:S?.6+.4*y(C):.85+.15*C,t=m.toFixed(1);c.style.transform=`translate(calc(-50% + `+t+`px),calc(-100% - 14px)) scale(`+e.toFixed(3)+`)`,c.style.transformOrigin=`calc(50% - `+t+`px) calc(100% + 14px)`,E&&(E.style.left=`calc(50% - `+t+`px)`),l.style.transform=`scale(`+e.toFixed(3)+`) translateY(-14px) rotate(45deg) translateY(14px)`,l.style.visibility=``}c.style.opacity=l.style.opacity=(S?Math.min(1,C/.75):C).toFixed(3),!S&&C===0&&(b=null)}),O(e.data.feature(e.getState().selected)),e.on(`select`,e=>O(e)),e.on(`level`,()=>O());let R=[`attract`,`controls`,`scenery`,`labels`];return e.on(`plugin`,e=>{e&&R.includes(e.id)||O()}),e.on(`units`,t=>{if(!S||!x||!(t.ids||[]).includes(x.id))return;let n=e.data.feature(e.getState().selected);n&&n.id===x.id&&O(n)}),()=>{document.removeEventListener(`keydown`,p,!0),document.removeEventListener(`pointerdown`,m,!0)}}),MapplicMap.plugin(`attract`,e=>{let t=e.plugin(`attract`),n=[`pointerdown`,`wheel`,`keydown`,`touchstart`],r=[`Tab`,`Shift`],i=e.ui.container,a=performance.now(),o=!1,s=0,c=1,l=[],u=0,d=0,f=0,p=0,m=!1,h=e=>t.setting(e)!==!1,g=()=>{let e=t.setting(`progress`);return e===`off`||e===`pill`?e:`bar`};e.ui.style({".mp-attract-bar":`position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none;z-index:1;transition:opacity 200ms ease-out`,".mp-attract-bar > div":`position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--mp-accent, #1476ff);transform-origin:left;transform:scaleX(0)`,".mp-attract-tip":`position:absolute;inset:0;border-radius:inherit;pointer-events:none;transition:opacity 200ms ease-out;-webkit-mask-image:linear-gradient(135deg,transparent 50%,#000 50%);mask-image:linear-gradient(135deg,transparent 50%,#000 50%)`,".mp-popup-tail > .mp-attract-tip":`inset:-1px;-webkit-mask-image:linear-gradient(135deg,transparent calc(50% - 2px),#000 calc(50% - 2px));mask-image:linear-gradient(135deg,transparent calc(50% - 2px),#000 calc(50% - 2px))`,".mp-attract-pill":`position:absolute;z-index:13;left:calc(50% + (var(--mp-inset-bl, 0px) - var(--mp-inset-br, 0px)) / 2);bottom:calc(16px + var(--mp-inset-b, 0px));transform:translateX(-50%);display:none;align-items:center;gap:10px;height:36px;padding:0 16px;box-sizing:border-box;border-radius:9999px;background:rgba(9,9,11,.45);-webkit-backdrop-filter:blur(12px) saturate(1.2);backdrop-filter:blur(12px) saturate(1.2);box-shadow:0 0 0 1px rgba(255,255,255,.08),0 8px 24px rgba(0,0,0,.12);color:#fff;font:600 13px/1 Onest,sans-serif;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity 200ms ease-out`,".mp-attract-pill.mp-on":`opacity:1`,"&:has(.mp-popup-sheet) .mp-attract-pill":`left:calc(50% + (var(--mp-inset-l, 0px) - var(--mp-inset-r, 0px)) / 2);top:16px;bottom:auto`,".mp-attract-pill svg":`flex:none`,".mp-attract-sep":`width:1px;height:14px;background:rgba(255,255,255,.24)`,".mp-attract-count":`font-weight:500;font-size:12px;font-variant-numeric:tabular-nums;color:rgba(255,255,255,.75)`,".mp-attract-btn":`position:relative;width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);display:flex;align-items:center;justify-content:center;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);color:var(--mp-fg-strong);cursor:pointer;pointer-events:auto;transition:background-color 150ms ease,color 150ms ease`,".mp-attract-btn:hover":`background:var(--mp-surface-hover)`,".mp-attract-btn:focus-visible":`outline:2px solid var(--mp-accent, #1476ff);outline-offset:2px`,"&.mp-attract-pill-on":`--mp-hint-vis:hidden`});let _=document.createElement(`div`);_.style.pointerEvents=`none`,e.ui.mount(_),_.className=`mp-attract-pill`,_.setAttribute(`aria-hidden`,`true`),_.innerHTML=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"></path><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"></path><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"></path><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"></path></svg><span class="mp-attract-text"></span><span class="mp-attract-sep"></span><span class="mp-attract-count"></span>`;let v=_.querySelector(`.mp-attract-text`),y=_.querySelector(`.mp-attract-count`),b=0,x=t=>{clearTimeout(b),i.classList.toggle(`mp-attract-pill-on`,t),t?(v.textContent=e.ui.t(`touch_to_explore`),y.textContent=e.ui.t(`tour_stop`,{n:d,total:u}),_.style.display!==`flex`&&(_.style.display=`flex`,requestAnimationFrame(()=>_.classList.add(`mp-on`)))):_.style.display===`flex`&&(_.classList.remove(`mp-on`),b=setTimeout(()=>{_.style.display=`none`},220))},S=document.createElement(`button`);S.type=`button`,S.className=`mp-control mp-btn mp-attract-btn mp-edge-t mp-edge-b`,S.style.order=`5`,S.style.display=`none`,S.style.border=`0`,S.style.padding=`0`,S.innerHTML=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="6 3 20 12 6 21 6 3"></polygon></svg>`,e.ui.zone(`bottom-left`).append(S);let C=null,w=()=>{let n=t.setting(`button`)===!0&&!o&&!m&&!e.getState().editing,r=n+`:`+e.ui.t(`start_tour`);if(i.toggleAttribute(`data-mp-tour`,o||m),S.classList.toggle(`mp-hit`,!!e.ui.env().touch),r===C)return;C=r,S.style.display=n?`flex`:`none`;let a=e.ui.t(`start_tour`);S.title=a,S.setAttribute(`aria-label`,a)},T=e=>{e.classList.add(`mp-attract-out`),e.style.opacity=`0`,setTimeout(()=>e.remove(),220)},E=e=>i.querySelectorAll(`.mp-attract-bar:not(.mp-attract-out), .mp-attract-tip:not(.mp-attract-out)`).forEach(t=>e?T(t):t.remove()),D=t=>{let n=s-f,r=n>0?Math.min(1,Math.max(0,(t-f)/n)):0;if(e.ui.env().reducedMotion){let e=Math.max(1,Math.round(n/1e3));r=Math.ceil(r*e)/e}return r},O=e=>{let t=i.querySelector(`.mp-popup`);if(!t)return;let n=t.querySelector(`:scope > .mp-attract-bar:not(.mp-attract-out)`);n||(n=document.createElement(`div`),n.className=`mp-attract-bar`,n.appendChild(document.createElement(`div`)),t.appendChild(n)),n.firstChild.style.transform=`scaleX(`+e.toFixed(4)+`)`;let r=[t.querySelector(`:scope > .mp-popup-arrow`),i.querySelector(`.mp-popup-tail`)].find(e=>e&&e.offsetWidth&&getComputedStyle(e).visibility!==`hidden`);if(!r)return;let a=r.querySelector(`:scope > .mp-attract-tip:not(.mp-attract-out)`);a||(a=document.createElement(`div`),a.className=`mp-attract-tip`,r.appendChild(a));let o=t.getBoundingClientRect(),s=a.getBoundingClientRect(),c=Math.min(100,Math.max(0,(o.left+e*o.width-s.left)/s.width*100));a.style.background=`linear-gradient(45deg,var(--mp-accent, #1476ff) `+c+`%,transparent `+c+`%)`},k=()=>{E(!0),x(!1)},A=0,j=()=>{A=0,o&&(g()!==`off`&&!m&&O(D(performance.now())),A=requestAnimationFrame(j))},M=()=>{A||=requestAnimationFrame(j)},N=t=>{if(t&&S.contains(t.composedPath?t.composedPath()[0]:t.target)||t&&t.type===`keydown`&&r.includes(t.key)||t&&t.type===`wheel`&&e.view.wheelPasses&&e.view.wheelPasses(t))return;a=performance.now();let n=o||m;o&&k(),m&&(m=!1,e.view.setLevel(e.getState().level)),n&&e.view.camera({resetTilt:!0}),o=!1,w()},P=()=>{o=!0,l=[],p=0,z()||R(),w()};S.addEventListener(`click`,()=>{!o&&!m&&!e.getState().editing&&P()});let F=n=>{let r=h(`arc`)?2600:2200,i=e.getState(),a=e.data.find({id:n}),o=a&&a.level!=null&&!i.allLevels&&a.level!==i.level;return t.setting(`explode`)===!0&&o&&e.view.canExplode()?Math.max(r,3e3):r},I=()=>{l=e.data.stores().filter(e=>e.name).map(e=>e.id);for(let e=l.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[l[e],l[t]]=[l[t],l[e]]}l[l.length-1]===e.getState().selected&&l.unshift(l.pop()),u=l.length},ee=()=>{let n=Math.round(+t.setting(`overview`)||0);return n>0&&p>=n&&!m&&e.view.canExplode()},L=()=>{p=0,m=!0,E(!0),x(!1),e.view.setLevel(`all`),e.view.drift(180*c,10,20),c=-c,s=performance.now()+1e4},R=()=>{if(!e.data.stores().filter(e=>e.name).length)return;if(ee())return L();m=!1,p++,l.length||I();let n=Math.max(3,+t.setting(`hold`)||8),r=l.pop(),i=performance.now(),a=F(r);d=u-l.length;try{e.view.select({id:r},{face:!0,duration:h(`arc`)?2600:2200,arc:h(`arc`),explode:t.setting(`explode`)===!0}),h(`drift`)&&(e.view.drift(15*c,n,15),c=-c)}catch{}s=i+a+n*1e3,f=i+a,E(!1),x(g()===`pill`),M()},z=()=>{let n=e.getState().selected,r=i.querySelector(`.mp-popup`);if(!n||!r||+r.style.opacity<.5||!e.data.stores().some(e=>e.id===n&&e.name))return!1;I(),l=l.filter(e=>e!==n),d=1,p=1;let a=performance.now();return f=a,s=a+Math.max(3,+t.setting(`hold`)||8)*1e3,E(!1),x(g()===`pill`),M(),!0},te=()=>{let n=performance.now();if(w(),document.hidden)o&&k(),o=!1;else if(e.getState().editing)o&&(e.view.drift(0),k()),o=!1,m=!1,a=n;else if(o)n>=s&&R();else{let r=t.setting(`after`)===0?0:Math.min(180,Math.max(3,+t.setting(`after`)||3));r&&n-a>=r*1e3&&!e.getState().wayfindingOpen&&P()}},B=e.on(`camera`,e=>{e.mode}),V=e.on(`plugin`,()=>{w(),o&&(g()===`off`&&E(!0),x(g()===`pill`&&!m))}),H=e.on(`language`,()=>{w(),o&&g()===`pill`&&!m&&x(!0)}),ne=t.setting(`page`)===!0?window:e.ui.container;n.forEach(e=>ne.addEventListener(e,N,{capture:!0,passive:!0}));let re=setInterval(te,250);return w(),()=>{clearInterval(re),clearTimeout(b),cancelAnimationFrame(A),o&&e.view.drift(0),n.forEach(e=>ne.removeEventListener(e,N,{capture:!0})),[B,V,H].forEach(e=>e&&e()),E(!1),i.classList.remove(`mp-attract-pill-on`),i.removeAttribute(`data-mp-tour`),_.remove(),S.remove()}}),MapplicMap.plugin(`intro`,e=>{let t=e.plugin(`intro`),n=(e,n,r,i)=>{let a=+t.setting(e);return Number.isFinite(a)?Math.min(i,Math.max(r,a)):n},r=()=>e.view.approach({seconds:n(`seconds`,1.6,.5,5),height:n(`height`,5,2,12),turn:n(`turn`,30,0,180)}),i=null;e.getState().ready?r():i=e.on(`ready`,()=>{i(),i=null,r()});let a=e.on(`plugin`,t=>{t&&t.id===`intro`&&t.enabled&&e.ui.env().editor&&e.getState().ready&&r()});return()=>{i&&i(),a(),e.view.approaching()&&e.view.approach(!1)}}),MapplicMap.plugin(`drift`,e=>{let t=e.plugin(`drift`),n=[`pointerdown`,`wheel`,`keydown`,`touchstart`],r=[`Tab`,`Shift`],i=e.ui.container,a=1,o=!0,s=!1,c=0,l=(e,n,r,i)=>{let a=+t.setting(e);return Number.isFinite(a)?Math.min(i,Math.max(r,a)):n},u=()=>{c=performance.now(),!s&&(s=!0,e.view.drifting()&&e.view.drift(0))},d=t=>{t.type===`keydown`&&r.includes(t.key)||t.type===`wheel`&&e.view.wheelPasses&&e.view.wheelPasses(t)||u()},f=()=>{let t=l(`angle`,30,0,180),n=l(`seconds`,20,4,120),r=l(`tilt`,6,0,30),i=o?.5:1;e.view.drift(t*i*a,n*i,r*i*a)&&(o=!1,a=-a)},p=()=>{if(document.hidden||!e.getState().ready)return;let t=e.getState(),n=performance.now();if(!(t.editing||i.hasAttribute(`data-mp-tour`))){if(t.selected||t.routeShown||t.wayfindingOpen)return u();if(s){let e=l(`resume`,0,0,600);if(!e||n-c<e*1e3)return;s=!1,o=!0}e.ui.env().reducedMotion||e.view.drifting()||f()}};n.forEach(e=>i.addEventListener(e,d,{capture:!0,passive:!0}));let m=setInterval(p,250);return p(),()=>{clearInterval(m),n.forEach(e=>i.removeEventListener(e,d,{capture:!0})),!s&&!i.hasAttribute(`data-mp-tour`)&&e.view.drifting()&&e.view.drift(0)}}),MapplicMap.plugin(`controls`,e=>{let t=e.plugin(`controls`),n=document,r=e.ui.container,i=(e,t=2)=>MapplicMap.svgIcon(e,16,t),a={plus:i(`<path d="M5 12h14"></path><path d="M12 5v14"></path>`),minus:i(`<path d="M5 12h14"></path>`),reset:i(`<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path><path d="M3 3v5h5"></path>`),fsIn:i(`<path d="M8 3H5a2 2 0 0 0-2 2v3"></path><path d="M21 8V5a2 2 0 0 0-2-2h-3"></path><path d="M3 16v3a2 2 0 0 0 2 2h3"></path><path d="M16 21h3a2 2 0 0 0 2-2v-3"></path>`),fsOut:i(`<path d="M8 3v3a2 2 0 0 1-2 2H3"></path><path d="M21 8h-3a2 2 0 0 1-2-2V3"></path><path d="M3 16h3a2 2 0 0 1 2 2v3"></path><path d="M16 21v-3a2 2 0 0 1 2-2h3"></path>`),layers:i(`<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"></path><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"></path><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"></path>`),needle:`<svg width="24" height="24" viewBox="0 0 24 24"><path d="M12 2.5 15.5 12h-7Z" style="fill:var(--mp-fg-strong)"></path><path d="M12 21.5 8.5 12h7Z" style="fill:var(--mp-border-strong)"></path></svg>`},o=(e,t,r,i)=>{let a=n.createElement(`div`);return e&&(a.className=e),i&&(a.style.cssText=i),t&&(a.innerHTML=t),r&&(a.title=r),a};e.ui.style({".mp-control":`position:absolute;display:flex;flex-direction:column;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);overflow:hidden;color:var(--mp-fg-strong);pointer-events:auto`,".mp-btn":`display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--mp-surface);transition:background-color 150ms ease,color 150ms ease,opacity 180ms ease,transform 180ms ease`,".mp-btn:hover":`background:var(--mp-surface-hover)`,".mp-zoom, .mp-levels, .mp-dim, .mp-reset, .mp-compass, .mp-fullscreen":`overflow:visible`,".mp-zoom > .mp-btn, .mp-levels > .mp-btn, .mp-dim > .mp-btn":`position:relative`,".mp-control > .mp-btn.mp-edge-t":`border-top-left-radius:inherit;border-top-right-radius:inherit`,".mp-control > .mp-btn.mp-edge-b":`border-bottom-left-radius:inherit;border-bottom-right-radius:inherit`,".mp-btn.mp-hit::after":`content:'';position:absolute;left:-6px;right:-6px;top:0;bottom:0`,".mp-btn.mp-hit.mp-edge-t::after":`top:-4px`,".mp-btn.mp-hit.mp-edge-b::after":`bottom:-4px`,".mp-zoom, .mp-levels":`width:var(--mp-cs, 40px);transition:left 200ms ease,right 200ms ease,top 200ms ease,bottom 200ms ease`,".mp-zoom .mp-btn, .mp-levels .mp-btn":`height:var(--mp-cs, 40px)`,".mp-zoom-out, .mp-level + .mp-level":`border-top:1px solid var(--mp-border-subtle)`,".mp-reset, .mp-compass, .mp-fullscreen":`width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);transition:background-color 150ms ease,color 150ms ease,opacity 180ms ease,transform 180ms ease,left 200ms ease,right 200ms ease,top 200ms ease,bottom 200ms ease`,".mp-compass":`perspective:80px`,".mp-needle":`width:24px;height:24px;display:flex;align-items:center;justify-content:center`,".mp-hint":`position:absolute;bottom:calc(28px + var(--mp-inset-b, 0px));visibility:var(--mp-hint-vis, var(--mp-hint-wf, visible));left:calc(var(--mp-cs, 40px) + 28px + var(--mp-inset-bl, 0px));right:calc(var(--mp-cs, 40px) + 28px + var(--mp-inset-br, 0px));font-size:12px;color:var(--mp-fg-subtle);pointer-events:none;text-align:center;text-wrap:balance`,".mp-levels":`font-size:12px;font-weight:600`,".mp-zone > .mp-control":`position:relative;left:auto;right:auto;top:auto;bottom:auto;pointer-events:auto`,".mp-dim":`width:var(--mp-cs, 40px);transition:left 200ms ease,right 200ms ease,top 200ms ease,bottom 200ms ease;font-size:12px;font-weight:600`,".mp-dim .mp-btn":`height:var(--mp-cs, 40px);color:var(--mp-fg-muted)`,".mp-dim .mp-btn + .mp-btn":`border-top:1px solid var(--mp-border-subtle)`,".mp-dim .mp-btn.mp-active, .mp-dim .mp-btn.mp-active:hover":`background:var(--mp-selected-bg);color:var(--mp-selected-fg)`,".mp-level":`color:var(--mp-fg-muted)`,".mp-ctl-tip":`position:absolute;left:0;top:0;z-index:9;height:28px;padding:0 10px;display:flex;align-items:center;gap:6px;white-space:nowrap;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-card-bg);box-shadow:0 0 0 1px var(--mp-card-ring), var(--mp-card-shadow);font-family:Onest,sans-serif;font-size:13px;font-weight:600;color:var(--mp-card-fg);pointer-events:none;opacity:0;transition:opacity 150ms ease,transform 150ms ease`,".mp-ctl-tip-arrow":`position:absolute;top:50%;width:8px;height:8px;margin-top:-4px;background:var(--mp-card-bg);box-shadow:var(--mp-arrow-ring);transform:rotate(45deg);border-radius:calc(1px * var(--mp-rk, 1))`,".mp-ctl-tip-sub":`font-weight:500;color:var(--mp-card-fg-muted)`,".mp-level.mp-active, .mp-level.mp-active:hover":`background:var(--mp-selected-bg);color:var(--mp-selected-fg)`,'&[data-mp-glass-ctl="1"] .mp-control':`background:var(--mp-ctl-glass);-webkit-backdrop-filter:var(--mp-ctl-blur);backdrop-filter:var(--mp-ctl-blur);box-shadow:0 0 0 1px var(--mp-ctl-ring), var(--mp-shadow-sm)`,'&[data-mp-glass-ctl="1"] .mp-control .mp-btn':`background:transparent`,'&[data-mp-glass-ctl="1"] .mp-control .mp-btn:hover, &[data-mp-glass-ctl="1"] .mp-control.mp-btn:hover':`background:var(--mp-ctl-glass-hover)`,'&[data-mp-glass-ctl="1"] .mp-control .mp-btn.mp-active, &[data-mp-glass-ctl="1"] .mp-control .mp-btn.mp-active:hover':`background:var(--mp-selected-bg)`});let s=(e,t,n,r)=>{let i=o(`mp-control mp-btn `+e,t,n);return i.addEventListener(`click`,r),i},c=e.ui.mount(o(`mp-controls`,``,``,`position:absolute;inset:0;pointer-events:none;font-family:Onest,sans-serif;z-index:8`)),l=e.ui.mount(o(`mp-controls mp-controls-edit`,``,``,`position:absolute;inset:0;pointer-events:none;font-family:Onest,sans-serif;display:none`),{layer:`top`,editing:!0}),u=o(`mp-control mp-zoom`),d=o(`mp-btn mp-zoom-in`,a.plus,e.ui.t(`zoom_in`)),f=o(`mp-btn mp-zoom-out`,a.minus,e.ui.t(`zoom_out`));d.onclick=()=>e.view.camera({zoom:1.4}),f.onclick=()=>e.view.camera({zoom:1/1.4}),u.append(d,f);let p=s(`mp-reset`,a.reset,e.ui.t(`reset_view`),()=>{e.view.camera({reset:!0}),e.view.deselect()}),m=s(`mp-compass`,``,e.ui.t(`reset_rotation`),()=>e.view.camera({resetRotation:!0})),h=o(`mp-needle`,a.needle);m.append(h);let g=o(`mp-control mp-dim`),_=o(`mp-btn mp-dim-3d`,`3D`,e.ui.t(`view_3d`)),v=o(`mp-btn mp-dim-2d`,`2D`,e.ui.t(`view_2d`));_.onclick=()=>e.view.camera({mode:`3d`}),v.onclick=()=>e.view.camera({mode:`2d`}),g.append(_,v);let y=()=>{try{return e.view.camera({}).mode===`2d`}catch{return!1}},b=null,x=e=>{_.classList.toggle(`mp-active`,e!==`2d`),v.classList.toggle(`mp-active`,e===`2d`),e!==b&&(b=e,oe())},S=!1,C=``,w=null,T=()=>{let e=r.parentElement;return e&&[...e.children].some(e=>e.classList.contains(`mp-dock`)&&!e.classList.contains(`mp-dock-below`))?e:r},E=()=>!!(n.fullscreenElement||n.webkitFullscreenElement)||S,D=e=>{S=e,e?(w=T(),C=w.style.cssText,Object.assign(w.style,{position:`fixed`,inset:`0`,height:`auto`,borderRadius:`0`,zIndex:`1000`}),n.body.style.overflow=`hidden`):(w&&(w.style.cssText=C||w.style.cssText),w=null,n.body.style.overflow=``),k()},O=s(`mp-fullscreen`,a.fsIn,e.ui.t(`full_screen`),()=>{if(n.fullscreenElement||n.webkitFullscreenElement)return(n.exitFullscreen||n.webkitExitFullscreen).call(n);if(S)return D(!1);let e=T(),t=e.requestFullscreen||e.webkitRequestFullscreen,r;try{r=t&&t.call(e)}catch{r=null}t?r&&r.catch&&r.catch(()=>D(!0)):D(!0)}),k=()=>{let t=E();O.innerHTML=t?a.fsOut:a.fsIn,O.title=e.ui.t(t?`exit_full_screen`:`full_screen`)},A=e=>{e.key===`Escape`&&S&&D(!1)};n.addEventListener(`fullscreenchange`,k),n.addEventListener(`webkitfullscreenchange`,k),n.addEventListener(`keydown`,A);let j=o(`mp-hint`),M=o(`mp-control mp-levels`),N=o(`mp-btn mp-level mp-level-all`,a.layers,e.ui.t(`all_levels`));N.onclick=()=>{let t=e.getState();e.view.setLevel(t.allLevels?t.level:`all`)};let P=e.data.levels().slice().reverse().map(t=>{let n=o(`mp-btn mp-level`,t.short);return n.setAttribute(`aria-label`,t.name),n.onclick=()=>e.view.setLevel(t.index),n._lv=t.index,n._name=t.name,n.addEventListener(`pointerenter`,()=>{R=n,te()}),n.addEventListener(`pointerleave`,()=>{R===n&&(R=null),te()}),n});M.append(N,...P);let F=o(`mp-ctl-tip`),I=n.createElement(`span`),ee=n.createElement(`span`),L=o(`mp-ctl-tip-arrow`);ee.className=`mp-ctl-tip-sub`,F.append(I,ee,L);let R=null,z=null,te=()=>{let t=e.getState(),n=null,r=``,i=``;if(R)n=R,r=R._name;else if(z&&!t.allLevels){let a=e.data.stores().find(e=>e.id===z)||e.data.feature(z);a&&typeof a.level==`number`&&a.level!==t.level&&(n=P.find(e=>e._lv===a.level)||null,r=a.name||``,i=n?n._name:``)}if(!n||!r||M.style.display===`none`){F.style.opacity=`0`;return}I.textContent=r,ee.textContent=i,ee.style.display=i?``:`none`;let a=c.getBoundingClientRect(),o=n.getBoundingClientRect(),s=M.getBoundingClientRect(),l=s.left+s.width/2<a.left+a.width/2,u=o.top-a.top+o.height/2;L.style.left=l?`-4px`:``,L.style.right=l?``:`-4px`,L.style.setProperty(`--mp-arrow-ring`,(l?`-1px 1px`:`1px -1px`)+` 0 0 var(--mp-card-ring)`);let d=l?s.right-a.left+10:s.left-a.left-10;F.style.transform=`translate(`+(l?`0`:`-100%`)+`, -50%) translate(`+d+`px,`+u+`px)`,F.style.opacity=`1`};e.on(`hover`,e=>{z=e||null,te()}),e.onFrame(()=>{(R||z)&&te()});let B=()=>{let t=e.getState(),n=(e,t)=>e.classList.toggle(`mp-active`,t);n(N,t.allLevels),P.forEach(e=>n(e,!t.allLevels&&t.level===e._lv))};c.append(u,p,j,M,F);let V=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],H=e.ui.zone(`bottom-left`),ne=[{key:`levels`,el:M,def:`top-right`,top:10,bottom:60,zone:null},{key:`fullscreen`,el:O,def:`bottom-left`,top:20,bottom:50,zone:10},{key:`dimension`,el:g,def:`bottom-left`,top:30,bottom:40,zone:20},{key:`compass`,el:m,def:`bottom-left`,top:40,bottom:30,zone:30},{key:`reset`,el:p,def:`bottom-right`,top:50,bottom:20,zone:5},{key:`zoom`,el:u,def:`bottom-right`,top:60,bottom:10,zone:40}],re=e=>{let n=t.setting(e.key+`_position`);return V.includes(n)?n:e.def},ie=t=>{ne.forEach(n=>{let r=n.at=re(n),i=n.el;if(r===`bottom-left`&&n.zone!=null){n.spot&&n.spot.remove(),n.spot=null,i.style.order=String(n.zone),i.parentNode!==H&&H.append(i);return}let a=i===M&&t?l:c;i.parentNode!==a&&a.append(i),i===M&&F.parentNode!==a&&a.append(F),i.style.order=``;let o={anchor:r,order:r.startsWith(`top`)?n.top:n.bottom};n.spot?n.spot.update(o):n.spot=e.ui.slot(i,o)})},ae=e.ui.slot(null,{anchor:`bottom-left`}),oe=()=>{let n=e.ui.env(),i=e=>t.enabled()&&!!t.setting(e);r.style.setProperty(`--mp-cs`,`32px`);let a=y(),o=!!e.getState().editing;ie(o),l.style.display=o?`block`:`none`,N.style.display=o||b===`2d`||!e.view.canExplode()?`none`:``,j.textContent=e.ui.t((n.touch?`hint_touch`:n.wheel===`off`?`hint_mouse_off`:n.ctrlZoom?`hint_mouse_ctrl`:`hint_mouse`)+(a?`_2d`:``));let s={zoom:i(`zoom`),reset:i(`reset`),compass:i(`compass`)&&!a,dim:t.enabled()&&t.setting(`dimension`)!==!1,full:i(`fullscreen`),hint:i(`hint`)&&!n.narrow,levels:(o?t.enabled():i(`levels`))&&P.length>1};u.style.display=s.zoom?`flex`:`none`,p.style.display=s.reset?`flex`:`none`,m.style.display=s.compass?`flex`:`none`,g.style.display=s.dim?`flex`:`none`,O.style.display=s.full?`flex`:`none`,M.style.display=s.levels?`flex`:`none`;let c=H.offsetHeight;ae.update({width:c?H.offsetWidth:0,height:c}),ne.some(e=>e.at===`bottom-center`&&e.el.style.display!==`none`)&&(s.hint=!1),j.style.display=s.hint?`block`:`none`,[u,M,g].forEach(se),[p,m,O].forEach(e=>e.classList.add(`mp-edge-t`,`mp-edge-b`)),[d,f,p,m,_,v,O,N,...P].forEach(e=>e.classList.toggle(`mp-hit`,!!n.touch)),U()},se=e=>{let t=Array.from(e.children).filter(e=>e.style.display!==`none`);Array.from(e.children).forEach(e=>{e.classList.toggle(`mp-edge-t`,e===t[0]),e.classList.toggle(`mp-edge-b`,e===t[t.length-1])})},U=()=>{let e=r.clientHeight;if(!e)return;let t=e=>e.el.style.display!==`none`&&e.el.offsetParent!==null,n=e;[`left`,`center`,`right`].forEach(r=>{let i=ne.filter(e=>e.at&&e.at.endsWith(r)&&t(e)),a=16,o=r===`left`?H.offsetHeight:0;i.forEach(e=>{e.at.startsWith(`top`)?a=Math.max(a,e.el.offsetTop+e.el.offsetHeight):e.spot&&(o+=(o?8:0)+e.el.offsetHeight)}),o&&(n=Math.min(n,e-a-8-16-o))}),r.style.setProperty(`--mp-room-b`,Math.max(0,Math.floor(n))+`px`)},ce=0,le=window.ResizeObserver?new ResizeObserver(()=>{cancelAnimationFrame(ce),ce=requestAnimationFrame(U)}):null;le&&[r,...ne.map(e=>e.el)].forEach(e=>le.observe(e));let ue=window.ResizeObserver?new ResizeObserver(()=>requestAnimationFrame(oe)):null;ue&&ue.observe(H);let de=t=>{let n=e.ui.env().reducedMotion;x(t.mode);let r=e.data.north?e.data.north():0;h.style.transform=`rotateX(`+(t.tilt*.6).toFixed(1)+`deg) rotate(`+(-t.rotation-r).toFixed(1)+`deg)`,p.style.opacity=t.home?`0`:`1`,p.style.pointerEvents=t.home?`none`:`auto`,p.style.transform=t.home&&!n?`translateY(4px)`:`none`};return p.style.opacity=`0`,p.style.pointerEvents=`none`,oe(),B(),k(),x(y()?`2d`:`3d`),e.on(`plugin`,oe),e.on(`layout`,oe),e.on(`level`,()=>{B(),te()}),e.on(`camera`,de),()=>{le&&le.disconnect(),ue&&ue.disconnect(),ne.forEach(e=>e.el.remove()),cancelAnimationFrame(ce),r.style.removeProperty(`--mp-room-b`),n.removeEventListener(`fullscreenchange`,k),n.removeEventListener(`webkitfullscreenchange`,k),n.removeEventListener(`keydown`,A),S&&D(!1)}}),MapplicMap.SEARCH={prompt(e,t){let n=e=>String(e??``).replace(/[|\n\r]+/g,` `).trim(),r=t.places.map(e=>[e.id,n(e.name),e.categories.join(`,`),e.level,(e.keywords||[]).map(n).join(`,`),n(MapplicMap.plainText(e.description)),Object.entries(e.details||{}).map(([e,t])=>e+`=`+n(t)).join(`, `)].join(`|`));return{system:`You turn a visitor question about a venue into a search query for its map. Reply with one JSON object and nothing else. Keys, all optional: "ids" (place ids from the list that answer the question), "category" (category ids), "level" (level indexes), "open" (true when they want places open now), "amenity" (amenity keys), "route" ({ "from": place id or null, "to": place id } when they ask how to get somewhere), "text" (words to search for), "note" (one short sentence, at most 12 words, shown to the visitor, saying what you found). Prefer "ids" when specific places clearly fit, judging by name, category, keywords, description and details. Details are key=value facts; compare numbers when the question asks (over, under, at least, between, cheapest, largest) and list every place that fits. Only use ids, categories, levels and amenities from the context. If nothing fits, reply {}.`,user:`Categories (id|name): `+t.categories.map(e=>e.id+`|`+e.name).join(`; `)+`
4190
+ @media (prefers-reduced-motion: reduce) { .mp-map .mp-hours-dot { animation: none !important } }`;return{parse:f,status:P,table:ee,special:L,badge:ie,widget:ae,tick:ne,formatTime:S,dayName:T,css:oe,keyframes:se,icons:te,inject:()=>{MapplicMap.injectCss(`hours`,oe),MapplicMap.injectCss(`hours-keyframes`,se)}}})(),MapplicMap.plugin(`hours`,e=>{let t=MapplicMap.HOURS,n=e.plugin(`hours`);e.ui.style(t.css),MapplicMap.injectCss(`hours-keyframes`,t.keyframes);let r=null,i=0,a=null,o=null,s=()=>a||=e.data.holidays(),c=()=>{let t=n.setting(`soon`);return{now:r||void 0,holidays:s(),timezone:n.setting(`timezone`)||``,soon:t==null?60:+t,hour12:!!n.setting(`hour12`),lang:e.ui.language()||void 0,t:e.ui.t,reducedMotion:!!e.ui.env().reducedMotion}},l=n=>{if(n&&typeof n==`object`)return`hours`in n?n.hours:n;if(t.parse(n))return n;try{let t=e.data.find(n);return t?t.hours:typeof n==`string`?n:null}catch{return typeof n==`string`?n:null}},u=(e,t)=>Object.assign(c(),t,e?{now:e}:null),d=n=>{let r=u(n);return e.data.stores().concat(e.data.amenities()).filter(e=>e.hours).map(e=>Object.assign({id:e.id,name:e.name},t.status(e.hours,r)))},f=()=>{let t=d(),n={},r=[];t.forEach(e=>{n[e.id]=e.state;let t=o&&o[e.id];t&&t!==e.state&&r.push({id:e.id,name:e.name,from:t,to:e.state,status:e})}),o=n,r.length&&e.announce(`hours`,{changes:r})},p=()=>{t.tick(),f()};e.provide({parse:e=>t.parse(e),status:(e,n)=>t.status(l(e),u(n)),table:(e,n)=>t.table(l(e),u(n)),special:(e,n)=>t.special(l(e),u(n)),statuses:e=>d(e),holidays:()=>s().map(e=>Object.assign({},e)),badge:(e,n)=>t.badge(l(e),()=>u(null,n)),widget:(e,n)=>t.widget(l(e),()=>u(null,n)),setTime:e=>{r=e||null,p()},options:c}),f(),e.onFrame(()=>{let e=Date.now();e-i<15e3||(i=e,p())}),e.on(`plugin`,()=>{a=null,p()}),e.on(`units`,()=>{a=null,p()}),e.on(`language`,()=>{a=null,t.tick()})}),MapplicMap.POPUP=(()=>{let e=document,t=[`gallery`,`header`,`description`,`hours`,`details`,`action`,`directions`],n=(t,n,r,i)=>{let a=e.createElement(t);return n&&(a.className=n),i&&(a.style.cssText=i),r!=null&&(a.innerHTML=r),a},r=MapplicMap.svgIcon,i=Object.fromEntries(Object.entries({up:`<path d="m5 12 7-7 7 7"></path><path d="M12 19V5"></path>`,dn:`<path d="M12 5v14"></path><path d="m19 12-7 7-7-7"></path>`,x:`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`,prev:`<path d="m15 18-6-6 6-6"></path>`,next:`<path d="m9 18 6-6-6-6"></path>`,phone:`<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path>`,mail:`<rect width="20" height="16" x="2" y="4" rx="2"></rect><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path>`,globe:`<circle cx="12" cy="12" r="10"></circle><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"></path><path d="M2 12h20"></path>`,clock:`<circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path>`,calendar:`<rect width="18" height="18" x="3" y="4" rx="2"></rect><path d="M16 2v4"></path><path d="M8 2v4"></path><path d="M3 10h18"></path>`,info:`<circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path>`,tag:`<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>`,layers:`<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"></path><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"></path><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"></path>`,star:`<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"></path>`,wifi:`<path d="M12 20h.01"></path><path d="M2 8.82a15 15 0 0 1 20 0"></path><path d="M5 12.86a10 10 0 0 1 14 0"></path><path d="M8.5 16.43a5 5 0 0 1 7 0"></path>`,start:`<circle cx="12" cy="12" r="8"></circle><circle cx="12" cy="12" r="3"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="M2 12h2"></path><path d="M20 12h2"></path>`}).map(([e,t])=>[e,r(t)])),a={".mp-popup":`position:absolute;left:0;top:0;box-sizing:border-box;width:var(--mp-pw,208px);border-radius:calc(16px * var(--mp-rk, 1));background:var(--mp-card-bg);color:var(--mp-card-fg);box-shadow:0 0 0 1px var(--mp-card-ring), var(--mp-card-shadow);transform-origin:50% calc(100% + 12px);will-change:opacity,transform;cursor:default;user-select:text;font-family:Onest,sans-serif;text-align:start`,".mp-popup-place:not(.mp-popup-sheet):not(.mp-media-side)":`width:max-content;min-width:var(--mp-pw,208px);max-width:max(var(--mp-pw,208px), 320px)`,".mp-popup-place:not(.mp-popup-sheet):not(.mp-media-side) .mp-sec:not(.mp-popup-head)":`contain:inline-size`,'&[data-mp-scheme="dark"] .mp-popup, .mp-popup[data-mp-scheme="dark"]':`--mp-card-shadow:0 24px 64px rgba(0,0,0,0.6), 0 8px 24px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3)`,'&[data-mp-scheme="dark"][data-mp-glass="1"], .mp-popup[data-mp-scheme="dark"][data-mp-glass="1"]':`--mp-glass-bg:#09090b;--mp-card-ring:rgba(255,255,255,0.07)`,'&[data-mp-glass="1"] .mp-popup, .mp-popup[data-mp-glass="1"]':`background:color-mix(in srgb, var(--mp-glass-bg, var(--mp-card-bg)) var(--mp-glass-tint, 62%), transparent);-webkit-backdrop-filter:blur(16px) saturate(1.15);backdrop-filter:blur(16px) saturate(1.15)`,'.mp-popup[data-mp-glass="1"] .mp-popup-arrow':`background:color-mix(in srgb, var(--mp-card-bg) 90%, transparent);clip-path:polygon(calc(100% + 1px) -2.5px,calc(100% + 1px) calc(100% + 1px),-2.5px calc(100% + 1px))`,'&[data-mp-glass="1"] .mp-popup-arrow':`display:none`,".mp-popup-tail":`position:absolute;left:4px;top:-4.5px;width:12px;height:12px;border-radius:calc(2px * var(--mp-rk, 1));transform-origin:6px 20px;transform:translateY(-14px) rotate(45deg) translateY(14px);will-change:opacity,transform;pointer-events:none;background:color-mix(in srgb, var(--mp-glass-bg, var(--mp-card-bg)) var(--mp-glass-tail, 44%), transparent);-webkit-backdrop-filter:blur(4px) saturate(1.15);backdrop-filter:blur(4px) saturate(1.15);box-shadow:1px 1px 0 0 var(--mp-card-ring)`,".mp-popup-tail-box":`display:none;position:absolute;left:-10px;top:-15.5px;width:20px;height:12px;overflow:hidden;pointer-events:none`,'&[data-mp-glass="1"] .mp-popup-tail-box':`display:block`,'&[data-mp-glass="1"] .mp-popup-scroll.mp-pinning > .mp-pin-top, &[data-mp-glass="1"] .mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom, .mp-popup[data-mp-glass="1"] .mp-popup-scroll.mp-pinning > .mp-pin-top, .mp-popup[data-mp-glass="1"] .mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom':`background:transparent`,'&[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-top::after, &[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-bottom::before, .mp-popup[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-top::after, .mp-popup[data-mp-glass="1"] .mp-popup-scroll > .mp-pin-bottom::before':`display:none`,".mp-popup-elevator":`width:max-content`,".mp-popup-bus_stop":`width:240px`,".mp-popup-arrow":`position:absolute;left:50%;bottom:-6px;width:12px;height:12px;margin-left:-6px;background:var(--mp-card-bg);box-shadow:1px 1px 0 0 var(--mp-card-ring);transform:rotate(45deg);border-radius:calc(2px * var(--mp-rk, 1))`,".mp-popup-head":`display:flex;align-items:flex-start;justify-content:space-between;gap:8px`,".mp-popup-bus_stop .mp-popup-head":`align-items:center`,".mp-popup-elevator .mp-popup-head":`align-items:center;padding:4px 8px 6px`,".mp-popup-close":`flex:none;width:24px;height:24px;margin:-4px -6px 0 0;padding:0;border:0;background:transparent;font:inherit;display:flex;align-items:center;justify-content:center;border-radius:calc(6px * var(--mp-rk, 1));color:var(--mp-card-fg-muted);cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,".mp-popup-elevator .mp-popup-close":`margin:-2px -4px 0 0`,".mp-popup-close:focus-visible, .mp-popup-x:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:1px`,".mp-popup:focus":`outline:none`,".mp-popup:focus-visible":`box-shadow:0 0 0 2px var(--mp-accent), var(--mp-card-shadow, 0 4px 12px rgba(0,0,0,0.2))`,".mp-popup-close:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup-who":`min-width:0;display:flex;align-items:center;gap:10px`,".mp-popup-logo":`flex:none;width:40px;height:40px;box-sizing:border-box;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-card-bg-hover);display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background-color 150ms ease`,".mp-popup-logo img":`width:100%;height:100%;object-fit:cover;display:block;opacity:0;transition:opacity 150ms ease`,".mp-popup-logo.mp-loaded":`background:#fff`,".mp-popup-logo.mp-loaded.mp-logo-mono":`background:var(--mp-logo-bg)`,".mp-popup-logo.mp-logo-mono img":`filter:var(--mp-logo-filter)`,".mp-popup-logo.mp-loaded img":`opacity:1`,".mp-popup-names":`min-width:0;display:flex;flex-direction:column`,".mp-popup-title":`min-width:0;font-size:14px;font-weight:700;letter-spacing:-0.01em;color:var(--mp-card-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-popup-sub":`margin-top:1px;font-size:12px;color:var(--mp-card-fg-muted);overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical`,".mp-popup-label":`font-size:11px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-card-fg-muted)`,".mp-popup-hours":`min-width:0`,".mp-sec + .mp-popup-hours, .mp-popup-hours + .mp-sec":`margin-top:8px`,".mp-popup-hours.mp-sec + .mp-popup-details.mp-sec":`margin-top:0`,".mp-popup-scroll > .mp-popup-hours:last-child":`margin-bottom:-4px`,".mp-popup-hours-plain":`min-height:28px;display:flex;align-items:center;gap:8px;font-size:12px;color:var(--mp-card-fg-secondary)`,".mp-popup-hours-plain svg":`flex:none;color:var(--mp-card-fg-muted)`,".mp-popup-foot":`display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px`,".mp-popup-btn":`flex:0 1 auto;min-width:0;height:28px;padding:0 12px;box-sizing:border-box;border:0;border-radius:calc(7px * var(--mp-rk, 1));font-family:Onest,sans-serif;font-size:13px;font-weight:600;line-height:28px;text-align:center;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;transition:background-color 150ms ease,box-shadow 150ms ease`,".mp-popup-foot.mp-pair .mp-popup-btn":`flex:1 1 auto;padding:0 8px`,".mp-popup-foot .mp-popup-btn.mp-popup-icon":`flex:none;width:28px;padding:0;display:flex;align-items:center;justify-content:center`,".mp-popup-go":`background:var(--mp-accent);color:var(--mp-fg-on-accent)`,".mp-popup-go:hover":`background:var(--mp-accent-hover)`,".mp-popup-alt":`background:transparent;box-shadow:inset 0 0 0 1px var(--mp-card-border-hover);color:var(--mp-card-fg)`,".mp-popup-alt:hover":`box-shadow:inset 0 0 0 1px var(--mp-card-fg-muted)`,".mp-popup-floors":`min-width:160px;display:flex;flex-direction:column;gap:4px`,".mp-popup-floor":`height:36px;padding:0 8px 0 10px;display:flex;align-items:center;justify-content:space-between;gap:8px;border:0;border-radius:calc(7px * var(--mp-rk, 1));background:var(--mp-card-bg-hover);font-family:Onest,sans-serif;font-size:13px;font-weight:600;color:var(--mp-card-fg);cursor:pointer;transition:background-color 150ms ease`,".mp-popup-floor:hover":`background:var(--mp-card-bg-active)`,".mp-popup-floor-name":`display:flex;align-items:center;gap:8px;white-space:nowrap`,".mp-popup-meta":`display:flex;align-items:center;gap:6px;min-width:0;margin-top:4px;font-size:12px;color:var(--mp-card-fg-muted)`,".mp-popup-meta-text":`min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap`,".mp-popup-cats":`display:flex;flex-wrap:nowrap;align-items:center;gap:4px;margin-top:4px;min-width:0`,".mp-popup-meta-wrap":`flex-wrap:nowrap;gap:4px`,".mp-popup-meta-wrap > .mp-popup-tag":`flex:none`,".mp-popup-meta-wrap > .mp-popup-cats":`flex:0 1 auto;flex-wrap:nowrap;margin-top:0;margin-inline-start:4px;align-items:center`,".mp-popup-discs":`flex:none;display:inline-flex;align-items:center;gap:2px`,".mp-popup-discs + .mp-popup-cat":`flex:0 1 auto;min-width:0;margin-inline-start:2px`,".mp-popup-cat":`min-width:0;max-width:100%;height:20px;padding:0;display:inline-flex;align-items:center;gap:5px;border:0;background:transparent;font-family:Onest,sans-serif;font-size:12px;font-weight:500;line-height:1;color:var(--mp-card-fg-secondary)`,".mp-popup-cat-disc":`flex:none;width:20px;height:20px;padding:0;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:50%;font-family:Onest,sans-serif;font-size:10px;font-weight:700;line-height:1;background:var(--mp-cc, var(--mp-card-cat, #27272a));color:#fff`,".mp-popup-cat-disc svg, .mp-popup-cat-disc img":`display:block;width:12px;height:12px;object-fit:contain`,".mp-popup-cat-name":`min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap`,".mp-popup-cat-btn":`cursor:pointer;border-radius:999px;transition:color 150ms ease`,".mp-popup-cat-btn:hover":`color:var(--mp-card-fg)`,".mp-popup-cat-btn:focus-visible, .mp-popup-cat-dot:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:1px`,".mp-popup-catw":`position:relative;flex:none;display:inline-flex`,".mp-popup-cat-dot":`cursor:pointer;transition:filter 150ms ease`,".mp-popup-cat-dot:hover":`filter:brightness(0.9)`,".mp-popup-cat-tip":`position:absolute;left:50%;top:calc(100% + 4px);z-index:2;transform:translate(calc(-50% + var(--mp-tx, 0px)),-2px);padding:4px 8px;border:0;border-radius:calc(6px * var(--mp-rk, 1));white-space:nowrap;font-family:Onest,sans-serif;font-size:11px;font-weight:600;line-height:1.2;background:var(--mp-ct, var(--mp-card-fg));color:var(--mp-ct-ink, var(--mp-card-bg));opacity:0;pointer-events:none;transition:opacity 150ms ease,transform 150ms ease`,'.mp-popup-catw[style*="--mp-ct"]':`--mp-ct-ink:#fff`,".mp-popup-cat-tip::before":`content:'';position:absolute;left:calc(50% - var(--mp-tx, 0px));top:-3px;width:6px;height:6px;margin-left:-3px;transform:rotate(45deg);background:inherit;border-radius:calc(1px * var(--mp-rk, 1))`,"button.mp-popup-cat-tip":`cursor:pointer`,".mp-popup > .mp-popup-cat-tip":`z-index:3`,".mp-popup-cat-tip.mp-show":`opacity:1;transform:translate(calc(-50% + var(--mp-tx, 0px)),0);pointer-events:auto`,".mp-popup-meta .mp-popup-tag":`min-width:0;height:18px;padding:0 6px;display:inline-flex;align-items:center;line-height:1;background:transparent;box-shadow:inset 0 0 0 1px var(--mp-card-border);color:var(--mp-card-fg-muted)`,".mp-popup-meta .mp-popup-tag-btn:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup-tag-btn":`border:0;cursor:pointer;font-family:Onest,sans-serif;transition:background 150ms ease`,".mp-popup-tag-btn:hover":`background:var(--mp-card-bg-strong)`,".mp-popup-tag":`flex:none;min-width:28px;box-sizing:border-box;text-align:center;font-size:11px;font-weight:600;padding:2px 6px;border-radius:calc(4px * var(--mp-rk, 1));background:var(--mp-card-bg-active);color:var(--mp-card-fg-secondary)`,".mp-popup-desc":`margin-top:2px;font-size:12px;line-height:1.5;color:var(--mp-card-fg-muted);white-space:pre-line;overflow-wrap:anywhere`,".mp-popup-departures":`margin-top:10px;padding-top:4px;border-top:1px solid var(--mp-card-border);display:flex;flex-direction:column`,".mp-popup-departure":`height:28px;display:flex;align-items:center;gap:10px;font-size:12px`,".mp-popup-dest":`flex:1;min-width:0;color:var(--mp-card-fg);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis`,".mp-popup-mins":`flex:none;font-family:'Roboto Mono',monospace;font-size:12px;color:var(--mp-card-fg-muted)`,".mp-popup-mins.mp-soon":`color:var(--mp-card-success)`,".mp-popup-scroll":`clip-path:inset(0 round calc(16px * var(--mp-rk, 1)));box-sizing:border-box;padding:12px;max-height:inherit;overflow-x:hidden;overflow-y:auto;overscroll-behavior:none;border-radius:inherit;scrollbar-width:thin;scrollbar-color:var(--mp-card-border) transparent`,".mp-popup-elevator .mp-popup-scroll":`padding:8px`,".mp-popup-sheet .mp-popup-scroll":`clip-path:inset(0 round calc(18px * var(--mp-rk, 1)))`,".mp-popup.mp-media-side:not(.mp-media-end) > .mp-popup-scroll":`clip-path:inset(0 round 0 calc(16px * var(--mp-rk, 1)) calc(16px * var(--mp-rk, 1)) 0)`,".mp-popup.mp-media-end > .mp-popup-scroll":`clip-path:inset(0 round calc(16px * var(--mp-rk, 1)) 0 0 calc(16px * var(--mp-rk, 1)))`,".mp-popup-sheet":`border-radius:calc(18px * var(--mp-rk, 1));transform-origin:50% 100%`,".mp-popup-sheet .mp-popup-arrow":`display:none`,".mp-popup:not(.mp-popup-sheet):not(.mp-media-side) .mp-popup-slide":`aspect-ratio:auto;height:var(--mp-bh,calc(var(--mp-pw,264px) * 0.5625))`,".mp-popup-sheet .mp-popup-slide":`aspect-ratio:auto;height:min(calc(var(--mp-cw,480px) * 0.5625), var(--mp-mh,160px))`,".mp-popup-x":`position:absolute;top:10px;inset-inline-end:10px;z-index:2;width:20px;height:20px;display:flex;align-items:center;justify-content:center;border:0;padding:0;border-radius:calc(6px * var(--mp-rk, 1));background:transparent;color:var(--mp-card-fg-muted);cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,".mp-popup-x svg":`width:12px;height:12px`,".mp-popup-x:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup.mp-media-top .mp-popup-x":`background:rgba(24,24,27,0.72);color:#fff;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)`,".mp-popup.mp-media-top .mp-popup-x:hover":`background:var(--mp-card-bg)`,".mp-popup-place:not(.mp-media-top) .mp-popup-scroll > :first-child":`padding-inline-end:20px`,".mp-sec + .mp-sec":`margin-top:10px`,".mp-popup-scroll.mp-pinning > .mp-pin-top":`position:sticky;top:0;z-index:1;margin-left:-12px;margin-right:-12px;padding-inline-start:12px;padding-inline-end:32px;background:var(--mp-card-bg)`,".mp-popup-scroll.mp-pinning:has(> .mp-pin-top)":`padding-top:0`,".mp-popup-scroll.mp-pinning-foot:has(> .mp-pin-bottom)":`padding-bottom:0`,".mp-popup-scroll.mp-pinning:has(> .mp-pin-top) > .mp-popup-gallery.mp-first":`margin-top:0`,".mp-popup-scroll.mp-pinning > .mp-pin-top:first-child":`margin-top:0;padding-top:12px`,".mp-popup-scroll.mp-pinning > .mp-pin-top:not(:first-child)":`margin-top:0;padding-top:10px`,".mp-popup-place .mp-popup-scroll.mp-pinning > .mp-pin-top":`padding-inline-end:32px`,".mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom":`position:sticky;bottom:0;z-index:1;margin:0 -12px;padding:10px 12px 12px;background:var(--mp-card-bg)`,".mp-popup-scroll.mp-pinning > .mp-pin-top::after, .mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom::before":`content:'';position:absolute;left:0;right:0;height:16px;pointer-events:none;opacity:0;transition:opacity 150ms ease`,".mp-popup-scroll.mp-pinning > .mp-pin-top::after":`top:100%;background:linear-gradient(var(--mp-card-bg),transparent)`,".mp-popup-scroll.mp-pinning-foot > .mp-pin-bottom::before":`bottom:100%;background:linear-gradient(transparent,var(--mp-card-bg))`,".mp-popup-scroll.mp-pinning.mp-under-top > .mp-pin-top::after, .mp-popup-scroll.mp-pinning-foot.mp-under-bottom > .mp-pin-bottom::before":`opacity:1`,".mp-popup-head + .mp-popup-text":`margin-top:8px`,".mp-popup-gallery":`position:relative;overflow:hidden;margin-left:-12px;margin-right:-12px;outline:none;background:var(--mp-card-bg-hover)`,".mp-popup-gallery.mp-first":`margin-top:-12px`,".mp-popup-gallery.mp-last":`margin-bottom:-12px`,".mp-popup-gallery:focus-visible":`box-shadow:inset 0 0 0 2px var(--mp-accent)`,".mp-popup.mp-media-side":`display:flex;width:calc(var(--mp-pw,264px) + var(--mp-mw,224px))`,".mp-popup.mp-media-end":`flex-direction:row-reverse`,".mp-popup.mp-media-side > .mp-popup-gallery":`flex:none;width:var(--mp-mw,224px);min-height:min(calc(var(--mp-mw,224px) * 1.25), var(--mp-room,9999px));margin:0;overflow:hidden;border-start-start-radius:inherit;border-end-start-radius:inherit`,".mp-popup.mp-media-end > .mp-popup-gallery":`border-start-start-radius:0;border-end-start-radius:0;border-start-end-radius:inherit;border-end-end-radius:inherit`,".mp-popup.mp-media-side > .mp-popup-scroll":`flex:1 1 auto;min-width:0;display:flex;flex-direction:column`,".mp-popup.mp-media-side > .mp-popup-scroll > *":`flex:none`,".mp-popup.mp-media-side > .mp-popup-scroll > :has(+ .mp-popup-foot:last-child)":`margin-bottom:auto`,".mp-popup.mp-media-side .mp-popup-track":`position:absolute;inset:0`,".mp-popup.mp-media-side .mp-popup-slide":`aspect-ratio:auto;height:100%`,".mp-popup.mp-media-end .mp-popup-x":`inset-inline-end:calc(var(--mp-mw,224px) + 10px)`,".mp-popup-track":`display:flex`,".mp-popup-gallery.mp-multi .mp-popup-track":`cursor:grab;touch-action:pan-y;will-change:transform;transition:transform 320ms cubic-bezier(0.22,0.8,0.24,1)`,".mp-popup-track.mp-drag":`cursor:grabbing;transition:none !important`,".mp-popup-slide":`flex:none;width:100%;aspect-ratio:16/9;position:relative;overflow:hidden;background:var(--mp-card-bg-hover)`,".mp-popup-slide img":`width:100%;height:100%;object-fit:cover;display:block;opacity:0;transition:opacity 200ms ease;-webkit-user-drag:none;user-select:none;pointer-events:none`,".mp-popup-slide.mp-loaded img":`opacity:1`,".mp-popup-slide.mp-broken img":`display:none`,".mp-popup-nav":`position:absolute;top:50%;width:24px;height:24px;margin-top:-12px;display:flex;align-items:center;justify-content:center;border:0;padding:0;border-radius:999px;background:rgba(24,24,27,0.28);-webkit-backdrop-filter:blur(8px) saturate(1.15);backdrop-filter:blur(8px) saturate(1.15);color:#fff;box-shadow:inset 0 0 0 1px rgba(255,255,255,0.22);cursor:pointer;opacity:0;pointer-events:none;transition:opacity 150ms ease,background-color 150ms ease`,".mp-popup-nav svg":`width:14px;height:14px`,".mp-popup-nav:hover":`background:rgba(24,24,27,0.45)`,".mp-popup-prev":`left:8px`,".mp-popup-next":`right:8px`,".mp-popup-gallery:hover .mp-popup-nav, .mp-popup-gallery:focus-visible .mp-popup-nav":`opacity:1;pointer-events:auto`,".mp-popup-nav:disabled":`opacity:0 !important;pointer-events:none !important`,".mp-popup-dots":`position:absolute;left:0;right:0;bottom:8px;display:flex;justify-content:center;gap:4px;pointer-events:none`,".mp-popup-dot":`width:6px;height:6px;padding:0;border:0;border-radius:calc(3px * var(--mp-rk, 1));background:rgba(255,255,255,0.55);box-shadow:0 0 2px rgba(0,0,0,0.3);pointer-events:auto;cursor:pointer;transition:width 150ms ease,background-color 150ms ease`,".mp-popup-dot.mp-on":`width:16px;background:#fff`,".mp-popup-text .mp-popup-desc":`margin-top:0`,".mp-popup-desc.mp-clamp":`display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden`,".mp-popup-more":`margin-top:4px;padding:0;border:0;background:none;font-family:Onest,sans-serif;font-size:12px;font-weight:600;color:var(--mp-card-fg);cursor:pointer`,".mp-popup-link":`color:var(--mp-card-fg);text-decoration:underline;text-decoration-color:var(--mp-card-border-strong);text-underline-offset:2px;transition:text-decoration-color 150ms ease`,".mp-popup-link:hover":`text-decoration-color:var(--mp-card-fg-muted)`,".mp-popup-details":`display:flex;flex-direction:column;margin-left:-8px;margin-right:-8px`,".mp-popup-row":`min-height:28px;padding:4px 8px;box-sizing:border-box;display:flex;align-items:center;gap:8px;border-radius:calc(7px * var(--mp-rk, 1));font-size:12px;line-height:1.35;color:var(--mp-card-fg-secondary);text-decoration:none;overflow-wrap:anywhere`,"a.mp-popup-row":`cursor:pointer;transition:background-color 150ms ease,color 150ms ease`,"a.mp-popup-row:hover":`background:var(--mp-card-bg-hover);color:var(--mp-card-fg)`,".mp-popup-row-icon":`flex:none;width:16px;display:flex;align-items:center;justify-content:center;color:var(--mp-card-fg-muted)`,".mp-popup-row-icon svg, .mp-popup-row-icon img":`width:14px;height:14px;stroke-width:1.75`,".mp-popup-row-label":`flex:1;min-width:0;color:var(--mp-card-fg-muted)`,".mp-popup-row-value":`flex:1;min-width:0`,".mp-popup-row-label + .mp-popup-row-value":`flex:0 1 auto;max-width:60%;text-align:end`},o=e=>e?/^\s*<svg/i.test(e)?e:i[e]||``:``,s=e=>{let t=n(`span`,`mp-popup-tag`);return t.textContent=e,t},c=(e,t)=>{let r=n(`span`,`mp-popup-names`),i=n(`span`,`mp-popup-title`);if(i.textContent=e,r.append(i),t){let e=n(`span`,`mp-popup-sub`);e.textContent=t,r.append(e)}return r},l=e=>{let t=n(`button`,`mp-popup-close`,i.x);return t.type=`button`,t.title=e.t(`close`),t.setAttribute(`aria-label`,e.t(`close`)),t.onclick=()=>e.close&&e.close(),t},u=e=>{let t=n(`button`,`mp-popup-x`,i.x);return t.type=`button`,t.title=e.t(`close`),t.setAttribute(`aria-label`,e.t(`close`)),t.onclick=()=>e.close&&e.close(),t},d=e=>[].concat(e.images||[]).map(e=>typeof e==`string`?{src:e}:e).filter(e=>e&&e.src),f=(e,t)=>{let r=/https?:\/\/[^\s<>"')]+/g,i=0,a;for(;a=r.exec(t);){a.index>i&&e.append(t.slice(i,a.index));let o=n(`a`,`mp-popup-link`);o.href=a[0],o.target=`_blank`,o.rel=`noopener`,o.textContent=a[0].replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``),e.append(o),i=r.lastIndex}i<t.length&&e.append(t.slice(i))},p=new Set([`p`,`br`,`b`,`strong`,`i`,`em`,`a`,`ul`,`ol`,`li`,`span`]),m=new Set([`script`,`style`,`iframe`,`object`,`embed`,`template`,`svg`,`math`,`noscript`,`link`,`meta`]),h=(t,n)=>{if(!/<\/?[a-z][^>]*>/i.test(n))return f(t,n);let r=new DOMParser().parseFromString(`<body>`+n+`</body>`,`text/html`).body,i=(t,n)=>t.childNodes.forEach(t=>{if(t.nodeType===3){n.closest&&n.closest(`a`)?n.append(t.textContent):f(n,t.textContent);return}if(t.nodeType!==1)return;let r=t.tagName.toLowerCase();if(m.has(r))return;if(!p.has(r))return i(t,n);let a=e.createElement(r),o=(t.getAttribute(`class`)||``).replace(/[^\w\- ]/g,``).trim();if(o&&(a.className=o),r===`a`){let e=(t.getAttribute(`href`)||``).trim();/^(https?:|mailto:|tel:)/i.test(e)&&(a.href=e,/^https?:/i.test(e)&&(a.target=`_blank`,a.rel=`noopener`)),a.classList.add(`mp-popup-link`)}n.append(a),i(t,a)});i(r,t)},g=(e,t)=>{let r=n(`div`,`mp-popup-gallery`),a=n(`div`,`mp-popup-track`);if(e.forEach((e,t)=>{let r=n(`div`,`mp-popup-slide`),i=n(`img`);i.alt=e.alt||``,i.decoding=`async`,t&&(i.loading=`lazy`),i.draggable=!1,i.onload=()=>r.classList.add(`mp-loaded`),i.onerror=()=>r.classList.add(`mp-broken`),i.src=e.src,r.append(i),a.append(r)}),r.append(a),[`pointerdown`,`touchstart`,`wheel`].forEach(e=>r.addEventListener(e,e=>e.stopPropagation(),{passive:!0})),e.length<2)return r;r.classList.add(`mp-multi`),r.tabIndex=0,r.setAttribute(`role`,`region`),r.setAttribute(`aria-roledescription`,`carousel`);let o=n(`div`,`mp-popup-dots`),s=n(`button`,`mp-popup-nav mp-popup-prev`,i.prev),c=n(`button`,`mp-popup-nav mp-popup-next`,i.next),l=-1;s.type=c.type=`button`,s.setAttribute(`aria-label`,t.t(`previous`)),c.setAttribute(`aria-label`,t.t(`next`));let u=()=>getComputedStyle(a).direction===`rtl`,d=()=>Math.max(1,r.clientWidth),f=e.length-1,p=0,m=e=>{let t=d(),n=.55;return Math.sign(e)*(Math.abs(e)*t*n/(t+n*Math.abs(e)))},h=e=>{let t=u()?-1:1,n=-(f-l)*d(),r=l*d(),i=e*t;return(i>r?r+m(i-r):i<n?n+m(i-n):i)*t},g=()=>{let e=u()?1:-1;a.style.transform=`translateX(calc(`+e*l*100+`% + `+p+`px))`},_=()=>{[...o.children].forEach((e,t)=>{e.classList.toggle(`mp-on`,t===l),e.setAttribute(`aria-current`,t===l?`true`:`false`)}),s.disabled=l===0,c.disabled=l===f},v=e=>{l=Math.max(0,Math.min(f,e)),p=0,a.style.transition=t.reducedMotion?`none`:``,g(),_()};e.forEach((t,r)=>{let i=n(`button`,`mp-popup-dot`);i.type=`button`,i.setAttribute(`aria-label`,r+1+` / `+e.length),i.onclick=()=>v(r),o.append(i)}),s.onclick=()=>v(l-1),c.onclick=()=>v(l+1),r.addEventListener(`keydown`,e=>{let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);t&&(e.preventDefault(),e.stopPropagation(),v(l+(u()?-t:t)))});let y=(e,t)=>{let n=(u()?-1:1)*(e<0?1:-1),r=Math.abs(e)>d()*.15||Math.abs(t)>.35&&Math.sign(t)===Math.sign(e);v(r?l+n:l)},b=null;a.addEventListener(`pointerdown`,e=>{e.button||(b={id:e.pointerId,x:e.clientX,y:e.clientY,on:!1,t:e.timeStamp,lx:e.clientX,v:0})}),a.addEventListener(`pointermove`,e=>{if(!b||e.pointerId!==b.id)return;let t=e.clientX-b.x,n=e.clientY-b.y;if(!b.on){if(Math.abs(t)<5&&Math.abs(n)<5)return;if(Math.abs(n)>Math.abs(t))return void(b=null);b.on=!0,b.x=e.clientX-Math.sign(t)*5,a.setPointerCapture(e.pointerId),a.classList.add(`mp-drag`)}let r=e.timeStamp-b.t;r>0&&(b.v=.8*((e.clientX-b.lx)/r)+.2*b.v),b.t=e.timeStamp,b.lx=e.clientX,p=h(e.clientX-b.x),g()});let x=e=>{if(!b||e.pointerId!==b.id)return;let t=b;b=null,t.on&&(a.classList.remove(`mp-drag`),e.timeStamp-t.t>80&&(t.v=0),y(e.type===`pointercancel`?0:e.clientX-t.x,t.v))};a.addEventListener(`pointerup`,x),a.addEventListener(`pointercancel`,x),a.addEventListener(`lostpointercapture`,x);let S=0,C=0,w=!1;return a.addEventListener(`wheel`,e=>{if(Math.abs(e.deltaX)<=Math.abs(e.deltaY)||(e.preventDefault(),clearTimeout(C),C=setTimeout(()=>{a.classList.remove(`mp-drag`),w||y(S,0),S=0,w=!1},140),w))return;S-=e.deltaX*(e.deltaMode===1?33:1);let t=h(S);Math.abs(S)>d()*.25&&t===S?(w=!0,a.classList.remove(`mp-drag`),y(S,0)):(a.classList.add(`mp-drag`),p=t,g())},{passive:!1}),r.append(s,c,o),l=0,g(),_(),r},_=(e,t,r)=>{let i=t&&t.levels||[];if(i.length<2||e.level==null)return null;let a=[{id:e.id,level:e.level}].concat((e.linked||[]).filter(e=>e.level!=null)),o=new Set,s=n(`span`,`mp-popup-meta`);if(a.slice().sort((e,t)=>e.level-t.level).forEach(r=>{if(o.has(r.level))return;o.add(r.level);let a=i.find(e=>e.index===r.level)||{},c=r.level!==e.level&&t.select,l=n(c?`button`:`span`,`mp-popup-tag`+(c?` mp-popup-tag-btn`:``));l.textContent=a.short||a.name||String(r.level),c&&(l.type=`button`,l.title=a.name||``,l.onclick=()=>t.select(r.id)),s.append(l)}),r){let e=n(`span`,`mp-popup-meta-text`);e.textContent=r,s.append(e)}return s},v=(e,t)=>{let r=(e.categoryTags||[]).filter(e=>e&&(e.name||e.id));if(!r.length||e.subtitle||e.group||!t||t.categoryChips===!1)return null;let i=MapplicMap.PLACE,a=t.filterCategory,o=n(`span`,`mp-popup-cats`),s=n(`span`,`mp-popup-discs`);return r.forEach((e,t)=>{let r=e.name||e.id,c=i&&e.icon?i.icon(e.icon,12):null,l=n(`span`,`mp-popup-catw`),u=n(`button`,`mp-popup-cat-disc mp-popup-cat-dot`,c||``),d=n(a?`button`:`span`,`mp-popup-cat-tip`);c||(u.textContent=r.trim().charAt(0).toUpperCase()),e.color&&(l.style.setProperty(`--mp-cc`,MapplicData.readableOn(`#ffffff`,e.color,3)),l.style.setProperty(`--mp-ct`,MapplicData.readableOn(`#ffffff`,e.color,4.5)),d.style.setProperty(`--mp-ct`,MapplicData.readableOn(`#ffffff`,e.color,4.5)),d.style.setProperty(`--mp-ct-ink`,`#fff`)),u.type=`button`,u.setAttribute(`aria-label`,r),u.setAttribute(`aria-expanded`,`false`),u.onclick=t=>{t.stopPropagation();let n=window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches;if(a&&(n||l.classList.contains(`mp-open`)))return a(e.id);let r=!l.classList.contains(`mp-open`);o.querySelectorAll(`.mp-popup-catw.mp-open`).forEach(e=>{e.classList.remove(`mp-open`),e.firstChild.setAttribute(`aria-expanded`,`false`),e.dispatchEvent(new Event(`mp-cat-hide`))}),l.classList.toggle(`mp-open`,r),u.setAttribute(`aria-expanded`,String(r)),r&&h()},d.textContent=r;let f=()=>{let e=l.closest(`.mp-popup`)||l;d.parentNode!==e&&e.append(d),d.style.transition=`none`,d.style.setProperty(`--mp-tx`,`0px`);let t=u.getBoundingClientRect(),n=e.getBoundingClientRect(),r=e.offsetWidth?n.width/e.offsetWidth:1;d.style.left=(t.left+t.width/2-n.left)/r+`px`,d.style.top=(t.bottom-n.top)/r+4+`px`;let i=d.getBoundingClientRect(),a=6*r,o=i.left<n.left+a?n.left+a-i.left:i.right>n.right-a?n.right-a-i.right:0;d.style.setProperty(`--mp-tx`,o/r+`px`),d.offsetWidth,d.style.transition=``},p=!1,m=0,h=()=>{clearTimeout(m),f(),d.classList.add(`mp-show`)},g=()=>{clearTimeout(m),m=setTimeout(()=>{p||l.classList.contains(`mp-open`)||MapplicMap.focused()===u||d.classList.remove(`mp-show`)},a?80:0)};l.addEventListener(`mouseenter`,h),l.addEventListener(`mouseleave`,g),d.addEventListener(`mouseenter`,()=>(p=!0,clearTimeout(m))),d.addEventListener(`mouseleave`,()=>(p=!1,g())),u.addEventListener(`focus`,()=>u.matches(`:focus-visible`)&&h()),u.addEventListener(`blur`,g),l.addEventListener(`mp-cat-hide`,()=>d.classList.remove(`mp-show`)),a?(d.type=`button`,d.tabIndex=-1,d.onclick=()=>a(e.id)):d.setAttribute(`aria-hidden`,`true`),l.append(u,d),s.append(l)}),o.append(s),requestAnimationFrame(()=>{let e=o.closest(`.mp-popup-scroll`);e&&e.addEventListener(`scroll`,()=>s.querySelectorAll(`.mp-popup-catw`).forEach(e=>e.dispatchEvent(new Event(`mp-cat-hide`))),{passive:!0})}),o},y=(e,t)=>{let r=v(e,t),i=r?null:e.subtitle||e.group||(e.categories&&e.categories.length>1?e.categories.join(`, `):e.category);if(!e.name&&!e.logo)return null;let a=n(`div`,`mp-popup-head`),o=n(`span`,`mp-popup-who`);if(e.logo){let t=n(`span`,`mp-popup-logo`),r=n(`img`,``);r.alt=``,r.decoding=`async`,r.onload=()=>{t.classList.toggle(`mp-logo-mono`,MapplicData.imageIsMono(r)),t.classList.add(`mp-loaded`)},r.onerror=()=>t.classList.remove(`mp-loaded`),r.src=e.logo,t.append(r),o.append(t)}let s=_(e,t,i),l=c(e.name||``,s?null:i);return s&&r&&(s.classList.add(`mp-popup-meta-wrap`),s.append(r)),s?l.append(s):r&&l.append(r),o.append(l),a.append(o),a},b=(e,t)=>{let r=n(`div`,`mp-popup-text`),i=n(`div`,`mp-popup-desc mp-clamp`);return h(i,e),r.append(i),requestAnimationFrame(()=>{if(i.scrollHeight-i.clientHeight<2)return i.classList.remove(`mp-clamp`);let e=n(`button`,`mp-popup-more`);e.type=`button`,e.textContent=t.t(`show_more`);let a=0;e.onclick=()=>{let n=!i.classList.contains(`mp-clamp`);if(e.textContent=t.t(n?`show_more`:`show_less`),clearTimeout(a),t.reducedMotion)return void i.classList.toggle(`mp-clamp`,n);let r=i.offsetHeight;i.style.transition=`none`,i.style.height=``,i.classList.toggle(`mp-clamp`,n);let o=i.offsetHeight;n&&i.classList.remove(`mp-clamp`),i.style.overflow=`hidden`,i.style.height=r+`px`,i.offsetHeight,i.style.transition=`height 200ms ease`,i.style.height=o+`px`,a=setTimeout(()=>{i.style.transition=i.style.height=i.style.overflow=``,i.classList.toggle(`mp-clamp`,n)},210)},r.append(e)}),r},x=(e,t)=>{let r=n(`div`,`mp-popup-hours`);if(t.hours)r.append(t.hours.widget(e.hours));else{let t=n(`div`,`mp-popup-hours-plain`,i.clock),a=n(`span`,``);a.textContent=e.hours,t.append(a),r.append(t)}return r},S=e=>{let t=[],r=String(e.website||``);if(e.phone&&t.push({icon:`phone`,value:e.phone,href:`tel:`+String(e.phone).replace(/[^\d+]/g,``)}),e.email&&t.push({icon:`mail`,value:e.email,href:`mailto:`+e.email}),r&&t.push({icon:`globe`,value:r.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``),href:/^https?:/i.test(r)?r:`https://`+r}),[].concat(e.details||[]).forEach(e=>{e&&(e.value!=null&&e.value!==``||e.label)&&t.push(e)}),!t.length)return null;let i=n(`div`,`mp-popup-details`);return t.forEach(e=>{let t=n(e.href?`a`:`div`,`mp-popup-row`),r=o(e.icon);if(e.href&&(t.href=e.href,/^https?:/i.test(e.href)&&(t.target=e.target||`_blank`,t.rel=`noopener`)),r&&t.append(n(`span`,`mp-popup-row-icon`,r)),e.label){let r=n(`span`,`mp-popup-row-label`);r.textContent=e.label,t.append(r)}if(e.value!=null&&e.value!==``){let r=n(`span`,`mp-popup-row-value`);r.textContent=String(e.value),t.append(r)}i.append(t)}),i},C=(e,t)=>{if(e.action===!1)return null;let n=e.kind===`store`&&e.popup&&e.popup.link&&typeof e.popup.link==`object`?e.popup.link:null,r=e.action&&typeof e.action==`object`?e.action:null;if(!n&&!r)return null;let i=Object.assign({},n,r);return!i.url&&!i.label?null:(i.url&&=String(i.url).replace(/\{(id|unit)\}/g,(t,n)=>encodeURIComponent(n===`unit`?e.id:e.location||e.id)),i.label||=t.t(`view_store`),i)},w=(e,t,r,i)=>{let a=n(`button`,`mp-popup-btn `+e,i);return a.type=`button`,i?a.setAttribute(`aria-label`,t):a.textContent=t,a.title=t,a.onclick=r,a},T=(e,t,r)=>{let i=n(r.url?`a`:`button`,`mp-popup-btn mp-popup-primary mp-popup-go`);return i.textContent=r.label,i.title=r.label,r.url?(i.href=r.url,i.target=r.target||`_blank`,i.target===`_blank`&&(i.rel=`noopener`)):i.type=`button`,i.addEventListener(`click`,n=>t.action&&t.action(e,r,n)),i},E=(e,t,r,a)=>{let o=r?C(e,t):null,s=a&&(e.kind===`store`||e.kind===`marker`&&e.location)&&t.dirs;if(!o&&!s)return null;let c=n(`div`,`mp-popup-foot`);if(s){t.startHere&&c.append(w(`mp-popup-from mp-popup-alt mp-popup-icon`,t.t(`from_here`),()=>t.dirs.from(e),i.start));let n=o||t.directions===`secondary`?`mp-popup-alt`:`mp-popup-go`;c.append(w(`mp-popup-dir `+n,t.t(`directions`),()=>t.dirs.to(e)))}return o&&c.append(T(e,t,o)),c.classList.toggle(`mp-pair`,!!(o&&s)),c},D=e=>{let t=e.getBoundingClientRect(),n=e.classList.contains(`mp-pinning`)&&e.querySelector(`:scope > .mp-pin-top`),r=e.classList.contains(`mp-pinning-foot`)&&e.querySelector(`:scope > .mp-pin-bottom`),i=n&&n.getBoundingClientRect(),a=r&&r.getBoundingClientRect();[...e.children].forEach(o=>{if(o===n||o===r)return;let s=o.getBoundingClientRect(),c=s.height,l=[];if(i&&e.scrollTop>1&&i.bottom>s.top&&i.top<s.bottom){let e=i.top-s.top,t=i.bottom-s.top;l.push(`#000 `+e+`px`,`transparent `+e+`px`,`transparent `+t+`px`,`#000 `+(t+12)+`px`)}if(a&&a.top<s.bottom&&a.bottom>s.top&&a.top<t.bottom-1){let e=a.top-s.top,t=a.bottom-s.top;l.push(`#000 `+(e-12)+`px`,`transparent `+e+`px`,`transparent `+t+`px`,`#000 `+t+`px`)}let u=l.length?`linear-gradient(#000 0px, `+l.join(`, `)+`, #000 `+Math.max(c,0)+`px)`:``;o.style.maskImage!==u&&(o.style.webkitMaskImage=u,o.style.maskImage=u)})},O=(e,t)=>{let n=()=>{let n=parseFloat(e.style.maxHeight)||0,r=t.scrollHeight-t.clientHeight-t.scrollTop;t.classList.toggle(`mp-pinning`,!(n&&n<220)),t.classList.add(`mp-pinning-foot`),t.classList.toggle(`mp-under-top`,t.scrollTop>1),t.classList.toggle(`mp-under-bottom`,r>1),D(t)};if(t.addEventListener(`scroll`,n,{passive:!0}),e._pinObs&&e._pinObs.disconnect(),typeof ResizeObserver==`function`){let r=0;e._pinObs=new ResizeObserver(()=>{cancelAnimationFrame(r),r=requestAnimationFrame(n)}),e._pinObs.observe(t),[...t.children].forEach(t=>e._pinObs.observe(t))}e._pinUpdate=n,n()},k=(e,n,r,i)=>{let a=e.popup||{},o=d(e),s=(Array.isArray(a.sections)?a.sections:t).filter((e,n,r)=>t.includes(e)&&r.indexOf(e)===n),c=s.find(e=>e===`action`||e===`directions`),l={gallery:()=>o.length?g(o,n):null,header:()=>y(e,n),description:()=>e.description?b(String(e.description),n):null,hours:()=>e.hours&&n.openNow!==!1?x(e,n):null,details:()=>S(e),action:()=>c===`action`?E(e,n,!0,s.includes(`directions`)):null,directions:()=>c===`directions`?E(e,n,s.includes(`action`),!0):null},f=s.map(e=>l[e]()).filter(Boolean);f.forEach(e=>{e.classList.add(`mp-sec`),r.append(e)});let p=e=>e&&e.classList.contains(`mp-popup-gallery`),m=p(f[0]);m&&f[0].classList.add(`mp-first`),p(f[f.length-1])&&f[f.length-1].classList.add(`mp-last`);let h=f.find(e=>e.classList.contains(`mp-popup-head`)),_=f[f.length-1];h&&(f[0]===h||m&&f[1]===h)&&h.classList.add(`mp-pin-top`),_&&_.classList.contains(`mp-popup-foot`)&&_!==h&&_.classList.add(`mp-pin-bottom`),O(i,r),i.classList.toggle(`mp-media-top`,m),i._media=o.length?{mode:a.media===`top`||a.media===`side`?a.media:`auto`,side:a.media_side===`end`?`end`:`start`,gallery:f.find(p),top:m,mark:null}:null,i.append(u(n)),i.style.setProperty(`--mp-pw`,Math.max(180,Math.min(480,+a.width||(o.length?264:208)))+`px`)},A={elevator(e,t,r){let a=t.state||{},o=n(`div`,`mp-popup-head`),c=n(`span`,`mp-popup-label`);c.textContent=t.t(`elevator`),o.append(c,l(t));let u=n(`div`,`mp-popup-floors`);u.append(...(e.floors||[]).slice().reverse().filter(t=>a.allLevels||t.index!==e.level).map(r=>{let o=n(`button`,`mp-popup-floor`),c=n(`span`,`mp-popup-floor-name`,a.allLevels||e.level==null?``:r.index>e.level?i.up:i.dn),l=n(`span`,``);return l.textContent=r.name,c.append(l),o.append(c,s(r.short)),o.onclick=()=>t.setLevel&&t.setLevel(r.index),o})),r.append(o,u)},bus_stop(e,t,r){let i=n(`div`,`mp-popup-head`);if(i.append(c(e.name),l(t)),r.append(i),e.description){let t=n(`div`,`mp-popup-desc`);h(t,String(e.description)),r.append(t)}if((e.departures||[]).length){let i=n(`div`,`mp-popup-departures`);i.append(...e.departures.map(e=>{let r=n(`div`,`mp-popup-departure`),i=n(`span`,`mp-popup-dest`),a=n(`span`,`mp-popup-mins`+(e.minutes<=2?` mp-soon`:``));return i.textContent=e.to,a.textContent=e.minutes<=0?t.t(`now`):t.t(`minutes`,{n:e.minutes}),r.append(s(String(e.line)),i,a),r})),r.append(i)}}};return{css:a,fill:(e,t,r)=>{let i=t.kind||`store`;e._media=null,e._pinUpdate=null,e._pinObs&&e._pinObs.disconnect(),e._pinObs=null,e.className=`mp-popup `+(A[i]?``:`mp-popup-place `)+`mp-popup-`+i,e.replaceChildren(),e.style.removeProperty(`--mp-pw`);let a=n(`div`,`mp-popup-scroll`),o=n(`span`,`mp-popup-arrow`);return e.append(a,o),(A[i]||k)(t,r,a,e),{scroll:a,arrow:o}},fitMedia:(t,n)=>{let r=t._media,i=t.querySelector(`:scope > .mp-popup-scroll`);if(!r||!r.gallery||!i)return`none`;let a=n=>{t.classList.toggle(`mp-media-side`,n),t.classList.toggle(`mp-media-end`,n&&r.side===`end`),t.classList.toggle(`mp-media-top`,!n&&r.top),n&&r.gallery.parentNode!==t?(r.mark=r.mark||e.createComment(`media`),r.gallery.replaceWith(r.mark),t.insertBefore(r.gallery,i)):!n&&r.gallery.parentNode===t&&r.mark.replaceWith(r.gallery)};n||={};let o=parseFloat(t.style.getPropertyValue(`--mp-pw`))||264,s=(n.width||0)>=o+224+16&&!(n.height>0&&n.height<280),c=!1;if(r.mode===`side`)c=s;else if(r.mode===`auto`&&s){a(!1);let e=i.scrollHeight;c=e-r.gallery.offsetHeight>300||n.height>0&&e>n.height}return a(c),t._pinUpdate&&t._pinUpdate(),c?`side`:`top`},MEDIA_SIDE_H:280,el:n,icons:i,sections:t,inject:()=>MapplicMap.injectCss(`popups`,a)}})(),MapplicMap.plugin(`popups`,e=>{let t=e.plugin(`popups`),n=e.plugin(`wayfinding`),r=e.plugin(`hours`),i=()=>e.ui.env().reducedMotion,a=MapplicMap.POPUP,o=e.ui.container;e.ui.style(a.css);let s=e.ui.mount(a.el(`div`,``,null,`position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;z-index:10`)),c=a.el(`div`,`mp-popup`,null,`opacity:0;pointer-events:none`),l=a.el(`span`,`mp-popup-tail`,null,`opacity:0`),u=a.el(`span`,`mp-popup-tail-box`);u.append(l),s.append(c,u),c.addEventListener(`wheel`,e=>e.stopPropagation(),{passive:!0}),c.tabIndex=-1,c.setAttribute(`role`,`dialog`);let d=0,f=null,p=e=>{(e.key===`Enter`||e.key===` `)&&(d=performance.now())},m=()=>d=0;document.addEventListener(`keydown`,p,!0),document.addEventListener(`pointerdown`,m,!0);let h=()=>c.contains(MapplicMap.focused()),g=e=>!!e&&e!==document.body&&(o.contains(e)||!!(e.closest&&e.closest(`[class*="mp-"]`))),_=()=>{let e=MapplicMap.focused();!h()&&g(e)&&(f=e),(f||h())&&c.focus({preventScroll:!0})},v=()=>{let e=f&&f.isConnected&&f.offsetParent!==null?f:(o.parentElement||document).querySelector(`.mp-search-input`);f=null,e?e.focus({preventScroll:!0}):o.focus&&o.focus({preventScroll:!0})};c.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&(t.stopPropagation(),e.view.deselect()),t.key===`Tab`&&t.shiftKey&&f){let e=c.querySelector(`button, a[href], input, select, textarea, [tabindex="0"]`);(MapplicMap.focused()===c||MapplicMap.focused()===e)&&(t.preventDefault(),v())}});let y=()=>({t:e.ui.t,close:()=>e.view.deselect(),openNow:t.setting(`open_now`)!==!1,directions:t.setting(`directions`)===`secondary`?`secondary`:`primary`,startHere:t.setting(`start_here`)===!0,reducedMotion:i(),state:e.getState(),setLevel:t=>e.view.setLevel(t),levels:e.data.levels(),select:t=>e.view.select({id:t}),categoryChips:t.setting(`category_chips`)!==!1,filterCategory:e.plugin(`search`).enabled()?t=>{e.plugin(`search`).setQuery({text:``,category:[t]}),e.view.deselect()}:null,hours:r.enabled()?{widget:e=>r.widget(e)}:null,dirs:n.enabled()?{from:e=>n.from({id:e.kind===`marker`&&e.location?e.location:e.id}),to:e=>n.to({id:e.kind===`marker`&&e.location?e.location:e.id})}:null}),b=null,x=null,S=!1,C=0,w=0,T=!1,E=null,D=e=>{let t=!!(e&&b&&F===b&&b.kind===e.kind&&b.id===e.id);b=e,t&&(F=e,ee=``,P=performance.now()+500);let n=h();E=a.fill(c,e,y()).arrow,c.setAttribute(`aria-label`,e.name||e.title||``),n&&!h()&&c.focus({preventScroll:!0}),c.classList.toggle(`mp-popup-sheet`,T),w=c.offsetWidth,c._k=null,c._fit=null},O=t=>{t!==void 0&&(x=t);let n=e.getState(),r=x&&!(x.kind===`store`&&n.allLevels),i=S,a=t!==void 0&&performance.now()-d<400;if(r&&D(x),S=!!r,c.style.pointerEvents=S?`auto`:`none`,c.setAttribute(`aria-hidden`,S?`false`:`true`),S&&a)d=0,_();else if(!S&&i&&(h()||f&&document.activeElement===document.body)){let e=f;requestAnimationFrame(()=>{if(S)return;let t=MapplicMap.focused();if(t&&t!==document.body&&!c.contains(t))return f=null;e?(f=e,v()):(f=null,h()&&t.blur())})}else S||(f=null)},k=e.plugin(`markers`),A=e=>{if(!k.enabled())return null;try{return k.top(e)}catch{return null}},j=e=>Math.min(e,Math.max(c.scrollHeight,c.querySelector(`:scope > .mp-popup-scroll`)?.scrollHeight||0))+56,M=(e,t)=>Math.max(0,Math.min(t/2-64,Math.max(e/2-Math.min(40,t*.05),e-t/2))),N=0,P=0;c.addEventListener(`click`,()=>P=performance.now()+500);let F=null,I=0,ee=``,L=e=>{let t=c._media,n=c.querySelector(`:scope > .mp-popup-scroll`);if(!t||!t.gallery||!n||c.classList.contains(`mp-media-side`))return;let r=e+`|`+w;if(r===ee)return;ee=r;let i=n.scrollHeight-t.gallery.offsetHeight+(t.top?12:0),a=Math.round(w*.5625);c.style.setProperty(`--mp-bh`,Math.max(Math.min(56,a),Math.min(a,Math.round(e-i)))+`px`)};e.onFrame(n=>{let r=o.clientWidth,u=o.clientHeight,d=t.setting(`style`),f=(d===`sheet`||d!==`floating`&&(r<360||r<480&&!!e.ui.env().touch))&&!!b&&b.kind!==`elevator`,p=Math.round(Math.min(360,u*.6)),m=0;if(f!==T&&(T=f,c.classList.toggle(`mp-popup-sheet`,f),f||(c.style.width=``,c._w=0),w=c.offsetWidth),b){if(T){let e=Math.min(r-16,480);c._w!==e&&(c.style.width=e+`px`,c._w=e),s.style.transform=`translate(`+((r-e)/2).toFixed(1)+`px,`+(u-8)+`px)`;let t=Math.round(u*.5);c.style.maxHeight=t+`px`,c.style.setProperty(`--mp-cw`,e+`px`),c.style.setProperty(`--mp-mh`,Math.round(t*.45)+`px`),c._fit!==`sheet`&&(c._fit=`sheet`,a.fitMedia(c,{width:0}))}else{if(F!==b){F=b,ee=``,c.style.maxHeight=``,c.style.removeProperty(`--mp-room`),c.style.removeProperty(`--mp-bh`),a.fitMedia(c,{width:r}),N=j(p);let t=e.view.lift(M(N,u)),n=Math.max(160,Math.min(p,Math.round(u/2+t-30)));a.fitMedia(c,{width:r,height:n}),c._fit=r,w=c.offsetWidth}else if(performance.now()<P){let t=j(p);Math.abs(t-N)>8&&(N=t,e.view.lift(M(t,u)))}let t=e.ui.anchor(b.id);if(t){let e=A(b.id),n=(e==null?t.y:Math.min(t.y,e-2))-8,i=Math.max(160,Math.min(p,Math.round(n-30)));c.style.maxHeight=i+`px`,c.style.setProperty(`--mp-room`,i+`px`),c._fit!==r&&(c._fit=r,a.fitMedia(c,{width:r,height:i}),w=c.offsetWidth),L(i);let o=w/2,l=Math.max(0,o-22);s.style.transform=`translate(`+t.x.toFixed(1)+`px,`+n.toFixed(1)+`px)`,m=Math.max(-l,Math.min(l,Math.min(0,r-8-(t.x+o))+Math.max(0,8-(t.x-o))))}}}C=i()?+!!S:Math.max(0,Math.min(1,C+(S?n/.24:-n/.16)));let h=T&&b&&(S||C>0)?c.offsetHeight+16:0,g=C<.5?2*C*C:1-(-2*C+2)**2/2,_=Math.round(S?h:h*g);_!==I&&(I=_,e.ui.inset(_?{bottom:_}:null));let v=C.toFixed(3)+`|`+m.toFixed(1)+`|`+T;if(c._k===v)return;c._k=v;let y=e=>{let t=e-1;return 1+2.7*t*t*t+1.7*t*t};if(T){let e=i()?0:(S?(1-C)**3:1-C)*24;c.style.transform=`translate(0,calc(-100% + `+e.toFixed(1)+`px))`,c.style.transformOrigin=``,l.style.visibility=`hidden`}else{let e=i()?1:S?.6+.4*y(C):.85+.15*C,t=m.toFixed(1);c.style.transform=`translate(calc(-50% + `+t+`px),calc(-100% - 14px)) scale(`+e.toFixed(3)+`)`,c.style.transformOrigin=`calc(50% - `+t+`px) calc(100% + 14px)`,E&&(E.style.left=`calc(50% - `+t+`px)`),l.style.transform=`scale(`+e.toFixed(3)+`) translateY(-14px) rotate(45deg) translateY(14px)`,l.style.visibility=``}c.style.opacity=l.style.opacity=(S?Math.min(1,C/.75):C).toFixed(3),!S&&C===0&&(b=null)}),O(e.data.feature(e.getState().selected)),e.on(`select`,e=>O(e)),e.on(`level`,()=>O());let R=[`attract`,`controls`,`scenery`,`labels`];return e.on(`plugin`,e=>{e&&R.includes(e.id)||O()}),e.on(`units`,t=>{if(!S||!x||!(t.ids||[]).includes(x.id))return;let n=e.data.feature(e.getState().selected);n&&n.id===x.id&&O(n)}),()=>{document.removeEventListener(`keydown`,p,!0),document.removeEventListener(`pointerdown`,m,!0)}}),MapplicMap.plugin(`attract`,e=>{let t=e.plugin(`attract`),n=[`pointerdown`,`wheel`,`keydown`,`touchstart`],r=[`Tab`,`Shift`],i=e.ui.container,a=performance.now(),o=!1,s=0,c=1,l=[],u=0,d=0,f=0,p=0,m=!1,h=e=>t.setting(e)!==!1,g=()=>{let e=t.setting(`progress`);return e===`off`||e===`pill`?e:`bar`};e.ui.style({".mp-attract-bar":`position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none;z-index:1;transition:opacity 200ms ease-out`,".mp-attract-bar > div":`position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--mp-accent, #1476ff);transform-origin:left;transform:scaleX(0)`,".mp-attract-tip":`position:absolute;inset:0;border-radius:inherit;pointer-events:none;transition:opacity 200ms ease-out;-webkit-mask-image:linear-gradient(135deg,transparent 50%,#000 50%);mask-image:linear-gradient(135deg,transparent 50%,#000 50%)`,".mp-popup-tail > .mp-attract-tip":`inset:-1px;-webkit-mask-image:linear-gradient(135deg,transparent calc(50% - 2px),#000 calc(50% - 2px));mask-image:linear-gradient(135deg,transparent calc(50% - 2px),#000 calc(50% - 2px))`,".mp-attract-pill":`position:absolute;z-index:13;left:calc(50% + (var(--mp-inset-bl, 0px) - var(--mp-inset-br, 0px)) / 2);bottom:calc(16px + var(--mp-inset-b, 0px));transform:translateX(-50%);display:none;align-items:center;gap:10px;height:36px;padding:0 16px;box-sizing:border-box;border-radius:9999px;background:rgba(9,9,11,.45);-webkit-backdrop-filter:blur(12px) saturate(1.2);backdrop-filter:blur(12px) saturate(1.2);box-shadow:0 0 0 1px rgba(255,255,255,.08),0 8px 24px rgba(0,0,0,.12);color:#fff;font:600 13px/1 Onest,sans-serif;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity 200ms ease-out`,".mp-attract-pill.mp-on":`opacity:1`,"&:has(.mp-popup-sheet) .mp-attract-pill":`left:calc(50% + (var(--mp-inset-l, 0px) - var(--mp-inset-r, 0px)) / 2);top:16px;bottom:auto`,".mp-attract-pill svg":`flex:none`,".mp-attract-sep":`width:1px;height:14px;background:rgba(255,255,255,.24)`,".mp-attract-count":`font-weight:500;font-size:12px;font-variant-numeric:tabular-nums;color:rgba(255,255,255,.75)`,".mp-attract-btn":`position:relative;width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);display:flex;align-items:center;justify-content:center;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);color:var(--mp-fg-strong);cursor:pointer;pointer-events:auto;transition:background-color 150ms ease,color 150ms ease`,".mp-attract-btn:hover":`background:var(--mp-surface-hover)`,".mp-attract-btn:focus-visible":`outline:2px solid var(--mp-accent, #1476ff);outline-offset:2px`,"&.mp-attract-pill-on":`--mp-hint-vis:hidden`});let _=document.createElement(`div`);_.style.pointerEvents=`none`,e.ui.mount(_),_.className=`mp-attract-pill`,_.setAttribute(`aria-hidden`,`true`),_.innerHTML=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"></path><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"></path><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"></path><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"></path></svg><span class="mp-attract-text"></span><span class="mp-attract-sep"></span><span class="mp-attract-count"></span>`;let v=_.querySelector(`.mp-attract-text`),y=_.querySelector(`.mp-attract-count`),b=0,x=t=>{clearTimeout(b),i.classList.toggle(`mp-attract-pill-on`,t),t?(v.textContent=e.ui.t(`touch_to_explore`),y.textContent=e.ui.t(`tour_stop`,{n:d,total:u}),_.style.display!==`flex`&&(_.style.display=`flex`,requestAnimationFrame(()=>_.classList.add(`mp-on`)))):_.style.display===`flex`&&(_.classList.remove(`mp-on`),b=setTimeout(()=>{_.style.display=`none`},220))},S=document.createElement(`button`);S.type=`button`,S.className=`mp-control mp-btn mp-attract-btn mp-edge-t mp-edge-b`,S.style.order=`5`,S.style.display=`none`,S.style.border=`0`,S.style.padding=`0`,S.innerHTML=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="6 3 20 12 6 21 6 3"></polygon></svg>`,e.ui.zone(`bottom-left`).append(S);let C=null,w=()=>{let n=t.setting(`button`)===!0&&!o&&!m&&!e.getState().editing,r=n+`:`+e.ui.t(`start_tour`);if(i.toggleAttribute(`data-mp-tour`,o||m),S.classList.toggle(`mp-hit`,!!e.ui.env().touch),r===C)return;C=r,S.style.display=n?`flex`:`none`;let a=e.ui.t(`start_tour`);S.title=a,S.setAttribute(`aria-label`,a)},T=e=>{e.classList.add(`mp-attract-out`),e.style.opacity=`0`,setTimeout(()=>e.remove(),220)},E=e=>i.querySelectorAll(`.mp-attract-bar:not(.mp-attract-out), .mp-attract-tip:not(.mp-attract-out)`).forEach(t=>e?T(t):t.remove()),D=t=>{let n=s-f,r=n>0?Math.min(1,Math.max(0,(t-f)/n)):0;if(e.ui.env().reducedMotion){let e=Math.max(1,Math.round(n/1e3));r=Math.ceil(r*e)/e}return r},O=e=>{let t=i.querySelector(`.mp-popup`);if(!t)return;let n=t.querySelector(`:scope > .mp-attract-bar:not(.mp-attract-out)`);n||(n=document.createElement(`div`),n.className=`mp-attract-bar`,n.appendChild(document.createElement(`div`)),t.appendChild(n)),n.firstChild.style.transform=`scaleX(`+e.toFixed(4)+`)`;let r=[t.querySelector(`:scope > .mp-popup-arrow`),i.querySelector(`.mp-popup-tail`)].find(e=>e&&e.offsetWidth&&getComputedStyle(e).visibility!==`hidden`);if(!r)return;let a=r.querySelector(`:scope > .mp-attract-tip:not(.mp-attract-out)`);a||(a=document.createElement(`div`),a.className=`mp-attract-tip`,r.appendChild(a));let o=t.getBoundingClientRect(),s=a.getBoundingClientRect(),c=Math.min(100,Math.max(0,(o.left+e*o.width-s.left)/s.width*100));a.style.background=`linear-gradient(45deg,var(--mp-accent, #1476ff) `+c+`%,transparent `+c+`%)`},k=()=>{E(!0),x(!1)},A=0,j=()=>{A=0,o&&(g()!==`off`&&!m&&O(D(performance.now())),A=requestAnimationFrame(j))},M=()=>{A||=requestAnimationFrame(j)},N=t=>{if(t&&S.contains(t.composedPath?t.composedPath()[0]:t.target)||t&&t.type===`keydown`&&r.includes(t.key)||t&&t.type===`wheel`&&e.view.wheelPasses&&e.view.wheelPasses(t))return;a=performance.now();let n=o||m;o&&k(),m&&(m=!1,e.view.setLevel(e.getState().level)),n&&e.view.camera({resetTilt:!0}),o=!1,w()},P=()=>{o=!0,l=[],p=0,z()||R(),w()};S.addEventListener(`click`,()=>{!o&&!m&&!e.getState().editing&&P()});let F=n=>{let r=h(`arc`)?2600:2200,i=e.getState(),a=e.data.find({id:n}),o=a&&a.level!=null&&!i.allLevels&&a.level!==i.level;return t.setting(`explode`)===!0&&o&&e.view.canExplode()?Math.max(r,3e3):r},I=()=>{l=e.data.stores().filter(e=>e.name).map(e=>e.id);for(let e=l.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[l[e],l[t]]=[l[t],l[e]]}l[l.length-1]===e.getState().selected&&l.unshift(l.pop()),u=l.length},ee=()=>{let n=Math.round(+t.setting(`overview`)||0);return n>0&&p>=n&&!m&&e.view.canExplode()},L=()=>{p=0,m=!0,E(!0),x(!1),e.view.setLevel(`all`),e.view.drift(180*c,10,20),c=-c,s=performance.now()+1e4},R=()=>{if(!e.data.stores().filter(e=>e.name).length)return;if(ee())return L();m=!1,p++,l.length||I();let n=Math.max(3,+t.setting(`hold`)||8),r=l.pop(),i=performance.now(),a=F(r);d=u-l.length;try{e.view.select({id:r},{face:!0,duration:h(`arc`)?2600:2200,arc:h(`arc`),explode:t.setting(`explode`)===!0}),h(`drift`)&&(e.view.drift(15*c,n,15),c=-c)}catch{}s=i+a+n*1e3,f=i+a,E(!1),x(g()===`pill`),M()},z=()=>{let n=e.getState().selected,r=i.querySelector(`.mp-popup`);if(!n||!r||+r.style.opacity<.5||!e.data.stores().some(e=>e.id===n&&e.name))return!1;I(),l=l.filter(e=>e!==n),d=1,p=1;let a=performance.now();return f=a,s=a+Math.max(3,+t.setting(`hold`)||8)*1e3,E(!1),x(g()===`pill`),M(),!0},te=()=>{let n=performance.now();if(w(),document.hidden)o&&k(),o=!1;else if(e.getState().editing)o&&(e.view.drift(0),k()),o=!1,m=!1,a=n;else if(o)n>=s&&R();else{let r=t.setting(`after`)===0?0:Math.min(180,Math.max(3,+t.setting(`after`)||3));r&&n-a>=r*1e3&&!e.getState().wayfindingOpen&&P()}},B=e.on(`camera`,e=>{e.mode}),V=e.on(`plugin`,()=>{w(),o&&(g()===`off`&&E(!0),x(g()===`pill`&&!m))}),H=e.on(`language`,()=>{w(),o&&g()===`pill`&&!m&&x(!0)}),ne=t.setting(`page`)===!0?window:e.ui.container;n.forEach(e=>ne.addEventListener(e,N,{capture:!0,passive:!0}));let re=setInterval(te,250);return w(),()=>{clearInterval(re),clearTimeout(b),cancelAnimationFrame(A),o&&e.view.drift(0),n.forEach(e=>ne.removeEventListener(e,N,{capture:!0})),[B,V,H].forEach(e=>e&&e()),E(!1),i.classList.remove(`mp-attract-pill-on`),i.removeAttribute(`data-mp-tour`),_.remove(),S.remove()}}),MapplicMap.plugin(`intro`,e=>{let t=e.plugin(`intro`),n=(e,n,r,i)=>{let a=+t.setting(e);return Number.isFinite(a)?Math.min(i,Math.max(r,a)):n},r=()=>e.view.approach({seconds:n(`seconds`,1.6,.5,5),height:n(`height`,5,2,12),turn:n(`turn`,30,0,180)}),i=null;e.getState().ready?r():i=e.on(`ready`,()=>{i(),i=null,r()});let a=e.on(`plugin`,t=>{t&&t.id===`intro`&&t.enabled&&e.ui.env().editor&&e.getState().ready&&r()});return()=>{i&&i(),a(),e.view.approaching()&&e.view.approach(!1)}}),MapplicMap.plugin(`drift`,e=>{let t=e.plugin(`drift`),n=[`pointerdown`,`wheel`,`keydown`,`touchstart`],r=[`Tab`,`Shift`],i=e.ui.container,a=1,o=!0,s=!1,c=0,l=(e,n,r,i)=>{let a=+t.setting(e);return Number.isFinite(a)?Math.min(i,Math.max(r,a)):n},u=()=>{c=performance.now(),!s&&(s=!0,e.view.drifting()&&e.view.drift(0))},d=t=>{t.type===`keydown`&&r.includes(t.key)||t.type===`wheel`&&e.view.wheelPasses&&e.view.wheelPasses(t)||u()},f=()=>{let t=l(`angle`,30,0,180),n=l(`seconds`,20,4,120),r=l(`tilt`,6,0,30),i=o?.5:1;e.view.drift(t*i*a,n*i,r*i*a)&&(o=!1,a=-a)},p=()=>{if(document.hidden||!e.getState().ready)return;let t=e.getState(),n=performance.now();if(!(t.editing||i.hasAttribute(`data-mp-tour`))){if(t.selected||t.routeShown||t.wayfindingOpen)return u();if(s){let e=l(`resume`,0,0,600);if(!e||n-c<e*1e3)return;s=!1,o=!0}e.ui.env().reducedMotion||e.view.drifting()||f()}};n.forEach(e=>i.addEventListener(e,d,{capture:!0,passive:!0}));let m=setInterval(p,250);return p(),()=>{clearInterval(m),n.forEach(e=>i.removeEventListener(e,d,{capture:!0})),!s&&!i.hasAttribute(`data-mp-tour`)&&e.view.drifting()&&e.view.drift(0)}}),MapplicMap.plugin(`controls`,e=>{let t=e.plugin(`controls`),n=document,r=e.ui.container,i=(e,t=2)=>MapplicMap.svgIcon(e,16,t),a={plus:i(`<path d="M5 12h14"></path><path d="M12 5v14"></path>`),minus:i(`<path d="M5 12h14"></path>`),reset:i(`<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path><path d="M3 3v5h5"></path>`),fsIn:i(`<path d="M8 3H5a2 2 0 0 0-2 2v3"></path><path d="M21 8V5a2 2 0 0 0-2-2h-3"></path><path d="M3 16v3a2 2 0 0 0 2 2h3"></path><path d="M16 21h3a2 2 0 0 0 2-2v-3"></path>`),fsOut:i(`<path d="M8 3v3a2 2 0 0 1-2 2H3"></path><path d="M21 8h-3a2 2 0 0 1-2-2V3"></path><path d="M3 16h3a2 2 0 0 1 2 2v3"></path><path d="M16 21v-3a2 2 0 0 1 2-2h3"></path>`),layers:i(`<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"></path><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"></path><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"></path>`),needle:`<svg width="24" height="24" viewBox="0 0 24 24"><path d="M12 2.5 15.5 12h-7Z" style="fill:var(--mp-fg-strong)"></path><path d="M12 21.5 8.5 12h7Z" style="fill:var(--mp-border-strong)"></path></svg>`},o=(e,t,r,i)=>{let a=n.createElement(`div`);return e&&(a.className=e),i&&(a.style.cssText=i),t&&(a.innerHTML=t),r&&(a.title=r),a};e.ui.style({".mp-control":`position:absolute;display:flex;flex-direction:column;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-surface);box-shadow:var(--mp-shadow-sm);overflow:hidden;color:var(--mp-fg-strong);pointer-events:auto`,".mp-btn":`display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--mp-surface);transition:background-color 150ms ease,color 150ms ease,opacity 180ms ease,transform 180ms ease`,".mp-btn:hover":`background:var(--mp-surface-hover)`,".mp-zoom, .mp-levels, .mp-dim, .mp-reset, .mp-compass, .mp-fullscreen":`overflow:visible`,".mp-zoom > .mp-btn, .mp-levels > .mp-btn, .mp-dim > .mp-btn":`position:relative`,".mp-control > .mp-btn.mp-edge-t":`border-top-left-radius:inherit;border-top-right-radius:inherit`,".mp-control > .mp-btn.mp-edge-b":`border-bottom-left-radius:inherit;border-bottom-right-radius:inherit`,".mp-btn.mp-hit::after":`content:'';position:absolute;left:-6px;right:-6px;top:0;bottom:0`,".mp-btn.mp-hit.mp-edge-t::after":`top:-4px`,".mp-btn.mp-hit.mp-edge-b::after":`bottom:-4px`,".mp-zoom, .mp-levels":`width:var(--mp-cs, 40px);transition:left 200ms ease,right 200ms ease,top 200ms ease,bottom 200ms ease`,".mp-zoom .mp-btn, .mp-levels .mp-btn":`height:var(--mp-cs, 40px)`,".mp-zoom-out, .mp-level + .mp-level":`border-top:1px solid var(--mp-border-subtle)`,".mp-reset, .mp-compass, .mp-fullscreen":`width:var(--mp-cs, 40px);height:var(--mp-cs, 40px);transition:background-color 150ms ease,color 150ms ease,opacity 180ms ease,transform 180ms ease,left 200ms ease,right 200ms ease,top 200ms ease,bottom 200ms ease`,".mp-compass":`perspective:80px`,".mp-needle":`width:24px;height:24px;display:flex;align-items:center;justify-content:center`,".mp-hint":`position:absolute;bottom:calc(28px + var(--mp-inset-b, 0px));visibility:var(--mp-hint-vis, var(--mp-hint-wf, visible));left:calc(var(--mp-cs, 40px) + 28px + var(--mp-inset-bl, 0px));right:calc(var(--mp-cs, 40px) + 28px + var(--mp-inset-br, 0px));font-size:12px;color:var(--mp-fg-subtle);pointer-events:none;text-align:center;text-wrap:balance`,".mp-levels":`font-size:12px;font-weight:600`,".mp-zone > .mp-control":`position:relative;left:auto;right:auto;top:auto;bottom:auto;pointer-events:auto`,".mp-dim":`width:var(--mp-cs, 40px);transition:left 200ms ease,right 200ms ease,top 200ms ease,bottom 200ms ease;font-size:12px;font-weight:600`,".mp-dim .mp-btn":`height:var(--mp-cs, 40px);color:var(--mp-fg-muted)`,".mp-dim .mp-btn + .mp-btn":`border-top:1px solid var(--mp-border-subtle)`,".mp-dim .mp-btn.mp-active, .mp-dim .mp-btn.mp-active:hover":`background:var(--mp-selected-bg);color:var(--mp-selected-fg)`,".mp-level":`color:var(--mp-fg-muted)`,".mp-ctl-tip":`position:absolute;left:0;top:0;z-index:9;height:28px;padding:0 10px;display:flex;align-items:center;gap:6px;white-space:nowrap;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-card-bg);box-shadow:0 0 0 1px var(--mp-card-ring), var(--mp-card-shadow);font-family:Onest,sans-serif;font-size:13px;font-weight:600;color:var(--mp-card-fg);pointer-events:none;opacity:0;transition:opacity 150ms ease,transform 150ms ease`,".mp-ctl-tip-arrow":`position:absolute;top:50%;width:8px;height:8px;margin-top:-4px;background:var(--mp-card-bg);box-shadow:var(--mp-arrow-ring);transform:rotate(45deg);border-radius:calc(1px * var(--mp-rk, 1))`,".mp-ctl-tip-sub":`font-weight:500;color:var(--mp-card-fg-muted)`,".mp-level.mp-active, .mp-level.mp-active:hover":`background:var(--mp-selected-bg);color:var(--mp-selected-fg)`,'&[data-mp-glass-ctl="1"] .mp-control':`background:var(--mp-ctl-glass);-webkit-backdrop-filter:var(--mp-ctl-blur);backdrop-filter:var(--mp-ctl-blur);box-shadow:0 0 0 1px var(--mp-ctl-ring), var(--mp-shadow-sm)`,'&[data-mp-glass-ctl="1"] .mp-control .mp-btn':`background:transparent`,'&[data-mp-glass-ctl="1"] .mp-control .mp-btn:hover, &[data-mp-glass-ctl="1"] .mp-control.mp-btn:hover':`background:var(--mp-ctl-glass-hover)`,'&[data-mp-glass-ctl="1"] .mp-control .mp-btn.mp-active, &[data-mp-glass-ctl="1"] .mp-control .mp-btn.mp-active:hover':`background:var(--mp-selected-bg)`});let s=(e,t,n,r)=>{let i=o(`mp-control mp-btn `+e,t,n);return i.addEventListener(`click`,r),i},c=e.ui.mount(o(`mp-controls`,``,``,`position:absolute;inset:0;pointer-events:none;font-family:Onest,sans-serif;z-index:8`)),l=e.ui.mount(o(`mp-controls mp-controls-edit`,``,``,`position:absolute;inset:0;pointer-events:none;font-family:Onest,sans-serif;display:none`),{layer:`top`,editing:!0}),u=o(`mp-control mp-zoom`),d=o(`mp-btn mp-zoom-in`,a.plus,e.ui.t(`zoom_in`)),f=o(`mp-btn mp-zoom-out`,a.minus,e.ui.t(`zoom_out`));d.onclick=()=>e.view.camera({zoom:1.4}),f.onclick=()=>e.view.camera({zoom:1/1.4}),u.append(d,f);let p=s(`mp-reset`,a.reset,e.ui.t(`reset_view`),()=>{e.view.camera({reset:!0}),e.view.deselect()}),m=s(`mp-compass`,``,e.ui.t(`reset_rotation`),()=>e.view.camera({resetRotation:!0})),h=o(`mp-needle`,a.needle);m.append(h);let g=o(`mp-control mp-dim`),_=o(`mp-btn mp-dim-3d`,`3D`,e.ui.t(`view_3d`)),v=o(`mp-btn mp-dim-2d`,`2D`,e.ui.t(`view_2d`));_.onclick=()=>e.view.camera({mode:`3d`}),v.onclick=()=>e.view.camera({mode:`2d`}),g.append(_,v);let y=()=>{try{return e.view.camera({}).mode===`2d`}catch{return!1}},b=null,x=e=>{_.classList.toggle(`mp-active`,e!==`2d`),v.classList.toggle(`mp-active`,e===`2d`),e!==b&&(b=e,oe())},S=!1,C=``,w=null,T=()=>{let e=r.parentElement;return e&&[...e.children].some(e=>e.classList.contains(`mp-dock`)&&!e.classList.contains(`mp-dock-below`))?e:r},E=()=>!!(n.fullscreenElement||n.webkitFullscreenElement)||S,D=e=>{S=e,e?(w=T(),C=w.style.cssText,Object.assign(w.style,{position:`fixed`,inset:`0`,height:`auto`,borderRadius:`0`,zIndex:`1000`}),n.body.style.overflow=`hidden`):(w&&(w.style.cssText=C||w.style.cssText),w=null,n.body.style.overflow=``),k()},O=s(`mp-fullscreen`,a.fsIn,e.ui.t(`full_screen`),()=>{if(n.fullscreenElement||n.webkitFullscreenElement)return(n.exitFullscreen||n.webkitExitFullscreen).call(n);if(S)return D(!1);let e=T(),t=e.requestFullscreen||e.webkitRequestFullscreen,r;try{r=t&&t.call(e)}catch{r=null}t?r&&r.catch&&r.catch(()=>D(!0)):D(!0)}),k=()=>{let t=E();O.innerHTML=t?a.fsOut:a.fsIn,O.title=e.ui.t(t?`exit_full_screen`:`full_screen`)},A=e=>{e.key===`Escape`&&S&&D(!1)};n.addEventListener(`fullscreenchange`,k),n.addEventListener(`webkitfullscreenchange`,k),n.addEventListener(`keydown`,A);let j=o(`mp-hint`),M=o(`mp-control mp-levels`),N=o(`mp-btn mp-level mp-level-all`,a.layers,e.ui.t(`all_levels`));N.onclick=()=>{let t=e.getState();e.view.setLevel(t.allLevels?t.level:`all`)};let P=e.data.levels().slice().reverse().map(t=>{let n=o(`mp-btn mp-level`,t.short);return n.setAttribute(`aria-label`,t.name),n.onclick=()=>e.view.setLevel(t.index),n._lv=t.index,n._name=t.name,n.addEventListener(`pointerenter`,()=>{R=n,te()}),n.addEventListener(`pointerleave`,()=>{R===n&&(R=null),te()}),n});M.append(N,...P);let F=o(`mp-ctl-tip`),I=n.createElement(`span`),ee=n.createElement(`span`),L=o(`mp-ctl-tip-arrow`);ee.className=`mp-ctl-tip-sub`,F.append(I,ee,L);let R=null,z=null,te=()=>{let t=e.getState(),n=null,r=``,i=``;if(R)n=R,r=R._name;else if(z&&!t.allLevels){let a=e.data.stores().find(e=>e.id===z)||e.data.feature(z);a&&typeof a.level==`number`&&a.level!==t.level&&(n=P.find(e=>e._lv===a.level)||null,r=a.name||``,i=n?n._name:``)}if(!n||!r||M.style.display===`none`){F.style.opacity=`0`;return}I.textContent=r,ee.textContent=i,ee.style.display=i?``:`none`;let a=c.getBoundingClientRect(),o=n.getBoundingClientRect(),s=M.getBoundingClientRect(),l=s.left+s.width/2<a.left+a.width/2,u=o.top-a.top+o.height/2;L.style.left=l?`-4px`:``,L.style.right=l?``:`-4px`,L.style.setProperty(`--mp-arrow-ring`,(l?`-1px 1px`:`1px -1px`)+` 0 0 var(--mp-card-ring)`);let d=l?s.right-a.left+10:s.left-a.left-10;F.style.transform=`translate(`+(l?`0`:`-100%`)+`, -50%) translate(`+d+`px,`+u+`px)`,F.style.opacity=`1`};e.on(`hover`,e=>{z=e||null,te()}),e.onFrame(()=>{(R||z)&&te()});let B=()=>{let t=e.getState(),n=(e,t)=>e.classList.toggle(`mp-active`,t);n(N,t.allLevels),P.forEach(e=>n(e,!t.allLevels&&t.level===e._lv))};c.append(u,p,j,M,F);let V=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],H=e.ui.zone(`bottom-left`),ne=[{key:`levels`,el:M,def:`top-right`,top:10,bottom:60,zone:null},{key:`fullscreen`,el:O,def:`bottom-left`,top:20,bottom:50,zone:10},{key:`dimension`,el:g,def:`bottom-left`,top:30,bottom:40,zone:20},{key:`compass`,el:m,def:`bottom-left`,top:40,bottom:30,zone:30},{key:`reset`,el:p,def:`bottom-right`,top:50,bottom:20,zone:5},{key:`zoom`,el:u,def:`bottom-right`,top:60,bottom:10,zone:40}],re=e=>{let n=t.setting(e.key+`_position`);return V.includes(n)?n:e.def},ie=t=>{ne.forEach(n=>{let r=n.at=re(n),i=n.el;if(r===`bottom-left`&&n.zone!=null){n.spot&&n.spot.remove(),n.spot=null,i.style.order=String(n.zone),i.parentNode!==H&&H.append(i);return}let a=i===M&&t?l:c;i.parentNode!==a&&a.append(i),i===M&&F.parentNode!==a&&a.append(F),i.style.order=``;let o={anchor:r,order:r.startsWith(`top`)?n.top:n.bottom};n.spot?n.spot.update(o):n.spot=e.ui.slot(i,o)})},ae=e.ui.slot(null,{anchor:`bottom-left`}),oe=()=>{let n=e.ui.env(),i=e=>t.enabled()&&!!t.setting(e);r.style.setProperty(`--mp-cs`,`32px`);let a=y(),o=!!e.getState().editing;ie(o),l.style.display=o?`block`:`none`,N.style.display=o||b===`2d`||!e.view.canExplode()?`none`:``,j.textContent=e.ui.t((n.touch?`hint_touch`:n.wheel===`off`?`hint_mouse_off`:n.ctrlZoom?`hint_mouse_ctrl`:`hint_mouse`)+(a?`_2d`:``));let s=!!(e.view.locked&&e.view.locked()),c={zoom:i(`zoom`)&&!s,reset:i(`reset`)&&!s,compass:i(`compass`)&&!a&&!s,dim:t.enabled()&&t.setting(`dimension`)!==!1,full:i(`fullscreen`),hint:i(`hint`)&&!n.narrow,levels:(o?t.enabled():i(`levels`))&&P.length>1};u.style.display=c.zoom?`flex`:`none`,p.style.display=c.reset?`flex`:`none`,m.style.display=c.compass?`flex`:`none`,g.style.display=c.dim?`flex`:`none`,O.style.display=c.full?`flex`:`none`,M.style.display=c.levels?`flex`:`none`;let h=H.offsetHeight;ae.update({width:h?H.offsetWidth:0,height:h}),ne.some(e=>e.at===`bottom-center`&&e.el.style.display!==`none`)&&(c.hint=!1),s&&(c.hint=!1),j.style.display=c.hint?`block`:`none`,[u,M,g].forEach(se),[p,m,O].forEach(e=>e.classList.add(`mp-edge-t`,`mp-edge-b`)),[d,f,p,m,_,v,O,N,...P].forEach(e=>e.classList.toggle(`mp-hit`,!!n.touch)),U()},se=e=>{let t=Array.from(e.children).filter(e=>e.style.display!==`none`);Array.from(e.children).forEach(e=>{e.classList.toggle(`mp-edge-t`,e===t[0]),e.classList.toggle(`mp-edge-b`,e===t[t.length-1])})},U=()=>{let e=r.clientHeight;if(!e)return;let t=e=>e.el.style.display!==`none`&&e.el.offsetParent!==null,n=e;[`left`,`center`,`right`].forEach(r=>{let i=ne.filter(e=>e.at&&e.at.endsWith(r)&&t(e)),a=16,o=r===`left`?H.offsetHeight:0;i.forEach(e=>{e.at.startsWith(`top`)?a=Math.max(a,e.el.offsetTop+e.el.offsetHeight):e.spot&&(o+=(o?8:0)+e.el.offsetHeight)}),o&&(n=Math.min(n,e-a-8-16-o))}),r.style.setProperty(`--mp-room-b`,Math.max(0,Math.floor(n))+`px`)},ce=0,le=window.ResizeObserver?new ResizeObserver(()=>{cancelAnimationFrame(ce),ce=requestAnimationFrame(U)}):null;le&&[r,...ne.map(e=>e.el)].forEach(e=>le.observe(e));let ue=window.ResizeObserver?new ResizeObserver(()=>requestAnimationFrame(oe)):null;ue&&ue.observe(H);let de=t=>{let n=e.ui.env().reducedMotion;x(t.mode);let r=e.data.north?e.data.north():0;h.style.transform=`rotateX(`+(t.tilt*.6).toFixed(1)+`deg) rotate(`+(-t.rotation-r).toFixed(1)+`deg)`,p.style.opacity=t.home?`0`:`1`,p.style.pointerEvents=t.home?`none`:`auto`,p.style.transform=t.home&&!n?`translateY(4px)`:`none`};p.style.opacity=`0`,p.style.pointerEvents=`none`,oe(),B(),k(),x(y()?`2d`:`3d`),e.on(`plugin`,oe),e.on(`layout`,oe),e.on(`level`,()=>{B(),te()});let fe=null;return e.on(`camera`,t=>{let n=!!(e.view.locked&&e.view.locked());n!==fe&&(fe=n,oe()),de(t)}),()=>{le&&le.disconnect(),ue&&ue.disconnect(),ne.forEach(e=>e.el.remove()),cancelAnimationFrame(ce),r.style.removeProperty(`--mp-room-b`),n.removeEventListener(`fullscreenchange`,k),n.removeEventListener(`webkitfullscreenchange`,k),n.removeEventListener(`keydown`,A),S&&D(!1)}}),MapplicMap.SEARCH={prompt(e,t){let n=e=>String(e??``).replace(/[|\n\r]+/g,` `).trim(),r=t.places.map(e=>[e.id,n(e.name),e.categories.join(`,`),e.level,(e.keywords||[]).map(n).join(`,`),n(MapplicMap.plainText(e.description)),Object.entries(e.details||{}).map(([e,t])=>e+`=`+n(t)).join(`, `)].join(`|`));return{system:`You turn a visitor question about a venue into a search query for its map. Reply with one JSON object and nothing else. Keys, all optional: "ids" (place ids from the list that answer the question), "category" (category ids), "level" (level indexes), "open" (true when they want places open now), "amenity" (amenity keys), "route" ({ "from": place id or null, "to": place id } when they ask how to get somewhere), "text" (words to search for), "note" (one short sentence, at most 12 words, shown to the visitor, saying what you found). Prefer "ids" when specific places clearly fit, judging by name, category, keywords, description and details. Details are key=value facts; compare numbers when the question asks (over, under, at least, between, cheapest, largest) and list every place that fits. Only use ids, categories, levels and amenities from the context. If nothing fits, reply {}.`,user:`Categories (id|name): `+t.categories.map(e=>e.id+`|`+e.name).join(`; `)+`
4157
4191
  Levels (index|name): `+t.levels.map(e=>e.index+`|`+e.name).join(`; `)+`
4158
4192
  Amenities: `+t.amenities.join(`, `)+`
4159
4193
  Opening hours known: `+(t.openNow?`yes`:`no`)+`
@@ -4161,5 +4195,5 @@ Places (id|name|categories|level|keywords|description|details):
4161
4195
  `+r.join(`
4162
4196
  `)+`
4163
4197
 
4164
- Question: `+t.question}},fromText(e){return async(t,n)=>{let r=MapplicMap.SEARCH.prompt(t,n);return e({system:r.system,messages:[{role:`user`,content:r.user}],max_tokens:1e3})}}},MapplicMap.plugin(`search`,e=>{let t=e.plugin(`search`),n=document,r=e=>t.setting(e),i=(t,n)=>e.ui.t(t,n),a=`var(--mp-shadow-sm)`,o=MapplicMap.svgIcon,s={search:o(`<circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path>`),x:o(`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`,14),filter:o(`<path d="M10 5H3"></path><path d="M12 19H3"></path><path d="M14 3v4"></path><path d="M16 17v4"></path><path d="M21 12h-9"></path><path d="M21 19h-5"></path><path d="M21 5h-7"></path><path d="M8 10v4"></path><path d="M8 12H3"></path>`),chevron:o(`<path d="m6 9 6 6 6-6"></path>`,14),route:o(`<circle cx="6" cy="19" r="3"></circle><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"></path><circle cx="18" cy="5" r="3"></circle>`),check:o(`<path d="M20 6 9 17l-5-5"></path>`,14),tag:o(`<path d="M12.6 2.6A2 2 0 0 0 11.2 2H4a2 2 0 0 0-2 2v7.2a2 2 0 0 0 .6 1.4l8.7 8.7a2.4 2.4 0 0 0 3.4 0l6.6-6.6a2.4 2.4 0 0 0 0-3.4z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>`)},c=(e,t,r)=>{let i=n.createElement(e);return t&&(i.className=t),r!=null&&(i.innerHTML=r),i},l=MapplicMap.escapeHtml,u=e=>String(e??``).toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\p{L}\p{N}\s]/gu,` `).replace(/\s+/g,` `).trim(),d=e=>u(e).split(` `).filter(Boolean),f=(e,t,n)=>{if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),i>1&&n>1&&e[i-1]===t[n-2]&&e[i-2]===t[n-1]&&(a[n]=Math.min(a[n],r[n-2]+1)),o=Math.min(o,a[n])}if(o>n)return n+1;r=a}return r[t.length]},p=MapplicMap.PLACE.SYNONYMS,m=[],h={},g=[],_={},v=[],y={},b={},x=()=>e.data.levels(),S=()=>r(`position`)||`top-left`,C=()=>{try{return e.plugin(`hours`).enabled()}catch{return!1}},w=()=>{try{return e.plugin(`wayfinding`).enabled()}catch{return!1}},T=()=>{try{return e.plugin(`directory`).enabled()}catch{return!1}},E=(()=>{let t=null;return e.on(`units`,()=>{t=null}),n=>(t||=Object.fromEntries(e.data.units().map(e=>[e.id,e.logo||e.thumb||null])),t[n]||null)})(),D=(e,t)=>e?t[e]?e:Object.keys(t).find(n=>t[n].label===e||t[n].name===e)||String(e).toLowerCase():`amenity`,O=()=>{let t=e.data.section(`categories`)||[],n=Object.fromEntries(t.map(e=>[e.id,e.kind||`store`])),r=e.data.amenityTypes(),i=e.data.section(`search`)||{};g=t.map(e=>e.id),_=Object.fromEntries(t.map(e=>[e.id,e])),v=t.filter(e=>e.kind!==`service`).map(t=>({id:t.id,words:d([t.name,e.data.categoryName(t.name),t.id.replace(/[-_]/g,` `)].concat([].concat(t.keywords||[]).flatMap(e=>String(e).split(/[;,]/))).join(` `)).filter(e=>e.length>=3&&e!==`and`)})),y={},b={};let a=(e,t)=>{let n=u(e);(t||[]).forEach(e=>{let t=u(e);t&&t!==n&&((b[n]=b[n]||new Set).add(t),(b[t]=b[t]||new Set).add(n))})};Object.entries(i.synonyms||{}).forEach(([e,t])=>a(e,[].concat(t))),m=[],h={},e.data.stores().map(e=>[e,`store`]).concat(e.data.amenities().map(e=>[e,`amenity`])).forEach(([i,a])=>{if(h[i.id])return;let o=i.location&&e.data.location(i.location)||{},s=!o.category&&a===`amenity`?MapplicMap.PLACE.amenityCategory(D(i.type,r),r,t):null,c=MapplicMap.PLACE.categoriesOf(o),l=c[0]||(a===`amenity`?s?s.id:`amenity`:null);if(c.length&&c.every(e=>n[e]===`service`))return;let f=MapplicMap.PLACE.groupCats(c,a===`amenity`,n),g=o.amenity||(a===`amenity`?D(i.type,r):null),v=g?r[g]||{}:null,y=[].concat(o.keywords||[],o.tags||[]).flatMap(e=>String(e).split(/[;,]/)).concat(v?[v.name,v.label]:[],g&&p[g]||[],g?[g]:[]),b={id:i.id,info:i,place:i.location?`loc:`+i.location:i.id,name:i.name,kind:g?`amenity`:`store`,amenity:g,category:l,categories:f,categoryName:a===`amenity`&&!o.category?v&&v.name||i.type||``:c.length>1?c.map(t=>_[t]&&e.data.categoryName(_[t].name)||t).join(`, `):i.category||``,level:i.level,hours:i.hours,location:o,n:{name:u(i.name),nameWords:d(i.name),keywords:d(y.join(` `)),category:d([i.category].concat(f.map(e=>_[e]&&_[e].name||``),f.slice(1).map(t=>_[t]&&e.data.categoryName(_[t].name)||t)).join(` `)),description:u(MapplicMap.plainText(i.description))}};m.push(b),h[b.id]=b})},k=e=>[e].concat(b[e]?[...b[e]]:[]),A=(e,t)=>{let n=e.n,i=0;if(k(t).forEach((e,t)=>{let r=t?.9:1,a=0,o=e.includes(` `);n.name.startsWith(e)?a=60:!o&&n.nameWords.some(t=>t.startsWith(e))?a=45:e.length>2&&n.name.includes(e)&&(a=30),(o?n.keywords.join(` `).includes(e):n.keywords.some(t=>t.startsWith(e)))&&(a=Math.max(a,36)),n.category.some(t=>t.startsWith(e))&&(a=Math.max(a,28)),!a&&e.length>=3&&n.description.includes(e)&&(a=10),i=Math.max(i,a*r)}),!i&&r(`fuzzy`)&&t.length>=4){let e=t.length>=7?2:1;n.nameWords.concat(n.keywords,n.category).some(n=>f(n,t,e)<=e||f(n.slice(0,t.length),t,e)<=e)&&(i=18)}return i},j=(e,t,n)=>{let r=0;for(let n of t){let t=A(e,n);if(!t)return 0;r+=t}return n&&e.n.name===n&&(r+=100),r},M=(e,t)=>{if(!e||typeof e!=`object`)return null;let n=e.source||(e.field?`field`:null);if(![`category`,`amenity`,`level`,`open_now`,`field`].includes(n)||n===`open_now`&&!C())return null;let r=e.type||(n===`open_now`?`toggle`:`chips`);return Object.assign({},e,{id:String(e.id||n+`-`+t),source:n,type:r,multi:e.multi!==!1})},N=()=>{let t=(e.data.section(`search`)||{}).filters;if(Array.isArray(t))return t.map(M).filter(Boolean);let n=[];return r(`filter_open`)&&n.push({id:`open`,source:`open_now`,type:`toggle`}),r(`filter_category`)&&n.push({id:`category`,source:`category`,type:`chips`,multi:!0}),n.map(M).filter(Boolean)},P=(e,t)=>String(t||``).split(`.`).reduce((e,t)=>e?.[t],e.location),F=(e,t)=>{if(t.source===`category`)return e.category&&!e.categories.includes(e.category)?e.categories.concat(e.category):e.categories;if(t.source===`level`)return[e.level];if(t.source===`amenity`)return[e.amenity];if(t.source===`field`){let n=P(e,t.field);return Array.isArray(n)?n:typeof n==`string`?n.split(/[;,]/).map(e=>e.trim()):[n]}return[]},I=null,ee=t=>{if(I||={},!(t in I))try{let n=e.plugin(`hours`).status(h[t]?h[t].info:{id:t});I[t]=n.state===`open`||n.state===`closing`}catch{I[t]=!1}return I[t]},L=e=>e==null||e===``||e===!1||Array.isArray(e)&&!e.length,R=(e,t,n)=>{if(L(n))return!0;if(t.source===`open_now`)return ee(e.id);if(t.type===`toggle`){let n=t.value===void 0||t.value;return F(e,t).some(e=>n===!0?!!e&&e!==`false`&&e!==`0`:String(e)===String(n))}let r=F(e,t).map(String);return[].concat(n).some(e=>r.includes(String(e)))},z=t=>{if(t.options)return t.options.map(e=>typeof e==`object`?e:{value:e,label:String(e)});if(t.source===`category`){let n={};m.forEach(t=>t.categories.forEach((r,a)=>{n[r]||(n[r]=r===`amenity`?i(`directory_amenities`):_[r]&&e.data.categoryName(_[r].name)||(a?``:t.categoryName)||r)}));let r=e=>g.includes(e)?g.indexOf(e):999;return Object.keys(n).filter(e=>!(t.include&&!t.include.includes(e))).sort((e,t)=>r(e)-r(t)).map(e=>({value:e,label:n[e],cat:_[e]||null}))}if(t.source===`level`){let e=new Set(m.map(e=>e.level));return x().filter(t=>e.has(t.index)).map(e=>({value:e.index,label:e.name}))}if(t.source===`amenity`){let t=e.data.amenityTypes();return[...new Set(m.map(e=>e.amenity).filter(Boolean))].map(n=>({value:n,label:(t[n]||{}).name||n,cat:MapplicMap.PLACE.amenityCategory(n,t,e.data.section(`categories`)||[])}))}return[]},te=e=>e.label?e.label:i({category:`search_categories`,open_now:`search_open_now`,amenity:`search_places`,level:`search_level`}[e.source]||`search_filters`),B=e.memory,V=B.state=B.state||{text:``,values:{},scope:{}};V.scope=V.scope||{};let H={category:`category`,amenity:`amenity`,level:`level`,open:`open_now`},ne=e=>Object.keys(V.scope).every(t=>R(e,{source:H[t],type:`chips`},V.scope[t])),re=[],ie=[],ae={},oe=[],se=null,U=null,ce=new Set(`where whereabouts is are the a an i im can could would will find get buy to for me some any with on in at please show what which there that sell sells selling looking look need want do does have has go near nearest closest something somewhere of and or my place places shop shops store stores located get`.split(` `)),le={first:1,second:2,third:3,fourth:4,fifth:5,one:1,two:2,three:3,four:4,five:5},ue=/^(level|floor|lvl|storey|story)$/,de=[`now`,`currently`,`right`,`still`],fe=e=>e.replace(/ies$/,`y`).replace(/(?<=[^s])s$/,``),pe=e=>{let t=x();if(!e)return null;let n=t.find(t=>u(t.short)===e||u(t.name)===e);if(n)return n;if(/^(ground|gf)$/.test(e))return t.find(e=>/^g/i.test(e.short||``)||/ground/i.test(e.name||``));if(e===`basement`)return t.find(e=>/^b/i.test(e.short||``)||/basement/i.test(e.name||``));let r=e.match(/^(\d+)(st|nd|rd|th)?$/),i=r?r[1]:le[e]==null?null:String(le[e]);return i==null?null:t.find(e=>u(e.short)===`l`+i||u(e.short)===i||d(e.name).includes(i))||null},me=e=>{let t=d(e),n=t.map(()=>!1),r={source:`rules`},i=(e,t)=>{r[e]=r[e]||[],r[e].includes(t)||r[e].push(t)};t.forEach((e,a)=>{if(!n[a]){if(e===`open`&&C())r.open=!0,n[a]=!0,[a-1,a+1,a+2].forEach(e=>{de.includes(t[e])&&(n[e]=!0)});else if(ue.test(e)){let e=pe(t[a+1]),r=!e&&pe(t[a-1]);(e||r)&&(i(`level`,(e||r).index),n[a]=n[e?a+1:a-1]=!0)}else if(/^l\d+$/.test(e)||/^(ground|basement)$/.test(e)){let t=pe(e);t&&(i(`level`,t.index),n[a]=!0)}else if(e.length>=3&&!ce.has(e)){let t=v.find(t=>t.words.some(t=>t===e||fe(t)===fe(e)));t&&(i(`category`,t.id),n[a]=!0)}}});let a=t.filter((e,t)=>!n[t]&&!ce.has(e));return!a.length&&!r.open&&!r.level&&!r.category||a.length===t.length?null:(r.text=a.join(` `),r)},he=/^(?:(?:please )?(?:show|find|give|get|plan|draw)(?: me)? )?(?:the |a )?(?:route|routes|directions?|way|path|walking route|navigation)\b/,ge=e=>{let t=d(e).filter(e=>!ce.has(e)),n=t.join(` `);if(!t.length)return null;let r=null,i=0;return m.forEach(e=>{let a=j(e,t,n);a>i&&(i=a,r=e)}),r},_e=e=>{let t=u(e),n=null,r=null,i;if((i=t.match(/^(?:how (?:do|can|would|should) (?:i|we) (?:get|go|walk)|take me|walk me|navigate|go|walk|get me)\s+to (.+?)(?: from (.+))?$/))?[r,n]=[i[1],i[2]||null]:(i=t.match(/^(?:.*?\b(?:route|routes|directions?|way|path|navigate|navigation)\s+)?from (.+?) to (.+)$/))?(he.test(t)||/^from /.test(t))&&([n,r]=[i[1],i[2]]):(i=t.match(/^.*?\b(?:route|routes|directions?|way|path)\s+to (.+?)(?: from (.+))?$/))&&([r,n]=[i[1],i[2]||null]),!r)return null;let a=n?ge(n):null,o=ge(r);return!o||n&&!a||a&&a.place===o.place?null:{source:`rules`,route:{from:a?a.id:null,to:o.id},ids:[a,o].filter(Boolean).map(e=>e.id)}},ve=async t=>{let n=t&&t.route;if(!n||!n.to||!w())return!1;let r=e.plugin(`wayfinding`),i=e=>h[e]&&h[e].amenity?h[e].name:{id:e};try{n.from?await r.show({id:n.from},i(n.to)):r.to(i(n.to))}catch(e){return console.warn(`mapplic search route:`,e),!1}return!0},ye=async()=>{let e=U;if(!e||!e.route)return!1;let t=await ve(e);return t&&Ne(``),t},be=e=>{let t=e=>`\0`+e+``,n=e.from?i(`search_route`,{from:t(e.from),to:t(e.to)}):i(`search_route_to`,{to:t(e.to)});return l(n).replace(/\u0000(.*?)\u0001/g,(e,t)=>`<b>`+l((h[t]||{name:t}).name)+`</b>`)},xe=e=>{let t=d(e.text||``),n=u(e.text||``),r=e.ids?new Set(e.ids):null,i=t=>re.every(e=>R(t,e,V.values[e.id]))&&ne(t)&&Object.keys(H).every(n=>L(e[n])||R(t,{source:H[n],type:`chips`},e[n]))&&(!r||r.has(t.id)||r.has(t.info.location));return m.map(e=>({e,score:t.length?j(e,t,n):1})).filter(e=>e.score&&i(e.e)).sort((e,t)=>t.score-e.score||e.e.name.localeCompare(t.e.name))},W=null,G=()=>W||MapplicMap.smartSearch||null,Se=()=>!!r(`smart`)&&typeof G()==`function`,Ce=e=>{let t={};return!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).forEach(n=>{let r=e[n];Object.keys(t).length>=12||(typeof r==`number`&&isFinite(r)||typeof r==`boolean`?t[n]=r:typeof r==`string`&&r.trim()&&r.length<=60&&(t[n]=r.trim()))}),t},K=e=>{let t=new Set,n=[],r=6e4;return m.forEach(e=>{if(t.has(e.place)||n.length>=600)return;t.add(e.place);let i=e.location||{},a={id:e.id,name:e.name,categories:e.categories.slice(),level:e.level,keywords:[].concat(i.keywords||[],i.tags||[]).flatMap(e=>String(e).split(/[;,]/)).map(e=>e.trim()).filter(Boolean)};if(r>0){let e=typeof i.description==`string`?i.description.replace(/<[^>]*>/g,` `).replace(/\s+/g,` `).trim():``;e&&(a.description=e.length>120?e.slice(0,119)+`…`:e);let t=Ce(i.data);Object.keys(t).length&&(a.details=t),r-=(a.description||``).length+JSON.stringify(a.details||``).length}n.push(a)}),{question:e,categories:Object.values(_).filter(e=>e.kind!==`service`).map(e=>({id:e.id,name:e.name||e.id})),levels:x().map(e=>({index:e.index,name:e.name,short:e.short})),amenities:[...new Set(m.map(e=>e.amenity).filter(Boolean))],openNow:C(),places:n}},we=e=>{let t=e;if(typeof t==`string`){let e=t.match(/\{[\s\S]*\}/);try{t=e?JSON.parse(e[0]):null}catch{t=null}}if(!t||typeof t!=`object`)return null;let n={source:`smart`},r=e=>[].concat(e??[]);t.text&&(n.text=String(t.text).slice(0,80));let i=r(t.category).filter(e=>_[e]||e===`amenity`);i.length&&(n.category=i);let a=r(t.level).map(Number).filter(e=>x().some(t=>t.index===e));a.length&&(n.level=a),t.open===!0&&C()&&(n.open=!0);let o=r(t.amenity).filter(e=>m.some(t=>t.amenity===e));o.length&&(n.amenity=o);let s=r(t.ids).filter(e=>h[e]||m.some(t=>t.info.location===e));s.length&&(n.ids=s);let c=e=>h[e]?e:(m.find(t=>t.info.location===e)||{}).id||null;return t.route&&typeof t.route==`object`&&c(t.route.to)&&w()&&(n.route={from:t.route.from?c(t.route.from):null,to:c(t.route.to)},n.ids=[n.route.from,n.route.to].filter(Boolean)),!n.text&&!n.category&&!n.level&&!n.open&&!n.amenity&&!n.ids&&!n.route?null:(t.note&&(n.note=String(t.note).slice(0,160)),n)},Te=async()=>{let e=V.text,t=e.trim();if(!t||!Se())return null;if(y[e]&&y[e].status!==`error`)return y[e].query||null;y[e]={status:`loading`},Ee();try{let n=we(await G()(t,K(t)));y[e]=n?{status:`done`,query:n}:{status:`none`}}catch(t){console.warn(`mapplic smart search:`,t),y[e]={status:`error`}}return V.text===e&&Ee(),y[e].query||null},Ee=()=>{I=null,re=N(),Object.keys(V.values).forEach(e=>{re.some(t=>t.id===e)||delete V.values[e]}),oe=d(V.text);let t=u(V.text),n={};m.forEach(e=>{n[e.id]=oe.length?j(e,oe,t):1});let i=(e,t)=>re.every(n=>n.id===t||R(e,n,V.values[n.id]))&&ne(e);if(ie=m.filter(e=>n[e.id]&&i(e)).map(e=>({e,score:oe.length?n[e.id]:0})).sort((e,t)=>t.score-e.score||e.e.name.localeCompare(t.e.name)),ae={},re.forEach(e=>{let t=ae[e.id]={},r=new Set,a=(e,n)=>{let i=e+`|`+n.place;r.has(i)||(r.add(i),t[e]=(t[e]||0)+1)};(e.source===`open_now`||e.type===`toggle`)&&(t.true=0),m.forEach(t=>{n[t.id]&&i(t,e.id)&&(e.source===`open_now`?ee(t.id)&&a(`true`,t):e.type===`toggle`?R(t,e,!0)&&a(`true`,t):F(t,e).forEach(e=>a(e,t)))})}),U=null,oe.length&&!ie.length){let e=y[V.text],t=e&&e.status===`done`?e.query:r(`intents`)?w()&&_e(V.text)||me(V.text):null;if(t){let n=xe(t);n.length?(ie=n,U=t):e&&e.status===`done`&&(e.status=`none`)}}let a=Me();if(se=a&&!ie.length?Ve():null,r(`highlight`)&&a&&ie.length<m.length){let t=(r(`highlight_tint`)===!1?[]:ze().category||[]).map(e=>_[e]).filter(e=>e&&e.color),n=ie.slice(0,300),i={};t.length&&n.forEach(e=>{let n=t.find(t=>(e.e.categories||[]).includes(t.id)||e.e.category===t.id);n&&(i[e.e.id]=n.color)}),e.view.highlight(n.map(e=>e.e.id),Object.keys(i).length?{colors:i}:void 0)}else e.view.highlight([]);ke(a),e.announce(`search`,{text:V.text,filters:JSON.parse(JSON.stringify(V.values)),ids:ie.map(e=>e.e.id),count:Ae(ie),total:Ae(m),active:a,query:ze(),interpreted:U?Re(U):null}),ot.forEach(e=>e.paint()),Ke()},De=``,Oe=null,ke=t=>{let n=ze(),i=t&&!n.text.trim()&&Object.keys(n).every(e=>e===`text`||e===`category`)&&n.category?n.category.join(`|`):``;if(i===De)return;De=i;let a=e.getState();if(!i){Oe!=null&&a.allLevels&&e.view.setLevel(Oe),Oe=null;return}if(r(`fit_category`)===!1||!a.ready)return;let o=new Set(ie.map(e=>e.e.id)),s=e.data.units().filter(e=>!e.hidden&&e.interactive),c=s.filter(e=>o.has(e.id));if(!c.length||c.length>s.length*.6)return;let l={};c.forEach(e=>(l[e.level]=l[e.level]||[]).push(e));let u=Object.keys(l).map(Number);if(u.length>1){if(a.allLevels)return;if(e.view.showAll()===`all`){Oe=a.level;return}}Oe=null;let d=u.sort((e,t)=>l[t].length-l[e].length)[0],f=l[d],p=f.flatMap(e=>e.box),m=e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return[Math.max(...t)-Math.min(...t),Math.max(...n)-Math.min(...n)]},h=m(p),g=m(s.filter(e=>e.level===d).flatMap(e=>e.box));f.length>1&&h[0]>g[0]*.85&&h[1]>g[1]*.85?(a.allLevels||a.level!==d)&&e.view.setLevel(d):e.view.fit(d,p,{fill:f.length===1?.4:.8})},Ae=e=>new Set(e.map(e=>(e.e||e).place)).size,je=()=>re.filter(e=>!L(V.values[e.id])).length+Object.keys(V.scope).length,Me=()=>!!oe.length||je()>0,Ne=e=>{e=String(e??``),e!==V.text&&(V.text=e,Ee())},Pe=(e,t)=>{let n=re.find(t=>t.id===e);if(!n)throw Error(`No filter "`+e+`". Filters: `+re.map(e=>e.id).join(`, `));L(t)?delete V.values[e]:V.values[e]=n.type===`chips`&&n.multi?[].concat(t):t,Ee()},Fe=(e,t)=>{let n=V.values[e.id];if(e.type===`toggle`)return Pe(e.id,!n);if(e.type===`select`)return Pe(e.id,t===``?null:t);if(!e.multi)return Pe(e.id,n&&n[0]===t?null:[t]);let r=[].concat(n||[]),i=r.findIndex(e=>String(e)===String(t));i>=0?r.splice(i,1):r.push(t),Pe(e.id,r)},Ie=()=>{V.text=``,V.values={},V.scope={},Ee()},Le=()=>{V.values={},V.scope={},Ee()},Re=e=>JSON.parse(JSON.stringify(e)),ze=()=>{let e={text:V.text};Object.keys(H).forEach(t=>{let n=re.find(e=>e.source===H[t]),r=n&&!L(V.values[n.id])?V.values[n.id]:V.scope[t];L(r)||(e[t]=t===`open`||[].concat(Re(r)))});let t={};return re.forEach(e=>{e.source===`field`&&!L(V.values[e.id])&&(t[e.id]=Re(V.values[e.id]))}),Object.keys(t).length&&(e.filters=t),e},Be=(e={})=>(re=N(),V.text=String(e.text==null?``:e.text),V.values={},V.scope={},Object.keys(H).forEach(t=>{let n=e[t];if(L(n))return;n=t===`open`||[].concat(n);let r=re.find(e=>e.source===H[t]);r&&(t===`open`?r.type===`toggle`:r.type===`chips`&&r.multi||n.length===1)?V.values[r.id]=r.type===`toggle`?!0:r.type===`select`?n[0]:n:V.scope[t]=n}),Object.entries(e.filters||{}).forEach(([e,t])=>{!L(t)&&re.some(t=>t.id===e)&&(V.values[e]=Re(t))}),Ee(),ze()),Ve=()=>{let t={text:null,withoutFilters:0};if(!oe.length)return t;let n=u(V.text);if(je()&&(t.withoutFilters=Ae(m.filter(e=>j(e,oe,n)))),t.withoutFilters||n.length<3)return t;let r=Math.min(n.length>=6?2:1,Math.floor(n.length/3)),i=m.map(e=>e.name).concat(Object.values(_).flatMap(t=>[t.name||``,e.data.categoryName(t.name||``)||``])),a=r+1;return i.forEach(e=>{let i=u(e);if(!i)return;let o=Math.min(f(i,n,r),n.length>=5?f(i.slice(0,n.length),n,r):r+1,...d(e).map(e=>f(e,n,r)));o<a&&(a=o,t.text=e)}),t},He=e=>{let t=String(e||``);if(!oe.length)return l(t);let n=t.normalize(`NFD`),r=[],i=``;for(let e=0;e<n.length;e++)/[\u0300-\u036f]/.test(n[e])||(i+=n[e].toLowerCase(),r.push(e));let a=Array(n.length).fill(!1);oe.forEach(e=>{let t=RegExp(`(^|[^\\p{L}\\p{N}])(`+e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)+`)`,`gu`),n;for(;n=t.exec(i);){let e=n.index+n[1].length;for(let t=e;t<e+n[2].length;t++)a[r[t]]=!0;t.lastIndex===n.index&&t.lastIndex++}});for(let e=1;e<n.length;e++)/[\u0300-\u036f]/.test(n[e])&&(a[e]=a[e-1]);let o=``,s=!1;for(let e=0;e<n.length;e++)a[e]!==s&&(o+=a[e]?`<mark>`:`</mark>`,s=a[e]),o+=l(n[e]);return(o+(s?`</mark>`:``)).normalize(`NFC`)},Ue=t=>{let n=[].concat(V.scope[t]);if(t===`open`)return i(`search_open_now`);if(t===`level`)return n.map(e=>(x().find(t=>String(t.index)===String(e))||{name:e}).name).join(`, `);if(t===`category`)return n.map(t=>t===`amenity`?i(`directory_amenities`):_[t]&&e.data.categoryName(_[t].name)||t).join(`, `);let r=e.data.amenityTypes();return n.map(e=>(r[e]||{}).name||e).join(`, `)},We=e.ui.mount(c(`div`,`mp-sr`));We.setAttribute(`role`,`status`),We.setAttribute(`aria-live`,`polite`);let Ge=0,Ke=()=>{clearTimeout(Ge),Ge=setTimeout(()=>{let e=Ae(ie);We.textContent=Me()?e?e===1?i(`search_result_one`):i(`search_results`,{n:e}):i(`search_none`):``},600)},qe=`mapplic.search.recent`,Je=()=>{try{return(JSON.parse(localStorage.getItem(qe))||[]).filter(e=>h[e])}catch{return[]}},Ye=e=>{let t=h[e];if(!t)return;let n=[e].concat(Je().filter(e=>h[e].place!==t.place)).slice(0,5);try{localStorage.setItem(qe,JSON.stringify(n))}catch{}},Xe=()=>{try{localStorage.removeItem(qe)}catch{}},Ze=()=>{let t=(e.data.section(`search`)||{}).popular,n=new Set,r=[],i=e=>{e&&!n.has(e.place)&&(n.add(e.place),r.push(e.id))};return Array.isArray(t)&&t.length?t.forEach(e=>i(h[e]||m.find(t=>t.info.location===e||t.n.name===u(e)))):m.filter(e=>MapplicMap.PLACE.isFeatured(e.location)).forEach(i),r.slice(0,5)};MapplicMap.injectCss(`search-keyframes`,`@keyframes mp-search-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.55) } 70%, 100% { box-shadow: 0 0 0 6px rgba(34,197,94,0) } }
4165
- @media (prefers-reduced-motion: reduce) { .mp-map .mp-search-live-dot { animation: none !important } }`),e.ui.style(Object.assign({},MapplicMap.PLACE.css,{".mp-search":`position:absolute;z-index:7;display:flex;flex-direction:column;gap:8px;font-family:Onest,sans-serif;color:var(--mp-fg)`,".mp-search.mp-slot-compact":`width:36px`,"&.mp-map .mp-search.mp-slot-compact.mp-engaged":`z-index:12;left:16px !important;right:16px !important;width:auto;max-width:var(--mp-sw);margin:0 auto`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-bar":`width:36px;padding:0;justify-content:center;cursor:pointer`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-bar > :not(.mp-search-icon):not(.mp-search-input)":`display:none !important`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-icon":`margin:0`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-input":`position:absolute;inset:0;width:100%;opacity:0;cursor:pointer`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-chips, .mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-veil":`display:none !important`,".mp-search.mp-slot-compact.mp-has-query:not(.mp-engaged) .mp-search-icon":`color:var(--mp-accent)`,".mp-search > .mp-search-ui":`position:relative`,".mp-search-veil":`position:absolute;left:-56px;right:-56px;z-index:-1;pointer-events:none;-webkit-backdrop-filter:blur(14px) saturate(1.3);backdrop-filter:blur(14px) saturate(1.3);background:var(--mp-veil, color-mix(in srgb, var(--mp-bg) 28%, transparent));-webkit-mask-composite:source-in;mask-composite:intersect`,".mp-pos-top-left .mp-search-veil, .mp-pos-top-center .mp-search-veil, .mp-pos-top-right .mp-search-veil":`top:-16px;bottom:-40px;-webkit-mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,".mp-pos-bottom-center .mp-search-veil":`bottom:-16px;top:-40px;-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,".mp-pos-top-left .mp-search-veil":`left:-16px;-webkit-mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to left, transparent 0, #000 56px);mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to left, transparent 0, #000 56px)`,".mp-pos-top-right .mp-search-veil":`right:-16px;-webkit-mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px);mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px)`,"&[data-mp-bleed] .mp-pos-top-center .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,"&[data-mp-bleed] .mp-pos-top-left .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 56px), transparent 100%)`,"&[data-mp-bleed] .mp-pos-top-right .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 16px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 16px), transparent 100%)`,"&[data-mp-bleed] .mp-pos-bottom-center .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 16px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 16px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,".mp-search.mp-pos-bottom-center":`flex-direction:column-reverse`,".mp-pos-bottom-center > .mp-search-ui":`flex-direction:column-reverse`,".mp-pos-bottom-center .mp-search-drop":`flex-direction:column-reverse`,".mp-pos-bottom-center .mp-search-drop .mp-search-menu":`border-bottom:0;border-top:1px solid var(--mp-border-subtle)`,".mp-pos-bottom-center .mp-search-foot":`border-top:0;border-bottom:1px solid var(--mp-border-subtle)`,"&.mp-map .mp-search.mp-open":`z-index:12`,".mp-search-ui":`display:flex;flex-direction:column;gap:8px;min-width:0;font-family:Onest,sans-serif`,".mp-search > .mp-search-ui > .mp-search-bar:focus-within":`box-shadow:0 2px 4px rgba(0,0,0,0.06), 0 0 0 2px var(--mp-accent)`,".mp-search-bar":`position:relative;display:flex;align-items:center;gap:4px;height:44px;padding:0 6px 0 14px;box-sizing:border-box;background:var(--mp-surface);border-radius:calc(10px * var(--mp-rk, 1));box-shadow:`+a+`;transition:box-shadow 150ms ease`,".mp-search > .mp-search-ui > .mp-search-bar":`height:36px;padding:0 4px 0 12px;border-radius:calc(8px * var(--mp-rk, 1))`,".mp-search > .mp-search-ui > .mp-search-bar .mp-search-iconbtn":`width:28px;height:28px;border-radius:calc(6px * var(--mp-rk, 1))`,".mp-search-panel .mp-search-bar":`height:40px;box-shadow:none;border:1px solid var(--mp-border);border-radius:calc(10px * var(--mp-rk, 1));padding-left:12px`,".mp-search-panel .mp-search-bar:focus-within":`border-color:var(--mp-accent);box-shadow:inset 0 0 0 1px var(--mp-accent)`,".mp-search-icon":`flex:none;display:flex;color:var(--mp-fg-muted);margin-right:6px`,".mp-search-input":`flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font:inherit;font-size:14px;color:var(--mp-fg);padding:0`,".mp-search-input::placeholder":`color:var(--mp-fg-subtle)`,".mp-search-count":`flex:none;padding:0 4px;font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--mp-fg-muted)`,".mp-search-count + .mp-search-kbd + .mp-search-clear":`margin-left:-2px`,".mp-search-kbd":`flex:none;display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;margin-right:6px;padding:0 5px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:calc(5px * var(--mp-rk, 1));background:var(--mp-surface);color:var(--mp-fg-muted);font-family:"Roboto Mono",ui-monospace,monospace;font-size:11px;font-weight:500;line-height:1;cursor:text;user-select:none`,".mp-search-input::-webkit-search-cancel-button":`-webkit-appearance:none`,".mp-search-iconbtn":`position:relative;flex:none;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;color:var(--mp-fg-muted);cursor:pointer;padding:0;transition:background-color 150ms ease,color 150ms ease`,".mp-search-iconbtn:hover":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,'.mp-search-iconbtn[aria-pressed="true"]':`background:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg)`,".mp-search-badge":`position:absolute;top:1px;right:1px;min-width:15px;height:15px;padding:0 4px;box-sizing:border-box;border-radius:999px;background:var(--mp-accent);color:var(--mp-fg-on-accent);font-size:10px;font-weight:600;line-height:15px;text-align:center`,".mp-search-chips":`display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;padding:2px;margin:-2px;overscroll-behavior-x:contain;user-select:none;-webkit-user-select:none`,".mp-search-chips::-webkit-scrollbar":`display:none`,".mp-search-chips > *":`transform:translateX(var(--mp-over, 0px))`,".mp-search-wrap .mp-search-chips":`flex-wrap:wrap;overflow:visible`,".mp-search-chip":`position:relative;flex:none;display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:999px;background:var(--mp-surface);color:var(--mp-fg-strong);font:inherit;font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer;transition:background-color 150ms ease,color 150ms ease,border-color 150ms ease,opacity 150ms ease`,".mp-search > .mp-search-ui .mp-search-chips .mp-search-chip":`height:28px;padding:0 10px;font-size:12px;border-color:transparent;box-shadow:`+a,".mp-search > .mp-search-ui .mp-search-chips .mp-search-chip.mp-search-pill":`padding-right:6px`,'&[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui > .mp-search-bar, &[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui .mp-search-chips .mp-search-chip:not([aria-pressed="true"])':`background:var(--mp-ctl-glass);-webkit-backdrop-filter:var(--mp-ctl-blur);backdrop-filter:var(--mp-ctl-blur)`,'&[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui > .mp-search-bar:not(:focus-within), &[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui .mp-search-chips .mp-search-chip':`box-shadow:0 0 0 1px var(--mp-ctl-ring), `+a,".mp-search-chip:hover":`background:var(--mp-bg-muted)`,'.mp-search-chip[aria-pressed="true"], .mp-search-chip.mp-active':`background:var(--mp-accent-subtle);border-color:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg)`,'.mp-search-chip.mp-cc[aria-pressed="true"]':`background:var(--mp-cd);border-color:var(--mp-cd);color:#fff;transition:filter 150ms ease`,'.mp-search-chip.mp-cc[aria-pressed="true"]:hover':`background:var(--mp-cd);filter:brightness(0.92)`,'.mp-search-chip.mp-cc[aria-pressed="true"] .mp-cat-icon':`color:#fff`,'.mp-search-chip.mp-cc[aria-pressed="true"] .mp-search-chip-count':`color:#fff;opacity:0.75`,'.mp-search-chip.mp-cat:not(.mp-cc)[aria-pressed="true"]':`background:var(--mp-fg-strong);border-color:var(--mp-fg-strong);color:var(--mp-surface)`,'.mp-search-chip.mp-cat:not(.mp-cc)[aria-pressed="true"] .mp-search-chip-count':`color:var(--mp-surface);opacity:0.75`,".mp-search-chip:disabled":`opacity:0.4;cursor:default;background:var(--mp-surface)`,".mp-search-chip-count":`color:var(--mp-fg-subtle);font-size:11px;font-variant-numeric:tabular-nums`,'.mp-search-chip[aria-pressed="true"] .mp-search-chip-count':`color:var(--mp-accent-subtle-fg);opacity:0.7`,".mp-search-chip select":`position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font:inherit;border:0`,".mp-search-chip svg":`flex:none`,".mp-search-live-dot":`flex:none;width:8px;height:8px;border-radius:999px;background:var(--mp-success-bright);animation:mp-search-pulse 1.6s ease-out infinite`,'.mp-search-chip.mp-search-live[aria-pressed="true"]':`background:var(--mp-success-subtle);border-color:var(--mp-success-subtle);color:var(--mp-success)`,".mp-search-chip:disabled .mp-search-live-dot, .mp-still .mp-search-live-dot":`animation:none`,".mp-search-menu":`display:flex;flex-direction:column;gap:14px`,".mp-search-group":`display:flex;flex-direction:column;gap:8px`,".mp-search-eyebrow":`font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-fg-muted)`,".mp-search-drop":`display:flex;flex-direction:column;background:var(--mp-surface);border-radius:calc(12px * var(--mp-rk, 1));box-shadow:var(--mp-shadow-float);overflow:hidden`,".mp-search-scroll":`overflow-y:auto;overscroll-behavior:contain;padding:6px`,".mp-search-drop .mp-search-menu":`padding:14px 14px 16px;border-bottom:1px solid var(--mp-border-subtle)`,".mp-search-section":`padding:10px 8px 4px;font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-fg-muted)`,".mp-search mark, .mp-dock mark, .mp-directory mark":`background:transparent;color:inherit;font-weight:700`,".mp-search-foot":`display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 14px;border-top:1px solid var(--mp-border-subtle);font-size:13px;color:var(--mp-fg-muted)`,".mp-search-link":`display:inline-flex;align-items:center;border:0;background:transparent;padding:4px 0;font:inherit;font-size:13px;font-weight:500;line-height:20px;text-align:left;color:var(--mp-accent);cursor:pointer`,".mp-search-link:hover":`color:var(--mp-accent-subtle-fg)`,".mp-search-empty":`display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px 12px;font-size:14px;color:var(--mp-fg-muted);text-wrap:pretty`,".mp-search-empty b":`color:var(--mp-fg);font-weight:600`,".mp-search-empty .mp-search-link":`font-size:14px;text-align:left`,".mp-search-empty .mp-search-link b":`color:inherit;font-weight:700`,".mp-search-section.mp-search-section-row":`display:flex;align-items:center;justify-content:space-between;gap:8px`,".mp-search-section .mp-search-link":`padding:0;font-size:12px;letter-spacing:0;text-transform:none;font-weight:500`,".mp-search-scope":`display:contents`,".mp-search-understood":`display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 8px 6px;font-size:13px;color:var(--mp-fg-muted);text-wrap:pretty`,".mp-search-understood-text":`display:flex;align-items:flex-start;gap:6px;min-width:0`,".mp-search-understood b":`color:var(--mp-fg);font-weight:600`,".mp-search-understood-icon":`flex:none;display:flex;margin-top:2px;color:var(--mp-accent)`,".mp-search-understood .mp-search-link":`flex:none;padding:0`,".mp-search-go":`flex:none;height:28px;padding:0 12px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-accent);color:var(--mp-fg-on-accent);font:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:background-color 150ms ease`,".mp-search-go:hover":`background:var(--mp-accent-hover)`,".mp-dir-thumb.mp-search-route-icon":`background:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg)`,".mp-dir-thumb.mp-search-route-icon svg":`width:auto;height:auto`,".mp-search-ask":`display:inline-flex;align-items:center;gap:6px;height:32px;margin-top:4px;padding:0 12px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:999px;background:var(--mp-surface);color:var(--mp-fg-strong);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background-color 150ms ease`,".mp-search-ask:hover":`background:var(--mp-bg-muted)`,".mp-search-ask svg, .mp-search-asking svg":`flex:none;color:var(--mp-accent)`,".mp-search-ask-key":`display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:-6px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:calc(5px * var(--mp-rk, 1));background:var(--mp-surface);font:inherit`,".mp-search-ask .mp-search-ask-key svg, .mp-search-link .mp-search-ask-key svg":`color:var(--mp-fg-muted)`,".mp-search-link .mp-search-ask-key":`flex:none;margin:0 0 0 8px`,".mp-search-asking":`display:inline-flex;align-items:center;gap:6px;margin-top:4px;font-size:13px;color:var(--mp-fg-muted)`,".mp-search-chip.mp-search-pill":`background:var(--mp-accent-subtle);border-color:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg);padding-right:8px`,".mp-search-chip.mp-search-pill:hover":`background:var(--mp-accent-subtle-hover)`,".mp-sr":`position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0`}));let Qe=e=>{let t=c(`div`,e?`mp-search-menu mp-search-wrap`:`mp-search-chips`);e||MapplicMap.PLACE.dragScroll(t);let n=``,a=[],o=c(`div`,`mp-search-scope`);o.style.order=`-2`;let u=null,d=()=>{o.replaceChildren(),Object.keys(V.scope).forEach(e=>{let t=c(`button`,`mp-search-chip mp-search-pill`);t.type=`button`,t.setAttribute(`aria-pressed`,`true`),t.title=i(`search_clear`),t.innerHTML=`<span>`+l(Ue(e))+`</span>`+s.x,t.onclick=()=>{delete V.scope[e],Ee()},o.append(t)})},f=()=>{a=[],t.replaceChildren(),e?(u=c(`div`,`mp-search-chips`),u.append(o),t.append(u)):t.append(o),re.forEach(n=>{let r=e?c(`div`,`mp-search-group`):t;if(e){r.append(c(`div`,`mp-search-eyebrow`,l(te(n))));let e=c(`div`,`mp-search-chips`);r.append(e),t.append(r)}let i=e?r.lastChild:t;if(n.type===`toggle`){let e=c(`button`,`mp-search-chip`);e.type=`button`,e.onclick=()=>Fe(n,!0),i.append(e),a.push({d:n,kind:`toggle`,b:e})}else if(n.type===`select`){let e=c(`label`,`mp-search-chip`),t=c(`span`),r=c(`select`);e.append(t,c(`span`,``,s.chevron),r),r.onchange=()=>{let e=z(n).find(e=>String(e.value)===r.value);Fe(n,e?e.value:``)},i.append(e),a.push({d:n,kind:`select`,b:e,text:t,sel:r})}else z(n).forEach(e=>{let t=c(`button`,`mp-search-chip`);t.type=`button`,t.onclick=()=>Fe(n,e.value),i.append(t),a.push({d:n,kind:`chip`,b:t,o:e})})})},p=``;return{el:t,paint:()=>{let o=JSON.stringify(re.map(e=>[e.id,e.type,z(e).map(e=>e.value)]));if(o!==n&&(n=o,f()),d(),u&&(u.style.display=Object.keys(V.scope).length?``:`none`),t.style.display=re.length||Object.keys(V.scope).length?``:`none`,a.forEach(e=>{let t=V.values[e.d.id],n=ae[e.d.id]||{};if(e.kind===`toggle`){let r=!L(t);e.b.setAttribute(`aria-pressed`,r?`true`:`false`);let i=e.d.source===`open_now`;e.b.classList.toggle(`mp-search-live`,i),e.b.innerHTML=(i?`<span class="mp-search-live-dot"></span>`:r?s.check:``)+`<span>`+l(te(e.d))+`</span>`,e.b.disabled=!r&&!n.true}else if(e.kind===`select`){let r=z(e.d),a=r.find(e=>!L(t)&&String(e.value)===String(t));e.text.textContent=a?a.label:e.d.placeholder||i(`search_any`),e.b.classList.toggle(`mp-active`,!!a);let o=`<option value="">`+l(e.d.placeholder||i(`search_any`))+`</option>`+r.map(e=>`<option value="`+l(e.value)+`"`+(a&&a.value===e.value?` selected`:``)+`>`+l(e.label)+(n[e.value]==null?``:` (`+n[e.value]+`)`)+`</option>`).join(``);e.sel._html!==o&&(e.sel.innerHTML=e.sel._html=o),e.sel.value=a?String(a.value):``}else{let i=[].concat(t||[]).some(t=>String(t)===String(e.o.value)),a=n[e.o.value]||0;e.b.setAttribute(`aria-pressed`,i?`true`:`false`);let o=r(`chip_icons`)&&e.o.cat&&MapplicMap.PLACE.icon(e.o.cat.icon,16);e.b.innerHTML=(o?`<span class="mp-cat-icon">`+o+`</span>`:``)+`<span>`+l(e.o.label)+`</span><span class="mp-search-chip-count">`+a+`</span>`,e.o.cat&&e.o.cat.color&&(e.b.style.setProperty(`--mp-cc`,e.o.cat.color),e.b.style.setProperty(`--mp-cd`,MapplicData.readableOn(`#ffffff`,e.o.cat.color,4.5))),e.b.classList.toggle(`mp-cc`,!!(e.o.cat&&e.o.cat.color)),e.b.classList.toggle(`mp-cat`,!!e.o.cat),e.b.disabled=!i&&!a}}),!e){let e=a.filter(e=>e.b.getAttribute(`aria-pressed`)===`true`||e.b.classList.contains(`mp-active`)),n=e.map(e=>e.d.id+`:`+(e.o?e.o.value:``)).join(`|`);if(n!==p){let r=new Set(p?p.split(`|`):[]),i=e.find(e=>!r.has(e.d.id+`:`+(e.o?e.o.value:``)));if(i&&t.scrollWidth>t.clientWidth){let e=i.b.offsetLeft-t.offsetLeft,n=e+i.b.offsetWidth,r=null;e<t.scrollLeft?r=e-16:n>t.scrollLeft+t.clientWidth&&(r=n-t.clientWidth+16),r!=null&&t.scrollTo({left:Math.max(0,r),behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})}p=n}}}}},$e=(t={})=>{let a=c(`div`,`mp-search-bar`),o=c(`input`,`mp-search-input`),l=c(`button`,`mp-search-iconbtn mp-search-clear`,s.x),u=c(`button`,`mp-search-iconbtn mp-search-filter`),d=c(`kbd`,`mp-search-kbd`,`/`),f=c(`span`,`mp-search-count`);f.setAttribute(`aria-hidden`,`true`),o.type=`search`,o.autocomplete=`off`,o.spellcheck=!1,o.setAttribute(`enterkeyhint`,`search`),t.combo&&(o.setAttribute(`role`,`combobox`),o.setAttribute(`aria-autocomplete`,`list`),o.setAttribute(`aria-expanded`,`false`)),l.type=u.type=`button`,l.title=i(`search_clear`),u.title=i(`search_filters`),d.setAttribute(`aria-hidden`,`true`),d.onmousedown=e=>{e.preventDefault(),o.focus()},a.append(c(`span`,`mp-search-icon`,s.search),o,f,d,l,u),st.add(o),o.addEventListener(`focus`,()=>d.style.display=`none`),o.addEventListener(`blur`,()=>h(a._menuOpen));let p=0;o.addEventListener(`input`,()=>{if(clearTimeout(p),m.length<=400)return Ne(o.value);p=setTimeout(()=>{p=0,Ne(o.value)},80)}),o.addEventListener(`focus`,()=>t.onFocus&&t.onFocus()),o.addEventListener(`keydown`,e=>t.onKey&&t.onKey(e)),l.onclick=()=>{let e=n.activeElement===o||!!V.text;je()?Ie():Ne(``),e&&o.focus()},u.onclick=()=>t.onFilter&&t.onFilter();let h=c=>{a._menuOpen=c,n.activeElement!==o&&o.value!==V.text&&(o.value=V.text),d.style.display=r(`shortcut`)&&!V.text&&n.activeElement!==o&&!e.ui.env().touch?``:`none`,r(`shortcut`)?o.setAttribute(`aria-keyshortcuts`,`/`):o.removeAttribute(`aria-keyshortcuts`),n.activeElement===o&&!p&&o.value!==V.text&&(o.value=V.text),o.placeholder=i(`search_placeholder`),o.setAttribute(`aria-label`,i(`search_placeholder`));let m=Me()&&t.count!==!1,h=m?ie.length:0;f.textContent=m?h===1?i(`search_result_one`):i(`search_results`,{n:h}):``,f.style.display=m?``:`none`,l.style.display=V.text||je()?``:`none`,l.title=je()?i(`search_clear_all`):i(`search_clear`);let g=r(`filters`)===`menu`&&(re.length>0||Object.keys(V.scope).length>0),_=je();u.style.display=g?``:`none`,u.setAttribute(`aria-pressed`,c?`true`:`false`),u.innerHTML=s.filter+(_?`<span class="mp-search-badge">`+_+`</span>`:``)};return{el:a,input:o,paint:h}},et=()=>MapplicMap.PLACE.icon(`sparkles`,14),tt=(t=()=>{})=>{if(!U)return null;let n=U,r=c(`div`,`mp-search-understood`),a=[];if(n.text&&a.push(`<b>`+l(n.text)+`</b>`),n.category&&a.push(l(n.category.map(t=>t===`amenity`?i(`directory_amenities`):_[t]&&e.data.categoryName(_[t].name)||t).join(`, `))),n.amenity){let t=e.data.amenityTypes();a.push(l(n.amenity.map(e=>(t[e]||{}).name||e).join(`, `)))}n.level&&a.push(l(n.level.map(e=>(x().find(t=>t.index===e)||{name:e}).name).join(`, `))),n.open&&a.push(l(i(`search_open_now`)));let o=c(`div`,`mp-search-understood-text`);if(n.route){o.innerHTML=`<span class="mp-search-understood-icon">`+s.route.replace(/16/g,`14`)+`</span><span>`+be(n.route)+`</span>`,r.append(o);let e=c(`button`,`mp-search-go`,l(i(`search_show_route`)));return e.type=`button`,e.onclick=async()=>{await ye(),t()},r.append(e),r}if(o.innerHTML=n.source===`smart`?`<span class="mp-search-understood-icon">`+et()+`</span><span>`+l(n.note||i(`search_smart_found`))+`</span>`:`<span>`+l(i(`search_showing`))+` `+a.join(` · `)+`</span>`,r.append(o),n.source===`rules`&&(n.category||n.level||n.open)){let e=c(`button`,`mp-search-link`,l(i(`search_use_filters`)));e.type=`button`,e.onclick=()=>{let e=Re(n);delete e.source,Be(Object.assign(ze(),e)),t()},r.append(e)}return r},nt=()=>{let e=se||{};if(e.withoutFilters)return Le;if(e.text)return()=>Ne(e.text);let t=y[V.text];return V.text.trim()&&Se()&&!t?Te:null},rt=()=>{let e=nt();return e&&e(),!!e},it=()=>e.ui.env().touch?``:`<kbd class="mp-search-ask-key" aria-hidden="true"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 10 4 15 9 20"/><path d="M20 4v7a4 4 0 0 1-4 4H4"/></svg></kbd>`,at=(e=()=>{})=>{let t=c(`div`,`mp-search-empty`),n=se||{},r=V.text.trim();t.append(c(`div`,``,l(i(`search_none`))+(r?` <b>“`+l(r)+`”</b>`:``)));let a=(n,r)=>{let i=n.indexOf(`<kbd`),a=c(`button`,`mp-search-link`,i<0?n:`<span>`+n.slice(0,i)+`</span>`+n.slice(i));a.type=`button`,a.onclick=()=>{r(),e()},t.append(a)},o=!!(n.withoutFilters||n.text);if(n.withoutFilters?a(l(i(`search_without_filters`,{n:n.withoutFilters}))+it(),Le):n.text&&a(l(i(`search_did_you_mean`))+` <b>`+l(n.text)+`</b>?`+it(),()=>Ne(n.text)),r&&Se()){let n=y[V.text];if(n&&n.status===`loading`)t.append(c(`div`,`mp-search-asking`,et()+`<span>`+l(i(`search_asking`))+`</span>`));else if(n&&(n.status===`none`||n.status===`error`))t.append(c(`div`,`mp-search-asking`,l(i(n.status===`error`?`search_ask_failed`:`search_ask_none`))));else{let n=c(`button`,`mp-search-ask`,et()+`<span>`+l(i(`search_ask`))+`</span>`+(o?``:it()));n.type=`button`,n.onclick=()=>{Te(),e()},t.append(n)}}return t},ot=new Set,st=new Set,ct=t=>{if(t.key!==`/`||t.ctrlKey||t.metaKey||t.altKey||!r(`shortcut`))return;let n=t.composedPath?t.composedPath()[0]:t.target,i=n&&n.tagName===`INPUT`&&!/^(checkbox|radio|button|submit|reset|range|color|file|image)$/i.test(n.type);if(n&&(n.isContentEditable||i||/^(textarea|select)$/i.test(n.tagName)))return;let a=e.ui.container.getBoundingClientRect();if(a.bottom<0||a.top>innerHeight||a.right<0||a.left>innerWidth)return;let o=[...st].find(e=>e.isConnected&&e.offsetParent);o&&(t.preventDefault(),o.focus(),o.select())};n.addEventListener(`keydown`,ct);let lt=(e,t={})=>{let n=c(`div`,`mp-search-ui mp-search-panel`),i=!1,a=$e({count:t.count,onKey:e=>{e.key===`Enter`&&t.onEnter&&t.onEnter(ie[0]?ie[0].e.id:null),e.key===`Escape`&&Ne(``),e.key===`ArrowDown`&&t.onArrow&&(e.preventDefault(),t.onArrow())},onFilter:()=>{i=!i,l.paint()}}),o=Qe(!1),s=Qe(!0);n.append(a.el,o.el,s.el);let l={paint:()=>{let e=r(`filters`);a.paint(i),o.paint(),s.paint(),o.el.style.display=e===`chips`&&(re.length||Object.keys(V.scope).length)?``:`none`,s.el.style.display=e===`menu`&&i&&(re.length||Object.keys(V.scope).length)?``:`none`},destroy:()=>{ot.delete(l),n.remove()}};return ot.add(l),e.append(n),l.paint(),{el:n,input:a.input,destroy:l.destroy,focus:()=>a.input.focus()}},ut=(()=>{let t=e.ui.mount(c(`div`,`mp-search`)),a=c(`div`,`mp-search-ui`),o=!1,u=!1,f=-1,p=[],g=$e({combo:!0,onFocus:()=>{o=!0,se()},onKey:e=>R(e),onFilter:()=>{u=!u,o=!0,se()}}),v=Qe(!1),y=Qe(!0),b=c(`div`,`mp-search-drop`),w=c(`div`,`mp-search-scroll`),D=c(`div`,`mp-search-foot`),O=c(`div`,`mp-search-veil`),k=`mp-search-`+Math.random().toString(36).slice(2,8);b.style.display=`none`,w.id=k,w.setAttribute(`role`,`listbox`),g.input.setAttribute(`aria-controls`,k),a.append(O,g.el,v.el),t.append(a,b);let A=e.ui.slot(t,{anchor:S(),priority:20,compact:!0,compactWidth:36,box:a}),j=()=>{o=!1,u=!1,N(-1),se()},M=e=>{o&&!(e.composedPath?e.composedPath().includes(t):t.contains(e.target))&&j()};n.addEventListener(`pointerdown`,M,!0);let N=t=>{f=t,p.forEach((e,n)=>{e.el.classList.toggle(`mp-hover`,n===t),e.el.setAttribute(`aria-selected`,n===t?`true`:`false`)});let n=p[t];if(n?g.input.setAttribute(`aria-activedescendant`,n.el.id):g.input.removeAttribute(`aria-activedescendant`),e.view.hover(n&&n.id?n.id:null),n){let e=n.el.offsetTop,t=e+n.el.offsetHeight;e<w.scrollTop?w.scrollTop=e-6:t>w.scrollTop+w.clientHeight&&(w.scrollTop=t-w.clientHeight+6)}},P=null,I=!1,ee=null,L=t=>{t&&(t.route?(ye(),j(),g.input.blur()):t.category?(V.values[P.id]=[t.category],V.text=``,Ee(),g.input.focus()):(e.view.select({id:t.id}),Ne(``),j(),g.input.blur()))},R=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),o||(o=!0,se()),!p.length)return;let t=e.key===`ArrowDown`==(S()===`bottom-center`)?-1:1;N((f+t+p.length+ +(f<0&&t<0))%p.length)}else if(e.key===`Enter`){let e=p[f>=0?f:0];e?L(e):oe.length&&rt()}else e.key===`Escape`&&(V.text?Ne(``):(j(),g.input.blur()))},te=(e,t,n,r)=>{let i=MapplicMap.PLACE.item(n,Object.assign({style:`logo`,compact:!0},r));return i.setAttribute(`role`,`option`),i.id=k+`-`+p.indexOf(e),i._name.innerHTML=t,i.onmouseenter=()=>N(p.indexOf(e)),i.onclick=()=>L(e),e.el=i,i},B=()=>x().length>1,H=(t,n)=>{let r=e.getState().level,a=t.all.find(e=>e.level===r)||t.all[0],o={id:a.id};p.push(o);let s=t.all.length>1&&!!t.e.amenity,c=Object.assign({},a,{logo:E(a.id),cat:_[a.category]||(a.amenity?MapplicMap.PLACE.amenityCategory(a.amenity,e.data.amenityTypes(),e.data.section(`categories`)||[]):null)});w.append(te(o,n,c,{levelOf:B()?ne:null,levels:t.all.map(e=>e.level).sort((e,t)=>e-t),subText:s?i(`search_locations`,{n:t.all.length}):t.e.categoryName,badge:s?null:ae(a)}))},ne=e=>x().find(t=>t.index===e)||{name:``,short:``},ae=t=>n=>{if(!t.hours||!C())return null;try{return e.plugin(`hours`).badge(t.info,{variant:n,theme:`light`})}catch{return null}},se=()=>{let n=!T();if(t.style.display=n?``:`none`,!n)return e.ui.container.style.removeProperty(`--mp-hint-vis`);let x=r(`filters`),C=S(),E=e.ui.container;[`top-left`,`top-center`,`top-right`,`bottom-center`].forEach(e=>t.classList.toggle(`mp-pos-`+e,e===C)),O.style.display=r(`blur`)?``:`none`;let k=r(`max_width`)||(/center/.test(C)?420:360);t.style.setProperty(`--mp-sw`,k+`px`),A.update({anchor:C,max:k,min:Math.min(200,k)}),t.classList.toggle(`mp-engaged`,o),t.classList.toggle(`mp-has-query`,Me()),t.classList.toggle(`mp-narrow`,e.ui.env().narrow),g.paint(u),v.paint(),v.el.style.display=x===`chips`&&(re.length||Object.keys(V.scope).length)?``:`none`,C===`bottom-center`?E.style.setProperty(`--mp-hint-vis`,`hidden`):E.style.removeProperty(`--mp-hint-vis`);let j=!Me()&&!(u&&x===`menu`)&&r(`suggestions`),M=j?Je():[],N=j?Ze().filter(e=>!M.some(t=>h[t].place===h[e].place)):[],L=o&&(Me()||u&&x===`menu`||M.length+N.length>0),R=e.ui.env().reducedMotion||!b.animate,B=[{opacity:0,transform:`translateY(`+(C===`bottom-center`?4:-4)+`px)`},{opacity:1,transform:`none`}];L===I?L&&(b.style.display=``):(ee&&ee.cancel(),ee=null,L?(b.style.display=``,R||(ee=b.animate(B,{duration:160,easing:`ease-out`}))):R?b.style.display=`none`:(ee=b.animate(B.slice().reverse(),{duration:120,easing:`ease-in`}),ee.onfinish=()=>{ee=null,b.style.display=`none`})),I=L,g.input.setAttribute(`aria-expanded`,L?`true`:`false`),t.classList.toggle(`mp-open`,L);let ne=()=>D.remove(),ae=e=>e?e.id?`i:`+e.id:e.category?`c:`+e.category:e.route?`r`:null:null,ce=f>=0?ae(p[f]):null,le=()=>{f<0||(f=-1,e.view.hover(null))};if(!L){p=[],le(),g.input.removeAttribute(`aria-activedescendant`);return}b.replaceChildren(),u&&x===`menu`&&(re.length||Object.keys(V.scope).length)&&(y.paint(),b.append(y.el)),p=[],w.replaceChildren();let ue=[],de=w.append.bind(w);if(w.append=(...e)=>e.forEach(e=>{e.classList&&e.classList.contains(`mp-search-section`)?ue.push({head:e,items:[]}):e.classList&&e.classList.contains(`mp-dir-item`)?(ue.length||ue.push({head:null,items:[]}),ue[ue.length-1].items.push(e)):ue.push({head:null,items:[e]})}),U&&U.route){let e={route:U};p.push(e);let t=c(`div`,`mp-dir-thumb mp-search-route-icon`,s.route),n=te(e,be(U.route),{name:``},{thumb:t,subText:i(`search_show_route`)});w.append(n)}else if(U){let e=tt(()=>g.input.focus());e&&w.append(e)}if(P=re.find(e=>e.source===`category`&&e.type===`chips`),oe.length&&P){let e=z(P).filter(e=>{let t=d(e.label);return oe.every(e=>t.some(t=>t.startsWith(e)))});e.length&&(w.append(c(`div`,`mp-search-section`,l(i(`search_categories`)))),e.slice(0,3).forEach(e=>{let t={category:e.value};p.push(t);let n=Ae(m.filter(t=>F(t,{source:`category`}).includes(e.value))),r=_[e.value],a=MapplicMap.PLACE.tint(c(`div`,`mp-dir-thumb mp-dir-icon`,r&&MapplicMap.PLACE.icon(r.icon,16)||s.tag),r);w.append(te(t,He(e.label),{name:e.label},{thumb:a,subText:i(`search_places_count`,{n})}))}))}let fe={},pe=[];ie.forEach(({e})=>{if(e.amenity){let t=`a:`+e.amenity+`:`+e.name;if(fe[t])return fe[t].all.push(e);fe[t]={e,all:[e]},pe.push(fe[t])}else{let t=`p:`+e.place;if(fe[t])return fe[t].all.push(e);fe[t]={e,all:[e]},pe.push(fe[t])}});let me=+r(`limit`)||1/0;pe.length&&oe.length&&(p.length&&w.append(c(`div`,`mp-search-section`,l(i(`search_places`)))),pe.slice(0,me).forEach(e=>H(e,He(e.e.name))));let he=(e,t,n)=>{if(!t.length)return;let r=c(`div`,`mp-search-section mp-search-section-row`);if(r.append(c(`span`,``,l(i(e)))),n){let e=c(`button`,`mp-search-link`,l(i(`search_clear`)));e.type=`button`,e.onclick=()=>{n(),g.input.focus(),se()},r.append(e)}w.append(r),t.forEach(e=>{let t=h[e],n=m.filter(n=>n.place===t.place&&!(n.amenity&&n.id!==e));H({e:t,all:n.length?n:[t]},l(t.name))})};j&&(he(`search_recent`,M,Xe),he(`search_popular`,N)),oe.length&&!p.length&&w.append(at(()=>g.input.focus())),delete w.append;let ge=S()===`bottom-center`;if(ue.forEach(e=>{e.head&&de(e.head),(ge?e.items.slice().reverse():e.items).forEach(e=>de(e))}),ge){let e=p.filter(e=>e.category);p=p.filter(e=>!e.category).concat(e)}w.childNodes.length&&b.append(w),ne();let _e=e.ui.size().height,ve=ge?_e-16-a.offsetHeight-8-16:_e-(t.offsetTop+a.offsetHeight+8)-16;if(b.style.maxHeight=Math.max(160,ve)+`px`,w.style.maxHeight=Math.max(120,ve-(D.parentNode?44:0)-(y.el.parentNode?y.el.offsetHeight:0))+`px`,f>=0){let e=ce?p.findIndex(e=>ae(e)===ce):-1;e<0?(le(),g.input.removeAttribute(`aria-activedescendant`)):(f=e,p[e].el.classList.add(`mp-hover`),g.input.setAttribute(`aria-activedescendant`,p[e].el.id))}ge&&f<0&&(w.scrollTop=w.scrollHeight)},ce={paint:se,destroy:()=>n.removeEventListener(`pointerdown`,M,!0)};return ot.add(ce),e.on(`select`,e=>{e&&j()}),ce})(),dt=()=>{O(),Ee()};return dt(),e.on(`select`,e=>{e&&h[e.id]&&Ye(e.id)}),e.on(`plugin`,e=>{[`search`,`directory`,`hours`,`localization`].includes(e.id)&&Ee()}),e.on(`language`,dt),e.on(`units`,dt),e.on(`layout`,()=>ut.paint()),e.on(`hours`,()=>{re.some(e=>e.source===`open_now`)&&Me()&&Ee()}),e.on(`level`,()=>ut.paint()),e.provide({query:e=>(Ne(e),ie.map(e=>e.e.id)),text:()=>V.text,setFilter:Pe,clear:Ie,setQuery:Be,getQuery:ze,suggest:()=>se?Object.assign({},se):{text:null,withoutFilters:0},emptyUi:at,emptyEnter:rt,understoodUi:tt,interpret:e=>e==null?U?Re(U):null:_e(String(e))||me(String(e)),act:ye,ask:Te,setSmartSearch:e=>{W=typeof e==`function`?e:null,ot.forEach(e=>e.paint())},state:()=>({interpreted:U?Re(U):null,query:ze(),text:V.text,filters:JSON.parse(JSON.stringify(V.values)),active:Me(),count:Ae(ie),total:Ae(m)}),results:()=>ie.map(e=>({id:e.e.id,score:e.score,info:e.e.info})),filters:()=>re.map(e=>({id:e.id,type:e.type,source:e.source,label:te(e),value:V.values[e.id]==null?null:JSON.parse(JSON.stringify(V.values[e.id])),options:e.type===`toggle`?[{value:!0,label:te(e),count:(ae[e.id]||{}).true||0}]:z(e).map(t=>Object.assign({},t,{count:(ae[e.id]||{})[t.value]||0}))})),entries:()=>m.map(e=>({id:e.id,name:e.name,kind:e.kind,category:e.category,categories:e.categories.slice(),categoryName:e.categoryName,level:e.level,amenity:e.amenity})),mark:He,mountUi:lt}),()=>{n.removeEventListener(`keydown`,ct),st.clear(),clearTimeout(Ge),ot.forEach(e=>e.destroy&&e.destroy()),ot.clear(),e.view.hover(null),e.ui.container.style.removeProperty(`--mp-hint-vis`)}}),MapplicMap.PLACE=(()=>{let e=document,t=(t,n,r)=>{let i=e.createElement(t);return n&&(i.className=n),r!=null&&(i.innerHTML=r),i},n=MapplicMap.escapeHtml,r=e=>String(e||``).split(/\s+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).slice(0,2).map(e=>e.replace(/[^\p{L}\p{N}]/gu,``)[0]||``).join(``).toUpperCase()||`·`,i=e=>{let t=String(e||``),n=[];t.replace(/(?:fill|stop-color|color)\s*[:=]\s*["']?\s*(#[0-9a-f]{3,8}|white|rgb\([^)]*\))/gi,(e,t)=>n.push(t));let r=e=>{if(e=e.toLowerCase(),e===`white`)return 1;let t,n,r;if(e[0]===`#`){let i=e.length<=5?e.slice(1,4).split(``).map(e=>e+e).join(``):e.slice(1,7);[t,n,r]=[0,2,4].map(e=>parseInt(i.slice(e,e+2),16))}else[t,n,r]=(e.match(/[\d.]+/g)||[0,0,0]).map(Number);return(.2126*t+.7152*n+.0722*r)/255};return n.length>0&&n.every(e=>r(e)>.85)},a=e=>{let t=String(e||``),n=(t.match(/viewBox\s*=\s*["']\s*([-\d.]+)[\s,]+([-\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i)||[]).slice(1).map(Number);if(n.length!==4||!n[2]||!n[3])return!1;let r=(e,t,r,i)=>e-n[0]<=n[2]*.03&&t-n[1]<=n[3]*.03&&r>=n[2]*.94&&i>=n[3]*.94,i=(t.replace(/<metadata[\s\S]*?<\/metadata>/i,``).match(/<(rect|path)\b[^>]*>/i)||[])[0];if(!i)return!1;if(/^<rect/i.test(i)){let e=e=>parseFloat((i.match(RegExp(`\\b`+e+`\\s*=\\s*["']?([-\\d.]+)(%?)`))||[])[1]),t=e=>RegExp(`\\b`+e+`\\s*=\\s*["']?100%`).test(i);return r(e(`x`)||0,e(`y`)||0,t(`width`)?n[2]:e(`width`)||0,t(`height`)?n[3]:e(`height`)||0)}let a=(i.match(/\bd\s*=\s*["']\s*M\s*([-\d.]+)[\s,]+([-\d.]+)\s*h\s*([\d.]+)\s*v\s*([\d.]+)/i)||[]).slice(1).map(Number);return a.length===4&&r(a[0],a[1],a[2],a[3])},o=e=>{let t=null,n=0,r=0,i=!1,a=0,o=0,s=0,c=0,l=()=>window.matchMedia&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,u=0,d=0,f=0,p=t=>{u=t,e.style.setProperty(`--mp-over`,t.toFixed(2)+`px`)},m=()=>{cancelAnimationFrame(f);let e=performance.now(),t=n=>{let r=Math.min(32,n-e);e=n,d+=(-25e-5*u-.026*d)*r,p(u+d*r),Math.abs(u)<.3&&Math.abs(d)<.01?(p(0),d=0):f=requestAnimationFrame(t)};f=requestAnimationFrame(t)},h=()=>{if(cancelAnimationFrame(c),l()||Math.abs(a)<.05)return;let t=performance.now(),n=e.scrollLeft,r=e.scrollWidth-e.clientWidth,i=o=>{let s=Math.min(32,o-t);t=o;let l=n-a*s;n=Math.max(0,Math.min(r,l)),e.scrollLeft=n,a*=.95**(s/16),l===n?Math.abs(a)>.02&&(c=requestAnimationFrame(i)):(d=a*.5,p(0),m())};c=requestAnimationFrame(i)};e.addEventListener(`pointerdown`,l=>{cancelAnimationFrame(c),cancelAnimationFrame(f),!(l.pointerType!==`mouse`||l.button!==0||e.scrollWidth<=e.clientWidth+1)&&(t=l.pointerId,n=o=l.clientX,s=performance.now(),r=e.scrollLeft,i=!1,a=0)}),e.addEventListener(`pointermove`,c=>{if(c.pointerId!==t)return;if(c.buttons===0){t=null,e.style.cursor=``;return}let u=c.clientX-n;if(!i&&Math.abs(u)>4){i=!0;try{e.setPointerCapture(t)}catch{}e.style.cursor=`grabbing`}if(i){let t=r-u,n=e.scrollWidth-e.clientWidth;e.scrollLeft=t,l()||p(t<0?-t/3:t>n?-(t-n)/3:0)}let d=performance.now(),f=d-s;f>0&&(a=.7*((c.clientX-o)/f)+.3*a),o=c.clientX,s=d});let g=n=>{if(n.pointerId!==t||(t=null,e.style.cursor=``,!i))return;performance.now()-s>80&&(a=0),u?(d=0,m()):h();let r=e=>{e.stopPropagation(),e.preventDefault()};e.addEventListener(`click`,r,!0),setTimeout(()=>e.removeEventListener(`click`,r,!0),0)},_=()=>{let t=e.scrollWidth-e.clientWidth;e.style.setProperty(`--mp-fl`,e.scrollLeft>1?`32px`:`0px`),e.style.setProperty(`--mp-fr`,e.scrollLeft<t-1?`32px`:`0px`)};e.classList.add(`mp-fade`),e.addEventListener(`scroll`,_,{passive:!0}),window.ResizeObserver&&new ResizeObserver(_).observe(e),window.MutationObserver&&new MutationObserver(_).observe(e,{childList:!0}),requestAnimationFrame(_),e.addEventListener(`pointerup`,g),e.addEventListener(`pointercancel`,g),e.addEventListener(`lostpointercapture`,g),e.addEventListener(`wheel`,t=>{Math.abs(t.deltaY)<=Math.abs(t.deltaX)||e.scrollWidth<=e.clientWidth+1||(cancelAnimationFrame(c),e.scrollLeft+=t.deltaY,t.preventDefault())},{passive:!1})},s={utensils:`<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"></path><path d="M7 2v20"></path><path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"></path>`,coffee:`<path d="M10 2v2"></path><path d="M14 2v2"></path><path d="M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1"></path><path d="M6 2v2"></path>`,"shopping-bag":`<path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"></path><path d="M3 6h18"></path><path d="M16 10a4 4 0 0 1-8 0"></path>`,"shopping-cart":`<circle cx="8" cy="21" r="1"></circle><circle cx="19" cy="21" r="1"></circle><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"></path>`,shirt:`<path d="M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z"></path>`,sparkles:`<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"></path><path d="M5 3v4"></path><path d="M19 17v4"></path><path d="M3 5h4"></path><path d="M17 19h4"></path>`,heart:`<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path>`,smartphone:`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path>`,sofa:`<path d="M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3"></path><path d="M2 11v5a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v2H6v-2a2 2 0 0 0-4 0Z"></path><path d="M4 18v2"></path><path d="M20 18v2"></path><path d="M12 4v9"></path>`,ticket:`<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"></path><path d="M13 5v2"></path><path d="M13 17v2"></path><path d="M13 11v2"></path>`,gem:`<path d="M6 3h12l4 6-10 13L2 9Z"></path><path d="M11 3 8 9l4 13 4-13-3-6"></path><path d="M2 9h20"></path>`,wrench:`<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path>`,car:`<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"></path><circle cx="7" cy="17" r="2"></circle><path d="M9 17h6"></path><circle cx="17" cy="17" r="2"></circle>`,info:`<circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path>`,tag:`<path d="M12.6 2.6A2 2 0 0 0 11.2 2H4a2 2 0 0 0-2 2v7.2a2 2 0 0 0 .6 1.4l8.7 8.7a2.4 2.4 0 0 0 3.4 0l6.6-6.6a2.4 2.4 0 0 0 0-3.4z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>`,footprints:`<path d="M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z"></path><path d="M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z"></path><path d="M16 17h4"></path><path d="M4 13h4"></path>`,watch:`<circle cx="12" cy="12" r="6"></circle><polyline points="12 10 12 12 13 13"></polyline><path d="m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-1.98 1.61l-.78 4.05"></path><path d="m7.88 16.36.8 4a2 2 0 0 0 1.98 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05"></path>`,dumbbell:`<path d="m6.5 6.5 11 11"></path><path d="m21 21-1-1"></path><path d="m3 3 1 1"></path><path d="m18 22 4-4"></path><path d="m2 6 4-4"></path><path d="m3 10 7-7"></path><path d="m14 21 7-7"></path>`,"gamepad-2":`<line x1="6" x2="10" y1="11" y2="11"></line><line x1="8" x2="8" y1="9" y2="13"></line><line x1="15" x2="15.01" y1="12" y2="12"></line><line x1="18" x2="18.01" y1="10" y2="10"></line><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"></path>`,baby:`<path d="M9 12h.01"></path><path d="M15 12h.01"></path><path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5"></path><path d="M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1"></path>`,clapperboard:`<path d="M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z"></path><path d="m6.2 5.3 3.1 3.9"></path><path d="m12.4 3.4 3.1 4"></path><path d="M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"></path>`,"cup-soda":`<path d="m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8"></path><path d="M5 8h14"></path><path d="M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0"></path><path d="m12 8 1-6h2"></path>`,gift:`<rect x="3" y="8" width="18" height="4" rx="1"></rect><path d="M12 8v13"></path><path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"></path><path d="M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5"></path>`},c={restroom:`M5.5 21v-6.5H5c-.55 0-1-.45-1-1V9c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2v4.5c0 .55-.45 1-1 1h-.5V21c0 .55-.45 1-1 1h-2c-.55 0-1-.45-1-1zM18 21v-5h1.61c.68 0 1.16-.67.95-1.32l-2.1-6.31C18.18 7.55 17.42 7 16.56 7h-.12c-.86 0-1.63.55-1.9 1.37l-2.1 6.31c-.22.65.26 1.32.95 1.32H15v5c0 .55.45 1 1 1h1c.55 0 1-.45 1-1zM7.5 6c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2zm9 0c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2z`},l=(e,t=16)=>{if(!e)return null;let r=String(e).trim();if(/^</.test(r))return r;if(/^(https?:|data:|\.{0,2}\/)|\.(svg|png|webp|jpe?g)$/i.test(r))return`<img src="`+n(r)+`" alt="" width="`+t+`" height="`+t+`">`;if(c[r])return`<svg width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="currentColor"><path d="`+c[r]+`"></path></svg>`;let i=s[r];return i?`<svg width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="`+(t>=20?1.75:2)+`" stroke-linecap="round" stroke-linejoin="round">`+i+`</svg>`:null},u={toilets:[`restroom`,`restrooms`,`toilet`,`wc`,`bathroom`,`washroom`,`loo`,`lavatory`],information:[`info`,`help`,`help desk`,`information desk`,`concierge`],parking:[`car park`,`garage`],atm:[`cash`,`cash machine`],elevator:[`lift`],baby:[`baby change`,`changing room`,`nursing`]},d=(e,t)=>e?t[e]?e:Object.keys(t).find(n=>t[n].label===e||t[n].name===e)||String(e).toLowerCase():null,f=(e,t,n)=>{if(!e)return null;let r=t[e]||{},i=Object.fromEntries((n||[]).map(e=>[e.id,e]));if(r.category&&i[r.category])return i[r.category];let a=(n||[]).filter(e=>e.kind===`amenity`),o=e=>String(e||``).toLowerCase().replace(/[^a-z0-9]+/g,` `).trim().replace(/s$/,``),s=new Set([e,r.name,r.label].concat(u[e]||[]).map(o));return a.find(t=>t.id===e)||a.find(e=>s.has(o(e.id))||s.has(o(e.name)))||null},p=(e,t)=>(t&&t.color&&e.style.setProperty(`--mp-cc`,t.color),t&&t.color&&e.classList.contains(`mp-dir-pip`)&&e.style.setProperty(`--mp-cc`,MapplicData.readableOn(`#ffffff`,t.color,3)),e),m=(e,n)=>{let o=t(`div`,`mp-dir-thumb`);if(n===`card`&&e.photo){let n=t(`img`,`mp-dir-photo`);n.src=e.photo,n.alt=``,n.loading=`lazy`,o.append(n)}else if(e.logo&&(e.logo.svg||/^\s*</.test(e.logo.image||``))){let t=e.logo.svg||e.logo.image;o.innerHTML=t,i(t)&&o.classList.add(`mp-dir-dark`),MapplicData.svgIsMono(t)&&o.classList.add(`mp-logo-mono`),n!==`card`&&a(t)&&o.classList.add(`mp-dir-bleed`)}else if(e.logo&&e.logo.image){let n=t(`img`,`mp-dir-logo`);o.classList.add(`mp-dir-raster`),n.onload=()=>MapplicData.imageIsMono(n)&&o.classList.add(`mp-logo-mono`),n.src=e.logo.image,n.alt=``,o.append(n)}else o.textContent=r(e.name);return o},h=(e,i,a)=>{let o=a||(e=>MapplicData.categoryName(e)),s=t(`span`,`mp-dir-cats`),c=t(`span`,`mp-dir-pips`),u=e.map(e=>o(e.name||e.id));return e.slice(0,3).forEach((e,i)=>{let a=p(t(`span`,`mp-dir-pip`,l(e.icon,12)||n(r(u[i]).slice(0,1))),e);c.append(a)}),s.title=u.join(`, `),s.append(c,t(`span`,`mp-dir-cat`,n(i||u[0]))),e.length>1&&s.append(t(`span`,`mp-dir-more`,`+`+(e.length-1))),s};return{css:{".mp-dir-item":`position:relative;display:grid;align-items:center;gap:12px;width:100%;min-width:0;box-sizing:border-box;padding:8px;border:0;border-radius:calc(10px * var(--mp-rk, 1));background:transparent;font:inherit;text-align:left;color:var(--mp-fg);cursor:pointer;transition:background-color 200ms ease,box-shadow 200ms ease`,".mp-dir-item:hover, .mp-dir-item.mp-hover":`background:var(--mp-bg-muted)`,".mp-dir-item.mp-active, .mp-dir-item.mp-active:hover":`background:var(--mp-focus)`,".mp-dir-item.mp-active .mp-dir-name":`color:var(--mp-focus-fg)`,".mp-dir-item:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-dir-text":`min-width:0;display:flex;flex-direction:column;gap:2px`,".mp-dir-name":`font-size:14px;font-weight:500;line-height:1.3;color:var(--mp-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap`,".mp-dir-sub":`display:flex;align-items:center;gap:6px;min-width:0;font-size:13px;line-height:1.35;color:var(--mp-fg-muted);white-space:nowrap;overflow:hidden`,".mp-dir-cat":`min-width:0;overflow:hidden;text-overflow:ellipsis`,".mp-dir-cats":`display:flex;align-items:center;gap:6px;min-width:0`,".mp-dir-pips":`flex:none;display:flex;align-items:center;gap:2px`,".mp-dir-pip":`flex:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;font-size:10px;font-weight:700;line-height:1;background:var(--mp-cc, var(--mp-bg-muted));color:#fff`,'.mp-dir-pip:not([style*="--mp-cc"])':`color:var(--mp-fg-tertiary)`,".mp-dir-pip svg, .mp-dir-pip img":`display:block;width:12px;height:12px;object-fit:contain`,".mp-dir-more":`flex:none;font-size:12px;font-weight:500;color:var(--mp-fg-tertiary)`,".mp-dir-sub .mp-hours-badge":`flex:none`,".mp-dir-sub .mp-hours-closed":`display:none`,".mp-dir-level":`flex:none;display:inline-flex;align-items:center;height:18px;padding:0 6px;border-radius:calc(5px * var(--mp-rk, 1));background:var(--mp-bg-muted);color:var(--mp-fg-tertiary);font-size:11px;font-weight:600;letter-spacing:0.02em`,".mp-dir-item.mp-active .mp-dir-level":`background:var(--mp-accent-subtle-hover);color:var(--mp-focus-fg)`,".mp-dir-end":`display:flex;align-items:center;justify-content:flex-end;min-width:0`,".mp-dir-item .mp-hours-dot":`animation:none`,".mp-dir-item .mp-hours-badge":`font-size:12px`,".mp-dir-thumb":`flex:none;display:flex;align-items:center;justify-content:center;overflow:hidden;background:var(--mp-bg-muted);color:var(--mp-fg-tertiary);font-weight:600;letter-spacing:-0.01em`,".mp-dir-thumb.mp-dir-dark, .mp-dir-i-card .mp-dir-thumb.mp-dir-dark":`background-color:var(--mp-fg-strong);background-image:none`,".mp-dir-thumb.mp-dir-bleed svg":`width:100%;height:100%`,".mp-dir-thumb svg, .mp-dir-thumb img.mp-dir-logo":`width:76%;height:76%;object-fit:contain`,".mp-dir-thumb.mp-dir-raster":`background:#fff;outline:1px solid rgba(9,9,11,0.08);outline-offset:-1px`,".mp-dir-thumb.mp-dir-raster img.mp-dir-logo":`width:100%;height:100%;object-fit:contain`,".mp-dir-thumb.mp-logo-mono svg, .mp-dir-thumb.mp-logo-mono img.mp-dir-logo":`filter:var(--mp-logo-filter)`,".mp-dir-thumb img.mp-dir-photo":`width:100%;height:100%;object-fit:cover`,".mp-dir-i-text":`grid-template-columns:minmax(0,1fr);padding:10px 10px`,".mp-dir-i-logo":`grid-template-columns:40px minmax(0,1fr)`,".mp-dir-i-logo .mp-dir-thumb":`width:40px;height:40px;border-radius:calc(10px * var(--mp-rk, 1));font-size:13px`,".mp-dir-i-card":`grid-template-columns:minmax(0,1fr);align-items:start;gap:10px;padding:6px 6px 10px`,".mp-dir-i-card .mp-dir-thumb":`width:100%;aspect-ratio:16 / 10;border-radius:calc(8px * var(--mp-rk, 1));font-size:20px;background-color:var(--mp-bg-muted)`,".mp-dir-i-card .mp-dir-thumb svg, .mp-dir-i-card .mp-dir-thumb img.mp-dir-logo":`width:44%;height:52%`,".mp-dir-i-card .mp-dir-text":`padding:0 4px;gap:3px`,".mp-dir-i-card .mp-dir-end":`justify-content:flex-start;padding:0 4px`,".mp-dir-i-tile":`grid-template-columns:minmax(0,1fr);justify-items:center;text-align:center;gap:8px;padding:14px 8px 12px`,".mp-dir-i-tile .mp-dir-thumb":`width:56px;height:56px;border-radius:calc(14px * var(--mp-rk, 1));font-size:16px`,".mp-dir-i-tile .mp-dir-text":`align-items:center;width:100%`,".mp-dir-i-tile .mp-dir-sub":`justify-content:center;flex-wrap:wrap;row-gap:4px;max-width:100%`,".mp-dir-i-tile .mp-dir-cats":`justify-content:center;max-width:100%`,".mp-dir-item .mp-hours-unknown":`display:none`,".mp-dir-compact":`padding:6px 8px;gap:10px;border-radius:calc(8px * var(--mp-rk, 1))`,".mp-dir-compact.mp-dir-i-logo":`grid-template-columns:32px minmax(0,1fr)`,".mp-dir-compact .mp-dir-thumb":`width:32px;height:32px;border-radius:calc(8px * var(--mp-rk, 1));font-size:12px`,".mp-dir-item mark":`background:transparent;color:inherit;font-weight:700`,".mp-dir-thumb.mp-dir-icon":`background:color-mix(in srgb, var(--mp-cc, #1476ff) 12%, var(--mp-surface));color:color-mix(in srgb, var(--mp-cc, #1476ff) 75%, var(--mp-fg))`,".mp-dir-thumb.mp-dir-icon svg":`width:auto;height:auto`,".mp-cat-icon":`flex:none;display:inline-flex;color:var(--mp-cc, currentColor)`,".mp-cat-icon img":`display:block;object-fit:contain`,".mp-fade":`-webkit-mask-image:linear-gradient(to right, transparent 0, #000 var(--mp-fl, 0px), #000 calc(100% - var(--mp-fr, 0px)), transparent 100%);mask-image:linear-gradient(to right, transparent 0, #000 var(--mp-fl, 0px), #000 calc(100% - var(--mp-fr, 0px)), transparent 100%)`},item:(e,r={})=>{let i=r.style||`logo`,a=t(`button`,`mp-dir-item mp-dir-i-`+i+(r.compact?` mp-dir-compact`:``));a.type=`button`,e.id&&(a.setAttribute(`data-mp-hover`,e.id),a.setAttribute(`data-id`,e.id)),r.thumb?a.append(r.thumb):i!==`text`&&a.append(m(e,i));let o=t(`div`,`mp-dir-text`),s=t(`div`,`mp-dir-name`,n(e.name)),c=t(`div`,`mp-dir-sub`);r.levelOf&&[...new Set(r.levels||[e.level])].forEach(e=>{let i=r.levelOf(e)||{},a=t(`span`,`mp-dir-level`,n(i.short||i.name||``));a.title=i.name||``,c.append(a)});let l=i!==`card`&&r.badge&&r.badge(`dot`);l&&c.append(l);let u=r.subText==null?e.categoryName:r.subText;r.cats&&r.cats.length?c.append(h(r.cats,r.catLabel||u,r.categoryName)):u&&c.append(t(`span`,`mp-dir-cat`,n(u))),o.append(s),c.childNodes.length&&o.append(c),a.append(o);let d=i===`card`&&r.badge&&r.badge(`full`);if(d){let e=t(`div`,`mp-dir-end`);e.append(d),a.append(e)}return a._name=s,a},thumb:m,dragScroll:o,initials:r,icon:l,tint:p,ICONS:s,SYNONYMS:u,amenityKey:d,amenityCategory:f,categoriesOf:e=>e?MapplicData.categoryList(e.category):[],groupCats:(e,t,n)=>{let r=e.length?e:t?[`amenity`]:[];return[...new Set(r.map(e=>n[e]===`amenity`?`amenity`:e))]},isFeatured:e=>!!e&&(e.featured===!0||/^(true|1|yes)$/i.test(String(e.featured||``).trim()))}})(),MapplicMap.plugin(`directory`,e=>{let t=e.plugin(`directory`),n=document,r=e=>t.setting(e),i=(t,n)=>e.ui.t(t,n),a=e.memory;a.closed=a.closed||{};let o=MapplicMap.svgIcon,s={chevronDown:o(`<path d="m6 9 6 6 6-6"></path>`,14),chevronLeft:o(`<path d="m15 18-6-6 6-6"></path>`),chevronRight:o(`<path d="m9 18 6-6-6-6"></path>`),chevronUp:o(`<path d="m18 15-6-6-6 6"></path>`),x:o(`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`,14)},c=(e,t,r)=>{let i=n.createElement(e);return t&&(i.className=t),r!=null&&(i.innerHTML=r),i},l=MapplicMap.escapeHtml,u=t=>{try{return e.plugin(t).enabled()}catch{return!1}},d=MapplicMap.PLACE,f=d.dragScroll;e.ui.style(Object.assign({},d.css,{".mp-directory":`display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;box-sizing:border-box;background:var(--mp-surface);font-family:Onest,sans-serif;color:var(--mp-fg);position:relative`,".mp-dock.mp-directory":`pointer-events:auto`,".mp-dir-left":`border-right:1px solid var(--mp-border)`,".mp-dir-right":`border-left:1px solid var(--mp-border)`,".mp-directory.mp-dir-bottom":`height:auto;background:transparent`,".mp-dir-bottom .mp-dir-item":`background:var(--mp-surface)`,".mp-dir-bottom .mp-dir-item:hover, .mp-dir-bottom .mp-dir-item.mp-hover":`background:var(--mp-bg-muted)`,".mp-dir-bottom .mp-dir-item.mp-active, .mp-dir-bottom .mp-dir-item.mp-active:hover":`background:var(--mp-focus)`,".mp-dir-bottom .mp-dir-search":`width:100%;max-width:var(--mp-dir-sw, 420px);align-self:center`,".mp-dir-bottom.mp-dir-sticky .mp-dir-gtitle, .mp-dir-bottom .mp-dir-gtitle":`position:static;background:transparent`,".mp-dir-grow .mp-dir-body":`flex:none;overflow:visible;overscroll-behavior:auto`,".mp-dir-pin .mp-dir-head":`position:sticky;top:var(--mp-sticky-top, 0px);z-index:3`,".mp-dir-pin .mp-dir-search":`position:relative`,".mp-dir-veil":`position:absolute;left:-56px;right:-56px;top:-32px;bottom:-40px;z-index:-1;pointer-events:none;opacity:0;transition:opacity 150ms ease;-webkit-backdrop-filter:blur(14px) saturate(1.3);backdrop-filter:blur(14px) saturate(1.3);background:var(--mp-veil, color-mix(in srgb, var(--mp-bg) 28%, transparent));-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);-webkit-mask-composite:source-in;mask-composite:intersect`,".mp-dir-stuck .mp-dir-veil":`opacity:1`,".mp-directory:not(.mp-dir-grow) .mp-dir-body":`-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--mp-dir-ft, 0px),#000 calc(100% - var(--mp-dir-fb, 0px)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--mp-dir-ft, 0px),#000 calc(100% - var(--mp-dir-fb, 0px)),transparent 100%)`,".mp-dir-floating, .mp-dir-sheet":`position:absolute;box-shadow:var(--mp-shadow-float);overflow:hidden;transition:height 200ms ease`,".mp-dir-floating":`top:16px;border-radius:calc(14px * var(--mp-rk, 1));height:calc(100% - 32px)`,".mp-dir-sheet":`left:0;right:0;bottom:0;height:55%;border-radius:calc(16px * var(--mp-rk, 1)) calc(16px * var(--mp-rk, 1)) 0 0`,".mp-still.mp-dir-floating, .mp-still.mp-dir-sheet":`transition:none`,".mp-dir-collapsed .mp-dir-rail":`visibility:hidden`,".mp-dir-tools":`display:flex;align-items:center;gap:8px;margin:-4px -6px -4px auto`,".mp-dir-wide .mp-search-ui":`flex-direction:row;align-items:center;gap:12px`,".mp-dir-wide .mp-search-ui > .mp-search-bar":`flex:0 1 340px;min-width:200px`,".mp-dir-wide .mp-search-ui > .mp-search-chips":`flex:1;min-width:0`,".mp-dir-head":`flex:none;display:flex;flex-direction:column;gap:12px;padding:16px 16px 4px`,".mp-dir-bottom .mp-dir-head":`padding:16px 16px 8px`,".mp-dir-titlerow":`display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px`,".mp-dir-title":`font-size:16px;font-weight:600;letter-spacing:-0.01em;color:var(--mp-fg)`,".mp-dir-iconbtn":`flex:none;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;color:var(--mp-fg-muted);cursor:pointer;padding:0;transition:background-color 150ms ease,color 150ms ease`,".mp-dir-iconbtn:hover":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,".mp-dir-bar-toggle":`cursor:pointer;user-select:none`,".mp-dir-iconbtn svg":`pointer-events:none`,".mp-dir-bar-toggle:hover .mp-dir-collapse":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,".mp-dir-bar":`flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 16px 8px;font-size:13px;color:var(--mp-fg-muted);min-height:20px`,".mp-dir-bar[hidden]":`display:none`,".mp-dir-bar[hidden] + .mp-dir-body":`padding-top:4px`,".mp-dir-link":`border:0;background:transparent;padding:2px 0;font:inherit;font-size:13px;font-weight:500;color:var(--mp-accent);cursor:pointer`,".mp-dir-link:hover":`color:var(--mp-accent-subtle-fg)`,".mp-dir-body":`flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 8px 8px;scrollbar-width:thin;scrollbar-color:var(--mp-border) transparent`,".mp-dir-with-rail .mp-dir-body":`padding-right:28px`,".mp-dir-group + .mp-dir-group":`margin-top:8px`,".mp-dir-gtitle":`display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:12px 8px 6px;box-sizing:border-box;border:0;background:var(--mp-surface);font:inherit;font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-fg-muted);text-align:left`,".mp-dir-sticky .mp-dir-gtitle":`position:sticky;top:0;z-index:1`,"button.mp-dir-gtitle":`cursor:pointer`,"button.mp-dir-gtitle:hover":`color:var(--mp-fg-strong)`,".mp-dir-glabel":`display:inline-flex;align-items:center;gap:8px;min-width:0`,".mp-dir-gmeta":`display:flex;align-items:center;gap:6px;letter-spacing:0;font-weight:500;color:var(--mp-fg-subtle)`,".mp-dir-gmeta svg":`transition:transform 150ms ease`,".mp-dir-gclosed .mp-dir-gmeta svg":`transform:rotate(-90deg)`,".mp-dir-fold":`display:grid;grid-template-rows:1fr;transition:grid-template-rows 200ms ease, opacity 200ms ease`,".mp-dir-fold > .mp-dir-items":`min-height:0;overflow:hidden`,".mp-dir-gclosed .mp-dir-fold":`grid-template-rows:0fr;opacity:0`,".mp-still .mp-dir-fold, .mp-still .mp-dir-gmeta svg":`transition:none`,".mp-dir-items":`display:grid;gap:2px`,".mp-dir-grid .mp-dir-items":`gap:8px;padding:2px 0`,".mp-dir-grid .mp-dir-items:has(> .mp-dir-i-text, > .mp-dir-i-logo)":`row-gap:2px`,".mp-dir-grid .mp-dir-i-tile, .mp-dir-grid .mp-dir-i-card, .mp-dir-reel .mp-dir-item":`box-shadow:inset 0 0 0 1px var(--mp-border)`,".mp-dir-grid .mp-dir-item.mp-active, .mp-dir-reel .mp-dir-item.mp-active":`box-shadow:inset 0 0 0 1px var(--mp-accent-subtle-hover)`,".mp-dir-reel":`display:grid;grid-auto-flow:column;gap:10px;align-items:stretch;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;padding:8px 8px 12px;margin:0 -8px 4px;user-select:none;-webkit-user-select:none`,".mp-dir-reel::-webkit-scrollbar":`display:none`,".mp-dir-reel > *":`transform:translateX(var(--mp-over, 0px))`,".mp-dir-reel .mp-dir-item":`align-content:start`,".mp-dir-reel .mp-dir-i-card .mp-dir-thumb":`aspect-ratio:16 / 9`,".mp-dir-reel img":`pointer-events:none;-webkit-user-drag:none`,".mp-dir-empty":`display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:16px 8px;font-size:14px;color:var(--mp-fg-muted)`,".mp-dir-rail":`position:absolute;right:4px;top:0;bottom:0;display:flex;flex-direction:column;justify-content:center;gap:0;padding:4px 0 12px;pointer-events:auto`,".mp-dir-rail button":`flex:0 1 16px;min-height:9px;width:20px;border:0;background:transparent;padding:0;font:inherit;font-size:10px;font-weight:600;color:var(--mp-fg-muted);cursor:pointer;border-radius:calc(4px * var(--mp-rk, 1));line-height:1;overflow:hidden`,".mp-dir-rail button:hover":`background:var(--mp-bg-muted);color:var(--mp-fg)`,".mp-dir-rail button:disabled":`color:var(--mp-border-strong);cursor:default;background:transparent`,".mp-dir-tab":`position:absolute;z-index:6;display:flex;align-items:center;justify-content:center;border:0;background:transparent;color:var(--mp-border-strong);cursor:pointer;padding:0;outline:none;transition:color 150ms ease`,".mp-dir-tab:hover, .mp-dir-tab:focus-visible":`--mp-bend:22deg;color:var(--mp-fg)`,".mp-dir-bend":`position:relative;display:block;width:26px;height:10px;pointer-events:none`,".mp-dir-bend i":`position:absolute;top:3.5px;width:14.5px;height:3px;border-radius:999px;background:currentColor;transition:transform 200ms ease`,".mp-dir-bend i:first-child":`left:0;transform-origin:13px 50%;transform:rotate(calc(var(--mp-bend, 0deg) * var(--mp-bend-dir, 1)))`,".mp-dir-bend i:last-child":`right:0;transform-origin:1.5px 50%;transform:rotate(calc(var(--mp-bend, 0deg) * var(--mp-bend-dir, 1) * -1))`,".mp-dir-tab-left .mp-dir-bend, .mp-dir-tab-right .mp-dir-bend":`width:10px;height:26px`,".mp-dir-tab-left .mp-dir-bend i, .mp-dir-tab-right .mp-dir-bend i":`top:auto;left:3.5px;right:auto;width:3px;height:14.5px`,".mp-dir-tab-left .mp-dir-bend i:first-child, .mp-dir-tab-right .mp-dir-bend i:first-child":`top:0;transform-origin:50% 13px`,".mp-dir-tab-left .mp-dir-bend i:last-child, .mp-dir-tab-right .mp-dir-bend i:last-child":`bottom:0;transform-origin:50% 1.5px`,".mp-dir-tab-left":`left:4px;top:50%;width:32px;height:72px;margin-top:-36px`,".mp-dir-tab-right":`right:4px;top:50%;width:32px;height:72px;margin-top:-36px`,".mp-dir-tab-bottom":`bottom:4px;left:50%;width:72px;height:32px;margin-left:-36px`,".mp-dir-tab.mp-dir-tab-touch":`--mp-bend:22deg;color:var(--mp-fg-tertiary)`,".mp-dir-tab.mp-dir-tab-still .mp-dir-bend i":`transition:none`,".mp-dir-handle":`width:36px;height:4px;border-radius:999px;background:var(--mp-border-strong);margin:-8px auto -4px;border:10px solid transparent;background-clip:padding-box;cursor:grab`,".mp-dir-sheet .mp-dir-head":`touch-action:none`,".mp-dir-sheet .mp-search-chips":`touch-action:pan-x`,".mp-dir-dragging":`transition:none !important`,".mp-dir-empty .mp-search-empty":`padding:0`,".mp-dir-body > .mp-search-understood":`padding:8px 8px 4px`}));let p=[],m={},h=[],g={},_=()=>e.data.levels(),v=e=>_().find(t=>t.index===e)||{name:``,short:``},y=()=>Object.fromEntries(e.data.units().map(e=>[e.id,e.logo||e.thumb||null])),b=()=>{let t=e.data.section(`categories`)||[],n=Object.fromEntries(t.map(e=>[e.id,e.kind||`store`])),r=e.data.amenityTypes(),i=e=>{let t=Object.keys(r).find(t=>t===e||r[t].label===e);return t&&r[t].name||e||``},a=y();h=t.map(e=>e.id),g=Object.fromEntries(t.map(e=>[e.id,e])),p=[],m={};let o={};e.data.stores().map(e=>[e,`store`]).concat(e.data.amenities().map(e=>[e,`amenity`])).forEach(([s,c])=>{if(m[s.id])return;let l=s.location&&o[s.location];if(l){l.ids.push(s.id),l.units.push({id:s.id,level:s.level}),l.levels.includes(s.level)||l.levels.push(s.level),l.levels.sort((e,t)=>e-t),m[s.id]=l;return}let u=s.location&&e.data.location(s.location)||{},f=!u.category&&c===`amenity`?d.amenityCategory(d.amenityKey(s.type,r),r,t):null,h=d.categoriesOf(u),_=h[0]||(c===`amenity`?f?f.id:`amenity`:null);if(h.length&&h.every(e=>n[e]===`service`))return;let v=d.groupCats(h,c===`amenity`,n),y=u.amenity||(c===`amenity`?s.type||`amenity`:null),b={id:s.id,info:s,name:s.name,amenity:y,category:_,categories:v,categoryName:c===`amenity`&&!u.category?i(s.type):h.length>1?h.map(t=>g[t]&&e.data.categoryName(g[t].name)||t).join(`, `):s.category||``,level:s.level,ids:[s.id],units:[{id:s.id,level:s.level}],levels:[s.level],hours:s.hours,logo:a[s.id]||null,cat:g[_]||null,cats:(h.length?h.filter(e=>n[e]!==`service`):_?[_]:[]).map(e=>g[e]).filter(Boolean),mainName:h.length&&g[h[0]]?e.data.categoryName(g[h[0]].name):``,photo:s.images&&s.images[0]&&(s.images[0].src||s.images[0])||null,featured:d.isFeatured(u),els:{},reelEl:null};p.push(b),m[b.id]=b,s.location&&(o[s.location]=b)})},x=t=>{let n=e.getState();return(t.units.find(e=>e.level===n.level)||t.units[0]).id},S=(t,n)=>{if(!t.hours||!r(`show_hours`)||!u(`hours`))return null;try{return e.plugin(`hours`).badge(t.info,{variant:n,theme:`light`})}catch{return null}},C=``,w=e=>Object.values(e.els).concat(e.reelEl||[]),T=(t,n)=>{let i=n||r(`item`),a=d.item(t,{style:i,levels:t.levels,levelOf:r(`show_level`)&&_().length>1?v:null,subText:r(`show_category`)?t.categoryName:``,cats:r(`show_category`)&&r(`category_style`)!==`text`?t.cats:null,catLabel:t.mainName,categoryName:e.data.categoryName,badge:e=>S(t,e)});return a.onmouseenter=()=>e.view.hover(x(t)),a.onmouseleave=()=>e.view.hover(null),a.onfocus=()=>e.view.hover(x(t)),a.onblur=()=>e.view.hover(null),a.onclick=()=>{e.view.select({id:x(t)}),U()},a},E=null,D=null,O=null,k=null,A=null,j=null,M=null,N=`left`,P=null,F=null,I=null,ee=()=>u(`search`)?e.plugin(`search`):null,L=`mp-dir-`+Math.random().toString(36).slice(2,8),R=()=>!!a.collapsed,z=e=>{a.collapsed=e,!e&&a.snap===`peek`&&(a.snap=`half`),re()},te=()=>a.collapsed?`peek`:a.snap===`full`?`full`:`half`,B=e=>{a.snap=e,a.collapsed=e===`peek`,re()},V={half:`55%`,full:`calc(100% - 56px)`},H=()=>{let t=e.ui.container.clientHeight;return{peek:A?A.offsetTop+4:120,half:Math.round(t*.55),full:Math.max(Math.round(t*.55),t-56)}},ne=e=>{let t=null,n=0,r=0,i=0,a=0,o=0,s=!1;e.addEventListener(`pointerdown`,e=>{N!==`sheet`||e.button>0||e.target.closest(`input, button, select, label, .mp-search-chips`)||(t=e.pointerId,n=i=e.clientY,a=performance.now(),r=E.offsetHeight,o=0,s=!1)}),e.addEventListener(`pointermove`,c=>{if(c.pointerId!==t)return;if(!s&&Math.abs(c.clientY-n)>4){s=!0;try{e.setPointerCapture(t)}catch{}E.classList.add(`mp-dir-dragging`)}if(!s)return;let l=H();E.style.height=Math.max(l.peek,Math.min(l.full+24,r+n-c.clientY))+`px`;let u=performance.now();u>a&&(o=.7*((i-c.clientY)/(u-a))+.3*o),i=c.clientY,a=u});let c=e=>{if(e.pointerId!==t)return;if(t=null,E.classList.remove(`mp-dir-dragging`),!s){e.target.closest(`.mp-dir-handle`)&&B({peek:`half`,half:`full`,full:`half`}[te()]);return}performance.now()-a>80&&(o=0);let n=H(),r=E.offsetHeight+o*200;B([`peek`,`half`,`full`].reduce((e,t)=>Math.abs(n[t]-r)<Math.abs(n[e]-r)?t:e,`half`))};e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,c)},re=()=>{if(!E)return;let e=R();if(D&&D.update({size:e?0:oe()}),E.classList.toggle(`mp-dir-collapsed`,e&&!D),!D&&A){let t=N===`sheet`?V[te()]||V.half:`calc(100% - 32px)`,n=A.offsetTop+4+`px`,r=E.offsetHeight+`px`;E.style.height=r,E.offsetHeight,E.style.height=e?n:t}O&&(O.style.setProperty(`--mp-bend-dir`,String((N===`right`?-1:1)*(e?-1:1))),O.title=i(e?`directory_expand`:`directory_collapse`),O.setAttribute(`aria-label`,O.title),O.setAttribute(`aria-expanded`,e?`false`:`true`));let t=F;t&&(t.innerHTML=e?s.chevronDown:s.chevronUp,t.title=i(e?`directory_expand`:`directory_collapse`)),me()},ie=()=>r(`height`)===`fixed`||r(`height`)===`map`,ae=()=>r(`height`)===`map`?Math.max(160,Math.round(e.ui.size().height*(+r(`map_share`)||50)/100)):+r(`max_height`)||600,oe=()=>N===`bottom`?ie()?ae():`auto`:r(`width`),se=e=>{let t=e.parentElement;for(;t&&t!==n.body&&t!==n.documentElement;){let e=getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null},U=()=>{if(N!==`bottom`)return;let t=e.ui.container,n=t.getBoundingClientRect(),r=se(t),i=r?r.getBoundingClientRect():{top:0,bottom:window.innerHeight,height:window.innerHeight};if(Math.min(n.bottom,i.bottom)-Math.max(n.top,i.top)>=Math.min(n.height,i.height)*.6)return;let a=n.top-i.top-Math.max(16,(i.height-n.height)/2);(r||window).scrollBy({top:a,behavior:e.ui.env().reducedMotion?`auto`:`smooth`})},ce=()=>{if(!E||!A||E.classList.contains(`mp-dir-grow`))return;let e=A.scrollHeight-A.clientHeight-A.scrollTop>2,t=A.scrollTop>2;A.style.setProperty(`--mp-dir-ft`,t?`16px`:`0px`),A.style.setProperty(`--mp-dir-fb`,e?`32px`:`0px`),e!==E.classList.contains(`mp-dir-more`)&&E.classList.toggle(`mp-dir-more`,e)},le=null,ue=e=>{let t=0,r=()=>{if(t=0,!E||!e.isConnected)return;let n=e.getBoundingClientRect().top-E.getBoundingClientRect().top>1;n!==E.classList.contains(`mp-dir-stuck`)&&E.classList.toggle(`mp-dir-stuck`,n)},i=(e,t)=>{for(let n=t;n;n=n.getRootNode().host)if(e.contains&&e.contains(n))return!0;return!1},a=e=>{let a=e.target;t||!E||a!==n&&a!==n.documentElement&&!i(a,E)||(t=requestAnimationFrame(r))},o=E&&E.getRootNode().host?E.getRootNode():null;n.addEventListener(`scroll`,a,{capture:!0,passive:!0}),o&&o.addEventListener(`scroll`,a,{capture:!0,passive:!0}),le=()=>{n.removeEventListener(`scroll`,a,{capture:!0}),o&&o.removeEventListener(`scroll`,a,{capture:!0}),t&&cancelAnimationFrame(t),le=null}},de=()=>e.ui.size().width+((N===`left`||N===`right`)&&D&&!R()?r(`width`):0),fe=()=>de()<640,pe=[`--mp-inset-l`,`--mp-inset-r`,`--mp-inset-bl`,`--mp-inset-br`],me=()=>{let t=e.ui.container;if(pe.forEach(e=>t.style.removeProperty(e)),E&&N===`sheet`?e.ui.inset(R()?null:{bottom:H()[te()]}):E&&/^floating-/.test(N)&&!R()?e.ui.inset({[N===`floating-right`?`right`:`left`]:r(`width`)+16}):e.ui.inset(null),!E||!/^floating-/.test(N))return;let n=r(`width`)+16+`px`,i=N===`floating-right`;t.style.setProperty(i?`--mp-inset-r`:`--mp-inset-l`,n),R()||t.style.setProperty(i?`--mp-inset-br`:`--mp-inset-bl`,n)},he=()=>{k&&k.destroy(),k=null,le&&le(),D&&D.remove(),D=null,E&&E.remove(),O&&O.remove(),E=O=A=j=M=P=null,p.forEach(e=>(e.els={},e.reelEl=null));let t=e.ui.container;pe.forEach(e=>t.style.removeProperty(e)),e.ui.inset(null)},ge=()=>{let t=fe(),n=!!(r(`toggle`)&&r(`collapsed`));r(`toggle`)?a.startCollapsed!==n&&(a.collapsed=n):a.collapsed=!1,a.startCollapsed=n,he(),b(),C=``;let o=r(`placement`);I=t,N=t?/^floating-/.test(o)?`sheet`:`bottom`:o;let s=r(`columns`)===1?`list`:`grid`;E=c(`div`,`mp-directory mp-dir-`+N+` mp-dir-`+s+(N===`bottom`?ie()?` mp-dir-capped`:` mp-dir-grow`+(r(`sticky_search`)?` mp-dir-pin`:``):``)+(e.ui.env().reducedMotion?` mp-still`:``)+(r(`collapsible`)?``:` mp-dir-sticky`)+(r(`group`)===`letter`&&r(`rail`)?` mp-dir-with-rail`:``));let u=c(`div`,`mp-dir-head`),d=r(`title`),f=/^floating-/.test(N)||N===`sheet`;if(N===`sheet`){let e=c(`div`,`mp-dir-handle`);e.setAttribute(`aria-hidden`,`true`),u.append(e),ne(u)}if(d){let e=c(`div`,`mp-dir-titlerow`);e.append(c(`div`,`mp-dir-title`,l(d))),u.append(e)}F=null,f&&r(`toggle`)&&(F=c(`button`,`mp-dir-iconbtn mp-dir-collapse`),F.type=`button`,F.onclick=e=>{e.stopPropagation(),z(!R())});let p=ee();if(p){let t=c(`div`,`mp-dir-search`);u.append(t);let n=typeof p.setting==`function`?+p.setting(`max_width`):0;n>0&&E.style.setProperty(`--mp-dir-sw`,n+`px`),k=p.mountUi(t,{count:!1,onEnter:t=>{let n=ee(),r=n&&n.interpret();r&&r.route?n.act():t?e.view.select({id:t}):n&&n.emptyEnter()},onArrow:()=>{let e=A&&A.querySelector(`.mp-dir-item`);e&&e.focus()}}),k.input.setAttribute(`aria-controls`,L),k.input.addEventListener(`focus`,()=>{N===`sheet`?te()!==`full`&&B(`full`):R()&&f&&z(!1)})}u.childNodes.length&&(E.append(u),E.classList.contains(`mp-dir-pin`)&&((u.querySelector(`.mp-dir-search`)||u).prepend(c(`div`,`mp-dir-veil`)),ue(u))),j=c(`div`,`mp-dir-bar`),A=c(`div`,`mp-dir-body`),A.id=L,A.setAttribute(`aria-label`,d||i(`search_places`)),A.addEventListener(`keydown`,be),A.addEventListener(`scroll`,ye,{passive:!0}),window.ResizeObserver&&new ResizeObserver(ye).observe(A),E.append(j,A),E.classList.contains(`mp-dir-with-rail`)&&(M=c(`div`,`mp-dir-rail`),E.append(M)),f?(N!==`sheet`&&(E.style.width=r(`width`)+`px`,E.style[N===`floating-right`?`right`:`left`]=`16px`),N!==`sheet`&&E.classList.add(`mp-dir-floating`),e.ui.mount(E,{layer:`top`})):(D=e.ui.dock(E,{side:N===`bottom`?`below`:N,size:R()?0:oe()}),r(`toggle`)&&(O=c(`button`,`mp-dir-tab mp-dir-tab-`+N),O.type=`button`,O.innerHTML=`<span class="mp-dir-bend"><i></i><i></i></span>`,O.classList.toggle(`mp-dir-tab-touch`,!!(window.matchMedia&&window.matchMedia(`(hover: none)`).matches)),O.classList.toggle(`mp-dir-tab-still`,!!e.ui.env().reducedMotion),O.onclick=()=>z(!R()),e.ui.mount(O))),re(),Se(),K(e.getState().selected,!1)},_e=()=>{if(!M||!A)return;let e=P&&P.parentNode===A?P.getBoundingClientRect().bottom-A.getBoundingClientRect().top+4:0;M.style.top=A.offsetTop+Math.max(0,e)+`px`,M.style.visibility=A.clientHeight-Math.max(0,e)<120?`hidden`:``},ve=0,ye=()=>{ve||=requestAnimationFrame(()=>{ve=0,_e(),ce()})},be=e=>{if(![`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=[...A.querySelectorAll(`.mp-dir-item`)].filter(e=>e.offsetParent),r=t.indexOf(n.activeElement);if(r<0)return;e.preventDefault();let i=e.key===`ArrowDown`||e.key===`ArrowRight`,a=e.key===`Home`?0:e.key===`End`?t.length-1:r+(i?1:-1);if(a<0&&k)return k.focus();a=Math.max(0,Math.min(t.length-1,a)),t[a].focus()},xe=t=>{if(!u(`hours`)||!t.hours)return 2;try{let n=e.plugin(`hours`).status(t.info).state;return n===`open`||n===`closing`?0:1}catch{return 2}},W=t=>{let n=r(`group`);if(n===`none`)return[{key:``,label:``,items:t}];let a=new Map,o=(e,t,n)=>{a.has(e)||a.set(e,{key:e,label:t,items:[]}),a.get(e).items.push(n)};t.forEach(t=>{if(n===`category`)(t.categories.length?r(`every_category`)?t.categories:t.categories.slice(0,1):[`~`]).forEach((n,r)=>o(n,n===`amenity`?i(`directory_amenities`):g[n]&&e.data.categoryName(g[n].name)||(r?``:t.categoryName)||i(`directory_other`),t));else if(n===`level`)o(`L`+t.levels[0],v(t.levels[0]).name,t);else{let e=String(t.name||``).trim().charAt(0).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toUpperCase(),n=/[A-Z]/.test(e)?e:`#`;o(n,n,t)}});let s=[...a.values()];if(n===`category`){let e=e=>h.includes(e)?h.indexOf(e):999;s.sort((t,n)=>e(t.key)-e(n.key))}else n===`level`?s.sort((e,t)=>+e.key.slice(1)-t.key.slice(1)):s.sort((e,t)=>e.key===`#`?1:t.key===`#`?-1:e.key.localeCompare(t.key));return s},G=()=>{let e=r(`columns`),t={text:140,logo:150,card:180,tile:128}[r(`item`)];if(e===1)return{gridTemplateColumns:`minmax(0, 1fr)`};if(e>1){let n=`calc((100% - `+(e-1)*8+`px) / `+e+`)`;return{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, max(`+t+`px, `+n+`)), 1fr))`}}return{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, `+t+`px), 1fr))`}},Se=()=>{if(!E)return;let t=ee(),n=t?t.state():{active:!1,text:``},o=!!(n.text&&n.text.trim()),m=p.filter(e=>r(`amenities`)||!e.amenity);if(r(`this_level`)){let t=e.getState();t.allLevels||(m=m.filter(e=>e.levels.includes(t.level)))}let h=m.length;if(t&&n.active){let e=new Map(t.results().map((e,t)=>[e.id,t])),n=t=>Math.min(...t.ids.map(t=>e.has(t)?e.get(t):1/0));m=m.filter(e=>n(e)<1/0),o&&m.sort((e,t)=>n(e)-n(t))}if(!o){let e=r(`sort`),t=(e,t)=>e.name.localeCompare(t.name);e===`level`?m.sort((e,n)=>e.levels[0]-n.levels[0]||t(e,n)):e===`open`?m.sort((e,n)=>xe(e)-xe(n)||t(e,n)):m.sort(t)}j.replaceChildren();let _=c(`span`,``,l(n.active?i(`directory_filtered`,{n:m.length,total:h}):i(`directory_places`,{n:h})));(r(`count`)!==!1||n.active)&&j.append(_);let v=c(`div`,`mp-dir-tools`);if(n.active){let e=c(`button`,`mp-dir-link`,l(i(`search_clear`)));e.type=`button`,e.onclick=()=>t.clear(),v.append(e)}F&&v.append(F),v.childNodes.length&&j.append(v),j.hidden=!j.childNodes.length,j.classList.toggle(`mp-dir-bar-toggle`,!!F),j.onclick=F?e=>{e.target.closest&&e.target.closest(`button`)||z(!R())}:null;let y=[r(`item`),r(`show_category`),r(`category_style`),r(`show_level`),r(`show_hours`),r(`category_icons`),u(`hours`)].join(`|`);y!==C&&(C=y,p.forEach(e=>(e.els={},e.reelEl=null)));let b=A.scrollTop,x=A.scrollLeft;A.replaceChildren();let S=r(`reel`)&&!n.active?p.filter(e=>e.featured&&(r(`amenities`)||!e.amenity)):[];if(S.length){P||(P=c(`div`,`mp-dir-reel`),f(P));let e=r(`reel_item`);P.style.gridAutoColumns=e===`tile`?`132px`:e===`logo`?`220px`:`200px`,P.replaceChildren(),S.forEach(t=>{(!t.reelEl||t.reelEl._look!==e)&&(t.reelEl=T(t,e),t.reelEl._look=e,t.reelEl._name.textContent=t.name),P.append(t.reelEl)}),A.append(P),P.style.marginRight=-parseFloat(getComputedStyle(A).paddingRight)+`px`}let w=t&&t.understoodUi&&t.understoodUi();if(w&&m.length&&A.append(w),!m.length){let e=c(`div`,`mp-dir-empty`);t&&n.active?e.append(t.emptyUi()):e.append(c(`span`,``,l(i(`search_none`)))),A.append(e)}let O=o?[{key:``,label:``,items:m}]:W(m),k=G(),N=r(`collapsible`),I=r(`group`);if(O.forEach(e=>{let i=c(`div`,`mp-dir-group`);if(i.dataset.key=e.key,e.label){let t=I+`:`+e.key,o=c(N?`button`:`div`,`mp-dir-gtitle`);N&&(o.type=`button`,o.onclick=()=>{a.closed[t]=!a.closed[t],i.classList.toggle(`mp-dir-gclosed`,!!a.closed[t])},a.closed[t]&&!n.active&&i.classList.add(`mp-dir-gclosed`));let u=c(`span`,`mp-dir-glabel`,l(e.label)),f=I===`category`&&r(`category_icons`)&&g[e.key],p=f&&d.icon(f.icon,14);if(p){let e=d.tint(c(`span`,`mp-cat-icon`,p),f);u.prepend(e)}o.append(u);let m=c(`span`,`mp-dir-gmeta`);r(`counts`)&&m.append(c(`span`,``,String(e.items.length))),N&&m.insertAdjacentHTML(`beforeend`,s.chevronDown),m.childNodes.length&&o.append(m),i.append(o)}let o=c(`div`,`mp-dir-items`),u=c(`div`,`mp-dir-fold`);u.append(o),Object.assign(o.style,k);let f=e.key||`_`;e.items.forEach(e=>{let n=e.els[f]||(e.els[f]=T(e));n._name.innerHTML=t?t.mark(e.name):l(e.name),o.append(n)}),p.length>150&&(i.style.contentVisibility=`auto`,i.style.containIntrinsicSize=`auto `+Math.min(2e3,56*e.items.length+40)+`px`),i.append(u),A.append(i)}),A.scrollTop=b,A.scrollLeft=x,requestAnimationFrame(ce),M){_e(),M.replaceChildren();let e=new Set(O.map(e=>e.key));`#ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``).forEach(t=>{let n=c(`button`,``,t);n.type=`button`,n.disabled=o||!e.has(t),n.onclick=()=>{let e=A.querySelector(`.mp-dir-group[data-key="`+t+`"]`);if(!e)return;if(!E.classList.contains(`mp-dir-grow`))return A.scrollTo({top:e.offsetTop-A.offsetTop,behavior:`auto`});let n=se(E),r=E.querySelector(`.mp-dir-head`),i=E.classList.contains(`mp-dir-pin`)?(parseFloat(getComputedStyle(E).getPropertyValue(`--mp-sticky-top`))||0)+(r?r.offsetHeight:0):0;(n||window).scrollBy({top:e.getBoundingClientRect().top-(n?n.getBoundingClientRect().top:0)-i-8})},M.append(n)})}K(e.getState().selected,!1),R()&&!D&&(E.style.height=A.offsetTop+4+`px`)},Ce=null,K=(t,n)=>{Ce=t||null,p.forEach(e=>{let t=!!Ce&&e.ids.includes(Ce);w(e).forEach(e=>{e.classList.toggle(`mp-active`,t),t?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)})});let r=Ce&&m[Ce],i=r&&Object.values(r.els).find(e=>e.isConnected);if(n&&i&&A){let t=i.getBoundingClientRect(),n=A.getBoundingClientRect(),r=!e.ui.env().reducedMotion;(t.top<n.top+36||t.bottom>n.bottom)&&A.scrollTo({top:A.scrollTop+t.top-n.top-n.height/2+t.height/2,behavior:r?`smooth`:`auto`})}};ge(),e.on(`search`,Se),e.on(`select`,e=>K(e&&e.id,!0)),e.on(`hover`,e=>{p.forEach(t=>w(t).forEach(n=>n.classList.toggle(`mp-hover`,!!e&&t.ids.includes(e))))}),e.on(`level`,()=>{r(`this_level`)&&Se()}),e.on(`plugin`,e=>{(e.id===`directory`||e.id===`search`||e.id===`hours`||e.id===`localization`)&&ge()});let we=0,Te=0;return e.onFrame((e,t)=>{if(N===`bottom`&&D&&r(`height`)===`map`&&!R()){let e=ae();e!==Te&&(Te=e,D.update({size:e}))}fe()===I?we=0:we?t-we>300&&(we=0,ge()):we=t}),e.on(`language`,ge),e.on(`units`,ge),()=>{he(),e.view.hover(null)}}),MapplicMap.plugin(`deeplink`,e=>{let t=e.plugin(`deeplink`),n=MapplicMap.LINK_ITEMS,r=[`select`,`level`,`from`,`category`],i=(()=>{for(let t=e.ui.container;t;){let e=t.closest&&t.closest(`mapplic-map`);if(e)return e;let n=t.getRootNode&&t.getRootNode();t=n&&n.host?n.host:null}return null})(),a=`map-`+(i&&i.id?i.id+`-`:``),o=MapplicMap._linkWriters=MapplicMap._linkWriters||new Map,s={};if(e.ui.env().editor)return;let c=e=>{let r=t.setting(e);return Array.isArray(r)?r.filter(e=>n.includes(e)):[]},l=()=>c(`read`),u=()=>c(`write`).filter(e=>l().includes(e)),d=t=>{try{return e.plugin(t).enabled()}catch{return!1}},f=()=>{let e=location.hash.slice(1);return e.includes(`=`)?new URLSearchParams(e):null},p=()=>{let e={},t=[new URLSearchParams(location.search),f()].filter(Boolean),n=e=>{let n=``;return t.forEach(t=>t.has(a+e)&&(n=(t.get(a+e)||``).trim())),n},r=l();return r.includes(`select`)&&n(`select`)&&(e.select=n(`select`)),r.includes(`route`)&&n(`from`)&&(e.from=n(`from`)),r.includes(`level`)&&n(`level`)&&(e.level=n(`level`)),r.includes(`category`)&&n(`category`)&&(e.category=n(`category`).split(`,`).filter(Boolean)),e},m=(e,t)=>console.warn(`mapplic: deep link `+e,t),h=t=>{try{e.view.select(t)}catch(e){m(`map-select`,e)}},g=(t,n)=>{if(l().includes(`category`)&&d(`search`)&&(t.category||n))try{let n=e.plugin(`search`),r=n.getQuery();t.category?r.category=t.category:delete r.category,n.setQuery(r)}catch(e){m(`map-category`,e)}else t.category&&console.warn(`mapplic: map-category needs Search on`);let r=d(`wayfinding`)?e.plugin(`wayfinding`):null;if(t.select)t.from&&r?r.show(t.from,t.select).catch(e=>{m(`route`,e),h(t.select)}):(n&&r&&r.state().routeShown&&r.hide(),h(t.select));else if(n&&(r&&r.state().routeShown&&r.hide(),e.getState().selected&&e.view.deselect()),t.level||n)try{e.view.setLevel(t.level||_)}catch(e){m(`map-level`,e)}},_=0,v=!1,y=0,b=t=>{if(t===`all`)return`all`;let n=e.data.levels()[t];return String(n&&(n.short||n.name)||t)},x=()=>{let t=u(),n=e.getState(),r={},i=t.includes(`route`)&&d(`wayfinding`)?e.plugin(`wayfinding`).state():null;if(i&&i.routeShown&&i.from&&i.to?(r.from=i.from,r.select=i.to):t.includes(`select`)&&n.selected&&(r.select=n.selected),t.includes(`level`)&&!r.select){let e=n.allLevels?`all`:n.level;e!==_&&(r.level=b(e))}if(t.includes(`category`)&&d(`search`)){let t=e.plugin(`search`).getQuery().category;t&&t.length&&(r.category=t.join(`,`))}return r},S=()=>{let e=o.get(a);return e&&e!==s&&e.alive?(s.warned||console.warn(`mapplic: another map already writes `+a+`* to the address; this one does not`),s.warned=!0,!1):(o.set(a,s),!0)},C=()=>{if(!v||!u().length||!S())return;let e=new URL(location.href),n=f(),i=t.setting(`style`)===`hash`&&(n||!e.hash)?`hash`:`query`,o=i===`hash`?n||new URLSearchParams:e.searchParams,s=x(),c=u(),l=r.filter(e=>e===`select`&&(c.includes(`select`)||c.includes(`route`))||e===`from`&&c.includes(`route`)||e===`level`&&c.includes(`level`)||e===`category`&&c.includes(`category`));if(l.forEach(t=>{e.searchParams.delete(a+t),n&&n.delete(a+t)}),l.forEach(e=>s[e]&&o.set(a+e,s[e])),i===`hash`||n){let t=(i===`hash`?o:n).toString();e.hash=t?`#`+t:``}let d=e.href.replace(/#$/,``);if(d!==location.href.replace(/#$/,``)){try{t.setting(`history`)===`push`?history.pushState(history.state,``,d):history.replaceState(history.state,``,d)}catch(e){m(`write`,e)}T=E(p())}},w=()=>{clearTimeout(y),y=setTimeout(C,250)};[`select`,`level`,`route`,`search`].forEach(t=>e.on(t,w)),e.on(`plugin`,e=>e&&e.id===`deeplink`&&w());let T=``,E=e=>r.map(t=>[].concat(e[t]||``).join(`,`)).join(`|`),D=()=>{let e=p();E(e)!==T&&(T=E(e),clearTimeout(y),g(e,!0))};window.addEventListener(`popstate`,D),window.addEventListener(`hashchange`,D);let O=!1,k=!1,A=()=>k=!0;e.ui.container.addEventListener(`pointerdown`,A,{capture:!0}),e.ui.container.addEventListener(`keydown`,A,{capture:!0});let j=()=>{if(O)return;O=!0;let t=e.getState();_=t.allLevels?`all`:t.level;let n=p();T=E(n),Object.keys(n).length&&(g(n,!1),setTimeout(()=>{let t=e.getState();!k&&n.select&&!t.selected&&!t.routeShown&&g(n,!1)},500)),setTimeout(()=>{v=!0,Object.keys(x()).length&&!Object.keys(n).length&&w()},600)};if(e.getState().ready)setTimeout(j,0);else{let t=e.on(`ready`,()=>{t(),j()})}return s.alive=!0,e.provide({linked:p,prefix:()=>a}),()=>{s.alive=!1,clearTimeout(y),o.get(a)===s&&o.delete(a),window.removeEventListener(`popstate`,D),window.removeEventListener(`hashchange`,D),e.ui.container.removeEventListener(`pointerdown`,A,{capture:!0}),e.ui.container.removeEventListener(`keydown`,A,{capture:!0})}}),MapplicMap.plugin(`localization`,()=>{});var{MapplicMap:Xh,MapplicData:Zh,MapplicView:Qh}=window;return Xh.loadThree=async()=>({THREE:Af,SVGLoader:Yh}),e.MapplicData=Zh,e.MapplicMap=Xh,e.MapplicView=Qh,Object.defineProperty(e,"THREE",{enumerable:!0,get:function(){return Af}}),e})({});
4198
+ Question: `+t.question}},fromText(e){return async(t,n)=>{let r=MapplicMap.SEARCH.prompt(t,n);return e({system:r.system,messages:[{role:`user`,content:r.user}],max_tokens:1e3})}}},MapplicMap.plugin(`search`,e=>{let t=e.plugin(`search`),n=document,r=e=>t.setting(e),i=(t,n)=>e.ui.t(t,n),a=`var(--mp-shadow-sm)`,o=MapplicMap.svgIcon,s={search:o(`<circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path>`),x:o(`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`,14),filter:o(`<path d="M10 5H3"></path><path d="M12 19H3"></path><path d="M14 3v4"></path><path d="M16 17v4"></path><path d="M21 12h-9"></path><path d="M21 19h-5"></path><path d="M21 5h-7"></path><path d="M8 10v4"></path><path d="M8 12H3"></path>`),chevron:o(`<path d="m6 9 6 6 6-6"></path>`,14),route:o(`<circle cx="6" cy="19" r="3"></circle><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"></path><circle cx="18" cy="5" r="3"></circle>`),check:o(`<path d="M20 6 9 17l-5-5"></path>`,14),tag:o(`<path d="M12.6 2.6A2 2 0 0 0 11.2 2H4a2 2 0 0 0-2 2v7.2a2 2 0 0 0 .6 1.4l8.7 8.7a2.4 2.4 0 0 0 3.4 0l6.6-6.6a2.4 2.4 0 0 0 0-3.4z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>`)},c=(e,t,r)=>{let i=n.createElement(e);return t&&(i.className=t),r!=null&&(i.innerHTML=r),i},l=MapplicMap.escapeHtml,u=e=>String(e??``).toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\p{L}\p{N}\s]/gu,` `).replace(/\s+/g,` `).trim(),d=e=>u(e).split(` `).filter(Boolean),f=(e,t,n)=>{if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),i>1&&n>1&&e[i-1]===t[n-2]&&e[i-2]===t[n-1]&&(a[n]=Math.min(a[n],r[n-2]+1)),o=Math.min(o,a[n])}if(o>n)return n+1;r=a}return r[t.length]},p=MapplicMap.PLACE.SYNONYMS,m=[],h={},g=[],_={},v=[],y={},b={},x=()=>e.data.levels(),S=()=>r(`position`)||`top-left`,C=()=>{try{return e.plugin(`hours`).enabled()}catch{return!1}},w=()=>{try{return e.plugin(`wayfinding`).enabled()}catch{return!1}},T=()=>{try{return e.plugin(`directory`).enabled()}catch{return!1}},E=(()=>{let t=null;return e.on(`units`,()=>{t=null}),n=>(t||=Object.fromEntries(e.data.units().map(e=>[e.id,e.logo||e.thumb||null])),t[n]||null)})(),D=(e,t)=>e?t[e]?e:Object.keys(t).find(n=>t[n].label===e||t[n].name===e)||String(e).toLowerCase():`amenity`,O=()=>{let t=e.data.section(`categories`)||[],n=Object.fromEntries(t.map(e=>[e.id,e.kind||`store`])),r=e.data.amenityTypes(),i=e.data.section(`search`)||{};g=t.map(e=>e.id),_=Object.fromEntries(t.map(e=>[e.id,e])),v=t.filter(e=>e.kind!==`service`).map(t=>({id:t.id,words:d([t.name,e.data.categoryName(t.name),t.id.replace(/[-_]/g,` `)].concat([].concat(t.keywords||[]).flatMap(e=>String(e).split(/[;,]/))).join(` `)).filter(e=>e.length>=3&&e!==`and`)})),y={},b={};let a=(e,t)=>{let n=u(e);(t||[]).forEach(e=>{let t=u(e);t&&t!==n&&((b[n]=b[n]||new Set).add(t),(b[t]=b[t]||new Set).add(n))})};Object.entries(i.synonyms||{}).forEach(([e,t])=>a(e,[].concat(t))),m=[],h={},e.data.stores().map(e=>[e,`store`]).concat(e.data.amenities().map(e=>[e,`amenity`])).forEach(([i,a])=>{if(h[i.id]||i.searchable===!1)return;let o=i.location&&e.data.location(i.location)||{},s=!o.category&&a===`amenity`?MapplicMap.PLACE.amenityCategory(D(i.type,r),r,t):null,c=MapplicMap.PLACE.categoriesOf(o),l=c[0]||(a===`amenity`?s?s.id:`amenity`:null);if(c.length&&c.every(e=>n[e]===`service`))return;let f=MapplicMap.PLACE.groupCats(c,a===`amenity`,n),g=o.amenity||(a===`amenity`?D(i.type,r):null),v=g?r[g]||{}:null,y=[].concat(o.keywords||[],o.tags||[]).flatMap(e=>String(e).split(/[;,]/)).concat(v?[v.name,v.label]:[],g&&p[g]||[],g?[g]:[]),b={id:i.id,info:i,place:i.location?`loc:`+i.location:i.id,name:i.name,kind:g?`amenity`:`store`,amenity:g,category:l,categories:f,categoryName:a===`amenity`&&!o.category?v&&v.name||i.type||``:c.length>1?c.map(t=>_[t]&&e.data.categoryName(_[t].name)||t).join(`, `):i.category||``,level:i.level,hours:i.hours,location:o,n:{name:u(i.name),nameWords:d(i.name),keywords:d(y.join(` `)),category:d([i.category].concat(f.map(e=>_[e]&&_[e].name||``),f.slice(1).map(t=>_[t]&&e.data.categoryName(_[t].name)||t)).join(` `)),description:u(MapplicMap.plainText(i.description))}};m.push(b),h[b.id]=b})},k=e=>[e].concat(b[e]?[...b[e]]:[]),A=(e,t)=>{let n=e.n,i=0;if(k(t).forEach((e,t)=>{let r=t?.9:1,a=0,o=e.includes(` `);n.name.startsWith(e)?a=60:!o&&n.nameWords.some(t=>t.startsWith(e))?a=45:e.length>2&&n.name.includes(e)&&(a=30),(o?n.keywords.join(` `).includes(e):n.keywords.some(t=>t.startsWith(e)))&&(a=Math.max(a,36)),n.category.some(t=>t.startsWith(e))&&(a=Math.max(a,28)),!a&&e.length>=3&&n.description.includes(e)&&(a=10),i=Math.max(i,a*r)}),!i&&r(`fuzzy`)&&t.length>=4){let e=t.length>=7?2:1;n.nameWords.concat(n.keywords,n.category).some(n=>f(n,t,e)<=e||f(n.slice(0,t.length),t,e)<=e)&&(i=18)}return i},j=(e,t,n)=>{let r=0;for(let n of t){let t=A(e,n);if(!t)return 0;r+=t}return n&&e.n.name===n&&(r+=100),r},M=(e,t)=>{if(!e||typeof e!=`object`)return null;let n=e.source||(e.field?`field`:null);if(![`category`,`amenity`,`level`,`open_now`,`field`].includes(n)||n===`open_now`&&!C())return null;let r=e.type||(n===`open_now`?`toggle`:`chips`);return Object.assign({},e,{id:String(e.id||n+`-`+t),source:n,type:r,multi:e.multi!==!1})},N=()=>{let t=(e.data.section(`search`)||{}).filters;if(Array.isArray(t))return t.map(M).filter(Boolean);let n=[];return r(`filter_open`)&&n.push({id:`open`,source:`open_now`,type:`toggle`}),r(`filter_category`)&&n.push({id:`category`,source:`category`,type:`chips`,multi:!0}),n.map(M).filter(Boolean)},P=(e,t)=>String(t||``).split(`.`).reduce((e,t)=>e?.[t],e.location),F=(e,t)=>{if(t.source===`category`)return e.category&&!e.categories.includes(e.category)?e.categories.concat(e.category):e.categories;if(t.source===`level`)return[e.level];if(t.source===`amenity`)return[e.amenity];if(t.source===`field`){let n=P(e,t.field);return Array.isArray(n)?n:typeof n==`string`?n.split(/[;,]/).map(e=>e.trim()):[n]}return[]},I=null,ee=t=>{if(I||={},!(t in I))try{let n=e.plugin(`hours`).status(h[t]?h[t].info:{id:t});I[t]=n.state===`open`||n.state===`closing`}catch{I[t]=!1}return I[t]},L=e=>e==null||e===``||e===!1||Array.isArray(e)&&!e.length,R=(e,t,n)=>{if(L(n))return!0;if(t.source===`open_now`)return ee(e.id);if(t.type===`toggle`){let n=t.value===void 0||t.value;return F(e,t).some(e=>n===!0?!!e&&e!==`false`&&e!==`0`:String(e)===String(n))}let r=F(e,t).map(String);return[].concat(n).some(e=>r.includes(String(e)))},z=t=>{if(t.options)return t.options.map(e=>typeof e==`object`?e:{value:e,label:String(e)});if(t.source===`category`){let n={};m.forEach(t=>t.categories.forEach((r,a)=>{n[r]||(n[r]=r===`amenity`?i(`directory_amenities`):_[r]&&e.data.categoryName(_[r].name)||(a?``:t.categoryName)||r)}));let r=e=>g.includes(e)?g.indexOf(e):999;return Object.keys(n).filter(e=>!(t.include&&!t.include.includes(e))).sort((e,t)=>r(e)-r(t)).map(e=>({value:e,label:n[e],cat:_[e]||null}))}if(t.source===`level`){let e=new Set(m.map(e=>e.level));return x().filter(t=>e.has(t.index)).map(e=>({value:e.index,label:e.name}))}if(t.source===`amenity`){let t=e.data.amenityTypes();return[...new Set(m.map(e=>e.amenity).filter(Boolean))].map(n=>({value:n,label:(t[n]||{}).name||n,cat:MapplicMap.PLACE.amenityCategory(n,t,e.data.section(`categories`)||[])}))}return[]},te=e=>e.label?e.label:i({category:`search_categories`,open_now:`search_open_now`,amenity:`search_places`,level:`search_level`}[e.source]||`search_filters`),B=e.memory,V=B.state=B.state||{text:``,values:{},scope:{}};V.scope=V.scope||{};let H={category:`category`,amenity:`amenity`,level:`level`,open:`open_now`},ne=e=>Object.keys(V.scope).every(t=>R(e,{source:H[t],type:`chips`},V.scope[t])),re=[],ie=[],ae={},oe=[],se=null,U=null,ce=new Set(`where whereabouts is are the a an i im can could would will find get buy to for me some any with on in at please show what which there that sell sells selling looking look need want do does have has go near nearest closest something somewhere of and or my place places shop shops store stores located get`.split(` `)),le={first:1,second:2,third:3,fourth:4,fifth:5,one:1,two:2,three:3,four:4,five:5},ue=/^(level|floor|lvl|storey|story)$/,de=[`now`,`currently`,`right`,`still`],fe=e=>e.replace(/ies$/,`y`).replace(/(?<=[^s])s$/,``),pe=e=>{let t=x();if(!e)return null;let n=t.find(t=>u(t.short)===e||u(t.name)===e);if(n)return n;if(/^(ground|gf)$/.test(e))return t.find(e=>/^g/i.test(e.short||``)||/ground/i.test(e.name||``));if(e===`basement`)return t.find(e=>/^b/i.test(e.short||``)||/basement/i.test(e.name||``));let r=e.match(/^(\d+)(st|nd|rd|th)?$/),i=r?r[1]:le[e]==null?null:String(le[e]);return i==null?null:t.find(e=>u(e.short)===`l`+i||u(e.short)===i||d(e.name).includes(i))||null},me=e=>{let t=d(e),n=t.map(()=>!1),r={source:`rules`},i=(e,t)=>{r[e]=r[e]||[],r[e].includes(t)||r[e].push(t)};t.forEach((e,a)=>{if(!n[a]){if(e===`open`&&C())r.open=!0,n[a]=!0,[a-1,a+1,a+2].forEach(e=>{de.includes(t[e])&&(n[e]=!0)});else if(ue.test(e)){let e=pe(t[a+1]),r=!e&&pe(t[a-1]);(e||r)&&(i(`level`,(e||r).index),n[a]=n[e?a+1:a-1]=!0)}else if(/^l\d+$/.test(e)||/^(ground|basement)$/.test(e)){let t=pe(e);t&&(i(`level`,t.index),n[a]=!0)}else if(e.length>=3&&!ce.has(e)){let t=v.find(t=>t.words.some(t=>t===e||fe(t)===fe(e)));t&&(i(`category`,t.id),n[a]=!0)}}});let a=t.filter((e,t)=>!n[t]&&!ce.has(e));return!a.length&&!r.open&&!r.level&&!r.category||a.length===t.length?null:(r.text=a.join(` `),r)},he=/^(?:(?:please )?(?:show|find|give|get|plan|draw)(?: me)? )?(?:the |a )?(?:route|routes|directions?|way|path|walking route|navigation)\b/,ge=e=>{let t=d(e).filter(e=>!ce.has(e)),n=t.join(` `);if(!t.length)return null;let r=null,i=0;return m.forEach(e=>{let a=j(e,t,n);a>i&&(i=a,r=e)}),r},_e=e=>{let t=u(e),n=null,r=null,i;if((i=t.match(/^(?:how (?:do|can|would|should) (?:i|we) (?:get|go|walk)|take me|walk me|navigate|go|walk|get me)\s+to (.+?)(?: from (.+))?$/))?[r,n]=[i[1],i[2]||null]:(i=t.match(/^(?:.*?\b(?:route|routes|directions?|way|path|navigate|navigation)\s+)?from (.+?) to (.+)$/))?(he.test(t)||/^from /.test(t))&&([n,r]=[i[1],i[2]]):(i=t.match(/^.*?\b(?:route|routes|directions?|way|path)\s+to (.+?)(?: from (.+))?$/))&&([r,n]=[i[1],i[2]||null]),!r)return null;let a=n?ge(n):null,o=ge(r);return!o||n&&!a||a&&a.place===o.place?null:{source:`rules`,route:{from:a?a.id:null,to:o.id},ids:[a,o].filter(Boolean).map(e=>e.id)}},ve=async t=>{let n=t&&t.route;if(!n||!n.to||!w())return!1;let r=e.plugin(`wayfinding`),i=e=>h[e]&&h[e].amenity?h[e].name:{id:e};try{n.from?await r.show({id:n.from},i(n.to)):r.to(i(n.to))}catch(e){return console.warn(`mapplic search route:`,e),!1}return!0},ye=async()=>{let e=U;if(!e||!e.route)return!1;let t=await ve(e);return t&&Ne(``),t},be=e=>{let t=e=>`\0`+e+``,n=e.from?i(`search_route`,{from:t(e.from),to:t(e.to)}):i(`search_route_to`,{to:t(e.to)});return l(n).replace(/\u0000(.*?)\u0001/g,(e,t)=>`<b>`+l((h[t]||{name:t}).name)+`</b>`)},xe=e=>{let t=d(e.text||``),n=u(e.text||``),r=e.ids?new Set(e.ids):null,i=t=>re.every(e=>R(t,e,V.values[e.id]))&&ne(t)&&Object.keys(H).every(n=>L(e[n])||R(t,{source:H[n],type:`chips`},e[n]))&&(!r||r.has(t.id)||r.has(t.info.location));return m.map(e=>({e,score:t.length?j(e,t,n):1})).filter(e=>e.score&&i(e.e)).sort((e,t)=>t.score-e.score||e.e.name.localeCompare(t.e.name))},W=null,G=()=>W||MapplicMap.smartSearch||null,Se=()=>!!r(`smart`)&&typeof G()==`function`,Ce=e=>{let t={};return!e||typeof e!=`object`||Array.isArray(e)||Object.keys(e).forEach(n=>{let r=e[n];Object.keys(t).length>=12||(typeof r==`number`&&isFinite(r)||typeof r==`boolean`?t[n]=r:typeof r==`string`&&r.trim()&&r.length<=60&&(t[n]=r.trim()))}),t},K=e=>{let t=new Set,n=[],r=6e4;return m.forEach(e=>{if(t.has(e.place)||n.length>=600)return;t.add(e.place);let i=e.location||{},a={id:e.id,name:e.name,categories:e.categories.slice(),level:e.level,keywords:[].concat(i.keywords||[],i.tags||[]).flatMap(e=>String(e).split(/[;,]/)).map(e=>e.trim()).filter(Boolean)};if(r>0){let e=typeof i.description==`string`?i.description.replace(/<[^>]*>/g,` `).replace(/\s+/g,` `).trim():``;e&&(a.description=e.length>120?e.slice(0,119)+`…`:e);let t=Ce(i.data);Object.keys(t).length&&(a.details=t),r-=(a.description||``).length+JSON.stringify(a.details||``).length}n.push(a)}),{question:e,categories:Object.values(_).filter(e=>e.kind!==`service`).map(e=>({id:e.id,name:e.name||e.id})),levels:x().map(e=>({index:e.index,name:e.name,short:e.short})),amenities:[...new Set(m.map(e=>e.amenity).filter(Boolean))],openNow:C(),places:n}},we=e=>{let t=e;if(typeof t==`string`){let e=t.match(/\{[\s\S]*\}/);try{t=e?JSON.parse(e[0]):null}catch{t=null}}if(!t||typeof t!=`object`)return null;let n={source:`smart`},r=e=>[].concat(e??[]);t.text&&(n.text=String(t.text).slice(0,80));let i=r(t.category).filter(e=>_[e]||e===`amenity`);i.length&&(n.category=i);let a=r(t.level).map(Number).filter(e=>x().some(t=>t.index===e));a.length&&(n.level=a),t.open===!0&&C()&&(n.open=!0);let o=r(t.amenity).filter(e=>m.some(t=>t.amenity===e));o.length&&(n.amenity=o);let s=r(t.ids).filter(e=>h[e]||m.some(t=>t.info.location===e));s.length&&(n.ids=s);let c=e=>h[e]?e:(m.find(t=>t.info.location===e)||{}).id||null;return t.route&&typeof t.route==`object`&&c(t.route.to)&&w()&&(n.route={from:t.route.from?c(t.route.from):null,to:c(t.route.to)},n.ids=[n.route.from,n.route.to].filter(Boolean)),!n.text&&!n.category&&!n.level&&!n.open&&!n.amenity&&!n.ids&&!n.route?null:(t.note&&(n.note=String(t.note).slice(0,160)),n)},Te=async()=>{let e=V.text,t=e.trim();if(!t||!Se())return null;if(y[e]&&y[e].status!==`error`)return y[e].query||null;y[e]={status:`loading`},Ee();try{let n=we(await G()(t,K(t)));y[e]=n?{status:`done`,query:n}:{status:`none`}}catch(t){console.warn(`mapplic smart search:`,t),y[e]={status:`error`}}return V.text===e&&Ee(),y[e].query||null},Ee=()=>{I=null,re=N(),Object.keys(V.values).forEach(e=>{re.some(t=>t.id===e)||delete V.values[e]}),oe=d(V.text);let t=u(V.text),n={};m.forEach(e=>{n[e.id]=oe.length?j(e,oe,t):1});let i=(e,t)=>re.every(n=>n.id===t||R(e,n,V.values[n.id]))&&ne(e);if(ie=m.filter(e=>n[e.id]&&i(e)).map(e=>({e,score:oe.length?n[e.id]:0})).sort((e,t)=>t.score-e.score||e.e.name.localeCompare(t.e.name)),ae={},re.forEach(e=>{let t=ae[e.id]={},r=new Set,a=(e,n)=>{let i=e+`|`+n.place;r.has(i)||(r.add(i),t[e]=(t[e]||0)+1)};(e.source===`open_now`||e.type===`toggle`)&&(t.true=0),m.forEach(t=>{n[t.id]&&i(t,e.id)&&(e.source===`open_now`?ee(t.id)&&a(`true`,t):e.type===`toggle`?R(t,e,!0)&&a(`true`,t):F(t,e).forEach(e=>a(e,t)))})}),U=null,oe.length&&!ie.length){let e=y[V.text],t=e&&e.status===`done`?e.query:r(`intents`)?w()&&_e(V.text)||me(V.text):null;if(t){let n=xe(t);n.length?(ie=n,U=t):e&&e.status===`done`&&(e.status=`none`)}}let a=Me();if(se=a&&!ie.length?Ve():null,r(`highlight`)&&a&&ie.length<m.length){let t=(r(`highlight_tint`)===!1?[]:ze().category||[]).map(e=>_[e]).filter(e=>e&&e.color),n=ie.slice(0,300),i={};t.length&&n.forEach(e=>{let n=t.find(t=>(e.e.categories||[]).includes(t.id)||e.e.category===t.id);n&&(i[e.e.id]=n.color)}),e.view.highlight(n.map(e=>e.e.id),Object.keys(i).length?{colors:i}:void 0)}else e.view.highlight([]);ke(a),e.announce(`search`,{text:V.text,filters:JSON.parse(JSON.stringify(V.values)),ids:ie.map(e=>e.e.id),count:Ae(ie),total:Ae(m),active:a,query:ze(),interpreted:U?Re(U):null}),ot.forEach(e=>e.paint()),Ke()},De=``,Oe=null,ke=t=>{let n=ze(),i=t&&!n.text.trim()&&Object.keys(n).every(e=>e===`text`||e===`category`)&&n.category?n.category.join(`|`):``;if(i===De)return;De=i;let a=e.getState();if(!i){Oe!=null&&a.allLevels&&e.view.setLevel(Oe),Oe=null;return}if(r(`fit_category`)===!1||!a.ready)return;let o=new Set(ie.map(e=>e.e.id)),s=e.data.units().filter(e=>!e.hidden&&e.interactive),c=s.filter(e=>o.has(e.id));if(!c.length||c.length>s.length*.6)return;let l={};c.forEach(e=>(l[e.level]=l[e.level]||[]).push(e));let u=Object.keys(l).map(Number);if(u.length>1){if(a.allLevels)return;if(e.view.showAll()===`all`){Oe=a.level;return}}Oe=null;let d=u.sort((e,t)=>l[t].length-l[e].length)[0],f=l[d],p=f.flatMap(e=>e.box),m=e=>{let t=e.map(e=>e[0]),n=e.map(e=>e[1]);return[Math.max(...t)-Math.min(...t),Math.max(...n)-Math.min(...n)]},h=m(p),g=m(s.filter(e=>e.level===d).flatMap(e=>e.box));f.length>1&&h[0]>g[0]*.85&&h[1]>g[1]*.85?(a.allLevels||a.level!==d)&&e.view.setLevel(d):e.view.fit(d,p,{fill:f.length===1?.4:.8})},Ae=e=>new Set(e.map(e=>(e.e||e).place)).size,je=()=>re.filter(e=>!L(V.values[e.id])).length+Object.keys(V.scope).length,Me=()=>!!oe.length||je()>0,Ne=e=>{e=String(e??``),e!==V.text&&(V.text=e,Ee())},Pe=(e,t)=>{let n=re.find(t=>t.id===e);if(!n)throw Error(`No filter "`+e+`". Filters: `+re.map(e=>e.id).join(`, `));L(t)?delete V.values[e]:V.values[e]=n.type===`chips`&&n.multi?[].concat(t):t,Ee()},Fe=(e,t)=>{let n=V.values[e.id];if(e.type===`toggle`)return Pe(e.id,!n);if(e.type===`select`)return Pe(e.id,t===``?null:t);if(!e.multi)return Pe(e.id,n&&n[0]===t?null:[t]);let r=[].concat(n||[]),i=r.findIndex(e=>String(e)===String(t));i>=0?r.splice(i,1):r.push(t),Pe(e.id,r)},Ie=()=>{V.text=``,V.values={},V.scope={},Ee()},Le=()=>{V.values={},V.scope={},Ee()},Re=e=>JSON.parse(JSON.stringify(e)),ze=()=>{let e={text:V.text};Object.keys(H).forEach(t=>{let n=re.find(e=>e.source===H[t]),r=n&&!L(V.values[n.id])?V.values[n.id]:V.scope[t];L(r)||(e[t]=t===`open`||[].concat(Re(r)))});let t={};return re.forEach(e=>{e.source===`field`&&!L(V.values[e.id])&&(t[e.id]=Re(V.values[e.id]))}),Object.keys(t).length&&(e.filters=t),e},Be=(e={})=>(re=N(),V.text=String(e.text==null?``:e.text),V.values={},V.scope={},Object.keys(H).forEach(t=>{let n=e[t];if(L(n))return;n=t===`open`||[].concat(n);let r=re.find(e=>e.source===H[t]);r&&(t===`open`?r.type===`toggle`:r.type===`chips`&&r.multi||n.length===1)?V.values[r.id]=r.type===`toggle`?!0:r.type===`select`?n[0]:n:V.scope[t]=n}),Object.entries(e.filters||{}).forEach(([e,t])=>{!L(t)&&re.some(t=>t.id===e)&&(V.values[e]=Re(t))}),Ee(),ze()),Ve=()=>{let t={text:null,withoutFilters:0};if(!oe.length)return t;let n=u(V.text);if(je()&&(t.withoutFilters=Ae(m.filter(e=>j(e,oe,n)))),t.withoutFilters||n.length<3)return t;let r=Math.min(n.length>=6?2:1,Math.floor(n.length/3)),i=m.map(e=>e.name).concat(Object.values(_).flatMap(t=>[t.name||``,e.data.categoryName(t.name||``)||``])),a=r+1;return i.forEach(e=>{let i=u(e);if(!i)return;let o=Math.min(f(i,n,r),n.length>=5?f(i.slice(0,n.length),n,r):r+1,...d(e).map(e=>f(e,n,r)));o<a&&(a=o,t.text=e)}),t},He=e=>{let t=String(e||``);if(!oe.length)return l(t);let n=t.normalize(`NFD`),r=[],i=``;for(let e=0;e<n.length;e++)/[\u0300-\u036f]/.test(n[e])||(i+=n[e].toLowerCase(),r.push(e));let a=Array(n.length).fill(!1);oe.forEach(e=>{let t=RegExp(`(^|[^\\p{L}\\p{N}])(`+e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)+`)`,`gu`),n;for(;n=t.exec(i);){let e=n.index+n[1].length;for(let t=e;t<e+n[2].length;t++)a[r[t]]=!0;t.lastIndex===n.index&&t.lastIndex++}});for(let e=1;e<n.length;e++)/[\u0300-\u036f]/.test(n[e])&&(a[e]=a[e-1]);let o=``,s=!1;for(let e=0;e<n.length;e++)a[e]!==s&&(o+=a[e]?`<mark>`:`</mark>`,s=a[e]),o+=l(n[e]);return(o+(s?`</mark>`:``)).normalize(`NFC`)},Ue=t=>{let n=[].concat(V.scope[t]);if(t===`open`)return i(`search_open_now`);if(t===`level`)return n.map(e=>(x().find(t=>String(t.index)===String(e))||{name:e}).name).join(`, `);if(t===`category`)return n.map(t=>t===`amenity`?i(`directory_amenities`):_[t]&&e.data.categoryName(_[t].name)||t).join(`, `);let r=e.data.amenityTypes();return n.map(e=>(r[e]||{}).name||e).join(`, `)},We=e.ui.mount(c(`div`,`mp-sr`));We.setAttribute(`role`,`status`),We.setAttribute(`aria-live`,`polite`);let Ge=0,Ke=()=>{clearTimeout(Ge),Ge=setTimeout(()=>{let e=Ae(ie);We.textContent=Me()?e?e===1?i(`search_result_one`):i(`search_results`,{n:e}):i(`search_none`):``},600)},qe=`mapplic.search.recent`,Je=()=>{try{return(JSON.parse(localStorage.getItem(qe))||[]).filter(e=>h[e])}catch{return[]}},Ye=e=>{let t=h[e];if(!t)return;let n=[e].concat(Je().filter(e=>h[e].place!==t.place)).slice(0,5);try{localStorage.setItem(qe,JSON.stringify(n))}catch{}},Xe=()=>{try{localStorage.removeItem(qe)}catch{}},Ze=()=>{let t=(e.data.section(`search`)||{}).popular,n=new Set,r=[],i=e=>{e&&!n.has(e.place)&&(n.add(e.place),r.push(e.id))};return Array.isArray(t)&&t.length?t.forEach(e=>i(h[e]||m.find(t=>t.info.location===e||t.n.name===u(e)))):m.filter(e=>MapplicMap.PLACE.isFeatured(e.location)).forEach(i),r.slice(0,5)};MapplicMap.injectCss(`search-keyframes`,`@keyframes mp-search-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.55) } 70%, 100% { box-shadow: 0 0 0 6px rgba(34,197,94,0) } }
4199
+ @media (prefers-reduced-motion: reduce) { .mp-map .mp-search-live-dot { animation: none !important } }`),e.ui.style(Object.assign({},MapplicMap.PLACE.css,{".mp-search":`position:absolute;z-index:7;display:flex;flex-direction:column;gap:8px;font-family:Onest,sans-serif;color:var(--mp-fg)`,".mp-search.mp-slot-compact":`width:36px`,"&.mp-map .mp-search.mp-slot-compact.mp-engaged":`z-index:12;left:16px !important;right:16px !important;width:auto;max-width:var(--mp-sw);margin:0 auto`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-bar":`width:36px;padding:0;justify-content:center;cursor:pointer`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-bar > :not(.mp-search-icon):not(.mp-search-input)":`display:none !important`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-icon":`margin:0`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-input":`position:absolute;inset:0;width:100%;opacity:0;cursor:pointer`,".mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-chips, .mp-search.mp-slot-compact:not(.mp-engaged) .mp-search-veil":`display:none !important`,".mp-search.mp-slot-compact.mp-has-query:not(.mp-engaged) .mp-search-icon":`color:var(--mp-accent)`,".mp-search > .mp-search-ui":`position:relative`,".mp-search-veil":`position:absolute;left:-56px;right:-56px;z-index:-1;pointer-events:none;-webkit-backdrop-filter:blur(14px) saturate(1.3);backdrop-filter:blur(14px) saturate(1.3);background:var(--mp-veil, color-mix(in srgb, var(--mp-bg) 28%, transparent));-webkit-mask-composite:source-in;mask-composite:intersect`,".mp-pos-top-left .mp-search-veil, .mp-pos-top-center .mp-search-veil, .mp-pos-top-right .mp-search-veil":`top:-16px;bottom:-40px;-webkit-mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,".mp-pos-bottom-center .mp-search-veil":`bottom:-16px;top:-40px;-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,".mp-pos-top-left .mp-search-veil":`left:-16px;-webkit-mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to left, transparent 0, #000 56px);mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to left, transparent 0, #000 56px)`,".mp-pos-top-right .mp-search-veil":`right:-16px;-webkit-mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px);mask-image:linear-gradient(to top, transparent 0, #000 40px), linear-gradient(to right, transparent 0, #000 56px)`,"&[data-mp-bleed] .mp-pos-top-center .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,"&[data-mp-bleed] .mp-pos-top-left .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 56px), transparent 100%)`,"&[data-mp-bleed] .mp-pos-top-right .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 16px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 16px), transparent 100%)`,"&[data-mp-bleed] .mp-pos-bottom-center .mp-search-veil":`-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 16px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 16px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%)`,".mp-search.mp-pos-bottom-center":`flex-direction:column-reverse`,".mp-pos-bottom-center > .mp-search-ui":`flex-direction:column-reverse`,".mp-pos-bottom-center .mp-search-drop":`flex-direction:column-reverse`,".mp-pos-bottom-center .mp-search-drop .mp-search-menu":`border-bottom:0;border-top:1px solid var(--mp-border-subtle)`,".mp-pos-bottom-center .mp-search-foot":`border-top:0;border-bottom:1px solid var(--mp-border-subtle)`,"&.mp-map .mp-search.mp-open":`z-index:12`,".mp-search-ui":`display:flex;flex-direction:column;gap:8px;min-width:0;font-family:Onest,sans-serif`,".mp-search > .mp-search-ui > .mp-search-bar:focus-within":`box-shadow:0 2px 4px rgba(0,0,0,0.06), 0 0 0 2px var(--mp-accent)`,".mp-search-bar":`position:relative;display:flex;align-items:center;gap:4px;height:44px;padding:0 6px 0 14px;box-sizing:border-box;background:var(--mp-surface);border-radius:calc(10px * var(--mp-rk, 1));box-shadow:`+a+`;transition:box-shadow 150ms ease`,".mp-search > .mp-search-ui > .mp-search-bar":`height:36px;padding:0 4px 0 12px;border-radius:calc(8px * var(--mp-rk, 1))`,".mp-search > .mp-search-ui > .mp-search-bar .mp-search-iconbtn":`width:28px;height:28px;border-radius:calc(6px * var(--mp-rk, 1))`,".mp-search-panel .mp-search-bar":`height:40px;box-shadow:none;border:1px solid var(--mp-border);border-radius:calc(10px * var(--mp-rk, 1));padding-left:12px`,".mp-search-panel .mp-search-bar:focus-within":`border-color:var(--mp-accent);box-shadow:inset 0 0 0 1px var(--mp-accent)`,".mp-search-icon":`flex:none;display:flex;color:var(--mp-fg-muted);margin-right:6px`,".mp-search-input":`flex:1;min-width:0;height:100%;border:0;outline:0;background:transparent;font:inherit;font-size:14px;color:var(--mp-fg);padding:0`,".mp-search-input::placeholder":`color:var(--mp-fg-subtle)`,".mp-search-count":`flex:none;padding:0 4px;font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--mp-fg-muted)`,".mp-search-count + .mp-search-kbd + .mp-search-clear":`margin-left:-2px`,".mp-search-kbd":`flex:none;display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;margin-right:6px;padding:0 5px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:calc(5px * var(--mp-rk, 1));background:var(--mp-surface);color:var(--mp-fg-muted);font-family:"Roboto Mono",ui-monospace,monospace;font-size:11px;font-weight:500;line-height:1;cursor:text;user-select:none`,".mp-search-input::-webkit-search-cancel-button":`-webkit-appearance:none`,".mp-search-iconbtn":`position:relative;flex:none;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;color:var(--mp-fg-muted);cursor:pointer;padding:0;transition:background-color 150ms ease,color 150ms ease`,".mp-search-iconbtn:hover":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,'.mp-search-iconbtn[aria-pressed="true"]':`background:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg)`,".mp-search-badge":`position:absolute;top:1px;right:1px;min-width:15px;height:15px;padding:0 4px;box-sizing:border-box;border-radius:999px;background:var(--mp-accent);color:var(--mp-fg-on-accent);font-size:10px;font-weight:600;line-height:15px;text-align:center`,".mp-search-chips":`display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;padding:2px;margin:-2px;overscroll-behavior-x:contain;user-select:none;-webkit-user-select:none`,".mp-search-chips::-webkit-scrollbar":`display:none`,".mp-search-chips > *":`transform:translateX(var(--mp-over, 0px))`,".mp-search-wrap .mp-search-chips":`flex-wrap:wrap;overflow:visible`,".mp-search-chip":`position:relative;flex:none;display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:999px;background:var(--mp-surface);color:var(--mp-fg-strong);font:inherit;font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer;transition:background-color 150ms ease,color 150ms ease,border-color 150ms ease,opacity 150ms ease`,".mp-search > .mp-search-ui .mp-search-chips .mp-search-chip":`height:28px;padding:0 10px;font-size:12px;border-color:transparent;box-shadow:`+a,".mp-search > .mp-search-ui .mp-search-chips .mp-search-chip.mp-search-pill":`padding-right:6px`,'&[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui > .mp-search-bar, &[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui .mp-search-chips .mp-search-chip:not([aria-pressed="true"])':`background:var(--mp-ctl-glass);-webkit-backdrop-filter:var(--mp-ctl-blur);backdrop-filter:var(--mp-ctl-blur)`,'&[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui > .mp-search-bar:not(:focus-within), &[data-mp-glass-ctl="1"] .mp-search > .mp-search-ui .mp-search-chips .mp-search-chip':`box-shadow:0 0 0 1px var(--mp-ctl-ring), `+a,".mp-search-chip:hover":`background:var(--mp-bg-muted)`,'.mp-search-chip[aria-pressed="true"], .mp-search-chip.mp-active':`background:var(--mp-accent-subtle);border-color:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg)`,'.mp-search-chip.mp-cc[aria-pressed="true"]':`background:var(--mp-cd);border-color:var(--mp-cd);color:#fff;transition:filter 150ms ease`,'.mp-search-chip.mp-cc[aria-pressed="true"]:hover':`background:var(--mp-cd);filter:brightness(0.92)`,'.mp-search-chip.mp-cc[aria-pressed="true"] .mp-cat-icon':`color:#fff`,'.mp-search-chip.mp-cc[aria-pressed="true"] .mp-search-chip-count':`color:#fff;opacity:0.75`,'.mp-search-chip.mp-cat:not(.mp-cc)[aria-pressed="true"]':`background:var(--mp-fg-strong);border-color:var(--mp-fg-strong);color:var(--mp-surface)`,'.mp-search-chip.mp-cat:not(.mp-cc)[aria-pressed="true"] .mp-search-chip-count':`color:var(--mp-surface);opacity:0.75`,".mp-search-chip:disabled":`opacity:0.4;cursor:default;background:var(--mp-surface)`,".mp-search-chip-count":`color:var(--mp-fg-subtle);font-size:11px;font-variant-numeric:tabular-nums`,'.mp-search-chip[aria-pressed="true"] .mp-search-chip-count':`color:var(--mp-accent-subtle-fg);opacity:0.7`,".mp-search-chip select":`position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font:inherit;border:0`,".mp-search-chip svg":`flex:none`,".mp-search-live-dot":`flex:none;width:8px;height:8px;border-radius:999px;background:var(--mp-success-bright);animation:mp-search-pulse 1.6s ease-out infinite`,'.mp-search-chip.mp-search-live[aria-pressed="true"]':`background:var(--mp-success-subtle);border-color:var(--mp-success-subtle);color:var(--mp-success)`,".mp-search-chip:disabled .mp-search-live-dot, .mp-still .mp-search-live-dot":`animation:none`,".mp-search-menu":`display:flex;flex-direction:column;gap:14px`,".mp-search-group":`display:flex;flex-direction:column;gap:8px`,".mp-search-eyebrow":`font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-fg-muted)`,".mp-search-drop":`display:flex;flex-direction:column;background:var(--mp-surface);border-radius:calc(12px * var(--mp-rk, 1));box-shadow:var(--mp-shadow-float);overflow:hidden`,".mp-search-scroll":`overflow-y:auto;overscroll-behavior:contain;padding:6px`,".mp-search-drop .mp-search-menu":`padding:14px 14px 16px;border-bottom:1px solid var(--mp-border-subtle)`,".mp-search-section":`padding:10px 8px 4px;font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-fg-muted)`,".mp-search mark, .mp-dock mark, .mp-directory mark":`background:transparent;color:inherit;font-weight:700`,".mp-search-foot":`display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 14px;border-top:1px solid var(--mp-border-subtle);font-size:13px;color:var(--mp-fg-muted)`,".mp-search-link":`display:inline-flex;align-items:center;border:0;background:transparent;padding:4px 0;font:inherit;font-size:13px;font-weight:500;line-height:20px;text-align:left;color:var(--mp-accent);cursor:pointer`,".mp-search-link:hover":`color:var(--mp-accent-subtle-fg)`,".mp-search-empty":`display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px 12px;font-size:14px;color:var(--mp-fg-muted);text-wrap:pretty`,".mp-search-empty b":`color:var(--mp-fg);font-weight:600`,".mp-search-empty .mp-search-link":`font-size:14px;text-align:left`,".mp-search-empty .mp-search-link b":`color:inherit;font-weight:700`,".mp-search-section.mp-search-section-row":`display:flex;align-items:center;justify-content:space-between;gap:8px`,".mp-search-section .mp-search-link":`padding:0;font-size:12px;letter-spacing:0;text-transform:none;font-weight:500`,".mp-search-scope":`display:contents`,".mp-search-understood":`display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 8px 6px;font-size:13px;color:var(--mp-fg-muted);text-wrap:pretty`,".mp-search-understood-text":`display:flex;align-items:flex-start;gap:6px;min-width:0`,".mp-search-understood b":`color:var(--mp-fg);font-weight:600`,".mp-search-understood-icon":`flex:none;display:flex;margin-top:2px;color:var(--mp-accent)`,".mp-search-understood .mp-search-link":`flex:none;padding:0`,".mp-search-go":`flex:none;height:28px;padding:0 12px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:var(--mp-accent);color:var(--mp-fg-on-accent);font:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:background-color 150ms ease`,".mp-search-go:hover":`background:var(--mp-accent-hover)`,".mp-dir-thumb.mp-search-route-icon":`background:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg)`,".mp-dir-thumb.mp-search-route-icon svg":`width:auto;height:auto`,".mp-search-ask":`display:inline-flex;align-items:center;gap:6px;height:32px;margin-top:4px;padding:0 12px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:999px;background:var(--mp-surface);color:var(--mp-fg-strong);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background-color 150ms ease`,".mp-search-ask:hover":`background:var(--mp-bg-muted)`,".mp-search-ask svg, .mp-search-asking svg":`flex:none;color:var(--mp-accent)`,".mp-search-ask-key":`display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:-6px;box-sizing:border-box;border:1px solid var(--mp-border);border-radius:calc(5px * var(--mp-rk, 1));background:var(--mp-surface);font:inherit`,".mp-search-ask .mp-search-ask-key svg, .mp-search-link .mp-search-ask-key svg":`color:var(--mp-fg-muted)`,".mp-search-link .mp-search-ask-key":`flex:none;margin:0 0 0 8px`,".mp-search-asking":`display:inline-flex;align-items:center;gap:6px;margin-top:4px;font-size:13px;color:var(--mp-fg-muted)`,".mp-search-chip.mp-search-pill":`background:var(--mp-accent-subtle);border-color:var(--mp-accent-subtle);color:var(--mp-accent-subtle-fg);padding-right:8px`,".mp-search-chip.mp-search-pill:hover":`background:var(--mp-accent-subtle-hover)`,".mp-sr":`position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0`}));let Qe=e=>{let t=c(`div`,e?`mp-search-menu mp-search-wrap`:`mp-search-chips`);e||MapplicMap.PLACE.dragScroll(t);let n=``,a=[],o=c(`div`,`mp-search-scope`);o.style.order=`-2`;let u=null,d=()=>{o.replaceChildren(),Object.keys(V.scope).forEach(e=>{let t=c(`button`,`mp-search-chip mp-search-pill`);t.type=`button`,t.setAttribute(`aria-pressed`,`true`),t.title=i(`search_clear`),t.innerHTML=`<span>`+l(Ue(e))+`</span>`+s.x,t.onclick=()=>{delete V.scope[e],Ee()},o.append(t)})},f=()=>{a=[],t.replaceChildren(),e?(u=c(`div`,`mp-search-chips`),u.append(o),t.append(u)):t.append(o),re.forEach(n=>{let r=e?c(`div`,`mp-search-group`):t;if(e){r.append(c(`div`,`mp-search-eyebrow`,l(te(n))));let e=c(`div`,`mp-search-chips`);r.append(e),t.append(r)}let i=e?r.lastChild:t;if(n.type===`toggle`){let e=c(`button`,`mp-search-chip`);e.type=`button`,e.onclick=()=>Fe(n,!0),i.append(e),a.push({d:n,kind:`toggle`,b:e})}else if(n.type===`select`){let e=c(`label`,`mp-search-chip`),t=c(`span`),r=c(`select`);e.append(t,c(`span`,``,s.chevron),r),r.onchange=()=>{let e=z(n).find(e=>String(e.value)===r.value);Fe(n,e?e.value:``)},i.append(e),a.push({d:n,kind:`select`,b:e,text:t,sel:r})}else z(n).forEach(e=>{let t=c(`button`,`mp-search-chip`);t.type=`button`,t.onclick=()=>Fe(n,e.value),i.append(t),a.push({d:n,kind:`chip`,b:t,o:e})})})},p=``;return{el:t,paint:()=>{let o=JSON.stringify(re.map(e=>[e.id,e.type,z(e).map(e=>e.value)]));if(o!==n&&(n=o,f()),d(),u&&(u.style.display=Object.keys(V.scope).length?``:`none`),t.style.display=re.length||Object.keys(V.scope).length?``:`none`,a.forEach(e=>{let t=V.values[e.d.id],n=ae[e.d.id]||{};if(e.kind===`toggle`){let r=!L(t);e.b.setAttribute(`aria-pressed`,r?`true`:`false`);let i=e.d.source===`open_now`;e.b.classList.toggle(`mp-search-live`,i),e.b.innerHTML=(i?`<span class="mp-search-live-dot"></span>`:r?s.check:``)+`<span>`+l(te(e.d))+`</span>`,e.b.disabled=!r&&!n.true}else if(e.kind===`select`){let r=z(e.d),a=r.find(e=>!L(t)&&String(e.value)===String(t));e.text.textContent=a?a.label:e.d.placeholder||i(`search_any`),e.b.classList.toggle(`mp-active`,!!a);let o=`<option value="">`+l(e.d.placeholder||i(`search_any`))+`</option>`+r.map(e=>`<option value="`+l(e.value)+`"`+(a&&a.value===e.value?` selected`:``)+`>`+l(e.label)+(n[e.value]==null?``:` (`+n[e.value]+`)`)+`</option>`).join(``);e.sel._html!==o&&(e.sel.innerHTML=e.sel._html=o),e.sel.value=a?String(a.value):``}else{let i=[].concat(t||[]).some(t=>String(t)===String(e.o.value)),a=n[e.o.value]||0;e.b.setAttribute(`aria-pressed`,i?`true`:`false`);let o=r(`chip_icons`)&&e.o.cat&&MapplicMap.PLACE.icon(e.o.cat.icon,16);e.b.innerHTML=(o?`<span class="mp-cat-icon">`+o+`</span>`:``)+`<span>`+l(e.o.label)+`</span><span class="mp-search-chip-count">`+a+`</span>`,e.o.cat&&e.o.cat.color&&(e.b.style.setProperty(`--mp-cc`,e.o.cat.color),e.b.style.setProperty(`--mp-cd`,MapplicData.readableOn(`#ffffff`,e.o.cat.color,4.5))),e.b.classList.toggle(`mp-cc`,!!(e.o.cat&&e.o.cat.color)),e.b.classList.toggle(`mp-cat`,!!e.o.cat),e.b.disabled=!i&&!a}}),!e){let e=a.filter(e=>e.b.getAttribute(`aria-pressed`)===`true`||e.b.classList.contains(`mp-active`)),n=e.map(e=>e.d.id+`:`+(e.o?e.o.value:``)).join(`|`);if(n!==p){let r=new Set(p?p.split(`|`):[]),i=e.find(e=>!r.has(e.d.id+`:`+(e.o?e.o.value:``)));if(i&&t.scrollWidth>t.clientWidth){let e=i.b.offsetLeft-t.offsetLeft,n=e+i.b.offsetWidth,r=null;e<t.scrollLeft?r=e-16:n>t.scrollLeft+t.clientWidth&&(r=n-t.clientWidth+16),r!=null&&t.scrollTo({left:Math.max(0,r),behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})}p=n}}}}},$e=(t={})=>{let a=c(`div`,`mp-search-bar`),o=c(`input`,`mp-search-input`),l=c(`button`,`mp-search-iconbtn mp-search-clear`,s.x),u=c(`button`,`mp-search-iconbtn mp-search-filter`),d=c(`kbd`,`mp-search-kbd`,`/`),f=c(`span`,`mp-search-count`);f.setAttribute(`aria-hidden`,`true`),o.type=`search`,o.autocomplete=`off`,o.spellcheck=!1,o.setAttribute(`enterkeyhint`,`search`),t.combo&&(o.setAttribute(`role`,`combobox`),o.setAttribute(`aria-autocomplete`,`list`),o.setAttribute(`aria-expanded`,`false`)),l.type=u.type=`button`,l.title=i(`search_clear`),u.title=i(`search_filters`),d.setAttribute(`aria-hidden`,`true`),d.onmousedown=e=>{e.preventDefault(),o.focus()},a.append(c(`span`,`mp-search-icon`,s.search),o,f,d,l,u),st.add(o),o.addEventListener(`focus`,()=>d.style.display=`none`),o.addEventListener(`blur`,()=>h(a._menuOpen));let p=0;o.addEventListener(`input`,()=>{if(clearTimeout(p),m.length<=400)return Ne(o.value);p=setTimeout(()=>{p=0,Ne(o.value)},80)}),o.addEventListener(`focus`,()=>t.onFocus&&t.onFocus()),o.addEventListener(`keydown`,e=>t.onKey&&t.onKey(e)),l.onclick=()=>{let e=n.activeElement===o||!!V.text;je()?Ie():Ne(``),e&&o.focus()},u.onclick=()=>t.onFilter&&t.onFilter();let h=c=>{a._menuOpen=c,n.activeElement!==o&&o.value!==V.text&&(o.value=V.text),d.style.display=r(`shortcut`)&&!V.text&&n.activeElement!==o&&!e.ui.env().touch?``:`none`,r(`shortcut`)?o.setAttribute(`aria-keyshortcuts`,`/`):o.removeAttribute(`aria-keyshortcuts`),n.activeElement===o&&!p&&o.value!==V.text&&(o.value=V.text),o.placeholder=i(`search_placeholder`),o.setAttribute(`aria-label`,i(`search_placeholder`));let m=Me()&&t.count!==!1,h=m?ie.length:0;f.textContent=m?h===1?i(`search_result_one`):i(`search_results`,{n:h}):``,f.style.display=m?``:`none`,l.style.display=V.text||je()?``:`none`,l.title=je()?i(`search_clear_all`):i(`search_clear`);let g=r(`filters`)===`menu`&&(re.length>0||Object.keys(V.scope).length>0),_=je();u.style.display=g?``:`none`,u.setAttribute(`aria-pressed`,c?`true`:`false`),u.innerHTML=s.filter+(_?`<span class="mp-search-badge">`+_+`</span>`:``)};return{el:a,input:o,paint:h}},et=()=>MapplicMap.PLACE.icon(`sparkles`,14),tt=(t=()=>{})=>{if(!U)return null;let n=U,r=c(`div`,`mp-search-understood`),a=[];if(n.text&&a.push(`<b>`+l(n.text)+`</b>`),n.category&&a.push(l(n.category.map(t=>t===`amenity`?i(`directory_amenities`):_[t]&&e.data.categoryName(_[t].name)||t).join(`, `))),n.amenity){let t=e.data.amenityTypes();a.push(l(n.amenity.map(e=>(t[e]||{}).name||e).join(`, `)))}n.level&&a.push(l(n.level.map(e=>(x().find(t=>t.index===e)||{name:e}).name).join(`, `))),n.open&&a.push(l(i(`search_open_now`)));let o=c(`div`,`mp-search-understood-text`);if(n.route){o.innerHTML=`<span class="mp-search-understood-icon">`+s.route.replace(/16/g,`14`)+`</span><span>`+be(n.route)+`</span>`,r.append(o);let e=c(`button`,`mp-search-go`,l(i(`search_show_route`)));return e.type=`button`,e.onclick=async()=>{await ye(),t()},r.append(e),r}if(o.innerHTML=n.source===`smart`?`<span class="mp-search-understood-icon">`+et()+`</span><span>`+l(n.note||i(`search_smart_found`))+`</span>`:`<span>`+l(i(`search_showing`))+` `+a.join(` · `)+`</span>`,r.append(o),n.source===`rules`&&(n.category||n.level||n.open)){let e=c(`button`,`mp-search-link`,l(i(`search_use_filters`)));e.type=`button`,e.onclick=()=>{let e=Re(n);delete e.source,Be(Object.assign(ze(),e)),t()},r.append(e)}return r},nt=()=>{let e=se||{};if(e.withoutFilters)return Le;if(e.text)return()=>Ne(e.text);let t=y[V.text];return V.text.trim()&&Se()&&!t?Te:null},rt=()=>{let e=nt();return e&&e(),!!e},it=()=>e.ui.env().touch?``:`<kbd class="mp-search-ask-key" aria-hidden="true"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 10 4 15 9 20"/><path d="M20 4v7a4 4 0 0 1-4 4H4"/></svg></kbd>`,at=(e=()=>{})=>{let t=c(`div`,`mp-search-empty`),n=se||{},r=V.text.trim();t.append(c(`div`,``,l(i(`search_none`))+(r?` <b>“`+l(r)+`”</b>`:``)));let a=(n,r)=>{let i=n.indexOf(`<kbd`),a=c(`button`,`mp-search-link`,i<0?n:`<span>`+n.slice(0,i)+`</span>`+n.slice(i));a.type=`button`,a.onclick=()=>{r(),e()},t.append(a)},o=!!(n.withoutFilters||n.text);if(n.withoutFilters?a(l(i(`search_without_filters`,{n:n.withoutFilters}))+it(),Le):n.text&&a(l(i(`search_did_you_mean`))+` <b>`+l(n.text)+`</b>?`+it(),()=>Ne(n.text)),r&&Se()){let n=y[V.text];if(n&&n.status===`loading`)t.append(c(`div`,`mp-search-asking`,et()+`<span>`+l(i(`search_asking`))+`</span>`));else if(n&&(n.status===`none`||n.status===`error`))t.append(c(`div`,`mp-search-asking`,l(i(n.status===`error`?`search_ask_failed`:`search_ask_none`))));else{let n=c(`button`,`mp-search-ask`,et()+`<span>`+l(i(`search_ask`))+`</span>`+(o?``:it()));n.type=`button`,n.onclick=()=>{Te(),e()},t.append(n)}}return t},ot=new Set,st=new Set,ct=t=>{if(t.key!==`/`||t.ctrlKey||t.metaKey||t.altKey||!r(`shortcut`))return;let n=t.composedPath?t.composedPath()[0]:t.target,i=n&&n.tagName===`INPUT`&&!/^(checkbox|radio|button|submit|reset|range|color|file|image)$/i.test(n.type);if(n&&(n.isContentEditable||i||/^(textarea|select)$/i.test(n.tagName)))return;let a=e.ui.container.getBoundingClientRect();if(a.bottom<0||a.top>innerHeight||a.right<0||a.left>innerWidth)return;let o=[...st].find(e=>e.isConnected&&e.offsetParent);o&&(t.preventDefault(),o.focus(),o.select())};n.addEventListener(`keydown`,ct);let lt=(e,t={})=>{let n=c(`div`,`mp-search-ui mp-search-panel`),i=!1,a=$e({count:t.count,onKey:e=>{e.key===`Enter`&&t.onEnter&&t.onEnter(ie[0]?ie[0].e.id:null),e.key===`Escape`&&Ne(``),e.key===`ArrowDown`&&t.onArrow&&(e.preventDefault(),t.onArrow())},onFilter:()=>{i=!i,l.paint()}}),o=Qe(!1),s=Qe(!0);n.append(a.el,o.el,s.el);let l={paint:()=>{let e=r(`filters`);a.paint(i),o.paint(),s.paint(),o.el.style.display=e===`chips`&&(re.length||Object.keys(V.scope).length)?``:`none`,s.el.style.display=e===`menu`&&i&&(re.length||Object.keys(V.scope).length)?``:`none`},destroy:()=>{ot.delete(l),n.remove()}};return ot.add(l),e.append(n),l.paint(),{el:n,input:a.input,destroy:l.destroy,focus:()=>a.input.focus()}},ut=(()=>{let t=e.ui.mount(c(`div`,`mp-search`)),a=c(`div`,`mp-search-ui`),o=!1,u=!1,f=-1,p=[],g=$e({combo:!0,onFocus:()=>{o=!0,se()},onKey:e=>R(e),onFilter:()=>{u=!u,o=!0,se()}}),v=Qe(!1),y=Qe(!0),b=c(`div`,`mp-search-drop`),w=c(`div`,`mp-search-scroll`),D=c(`div`,`mp-search-foot`),O=c(`div`,`mp-search-veil`),k=`mp-search-`+Math.random().toString(36).slice(2,8);b.style.display=`none`,w.id=k,w.setAttribute(`role`,`listbox`),g.input.setAttribute(`aria-controls`,k),a.append(O,g.el,v.el),t.append(a,b);let A=e.ui.slot(t,{anchor:S(),priority:20,compact:!0,compactWidth:36,box:a}),j=()=>{o=!1,u=!1,N(-1),se()},M=e=>{o&&!(e.composedPath?e.composedPath().includes(t):t.contains(e.target))&&j()};n.addEventListener(`pointerdown`,M,!0);let N=t=>{f=t,p.forEach((e,n)=>{e.el.classList.toggle(`mp-hover`,n===t),e.el.setAttribute(`aria-selected`,n===t?`true`:`false`)});let n=p[t];if(n?g.input.setAttribute(`aria-activedescendant`,n.el.id):g.input.removeAttribute(`aria-activedescendant`),e.view.hover(n&&n.id?n.id:null),n){let e=n.el.offsetTop,t=e+n.el.offsetHeight;e<w.scrollTop?w.scrollTop=e-6:t>w.scrollTop+w.clientHeight&&(w.scrollTop=t-w.clientHeight+6)}},P=null,I=!1,ee=null,L=t=>{t&&(t.route?(ye(),j(),g.input.blur()):t.category?(V.values[P.id]=[t.category],V.text=``,Ee(),g.input.focus()):(e.view.select({id:t.id}),Ne(``),j(),g.input.blur()))},R=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),o||(o=!0,se()),!p.length)return;let t=e.key===`ArrowDown`==(S()===`bottom-center`)?-1:1;N((f+t+p.length+ +(f<0&&t<0))%p.length)}else if(e.key===`Enter`){let e=p[f>=0?f:0];e?L(e):oe.length&&rt()}else e.key===`Escape`&&(V.text?Ne(``):(j(),g.input.blur()))},te=(e,t,n,r)=>{let i=MapplicMap.PLACE.item(n,Object.assign({style:`logo`,compact:!0},r));return i.setAttribute(`role`,`option`),i.id=k+`-`+p.indexOf(e),i._name.innerHTML=t,i.onmouseenter=()=>N(p.indexOf(e)),i.onclick=()=>L(e),e.el=i,i},B=()=>x().length>1,H=(t,n)=>{let r=e.getState().level,a=t.all.find(e=>e.level===r)||t.all[0],o={id:a.id};p.push(o);let s=t.all.length>1&&!!t.e.amenity,c=Object.assign({},a,{logo:E(a.id),cat:_[a.category]||(a.amenity?MapplicMap.PLACE.amenityCategory(a.amenity,e.data.amenityTypes(),e.data.section(`categories`)||[]):null)});w.append(te(o,n,c,{levelOf:B()?ne:null,levels:t.all.map(e=>e.level).sort((e,t)=>e-t),subText:s?i(`search_locations`,{n:t.all.length}):t.e.categoryName,badge:s?null:ae(a)}))},ne=e=>x().find(t=>t.index===e)||{name:``,short:``},ae=t=>n=>{if(!t.hours||!C())return null;try{return e.plugin(`hours`).badge(t.info,{variant:n,theme:`light`})}catch{return null}},se=()=>{let n=!T();if(t.style.display=n?``:`none`,!n)return e.ui.container.style.removeProperty(`--mp-hint-vis`);let x=r(`filters`),C=S(),E=e.ui.container;[`top-left`,`top-center`,`top-right`,`bottom-center`].forEach(e=>t.classList.toggle(`mp-pos-`+e,e===C)),O.style.display=r(`blur`)?``:`none`;let k=r(`max_width`)||(/center/.test(C)?420:360);t.style.setProperty(`--mp-sw`,k+`px`),A.update({anchor:C,max:k,min:Math.min(200,k)}),t.classList.toggle(`mp-engaged`,o),t.classList.toggle(`mp-has-query`,Me()),t.classList.toggle(`mp-narrow`,e.ui.env().narrow),g.paint(u),v.paint(),v.el.style.display=x===`chips`&&(re.length||Object.keys(V.scope).length)?``:`none`,C===`bottom-center`?E.style.setProperty(`--mp-hint-vis`,`hidden`):E.style.removeProperty(`--mp-hint-vis`);let j=!Me()&&!(u&&x===`menu`)&&r(`suggestions`),M=j?Je():[],N=j?Ze().filter(e=>!M.some(t=>h[t].place===h[e].place)):[],L=o&&(Me()||u&&x===`menu`||M.length+N.length>0),R=e.ui.env().reducedMotion||!b.animate,B=[{opacity:0,transform:`translateY(`+(C===`bottom-center`?4:-4)+`px)`},{opacity:1,transform:`none`}];L===I?L&&(b.style.display=``):(ee&&ee.cancel(),ee=null,L?(b.style.display=``,R||(ee=b.animate(B,{duration:160,easing:`ease-out`}))):R?b.style.display=`none`:(ee=b.animate(B.slice().reverse(),{duration:120,easing:`ease-in`}),ee.onfinish=()=>{ee=null,b.style.display=`none`})),I=L,g.input.setAttribute(`aria-expanded`,L?`true`:`false`),t.classList.toggle(`mp-open`,L);let ne=()=>D.remove(),ae=e=>e?e.id?`i:`+e.id:e.category?`c:`+e.category:e.route?`r`:null:null,ce=f>=0?ae(p[f]):null,le=()=>{f<0||(f=-1,e.view.hover(null))};if(!L){p=[],le(),g.input.removeAttribute(`aria-activedescendant`);return}b.replaceChildren(),u&&x===`menu`&&(re.length||Object.keys(V.scope).length)&&(y.paint(),b.append(y.el)),p=[],w.replaceChildren();let ue=[],de=w.append.bind(w);if(w.append=(...e)=>e.forEach(e=>{e.classList&&e.classList.contains(`mp-search-section`)?ue.push({head:e,items:[]}):e.classList&&e.classList.contains(`mp-dir-item`)?(ue.length||ue.push({head:null,items:[]}),ue[ue.length-1].items.push(e)):ue.push({head:null,items:[e]})}),U&&U.route){let e={route:U};p.push(e);let t=c(`div`,`mp-dir-thumb mp-search-route-icon`,s.route),n=te(e,be(U.route),{name:``},{thumb:t,subText:i(`search_show_route`)});w.append(n)}else if(U){let e=tt(()=>g.input.focus());e&&w.append(e)}if(P=re.find(e=>e.source===`category`&&e.type===`chips`),oe.length&&P){let e=z(P).filter(e=>{let t=d(e.label);return oe.every(e=>t.some(t=>t.startsWith(e)))});e.length&&(w.append(c(`div`,`mp-search-section`,l(i(`search_categories`)))),e.slice(0,3).forEach(e=>{let t={category:e.value};p.push(t);let n=Ae(m.filter(t=>F(t,{source:`category`}).includes(e.value))),r=_[e.value],a=MapplicMap.PLACE.tint(c(`div`,`mp-dir-thumb mp-dir-icon`,r&&MapplicMap.PLACE.icon(r.icon,16)||s.tag),r);w.append(te(t,He(e.label),{name:e.label},{thumb:a,subText:i(`search_places_count`,{n})}))}))}let fe={},pe=[];ie.forEach(({e})=>{if(e.amenity){let t=`a:`+e.amenity+`:`+e.name;if(fe[t])return fe[t].all.push(e);fe[t]={e,all:[e]},pe.push(fe[t])}else{let t=`p:`+e.place;if(fe[t])return fe[t].all.push(e);fe[t]={e,all:[e]},pe.push(fe[t])}});let me=+r(`limit`)||1/0;pe.length&&oe.length&&(p.length&&w.append(c(`div`,`mp-search-section`,l(i(`search_places`)))),pe.slice(0,me).forEach(e=>H(e,He(e.e.name))));let he=(e,t,n)=>{if(!t.length)return;let r=c(`div`,`mp-search-section mp-search-section-row`);if(r.append(c(`span`,``,l(i(e)))),n){let e=c(`button`,`mp-search-link`,l(i(`search_clear`)));e.type=`button`,e.onclick=()=>{n(),g.input.focus(),se()},r.append(e)}w.append(r),t.forEach(e=>{let t=h[e],n=m.filter(n=>n.place===t.place&&!(n.amenity&&n.id!==e));H({e:t,all:n.length?n:[t]},l(t.name))})};j&&(he(`search_recent`,M,Xe),he(`search_popular`,N)),oe.length&&!p.length&&w.append(at(()=>g.input.focus())),delete w.append;let ge=S()===`bottom-center`;if(ue.forEach(e=>{e.head&&de(e.head),(ge?e.items.slice().reverse():e.items).forEach(e=>de(e))}),ge){let e=p.filter(e=>e.category);p=p.filter(e=>!e.category).concat(e)}w.childNodes.length&&b.append(w),ne();let _e=e.ui.size().height,ve=ge?_e-16-a.offsetHeight-8-16:_e-(t.offsetTop+a.offsetHeight+8)-16;if(b.style.maxHeight=Math.max(160,ve)+`px`,w.style.maxHeight=Math.max(120,ve-(D.parentNode?44:0)-(y.el.parentNode?y.el.offsetHeight:0))+`px`,f>=0){let e=ce?p.findIndex(e=>ae(e)===ce):-1;e<0?(le(),g.input.removeAttribute(`aria-activedescendant`)):(f=e,p[e].el.classList.add(`mp-hover`),g.input.setAttribute(`aria-activedescendant`,p[e].el.id))}ge&&f<0&&(w.scrollTop=w.scrollHeight)},ce={paint:se,destroy:()=>n.removeEventListener(`pointerdown`,M,!0)};return ot.add(ce),e.on(`select`,e=>{e&&j()}),ce})(),dt=()=>{O(),Ee()};return dt(),e.on(`select`,e=>{e&&h[e.id]&&Ye(e.id)}),e.on(`plugin`,e=>{[`search`,`directory`,`hours`,`localization`].includes(e.id)&&Ee()}),e.on(`language`,dt),e.on(`units`,dt),e.on(`layout`,()=>ut.paint()),e.on(`hours`,()=>{re.some(e=>e.source===`open_now`)&&Me()&&Ee()}),e.on(`level`,()=>ut.paint()),e.provide({query:e=>(Ne(e),ie.map(e=>e.e.id)),text:()=>V.text,setFilter:Pe,clear:Ie,setQuery:Be,getQuery:ze,suggest:()=>se?Object.assign({},se):{text:null,withoutFilters:0},emptyUi:at,emptyEnter:rt,understoodUi:tt,interpret:e=>e==null?U?Re(U):null:_e(String(e))||me(String(e)),act:ye,ask:Te,setSmartSearch:e=>{W=typeof e==`function`?e:null,ot.forEach(e=>e.paint())},state:()=>({interpreted:U?Re(U):null,query:ze(),text:V.text,filters:JSON.parse(JSON.stringify(V.values)),active:Me(),count:Ae(ie),total:Ae(m)}),results:()=>ie.map(e=>({id:e.e.id,score:e.score,info:e.e.info})),filters:()=>re.map(e=>({id:e.id,type:e.type,source:e.source,label:te(e),value:V.values[e.id]==null?null:JSON.parse(JSON.stringify(V.values[e.id])),options:e.type===`toggle`?[{value:!0,label:te(e),count:(ae[e.id]||{}).true||0}]:z(e).map(t=>Object.assign({},t,{count:(ae[e.id]||{})[t.value]||0}))})),entries:()=>m.map(e=>({id:e.id,name:e.name,kind:e.kind,category:e.category,categories:e.categories.slice(),categoryName:e.categoryName,level:e.level,amenity:e.amenity})),mark:He,mountUi:lt}),()=>{n.removeEventListener(`keydown`,ct),st.clear(),clearTimeout(Ge),ot.forEach(e=>e.destroy&&e.destroy()),ot.clear(),e.view.hover(null),e.ui.container.style.removeProperty(`--mp-hint-vis`)}}),MapplicMap.PLACE=(()=>{let e=document,t=(t,n,r)=>{let i=e.createElement(t);return n&&(i.className=n),r!=null&&(i.innerHTML=r),i},n=MapplicMap.escapeHtml,r=e=>String(e||``).split(/\s+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).slice(0,2).map(e=>e.replace(/[^\p{L}\p{N}]/gu,``)[0]||``).join(``).toUpperCase()||`·`,i=e=>{let t=String(e||``),n=[];t.replace(/(?:fill|stop-color|color)\s*[:=]\s*["']?\s*(#[0-9a-f]{3,8}|white|rgb\([^)]*\))/gi,(e,t)=>n.push(t));let r=e=>{if(e=e.toLowerCase(),e===`white`)return 1;let t,n,r;if(e[0]===`#`){let i=e.length<=5?e.slice(1,4).split(``).map(e=>e+e).join(``):e.slice(1,7);[t,n,r]=[0,2,4].map(e=>parseInt(i.slice(e,e+2),16))}else[t,n,r]=(e.match(/[\d.]+/g)||[0,0,0]).map(Number);return(.2126*t+.7152*n+.0722*r)/255};return n.length>0&&n.every(e=>r(e)>.85)},a=e=>{let t=String(e||``),n=(t.match(/viewBox\s*=\s*["']\s*([-\d.]+)[\s,]+([-\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i)||[]).slice(1).map(Number);if(n.length!==4||!n[2]||!n[3])return!1;let r=(e,t,r,i)=>e-n[0]<=n[2]*.03&&t-n[1]<=n[3]*.03&&r>=n[2]*.94&&i>=n[3]*.94,i=(t.replace(/<metadata[\s\S]*?<\/metadata>/i,``).match(/<(rect|path)\b[^>]*>/i)||[])[0];if(!i)return!1;if(/^<rect/i.test(i)){let e=e=>parseFloat((i.match(RegExp(`\\b`+e+`\\s*=\\s*["']?([-\\d.]+)(%?)`))||[])[1]),t=e=>RegExp(`\\b`+e+`\\s*=\\s*["']?100%`).test(i);return r(e(`x`)||0,e(`y`)||0,t(`width`)?n[2]:e(`width`)||0,t(`height`)?n[3]:e(`height`)||0)}let a=(i.match(/\bd\s*=\s*["']\s*M\s*([-\d.]+)[\s,]+([-\d.]+)\s*h\s*([\d.]+)\s*v\s*([\d.]+)/i)||[]).slice(1).map(Number);return a.length===4&&r(a[0],a[1],a[2],a[3])},o=e=>{let t=null,n=0,r=0,i=!1,a=0,o=0,s=0,c=0,l=()=>window.matchMedia&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,u=0,d=0,f=0,p=t=>{u=t,e.style.setProperty(`--mp-over`,t.toFixed(2)+`px`)},m=()=>{cancelAnimationFrame(f);let e=performance.now(),t=n=>{let r=Math.min(32,n-e);e=n,d+=(-25e-5*u-.026*d)*r,p(u+d*r),Math.abs(u)<.3&&Math.abs(d)<.01?(p(0),d=0):f=requestAnimationFrame(t)};f=requestAnimationFrame(t)},h=()=>{if(cancelAnimationFrame(c),l()||Math.abs(a)<.05)return;let t=performance.now(),n=e.scrollLeft,r=e.scrollWidth-e.clientWidth,i=o=>{let s=Math.min(32,o-t);t=o;let l=n-a*s;n=Math.max(0,Math.min(r,l)),e.scrollLeft=n,a*=.95**(s/16),l===n?Math.abs(a)>.02&&(c=requestAnimationFrame(i)):(d=a*.5,p(0),m())};c=requestAnimationFrame(i)};e.addEventListener(`pointerdown`,l=>{cancelAnimationFrame(c),cancelAnimationFrame(f),!(l.pointerType!==`mouse`||l.button!==0||e.scrollWidth<=e.clientWidth+1)&&(t=l.pointerId,n=o=l.clientX,s=performance.now(),r=e.scrollLeft,i=!1,a=0)}),e.addEventListener(`pointermove`,c=>{if(c.pointerId!==t)return;if(c.buttons===0){t=null,e.style.cursor=``;return}let u=c.clientX-n;if(!i&&Math.abs(u)>4){i=!0;try{e.setPointerCapture(t)}catch{}e.style.cursor=`grabbing`}if(i){let t=r-u,n=e.scrollWidth-e.clientWidth;e.scrollLeft=t,l()||p(t<0?-t/3:t>n?-(t-n)/3:0)}let d=performance.now(),f=d-s;f>0&&(a=.7*((c.clientX-o)/f)+.3*a),o=c.clientX,s=d});let g=n=>{if(n.pointerId!==t||(t=null,e.style.cursor=``,!i))return;performance.now()-s>80&&(a=0),u?(d=0,m()):h();let r=e=>{e.stopPropagation(),e.preventDefault()};e.addEventListener(`click`,r,!0),setTimeout(()=>e.removeEventListener(`click`,r,!0),0)},_=()=>{let t=e.scrollWidth-e.clientWidth;e.style.setProperty(`--mp-fl`,e.scrollLeft>1?`32px`:`0px`),e.style.setProperty(`--mp-fr`,e.scrollLeft<t-1?`32px`:`0px`)};e.classList.add(`mp-fade`),e.addEventListener(`scroll`,_,{passive:!0}),window.ResizeObserver&&new ResizeObserver(_).observe(e),window.MutationObserver&&new MutationObserver(_).observe(e,{childList:!0}),requestAnimationFrame(_),e.addEventListener(`pointerup`,g),e.addEventListener(`pointercancel`,g),e.addEventListener(`lostpointercapture`,g),e.addEventListener(`wheel`,t=>{Math.abs(t.deltaY)<=Math.abs(t.deltaX)||e.scrollWidth<=e.clientWidth+1||(cancelAnimationFrame(c),e.scrollLeft+=t.deltaY,t.preventDefault())},{passive:!1})},s={utensils:`<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"></path><path d="M7 2v20"></path><path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"></path>`,coffee:`<path d="M10 2v2"></path><path d="M14 2v2"></path><path d="M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1"></path><path d="M6 2v2"></path>`,"shopping-bag":`<path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"></path><path d="M3 6h18"></path><path d="M16 10a4 4 0 0 1-8 0"></path>`,"shopping-cart":`<circle cx="8" cy="21" r="1"></circle><circle cx="19" cy="21" r="1"></circle><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"></path>`,shirt:`<path d="M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z"></path>`,sparkles:`<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"></path><path d="M5 3v4"></path><path d="M19 17v4"></path><path d="M3 5h4"></path><path d="M17 19h4"></path>`,heart:`<path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path>`,smartphone:`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path>`,sofa:`<path d="M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3"></path><path d="M2 11v5a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v2H6v-2a2 2 0 0 0-4 0Z"></path><path d="M4 18v2"></path><path d="M20 18v2"></path><path d="M12 4v9"></path>`,ticket:`<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"></path><path d="M13 5v2"></path><path d="M13 17v2"></path><path d="M13 11v2"></path>`,gem:`<path d="M6 3h12l4 6-10 13L2 9Z"></path><path d="M11 3 8 9l4 13 4-13-3-6"></path><path d="M2 9h20"></path>`,wrench:`<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path>`,car:`<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"></path><circle cx="7" cy="17" r="2"></circle><path d="M9 17h6"></path><circle cx="17" cy="17" r="2"></circle>`,info:`<circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path>`,tag:`<path d="M12.6 2.6A2 2 0 0 0 11.2 2H4a2 2 0 0 0-2 2v7.2a2 2 0 0 0 .6 1.4l8.7 8.7a2.4 2.4 0 0 0 3.4 0l6.6-6.6a2.4 2.4 0 0 0 0-3.4z"></path><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"></circle>`,footprints:`<path d="M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z"></path><path d="M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z"></path><path d="M16 17h4"></path><path d="M4 13h4"></path>`,watch:`<circle cx="12" cy="12" r="6"></circle><polyline points="12 10 12 12 13 13"></polyline><path d="m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-1.98 1.61l-.78 4.05"></path><path d="m7.88 16.36.8 4a2 2 0 0 0 1.98 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05"></path>`,dumbbell:`<path d="m6.5 6.5 11 11"></path><path d="m21 21-1-1"></path><path d="m3 3 1 1"></path><path d="m18 22 4-4"></path><path d="m2 6 4-4"></path><path d="m3 10 7-7"></path><path d="m14 21 7-7"></path>`,"gamepad-2":`<line x1="6" x2="10" y1="11" y2="11"></line><line x1="8" x2="8" y1="9" y2="13"></line><line x1="15" x2="15.01" y1="12" y2="12"></line><line x1="18" x2="18.01" y1="10" y2="10"></line><path d="M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z"></path>`,baby:`<path d="M9 12h.01"></path><path d="M15 12h.01"></path><path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5"></path><path d="M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1"></path>`,clapperboard:`<path d="M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z"></path><path d="m6.2 5.3 3.1 3.9"></path><path d="m12.4 3.4 3.1 4"></path><path d="M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"></path>`,"cup-soda":`<path d="m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8"></path><path d="M5 8h14"></path><path d="M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0"></path><path d="m12 8 1-6h2"></path>`,gift:`<rect x="3" y="8" width="18" height="4" rx="1"></rect><path d="M12 8v13"></path><path d="M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7"></path><path d="M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5"></path>`},c={restroom:`M5.5 21v-6.5H5c-.55 0-1-.45-1-1V9c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2v4.5c0 .55-.45 1-1 1h-.5V21c0 .55-.45 1-1 1h-2c-.55 0-1-.45-1-1zM18 21v-5h1.61c.68 0 1.16-.67.95-1.32l-2.1-6.31C18.18 7.55 17.42 7 16.56 7h-.12c-.86 0-1.63.55-1.9 1.37l-2.1 6.31c-.22.65.26 1.32.95 1.32H15v5c0 .55.45 1 1 1h1c.55 0 1-.45 1-1zM7.5 6c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2zm9 0c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2z`},l=(e,t=16)=>{if(!e)return null;let r=String(e).trim();if(/^</.test(r))return r;if(/^(https?:|data:|\.{0,2}\/)|\.(svg|png|webp|jpe?g)$/i.test(r))return`<img src="`+n(r)+`" alt="" width="`+t+`" height="`+t+`">`;if(c[r])return`<svg width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="currentColor"><path d="`+c[r]+`"></path></svg>`;let i=s[r];return i?`<svg width="`+t+`" height="`+t+`" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="`+(t>=20?1.75:2)+`" stroke-linecap="round" stroke-linejoin="round">`+i+`</svg>`:null},u={toilets:[`restroom`,`restrooms`,`toilet`,`wc`,`bathroom`,`washroom`,`loo`,`lavatory`],information:[`info`,`help`,`help desk`,`information desk`,`concierge`],parking:[`car park`,`garage`],atm:[`cash`,`cash machine`],elevator:[`lift`],baby:[`baby change`,`changing room`,`nursing`]},d=(e,t)=>e?t[e]?e:Object.keys(t).find(n=>t[n].label===e||t[n].name===e)||String(e).toLowerCase():null,f=(e,t,n)=>{if(!e)return null;let r=t[e]||{},i=Object.fromEntries((n||[]).map(e=>[e.id,e]));if(r.category&&i[r.category])return i[r.category];let a=(n||[]).filter(e=>e.kind===`amenity`),o=e=>String(e||``).toLowerCase().replace(/[^a-z0-9]+/g,` `).trim().replace(/s$/,``),s=new Set([e,r.name,r.label].concat(u[e]||[]).map(o));return a.find(t=>t.id===e)||a.find(e=>s.has(o(e.id))||s.has(o(e.name)))||null},p=(e,t)=>(t&&t.color&&e.style.setProperty(`--mp-cc`,t.color),t&&t.color&&e.classList.contains(`mp-dir-pip`)&&e.style.setProperty(`--mp-cc`,MapplicData.readableOn(`#ffffff`,t.color,3)),e),m=(e,n)=>{let o=t(`div`,`mp-dir-thumb`);if(n===`card`&&e.photo){let n=t(`img`,`mp-dir-photo`);n.src=e.photo,n.alt=``,n.loading=`lazy`,o.append(n)}else if(e.logo&&(e.logo.svg||/^\s*</.test(e.logo.image||``))){let t=e.logo.svg||e.logo.image;o.innerHTML=t,i(t)&&o.classList.add(`mp-dir-dark`),MapplicData.svgIsMono(t)&&o.classList.add(`mp-logo-mono`),n!==`card`&&a(t)&&o.classList.add(`mp-dir-bleed`)}else if(e.logo&&e.logo.image){let n=t(`img`,`mp-dir-logo`);o.classList.add(`mp-dir-raster`),n.onload=()=>MapplicData.imageIsMono(n)&&o.classList.add(`mp-logo-mono`),n.src=e.logo.image,n.alt=``,o.append(n)}else o.textContent=r(e.name);return o},h=(e,i,a)=>{let o=a||(e=>MapplicData.categoryName(e)),s=t(`span`,`mp-dir-cats`),c=t(`span`,`mp-dir-pips`),u=e.map(e=>o(e.name||e.id));return e.slice(0,3).forEach((e,i)=>{let a=p(t(`span`,`mp-dir-pip`,l(e.icon,12)||n(r(u[i]).slice(0,1))),e);c.append(a)}),s.title=u.join(`, `),s.append(c,t(`span`,`mp-dir-cat`,n(i||u[0]))),e.length>1&&s.append(t(`span`,`mp-dir-more`,`+`+(e.length-1))),s};return{css:{".mp-dir-item":`position:relative;display:grid;align-items:center;gap:12px;width:100%;min-width:0;box-sizing:border-box;padding:8px;border:0;border-radius:calc(10px * var(--mp-rk, 1));background:transparent;font:inherit;text-align:left;color:var(--mp-fg);cursor:pointer;transition:background-color 200ms ease,box-shadow 200ms ease`,".mp-dir-item:hover, .mp-dir-item.mp-hover":`background:var(--mp-bg-muted)`,".mp-dir-item.mp-active, .mp-dir-item.mp-active:hover":`background:var(--mp-focus)`,".mp-dir-item.mp-active .mp-dir-name":`color:var(--mp-focus-fg)`,".mp-dir-item:focus-visible":`outline:2px solid var(--mp-accent);outline-offset:-2px`,".mp-dir-text":`min-width:0;display:flex;flex-direction:column;gap:2px`,".mp-dir-name":`font-size:14px;font-weight:500;line-height:1.3;color:var(--mp-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap`,".mp-dir-sub":`display:flex;align-items:center;gap:6px;min-width:0;font-size:13px;line-height:1.35;color:var(--mp-fg-muted);white-space:nowrap;overflow:hidden`,".mp-dir-cat":`min-width:0;overflow:hidden;text-overflow:ellipsis`,".mp-dir-cats":`display:flex;align-items:center;gap:6px;min-width:0`,".mp-dir-pips":`flex:none;display:flex;align-items:center;gap:2px`,".mp-dir-pip":`flex:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;font-size:10px;font-weight:700;line-height:1;background:var(--mp-cc, var(--mp-bg-muted));color:#fff`,'.mp-dir-pip:not([style*="--mp-cc"])':`color:var(--mp-fg-tertiary)`,".mp-dir-pip svg, .mp-dir-pip img":`display:block;width:12px;height:12px;object-fit:contain`,".mp-dir-more":`flex:none;font-size:12px;font-weight:500;color:var(--mp-fg-tertiary)`,".mp-dir-sub .mp-hours-badge":`flex:none`,".mp-dir-sub .mp-hours-closed":`display:none`,".mp-dir-level":`flex:none;display:inline-flex;align-items:center;height:18px;padding:0 6px;border-radius:calc(5px * var(--mp-rk, 1));background:var(--mp-bg-muted);color:var(--mp-fg-tertiary);font-size:11px;font-weight:600;letter-spacing:0.02em`,".mp-dir-item.mp-active .mp-dir-level":`background:var(--mp-accent-subtle-hover);color:var(--mp-focus-fg)`,".mp-dir-end":`display:flex;align-items:center;justify-content:flex-end;min-width:0`,".mp-dir-item .mp-hours-dot":`animation:none`,".mp-dir-item .mp-hours-badge":`font-size:12px`,".mp-dir-thumb":`flex:none;display:flex;align-items:center;justify-content:center;overflow:hidden;background:var(--mp-bg-muted);color:var(--mp-fg-tertiary);font-weight:600;letter-spacing:-0.01em`,".mp-dir-thumb.mp-dir-dark, .mp-dir-i-card .mp-dir-thumb.mp-dir-dark":`background-color:var(--mp-fg-strong);background-image:none`,".mp-dir-thumb.mp-dir-bleed svg":`width:100%;height:100%`,".mp-dir-thumb svg, .mp-dir-thumb img.mp-dir-logo":`width:76%;height:76%;object-fit:contain`,".mp-dir-thumb.mp-dir-raster":`background:#fff;outline:1px solid rgba(9,9,11,0.08);outline-offset:-1px`,".mp-dir-thumb.mp-dir-raster img.mp-dir-logo":`width:100%;height:100%;object-fit:contain`,".mp-dir-thumb.mp-logo-mono svg, .mp-dir-thumb.mp-logo-mono img.mp-dir-logo":`filter:var(--mp-logo-filter)`,".mp-dir-thumb img.mp-dir-photo":`width:100%;height:100%;object-fit:cover`,".mp-dir-i-text":`grid-template-columns:minmax(0,1fr);padding:10px 10px`,".mp-dir-i-logo":`grid-template-columns:40px minmax(0,1fr)`,".mp-dir-i-logo .mp-dir-thumb":`width:40px;height:40px;border-radius:calc(10px * var(--mp-rk, 1));font-size:13px`,".mp-dir-i-card":`grid-template-columns:minmax(0,1fr);align-items:start;gap:10px;padding:6px 6px 10px`,".mp-dir-i-card .mp-dir-thumb":`width:100%;aspect-ratio:16 / 10;border-radius:calc(8px * var(--mp-rk, 1));font-size:20px;background-color:var(--mp-bg-muted)`,".mp-dir-i-card .mp-dir-thumb svg, .mp-dir-i-card .mp-dir-thumb img.mp-dir-logo":`width:44%;height:52%`,".mp-dir-i-card .mp-dir-text":`padding:0 4px;gap:3px`,".mp-dir-i-card .mp-dir-end":`justify-content:flex-start;padding:0 4px`,".mp-dir-i-tile":`grid-template-columns:minmax(0,1fr);justify-items:center;text-align:center;gap:8px;padding:14px 8px 12px`,".mp-dir-i-tile .mp-dir-thumb":`width:56px;height:56px;border-radius:calc(14px * var(--mp-rk, 1));font-size:16px`,".mp-dir-i-tile .mp-dir-text":`align-items:center;width:100%`,".mp-dir-i-tile .mp-dir-sub":`justify-content:center;flex-wrap:wrap;row-gap:4px;max-width:100%`,".mp-dir-i-tile .mp-dir-cats":`justify-content:center;max-width:100%`,".mp-dir-item .mp-hours-unknown":`display:none`,".mp-dir-compact":`padding:6px 8px;gap:10px;border-radius:calc(8px * var(--mp-rk, 1))`,".mp-dir-compact.mp-dir-i-logo":`grid-template-columns:32px minmax(0,1fr)`,".mp-dir-compact .mp-dir-thumb":`width:32px;height:32px;border-radius:calc(8px * var(--mp-rk, 1));font-size:12px`,".mp-dir-item mark":`background:transparent;color:inherit;font-weight:700`,".mp-dir-thumb.mp-dir-icon":`background:color-mix(in srgb, var(--mp-cc, #1476ff) 12%, var(--mp-surface));color:color-mix(in srgb, var(--mp-cc, #1476ff) 75%, var(--mp-fg))`,".mp-dir-thumb.mp-dir-icon svg":`width:auto;height:auto`,".mp-cat-icon":`flex:none;display:inline-flex;color:var(--mp-cc, currentColor)`,".mp-cat-icon img":`display:block;object-fit:contain`,".mp-fade":`-webkit-mask-image:linear-gradient(to right, transparent 0, #000 var(--mp-fl, 0px), #000 calc(100% - var(--mp-fr, 0px)), transparent 100%);mask-image:linear-gradient(to right, transparent 0, #000 var(--mp-fl, 0px), #000 calc(100% - var(--mp-fr, 0px)), transparent 100%)`},item:(e,r={})=>{let i=r.style||`logo`,a=t(`button`,`mp-dir-item mp-dir-i-`+i+(r.compact?` mp-dir-compact`:``));a.type=`button`,e.id&&(a.setAttribute(`data-mp-hover`,e.id),a.setAttribute(`data-id`,e.id)),r.thumb?a.append(r.thumb):i!==`text`&&a.append(m(e,i));let o=t(`div`,`mp-dir-text`),s=t(`div`,`mp-dir-name`,n(e.name)),c=t(`div`,`mp-dir-sub`);r.levelOf&&[...new Set(r.levels||[e.level])].forEach(e=>{let i=r.levelOf(e)||{},a=t(`span`,`mp-dir-level`,n(i.short||i.name||``));a.title=i.name||``,c.append(a)});let l=i!==`card`&&r.badge&&r.badge(`dot`);l&&c.append(l);let u=r.subText==null?e.categoryName:r.subText;r.cats&&r.cats.length?c.append(h(r.cats,r.catLabel||u,r.categoryName)):u&&c.append(t(`span`,`mp-dir-cat`,n(u))),o.append(s),c.childNodes.length&&o.append(c),a.append(o);let d=i===`card`&&r.badge&&r.badge(`full`);if(d){let e=t(`div`,`mp-dir-end`);e.append(d),a.append(e)}return a._name=s,a},thumb:m,dragScroll:o,initials:r,icon:l,tint:p,ICONS:s,SYNONYMS:u,amenityKey:d,amenityCategory:f,categoriesOf:e=>e?MapplicData.categoryList(e.category):[],groupCats:(e,t,n)=>{let r=e.length?e:t?[`amenity`]:[];return[...new Set(r.map(e=>n[e]===`amenity`?`amenity`:e))]},isFeatured:e=>!!e&&(e.featured===!0||/^(true|1|yes)$/i.test(String(e.featured||``).trim()))}})(),MapplicMap.plugin(`directory`,e=>{let t=e.plugin(`directory`),n=document,r=e=>t.setting(e),i=(t,n)=>e.ui.t(t,n),a=e.memory;a.closed=a.closed||{};let o=MapplicMap.svgIcon,s={chevronDown:o(`<path d="m6 9 6 6 6-6"></path>`,14),chevronLeft:o(`<path d="m15 18-6-6 6-6"></path>`),chevronRight:o(`<path d="m9 18 6-6-6-6"></path>`),chevronUp:o(`<path d="m18 15-6-6-6 6"></path>`),x:o(`<path d="M18 6 6 18"></path><path d="m6 6 12 12"></path>`,14)},c=(e,t,r)=>{let i=n.createElement(e);return t&&(i.className=t),r!=null&&(i.innerHTML=r),i},l=MapplicMap.escapeHtml,u=t=>{try{return e.plugin(t).enabled()}catch{return!1}},d=MapplicMap.PLACE,f=d.dragScroll;e.ui.style(Object.assign({},d.css,{".mp-directory":`display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;box-sizing:border-box;background:var(--mp-surface);font-family:Onest,sans-serif;color:var(--mp-fg);position:relative`,".mp-dock.mp-directory":`pointer-events:auto`,".mp-dir-left":`border-right:1px solid var(--mp-border)`,".mp-dir-right":`border-left:1px solid var(--mp-border)`,".mp-directory.mp-dir-bottom":`height:auto;background:transparent`,".mp-dir-bottom .mp-dir-item":`background:var(--mp-surface)`,".mp-dir-bottom .mp-dir-item:hover, .mp-dir-bottom .mp-dir-item.mp-hover":`background:var(--mp-bg-muted)`,".mp-dir-bottom .mp-dir-item.mp-active, .mp-dir-bottom .mp-dir-item.mp-active:hover":`background:var(--mp-focus)`,".mp-dir-bottom .mp-dir-search":`width:100%;max-width:var(--mp-dir-sw, 420px);align-self:center`,".mp-dir-bottom.mp-dir-sticky .mp-dir-gtitle, .mp-dir-bottom .mp-dir-gtitle":`position:static;background:transparent`,".mp-dir-grow .mp-dir-body":`flex:none;overflow:visible;overscroll-behavior:auto`,".mp-dir-pin .mp-dir-head":`position:sticky;top:var(--mp-sticky-top, 0px);z-index:3`,".mp-dir-pin .mp-dir-search":`position:relative`,".mp-dir-veil":`position:absolute;left:-56px;right:-56px;top:-32px;bottom:-40px;z-index:-1;pointer-events:none;opacity:0;transition:opacity 150ms ease;-webkit-backdrop-filter:blur(14px) saturate(1.3);backdrop-filter:blur(14px) saturate(1.3);background:var(--mp-veil, color-mix(in srgb, var(--mp-bg) 28%, transparent));-webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);mask-image:linear-gradient(to bottom, transparent 0, #000 32px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);-webkit-mask-composite:source-in;mask-composite:intersect`,".mp-dir-stuck .mp-dir-veil":`opacity:1`,".mp-directory:not(.mp-dir-grow) .mp-dir-body":`-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--mp-dir-ft, 0px),#000 calc(100% - var(--mp-dir-fb, 0px)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--mp-dir-ft, 0px),#000 calc(100% - var(--mp-dir-fb, 0px)),transparent 100%)`,".mp-dir-floating, .mp-dir-sheet":`position:absolute;box-shadow:var(--mp-shadow-float);overflow:hidden;transition:height 200ms ease`,".mp-dir-floating":`top:16px;border-radius:calc(14px * var(--mp-rk, 1));height:calc(100% - 32px)`,".mp-dir-sheet":`left:0;right:0;bottom:0;height:55%;border-radius:calc(16px * var(--mp-rk, 1)) calc(16px * var(--mp-rk, 1)) 0 0`,".mp-still.mp-dir-floating, .mp-still.mp-dir-sheet":`transition:none`,".mp-dir-collapsed .mp-dir-rail":`visibility:hidden`,".mp-dir-tools":`display:flex;align-items:center;gap:8px;margin:-4px -6px -4px auto`,".mp-dir-wide .mp-search-ui":`flex-direction:row;align-items:center;gap:12px`,".mp-dir-wide .mp-search-ui > .mp-search-bar":`flex:0 1 340px;min-width:200px`,".mp-dir-wide .mp-search-ui > .mp-search-chips":`flex:1;min-width:0`,".mp-dir-head":`flex:none;display:flex;flex-direction:column;gap:12px;padding:16px 16px 4px`,".mp-dir-bottom .mp-dir-head":`padding:16px 16px 8px`,".mp-dir-titlerow":`display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px`,".mp-dir-title":`font-size:16px;font-weight:600;letter-spacing:-0.01em;color:var(--mp-fg)`,".mp-dir-iconbtn":`flex:none;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:calc(8px * var(--mp-rk, 1));background:transparent;color:var(--mp-fg-muted);cursor:pointer;padding:0;transition:background-color 150ms ease,color 150ms ease`,".mp-dir-iconbtn:hover":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,".mp-dir-bar-toggle":`cursor:pointer;user-select:none`,".mp-dir-iconbtn svg":`pointer-events:none`,".mp-dir-bar-toggle:hover .mp-dir-collapse":`background:var(--mp-bg-muted);color:var(--mp-fg-strong)`,".mp-dir-bar":`flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 16px 8px;font-size:13px;color:var(--mp-fg-muted);min-height:20px`,".mp-dir-bar[hidden]":`display:none`,".mp-dir-bar[hidden] + .mp-dir-body":`padding-top:4px`,".mp-dir-link":`border:0;background:transparent;padding:2px 0;font:inherit;font-size:13px;font-weight:500;color:var(--mp-accent);cursor:pointer`,".mp-dir-link:hover":`color:var(--mp-accent-subtle-fg)`,".mp-dir-body":`flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 8px 8px;scrollbar-width:thin;scrollbar-color:var(--mp-border) transparent`,".mp-dir-with-rail .mp-dir-body":`padding-right:28px`,".mp-dir-group + .mp-dir-group":`margin-top:8px`,".mp-dir-gtitle":`display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:12px 8px 6px;box-sizing:border-box;border:0;background:var(--mp-surface);font:inherit;font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--mp-fg-muted);text-align:left`,".mp-dir-sticky .mp-dir-gtitle":`position:sticky;top:0;z-index:1`,"button.mp-dir-gtitle":`cursor:pointer`,"button.mp-dir-gtitle:hover":`color:var(--mp-fg-strong)`,".mp-dir-glabel":`display:inline-flex;align-items:center;gap:8px;min-width:0`,".mp-dir-gmeta":`display:flex;align-items:center;gap:6px;letter-spacing:0;font-weight:500;color:var(--mp-fg-subtle)`,".mp-dir-gmeta svg":`transition:transform 150ms ease`,".mp-dir-gclosed .mp-dir-gmeta svg":`transform:rotate(-90deg)`,".mp-dir-fold":`display:grid;grid-template-rows:1fr;transition:grid-template-rows 200ms ease, opacity 200ms ease`,".mp-dir-fold > .mp-dir-items":`min-height:0;overflow:hidden`,".mp-dir-gclosed .mp-dir-fold":`grid-template-rows:0fr;opacity:0`,".mp-still .mp-dir-fold, .mp-still .mp-dir-gmeta svg":`transition:none`,".mp-dir-items":`display:grid;gap:2px`,".mp-dir-grid .mp-dir-items":`gap:8px;padding:2px 0`,".mp-dir-grid .mp-dir-items:has(> .mp-dir-i-text, > .mp-dir-i-logo)":`row-gap:2px`,".mp-dir-grid .mp-dir-i-tile, .mp-dir-grid .mp-dir-i-card, .mp-dir-reel .mp-dir-item":`box-shadow:inset 0 0 0 1px var(--mp-border)`,".mp-dir-grid .mp-dir-item.mp-active, .mp-dir-reel .mp-dir-item.mp-active":`box-shadow:inset 0 0 0 1px var(--mp-accent-subtle-hover)`,".mp-dir-reel":`display:grid;grid-auto-flow:column;gap:10px;align-items:stretch;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-x:contain;padding:8px 8px 12px;margin:0 -8px 4px;user-select:none;-webkit-user-select:none`,".mp-dir-reel::-webkit-scrollbar":`display:none`,".mp-dir-reel > *":`transform:translateX(var(--mp-over, 0px))`,".mp-dir-reel .mp-dir-item":`align-content:start`,".mp-dir-reel .mp-dir-i-card .mp-dir-thumb":`aspect-ratio:16 / 9`,".mp-dir-reel img":`pointer-events:none;-webkit-user-drag:none`,".mp-dir-empty":`display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:16px 8px;font-size:14px;color:var(--mp-fg-muted)`,".mp-dir-rail":`position:absolute;right:4px;top:0;bottom:0;display:flex;flex-direction:column;justify-content:center;gap:0;padding:4px 0 12px;pointer-events:auto`,".mp-dir-rail button":`flex:0 1 16px;min-height:9px;width:20px;border:0;background:transparent;padding:0;font:inherit;font-size:10px;font-weight:600;color:var(--mp-fg-muted);cursor:pointer;border-radius:calc(4px * var(--mp-rk, 1));line-height:1;overflow:hidden`,".mp-dir-rail button:hover":`background:var(--mp-bg-muted);color:var(--mp-fg)`,".mp-dir-rail button:disabled":`color:var(--mp-border-strong);cursor:default;background:transparent`,".mp-dir-tab":`position:absolute;z-index:6;display:flex;align-items:center;justify-content:center;border:0;background:transparent;color:var(--mp-border-strong);cursor:pointer;padding:0;outline:none;transition:color 150ms ease`,".mp-dir-tab:hover, .mp-dir-tab:focus-visible":`--mp-bend:22deg;color:var(--mp-fg)`,".mp-dir-bend":`position:relative;display:block;width:26px;height:10px;pointer-events:none`,".mp-dir-bend i":`position:absolute;top:3.5px;width:14.5px;height:3px;border-radius:999px;background:currentColor;transition:transform 200ms ease`,".mp-dir-bend i:first-child":`left:0;transform-origin:13px 50%;transform:rotate(calc(var(--mp-bend, 0deg) * var(--mp-bend-dir, 1)))`,".mp-dir-bend i:last-child":`right:0;transform-origin:1.5px 50%;transform:rotate(calc(var(--mp-bend, 0deg) * var(--mp-bend-dir, 1) * -1))`,".mp-dir-tab-left .mp-dir-bend, .mp-dir-tab-right .mp-dir-bend":`width:10px;height:26px`,".mp-dir-tab-left .mp-dir-bend i, .mp-dir-tab-right .mp-dir-bend i":`top:auto;left:3.5px;right:auto;width:3px;height:14.5px`,".mp-dir-tab-left .mp-dir-bend i:first-child, .mp-dir-tab-right .mp-dir-bend i:first-child":`top:0;transform-origin:50% 13px`,".mp-dir-tab-left .mp-dir-bend i:last-child, .mp-dir-tab-right .mp-dir-bend i:last-child":`bottom:0;transform-origin:50% 1.5px`,".mp-dir-tab-left":`left:4px;top:50%;width:32px;height:72px;margin-top:-36px`,".mp-dir-tab-right":`right:4px;top:50%;width:32px;height:72px;margin-top:-36px`,".mp-dir-tab-bottom":`bottom:4px;left:50%;width:72px;height:32px;margin-left:-36px`,".mp-dir-tab.mp-dir-tab-touch":`--mp-bend:22deg;color:var(--mp-fg-tertiary)`,".mp-dir-tab.mp-dir-tab-still .mp-dir-bend i":`transition:none`,".mp-dir-handle":`width:36px;height:4px;border-radius:999px;background:var(--mp-border-strong);margin:-8px auto -4px;border:10px solid transparent;background-clip:padding-box;cursor:grab`,".mp-dir-sheet .mp-dir-head":`touch-action:none`,".mp-dir-sheet .mp-search-chips":`touch-action:pan-x`,".mp-dir-dragging":`transition:none !important`,".mp-dir-empty .mp-search-empty":`padding:0`,".mp-dir-body > .mp-search-understood":`padding:8px 8px 4px`}));let p=[],m={},h=[],g={},_=()=>e.data.levels(),v=e=>_().find(t=>t.index===e)||{name:``,short:``},y=()=>Object.fromEntries(e.data.units().map(e=>[e.id,e.logo||e.thumb||null])),b=()=>{let t=e.data.section(`categories`)||[],n=Object.fromEntries(t.map(e=>[e.id,e.kind||`store`])),r=e.data.amenityTypes(),i=e=>{let t=Object.keys(r).find(t=>t===e||r[t].label===e);return t&&r[t].name||e||``},a=y();h=t.map(e=>e.id),g=Object.fromEntries(t.map(e=>[e.id,e])),p=[],m={};let o={};e.data.stores().map(e=>[e,`store`]).concat(e.data.amenities().map(e=>[e,`amenity`])).forEach(([s,c])=>{if(m[s.id]||s.searchable===!1)return;let l=s.location&&o[s.location];if(l){l.ids.push(s.id),l.units.push({id:s.id,level:s.level}),l.levels.includes(s.level)||l.levels.push(s.level),l.levels.sort((e,t)=>e-t),m[s.id]=l;return}let u=s.location&&e.data.location(s.location)||{},f=!u.category&&c===`amenity`?d.amenityCategory(d.amenityKey(s.type,r),r,t):null,h=d.categoriesOf(u),_=h[0]||(c===`amenity`?f?f.id:`amenity`:null);if(h.length&&h.every(e=>n[e]===`service`))return;let v=d.groupCats(h,c===`amenity`,n),y=u.amenity||(c===`amenity`?s.type||`amenity`:null),b={id:s.id,info:s,name:s.name,amenity:y,category:_,categories:v,categoryName:c===`amenity`&&!u.category?i(s.type):h.length>1?h.map(t=>g[t]&&e.data.categoryName(g[t].name)||t).join(`, `):s.category||``,level:s.level,ids:[s.id],units:[{id:s.id,level:s.level}],levels:[s.level],hours:s.hours,logo:a[s.id]||null,cat:g[_]||null,cats:(h.length?h.filter(e=>n[e]!==`service`):_?[_]:[]).map(e=>g[e]).filter(Boolean),mainName:h.length&&g[h[0]]?e.data.categoryName(g[h[0]].name):``,photo:s.images&&s.images[0]&&(s.images[0].src||s.images[0])||null,featured:d.isFeatured(u),els:{},reelEl:null};p.push(b),m[b.id]=b,s.location&&(o[s.location]=b)})},x=t=>{let n=e.getState();return(t.units.find(e=>e.level===n.level)||t.units[0]).id},S=(t,n)=>{if(!t.hours||!r(`show_hours`)||!u(`hours`))return null;try{return e.plugin(`hours`).badge(t.info,{variant:n,theme:`light`})}catch{return null}},C=``,w=e=>Object.values(e.els).concat(e.reelEl||[]),T=(t,n)=>{let i=n||r(`item`),a=d.item(t,{style:i,levels:t.levels,levelOf:r(`show_level`)&&_().length>1?v:null,subText:r(`show_category`)?t.categoryName:``,cats:r(`show_category`)&&r(`category_style`)!==`text`?t.cats:null,catLabel:t.mainName,categoryName:e.data.categoryName,badge:e=>S(t,e)});return a.onmouseenter=()=>e.view.hover(x(t)),a.onmouseleave=()=>e.view.hover(null),a.onfocus=()=>e.view.hover(x(t)),a.onblur=()=>e.view.hover(null),a.onclick=()=>{e.view.select({id:x(t)}),U()},a},E=null,D=null,O=null,k=null,A=null,j=null,M=null,N=`left`,P=null,F=null,I=null,ee=()=>u(`search`)?e.plugin(`search`):null,L=`mp-dir-`+Math.random().toString(36).slice(2,8),R=()=>!!a.collapsed,z=e=>{a.collapsed=e,!e&&a.snap===`peek`&&(a.snap=`half`),re()},te=()=>a.collapsed?`peek`:a.snap===`full`?`full`:`half`,B=e=>{a.snap=e,a.collapsed=e===`peek`,re()},V={half:`55%`,full:`calc(100% - 56px)`},H=()=>{let t=e.ui.container.clientHeight;return{peek:A?A.offsetTop+4:120,half:Math.round(t*.55),full:Math.max(Math.round(t*.55),t-56)}},ne=e=>{let t=null,n=0,r=0,i=0,a=0,o=0,s=!1;e.addEventListener(`pointerdown`,e=>{N!==`sheet`||e.button>0||e.target.closest(`input, button, select, label, .mp-search-chips`)||(t=e.pointerId,n=i=e.clientY,a=performance.now(),r=E.offsetHeight,o=0,s=!1)}),e.addEventListener(`pointermove`,c=>{if(c.pointerId!==t)return;if(!s&&Math.abs(c.clientY-n)>4){s=!0;try{e.setPointerCapture(t)}catch{}E.classList.add(`mp-dir-dragging`)}if(!s)return;let l=H();E.style.height=Math.max(l.peek,Math.min(l.full+24,r+n-c.clientY))+`px`;let u=performance.now();u>a&&(o=.7*((i-c.clientY)/(u-a))+.3*o),i=c.clientY,a=u});let c=e=>{if(e.pointerId!==t)return;if(t=null,E.classList.remove(`mp-dir-dragging`),!s){e.target.closest(`.mp-dir-handle`)&&B({peek:`half`,half:`full`,full:`half`}[te()]);return}performance.now()-a>80&&(o=0);let n=H(),r=E.offsetHeight+o*200;B([`peek`,`half`,`full`].reduce((e,t)=>Math.abs(n[t]-r)<Math.abs(n[e]-r)?t:e,`half`))};e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,c)},re=()=>{if(!E)return;let e=R();if(D&&D.update({size:e?0:oe()}),E.classList.toggle(`mp-dir-collapsed`,e&&!D),!D&&A){let t=N===`sheet`?V[te()]||V.half:`calc(100% - 32px)`,n=A.offsetTop+4+`px`,r=E.offsetHeight+`px`;E.style.height=r,E.offsetHeight,E.style.height=e?n:t}O&&(O.style.setProperty(`--mp-bend-dir`,String((N===`right`?-1:1)*(e?-1:1))),O.title=i(e?`directory_expand`:`directory_collapse`),O.setAttribute(`aria-label`,O.title),O.setAttribute(`aria-expanded`,e?`false`:`true`));let t=F;t&&(t.innerHTML=e?s.chevronDown:s.chevronUp,t.title=i(e?`directory_expand`:`directory_collapse`)),me()},ie=()=>r(`height`)===`fixed`||r(`height`)===`map`,ae=()=>r(`height`)===`map`?Math.max(160,Math.round(e.ui.size().height*(+r(`map_share`)||50)/100)):+r(`max_height`)||600,oe=()=>N===`bottom`?ie()?ae():`auto`:r(`width`),se=e=>{let t=e.parentElement;for(;t&&t!==n.body&&t!==n.documentElement;){let e=getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null},U=()=>{if(N!==`bottom`)return;let t=e.ui.container,n=t.getBoundingClientRect(),r=se(t),i=r?r.getBoundingClientRect():{top:0,bottom:window.innerHeight,height:window.innerHeight};if(Math.min(n.bottom,i.bottom)-Math.max(n.top,i.top)>=Math.min(n.height,i.height)*.6)return;let a=n.top-i.top-Math.max(16,(i.height-n.height)/2);(r||window).scrollBy({top:a,behavior:e.ui.env().reducedMotion?`auto`:`smooth`})},ce=()=>{if(!E||!A||E.classList.contains(`mp-dir-grow`))return;let e=A.scrollHeight-A.clientHeight-A.scrollTop>2,t=A.scrollTop>2;A.style.setProperty(`--mp-dir-ft`,t?`16px`:`0px`),A.style.setProperty(`--mp-dir-fb`,e?`32px`:`0px`),e!==E.classList.contains(`mp-dir-more`)&&E.classList.toggle(`mp-dir-more`,e)},le=null,ue=e=>{let t=0,r=()=>{if(t=0,!E||!e.isConnected)return;let n=e.getBoundingClientRect().top-E.getBoundingClientRect().top>1;n!==E.classList.contains(`mp-dir-stuck`)&&E.classList.toggle(`mp-dir-stuck`,n)},i=(e,t)=>{for(let n=t;n;n=n.getRootNode().host)if(e.contains&&e.contains(n))return!0;return!1},a=e=>{let a=e.target;t||!E||a!==n&&a!==n.documentElement&&!i(a,E)||(t=requestAnimationFrame(r))},o=E&&E.getRootNode().host?E.getRootNode():null;n.addEventListener(`scroll`,a,{capture:!0,passive:!0}),o&&o.addEventListener(`scroll`,a,{capture:!0,passive:!0}),le=()=>{n.removeEventListener(`scroll`,a,{capture:!0}),o&&o.removeEventListener(`scroll`,a,{capture:!0}),t&&cancelAnimationFrame(t),le=null}},de=()=>e.ui.size().width+((N===`left`||N===`right`)&&D&&!R()?r(`width`):0),fe=()=>de()<640,pe=[`--mp-inset-l`,`--mp-inset-r`,`--mp-inset-bl`,`--mp-inset-br`],me=()=>{let t=e.ui.container;if(pe.forEach(e=>t.style.removeProperty(e)),E&&N===`sheet`?e.ui.inset(R()?null:{bottom:H()[te()]}):E&&/^floating-/.test(N)&&!R()?e.ui.inset({[N===`floating-right`?`right`:`left`]:r(`width`)+16}):e.ui.inset(null),!E||!/^floating-/.test(N))return;let n=r(`width`)+16+`px`,i=N===`floating-right`;t.style.setProperty(i?`--mp-inset-r`:`--mp-inset-l`,n),R()||t.style.setProperty(i?`--mp-inset-br`:`--mp-inset-bl`,n)},he=()=>{k&&k.destroy(),k=null,le&&le(),D&&D.remove(),D=null,E&&E.remove(),O&&O.remove(),E=O=A=j=M=P=null,p.forEach(e=>(e.els={},e.reelEl=null));let t=e.ui.container;pe.forEach(e=>t.style.removeProperty(e)),e.ui.inset(null)},ge=()=>{let t=fe(),n=!!(r(`toggle`)&&r(`collapsed`));r(`toggle`)?a.startCollapsed!==n&&(a.collapsed=n):a.collapsed=!1,a.startCollapsed=n,he(),b(),C=``;let o=r(`placement`);I=t,N=t?/^floating-/.test(o)?`sheet`:`bottom`:o;let s=r(`columns`)===1?`list`:`grid`;E=c(`div`,`mp-directory mp-dir-`+N+` mp-dir-`+s+(N===`bottom`?ie()?` mp-dir-capped`:` mp-dir-grow`+(r(`sticky_search`)?` mp-dir-pin`:``):``)+(e.ui.env().reducedMotion?` mp-still`:``)+(r(`collapsible`)?``:` mp-dir-sticky`)+(r(`group`)===`letter`&&r(`rail`)?` mp-dir-with-rail`:``));let u=c(`div`,`mp-dir-head`),d=r(`title`),f=/^floating-/.test(N)||N===`sheet`;if(N===`sheet`){let e=c(`div`,`mp-dir-handle`);e.setAttribute(`aria-hidden`,`true`),u.append(e),ne(u)}if(d){let e=c(`div`,`mp-dir-titlerow`);e.append(c(`div`,`mp-dir-title`,l(d))),u.append(e)}F=null,f&&r(`toggle`)&&(F=c(`button`,`mp-dir-iconbtn mp-dir-collapse`),F.type=`button`,F.onclick=e=>{e.stopPropagation(),z(!R())});let p=ee();if(p){let t=c(`div`,`mp-dir-search`);u.append(t);let n=typeof p.setting==`function`?+p.setting(`max_width`):0;n>0&&E.style.setProperty(`--mp-dir-sw`,n+`px`),k=p.mountUi(t,{count:!1,onEnter:t=>{let n=ee(),r=n&&n.interpret();r&&r.route?n.act():t?e.view.select({id:t}):n&&n.emptyEnter()},onArrow:()=>{let e=A&&A.querySelector(`.mp-dir-item`);e&&e.focus()}}),k.input.setAttribute(`aria-controls`,L),k.input.addEventListener(`focus`,()=>{N===`sheet`?te()!==`full`&&B(`full`):R()&&f&&z(!1)})}u.childNodes.length&&(E.append(u),E.classList.contains(`mp-dir-pin`)&&((u.querySelector(`.mp-dir-search`)||u).prepend(c(`div`,`mp-dir-veil`)),ue(u))),j=c(`div`,`mp-dir-bar`),A=c(`div`,`mp-dir-body`),A.id=L,A.setAttribute(`aria-label`,d||i(`search_places`)),A.addEventListener(`keydown`,be),A.addEventListener(`scroll`,ye,{passive:!0}),window.ResizeObserver&&new ResizeObserver(ye).observe(A),E.append(j,A),E.classList.contains(`mp-dir-with-rail`)&&(M=c(`div`,`mp-dir-rail`),E.append(M)),f?(N!==`sheet`&&(E.style.width=r(`width`)+`px`,E.style[N===`floating-right`?`right`:`left`]=`16px`),N!==`sheet`&&E.classList.add(`mp-dir-floating`),e.ui.mount(E,{layer:`top`})):(D=e.ui.dock(E,{side:N===`bottom`?`below`:N,size:R()?0:oe()}),r(`toggle`)&&(O=c(`button`,`mp-dir-tab mp-dir-tab-`+N),O.type=`button`,O.innerHTML=`<span class="mp-dir-bend"><i></i><i></i></span>`,O.classList.toggle(`mp-dir-tab-touch`,!!(window.matchMedia&&window.matchMedia(`(hover: none)`).matches)),O.classList.toggle(`mp-dir-tab-still`,!!e.ui.env().reducedMotion),O.onclick=()=>z(!R()),e.ui.mount(O))),re(),Se(),K(e.getState().selected,!1)},_e=()=>{if(!M||!A)return;let e=P&&P.parentNode===A?P.getBoundingClientRect().bottom-A.getBoundingClientRect().top+4:0;M.style.top=A.offsetTop+Math.max(0,e)+`px`,M.style.visibility=A.clientHeight-Math.max(0,e)<120?`hidden`:``},ve=0,ye=()=>{ve||=requestAnimationFrame(()=>{ve=0,_e(),ce()})},be=e=>{if(![`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=[...A.querySelectorAll(`.mp-dir-item`)].filter(e=>e.offsetParent),r=t.indexOf(n.activeElement);if(r<0)return;e.preventDefault();let i=e.key===`ArrowDown`||e.key===`ArrowRight`,a=e.key===`Home`?0:e.key===`End`?t.length-1:r+(i?1:-1);if(a<0&&k)return k.focus();a=Math.max(0,Math.min(t.length-1,a)),t[a].focus()},xe=t=>{if(!u(`hours`)||!t.hours)return 2;try{let n=e.plugin(`hours`).status(t.info).state;return n===`open`||n===`closing`?0:1}catch{return 2}},W=t=>{let n=r(`group`);if(n===`none`)return[{key:``,label:``,items:t}];let a=new Map,o=(e,t,n)=>{a.has(e)||a.set(e,{key:e,label:t,items:[]}),a.get(e).items.push(n)};t.forEach(t=>{if(n===`category`)(t.categories.length?r(`every_category`)?t.categories:t.categories.slice(0,1):[`~`]).forEach((n,r)=>o(n,n===`amenity`?i(`directory_amenities`):g[n]&&e.data.categoryName(g[n].name)||(r?``:t.categoryName)||i(`directory_other`),t));else if(n===`level`)o(`L`+t.levels[0],v(t.levels[0]).name,t);else{let e=String(t.name||``).trim().charAt(0).normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toUpperCase(),n=/[A-Z]/.test(e)?e:`#`;o(n,n,t)}});let s=[...a.values()];if(n===`category`){let e=e=>h.includes(e)?h.indexOf(e):999;s.sort((t,n)=>e(t.key)-e(n.key))}else n===`level`?s.sort((e,t)=>+e.key.slice(1)-t.key.slice(1)):s.sort((e,t)=>e.key===`#`?1:t.key===`#`?-1:e.key.localeCompare(t.key));return s},G=()=>{let e=r(`columns`),t={text:140,logo:150,card:180,tile:128}[r(`item`)];if(e===1)return{gridTemplateColumns:`minmax(0, 1fr)`};if(e>1){let n=`calc((100% - `+(e-1)*8+`px) / `+e+`)`;return{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, max(`+t+`px, `+n+`)), 1fr))`}}return{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, `+t+`px), 1fr))`}},Se=()=>{if(!E)return;let t=ee(),n=t?t.state():{active:!1,text:``},o=!!(n.text&&n.text.trim()),m=p.filter(e=>r(`amenities`)||!e.amenity);if(r(`this_level`)){let t=e.getState();t.allLevels||(m=m.filter(e=>e.levels.includes(t.level)))}let h=m.length;if(t&&n.active){let e=new Map(t.results().map((e,t)=>[e.id,t])),n=t=>Math.min(...t.ids.map(t=>e.has(t)?e.get(t):1/0));m=m.filter(e=>n(e)<1/0),o&&m.sort((e,t)=>n(e)-n(t))}if(!o){let e=r(`sort`),t=(e,t)=>e.name.localeCompare(t.name);e===`level`?m.sort((e,n)=>e.levels[0]-n.levels[0]||t(e,n)):e===`open`?m.sort((e,n)=>xe(e)-xe(n)||t(e,n)):m.sort(t)}j.replaceChildren();let _=c(`span`,``,l(n.active?i(`directory_filtered`,{n:m.length,total:h}):i(`directory_places`,{n:h})));(r(`count`)!==!1||n.active)&&j.append(_);let v=c(`div`,`mp-dir-tools`);if(n.active){let e=c(`button`,`mp-dir-link`,l(i(`search_clear`)));e.type=`button`,e.onclick=()=>t.clear(),v.append(e)}F&&v.append(F),v.childNodes.length&&j.append(v),j.hidden=!j.childNodes.length,j.classList.toggle(`mp-dir-bar-toggle`,!!F),j.onclick=F?e=>{e.target.closest&&e.target.closest(`button`)||z(!R())}:null;let y=[r(`item`),r(`show_category`),r(`category_style`),r(`show_level`),r(`show_hours`),r(`category_icons`),u(`hours`)].join(`|`);y!==C&&(C=y,p.forEach(e=>(e.els={},e.reelEl=null)));let b=A.scrollTop,x=A.scrollLeft;A.replaceChildren();let S=r(`reel`)&&!n.active?p.filter(e=>e.featured&&(r(`amenities`)||!e.amenity)):[];if(S.length){P||(P=c(`div`,`mp-dir-reel`),f(P));let e=r(`reel_item`);P.style.gridAutoColumns=e===`tile`?`132px`:e===`logo`?`220px`:`200px`,P.replaceChildren(),S.forEach(t=>{(!t.reelEl||t.reelEl._look!==e)&&(t.reelEl=T(t,e),t.reelEl._look=e,t.reelEl._name.textContent=t.name),P.append(t.reelEl)}),A.append(P),P.style.marginRight=-parseFloat(getComputedStyle(A).paddingRight)+`px`}let w=t&&t.understoodUi&&t.understoodUi();if(w&&m.length&&A.append(w),!m.length){let e=c(`div`,`mp-dir-empty`);t&&n.active?e.append(t.emptyUi()):e.append(c(`span`,``,l(i(`search_none`)))),A.append(e)}let O=o?[{key:``,label:``,items:m}]:W(m),k=G(),N=r(`collapsible`),I=r(`group`);if(O.forEach(e=>{let i=c(`div`,`mp-dir-group`);if(i.dataset.key=e.key,e.label){let t=I+`:`+e.key,o=c(N?`button`:`div`,`mp-dir-gtitle`);N&&(o.type=`button`,o.onclick=()=>{a.closed[t]=!a.closed[t],i.classList.toggle(`mp-dir-gclosed`,!!a.closed[t])},a.closed[t]&&!n.active&&i.classList.add(`mp-dir-gclosed`));let u=c(`span`,`mp-dir-glabel`,l(e.label)),f=I===`category`&&r(`category_icons`)&&g[e.key],p=f&&d.icon(f.icon,14);if(p){let e=d.tint(c(`span`,`mp-cat-icon`,p),f);u.prepend(e)}o.append(u);let m=c(`span`,`mp-dir-gmeta`);r(`counts`)&&m.append(c(`span`,``,String(e.items.length))),N&&m.insertAdjacentHTML(`beforeend`,s.chevronDown),m.childNodes.length&&o.append(m),i.append(o)}let o=c(`div`,`mp-dir-items`),u=c(`div`,`mp-dir-fold`);u.append(o),Object.assign(o.style,k);let f=e.key||`_`;e.items.forEach(e=>{let n=e.els[f]||(e.els[f]=T(e));n._name.innerHTML=t?t.mark(e.name):l(e.name),o.append(n)}),p.length>150&&(i.style.contentVisibility=`auto`,i.style.containIntrinsicSize=`auto `+Math.min(2e3,56*e.items.length+40)+`px`),i.append(u),A.append(i)}),A.scrollTop=b,A.scrollLeft=x,requestAnimationFrame(ce),M){_e(),M.replaceChildren();let e=new Set(O.map(e=>e.key));`#ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``).forEach(t=>{let n=c(`button`,``,t);n.type=`button`,n.disabled=o||!e.has(t),n.onclick=()=>{let e=A.querySelector(`.mp-dir-group[data-key="`+t+`"]`);if(!e)return;if(!E.classList.contains(`mp-dir-grow`))return A.scrollTo({top:e.offsetTop-A.offsetTop,behavior:`auto`});let n=se(E),r=E.querySelector(`.mp-dir-head`),i=E.classList.contains(`mp-dir-pin`)?(parseFloat(getComputedStyle(E).getPropertyValue(`--mp-sticky-top`))||0)+(r?r.offsetHeight:0):0;(n||window).scrollBy({top:e.getBoundingClientRect().top-(n?n.getBoundingClientRect().top:0)-i-8})},M.append(n)})}K(e.getState().selected,!1),R()&&!D&&(E.style.height=A.offsetTop+4+`px`)},Ce=null,K=(t,n)=>{Ce=t||null,p.forEach(e=>{let t=!!Ce&&e.ids.includes(Ce);w(e).forEach(e=>{e.classList.toggle(`mp-active`,t),t?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)})});let r=Ce&&m[Ce],i=r&&Object.values(r.els).find(e=>e.isConnected);if(n&&i&&A){let t=i.getBoundingClientRect(),n=A.getBoundingClientRect(),r=!e.ui.env().reducedMotion;(t.top<n.top+36||t.bottom>n.bottom)&&A.scrollTo({top:A.scrollTop+t.top-n.top-n.height/2+t.height/2,behavior:r?`smooth`:`auto`})}};ge(),e.on(`search`,Se),e.on(`select`,e=>K(e&&e.id,!0)),e.on(`hover`,e=>{p.forEach(t=>w(t).forEach(n=>n.classList.toggle(`mp-hover`,!!e&&t.ids.includes(e))))}),e.on(`level`,()=>{r(`this_level`)&&Se()}),e.on(`plugin`,e=>{(e.id===`directory`||e.id===`search`||e.id===`hours`||e.id===`localization`)&&ge()});let we=0,Te=0;return e.onFrame((e,t)=>{if(N===`bottom`&&D&&r(`height`)===`map`&&!R()){let e=ae();e!==Te&&(Te=e,D.update({size:e}))}fe()===I?we=0:we?t-we>300&&(we=0,ge()):we=t}),e.on(`language`,ge),e.on(`units`,ge),()=>{he(),e.view.hover(null)}}),MapplicMap.plugin(`deeplink`,e=>{let t=e.plugin(`deeplink`),n=MapplicMap.LINK_ITEMS,r=[`select`,`level`,`from`,`category`],i=(()=>{for(let t=e.ui.container;t;){let e=t.closest&&t.closest(`mapplic-map`);if(e)return e;let n=t.getRootNode&&t.getRootNode();t=n&&n.host?n.host:null}return null})(),a=`map-`+(i&&i.id?i.id+`-`:``),o=MapplicMap._linkWriters=MapplicMap._linkWriters||new Map,s={};if(e.ui.env().editor)return;let c=e=>{let r=t.setting(e);return Array.isArray(r)?r.filter(e=>n.includes(e)):[]},l=()=>c(`read`),u=()=>c(`write`).filter(e=>l().includes(e)),d=t=>{try{return e.plugin(t).enabled()}catch{return!1}},f=()=>{let e=location.hash.slice(1);return e.includes(`=`)?new URLSearchParams(e):null},p=()=>{let e={},t=[new URLSearchParams(location.search),f()].filter(Boolean),n=e=>{let n=``;return t.forEach(t=>t.has(a+e)&&(n=(t.get(a+e)||``).trim())),n},r=l();return r.includes(`select`)&&n(`select`)&&(e.select=n(`select`)),r.includes(`route`)&&n(`from`)&&(e.from=n(`from`)),r.includes(`level`)&&n(`level`)&&(e.level=n(`level`)),r.includes(`category`)&&n(`category`)&&(e.category=n(`category`).split(`,`).filter(Boolean)),e},m=(e,t)=>console.warn(`mapplic: deep link `+e,t),h=t=>{try{e.view.select(t)}catch(e){m(`map-select`,e)}},g=(t,n)=>{if(l().includes(`category`)&&d(`search`)&&(t.category||n))try{let n=e.plugin(`search`),r=n.getQuery();t.category?r.category=t.category:delete r.category,n.setQuery(r)}catch(e){m(`map-category`,e)}else t.category&&console.warn(`mapplic: map-category needs Search on`);let r=d(`wayfinding`)?e.plugin(`wayfinding`):null;if(t.select)t.from&&r?r.show(t.from,t.select).catch(e=>{m(`route`,e),h(t.select)}):(n&&r&&r.state().routeShown&&r.hide(),h(t.select));else if(n&&(r&&r.state().routeShown&&r.hide(),e.getState().selected&&e.view.deselect()),t.level||n)try{e.view.setLevel(t.level||_)}catch(e){m(`map-level`,e)}},_=0,v=!1,y=0,b=t=>{if(t===`all`)return`all`;let n=e.data.levels()[t];return String(n&&(n.short||n.name)||t)},x=()=>{let t=u(),n=e.getState(),r={},i=t.includes(`route`)&&d(`wayfinding`)?e.plugin(`wayfinding`).state():null;if(i&&i.routeShown&&i.from&&i.to?(r.from=i.from,r.select=i.to):t.includes(`select`)&&n.selected&&(r.select=n.selected),t.includes(`level`)&&!r.select){let e=n.allLevels?`all`:n.level;e!==_&&(r.level=b(e))}if(t.includes(`category`)&&d(`search`)){let t=e.plugin(`search`).getQuery().category;t&&t.length&&(r.category=t.join(`,`))}return r},S=()=>{let e=o.get(a);return e&&e!==s&&e.alive?(s.warned||console.warn(`mapplic: another map already writes `+a+`* to the address; this one does not`),s.warned=!0,!1):(o.set(a,s),!0)},C=()=>{if(!v||!u().length||!S())return;let e=new URL(location.href),n=f(),i=t.setting(`style`)===`hash`&&(n||!e.hash)?`hash`:`query`,o=i===`hash`?n||new URLSearchParams:e.searchParams,s=x(),c=u(),l=r.filter(e=>e===`select`&&(c.includes(`select`)||c.includes(`route`))||e===`from`&&c.includes(`route`)||e===`level`&&c.includes(`level`)||e===`category`&&c.includes(`category`));if(l.forEach(t=>{e.searchParams.delete(a+t),n&&n.delete(a+t)}),l.forEach(e=>s[e]&&o.set(a+e,s[e])),i===`hash`||n){let t=(i===`hash`?o:n).toString();e.hash=t?`#`+t:``}let d=e.href.replace(/#$/,``);if(d!==location.href.replace(/#$/,``)){try{t.setting(`history`)===`push`?history.pushState(history.state,``,d):history.replaceState(history.state,``,d)}catch(e){m(`write`,e)}T=E(p())}},w=()=>{clearTimeout(y),y=setTimeout(C,250)};[`select`,`level`,`route`,`search`].forEach(t=>e.on(t,w)),e.on(`plugin`,e=>e&&e.id===`deeplink`&&w());let T=``,E=e=>r.map(t=>[].concat(e[t]||``).join(`,`)).join(`|`),D=()=>{let e=p();E(e)!==T&&(T=E(e),clearTimeout(y),g(e,!0))};window.addEventListener(`popstate`,D),window.addEventListener(`hashchange`,D);let O=!1,k=!1,A=()=>k=!0;e.ui.container.addEventListener(`pointerdown`,A,{capture:!0}),e.ui.container.addEventListener(`keydown`,A,{capture:!0});let j=()=>{if(O)return;O=!0;let t=e.getState();_=t.allLevels?`all`:t.level;let n=p();T=E(n),Object.keys(n).length&&(g(n,!1),setTimeout(()=>{let t=e.getState();!k&&n.select&&!t.selected&&!t.routeShown&&g(n,!1)},500)),setTimeout(()=>{v=!0,Object.keys(x()).length&&!Object.keys(n).length&&w()},600)};if(e.getState().ready)setTimeout(j,0);else{let t=e.on(`ready`,()=>{t(),j()})}return s.alive=!0,e.provide({linked:p,prefix:()=>a}),()=>{s.alive=!1,clearTimeout(y),o.get(a)===s&&o.delete(a),window.removeEventListener(`popstate`,D),window.removeEventListener(`hashchange`,D),e.ui.container.removeEventListener(`pointerdown`,A,{capture:!0}),e.ui.container.removeEventListener(`keydown`,A,{capture:!0})}}),MapplicMap.plugin(`localization`,()=>{});var{MapplicMap:Xh,MapplicData:Zh,MapplicView:Qh}=window;return Xh.loadThree=async()=>({THREE:Af,SVGLoader:Yh}),e.MapplicData=Zh,e.MapplicMap=Xh,e.MapplicView=Qh,Object.defineProperty(e,"THREE",{enumerable:!0,get:function(){return Af}}),e})({});