PageSourceSearch

https://fluvius-2n3.pages.dev/main.js

js fluvius-2n3.pages.dev collected 2026-10-03 05:13:30 UTC 2,372,328 bytes, 2,833 lines download raw bytes

1var Wre=Object.defineProperty;var Xre=(Qu,cu,_c)=>cu in Qu?Wre(Qu,cu,{enumerable:!0,configurable:!0,writable:!0,value:_c}):Qu[cu]=_c;var de=(Qu,cu,_c)=>Xre(Qu,typeof cu!="symbol"?cu+"":cu,_c);(function(){"use strict";var g5,_5,y5,v5,x5,b5,w5,T5,E5,S5,C5,I5,A5,P5,M5,k5,R5,L5,z5,D5,O5,F5,N5,B5,V5,U5,j5,G5,$5,H5,q5,Z5,W5,X5,Y5,K5,J5,Q5,eN,tN,rN,iN,nN,oN,sN,aN,lN,cN,uN,hN,dN,fN,pN,mN,gN,_N,yN,vN,xN,bN,wN,TN,EN,SN,CN,IN,AN,PN,MN,kN,RN,LN,zN,DN,ON,FN,NN,BN,VN,UN,jN,GN,$N,HN,qN,ZN,WN,XN,YN,KN,JN,QN,e4,t4,r4,i4,n4,o4,s4,a4,l4,c4,u4,h4,d4,f4,p4,m4,g4,_4,y4,v4,x4,b4,w4,T4,E4,S4,C4,I4,A4,P4,M4,k4,R4,L4,z4,D4,O4,F4,N4,B4,V4,U4,j4,G4,$4,H4,q4,Z4,W4,X4,Y4,K4,J4,Q4,eB,tB,rB,iB,nB,oB,sB,aB,lB,cB,uB,hB,dB,fB,pB,mB,gB,_B,yB,vB,xB,bB,wB,TB,EB,SB,CB,IB,AB,PB,MB,kB,RB,LB,zB,DB,OB,FB,NB,BB,VB,UB,jB,GB,$B,HB,qB,ZB,WB,XB,YB,KB,JB,QB,eV,tV,rV,iV,nV,oV,sV,aV,lV,cV,uV,hV,dV,fV,pV,mV,gV,_V,yV,vV,xV,bV,wV,TV,EV,SV,CV,IV,AV,PV,MV,kV,RV,LV,zV,DV,OV,FV,NV,BV,VV,UV,jV,GV,$V,HV,qV,ZV,WV,XV,YV,KV,JV,QV,eU,tU,rU,iU,nU,oU,sU,aU,lU,cU,uU,hU,dU,fU,pU,mU,gU,_U,yU,vU,xU,bU,wU,TU,EU,SU,CU;var Qu=document.createElement("style");Qu.textContent=`.mapboxgl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.mapboxgl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:grab;-webkit-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom,.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-left,.mapboxgl-ctrl-right,.mapboxgl-ctrl-top,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top{left:50%;top:0;transform:translate(-50%)}.mapboxgl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-right{right:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl-bottom{bottom:0;left:50%;transform:translate(-50%)}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-left{left:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,.mapboxgl-ctrl-right .mapboxgl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-bottom .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,.mapboxgl-ctrl-left .mapboxgl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{background-color:initial;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;overflow:hidden;padding:0;width:29px}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:initial}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl-group button:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:only-child{border-radius:inherit}.mapboxgl-ctrl button:not(:disabled):hover{background-color:#0000000d}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewB
1ox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewB
1ox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3
1E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3
1E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3
1E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3
1E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3
1E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}}@keyframes mapboxgl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='0.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='0.9' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:initial;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.
112.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23000'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{background-color:#fff;border-radius:12px;box-sizing:initial;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;
1cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button{background-color:#0000000d}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.mapboxgl-ctrl-attrib a{color:#000000bf;text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.mapboxgl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{flex-direction:column-reverse}.mapboxgl-popup-anchor-left{flex-direction:row}.mapboxgl-popup-anchor-right{flex-direction:row-reverse}.mapboxgl-popup-tip{border:10px solid #0000;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button{background-color:initial;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover{background-color:#0000000d}.mapboxgl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:10px 10px 15px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}
1.mapboxgl-marker{left:0;opacity:1;position:absolute;top:0;transition:opacity .2s;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before{animation:mapboxgl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.mapboxgl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading{height:0;width:0}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after,.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-bottom:7.5px solid #4aa1eb;content:"";position:absolute}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-left:7.5px solid #0000;transform:translateY(-28px) skewY(-20deg)}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after{border-right:7.5px solid #0000;transform:translate(7.5px,-28px) skewY(20deg)}@keyframes mapboxgl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}@media print{.mapbox-improve-map{display:none}}.mapboxgl-scroll-zoom-blocker,.mapboxgl-touch-pan-blocker{align-items:center;background:#000000b3;color:#fff;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;top:0;transition:opacity .75s ease-in-out;transition-delay:1s;width:100%}.mapboxgl-scroll-zoom-blocker-show,.mapboxgl-touch-pan-blocker-show{opacity:1;transition:opacity .1s ease-in-out}.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page,.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button{background-color:#fff;border:1px solid #ccc;border-radius:4px;color:#333;cursor:pointer;font-size:12px;height:auto;line-height:1.5;margin:2px;padding:5px 10px;width:auto}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:hover{background-color:#f0f0f0}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button-selected{background-color:#4264fb;border-color:#4264fb;color:#fff}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button-selected:hover{background-color:#3151d9}.mapbox-gl-draw_ctrl-bottom-left,.mapbox-gl-draw_ctrl-top-left{margin-left:0;border-radius:0 4px 4px 0}.mapbox-gl-draw_ctrl-top-right,.mapbox-gl-draw_ctrl-bottom-right{margin-right:0;border-radius:4px 0 0 4px}.mapbox-gl-draw_ctrl-draw-btn{border-color:#000000e6;color:#ffffff80;width:30px;height:30px}.mapbox-gl-draw_ctrl-draw-btn.active,.mapbox-gl-draw_ctrl-draw-btn.active:hover{background-color:#0000000d}.mapbox-gl-draw_ctrl-draw-btn{background-repeat:no-repeat;background-position:center}.mapbox-gl-draw_point{background-image:url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m10 2c-3.3 0-6 2.7-6 6s6 9 6 9 6-5.7 6-9-2.7-6-6-6zm0 2c2.1 0 3.8 1.7 3.8 3.8 0 1.5-1.8 3.9-2.9 5.2h-1.7c-1.1-1.4-2.9-3.8-2.9-5.2-.1-2.1 1.6-3.8 3.7-3.8z"/>%3C/svg>')}.mapbox-gl-draw_polygon{background-image:url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m15 12.3v-4.6c.6-.3 1-1 1-1.7 0-1.1-.9-2-2-2-.7 0-1.4.4-1.7 1h-4.6c-.3-.6-1-1-1.7-1-1.1 0-2 .9-2 2 0 .7.4 1.4 1 1.7v4.6c-.6.3-1 1-1 1.7 0 1.1.9 2 2 2 .7 0 1.4-.4 1.7-1h4.6c.3.6 1 1 1.7 1 1.1 0 2-.9 2-2 0-.7-.4-1.4-1-1.7zm-8-.3v-4l1-1h4l1 1v4l-1 1h-4z"/>%3C/svg>')}.mapbox-gl-draw_line{background-image:url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m13.5 3.5c-1.4 0-2.5 1.1-2.5 2.5 0 .3 0 .6.2.9l-3.8 3.8c-.3-.1-.6-.2-.9-.2-1.4 0-2.5 1.1-2.5 2.5s1.1 2.5 2.5 2.5 2.5-1.1 2.5-2.5c0-.3 0-.6-.2-.9l3.8-3.8c.3.1.6.2.9.2 1.4 0 2.5-1.1 2.5-2.5s-1.1-2.5-2.5-2.5z"/>%3C/svg>')}.mapbox-gl-draw_trash{background-image:url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M10,3.4 c-0.8,0-1.5,0.5-1.8,1.2H5l-1,1v1h12v-1l-1-1h-3.2C11.5,3.9,10.8,3.4,10,3.4z M5,8v7c0,1,1,2,2,2h6c1,0,2-1,2-2V8h-2v5.5
1h-1.5V8h-3 v5.5H7V8H5z"/>%3C/svg>')}.mapbox-gl-draw_uncombine{background-image:url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="m12 2c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm4 4c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l1 1c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-1-1c-.2-.2-.4-.3-.7-.3zm-7 1c-1 0-1 1-.5 1.5.3.3 1 1 1 1l-1 1s-.5.5 0 1 1 0 1 0l1-1 1 1c.5.5 1.5.5 1.5-.5v-4zm-5 3c-.3 0-.5.1-.7.3l-1 1c-.4.4-.4 1 0 1.4l4.9 4.9c.4.4 1 .4 1.4 0l1-1c.4-.4.4-1 0-1.4l-4.9-4.9c-.1-.2-.4-.3-.7-.3z"/>%3C/svg>')}.mapbox-gl-draw_combine{background-image:url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="20" height="20">%3Cpath d="M12.1,2c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l4.9,4.9c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-4.9-4.9C12.6,2.1,12.3,2,12.1,2z M8,8C7,8,7,9,7.5,9.5c0.3,0.3,1,1,1,1l-1,1c0,0-0.5,0.5,0,1s1,0,1,0l1-1l1,1 C11,13,12,13,12,12V8H8z M4,10c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1c0.4-0.4,0.4-1,0-1.4 l-1-1C4.5,10.1,4.3,10,4,10z M8,14c-0.3,0-0.5,0.1-0.7,0.3l-1,1c-0.4,0.4-0.4,1,0,1.4l1,1c0.4,0.4,1,0.4,1.4,0l1-1 c0.4-0.4,0.4-1,0-1.4l-1-1C8.5,14.1,8.3,14,8,14z"/>%3C/svg>')}.mapboxgl-map.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive{cursor:pointer}.mapboxgl-map.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive{cursor:move}.mapboxgl-map.mouse-add .mapboxgl-canvas-container.mapboxgl-interactive{cursor:crosshair}.mapboxgl-map.mouse-move.mode-direct_select .mapboxgl-canvas-container.mapboxgl-interactive{cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.mapboxgl-map.mode-direct_select.feature-vertex.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive{cursor:move}.mapboxgl-map.mode-direct_select.feature-midpoint.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive{cursor:cell}.mapboxgl-map.mode-direct_select.feature-feature.mouse-move .mapboxgl-canvas-container.mapboxgl-interactive{cursor:move}.mapboxgl-map.mode-static.mouse-pointer .mapboxgl-canvas-container.mapboxgl-interactive{cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.mapbox-gl-draw_boxselect{pointer-events:none;position:absolute;top:0;left:0;width:0;height:0;background:#0000001a;border:2px dotted #fff;opacity:.5}.mapboxgl-canvas-container.mapboxgl-interactive{cursor:default}.mode-parcel_select .mapboxgl-canvas{cursor:pointer}/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:Poppins Custom, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-600:oklch(57.7% .245 27.325);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-700:oklch(48.8% .243 264.376);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-lg:64rem;--container-lg:32rem;
1--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-tight:1.25;--radius-sm:.25rem;--radius-lg:.5rem;--drop-shadow-2xl:0 25px 25px #00000026;--ease-out:cubic-bezier(0, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}
1button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-gray-200,currentcolor)}::file-selector-button{border-color:var(--color-gray-200,currentcolor)}:root{--page-has-backdrop:var(--page-scroll-lock) 1;--page-scroll-bg:var(--page-scroll-lock) var(--root-bg,#0000)}@supports (color:color-mix(in lab,red,red)){:root{--page-scroll-bg:var(--page-scroll-lock) color-mix(in srgb, var(--root-bg,#0000), oklch(0% 0 0) calc(var(--page-has-backdrop,0) * 40%))}}:root{background-image:var(--page-scroll-lock) linear-gradient(var(--root-bg,#0000),var(--root-bg,#0000));transition:var(--page-scroll-lock) background-color .3s ease-out;animation:var(--page-scroll-lock) set-page-has-scroll forwards;animation-timeline:var(--page-scroll-lock) scroll();--page-has-scroll:initial;scrollbar-gutter:var(--page-has-scroll) var(--page-scroll-lock) stable}@keyframes set-page-has-scroll{0%,to{--page-has-scroll: }}:root{--fx-noise:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.34' numOctaves='4' stitchTiles='stitch'%3E%3C/feTurbulence%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23a)' opacity='0.2'%3E%3C/rect%3E%3C/svg%3E")}:root,[data-theme]{background-color:var(--root-bg);color:var(--color-base-content)}:root{background-color:var(--page-scroll-bg,var(--root-bg))}:where(:root,[data-theme]){--root-bg:var(--color-base-100)}:root{--page-scroll-lock:initial;--page-overflow:var(--page-scroll-lock) hidden}:root:not(span){overflow:var(--page-overflow)}:root{scrollbar-color:currentColor #0000}@supports (color:color-mix(in lab,red,red)){:root{scrollbar-color:color-mix(in oklch,currentColor 35%,#0000) #0000}}@property --radialprogress{syntax:"<percentage>";inherits:true;initial-value:0%}@property --aura-angle{syntax:"<angle>";inherits:false;initial-value:0deg}:where(:root),:root:has(input.theme-controller[value=mytheme]:checked),[data-theme=mytheme]{color-scheme:light;--color-primary:#95c11f;--color-primary-content:white;--color-secondary:#0d3a32;--color-secondary-content:white;--color-accent:#ffce00;--color-accent-content:#0d3a32;--color-neutral:#0d3a32;--color-neutral-content:white;--color-base-100:white;--color-base-200:#fbfaf2;--color-base-300:#f2edd2;--color-base-content:#0d3a32;--color-info:#0095ff;--color-info-content:white;--color-success:#95c11f;--color-success-content:white;--color-warning:#ffce00;--color-warning-content:#0d3a32;--color-error:#c11435;--color-error-content:white;--radius-field:0;--border:1px;--depth:1;--size-field:.25rem;--size-selector:.25rem}}@layer components;@layer utilities{@layer daisyui.l1.l2.l3{:where(.btn){width:unset}.btn{--size:calc(var(--size-field,.25rem) * 10);--btn-p:1rem;--btn-fg:var(--color-base-content);cursor:pointer;text-align:center;vertical-align:middle;outline-offset:2px;webkit-user-select:none;-webkit-user-select:none;user-select:none;border-width:var(--border);touch-action:manipulation;--btn-bg:var(--btn-color,var(--color-base-200));--btn-border:var(--btn-color,var(--color-base-200));border-start-start-radius:var(--join-ss,var(--radius-field));border-start-end-radius:var(--join-se,var(--radius-field));border-end-end-radius:var(--join-ee,var(--radius-field));border-end-start-radius:var(--join-es,var(--radius-field));flex-wrap:nowrap;flex-shrink:0;justify-content:center;align-items:center;gap:.375rem;font-weight:600;transition-property:color,background-color,border-color,box-shadow,transform;transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);display:inline-flex}@supports (color:color-mix(in lab,red,red)){.btn{--btn-border:color-mix(in oklab, var(--btn-color,var(--color-base-200)), #000 calc(var(--depth) * 5%))}}.btn{--btn-soft-bg:initial;--btn-shadow:0 3px 2px -2px var(--btn-bg), 0 4px 3px -2px var(--btn-bg)}@supports (color:color-mix(in lab,red,red)){.btn{--btn-shadow:0 3px 2px -2px color-mix(in oklab, var(--btn-bg) calc(var(--depth) * 30%), #0000), 0 4px 3px -2px color-mix(in oklab, var(--btn-bg) calc(var(--depth) * 30%), #0000)}}
1.btn{--btn-inset:0 .5px 0 .5px oklch(100% 0 0 / calc(var(--depth) * 6%));height:var(--size);padding-inline:var(--btn-p);font-size:var(--fontsize,.875rem);background-color:var(--btn-bg);color:var(--btn-fg);border-color:var(--btn-border);border-style:var(--btn-border-style,solid);outline-color:var(--btn-color,var(--color-base-content));--tw-prose-links:var(--btn-fg);background-image:none,var(--fx-noise);background-size:auto,calc(var(--noise,0) * 100%);text-shadow:0 .5px oklch(100% 0 0 / calc(var(--depth) * .15));box-shadow:var(--btn-inset) inset,var(--btn-shadow)}.btn:is([type=checkbox],[type=radio]){-webkit-appearance:none;-moz-appearance:none;appearance:none}.btn:is([type=checkbox],[type=radio])[aria-label]:after{--tw-content:attr(aria-label);content:var(--tw-content)}.btn:where(:checked:not(.filter [type=radio].btn)){--btn-color:var(--color-primary);--btn-fg:var(--color-primary-content)}.loading{pointer-events:none;aspect-ratio:1;vertical-align:middle;width:calc(var(--size-selector,.25rem) * 6);background-color:currentColor;display:inline-block;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='8s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='8s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:100%;mask-size:100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}@media (prefers-reduced-motion:no-preference){.loading{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='2s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='2s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E")}}.toggle{border:var(--border) solid currentColor;color:var(--input-color);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;vertical-align:middle;webkit-user-select:none;-webkit-user-select:none;user-select:none;--radius-selector-max:calc(var(--radius-selector) + var(--radius-selector) + var(--radius-selector));border-radius:calc(var(--radius-selector) + min(var(--toggle-p),var(--radius-selector-max)) + min(var(--border),var(--radius-selector-max)));padding:var(--toggle-p);flex-shrink:0;grid-template-columns:0fr 1fr 1fr;place-content:center;display:inline-grid;position:relative;box-shadow:inset 0 1px}@supports (color:color-mix(in lab,red,red)){.toggle{box-shadow:0 1px color-mix(in oklab,currentColor calc(var(--depth) * 10%),#0000) inset}}.toggle{--input-color:var(--color-base-content);transition:color .3s,grid-template-columns .2s}@supports (color:color-mix(in lab,red,red)){.toggle{--input-color:color-mix(in oklab, var(--color-base-content) 50%, #0000)}}.toggle{--toggle-p:calc(var(--size) * .125);--size:calc(var(--size-selector,.25rem) * 6);width:calc((var(--size) * 2) - (var(--border) + var(--toggle-p)) * 2);height:var(--size)}.toggle>*{z-index:1;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#0000;border:none;grid-column:2/span 1;grid-row-start:1;height:100%;padding:.125rem;transition:opacity .2s,rotate .4s}.toggle>:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.toggle>:focus{outline-offset:2px;outline:2px solid #0000}}.toggle>:nth-child(2){color:var(--color-base-100);rotate:0deg}.toggle>:nth-child(3){color:var(--color-base-100);opacity:0;rotate:-15deg}.toggle:has(:checked)>:nth-child(2){opacity:0;rotate:15deg}.toggle:has(:checked)>:nth-child(3){opacity:1;rotate:0deg}.toggle:before{aspect-ratio:1;border-radius:var(--radius-selector);--tw-content:"";content:var(--tw-content);width:100%;height:100%;box-shadow:0 -1px oklch(0% 0 0 / calc(var(--depth) * .1)) inset,0 8px 0 -4px oklch(100% 0 0 / calc(var(--depth) * .1)) inset,0 1px currentColor;background-color:currentColor;grid-row-start:1;grid-column-start:2;transition:background-color .1s,translate .2s,inset-inline-start .2s;position:relative;inset-inline-start:0;translate:0}@supports (color:color-mix(in lab,red,red)){.toggle:before{box-shadow:0 -1px oklch(0% 0 0 / calc(var(--depth) * .1)) inset,0 8px 0 -4px oklch(100% 0 0 / calc(var(--depth) * .1)) inset,0 1px color-mix(in oklab,currentColor calc(var(--depth) * 10%),#0000)}}.toggle:before{background-size:auto,calc(var(--noise) * 100%);background-image:none,var(--fx-noise)}@media (forced-colors:active){.toggle:before{outline-style:var(--tw-outline-style);outline-offset:-1px;outline-width:1px}}@media print{.toggle:before{outline-offset:-1rem;outline:.25rem solid}}.toggle:focus-visible,.toggle:has(:focus-visible){outline-offset:2px;outline:2px solid}.toggle:checked{background-color:var(--color-base-100);--input-color:var(--color-base-content);grid-template-columns:1fr 1fr 0fr}.toggle:checked:before{background-color:currentColor}@starting-style{.toggle:checked:before{opacity:0}
1}.toggle[aria-checked=true]{background-color:var(--color-base-100);--input-color:var(--color-base-content);grid-template-columns:1fr 1fr 0fr}.toggle[aria-checked=true]:before{background-color:currentColor}@starting-style{.toggle[aria-checked=true]:before{opacity:0}}.toggle:has(>input:checked){background-color:var(--color-base-100);--input-color:var(--color-base-content);grid-template-columns:1fr 1fr 0fr}.toggle:has(>input:checked):before{background-color:currentColor}@starting-style{.toggle:has(>input:checked):before{opacity:0}}.toggle:indeterminate{grid-template-columns:.5fr 1fr .5fr}.toggle:disabled{cursor:not-allowed;opacity:.3}.toggle:disabled:before{border:var(--border) solid currentColor;background-color:#0000}.input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--color-base-100);vertical-align:middle;white-space:nowrap;--size:calc(var(--size-field,.25rem) * var(--in-size-mul,10));--input-color:var(--color-base-content);flex-shrink:1;align-items:center;gap:.5rem;padding-inline:.75rem;display:inline-flex;position:relative}@supports (color:color-mix(in lab,red,red)){.input{--input-color:color-mix(in oklab, var(--color-base-content) 20%, #0000)}}.input{cursor:text;width:clamp(3rem,20rem,100%);height:var(--size);font-size:max(var(--font-size,0rem),var(--font-size-min,.875rem));touch-action:manipulation;border:var(--border) solid var(--input-color,#0000);box-shadow:0 1px var(--input-color) inset,0 -1px oklch(100% 0 0 / calc(var(--depth) * .1)) inset;border-start-start-radius:var(--join-ss,var(--radius-field));border-start-end-radius:var(--join-se,var(--radius-field));border-end-end-radius:var(--join-ee,var(--radius-field));border-end-start-radius:var(--join-es,var(--radius-field))}@supports (color:color-mix(in lab,red,red)){.input{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000) inset,0 -1px oklch(100% 0 0 / calc(var(--depth) * .1)) inset}}.input input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#0000;border:none;width:100%;height:100%}.input input::placeholder{color:var(--color-base-content);opacity:.5}.input input:focus,.input input:focus-within{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.input input:focus,.input input:focus-within{outline-offset:2px;outline:2px solid #0000}}.input input::-webkit-calendar-picker-indicator{inset-inline-end:-.15em}.input::-webkit-inner-spin-button{margin-inline-end:-10px}.input::-webkit-calendar-picker-indicator{inset-inline-end:.75em}input.input{text-align:start;display:inline-flex;position:relative}input.input[type=url],input.input[type=tel],input.input[type=email],input.input[type=number]{direction:ltr}input.input::-webkit-datetime-edit{min-height:100%;text-align:inherit;align-items:center;display:grid}input.input::-webkit-date-and-time-value{min-height:100%;text-align:inherit;align-items:center;display:grid}input.input::-webkit-inner-spin-button{margin-block:calc(.25rem * var(--spin-my,-3))}input.input::-webkit-calendar-picker-indicator{cursor:pointer;width:1em;height:1em;position:absolute}input.input::-webkit-color-swatch-wrapper{padding-block:.25rem}.input input{text-align:start;display:inline-flex;position:relative}.input input[type=url],.input input[type=tel],.input input[type=email],.input input[type=number]{direction:ltr}.input input::-webkit-datetime-edit{min-height:100%;text-align:inherit;align-items:center;display:grid}.input input::-webkit-date-and-time-value{min-height:100%;text-align:inherit;align-items:center;display:grid}.input input::-webkit-inner-spin-button{margin-block:calc(.25rem * var(--spin-my,-3))}.input input::-webkit-calendar-picker-indicator{cursor:pointer;width:1em;height:1em;position:absolute}.input input::-webkit-color-swatch-wrapper{padding-block:.25rem}.input:focus{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.input:focus{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.input:focus{outline:2px solid var(--input-color);outline-offset:2px}@media (pointer:coarse){@supports (-webkit-touch-callout:none){.input:focus{--font-size:1rem}}}
1.input:focus-within{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.input:focus-within{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.input:focus-within{outline:2px solid var(--input-color);outline-offset:2px}@media (pointer:coarse){@supports (-webkit-touch-callout:none){.input:focus-within{--font-size:1rem}}}.input:has(>input[disabled]){cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200)}.input:has(>input[disabled]):is(input),.input:has(>input[disabled]) :is(input){color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.input:has(>input[disabled]):is(input),.input:has(>input[disabled]) :is(input){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}.input:has(>input[disabled]){box-shadow:none}.input:has(>input[disabled])::placeholder,.input:has(>input[disabled]) ::placeholder{color:var(--color-base-content);opacity:.2}.input:is(:disabled,[disabled]){cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200)}.input:is(:disabled,[disabled]):is(input),.input:is(:disabled,[disabled]) :is(input){color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.input:is(:disabled,[disabled]):is(input),.input:is(:disabled,[disabled]) :is(input){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}.input:is(:disabled,[disabled]){box-shadow:none}.input:is(:disabled,[disabled])::placeholder,.input:is(:disabled,[disabled]) ::placeholder{color:var(--color-base-content);opacity:.2}fieldset:disabled .input{cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200)}fieldset:disabled .input:is(input),fieldset:disabled .input :is(input){color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){fieldset:disabled .input:is(input),fieldset:disabled .input :is(input){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}fieldset:disabled .input{box-shadow:none}fieldset:disabled .input::placeholder,fieldset:disabled .input ::placeholder{color:var(--color-base-content);opacity:.2}.input:has(>input[disabled])>input[disabled]{cursor:not-allowed}.table{border-collapse:separate;--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;width:100%;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-radius:var(--radius-box);text-align:left;font-size:.875rem;position:relative}.table:where(:dir(rtl),[dir=rtl],[dir=rtl] *){text-align:right}@media (hover:hover){:is(:is(.table tr.row-hover),.table tr.row-hover:nth-child(2n)):hover{background-color:var(--color-base-200)}}.table :where(th,td){vertical-align:middle;padding-block:.75rem;padding-inline:1rem}.table :where(thead,tfoot){white-space:nowrap;color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.table :where(thead,tfoot){color:color-mix(in oklab,var(--color-base-content) 60%,transparent)}}.table :where(thead,tfoot){font-size:.875rem;font-weight:600}.table :where(tfoot tr:first-child :is(td,th)){border-top:var(--border) solid var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.table :where(tfoot tr:first-child :is(td,th)){border-top:var(--border) solid color-mix(in oklch,var(--color-base-content) 5%,#0000)}}.table :where(.table-pin-rows thead){z-index:1;position:sticky;top:0}.table :where(.table-pin-rows tfoot){z-index:1;position:sticky;bottom:0}.table :where(.table-pin-rows :is(thead,tfoot) tr){background-color:var(--color-base-100)}.table :where(.table-pin-cols tr th){background-color:var(--color-base-100);position:sticky;left:0;right:0}.table :where(thead tr :is(td,th),tbody tr:not(:last-child) :is(td,th)){border-bottom:var(--border) solid var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.table :where(thead tr :is(td,th),tbody tr:not(:last-child) :is(td,th)){border-bottom:var(--border) solid color-mix(in oklch,var(--color-base-content) 5%,#0000)}}.steps{counter-reset:step;grid-auto-columns:1fr;grid-auto-flow:column;display:inline-grid;overflow:auto hidden}.steps .step{text-align:center;--step-bg:var(--color-base-300);--step-fg:var(--color-base-content);grid-template-rows:40px 1fr;grid-template-columns:auto;place-items:center;min-width:4rem;display:grid}.steps .step:before{width:100%;height:.5rem;color:var(--step-bg);background-color:var(--step-bg);content:"";border:1px solid;grid-row-start:1;grid-column-start:1;margin-inline-start:-100%;top:0}.steps .step>.step-icon,.steps .step:not(:has(.step-icon)):after{--tw-content:counter(step);content:var(--tw-content);counter-increment:step;z-index:1;color:var(--step-fg);background-color:var(--step-bg);border:1px solid var(--step-bg);border-radius:3.40282e38px;grid-row-start:1;grid-column-start:1;place-self:center;place-items:center;width:2rem;height:2rem;display:grid;position:relative}.steps .step:first-child:before{--tw-content:none;content:var(--tw-content)}.steps .step[data-content]:after{--tw-content:attr(data-content);content:var(--tw-content)}.select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--color-base-100);vertical-align:middle;--size:calc(var(--size-field,.25rem) * var(--sl-size-mul,10));--input-color:var(--color-base-content);flex-shrink:1;align-items:center;gap:.375rem;padding-inline:.75rem 1.75rem;display:inline-flex;position:relative}@supports (color:color-mix(in lab,red,red)){.select{--input-color:color-mix(in oklab, var(--color-base-content) 20%, #0000)}}.select{width:clamp(3rem,20rem,100%);height:var(--size);font-size:max(var(--font-size,0rem),var(--font-size-min,.875rem));touch-action:manipulation;white-space:nowrap;text-overflow:ellipsis;border:var(--border) solid var(--input-color,#0000);box-shadow:0 1px var(--input-color) inset,0 -1px oklch(100% 0 0 / calc(var(--depth) * .1)) inset;background-image:linear-gradient(45deg,#0000 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,#0000 50%);background-position:calc(100% - 20px) calc(1px + 50%),calc(100% - 16.1px) calc(1px + 50%);background-repeat:no-repeat;background-size:4px 4px,4px 4px;border-start-start-radius:var(--join-ss,var(--radius-field));border-start-end-radius:var(--join-se,var(--radius-field));border-end-end-radius:var(--join-ee,var(--radius-field));border-end-start-radius:var(--join-es,var(--radius-field));overflow:hidden}@supports (color:color-mix(in lab,red,red)){.select{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000) inset,0 -1px oklch(100% 0 0 / calc(var(--depth) * .1)) inset}}[dir=rtl] .select{background-position:12px calc(1px + 50%),16px calc(1px + 50%)}.select[multiple]{background-image:none;height:auto;padding-block:.75rem;padding-inline-end:.75rem;overflow:auto}.select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:calc(100% + 2.75rem);height:calc(100% - calc(var(--border) * 2));background:inherit;border-radius:inherit;border-style:none;align-items:center;margin-inline:-.75rem -1.75rem;padding-inline:.75rem 1.75rem}.select select::placeholder{color:var(--color-base-content);opacity:.5}.select select:focus,.select select:focus-within{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.select select:focus,.select select:focus-within{outline-offset:2px;outline:2px solid #0000}}.select select:not(:last-child){background-image:none;margin-inline-end:-1.375rem}.select:focus{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.select:focus{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.select:focus{outline:2px solid var(--input-color);outline-offset:2px}.select:focus-within{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.select:focus-within{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.select:focus-within{outline:2px solid var(--input-color);outline-offset:2px}.select:open{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.select:open{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.select:open{outline:2px solid var(--input-color);outline-offset:2px;background-image:linear-gradient(135deg,#0000 50%,currentColor 50%),linear-gradient(45deg,currentColor 50%,#0000 50%)}.select:has(>select[disabled]){cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200)}.select:has(>select[disabled]):is(select),.select:has(>select[disabled]) :is(select){color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.select:has(>select[disabled]):is(select),.select:has(>select[disabled]) :is(select){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}.select:has(>select[disabled]){box-shadow:none}.select:has(>select[disabled])::placeholder,.select:has(>select[disabled]) ::placeholder{color:var(--color-base-content);opacity:.2}.select:is(:disabled,[disabled]){cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200)}.select:is(:disabled,[disabled]):is(select),.select:is(:disabled,[disabled]) :is(select){color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.select:is(:disabled,[disabled]):is(select),.select:is(:disabled,[disabled]) :is(select){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}.select:is(:disabled,[disabled]){box-shadow:none}.select:is(:disabled,[disabled])::placeholder,.select:is(:disabled,[disabled]) ::placeholder{color:var(--color-base-content);opacity:.2}
1fieldset:disabled .select{cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200)}fieldset:disabled .select:is(select),fieldset:disabled .select :is(select){color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){fieldset:disabled .select:is(select),fieldset:disabled .select :is(select){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}fieldset:disabled .select{box-shadow:none}fieldset:disabled .select::placeholder,fieldset:disabled .select ::placeholder{color:var(--color-base-content);opacity:.2}.select:has(>select[disabled])>select[disabled]{cursor:not-allowed}@supports (appearance:base-select){:is(.select,.select select){-webkit-appearance:base-select;-moz-appearance:base-select;appearance:base-select}:is(.select,.select select)::picker(select){-webkit-appearance:base-select;-moz-appearance:base-select;appearance:base-select}}:is(.select,.select select)::picker(select){color:inherit;border:var(--border) solid var(--color-base-200);border-radius:var(--radius-box);background-color:inherit;max-height:min(24rem,70dvh);box-shadow:0 2px calc(var(--depth) * 3px) -2px #0003;box-shadow:0 20px 25px -5px rgb(0 0 0/calc(var(--depth) * .1)),0 8px 10px -6px rgb(0 0 0/calc(var(--depth) * .1));margin-block:.5rem;margin-inline:.5rem;padding:.5rem;translate:-.5rem}:is(.select,.select select)::picker-icon{display:none}:is(.select,.select select) selectedcontent{text-overflow:ellipsis;white-space:nowrap;width:100%;overflow:hidden}:is(.select,.select select) optgroup{padding-top:.5em}:is(.select,.select select) optgroup option:first-child{margin-top:.5em}:is(.select,.select select) option{border-radius:var(--radius-field);padding-block:.375rem;padding-inline:calc(.25rem * var(--option-px,3));white-space:normal;transition-property:color,background-color;transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1)}:is(.select,.select select) option:not(:disabled):hover,:is(.select,.select select) option:not(:disabled):focus-visible{cursor:pointer;background-color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){:is(.select,.select select) option:not(:disabled):hover,:is(.select,.select select) option:not(:disabled):focus-visible{background-color:color-mix(in oklab,var(--color-base-content) 10%,transparent)}}:is(.select,.select select) option:not(:disabled):hover,:is(.select,.select select) option:not(:disabled):focus-visible{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){:is(.select,.select select) option:not(:disabled):hover,:is(.select,.select select) option:not(:disabled):focus-visible{outline-offset:2px;outline:2px solid #0000}}:is(.select,.select select) option:not(:disabled):active{background-color:var(--color-neutral);color:var(--color-neutral-content);box-shadow:0 2px calc(var(--depth) * 3px) -2px var(--color-neutral)}[dir=rtl] .select::picker(select){translate:.5rem}[dir=rtl] .select select::picker(select){translate:.5rem}.checkbox{border:var(--border) solid var(--input-color,var(--color-base-content))}@supports (color:color-mix(in lab,red,red)){.checkbox{border:var(--border) solid var(--input-color,color-mix(in oklab, var(--color-base-content) 20%, #0000))}}.checkbox{cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:var(--radius-selector);vertical-align:middle;color:var(--color-base-content);box-shadow:0 1px oklch(0% 0 0 / calc(var(--depth) * .1)) inset,0 0 #0000 inset,0 0 #0000;--size:calc(var(--size-selector,.25rem) * 6);width:var(--size);height:var(--size);background-size:auto,calc(var(--noise) * 100%);background-image:none,var(--fx-noise);flex-shrink:0;padding:.25rem;transition:background-color .2s,box-shadow .2s;display:inline-block;position:relative}.checkbox:before{--tw-content:"";content:var(--tw-content);opacity:0;clip-path:polygon(20% 100%,20% 80%,50% 80%,50% 80%,70% 80%,70% 100%);width:100%;height:100%;box-shadow:0 3px oklch(100% 0 0 / calc(var(--depth) * .1)) inset;background-color:currentColor;font-size:1rem;line-height:.75;transition:clip-path .3s .1s,opacity .1s .1s,rotate .3s .1s,translate .3s .1s;display:block;rotate:45deg}.checkbox:focus-visible{outline:2px solid var(--input-color,currentColor);outline-offset:2px}.checkbox:checked{background-color:var(--input-color,#0000);box-shadow:0 0 #0000 inset,0 8px 0 -4px oklch(100% 0 0 / calc(var(--depth) * .1)) inset,0 1px oklch(0% 0 0 / calc(var(--depth) * .1))}.checkbox:checked:before{clip-path:polygon(20% 100%,20% 80%,50% 80%,50% 0%,70% 0%,70% 100%);opacity:1}@media (forced-colors:active){.checkbox:checked:before{--tw-content:"✔︎";clip-path:none;background-color:#0000;rotate:0deg}}@media print{.checkbox:checked:before{--tw-content:"✔︎";clip-path:none;background-color:#0000;rotate:0deg}}.checkbox[aria-checked=true]{background-color:var(--input-color,#0000);box-shadow:0 0 #0000 inset,0 8px 0 -4px oklch(100% 0 0 / calc(var(--depth) * .1)) inset,0 1px oklch(0% 0 0 / calc(var(--depth) * .1))}.checkbox[aria-checked=true]:before{clip-path:polygon(20% 100%,20% 80%,50% 80%,50% 0%,70% 0%,70% 100%);opacity:1}@media (forced-colors:active){.checkbox[aria-checked=true]:before{--tw-content:"✔︎";clip-path:none;background-color:#0000;rotate:0deg}}@media print{.checkbox[aria-checked=true]:before{--tw-content:"✔︎";clip-path:none;background-color:#0000;rotate:0deg}}.checkbox:indeterminate{background-color:var(--input-color,var(--color-base-content))}@supports (color:color-mix(in lab,red,red)){.checkbox:indeterminate{background-color:var(--input-color,color-mix(in oklab, var(--color-base-content) 20%, #0000))}}.checkbox:indeterminate:before{opacity:1;clip-path:polygon(20% 100%,20% 80%,50% 80%,50% 80%,80% 80%,80% 100%);translate:0 -35%;rotate:0deg}.checkbox[aria-checked=mixed]{background-color:var(--input-color,var(--color-base-content))}@supports (color:color-mix(in lab,red,red)){.checkbox[aria-checked=mixed]{background-color:var(--input-color,color-mix(in oklab, var(--color-base-content) 20%, #0000))}}.checkbox[aria-checked=mixed]:before{opacity:1;clip-path:polygon(20% 100%,20% 80%,50% 80%,50% 80%,80% 80%,80% 100%);translate:0 -35%;rotate:0deg}.radio{cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;vertical-align:middle;border:var(--border) solid var(--input-color,currentColor);border-radius:3.40282e38px;flex-shrink:0;padding:.25rem;display:inline-block;position:relative}@supports (color:color-mix(in lab,red,red)){.radio{border:var(--border) solid var(--input-color,color-mix(in srgb, currentColor 20%, #0000))}}.radio{box-shadow:0 1px oklch(0% 0 0 / calc(var(--depth) * .1)) inset;--size:calc(var(--size-selector,.25rem) * 6);width:var(--size);height:var(--size);color:var(--input-color,currentColor)}.radio:before{--tw-content:"";content:var(--tw-content);background-size:auto,calc(var(--noise) * 100%);background-image:none,var(--fx-noise);border-radius:3.40282e38px;width:100%;height:100%;display:block}.radio:focus-visible{outline:2px solid}.radio:checked{background-color:var(--color-base-100);border-color:currentColor}@media (prefers-reduced-motion:no-preference){.radio:checked{animation:.2s ease-out radio}}.radio:checked:before{box-shadow:0 -1px oklch(0% 0 0 / calc(var(--depth) * .1)) inset,0 8px 0 -4px oklch(100% 0 0 / calc(var(--depth) * .1)) inset,0 1px oklch(0% 0 0 / calc(var(--depth) * .1));background-color:currentColor}@media (forced-colors:active){.radio:checked:before{outline-style:var(--tw-outline-style);outline-offset:-1px;outline-width:1px}}@media print{.radio:checked:before{outline-offset:-1rem;outline:.25rem solid}}.radio[aria-checked=true]{background-color:var(--color-base-100);border-color:currentColor}@media (prefers-reduced-motion:no-preference){.radio[aria-checked=true]{animation:.2s ease-out radio}}.radio[aria-checked=true]:before{box-shadow:0 -1px oklch(0% 0 0 / calc(var(--depth) * .1)) inset,0 8px 0 -4px oklch(100% 0 0 / calc(var(--depth) * .1)) inset,0 1px oklch(0% 0 0 / calc(var(--depth) * .1));background-color:currentColor}@media (forced-colors:active){.radio[aria-checked=true]:before{outline-style:var(--tw-outline-style);outline-offset:-1px;outline-width:1px}}@media print{.radio[aria-checked=true]:before{outline-offset:-1rem;outline:.25rem solid}}.card{border-radius:var(--radius-box);outline-offset:2px;outline:2px solid #0000;flex-direction:column;transition:outline .2s ease-in-out;display:flex;position:relative}.card:focus-visible,.card[aria-checked=true],.card:has(>:checked,>
1:is([type=checkbox],[type=radio]):focus-visible){outline-color:currentColor}.card:has(>:checked:focus-visible),.card[aria-checked=true]:focus-visible,.card[aria-checked=true]:has(>:is([type=checkbox],[type=radio]):focus-visible){outline-width:4px}.card:has(>:is([type=checkbox],[type=radio])){cursor:pointer;-webkit-user-select:none;user-select:none}.card>:is([type=checkbox],[type=radio]){-webkit-appearance:none;-moz-appearance:none;appearance:none}.hero-content{isolation:isolate;justify-content:center;align-items:center;gap:1rem;max-width:80rem;padding:1rem;display:flex}.textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:var(--radius-field);background-color:var(--color-base-100);vertical-align:middle;--input-color:var(--color-base-content);flex-shrink:1;min-height:5rem;padding-block:.5rem;padding-inline:.75rem}@supports (color:color-mix(in lab,red,red)){.textarea{--input-color:color-mix(in oklab, var(--color-base-content) 20%, #0000)}}.textarea{width:clamp(3rem,20rem,100%);font-size:max(var(--font-size,0rem),var(--font-size-min,.875rem));touch-action:manipulation;border:var(--border) solid var(--input-color,#0000);box-shadow:0 1px var(--input-color) inset,0 -1px oklch(100% 0 0 / calc(var(--depth) * .1)) inset}@supports (color:color-mix(in lab,red,red)){.textarea{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000) inset,0 -1px oklch(100% 0 0 / calc(var(--depth) * .1)) inset}}.textarea textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#0000;border:none}.textarea textarea::placeholder{color:var(--color-base-content);opacity:.5}.textarea textarea:focus,.textarea textarea:focus-within{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.textarea textarea:focus,.textarea textarea:focus-within{outline-offset:2px;outline:2px solid #0000}}.textarea:focus{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.textarea:focus{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.textarea:focus{outline:2px solid var(--input-color);outline-offset:2px;isolation:isolate}@media (pointer:coarse){@supports (-webkit-touch-callout:none){.textarea:focus{--font-size:1rem}}}.textarea:focus-within{--input-color:var(--color-base-content);box-shadow:0 1px var(--input-color)}@supports (color:color-mix(in lab,red,red)){.textarea:focus-within{box-shadow:0 1px color-mix(in oklab,var(--input-color) calc(var(--depth) * 10%),#0000)}}.textarea:focus-within{outline:2px solid var(--input-color);outline-offset:2px;isolation:isolate}@media (pointer:coarse){@supports (-webkit-touch-callout:none){.textarea:focus-within{--font-size:1rem}}}.textarea:has(>textarea[disabled]){cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200);color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.textarea:has(>textarea[disabled]){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}.textarea:has(>textarea[disabled]){box-shadow:none}.textarea:has(>textarea[disabled])::placeholder,.textarea:has(>textarea[disabled]) ::placeholder{color:var(--color-base-content);opacity:.2}.textarea:is(:disabled,[disabled]){cursor:not-allowed;border-color:var(--color-base-200);background-color:var(--color-base-200);color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.textarea:is(:disabled,[disabled]){color:color-mix(in oklab,var(--color-base-content) 40%,transparent)}}.textarea:is(:disabled,[disabled]){box-shadow:none}.textarea:is(:disabled,[disabled])::placeholder,.textarea:is(:disabled,[disabled]) ::placeholder{color:var(--color-base-content);opacity:.2}.textarea:has(>textarea[disabled])>textarea[disabled]{cursor:not-allowed}.hero{background-position:50%;background-size:cover;place-items:center;width:100%;display:grid}.hero>*{grid-row-start:1;grid-column-start:1}.label{white-space:nowrap;color:currentColor;align-items:center;gap:.375rem;display:inline-flex}@supports (color:color-mix(in lab,red,red)){.label{color:color-mix(in oklab,currentcolor 60%,transparent)}}
1.label:has(input){cursor:pointer}.label:is(.input>*,.select>*){white-space:nowrap;height:calc(100% - .5rem);font-size:inherit;align-items:center;padding-inline:.75rem;display:flex}.label:is(.input>*,.select>*):first-child{border-inline-end:var(--border) solid currentColor;margin-inline:-.75rem .75rem}@supports (color:color-mix(in lab,red,red)){.label:is(.input>*,.select>*):first-child{border-inline-end:var(--border) solid color-mix(in oklab,currentColor 10%,#0000)}}.label:is(.input>*,.select>*):last-child{border-inline-start:var(--border) solid currentColor;margin-inline:.75rem -.75rem}@supports (color:color-mix(in lab,red,red)){.label:is(.input>*,.select>*):last-child{border-inline-start:var(--border) solid color-mix(in oklab,currentColor 10%,#0000)}}.status{aspect-ratio:1;border-radius:var(--radius-selector);background-color:var(--color-base-content);width:.5rem;height:.5rem;display:inline-block}@supports (color:color-mix(in lab,red,red)){.status{background-color:color-mix(in oklab,var(--color-base-content) 20%,transparent)}}.status{vertical-align:middle;color:#0000004d;background-position:50%;background-repeat:no-repeat}@supports (color:color-mix(in lab,red,red)){.status{color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.status{background-image:radial-gradient(circle at 35% 30%,oklch(1 0 0 / calc(var(--depth) * .5)),#0000);box-shadow:0 2px 3px -1px}@supports (color:color-mix(in lab,red,red)){.status{box-shadow:0 2px 3px -1px color-mix(in oklab,currentColor calc(var(--depth) * 100%),#0000)}}.link{cursor:pointer;text-decoration-line:underline}.link:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.link:focus{outline-offset:2px;outline:2px solid #0000}}.link:focus-visible{outline-offset:2px;outline:2px solid}.aura:has(>.card,>.alert){--aura-radius:var(--radius-box)}.aura:has(>.btn,>.input,>.select){--aura-radius:var(--radius-field)}.aura:has(>.checkbox,>.toggle,>.badge){--aura-radius:var(--radius-selector)}.alert{--alert-border-color:var(--color-base-200);border-radius:var(--radius-box);color:var(--color-base-content);background-color:var(--alert-color,var(--color-base-200));text-align:start;background-size:auto,calc(var(--noise) * 33%);background-image:none,var(--fx-noise);box-shadow:0 3px 0 -2px oklch(100% 0 0 / calc(var(--depth) * .08)) inset,0 1px #000,0 4px 3px -2px oklch(0% 0 0 / calc(var(--depth) * .08));border-style:solid;grid-template-columns:auto;grid-auto-flow:column;justify-content:start;place-items:center start;gap:1rem;padding-block:.75rem;padding-inline:1rem;font-size:.875rem;line-height:1.25rem;display:grid}@supports (color:color-mix(in lab,red,red)){.alert{box-shadow:0 3px 0 -2px oklch(100% 0 0 / calc(var(--depth) * .08)) inset,0 1px color-mix(in oklab,color-mix(in oklab,#000 20%,var(--alert-color,var(--color-base-200))) calc(var(--depth) * 20%),#0000),0 4px 3px -2px oklch(0% 0 0 / calc(var(--depth) * .08))}}.alert:has(>:nth-child(2)){grid-template-columns:auto minmax(auto,1fr)}}.prose :where(a.btn:not(.btn-link)):not(:where([class~=not-prose],[class~=not-prose] *)){text-decoration-line:none}@layer daisyui.l1{@media (hover:hover){.btn:hover{--btn-bg:var(--btn-color,var(--color-base-200))}@supports (color:color-mix(in lab,red,red)){.btn:hover{--btn-bg:color-mix(in oklab, var(--btn-color,var(--color-base-200)), #000 7%)}}.btn:hover{color:var(--btn-fg);--btn-border:var(--btn-bg)}@supports (color:color-mix(in lab,red,red)){.btn:hover{--btn-border:color-mix(in oklab, var(--btn-bg), #000 calc(var(--depth) * 5%))}}.btn:hover{--btn-border-style:solid;--btn-inset:0 .5px 0 .5px oklch(100% 0 0 / calc(var(--depth) * 6%));--btn-shadow:0 3px 2px -2px var(--btn-bg), 0 4px 3px -2px var(--btn-bg)}@supports (color:color-mix(in lab,red,red)){.btn:hover{--btn-shadow:0 3px 2px -2px color-mix(in oklab, var(--btn-bg) calc(var(--depth) * 30%), #0000), 0 4px 3px -2px color-mix(in oklab, var(--btn-bg) calc(var(--depth) * 30%), #0000)}}}.btn:active:not(.btn-active){--btn-bg:var(--btn-color,var(--color-base-200));translate:0 .5px}@supports (color:color-mix(in lab,red,red)){.btn:active:not(.btn-active){--btn-bg:color-mix(in oklab, var(--btn-color,var(--color-base-200)), #000 5%)}}
1.btn:active:not(.btn-active){color:var(--btn-fg,var(--color-base-content));--btn-border:var(--btn-color,var(--color-base-200))}@supports (color:color-mix(in lab,red,red)){.btn:active:not(.btn-active){--btn-border:color-mix(in oklab, var(--btn-color,var(--color-base-200)), #000 7%)}}.btn:active:not(.btn-active){--btn-border-style:solid;--btn-inset:0 0 0 0 oklch(0% 0 0/0);--btn-shadow:0 0 0 0 oklch(0% 0 0/0)}.btn:where(:checked:not(.filter [type=radio].btn),:not([type=radio],[type=checkbox]):focus-visible){--btn-bg:var(--btn-color,var(--color-base-200));color:var(--btn-fg,var(--color-base-content));--btn-border:var(--btn-bg)}@supports (color:color-mix(in lab,red,red)){.btn:where(:checked:not(.filter [type=radio].btn),:not([type=radio],[type=checkbox]):focus-visible){--btn-border:color-mix(in oklab, var(--btn-bg), #000 calc(var(--depth) * 5%))}}.btn:where(:checked:not(.filter [type=radio].btn),:not([type=radio],[type=checkbox]):focus-visible){--btn-border-style:solid;--btn-inset:0 .5px 0 .5px oklch(100% 0 0 / calc(var(--depth) * 6%));--btn-shadow:0 3px 2px -2px var(--btn-bg), 0 4px 3px -2px var(--btn-bg)}@supports (color:color-mix(in lab,red,red)){.btn:where(:checked:not(.filter [type=radio].btn),:not([type=radio],[type=checkbox]):focus-visible){--btn-shadow:0 3px 2px -2px color-mix(in oklab, var(--btn-bg) calc(var(--depth) * 30%), #0000), 0 4px 3px -2px color-mix(in oklab, var(--btn-bg) calc(var(--depth) * 30%), #0000)}}.btn:where(:checked:not(.filter [type=radio].btn),:not([type=radio],[type=checkbox]):focus-visible){isolation:isolate}.btn:focus-visible,.btn:has(:focus-visible){isolation:isolate;outline-width:2px;outline-style:solid}}@layer daisyui{.btn:is(:disabled,[disabled],[aria-disabled=true]){pointer-events:none;color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){.btn:is(:disabled,[disabled],[aria-disabled=true]){color:color-mix(in oklch,var(--color-base-content) 20%,#0000)}}.btn:is(:disabled,[disabled],[aria-disabled=true]){--btn-bg:#0000;--btn-border:#0000;--btn-inset:0 0 0 0 oklch(0% 0 0/0);--btn-shadow:0 0 0 0 oklch(0% 0 0/0);background-image:none}:is(.btn-disabled,.btn:is(:disabled,[disabled],[aria-disabled=true])):not(.btn-link,.btn-ghost){background-color:var(--color-base-content)}@supports (color:color-mix(in lab,red,red)){:is(.btn-disabled,.btn:is(:disabled,[disabled],[aria-disabled=true])):not(.btn-link,.btn-ghost){background-color:color-mix(in oklab,var(--color-base-content) 10%,transparent)}}}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}:is(.input[type=url],.input[type=tel],.input[type=email],.input[type=number]):dir(rtl){border-start-start-radius:var(--join-se,var(--radius-field));border-start-end-radius:var(--join-ss,var(--radius-field));border-end-end-radius:var(--join-es,var(--radius-field));border-end-start-radius:var(--join-ee,var(--radius-field))}@layer daisyui.l1.l2{.steps-horizontal .step{text-align:center;grid-template-rows:40px 1fr;grid-template-columns:auto;place-items:center;min-width:4rem;display:grid}.steps-horizontal .step:before{width:100%;height:.5rem;margin-inline-start:-100%;translate:0}[dir=rtl] :is(.steps-horizontal .step):before{translate:0}.steps-vertical .step{grid-template-rows:auto;grid-template-columns:40px 1fr;justify-items:start;gap:.5rem;min-height:4rem;display:grid}.steps-vertical .step:before{width:.5rem;height:100%;margin-inline-start:50%;translate:-50% -50%}[dir=rtl] :is(.steps-vertical .step):before{translate:50% -50%}.steps .step-neutral+.step-neutral:before,.steps .step-neutral:after,.steps .step-neutral>.step-icon{--step-bg:var(--color-neutral);--step-fg:var(--color-neutral-content)}.steps .step-secondary+.step-secondary:before,.steps .step-secondary:after,.steps .step-secondary>.step-icon{--step-bg:var(--color-secondary);--step-fg:var(--color-secondary-content)}.steps .step-accent+.step-accent:before,.steps .step-accent:after,.steps .step-accent>.step-icon{--step-bg:var(--color-accent);--step-fg:var(--color-accent-content)}.steps .step-info+.step-info:before,.steps .step-info:after,.steps .step-info>.step-icon{--step-bg:var(--color-info);--step-fg:var(--color-info-content)}.steps .step-success+.step-success:before,.steps .step-success:after,.steps .step-success>.step-icon{--step-bg:var(--color-success);--step-fg:var(--color-success-content)}.steps .step-warning+.step-warning:before,.steps .step-warning:after,.steps .step-warning>.step-icon{--step-bg:var(--color-warning);--step-fg:var(--color-warning-content)}.steps .step-error+.step-error:before,.steps .step-error:after,.steps .step-error>.step-icon{--step-bg:var(--color-error);--step-fg:var(--color-error-content)}.checkbox:disabled,.radio:disabled{cursor:not-allowed;opacity:.2}.loading-sm{width:calc(var(--size-selector,.25rem) * 5)}.alert-vertical{text-align:center;grid-template-columns:auto;grid-auto-flow:row;justify-content:center;justify-items:center}.alert-vertical:has(>:nth-child(2)){grid-template-columns:auto}.input-ghost{box-shadow:none;background-color:#0000;border-color:#0000}.input-ghost:focus,.input-ghost:focus-within{background-color:var(--color-base-100);color:var(--color-base-content);box-shadow:none;border-color:#0000}.loading-spinner{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewB
1ox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='8s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='8s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='6s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E")}@media (prefers-reduced-motion:no-preference){.loading-spinner{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='2s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='black' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform-origin='center'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='2s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dasharray' values='0,150;42,150;42,150' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3Canimate attributeName='stroke-dashoffset' values='0;-16;-59' keyTimes='0;0.475;1' dur='1.5s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/g%3E%3C/svg%3E")}}.checkbox-sm{--size:calc(var(--size-selector,.25rem) * 5);padding:.1875rem}.table-xs :not(thead,tfoot) tr{font-size:.6875rem}.table-xs :where(th,td){padding-block:.25rem;padding-inline:.5rem}.alert-error{color:var(--color-error-content);--alert-border-color:var(--color-error);--alert-color:var(--color-error)}.alert-info{color:var(--color-info-content);--alert-border-color:var(--color-info);--alert-color:var(--color-info)}.alert-warning{color:var(--color-warning-content);--alert-border-color:var(--color-warning);--alert-color:var(--color-warning)}.checkbox-error{color:var(--color-error-content);--input-color:var(--color-error)}.checkbox-primary{color:var(--color-primary-content);--input-color:var(--color-primary)}@media (hover:hover){.link-primary:hover{color:var(--color-primary)}@supports (color:color-mix(in lab,red,red)){.link-primary:hover{color:color-mix(in oklab,var(--color-primary) 80%,#000)}}}.link-primary{color:var(--color-primary)}.steps .step-primary+.step-primary:before,.steps .step-primary:after,.steps .step-primary>.step-icon{--step-bg:var(--color-primary);--step-fg:var(--color-primary-content)}.input-sm{--in-size-mul:8;--font-size-min:.75rem;--spin-my:-2}.floating-label:has(.input-sm){--top-mul:4;--font-size:.75rem}.select-error,.select-error:focus,.select-error:focus-within{--input-color:var(--color-error)}.select-error:open{--input-color:var(--color-error)}.btn-primary{--btn-color:var(--color-primary);--btn-fg:var(--color-primary-content);--btn-soft-bg:initial}.btn-sm{--fontsize:.75rem;--btn-p:.75rem;--size:calc(var(--size-field,.25rem) * 8)}.btn-success{--btn-color:var(--color-success);--btn-fg:var(--color-success-content);--btn-soft-bg:initial}.btn-warning{--btn-color:var(--color-warning);--btn-fg:var(--color-warning-content);--btn-soft-bg:initial}.input-error,.input-error:focus,.input-error:focus-within{--input-color:var(--color-error)}.radio-primary{--input-color:var(--color-primary)}
1.invalid\\:input-error:invalid,.invalid\\:input-error:invalid:focus,.invalid\\:input-error:invalid:focus-within{--input-color:var(--color-error)}}@layer daisyui.l1.l2.l3.l4{.card figure:first-child{border-start-start-radius:inherit;border-start-end-radius:inherit;border-end-end-radius:unset;border-end-start-radius:unset;overflow:hidden}.card figure:last-child{border-start-start-radius:unset;border-start-end-radius:unset;border-end-end-radius:inherit;border-end-start-radius:inherit;overflow:hidden}.card figure{justify-content:center;align-items:center;display:flex}.join-item>*{--join-ss:initial;--join-se:initial;--join-es:initial;--join-ee:initial}}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{top:0;right:0;bottom:0;left:0}.top-0{top:0}.top-1\\/2{top:50%}.right-0{right:0}.right-4{right:calc(var(--spacing) * 4)}.bottom-10{bottom:calc(var(--spacing) * 10)}.left-0{left:0}.join{--join-ss:0;--join-se:0;--join-es:0;--join-ee:0;--join-ml:0;--join-mt:0;--join-v:0;--join-h:1;align-items:stretch;display:inline-flex}@scope (.join){:scope>:where(:focus,:has(:focus)){z-index:2}@media (hover:hover){:scope>:where(.btn:hover,:has(.btn:hover)){z-index:1}}:scope :where(:scope>:first-child){--join-ss:var(--radius-field);--join-se:calc(var(--radius-field) * var(--join-v));--join-es:calc(var(--radius-field) * var(--join-h));--join-ee:0}:scope :where(:scope>:last-child){--join-ss:0;--join-se:calc(var(--radius-field) * var(--join-h));--join-es:calc(var(--radius-field) * var(--join-v));--join-ee:var(--radius-field)}:scope :where(:scope>:only-child){--join-ss:var(--radius-field);--join-se:var(--radius-field);--join-es:var(--radius-field);--join-ee:var(--radius-field)}:scope :where(:scope>:not(:first-child)){--join-ml:calc(var(--border,1px) * -1 * var(--join-h));--join-mt:calc(var(--border,1px) * -1 * var(--join-v))}}.z-10{z-index:10}.z-20{z-index:20}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-mx-8{margin-inline:calc(var(--spacing) * -8)}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing) * 2)}.my-4{margin-block:calc(var(--spacing) * 4)}.my-12{margin-block:calc(var(--spacing) * 12)}.join-item{border-style:solid;border-width:var(--border,1px);border-start-start-radius:var(--join-ss);border-start-end-radius:var(--join-se);border-end-end-radius:var(--join-ee);border-end-start-radius:var(--join-es)}.join-item:not(:disabled,[disabled],.btn-disabled){margin-block-start:var(--join-mt,0);margin-inline-start:var(--join-ml,0)}.join-item:is(:disabled,[disabled],.btn-disabled){border-width:var(--border,1px);border-inline-end-width:calc(var(--border,1px) * var(--join-v));border-block-end-width:calc(var(--border,1px) * var(--join-h))}.mt-1{margin-top:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-5{margin-left:calc(var(--spacing) * 5)}.alert{border-width:var(--border);border-color:var(--alert-border-color,var(--color-base-200))}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.table{display:table}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-16{height:calc(var(--spacing) * 16)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-\\[80vh\\]{height:80vh}.h-full{height:100%}.max-h-0{max-height:0}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-144{max-height:calc(var(--spacing) * 144)}.max-h-\\[40vh\\]{max-height:40vh}.min-h-80{min-height:calc(var(--spacing) * 80)}.min-h-screen{min-height:100vh}.w-4{width:calc(var(--spacing) * 4)}.w-6{width:calc(var(--spacing) * 6)}.w-32{width:calc(var(--spacing) * 32)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-\\[7rem\\]{max-width:7rem}.max-w-\\[460px\\]{max-width:460px}.max-w-\\[480px\\]{max-width:480px}.max-w-\\[min\\(100\\%\\,22rem\\)\\]{max-width:min(100%,22rem)}.max-w-lg{max-width:var(--container-lg)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-0{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\\[16vh\\]{--tw-translate-y:16vh;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.cursor-pointer{cursor:pointer}.list-outside{list-style-position:outside}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-start{justify-content:flex-start}.justify-stretch{justify-content:stretch}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 10) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 10) * calc(1 - var(--tw-space-y-reverse)))}.gap-y-2{row-gap:calc(var(--spacing) * 2)}:where(.divide-x-2>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(2px * var(--tw-divide-x-reverse));border-inline-end-width:calc(2px * calc(1 - var(--tw-divide-x-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:var(--radius-lg)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-base-300{border-color:var(--color-base-300)}.bg-base-100,.bg-base-100\\/90{background-color:var(--color-base-100)}@supports (color:color-mix(in lab,red,red)){.bg-base-100\\/90{background-color:color-mix(in oklab,var(--color-base-100) 90%,transparent)}}.bg-base-200{background-color:var(--color-base-200)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-white{background-color:var(--color-white)}.fill-current{fill:currentColor}.stroke-current{stroke:currentColor}.stroke-info{stroke:var(--color-info)}.p-0{padding:0}.p-4{padding:calc(var(--spacing) * 4)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-\\[6vw\\]{padding-inline:6vw}.py-2{padding-block:calc(var(--spacing) * 2)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.pr-12{padding-right:calc(var(--spacing) * 12)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-right{text-align:right}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);
1line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[0\\.2em\\]{--tw-tracking:.2em;letter-spacing:.2em}.whitespace-nowrap{white-space:nowrap}.text-error{color:var(--color-error)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-primary{color:var(--color-primary)}.text-red-600{color:var(--color-red-600)}.text-secondary{color:var(--color-secondary)}.text-success{color:var(--color-success)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.opacity-0{opacity:0}.opacity-100{opacity:1}
1.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.outline-primary{outline-color:var(--color-primary)}.drop-shadow-2xl{--tw-drop-shadow-size:drop-shadow(0 25px 25px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-2xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-1000{--tw-duration:1s;transition-duration:1s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-solid{--tw-outline-style:solid;outline-style:solid}.placeholder\\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}@media (hover:hover){.hover\\:bg-base-300:hover{background-color:var(--color-base-300)}.hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}}.focus\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.disabled\\:bg-white:disabled{background-color:var(--color-white)}.disabled\\:text-gray-300:disabled{color:var(--color-gray-300)}.disabled\\:opacity-100:disabled{opacity:1}@media (min-width:40rem){.sm\\:inline{display:inline}}@media (min-width:48rem){.md\\:col-span-2{grid-column:span 2/span 2}.md\\:col-span-4{grid-column:span 4/span 4}.md\\:col-span-6{grid-column:span 6/span 6}.md\\:mt-6{margin-top:calc(var(--spacing) * 6)}.md\\:h-14{height:calc(var(--spacing) * 14)}.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.md\\:justify-end{justify-content:flex-end}.md\\:justify-start{justify-content:flex-start}.md\\:gap-8{gap:calc(var(--spacing) * 8)}.md\\:py-3{padding-block:calc(var(--spacing) * 3)}.md\\:py-4{padding-block:calc(var(--spacing) * 4)}}@media (min-width:64rem){.lg\\:max-w-\\(--breakpoint-lg\\){max-width:var(--breakpoint-lg)}}.\\[\\&_td\\]\\:px-1\\.5 td{padding-inline:calc(var(--spacing) * 1.5)}.\\[\\&_td\\]\\:py-0\\.5 td{padding-block:calc(var(--spacing) * .5)}}:root{--corner-lg:.75rem;--corner-sm:.25rem}.radius-leaf.btn,.radius-leaf .btn{border-radius:var(--corner-lg) var(--corner-sm)}.radius-leaf.join>.join-item,.radius-leaf .join>.join-item{border-radius:0}.radius-leaf.join>.join-item:first-child,.radius-leaf .join>.join-item:first-child{border-start-start-radius:var(--corner-lg);border-end-start-radius:var(--corner-sm)}.radius-leaf.join>.join-item:last-child,.radius-leaf .join>.join-item:last-child{border-start-end-radius:var(--corner-sm);border-end-end-radius:var(--corner-lg)}input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}@keyframes toast{0%{opacity:0;scale:.9}to{opacity:1;scale:1}}@keyframes aura{to{--aura-angle:360deg;transform:translateZ(1px)}}@keyframes aura-glow{20%,80%{opacity:.7;filter:blur(.25rem)}50%{opacity:1;filter:blur(.75rem)}}@keyframes aura-glow-after{20%,80%{opacity:.3;filter:blur(1rem)}50%{opacity:.6;filter:blur(1.5rem)}}@keyframes radio{0%{padding:5px}50%{padding:3px}}@keyframes progress{50%{background-position-x:-115%}}@keyframes menu{0%{opacity:0}
1}@keyframes skeleton{0%{background-position:150%}to{background-position:-50%}}@keyframes rating{0%,40%{filter:brightness(1.05)contrast(1.05);scale:1.1}}@keyframes rotator{89.9999%,to{--first-item-position:0 0%}90%,99.9999%{--first-item-position:0 calc(var(--items) * 100%)}to{translate:0 -100%}}@keyframes dropdown{0%{opacity:0}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
2/*$vite$:1*/`,document.head.appendChild(Qu);function cu(e,t){for(var o=0;o<t.length;o++){const u=t[o];if(typeof u!="string"&&!Array.isArray(u)){for(const p in u)if(p!=="default"&&!(p in e)){const y=Object.getOwnPropertyDescriptor(u,p);y&&Object.defineProperty(e,p,y.get?y:{enumerable:!0,get:()=>u[p]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var _c=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ig(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d3={exports:{}},Tv={},f3={exports:{}},mn={};/**
3 * @license React
4 * react.production.min.js
5 *
6 * Copyright (c) Facebook, Inc. and its affiliates.
7 *
8 * This source code is licensed under the MIT license found in the
9 * LICENSE file in the root directory of this source tree.
10 */var Ag=Symbol.for("react.element"),yG=Symbol.for("react.portal"),vG=Symbol.for("react.fragment"),xG=Symbol.for("react.strict_mode"),bG=Symbol.for("react.profiler"),wG=Symbol.for("react.provider"),TG=Symbol.for("react.context"),EG=Symbol.for("react.forward_ref"),SG=Symbol.for("react.suspense"),CG=Symbol.for("react.memo"),IG=Symbol.for("react.lazy"),p3=Symbol.iterator;function AG(e){return e===null||typeof e!="object"?null:(e=p3&&e[p3]||e["@@iterator"],typeof e=="function"?e:null)}var m3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g3=Object.assign,_3={};function ap(e,t,o){this.props=e,this.context=t,this.refs=_3,this.updater=o||m3}ap.prototype.isReactComponent={},ap.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},ap.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function y3(){}y3.prototype=ap.prototype;function _2(e,t,o){this.props=e,this.context=t,this.refs=_3,this.updater=o||m3}var y2=_2.prototype=new y3;y2.constructor=_2,g3(y2,ap.prototype),y2.isPureReactComponent=!0;var v3=Array.isArray,x3=Object.prototype.hasOwnProperty,v2={current:null},b3={key:!0,ref:!0,__self:!0,__source:!0};function w3(e,t,o){var u,p={},y=null,T=null;if(t!=null)for(u in t.ref!==void 0&&(T=t.ref),t.key!==void 0&&(y=""+t.key),t)x3.call(t,u)&&!b3.hasOwnProperty(u)&&(p[u]=t[u]);var s=arguments.length-2;if(s===1)p.children=o;else if(1<s){for(var M=Array(s),L=0;L<s;L++)M[L]=arguments[L+2];p.children=M}if(e&&e.defaultProps)for(u in s=e.defaultProps,s)p[u]===void 0&&(p[u]=s[u]);return{$$typeof:Ag,type:e,key:y,ref:T,props:p,_owner:v2.current}}function PG(e,t){return{$$typeof:Ag,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function x2(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ag}function MG(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(o){return t[o]})}var T3=/\/+/g;function b2(e,t){return typeof e=="object"&&e!==null&&e.key!=null?MG(""+e.key):t.toString(36)}function Ev(e,t,o,u,p){var y=typeof e;(y==="undefined"||y==="boolean")&&(e=null);var T=!1;if(e===null)T=!0;else switch(y){case"string":case"number":T=!0;break;case"object":switch(e.$$typeof){case Ag:case yG:T=!0}}if(T)return T=e,p=p(T),e=u===""?"."+b2(T,0):u,v3(p)?(o="",e!=null&&(o=e.replace(T3,"$&/")+"/"),Ev(p,t,o,"",function(L){return L})):p!=null&&(x2(p)&&(p=PG(p,o+(!p.key||T&&T.key===p.key?"":(""+p.key).replace(T3,"$&/")+"/")+e)),t.push(p)),1;if(T=0,u=u===""?".":u+":",v3(e))for(var s=0;s<e.length;s++){y=e[s];var M=u+b2(y,s);T+=Ev(y,t,o,M,p)}else if(M=AG(e),typeof M=="function")for(e=M.call(e),s=0;!(y=e.next()).done;)y=y.value,M=u+b2(y,s++),T+=Ev(y,t,o,M,p);else if(y==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return T}function Sv(e,t,o){if(e==null)return e;var u=[],p=0;return Ev(e,u,"","",function(y){return t.call(o,y,p++)}),u}function kG(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(o){(e._status===0||e._status===-1)&&(e._status=1,e._result=o)},function(o){(e._status===0||e._status===-1)&&(e._status=2,e._result=o)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ys={current:null},Cv={transition:null},RG={ReactCurrentDispatcher:Ys,ReactCurrentBatchConfig:Cv,ReactCurrentOwner:v2};function E3(){throw Error("act(...) is not supported in production builds of React.")}mn.Children={map:Sv,forEach:function(e,t,o){Sv(e,function(){t.apply(this,arguments)},o)},count:function(e){var t=0;return Sv(e,function(){t++}),t},toArray:function(e){return Sv(e,function(t){return t})||[]},only:function(e){if(!x2(e))throw Error("React.Children.only expected to receive a single React element child.");return e}}
vendor: 7,373 bytes, lines 10-26
10,mn.Component=ap,mn.Fragment=vG,mn.Profiler=bG,mn.PureComponent=_2,mn.StrictMode=xG,mn.Suspense=SG,mn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=RG,mn.act=E3,mn.cloneElement=function(e,t,o){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var u=g3({},e.props),p=e.key,y=e.ref,T=e._owner;if(t!=null){if(t.ref!==void 0&&(y=t.ref,T=v2.current),t.key!==void 0&&(p=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(M in t)x3.call(t,M)&&!b3.hasOwnProperty(M)&&(u[M]=t[M]===void 0&&s!==void 0?s[M]:t[M])}var M=arguments.length-2;if(M===1)u.children=o;else if(1<M){s=Array(M);for(var L=0;L<M;L++)s[L]=arguments[L+2];u.children=s}return{$$typeof:Ag,type:e.type,key:p,ref:y,props:u,_owner:T}},mn.createContext=function(e){return e={$$typeof:TG,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:wG,_context:e},e.Consumer=e},mn.createElement=w3,mn.createFactory=function(e){var t=w3.bind(null,e);return t.type=e,t},mn.createRef=function(){return{current:null}},mn.forwardRef=function(e){return{$$typeof:EG,render:e}},mn.isValidElement=x2,mn.lazy=function(e){return{$$typeof:IG,_payload:{_status:-1,_result:e},_init:kG}},mn.memo=function(e,t){return{$$typeof:CG,type:e,compare:t===void 0?null:t}},mn.startTransition=function(e){var t=Cv.transition;Cv.transition={};try{e()}finally{Cv.transition=t}},mn.unstable_act=E3,mn.useCallback=function(e,t){return Ys.current.useCallback(e,t)},mn.useContext=function(e){return Ys.current.useContext(e)},mn.useDebugValue=function(){},mn.useDeferredValue=function(e){return Ys.current.useDeferredValue(e)},mn.useEffect=function(e,t){return Ys.current.useEffect(e,t)},mn.useId=function(){return Ys.current.useId()},mn.useImperativeHandle=function(e,t,o){return Ys.current.useImperativeHandle(e,t,o)},mn.useInsertionEffect=function(e,t){return Ys.current.useInsertionEffect(e,t)},mn.useLayoutEffect=function(e,t){return Ys.current.useLayoutEffect(e,t)},mn.useMemo=function(e,t){return Ys.current.useMemo(e,t)},mn.useReducer=function(e,t,o){return Ys.current.useReducer(e,t,o)},mn.useRef=function(e){return Ys.current.useRef(e)},mn.useState=function(e){return Ys.current.useState(e)},mn.useSyncExternalStore=function(e,t,o){return Ys.current.useSyncExternalStore(e,t,o)},mn.useTransition=function(){return Ys.current.useTransition()},mn.version="18.3.1",f3.exports=mn;var mt=f3.exports;const kn=Ig(mt),LG=cu({__proto__:null,default:kn},[mt]);/**
11 * @license React
12 * react-jsx-runtime.production.min.js
13 *
14 * Copyright (c) Facebook, Inc. and its affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 */var zG=mt,DG=Symbol.for("react.element"),OG=Symbol.for("react.fragment"),FG=Object.prototype.hasOwnProperty,NG=zG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,BG={key:!0,ref:!0,__self:!0,__source:!0};function S3(e,t,o){var u,p={},y=null,T=null;o!==void 0&&(y=""+o),t.key!==void 0&&(y=""+t.key),t.ref!==void 0&&(T=t.ref);for(u in t)FG.call(t,u)&&!BG.hasOwnProperty(u)&&(p[u]=t[u]);if(e&&e.defaultProps)for(u in t=e.defaultProps,t)p[u]===void 0&&(p[u]=t[u]);return{$$typeof:DG,type:e,key:y,ref:T,props:p,_owner:NG.current}}Tv.Fragment=OG,Tv.jsx=S3,Tv.jsxs=S3,d3.exports=Tv;var Ve=d3.exports,w2={},C3={exports:{}},$a={},I3={exports:{}},A3={};/**
19 * @license React
20 * scheduler.production.min.js
21 *
22 * Copyright (c) Facebook, Inc. and its affiliates.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 */(function(e){function t(Oe,rt){var Nt=Oe.length;Oe.push(rt);e:for(;0<Nt;){var jt=Nt-1>>>1,gr=Oe[jt];if(0<p(gr,rt))Oe[jt]=rt,Oe[Nt]=gr,Nt=jt;else break e}}function o(Oe){return Oe.length===0?null:Oe[0]}function u(Oe){if(Oe.length===0)return null;var rt=Oe[0],Nt=Oe.pop();if(Nt!==rt){Oe[0]=Nt;e:for(var jt=0,gr=Oe.length,li=gr>>>1;jt<li;){var di=2*(jt+1)-1,Wr=Oe[di],fr=di+1,Ur=Oe[fr];if(0>p(Wr,Nt))fr<gr&&0>p(Ur,Wr)?(Oe[jt]=Ur,Oe[fr]=Nt,jt=fr):(Oe[jt]=Wr,Oe[di]=Nt,jt=di);else if(fr<gr&&0>p(Ur,Nt))Oe[jt]=Ur,Oe[fr]=Nt,jt=fr;else break e}}return rt}function p(Oe,rt){var Nt=Oe.sortIndex-rt.sortIndex;return Nt!==0?Nt:Oe.id-rt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var y=performance;e.unstable_now=function(){return y.now()}}else{var T=Date,s=T.now();e.unstable_now=function(){return T.now()-s}}var M=[],L=[],B=1,H=null,$=3,te=!1,xe=!1,pe=!1,Ne=typeof setTimeout=="function"?setTimeout:null,_e=typeof clearTimeout=="function"?clearTimeout:null,ie=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ke(Oe){for(var rt=o(L);rt!==null;){if(rt.callback===null)u(L);else if(rt.startTime<=Oe)u(L),rt.sortIndex=rt.expirationTime,t(M,rt);else break;rt=o(L)}}function ot(Oe){if(pe=!1,ke(Oe),!xe)if(o(M)!==null)xe=!0,He(et);else{var rt=o(L);rt!==null&&tt(ot,rt.startTime-Oe)}}function et(Oe,rt){xe=!1,pe&&(pe=!1,_e(K),K=-1),te=!0;var Nt=$;try{for(ke(rt),H=o(M);H!==null&&(!(H.expirationTime>rt)||Oe&&!Ye());){var jt=H.callback;if(typeof jt=="function"){H.callback=null,$=H.priorityLevel;var gr=jt(H.expirationTime<=rt);rt=e.unstable_now(),typeof gr=="function"?H.callback=gr:H===o(M)&&u(M),ke(rt)}else u(M);H=o(M)}if(H!==null)var li=!0;else{var di=o(L);di!==null&&tt(ot,di.startTime-rt),li=!1}return li}finally{H=null,$=Nt,te=!1}}var wt=!1,It=null,K=-1,ve=5,Ae=-1;function Ye(){return!(e.unstable_now()-Ae<ve)}function Be(){if(It!==null){var Oe=e.unstable_now();Ae=Oe;var rt=!0;try{rt=It(!0,Oe)}finally{rt?Fe():(wt=!1,It=null)}}else wt=!1}var Fe;if(typeof ie=="function")Fe=function(){ie(Be)};else if(typeof MessageChannel<"u"){var Je=new MessageChannel,ze=Je.port2;Je.port1.onmessage=Be,Fe=function(){ze.postMessage(null)}}else Fe=function(){Ne(Be,0)};function He(Oe){It=Oe,wt||(wt=!0,Fe())}function tt(Oe,rt){K=Ne(function(){Oe(e.unstable_now())},rt)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Oe){Oe.callback=null},e.unstable_continueExecution=function(){xe||te||(xe=!0,He(et))},e.unstable_forceFrameRate=function(Oe){0>Oe||125<Oe?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ve=0<Oe?Math.floor(1e3/Oe):5},e.unstable_getCurrentPriorityLevel=function(){return $},e.unstable_getFirstCallbackNode=function(){return o(M)},e.unstable_next=function(Oe){switch($){case 1:case 2:case 3:var rt=3;break;default:rt=$}var Nt=$;$=rt;try{return Oe()}finally{$=Nt}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Oe,rt){switch(Oe){case 1:case 2:case 3:case 4:case 5:break;default:Oe=3}var Nt=$;$=Oe;try{return rt()}finally{$=Nt}},e.unstable_scheduleCallback=function(Oe,rt,Nt){var jt=e.unstable_now();switch(typeof Nt=="object"&&Nt!==null?(Nt=Nt.delay,Nt=typeof Nt=="number"&&0<Nt?jt+Nt:jt):Nt=jt,Oe){case 1:var gr=-1;break;case 2:gr=250;break;case 5:gr=1073741823;break;case 4:gr=1e4;break;default:gr=5e3}
vendor: 4,653 bytes, lines 26-34
26return gr=Nt+gr,Oe={id:B++,callback:rt,priorityLevel:Oe,startTime:Nt,expirationTime:gr,sortIndex:-1},Nt>jt?(Oe.sortIndex=Nt,t(L,Oe),o(M)===null&&Oe===o(L)&&(pe?(_e(K),K=-1):pe=!0,tt(ot,Nt-jt))):(Oe.sortIndex=gr,t(M,Oe),xe||te||(xe=!0,He(et))),Oe},e.unstable_shouldYield=Ye,e.unstable_wrapCallback=function(Oe){var rt=$;return function(){var Nt=$;$=rt;try{return Oe.apply(this,arguments)}finally{$=Nt}}}})(A3),I3.exports=A3;var VG=I3.exports;/**
27 * @license React
28 * react-dom.production.min.js
29 *
30 * Copyright (c) Facebook, Inc. and its affiliates.
31 *
32 * This source code is licensed under the MIT license found in the
33 * LICENSE file in the root directory of this source tree.
34 */var UG=mt,Ha=VG;function mr(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)t+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var P3=new Set,Pg={};function Md(e,t){lp(e,t),lp(e+"Capture",t)}function lp(e,t){for(Pg[e]=t,e=0;e<t.length;e++)P3.add(t[e])}var uu=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),T2=Object.prototype.hasOwnProperty,jG=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,M3={},k3={};function GG(e){return T2.call(k3,e)?!0:T2.call(M3,e)?!1:jG.test(e)?k3[e]=!0:(M3[e]=!0,!1)}function $G(e,t,o,u){if(o!==null&&o.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function HG(e,t,o,u){if(t===null||typeof t>"u"||$G(e,t,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ks(e,t,o,u,p,y,T){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=o,this.propertyName=e,this.type=t,this.sanitizeURL=y,this.removeEmptyString=T}var ys={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ys[e]=new Ks(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ys[t]=new Ks(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){ys[e]=new Ks(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ys[e]=new Ks(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ys[e]=new Ks(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){ys[e]=new Ks(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){ys[e]=new Ks(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){ys[e]=new Ks(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){ys[e]=new Ks(e,5,!1,e.toLowerCase(),null,!1,!1)});var E2=/[\-:]([a-z])/g;function S2(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode
34-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E2,S2);ys[t]=new Ks(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E2,S2);ys[t]=new Ks(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E2,S2);ys[t]=new Ks(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){ys[e]=new Ks(e,1,!1,e.toLowerCase(),null,!1,!1)}),ys.xlinkHref=new Ks("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){ys[e]=new Ks(e,1,!1,e.toLowerCase(),null,!0,!0)});function C2(e,t,o,u){var p=ys.hasOwnProperty(t)?ys[t]:null;(p!==null?p.type!==0:u||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(HG(t,o,p,u)&&(o=null),u||p===null?GG(t)&&(o===null?e.removeAttribute(t):e.setAttribute(t,""+o)):p.mustUseProperty?e[p.propertyName]=o===null?p.type===3?!1:"":o:(t=p.attributeName,u=p.attributeNamespace,o===null?e.removeAttribute(t):(p=p.type,o=p===3||p===4&&o===!0?"":""+o,u?e.setAttributeNS(u,t,o):e.setAttribute(t,o))))}var hu=UG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Iv=Symbol.for("react.element"),cp=Symbol.for("react.portal"),up=Symbol.for("react.fragment"),I2=Symbol.for("react.strict_mode"),A2=Symbol.for("react.profiler"),R3=Symbol.for("react.provider"),L3=Symbol.for("react.context"),P2=Symbol.for("react.forward_ref"),M2=Symbol.for("react.suspense"),k2=Symbol.for("react.suspense_list"),R2=Symbol.for("react.memo"),eh=Symbol.for("react.lazy"),z3=Symbol.for("react.offscreen"),D3=Symbol.iterator;function Mg(e){return e===null||typeof e!="object"?null:(e=D3&&e[D3]||e["@@iterator"],typeof e=="function"?e:null)}var go=Object.assign,L2;function kg(e){if(L2===void 0)try{throw Error()}catch(o){var t=o.stack.trim().match(/\n( *(at )?)/);L2=t&&t[1]||""}return`
35`+L2+e}var z2=!1;function D2(e,t){if(!e||z2)return"";z2=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(L){var u=L}Reflect.construct(e,[],t)}else{try{t.call()}catch(L){u=L}e.call(t.prototype)}else{try{throw Error()}catch(L){u=L}e()}}catch(L){if(L&&u&&typeof L.stack=="string"){for(var p=L.stack.split(`
36`),y=u.stack.split(`
37`),T=p.length-1,s=y.length-1;1<=T&&0<=s&&p[T]!==y[s];)s--;for(;1<=T&&0<=s;T--,s--)if(p[T]!==y[s]){if(T!==1||s!==1)do if(T--,s--,0>s||p[T]!==y[s]){var M=`
38`+p[T].replace(" at new "," at ");return e.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",e.displayName)),M}while(1<=T&&0<=s);break}}}finally{z2=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?kg(e):""}function qG(e){switch(e.tag){case 5:return kg(e.type);case 16:return kg("Lazy");case 13:return kg("Suspense");case 19:return kg("SuspenseList");case 0:case 2:case 15:return e=D2(e.type,!1),e;case 11:return e=D2(e.type.render,!1),e;case 1:return e=D2(e.type,!0),e;default:return""}}function O2(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case up:return"Fragment";case cp:return"Portal";case A2:return"Profiler";case I2:return"StrictMode";case M2:return"Suspense";case k2:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case L3:return(e.displayName||"Context")+".Consumer";case R3:return(e._context.displayName||"Context")+".Provider";case P2:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R2:return t=e.displayName||null,t!==null?t:O2(e.type)||"Memo";case eh:t=e._payload,e=e._init;try{return O2(e(t))}catch{}}return null}function ZG(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return O2(t);case 8:return t===I2?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function th(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O3(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function WG(e){var t=O3(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),u=""+e[t];if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var p=o.get,y=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return p.call(this)},set:function(T){u=""+T,y.call(this,T)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(T){u=""+T},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Av(e){e._valueTracker||(e._valueTracker=WG(e))}function F3(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var o=t.getValue(),u="";return e&&(u=O3(e)?e.checked?"true":"false":e.value),e=u,e!==o?(t.setValue(e),!0):!1}function Pv(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function F2(e,t){var o=t.checked;return go({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function N3(e,t){var o=t.defaultValue==null?"":t.defaultValue,u=t.checked!=null?t.checked:t.defaultChecked;o=th(t.value!=null?t.value:o),e._wrapperState={initialChecked:u,initialValue:o,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}
vendor: 4,658 bytes, line 38
38function B3(e,t){t=t.checked,t!=null&&C2(e,"checked",t,!1)}function N2(e,t){B3(e,t);var o=th(t.value),u=t.type;if(o!=null)u==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(u==="submit"||u==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?B2(e,t.type,o):t.hasOwnProperty("defaultValue")&&B2(e,t.type,th(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function V3(e,t,o){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var u=t.type;if(!(u!=="submit"&&u!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,o||t===e.value||(e.value=t),e.defaultValue=t}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function B2(e,t,o){(t!=="number"||Pv(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var Rg=Array.isArray;function hp(e,t,o,u){if(e=e.options,t){t={};for(var p=0;p<o.length;p++)t["$"+o[p]]=!0;for(o=0;o<e.length;o++)p=t.hasOwnProperty("$"+e[o].value),e[o].selected!==p&&(e[o].selected=p),p&&u&&(e[o].defaultSelected=!0)}else{for(o=""+th(o),t=null,p=0;p<e.length;p++){if(e[p].value===o){e[p].selected=!0,u&&(e[p].defaultSelected=!0);return}t!==null||e[p].disabled||(t=e[p])}t!==null&&(t.selected=!0)}}function V2(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(mr(91));return go({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function U3(e,t){var o=t.value;if(o==null){if(o=t.children,t=t.defaultValue,o!=null){if(t!=null)throw Error(mr(92));if(Rg(o)){if(1<o.length)throw Error(mr(93));o=o[0]}t=o}t==null&&(t=""),o=t}e._wrapperState={initialValue:th(o)}}function j3(e,t){var o=th(t.value),u=th(t.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),t.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),u!=null&&(e.defaultValue=""+u)}function G3(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function $3(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function U2(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?$3(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Mv,H3=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,o,u,p){MSApp.execUnsafeLocalFunction(function(){return e(t,o,u,p)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Mv=Mv||document.createElement("div"),Mv.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Mv.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Lg(e,t){if(t){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=t;return}}e.textContent=t}var zg={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},XG=["Webkit","ms","Moz","O"];Object.keys(zg).forEach(function(e){XG.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zg[t]=zg[e]})});function q3(e,t,o){return t==null||typeof t=="boolean"||t===""?"":o||typeof t!="number"||t===0||zg.hasOwnProperty(e)&&zg[e]?(""+t).trim():t+"px"}function Z3(e,t){e=e.style;for(var o in t)if(t.hasOwnProperty(o)){var u=o.indexOf("--")===0,p=q3(o,t[o],u);o==="float"&&(o="cssFloat"),u?e.setProperty(o,p):e[o]=p}}var YG=go({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function j2(e,t){if(t){if(YG[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(mr(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(mr(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(mr(61))}if(t.style!=null&&typeof t.style!="object")throw Error(mr(62))}}function G2(e,t){if(e.indexOf("-")===-1)return typeof t.is=="str
38ing";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $2=null;function H2(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var q2=null,dp=null,fp=null;function W3(e){if(e=r_(e)){if(typeof q2!="function")throw Error(mr(280));var t=e.stateNode;t&&(t=Qv(t),q2(e.stateNode,e.type,t))}}function X3(e){dp?fp?fp.push(e):fp=[e]:dp=e}function Y3(){if(dp){var e=dp,t=fp;if(fp=dp=null,W3(e),t)for(e=0;e<t.length;e++)W3(t[e])}}function K3(e,t){return e(t)}function J3(){}var Z2=!1;function Q3(e,t,o){if(Z2)return e(t,o);Z2=!0;try{return K3(e,t,o)}finally{Z2=!1,(dp!==null||fp!==null)&&(J3(),Y3())}}function Dg(e,t){var o=e.stateNode;if(o===null)return null;var u=Qv(o);if(u===null)return null;o=u[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(e=e.type,u=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!u;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(mr(231,t,typeof o));return o}var W2=!1;if(uu)try{var Og={};Object.defineProperty(Og,"passive",{get:function(){W2=!0}}),window.addEventListener("test",Og,Og),window.removeEventListener("test",Og,Og)}catch{W2=!1}function KG(e,t,o,u,p,y,T,s,M){var L=Array.prototype.slice.call(arguments,3);try{t.apply(o,L)}catch(B){this.onError(B)}}var Fg=!1,kv=null,Rv=!1,X2=null,JG={onError:function(e){Fg=!0,kv=e}};function QG(e,t,o,u,p,y,T,s,M){Fg=!1,kv=null,KG.apply(JG,arguments)}function e$(e,t,o,u,p,y,T,s,M){if(QG.apply(this,arguments),Fg){if(Fg){var L=kv;Fg=!1,kv=null}else throw Error(mr(198));Rv||(Rv=!0,X2=L)}}function kd(e){var t=e,o=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(o=t.return),e=t.return;while(e)}return t.tag===3?o:null}function eP(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function tP(e){if(kd(e)!==e)throw Error(mr(188))}function t$(e){var t=e.alternate;if(!t){if(t=kd(e),t===null)throw Error(mr(188));return t!==e?null:e}for(var o=e,u=t;;){var p=o.return;if(p===null)break;var y=p.alternate;if(y===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===y.child){for(y=p.child;y;){if(y===o)return tP(p),e;if(y===u)return tP(p),t;y=y.sibling}throw Error(mr(188))}if(o.return!==u.return)o=p,u=y;else{for(var T=!1,s=p.child;s;){if(s===o){T=!0,o=p,u=y;break}if(s===u){T=!0,u=p,o=y;break}s=s.sibling}if(!T){for(s=y.child;s;){if(s===o){T=!0,o=y,u=p;break}if(s===u){T=!0,u=y,o=p;break}s=s.sibling}if(!T)throw Error(mr(189))}}if(o.alternate!==u)throw Error(mr(190))}if(o.tag!==3)throw Error(mr(188));return o.stateNode.current===o?e:t}function rP(e){return e=t$(e),e!==null?iP(e):null}function iP(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=iP(e);if(t!==null)return t;e=e.sibling}return null}var nP=Ha.unstable_scheduleCallback,oP=Ha.unstable_cancelCallback,r$=Ha.unstable_shouldYield,i$=Ha.unstable_requestPaint,Mo=Ha.unstable_now,n$=Ha.unstable_getCurrentPriorityLevel,Y2=Ha.unstable_ImmediatePriority,sP=Ha.unstable_UserBlockingPriority,Lv=Ha.unstable_NormalPriority,o$=Ha.unstable_LowPriority,aP=Ha.unstable_IdlePriority,zv=null,yc=null;function s$(e){if(yc&&typeof yc.onCommitFiberRoot=="function")try{yc.onCommitFiberRoot(zv,e,void 0,(e.current.flags&128)===128)}catch{}}var Bl=Math.clz32?Math.clz32:c$,a$=Math.log,l$=Math.LN2;function c$(e){return e>>>=0,e===0?32:31-(a$(e)/l$|0)|0}var Dv=64,Ov=4194304;function Ng(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fv(e,t){var o=e.pendingLanes;if(o===0)return 0;var u=0,p=e.suspendedLanes,y=e.pingedLanes,T=o&268435455;if(T!==0){var s=T&~p;s!==0?u=Ng(s):(y&=T,y!==0&&(u=Ng(y)))}else T=o&~p,T!==0?u=Ng(T):y!==0&&(u=Ng(y));if(u===0)return 0;if(t!==0&&t!==u&&!(t&p)&&(p=u&-u,y=t&-t,p>=y||p===16&&(y&4194240)!==0))return t;if(u&4&&(u|=o&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=u;0<t;)o=31-Bl(t),p=1<<o,u|=e[o],t&=~p;return u}function u$(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function h$(e,t){for(var o=e.suspendedLanes,u=e.pingedLanes,p=e.expirationTimes,y=e.pendingLanes;0<y;){var T=31-Bl(y),s=1<<T,M=p[T];M===-1?(!(s&o)||s&u)&&(p[T]=u$(s,t)):M<=t&&(e.expiredLanes|=s),y&=~s}}function K2(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function lP(){var e=Dv;return Dv<<=1,!(Dv&4194240)&&(Dv=64),e}function J2(e){for(var t=[],o=0;31>o;o++)t.push(e);return t}function Bg(e,t,o){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bl(t),e[t]=o}function d$(e,t){var o=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var u=e.eventTimes;for(e=e.expirationTimes;0<o;){var p=31-Bl(o),y=1<<p;t[p]=0,u[p]=-1,e[p]=-1,o&=~y}}function Q2(e,t){var o=e.entangledLanes|=t;for(e=e.entanglements;o;){var u=31-Bl(o),p=1<<u;p&t|e[u]&t&&(e[u]|=t),o&=~p}}var Bn=0;function cP(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var uP,eT,hP,dP,fP,tT=!1,Nv=[],rh=null,ih=null,nh=null,Vg=new Map,Ug=new Map,oh=[],f$="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function pP(e,t){switch(e){case"focusin":case"focusout":rh=null;break;case"dragenter":case"dragleave":ih=null;break;case"mouseover":case"mouseout":nh=null;break;case"pointerover":case"pointerout":Vg.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ug.delete(t.pointerId)}}function jg(e,t,o,u,p,y){return e===null||e.nativeEvent!==y?(e={blockedOn:t,domEventName:o,eventSystemFlags:u,nativeEvent:y,targetContainers:[p]},t!==null&&(t=r_(t),t!==null&&eT(t)),e):(e.eventSystemFlags|=u,t=e.targetContainers,p!==null&&t.indexOf(p)===-1&&t.push(p),e)}function p$(e,t,o,u,p){switch(t){case"focusin":return rh=jg(rh,e,t,o,u,p),!0;case"dragenter":return ih=jg(ih,e,t,o,u,p),!0;case"mouseover":return nh=jg(nh,e,t,o,u,p),!0;case"pointerover":var y=p.pointerId;return Vg.set(y,jg(Vg.get(y)||null,e,t,o,u,p)),!0;case"gotpointercapture":return y=p.pointerId,Ug.set(y,jg(Ug.get(y)||null,e,t,o,u,p)),!0}return!1}function mP(e){var t=Rd(e.target);if(t!==null){var o=kd(t);if(o!==null){if(t=o.tag,t===13){if(t=eP(o),t!==null){e.blockedOn=t,fP(e.priority,function(){hP(o)});return}}else if(t===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Bv(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var o=iT(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var u=new o.constructor(o.type,o);$2=u,o.target.dispatchEvent(u),$2=null}else return t=r_(o),t!==null&&eT(t),e.blockedOn=o,!1;t.shift()}return!0}function gP(e,t,o){Bv(e)&&o.delete(t)}function m$(){tT=!1,rh!==null&&Bv(rh)&&(rh=null),ih!==null&&Bv(ih)&&(ih=null),nh!==null&&Bv(nh)&&(nh=null),Vg.forEach(gP),Ug.forEach(gP)}function Gg(e,t){e.blockedOn===t&&(e.blockedOn=null,tT||(tT=!0,Ha.unstable_scheduleCallback(Ha.unstable_NormalPriority,m$)))}function $g(e){function t(p){return Gg(p,e)}if(0<Nv.length){Gg(Nv[0],e);for(var o=1;o<Nv.length;o++){var u=Nv[o];u.blockedOn===e&&(u.blockedOn=null)}}for(rh!==null&&Gg(rh,e),ih!==null&&Gg(ih,e),nh!==null&&Gg(nh,e),Vg.forEach(t),Ug.forEach(t),o=0;o<oh.length;o++)u=oh[o],u.blockedOn===e&&(u.blockedOn=null);for(;0<oh.length&&(o=oh[0],o.blockedOn===null);)mP(o),o.blockedOn===null&&oh.shift()}var pp=hu.ReactCurrentBatchConfig,Vv=!0;function g$(e,t,o,u){var p=Bn,y=pp.transition;pp.transition=null;try{Bn=1,rT(e,t,o,u)}finally{Bn=p,pp.transition=y}}function _$(e,t,o,u){var p=Bn,y=pp.transition;pp.transition=null;try{Bn=4,rT(e,t,o,u)}finally{Bn=p,pp.transition=y}}function rT(e,t,o,u){if(Vv){var p=iT(e,t,o,u);if(p===null)xT(e,t,u,Uv,o),pP(e,u);else if(p$(p,e,t,o,u))u.stopPropagation();else if(pP(e,u),t&4&&-1<f$.indexOf(e)){for(;p!==null;){var y=r_(p);if(y!==null&&uP(y),y=iT(e,t,o,u),y===null&&xT(e,t,u,Uv,o),y===p)break;p=y}p!==null&&u.stopPropagation()}else xT(e,t,u,null,o)}}var Uv=null;function iT(e,t,o,u){if(Uv=null,e=H2(u),e=Rd(e),e!==null)if(t=kd(e),t===null)e=null;else if(o=t.tag,o===13){if(e=eP(t),e!==null)return e;e=null}else if(o===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Uv=e,null}
vendor: 8,695 bytes, line 38
38function _P(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(n$()){case Y2:return 1;case sP:return 4;case Lv:case o$:return 16;case aP:return 536870912;default:return 16}default:return 16}}var sh=null,nT=null,jv=null;function yP(){if(jv)return jv;var e,t=nT,o=t.length,u,p="value"in sh?sh.value:sh.textContent,y=p.length;for(e=0;e<o&&t[e]===p[e];e++);var T=o-e;for(u=1;u<=T&&t[o-u]===p[y-u];u++);return jv=p.slice(e,1<u?1-u:void 0)}function Gv(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function $v(){return!0}function vP(){return!1}function qa(e){function t(o,u,p,y,T){this._reactName=o,this._targetInst=p,this.type=u,this.nativeEvent=y,this.target=T,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(o=e[s],this[s]=o?o(y):y[s]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?$v:vP,this.isPropagationStopped=vP,this}return go(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=$v)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=$v)},persist:function(){},isPersistent:$v}),t}var mp={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},oT=qa(mp),Hg=go({},mp,{view:0,detail:0}),y$=qa(Hg),sT,aT,qg,Hv=go({},Hg,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cT,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==qg&&(qg&&e.type==="mousemove"?(sT=e.screenX-qg.screenX,aT=e.screenY-qg.screenY):aT=sT=0,qg=e),sT)},movementY:function(e){return"movementY"in e?e.movementY:aT}}),xP=qa(Hv),v$=go({},Hv,{dataTransfer:0}),x$=qa(v$),b$=go({},Hg,{relatedTarget:0}),lT=qa(b$),w$=go({},mp,{animationName:0,elapsedTime:0,pseudoElement:0}),T$=qa(w$),E$=go({},mp,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),S$=qa(E$),C$=go({},mp,{data:0}),bP=qa(C$),I$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},A$={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},P$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function M$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=P$[e])?!!t[e]:!1}function cT(){return M$}var k$=go({},Hg,{key:function(e){if(e.key){var t=I$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Gv(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?A$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cT,charCode:function(e){return e.type==="keypress"?Gv(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Gv(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),R$=qa(k$),L$=go({},Hv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wP=qa(L$),z$=go({},Hg,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cT}),D$=qa(z$),O$=go({},mp,{propertyName:0,elapsedTime:0,pseudoElement:0}),F$=qa(O$),N$=go({},Hv,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),B$=qa(N$),V$=[9,13,27,32],uT=uu&&"CompositionEvent"in window,Zg=null;uu&&"documentMode"in document&&(Zg=document.documentMode);var U$=uu&&"TextEvent"in window&&!Zg,TP=uu&&(!uT||Zg&&8<Zg&&11>=Zg),EP=" ",SP=!1;function CP(e,t){switch(e){case"keyup":return V$.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function IP(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gp=!1;function j$(e,t){switch(e){case"compositionend":return IP(t);case"keypress":return t.which!==32?null:(SP=!0,EP);case"textInput":return e=t.data,e===EP&&SP?null:e;default:return null}}function G$(e,t){if(gp)return e==="compositionend"||!uT&&CP(e,t)?(e=yP(),jv=nT=sh=null,gp=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return TP&&t.locale!=="ko"?null:t.data;default:return null}}var $$={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function AP(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!$$[e.type]:t==="textarea"}function PP(e,t,o,u){X3(u),t=Yv(t,"onChange"),0<t.length&&(o=new oT("onChange","change",null,o,u),e.push({event:o,listeners:t}))}var Wg=null,Xg=null;function H$(e){ZP(e,0)}function qv(e){var t=bp(e);if(F3(t))return e}function q$(e,t){if(e==="change")return t}var MP=!1;if(uu){var hT;if(uu){var dT="oninput"in document;if(!dT){var kP=document.createElement("div");kP.setAttribute("oninput","return;"),dT=typeof kP.oninput=="function"}hT=dT}else hT=!1;MP=hT&&(!document.documentMode||9<document.documentMode)}function RP(){Wg&&(Wg.detachEvent("onpropertychange",LP),Xg=Wg=null)}function LP(e){if(e.propertyName==="value"&&qv(Xg)){var t=[];PP(t,Xg,e,H2(e)),Q3(H$,t)}}function Z$(e,t,o){e==="focusin"?(RP(),Wg=t,Xg=o,Wg.attachEvent("onpropertychange",LP)):e==="focusout"&&RP()}function W$(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return qv(Xg)}function X$(e,t){if(e==="click")return qv(t)}function Y$(e,t){if(e==="input"||e==="change")return qv(t)}function K$(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vl=typeof Object.is=="function"?Object.is:K$;function Yg(e,t){if(Vl(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var o=Object.keys(e),u=Object.keys(t);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var p=o[u];if(!T2.call(t,p)||!Vl(e[p],t[p]))return!1}return!0}function zP(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function DP(e,t){var o=zP(e);e=0;for(var u;o;){if(o.nodeType===3){if(u=e+o.textContent.length,e<=t&&u>=t)return{node:o,offset:t-e};e=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=zP(o)}}function OP(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?OP(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function FP(){for(var e=window,t=Pv();t instanceof e.HTMLIFrameElement;){try{var o=typeof t.contentWindow.location.href=="string"}catch{o=!1}
vendor: 8,891 bytes, line 38
38if(o)e=t.contentWindow;else break;t=Pv(e.document)}return t}function fT(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function J$(e){var t=FP(),o=e.focusedElem,u=e.selectionRange;if(t!==o&&o&&o.ownerDocument&&OP(o.ownerDocument.documentElement,o)){if(u!==null&&fT(o)){if(t=u.start,e=u.end,e===void 0&&(e=t),"selectionStart"in o)o.selectionStart=t,o.selectionEnd=Math.min(e,o.value.length);else if(e=(t=o.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var p=o.textContent.length,y=Math.min(u.start,p);u=u.end===void 0?y:Math.min(u.end,p),!e.extend&&y>u&&(p=u,u=y,y=p),p=DP(o,y);var T=DP(o,u);p&&T&&(e.rangeCount!==1||e.anchorNode!==p.node||e.anchorOffset!==p.offset||e.focusNode!==T.node||e.focusOffset!==T.offset)&&(t=t.createRange(),t.setStart(p.node,p.offset),e.removeAllRanges(),y>u?(e.addRange(t),e.extend(T.node,T.offset)):(t.setEnd(T.node,T.offset),e.addRange(t)))}}for(t=[],e=o;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<t.length;o++)e=t[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Q$=uu&&"documentMode"in document&&11>=document.documentMode,_p=null,pT=null,Kg=null,mT=!1;function NP(e,t,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;mT||_p==null||_p!==Pv(u)||(u=_p,"selectionStart"in u&&fT(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Kg&&Yg(Kg,u)||(Kg=u,u=Yv(pT,"onSelect"),0<u.length&&(t=new oT("onSelect","select",null,t,o),e.push({event:t,listeners:u}),t.target=_p)))}function Zv(e,t){var o={};return o[e.toLowerCase()]=t.toLowerCase(),o["Webkit"+e]="webkit"+t,o["Moz"+e]="moz"+t,o}var yp={animationend:Zv("Animation","AnimationEnd"),animationiteration:Zv("Animation","AnimationIteration"),animationstart:Zv("Animation","AnimationStart"),transitionend:Zv("Transition","TransitionEnd")},gT={},BP={};uu&&(BP=document.createElement("div").style,"AnimationEvent"in window||(delete yp.animationend.animation,delete yp.animationiteration.animation,delete yp.animationstart.animation),"TransitionEvent"in window||delete yp.transitionend.transition);function Wv(e){if(gT[e])return gT[e];if(!yp[e])return e;var t=yp[e],o;for(o in t)if(t.hasOwnProperty(o)&&o in BP)return gT[e]=t[o];return e}var VP=Wv("animationend"),UP=Wv("animationiteration"),jP=Wv("animationstart"),GP=Wv("transitionend"),$P=new Map,HP="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ah(e,t){$P.set(e,t),Md(t,[e])}for(var _T=0;_T<HP.length;_T++){var yT=HP[_T],e9=yT.toLowerCase(),t9=yT[0].toUpperCase()+yT.slice(1);ah(e9,"on"+t9)}ah(VP,"onAnimationEnd"),ah(UP,"onAnimationIteration"),ah(jP,"onAnimationStart"),ah("dblclick","onDoubleClick"),ah("focusin","onFocus"),ah("focusout","onBlur"),ah(GP,"onTransitionEnd"),lp("onMouseEnter",["mouseout","mouseover"]),lp("onMouseLeave",["mouseout","mouseover"]),lp("onPointerEnter",["pointerout","pointerover"]),lp("onPointerLeave",["pointerout","pointerover"]),Md("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Md("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Md("onBeforeInput",["compositionend","keypress","textInput","paste"]),Md("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Md("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Md("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jg="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),r9=new Set("cancel close invalid load scroll toggle".split(" ").concat(Jg));function qP(e,t,o){var u=e.type||"unknown-event";e.currentTarget=o,e$(u,t,void 0,e),e.currentTarget=null}function ZP(e,t){t=(t&4)!==0;for(var o=0;o<e.length;o++){var u=e[o],p=u.event;u=u.listeners;e:{var y=void 0;if(t)for(var T=u.length-1;0<=T;T--){var s=u[T],M=s.instance,L=s.currentTarget;if(s=s.listener,M!==y&&p.isPropagationStopped())break e;qP(p,s,L),y=M}else for(T=0;T<u.length;T++){if(s=u[T],M=s.instance,L=s.currentTarget,s=s.listener,M!==y&&p.isPropagationStopped())break e;qP(p,s,L),y=M}}}if(Rv)throw e=X2,Rv=!1,X2=null,e}function oo(e,t){var o=t[CT];o===void 0&&(o=t[CT]=new Set);var u=e+"__bubble";o.has(u)||(WP(t,e,2,!1),o.add(u))}function vT(e,t,o){var u=0;t&&(u|=4),WP(o,e,u,t)}var Xv="_reactListening"+Math.random().toString(36).slice(2);function Qg(e){if(!e[Xv]){e[Xv]=!0,P3.forEach(function(o){o!=="selectionchange"&&(r9.has(o)||vT(o,!1,e),vT(o,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xv]||(t[Xv]=!0,vT("selectionchange",!1,t))}}function WP(e,t,o,u){switch(_P(t)){case 1:var p=g$;break;case 4:p=_$;break;default:p=rT}o=p.bind(null,t,o,e),p=void 0,!W2||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(p=!0),u?p!==void 0?e.addEventListener(t,o,{capture:!0,passive:p}):e.addEventListener(t,o,!0):p!==void 0?e.addEventListener(t,o,{passive:p}):e.addEventListener(t,o,!1)}function xT(e,t,o,u,p){var y=u;if(!(t&1)&&!(t&2)&&u!==null)e:for(;;){if(u===null)return;var T=u.tag;if(T===3||T===4){var s=u.stateNode.containerInfo;if(s===p||s.nodeType===8&&s.parentNode===p)break;if(T===4)for(T=u.return;T!==null;){var M=T.tag;if((M===3||M===4)&&(M=T.stateNode.containerInfo,M===p||M.nodeType===8&&M.parentNode===p))return;T=T.return}for(;s!==null;){if(T=Rd(s),T===null)return;if(M=T.tag,M===5||M===6){u=y=T;continue e}s=s.parentNode}}u=u.return}Q3(function(){var L=y,B=H2(o),H=[];e:{var $=$P.get(e);if($!==void 0){var te=oT,xe=e;switch(e){case"keypress":if(Gv(o)===0)break e;case"keydown":case"keyup":te=R$;break;case"focusin":xe="focus",te=lT;break;case"focusout":xe="blur",te=lT;break;case"beforeblur":case"afterblur":te=lT;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=xP;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=x$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=D$;break;case VP:case UP:case jP:te=T$;break;case GP:te=F$;break;case"scroll":te=y$;break;case"wheel":te=B$;break;case"copy":case"cut":case"paste":te=S$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=wP}var pe=(t&4)!==0,Ne=!pe&&e==="scroll",_e=pe?$!==null?$+"Capture":null:$;pe=[];for(var ie=L,ke;ie!==null;){ke=ie;var ot=ke.stateNode;if(ke.tag===5&&ot!==null&&(ke=ot,_e!==null&&(ot=Dg(ie,_e),ot!=null&&pe.push(e_(ie,ot,ke)))),Ne)break;ie=ie.return}0<pe.length&&($=new te($,xe,null,o,B),H.push({event:$,listeners:pe}))}}if(!(t&7)){e:{if($=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",$&&o!==$2&&(xe=o.relatedTarget||o.fromElement)&&(Rd(xe)||xe[du]))break e;if((te||$)&&($=B.window===B?B:($=B.ownerDocument)?$.defaultView||$.parentWindow:window,te?(xe=o.relatedTarget||o.toElement,te=L,xe=xe?Rd(xe):null,xe!==null&&(Ne=kd(xe),xe!==Ne||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(te=null,xe=L),te!==xe)){if(pe=xP,ot="onMouseLeave",_e="onMouseEnter",ie="mouse",(e==="pointerout"||e==="pointerover")&&(pe=wP,ot="onPointerLeave",_e="onPointerEnter",ie="pointer"),Ne=te==null?$:bp(te),ke=xe==null?$:bp(xe),$=new pe(ot,ie+"leave",te,o,B),$.target=Ne,$.relatedTarget=ke,ot=null,Rd(B)===L&&(pe=new pe(_e,ie+"enter",xe,o,B),pe.target=ke,pe.relatedTarget=Ne,ot=pe),Ne=ot,te&&xe)t:{for(pe=te,_e=xe,ie=0,ke=pe;ke;ke=vp(ke))ie++;for(ke=0,ot=_e;ot;ot=vp(ot))ke++;for(;0<ie-ke;)pe=vp(pe),ie--;for(;0<ke-ie;)_e=vp(_e),ke--;for(;ie--;){if(pe===_e||_e!==null&&pe===_e.alternate)break t;pe=vp(pe),_e=vp(_e)}pe=null}else pe=null;te!==null&&XP(H,$,te,pe,!1),xe!==null&&Ne!==null&&XP(H,Ne,xe,pe,!0)}}
vendor: 6,411 bytes, lines 38-39
38e:{if($=L?bp(L):window,te=$.nodeName&&$.nodeName.toLowerCase(),te==="select"||te==="input"&&$.type==="file")var et=q$;else if(AP($))if(MP)et=Y$;else{et=W$;var wt=Z$}else(te=$.nodeName)&&te.toLowerCase()==="input"&&($.type==="checkbox"||$.type==="radio")&&(et=X$);if(et&&(et=et(e,L))){PP(H,et,o,B);break e}wt&&wt(e,$,L),e==="focusout"&&(wt=$._wrapperState)&&wt.controlled&&$.type==="number"&&B2($,"number",$.value)}switch(wt=L?bp(L):window,e){case"focusin":(AP(wt)||wt.contentEditable==="true")&&(_p=wt,pT=L,Kg=null);break;case"focusout":Kg=pT=_p=null;break;case"mousedown":mT=!0;break;case"contextmenu":case"mouseup":case"dragend":mT=!1,NP(H,o,B);break;case"selectionchange":if(Q$)break;case"keydown":case"keyup":NP(H,o,B)}var It;if(uT)e:{switch(e){case"compositionstart":var K="onCompositionStart";break e;case"compositionend":K="onCompositionEnd";break e;case"compositionupdate":K="onCompositionUpdate";break e}K=void 0}else gp?CP(e,o)&&(K="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(K="onCompositionStart");K&&(TP&&o.locale!=="ko"&&(gp||K!=="onCompositionStart"?K==="onCompositionEnd"&&gp&&(It=yP()):(sh=B,nT="value"in sh?sh.value:sh.textContent,gp=!0)),wt=Yv(L,K),0<wt.length&&(K=new bP(K,e,null,o,B),H.push({event:K,listeners:wt}),It?K.data=It:(It=IP(o),It!==null&&(K.data=It)))),(It=U$?j$(e,o):G$(e,o))&&(L=Yv(L,"onBeforeInput"),0<L.length&&(B=new bP("onBeforeInput","beforeinput",null,o,B),H.push({event:B,listeners:L}),B.data=It))}ZP(H,t)})}function e_(e,t,o){return{instance:e,listener:t,currentTarget:o}}function Yv(e,t){for(var o=t+"Capture",u=[];e!==null;){var p=e,y=p.stateNode;p.tag===5&&y!==null&&(p=y,y=Dg(e,o),y!=null&&u.unshift(e_(e,y,p)),y=Dg(e,t),y!=null&&u.push(e_(e,y,p))),e=e.return}return u}function vp(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function XP(e,t,o,u,p){for(var y=t._reactName,T=[];o!==null&&o!==u;){var s=o,M=s.alternate,L=s.stateNode;if(M!==null&&M===u)break;s.tag===5&&L!==null&&(s=L,p?(M=Dg(o,y),M!=null&&T.unshift(e_(o,M,s))):p||(M=Dg(o,y),M!=null&&T.push(e_(o,M,s)))),o=o.return}T.length!==0&&e.push({event:t,listeners:T})}var i9=/\r\n?/g,n9=/\u0000|\uFFFD/g;function YP(e){return(typeof e=="string"?e:""+e).replace(i9,`
39`).replace(n9,"")}function Kv(e,t,o){if(t=YP(t),YP(e)!==t&&o)throw Error(mr(425))}function Jv(){}var bT=null,wT=null;function TT(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ET=typeof setTimeout=="function"?setTimeout:void 0,o9=typeof clearTimeout=="function"?clearTimeout:void 0,KP=typeof Promise=="function"?Promise:void 0,s9=typeof queueMicrotask=="function"?queueMicrotask:typeof KP<"u"?function(e){return KP.resolve(null).then(e).catch(a9)}:ET;function a9(e){setTimeout(function(){throw e})}function ST(e,t){var o=t,u=0;do{var p=o.nextSibling;if(e.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"){if(u===0){e.removeChild(p),$g(t);return}u--}else o!=="$"&&o!=="$?"&&o!=="$!"||u++;o=p}while(o);$g(t)}function lh(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function JP(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(t===0)return e;t--}else o==="/$"&&t++}e=e.previousSibling}return null}var xp=Math.random().toString(36).slice(2),vc="__reactFiber$"+xp,t_="__reactProps$"+xp,du="__reactContainer$"+xp,CT="__reactEvents$"+xp,l9="__reactListeners$"+xp,c9="__reactHandles$"+xp;function Rd(e){var t=e[vc];if(t)return t;for(var o=e.parentNode;o;){if(t=o[du]||o[vc]){if(o=t.alternate,t.child!==null||o!==null&&o.child!==null)for(e=JP(e);e!==null;){if(o=e[vc])return o;e=JP(e)}return t}e=o,o=e.parentNode}return null}function r_(e){return e=e[vc]||e[du],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function bp(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(mr(33))}function Qv(e){return e[t_]||null}var IT=[],wp=-1;function ch(e){return{current:e}}function so(e){0>wp||(e.current=IT[wp],IT[wp]=null,wp--)}function Xn(e,t){wp++,IT[wp]=e.current,e.current=t}var uh={},Ms=ch(uh),Ta=ch(!1),Ld=uh;function Tp(e,t){var o=e.type.contextTypes;if(!o)return uh;var u=e.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===t)return u.__reactInternalMemoizedMaskedChildContext;var p={},y;for(y in o)p[y]=t[y];return u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=p),p}function Ea(e){return e=e.childContextTypes,e!=null}function ex(){so(Ta),so(Ms)}function QP(e,t,o){if(Ms.current!==uh)throw Error(mr(168));Xn(Ms,t),Xn(Ta,o)}function eM(e,t,o){var u=e.stateNode;if(t=t.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var p in u)if(!(p in t))throw Error(mr(108,ZG(e)||"Unknown",p));return go({},o,u)}function tx(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||uh,Ld=Ms.current,Xn(Ms,e),Xn(Ta,Ta.current),!0}function tM(e,t,o){var u=e.stateNode;if(!u)throw Error(mr(169));o?(e=eM(e,t,Ld),u.__reactInternalMemoizedMergedChildContext=e,so(Ta),so(Ms),Xn(Ms,e)):so(Ta),Xn(Ta,o)}var fu=null,rx=!1,AT=!1;function rM(e){fu===null?fu=[e]:fu.push(e)}function u9(e){rx=!0,rM(e)}function hh(){if(!AT&&fu!==null){AT=!0;var e=0,t=Bn;try{var o=fu;for(Bn=1;e<o.length;e++){var u=o[e];do u=u(!0);while(u!==null)}fu=null,rx=!1}catch(p){throw fu!==null&&(fu=fu.slice(e+1)),nP(Y2,hh),p}finally{Bn=t,AT=!1}}return null}var Ep=[],Sp=0,ix=null,nx=0,ll=[],cl=0,zd=null,pu=1,mu="";function Dd(e,t){Ep[Sp++]=nx,Ep[Sp++]=ix,ix=e,nx=t}function iM(e,t,o){ll[cl++]=pu,ll[cl++]=mu,ll[cl++]=zd,zd=e;var u=pu;e=mu;var p=32-Bl(u)-1;u&=~(1<<p),o+=1;var y=32-Bl(t)+p;if(30<y){var T=p-p%5;y=(u&(1<<T)-1).toString(32),u>>=T,p-=T,pu=1<<32-Bl(t)+p|o<<p|u,mu=y+e}else pu=1<<y|o<<p|u,mu=e}function PT(e){e.return!==null&&(Dd(e,1),iM(e,1,0))}function MT(e){for(;e===ix;)ix=Ep[--Sp],Ep[Sp]=null,nx=Ep[--Sp],Ep[Sp]=null;for(;e===zd;)zd=ll[--cl],ll[cl]=null,mu=ll[--cl],ll[cl]=null,pu=ll[--cl],ll[cl]=null}var Za=null,Wa=null,uo=!1,Ul=null;function nM(e,t){var o=fl(5,null,null,0);o.elementType="DELETED",o.stateNode=t,o.return=e,t=e.deletions,t===null?(e.deletions=[o],e.flags|=16):t.push(o)}function oM(e,t){switch(e.tag){case 5:var o=e.type;
vendor: 15,928 bytes, line 39
39return t=t.nodeType!==1||o.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Za=e,Wa=lh(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Za=e,Wa=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(o=zd!==null?{id:pu,overflow:mu}:null,e.memoizedState={dehydrated:t,treeContext:o,retryLane:1073741824},o=fl(18,null,null,0),o.stateNode=t,o.return=e,e.child=o,Za=e,Wa=null,!0):!1;default:return!1}}function kT(e){return(e.mode&1)!==0&&(e.flags&128)===0}function RT(e){if(uo){var t=Wa;if(t){var o=t;if(!oM(e,t)){if(kT(e))throw Error(mr(418));t=lh(o.nextSibling);var u=Za;t&&oM(e,t)?nM(u,o):(e.flags=e.flags&-4097|2,uo=!1,Za=e)}}else{if(kT(e))throw Error(mr(418));e.flags=e.flags&-4097|2,uo=!1,Za=e}}}function sM(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Za=e}function ox(e){if(e!==Za)return!1;if(!uo)return sM(e),uo=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!TT(e.type,e.memoizedProps)),t&&(t=Wa)){if(kT(e))throw aM(),Error(mr(418));for(;t;)nM(e,t),t=lh(t.nextSibling)}if(sM(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(mr(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(t===0){Wa=lh(e.nextSibling);break e}t--}else o!=="$"&&o!=="$!"&&o!=="$?"||t++}e=e.nextSibling}Wa=null}}else Wa=Za?lh(e.stateNode.nextSibling):null;return!0}function aM(){for(var e=Wa;e;)e=lh(e.nextSibling)}function Cp(){Wa=Za=null,uo=!1}function LT(e){Ul===null?Ul=[e]:Ul.push(e)}var h9=hu.ReactCurrentBatchConfig;function i_(e,t,o){if(e=o.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(mr(309));var u=o.stateNode}if(!u)throw Error(mr(147,e));var p=u,y=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===y?t.ref:(t=function(T){var s=p.refs;T===null?delete s[y]:s[y]=T},t._stringRef=y,t)}if(typeof e!="string")throw Error(mr(284));if(!o._owner)throw Error(mr(290,e))}return e}function sx(e,t){throw e=Object.prototype.toString.call(t),Error(mr(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lM(e){var t=e._init;return t(e._payload)}function cM(e){function t(_e,ie){if(e){var ke=_e.deletions;ke===null?(_e.deletions=[ie],_e.flags|=16):ke.push(ie)}}function o(_e,ie){if(!e)return null;for(;ie!==null;)t(_e,ie),ie=ie.sibling;return null}function u(_e,ie){for(_e=new Map;ie!==null;)ie.key!==null?_e.set(ie.key,ie):_e.set(ie.index,ie),ie=ie.sibling;return _e}function p(_e,ie){return _e=vh(_e,ie),_e.index=0,_e.sibling=null,_e}function y(_e,ie,ke){return _e.index=ke,e?(ke=_e.alternate,ke!==null?(ke=ke.index,ke<ie?(_e.flags|=2,ie):ke):(_e.flags|=2,ie)):(_e.flags|=1048576,ie)}function T(_e){return e&&_e.alternate===null&&(_e.flags|=2),_e}function s(_e,ie,ke,ot){return ie===null||ie.tag!==6?(ie=EE(ke,_e.mode,ot),ie.return=_e,ie):(ie=p(ie,ke),ie.return=_e,ie)}function M(_e,ie,ke,ot){var et=ke.type;return et===up?B(_e,ie,ke.props.children,ot,ke.key):ie!==null&&(ie.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===eh&&lM(et)===ie.type)?(ot=p(ie,ke.props),ot.ref=i_(_e,ie,ke),ot.return=_e,ot):(ot=Mx(ke.type,ke.key,ke.props,null,_e.mode,ot),ot.ref=i_(_e,ie,ke),ot.return=_e,ot)}function L(_e,ie,ke,ot){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==ke.containerInfo||ie.stateNode.implementation!==ke.implementation?(ie=SE(ke,_e.mode,ot),ie.return=_e,ie):(ie=p(ie,ke.children||[]),ie.return=_e,ie)}function B(_e,ie,ke,ot,et){return ie===null||ie.tag!==7?(ie=Gd(ke,_e.mode,ot,et),ie.return=_e,ie):(ie=p(ie,ke),ie.return=_e,ie)}function H(_e,ie,ke){if(typeof ie=="string"&&ie!==""||typeof ie=="number")return ie=EE(""+ie,_e.mode,ke),ie.return=_e,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case Iv:return ke=Mx(ie.type,ie.key,ie.props,null,_e.mode,ke),ke.ref=i_(_e,null,ie),ke.return=_e,ke;case cp:return ie=SE(ie,_e.mode,ke),ie.return=_e,ie;case eh:var ot=ie._init;return H(_e,ot(ie._payload),ke)}if(Rg(ie)||Mg(ie))return ie=Gd(ie,_e.mode,ke,null),ie.return=_e,ie;sx(_e,ie)}return null}function $(_e,ie,ke,ot){var et=ie!==null?ie.key:null;if(typeof ke=="string"&&ke!==""||typeof ke=="number")return et!==null?null:s(_e,ie,""+ke,ot);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case Iv:return ke.key===et?M(_e,ie,ke,ot):null;case cp:return ke.key===et?L(_e,ie,ke,ot):null;case eh:return et=ke._init,$(_e,ie,et(ke._payload),ot)}if(Rg(ke)||Mg(ke))return et!==null?null:B(_e,ie,ke,ot,null);sx(_e,ke)}return null}function te(_e,ie,ke,ot,et){if(typeof ot=="string"&&ot!==""||typeof ot=="number")return _e=_e.get(ke)||null,s(ie,_e,""+ot,et);if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case Iv:return _e=_e.get(ot.key===null?ke:ot.key)||null,M(ie,_e,ot,et);case cp:return _e=_e.get(ot.key===null?ke:ot.key)||null,L(ie,_e,ot,et);case eh:var wt=ot._init;return te(_e,ie,ke,wt(ot._payload),et)}if(Rg(ot)||Mg(ot))return _e=_e.get(ke)||null,B(ie,_e,ot,et,null);sx(ie,ot)}return null}function xe(_e,ie,ke,ot){for(var et=null,wt=null,It=ie,K=ie=0,ve=null;It!==null&&K<ke.length;K++){It.index>K?(ve=It,It=null):ve=It.sibling;var Ae=$(_e,It,ke[K],ot);if(Ae===null){It===null&&(It=ve);break}e&&It&&Ae.alternate===null&&t(_e,It),ie=y(Ae,ie,K),wt===null?et=Ae:wt.sibling=Ae,wt=Ae,It=ve}if(K===ke.length)return o(_e,It),uo&&Dd(_e,K),et;if(It===null){for(;K<ke.length;K++)It=H(_e,ke[K],ot),It!==null&&(ie=y(It,ie,K),wt===null?et=It:wt.sibling=It,wt=It);return uo&&Dd(_e,K),et}for(It=u(_e,It);K<ke.length;K++)ve=te(It,_e,K,ke[K],ot),ve!==null&&(e&&ve.alternate!==null&&It.delete(ve.key===null?K:ve.key),ie=y(ve,ie,K),wt===null?et=ve:wt.sibling=ve,wt=ve);return e&&It.forEach(function(Ye){return t(_e,Ye)}),uo&&Dd(_e,K),et}function pe(_e,ie,ke,ot){var et=Mg(ke);if(typeof et!="function")throw Error(mr(150));if(ke=et.call(ke),ke==null)throw Error(mr(151));for(var wt=et=null,It=ie,K=ie=0,ve=null,Ae=ke.next();It!==null&&!Ae.done;K++,Ae=ke.next()){It.index>K?(ve=It,It=null):ve=It.sibling;var Ye=$(_e,It,Ae.value,ot);if(Ye===null){It===null&&(It=ve);break}e&&It&&Ye.alternate===null&&t(_e,It),ie=y(Ye,ie,K),wt===null?et=Ye:wt.sibling=Ye,wt=Ye,It=ve}if(Ae.done)return o(_e,It),uo&&Dd(_e,K),et;if(It===null){for(;!Ae.done;K++,Ae=ke.next())Ae=H(_e,Ae.value,ot),Ae!==null&&(ie=y(Ae,ie,K),wt===null?et=Ae:wt.sibling=Ae,wt=Ae);return uo&&Dd(_e,K),et}for(It=u(_e,It);!Ae.done;K++,Ae=ke.next())Ae=te(It,_e,K,Ae.value,ot),Ae!==null&&(e&&Ae.alternate!==null&&It.delete(Ae.key===null?K:Ae.key),ie=y(Ae,ie,K),wt===null?et=Ae:wt.sibling=Ae,wt=Ae);return e&&It.forEach(function(Be){return t(_e,Be)}),uo&&Dd(_e,K),et}function Ne(_e,ie,ke,ot){if(typeof ke=="object"&&ke!==null&&ke.type===up&&ke.key===null&&(ke=ke.props.children),typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case Iv:e:{for(var et=ke.key,wt=ie;wt!==null;){if(wt.key===et){if(et=ke.type,et===up){if(wt.tag===7){o(_e,wt.sibling),ie=p(wt,ke.props.children),ie.return=_e,_e=ie;break e}}else if(wt.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===eh&&lM(et)===wt.type){o(_e,wt.sibling),ie=p(wt,ke.props),ie.ref=i_(_e,wt,ke),ie.return=_e,_e=ie;break e}o(_e,wt);break}else t(_e,wt);wt=wt.sibling}ke.type===up?(ie=Gd(ke.props.children,_e.mode,ot,ke.key),ie.return=_e,_e=ie):(ot=Mx(ke.type,ke.key,ke.props,null,_e.mode,ot),ot.ref=i_(_e,ie,ke),ot.return=_e,_e=ot)}return T(_e);case cp:e:{for(wt=ke.key;ie!==null;){if(ie.key===wt)if(ie.tag===4&&ie.stateNode.containerInfo===ke.containerInfo&&ie.stateNode.implementation===ke.implementation){o(_e,ie.sibling),ie=p(ie,ke.children||[]),ie.return=_e,_e=ie;break e}else{o(_e,ie);break}else t(_e,ie);ie=ie.sibling}ie=SE(ke,_e.mode,ot),ie.return=_e,_e=ie}return T(_e);case eh:return wt=ke._init,Ne(_e,ie,wt(ke._payload),ot)}if(Rg(ke))return xe(_e,ie,ke,ot);if(Mg(ke))return pe(_e,ie,ke,ot);sx(_e,ke)}return typeof ke=="string"&&ke!==""||typeof ke=="number"?(ke=""+ke,ie!==null&&ie.tag===6?(o(_e,ie.sibling),ie=p(ie,ke),ie.return=_e,_e=ie):(o(_e,ie),ie=EE(ke,_e.mode,ot),ie.return=_e,_e=ie),T(_e)):o(_e,ie)}return Ne}var Ip=cM(!0),uM=cM(!1),ax=ch(null),lx=null,Ap=null,zT=null;function DT(){zT=Ap=lx=null}function OT(e){var t=ax.current;so(ax),e._currentValue=t}function FT(e,t,o){for(;e!==null;){var u=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,u!==null&&(u.childLanes|=t)):u!==null&&(u.childLanes&t)!==t&&(u.childLanes|=t),e===o)break;e=e.return}}function Pp(e,t){lx=e,zT=Ap=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Sa=!0),e.firstContext=null)}function ul(e){var t=e._currentValue;if(zT!==e)if(e={context:e,memoizedValue:t,next:null},Ap===null){if(lx===null)throw Error(mr(308));Ap=e,lx.dependencies={lanes:0,firstContext:e}}else Ap=Ap.next=e;return t}var Od=null;function NT(e){Od===null?Od=[e]:Od.push(e)}function hM(e,t,o,u){var p=t.interleaved;return p===null?(o.next=o,NT(t)):(o.next=p.next,p.next=o),t.interleaved=o,gu(e,u)}function gu(e,t){e.lanes|=t;var o=e.alternate;for(o!==null&&(o.lanes|=t),o=e,e=e.return;e!==null;)e.childLanes|=t,o=e.alternate,o!==null&&(o.childLanes|=t),o=e,e=e.return;return o.tag===3?o.stateNode:null}var dh=!1;function BT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dM(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function _u(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fh(e,t,o){var u=e.updateQueue;if(u===null)return null;if(u=u.shared,In&2){var p=u.pending;return p===null?t.next=t:(t.next=p.next,p.next=t),u.pending=t,gu(e,o)}return p=u.interleaved,p===null?(t.next=t,NT(u)):(t.next=p.next,p.next=t),u.interleaved=t,gu(e,o)}function cx(e,t,o){if(t=t.updateQueue,t!==null&&(t=t.shared,(o&4194240)!==0)){var u=t.lanes;u&=e.pendingLanes,o|=u,t.lanes=o,Q2(e,o)}}function fM(e,t){var o=e.updateQueue,u=e.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var T={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};y===null?p=y=T:y=y.next=T,o=o.next}while(o!==null);y===null?p=y=t:y=y.next=t}else p=y=t;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:y,shared:u.shared,effects:u.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=t:e.next=t,o.lastBaseUpdate=t}function ux(e,t,o,u){var p=e.updateQueue;dh=!1;var y=p.firstBaseUpdate,T=p.lastBaseUpdate,s=p.shared.pending;if(s!==null){p.shared.pending=null;var M=s,L=M.next;M.next=null,T===null?y=L:T.next=L,T=M;var B=e.alternate;B!==null&&(B=B.updateQueue,s=B.lastBaseUpdate,s!==T&&(s===null?B.firstBaseUpdate=L:s.next=L,B.lastBaseUpdate=M))}if(y!==null){var H=p.baseState;T=0,B=L=M=null,s=y;do{var $=s.lane,te=s.eventTime;if((u&$)===$){B!==null&&(B=B.next={eventTime:te,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var xe=e,pe=s;switch($=t,te=o,pe.tag){case 1:if(xe=pe.payload,typeof xe=="function"){H=xe.call(te,H,$);break e}H=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=pe.payload,$=typeof xe=="function"?xe.call(te,H,$):xe,$==null)break e;H=go({},H,$);break e;case 2:dh=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,$=p.effects,$===null?p.effects=[s]:$.push(s))}else te={eventTime:te,lane:$,tag:s.tag,payload:s.payload,callback:s.callback,next:null},B===null?(L=B=te,M=H):B=B.next=te,T|=$;if(s=s.next,s===null){if(s=p.shared.pending,s===null)break;$=s,s=$.next,$.next=null,p.lastBaseUpdate=$,p.shared.pending=null}}while(!0);if(B===null&&(M=H),p.baseState=M,p.firstBaseUpdate=L,p.lastBaseUpdate=B,t=p.shared.interleaved,t!==null){p=t;do T|=p.lane,p=p.next;while(p!==t)}else y===null&&(p.shared.lanes=0);Bd|=T,e.lanes=T,e.memoizedState=H}}function pM(e,t,o){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var u=e[t],p=u.callback;if(p!==null){if(u.callback=null,u=o,typeof p!="function")throw Error(mr(191,p));p.call(u)}}}var n_={},xc=ch(n_),o_=ch(n_),s_=ch(n_);function Fd(e){if(e===n_)throw Error(mr(174));return e}function VT(e,t){switch(Xn(s_,t),Xn(o_,e),Xn(xc,n_),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:U2(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=U2(t,e)}so(xc),Xn(xc,t)}function Mp(){so(xc),so(o_),so(s_)}function mM(e){Fd(s_.current);var t=Fd(xc.current),o=U2(t,e.type);t!==o&&(Xn(o_,e),Xn(xc,o))}function UT(e){o_.current===e&&(so(xc),so(o_))}var _o=ch(0);function hx(e){for(var t=e;t!==null;){if(t.tag===13){var o=t.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var jT=[];function GT(){for(var e=0;e<jT.length;e++)jT[e]._workInProgressVersionPrimary=null;jT.length=0}var dx=hu.ReactCurrentDispatcher,$T=hu.ReactCurrentBatchConfig,Nd=0,yo=null,Zo=null,rs=null,fx=!1,a_=!1,l_=0,d9=0;function ks(){throw Error(mr(321))}function HT(e,t){if(t===null)return!1;for(var o=0;o<t.length&&o<e.length;o++)if(!Vl(e[o],t[o]))return!1;return!0}function qT(e,t,o,u,p,y){if(Nd=y,yo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,dx.current=e===null||e.memoizedState===null?g9:_9,e=o(u,p),a_){y=0;do{if(a_=!1,l_=0,25<=y)throw Error(mr(301));y+=1,rs=Zo=null,t.updateQueue=null,dx.current=y9,e=o(u,p)}while(a_)}if(dx.current=gx,t=Zo!==null&&Zo.next!==null,Nd=0,rs=Zo=yo=null,fx=!1,t)throw Error(mr(300));return e}function ZT(){var e=l_!==0;return l_=0,e}function bc(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rs===null?yo.memoizedState=rs=e:rs=rs.next=e,rs}function hl(){if(Zo===null){var e=yo.alternate;e=e!==null?e.memoizedState:null}else e=Zo.next;var t=rs===null?yo.memoizedState:rs.next;if(t!==null)rs=t,Zo=e;else{if(e===null)throw Error(mr(310));Zo=e,e={memoizedState:Zo.memoizedState,baseState:Zo.baseState,baseQueue:Zo.baseQueue,queue:Zo.queue,next:null},rs===null?yo.memoizedState=rs=e:rs=rs.next=e}return rs}function c_(e,t){return typeof t=="function"?t(e):t}function WT(e){var t=hl(),o=t.queue;if(o===null)throw Error(mr(311));o.lastRenderedReducer=e;var u=Zo,p=u.baseQueue,y=o.pending;if(y!==null){if(p!==null){var T=p.next;p.next=y.next,y.next=T}u.baseQueue=p=y,o.pending=null}if(p!==null){y=p.next,u=u.baseState;var s=T=null,M=null,L=y;do{var B=L.lane;if((Nd&B)===B)M!==null&&(M=M.next={lane:0,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),u=L.hasEagerState?L.eagerState:e(u,L.action);else{var H={lane:B,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null};M===null?(s=M=H,T=u):M=M.next=H,yo.lanes|=B,Bd|=B}L=L.next}while(L!==null&&L!==y);M===null?T=u:M.next=s,Vl(u,t.memoizedState)||(Sa=!0),t.memoizedState=u,t.baseState=T,t.baseQueue=M,o.lastRenderedState=u}if(e=o.interleaved,e!==null){p=e;do y=p.lane,yo.lanes|=y,Bd|=y,p=p.next;while(p!==e)}else p===null&&(o.lanes=0);return[t.memoizedState,o.dispatch]}function XT(e){var t=hl(),o=t.queue;if(o===null)throw Error(mr(311));o.lastRenderedReducer=e;var u=o.dispatch,p=o.pending,y=t.memoizedState;if(p!==null){o.pending=null;var T=p=p.next;do y=e(y,T.action),T=T.next;while(T!==p);Vl(y,t.memoizedState)||(Sa=!0),t.memoizedState=y,t.baseQueue===null&&(t.baseState=y),o.lastRenderedState=y}return[y,u]}function gM(){}function _M(e,t){var o=yo,u=hl(),p=t(),y=!Vl(u.memoizedState,p);if(y&&(u.memoizedState=p,Sa=!0),u=u.queue,YT(xM.bind(null,o,u,e),[e]),u.getSnapshot!==t||y||rs!==null&&rs.memoizedState.tag&1){if(o.flags|=2048,u_(9,vM.bind(null,o,u,p,t),void 0,null),is===null)throw Error(mr(349));
vendor: 4,230 bytes, line 39
39Nd&30||yM(o,t,p)}return p}function yM(e,t,o){e.flags|=16384,e={getSnapshot:t,value:o},t=yo.updateQueue,t===null?(t={lastEffect:null,stores:null},yo.updateQueue=t,t.stores=[e]):(o=t.stores,o===null?t.stores=[e]:o.push(e))}function vM(e,t,o,u){t.value=o,t.getSnapshot=u,bM(t)&&wM(e)}function xM(e,t,o){return o(function(){bM(t)&&wM(e)})}function bM(e){var t=e.getSnapshot;e=e.value;try{var o=t();return!Vl(e,o)}catch{return!0}}function wM(e){var t=gu(e,1);t!==null&&Hl(t,e,1,-1)}function TM(e){var t=bc();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c_,lastRenderedState:e},t.queue=e,e=e.dispatch=m9.bind(null,yo,e),[t.memoizedState,e]}function u_(e,t,o,u){return e={tag:e,create:t,destroy:o,deps:u,next:null},t=yo.updateQueue,t===null?(t={lastEffect:null,stores:null},yo.updateQueue=t,t.lastEffect=e.next=e):(o=t.lastEffect,o===null?t.lastEffect=e.next=e:(u=o.next,o.next=e,e.next=u,t.lastEffect=e)),e}function EM(){return hl().memoizedState}function px(e,t,o,u){var p=bc();yo.flags|=e,p.memoizedState=u_(1|t,o,void 0,u===void 0?null:u)}function mx(e,t,o,u){var p=hl();u=u===void 0?null:u;var y=void 0;if(Zo!==null){var T=Zo.memoizedState;if(y=T.destroy,u!==null&&HT(u,T.deps)){p.memoizedState=u_(t,o,y,u);return}}yo.flags|=e,p.memoizedState=u_(1|t,o,y,u)}function SM(e,t){return px(8390656,8,e,t)}function YT(e,t){return mx(2048,8,e,t)}function CM(e,t){return mx(4,2,e,t)}function IM(e,t){return mx(4,4,e,t)}function AM(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function PM(e,t,o){return o=o!=null?o.concat([e]):null,mx(4,4,AM.bind(null,t,e),o)}function KT(){}function MM(e,t){var o=hl();t=t===void 0?null:t;var u=o.memoizedState;return u!==null&&t!==null&&HT(t,u[1])?u[0]:(o.memoizedState=[e,t],e)}function kM(e,t){var o=hl();t=t===void 0?null:t;var u=o.memoizedState;return u!==null&&t!==null&&HT(t,u[1])?u[0]:(e=e(),o.memoizedState=[e,t],e)}function RM(e,t,o){return Nd&21?(Vl(o,t)||(o=lP(),yo.lanes|=o,Bd|=o,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Sa=!0),e.memoizedState=o)}function f9(e,t){var o=Bn;Bn=o!==0&&4>o?o:4,e(!0);var u=$T.transition;$T.transition={};try{e(!1),t()}finally{Bn=o,$T.transition=u}}function LM(){return hl().memoizedState}function p9(e,t,o){var u=_h(e);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},zM(e))DM(t,o);else if(o=hM(e,t,o,u),o!==null){var p=Qs();Hl(o,e,u,p),OM(o,t,u)}}function m9(e,t,o){var u=_h(e),p={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(zM(e))DM(t,p);else{var y=e.alternate;if(e.lanes===0&&(y===null||y.lanes===0)&&(y=t.lastRenderedReducer,y!==null))try{var T=t.lastRenderedState,s=y(T,o);if(p.hasEagerState=!0,p.eagerState=s,Vl(s,T)){var M=t.interleaved;M===null?(p.next=p,NT(t)):(p.next=M.next,M.next=p),t.interleaved=p;return}}catch{}finally{}o=hM(e,t,p,u),o!==null&&(p=Qs(),Hl(o,e,u,p),OM(o,t,u))}}function zM(e){var t=e.alternate;return e===yo||t!==null&&t===yo}function DM(e,t){a_=fx=!0;var o=e.pending;o===null?t.next=t:(t.next=o.next,o.next=t),e.pending=t}function OM(e,t,o){if(o&4194240){var u=t.lanes;u&=e.pendingLanes,o|=u,t.lanes=o,Q2(e,o)}}var gx={readContext:ul,useCallback:ks,useContext:ks,useEffect:ks,useImperativeHandle:ks,useInsertionEffect:ks,useLayoutEffect:ks,useMemo:ks,useReducer:ks,useRef:ks,useState:ks,useDebugValue:ks,useDeferredValue:ks,useTransition:ks,useMutableSource:ks,useSyncExternalStore:ks,useId:ks,unstable_isNewReconciler:!1},g9={readContext:ul,useCallback:function(e,t){return bc().memoizedState=[e,t===void 0?null:t],e},useContext:ul,useEffect:SM,useImperativeHandle:function(e,t,o){return o=o!=null?o.concat([e]):null,px(4194308,4,AM.bind(null,t,e),o)},useLayoutEffect:function(e,t){return px(4194308,4,e,t)},useInsertionEffect:function(e,t){return px(4,2,e,t)},useMemo:function(e,t){var o=bc();return t=t===void 0?null:t,e=e(),o.memoizedState=[e,t],e},useReducer:function(e,t,o){var u=bc();return t=o!==void 0?o(t):t,u.memoizedState=u.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},u.queue=e,e=e.dispatch=p9.bind(null,yo,e),[u.memoizedState,e]}
vendor: 4,634 bytes, lines 39-41
39,useRef:function(e){var t=bc();return e={current:e},t.memoizedState=e},useState:TM,useDebugValue:KT,useDeferredValue:function(e){return bc().memoizedState=e},useTransition:function(){var e=TM(!1),t=e[0];return e=f9.bind(null,e[1]),bc().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,o){var u=yo,p=bc();if(uo){if(o===void 0)throw Error(mr(407));o=o()}else{if(o=t(),is===null)throw Error(mr(349));Nd&30||yM(u,t,o)}p.memoizedState=o;var y={value:o,getSnapshot:t};return p.queue=y,SM(xM.bind(null,u,y,e),[e]),u.flags|=2048,u_(9,vM.bind(null,u,y,o,t),void 0,null),o},useId:function(){var e=bc(),t=is.identifierPrefix;if(uo){var o=mu,u=pu;o=(u&~(1<<32-Bl(u)-1)).toString(32)+o,t=":"+t+"R"+o,o=l_++,0<o&&(t+="H"+o.toString(32)),t+=":"}else o=d9++,t=":"+t+"r"+o.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},_9={readContext:ul,useCallback:MM,useContext:ul,useEffect:YT,useImperativeHandle:PM,useInsertionEffect:CM,useLayoutEffect:IM,useMemo:kM,useReducer:WT,useRef:EM,useState:function(){return WT(c_)},useDebugValue:KT,useDeferredValue:function(e){var t=hl();return RM(t,Zo.memoizedState,e)},useTransition:function(){var e=WT(c_)[0],t=hl().memoizedState;return[e,t]},useMutableSource:gM,useSyncExternalStore:_M,useId:LM,unstable_isNewReconciler:!1},y9={readContext:ul,useCallback:MM,useContext:ul,useEffect:YT,useImperativeHandle:PM,useInsertionEffect:CM,useLayoutEffect:IM,useMemo:kM,useReducer:XT,useRef:EM,useState:function(){return XT(c_)},useDebugValue:KT,useDeferredValue:function(e){var t=hl();return Zo===null?t.memoizedState=e:RM(t,Zo.memoizedState,e)},useTransition:function(){var e=XT(c_)[0],t=hl().memoizedState;return[e,t]},useMutableSource:gM,useSyncExternalStore:_M,useId:LM,unstable_isNewReconciler:!1};function jl(e,t){if(e&&e.defaultProps){t=go({},t),e=e.defaultProps;for(var o in e)t[o]===void 0&&(t[o]=e[o]);return t}return t}function JT(e,t,o,u){t=e.memoizedState,o=o(u,t),o=o==null?t:go({},t,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var _x={isMounted:function(e){return(e=e._reactInternals)?kd(e)===e:!1},enqueueSetState:function(e,t,o){e=e._reactInternals;var u=Qs(),p=_h(e),y=_u(u,p);y.payload=t,o!=null&&(y.callback=o),t=fh(e,y,p),t!==null&&(Hl(t,e,p,u),cx(t,e,p))},enqueueReplaceState:function(e,t,o){e=e._reactInternals;var u=Qs(),p=_h(e),y=_u(u,p);y.tag=1,y.payload=t,o!=null&&(y.callback=o),t=fh(e,y,p),t!==null&&(Hl(t,e,p,u),cx(t,e,p))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var o=Qs(),u=_h(e),p=_u(o,u);p.tag=2,t!=null&&(p.callback=t),t=fh(e,p,u),t!==null&&(Hl(t,e,u,o),cx(t,e,u))}};function FM(e,t,o,u,p,y,T){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(u,y,T):t.prototype&&t.prototype.isPureReactComponent?!Yg(o,u)||!Yg(p,y):!0}function NM(e,t,o){var u=!1,p=uh,y=t.contextType;return typeof y=="object"&&y!==null?y=ul(y):(p=Ea(t)?Ld:Ms.current,u=t.contextTypes,y=(u=u!=null)?Tp(e,p):uh),t=new t(o,y),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=_x,e.stateNode=t,t._reactInternals=e,u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=p,e.__reactInternalMemoizedMaskedChildContext=y),t}function BM(e,t,o,u){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(o,u),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(o,u),t.state!==e&&_x.enqueueReplaceState(t,t.state,null)}function QT(e,t,o,u){var p=e.stateNode;p.props=o,p.state=e.memoizedState,p.refs={},BT(e);var y=t.contextType;typeof y=="object"&&y!==null?p.context=ul(y):(y=Ea(t)?Ld:Ms.current,p.context=Tp(e,y)),p.state=e.memoizedState,y=t.getDerivedStateFromProps,typeof y=="function"&&(JT(e,t,y,o),p.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(t=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),t!==p.state&&_x.enqueueReplaceState(p,p.state,null),ux(e,o,p,u),p.state=e.memoizedState),typeof p.componentDidMount=="function"&&(e.flags|=4194308)}function kp(e,t){try{var o="",u=t;do o+=qG(u),u=u.return;while(u);var p=o}catch(y){p=`
40Error generating stack: `+y.message+`
41`+y.stack}return{value:e,source:t,stack:p,digest:null}}function eE(e,t,o){return{value:e,source:null,stack:o??null,digest:t??null}}function tE(e,t){try{console.error(t.value)}catch(o){setTimeout(function(){throw o})}}var v9=typeof WeakMap=="function"?WeakMap:Map;
vendor: 17,466 bytes, line 41
41function VM(e,t,o){o=_u(-1,o),o.tag=3,o.payload={element:null};var u=t.value;return o.callback=function(){Ex||(Ex=!0,gE=u),tE(e,t)},o}function UM(e,t,o){o=_u(-1,o),o.tag=3;var u=e.type.getDerivedStateFromError;if(typeof u=="function"){var p=t.value;o.payload=function(){return u(p)},o.callback=function(){tE(e,t)}}var y=e.stateNode;return y!==null&&typeof y.componentDidCatch=="function"&&(o.callback=function(){tE(e,t),typeof u!="function"&&(mh===null?mh=new Set([this]):mh.add(this));var T=t.stack;this.componentDidCatch(t.value,{componentStack:T!==null?T:""})}),o}function jM(e,t,o){var u=e.pingCache;if(u===null){u=e.pingCache=new v9;var p=new Set;u.set(t,p)}else p=u.get(t),p===void 0&&(p=new Set,u.set(t,p));p.has(o)||(p.add(o),e=L9.bind(null,e,t,o),t.then(e,e))}function GM(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function $M(e,t,o,u,p){return e.mode&1?(e.flags|=65536,e.lanes=p,e):(e===t?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(t=_u(-1,1),t.tag=2,fh(o,t,1))),o.lanes|=1),e)}var x9=hu.ReactCurrentOwner,Sa=!1;function Js(e,t,o,u){t.child=e===null?uM(t,null,o,u):Ip(t,e.child,o,u)}function HM(e,t,o,u,p){o=o.render;var y=t.ref;return Pp(t,p),u=qT(e,t,o,u,y,p),o=ZT(),e!==null&&!Sa?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~p,yu(e,t,p)):(uo&&o&&PT(t),t.flags|=1,Js(e,t,u,p),t.child)}function qM(e,t,o,u,p){if(e===null){var y=o.type;return typeof y=="function"&&!TE(y)&&y.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(t.tag=15,t.type=y,ZM(e,t,y,u,p)):(e=Mx(o.type,null,u,t,t.mode,p),e.ref=t.ref,e.return=t,t.child=e)}if(y=e.child,!(e.lanes&p)){var T=y.memoizedProps;if(o=o.compare,o=o!==null?o:Yg,o(T,u)&&e.ref===t.ref)return yu(e,t,p)}return t.flags|=1,e=vh(y,u),e.ref=t.ref,e.return=t,t.child=e}function ZM(e,t,o,u,p){if(e!==null){var y=e.memoizedProps;if(Yg(y,u)&&e.ref===t.ref)if(Sa=!1,t.pendingProps=u=y,(e.lanes&p)!==0)e.flags&131072&&(Sa=!0);else return t.lanes=e.lanes,yu(e,t,p)}return rE(e,t,o,u,p)}function WM(e,t,o){var u=t.pendingProps,p=u.children,y=e!==null?e.memoizedState:null;if(u.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xn(Lp,Xa),Xa|=o;else{if(!(o&1073741824))return e=y!==null?y.baseLanes|o:o,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Xn(Lp,Xa),Xa|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=y!==null?y.baseLanes:o,Xn(Lp,Xa),Xa|=u}else y!==null?(u=y.baseLanes|o,t.memoizedState=null):u=o,Xn(Lp,Xa),Xa|=u;return Js(e,t,p,o),t.child}function XM(e,t){var o=t.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(t.flags|=512,t.flags|=2097152)}function rE(e,t,o,u,p){var y=Ea(o)?Ld:Ms.current;return y=Tp(t,y),Pp(t,p),o=qT(e,t,o,u,y,p),u=ZT(),e!==null&&!Sa?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~p,yu(e,t,p)):(uo&&u&&PT(t),t.flags|=1,Js(e,t,o,p),t.child)}function YM(e,t,o,u,p){if(Ea(o)){var y=!0;tx(t)}else y=!1;if(Pp(t,p),t.stateNode===null)vx(e,t),NM(t,o,u),QT(t,o,u,p),u=!0;else if(e===null){var T=t.stateNode,s=t.memoizedProps;T.props=s;var M=T.context,L=o.contextType;typeof L=="object"&&L!==null?L=ul(L):(L=Ea(o)?Ld:Ms.current,L=Tp(t,L));var B=o.getDerivedStateFromProps,H=typeof B=="function"||typeof T.getSnapshotBeforeUpdate=="function";H||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(s!==u||M!==L)&&BM(t,T,u,L),dh=!1;var $=t.memoizedState;T.state=$,ux(t,u,T,p),M=t.memoizedState,s!==u||$!==M||Ta.current||dh?(typeof B=="function"&&(JT(t,o,B,u),M=t.memoizedState),(s=dh||FM(t,o,s,u,$,M,L))?(H||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(t.flags|=4194308)):(typeof T.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=u,t.memoizedState=M),T.props=u,T.state=M,T.context=L,u=s):(typeof T.componentDidMount=="function"&&(t.flags|=4194308),u=!1)}else{T=t.stateNode,dM(e,t),s=t.memoizedProps,L=t.type===t.elementType?s:jl(t.type,s),T.props=L,H=t.pendingProps,$=T.context,M=o.contextType,typeof M=="object"&&M!==null?M=ul(M):(M=Ea(o)?Ld:Ms.current,M=Tp(t,M));var te=o.getDerivedStateFromProps;(B=typeof te=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(s!==H||$!==M)&&BM(t,T,u,M),dh=!1,$=t.memoizedState,T.state=$,ux(t,u,T,p);var xe=t.memoizedState;s!==H||$!==xe||Ta.current||dh?(typeof te=="function"&&(JT(t,o,te,u),xe=t.memoizedState),(L=dh||FM(t,o,L,u,$,xe,M)||!1)?(B||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(u,xe,M),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(u,xe,M)),typeof T.componentDidUpdate=="function"&&(t.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof T.componentDidUpdate!="function"||s===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),t.memoizedProps=u,t.memoizedState=xe),T.props=u,T.state=xe,T.context=M,u=L):(typeof T.componentDidUpdate!="function"||s===e.memoizedProps&&$===e.memoizedState||(t.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&$===e.memoizedState||(t.flags|=1024),u=!1)}return iE(e,t,o,u,y,p)}function iE(e,t,o,u,p,y){XM(e,t);var T=(t.flags&128)!==0;if(!u&&!T)return p&&tM(t,o,!1),yu(e,t,y);u=t.stateNode,x9.current=t;var s=T&&typeof o.getDerivedStateFromError!="function"?null:u.render();return t.flags|=1,e!==null&&T?(t.child=Ip(t,e.child,null,y),t.child=Ip(t,null,s,y)):Js(e,t,s,y),t.memoizedState=u.state,p&&tM(t,o,!0),t.child}function KM(e){var t=e.stateNode;t.pendingContext?QP(e,t.pendingContext,t.pendingContext!==t.context):t.context&&QP(e,t.context,!1),VT(e,t.containerInfo)}function JM(e,t,o,u,p){return Cp(),LT(p),t.flags|=256,Js(e,t,o,u),t.child}var nE={dehydrated:null,treeContext:null,retryLane:0};function oE(e){return{baseLanes:e,cachePool:null,transitions:null}}function QM(e,t,o){var u=t.pendingProps,p=_o.current,y=!1,T=(t.flags&128)!==0,s;if((s=T)||(s=e!==null&&e.memoizedState===null?!1:(p&2)!==0),s?(y=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(p|=1),Xn(_o,p&1),e===null)return RT(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(T=u.children,e=u.fallback,y?(u=t.mode,y=t.child,T={mode:"hidden",children:T},!(u&1)&&y!==null?(y.childLanes=0,y.pendingProps=T):y=kx(T,u,0,null),e=Gd(e,u,o,null),y.return=t,e.return=t,y.sibling=e,t.child=y,t.child.memoizedState=oE(o),t.memoizedState=nE,e):sE(t,T));if(p=e.memoizedState,p!==null&&(s=p.dehydrated,s!==null))return b9(e,t,T,u,s,p,o);if(y){y=u.fallback,T=t.mode,p=e.child,s=p.sibling;var M={mode:"hidden",children:u.children};return!(T&1)&&t.child!==p?(u=t.child,u.childLanes=0,u.pendingProps=M,t.deletions=null):(u=vh(p,M),u.subtreeFlags=p.subtreeFlags&14680064),s!==null?y=vh(s,y):(y=Gd(y,T,o,null),y.flags|=2),y.return=t,u.return=t,u.sibling=y,t.child=u,u=y,y=t.child,T=e.child.memoizedState,T=T===null?oE(o):{baseLanes:T.baseLanes|o,cachePool:null,transitions:T.transitions},y.memoizedState=T,y.childLanes=e.childLanes&~o,t.memoizedState=nE,u}return y=e.child,e=y.sibling,u=vh(y,{mode:"visible",children:u.children}),!(t.mode&1)&&(u.lanes=o),u.return=t,u.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=u,t.memoizedState=null,u}function sE(e,t){return t=kx({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function yx(e,t,o,u){return u!==null&&LT(u),Ip(t,e.child,null,o),e=sE(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function b9(e,t,o,u,p,y,T){if(o)return t.flags&256?(t.flags&=-257,u=eE(Error(mr(422))),yx(e,t,T,u)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(y=u.fallback,p=t.mode,u=kx({mode:"visible",children:u.children},p,0,null),y=Gd(y,p,T,null),y.flags|=2,u.return=t,y.return=t,u.sibling=y,t.child=u,t.mode&1&&Ip(t,e.child,null,T),t.child.memoizedState=oE(T),t.memoizedState=nE,y);if(!(t.mode&1))return yx(e,t,T,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var s=u.dgst;return u=s,y=Error(mr(419)),u=eE(y,u,void 0),yx(e,t,T,u)}if(s=(T&e.childLanes)!==0,Sa||s){if(u=is,u!==null){switch(T&-T){case 4:p=2;break;case 16:p=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}p=p&(u.suspendedLanes|T)?0:p,p!==0&&p!==y.retryLane&&(y.retryLane=p,gu(e,p),Hl(u,e,p,-1))}return wE(),u=eE(Error(mr(421))),yx(e,t,T,u)}return p.data==="$?"?(t.flags|=128,t.child=e.child,t=z9.bind(null,e),p._reactRetry=t,null):(e=y.treeContext,Wa=lh(p.nextSibling),Za=t,uo=!0,Ul=null,e!==null&&(ll[cl++]=pu,ll[cl++]=mu,ll[cl++]=zd,pu=e.id,mu=e.overflow,zd=t),t=sE(t,u.children),t.flags|=4096,t)}function ek(e,t,o){e.lanes|=t;var u=e.alternate;u!==null&&(u.lanes|=t),FT(e.return,t,o)}function aE(e,t,o,u,p){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:p}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=u,y.tail=o,y.tailMode=p)}function tk(e,t,o){var u=t.pendingProps,p=u.revealOrder,y=u.tail;if(Js(e,t,u.children,o),u=_o.current,u&2)u=u&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ek(e,o,t);else if(e.tag===19)ek(e,o,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}u&=1}if(Xn(_o,u),!(t.mode&1))t.memoizedState=null;else switch(p){case"forwards":for(o=t.child,p=null;o!==null;)e=o.alternate,e!==null&&hx(e)===null&&(p=o),o=o.sibling;o=p,o===null?(p=t.child,t.child=null):(p=o.sibling,o.sibling=null),aE(t,!1,p,o,y);break;case"backwards":for(o=null,p=t.child,t.child=null;p!==null;){if(e=p.alternate,e!==null&&hx(e)===null){t.child=p;break}e=p.sibling,p.sibling=o,o=p,p=e}aE(t,!0,o,null,y);break;case"together":aE(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function vx(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function yu(e,t,o){if(e!==null&&(t.dependencies=e.dependencies),Bd|=t.lanes,!(o&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(mr(153));if(t.child!==null){for(e=t.child,o=vh(e,e.pendingProps),t.child=o,o.return=t;e.sibling!==null;)e=e.sibling,o=o.sibling=vh(e,e.pendingProps),o.return=t;o.sibling=null}return t.child}function w9(e,t,o){switch(t.tag){case 3:KM(t),Cp();break;case 5:mM(t);break;case 1:Ea(t.type)&&tx(t);break;case 4:VT(t,t.stateNode.containerInfo);break;case 10:var u=t.type._context,p=t.memoizedProps.value;Xn(ax,u._currentValue),u._currentValue=p;break;case 13:if(u=t.memoizedState,u!==null)return u.dehydrated!==null?(Xn(_o,_o.current&1),t.flags|=128,null):o&t.child.childLanes?QM(e,t,o):(Xn(_o,_o.current&1),e=yu(e,t,o),e!==null?e.sibling:null);Xn(_o,_o.current&1);break;case 19:if(u=(o&t.childLanes)!==0,e.flags&128){if(u)return tk(e,t,o);t.flags|=128}if(p=t.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),Xn(_o,_o.current),u)break;return null;case 22:case 23:return t.lanes=0,WM(e,t,o)}return yu(e,t,o)}var rk,lE,ik,nk;rk=function(e,t){for(var o=t.child;o!==null;){if(o.tag===5||o.tag===6)e.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},lE=function(){},ik=function(e,t,o,u){var p=e.memoizedProps;if(p!==u){e=t.stateNode,Fd(xc.current);var y=null;switch(o){case"input":p=F2(e,p),u=F2(e,u),y=[];break;case"select":p=go({},p,{value:void 0}),u=go({},u,{value:void 0}),y=[];break;case"textarea":p=V2(e,p),u=V2(e,u),y=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(e.onclick=Jv)}j2(o,u);var T;o=null;for(L in p)if(!u.hasOwnProperty(L)&&p.hasOwnProperty(L)&&p[L]!=null)if(L==="style"){var s=p[L];for(T in s)s.hasOwnProperty(T)&&(o||(o={}),o[T]="")}else L!=="dangerouslySetInnerHTML"&&L!=="children"&&L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&L!=="autoFocus"&&(Pg.hasOwnProperty(L)?y||(y=[]):(y=y||[]).push(L,null));for(L in u){var M=u[L];if(s=p!=null?p[L]:void 0,u.hasOwnProperty(L)&&M!==s&&(M!=null||s!=null))if(L==="style")if(s){for(T in s)!s.hasOwnProperty(T)||M&&M.hasOwnProperty(T)||(o||(o={}),o[T]="");for(T in M)M.hasOwnProperty(T)&&s[T]!==M[T]&&(o||(o={}),o[T]=M[T])}else o||(y||(y=[]),y.push(L,o)),o=M;else L==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,s=s?s.__html:void 0,M!=null&&s!==M&&(y=y||[]).push(L,M)):L==="children"?typeof M!="string"&&typeof M!="number"||(y=y||[]).push(L,""+M):L!=="suppressContentEditableWarning"&&L!=="suppressHydrationWarning"&&(Pg.hasOwnProperty(L)?(M!=null&&L==="onScroll"&&oo("scroll",e),y||s===M||(y=[])):(y=y||[]).push(L,M))}o&&(y=y||[]).push("style",o);var L=y;(t.updateQueue=L)&&(t.flags|=4)}},nk=function(e,t,o,u){o!==u&&(t.flags|=4)};function h_(e,t){if(!uo)switch(e.tailMode){case"hidden":t=e.tail;for(var o=null;t!==null;)t.alternate!==null&&(o=t),t=t.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:u.sibling=null}}function Rs(e){var t=e.alternate!==null&&e.alternate.child===e.child,o=0,u=0;if(t)for(var p=e.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=e,p=p.sibling;else for(p=e.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=e,p=p.sibling;return e.subtreeFlags|=u,e.childLanes=o,t}function T9(e,t,o){var u=t.pendingProps;switch(MT(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rs(t),null;case 1:return Ea(t.type)&&ex(),Rs(t),null;case 3:return u=t.stateNode,Mp(),so(Ta),so(Ms),GT(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(e===null||e.child===null)&&(ox(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ul!==null&&(vE(Ul),Ul=null))),lE(e,t),Rs(t),null;case 5:UT(t);var p=Fd(s_.current);if(o=t.type,e!==null&&t.stateNode!=null)ik(e,t,o,u,p),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!u){if(t.stateNode===null)throw Error(mr(166));return Rs(t),null}if(e=Fd(xc.current),ox(t)){u=t.stateNode,o=t.type;var y=t.memoizedProps;switch(u[vc]=t,u[t_]=y,e=(t.mode&1)!==0,o){case"dialog":oo("cancel",u),oo("close",u);break;case"iframe":case"object":case"embed":oo("load",u);break;case"video":case"audio":for(p=0;p<Jg.length;p++)oo(Jg[p],u);break;case"source":oo("error",u);break;case"img":case"image":case"link":oo("error",u),oo("load",u);break;case"details":oo("toggle",u);break;case"input":N3(u,y),oo("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!y.multiple},oo("invalid",u);break;case"textarea":U3(u,y),oo("invalid",u)}j2(o,y),p=null;for(var T in y)if(y.hasOwnProperty(T)){var s=y[T];T==="children"?typeof s=="string"?u.textContent!==s&&(y.suppressHydrationWarning!==!0&&Kv(u.textContent,s,e),p=["children",s]):typeof s=="number"&&u.textContent!==""+s&&(y.suppressHydrationWarning!==!0&&Kv(u.textContent,s,e),p=["children",""+s]):Pg.hasOwnProperty(T)&&s!=null&&T==="onScroll"&&oo("scroll",u)}switch(o){case"input":Av(u),V3(u,y,!0);break;case"textarea":Av(u),G3(u);break;case"select":case"option":break;default:typeof y.onClick=="function"&&(u.onclick=Jv)}u=p,t.updateQueue=u,u!==null&&(t.flags|=4)}else{T=p.nodeType===9?p:p.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=$3(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=T.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof u.is=="string"?e=T.createElement(o,{is:u.is}):(e=T.createElement(o),o==="select"&&(T=e,u.multiple?T.multiple=!0:u.size&&(T.size=u.size))):e=T.createElementNS(e,o),e[vc]=t,e[t_]=u,rk(e,t,!1,!1),t.stateNode=e;e:{switch(T=G2(o,u),o){case"dialog":oo("cancel",e),oo("close",e),p=u;break;case"iframe":case"object":case"embed":oo("load",e),p=u;break;case"video":case"audio":for(p=0;p<Jg.length;p++)oo(Jg[p],e);p=u;break;case"source":oo("error",e),p=u;break;case"img":case"image":case"link":oo("error",e),oo("load",e),p=u;break;case"details":oo("toggle",e),p=u;break;case"input":N3(e,u),p=F2(e,u),oo("invalid",e);break;case"option":p=u;break;case"select":e._wrapperState={wasMultiple:!!u.multiple},p=go({},u,{value:void 0}),oo("invalid",e);break;case"textarea":U3(e,u),p=V2(e,u),oo("invalid",e);break;default:p=u}j2(o,p),s=p;for(y in s)if(s.hasOwnProperty(y)){var M=s[y];y==="style"?Z3(e,M):y==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,M!=null&&H3(e,M)):y==="children"?typeof M=="str
41ing"?(o!=="textarea"||M!=="")&&Lg(e,M):typeof M=="number"&&Lg(e,""+M):y!=="suppressContentEditableWarning"&&y!=="suppressHydrationWarning"&&y!=="autoFocus"&&(Pg.hasOwnProperty(y)?M!=null&&y==="onScroll"&&oo("scroll",e):M!=null&&C2(e,y,M,T))}switch(o){case"input":Av(e),V3(e,u,!1);break;case"textarea":Av(e),G3(e);break;case"option":u.value!=null&&e.setAttribute("value",""+th(u.value));break;case"select":e.multiple=!!u.multiple,y=u.value,y!=null?hp(e,!!u.multiple,y,!1):u.defaultValue!=null&&hp(e,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(e.onclick=Jv)}switch(o){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Rs(t),null;case 6:if(e&&t.stateNode!=null)nk(e,t,e.memoizedProps,u);else{if(typeof u!="string"&&t.stateNode===null)throw Error(mr(166));if(o=Fd(s_.current),Fd(xc.current),ox(t)){if(u=t.stateNode,o=t.memoizedProps,u[vc]=t,(y=u.nodeValue!==o)&&(e=Za,e!==null))switch(e.tag){case 3:Kv(u.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Kv(u.nodeValue,o,(e.mode&1)!==0)}y&&(t.flags|=4)}else u=(o.nodeType===9?o:o.ownerDocument).createTextNode(u),u[vc]=t,t.stateNode=u}return Rs(t),null;case 13:if(so(_o),u=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(uo&&Wa!==null&&t.mode&1&&!(t.flags&128))aM(),Cp(),t.flags|=98560,y=!1;else if(y=ox(t),u!==null&&u.dehydrated!==null){if(e===null){if(!y)throw Error(mr(318));if(y=t.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(mr(317));y[vc]=t}else Cp(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rs(t),y=!1}else Ul!==null&&(vE(Ul),Ul=null),y=!0;if(!y)return t.flags&65536?t:null}return t.flags&128?(t.lanes=o,t):(u=u!==null,u!==(e!==null&&e.memoizedState!==null)&&u&&(t.child.flags|=8192,t.mode&1&&(e===null||_o.current&1?Wo===0&&(Wo=3):wE())),t.updateQueue!==null&&(t.flags|=4),Rs(t),null);case 4:return Mp(),lE(e,t),e===null&&Qg(t.stateNode.containerInfo),Rs(t),null;case 10:return OT(t.type._context),Rs(t),null;case 17:return Ea(t.type)&&ex(),Rs(t),null;case 19:if(so(_o),y=t.memoizedState,y===null)return Rs(t),null;if(u=(t.flags&128)!==0,T=y.rendering,T===null)if(u)h_(y,!1);else{if(Wo!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(T=hx(e),T!==null){for(t.flags|=128,h_(y,!1),u=T.updateQueue,u!==null&&(t.updateQueue=u,t.flags|=4),t.subtreeFlags=0,u=o,o=t.child;o!==null;)y=o,e=u,y.flags&=14680066,T=y.alternate,T===null?(y.childLanes=0,y.lanes=e,y.child=null,y.subtreeFlags=0,y.memoizedProps=null,y.memoizedState=null,y.updateQueue=null,y.dependencies=null,y.stateNode=null):(y.childLanes=T.childLanes,y.lanes=T.lanes,y.child=T.child,y.subtreeFlags=0,y.deletions=null,y.memoizedProps=T.memoizedProps,y.memoizedState=T.memoizedState,y.updateQueue=T.updateQueue,y.type=T.type,e=T.dependencies,y.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return Xn(_o,_o.current&1|2),t.child}e=e.sibling}y.tail!==null&&Mo()>zp&&(t.flags|=128,u=!0,h_(y,!1),t.lanes=4194304)}else{if(!u)if(e=hx(T),e!==null){if(t.flags|=128,u=!0,o=e.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),h_(y,!0),y.tail===null&&y.tailMode==="hidden"&&!T.alternate&&!uo)return Rs(t),null}else 2*Mo()-y.renderingStartTime>zp&&o!==1073741824&&(t.flags|=128,u=!0,h_(y,!1),t.lanes=4194304);y.isBackwards?(T.sibling=t.child,t.child=T):(o=y.last,o!==null?o.sibling=T:t.child=T,y.last=T)}return y.tail!==null?(t=y.tail,y.rendering=t,y.tail=t.sibling,y.renderingStartTime=Mo(),t.sibling=null,o=_o.current,Xn(_o,u?o&1|2:o&1),t):(Rs(t),null);case 22:case 23:return bE(),u=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==u&&(t.flags|=8192),u&&t.mode&1?Xa&1073741824&&(Rs(t),t.subtreeFlags&6&&(t.flags|=8192)):Rs(t),null;case 24:return null;case 25:return null}throw Error(mr(156,t.tag))}function E9(e,t){switch(MT(t),t.tag){case 1:return Ea(t.type)&&ex(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mp(),so(Ta),so(Ms),GT(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return UT(t),null;case 13:if(so(_o),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(mr(340));Cp()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return so(_o),null;case 4:return Mp(),null;
vendor: 25,814 bytes, line 41
41case 10:return OT(t.type._context),null;case 22:case 23:return bE(),null;case 24:return null;default:return null}}var xx=!1,Ls=!1,S9=typeof WeakSet=="function"?WeakSet:Set,Vr=null;function Rp(e,t){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){Eo(e,t,u)}else o.current=null}function cE(e,t,o){try{o()}catch(u){Eo(e,t,u)}}var ok=!1;function C9(e,t){if(bT=Vv,e=FP(),fT(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var T=0,s=-1,M=-1,L=0,B=0,H=e,$=null;t:for(;;){for(var te;H!==o||p!==0&&H.nodeType!==3||(s=T+p),H!==y||u!==0&&H.nodeType!==3||(M=T+u),H.nodeType===3&&(T+=H.nodeValue.length),(te=H.firstChild)!==null;)$=H,H=te;for(;;){if(H===e)break t;if($===o&&++L===p&&(s=T),$===y&&++B===u&&(M=T),(te=H.nextSibling)!==null)break;H=$,$=H.parentNode}H=te}o=s===-1||M===-1?null:{start:s,end:M}}else o=null}o=o||{start:0,end:0}}else o=null;for(wT={focusedElem:e,selectionRange:o},Vv=!1,Vr=t;Vr!==null;)if(t=Vr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vr=e;else for(;Vr!==null;){t=Vr;try{var xe=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var pe=xe.memoizedProps,Ne=xe.memoizedState,_e=t.stateNode,ie=_e.getSnapshotBeforeUpdate(t.elementType===t.type?pe:jl(t.type,pe),Ne);_e.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:var ke=t.stateNode.containerInfo;ke.nodeType===1?ke.textContent="":ke.nodeType===9&&ke.documentElement&&ke.removeChild(ke.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(mr(163))}}catch(ot){Eo(t,t.return,ot)}if(e=t.sibling,e!==null){e.return=t.return,Vr=e;break}Vr=t.return}return xe=ok,ok=!1,xe}function d_(e,t,o){var u=t.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&e)===e){var y=p.destroy;p.destroy=void 0,y!==void 0&&cE(t,o,y)}p=p.next}while(p!==u)}}function bx(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var o=t=t.next;do{if((o.tag&e)===e){var u=o.create;o.destroy=u()}o=o.next}while(o!==t)}}function uE(e){var t=e.ref;if(t!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof t=="function"?t(e):t.current=e}}function sk(e){var t=e.alternate;t!==null&&(e.alternate=null,sk(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vc],delete t[t_],delete t[CT],delete t[l9],delete t[c9])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ak(e){return e.tag===5||e.tag===3||e.tag===4}function lk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ak(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function hE(e,t,o){var u=e.tag;if(u===5||u===6)e=e.stateNode,t?o.nodeType===8?o.parentNode.insertBefore(e,t):o.insertBefore(e,t):(o.nodeType===8?(t=o.parentNode,t.insertBefore(e,o)):(t=o,t.appendChild(e)),o=o._reactRootContainer,o!=null||t.onclick!==null||(t.onclick=Jv));else if(u!==4&&(e=e.child,e!==null))for(hE(e,t,o),e=e.sibling;e!==null;)hE(e,t,o),e=e.sibling}function dE(e,t,o){var u=e.tag;if(u===5||u===6)e=e.stateNode,t?o.insertBefore(e,t):o.appendChild(e);else if(u!==4&&(e=e.child,e!==null))for(dE(e,t,o),e=e.sibling;e!==null;)dE(e,t,o),e=e.sibling}var vs=null,Gl=!1;function ph(e,t,o){for(o=o.child;o!==null;)ck(e,t,o),o=o.sibling}function ck(e,t,o){if(yc&&typeof yc.onCommitFiberUnmount=="function")try{yc.onCommitFiberUnmount(zv,o)}catch{}switch(o.tag){case 5:Ls||Rp(o,t);case 6:var u=vs,p=Gl;vs=null,ph(e,t,o),vs=u,Gl=p,vs!==null&&(Gl?(e=vs,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):vs.removeChild(o.stateNode));break;case 18:vs!==null&&(Gl?(e=vs,o=o.stateNode,e.nodeType===8?ST(e.parentNode,o):e.nodeType===1&&ST(e,o),$g(e)):ST(vs,o.stateNode));break;case 4:u=vs,p=Gl,vs=o.stateNode.containerInfo,Gl=!0,ph(e,t,o),vs=u,Gl=p;break;case 0:case 11:case 14:case 15:if(!Ls&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var y=p,T=y.destroy;y=y.tag,T!==void 0&&(y&2||y&4)&&cE(o,t,T),p=p.next}while(p!==u)}ph(e,t,o);break;case 1:if(!Ls&&(Rp(o,t),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(s){Eo(o,t,s)}ph(e,t,o);break;case 21:ph(e,t,o);break;case 22:o.mode&1?(Ls=(u=Ls)||o.memoizedState!==null,ph(e,t,o),Ls=u):ph(e,t,o);break;default:ph(e,t,o)}}function uk(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new S9),t.forEach(function(u){var p=D9.bind(null,e,u);o.has(u)||(o.add(u),u.then(p,p))})}}function $l(e,t){var o=t.deletions;if(o!==null)for(var u=0;u<o.length;u++){var p=o[u];try{var y=e,T=t,s=T;e:for(;s!==null;){switch(s.tag){case 5:vs=s.stateNode,Gl=!1;break e;case 3:vs=s.stateNode.containerInfo,Gl=!0;break e;case 4:vs=s.stateNode.containerInfo,Gl=!0;break e}s=s.return}if(vs===null)throw Error(mr(160));ck(y,T,p),vs=null,Gl=!1;var M=p.alternate;M!==null&&(M.return=null),p.return=null}catch(L){Eo(p,t,L)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)hk(t,e),t=t.sibling}function hk(e,t){var o=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if($l(t,e),wc(e),u&4){try{d_(3,e,e.return),bx(3,e)}catch(pe){Eo(e,e.return,pe)}try{d_(5,e,e.return)}catch(pe){Eo(e,e.return,pe)}}break;case 1:$l(t,e),wc(e),u&512&&o!==null&&Rp(o,o.return);break;case 5:if($l(t,e),wc(e),u&512&&o!==null&&Rp(o,o.return),e.flags&32){var p=e.stateNode;try{Lg(p,"")}catch(pe){Eo(e,e.return,pe)}}if(u&4&&(p=e.stateNode,p!=null)){var y=e.memoizedProps,T=o!==null?o.memoizedProps:y,s=e.type,M=e.updateQueue;if(e.updateQueue=null,M!==null)try{s==="input"&&y.type==="radio"&&y.name!=null&&B3(p,y),G2(s,T);var L=G2(s,y);for(T=0;T<M.length;T+=2){var B=M[T],H=M[T+1];B==="style"?Z3(p,H):B==="dangerouslySetInnerHTML"?H3(p,H):B==="children"?Lg(p,H):C2(p,B,H,L)}switch(s){case"input":N2(p,y);break;case"textarea":j3(p,y);break;case"select":var $=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!y.multiple;var te=y.value;te!=null?hp(p,!!y.multiple,te,!1):$!==!!y.multiple&&(y.defaultValue!=null?hp(p,!!y.multiple,y.defaultValue,!0):hp(p,!!y.multiple,y.multiple?[]:"",!1))}p[t_]=y}catch(pe){Eo(e,e.return,pe)}}break;case 6:if($l(t,e),wc(e),u&4){if(e.stateNode===null)throw Error(mr(162));p=e.stateNode,y=e.memoizedProps;try{p.nodeValue=y}catch(pe){Eo(e,e.return,pe)}}break;case 3:if($l(t,e),wc(e),u&4&&o!==null&&o.memoizedState.isDehydrated)try{$g(t.containerInfo)}catch(pe){Eo(e,e.return,pe)}break;case 4:$l(t,e),wc(e);break;case 13:$l(t,e),wc(e),p=e.child,p.flags&8192&&(y=p.memoizedState!==null,p.stateNode.isHidden=y,!y||p.alternate!==null&&p.alternate.memoizedState!==null||(mE=Mo())),u&4&&uk(e);break;case 22:if(B=o!==null&&o.memoizedState!==null,e.mode&1?(Ls=(L=Ls)||B,$l(t,e),Ls=L):$l(t,e),wc(e),u&8192){if(L=e.memoizedState!==null,(e.stateNode.isHidden=L)&&!B&&e.mode&1)for(Vr=e,B=e.child;B!==null;){for(H=Vr=B;Vr!==null;){switch($=Vr,te=$.child,$.tag){case 0:case 11:case 14:case 15:d_(4,$,$.return);break;case 1:Rp($,$.return);var xe=$.stateNode;if(typeof xe.componentWillUnmount=="function"){u=$,o=$.return;try{t=u,xe.props=t.memoizedProps,xe.state=t.memoizedState,xe.componentWillUnmount()}catch(pe){Eo(u,o,pe)}}break;case 5:Rp($,$.return);break;case 22:if($.memoizedState!==null){pk(H);continue}}te!==null?(te.return=$,Vr=te):pk(H)}B=B.sibling}e:for(B=null,H=e;;){if(H.tag===5){if(B===null){B=H;try{p=H.stateNode,L?(y=p.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none"):(s=H.stateNode,M=H.memoizedProps.style,T=M!=null&&M.hasOwnProperty("display")?M.display:null,s.style.display=q3("display",T))}catch(pe){Eo(e,e.return,pe)}}}else if(H.tag===6){if(B===null)try{H.stateNode.nodeValue=L?"":H.memoizedProps}catch(pe){Eo(e,e.return,pe)}}else if((H.tag!==22&&H.tag!==23||H.memoizedState===null||H===e)&&H.child!==null){H.child.return=H,H=H.child;continue}if(H===e)break e;for(;H.sibling===null;){if(H.return===null||H.return===e)break e;B===H&&(B=null),H=H.return}B===H&&(B=null),H.sibling.return=H.return,H=H.sibling}}break;case 19:$l(t,e),wc(e),u&4&&uk(e);break;case 21:break;default:$l(t,e),wc(e)}}function wc(e){var t=e.flags;if(t&2){try{e:{for(var o=e.return;o!==null;){if(ak(o)){var u=o;break e}o=o.return}throw Error(mr(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(Lg(p,""),u.flags&=-33);var y=lk(e);dE(e,y,p);break;case 3:case 4:var T=u.stateNode.containerInfo,s=lk(e);hE(e,s,T);break;default:throw Error(mr(161))}}catch(M){Eo(e,e.return,M)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function I9(e,t,o){Vr=e,dk(e)}function dk(e,t,o){for(var u=(e.mode&1)!==0;Vr!==null;){var p=Vr,y=p.child;if(p.tag===22&&u){var T=p.memoizedState!==null||xx;if(!T){var s=p.alternate,M=s!==null&&s.memoizedState!==null||Ls;s=xx;var L=Ls;if(xx=T,(Ls=M)&&!L)for(Vr=p;Vr!==null;)T=Vr,M=T.child,T.tag===22&&T.memoizedState!==null?mk(p):M!==null?(M.return=T,Vr=M):mk(p);for(;y!==null;)Vr=y,dk(y),y=y.sibling;Vr=p,xx=s,Ls=L}fk(e)}else p.subtreeFlags&8772&&y!==null?(y.return=p,Vr=y):fk(e)}}function fk(e){for(;Vr!==null;){var t=Vr;if(t.flags&8772){var o=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ls||bx(5,t);break;case 1:var u=t.stateNode;if(t.flags&4&&!Ls)if(o===null)u.componentDidMount();else{var p=t.elementType===t.type?o.memoizedProps:jl(t.type,o.memoizedProps);u.componentDidUpdate(p,o.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var y=t.updateQueue;y!==null&&pM(t,y,u);break;case 3:var T=t.updateQueue;if(T!==null){if(o=null,t.child!==null)switch(t.child.tag){case 5:o=t.child.stateNode;break;case 1:o=t.child.stateNode}pM(t,T,o)}break;case 5:var s=t.stateNode;if(o===null&&t.flags&4){o=s;var M=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":M.autoFocus&&o.focus();break;case"img":M.src&&(o.src=M.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var L=t.alternate;if(L!==null){var B=L.memoizedState;if(B!==null){var H=B.dehydrated;H!==null&&$g(H)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(mr(163))}Ls||t.flags&512&&uE(t)}catch($){Eo(t,t.return,$)}}if(t===e){Vr=null;break}if(o=t.sibling,o!==null){o.return=t.return,Vr=o;break}Vr=t.return}}function pk(e){for(;Vr!==null;){var t=Vr;if(t===e){Vr=null;break}var o=t.sibling;if(o!==null){o.return=t.return,Vr=o;break}Vr=t.return}}function mk(e){for(;Vr!==null;){var t=Vr;try{switch(t.tag){case 0:case 11:case 15:var o=t.return;try{bx(4,t)}catch(M){Eo(t,o,M)}break;case 1:var u=t.stateNode;if(typeof u.componentDidMount=="function"){var p=t.return;try{u.componentDidMount()}catch(M){Eo(t,p,M)}}var y=t.return;try{uE(t)}catch(M){Eo(t,y,M)}break;case 5:var T=t.return;try{uE(t)}catch(M){Eo(t,T,M)}}}catch(M){Eo(t,t.return,M)}if(t===e){Vr=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Vr=s;break}Vr=t.return}}var A9=Math.ceil,wx=hu.ReactCurrentDispatcher,fE=hu.ReactCurrentOwner,dl=hu.ReactCurrentBatchConfig,In=0,is=null,Fo=null,xs=0,Xa=0,Lp=ch(0),Wo=0,f_=null,Bd=0,Tx=0,pE=0,p_=null,Ca=null,mE=0,zp=1/0,vu=null,Ex=!1,gE=null,mh=null,Sx=!1,gh=null,Cx=0,m_=0,_E=null,Ix=-1,Ax=0;function Qs(){return In&6?Mo():Ix!==-1?Ix:Ix=Mo()}function _h(e){return e.mode&1?In&2&&xs!==0?xs&-xs:h9.transition!==null?(Ax===0&&(Ax=lP()),Ax):(e=Bn,e!==0||(e=window.event,e=e===void 0?16:_P(e.type)),e):1}function Hl(e,t,o,u){if(50<m_)throw m_=0,_E=null,Error(mr(185));Bg(e,o,u),(!(In&2)||e!==is)&&(e===is&&(!(In&2)&&(Tx|=o),Wo===4&&yh(e,xs)),Ia(e,u),o===1&&In===0&&!(t.mode&1)&&(zp=Mo()+500,rx&&hh()))}function Ia(e,t){var o=e.callbackNode;h$(e,t);var u=Fv(e,e===is?xs:0);if(u===0)o!==null&&oP(o),e.callbackNode=null,e.callbackPriority=0;else if(t=u&-u,e.callbackPriority!==t){if(o!=null&&oP(o),t===1)e.tag===0?u9(_k.bind(null,e)):rM(_k.bind(null,e)),s9(function(){!(In&6)&&hh()}),o=null;else{switch(cP(u)){case 1:o=Y2;break;case 4:o=sP;break;case 16:o=Lv;break;case 536870912:o=aP;break;default:o=Lv}o=Sk(o,gk.bind(null,e))}e.callbackPriority=t,e.callbackNode=o}}function gk(e,t){if(Ix=-1,Ax=0,In&6)throw Error(mr(327));var o=e.callbackNode;if(Dp()&&e.callbackNode!==o)return null;var u=Fv(e,e===is?xs:0);if(u===0)return null;if(u&30||u&e.expiredLanes||t)t=Px(e,u);else{t=u;var p=In;In|=2;var y=vk();(is!==e||xs!==t)&&(vu=null,zp=Mo()+500,Ud(e,t));do try{k9();break}catch(s){yk(e,s)}while(!0);DT(),wx.current=y,In=p,Fo!==null?t=0:(is=null,xs=0,t=Wo)}if(t!==0){if(t===2&&(p=K2(e),p!==0&&(u=p,t=yE(e,p))),t===1)throw o=f_,Ud(e,0),yh(e,u),Ia(e,Mo()),o;if(t===6)yh(e,u);else{if(p=e.current.alternate,!(u&30)&&!P9(p)&&(t=Px(e,u),t===2&&(y=K2(e),y!==0&&(u=y,t=yE(e,y))),t===1))throw o=f_,Ud(e,0),yh(e,u),Ia(e,Mo()),o;switch(e.finishedWork=p,e.finishedLanes=u,t){case 0:case 1:throw Error(mr(345));case 2:jd(e,Ca,vu);break;case 3:if(yh(e,u),(u&130023424)===u&&(t=mE+500-Mo(),10<t)){if(Fv(e,0)!==0)break;if(p=e.suspendedLanes,(p&u)!==u){Qs(),e.pingedLanes|=e.suspendedLanes&p;break}e.timeoutHandle=ET(jd.bind(null,e,Ca,vu),t);break}jd(e,Ca,vu);break;case 4:if(yh(e,u),(u&4194240)===u)break;for(t=e.eventTimes,p=-1;0<u;){var T=31-Bl(u);y=1<<T,T=t[T],T>p&&(p=T),u&=~y}if(u=p,u=Mo()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*A9(u/1960))-u,10<u){e.timeoutHandle=ET(jd.bind(null,e,Ca,vu),u);break}jd(e,Ca,vu);break;case 5:jd(e,Ca,vu);break;default:throw Error(mr(329))}}}return Ia(e,Mo()),e.callbackNode===o?gk.bind(null,e):null}function yE(e,t){var o=p_;return e.current.memoizedState.isDehydrated&&(Ud(e,t).flags|=256),e=Px(e,t),e!==2&&(t=Ca,Ca=o,t!==null&&vE(t)),e}function vE(e){Ca===null?Ca=e:Ca.push.apply(Ca,e)}function P9(e){for(var t=e;;){if(t.flags&16384){var o=t.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var u=0;u<o.length;u++){var p=o[u],y=p.getSnapshot;p=p.value;try{if(!Vl(y(),p))return!1}catch{return!1}}}if(o=t.child,t.subtreeFlags&16384&&o!==null)o.return=t,t=o;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yh(e,t){for(t&=~pE,t&=~Tx,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var o=31-Bl(t),u=1<<o;e[o]=-1,t&=~u}}function _k(e){if(In&6)throw Error(mr(327));Dp();var t=Fv(e,0);if(!(t&1))return Ia(e,Mo()),null;var o=Px(e,t);if(e.tag!==0&&o===2){var u=K2(e);u!==0&&(t=u,o=yE(e,u))}if(o===1)throw o=f_,Ud(e,0),yh(e,t),Ia(e,Mo()),o;if(o===6)throw Error(mr(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,jd(e,Ca,vu),Ia(e,Mo()),null}function xE(e,t){var o=In;In|=1;try{return e(t)}finally{In=o,In===0&&(zp=Mo()+500,rx&&hh())}}function Vd(e){gh!==null&&gh.tag===0&&!(In&6)&&Dp();var t=In;In|=1;var o=dl.transition,u=Bn;try{if(dl.transition=null,Bn=1,e)return e()}finally{Bn=u,dl.transition=o,In=t,!(In&6)&&hh()}}function bE(){Xa=Lp.current,so(Lp)}function Ud(e,t){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,o9(o)),Fo!==null)for(o=Fo.return;o!==null;){var u=o;switch(MT(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&ex();break;case 3:Mp(),so(Ta),so(Ms),GT();break;case 5:UT(u);break;case 4:Mp();break;case 13:so(_o);break;case 19:so(_o);break;case 10:OT(u.type._context);break;case 22:case 23:bE()}o=o.return}if(is=e,Fo=e=vh(e.current,null),xs=Xa=t,Wo=0,f_=null,pE=Tx=Bd=0,Ca=p_=null,Od!==null){for(t=0;t<Od.length;t++)if(o=Od[t],u=o.interleaved,u!==null){o.interleaved=null;var p=u.next,y=o.pending;if(y!==null){var T=y.next;y.next=p,u.next=T}o.pending=u}Od=null}return e}function yk(e,t){do{var o=Fo;try{if(DT(),dx.current=gx,fx){for(var u=yo.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}fx=!1}if(Nd=0,rs=Zo=yo=null,a_=!1,l_=0,fE.current=null,o===null||o.return===null){Wo=1,f_=t,Fo=null;break}e:{var y=e,T=o.return,s=o,M=t;if(t=xs,s.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){var L=M,B=s,H=B.tag;if(!(B.mode&1)&&(H===0||H===11||H===15)){var $=B.alternate;$?(B.updateQueue=$.updateQueue,B.memoizedState=$.memoizedState,B.lanes=$.lanes):(B.updateQueue=null,B.memoizedState=null)}var te=GM(T);if(te!==null){te.flags&=-257,$M(te,T,s,y,t),te.mode&1&&jM(y,L,t),t=te,M=L;var xe=t.updateQueue;if(xe===null){var pe=new Set;pe.add(M),t.updateQueue=pe}else xe.add(M);break e}else{if(!(t&1)){jM(y,L,t),wE();break e}M=Error(mr(426))}}else if(uo&&s.mode&1){var Ne=GM(T);if(Ne!==null){!(Ne.flags&65536)&&(Ne.flags|=256),$M(Ne,T,s,y,t),LT(kp(M,s));break e}}y=M=kp(M,s),Wo!==4&&(Wo=2),p_===null?p_=[y]:p_.push(y),y=T;do{switch(y.tag){case 3:y.flags|=65536,t&=-t,y.lanes|=t;var _e=VM(y,M,t);fM(y,_e);break e;case 1:s=M;var ie=y.type,ke=y.stateNode;if(!(y.flags&128)&&(typeof ie.getDerivedStateFromError=="function"||ke!==null&&typeof ke.componentDidCatch=="function"&&(mh===null||!mh.has(ke)))){y.flags|=65536,t&=-t,y.lanes|=t;var ot=UM(y,s,t);fM(y,ot);break e}}y=y.return}while(y!==null)}bk(o)}catch(et){t=et,Fo===o&&o!==null&&(Fo=o=o.return);continue}break}while(!0)}function vk(){var e=wx.current;return wx.current=gx,e===null?gx:e}function wE(){(Wo===0||Wo===3||Wo===2)&&(Wo=4),is===null||!(Bd&268435455)&&!(Tx&268435455)||yh(is,xs)}function Px(e,t){var o=In;In|=2;var u=vk();(is!==e||xs!==t)&&(vu=null,Ud(e,t));do try{M9();break}catch(p){yk(e,p)}while(!0);if(DT(),In=o,wx.current=u,Fo!==null)throw Error(mr(261));return is=null,xs=0,Wo}function M9(){for(;Fo!==null;)xk(Fo)}function k9(){for(;Fo!==null&&!r$();)xk(Fo)}function xk(e){var t=Ek(e.alternate,e,Xa);e.memoizedProps=e.pendingProps,t===null?bk(e):Fo=t,fE.current=null}function bk(e){var t=e;do{var o=t.alternate;if(e=t.return,t.flags&32768){if(o=E9(o,t),o!==null){o.flags&=32767,Fo=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Wo=6,Fo=null;return}}else if(o=T9(o,t,Xa),o!==null){Fo=o;return}if(t=t.sibling,t!==null){Fo=t;return}Fo=t=e}while(t!==null);Wo===0&&(Wo=5)}function jd(e,t,o){var u=Bn,p=dl.transition;try{dl.transition=null,Bn=1,R9(e,t,o,u)}finally{dl.transition=p,Bn=u}return null}function R9(e,t,o,u){do Dp();while(gh!==null);if(In&6)throw Error(mr(327));o=e.finishedWork;var p=e.finishedLanes;if(o===null)return null;if(e.finishedWork=null,e.finishedLanes=0,o===e.current)throw Error(mr(177));e.callbackNode=null,e.callbackPriority=0;var y=o.lanes|o.childLanes;if(d$(e,y),e===is&&(Fo=is=null,xs=0),!(o.subtreeFlags&2064)&&!(o.flags&2064)||Sx||(Sx=!0,Sk(Lv,function(){return Dp(),null})),y=(o.flags&15990)!==0,o.subtreeFlags&15990||y){y=dl.transition,dl.transition=null;var T=Bn;Bn=1;var s=In;In|=4,fE.current=null,C9(e,o),hk(o,e),J$(wT),Vv=!!bT,wT=bT=null,e.current=o,I9(o),i$(),In=s,Bn=T,dl.transition=y}else e.current=o;if(Sx&&(Sx=!1,gh=e,Cx=p),y=e.pendingLanes,y===0&&(mh=null),s$(o.stateNode),Ia(e,Mo()),t!==null)for(u=e.onRecoverableError,o=0;o<t.length;o++)p=t[o],u(p.value,{componentStack:p.stack,digest:p.digest});if(Ex)throw Ex=!1,e=gE,gE=null,e;return Cx&1&&e.tag!==0&&Dp(),y=e.pendingLanes,y&1?e===_E?m_++:(m_=0,_E=e):m_=0,hh(),null}function Dp(){if(gh!==null){var e=cP(Cx),t=dl.transition,o=Bn;try{if(dl.transition=null,Bn=16>e?16:e,gh===null)var u=!1;else{if(e=gh,gh=null,Cx=0,In&6)throw Error(mr(331));var p=In;for(In|=4,Vr=e.current;Vr!==null;){var y=Vr,T=y.child;if(Vr.flags&16){var s=y.deletions;if(s!==null){for(var M=0;M<s.length;M++){var L=s[M];for(Vr=L;Vr!==null;){var B=Vr;switch(B.tag){case 0:case 11:case 15:d_(8,B,y)}var H=B.child;if(H!==null)H.return=B,Vr=H;else for(;Vr!==null;){B=Vr;var $=B.sibling,te=B.return;if(sk(B),B===L){Vr=null;break}if($!==null){$.return=te,Vr=$;break}Vr=te}}}var xe=y.alternate;if(xe!==null){var pe=xe.child;if(pe!==null){xe.child=null;do{var Ne=pe.sibling;pe.sibling=null,pe=Ne}while(pe!==null)}}Vr=y}}if(y.subtreeFlags&2064&&T!==null)T.return=y,Vr=T;else e:for(;Vr!==null;){if(y=Vr,y.flags&2048)switch(y.tag){case 0:case 11:case 15:d_(9,y,y.return)}var _e=y.sibling;if(_e!==null){_e.return=y.return,Vr=_e;break e}Vr=y.return}}var ie=e.current;for(Vr=ie;Vr!==null;){T=Vr;var ke=T.child;if(T.subtreeFlags&2064&&ke!==null)ke.return=T,Vr=ke;else e:for(T=ie;Vr!==null;){if(s=Vr,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:bx(9,s)}}catch(et){Eo(s,s.return,et)}if(s===T){Vr=null;break e}var ot=s.sibling;if(ot!==null){ot.return=s.return,Vr=ot;break e}Vr=s.return}}if(In=p,hh(),yc&&typeof yc.onPostCommitFiberRoot=="function")try{yc.onPostCommitFiberRoot(zv,e)}catch{}u=!0}return u}finally{Bn=o,dl.transition=t}}return!1}function wk(e,t,o){t=kp(o,t),t=VM(e,t,1),e=fh(e,t,1),t=Qs(),e!==null&&(Bg(e,1,t),Ia(e,t))}function Eo(e,t,o){if(e.tag===3)wk(e,e,o);else for(;t!==null;){if(t.tag===3){wk(t,e,o);break}else if(t.tag===1){var u=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(mh===null||!mh.has(u))){e=kp(o,e),e=UM(t,e,1),t=fh(t,e,1),e=Qs(),t!==null&&(Bg(t,1,e),Ia(t,e));break}}t=t.return}}function L9(e,t,o){var u=e.pingCache;u!==null&&u.delete(t),t=Qs(),e.pingedLanes|=e.suspendedLanes&o,is===e&&(xs&o)===o&&(Wo===4||Wo===3&&(xs&130023424)===xs&&500>Mo()-mE?Ud(e,0):pE|=o),Ia(e,t)}function Tk(e,t){t===0&&(e.mode&1?(t=Ov,Ov<<=1,!(Ov&130023424)&&(Ov=4194304)):t=1);var o=Qs();e=gu(e,t),e!==null&&(Bg(e,t,o),Ia(e,o))}function z9(e){var t=e.memoizedState,o=0;t!==null&&(o=t.retryLane),Tk(e,o)}function D9(e,t){var o=0;switch(e.tag){case 13:var u=e.stateNode,p=e.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=e.stateNode;break;default:throw Error(mr(314))}u!==null&&u.delete(t),Tk(e,o)}var Ek;Ek=function(e,t,o){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ta.current)Sa=!0;else{if(!(e.lanes&o)&&!(t.flags&128))return Sa=!1,w9(e,t,o);Sa=!!(e.flags&131072)}else Sa=!1,uo&&t.flags&1048576&&iM(t,nx,t.index);switch(t.lanes=0,t.tag){case 2:var u=t.type;vx(e,t),e=t.pendingProps;var p=Tp(t,Ms.current);Pp(t,o),p=qT(null,t,u,e,p,o);var y=ZT();return t.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ea(u)?(y=!0,tx(t)):y=!1,t.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,BT(t),p.updater=_x,t.stateNode=p,p._reactInternals=t,QT(t,u,e,o),t=iE(null,t,u,!0,y,o)):(t.tag=0,uo&&y&&PT(t),Js(null,t,p,o),t=t.child),t;case 16:u=t.elementType;e:{switch(vx(e,t),e=t.pendingProps,p=u._init,u=p(u._payload),t.type=u,p=t.tag=F9(u),e=jl(u,e),p){case 0:t=rE(null,t,u,e,o);break e;case 1:t=YM(null,t,u,e,o);break e;case 11:t=HM(null,t,u,e,o);break e;case 14:t=qM(null,t,u,jl(u.type,e),o);break e}throw Error(mr(306,u,""))}return t;case 0:return u=t.type,p=t.pendingProps,p=t.elementType===u?p:jl(u,p),rE(e,t,u,p,o);case 1:return u=t.type,p=t.pendingProps,p=t.elementType===u?p:jl(u,p),YM(e,t,u,p,o);case 3:e:{if(KM(t),e===null)throw Error(mr(387));u=t.pendingProps,y=t.memoizedState,p=y.element,dM(e,t),ux(t,u,null,o);var T=t.memoizedState;if(u=T.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},t.updateQueue.baseState=y,t.memoizedState=y,t.flags&256){p=kp(Error(mr(423)),t),t=JM(e,t,u,o,p);break e}else if(u!==p){p=kp(Error(mr(424)),t),t=JM(e,t,u,o,p);break e}else for(Wa=lh(t.stateNode.containerInfo.firstChild),Za=t,uo=!0,Ul=null,o=uM(t,null,u,o),t.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Cp(),u===p){t=yu(e,t,o);break e}Js(e,t,u,o)}t=t.child}return t;case 5:return mM(t),e===null&&RT(t),u=t.type,p=t.pendingProps,y=e!==null?e.memoizedProps:null,T=p.children,TT(u,p)?T=null:y!==null&&TT(u,y)&&(t.flags|=32),XM(e,t),Js(e,t,T,o),t.child;case 6:return e===null&&RT(t),null;case 13:return QM(e,t,o);case 4:return VT(t,t.stateNode.containerInfo),u=t.pendingProps,e===null?t.child=Ip(t,null,u,o):Js(e,t,u,o),t.child;case 11:return u=t.type,p=t.pendingProps,p=t.elementType===u?p:jl(u,p),HM(e,t,u,p,o);case 7:return Js(e,t,t.pendingProps,o),t.child;case 8:return Js(e,t,t.pendingProps.children,o),t.child;case 12:return Js(e,t,t.pendingProps.children,o),t.child;case 10:e:{if(u=t.type._context,p=t.pendingProps,y=t.memoizedProps,T=p.value,Xn(ax,u._currentValue),u._currentValue=T,y!==null)if(Vl(y.value,T)){if(y.children===p.children&&!Ta.current){t=yu(e,t,o);break e}}else for(y=t.child,y!==null&&(y.return=t);y!==null;){var s=y.dependencies;if(s!==null){T=y.child;for(var M=s.firstContext;M!==null;){if(M.context===u){if(y.tag===1){M=_u(-1,o&-o),M.tag=2;var L=y.updateQueue;if(L!==null){L=L.shared;var B=L.pending;B===null?M.next=M:(M.next=B.next,B.next=M),L.pending=M}}y.lanes|=o,M=y.alternate,M!==null&&(M.lanes|=o),FT(y.return,o,t),s.lanes|=o;break}M=M.next}}else if(y.tag===10)T=y.type===t.type?null:y.child;else if(y.tag===18){if(T=y.return,T===null)throw Error(mr(341));T.lanes|=o,s=T.alternate,s!==null&&(s.lanes|=o),FT(T,o,t),T=y.sibling}else T=y.child;if(T!==null)T.return=y;else for(T=y;T!==null;){if(T===t){T=null;break}if(y=T.sibling,y!==null){y.return=T.return,T=y;break}T=T.return}y=T}Js(e,t,p.children,o),t=t.child}return t;case 9:return p=t.type,u=t.pendingProps.children,Pp(t,o),p=ul(p),u=u(p),t.flags|=1,Js(e,t,u,o),t.child;case 14:return u=t.type,p=jl(u,t.pendingProps),p=jl(u.type,p),qM(e,t,u,p,o);case 15:return ZM(e,t,t.type,t.pendingProps,o);case 17:return u=t.type,p=t.pendingProps,p=t.elementType===u?p:jl(u,p),vx(e,t),t.tag=1,Ea(u)?(e=!0,tx(t)):e=!1,Pp(t,o),NM(t,u,p),QT(t,u,p,o),iE(null,t,u,!0,e,o);case 19:return tk(e,t,o);case 22:return WM(e,t,o)}throw Error(mr(156,t.tag))};function Sk(e,t){return nP(e,t)}function O9(e,t,o,u){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.t
vendor: 5,293 bytes, line 41
41ype=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fl(e,t,o,u){return new O9(e,t,o,u)}function TE(e){return e=e.prototype,!(!e||!e.isReactComponent)}function F9(e){if(typeof e=="function")return TE(e)?1:0;if(e!=null){if(e=e.$$typeof,e===P2)return 11;if(e===R2)return 14}return 2}function vh(e,t){var o=e.alternate;return o===null?(o=fl(e.tag,t,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=t,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,t=e.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function Mx(e,t,o,u,p,y){var T=2;if(u=e,typeof e=="function")TE(e)&&(T=1);else if(typeof e=="string")T=5;else e:switch(e){case up:return Gd(o.children,p,y,t);case I2:T=8,p|=8;break;case A2:return e=fl(12,o,t,p|2),e.elementType=A2,e.lanes=y,e;case M2:return e=fl(13,o,t,p),e.elementType=M2,e.lanes=y,e;case k2:return e=fl(19,o,t,p),e.elementType=k2,e.lanes=y,e;case z3:return kx(o,p,y,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R3:T=10;break e;case L3:T=9;break e;case P2:T=11;break e;case R2:T=14;break e;case eh:T=16,u=null;break e}throw Error(mr(130,e==null?e:typeof e,""))}return t=fl(T,o,t,p),t.elementType=e,t.type=u,t.lanes=y,t}function Gd(e,t,o,u){return e=fl(7,e,u,t),e.lanes=o,e}function kx(e,t,o,u){return e=fl(22,e,u,t),e.elementType=z3,e.lanes=o,e.stateNode={isHidden:!1},e}function EE(e,t,o){return e=fl(6,e,null,t),e.lanes=o,e}function SE(e,t,o){return t=fl(4,e.children!==null?e.children:[],e.key,t),t.lanes=o,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function N9(e,t,o,u,p){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=J2(0),this.expirationTimes=J2(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=J2(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function CE(e,t,o,u,p,y,T,s,M){return e=new N9(e,t,o,s,M),t===1?(t=1,y===!0&&(t|=8)):t=0,y=fl(3,null,null,t),e.current=y,y.stateNode=e,y.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},BT(y),e}function B9(e,t,o){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:cp,key:u==null?null:""+u,children:e,containerInfo:t,implementation:o}}function Ck(e){if(!e)return uh;e=e._reactInternals;e:{if(kd(e)!==e||e.tag!==1)throw Error(mr(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ea(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(mr(171))}if(e.tag===1){var o=e.type;if(Ea(o))return eM(e,o,t)}return t}function Ik(e,t,o,u,p,y,T,s,M){return e=CE(o,u,!0,e,p,y,T,s,M),e.context=Ck(null),o=e.current,u=Qs(),p=_h(o),y=_u(u,p),y.callback=t??null,fh(o,y,p),e.current.lanes=p,Bg(e,p,u),Ia(e,u),e}function Rx(e,t,o,u){var p=t.current,y=Qs(),T=_h(p);return o=Ck(o),t.context===null?t.context=o:t.pendingContext=o,t=_u(y,T),t.payload={element:e},u=u===void 0?null:u,u!==null&&(t.callback=u),e=fh(p,t,T),e!==null&&(Hl(e,p,T,y),cx(e,p,T)),T}function Lx(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Ak(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<t?o:t}}function IE(e,t){Ak(e,t),(e=e.alternate)&&Ak(e,t)}function V9(){return null}var Pk=typeof reportError=="function"?reportError:function(e){console.error(e)};function AE(e){this._internalRoot=e}zx.prototype.render=AE.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(mr(409));Rx(e,t,null,null)},zx.prototype.unmount=AE.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vd(function(){Rx(null,e,null,null)}),t[du]=null}};function zx(e){this._internalRoot=e}zx.prototype.unstable_scheduleHydration=function(e){if(e){var t=dP();e={blockedOn:null,target:e,priority:t};for(var o=0;o<oh.length&&t!==0&&t<oh[o].priority;o++);oh.splice(o,0,e),o===0&&mP(e)}};function PE(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Dx(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Mk(){}function U9(e,t,o,u,p){if(p){if(typeof u=="function"){var y=u;u=function(){var L=Lx(T);y.call(L)}}var T=Ik(t,u,e,0,null,!1,!1,"",Mk);return e._reactRootContainer=T,e[du]=T.current,Qg(e.nodeType===8?e.parentNode:e),Vd(),T}for(;
vendor: 4,967 bytes, lines 41-50
41p=e.lastChild;)e.removeChild(p);if(typeof u=="function"){var s=u;u=function(){var L=Lx(M);s.call(L)}}var M=CE(e,0,!1,null,null,!1,!1,"",Mk);return e._reactRootContainer=M,e[du]=M.current,Qg(e.nodeType===8?e.parentNode:e),Vd(function(){Rx(t,M,o,u)}),M}function Ox(e,t,o,u,p){var y=o._reactRootContainer;if(y){var T=y;if(typeof p=="function"){var s=p;p=function(){var M=Lx(T);s.call(M)}}Rx(t,T,e,p)}else T=U9(o,t,e,p,u);return Lx(T)}uP=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var o=Ng(t.pendingLanes);o!==0&&(Q2(t,o|1),Ia(t,Mo()),!(In&6)&&(zp=Mo()+500,hh()))}break;case 13:Vd(function(){var u=gu(e,1);if(u!==null){var p=Qs();Hl(u,e,1,p)}}),IE(e,1)}},eT=function(e){if(e.tag===13){var t=gu(e,134217728);if(t!==null){var o=Qs();Hl(t,e,134217728,o)}IE(e,134217728)}},hP=function(e){if(e.tag===13){var t=_h(e),o=gu(e,t);if(o!==null){var u=Qs();Hl(o,e,t,u)}IE(e,t)}},dP=function(){return Bn},fP=function(e,t){var o=Bn;try{return Bn=e,t()}finally{Bn=o}},q2=function(e,t,o){switch(t){case"input":if(N2(e,o),t=o.name,o.type==="radio"&&t!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<o.length;t++){var u=o[t];if(u!==e&&u.form===e.form){var p=Qv(u);if(!p)throw Error(mr(90));F3(u),N2(u,p)}}}break;case"textarea":j3(e,o);break;case"select":t=o.value,t!=null&&hp(e,!!o.multiple,t,!1)}},K3=xE,J3=Vd;var j9={usingClientEntryPoint:!1,Events:[r_,bp,Qv,X3,Y3,xE]},g_={findFiberByHostInstance:Rd,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},G9={bundleType:g_.bundleType,version:g_.version,rendererPackageName:g_.rendererPackageName,rendererConfig:g_.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hu.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=rP(e),e===null?null:e.stateNode},findFiberByHostInstance:g_.findFiberByHostInstance||V9,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fx=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fx.isDisabled&&Fx.supportsFiber)try{zv=Fx.inject(G9),yc=Fx}catch{}}$a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j9,$a.createPortal=function(e,t){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!PE(t))throw Error(mr(200));return B9(e,t,null,o)},$a.createRoot=function(e,t){if(!PE(e))throw Error(mr(299));var o=!1,u="",p=Pk;return t!=null&&(t.unstable_strictMode===!0&&(o=!0),t.identifierPrefix!==void 0&&(u=t.identifierPrefix),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=CE(e,1,!1,null,null,o,!1,u,p),e[du]=t.current,Qg(e.nodeType===8?e.parentNode:e),new AE(t)},$a.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(mr(188)):(e=Object.keys(e).join(","),Error(mr(268,e)));return e=rP(t),e=e===null?null:e.stateNode,e},$a.flushSync=function(e){return Vd(e)},$a.hydrate=function(e,t,o){if(!Dx(t))throw Error(mr(200));return Ox(null,e,t,!0,o)},$a.hydrateRoot=function(e,t,o){if(!PE(e))throw Error(mr(405));var u=o!=null&&o.hydratedSources||null,p=!1,y="",T=Pk;if(o!=null&&(o.unstable_strictMode===!0&&(p=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onRecoverableError!==void 0&&(T=o.onRecoverableError)),t=Ik(t,null,e,1,o??null,p,!1,y,T),e[du]=t.current,Qg(e),u)for(e=0;e<u.length;e++)o=u[e],p=o._getVersion,p=p(o._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[o,p]:t.mutableSourceEagerHydrationData.push(o,p);return new zx(t)},$a.render=function(e,t,o){if(!Dx(t))throw Error(mr(200));return Ox(null,e,t,!1,o)},$a.unmountComponentAtNode=function(e){if(!Dx(e))throw Error(mr(40));return e._reactRootContainer?(Vd(function(){Ox(null,null,e,!1,function(){e._reactRootContainer=null,e[du]=null})}),!0):!1},$a.unstable_batchedUpdates=xE,$a.unstable_renderSubtreeIntoContainer=function(e,t,o,u){if(!Dx(o))throw Error(mr(200));if(e==null||e._reactInternals===void 0)throw Error(mr(38));return Ox(e,t,o,!1,u)},$a.version="18.3.1-next-f1338f8080-20240426";function kk(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kk)}catch(e){console.error(e)}}kk(),C3.exports=$a;var Rk=C3.exports,Lk=Rk;w2.createRoot=Lk.createRoot,w2.hydrateRoot=Lk.hydrateRoot;/**
42 * react-router v7.15.1
43 *
44 * Copyright (c) Remix Software Inc.
45 *
46 * This source code is licensed under the MIT license found in the
47 * LICENSE.md file in the root directory of this source tree.
48 *
49 * @license MIT
50 */var zk=e=>{throw TypeError(e)},Dk=(e,t,o)=>
50t.has(e)||zk("Cannot "+o),pl=(e,t,o)=>(Dk(e,t,"read from private field"),o?o.call(e):t.get(e)),__=(e,t,o)=>t.has(e)?zk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),Tc=(e,t,o,u)=>(Dk(e,t,"write to private field"),t.set(e,o),o),Ok="popstate";function Fk(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function $9(e={}){function t(u,p){var L;let y=(L=p.state)==null?void 0:L.masked,{pathname:T,search:s,hash:M}=y||u.location;return y_("",{pathname:T,search:s,hash:M},p.state&&p.state.usr||null,p.state&&p.state.key||"default",y?{pathname:u.location.pathname,search:u.location.search,hash:u.location.hash}:void 0)}function o(u,p){return typeof p=="string"?p:Ec(p)}return q9(t,o,null,e)}function on(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function No(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function H9(){return Math.random().toString(36).substring(2,10)}function Nk(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function y_(e,t,o=null,u,p){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Sc(t):t,state:o,key:t&&t.key||u||H9(),mask:p}}function Ec({pathname:e="/",search:t="",hash:o=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),o&&o!=="#"&&(e+=o.charAt(0)==="#"?o:"#"+o),e}function Sc(e){let t={};if(e){let o=e.indexOf("#");o>=0&&(t.hash=e.substring(o),e=e.substring(0,o));let u=e.indexOf("?");u>=0&&(t.search=e.substring(u),e=e.substring(0,u)),e&&(t.pathname=e)}return t}function q9(e,t,o,u={}){let{window:p=document.defaultView,v5Compat:y=!1}=u,T=p.history,s="POP",M=null,L=B();L==null&&(L=0,T.replaceState({...T.state,idx:L},""));function B(){return(T.state||{idx:null}).idx}function H(){s="POP";let Ne=B(),_e=Ne==null?null:Ne-L;L=Ne,M&&M({action:s,location:pe.location,delta:_e})}function $(Ne,_e){s="PUSH";let ie=Fk(Ne)?Ne:y_(pe.location,Ne,_e);L=B()+1;let ke=Nk(ie,L),ot=pe.createHref(ie.mask||ie);try{T.pushState(ke,"",ot)}catch(et){if(et instanceof DOMException&&et.name==="DataCloneError")throw et;p.location.assign(ot)}y&&M&&M({action:s,location:pe.location,delta:1})}function te(Ne,_e){s="REPLACE";let ie=Fk(Ne)?Ne:y_(pe.location,Ne,_e);L=B();let ke=Nk(ie,L),ot=pe.createHref(ie.mask||ie);T.replaceState(ke,"",ot),y&&M&&M({action:s,location:pe.location,delta:0})}function xe(Ne){return Bk(Ne)}let pe={get action(){return s},get location(){return e(p,T)},listen(Ne){if(M)throw new Error("A history only accepts one active listener");return p.addEventListener(Ok,H),M=Ne,()=>{p.removeEventListener(Ok,H),M=null}},createHref(Ne){return t(p,Ne)},createURL:xe,encodeLocation(Ne){let _e=xe(Ne);return{pathname:_e.pathname,search:_e.search,hash:_e.hash}},push:$,replace:te,go(Ne){return T.go(Ne)}};return pe}function Bk(e,t=!1){let o="http://localhost";
50typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),on(o,"No window.location.(origin|href) available to create URL");let u=typeof e=="string"?e:Ec(e);return u=u.replace(/ $/,"%20"),!t&&u.startsWith("//")&&(u=o+u),new URL(u,o)}var v_,Vk=class{constructor(e){if(__(this,v_,new Map),e)for(let[t,o]of e)this.set(t,o)}get(e){if(pl(this,v_).has(e))return pl(this,v_).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){pl(this,v_).set(e,t)}};v_=new WeakMap;var Z9=new Set(["lazy","caseSensitive","path","id","index","children"]);function W9(e){return Z9.has(e)}var X9=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function Y9(e){return X9.has(e)}function K9(e){return e.index===!0}function x_(e,t,o=[],u={},p=!1){return e.map((y,T)=>{let s=[...o,String(T)],M=typeof y.id=="string"?y.id:s.join("-");if(on(y.index!==!0||!y.children,"Cannot specify children on an index route"),on(p||!u[M],`Found a route id collision on i
50d "${M}".  Route id's must be globally unique within Data Router usages`),K9(y)){let L={...y,id:M};return u[M]=Uk(L,t(L)),L}else{let L={...y,id:M,children:void 0};return u[M]=Uk(L,t(L)),y.children&&(L.children=x_(y.children,t,s,u,p)),L}})}function Uk(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function jk(e,t,o="/"){return ql(e,t,o,!1)}function ql(e,t,o,u,p){let y=typeof t=="string"?Sc(t):t,T=ml(y.pathname||"/",o);if(T==null)return null;let s=p??Nx(e),M=null,L=u7(T);for(let B=0;M==null&&B<s.length;++B)M=l7(s[B],L,u);return M}function J9(e,t){let{route:o,pathname:u,params:p}=e;return{id:o.id,pathname:u,params:p,data:t[o.id],loaderData:t[o.id],handle:o.handle}}function Nx(e){let t=Gk(e);return Q9(t),t}function Gk(e,t=[],o=[],u="",p=!1){let y=(T,s,M=p,L)=>{let B={relativePath:L===void 0?T.path||"":L,caseSensitive:T.caseSensitive===!0,childrenIndex:s,route:T};if(B.relativePath.startsWith("/")){if(!B.relativePath.startsWith(u)&&M)return;on(B.relativePath.startsWith(u),`Absolute route path "${B.relativePath}" nested under path "${u}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),B.relativePath=B.relativePath.slice(u.length)}let H=gl([u,B.relativePath]),$=o.concat(B);T.children&&T.children.length>0&&(on(T.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${H}".`),Gk(T.children,t,$,H,M)),!(T.path==null&&!T.index)&&t.push({path:H,score:s7(H,T.index),routesMeta:$})};return e.forEach((T,s)=>{var M;if(T.path===""||!((M=T.path)!=null&&M.includes("?")))y(T,s);else for(let L of $k(T.path))y(T,s,!0,L)}),t}function $k(e){let t=e.split("/");if(t.length===0)return[];let[o,...u]=t,p=o.endsWith("?"),y=o.replace(/\?$/,"");if(u.length===0)return p?[y,""]:[y];let T=$k(u.join("/")),s=[];return s.push(...T.map(M=>M===""?y:[y,M].join("/"))),p&&s.push(...T),s.map(M=>e.startsWith("/")&&M===""?"/":M)}function Q9(e){e.sort((t,o)=>t.score!==o.score?o.score-t.score:a7(t.routesMeta.map(u=>u.childrenIndex),o.routesMeta.map(u=>u.childrenIndex)))}var e7=/^:[\w-]+$/,t7=3,r7=2,i7=1,n7=10,o7=-2,Hk=e=>e==="*";function s7(e,t){let o=e.split("/"),u=o.length;return o.some(Hk)&&(u+=o7),t&&(u+=r7),o.filter(p=>!Hk(p)).reduce((p,y)=>p+(e7.test(y)?t7:y===""?i7:n7),u)}function a7(e,t){return e.length===t.length&&e.slice(0,-1).every((u,p)=>u===t[p])?e[e.length-1]-t[t.length-1]:0}function l7(e,t,o=!1){let{routesMeta:u}=e,p={},y="/",T=[];for(let s=0;s<u.length;++s){let M=u[s],L=s===u.length-1,B=y==="/"?t:t.slice(y.length)||"/",H=Bx({path:M.relativePath,caseSensitive:M.caseSensitive,end:L},B),$=M.route;if(!H&&L&&o&&!u[u.length-1].route.index&&(H=Bx({path:M.relativePath,caseSensitive:M.caseSensitive,end:!1},B)),!H)return null;
50Object.assign(p,H.params),T.push({params:p,pathname:gl([y,H.pathname]),pathnameBase:f7(gl([y,H.pathnameBase])),route:$}),H.pathnameBase!=="/"&&(y=gl([y,H.pathnameBase]))}return T}function Bx(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[o,u]=c7(e.path,e.caseSensitive,e.end),p=t.match(o);if(!p)return null;let y=p[0],T=y.replace(/(.)\/+$/,"$1"),s=p.slice(1);return{params:u.reduce((L,{paramName:B,isOptional:H},$)=>{if(B==="*"){let xe=s[$]||"";T=y.slice(0,y.length-xe.length).replace(/(.)\/+$/,"$1")}const te=s[$];return H&&!te?L[B]=void 0:L[B]=(te||"").replace(/%2F/g,"/"),L},{}),pathname:y,pathnameBase:T,pattern:e}}function c7(e,t=!1,o=!0){No(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let u=[],p="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(T,s,M,L,B)=>{if(u.push({paramName:s,isOptional:M!=null}),M){let H=B.charAt(L+T.length);return H&&H!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(u.push({paramName:"*"}),p+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?p+="\\/*$":e!==""&&e!=="/"&&(p+="(?:(?=\\/|$))"),[new RegExp(p,t?void 0:"i"),u]}function u7(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return No(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ml(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let o=t.endsWith("/")?t.length-1:t.length,u=e.charAt(o);return u&&u!=="/"?null:e.slice(o)||"/"}function h7({basename:e,pathname:t}){return t==="/"?e:gl([e,t])}var qk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ME=e=>qk.test(e);function d7(e,t="/"){let{pathname:o,search:u="",hash:p=""}=typeof e=="string"?Sc(e):e,y;return o?(o=LE(o),o.startsWith("/")?y=Zk(o.substring(1),"/"):y=Zk(o,t)):y=t,{pathname:y,search:p7(u),hash:m7(p)}}function Zk(e,t){let o=Ux(t).split("/");return e.split("/").forEach(p=>{p===".."?o.length>1&&o.pop():p!=="."&&o.push(p)}),o.length>1?o.join("/"):"/"}function kE(e,t,o,u){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(u)}].  Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Wk(e){return e.filter((t,o)=>o===0||t.route.path&&t.route.path.length>0)}function RE(e){let t=Wk(e);return t.map((o,u)=>u===t.length-1?o.pathname:o.pathnameBase)}function Vx(e,t,o,u=!1){let p;typeof e=="string"?p=Sc(e):(p={...e},on(!p.pathname||!p.pathname.includes("?"),kE("?","pathname","search",p)),on(!p.pathname||!p.pathname.includes("#"),kE("#","pathname","hash",p)),on(!p.search||!p.search.includes("#"),kE("#","search","hash",p)));let y=e===""||p.pathname==="",T=y?"/":p.pathname,s;if(T==null)s=o;else{let H=t.length-1;if(!u&&T.startsWith("..")){let $=T.split("/");for(;$[0]==="..";)$.shift(),H-=1;p.pathname=$.join("/")}s=H>=0?t[H]:"/"}let M=d7(p,s),L=T&&T!=="/"&&T.endsWith("/"),B=(y||T===".")&&o.endsWith("/");return!M.pathname.endsWith("/")&&(L||B)&&(M.pathname+="/"),M}var LE=e=>e.replace(/\/\/+/g,"/"),gl=e=>LE(e.join("/")),Ux=e=>e.replace(/\/+$/,""),f7=e=>Ux(e).replace(/^\/*/,"/"),p7=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,m7=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,b_=class{constructor(e,t,o,u=!1){this.status=e,this.statusText=t||"",this.internal=u,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function w_(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function T_(e){let t=e.map(o=>o.route.path).filter(Boolean);return gl(t)||"/"}var Xk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yk(e,t){let o=e;if(typeof o!="string"||!qk.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let u=o,p=!1;if(Xk)try{let y=new URL(window.location.href),T=o.startsWith("//")?new URL(y.protocol+o):new URL(o),s=ml(T.pathname,t);T.origin===y.origin&&s!=null?o=s+T.search+T.hash:p=!0}catch{No(!1,`<Link to="${o}">
50 contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:u,isExternal:p,to:o}}var xh=Symbol("Uninstrumented");function g7(e,t){let o={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(p=>p({id:t.id,index:t.index,path:t.path,instrument(y){let T=Object.keys(o);for(let s of T)y[s]&&o[s].push(y[s])}}));let u={};if(typeof t.lazy=="function"&&o.lazy.length>0){let p=Op(o.lazy,t.lazy,()=>{});p&&(u.lazy=p)}if(typeof t.lazy=="object"){let p=t.lazy;["middleware","loader","action"].forEach(y=>{let T=p[y],s=o[`lazy.${y}`];if(typeof T=="function"&&s.length>0){let M=Op(s,T,()=>{});M&&(u.lazy=Object.assign(u.lazy||{},{[y]:M}))}})}return["loader","action"].forEach(p=>{let y=t[p];if(typeof y=="function"&&o[p].length>0){let T=y[xh]??y,s=Op(o[p],T,(...M)=>Jk(M[0]));s&&(p==="loader"&&T.hydrate===!0&&(s.hydrate=!0),s[xh]=T,u[p]=s)}}),t.middleware&&t.middleware.length>0&&o.middleware.length>0&&(u.middleware=t.middleware.map(p=>{let y=p[xh]??p,T=Op(o.middleware,y,(...s)=>Jk(s[0]));return T?(T[xh]=y,T):p})),u}function _7(e,t){let o={navigate:[],fetch:[]};if(t.forEach(u=>u({instrument(p){let y=Object.keys(p);for(let T of y)p[T]&&o[T].push(p[T])}})),o.navigate.length>0){let u=e.navigate[xh]??e.navigate,p=Op(o.navigate,u,(...y)=>{let[T,s]=y;return{to:typeof T=="number"||typeof T=="string"?T:T?Ec(T):".",...Qk(e,s??{})}});p&&(p[xh]=u,e.navigate=p)}if(o.fetch.length>0){let u=e.fetch[xh]??e.fetch,p=Op(o.fetch,u,(...y)=>{let[T,,s,M]=y;return{href:s??".",fetcherKey:T,...Qk(e,M??{})}});p&&(p[xh]=u,e.fetch=p)}return e}function Op(e,t,o){return e.length===0?null:async(...u)=>{let p=await Kk(e,o(...u),()=>t(...u),e.length-1);if(p.type==="error")throw p.value;return p.value}}async function Kk(e,t,o,u){let p=e[u],y;if(p){let T,s=async()=>(T?console.error("You cannot call instrumented handlers more than once"):T=Kk(e,t,o,u-1),y=await T,on(y,"Expected a result"),y.type==="error"&&y.value instanceof Error?{status:"error",error:y.value}:{status:"success",error:void 0});try{await p(s,t)}catch(M){console.error("An instrumentation function threw an error:",M)}T||await s(),await T}else try{y={type:"success",value:await o()}}catch(T){y={type:"error",value:T}}return y||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Jk(e){let{request:t,context:o,params:u,pattern:p}=e;return{request:y7(t),params:{...u},pattern:p,context:v7(o)}}function Qk(e,t){return{currentUrl:Ec(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function y7(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function v7(e){if(b7(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var x7=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function b7(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===x7}var eR=["POST","PUT","PATCH","DELETE"],w7=new Set(eR),T7=["GET",...eR],E7=new Set(T7),tR=new Set([301,302,303,307,308]),S7=new Set([307,308]),zE={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},C7={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},E_={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},I7=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),rR="remix-router-transitions",iR=Symbol("ResetLoaderData"),$d,Fp,bh,Np,A7=class{constructor(e){__(this,$d),__(this,Fp),__(this,bh),__(this,Np),Tc(this,$d,e),Tc(this,Fp,Nx(e))}get stableRoutes(){return pl(this,$d)}get activeRoutes(){return pl(this,bh)??pl(this,$d)}get branches(){return pl(this,Np)??pl(this,Fp)}get hasHMRRoutes(){return pl(this,bh)!=null}setRoutes(e){Tc(this,$d,e),Tc(this,Fp,Nx(e))}setHmrRoutes(e){Tc(this,bh,e),Tc(this,Np,Nx(e))}commitHmrRoutes(){pl(this,bh)&&(Tc(this,$d,pl(this,bh)),Tc(this,Fp,pl(this,Np)),Tc(this,bh,void 0),Tc(this,Np,void 0))}};$d=new WeakMap,Fp=new WeakMap,bh=new WeakMap,Np=new WeakMap;function P7(e){const t=e.window?e.window:typeof window<"u"?window:void 0,o=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";on(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let u=e.hydrationRouteProperties||[],p=e.mapRouteProperties||I7,y=p;if(e.instrumentations){let q=e.instrumentations;y=Q=>({...p(Q),...g7(q.map(J=>
50J.route).filter(Boolean),Q)})}let T={},s=new A7(x_(e.routes,y,void 0,T)),M=e.basename||"/";M.startsWith("/")||(M=`/${M}`);let L=e.dataStrategy||z7,B={...e.future},H=null,$=new Set,te=null,xe=null,pe=null,Ne=null,_e=e.hydrationData!=null,ie=ql(s.activeRoutes,e.history.location,M,!1,s.branches),ke=!1,ot=null,et,wt;if(ie==null&&!e.patchRoutesOnNavigation){let q=_l(404,{pathname:e.history.location.pathname}),{matches:Q,route:J}=jx(s.activeRoutes);et=!0,wt=!et,ie=Q,ot={[J.id]:q}}else if(ie&&!e.hydrationData&&Pl(ie,s.activeRoutes,e.history.location.pathname).active&&(ie=null),ie)if(ie.some(q=>q.route.lazy))et=!1,wt=!et;else if(!ie.some(q=>OE(q.route)))et=!0,wt=!et;else{let q=e.hydrationData?e.hydrationData.loaderData:null,Q=e.hydrationData?e.hydrationData.errors:null,J=ie;if(Q){let ce=ie.findIndex(Ce=>Q[Ce.route.id]!==void 0);J=J.slice(0,ce+1)}wt=!1,et=!0,J.forEach(ce=>{let Ce=sR(ce.route,q,Q);wt=wt||Ce.renderFallback,et=et&&!Ce.shouldLoad})}else{et=!1,wt=!et,ie=[];let q=Pl(null,s.activeRoutes,e.history.location.pathname);q.active&&q.matches&&(ke=!0,ie=q.matches)}let It,K={historyAction:e.history.action,location:e.history.location,matches:ie,initialized:et,renderFallback:wt,navigation:zE,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ot,fetchers:new Map,blockers:new Map},ve="POP",Ae=null,Ye=!1,Be,Fe=!1,Je=new Map,ze=null,He=!1,tt=!1,Oe=new Set,rt=new Map,Nt=0,jt=-1,gr=new Map,li=new Set,di=new Map,Wr=new Map,fr=new Set,Ur=new Map,qi,zn=null;function sn(){if(H=e.history.listen(({action:q,location:Q,delta:J})=>{if(qi){qi(),qi=void 0;return}No(Ur.size===0||J!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs.  This can also happen if you are using createHashRouter and the user manually changes the URL.");let ce=Il({currentLocation:K.location,nextLocation:Q,historyAction:q});if(ce&&J!=null){let Ce=new Promise(Ee=>{qi=Ee});e.history.go(J*-1),wo(ce,{state:"blocked",location:Q,proceed(){wo(ce,{state:"proceeding",proceed:void 0,reset:void 0,location:Q}),Ce.then(()=>e.history.go(J))},reset(){let Ee=new Map(K.blockers);Ee.set(ce,E_),tn({blockers:Ee})}}),Ae==null||Ae.resolve(),Ae=null;return}return Lo(q,Q)}),o){J7(t,Je);let q=()=>Q7(t,Je);t.addEventListener("pagehide",q),ze=()=>t.removeEventListener("pagehide",q)}return K.initialized||Lo("POP",K.location,{initialHydration:!0}),It}function ao(){H&&H(),ze&&ze(),$.clear(),Be&&Be.abort(),K.fetchers.forEach((q,Q)=>yi(K.fetchers,Q)),K.blockers.forEach((q,Q)=>Cl(Q))}function So(q){if($.add(q),te){let{newErrors:Q}=te;te=null,q(K,{deletedFetchers:[],newErrors:Q,viewTransitionOpts:void 0,flushSync:!1})}return()=>$.delete(q)}function tn(q,Q={}){q.matches&&(q.matches=q.matches.map(Ce=>{let Ee=T[Ce.route.id],Re=Ce.route;return Re.element!==Ee.element||Re.errorElement!==Ee.errorElement||Re.hydrateFallbackElement!==Ee.hydrateFallbackElement?{...Ce,route:Ee}:Ce})),K={...K,...q};let J=[],ce=[];K.fetchers.forEach((Ce,Ee)=>{Ce.state==="idle"&&(fr.has(Ee)?J.push(Ee):ce.push(Ee))}),fr.forEach(Ce=>{!K.fetchers.has(Ce)&&!rt.has(Ce)&&J.push(Ce)}),$.size===0&&(te={newErrors:q.errors??null}),[...$].forEach(Ce=>Ce(K,{deletedFetchers:J,newErrors:q.errors??null,viewTransitionOpts:Q.viewTransitionOpts,flushSync:Q.flushSync===!0})),J.forEach(Ce=>yi(K.fetchers,Ce)),ce.forEach(Ce=>K.fetchers.delete(Ce))}function Wi(q,Q,{flushSync:J}={}){var Ht,Kt;let ce=K.actionData!=null&&K.navigation.formMethod!=null&&zs(K.navigation.formMethod)&&K.navigation.state==="loading"&&((Ht=q.state)==null?void 0:Ht._isRedirect)!==!0,Ce;Q.actionData?Object.keys(Q.actionData).length>0?Ce=Q.actionData:Ce=null:ce?Ce=K.actionData:Ce=null;let Ee=Q.loaderData?bR(K.loaderData,Q.loaderData,Q.matches||[],Q.errors):K.loaderData,Re=K.blockers;Re.size>0&&(Re=new Map(Re),Re.forEach((er,dr)=>Re.set(dr,E_)));let dt=He?!1:Fh(q,Q.matches||K.matches),Ge=Ye===!0||K.navigation.formMethod!=null&&zs(K.navigation.formMethod)&&((Kt=q.state)==null?void 0:Kt._isRedirect)!==!0;s.commitHmrRoutes(),He||ve==="POP"||(ve==="PUSH"?e.history.push(q,q.state):ve==="REPLACE"&&e.history.replace(q,q.state));let Mt;if(ve==="POP"){let er=Je.get(K.location.pathname);er&&er.has(q.pathname)?Mt={currentLocation:K.location,nextLocation:q}:Je.has(q.pathname)&&(Mt={currentLocation:q,nextLocation:K.location})}else if(Fe){let er=Je.get(K.location.pathname);er?er.add(q.pathname):(er=new Set([q.pathname]),Je.set(K.location.pathname,er)),Mt={currentLocation:K.location,nextLocation:q}}tn({...Q,actionData:Ce,loaderData:Ee,historyAction:ve,location:q,initialized:!0,renderFallback:!1,navigation:zE,revalidation:"idle",restoreScrollPosition:dt,preventScrollReset:Ge,blockers:Re},{viewTransitionOpts:Mt,flushSync:J===!0}),ve="POP",Ye=!1,Fe=!1,He=!1,tt=!1,Ae==null||Ae.resolve(),Ae=null,zn==null||zn.resolve(),zn=null}async function Xr(q,Q){if(Ae==null||Ae.resolve(),Ae=null,typeof q=="number"){Ae||(Ae=CR());let Er=Ae.promise;return e.history.go(q),Er}let J=DE(K.location,K.matches,M,q,Q==null?void 0:Q.fromRouteId,Q==null?void 0:Q.relative),{path:ce,submission:Ce,error:Ee}=nR(!1,J,Q),Re;
50Q!=null&&Q.mask&&(Re={pathname:"",search:"",hash:"",...typeof Q.mask=="string"?Sc(Q.mask):{...K.location.mask,...Q.mask}});let dt=K.location,Ge=y_(dt,ce,Q&&Q.state,void 0,Re);Ge={...Ge,...e.history.encodeLocation(Ge)};let Mt=Q&&Q.replace!=null?Q.replace:void 0,Ht="PUSH";Mt===!0?Ht="REPLACE":Mt===!1||Ce!=null&&zs(Ce.formMethod)&&Ce.formAction===K.location.pathname+K.location.search&&(Ht="REPLACE");let Kt=Q&&"preventScrollReset"in Q?Q.preventScrollReset===!0:void 0,er=(Q&&Q.flushSync)===!0,dr=Il({currentLocation:dt,nextLocation:Ge,historyAction:Ht});if(dr){wo(dr,{state:"blocked",location:Ge,proceed(){wo(dr,{state:"proceeding",proceed:void 0,reset:void 0,location:Ge}),Xr(q,Q)},reset(){let Er=new Map(K.blockers);Er.set(dr,E_),tn({blockers:Er})}});return}await Lo(Ht,Ge,{submission:Ce,pendingError:Ee,preventScrollReset:Kt,replace:Q&&Q.replace,enableViewTransition:Q&&Q.viewTransition,flushSync:er,callSiteDefaultShouldRevalidate:Q&&Q.defaultShouldRevalidate})}function Ro(){zn||(zn=CR()),pr(),tn({revalidation:"loading"});let q=zn.promise;return K.navigation.state==="submitting"?q:K.navigation.state==="idle"?(Lo(K.historyAction,K.location,{startUninterruptedRevalidation:!0}),q):(Lo(ve||K.historyAction,K.navigation.location,{overrideNavigation:K.navigation,enableViewTransition:Fe===!0}),q)}async function Lo(q,Q,J){Be&&Be.abort(),Be=null,ve=q,He=(J&&J.startUninterruptedRevalidation)===!0,rl(K.location,K.matches),Ye=(J&&J.preventScrollReset)===!0,Fe=(J&&J.enableViewTransition)===!0;let ce=s.activeRoutes,Ce=J!=null&&J.initialHydration&&K.matches&&K.matches.length>0&&!ke?K.matches:ql(ce,Q,M,!1,s.branches),Ee=(J&&J.flushSync)===!0;if(Ce&&K.initialized&&!tt&&j7(K.location,Q)&&!(J&&J.submission&&zs(J.submission.formMethod))){Wi(Q,{matches:Ce},{flushSync:Ee});return}let Re=Pl(Ce,ce,Q.pathname);if(Re.active&&Re.matches&&(Ce=Re.matches),!Ce){let{error:Ar,notFoundMatches:ei,route:rn}=Al(Q.pathname);Wi(Q,{matches:ei,loaderData:{},errors:{[rn.id]:Ar}},{flushSync:Ee});return}let dt=J&&J.overrideNavigation?{...J.overrideNavigation,matches:Ce,historyAction:q}:void 0;Be=new AbortController;let Ge=Vp(e.history,Q,Be.signal,J&&J.submission),Mt=e.getContext?await e.getContext():new Vk,Ht;if(J&&J.pendingError)Ht=[wh(Ce).route.id,{type:"error",error:J.pendingError}];else if(J&&J.submission&&zs(J.submission.formMethod)){let Ar=await oc(Ge,Q,J.submission,Ce,q,Mt,Re.active,J&&J.initialHydration===!0,{replace:J.replace,flushSync:Ee});if(Ar.shortCircuited)return;if(Ar.pendingActionResult){let[ei,rn]=Ar.pendingActionResult;if(Ya(rn)&&w_(rn.error)&&rn.error.status===404){Be=null,Wi(Q,{matches:Ar.matches,loaderData:{},errors:{[ei]:rn.error}});return}}Ce=Ar.matches||Ce,Ht=Ar.pendingActionResult,dt=UE(Q,Ce,q,J.submission),Ee=!1,Re.active=!1,Ge=Vp(e.history,Ge.url,Ge.signal)}let{shortCircuited:Kt,matches:er,loaderData:dr,errors:Er,workingFetchers:Kr}=await Gs(Ge,Q,Ce,q,Mt,Re.active,dt,J&&J.submission,J&&J.fetcherSubmission,J&&J.replace,J&&J.initialHydration===!0,Ee,Ht,J&&J.callSiteDefaultShouldRevalidate);Kt||(Be=null,Wi(Q,{matches:er||Ce,...wR(Ht),loaderData:dr,errors:Er,...Kr?{fetchers:Kr}:{}}))}async function oc(q,Q,J,ce,Ce,Ee,Re,dt,Ge={}){pr();let Mt=Y7(Q,ce,Ce,J);if(tn({navigation:Mt},{flushSync:Ge.flushSync===!0}),Re){let er=await ai(ce,Q.pathname,q.signal);if(er.type==="aborted")return{shortCircuited:!0};if(er.type==="error"){if(er.partialMatches.length===0){let{matches:Er,route:Kr}=jx(s.activeRoutes);return{matches:Er,pendingActionResult:[Kr.id,{type:"error",error:er.error}]}}let dr=wh(er.partialMatches).route.id;return{matches:er.partialMatches,pendingActionResult:[dr,{type:"error",error:er.error}]}}else if(er.matches)ce=er.matches;else{let{notFoundMatches:dr,error:Er,route:Kr}=Al(Q.pathname);return{matches:dr,pendingActionResult:[Kr.id,{type:"error",error:Er}]}}}let Ht,Kt=$x(ce,Q);if(!Kt.route.action&&!Kt.route.lazy)Ht={type:"error",error:_l(405,{method:q.method,pathname:Q.pathname,routeId:Kt.route.id})};else{let er=Bp(y,T,q,Q,ce,Kt,dt?[]:u,Ee),dr=await pt(q,Q,er,Ee,null);if(Ht=dr[Kt.route.id],!Ht){for(let Er of ce)if(dr[Er.route.id]){Ht=dr[Er.route.id];break}}if(q.signal.aborted)return{shortCircuited:!0}}if(Hd(Ht)){let er;return Ge&&Ge.replace!=null?er=Ge.replace:er=_R(Ht.response.headers.get("Location"),new URL(q.url),M,e.history)===K.location.pathname+K.location.search,await qe(q,Ht,!0,{submission:J,replace:er}),{shortCircuited:!0}}if(Ya(Ht)){let er=wh(ce,Kt.route.id);return(Ge&&Ge.replace)!==!0&&(ve="PUSH"),{matches:ce,pendingActionResult:[er.route.id,Ht,Kt.route.id]}}return{matches:ce,pendingActionResult:[Kt.route.id,Ht]}}async function Gs(q,Q,J,ce,Ce,Ee,Re,dt,Ge,Mt,Ht,Kt,er,dr){let Er=Re||UE(Q,J,ce,dt),Kr=dt||Ge||SR(Er),Ar=!He&&!Ht;if(Ee){if(Ar){let Do=zo(er);tn({navigation:Er,...Do!==void 0?{actionData:Do}:{}},{flushSync:Kt})}let zi=await ai(J,Q.pathname,q.signal);if(zi.type==="aborted")return{shortCircuited:!0};if(zi.type==="error"){if(zi.partialMatches.length===0){let{matches:hs,route:Es}=jx(s.activeRoutes);return{matches:hs,loaderData:{},errors:{[Es.id]:zi.error}}}let Do=wh(zi.partialMatches).route.id;return{matches:zi.partialMatches,loaderData:{},errors:{[Do]:zi.error}}}else if(zi.matches)J=zi.matches;else{let{error:Do,notFoundMatches:hs,route:Es}=Al(Q.pathname);return{matches:hs,loaderData:{},errors:{[Es.id]:Do}}}}let ei=s.activeRoutes,{dsMatches:rn,revalidatingFetchers:Xi}=oR(q,Ce,y,T,e.history,K,J,Kr,Q,Ht?[]:u,Ht===!0,tt,Oe,fr,di,li,ei,M,e.patchRoutesOnNavigation!=null,s.branches,er,dr);if(jt=++Nt,!e.dataStrategy&&!rn.some(zi=>zi.shouldLoad)&&!rn.some(zi=>zi.route.middleware&&zi.route.middleware.length>0)&&Xi.length===0){let zi=new Map(K.fetchers),Do=Yo(zi);return Wi(Q,{matches:J,loaderData:{},errors:er&&Ya(er[1])?{[er[0]]:er[1].error}:null,...wR(er),...Do?{fetchers:zi}:{}},{flushSync:Kt}),{shortCircuited:!0}}if(Ar){let zi={};if(!Ee){zi.navigation=Er;let Do=zo(er);Do!==void 0&&(zi.actionData=Do)}Xi.length>0&&(zi.fetchers=Uo(Xi)),tn(zi,{flushSync:Kt})}Xi.forEach(zi=>{An(zi.key),zi.controller&&rt.set(zi.key,zi.controller)});let Ei=()=>Xi.forEach(zi=>An(zi.key));Be&&Be.signal.addEventListener("abort",Ei);let{loaderResults:ti,fetcherResults:an}=await yt(rn,Xi,q,Q,Ce);if(q.signal.aborted)return{shortCircuited:!0};Be&&Be.signal.removeEventListener("abort",Ei),Xi.forEach(zi=>rt.delete(zi.key));let ji=Gx(ti);if(ji)return await qe(q,ji.result,!0,{replace:Mt}),{shortCircuited:!0};if(ji=Gx(an),ji)return li.add(ji.key),await qe(q,ji.result,!0,{replace:Mt}),{shortCircuited:!0};let Li=new Map(K.fetchers),{loaderData:Kn,errors:Jn}=xR(K,J,ti,er,Xi,an,Li);Ht&&K.errors&&(Jn={...K.errors,...Jn});let po=Yo(Li),Ml=Fi(jt,Li),Qn=po||Ml||Xi.length>0;return{matches:J,loaderData:Kn,errors:Jn,...Qn?{workingFetchers:Li}:{}}}function zo(q){if(q&&!Ya(q[1]))return{[q[0]]:q[1].data};if(K.actionData)return Object.keys(K.actionData).length===0?null:K.actionData}function Uo(q){let Q=new Map(K.fetchers);return q.forEach(J=>{let ce=Q.get(J.key),Ce=C_(void 0,ce?ce.data:void 0);Q.set(J.key,Ce)}),Q}async function aa(q,Q,J,ce){An(q);let Ce=(ce&&ce.flushSync)===!0,Ee=s.activeRoutes,Re=DE(K.location,K.matches,M,J,Q,ce==null?void 0:ce.relative),dt=ql(Ee,Re,M,!1,s.branches),Ge=Pl(dt,Ee,Re);if(Ge.active&&Ge.matches&&(dt=Ge.matches),!dt){lr(q,Q,_l(404,{pathname:Re}),{flushSync:Ce});return}let{path:Mt,submission:Ht,error:Kt}=nR(!0,Re,ce);if(Kt){lr(q,Q,Kt,{flushSync:Ce});return}let er=e.getContext?await e.getContext():new Vk,dr=(ce&&ce.preventScrollReset)===!0;if(Ht&&zs(Ht.formMethod)){await za(q,Q,Mt,dt,er,Ge.active,Ce,dr,Ht,ce&&ce.defaultShouldRevalidate);return}di.set(q,{routeId:Q,path:Mt}),await Da(q,Q,Mt,dt,er,Ge.active,Ce,dr,Ht)}async function za(q,Q,J,ce,Ce,Ee,Re,dt,Ge,Mt){pr(),di.delete(q);let Ht=K.fetchers.get(q);nr(q,K7(Ge,Ht),{flushSync:Re});let Kt=new AbortController,er=Vp(e.history,J,Kt.signal,Ge);if(Ee){let Sn=await ai(ce,new URL(er.url).pathname,er.signal,q);if(Sn.type==="aborted")return;if(Sn.type==="error"){lr(q,Q,Sn.error,{flushSync:Re});return}else if(Sn.matches)ce=Sn.matches;else{lr(q,Q,_l(404,{pathname:J}),{flushSync:Re});return}}let dr=$x(ce,J);if(!dr.route.action&&!dr.route.lazy){let Sn=_l(405,{method:Ge.formMethod,pathname:J,routeId:Q});lr(q,Q,Sn,{flushSync:Re});return}rt.set(q,Kt);let Er=Nt,Kr=Bp(y,T,er,J,ce,dr,u,Ce),Ar=await pt(er,J,Kr,Ce,q),ei=Ar[dr.route.id];if(!ei){for(let Sn of Kr)if(Ar[Sn.route.id]){ei=Ar[Sn.route.id];break}}if(er.signal.aborted){rt.get(q)===Kt&&rt.delete(q);return}if(fr.has(q)){if(Hd(ei)||Ya(ei)){nr(q,Cc(void 0));return}}else{if(Hd(ei))if(rt.delete(q),jt>Er){nr(q,Cc(void 0));return}else return li.add(q),nr(q,C_(Ge)),qe(er,ei,!1,{fetcherSubmission:Ge,preventScrollReset:dt});if(Ya(ei)){lr(q,Q,ei.error);return}}let rn=K.navigation.location||K.location,Xi=Vp(e.history,rn,Kt.signal),Ei=s.activeRoutes,ti=K.navigation.state!=="idle"?ql(Ei,K.navigation.location,M,!1,s.branches):K.matches;on(ti,"Didn't find any matches after fetcher action");let an=++Nt;gr.set(q,an);let{dsMatches:ji,revalidatingFetchers:Li}=oR(Xi,Ce,y,T,e.history,K,ti,Ge,rn,u,!1,tt,Oe,fr,di,li,Ei,M,e.patchRoutesOnNavigation!=null,s.branches,[dr.route.id,ei],Mt),Kn=C_(Ge,ei.data),Jn=new Map(K.fetchers);Jn.set(q,Kn),Li.filter(Sn=>Sn.key!==q).forEach(Sn=>{let la=Sn.key,Mu=Jn.get(la),ca=C_(void 0,Mu?Mu.data:void 0);Jn.set(la,ca),An(la),Sn.controller&&rt.set(la,Sn.controller)}),tn({fetchers:Jn});let po=()=>Li.forEach(Sn=>An(Sn.key));Kt.signal.addEventListener("abort",po);let{loaderResults:Ml,fetcherResults:Qn}
50=await yt(ji,Li,Xi,rn,Ce);if(Kt.signal.aborted)return;Kt.signal.removeEventListener("abort",po),gr.delete(q),rt.delete(q),Li.forEach(Sn=>rt.delete(Sn.key));let zi=K.fetchers.has(q),Do=Sn=>{if(!zi)return Sn;let la=new Map(Sn.fetchers);return la.set(q,Cc(ei.data)),{...Sn,fetchers:la}},hs=Gx(Ml);if(hs)return K=Do(K),qe(Xi,hs.result,!1,{preventScrollReset:dt});if(hs=Gx(Qn),hs)return li.add(hs.key),K=Do(K),qe(Xi,hs.result,!1,{preventScrollReset:dt});let Es=new Map(K.fetchers);zi&&Es.set(q,Cc(ei.data));let{loaderData:Pu,errors:Nc}=xR(K,ti,Ml,void 0,Li,Qn,Es);Fi(an,Es),K.navigation.state==="loading"&&an>jt?(on(ve,"Expected pending action"),Be&&Be.abort(),Wi(K.navigation.location,{matches:ti,loaderData:Pu,errors:Nc,fetchers:Es})):(tn({errors:Nc,loaderData:bR(K.loaderData,Pu,ti,Nc),fetchers:Es}),tt=!1)}async function Da(q,Q,J,ce,Ce,Ee,Re,dt,Ge){let Mt=K.fetchers.get(q);nr(q,C_(Ge,Mt?Mt.data:void 0),{flushSync:Re});let Ht=new AbortController,Kt=Vp(e.history,J,Ht.signal);if(Ee){let ei=await ai(ce,new URL(Kt.url).pathname,Kt.signal,q);if(ei.type==="aborted")return;if(ei.type==="error"){lr(q,Q,ei.error,{flushSync:Re});return}else if(ei.matches)ce=ei.matches;else{lr(q,Q,_l(404,{pathname:J}),{flushSync:Re});return}}let er=$x(ce,J);rt.set(q,Ht);let dr=Nt,Er=Bp(y,T,Kt,J,ce,er,u,Ce),Kr=await pt(Kt,J,Er,Ce,q),Ar=Kr[er.route.id];if(!Ar){for(let ei of ce)if(Kr[ei.route.id]){Ar=Kr[ei.route.id];break}}if(rt.get(q)===Ht&&rt.delete(q),!Kt.signal.aborted){if(fr.has(q)){nr(q,Cc(void 0));return}if(Hd(Ar))if(jt>dr){nr(q,Cc(void 0));return}else{li.add(q),await qe(Kt,Ar,!1,{preventScrollReset:dt});return}if(Ya(Ar)){lr(q,Q,Ar.error);return}nr(q,Cc(Ar.data))}}async function qe(q,Q,J,{submission:ce,fetcherSubmission:Ce,preventScrollReset:Ee,replace:Re}={}){J||(Ae==null||Ae.resolve(),Ae=null),Q.response.headers.has("X-Remix-Revalidate")&&(tt=!0);let dt=Q.response.headers.get("Location");on(dt,"Expected a Location header on the redirect Response"),dt=_R(dt,new URL(q.url),M,e.history);let Ge=y_(K.location,dt,{_isRedirect:!0});if(o){let Er=!1;if(Q.response.headers.has("X-Remix-Reload-Document"))Er=!0;else if(ME(dt)){const Kr=Bk(dt,!0);Er=Kr.origin!==t.location.origin||ml(Kr.pathname,M)==null}if(Er){Re?t.location.replace(dt):t.location.assign(dt);return}}Be=null;let Mt=Re===!0||Q.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Ht,formAction:Kt,formEncType:er}=K.navigation;!ce&&!Ce&&Ht&&Kt&&er&&(ce=SR(K.navigation));let dr=ce||Ce;if(S7.has(Q.response.status)&&dr&&zs(dr.formMethod))await Lo(Mt,Ge,{submission:{...dr,formAction:dt},preventScrollReset:Ee||Ye,enableViewTransition:J?Fe:void 0});else{let Er=UE(Ge,[],Mt,ce);await Lo(Mt,Ge,{overrideNavigation:Er,fetcherSubmission:Ce,preventScrollReset:Ee||Ye,enableViewTransition:J?Fe:void 0})}}async function pt(q,Q,J,ce,Ce){var dt;let Ee,Re={};try{Ee=await O7(L,q,Q,J,Ce,ce,!1)}catch(Ge){return J.filter(Mt=>Mt.shouldLoad).forEach(Mt=>{Re[Mt.route.id]={type:"error",error:Ge}}),Re}if(q.signal.aborted)return Re;if(!zs(q.method))for(let Ge of J){if(((dt=Ee[Ge.route.id])==null?void 0:dt.type)==="error")break;!Ee.hasOwnProperty(Ge.route.id)&&!K.loaderData.hasOwnProperty(Ge.route.id)&&(!K.errors||!K.errors.hasOwnProperty(Ge.route.id))&&Ge.shouldCallHandler()&&(Ee[Ge.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ge.route.id}`)})}for(let[Ge,Mt]of Object.entries(Ee))if(q7(Mt)){let Ht=Mt.result;Re[Ge]={type:"redirect",response:V7(Ht,q,Ge,J,M)}}else Re[Ge]=await B7(Mt);return Re}async function yt(q,Q,J,ce,Ce){let Ee=pt(J,ce,q,Ce,null),Re=Promise.all(Q.map(async Mt=>{if(Mt.matches&&Mt.match&&Mt.request&&Mt.controller){let Kt=(await pt(Mt.request,Mt.path,Mt.matches,Ce,Mt.key))[Mt.match.route.id];return{[Mt.key]:Kt}}else return Promise.resolve({[Mt.key]:{type:"error",error:_l(404,{pathname:Mt.path})}})})),dt=await Ee,Ge=(await Re).reduce((Mt,Ht)=>Object.assign(Mt,Ht),{});return{loaderResults:dt,fetcherResults:Ge}}function pr(){tt=!0,di.forEach((q,Q)=>{rt.has(Q)&&Oe.add(Q),An(Q)})}function nr(q,Q,J={}){let ce=new Map(K.fetchers);ce.set(q,Q),tn({fetchers:ce},{flushSync:(J&&J.flushSync)===!0})}function lr(q,Q,J,ce={}){let Ce=wh(K.matches,Q),Ee=new Map(K.fetchers);yi(Ee,q),tn({errors:{[Ce.route.id]:J},fetchers:Ee},{flushSync:(ce&&ce.flushSync)===!0})}
50function wr(q){return Wr.set(q,(Wr.get(q)||0)+1),fr.has(q)&&fr.delete(q),K.fetchers.get(q)||C7}function Yr(q,Q){An(q,Q==null?void 0:Q.reason),nr(q,Cc(null))}function yi(q,Q){let J=K.fetchers.get(Q);rt.has(Q)&&!(J&&J.state==="loading"&&gr.has(Q))&&An(Q),di.delete(Q),gr.delete(Q),li.delete(Q),fr.delete(Q),Oe.delete(Q),q.delete(Q)}function Rn(q){let Q=(Wr.get(q)||0)-1;Q<=0?(Wr.delete(q),fr.add(q)):Wr.set(q,Q),tn({fetchers:new Map(K.fetchers)})}function An(q,Q){let J=rt.get(q);J&&(J.abort(Q),rt.delete(q))}function lo(q,Q){for(let J of q){let ce=Q.get(J);on(ce,`Expected fetcher: ${J}`);let Ce=Cc(ce.data);Q.set(J,Ce)}}function Yo(q){let Q=[],J=!1;for(let ce of li){let Ce=q.get(ce);on(Ce,`Expected fetcher: ${ce}`),Ce.state==="loading"&&(li.delete(ce),Q.push(ce),J=!0)}return lo(Q,q),J}function Fi(q,Q){let J=[];for(let[ce,Ce]of gr)if(Ce<q){let Ee=Q.get(ce);on(Ee,`Expected fetcher: ${ce}`),Ee.state==="loading"&&(An(ce),gr.delete(ce),J.push(ce))}return lo(J,Q),J.length>0}function tl(q,Q){let J=K.blockers.get(q)||E_;return Ur.get(q)!==Q&&Ur.set(q,Q),J}function Cl(q){K.blockers.delete(q),Ur.delete(q)}function wo(q,Q){let J=K.blockers.get(q)||E_;on(J.state==="unblocked"&&Q.state==="blocked"||J.state==="blocked"&&Q.state==="blocked"||J.state==="blocked"&&Q.state==="proceeding"||J.state==="blocked"&&Q.state==="unblocked"||J.state==="proceeding"&&Q.state==="unblocked",`Invalid blocker state transition: ${J.state} -> ${Q.state}`);let ce=new Map(K.blockers);ce.set(q,Q),tn({blockers:ce})}function Il({currentLocation:q,nextLocation:Q,historyAction:J}){if(Ur.size===0)return;Ur.size>1&&No(!1,"A router only supports one blocker at a time");let ce=Array.from(Ur.entries()),[Ce,Ee]=ce[ce.length-1],Re=K.blockers.get(Ce);if(!(Re&&Re.state==="proceeding")&&Ee({currentLocation:q,nextLocation:Q,historyAction:J}))return Ce}function Al(q){let Q=_l(404,{pathname:q}),J=s.activeRoutes,{matches:ce,route:Ce}=jx(J);return{notFoundMatches:ce,route:Ce,error:Q}}function Fc(q,Q,J){if(xe=q,Ne=Q,pe=J||null,!_e&&K.navigation===zE){_e=!0;let ce=Fh(K.location,K.matches);ce!=null&&tn({restoreScrollPosition:ce})}return()=>{xe=null,Ne=null,pe=null}}function Tt(q,Q){return pe&&pe(q,Q.map(ce=>J9(ce,K.loaderData)))||q.key}function rl(q,Q){if(xe&&Ne){let J=Tt(q,Q);xe[J]=Ne()}}function Fh(q,Q){if(xe){let J=Tt(q,Q),ce=xe[J];if(typeof ce=="number")return ce}return null}function Pl(q,Q,J){if(e.patchRoutesOnNavigation){let ce=s.branches;if(q){if(Object.keys(q[0].params).length>0)return{active:!0,matches:ql(Q,J,M,!0,ce)}}else return{active:!0,matches:ql(Q,J,M,!0,ce)||[]}}return{active:!1,matches:null}}async function ai(q,Q,J,ce){if(!e.patchRoutesOnNavigation)return{type:"success",matches:q};let Ce=q;for(;;){let Ee=T;try{await e.patchRoutesOnNavigation({signal:J,path:Q,matches:Ce,fetcherKey:ce,patch:(Mt,Ht)=>{J.aborted||aR(Mt,Ht,s,Ee,y,!1)}})}catch(Mt){return{type:"error",error:Mt,partialMatches:Ce}}if(J.aborted)return{type:"aborted"};let Re=s.branches,dt=ql(s.activeRoutes,Q,M,!1,Re),Ge=null;if(dt){if(Object.keys(dt[0].params).length===0)return{type:"success",matches:dt};if(Ge=ql(s.activeRoutes,Q,M,!0,Re),!(Ge&&Ce.length<Ge.length&&Xe(Ce,Ge.slice(0,Ce.length))))return{type:"success",matches:dt}}if(Ge||(Ge=ql(s.activeRoutes,Q,M,!0,Re)),!Ge||Xe(Ce,Ge))return{type:"success",matches:null};Ce=Ge}}function Xe(q,Q){return q.length===Q.length&&q.every((J,ce)=>
50J.route.id===Q[ce].route.id)}function Y(q){T={},s.setHmrRoutes(x_(q,y,void 0,T))}function ee(q,Q,J=!1){aR(q,Q,s,T,y,J),s.hasHMRRoutes||tn({})}return It={get basename(){return M},get future(){return B},get state(){return K},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return T},get window(){return t},initialize:sn,subscribe:So,enableScrollRestoration:Fc,navigate:Xr,fetch:aa,revalidate:Ro,createHref:q=>e.history.createHref(q),encodeLocation:q=>e.history.encodeLocation(q),getFetcher:wr,resetFetcher:Yr,deleteFetcher:Rn,dispose:ao,getBlocker:tl,deleteBlocker:Cl,patchRoutes:ee,_internalFetchControllers:rt,_internalSetRoutes:Y,_internalSetStateDoNotUseOrYouWillBreakYourApp(q){tn(q)}},e.instrumentations&&(It=_7(It,e.instrumentations.map(q=>q.router).filter(Boolean))),It}function M7(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function DE(e,t,o,u,p,y){let T,s;if(p){T=[];for(let L of t)if(T.push(L),L.route.id===p){s=L;break}}else T=t,s=t[t.length-1];let M=Vx(u||".",RE(T),ml(e.pathname,o)||e.pathname,y==="path");if(u==null&&(M.search=e.search,M.hash=e.hash),(u==null||u===""||u===".")&&s){let L=VE(M.search);if(s.route.index&&!L)M.search=M.search?M.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&L){let B=new URLSearchParams(M.search),H=B.getAll("index");B.delete("index"),H.filter(te=>te).forEach(te=>B.append("index",te));let $=B.toString();M.search=$?`?${$}`:""}}return o!=="/"&&(M.pathname=h7({basename:o,pathname:M.pathname})),Ec(M)}function nR(e,t,o){if(!o||!M7(o))return{path:t};if(o.formMethod&&!X7(o.formMethod))return{path:t,error:_l(405,{method:o.formMethod})};let u=()=>({path:t,error:_l(400,{type:"invalid-body"})}),y=(o.formMethod||"get").toUpperCase(),T=TR(t);if(o.body!==void 0){if(o.formEncType==="text/plain"){if(!zs(y))return u();let H=typeof o.body=="string"?o.body:o.body instanceof FormData||o.body instanceof URLSearchParams?Array.from(o.body.entries()).reduce(($,[te,xe])=>`${$}${te}=${xe}
51`,""):String(o.body);return{path:t,submission:{formMethod:y,formAction:T,formEncType:o.formEncType,formData:void 0,json:void 0,text:H}}}else if(o.formEncType==="application/json"){if(!zs(y))return u();try{let H=typeof o.body=="string"?JSON.parse(o.body):o.body;return{path:t,submission:{formMethod:y,formAction:T,formEncType:o.formEncType,formData:void 0,json:H,text:void 0}}}catch{return u()}}}on(typeof FormData=="function","FormData is not available in this environment");let s,M;if(o.formData)s=NE(o.formData),M=o.formData;else if(o.body instanceof FormData)s=NE(o.body),M=o.body;else if(o.body instanceof URLSearchParams)s=o.body,M=vR(s);else if(o.body==null)s=new URLSearchParams,M=new FormData;else try{s=new URLSearchParams(o.body),M=vR(s)}catch{return u()}let L={formMethod:y,formAction:T,formEncType:o&&o.formEncType||"application/x-www-form-urlencoded",formData:M,json:void 0,text:void 0};if(zs(L.formMethod))return{path:t,submission:L};let B=Sc(t);return e&&B.search&&VE(B.search)&&s.append("index",""),B.search=`?${s}`,{path:Ec(B),submission:L}}function oR(e,t,o,u,p,y,T,s,M,L,B,H,$,te,xe,pe,Ne,_e,ie,ke,ot,et){var He;let wt=ot?Ya(ot[1])?ot[1].error:ot[1].data:void 0,It=p.createURL(y.location),K=p.createURL(M),ve;if(B&&y.errors){let tt=Object.keys(y.errors)[0];ve=T.findIndex(Oe=>Oe.route.id===tt)}else if(ot&&Ya(ot[1])){let tt=ot[0];ve=T.findIndex(Oe=>Oe.route.id===tt)-1}let Ae=ot?ot[1].statusCode:void 0,Ye=Ae&&Ae>=400,Be={currentUrl:It,currentParams:((He=y.matches[0])==null?void 0:He.params)||{},nextUrl:K,nextParams:T[0].params,...s,actionResult:wt,actionStatus:Ae},Fe=T_(T),Je=T.map((tt,Oe)=>{let{route:rt}=tt,Nt=null;if(ve!=null&&Oe>ve)Nt=!1;else if(rt.lazy)Nt=!0;else if(!OE(rt))Nt=!1;else if(B){let{shouldLoad:di}=sR(rt,y.loaderData,y.errors);Nt=di}else k7(y.loaderData,y.matches[Oe],tt)&&(Nt=!0);if(Nt!==null)return FE(o,u,e,M,Fe,tt,L,t,Nt);let jt=!1;typeof et=="boolean"?jt=et:Ye?jt=!1:(H||It.pathname+It.search===K.pathname+K.search||It.search!==K.search||R7(y.matches[Oe],tt))&&(jt=!0);let gr={...Be,defaultShouldRevalidate:jt},li=S_(tt,gr);return FE(o,u,e,M,Fe,tt,L,t,li,gr,et)}),ze=[];return xe.forEach((tt,Oe)=>{if(B||!T.some(fr=>fr.route.id===tt.routeId)||te.has(Oe))return;let rt=y.fetchers.get(Oe),Nt=rt&&rt.state!=="idle"&&rt.data===void 0,jt=ql(Ne,tt.path,_e??"/",!1,ke);if(!jt){if(ie&&Nt)return;ze.push({key:Oe,routeId:tt.routeId,path:tt.path,matches:null,match:null,request:null,controller:null});return}if(pe.has(Oe))return;let gr=$x(jt,tt.path),li=new AbortController,di=Vp(p,tt.path,li.signal),Wr=null;if($.has(Oe))$.delete(Oe),Wr=Bp(o,u,di,tt.path,jt,gr,L,t);else if(Nt)H&&(Wr=Bp(o,u,di,tt.path,jt,gr,L,t));else{let fr;typeof et=="boolean"?fr=et:Ye?fr=!1:fr=H;let Ur={...Be,defaultShouldRevalidate:fr};S_(gr,Ur)&&(Wr=Bp(o,u,di,tt.path,jt,gr,L,t,Ur))}Wr&&ze.push({key:Oe,routeId:tt.routeId,path:tt.path,matches:Wr,match:gr,request:di,controller:li})}),{dsMatches:Je,revalidatingFetchers:ze}}function OE(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function sR(e,t,o){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!OE(e))return{shouldLoad:!1,renderFallback:!1};let u=t!=null&&e.id in t,p=o!=null&&o[e.id]!==void 0;if(!u&&p)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!u};let y=!u&&!p;return{shouldLoad:y,renderFallback:y}}function k7(e,t,o){let u=!t||o.route.id!==t.route.id,p=!e.hasOwnProperty(o.route.id);return u||p}function R7(e,t){let o=e.route.path;return e.pathname!==t.pathname||o!=null&&o.endsWith("*")&&e.params["*"]!==t.params["*"]}function S_(e,t){if(e.route.shouldRevalidate){let o=e.route.shouldRevalidate(t);if(typeof o=="boolean")return o}return t.defaultShouldRevalidate}function aR(e,t,o,u,p,y){let T;if(e){let L=u[e];on(L,`No route found to patch children into: routeId = ${e}`),L.children||(L.children=[]),T=L.children}else T=o.activeRoutes;let s=[],M=[];if(t.forEach(L=>{let B=T.find(H=>lR(L,H));B?M.push({existingRoute:B,newRoute:L}):s.push(L)}),s.length>0){let L=x_(s,p,[e||"_","patch",String((T==null?void 0:T.length)||"0")],u);T.push(...L)}if(y&&M.length>0)for(let L=0;L<M.length;L++){let{existingRoute:B,newRoute:H}=M[L],$=B,[te]=x_([H],p,[],{},!0);Object.assign($,{element:te.element?te.element:$.element,errorElement:te.errorElement?te.errorElement:$.errorElement,hydrateFallbackElement:te.hydrateFallbackElement?te.hydrateFallbackElement:$.hydrateFallbackElement})}o.hasHMRRoutes||o.setRoutes([...o.activeRoutes])}function lR(e,t){var o;return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:((o=e.children)==null?void 0:o.every((u,p)=>{var y;return(y=t.children)==null?void 0:y.some(T=>lR(u,T))}))??!1:!1}var cR=new WeakMap,uR=({key:e,route:t,manifest:o,mapRouteProperties:u})=>{let p=o[t.id];if(on(p,"No route found in manifest"),!p.lazy||typeof p.lazy!="object")return;let y=p.lazy[e];if(!y)return;let T=cR.get(p);T||(T={},cR.set(p,T));let s=T[e];
51if(s)return s;let M=(async()=>{let L=W9(e),H=p[e]!==void 0&&e!=="hasErrorBoundary";if(L)No(!L,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),T[e]=Promise.resolve();else if(H)No(!1,`Route "${p.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let $=await y();$!=null&&(Object.assign(p,{[e]:$}),Object.assign(p,u(p)))}typeof p.lazy=="object"&&(p.lazy[e]=void 0,Object.values(p.lazy).every($=>$===void 0)&&(p.lazy=void 0))})();return T[e]=M,M},hR=new WeakMap;function L7(e,t,o,u,p){let y=o[e.id];if(on(y,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let B=hR.get(y);if(B)return{lazyRoutePromise:B,lazyHandlerPromise:B};let H=(async()=>{on(typeof e.lazy=="function","No lazy route function found");let $=await e.lazy(),te={};for(let xe in $){let pe=$[xe];if(pe===void 0)continue;let Ne=Y9(xe),ie=y[xe]!==void 0&&xe!=="hasErrorBoundary";Ne?No(!Ne,"Route property "+xe+" is not a supported property to be returned from a lazy route function. This property will be ignored."):ie?No(!ie,`Route "${y.id}" has a static property "${xe}" defined but its lazy function is also returning a value for this property. The lazy route property "${xe}" will be ignored.`):te[xe]=pe}Object.assign(y,te),Object.assign(y,{...u(y),lazy:void 0})})();return hR.set(y,H),H.catch(()=>{}),{lazyRoutePromise:H,lazyHandlerPromise:H}}let T=Object.keys(e.lazy),s=[],M;for(let B of T){if(p&&p.includes(B))continue;let H=uR({key:B,route:e,manifest:o,mapRouteProperties:u});H&&(s.push(H),B===t&&(M=H))}let L=s.length>0?Promise.all(s).then(()=>{}):void 0;return L==null||L.catch(()=>{}),M==null||M.catch(()=>{}),{lazyRoutePromise:L,lazyHandlerPromise:M}}async function dR(e){let t=e.matches.filter(p=>p.shouldLoad),o={};return(await Promise.all(t.map(p=>p.resolve()))).forEach((p,y)=>{o[t[y].route.id]=p}),o}async function z7(e){return e.matches.some(t=>t.route.middleware)?fR(e,()=>dR(e)):dR(e)}function fR(e,t){return D7(e,t,u=>{if(W7(u))throw u;return u},$7,o);function o(u,p,y){if(y)return Promise.resolve(Object.assign(y.value,{[p]:{type:"error",result:u}}));{let{matches:T}=e,s=Math.min(Math.max(T.findIndex(L=>L.route.id===p),0),Math.max(T.findIndex(L=>L.shouldCallHandler()),0)),M=wh(T,T[s].route.id).route.id;return Promise.resolve({[M]:{type:"error",result:u}})}}}async function D7(e,t,o,u,p){let{matches:y,...T}=e,s=y.flatMap(L=>L.route.middleware?L.route.middleware.map(B=>[L.route.id,B]):[]);return await pR(T,s,t,o,u,p)}async function pR(e,t,o,u,p,y,T=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??new Error(`Request aborted: ${s.method} ${s.url}`);let M=t[T];if(!M)return await o();let[L,B]=M,H,$=async()=>{if(H)throw new Error("You may only call `next()` once per middleware");try{return H={value:await pR(e,t,o,u,p,y,T+1)},H.value}catch(te){return H={value:await y(te,L,H)},H.value}};try{let te=await B(e,$),xe=te!=null?u(te):void 0;return p(xe)?xe:H?xe??H.value:(H={value:await $()},H.value)}catch(te){return await y(te,L,H)}}function mR(e,t,o,u,p){let y=uR({key:"middleware",route:u.route,manifest:t,mapRouteProperties:e}),T=L7(u.route,zs(o.method)?"action":"loader",t,e,p);return{middleware:y,route:T.lazyRoutePromise,handler:T.lazyHandlerPromise}}function FE(e,t,o,u,p,y,T,s,M,L=null,B){let H=!1,$=mR(e,t,o,y,T);return{...y,_lazyPromises:$,shouldLoad:M,shouldRevalidateArgs:L,shouldCallHandler(te){return H=!0,L?typeof B=="boolean"?S_(y,{...L,defaultShouldRevalidate:B}):typeof te=="boolean"?S_(y,{...L,defaultShouldRevalidate:te}):S_(y,L):M},resolve(te){let{lazy:xe,loader:pe,middleware:Ne}=y.route,_e=H||M||te&&!zs(o.method)&&(xe||pe),ie=Ne&&Ne.length>0&&!pe&&!xe;return _e&&(zs(o.method)||!ie)?F7({request:o,path:u,pattern:p,match:y,lazyHandlerPromise:$==null?void 0:$.handler,lazyRoutePromise:$==null?void 0:$.route,handlerOverride:te,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function Bp(e,t,o,u,p,y,T,s,M=null){return p.map(L=>L.route.id!==y.route.id?{...L,shouldLoad:!1,shouldRevalidateArgs:M,shouldCallHandler:()=>!1,_lazyPromises:mR(e,t,o,L,T),resolve:()=>Promise.resolve({type:"data",result:void 0})}:FE(e,t,o,u,T_(p),L,T,s,!0,M))}async function O7(e,t,o,u,p,y,T){u.some(B=>{var H;return(H=B._lazyPromises)==null?void 0:H.middleware})&&await Promise.all(u.map(B=>{var H;return(H=B._lazyPromises)==null?void 0:H.middleware}));let s={request:t,url:yR(t,o),pattern:T_(u),params:u[0].params,context:y,matches:u},L=await e({...s,fetcherKey:p,runClientMiddleware:B=>{let H=s;return fR(H,()=>B({...H,fetcherKey:p,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(u.flatMap(B=>{var H,$;return[(H=B._lazyPromises)==null?void 0:H.handler,($=B._lazyPromises)==null?void 0:$.route]}))}catch{}return L}async function F7({request:e,path:t,pattern:o,match:u,lazyHandlerPromise:p,lazyRoutePromise:y,handlerOverride:T,scopedContext:s}){let M,L,B=zs(e.method),H=B?"action":"loader",$=te=>{let xe,pe=new Promise((ie,ke)=>xe=ke);L=()=>xe(),e.signal.addEventListener("abort",L);let Ne=ie=>typeof te!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${H}" [routeId: ${u.route.id}]`)):te({request:e,url:yR(e,t),pattern:o,params:u.params,context:s},...ie!==void 0?[ie]:[]),_e=(async()=>{try{return{type:"data",result:await(T?T(ke=>Ne(ke)):Ne())}}catch(ie){return{type:"error",result:ie}}})();return Promise.race([_e,pe])};try{let te=B?u.route.action:u.route.loader;
51if(p||y)if(te){let xe,[pe]=await Promise.all([$(te).catch(Ne=>{xe=Ne}),p,y]);if(xe!==void 0)throw xe;M=pe}else{await p;let xe=B?u.route.action:u.route.loader;if(xe)[M]=await Promise.all([$(xe),y]);else if(H==="action"){let pe=new URL(e.url),Ne=pe.pathname+pe.search;throw _l(405,{method:e.method,pathname:Ne,routeId:u.route.id})}else return{type:"data",result:void 0}}else if(te)M=await $(te);else{let xe=new URL(e.url),pe=xe.pathname+xe.search;throw _l(404,{pathname:pe})}}catch(te){return{type:"error",result:te}}finally{L&&e.signal.removeEventListener("abort",L)}return M}async function N7(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function B7(e){var u,p,y,T,s;let{result:t,type:o}=e;if(BE(t)){let M;try{M=await N7(t)}catch(L){return{type:"error",error:L}}return o==="error"?{type:"error",error:new b_(t.status,t.statusText,M),statusCode:t.status,headers:t.headers}:{type:"data",data:M,statusCode:t.status,headers:t.headers}}return o==="error"?ER(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:(u=t.init)==null?void 0:u.status,headers:(p=t.init)!=null&&p.headers?new Headers(t.init.headers):void 0}:{type:"error",error:G7(t),statusCode:w_(t)?t.status:void 0,headers:(y=t.init)!=null&&y.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:w_(t)?t.status:void 0}:ER(t)?{type:"data",data:t.data,statusCode:(T=t.init)==null?void 0:T.status,headers:(s=t.init)!=null&&s.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function V7(e,t,o,u,p){let y=e.headers.get("Location");if(on(y,"Redirects returned/thrown from loaders/actions must have a Location header"),!ME(y)){let T=u.slice(0,u.findIndex(s=>s.route.id===o)+1);y=DE(new URL(t.url),T,p,y),e.headers.set("Location",y)}return e}var gR=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function _R(e,t,o,u){if(ME(e)){let p=e,y=p.startsWith("//")?new URL(t.protocol+p):new URL(p);if(gR.includes(y.protocol))throw new Error("Invalid redirect location");let T=ml(y.pathname,o)!=null;if(y.origin===t.origin&&T)return LE(y.pathname)+y.search+y.hash}try{let p=u.createURL(e);if(gR.includes(p.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Vp(e,t,o,u){let p=e.createURL(TR(t)).toString(),y={signal:o};if(u&&zs(u.formMethod)){let{formMethod:T,formEncType:s}=u;y.method=T.toUpperCase(),s==="application/json"?(y.headers=new Headers({"Content-Type":s}),y.body=JSON.stringify(u.json)):s==="text/plain"?y.body=u.text:s==="application/x-www-form-urlencoded"&&u.formData?y.body=NE(u.formData):y.body=u.formData}return new Request(p,y)}function yR(e,t){let o=new URL(e.url),u=typeof t=="string"?Sc(t):t;if(o.pathname=u.pathname||"/",u.search){let p=new URLSearchParams(u.search),y=p.getAll("index");p.delete("index");for(let T of y.filter(Boolean))p.append("index",T);o.search=p.size?`?${p.toString()}`:""}else o.search="";return o.hash=u.hash||"",o}function NE(e){let t=new URLSearchParams;for(let[o,u]of e.entries())t.append(o,typeof u=="string"?u:u.name);return t}function vR(e){let t=new FormData;for(let[o,u]of e.entries())t.append(o,u);return t}function U7(e,t,o,u=!1,p=!1){let y={},T=null,s,M=!1,L={},B=o&&Ya(o[1])?o[1].error:void 0;return e.forEach(H=>{if(!(H.route.id in t))return;let $=H.route.id,te=t[$];if(on(!Hd(te),"Cannot handle redirect results in processLoaderData"),Ya(te)){let xe=te.error;if(B!==void 0&&(xe=B,B=void 0),T=T||{},p)T[$]=xe;else{let pe=wh(e,$);T[pe.route.id]==null&&(T[pe.route.id]=xe)}u||(y[$]=iR),M||(M=!0,s=w_(te.error)?te.error.status:500),te.headers&&(L[$]=te.headers)}else y[$]=te.data,te.statusCode&&te.statusCode!==200&&!M&&(s=te.statusCode),te.headers&&(L[$]=te.headers)}),B!==void 0&&o&&(T={[o[0]]:B},o[2]&&(y[o[2]]=void 0)),{loaderData:y,errors:T,statusCode:s||200,loaderHeaders:L}}function xR(e,t,o,u,p,y,T){let{loaderData:s,errors:M}=U7(t,o,u);return p.filter(L=>!L.matches||L.matches.some(B=>B.shouldLoad)).forEach(L=>{let{key:B,match:H,controller:$}=L;if($&&$.signal.aborted)return;let te=y[B];if(on(te,"Did not find corresponding fetcher result"),Ya(te)){let xe=wh(e.matches,H==null?void 0:H.route.id);M&&M[xe.route.id]||(M={...M,[xe.route.id]:te.error}),T.delete(B)}else if(Hd(te))on(!1,"Unhandled fetcher revalidation redirect");else{let xe=Cc(te.data);T.set(B,xe)}}),{loaderData:s,errors:M}}function bR(e,t,o,u){let p=Object.entries(t).filter(([,y])=>y!==iR).reduce((y,[T,s])=>(y[T]=s,y),{});for(let y of o){let T=y.route.id;if(!t.hasOwnProperty(T)&&e.hasOwnProperty(T)&&y.route.loader&&(p[T]=e[T]),u&&u.hasOwnProperty(T))break}return p}function wR(e){return e?Ya(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function wh(e,t){return(t?e.slice(0,e.findIndex(u=>u.route.id===t)+1):[...e]).reverse().find(u=>u.route.hasErrorBoundary===!0)||e[0]}function jx(e){let t=e.length===1?e[0]:e.find(o=>o.index||!o.path||o.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function _l(e,{pathname:t,routeId:o,method:u,type:p,message:y}={}){let T="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(T="Bad Request",u&&t&&o?s=`You made a ${u} request to "${t}" but did not provide a \`loader\` for route "${o}", so there is no way to handle the request.`:p==="invalid-body"&&(s="Unable to encode submission body")):e===403?(T="Forbidden",s=`Route "${o}" does not match URL "${t}"`):e===404?(T="Not Found",s=`No route matches URL "${t}"`):e===405&&(T="Method Not Allowed",u&&t&&o?s=`You made a ${u.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${o}", so there is no way to handle the request.`:u&&(s=`Invalid request method "${u.toUpperCase()}"`)),new b_(e||500,T,new Error(s),!0)}function Gx(e){let t=Object.entries(e);for(let o=t.length-1;o>=0;o--){let[u,p]=t[o];if(Hd(p))return{key:u,result:p}}}function TR(e){let t=typeof e=="string"?Sc(e):e;return Ec({...t,hash:""})}function j7(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function G7(e){var t,o;return new b_(((t=e.init)==null?void 0:t.status)??500,((o=e.init)==null?void 0:o.statusText)??"Internal Server Error",e.data)}function $7(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,o])=>typeof t=="string"&&H7(o))}function H7(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function q7(e){return BE(e.result)&&tR.has(e.result.status)}function Ya(e){return e.type==="error"}function Hd(e){return(e&&e.type)==="redirect"}function ER(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function BE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Z7(e){return tR.has(e)}function W7(e){return BE(e)&&Z7(e.status)&&e.headers.has("Location")}function X7(e){return E7.has(e.toUpperCase())}function zs(e){return w7.has(e.toUpperCase())}function VE(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function $x(e,t){let o=typeof t=="string"?Sc(t).search:t.search;if(e[e.length-1].route.index&&VE(o||""))return e[e.length-1];let u=Wk(e);return u[u.length-1]}function SR(e){let{formMethod:t,formAction:o,formEncType:u,text:p,formData:y,json:T}=e;if(!(!t||!o||!u)){if(p!=null)return{formMethod:t,formAction:o,formEncType:u,formData:void 0,json:void 0,text:p};if(y!=null)return{formMethod:t,formAction:o,formEncType:u,formData:y,json:void 0,text:void 0};if(T!==void 0)return{formMethod:t,formAction:o,formEncType:u,formData:void 0,json:T,text:void 0}}}function UE(e,t,o,u){return u?{state:"loading",location:e,matches:t,historyAction:o,formMethod:u.formMethod,formAction:u.formAction,formEncType:u.formEncType,formData:u.formData,json:u.json,text:u.text}:{state:"loading",location:e,matches:t,historyAction:o,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Y7(e,t,o,u){return{state:"submitting",location:e,matches:t,historyAction:o,formMethod:u.formMethod,formAction:u.formAction,formEncType:u.formEncType,formData:u.formData,json:u.json,text:u.text}}function C_(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function K7(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Cc(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function J7(e,t){try{let o=e.sessionStorage.getItem(rR);if(o){let u=JSON.parse(o);for(let[p,y]of Object.entries(u||{}))y&&Array.isArray(y)&&t.set(p,new Set(y||[]))}}catch{}}function Q7(e,t){if(t.size>0){let o={};for(let[u,p]of t)o[u]=[...p];try{e.sessionStorage.setItem(rR,JSON.stringify(o))}catch(u){No(!1,`Failed to save applied view transitions in sessionStorage (${u}).`)}}}function CR(){let e,t,o=new Promise((u,p)=>{e=async y=>{u(y);try{await o}catch{}},t=async y=>{p(y);try{await o}catch{}}});return{promise:o,resolve:e,reject:t}}var qd=mt.createContext(null);qd.displayName="DataRouter";var I_=mt.createContext(null);I_.displayName="DataRouterState";var IR=mt.createContext(!1);function AR(){return mt.useContext(IR)}var jE=mt.createContext({isTransitioning:!1});jE.displayName="ViewTransition";var PR=mt.createContext(new Map);PR.displayName="Fetchers";var eH=mt.createContext(null);eH.displayName="Await";var yl=mt.createContext(null);
51yl.displayName="Navigation";var Hx=mt.createContext(null);Hx.displayName="Location";var Zl=mt.createContext({outlet:null,matches:[],isDataRoute:!1});Zl.displayName="Route";var GE=mt.createContext(null);GE.displayName="RouteError";var MR="REACT_ROUTER_ERROR",tH="REDIRECT",rH="ROUTE_ERROR_RESPONSE";function iH(e){if(e.startsWith(`${MR}:${tH}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function nH(e){if(e.startsWith(`${MR}:${rH}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new b_(t.status,t.statusText,t.data)}catch{}}function oH(e,{relative:t}={}){on(A_(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:u}=mt.useContext(yl),{hash:p,pathname:y,search:T}=P_(e,{relative:t}),s=y;return o!=="/"&&(s=y==="/"?o:gl([o,y])),u.createHref({pathname:s,search:T,hash:p})}function A_(){return mt.useContext(Hx)!=null}function Ic(){return on(A_(),"useLocation() may be used only in the context of a <Router> component."),mt.useContext(Hx).location}var kR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function RR(e){mt.useContext(yl).static||mt.useLayoutEffect(e)}function $E(){let{isDataRoute:e}=mt.useContext(Zl);return e?bH():sH()}function sH(){on(A_(),"useNavigate() may be used only in the context of a <Router> component.");let e=mt.useContext(qd),{basename:t,navigator:o}=mt.useContext(yl),{matches:u}=mt.useContext(Zl),{pathname:p}=Ic(),y=JSON.stringify(RE(u)),T=mt.useRef(!1);return RR(()=>{T.current=!0}),mt.useCallback((M,L={})=>{if(No(T.current,kR),!T.current)return;if(typeof M=="number"){o.go(M);return}let B=Vx(M,JSON.parse(y),p,L.relative==="path");e==null&&t!=="/"&&(B.pathname=B.pathname==="/"?t:gl([t,B.pathname])),(L.replace?o.replace:o.push)(B,L.state,L)},[t,o,y,p,e])}var aH=mt.createContext(null);function lH(e){let t=mt.useContext(Zl).outlet;return mt.useMemo(()=>t&&mt.createElement(aH.Provider,{value:e},t),[t,e])}function cH(){let{matches:e}=mt.useContext(Zl),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function P_(e,{relative:t}={}){let{matches:o}=mt.useContext(Zl),{pathname:u}=Ic(),p=JSON.stringify(RE(o));return mt.useMemo(()=>Vx(e,JSON.parse(p),u,t==="path"),[e,p,u,t])}function uH(e,t,o){on(A_(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=mt.useContext(yl),{matches:p}=mt.useContext(Zl),y=p[p.length-1],T=y?y.params:{},s=y?y.pathname:"/",M=y?y.pathnameBase:"/",L=y&&y.route;{let Ne=L&&L.path||"";DR(s,!L||Ne.endsWith("*")||Ne.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${Ne}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
52
53Please change the parent <Route path="${Ne}"> to <Route path="${Ne==="/"?"*":`${Ne}/*`}">.`)}let B=Ic(),H;H=B;let $=H.pathname||"/",te=$;if(M!=="/"){let Ne=M.replace(/^\//,"").split("/");te="/"+$.replace(/^\//,"").split("/").slice(Ne.length).join("/")}let xe=o&&o.state.matches.length?o.state.matches.map(Ne=>Object.assign(Ne,{route:o.manifest[Ne.route.id]||Ne.route})):jk(e,{pathname:te});return No(L||xe!=null,`No routes matched location "${H.pathname}${H.search}${H.hash}" `),No(xe==null||xe[xe.length-1].route.element!==void 0||xe[xe.length-1].route.Component!==void 0||xe[xe.length-1].route.lazy!==void 0,`Matched leaf route at location "${H.pathname}${H.search}${H.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),mH(xe&&xe.map(Ne=>Object.assign({},Ne,{params:Object.assign({},T,Ne.params),pathname:gl([M,u.encodeLocation?u.encodeLocation(Ne.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:Ne.pathname]),pathnameBase:Ne.pathnameBase==="/"?M:gl([M,u.encodeLocation?u.encodeLocation(Ne.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:Ne.pathnameBase])})),p,o)}function hH(){let e=xH(),t=w_(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),o=e instanceof Error?e.stack:null,u="rgba(200,200,200, 0.5)",p={padding:"0.5rem",backgroundColor:u},y={padding:"2px 4px",backgroundColor:u},T=null;return console.error("Error handled by React Router default ErrorBoundary:",e),T=mt.createElement(mt.Fragment,null,mt.createElement("p",null,"💿 Hey developer 👋"),mt.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",mt.createElement("code",{style:y},"ErrorBoundary")," or"," ",mt.createElement("code",{style:y},"errorElement")," prop on your route.")),mt.createElement(mt.Fragment,null,mt.createElement("h2",null,"Unexpected Application 
53Error!"),mt.createElement("h3",{style:{fontStyle:"italic"}},t),o?mt.createElement("pre",{style:p},o):null,T)}var dH=mt.createElement(hH,null),LR=class extends mt.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const o=nH(e.digest);o&&(e=o)}let t=e!==void 0?mt.createElement(Zl.Provider,{value:this.props.routeContext},mt.createElement(GE.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?mt.createElement(fH,{error:e},t):t}};LR.contextType=IR;var HE=new WeakMap;function fH({children:e,error:t}){let{basename:o}=mt.useContext(yl);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let u=iH(t.digest);if(u){let p=HE.get(t);if(p)throw p;let y=Yk(u.location,o);if(Xk&&!HE.get(t))if(y.isExternal||u.reloadDocument)window.location.href=y.absoluteURL||y.to;else{const T=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(y.to,{replace:u.replace}));throw HE.set(t,T),T}return mt.createElement("meta",{httpEquiv:"refresh",content:`0;url=${y.absoluteURL||y.to}`})}}return e}function pH({routeContext:e,match:t,children:o}){let u=mt.useContext(qd);return u&&u.static&&u.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(u.staticContext._deepestRenderedBoundaryId=t.route.id),mt.createElement(Zl.Provider,{value:e},o)}function mH(e,t=[],o){let u=o==null?void 0:o.state;if(e==null){if(!u)return null;if(u.errors)e=u.matches;else if(t.length===0&&!u.initialized&&u.matches.length>0)e=u.matches;else return null}let p=e,y=u==null?void 0:u.errors;if(y!=null){let B=p.findIndex(H=>H.route.id&&(y==null?void 0:y[H.route.id])!==void 0);on(B>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(y).join(",")}`),p=p.slice(0,Math.min(p.length,B+1))}let T=!1,s=-1;if(o&&u){T=u.renderFallback;for(let B=0;B<p.length;B++){let H=p[B];if((H.route.HydrateFallback||H.route.hydrateFallbackElement)&&(s=B),H.route.id){let{loaderData:$,errors:te}=u,xe=H.route.loader&&!$.hasOwnProperty(H.route.id)&&(!te||te[H.route.id]===void 0);if(H.route.lazy||xe){o.isStatic&&(T=!0),s>=0?p=p.slice(0,s+1):p=[p[0]];break}}}}let M=o==null?void 0:o.onError,L=u&&M?(B,H)=>{var $,te;M(B,{location:u.location,params:((te=($=u.matches)==null?void 0:$[0])==null?void 0:te.params)??{},pattern:T_(u.matches),errorInfo:H})}:void 0;return p.reduceRight((B,H,$)=>{let te,xe=!1,pe=null,Ne=null;u&&(te=y&&H.route.id?y[H.route.id]:void 0,pe=H.route.errorElement||dH,T&&(s<0&&$===0?(DR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),xe=!0,Ne=null):s===$&&(xe=!0,Ne=H.route.hydrateFallbackElement||null)));let _e=t.concat(p.slice(0,$+1)),ie=()=>{let ke;return te?ke=pe:xe?ke=Ne:H.route.Component?ke=mt.createElement(H.route.Component,null):H.route.element?ke=H.route.element:ke=B,mt.createElement(pH,{match:H,routeContext:{outlet:B,matches:_e,isDataRoute:u!=null},children:ke})};return u&&(H.route.ErrorBoundary||H.route.errorElement||$===0)?mt.createElement(LR,{location:u.location,revalidation:u.revalidation,component:pe,error:te,children:ie(),routeContext:{outlet:null,matches:_e,isDataRoute:!0},onError:L}):ie()},null)}function qE(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function gH(e){let t=mt.useContext(qd);return on(t,qE(e)),t}function _H(e){let t=mt.useContext(I_);return on(t,qE(e)),t}function yH(e){let t=mt.useContext(Zl);return on(t,qE(e)),t}function ZE(e){let t=yH(e),o=t.matches[t.matches.length-1];return on(o.route.id,`${e} can only be used on routes that contain a unique "id"`),o.route.id}function vH(){return ZE("useRouteId")}function xH(){var u;let e=mt.useContext(GE),t=_H("useRouteError"),o=ZE("useRouteError");return e!==void 0?e:(u=t.errors)==null?void 0:u[o]}function bH(){let{router:e}=gH("useNavigate"),t=ZE("useNavigate"),o=mt.useRef(!1);return RR(()=>{o.current=!0}),mt.useCallback(async(p,y={})=>{No(o.current,kR),o.current&&(typeof p=="number"?await e.navigate(p):await e.navigate(p,{fromRouteId:t,...y}
53))},[e,t])}var zR={};function DR(e,t,o){!t&&!zR[e]&&(zR[e]=!0,No(!1,o))}var OR={};function FR(e,t){!e&&!OR[t]&&(OR[t]=!0,console.warn(t))}var wH="useOptimistic",NR=LG[wH],TH=()=>{};function EH(e){return NR?NR(e):[e,TH]}function SH(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&No(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:mt.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&No(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:mt.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&No(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:mt.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var CH=["HydrateFallback","hydrateFallbackElement"],IH=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=o=>{this.status==="pending"&&(this.status="resolved",e(o))},this.reject=o=>{this.status==="pending"&&(this.status="rejected",t(o))}})}};function AH({router:e,flushSync:t,onError:o,useTransitions:u}){u=AR()||u;let[y,T]=mt.useState(e.state),[s,M]=EH(y),[L,B]=mt.useState(),[H,$]=mt.useState({isTransitioning:!1}),[te,xe]=mt.useState(),[pe,Ne]=mt.useState(),[_e,ie]=mt.useState(),ke=mt.useRef(new Map),ot=mt.useCallback((K,{deletedFetchers:ve,newErrors:Ae,flushSync:Ye,viewTransitionOpts:Be})=>{Ae&&o&&Object.values(Ae).forEach(Je=>{var ze;return o(Je,{location:K.location,params:((ze=K.matches[0])==null?void 0:ze.params)??{},pattern:T_(K.matches)})}),K.fetchers.forEach((Je,ze)=>{Je.data!==void 0&&ke.current.set(ze,Je.data)}),ve.forEach(Je=>ke.current.delete(Je)),FR(Ye===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable.  Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let Fe=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(FR(Be==null||Fe,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!Be||!Fe){t&&Ye?t(()=>T(K)):u===!1?T(K):mt.startTransition(()=>{u===!0&&M(Je=>BR(Je,K)),T(K)});return}if(t&&Ye){t(()=>{pe&&(te==null||te.resolve(),pe.skipTransition()),$({isTransitioning:!0,flushSync:!0,currentLocation:Be.currentLocation,nextLocation:Be.nextLocation})});let Je=e.window.document.startViewTransition(()=>{t(()=>T(K))});Je.finished.finally(()=>{t(()=>{xe(void 0),Ne(void 0),B(void 0),$({isTransitioning:!1})})}),t(()=>Ne(Je));return}pe?(te==null||te.resolve(),pe.skipTransition(),ie({state:K,currentLocation:Be.currentLocation,nextLocation:Be.nextLocation})):(B(K),$({isTransitioning:!0,flushSync:!1,currentLocation:Be.currentLocation,nextLocation:Be.nextLocation}))},[e.window,t,pe,te,u,M,o]);mt.useLayoutEffect(()=>e.subscribe(ot),[e,ot]),mt.useEffect(()=>{H.isTransitioning&&!H.flushSync&&xe(new IH)},[H]),mt.useEffect(()=>{if(te&&L&&e.window){let K=L,ve=te.promise,Ae=e.window.document.startViewTransition(async()=>{u===!1?T(K):mt.startTransition(()=>{u===!0&&M(Ye=>BR(Ye,K)),T(K)}),await ve});Ae.finished.finally(()=>{xe(void 0),Ne(void 0),B(void 0),$({isTransitioning:!1})}),Ne(Ae)}},[L,te,e.window,u,M]),mt.useEffect(()=>{te&&L&&s.location.key===L.location.key&&te.resolve()},[te,pe,s.location,L]),mt.useEffect(()=>{!H.isTransitioning&&_e&&(B(_e.state),$({isTransitioning:!0,flushSync:!1,currentLocation:_e.currentLocation,nextLocation:_e.nextLocation}),ie(void 0))},[H.isTransitioning,_e]);let et=mt.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:K=>e.navigate(K),push:(K,ve,Ae)=>e.navigate(K,{state:ve,preventScrollReset:Ae==null?void 0:Ae.preventScrollReset}),replace:(K,ve,Ae)=>e.navigate(K,{replace:!0,state:ve,preventScrollReset:Ae==null?void 0:Ae.preventScrollReset})}),[e]),wt=e.basename||"/",It=mt.useMemo(()=>({router:e,navigator:et,static:!1,basename:wt,onError:o}),[e,et,wt,o]);return mt.createElement(mt.Fragment,null,mt.createElement(qd.Provider,{value:It},mt.createElement(I_.Provider,{value:s},mt.createElement(PR.Provider,{value:ke.current},mt.createElement(jE.Provider,{value:H},mt.createElement(RH,{basename:wt,location:s.location,navigationType:s.historyAction,navigator:et,useTransitions:u},mt.createElement(PH,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:o})))))),null)}function BR(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var PH=mt.memo(MH);function MH({routes:e,manifest:t,future:o,state:u,isStatic:p,onError:y}){return uH(e,void 0,{manifest:t,state:u,isStatic:p,onError:y})}function kH(e){return lH(e.context)}function RH({basename:e="/",children:t=null,location:o,navigationType:u="POP",navigator:p,static:y=!1,useTransitions:T}){on(!A_(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),M=mt.useMemo(()=>({basename:s,navigator:p,static:y,useTransitions:T,future:{}}),[s,p,y,T]);
53typeof o=="string"&&(o=Sc(o));let{pathname:L="/",search:B="",hash:H="",state:$=null,key:te="default",mask:xe}=o,pe=mt.useMemo(()=>{let Ne=ml(L,s);return Ne==null?null:{location:{pathname:Ne,search:B,hash:H,state:$,key:te,mask:xe},navigationType:u}},[s,L,B,H,$,te,u,xe]);return No(pe!=null,`<Router basename="${s}"> is not able to match the URL "${L}${B}${H}" because it does not start with the basename, so the <Router> won't render anything.`),pe==null?null:mt.createElement(yl.Provider,{value:M},mt.createElement(Hx.Provider,{children:t,value:pe}))}var qx="get",Zx="application/x-www-form-urlencoded";function Wx(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function LH(e){return Wx(e)&&e.tagName.toLowerCase()==="button"}function zH(e){return Wx(e)&&e.tagName.toLowerCase()==="form"}function DH(e){return Wx(e)&&e.tagName.toLowerCase()==="input"}function OH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function FH(e,t){return e.button===0&&(!t||t==="_self")&&!OH(e)}var Xx=null;function NH(){if(Xx===null)try{new FormData(document.createElement("form"),0),Xx=!1}catch{Xx=!0}return Xx}var BH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function WE(e){return e!=null&&!BH.has(e)?(No(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zx}"`),null):e}function VH(e,t){let o,u,p,y,T;if(zH(e)){let s=e.getAttribute("action");u=s?ml(s,t):null,o=e.getAttribute("method")||qx,p=WE(e.getAttribute("enctype"))||Zx,y=new FormData(e)}else if(LH(e)||DH(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let M=e.getAttribute("formaction")||s.getAttribute("action");if(u=M?ml(M,t):null,o=e.getAttribute("formmethod")||s.getAttribute("method")||qx,p=WE(e.getAttribute("formenctype"))||WE(s.getAttribute("enctype"))||Zx,y=new FormData(s,e),!NH()){let{name:L,type:B,value:H}=e;if(B==="image"){let $=L?`${L}.`:"";y.append(`${$}x`,"0"),y.append(`${$}y`,"0")}else L&&y.append(L,H)}}else{if(Wx(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=qx,u=null,p=Zx,T=e}return y&&p==="text/plain"&&(T=y,y=void 0),{action:u,method:o.toLowerCase(),encType:p,formData:y,body:T}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function XE(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function VR(e,t,o,u){let p=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return o?p.pathname.endsWith("/")?p.pathname=`${p.pathname}_.${u}`:p.pathname=`${p.pathname}.${u}`:p.pathname==="/"?p.pathname=`_root.${u}`:t&&ml(p.pathname,t)==="/"?p.pathname=`${Ux(t)}/_root.${u}`:p.pathname=`${Ux(p.pathname)}.${u}`,p}async function UH(e,t){if(e.id in t)return t[e.id];try{let o=await import(e.module);return t[e.id]=o,o}catch(o){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function jH(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function GH(e,t,o){let u=await Promise.all(e.map(async p=>{let y=t.routes[p.route.id];if(y){let T=await UH(y,o);return T.links?T.links():[]}return[]}));return ZH(u.flat(1).filter(jH).filter(p=>p.rel==="stylesheet"||p.rel==="preload").map(p=>p.rel==="stylesheet"?{...p,rel:"prefetch",as:"style"}:{...p,rel:"prefetch"}))}function UR(e,t,o,u,p,y){let T=(M,L)=>o[L]?M.route.id!==o[L].route.id:!0,s=(M,L)=>{var B;return o[L].pathname!==M.pathname||((B=o[L].route.path)==null?void 0:B.endsWith("*"))&&o[L].params["*"]!==M.params["*"]};return y==="assets"?t.filter((M,L)=>T(M,L)||s(M,L)):y==="data"?t.filter((M,L)=>{var H;let B=u.routes[M.route.id];if(!B||!B.hasLoader)return!1;if(T(M,L)||s(M,L))return!0;if(M.route.shouldRevalidate){let $=M.route.shouldRevalidate({currentUrl:new URL(p.pathname+p.search+p.hash,window.origin),currentParam
53s:((H=o[0])==null?void 0:H.params)||{},nextUrl:new URL(e,window.origin),nextParams:M.params,defaultShouldRevalidate:!0});if(typeof $=="boolean")return $}return!0}):[]}function $H(e,t,{includeHydrateFallback:o}={}){return HH(e.map(u=>{let p=t.routes[u.route.id];if(!p)return[];let y=[p.module];return p.clientActionModule&&(y=y.concat(p.clientActionModule)),p.clientLoaderModule&&(y=y.concat(p.clientLoaderModule)),o&&p.hydrateFallbackModule&&(y=y.concat(p.hydrateFallbackModule)),p.imports&&(y=y.concat(p.imports)),y}).flat(1))}function HH(e){return[...new Set(e)]}function qH(e){let t={},o=Object.keys(e).sort();for(let u of o)t[u]=e[u];return t}function ZH(e,t){let o=new Set;return new Set(t),e.reduce((u,p)=>{let y=JSON.stringify(qH(p));return o.has(y)||(o.add(y),u.push({key:y,link:p})),u},[])}function YE(){let e=mt.useContext(qd);return XE(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function WH(){let e=mt.useContext(I_);return XE(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var KE=mt.createContext(void 0);KE.displayName="FrameworkContext";function JE(){let e=mt.useContext(KE);return XE(e,"You must render this element inside a <HydratedRouter> element"),e}function XH(e,t){let o=mt.useContext(KE),[u,p]=mt.useState(!1),[y,T]=mt.useState(!1),{onFocus:s,onBlur:M,onMouseEnter:L,onMouseLeave:B,onTouchStart:H}=t,$=mt.useRef(null);mt.useEffect(()=>{if(e==="render"&&T(!0),e==="viewport"){let pe=_e=>{_e.forEach(ie=>{T(ie.isIntersecting)})},Ne=new IntersectionObserver(pe,{threshold:.5});return $.current&&Ne.observe($.current),()=>{Ne.disconnect()}}},[e]),mt.useEffect(()=>{if(u){let pe=setTimeout(()=>{T(!0)},100);return()=>{clearTimeout(pe)}}},[u]);let te=()=>{p(!0)},xe=()=>{p(!1),T(!1)};return o?e!=="intent"?[y,$,{}]:[y,$,{onFocus:M_(s,te),onBlur:M_(M,xe),onMouseEnter:M_(L,te),onMouseLeave:M_(B,xe),onTouchStart:M_(H,te)}]:[!1,$,{}]}function M_(e,t){return o=>{e&&e(o),o.defaultPrevented||t(o)}}function YH({page:e,...t}){let o=AR(),{router:u}=YE(),p=mt.useMemo(()=>jk(u.routes,e,u.basename),[u.routes,e,u.basename]);return p?o?mt.createElement(JH,{page:e,matches:p,...t}):mt.createElement(QH,{page:e,matches:p,...t}):null}function KH(e){let{manifest:t,routeModules:o}=JE(),[u,p]=mt.useState([]);return mt.useEffect(()=>{let y=!1;return GH(e,t,o).then(T=>{y||p(T)}),()=>{y=!0}},[e,t,o]),u}function JH({page:e,matches:t,...o}){let u=Ic(),{future:p}=JE(),{basename:y}=YE(),T=mt.useMemo(()=>{if(e===u.pathname+u.search+u.hash)return[];let s=VR(e,y,p.unstable_trailingSlashAwareDataRequests,"rsc"),M=!1,L=[];for(let B of t)typeof B.route.shouldRevalidate=="function"?M=!0:L.push(B.route.id);return M&&L.length>0&&s.searchParams.set("_routes",L.join(",")),[s.pathname+s.search]},[y,p.unstable_trailingSlashAwareDataRequests,e,u,t]);return mt.createElement(mt.Fragment,null,T.map(s=>mt.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...o})))}function QH({page:e,matches:t,...o}){let u=Ic(),{future:p,manifest:y,routeModules:T}
53=JE(),{basename:s}=YE(),{loaderData:M,matches:L}=WH(),B=mt.useMemo(()=>UR(e,t,L,y,u,"data"),[e,t,L,y,u]),H=mt.useMemo(()=>UR(e,t,L,y,u,"assets"),[e,t,L,y,u]),$=mt.useMemo(()=>{if(e===u.pathname+u.search+u.hash)return[];let pe=new Set,Ne=!1;if(t.forEach(ie=>{var ot;let ke=y.routes[ie.route.id];!ke||!ke.hasLoader||(!B.some(et=>et.route.id===ie.route.id)&&ie.route.id in M&&((ot=T[ie.route.id])!=null&&ot.shouldRevalidate)||ke.hasClientLoader?Ne=!0:pe.add(ie.route.id))}),pe.size===0)return[];let _e=VR(e,s,p.unstable_trailingSlashAwareDataRequests,"data");return Ne&&pe.size>0&&_e.searchParams.set("_routes",t.filter(ie=>pe.has(ie.route.id)).map(ie=>ie.route.id).join(",")),[_e.pathname+_e.search]},[s,p.unstable_trailingSlashAwareDataRequests,M,u,y,B,t,e,T]),te=mt.useMemo(()=>$H(H,y),[H,y]),xe=KH(H);return mt.createElement(mt.Fragment,null,$.map(pe=>mt.createElement("link",{key:pe,rel:"prefetch",as:"fetch",href:pe,...o})),te.map(pe=>mt.createElement("link",{key:pe,rel:"modulepreload",href:pe,...o})),xe.map(({key:pe,link:Ne})=>mt.createElement("link",{key:pe,nonce:o.nonce,...Ne,crossOrigin:Ne.crossOrigin??o.crossOrigin})))}function eq(...e){return t=>{e.forEach(o=>{typeof o=="function"?o(t):o!=null&&(o.current=t)})}}var tq=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{tq&&(window.__reactRouterVersion="7.15.1")}catch{}function rq(e,t){return P7({basename:t==null?void 0:t.basename,getContext:t==null?void 0:t.getContext,future:t==null?void 0:t.future,history:$9({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||iq(),routes:e,mapRouteProperties:SH,hydrationRouteProperties:CH,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window,instrumentations:t==null?void 0:t.instrumentations}).initialize()}function iq(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:nq(e.errors)}),e}function nq(e){if(!e)return null;let t=Object.entries(e),o={};for(let[u,p]of t)if(p&&p.__type==="RouteErrorResponse")o[u]=new b_(p.status,p.statusText,p.data,p.internal===!0);else if(p&&p.__type==="Error"){if(p.__subType){let y=window[p.__subType];if(typeof y=="function")try{let T=new y(p.message);T.stack="",o[u]=T}catch{}}if(o[u]==null){let y=new Error(p.message);y.stack="",o[u]=y}}else o[u]=p;return o}var jR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,GR=mt.forwardRef(function({onClick:t,discover:o="render",prefetch:u="none",relative:p,reloadDocument:y,replace:T,mask:s,state:M,target:L,to:B,preventScrollReset:H,viewTransition:$,defaultShouldRevalidate:te,...xe},pe){let{basename:Ne,navigator:_e,useTransitions:ie}=mt.useContext(yl),ke=typeof B=="string"&&jR.test(B),ot=Yk(B,Ne);B=ot.to;let et=oH(B,{relative:p}),wt=Ic(),It=null;if(s){let ze=Vx(s,[],wt.mask?wt.mask.pathname:"/",!0);Ne!=="/"&&(ze.pathname=ze.pathname==="/"?Ne:gl([Ne,ze.pathname])),It=_e.createHref(ze)}let[K,ve,Ae]=XH(u,xe),Ye=lq(B,{replace:T,mask:s,state:M,target:L,preventScrollReset:H,relative:p,viewTransition:$,defaultShouldRevalidate:te,useTransitions:ie});function Be(ze){t&&t(ze),ze.defaultPrevented||Ye(ze)}let Fe=!(ot.isExternal||y),Je=mt.createElement("a",{...xe,...Ae,href:(Fe?It:void 0)||ot.absoluteURL||et,onClick:Fe?Be:t,ref:eq(pe,ve),target:L,"data-discover":!ke&&o==="render"?"true":void 0});return K&&!ke?mt.createElement(mt.Fragment,null,Je,mt.createElement(YH,{page:et})):Je});GR.displayName="Link";var oq=mt.forwardRef(function({"aria-current":t="page",caseSensitive:o=!1,className:u="",end:p=!1,style:y,to:T,viewTransition:s,children:M,...L},B){let H=P_(T,{relative:L.relative}),$=Ic(),te=mt.useContext(I_),{navigator:xe,basename:pe}=mt.useContext(yl),Ne=te!=null&&fq(H)&&s===!0,_e=xe.encodeLocation?xe.encodeLocation(H).pathname:H.pathname,ie=$.pathname,ke=te&&te.navigation&&te.navigation.location?te.navigation.location.pathname:null;o||(ie=ie.toLowerCase(),ke=ke?ke.toLowerCase():null,_e=_e.toLowerCase()),ke&&pe&&(ke=ml(ke,pe)||ke);const ot=_e!=="/"&&_e.endsWith("/")?_e.length-1:_e.length;let et=ie===_e||!p&&ie.startsWith(_e)&&ie.charAt(ot)==="/",wt=ke!=null&&(ke===_e||!p&&ke.startsWith(_e)&&ke.charAt(_e.length)==="/"),It={isActive:et,isPending:wt,isTransitioning:Ne},K=et?t:void 0,ve;typeof u=="function"?ve=u(It):ve=[u,et?"active":null,wt?"pending":null,Ne?"transitioning":null].filter(
53Boolean).join(" ");let Ae=typeof y=="function"?y(It):y;return mt.createElement(GR,{...L,"aria-current":K,className:ve,ref:B,style:Ae,to:T,viewTransition:s},typeof M=="function"?M(It):M)});oq.displayName="NavLink";var sq=mt.forwardRef(({discover:e="render",fetcherKey:t,navigate:o,reloadDocument:u,replace:p,state:y,method:T=qx,action:s,onSubmit:M,relative:L,preventScrollReset:B,viewTransition:H,defaultShouldRevalidate:$,...te},xe)=>{let{useTransitions:pe}=mt.useContext(yl),Ne=hq(),_e=dq(s,{relative:L}),ie=T.toLowerCase()==="get"?"get":"post",ke=typeof s=="string"&&jR.test(s),ot=et=>{if(M&&M(et),et.defaultPrevented)return;et.preventDefault();let wt=et.nativeEvent.submitter,It=(wt==null?void 0:wt.getAttribute("formmethod"))||T,K=()=>Ne(wt||et.currentTarget,{fetcherKey:t,method:It,navigate:o,replace:p,state:y,relative:L,preventScrollReset:B,viewTransition:H,defaultShouldRevalidate:$});pe&&o!==!1?mt.startTransition(()=>K()):K()};return mt.createElement("form",{ref:xe,method:ie,action:_e,onSubmit:u?M:ot,...te,"data-discover":!ke&&e==="render"?"true":void 0})});sq.displayName="Form";function aq(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function $R(e){let t=mt.useContext(qd);return on(t,aq(e)),t}function lq(e,{target:t,replace:o,mask:u,state:p,preventScrollReset:y,relative:T,viewTransition:s,defaultShouldRevalidate:M,useTransitions:L}={}){let B=$E(),H=Ic(),$=P_(e,{relative:T});return mt.useCallback(te=>{if(FH(te,t)){te.preventDefault();let xe=o!==void 0?o:Ec(H)===Ec($),pe=()=>B(e,{replace:xe,mask:u,state:p,preventScrollReset:y,relative:T,viewTransition:s,defaultShouldRevalidate:M});L?mt.startTransition(()=>pe()):pe()}},[H,B,$,o,u,p,t,e,y,T,s,M,L])}var cq=0,uq=()=>`__${String(++cq)}__`;function hq(){let{router:e}=$R("useSubmit"),{basename:t}=mt.useContext(yl),o=vH(),u=e.fetch,p=e.navigate;return mt.useCallback(async(y,T={})=>{let{action:s,method:M,encType:L,formData:B,body:H}=VH(y,t);if(T.navigate===!1){let $=T.fetcherKey||uq();await u($,o,T.action||s,{defaultShouldRevalidate:T.defaultShouldRevalidate,preventScrollReset:T.preventScrollReset,formData:B,body:H,formMethod:T.method||M,formEncType:T.encType||L,flushSync:T.flushSync})}else await p(T.action||s,{defaultShouldRevalidate:T.defaultShouldRevalidate,preventScrollReset:T.preventScrollReset,formData:B,body:H,formMethod:T.method||M,formEncType:T.encType||L,replace:T.replace,state:T.state,fromRouteId:o,flushSync:T.flushSync,viewTransition:T.viewTransition})},[u,p,t,o])}function dq(e,{relative:t}={}){let{basename:o}=mt.useContext(yl),u=mt.useContext(Zl);on(u,"useFormAction must be used inside a RouteContext");let[p]=u.matches.slice(-1),y={...P_(e||".",{relative:t})},T=Ic();if(e==null){y.search=T.search;let s=new URLSearchParams(y.search),M=s.getAll("index");if(M.some(B=>B==="")){s.delete("index"),M.filter(H=>H).forEach(H=>s.append("index",H));let B=s.toString();y.search=B?`?${B}`:""}}return(!e||e===".")&&p.route.index&&(y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(y.pathname=y.pathname==="/"?o:gl([o,y.pathname])),Ec(y)}function fq(e,{relative:t}={}){let o=mt.useContext(jE);on(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:u}=$R("useViewTransitionState"),p=P_(e,{relative:t});if(!o.isTransitioning)return!1;let y=ml(o.currentLocation.pathname,u)||o.currentLocation.pathname,T=ml(o.nextLocation.pathname,u)||o.nextLocation.pathname;return Bx(p.pathname,T)!=null||Bx(p.pathname,y)!=null}function pq(e){return mt.createElement(AH,{flushSync:Rk.flushSync,...e})}var k_=e=>e.type==="checkbox",Zd=e=>e instanceof Date,bs=e=>e==null;const HR=e=>typeof e=="object";var vo=e=>!bs(e)&&!Array.isArray(e)&&HR(e)&&!Zd(e),mq=e=>vo(e)&&e.target?k_(e.target)?e.target.checked:e.target.value:e,qR=(e,t)=>{const o=t.split("."),u=[];let p=o[0];for(let y=1;y<o.length;p+="."+o[y++])!isNaN(+o[y])&&e.has(p)&&u.push(p);return u},gq=e=>{const t=e.constructor&&e.constructor.prototype;return vo(t)&&t.hasOwnProperty("isPrototypeOf")},QE=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Bo(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(QE&&(e instanceof Blob||t))return e;const o=Array.isArray(e);if(!o&&!(vo(e)&&gq(e)))return e;const u=o?[]:Object.create(Object.getPrototypeOf(e));for(const p in e)Object.prototype.hasOwnProperty.call(e,p)&&(u[p]=Bo(e[p]));return u}var R_=e=>/^\w*$/.test(e),ho=e=>e===void 0,eS=e=>Array.isArray(e)?e.filter(Boolean):[],Yx=e=>eS(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Nr=(e,t,o)=>{if(!t||!vo(e))return o;const p=(R_(t)?[t]:Yx(t)).reduce((y,T)=>bs(y)?void 0:y[T],e);return ho(p)||p===e?ho(e[t])?o:e[t]:p},Ac=e=>typeof e=="boolean",vl=e=>typeof e=="function",Gn=(e,t,o)=>{let u=-1;const p=R_(t)?[t]:Yx(t),y=p.length,T=y-1;for(;++u<y;){const s=p[u];let M=o;if(u!==T){const L=e[s];M=vo(L)||Array.isArray(L)?L:isNaN(+p[u+1])?{}:[]}if(s==="__proto__"||s==="constructor"||s==="prototype")return;e[s]=M,e=e[s]}};const Up={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wl={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Xl={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},tS="form",ZR="root",rS=kn.createContext(null);rS.displayName="HookFormControlContext";const _q=()=>kn.useContext(rS);var yq=(e,t,o,u=!0)=>{const p={};for(const y in e)Object.defineProperty(p,y,{get:()=>{const T=y;return t._proxyFormState[T]!==Wl.all&&(t._proxyFormState[T]=!u||Wl.all),e[T]}});return p};const WR=typeof window<"u"?kn.useLayoutEffect:kn.useEffect;var Ds=e=>typeof e=="string",iS=(e,t,o,u,p)=>Ds(e)?(u&&t.watch.add(e),Nr(o,e,p)):Array.isArray(e)?e.map(y=>(u&&t.watch.add(y),Nr(o,y))):(u&&(t.watchAll=!0),o),nS=e=>bs(e)||!HR(e);function Ka(e,t,o=new WeakSet){if(e===t)return!0;
53if(nS(e)||nS(t))return Object.is(e,t);if(Zd(e)&&Zd(t))return Object.is(e.getTime(),t.getTime());const u=Object.keys(e),p=Object.keys(t);if(u.length!==p.length)return!1;if(o.has(e)||o.has(t))return!0;o.add(e),o.add(t);for(const y of u){const T=e[y];if(!(y in t))return!1;if(y!=="ref"){const s=t[y];if(Zd(T)&&Zd(s)||(vo(T)||Array.isArray(T))&&(vo(s)||Array.isArray(s))?!Ka(T,s,o):!Object.is(T,s))return!1}}return!0}function vq(e){const t=_q(),{control:o=t,name:u,defaultValue:p,disabled:y,exact:T,compute:s}=e||{},M=kn.useRef(p),L=kn.useRef(s),B=kn.useRef(void 0),H=kn.useRef(o),$=kn.useRef(u);L.current=s;const[te,xe]=kn.useState(()=>{const ot=o._getWatch(u,M.current);return L.current?L.current(ot):ot}),pe=kn.useCallback(ot=>{const et=iS(u,o._names,ot||o._formValues,!1,M.current);return L.current?L.current(et):et},[o._formValues,o._names,u]),Ne=kn.useCallback(ot=>{if(!y){const et=iS(u,o._names,ot||o._formValues,!1,M.current);if(L.current){const wt=L.current(et);Ka(wt,B.current)||(xe(wt),B.current=wt)}else xe(et)}},[o._formValues,o._names,y,u]);WR(()=>((H.current!==o||!Ka($.current,u))&&(H.current=o,$.current=u,Ne()),o._subscribe({name:u,formState:{values:!0},exact:T,callback:ot=>{Ne(ot.values)}})),[o,T,u,Ne]),kn.useEffect(()=>o._removeUnmounted());const _e=H.current!==o,ie=$.current,ke=kn.useMemo(()=>{if(y)return null;const ot=!_e&&!Ka(ie,u);return _e||ot?pe():null},[y,_e,u,ie,pe]);return ke!==null?ke:te}const oS=kn.createContext(null);oS.displayName="HookFormContext";const XR=()=>kn.useContext(oS),xq=e=>{const{children:t,watch:o,getValues:u,getFieldState:p,setError:y,clearErrors:T,setValue:s,setValues:M,trigger:L,formState:B,resetField:H,reset:$,handleSubmit:te,unregister:xe,control:pe,register:Ne,setFocus:_e,subscribe:ie}=e,ke=kn.useMemo(()=>({watch:o,getValues:u,getFieldState:p,setError:y,clearErrors:T,setValue:s,setValues:M,trigger:L,formState:B,resetField:H,reset:$,handleSubmit:te,unregister:xe,control:pe,register:Ne,setFocus:_e,subscribe:ie}),[T,pe,B,p,u,te,Ne,$,H,y,_e,s,M,ie,L,xe,o]);return kn.createElement(oS.Provider,{value:ke},kn.createElement(rS.Provider,{value:ke.control},t))};var YR=(e,t,o,u,p)=>t?{...o[e],types:{...o[e]&&o[e].types?o[e].types:{},[u]:p||!0}}:{},L_=e=>Array.isArray(e)?e:[e],KR=()=>{let e=[];return{get observers(){return e},next:p=>{for(const y of e)y.next&&y.next(p)},subscribe:p=>(e.push(p),{unsubscribe:()=>{e=e.filter(y=>y!==p)}}),unsubscribe:()=>{e=[]}}};function JR(e,t){const o={};for(const u in e)if(e.hasOwnProperty(u)){const p=e[u],y=t[u];if(p&&vo(p)&&y){const T=JR(p,y);vo(T)&&(o[u]=T)}else e[u]&&(o[u]=y)}return o}var Os=e=>vo(e)&&!Object.keys(e).length,sS=e=>e.type==="file",Kx=e=>{if(!QE)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},QR=e=>e.type==="select-multiple",aS=e=>e.type==="radio",bq=e=>aS(e)||k_(e),lS=e=>Kx(e)&&e.isConnected;function wq(e,t){const o=t.slice(0,-1).length;let u=0;for(;u<o;){if(bs(e)){e=void 0;break}e=e[t[u]],u++}return e}function Tq(e){for(const t in e)if(e.hasOwnProperty(t)&&!ho(e[t]))return!1;return!0}function Vo(e,t){if(Ds(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const o=Array.isArray(t)?t:R_(t)?[t]:Yx(t),u=o.length===1?e:wq(e,o),p=o.length-1,y=o[p];return u&&delete u[y],p!==0&&(vo(u)&&Os(u)||Array.isArray(u)&&Tq(u))&&Vo(e,o.slice(0,-1)),e}var Eq=e=>{for(const t in e)if(vl(e[t]))return!0;return!1};function eL(e){return Array.isArray(e)||vo(e)&&!Eq(e)}function cS(e,t={}){for(const o in e){const u=e[o];eL(u)?(t[o]=Array.isArray(u)?[]:{},cS(u,t[o])):ho(u)||(t[o]=!0)}return t}function uS(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(o=>uS(o));return t.some(o=>o!==void 0)?t:void 0}if(vo(e)){const t={};for(const o in e){const u=uS(e[o]);ho(u)||(t[o]=u)}return Object.keys(t).length?t:void 0}}}function jp(e,t,o){o||(o=cS(t));for(const u in e){const p=e[u];if(eL(p))ho(t)||nS(o[u])?o[u]=cS(p,Array.isArray(p)?[]:{}):jp(p,bs(t)?{}:t[u],o[u]);else{const y=t[u];o[u]=!Ka(p,y)}}return uS(o)||{}}const tL={value:!1,isValid:!1},rL={value:!0,isValid:!0};var iL=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(o=>o&&o.checked&&!o.disabled).map(o=>o.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ho(e[0].attributes.value)?ho(e[0].value)||e[0].value===""?rL:{value:e[0].value,isValid:!0}:rL:tL}return tL},nL=(e,{valueAsNumber:t,valueAsDate:o,setValueAs:u})=>ho(e)?e:t?e===""?NaN:e&&+e:o&&Ds(e)?new Date(e):u?u(e):e;const oL={isValid:!1,value:null};var sL=e=>Array.isArray(e)?e.reduce((t,o)=>o&&o.checked&&!o.disabled?{isValid:!0,value:o.value}:t,oL):oL;function aL(e){const t=e.ref;return sS(t)?t.files:aS(t)?sL(e.refs).value:QR(t)?[...t.selectedOptions].map(({value:o})=>o):k_(t)?iL(e.refs).value:nL(ho(t.value)?e.ref.value:t.value,e)}var Sq=(e,t,o,u)=>{const p={};for(const y of e){const T=Nr(t,y);T&&Gn(p,y,T._f)}return{criteriaMode:o,names:[...e],fields:p,shouldUseNativeValidation:u}},Jx=e=>e instanceof RegExp,z_=e=>ho(e)?e:Jx(e)?e.source:vo(e)?Jx(e.value)?e.value.source:e.value:e,lL=e=>({isOnSubmit:!e||e===Wl.onSubmit,isOnBlur:e===Wl.onBlur,isOnChange:e===Wl.onChange,isOnAll:e===Wl.all,isOnTouch:e===Wl.onTouched});const cL="AsyncFunction";var Cq=e=>!!e&&!!e.validate&&!!(vl(e.validate)&&e.validate.constructor.name===cL||vo(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===cL)),Iq=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),uL=(e,t,o)=>!o&&(t.watchAll||t.watch.has(e)||[...t.watch].some(u=>e.startsWith(u)&&/^\.\w+/.test(e.slice(u.length))));const D_=(e,t,o,u)=>{for(const p of o||Object.keys(e)){const y=Nr(e,p);if(y){const{_f:T,...s}=y;if(T){if(T.refs&&T.refs[0]&&t(T.refs[0],p)&&!u)return!0;
53if(T.ref&&t(T.ref,T.name)&&!u)return!0;if(D_(s,t))break}else if(vo(s)&&D_(s,t))break}}};function hL(e,t,o){const u=Nr(e,o);if(u||R_(o))return{error:u,name:o};const p=o.split(".");for(;p.length;){const y=p.join("."),T=Nr(t,y),s=Nr(e,y);if(T&&!Array.isArray(T)&&o!==y)return{name:o};if(s&&s.type)return{name:y,error:s};if(s&&s.root&&s.root.type)return{name:`${y}.root`,error:s.root};p.pop()}return{name:o}}var Aq=(e,t,o,u)=>{o(e);const{name:p,...y}=e;return Os(y)||u&&Object.keys(y).length>=Object.keys(t).length||Object.keys(y).find(T=>t[T]===(!u||Wl.all))},Pq=(e,t,o)=>!e||!t||e===t||L_(e).some(u=>u&&(o?u===t:u.startsWith(t)||t.startsWith(u))),Mq=(e,t,o,u,p)=>p.isOnAll?!1:!o&&p.isOnTouch?!(t||e):(o?u.isOnBlur:p.isOnBlur)?!e:(o?u.isOnChange:p.isOnChange)?e:!0,kq=(e,t)=>!eS(Nr(e,t)).length&&Vo(e,t),dL=(e,t,o)=>{const u=L_(Nr(e,o));return Gn(u,ZR,t[o]),Gn(e,o,u),e};function fL(e,t,o="validate"){if(Ds(e)||Array.isArray(e)&&e.every(Ds)||Ac(e)&&!e)return{type:o,message:Ds(e)?e:"",ref:t}}var Gp=e=>vo(e)&&!Jx(e)?e:{value:e,message:""},pL=async(e,t,o,u,p,y)=>{const{ref:T,refs:s,required:M,maxLength:L,minLength:B,min:H,max:$,pattern:te,validate:xe,name:pe,valueAsNumber:Ne,mount:_e}=e._f,ie=Nr(o,pe);if(!_e||t.has(pe))return{};const ke=s?s[0]:T,ot=Be=>{p&&ke.reportValidity&&(ke.setCustomValidity(Ac(Be)?"":Be||""),ke.reportValidity())},et={},wt=aS(T),It=k_(T),K=wt||It,ve=(Ne||sS(T))&&ho(T.value)&&ho(ie)||Kx(T)&&T.value===""||ie===""||Array.isArray(ie)&&!ie.length||Ne&&typeof ie=="number"&&isNaN(ie),Ae=YR.bind(null,pe,u,et),Ye=(Be,Fe,Je,ze=Xl.maxLength,He=Xl.minLength)=>{const tt=Be?Fe:Je;et[pe]={type:Be?ze:He,message:tt,ref:T,...Ae(Be?ze:He,tt)}};if(y?!Array.isArray(ie)||!ie.length:M&&(!K&&(ve||bs(ie))||Ac(ie)&&!ie||It&&!iL(s).isValid||wt&&!sL(s).isValid)){const{value:Be,message:Fe}=Ds(M)?{value:!!M,message:M}:Gp(M);if(Be&&(et[pe]={type:Xl.required,message:Fe,ref:ke,...Ae(Xl.required,Fe)},!u))return ot(Fe),et}if(!ve&&(!bs(H)||!bs($))){let Be,Fe;const Je=Gp($),ze=Gp(H);if(!bs(ie)&&!isNaN(ie)){const He=T.valueAsNumber||ie&&+ie;bs(Je.value)||(Be=He>Je.value),bs(ze.value)||(Fe=He<ze.value)}else{const He=T.valueAsDate||new Date(ie),tt=Nt=>new Date(new Date().toDateString()+" "+Nt),Oe=T.type=="time",rt=T.type=="week";Ds(Je.value)&&ie&&(Be=Oe?tt(ie)>tt(Je.value):rt?ie>Je.value:He>new Date(Je.value)),Ds(ze.value)&&ie&&(Fe=Oe?tt(ie)<tt(ze.value):rt?ie<ze.value:He<new Date(ze.value))}if((Be||Fe)&&(Ye(!!Be,Je.message,ze.message,Xl.max,Xl.min),!u))return ot(et[pe].message),et}if((L||B)&&!ve&&(Ds(ie)||y&&Array.isArray(ie))){const Be=Gp(L),Fe=Gp(B),Je=!bs(Be.value)&&ie.length>+Be.value,ze=!bs(Fe.value)&&ie.length<+Fe.value;if((Je||ze)&&(Ye(Je,Be.message,Fe.message),!u))return ot(et[pe].message),et}if(te&&!ve&&Ds(ie)){const{value:Be,message:Fe}=Gp(te);if(Jx(Be)&&!ie.match(Be)&&(et[pe]={type:Xl.pattern,message:Fe,ref:T,...Ae(Xl.pattern,Fe)},!u))return ot(Fe),et}if(xe){if(vl(xe)){const Be=await xe(ie,o),Fe=fL(Be,ke);if(Fe&&(et[pe]={...Fe,...Ae(Xl.validate,Fe.message)},!u))return ot(Fe.message),et}else if(vo(xe)){let Be={};for(const Fe in xe){if(!Os(Be)&&!u)break;const Je=fL(await xe[Fe](ie,o),ke,Fe);Je&&(Be={...Je,...Ae(Fe,Je.message)},ot(Je.message),u&&(et[pe]=Be))}if(!Os(Be)&&(et[pe]={ref:ke,...Be},!u))return et}}return ot(!0),et};const Rq={mode:Wl.onSubmit,reValidateMode:Wl.onChange,shouldFocusError:!0},mL={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Lq(e={}){let t={...Rq,...e},o={...Bo(mL),isLoading:vl(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},u={},p=vo(t.defaultValues)||vo(t.values)?Bo(t.defaultValues||t.values)||{}:{},y=t.shouldUnregister?{}:Bo(p),T={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},M,L=0;const B={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},H={...B};let $={...H};const te={array:KR(),state:KR()},xe=t.criteriaMode===Wl.all,pe=qe=>pt=>{clearTimeout(L),L=setTimeout(qe,pt)},Ne=async qe=>{if(!T.keepIsValid&&!t.disabled&&(H.isValid||$.isValid||qe)){let pt;t.resolver?(pt=Os((await Ae()).errors),_e()):pt=await Fe({fields:u,onlyCheckValid:!0,eventType:Up.VALID}),pt!==o.isValid&&te.state.next({isValid:pt})}},_e=(qe,pt)=>{!t.disabled&&(H.isValidating||H.validatingFields||$.isValidating||$.validatingFields)&&((qe||Array.from(s.mount)).forEac
53h(yt=>{yt&&(pt?Gn(o.validatingFields,yt,pt):Vo(o.validatingFields,yt))}),te.state.next({validatingFields:o.validatingFields,isValidating:!Os(o.validatingFields)}))},ie=()=>{o.dirtyFields=jp(p,y)},ke=(qe,pt=[],yt,pr,nr=!0,lr=!0)=>{if(pr&&yt&&!t.disabled){if(T.action=!0,lr&&Array.isArray(Nr(u,qe))){const wr=yt(Nr(u,qe),pr.argA,pr.argB);nr&&Gn(u,qe,wr)}if(lr&&Array.isArray(Nr(o.errors,qe))){const wr=yt(Nr(o.errors,qe),pr.argA,pr.argB);nr&&Gn(o.errors,qe,wr),kq(o.errors,qe)}if((H.touchedFields||$.touchedFields)&&lr&&Array.isArray(Nr(o.touchedFields,qe))){const wr=yt(Nr(o.touchedFields,qe),pr.argA,pr.argB);nr&&Gn(o.touchedFields,qe,wr)}(H.dirtyFields||$.dirtyFields)&&ie(),te.state.next({name:qe,isDirty:ze(qe,pt),dirtyFields:o.dirtyFields,errors:o.errors,isValid:o.isValid})}else Gn(y,qe,pt)},ot=(qe,pt)=>{Gn(o.errors,qe,pt),te.state.next({errors:o.errors})},et=qe=>{o.errors=qe,te.state.next({errors:o.errors,isValid:!1})},wt=qe=>{const pt=R_(qe)?[qe]:Yx(qe);let yt=y,pr=p;for(let nr=0;nr<pt.length-1;nr++){const lr=pt[nr];if(yt=bs(yt)?yt:yt[lr],pr=bs(pr)?pr:pr[lr],yt===null&&pr!==null)return!0}return!1},It=(qe,pt,yt,pr)=>{const nr=Nr(u,qe);if(nr){if(wt(qe))return;const lr=ho(Nr(y,qe)),wr=Nr(y,qe,ho(yt)?Nr(p,qe):yt);ho(wr)||pr&&pr.defaultChecked||pt?Gn(y,qe,pt?wr:aL(nr._f)):Oe(qe,wr),T.mount&&!T.action&&(Ne(),lr&&o.isDirty&&(H.isDirty||$.isDirty)&&(ze()||(o.isDirty=!1,te.state.next({...o}))))}},K=(qe,pt,yt,pr,nr)=>{let lr=!1,wr=!1;const Yr={name:qe};if(!t.disabled){if(!yt||pr){(H.isDirty||$.isDirty)&&(wr=o.isDirty,o.isDirty=Yr.isDirty=ze(),lr=wr!==Yr.isDirty);const yi=Ka(Nr(p,qe),pt);wr=!!Nr(o.dirtyFields,qe),yi!==o.isDirty?o.dirtyFields=jp(p,y):yi?Vo(o.dirtyFields,qe):Gn(o.dirtyFields,qe,!0),Yr.dirtyFields=o.dirtyFields,lr=lr||(H.dirtyFields||$.dirtyFields)&&wr!==!yi}if(yt){const yi=Nr(o.touchedFields,qe);yi||(Gn(o.touchedFields,qe,yt),Yr.touchedFields=o.touchedFields,lr=lr||(H.touchedFields||$.touchedFields)&&yi!==yt)}lr&&nr&&te.state.next(Yr)}return lr?Yr:{}},ve=(qe,pt,yt,pr)=>{const nr=Nr(o.errors,qe),lr=(H.isValid||$.isValid)&&Ac(pt)&&o.isValid!==pt;if(t.delayError&&yt?(M=pe(()=>ot(qe,yt)),M(t.delayError)):(clearTimeout(L),M=null,yt?Gn(o.errors,qe,yt):Vo(o.errors,qe)),(yt?!Ka(nr,yt):nr)||!Os(pr)||lr){const wr={...pr,...lr&&Ac(pt)?{isValid:pt}:{},errors:o.errors,name:qe};o={...o,...wr},te.state.next(wr)}},Ae=async qe=>(_e(qe,!0),await t.resolver(y,t.context,Sq(qe||s.mount,u,t.criteriaMode,t.shouldUseNativeValidation))),Ye=async qe=>{const{errors:pt}=await Ae(qe);if(_e(qe),qe)for(const yt of qe){const pr=Nr(pt,yt);pr?s.array.has(yt)&&vo(pr)?dL(o.errors,{[yt]:pr},yt):Gn(o.errors,yt,pr):Vo(o.errors,yt)}else o.errors=pt;return pt},Be=async({name:qe,eventType:pt})=>{if(e.validate){const yt=await e.validate({formValues:y,formState:o,name:qe,eventType:pt});if(vo(yt))for(const pr in yt){const nr=yt[pr];nr&&qi(`${tS}.${pr}`,{message:Ds(nr.message)?nr.message:"",type:nr.type||Xl.validate})}else Ds(yt)||!yt?qi(tS,{message:yt||"",type:Xl.validate}):Ur(tS);return yt}return!0},Fe=async({fields:qe,onlyCheckValid:pt,name:yt,eventType:pr,context:nr={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(nr.runRootValidation=!0,!await Be({name:yt,eventType:pr})&&(nr.valid=!1,pt)))return nr.valid;for(const lr in qe){const wr=qe[lr];if(wr){const{_f:Yr,...yi}=wr;if(Yr){const Rn=s.array.has(Yr.name),An=wr._f&&Cq(wr._f),lo=H.validatingFields||H.isValidating||$.validatingFields||$.isValidating;An&&lo&&_e([Yr.name],!0);const Yo=await pL(wr,s.disabled,y,xe,t.shouldUseNativeValidation&&!pt,Rn);if(An&&lo&&_e([Yr.name]),Yo[Yr.name]&&(nr.valid=!1,pt)||(!pt&&(Nr(Yo,Yr.name)?Rn?dL(o.errors,Yo,Yr.name):Gn(o.errors,Yr.name,Yo[Yr.name]):Vo(o.errors,Yr.name)),e.shouldUseNativeValidation&&Yo[Yr.name]))break}!Os(yi)&&await Fe({context:nr,onlyCheckValid:pt,fields:yi,name:lr,eventType:pr})}}return nr.valid},Je=()=>{for(const qe of s.unMount){const pt=Nr(u,qe);pt&&(pt._f.refs?pt._f.refs.every(yt=>!lS(yt)):!lS(pt._f.ref))&&So(qe)}s.unMount=new Set},ze=(qe,pt)=>!t.disabled&&(qe&&pt&&Gn(y,qe,pt),!Ka(Wr(),p)),He=(qe,pt,yt)=>iS(qe,s,{...T.mount?y:ho(pt)?p:Ds(qe)?{[qe]:pt}:pt},yt,pt),tt=qe=>eS(Nr(T.mount?y:p,qe,t.shouldUnregister?Nr(p,qe,[]):[])),Oe=(qe,pt,yt={})=>{const pr=Nr(u,qe);let nr=pt;if(pr){const lr=pr._f;lr&&(!lr.disabled&&Gn(y,qe,nL(pt,lr)),nr=Kx(lr.ref)&&bs(pt)?"":pt,QR(lr.ref)?[...lr.ref.options].forEac
53h(wr=>wr.selected=nr.includes(wr.value)):lr.refs?k_(lr.ref)?lr.refs.forEach(wr=>{(!wr.defaultChecked||!wr.disabled)&&(Array.isArray(nr)?wr.checked=!!nr.find(Yr=>Yr===wr.value):wr.checked=nr===wr.value||!!nr)}):lr.refs.forEach(wr=>wr.checked=wr.value===nr):sS(lr.ref)?lr.ref.value="":(lr.ref.value=nr,lr.ref.type||te.state.next({name:qe,values:Bo(y)})))}(yt.shouldDirty||yt.shouldTouch)&&K(qe,nr,yt.shouldTouch,yt.shouldDirty,!0),yt.shouldValidate&&di(qe)},rt=(qe,pt,yt)=>{for(const pr in pt){if(!pt.hasOwnProperty(pr))return;const nr=pt[pr],lr=qe+"."+pr,wr=Nr(u,lr);(s.array.has(qe)||vo(nr)||wr&&!wr._f)&&!Zd(nr)?rt(lr,nr,yt):Oe(lr,nr,yt)}},Nt=(qe,pt,yt={})=>{const pr=Nr(u,qe),nr=s.array.has(qe),lr=Bo(pt),wr=Nr(y,qe),Yr=Ka(wr,lr);if(Yr||Gn(y,qe,lr),nr)te.array.next({name:qe,values:Bo(y)}),(H.isDirty||H.dirtyFields||$.isDirty||$.dirtyFields)&&yt.shouldDirty&&(ie(),te.state.next({name:qe,dirtyFields:o.dirtyFields,isDirty:ze(qe,lr)}));else{const yi=Array.isArray(lr)&&!lr.length||Os(lr);!pr||pr._f||bs(lr)||yi?Oe(qe,lr,yt):rt(qe,lr,yt)}if(!Yr){const yi=uL(qe,s),Rn=Bo(y);if(!nr)for(const An of qR(s.array,qe))te.array.next({name:An,values:Rn});te.state.next({...yi&&o,name:T.mount||yi?qe:void 0,values:Rn})}},jt=qe=>{const pt=vl(qe)?qe(y):qe;if(!Ka(y,pt)){y={...y,...pt};for(const yt of s.mount)Nt(yt,Nr(pt,yt));te.state.next({...o,values:y})}},gr=async qe=>{T.mount=!0;const pt=qe.target;let yt=pt.name,pr=!0;const nr=Nr(u,yt),lr=yi=>{pr=Number.isNaN(yi)||Zd(yi)&&isNaN(yi.getTime())||Ka(yi,Nr(y,yt,yi))},wr=lL(t.mode),Yr=lL(t.reValidateMode);if(nr){let yi,Rn;const An=pt.type?aL(nr._f):mq(qe),lo=qe.type===Up.BLUR||qe.type===Up.FOCUS_OUT,Yo=!Iq(nr._f)&&!e.validate&&!t.resolver&&!Nr(o.errors,yt)&&!nr._f.deps||Mq(lo,Nr(o.touchedFields,yt),o.isSubmitted,Yr,wr),Fi=uL(yt,s,lo);Gn(y,yt,An),lo?(!pt||!pt.readOnly)&&(nr._f.onBlur&&nr._f.onBlur(qe),M&&M(0)):nr._f.onChange&&nr._f.onChange(qe);const tl=K(yt,An,lo),Cl=!Os(tl)||Fi;if(!lo&&te.state.next({name:yt,type:qe.type,values:Bo(y)}),Yo)return(H.isValid||$.isValid)&&(t.mode==="onBlur"?lo&&Ne():lo||Ne()),Cl&&te.state.next({name:yt,...Fi?{}:tl});if(!t.resolver&&e.validate&&await Be({name:yt,eventType:qe.type}),!lo&&Fi&&te.state.next({...o}),t.resolver){const{errors:wo}=await Ae([yt]);if(_e([yt]),lr(An),pr){const Il=hL(o.errors,u,yt),Al=hL(wo,u,Il.name||yt);yi=Al.error,yt=Al.name,Rn=Os(wo)}}else _e([yt],!0),yi=(await pL(nr,s.disabled,y,xe,t.shouldUseNativeValidation))[yt],_e([yt]),lr(An),pr&&(yi?Rn=!1:(H.isValid||$.isValid)&&(Rn=await Fe({fields:u,onlyCheckValid:!0,name:yt,eventType:qe.type})));pr&&(nr._f.deps&&(!Array.isArray(nr._f.deps)||nr._f.deps.length>0)&&di(nr._f.deps),ve(yt,Rn,yi,tl))}},li=(qe,pt)=>{if(Nr(o.errors,pt)&&qe.focus)return qe.focus(),1},di=async(qe,pt={})=>{let yt,pr;const nr=L_(qe);if(t.resolver){const lr=await Ye(ho(qe)?qe:nr);yt=Os(lr),pr=qe?!nr.some(wr=>Nr(lr,wr)):yt}else qe?(pr=(await Promise.all(nr.map(async lr=>{const wr=Nr(u,lr);return await Fe({fields:wr&&wr._f?{[lr]:wr}:wr,eventType:Up.TRIGGER})}))).every(Boolean),!(!pr&&!o.isValid)&&Ne()):pr=yt=await Fe({fields:u,name:qe,eventType:Up.TRIGGER});return te.state.next({...!Ds(qe)||(H.isValid||$.isValid)&&yt!==o.isValid?{}:{name:qe},...t.resolver||!qe?{isValid:yt}:{},errors:o.errors}),pt.shouldFocus&&!pr&&D_(u,li,qe?nr:s.mount),pr},Wr=(qe,pt)=>{let yt={...T.mount?y:p};return pt&&(yt=JR(pt.dirtyFields?o.dirtyFields:o.touchedFields,yt)),ho(qe)?yt:Ds(qe)?Nr(yt,qe):qe.map(pr=>Nr(yt,pr))},fr=(qe,pt)=>({invalid:!!Nr((pt||o).errors,qe),isDirty:!!Nr((pt||o).dirtyFields,qe),error:Nr((pt||o).errors,qe),isValidating:!!Nr(o.validatingFields,qe),isTouched:!!Nr((pt||o).touchedFields,qe)}),Ur=qe=>{const pt=qe?L_(qe):void 0;pt==null||pt.forEach(yt=>Vo(o.errors,yt)),pt?pt.forEach(yt=>{te.state.next({name:yt,errors:o.errors})}):te.state.next({errors:{}})},qi=(qe,pt,yt)=>{const pr=(Nr(u,qe,{_f:{}})._f||{}).ref,nr=Nr(o.errors,qe)||{},{ref:lr,message:wr,type:Yr,...yi}=nr;Gn(o.errors,qe,{...yi,...pt,ref:pr}),te.state.next({name:qe,errors:o.errors,isValid:!1}),yt&&yt.shouldFocus&&pr&&pr.focus&&pr.focus()},zn=(qe,pt)=>vl(qe)?te.state.subscribe({next:yt=>"values"in yt&&qe(yt.values||He(void 0,pt),yt)}):He(qe,pt,!0),sn=qe=>te.state.subscribe({next:pt=>{if(Pq(qe.name,pt.name,qe.exact)&&Aq(pt,qe.formState||H,aa,qe.reRenderRoot)){const yt={...y};qe.callback({values:yt,...o,...pt,defaultValues:p})}}}).unsubscribe,ao=qe=>(T.mount=!0,$={...$,...qe.formState},sn({...qe,formState:{...B,...qe.formState}})),So=(qe,pt={})=>{for(const yt of qe?L_(qe):s.mount)s.mount.delete(yt),s.array.delete(yt),pt.keepValue||(Vo(u,yt),Vo(y,yt)),!pt.keepError&&Vo(o.errors,yt),!pt.keepDirty&&Vo(o.dirtyFields,yt),!pt.keepTouched&&Vo(o.touchedFields,yt),!pt.keepIsValidating&&Vo(o.val
53idatingFields,yt),!t.shouldUnregister&&!pt.keepDefaultValue&&Vo(p,yt);te.state.next({values:Bo(y)}),te.state.next({...o,...pt.keepDirty?{isDirty:ze()}:{}}),!pt.keepIsValid&&Ne()},tn=({disabled:qe,name:pt})=>{if(Ac(qe)&&T.mount||qe||s.disabled.has(pt)){const nr=s.disabled.has(pt)!==!!qe;qe?s.disabled.add(pt):s.disabled.delete(pt),nr&&T.mount&&!T.action&&Ne()}},Wi=(qe,pt={})=>{let yt=Nr(u,qe);const pr=Ac(pt.disabled)||Ac(t.disabled),nr=!s.registerName.has(qe)&&yt&&yt._f&&!yt._f.mount;return Gn(u,qe,{...yt||{},_f:{...yt&&yt._f?yt._f:{ref:{name:qe}},name:qe,mount:!0,...pt}}),s.mount.add(qe),yt&&!nr?tn({disabled:Ac(pt.disabled)?pt.disabled:t.disabled,name:qe}):It(qe,!0,pt.value),{...pr?{disabled:pt.disabled||t.disabled}:{},...t.progressive?{required:!!pt.required,min:z_(pt.min),max:z_(pt.max),minLength:z_(pt.minLength),maxLength:z_(pt.maxLength),pattern:z_(pt.pattern)}:{},name:qe,onChange:gr,onBlur:gr,ref:lr=>{if(lr){s.registerName.add(qe),Wi(qe,pt),s.registerName.delete(qe),yt=Nr(u,qe);const wr=ho(lr.value)&&lr.querySelectorAll&&lr.querySelectorAll("input,select,textarea")[0]||lr,Yr=bq(wr),yi=yt._f.refs||[];if(Yr?yi.find(Rn=>Rn===wr):wr===yt._f.ref)return;Gn(u,qe,{_f:{...yt._f,...Yr?{refs:[...yi.filter(lS),wr,...Array.isArray(Nr(p,qe))?[{}]:[]],ref:{type:wr.type,name:qe}}:{ref:wr}}}),It(qe,!1,void 0,wr)}else yt=Nr(u,qe,{}),yt._f&&(yt._f.mount=!1),(t.shouldUnregister||pt.shouldUnregister)&&!(qR(s.array,qe).length&&T.action)&&s.unMount.add(qe)}}},Xr=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&D_(u,li,s.mount),Ro=qe=>{Ac(qe)&&(te.state.next({disabled:qe}),D_(u,(pt,yt)=>{const pr=Nr(u,yt);pr&&(pt.disabled=pr._f.disabled||qe,Array.isArray(pr._f.refs)&&pr._f.refs.forEach(nr=>{nr.disabled=pr._f.disabled||qe}))},0,!1))},Lo=(qe,pt)=>async yt=>{let pr;yt&&(yt.preventDefault&&yt.preventDefault(),yt.persist&&yt.persist());let nr=Bo(y);if(te.state.next({isSubmitting:!0}),t.resolver){const{errors:lr,values:wr}=await Ae();_e(),o.errors=lr,nr=Bo(wr)}else await Fe({fields:u,eventType:Up.SUBMIT});if(s.disabled.size)for(const lr of s.disabled)Vo(nr,lr);if(Vo(o.errors,ZR),Os(o.errors)){te.state.next({errors:{}});try{await qe(nr,yt)}catch(lr){pr=lr}}else pt&&await pt({...o.errors},yt),Xr(),setTimeout(Xr);if(te.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Os(o.errors)&&!pr,submitCount:o.submitCount+1,errors:o.errors}),pr)throw pr},oc=(qe,pt={})=>{Nr(u,qe)&&(ho(pt.defaultValue)?Nt(qe,Bo(Nr(p,qe))):(Nt(qe,pt.defaultValue),Gn(p,qe,Bo(pt.defaultValue))),pt.keepTouched||Vo(o.touchedFields,qe),pt.keepDirty||(Vo(o.dirtyFields,qe),o.isDirty=pt.defaultValue?ze(qe,Bo(Nr(p,qe))):ze()),pt.keepError||(Vo(o.errors,qe),H.isValid&&Ne()),te.state.next({...o}))},Gs=(qe,pt={})=>{const yt=qe?Bo(qe):p,pr=Bo(yt),nr=Os(qe),lr=nr?p:pr;if(pt.keepDefaultValues||(p=yt),!pt.keepValues){if(pt.keepDirtyValues){const wr=new Set([...s.mount,...Object.keys(jp(p,y))]);for(const Yr of Array.from(wr)){const yi=Nr(o.dirtyFields,Yr),Rn=Nr(y,Yr),An=Nr(lr,Yr);yi&&!ho(Rn)?Gn(lr,Yr,Rn):!yi&&!ho(An)&&Nt(Yr,An)}}else{if(QE&&ho(qe))for(const wr of s.mount){const Yr=Nr(u,wr);if(Yr&&Yr._f){const yi=Array.isArray(Yr._f.refs)?Yr._f.refs[0]:Yr._f.ref;if(Kx(yi)){const Rn=yi.closest("form");if(Rn){Rn.reset();break}}}}if(pt.keepFieldsRef)for(const wr of s.mount)Nt(wr,Nr(lr,wr));else u={}}y=t.shouldUnregister?pt.keepDefaultValues?Bo(p):{}:Bo(lr),te.array.next({values:{...lr}}),te.state.next({values:{...lr}})}s={mount:pt.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},T.mount=!H.isValid||!!pt.keepIsValid||!!pt.keepDirtyValues||!t.shouldUnregister&&!Os(lr),T.watch=!!t.shouldUnregister,T.keepIsValid=!!pt.keepIsValid,T.action=!1,pt.keepErrors||(o.errors={}),te.state.next({submitCount:pt.keepSubmitCount?o.submitCount:0,isDirty:nr?!1:pt.keepDirty?o.isDirty:!!(pt.keepDefaultValues&&!Ka(qe,p)),isSubmitted:pt.keepIsSubmitted?o.isSubmitted:!1,dirtyFields:nr?{}:pt.keepDirtyValues?pt.keepDefaultValues&&y?jp(p,y):o.dirtyFields:pt.keepDefaultValues&&qe?jp(p,qe):pt.keepDirty?o.dirtyFields:{},touchedFields:pt.keepTouched?o.touchedFields:{},errors:pt.keepErrors?o.errors:{},isSubmitSuccessful:pt.keepIsSubmitSuccessful?o.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:p})},zo=(qe,pt)=>Gs(vl(qe)?qe(y):qe,{...t.resetOptions,...pt}),Uo=(qe,pt={})=>{const yt=Nr(u,qe),pr=yt&&yt._f;if(pr){const nr=pr.refs?pr.refs[0]:pr.ref;nr.focus&&setTimeout(()=>{nr.focus(),pt.shouldSelect&&vl(nr.select)&&nr.select()})}},aa=qe=>{o={...o,...qe}},Da={control:{register:Wi,unregister:So,getFieldState:fr,handleSubmit:Lo,setError:qi,_subscribe:sn,_runSchema:Ae,_updateIsValidating:_e,_focusError:Xr,_getWatch:He,_getDirty:ze,_setValid:Ne,_setFieldArray:ke,_setDisabledField:tn,_setErrors:et,_getFieldArray:tt,_reset:Gs,_resetDefaultValues:()=>vl(t.defaultValues)&&t.defaultValues().then(qe=>{zo(qe,t.resetOptions),te.state.next({isLoading:!1})}),_removeUnmounted:Je,_disableForm:Ro,_subjects:te,_proxyFormState:H,get _fields(){return u},get _formValues(){return y},get _state(){return T},set _state(qe){T=qe},get _defaultValues(){return p},get _names(){return s},set _names(qe){s=qe},get _formState(){return o},get _options(){return t},set _options(qe){t={...t,...qe}}},subscribe:ao,trigger:di,register:Wi,handleSubmit:Lo,watch:zn,setValue:Nt,setValues:jt,getValues:Wr,reset:zo,resetField:oc,clearErrors:Ur,unregister:So,setError:qi,setFocus:Uo,getFieldState:fr};return{...Da,formControl:Da}}function zq(e={}){const t=kn.useRef(void 0),o=kn.useRef(void 0),[u,p]=kn.useState(()=>({...Bo(mL),isLoading:vl(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:vl(e.defaultValues)?void 0:e.defaultValues}));if(!t.current)if(e.formControl)t.current={...e.formControl,formState:u},e.defaultValues&&!vl(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:T,...s}=Lq(e);t.current={...s,formState:u}}const y=t.current.control;return y._options=e,WR(()=>{const T=y._subscribe({formState:y._proxyFormState,callback:()=>p({...y._formState,defaultValues:y._defaultValues}),reRenderRoot:!0});return p(s=>({...s,isReady:!0})),y._formState.isReady=!0,T},[y]),kn.useEffect(()=>y._disableForm(e.disabled),[y,e.disabled]),kn.useEffect(()=>{e.mode&&(y._options.mode=e.mode),e.reValidateMode&&(y._options.reValidateMode=e.reValidateMode)},[y,e.mode,e.reValidateMode]),kn.useEffect(()=>{e.errors&&(y._setErrors(e.errors),y._focusError())},[y,e.errors]),kn.useEffect(()=>{e.shouldUnregister&&y._subjects.state.next({values:y._getWatch()})},[y,e.shouldUnregister]),kn.useEffect(()=>{if(y._proxyFormState.isDirty){const T=y._getDirty();T!==u.isDirty&&y._subjects.state.next({isDirty:T})}},[y,u.isDirty]),kn.useEffect(()=>{var T;e.values&&!Ka(e.values,o.current)?(y._reset(e.values,{keepFieldsRef:!0,...y._options.resetOptions}),!((T=y._options.resetOptions)===null||T===void 0)&&T.keepIsValid||y._setValid(),o.current=e.values,p(s=>({...s}))):y._resetDefaultValues()},[y,e.values]),kn.useEffect(()=>{y._state.mount||(y._setValid(),y._state.mount=!0),y._state.watch&&(y._state.watch=!1,y._subjects.state.next({...y._formState})),y._removeUnmounted()}),t.current.formState=kn.useMemo(()=>yq(u,y),[y,u]),t.current}var gL={exports:{}};(function(e,t){(function(o,u){e.exports=u()})(_c,function(){var o,u,p;function y(s,M){if(!o)o=M;else if(!u)u=M;else{var L="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+o+")(sharedChunk); ("+u+")(sharedChunk); self.onerror = null;",B={};o(B),p=M(B),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(p.workerUrl=window.URL.createObjectURL(new Blob([L],{type:"text/javascript"})))}}y(["exports"],function(s){var M=1e-6,L=typeof Float32Array<"u"?Float32Array:Array;
vendor: 4,139 bytes, line 53
53function B(a,r){var n=r[0],c=r[1],h=r[2],m=r[3],g=n*m-h*c;return g?(a[0]=m*(g=1/g),a[1]=-c*g,a[2]=-h*g,a[3]=n*g,a):null}function H(){var a=new L(9);return L!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function $(a,r){var n=r[0],c=r[1],h=r[2],m=r[3],g=r[4],x=r[5],w=r[6],E=r[7],I=r[8];return a[0]=g*I-x*E,a[1]=h*E-c*I,a[2]=c*x-h*g,a[3]=x*w-m*I,a[4]=n*I-h*w,a[5]=h*m-n*x,a[6]=m*E-g*w,a[7]=c*w-n*E,a[8]=n*g-c*m,a}function te(a,r,n){var c=r[0],h=r[1],m=r[2],g=r[3],x=r[4],w=r[5],E=r[6],I=r[7],A=r[8],P=n[0],D=n[1],O=n[2],V=n[3],j=n[4],X=n[5],oe=n[6],ne=n[7],ae=n[8];return a[0]=P*c+D*g+O*E,a[1]=P*h+D*x+O*I,a[2]=P*m+D*w+O*A,a[3]=V*c+j*g+X*E,a[4]=V*h+j*x+X*I,a[5]=V*m+j*w+X*A,a[6]=oe*c+ne*g+ae*E,a[7]=oe*h+ne*x+ae*I,a[8]=oe*m+ne*w+ae*A,a}function xe(){var a=new L(16);return L!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a}function pe(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function Ne(a,r){var n=r[0],c=r[1],h=r[2],m=r[3],g=r[4],x=r[5],w=r[6],E=r[7],I=r[8],A=r[9],P=r[10],D=r[11],O=r[12],V=r[13],j=r[14],X=r[15],oe=n*x-c*g,ne=n*w-h*g,ae=n*E-m*g,Ie=c*w-h*x,be=c*E-m*x,Te=h*E-m*w,Le=I*V-A*O,De=I*j-P*O,lt=I*X-D*O,je=A*j-P*V,ht=A*X-D*V,Lt=P*X-D*j,gt=oe*Lt-ne*ht+ae*je+Ie*lt-be*De+Te*Le;return gt?(a[0]=(x*Lt-w*ht+E*je)*(gt=1/gt),a[1]=(h*ht-c*Lt-m*je)*gt,a[2]=(V*Te-j*be+X*Ie)*gt,a[3]=(P*be-A*Te-D*Ie)*gt,a[4]=(w*lt-g*Lt-E*De)*gt,a[5]=(n*Lt-h*lt+m*De)*gt,a[6]=(j*ae-O*Te-X*ne)*gt,a[7]=(I*Te-P*ae+D*ne)*gt,a[8]=(g*ht-x*lt+E*Le)*gt,a[9]=(c*lt-n*ht-m*Le)*gt,a[10]=(O*be-V*ae+X*oe)*gt,a[11]=(A*ae-I*be-D*oe)*gt,a[12]=(x*De-g*je-w*Le)*gt,a[13]=(n*je-c*De+h*Le)*gt,a[14]=(V*ne-O*Ie-j*oe)*gt,a[15]=(I*Ie-A*ne+P*oe)*gt,a):null}function _e(a,r,n){var c=r[0],h=r[1],m=r[2],g=r[3],x=r[4],w=r[5],E=r[6],I=r[7],A=r[8],P=r[9],D=r[10],O=r[11],V=r[12],j=r[13],X=r[14],oe=r[15],ne=n[0],ae=n[1],Ie=n[2],be=n[3];return a[0]=ne*c+ae*x+Ie*A+be*V,a[1]=ne*h+ae*w+Ie*P+be*j,a[2]=ne*m+ae*E+Ie*D+be*X,a[3]=ne*g+ae*I+Ie*O+be*oe,a[4]=(ne=n[4])*c+(ae=n[5])*x+(Ie=n[6])*A+(be=n[7])*V,a[5]=ne*h+ae*w+Ie*P+be*j,a[6]=ne*m+ae*E+Ie*D+be*X,a[7]=ne*g+ae*I+Ie*O+be*oe,a[8]=(ne=n[8])*c+(ae=n[9])*x+(Ie=n[10])*A+(be=n[11])*V,a[9]=ne*h+ae*w+Ie*P+be*j,a[10]=ne*m+ae*E+Ie*D+be*X,a[11]=ne*g+ae*I+Ie*O+be*oe,a[12]=(ne=n[12])*c+(ae=n[13])*x+(Ie=n[14])*A+(be=n[15])*V,a[13]=ne*h+ae*w+Ie*P+be*j,a[14]=ne*m+ae*E+Ie*D+be*X,a[15]=ne*g+ae*I+Ie*O+be*oe,a}function ie(a,r,n){var c,h,m,g,x,w,E,I,A,P,D,O,V=n[0],j=n[1],X=n[2];return r===a?(a[12]=r[0]*V+r[4]*j+r[8]*X+r[12],a[13]=r[1]*V+r[5]*j+r[9]*X+r[13],a[14]=r[2]*V+r[6]*j+r[10]*X+r[14],a[15]=r[3]*V+r[7]*j+r[11]*X+r[15]):(h=r[1],m=r[2],g=r[3],x=r[4],w=r[5],E=r[6],I=r[7],A=r[8],P=r[9],D=r[10],O=r[11],a[0]=c=r[0],a[1]=h,a[2]=m,a[3]=g,a[4]=x,a[5]=w,a[6]=E,a[7]=I,a[8]=A,a[9]=P,a[10]=D,a[11]=O,a[12]=c*V+x*j+A*X+r[12],a[13]=h*V+w*j+P*X+r[13],a[14]=m*V+E*j+D*X+r[14],a[15]=g*V+I*j+O*X+r[15]),a}function ke(a,r,n){var c=n[0],h=n[1],m=n[2];return a[0]=r[0]*c,a[1]=r[1]*c,a[2]=r[2]*c,a[3]=r[3]*c,a[4]=r[4]*h,a[5]=r[5]*h,a[6]=r[6]*h,a[7]=r[7]*h,a[8]=r[8]*m,a[9]=r[9]*m,a[10]=r[10]*m,a[11]=r[11]*m,a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15],a}function ot(a,r,n){var c=Math.sin(n),h=Math.cos(n),m=r[4],g=r[5],x=r[6],w=r[7],E=r[8],I=r[9],A=r[10],P=r[11];return r!==a&&(a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=r[3],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[4]=m*h+E*c,a[5]=g*h+I*c,a[6]=x*h+A*c,a[7]=w*h+P*c,a[8]=E*h-m*c,a[9]=I*h-g*c,a[10]=A*h-x*c,a[11]=P*h-w*c,a}function et(a,r,n){var c=Math.sin(n),h=Math.cos(n),m=r[0],g=r[1],x=r[2],w=r[3],E=r[8],I=r[9],A=r[10],P=r[11];return r!==a&&(a[4]=r[4],a[5]=r[5],a[6]=r[6],a[7]=r[7],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[0]=m*h-E*c,a[1]=g*h-I*c,a[2]=x*h-A*c,a[3]=w*h-P*c,a[8]=m*c+E*h,a[9]=g*c+I*h,a[10]=x*c+A*h,a[11]=w*c+P*h,a}function wt(a,r,n){var c=Math.sin(n),h=Math.cos(n),m=r[0],g=r[1],x=r[2],w=r[3],E=r[4],I=r[5],A=r[6],P=r[7];return r!==a&&(a[8]=r[8],a[9]=r[9],a[10]=r[10],a[11]=r[11],a[12]=r[12],a[13]=r[13],a[14]=r[14],a[15]=r[15]),a[0]=m*h+E*c,a[1]=g*h+I*c,a[2]=x
53*h+A*c,a[3]=w*h+P*c,a[4]=E*h-m*c,a[5]=I*h-g*c,a[6]=A*h-x*c,a[7]=P*h-w*c,a}function It(a,r){return a[0]=r[0],a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=r[1],a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=r[2],a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function K(a,r,n){var c,h,m,g=n[0],x=n[1],w=n[2],E=Math.hypot(g,x,w);return E<M?null:(g*=E=1/E,x*=E,w*=E,c=Math.sin(r),h=Math.cos(r),a[0]=g*g*(m=1-h)+h,a[1]=x*g*m+w*c,a[2]=w*g*m-x*c,a[3]=0,a[4]=g*x*m-w*c,a[5]=x*x*m+h,a[6]=w*x*m+g*c,a[7]=0,a[8]=g*w*m+x*c,a[9]=x*w*m-g*c,a[10]=w*w*m+h,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a)}function ve(a,r){var n=r[0],c=r[1],h=r[2],m=r[3],g=n+n,x=c+c,w=h+h,E=n*g,I=c*g,A=c*x,P=h*g,D=h*x,O=h*w,V=m*g,j=m*x,X=m*w;return a[0]=1-A-O,a[1]=I+X,a[2]=P-j,a[3]=0,a[4]=I-X,a[5]=1-E-O,a[6]=D+V,a[7]=0,a[8]=P+j,a[9]=D-V,a[10]=1-E-A,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}Math.hypot||(Math.hypot=function(){for(var a=0,r=arguments.length;r--;)a+=arguments[r]*arguments[r];return Math.sqrt(a)});var Ae=_e;function Ye(){var a=new L(3);return L!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function Be(a){var r=new L(3);return r[0]=a[0],r[1]=a[1],r[2]=a[2],r}function Fe(a){return Math.hypot(a[0],a[1],a[2])}function Je(a,r,n){var c=new L(3);return c[0]=a,c[1]=r,c[2]=n,c}function ze(a,r,n,c){return a[0]=r,a[1]=n,a[2]=c,a}function He(a,r,n){return a[0]=r[0]+n[0],a[1]=r[1]+n[1],a[2]=r[2]+n[2],a}function tt(a,r,n){return a[0]=r[0]-n[0],a[1]=r[1]-n[1],a[2]=r[2]-n[2],a}function Oe(a,r,n){return a[0]=r[0]*n[0],a[1]=r[1]*n[1],a[2]=r[2]*n[2],a}function rt(a,r,n){return a[0]=Math.min(r[0],n[0]),a[1]=Math.min(r[1],n[1]),a[2]=Math.min(r[2],n[2]),a}function Nt(a,r,n){return a[0]=Math.max(r[0],n[0]),a[1]=Math.max(r[1],n[1]),a[2]=Math.max(r[2],n[2]),a}function jt(a,r,n){return a[0]=r[0]*n,a[1]=r[1]*n,a[2]=r[2]*n,a}function gr(a,r,n,c){return a[0]=r[0]+n[0]*c,a[1]=r[1]+n[1]*c,a[2]=r[2]+n[2]*c,a}function li(a,r){var n=r[0]-a[0],c=r[1]-a[1],h=r[2]-a[2];return n*n+c*c+h*h}function di(a){var r=a[0],n=a[1],c=a[2];return r*r+n*n+c*c}function Wr(a,r){return a[0]=-r[0],a[1]=-r[1],a[2]=-r[2],a}function fr(a,r){var n=r[0],c=r[1],h=r[2],m=n*n+c*c+h*h;return m>0&&(m=1/Math.sqrt(m)),a[0]=r[0]*m,a[1]=r[1]*m,a[2]=r[2]*m,a}function Ur(a,r){return a[0]*r[0]+a[1]*r[1]+a[2]*r[2]}function qi(a,r,n){var c=r[0],h=r[1],m=r[2],g=n[0],x=n[1],w=n[2];return a[0]=h*w-m*x,a[1]=m*g-c*w,a[2]=c*x-h*g,a}function zn(a,r,n,c){var h=r[0],m=r[1],g=r[2];return a[0]=h+c*(n[0]-h),a[1]=m+c*(n[1]-m),a[2]=g+c*(n[2]-g),a}function sn(a,r,n){var c=r[0],h=r[1],m=r[2],g=n[3]*c+n[7]*h+n[11]*m+n[15];return a[0]=(n[0]*c+n[4]*h+n[8]*m+n[12])/(g=g||1),a[1]=(n[1]*c+n[5]*h+n[9]*m+n[13])/g,a[2]=(n[2]*c+n[6]*h+n[10]*m+n[14])/g,a}function ao(a,r,n){var c=r[0],h=r[1],m=r[2];return a[0]=c*n[0]+h*n[3]+m*n[6],a[1]=c*n[1]+h*n[4]+m*n[7],a[2]=c*n[2]+h*n[5]+m*n[8],a}function So(a,r,n){var c=n[0],h=n[1],m=n[2],g=r[0],x=r[1],w=r[2],E=h*w-m*x,I=m*g-c*w,A=c*x-h*g,P=h*A-m*I,D=m*E-c*A,O=c*I-h*E,V=2*n[3];return I*=V,A*=V,D*=2,O*=2,a[0]=g+(E*=V)+(P*=2),a[1]=x+I+D,a[2]=w+A+O,a}function tn(a){return a[0]=0,a[1]=0,a[2]=0,a}function Wi(a,r){return a[0]===r[0]&&a[1]===r[1]&&a[2]===r[2]}var Xr=tt,Ro=Oe,Lo=Fe;function oc(){var a=new L(4);return L!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0),a}function Gs(a,r,n){return a[0]=r[0]*n,a[1]=r[1]*n,a[2]=r[2]*n,a[3]=r[3]*n,a}function zo(a,r){var n=r[0],c=r[1],h=r[2],m=r[3],g=n*n+c*c+h*h+m*m;return g>0&&(g=1/Math.sqrt(g)),a[0]=n*g,a[1]=c*g,a[2]=h*g,a[3]=m*g,a}function Uo(a,r,n){var c=r[0],h=r[1],m=r[2],g=r[3];return a[0]=n[0]*c+n[4]*h+n[8]*m+n[12]*g,a[1]=n[1]*c+n[5]*h+n[9]*m+n[13]*g,a[2]=n[2]*c+n[6]*h+n[10]*m+n[14]*g,a[3]=n[3]*c+n[7]*h+n[11]*m+n[15]*g,a}function aa(){var a=new L(4);return L!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function za(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a}function Da(a,r,n){n*=.5;var c=r[0],h=r[1],m=r[2],g=r[3],x=Math.sin(n),w=Math.cos(n);return a[0]=c*w+g*x,a[1]=h*w+m*x,a[2]=m*w-h*x,a[3]=g*w-c*x,a}function qe(a,r,n){n*=.5;var c=r[0],h=r[1],m=r[2],g=r[3],x=Math.sin(n),w=Math.cos(n);return a[0]=c*w-m*x,a[1]=h*w+g*x,a[2]=m*w+c*x,a[3]=g*w-h*x,a}Ye(),oc();var pt,yt,pr,nr=zo,lr=(pt=Ye(),yt=Je(1,0,0),pr=Je(0,1,0),function(a,r,n){var c=Ur(r,n);return c<-.999999?(qi(pt,yt,r),Lo(pt)<1e-6&&qi(pt,pr,r),fr(pt,pt),function(h,m,g){g*=.5;var x=Math.sin(g);h[0]=x*m[0],h[1]=x*m[1],h[2]=x*m[2],h[3]=Math.cos(g)}(a,pt,Math.PI),a):c>.999999?(a[0]=0,a[1]=0,a[2]=0,a[3]=1,a):(qi(pt,r,n),a[0]=pt[0],a[1]=pt[1],a[2]=pt[2],a[3]=1+c,nr(a,a))});function wr(){var a=new L(2);return L!=Float32Array&&(a[0]=0,a[1]=0),a}function Yr(a,r){var n=new L(2);return n[0]=a,n[1]=r,n}function yi(a,r,n){return a[0]=r[0]+n[0],a[1]=r[1]+n[1],a}
vendor: 3,552 bytes, line 53
53function Rn(a,r,n){return a[0]=r[0]-n[0],a[1]=r[1]-n[1],a}function An(a,r,n){return a[0]=r[0]*n,a[1]=r[1]*n,a}function lo(a){return Math.hypot(a[0],a[1])}function Yo(a,r){var n=r[0],c=r[1],h=n*n+c*c;return h>0&&(h=1/Math.sqrt(h)),a[0]=r[0]*h,a[1]=r[1]*h,a}function Fi(a,r){return a[0]*r[0]+a[1]*r[1]}aa(),aa(),H();var tl,Cl,wo=Rn;function Il(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}wr();var Al=function(){if(Cl)return tl;function a(r,n,c,h){this.cx=3*r,this.bx=3*(c-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(h-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=n,this.p2x=c,this.p2y=h}return Cl=1,tl=a,a.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,n){if(n===void 0&&(n=1e-6),r<0)return 0;if(r>1)return 1;for(var c=r,h=0;h<8;h++){var m=this.sampleCurveX(c)-r;if(Math.abs(m)<n)return c;var g=this.sampleCurveDerivativeX(c);if(Math.abs(g)<1e-6)break;c-=m/g}var x=0,w=1;for(c=r,h=0;h<20&&(m=this.sampleCurveX(c),!(Math.abs(m-r)<n));h++)r>m?x=c:w=c,c=.5*(w-x)+x;return c},solve:function(r,n){return this.sampleCurveY(this.solveCurveX(r,n))}},tl}(),Fc=Il(Al);function Tt(a,r){this.x=a,this.y=r}function rl(a,r){if(Array.isArray(a)){if(!Array.isArray(r)||a.length!==r.length)return!1;for(let n=0;n<a.length;n++)if(!rl(a[n],r[n]))return!1;return!0}if(typeof a=="object"&&a!==null&&r!==null){if(typeof r!="object"||Object.keys(a).length!==Object.keys(r).length)return!1;for(const n in a)if(!rl(a[n],r[n]))return!1;return!0}return a===r}Tt.prototype={clone(){return new Tt(this.x,this.y)},add(a){return this.clone()._add(a)},sub(a){return this.clone()._sub(a)},multByPoint(a){return this.clone()._multByPoint(a)},divByPoint(a){return this.clone()._divByPoint(a)},mult(a){return this.clone()._mult(a)},div(a){return this.clone()._div(a)},rotate(a){return this.clone()._rotate(a)},rotateAround(a,r){return this.clone()._rotateAround(a,r)},matMult(a){return this.clone()._matMult(a)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(a){return this.x===a.x&&this.y===a.y},dist(a){return Math.sqrt(this.distSqr(a))},distSqr(a){const r=a.x-this.x,n=a.y-this.y;return r*r+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith(a){return this.angleWithSep(a.x,a.y)},angleWithSep(a,r){return Math.atan2(this.x*r-this.y*a,this.x*a+this.y*r)},_matMult(a){const r=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=r,this},_add(a){return this.x+=a.x,this.y+=a.y,this},_sub(a){return this.x-=a.x,this.y-=a.y,this},_mult(a){return this.x*=a,this.y*=a,this},_div(a){return this.x/=a,this.y/=a,this},_multByPoint(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint(a){return this.x/=a.x,this.y/=a.y,this},_unit(){return this._div(this.mag()),this},_perp(){const a=this.y;return this.y=this.x,this.x=-a,this},_rotate(a){const r=Math.cos(a),n=Math.sin(a),c=n*this.x+r*this.y;return this.x=r*this.x-n*this.y,this.y=c,this},_rotateAround(a,r){const n=Math.cos(a),c=Math.sin(a),h=r.y+c*(this.x-r.x)+n*(this.y-r.y);return this.x=r.x+n*(this.x-r.x)-c*(this.y-r.y),this.y=h,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Tt},Tt.convert=function(a){if(a instanceof Tt)return a;
53if(Array.isArray(a))return new Tt(+a[0],+a[1]);if(a.x!==void 0&&a.y!==void 0)return new Tt(+a.x,+a.y);throw new Error("Expected [x, y] or {x, y} point format")};const Fh=Math.PI/180,Pl=180/Math.PI;function ai(a){return a*Fh}function Xe(a){return a*Pl}const Y=[[0,0],[1,0],[1,1],[0,1]];function ee(a){if(a<=0)return 0;if(a>=1)return 1;const r=a*a,n=r*a;return 4*(a<.5?n:3*(a-r)+n-.75)}function q(a,r,n,c){const h=new Fc(a,r,n,c);return function(m){return h.solve(m)}}const Q=q(.25,.1,.25,1);function J(a,r,n){return Math.min(n,Math.max(r,a))}function ce(a,r,n){return(n=J((n-a)/(r-a),0,1))*n*(3-2*n)}function Ce(a,r,n){const c=n-r,h=((a-r)%c+c)%c+r;return h===r?n:h}function Ee(a,r,n){if(!a.length)return n(null,[]);let c=a.length;const h=new Array(a.length);let m=null;a.forEach((g,x)=>{r(g,(w,E)=>{w&&(m=w),h[x]=E,--c==0&&n(m,h)})})}function Re(a,...r){for(const n of r)for(const c in n)a[c]=n[c];return a}let dt=1;function Ge(){return dt++}function Mt(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function Ht(a,r){a.forEach(n=>{r[n]&&(r[n]=r[n].bind(r))})}function Kt(a,r,n){const c={};for(const h in a)c[h]=r.call(this,a[h],h,a);return c}function er(a,r,n){const c={};for(const h in a)r.call(this,a[h],h,a)&&(c[h]=a[h]);return c}function dr(a){return Array.isArray(a)?a.map(dr):typeof a=="object"&&a?Kt(a,dr):a}function Er(a,r){for(let n=0;n<a.length;n++)if(r.indexOf(a[n])>=0)return!0;return!1}const Kr={};function Ar(a){Kr[a]||(typeof console<"u"&&console.warn(a),Kr[a]=!0)}function ei(a,r,n){return(n.y-a.y)*(r.x-a.x)>(r.y-a.y)*(n.x-a.x)}function rn(a){let r=0;for(let n,c,h=0,m=a.length,g=m-1;h<m;g=h++)n=a[h],c=a[g],r+=(c.x-n.x)*(n.y+c.y);return r}function Xi([a,r,n]){const c=ai(r+90),h=ai(n);return{x:a*Math.cos(c)*Math.sin(h),y:a*Math.sin(c)*Math.sin(h),z:a*Math.cos(h),azimuthal:r,polar:n}}function Ei(a){return(typeof self<"u"||a!==void 0)&&typeof WorkerGlobalScope<"u"&&(a!==void 0?a:self)instanceof WorkerGlobalScope}function ti(a){const r={};if(a.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,c,h,m)=>{const g=h||m;return r[c]=!g||g.toLowerCase(),""}),r["max-age"]){const n=parseInt(r["max-age"],10);isNaN(n)?delete r["max-age"]:r["max-age"]=n}return r}let an=null;function ji(a,r){return[a[4*r],a[4*r+1],a[4*r+2],a[4*r+3]]}function Li(a,r,n,c){for(;r<n;){const h=r+n>>1;a[h]<c?r=h+1:n=h}return r}function Kn(a,r,n,c){for(;r<n;){const h=r+n>>1;a[h]<=c?r=h+1:n=h}return r}function Jn(a){return a>0?1/(1.001-a):1+a}function po(a){return a>0?1-1/(1.001-a):-a}function Ml(a,r,n){return(a-r.min)*(n.max-n.min)/(r.max-r.min)+n.min}const Qn={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Qn.API_URL)return null;try{const a=new URL(Qn.API_URL);return a.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":a.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.1.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function zi(a){return Qn.API_URL_REGEX.test(a)}function Do(a){return Qn.API_SPRITE_REGEX.test(a)}let hs,Es,Pu,Nc,Sn,la;function Mu(){return hs==null&&(hs=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),hs}const ca={now:()=>Nc!==void 0?Nc:performance.now(),setNow(a){Nc=a},restoreNow(){Nc=void 0},frame(a){const r=requestAnimationFrame(a);return{cancel:()=>cancelAnimationFrame(r)}},getImageData(a,r=0){const{width:n,height:c}=a;Sn||(Sn=document.createElement("canvas"));const h=Sn.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return(n>Sn.width||c>Sn.height)&&(Sn.width=n,Sn.height=c),h.clearRect(-r,-r,n+2*r,c+2*r),h.drawImage(a,0,0,n,c),h.getImageData(-r,-r,n+2*r,c+2*r)}
53,resolveURL:a=>(Es||(Es=document.createElement("a")),Es.href=a,Es.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Pu==null&&(Pu=window.matchMedia("(prefers-reduced-motion: reduce)")),Pu.matches)},hasCanvasFingerprintNoise(){if(la!==void 0)return la;if(!Mu())return la=!1,!1;const a=new OffscreenCanvas(85,1),r=a.getContext("2d",{willReadFrequently:!0});let n=0;for(let h=0;h<a.width;++h)r.fillStyle=`rgba(${n++},${n++},${n++}, 255)`,r.fillRect(h,0,1,1);const c=r.getImageData(0,0,a.width,a.height);n=0;for(let h=0;h<c.data.length;++h)if(h%4!=3&&n++!==c.data[h])return la=!0,!0;return la=!1,!1}};function ua(a,r){const n=a.indexOf("?");if(n<0)return`${a}?${new URLSearchParams(r).toString()}`;const c=new URLSearchParams(a.slice(n));for(const h in r)c.set(h,r[h]);return`${a.slice(0,n)}?${c.toString()}`}function Oa(a,r={persistentParams:[]}){const n=a.indexOf("?");if(n<0)return a;const c=new URLSearchParams,h=new URLSearchParams(a.slice(n));for(const g of r.persistentParam
53s){const x=h.get(g);x&&c.set(g,x)}const m=c.toString();return`${a.slice(0,n)}${m.length>0?`?${m}`:""}`}const sc="mapbox-tiles";let il=500,ac=50;const pf=["language","worldview","jobid"];let kl,mf;function ku(){try{return caches}catch{}}function Nh(){const a=ku();a&&kl==null&&(kl=a.open(sc))}let Ey=1/0;const Sy={supported:!1,testSupport:function(a){!gf&&Ru&&(Bh?yb(a):Ss=a)}};let Ss,Ru,gf=!1,Bh=!1;const _b=typeof self<"u"?self:{};function yb(a){const r=a.createTexture();a.bindTexture(a.TEXTURE_2D,r);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,Ru),a.isContextLost())return;Sy.supported=!0}catch{}a.deleteTexture(r),gf=!0}_b.document&&(Ru=_b.document.createElement("img"),Ru.onload=function(){Ss&&yb(Ss),Ss=null,Bh=!0},Ru.onerror=function(){gf=!0,Ss=null},Ru.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const _f={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(_f);class fi extends Error{constructor(r,n,c){n===401&&zi(c)&&(r+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(r),this.status=n,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const dm=Ei()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Vh=function(a,r){if(!(/^file:/.test(n=a.url)||/^file:/.test(dm())&&!/^\w+:/.test(n))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(c,h){const m=new AbortController,g=new Request(c.url,{method:c.method||"GET",body:c.body,credentials:c.credentials,headers:c.headers,referrer:dm(),referrerPolicy:c.referrerPolicy,signal:m.signal});let x=!1,w=!1;const E=(I=g.url).indexOf("sku=")>0&&zi(I);var I;c.type==="json"&&g.headers.set("Accept","application/json");const A=(D,O,V)=>{if(w)return;if(D&&D.message!=="SecurityError"&&Ar(D.toString()),O&&V)return P(O);const j=Date.now();fetch(g).then(X=>{if(X.ok){const oe=E?X.clone():null;return P(X,oe,j)}return h(new fi(X.statusText,X.status,c.url))}).catch(X=>{X.name!=="AbortError"&&h(new Error(`${X.message} ${c.url}`))})},P=(D,O,V)=>{(c.type==="arrayBuffer"?D.arrayBuffer():c.type==="json"?D.json():D.text()).then(j=>{w||(O&&V&&function(X,oe,ne){if(Nh(),kl==null)return;const ae=ti(oe.headers.get("Cache-Control")||"");if(ae["no-store"])return;const Ie={status:oe.status,statusText:oe.statusText,headers:new Headers};oe.headers.forEach((Le,De)=>Ie.headers.set(De,Le)),ae["max-age"]&&Ie.headers.set("Expires",new Date(ne+1e3*ae["max-age"]).toUTCString());const be=Ie.headers.get("Expires");if(!be||new Date(be).getTime()-ne<42e4)return;
53let Te=Oa(X.url,{persistentParams:pf});if(oe.status===206){const Le=X.headers.get("Range");if(!Le)return;Ie.status=200,Te=ua(Te,{range:Le})}(function(Le,De){if(mf===void 0)try{new Response(new ReadableStream),mf=!0}catch{mf=!1}mf?De(Le.body):Le.blob().then(De).catch(lt=>Ar(lt.message))})(oe,Le=>{const De=new Response((lt=oe.status)!==200&&lt!==404&&[101,103,204,205,304].includes(lt)?null:Le,Ie);var lt;Nh(),kl!=null&&kl.then(je=>je.put(Te,De)).catch(je=>Ar(je.message))})}(g,O,V),x=!0,h(null,j,D.headers.get("Cache-Control"),D.headers.get("Expires")))}).catch(j=>{w||h(new Error(j.message))})};return E?function(D,O){if(Nh(),kl==null)return O(null);kl.then(V=>{let j=Oa(D.url,{persistentParams:pf});const X=D.headers.get("Range");X&&(j=ua(j,{range:X})),V.match(j).then(oe=>{const ne=function(ae){if(!ae)return!1;const Ie=new Date(ae.headers.get("Expires")||0),be=ti(ae.headers.get("Cache-Control")||"");return Number(Ie)>Date.now()&&!be["no-cache"]}(oe);V.delete(j).catch(O),ne&&V.put(j,oe.clone()).catch(O),O(null,oe,ne)}).catch(O)}).catch(O)}(g,A):A(null,null),{cancel:()=>{w=!0,x||m.abort()}}}(a,r);if(Ei(self)&&self.worker.actor)return self.worker.actor.send("getResource",a,r,void 0,!0)}var n;return function(c,h){const m=new XMLHttpRequest;m.open(c.method||"GET",c.url,!0),c.type==="arrayBuffer"&&(m.responseType="arraybuffer");for(const g in c.headers)m.setRequestHeader(g,c.headers[g]);return c.type==="json"&&(m.responseType="text",m.setRequestHeader("Accept","application/json")),m.withCredentials=c.credentials==="include",m.onerror=()=>{h(new Error(m.statusText))},m.onload=()=>{if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let g=m.response;if(c.type==="json")try{g=JSON.parse(m.response)}catch(x){return h(x)}h(null,g,m.getResponseHeader("Cache-Control"),m.getResponseHeader("Expires"))}else h(new fi(m.statusText,m.status,c.url))},m.send(c.body),{cancel:()=>m.abort()}}(a,r)},yf=function(a,r){return Vh(Re(a,{type:"arrayBuffer"}),r)};function gI(a){const r=document.createElement("a");return r.href=a,r.protocol===location.protocol&&r.host===location.host}const vf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Lu,Bc;Lu=[],Bc=0;const xf=function(a,r){if(Sy.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),Bc>=Qn.MAX_PARALLEL_IMAGE_REQUESTS){const m={requestParameters:a,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return Lu.push(m),m}Bc++;let n=!1;const c=()=>{if(!n)for(n=!0,Bc--;Lu.length&&Bc<Qn.MAX_PARALLEL_IMAGE_REQUESTS;){const m=Lu.shift(),{requestParameters:g,callback:x,cancelled:w}=m;w||(m.cancel=xf(g,x).cancel)}},h=yf(a,(m,g,x,w)=>{c(),m?r(m):g&&(self.createImageBitmap?function(E,I){const A=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(A).then(P=>{I(null,P)}).catch(P=>{I(new Error(`Could not load image because of ${P.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(g,(E,I)=>r(E,I,x,w)):function(E,I){const A=new Image;A.onload=()=>{I(null,A),URL.revokeObjectURL(A.src),A.onload=null,requestAnimationFrame(()=>{A.src=vf})},A.onerror=()=>I(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const P=new Blob([new Uint8Array(E)],{type:"image/png"});A.src=E.byteLength?URL.createObjectURL(P):vf}(g,(E,I)=>r(E,I,x,w)))});return{cancel:()=>{h.cancel(),c()}}};var vb,fm,xb,Uh={exports:{}},zu={exports:{}},bb={exports:{}},bf=function(){if(xb)return Uh.exports;xb=1;var a=(vb||(vb=1,zu.exports=function(n,c){var h,m,g,x,w,E,I,A;for(m=n.length-(h=3&n.length),g=c,w=3432918353,E=461845907,A=0;A<m;)I=255&n.charCodeAt(A)|(255&n.charCodeAt(++A))<<8|(255&n.charCodeAt(++A))<<16|(255&n.charCodeAt(++A))<<24,++A,g=27492+(65535&(x=5*(65535&(g=(g^=I=(65535&(I=(I=(65535&I)*w+(((I>>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*E+(((I>>>16)*E&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);
53switch(I=0,h){case 3:I^=(255&n.charCodeAt(A+2))<<16;case 2:I^=(255&n.charCodeAt(A+1))<<8;case 1:g^=I=(65535&(I=(I=(65535&(I^=255&n.charCodeAt(A)))*w+(((I>>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*E+(((I>>>16)*E&65535)<<16)&4294967295}return g^=n.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0}),zu.exports),r=(fm||(fm=1,bb.exports=function(n,c){for(var h,m=n.length,g=c^m,x=0;m>=4;)h=1540483477*(65535&(h=255&n.charCodeAt(x)|(255&n.charCodeAt(++x))<<8|(255&n.charCodeAt(++x))<<16|(255&n.charCodeAt(++x))<<24))+((1540483477*(h>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),m-=4,++x;switch(m){case 3:g^=(255&n.charCodeAt(x+2))<<16;case 2:g^=(255&n.charCodeAt(x+1))<<8;case 1:g=1540483477*(65535&(g^=255&n.charCodeAt(x)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0}),bb.exports);return Uh.exports=a,Uh.exports.murmur3=a,Uh.exports.murmur2=r,Uh.exports}(),jh=Il(bf);class lc{constructor(r,...n){Re(this,n[0]||{}),this.type=r}}class ha extends lc{constructor(r,n={}){super("error",Re({error:r},n))}}function Cy(a,r,n){n[a]&&n[a].indexOf(r)!==-1||(n[a]=n[a]||[],n[a].push(r))}function Iy(a,r,n){if(n&&n[a]){const c=n[a].indexOf(r);c!==-1&&n[a].splice(c,1)}}class Du{on(r,n){return this._listeners=this._listeners||{},Cy(r,n,this._listeners),this}off(r,n){return Iy(r,n,this._listeners),Iy(r,n,this._oneTimeListeners),this}once(r,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},Cy(r,n,this._oneTimeListeners),this):new Promise(c=>{this.once(r,c)})}fire(r,n){const c=typeof r=="string"?new lc(r,n):r,h=c.type;if(this.listens(h)){c.target=this;const m=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const w of m)w.call(this,c);const g=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const w of g)Iy(h,w,this._oneTimeListeners),w.call(this,c);const x=this._eventedParent;x&&(Re(c,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(c))}else c instanceof ha&&console.error(c.error);return this}listens(r){return!!(this._listeners&&this._listeners[r]&&this._listeners[r].length>0||this._oneTimeListeners&&this._oneTimeListeners[r]&&this._oneTimeListeners[r].length>0||this._eventedParent&&this._eventedParent.listens(r))}setEventedParent(r,n){return this._eventedParent=r,this._eventedParentData=n,this}}class $s{constructor(r){typeof r=="string"?this.name=r:(this.name=r.name,this.iconsetId=r.iconsetId)}static from(r){return new $s(r)}static toString(r){return r.iconsetId?`${r.name}�${r.iconsetId}`:r.name}static parse(r){const[n,c]=r.split("�");return new $s({name:n,iconsetId:c})}static isEqual(r,n){return r.name===n.name&&r.iconsetId===n.iconsetId}toString(){return $s.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Ay,pm={},Py=function(){if(Ay)return pm;Ay=1;var a={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function r(m){return(m=Math.round(m))<0?0:m>255?255:m}function n(m){return r(m[m.length-1]==="%"?parseFloat(m)/100*255:parseInt(m))}function c(m){return(g=m[m.length-1]==="%"?parseFloat(m)/100:parseFloat(m))<0?0:g>1?1:g;var g}function h(m,g,x){return x<0?x+=1:x>1&&(x-=1),6*x<1?m+(g-m)*x*6:2*x<1?g:3*x<2?m+(g-m)*(2/3-x)*6:m}try{pm.parseCSSColor=function(m){var g,x=m.replace(/ /g,"").toLowerCase();if(x in a)return a[x].slice();if(x[0]==="#")return x.length===4?(g=parseInt(x.substr(1),16))>=0&&g<=4095?[(3840&g)>>4|(3840&g)>>8,240&g|(240&g)>>4,15&g|(15&g)<<4,1]:null:x.length===7&&(g=parseInt(x.substr(1),16))>=0&&g<=16777215?[(16711680&g)>>16,(65280&g)>>8,255&g,1]:null;var w=x.indexOf("("),E=x.indexOf(")");if(w!==-1&&E+1===x.length){var I=x.substr(0,w),A=x.substr(w+1,E-(w+1)).split(","),P=1;switch(I){case"rgba":if(A.length!==4)return null;P=c(A.pop());case"rgb":return A.length!==3?null:[n(A[0]),n(A[1]),n(A[2]),P];case"hsla":if(A.length!==4)return null;P=c(A.pop());case"hsl":if(A.length!==3)return null;var D=(parseFloat(A[0])%360+360)%360/360,O=c(A[1]),V=c(A[2]),j=V<=.5?V*(O+1):V+O-V*O,X=2*V-j;return[r(255*h(X,j,D+1/3)),r(255*h(X,j,D)),r(255*h(X,j,D-1/3)),P];default:return null}}return null}}catch{}return pm}();class Mi{constructor(r,n,c,h=1){this.r=r,this.g=n,this.b=c,this.a=h}static parse(r){if(!r)return;if(r instanceof Mi)return r;if(typeof r!="string")return;const n=Py.parseCSSColor(r);return n?new Mi(n[0]/255,n[1]/255,n[2]/255,n[3]):void 0}toString(){const[r,n,c,h]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*r)},${Math.round(255*n)},${Math.round(255*c)},${h})`}toNonPremultipliedRenderColor(r){const{r:n,g:c,b:h,a:m}=this;return new Gh(r,n,c,h,m)}toPremultipliedRenderColor(r){const{r:n,g:c,b:h,a:m}=this;return new wb(r,n*m,c*m,h*m,m)}clone(){return new Mi(this.r,this.g,this.b,this.a)}}class wf{constructor(r,n,c,h,m,g=!1){if(this.premultiplied=!1,this.premultiplied=g,r){const x=r.image.height,w=x*x;this.premultiplied?(n=m===0?0:n/m*(x-1),c=m===0?0:c/m*(x-1),h=m===0?0:h/m*(x-1)):(n*=x-1,c*=x-1,h*=x-1);const E=Math.floor(n),I=Math.floor(c),A=Math.floor(h),P=Math.ceil(n),D=Math.ceil(c),O=Math.ceil(h),V=n-E,j=c-I,X=h-A,oe=r.image.data,ne=4*(E+I*w+A*x),ae=4*(E+I*w+O*x),Ie=4*(E+D*w+A*x),be=4*(E+D*w+O*x),Te=4*(P+I*w+A*x),Le=4*(P+I*w+O*x),De=4*(P
53+D*w+A*x),lt=4*(P+D*w+O*x);if(ne<0||lt>=oe.length)throw new Error("out of range");this.r=_r(_r(_r(oe[ne],oe[ae],X),_r(oe[Ie],oe[be],X),j),_r(_r(oe[Te],oe[Le],X),_r(oe[De],oe[lt],X),j),V)/255*(this.premultiplied?m:1),this.g=_r(_r(_r(oe[ne+1],oe[ae+1],X),_r(oe[Ie+1],oe[be+1],X),j),_r(_r(oe[Te+1],oe[Le+1],X),_r(oe[De+1],oe[lt+1],X),j),V)/255*(this.premultiplied?m:1),this.b=_r(_r(_r(oe[ne+2],oe[ae+2],X),_r(oe[Ie+2],oe[be+2],X),j),_r(_r(oe[Te+2],oe[Le+2],X),_r(oe[De+2],oe[lt+2],X),j),V)/255*(this.premultiplied?m:1),this.a=m}else this.r=n,this.g=c,this.b=h,this.a=m}toArray(){const{r,g:n,b:c,a:h}=this;return[255*r,255*n,255*c,h]}toHslaArray(){let{r,g:n,b:c,a:h}=this;if(this.premultiplied){if(h===0)return[0,0,0,0];r/=h,n/=h,c/=h}const m=Math.min(Math.max(r,0),1),g=Math.min(Math.max(n,0),1),x=Math.min(Math.max(c,0),1),w=Math.min(m,g,x),E=Math.max(m,g,x),I=(w+E)/2;if(w===E)return[0,0,100*I,h];const A=E-w,P=I>.5?A/(2-E-w):A/(E+w);let D=0;return E===m?D=(g-x)/A+(g<x?6:0):E===g?D=(x-m)/A+2:E===x&&(D=(m-g)/A+4),D*=60,[Math.min(Math.max(D,0),360),Math.min(Math.max(100*P,0),100),Math.min(Math.max(100*I,0),100),h]}toArray01(){const{r,g:n,b:c,a:h}=this;return[r,n,c,h]}toArray01Scaled(r){const{r:n,g:c,b:h}=this;return[n*r,c*r,h*r]}toArray01Linear(){const{r,g:n,b:c,a:h}=this;return[Math.pow(r,2.2),Math.pow(n,2.2),Math.pow(c,2.2),h]}}class Gh extends wf{constructor(r,n,c,h,m){super(r,n,c,h,m,!1)}}class wb extends wf{constructor(r,n,c,h,m){super(r,n,c,h,m,!0)}}function _r(a,r,n){return a*(1-n)+r*n}function Tb(a,r,n){return a.map((c,h)=>_r(c,r[h],n))}Mi.black=new Mi(0,0,0,1),Mi.white=new Mi(1,1,1,1),Mi.transparent=new Mi(0,0,0,0),Mi.red=new Mi(1,0,0,1),Mi.blue=new Mi(0,0,1,1);var Tf=Object.freeze({__proto__:null,array:Tb,color:function(a,r,n){return new Mi(_r(a.r,r.r,n),_r(a.g,r.g,n),_r(a.b,r.b,n),_r(a.a,r.a,n))},number:_r});function Ou(a,...r){for(const n of r)for(const c in n)a[c]=n[c];return a}class da extends Error{constructor(r,n){super(n),this.message=n,this.key=r}}class My{constructor(r,n=[]){this.parent=r,this.bindings={};for(const[c,h]of n)this.bindings[c]=h}concat(r){return new My(this,r)}get(r){if(this.bindings[r])return this.bindings[r];if(this.parent)return this.parent.get(r);throw new Error(`${r} not found in scope.`)}has(r){return!!this.bindings[r]||!!this.parent&&this.parent.has(r)}}const $h={kind:"null"},cr={kind:"number"},Ai={kind:"string"},Pi={kind:"boolean"},Hs={kind:"color"},cc={kind:"object"},ki={kind:"value"},mm={kind:"collator"},Ef={kind:"formatted"},Sf={kind:"resolvedImage"};function Ko(a,r){return{kind:"array",itemType:a,N:r}}function eo(a){if(a.kind==="array"){const r=eo(a.itemType);return typeof a.N=="number"?`array<${r}, ${a.N}>`:a.itemType.kind==="value"?"array":`array<${r}>`}return a.kind}const _I=[$h,cr,Ai,Pi,Hs,Ef,cc,Ko(ki),Sf];function Hh(a,r){if(r.kind==="error")return null;if(a.kind==="array"){if(r.kind==="array"&&(r.N===0&&r.itemType.kind==="value"||!Hh(a.itemType,r.itemType))&&(typeof a.N!="number"||a.N===r.N))return null}else{if(a.kind===r.kind)return null;if(a.kind==="value"){for(const n of _I)if(!Hh(n,r))return null}}return`Expected ${eo(a)} but found ${eo(r)} instead.`}function Vc(a,r){return r.some(n=>n.kind===a.kind)}function Cf(a,r){return r.some(n=>n==="null"?a===null:n==="array"?Array.isArray(a):n==="object"?a&&!Array.isArray(a)&&typeof a=="object":n===typeof a)}function gm(a,r){return a.kind==="array"&&r.kind==="array"?a.N===r.N&&gm(a.itemType,r.itemType):a.kind===r.kind}class If{constructor(r,n,c){this.sensitivity=r?n?"variant":"case":n?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(r,n){return this.collator.compare(r,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class _m{constructor(r,n,c,h,m){this.text=r.normalize?r.normalize():r,this.image=n,this.scale=c,this.fontStack=h,this.textColor=m}}class ds{constructor(r){this.sections=r}static fromString(r){return new ds([new _m(r,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(r=>r.text.length!==0||!!r.image&&r.image.hasPrimary())}static factory(r){return r instanceof ds?r:ds.fromString(r)}toString(){return this.sections.length===0?"":this.sections.map(r=>r.text).join("")}serialize(){const r=["format"];for(const n of this.sections){if(n.image){const h=n.image.getPrimary().id.toString();r.push(["image",h]);continue}r.push(n.text);const c={};n.fontStack&&(c["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(c["font-scale"]=n.scale),n.textColor&&(c["text-color"]=["rgba"].concat(n.textColor.toNonPremultipliedRenderColor(null).toArray())),r.push(c)}return r}}class uc{constructor(r,n={}){if(this.id=$s.from(r),this.options=Object.assign({},n),n.transform){const{a:c,b:h,c:m,d:g,e:x,f:w}=n.transform;this.options.transform=new DOMMatrix([c,h,m,g,x,w])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:r,b:n,c,d:h,e:m,f:g}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:r,b:n,c,d:h,e:m,f:g}})}static parse(r){let n,c,h,m;
vendor: 17,035 bytes, line 53
53try{({name:n,iconsetId:c,params:h,transform:m}=JSON.parse(r)||{})}catch{return null}if(!n)return null;const{a:g,b:x,c:w,d:E,e:I,f:A}=m||{};return new uc({name:n,iconsetId:c},{params:h,transform:new DOMMatrix([g,x,w,E,I,A])})}scaleSelf(r,n){return this.options.transform.scaleSelf(r,n),this}}class Cs{constructor(r,n,c,h,m=!1){this.primaryId=$s.from(r),this.primaryOptions=n,c&&(this.secondaryId=$s.from(c)),this.secondaryOptions=h,this.available=m}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new uc(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new uc(this.secondaryId,this.secondaryOptions):null}static from(r){return typeof r=="string"?Cs.build({name:r}):r}static build(r,n,c,h){return!r||typeof r=="object"&&!("name"in r)?null:new Cs(r,c,n,h)}}function Fu(a,r,n,c){return typeof a=="number"&&a>=0&&a<=255&&typeof r=="number"&&r>=0&&r<=255&&typeof n=="number"&&n>=0&&n<=255?c===void 0||typeof c=="number"&&c>=0&&c<=1?null:`Invalid rgba value [${[a,r,n,c].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof c=="number"?[a,r,n,c]:[a,r,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Br(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof Mi||a instanceof If||a instanceof ds||a instanceof Cs)return!0;if(Array.isArray(a)){for(const r of a)if(!Br(r))return!1;return!0}if(typeof a=="object"){for(const r in a)if(!Br(a[r]))return!1;return!0}return!1}function Yt(a){if(a===null)return $h;if(typeof a=="string")return Ai;if(typeof a=="boolean")return Pi;if(typeof a=="number")return cr;if(a instanceof Mi)return Hs;if(a instanceof If)return mm;if(a instanceof ds)return Ef;if(a instanceof Cs)return Sf;if(Array.isArray(a)){const r=a.length;let n;for(const c of a){const h=Yt(c);if(n){if(n===h)continue;n=ki;break}n=h}return Ko(n||ki,r)}return cc}function Fa(a){const r=typeof a;return a===null?"":r==="string"||r==="number"||r==="boolean"?String(a):a instanceof ds||a instanceof Cs||a instanceof Mi?a.toString():JSON.stringify(a)}class Cr{constructor(r,n){this.type=r,this.value=n}static parse(r,n){if(r.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!Br(r[1]))return n.error("invalid value");const c=r[1];let h=Yt(c);const m=n.expectedType;return h.kind!=="array"||h.N!==0||!m||m.kind!=="array"||typeof m.N=="number"&&m.N!==0||(h=m),new Cr(h,c)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Mi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof ds?this.value.serialize():this.value}}class Zn{constructor(r){this.name="ExpressionEvaluationError",this.message=r}toJSON(){return this.message}}const Af={string:Ai,number:cr,boolean:Pi,object:cc};class vr{constructor(r,n){this.type=r,this.args=n}static parse(r,n){if(r.length<2)return n.error("Expected at least one argument.");let c,h=1;const m=r[0];if(m==="array"){let x,w;if(r.length>2){const E=r[1];if(typeof E!="string"||!(E in Af)||E==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);x=Af[E],h++}else x=ki;if(r.length>3){if(r[2]!==null&&(typeof r[2]!="number"||r[2]<0||r[2]!==Math.floor(r[2])))return n.error('The length argument to "array" must be a positive integer literal',2);w=r[2],h++}c=Ko(x,w)}else c=Af[m];const g=[];for(;h<r.length;h++){const x=n.parse(r[h],h,ki);if(!x)return null;g.push(x)}return new vr(c,g)}evaluate(r){for(let n=0;n<this.args.length;n++){const c=this.args[n].evaluate(r);if(!Hh(this.type,Yt(c)))return c;if(n===this.args.length-1)throw new Zn(`The expression ${JSON.stringify(this.args[n].serialize())} evaluated to ${eo(Yt(c))} but was expected to be of type ${eo(this.type)}.`)}return null}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){const r=this.type,n=[r.kind];if(r.kind==="array"){const c=r.itemType;if(c.kind==="string"||c.kind==="number"||c.kind==="boolean"){n.push(c.kind);const h=r.N;(typeof h=="number"||this.args.length>1)&&n.push(h)}}return n.concat(this.args.map(c=>c.serialize()))}}class qh{constructor(r){this.type=Ef,this.sections=r}static parse(r,n){if(r.length<2)return n.error("Expected at least one argument.");const c=r[1];if(!Array.isArray(c)&&typeof c=="object")return n.error("First argument must be an image or text section.");const h=[];let m=!1;for(let g=1;g<=r.length-1;++g){const x=r[g];if(m&&typeof x=="object"&&!Array.isArray(x)){m=!1;let w=null;if(x["font-scale"]&&(w=n.parseObjectValue(x["font-scale"],g,"font-scale",cr),!w))return null;let E=null;if(x["text-font"]&&(E=n.parseObjectValue(x["text-font"],g,"text-font",Ko(Ai)),!E))return null;let I=null;if(x["text-color"]&&(I=n.parseObjectValue(x["text-color"],g,"text-color",Hs),!I))return null;const A=h[h.length-1];A.scale=w,A.font=E,A.textColor=I}else{const w=n.parse(r[g],g,ki);if(!w)return null;const E=w.type.kind;if(E!=="string"&&E!=="value"&&E!=="null"&&E!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");m=!0,h.push({content:w,scale:null,font:null,textColor:null})}}return new qh(h)}evaluate(r){return new ds(this.sections.map(n=>{const c=n.content.evaluate(r);return gm(Yt(c),Sf)?new _m("",c,null,null,null):new _m(Fa(c),null,n.scale?n.scale.evaluate(r):null,n.font?n.font.evaluate(r).join(","):null,n.textColor?n.textColor.evaluate(r):null)}))}eachChild(r){for(const n of this.sections)r(n.content),n.scale&&r(n.scale),n.font&&r(n.font),n.textColor&&r(n.textColor)}outputDefined(){return!1}serialize(){const r=["format"];for(const n of this.sections){r.push(n.content.serialize());const c={};n.scale&&(c["font-scale"]=n.scale.serialize()),n.font&&(c["text-font"]=n.font.serialize()),n.textColor&&(c["text-color"]=n.textColor.serialize()),r.push(c)}return r}}class Zh{constructor(r,n,c,h){this._imageWarnHistory={},this.type=Sf,this.namePrimary=r,this.nameSecondary=n,c&&(this.paramsPrimary=c.params,this.iconsetIdPrimary=c.iconset?c.iconset.id:void 0),h&&(this.paramsSecondary=h.params,this.iconsetIdSecondary=h.iconset?h.iconset.id:void 0)}static parse(r,n){if(r.length<2)return n.error("Expected two or more arguments.");let c=1;const h=[];function m(){if(c<r.length){const x=n.parse(r[c],c++,Ai);return x?(h.push({image:x,options:{}}),!0):(n.error(h.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function g(){if(c<r.length){const w=r[c];if((x=w)===null||typeof x!="object"||Array.isArray(x))return!0;const E=w.params,I=w.iconset,A=n.concat(c);if(!E&&!I)return c++,!0;if(E){if(typeof E!="object"||E.constructor!==Object)return A.error('Image options "params" should be an object'),!1;const P={},D=A.concat(void 0,"params");for(const O in E){if(!O)return D.error("Image parameter name should be non-empty"),!1;const V=D.concat(void 0,O).parse(E[O],void 0,Hs,void 0,{typeAnnotation:"coerce"});if(!V)return!1;P[O]=V}h[h.length-1].options.params=P}if(I){if(typeof I!="object"||I.constructor!==Object)return A.error('Image options "iconset" should be an object'),!1;if(!I.id)return A.error('Image options "iconset" should have an "id" property'),!1;h[h.length-1].options.iconset=I}return c++,!0}var x;return!0}for(let x=0;x<2;x++)if(!m()||!g())return;return new Zh(h[0].image,h[1]?h[1].image:void 0,h[0].options,h[1]?h[1].options:void 0)}evaluateParams(r,n){const c={};if(n){for(const h in n)if(n[h])try{c[h]=n[h].evaluate(r)}catch{continue}if(Object.keys(c).length!==0)return{params:c}}}evaluate(r){const n={name:this.namePrimary.evaluate(r),iconsetId:this.iconsetIdPrimary},c=this.nameSecondary?{name:this.nameSecondary.evaluate(r),iconsetId:this.iconsetIdSecondary}:void 0,h=Cs.build(n,c,this.paramsPrimary?this.evaluateParams(r,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(r,this.paramsSecondary):void 0);if(h&&r.availableImages){const m=h.getPrimary().id;if(h.available=r.availableImages.some(g=>$s.isEqual(g,m)),h.available){const g=h.getSecondary()?h.getSecondary().id:null;g&&(h.available=r.availableImages.some(x=>$s.isEqual(x,g)))}}return h}eachChild(r){if(r(this.namePrimary),this.paramsPrimary)for(const n in this.paramsPrimary)this.paramsPrimary[n]&&r(this.paramsPrimary[n]);if(this.nameSecondary&&(r(this.nameSecondary),this.paramsSecondary))for(const n in this.paramsSecondary)this.paramsSecondary[n]&&r(this.paramsSecondary[n])}outputDefined(){return!1}serializeOptions(r,n){const c={};if(n&&(c.iconset={id:n}),r){c.params={};for(const h in r)r[h]&&(c.params[h]=r[h].serialize())}return Object.keys(c).length>0?c:void 0}serialize(){const r=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const n=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);n&&r.push(n)}if(this.nameSecondary&&(r.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const n=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);n&&r.push(n)}return r}}function Uc(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}const Eb={"to-boolean":Pi,"to-color":Hs,"to-number":cr,"to-string":Ai};class Na{constructor(r,n){this.type=r,this.args=n}static parse(r,n){if(r.length<2)return n.error("Expected at least one argument.");const c=r[0],h=[];let m=$h;if(c==="to-array"){if(!Array.isArray(r[1]))return null;const g=r[1].length;if(n.expectedType){if(n.expectedType.kind!=="array")return n.error(`Expected ${n.expectedType.kind} but found array.`);m=Ko(n.expectedType.itemType,g)}else{if(!(g>0&&Br(r[1][0])))return null;m=Ko(Yt(r[1][0]),g)}for(let x=0;x<g;x++){const w=r[1][x];let E;if(Uc(w)==="array")E=n.parse(w,void 0,m.itemType);else{const I=Uc(w);if(I!==m.itemType.kind)return n.error(`Expected ${m.itemType.kind} but found ${I}.`);E=n.registry.literal.parse(["literal",w===void 0?null:w],n)}if(!E)return null;h.push(E)}}else{if((c==="to-boolean"||c==="to-string")&&r.length!==2)return n.error("Expected one argument.");m=Eb[c];for(let g=1;g<r.length;g++){const x=n.parse(r[g],g,ki);if(!x)return null;h.push(x)}}return new Na(m,h)}evaluate(r){if(this.type.kind==="boolean")return!!this.args[0].evaluate(r);if(this.type.kind==="color"){let n,c;for(const h of this.args){if(n=h.evaluate(r),c=null,n instanceof Mi)return n;if(typeof n=="string"){const m=r.parseColor(n);if(m)return m}else if(Array.isArray(n)&&(c=n.length<3||n.length>4?`Invalid rbga value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:Fu(n[0],n[1],n[2],n[3]),!c))return new Mi(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Zn(c||`Could not parse color from value '${typeof n=="string"?n:String(JSON.stringify(n))}'`)}if(this.type.kind==="number"){let n=null;for(const c of this.args){if(n=c.evaluate(r),n===null)return 0;const h=Number(n);if(!isNaN(h))return h}throw new Zn(`Could not convert ${JSON.stringify(n)} to number.`)}return this.type.kind==="formatted"?ds.fromString(Fa(this.args[0].evaluate(r))):this.type.kind==="resolvedImage"?Cs.build(Fa(this.args[0].evaluate(r))):this.type.kind==="array"?this.args.map(n=>n.evaluate(r)):Fa(this.args[0].evaluate(r))}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){if(this.type.kind==="formatted")return new qh([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Zh(this.args[0]).serialize();const r=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(n=>{r.push(n.serialize())}),r}}const fs=["Unknown","Point","LineString","Polygon"];class Pf{constructor(r,n){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=r,this.options=n}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?fs[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(r){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const r=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:c,y:h}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(c*n-r[0])+this.featureDistanceData.bearing[1]*(h*n-r[1])}return 0}parseColor(r){let n=this._parseColorCache[r];return n||(n=this._parseColorCache[r]=Mi.parse(r)),n}getConfig(r){return this.options?this.options.get(r):null}}class Co{constructor(r,n,c,h,m){this.name=r,this.type=n,this._evaluate=c,this.args=h,this._overloadIndex=m}evaluate(r){if(!this._evaluate){const n=Co.definitions[this.name];this._evaluate=Array.isArray(n)?n[2]:n.overloads[this._overloadIndex][1]}return this._evaluate(r,this.args)}eachChild(r){this.args.forEach(r)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(r=>r.serialize()))}static parse(r,n){const c=r[0],h=Co.definitions[c];if(!h)return n.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0);const m=Array.isArray(h)?h[0]:h.type,g=Array.isArray(h)?[[h[1],h[2]]]:h.overloads,x=[];let w=null,E=-1;for(const[I,A]of g){if(Array.isArray(I)&&I.length!==r.length-1)continue;x.push(I),E++,w=new Mm(n.registry,n.path,null,n.scope,void 0,n._scope,n.options);const P=[];let D=!1;for(let O=1;O<r.length;O++){const V=r[O],j=Array.isArray(I)?I[O-1]:I.type,X=w.parse(V,1+P.length,j);if(!X){D=!0;break}P.push(X)}if(!D)if(Array.isArray(I)&&I.length!==P.length)w.error(`Expected ${I.length} arguments, but found ${P.length} instead.`);else{for(let O=0;O<P.length;O++){const V=Array.isArray(I)?I[O]:I.type,j=P[O];w.concat(O+1).checkSubtype(V,j.type)}if(w.errors.length===0)return new Co(c,m,A,P,E)}}if(x.length===1)n.errors.push(...w.errors);else{const I=(x.length?x:g.map(([P])=>P)).map(ky).join(" | "),A=[];for(let P=1;P<r.length;P++){const D=n.parse(r[P],1+A.length);if(!D)return null;A.push(eo(D.type))}n.error(`Expected arguments of type ${I}, but found (${A.join(", ")}) instead.`)}return null}static register(r,n){Co.definitions=n;for(const c in n)r[c]=Co}}function ky(a){return Array.isArray(a)?`(${a.map(eo).join(", ")})`:`(${eo(a.type)}...)`}class Rl{constructor(r,n,c){this.type=mm,this.locale=c,this.caseSensitive=r,this.diacriticSensitive=n}static parse(r,n){if(r.length!==2)return n.error("Expected one argument.");const c=r[1];if(typeof c!="object"||Array.isArray(c))return n.error("Collator options argument must be an object.");const h=c["case-sensitive"]===void 0?n.parse(!1,1,Pi):n.parseObjectValue(c["case-sensitive"],1,"case-sensitive",Pi);if(!h)return null;const m=c["diacritic-sensitive"]===void 0?n.parse(!1,1,Pi):n.parseObjectValue(c["diacritic-sensitive"],1,"diacritic-sensitive",Pi);if(!m)return null;let g=null;return c.locale&&(g=n.parseObjectValue(c.locale,1,"locale",Ai),!g)?null:new Rl(h,m,g)}evaluate(r){return new If(this.caseSensitive.evaluate(r),this.diacriticSensitive.evaluate(r),this.locale?this.locale.evaluate(r):null)}eachChild(r){r(this.caseSensitive),r(this.diacriticSensitive),this.locale&&r(this.locale)}outputDefined(){return!1}serialize(){const r={};return r["case-sensitive"]=this.caseSensitive.serialize(),r["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(r.locale=this.locale.serialize()),["collator",r]}}function Jo(a,r,n=0,c=a.length-1,h=yI){for(;c>n;){if(c-n>600){const w=c-n+1,E=r-n+1,I=Math.log(w),A=.5*Math.exp(2*I/3),P=.5*Math.sqrt(I*A*(w-A)/w)*(E-w/2<0?-1:1);Jo(a,r,Math.max(n,Math.floor(r-E*A/w+P)),Math.min(c,Math.floor(r+(w-E)*A/w+P)),h)}const m=a[r];let g=n,x=c;for(Mf(a,n,r),h(a[c],m)>0&&Mf(a,n,c);g<x;){for(Mf(a,g,x),g++,x--;h(a[g],m)<0;)g++;for(;h(a[x],m)>0;)x--}h(a[n],m)===0?Mf(a,n,x):(x++,Mf(a,x,c)),x<=r&&(n=x+1),r<=x&&(c=x-1)}}function Mf(a,r,n){const c=a[r];a[r]=a[n],a[n]=c}function yI(a,r){return a<r?-1:a>r?1:0}function vI(a){let r=0;for(let n,c,h=0,m=a.length,g=m-1;h<m;g=h++)n=a[h],c=a[g],r+=(c.x-n.x)*(n.y+c.y);return r}function jc(a,r){a[0]=Math.min(a[0],r[0]),a[1]=Math.min(a[1],r[1]),a[2]=Math.max(a[2],r[0]),a[3]=Math.max(a[3],r[1])}function Wh(a,r){return!(a[0]<=r[0]||a[2]>=r[2]||a[1]<=r[1]||a[3]>=r[3])}function Nu(a,r,n){const c=a[0]-r[0],h=a[1]-r[1],m=a[0]-n[0],g=a[1]-n[1];return c*g-m*h==0&&c*m<=0&&h*g<=0}function Xh(a,r,n=!1){let c=!1;for(let x=0,w=r.length;x<w;x++){const E=r[x];for(let I=0,A=E.length,P=A-1;I<A;P=I++){const D=E[P],O=E[I];if(Nu(a,D,O))return n;
53(m=D)[1]>(h=a)[1]!=(g=O)[1]>h[1]&&h[0]<(g[0]-m[0])*(h[1]-m[1])/(g[1]-m[1])+m[0]&&(c=!c)}}var h,m,g;return c}function Sb(a,r,n,c){const h=c[0]-n[0],m=c[1]-n[1],g=(a[0]-n[0])*m-h*(a[1]-n[1]),x=(r[0]-n[0])*m-h*(r[1]-n[1]);return g>0&&x<0||g<0&&x>0}function ym(a,r,n,c){return(h=[c[0]-n[0],c[1]-n[1]])[0]*(m=[r[0]-a[0],r[1]-a[1]])[1]-h[1]*m[0]!=0&&!(!Sb(a,r,n,c)||!Sb(n,c,a,r));var h,m}function Ry(a){const r=new Tt(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),n=new Tt(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const c of a[0])r.x>c.x&&(r.x=c.x),r.y>c.y&&(r.y=c.y),n.x<c.x&&(n.x=c.x),n.y<c.y&&(n.y=c.y);return{min:r,max:n}}const Gc=8192;function xI(a,r){const n=(180+a[0])/360,c=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,h=Math.pow(2,r.z);return[Math.round(n*h*Gc),Math.round(c*h*Gc)]}function Cb(a,r){for(let n=0;n<r.length;n++)if(Xh(a,r[n]))return!0;return!1}function bI(a,r,n){for(const c of n)for(let h=0,m=c.length,g=m-1;h<m;g=h++)if(ym(a,r,c[g],c[h]))return!0;return!1}function Ib(a,r){for(let n=0;n<a.length;++n)if(!Xh(a[n],r))return!1;for(let n=0;n<a.length-1;++n)if(bI(a[n],a[n+1],r))return!1;return!0}function Ab(a,r){for(let n=0;n<r.length;n++)if(Ib(a,r[n]))return!0;return!1}function Ly(a,r,n){const c=[];for(let h=0;h<a.length;h++){const m=[];for(let g=0;g<a[h].length;g++){const x=xI(a[h][g],n);jc(r,x),m.push(x)}c.push(m)}return c}function $c(a,r,n){const c=[];for(let h=0;h<a.length;h++){const m=Ly(a[h],r,n);c.push(m)}return c}function Pb(a,r,n,c){if(a[0]<n[0]||a[0]>n[2]){const h=.5*c;let m=a[0]-n[0]>h?-c:n[0]-a[0]>h?c:0;m===0&&(m=a[0]-n[2]>h?-c:n[2]-a[0]>h?c:0),a[0]+=m}jc(r,a)}function Mb(a,r,n,c){const h=Math.pow(2,c.z)*Gc,m=[c.x*Gc,c.y*Gc],g=[];if(!a)return g;for(const x of a)for(const w of x){const E=[w.x+m[0],w.y+m[1]];Pb(E,r,n,h),g.push(E)}return g}function vm(a,r,n,c){const h=Math.pow(2,c.z)*Gc,m=[c.x*Gc,c.y*Gc],g=[];if(!a)return g;for(const w of a){const E=[];for(const I of w){const A=[I.x+m[0],I.y+m[1]];jc(r,A),E.push(A)}g.push(E)}if(r[2]-r[0]<=h/2){(x=r)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(const w of g)for(const E of w)Pb(E,r,n,h)}var x;return g}class Hc{constructor(r,n){this.type=Pi,this.geojson=r,this.geometries=n}static parse(r,n){if(r.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(Br(r[1])){const c=r[1];if(c.type==="FeatureCollection")for(let h=0;h<c.features.length;++h){const m=c.features[h].geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new Hc(c,c.features[h].geometry)}else if(c.type==="Feature"){const h=c.geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Hc(c,c.geometry)}else if(c.type==="Polygon"||c.type==="MultiPolygon")return new Hc(c,c)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(r){if(r.geometry()!=null&&r.canonicalID()!=null){if(r.geometryType()==="Point")return function(n,c){const h=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],g=n.canonicalID();if(!g)return!1;if(c.type==="Polygon"){const x=Ly(c.coordinates,m,g),w=Mb(n.geometry(),h,m,g);if(!Wh(h,m))return!1;for(const E of w)if(!Xh(E,x))return!1}if(c.type==="MultiPolygon"){const x=$c(c.coordinates,m,g),w=Mb(n.geometry(),h,m,g);if(!Wh(h,m))return!1;for(const E of w)if(!Cb(E,x))return!1}return!0}(r,this.geometries);if(r.geometryType()==="LineString")return function(n,c){const h=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],g=n.canonicalID();if(!g)return!1;if(c.type==="Polygon"){const x=Ly(c.coordinates,m,g),w=vm(n.geometry(),h,m,g);if(!Wh(h,m))return!1;for(const E of w)if(!Ib(E,x))return!1}if(c.type==="MultiPolygon"){const x=$c(c.coordinates,m,g),w=vm(n.geometry(),h,m,g);if(!Wh(h,m))return!1;for(const E of w)if(!Ab(E,x))return!1}return!0}(r,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const kf={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Ba=1/298.257223563,zy=Ba*(2-Ba),Yh=Math.PI/180;class Kh{static fromTile(r,n,c){const h=Math.PI*(1-2*(r+.5)/Math.pow(2,n)),m=Math.atan(.5*(Math.exp(h)-Math.exp(-h)))/Yh;return new Kh(m,c)}static get units(){return kf}constructor(r,n){if(r===void 0)throw new Error("No latitude given.");if(n&&!kf[n])throw new Error(`Unknown unit ${n}. Use one of: ${Object.keys(kf).join(", ")}`);const c=6378.137*Yh*(n?kf[n]:1),h=Math.cos(r*Yh),m=1/(1-zy*(1-h*h)),g=Math.sqrt(m);this.kx=c*g*h,this.ky=c*g*m*(1-zy)}distance(r,n){const c=fa(r[0]-n[0])*this.kx,h=(r[1]-n[1])*this.ky;return Math.sqrt(c*c+h*h)}bearing(r,n){const c=fa(n[0]-r[0])*this.kx;return Math.atan2(c,(n[1]-r[1])*this.ky)/Yh}destination(r,n,c){const h=c*Yh;return this.offset(r,Math.sin(h)*n,Math.cos(h)*n)}offset(r,n,c){return[r[0]+n/this.kx,r[1]+c/this.ky]}lineDistance(r){let n=0;for(let c=0;c<r.length-1;c++)n+=this.distance(r[c],r[c+1]);return n}area(r){let n=0;for(let c=0;c<r.length;c++){const h=r[c];for(let m=0,g=h.length,x=g-1;m<g;x=m++)n+=fa(h[m][0]-h[x][0])*(h[m][1]+h[x][1])*(c?-1:1)}return Math.abs(n)/2*this.kx*this.ky}along(r,n){let c=0;if(n<=0)return r[0];for(let h=0;h<r.length-1;h++){const m=r[h],g=r[h+1],x=this.distance(m,g);if(c+=x,c>n)return xm(m,g,(n-(c-x))/x)}return r[r.length-1]}pointToSegmentDistance(r,n,c){let[h,m]=n,g=fa(c[0]-h)*this.kx,x=(c[1]-m)*this.ky;if(g!==0||x!==0){const w=(fa(r[0]-h)*this.kx*g+(r[1]-m)*this.ky*x)/(g*g+x*x);w>1?(h=c[0],m=c[1]):w>0&&(h+=g/this.kx*w,m+=x/this.ky*w)}return g=fa(r[0]-h)*this.kx,x=(r[1]-m)*this.ky,Math.sqrt(g*g+x*x)}pointOnLine(r,n){let c=1/0,h=r[0][0],m=r[0][1],g=0,x=0;for(let w=0;w<r.length-1;w++){let E=r[w][0],I=r[w][1],A=fa(r[w+1][0]-E)*this.kx,P=(r[w+1][1]-I)*this.ky,D=0;A===0&&P===0||(D=(fa(n[0]-E)*this.kx*A+(n[1]-I)*this.ky*P)/(A*A+P*P),D>1?(E=r[w+1][0],I=r[w+1][1]):D>0&&(E+=A/this.kx*D,I+=P/this.ky*D)),A=fa(n[0]-E)*this.kx,P=(n[1]-I)*this.ky;const O=A*A+P*P;O<c&&(c=O,h=E,m=I,g=w,x=D)}return{point:[h,m],index:g,t:Math.max(0,Math.min(1,x))}}lineSlice(r,n,c){let h=this.pointOnLine(c,r),m=this.pointOnLine(c,n);if(h.index>m.index||h.index===m.index&&h.t>m.t){const E=h;h=m,m=E}const g=[h.point],x=h.index+1,w=m.index;!Dy(c[x],g[0])&&x<=w&&g.push(c[x]);for(let E=x+1;E<=w;E++)g.push(c[E]);return Dy(c[w],m.point)||g.push(m.point),g}lineSliceAlong(r,n,c){let h=0;const m=[];for(let g=0;g<c.length-1;g++){const x=c[g],w=c[g+1],E=this.distance(x,w);if(h+=E,h>r&&m.length===0&&m.push(xm(x,w,(r-(h-E))/E)),h>=n)return m.push(xm(x,w,(n-(h-E))/E)),m;h>r&&m.push(w)}return m}bufferPoint(r,n){const c=n/this.ky,h=n/this.kx;return[r[0]-h,r[1]-c,r[0]+h,r[1]+c]}bufferBBox(r,n){const c=n/this.ky,h=n/this.kx;return[r[0]-h,r[1]-c,r[2]+h,r[3]+c]}insideBBox(r,n){return fa(r[0]-n[0])>=0&&fa(r[0]-n[2])<=0&&r[1]>=n[1]&&r[1]<=n[3]}}function Dy(a,r){return a[0]===r[0]&&a[1]===r[1]}function xm(a,r,n){const c=fa(r[0]-a[0]);return[a[0]+c*n,a[1]+(r[1]-a[1])*n]}function fa(a){for(;a<-180;)a+=360;for(;a>180;)a-=360;return a}class bm{constructor(r=[],n=(c,h)=>c<h?-1:c>h?1:0){if(this.data=r,this.length=this.data.length,this.compare=n,this.length>0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:n,compare:c}=this,h=n[r];for(;r>0;){const m=r-1>>1,g=n[m];if(c(h,g)>=0)break;n[r]=g,r=m}n[r]=h}_down(r){const{data:n,compare:c}=this,h=this.length>>1,m=n[r];for(;r<h;){let g=1+(r<<1);const x=g+1;if(x<this.length&&c(n[x],n[g])<0&&(g=x),c(n[g],m)>=0)break;n[r]=n[g],r=g}n[r]=m}}var Vt=8192;function Oy(a,r){return r.dist-a.dist}const wm=100,Tm=50;function Rf(a){const r=[1/0,1/0,-1/0,-1/0];if(r.length!==a.length)return!1;for(let n=0;n<r.length;n++)if(r[n]!==a[n])return!1;return!0}function Bu(a){return a[1]-a[0]+1}function Va(a,r){const n=a[1]>=a[0]&&a[1]<r;return n||console.warn("Distance Expression: Index is out of range"),n}function Em(a,r){if(a[0]>
53a[1])return[null,null];const n=Bu(a);if(r){if(n===2)return[a,null];const c=Math.floor(n/2);return[[a[0],a[0]+c],[a[0]+c,a[1]]]}{if(n===1)return[a,null];const c=Math.floor(n/2)-1;return[[a[0],a[0]+c],[a[0]+c+1,a[1]]]}}function qc(a,r){const n=[1/0,1/0,-1/0,-1/0];if(!Va(r,a.length))return n;for(let c=r[0];c<=r[1];++c)jc(n,a[c]);return n}function Lf(a){const r=[1/0,1/0,-1/0,-1/0];for(let n=0;n<a.length;++n)for(let c=0;c<a[n].length;++c)jc(r,a[n][c]);return r}function nl(a,r,n){if(Rf(a)||Rf(r))return NaN;let c=0,h=0;return a[2]<r[0]&&(c=r[0]-a[2]),a[0]>r[2]&&(c=a[0]-r[2]),a[1]>r[3]&&(h=a[1]-r[3]),a[3]<r[1]&&(h=r[1]-a[3]),n.distance([0,0],[c,h])}function oi(a){return 360*a-180}function wI(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function Fy(a,r){const n=Math.pow(2,r.z),c=(a.y/Vt+r.y)/n;return[oi((a.x/Vt+r.x)/n),wI(c)]}function TI(a,r){const n=[];for(let c=0;c<a.length;++c)n.push(Fy(a[c],r));return n}function Ny(a,r,n){const c=n.pointOnLine(r,a).point;return n.distance(a,c)}function kb(a,r,n,c,h){const m=n.slice(c[0],c[1]+1);let g=1/0;for(let x=r[0];x<=r[1];++x)if((g=Math.min(g,Ny(a[x],m,h)))===0)return 0;return g}function vn(a,r,n,c,h){const m=Math.min(h.pointToSegmentDistance(a,n,c),h.pointToSegmentDistance(r,n,c)),g=Math.min(h.pointToSegmentDistance(n,a,r),h.pointToSegmentDistance(c,a,r));return Math.min(m,g)}function EI(a,r,n,c,h){if(!Va(r,a.length)||!Va(c,n.length))return NaN;let m=1/0;for(let g=r[0];g<r[1];++g)for(let x=c[0];x<c[1];++x){if(ym(a[g],a[g+1],n[x],n[x+1]))return 0;m=Math.min(m,vn(a[g],a[g+1],n[x],n[x+1],h))}return m}function SI(a,r,n,c,h){if(!Va(r,a.length)||!Va(c,n.length))return NaN;let m=1/0;for(let g=r[0];g<=r[1];++g)for(let x=c[0];x<=c[1];++x)if((m=Math.min(m,h.distance(a[g],n[x])))===0)return m;return m}function CI(a,r,n){if(Xh(a,r,!0))return 0;let c=1/0;for(const h of r){const m=h.length;if(m<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(h[0]!==h[m-1]&&(c=Math.min(c,n.pointToSegmentDistance(a,h[m-1],h[0])))===0||(c=Math.min(c,Ny(a,h,n)))===0)return c}return c}function II(a,r,n,c){if(!Va(r,a.length))return NaN;for(let m=r[0];m<=r[1];++m)if(Xh(a[m],n,!0))return 0;let h=1/0;for(let m=r[0];m<r[1];++m)for(const g of n)for(let x=0,w=g.length,E=w-1;x<w;E=x++){if(ym(a[m],a[m+1],g[E],g[x]))return 0;h=Math.min(h,vn(a[m],a[m+1],g[E],g[x],c))}return h}function Rb(a,r){for(const n of a)for(let c=0;c<=n.length-1;++c)if(Xh(n[c],r,!0))return!0;return!1}function AI(a,r,n,c=1/0){const h=Lf(a),m=Lf(r);if(c!==1/0&&nl(h,m,n)>=c)return c;if(Wh(h,m)){if(Rb(a,r))return 0}else if(Rb(r,a))return 0;let g=c;for(const x of a)for(let w=0,E=x.length,I=E-1;w<E;I=w++)for(const A of r)for(let P=0,D=A.length,O=D-1;P<D;O=P++){if(ym(x[I],x[w],A[O],A[P]))return 0;g=Math.min(g,vn(x[I],x[w],A[O],A[P],n))}return g}function Sm(a,r,n,c,h,m,g){if(m===null||g===null)return;const x=nl(qc(c,m),qc(h,g),n);x<r&&a.push({dist:x,range1:m,range2:g})}function PI(a,r,n,c,h=1/0){let m=Math.min(c.distance(a[0],n[0][0]),h);if(m===0)return m;const g=new bm([{dist:0,range1:[0,a.length-1],range2:[0,0]}],Oy),x=r?Tm:wm,w=Lf(n);for(;g.length;){const E=g.pop();if(E.dist>=m)continue;const I=E.range1;if(Bu(I)<=x){if(!Va(I,a.length))return NaN;if(r){const A=II(a,I,n,c);if((m=Math.min(m,A))===0)return m}else for(let A=I[0];A<=I[1];++A){const P=CI(a[A],n,c);if((m=Math.min(m,P))===0)return m}}else{const A=Em(I,r);if(A[0]!==null){const P=nl(qc(a,A[0]),w,c);P<m&&g.push({dist:P,range1:A[0],range2:[0,0]})}if(A[1]!==null){const P=nl(qc(a,A[1]),w,c);P<m&&g.push({dist:P,range1:A[1],range2:[0,0]})}}}return m}function Lb(a,r,n,c,h,m=1/0){let g=Math.min(m,h.distance(a[0],n[0]));if(g===0)return g;const x=new bm([{dist:0,range1:[0,a.length-1],range2:[0,n.length-1]}],Oy),w=r?Tm:wm,E=c?Tm:wm;for(;x.length;){const I=x.pop();if(I.dist>=g)continue;const A=I.range1,P=I.range2;if(Bu(A)<=w&&Bu(P)<=E){if(!Va(A,a.length)||!Va(P,n.length))return NaN;if(r&&c?g=Math.min(g,EI(a,A,n,P,h)):r||c?r&&!c?g=Math.min(g,kb(n,P,a,A,h)):!r&&c&&(g=Math.min(g,kb(a,A,n,P,h))):g=Math.min(g,SI(a,A,n,P,h)),g===0)return g}else{const D=Em(A,r),O=Em(P,c);Sm(x,g,h,a,n,D[0],O[0]),Sm(x,g,h,a,n,D[0],O[1]),Sm(x,g,h,a,n,D[1],O[0]),Sm(x,g,h,a,n,D[1],O[1])}}return g}function By(a,r,n,c,h=1/0){let m=h;const g=qc(a,[0,a.length-1]);for(const x of n)if(!(m!==1/0&&nl(g,qc(x,[0,x.length-1]),c)>
53=m)&&(m=Math.min(m,Lb(a,r,x,!0,c,m)),m===0))return m;return m}function Cm(a,r,n,c,h=1/0){let m=h;const g=qc(a,[0,a.length-1]);for(const x of n){if(m!==1/0&&nl(g,Lf(x),c)>=m)continue;const w=PI(a,r,x,c,m);if(isNaN(w))return w;if((m=Math.min(m,w))===0)return m}return m}function Vy(a){return a==="Point"||a==="MultiPoint"||a==="LineString"||a==="MultiLineString"||a==="Polygon"||a==="MultiPolygon"}class Vu{constructor(r,n){this.type=cr,this.geojson=r,this.geometries=n}static parse(r,n){if(r.length!==2)return n.error(`'distance' expression requires either one argument, but found ' ${r.length-1} instead.`);if(Br(r[1])){const c=r[1];if(c.type==="FeatureCollection"){for(let h=0;h<c.features.length;++h)if(Vy(c.features[h].geometry.type))return new Vu(c,c.features[h].geometry)}else if(c.type==="Feature"){if(Vy(c.geometry.type))return new Vu(c,c.geometry)}else if(Vy(c.type))return new Vu(c,c)}return n.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(r){const n=r.geometry(),c=r.canonicalID();if(n!=null&&c!=null){if(r.geometryType()==="Point")return function(h,m,g){const x=[];for(const E of h)for(const I of E)x.push(Fy(I,m));const w=new Kh(x[0][1],"meters");return g.type==="Point"||g.type==="MultiPoint"||g.type==="LineString"?Lb(x,!1,g.type==="Point"?[g.coordinates]:g.coordinates,g.type==="LineString",w):g.type==="MultiLineString"?By(x,!1,g.coordinates,w):g.type==="Polygon"||g.type==="MultiPolygon"?Cm(x,!1,g.type==="Polygon"?[g.coordinates]:g.coordinates,w):null}(n,c,this.geometries);if(r.geometryType()==="LineString")return function(h,m,g){const x=[];for(const E of h){const I=[];for(const A of E)I.push(Fy(A,m));x.push(I)}const w=new Kh(x[0][0][1],"meters");if(g.type==="Point"||g.type==="MultiPoint"||g.type==="LineString")return By(g.type==="Point"?[g.coordinates]:g.coordinates,g.type==="LineString",x,w);if(g.type==="MultiLineString"){let E=1/0;for(let I=0;I<g.coordinates.length;I++){const A=By(g.coordinates[I],!0,x,w,E);if(isNaN(A))return A;if((E=Math.min(E,A))===0)return E}return E}if(g.type==="Polygon"||g.type==="MultiPolygon"){let E=1/0;for(let I=0;I<x.length;I++){const A=Cm(x[I],!0,g.type==="Polygon"?[g.coordinates]:g.coordinates,w,E);if(isNaN(A))return A;if((E=Math.min(E,A))===0)return E}return E}return null}(n,c,this.geometries);if(r.geometryType()==="Polygon")return function(h,m,g){const x=[];for(const E of function(I,A){const P=I.length;if(P<=1)return[I];const D=[];let O,V;for(let j=0;j<P;j++){const X=vI(I[j]);X!==0&&(I[j].area=Math.abs(X),V===void 0&&(V=X<0),V===X<0?(O&&D.push(O),O=[I[j]]):O.push(I[j]))}return O&&D.push(O),D}(h)){const I=[];for(let A=0;A<E.length;++A)I.push(TI(E[A],m));x.push(I)}const w=new Kh(x[0][0][0][1],"meters");if(g.type==="Point"||g.type==="MultiPoint"||g.type==="LineString")return Cm(g.type==="Point"?[g.coordinates]:g.coordinates,g.type==="LineString",x,w);if(g.type==="MultiLineString"){let E=1/0;for(let I=0;I<g.coordinates.length;I++){const A=Cm(g.coordinates[I],!0,x,w,E);if(isNaN(A))return A;if((E=Math.min(E,A))===0)return E}return E}return g.type==="Polygon"||g.type==="MultiPolygon"?function(E,I,A){let P=1/0;for(const D of E)for(const O of I){const V=AI(D,O,A,P);if(isNaN(V))return V;if((P=Math.min(P,V))===0)return P}return P}(g.type==="Polygon"?[g.coordinates]:g.coordinates,x,w):null}(n,c,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Jh(a){if(a instanceof Co&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof Hc||a instanceof Vu)return!1;if(a instanceof ed)return a.featureConstant;let r=!0;return a.eachChild(n=>{r&&!Jh(n)&&(r=!1)}),r}function Im(a){if(a instanceof Co&&a.name==="feature-state")return!1;let r=!0;return a.eachChild(n=>{r&&!Im(n)&&(r=!1)}),r}function Am(a){if(a instanceof ed)return new Set([a.key]);let r=new Set;return a.eachChild(n=>{r=new Set([...r,...Am(n)])}),r}function Qh(a,r){if(a instanceof Co&&r.indexOf(a.name)>=0)return!1;let n=!0;return a.eachChild(c=>{n&&!Qh(c,r)&&(n=!1)}),n}
53function zb(a,r,n){return[a,r,n].filter(Boolean).join("�")}function Uy(a,r){switch(a){case"string":return Fa(r);case"number":return+r;case"boolean":return!!r;case"color":return Mi.parse(r);case"formatted":return ds.fromString(Fa(r));case"resolvedImage":return Cs.build(Fa(r))}return r}function Db(a,r,n,c){return c!==void 0&&(a=c*Math.round(a/c)),r!==void 0&&a<r&&(a=r),n!==void 0&&a>n&&(a=n),a}class ed{constructor(r,n,c,h=!1){this.type=r,this.key=n,this.scope=c,this.featureConstant=h}static parse(r,n){let c=n.expectedType;if(c==null&&(c=ki),r.length<2||r.length>3)return n.error("Invalid number of arguments for 'config' expression.");const h=n.parse(r[1],1);if(!(h instanceof Cr))return n.error("Key name of 'config' expression must be a string literal.");let m,g=!0;const x=Fa(h.value);if(r.length>=3){const w=n.parse(r[2],2);if(!(w instanceof Cr))return n.error("Scope of 'config' expression must be a string literal.");m=Fa(w.value)}if(n.options){const w=zb(x,m,n._scope),E=n.options.get(w);E&&(g=Jh(E.value||E.default))}return new ed(c,x,m,g)}evaluate(r){const n=zb(this.key,this.scope,r.scope),c=r.getConfig(n);if(!c)return null;const{type:h,value:m,values:g,minValue:x,maxValue:w,stepValue:E}=c,I=c.default.evaluate(r);let A=I;if(m){const P=r.scope;r.scope=(P||"").split("�").slice(1).join("�"),A=m.evaluate(r),r.scope=P}return h&&(A=Uy(h,A)),A===void 0||x===void 0&&w===void 0&&E===void 0||(typeof A=="number"?A=Db(A,x,w,E):Array.isArray(A)&&(A=A.map(P=>typeof P=="number"?Db(P,x,w,E):P))),m!==void 0&&A!==void 0&&g&&!g.includes(A)&&(A=I,h&&(A=Uy(h,A))),(h&&h!==this.type||A!==void 0&&!gm(Yt(A),this.type))&&(A=Uy(this.type.kind,A)),A}eachChild(){}outputDefined(){return!1}serialize(){const r=["config",this.key];return this.scope&&r.concat(this.scope),r}}class Pm{constructor(r,n){this.type=n.type,this.name=r,this.boundExpression=n}static parse(r,n){if(r.length!==2||typeof r[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");const c=r[1];return n.scope.has(c)?new Pm(c,n.scope.get(c)):n.error(`Unknown variable "${c}". Make sure "${c}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(r){return this.boundExpression.evaluate(r)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Mm{constructor(r,n=[],c,h=new My,m=[],g,x){this.registry=r,this.path=n,this.key=n.map(w=>typeof w=="string"?`['${w}']`:`[${w}]`).join(""),this.scope=h,this.errors=m,this.expectedType=c,this._scope=g,this.options=x}parse(r,n,c,h,m={}){return n||c?this.concat(n,null,c,h)._parse(r,m):this._parse(r,m)}parseObjectValue(r,n,c,h,m,g={}){return this.concat(n,c,h,m)._parse(r,g)}_parse(r,n){function c(h,m,g){return g==="assert"?new vr(m,[h]):g==="coerce"?new Na(m,[h]):h}if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"||(r=["literal",r]),Array.isArray(r)){if(r.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const h=typeof r[0]=="string"?this.registry[r[0]]:void 0;if(h){let m=h.parse(r,this);if(!m)return null;if(this.expectedType){const g=this.expectedType,x=m.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||x.kind!=="value")if(g.kind!=="color"&&g.kind!=="formatted"&&g.kind!=="resolvedImage"||x.kind!=="value"&&x.kind!=="string"){if(this.checkSubtype(g,x))return null}else m=c(m,g,n.typeAnnotation||"coerce");else m=c(m,g,n.typeAnnotation||"assert")}if(!(m instanceof Cr)&&m.type.kind!=="resolvedImage"&&jy(m)){const g=new Pf(this._scope,this.options);try{m=new Cr(m.type,m.evaluate(g))}catch(x){return this.error(x.message),null}}return m}return Na.parse(["to-array",r],this)}return this.error(r===void 0?"'undefined' value invalid. Use null instead.":typeof r=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof r} instead.`)}concat(r,n,c,h){let m=typeof r=="number"?this.path.concat(r):this.path;m=typeof n=="string"?m.concat(n):m;const g=h?this.scope.concat(h):this.scope;return new Mm(this.registry,m,c||null,g,this.errors,this._scope,this.options)}error(r,...n){const c=`${this.key}${n.map(h=>`[${h}]`).join("")}`;this.errors.push(new da(c,r))}checkSubtype(r,n){const c=Hh(r,n);return c&&this.error(c),c}}
vendor: 5,299 bytes, line 53
53function jy(a){if(a instanceof Pm)return jy(a.boundExpression);if(a instanceof Co&&a.name==="error"||a instanceof Rl||a instanceof Hc||a instanceof Vu||a instanceof ed)return!1;const r=a instanceof Na||a instanceof vr;let n=!0;return a.eachChild(c=>{n=r?n&&jy(c):n&&c instanceof Cr}),!!n&&Jh(a)&&Qh(a,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function km(a,r){const n=a.length-1;let c,h,m=0,g=n,x=0;for(;m<=g;)if(x=Math.floor((m+g)/2),c=a[x],h=a[x+1],c<=r){if(x===n||r<h)return x;m=x+1}else{if(!(c>r))throw new Zn("Input is not a number.");g=x-1}return 0}class zf{constructor(r,n,c){this.type=r,this.input=n,this.labels=[],this.outputs=[];for(const[h,m]of c)this.labels.push(h),this.outputs.push(m)}static parse(r,n){if(r.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return n.error("Expected an even number of arguments.");const c=n.parse(r[1],1,cr);if(!c)return null;const h=[];let m=null;n.expectedType&&n.expectedType.kind!=="value"&&(m=n.expectedType);for(let g=1;g<r.length;g+=2){const x=g===1?-1/0:r[g],w=r[g+1],E=g,I=g+1;if(typeof x!="number")return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(h.length&&h[h.length-1][0]>=x)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',E);const A=n.parse(w,I,m);if(!A)return null;m=m||A.type,h.push([x,A])}return new zf(m,c,h)}evaluate(r){const n=this.labels,c=this.outputs;if(n.length===1)return c[0].evaluate(r);const h=this.input.evaluate(r);if(h<=n[0])return c[0].evaluate(r);const m=n.length;return h>=n[m-1]?c[m-1].evaluate(r):c[km(n,h)].evaluate(r)}eachChild(r){r(this.input);for(const n of this.outputs)r(n)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){const r=["step",this.input.serialize()];for(let n=0;n<this.labels.length;n++)n>0&&r.push(this.labels[n]),r.push(this.outputs[n].serialize());return r}}const Ob=.95047,Fb=1.08883,Nb=4/29,td=6/29,Bb=3*td*td,Gy=td*td*td,MI=Math.PI/180,Vb=180/Math.PI;function $y(a){return a>Gy?Math.pow(a,1/3):a/Bb+Nb}function Hy(a){return a>td?a*a*a:Bb*(a-Nb)}function qy(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function Rm(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Zy(a){const r=Rm(a.r),n=Rm(a.g),c=Rm(a.b),h=$y((.4124564*r+.3575761*n+.1804375*c)/Ob),m=$y((.2126729*r+.7151522*n+.072175*c)/1);return{l:116*m-16,a:500*(h-m),b:200*(m-$y((.0193339*r+.119192*n+.9503041*c)/Fb)),alpha:a.a}}function Uu(a){let r=(a.l+16)/116,n=isNaN(a.a)?r:r+a.a/500,c=isNaN(a.b)?r:r-a.b/200;return r=1*Hy(r),n=Ob*Hy(n),c=Fb*Hy(c),new Mi(qy(3.2404542*n-1.5371385*r-.4985314*c),qy(-.969266*n+1.8760108*r+.041556*c),qy(.0556434*n-.2040259*r+1.0572252*c),a.alpha)}function Ub(a,r,n){const c=r-a;return a+n*(c>180||c<-180?c-360*Math.round(c/360):c)}const rd={forward:Zy,reverse:Uu,interpolate:function(a,r,n){return{l:_r(a.l,r.l,n),a:_r(a.a,r.a,n),b:_r(a.b,r.b,n),alpha:_r(a.alpha,r.alpha,n)}}},Df={forward:function(a){const{l:r,a:n,b:c}=Zy(a),h=Math.atan2(c,n)*Vb;return{h:h<0?h+360:h,c:Math.sqrt(n*n+c*c),l:r,alpha:a.a}},reverse:function(a){const r=a.h*MI,n=a.c;return Uu({l:a.l,a:Math.cos(r)*n,b:Math.sin(r)*n,alpha:a.alpha})},interpolate:function(a,r,n){return{h:Ub(a.h,r.h,n),c:_r(a.c,r.c,n),l:_r(a.l,r.l,n),alpha:_r(a.alpha,r.alpha,n)}}};var Lm=Object.freeze({__proto__:null,hcl:Df,lab:rd});class Is{constructor(r,n,c,h,m){this.type=r,this.operator=n,this.interpolation=c,this.input=h,this.labels=[],this.outputs=[];for(const[g,x]of m)this.labels.push(g),this.outputs.push(x)}static interpolationFactor(r,n,c,h){let m=0;if(r.name==="exponential")m=Wy(n,r.base,c,h);else if(r.name==="linear")m=Wy(n,1,c,h);else if(r.name==="cubic-bezier"){const g=r.controlPoints;m=new Fc(g[0],g[1],g[2],g[3]).solve(Wy(n,1,c,h))}return m}static parse(r,n){let[c,h,m,...g]=r;if(!Array.isArray(h)||h.length===0)return n.error("Expected an interpolation type expression.",1);if(h[0]==="linear")h={name:"linear"};else if(h[0]==="exponential"){const E=h[1];if(typeof E!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);h={name:"exponential",base:E}}else{if(h[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(h[0])}`,1,0);{const E=h.slice(1);if(E.length!==4||E.some(I=>typeof I!="number"||I<0||I>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);h={name:"cubic-bezier",controlPoints:E}}}if(r.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length-1>3&&(r.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(m=n.parse(m,2,cr),!m)return null;const x=[];let w=null;c==="interpolate-hcl"||c==="interpolate-lab"?w=Hs:n.expectedType&&n.expectedType.kind!=="value"&&(w=n.expectedType);for(let E=0;E<g.length;E+=2){const I=g[E],A=g[E+1],P=E+3,D=E+4;if(typeof I!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
53omputed expressions) for the input values.',P);if(x.length&&x[x.length-1][0]>=I)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const O=n.parse(A,D,w);if(!O)return null;w=w||O.type,x.push([I,O])}return w.kind==="number"||w.kind==="color"||w.kind==="array"&&w.itemType.kind==="number"&&typeof w.N=="number"?new Is(w,c,h,m,x):n.error(`Type ${eo(w)} is not interpolatable.`)}evaluate(r){const n=this.labels,c=this.outputs;if(n.length===1)return c[0].evaluate(r);const h=this.input.evaluate(r);if(h<=n[0])return c[0].evaluate(r);const m=n.length;if(h>=n[m-1])return c[m-1].evaluate(r);const g=km(n,h),x=Is.interpolationFactor(this.interpolation,h,n[g],n[g+1]),w=c[g].evaluate(r),E=c[g+1].evaluate(r);return this.operator==="interpolate"?Tf[this.type.kind.toLowerCase()](w,E,x):this.operator==="interpolate-hcl"?Df.reverse(Df.interpolate(Df.forward(w),Df.forward(E),x)):rd.reverse(rd.interpolate(rd.forward(w),rd.forward(E),x))}eachChild(r){r(this.input);for(const n of this.outputs)r(n)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){let r;r=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const n=[this.operator,r,this.input.serialize()];for(let c=0;c<this.labels.length;c++)n.push(this.labels[c],this.outputs[c].serialize());return n}}function Wy(a,r,n,c){const h=c-n,m=a-n;return h===0?0:r===1?m/h:(Math.pow(r,m)-1)/(Math.pow(r,h)-1)}class zm{constructor(r,n){this.type=r,this.args=n}static parse(r,n){if(r.length<2)return n.error("Expectected at least one argument.");let c=null;const h=n.expectedType;h&&h.kind!=="value"&&(c=h);const m=[];for(const x of r.slice(1)){const w=n.parse(x,1+m.length,c,void 0,{typeAnnotation:"omit"});if(!w)return null;c=c||w.type,m.push(w)}const g=h&&m.some(x=>Hh(h,x.type));return new zm(g?ki:c,m)}evaluate(r){let n,c=null,h=0;for(const m of this.args){if(h++,c=m.evaluate(r),c&&c instanceof Cs&&!c.available&&(n||(n=c),c=null,h===this.args.length))return n;if(c!==null)break}return c}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){const r=["coalesce"];return this.eachChild(n=>{r.push(n.serialize())}),r}}class Of{constructor(r,n){this.type=n.type,this.bindings=[].concat(r),this.result=n}evaluate(r){return this.result.evaluate(r)}eachChild(r){for(const n of this.bindings)r(n[1]);r(this.result)}static parse(r,n){if(r.length<4)return n.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);const c=[];for(let m=1;m<r.length-1;m+=2){const g=r[m];if(typeof g!="string")return n.error(`Expected string, but found ${typeof g} instead.`,m);if(/[^a-zA-Z0-9_]/.test(g))return n.error("Variable names must contain only alphanumeric characters or '_'.",m);const x=n.parse(r[m+1],m+1);if(!x)return null;c.push([g,x])}const h=n.parse(r[r.length-1],r.length-1,n.expectedType,c);return h?new Of(c,h):null}outputDefined(){return this.result.outputDefined()}serialize(){const r=["let"];for(const[n,c]of this.bindings)r.push(n,c.serialize());return r.push(this.result.serialize()),r}}class Dm{constructor(r,n,c){this.type=r,this.index=n,this.input=c}static parse(r,n){if(r.length!==3)return n.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=n.parse(r[1],1,cr),h=n.parse(r[2],2,Ko(n.expectedType||ki));return c&&h?new Dm(h.type.itemType,c,h):null}evaluate(r){const n=this.index.evaluate(r),c=this.input.evaluate(r);if(n<0)throw new Zn(`Array index out of bounds: ${n} < 0.`);if(n>=c.length)throw new Zn(`Array index out of bounds: ${n} > ${c.length-1}.`);if(n!==Math.floor(n))throw new Zn(`Array index must be an integer, but found ${n} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return c[n]}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Xy{constructor(r,n,c){this.type=r,this.index=n,this.input=c}static parse(r,n){if(r.length!==3)return n.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=n.parse(r[1],1,cr),h=n.parse(r[2],2,Ko(n.expectedType||ki));return c&&h?new Xy(h.type.itemType,c,h):null}evaluate(r){const n=this.index.evaluate(r),c=this.input.evaluate(r);if(n<0)throw new Zn(`Array index out of bounds: ${n} < 0.`);if(n>c.length-1)throw new Zn(`Array index out of bounds: ${n} > ${c.length-1}.`);if(n===Math.floor(n))return c[n];const h=Math.floor(n),m=Math.ceil(n),g=c[h],x=c[m];if(typeof g!="number"||typeof x!="number")throw new Zn(`Cannot interpolate between non-number values at index ${n}.`);const w=n-h;return g*(1-w)+x*w}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Yy{constructor(r,n){this.type=Pi,this.needle=r,this.haystack=n}static parse(r,n){if(r.length!==3)return n.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=n.parse(r[1],1,ki),h=n.parse(r[2],2,ki);
53return c&&h?Vc(c.type,[Pi,Ai,cr,$h,ki])?new Yy(c,h):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${eo(c.type)} instead`):null}evaluate(r){const n=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(c==null)return!1;if(!Cf(n,["boolean","string","number","null"]))throw new Zn(`Expected first argument to be of type boolean, string, number or null, but found ${eo(Yt(n))} instead.`);if(!Cf(c,["string","array"]))throw new Zn(`Expected second argument to be of type array or string, but found ${eo(Yt(c))} instead.`);return c.indexOf(n)>=0}eachChild(r){r(this.needle),r(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Om{constructor(r,n,c){this.type=cr,this.needle=r,this.haystack=n,this.fromIndex=c}static parse(r,n){if(r.length<=2||r.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=n.parse(r[1],1,ki),h=n.parse(r[2],2,ki);if(!c||!h)return null;if(!Vc(c.type,[Pi,Ai,cr,$h,ki]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${eo(c.type)} instead`);if(r.length===4){const m=n.parse(r[3],3,cr);return m?new Om(c,h,m):null}return new Om(c,h)}evaluate(r){const n=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(!Cf(n,["boolean","string","number","null"]))throw new Zn(`Expected first argument to be of type boolean, string, number or null, but found ${eo(Yt(n))} instead.`);if(!Cf(c,["string","array"]))throw new Zn(`Expected second argument to be of type array or string, but found ${eo(Yt(c))} instead.`);if(this.fromIndex){const h=this.fromIndex.evaluate(r);return c.indexOf(n,h)}return c.indexOf(n)}eachChild(r){r(this.needle),r(this.haystack),this.fromIndex&&r(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const r=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),r]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Fm{constructor(r,n,c,h,m,g){this.inputType=r,this.type=n,this.input=c,this.cases=h,this.outputs=m,this.otherwise=g}static parse(r,n){if(r.length<5)return n.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return n.error("Expected an even number of arguments.");let c,h;n.expectedType&&n.expectedType.kind!=="value"&&(h=n.expectedType);const m={},g=[];for(let E=2;E<r.length-1;E+=2){let I=r[E];const A=r[E+1];Array.isArray(I)||(I=[I]);const P=n.concat(E);if(I.length===0)return P.error("Expected at least one branch label.");for(const O of I){if(typeof O!="number"&&typeof O!="string")return P.error("Branch labels must be numbers or strings.");if(typeof O=="number"&&Math.abs(O)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof O=="number"&&Math.floor(O)!==O)return P.error("Numeric branch labels must be integer values.");if(c){if(P.checkSubtype(c,Yt(O)))return null}else c=Yt(O);if(m[String(O)]!==void 0)return P.error("Branch labels must be unique.");m[String(O)]=g.length}const D=n.parse(A,E,h);if(!D)return null;h=h||D.type,g.push(D)}const x=n.parse(r[1],1,ki);if(!x)return null;const w=n.parse(r[r.length-1],r.length-1,h);return w?x.type.kind!=="value"&&n.concat(1).checkSubtype(c,x.type)?null:new Fm(c,h,x,m,g,w):null}evaluate(r){const n=this.input.evaluate(r);return(gm(Yt(n),this.inputType)&&this.outputs[this.cases[n]]||this.otherwise).evaluate(r)}eachChild(r){r(this.input),this.outputs.forEach(r),r(this.otherwise)}outputDefined(){return this.outputs.every(r=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["match",this.input.serialize()],n=Object.keys(this.cases).sort(),c=[],h={};for(const g of n){const x=h[this.cases[g]];x===void 0?(h[this.cases[g]]=c.length,c.push([this.cases[g],[g]])):c[x][1].push(g)}const m=g=>this.inputType.kind==="number"?Number(g):g;for(const[g,x]of c)r.push(x.length===1?m(x[0]):x.map(m)),r.push(this.outputs[g].serialize());return r.push(this.otherwise.serialize()),r}}class Nm{constructor(r,n,c){this.type=r,this.branches=n,this.otherwise=c}static parse(r,n){if(r.length<4)return n.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return n.error("Expected an odd number of arguments.");let c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);const h=[];for(let g=1;g<r.length-1;g+=2){const x=n.parse(r[g],g,Pi);if(!x)return null;const w=n.parse(r[g+1],g+1,c);if(!w)return null;h.push([x,w]),c=c||w.type}const m=n.parse(r[r.length-1],r.length-1,c);return m?new Nm(c,h,m):null}evaluate(r){for(const[n,c]of this.branches)if(n.evaluate(r))return c.evaluate(r);return this.otherwise.evaluate(r)}eachChild(r){for(const[n,c]of this.branches)r(n),r(c);r(this.otherwise)}outputDefined(){return this.branches.every(([r,n])=>n.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["case"];return this.eachChild(n=>{r.push(n.serialize())}),r}}class ju{constructor(r,n,c,h){this.type=r,this.input=n,this.beginIndex=c,this.endIndex=h}static parse(r,n){if(r.length<=2||r.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=n.parse(r[1],1,ki),h=n.parse(r[2],2,cr);if(!c||!h)return null;if(!Vc(c.type,[Ko(ki),Ai,ki]))return n.error(`Expected first argument to be of type array or string, but found ${eo(c.type)} instead`);if(r.length===4){const m=n.parse(r[3],3,cr);return m?new ju(c.type,c,h,m):null}return new ju(c.type,c,h)}evaluate(r){const n=this.input.evaluate(r),c=this.beginIndex.evaluate(r);if(!Cf(n,["string","array"]))throw new Zn(`Expected first argument to be of type array or string, but found ${eo(Yt(n))} instead.`);if(this.endIndex){const h=this.endIndex.evaluate(r);return n.slice(c,h)}return n.slice(c)}eachChild(r){r(this.input),r(this.beginIndex),this.endIndex&&r(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const r=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),r]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class Ky{constructor(r,n){this.type=Ko(Ai),this.str=r,this.delimiter=n}static parse(r,n){if(r.length!==3)return n.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=n.parse(r[1],1,Ai),h=n.parse(r[2],2,Ai);return c&&h?new Ky(c,h):void 0}evaluate(r){const n=this.str.evaluate(r),c=this.delimiter.evaluate(r);return n.split(c)}eachChild(r){r(this.str),r(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Jy(a,r){return a==="=="||a==="!="?r.kind==="boolean"||r.kind==="str
53ing"||r.kind==="number"||r.kind==="null"||r.kind==="value":r.kind==="string"||r.kind==="number"||r.kind==="value"}function jb(a,r,n,c){return c.compare(r,n)===0}function id(a,r,n){const c=a!=="=="&&a!=="!=";return class gG{constructor(m,g,x){this.type=Pi,this.lhs=m,this.rhs=g,this.collator=x,this.hasUntypedArgument=m.type.kind==="value"||g.type.kind==="value"}static parse(m,g){if(m.length!==3&&m.length!==4)return g.error("Expected two or three arguments.");const x=m[0];let w=g.parse(m[1],1,ki);if(!w)return null;if(!Jy(x,w.type))return g.concat(1).error(`"${x}" comparisons are not supported for type '${eo(w.type)}'.`);let E=g.parse(m[2],2,ki);if(!E)return null;if(!Jy(x,E.type))return g.concat(2).error(`"${x}" comparisons are not supported for type '${eo(E.type)}'.`);if(w.type.kind!==E.type.kind&&w.type.kind!=="value"&&E.type.kind!=="value")return g.error(`Cannot compare types '${eo(w.type)}' and '${eo(E.type)}'.`);c&&(w.type.kind==="value"&&E.type.kind!=="value"?w=new vr(E.type,[w]):w.type.kind!=="value"&&E.type.kind==="value"&&(E=new vr(w.type,[E])));let I=null;if(m.length===4){if(w.type.kind!=="string"&&E.type.kind!=="string"&&w.type.kind!=="value"&&E.type.kind!=="value")return g.error("Cannot use collator to compare non-string types.");if(I=g.parse(m[3],3,mm),!I)return null}return new gG(w,E,I)}evaluate(m){const g=this.lhs.evaluate(m),x=this.rhs.evaluate(m);if(c&&this.hasUntypedArgument){const w=Yt(g),E=Yt(x);if(w.kind!==E.kind||w.kind!=="string"&&w.kind!=="number")throw new Zn(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${w.kind}, ${E.kind}) instead.`)}if(this.collator&&!c&&this.hasUntypedArgument){const w=Yt(g),E=Yt(x);if(w.kind!=="string"||E.kind!=="string")return r(m,g,x)}return this.collator?n(m,g,x,this.collator.evaluate(m)):r(m,g,x)}eachChild(m){m(this.lhs),m(this.rhs),this.collator&&m(this.collator)}outputDefined(){return!0}serialize(){const m=[a];return this.eachChild(g=>{m.push(g.serialize())}),m}}}const Gb=id("==",function(a,r,n){return r===n},jb),$b=id("!=",function(a,r,n){return r!==n},function(a,r,n,c){return!jb(0,r,n,c)}),kI=id("<",function(a,r,n){return r<n},function(a,r,n,c){return c.compare(r,n)<0}),RI=id(">",function(a,r,n){return r>n},function(a,r,n,c){return c.compare(r,n)>0}),LI=id("<=",function(a,r,n){return r<=n},function(a,r,n,c){return c.compare(r,n)<=0}),Bm=id(">=",function(a,r,n){return r>=n},function(a,r,n,c){return c.compare(r,n)>=0});class Qy{constructor(r,n,c,h,m,g){this.type=Ai,this.number=r,this.locale=n,this.currency=c,this.unit=h,this.minFractionDigits=m,this.maxFractionDigits=g}static parse(r,n){if(r.length!==3)return n.error("Expected two arguments.");const c=n.parse(r[1],1,cr);if(!c)return null;const h=r[2];if(typeof h!="object"||Array.isArray(h))return n.error("NumberFormat options argument must be an object.");let m=null;if(h.locale&&(m=n.parseObjectValue(h.locale,2,"locale",Ai),!m))return null;let g=null;if(h.currency&&(g=n.parseObjectValue(h.currency,2,"currency",Ai),!g))return null;let x=null;if(h.unit&&(x=n.parseObjectValue(h.unit,2,"unit",Ai),!x))return null;let w=null;if(h["min-fraction-digits"]&&(w=n.parseObjectValue(h["min-fraction-digits"],2,"min-fraction-digits",cr),!w))return null;let E=null;return h["max-fraction-digits"]&&(E=n.parseObjectValue(h["max-fraction-digits"],2,"max-fraction-digits",cr),!E)?null:new Qy(c,m,g,x,w,E)}evaluate(r){return new Intl.NumberFormat(this.locale?this.locale.evaluate(r):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(r):void 0,unit:this.unit?this.unit.evaluate(r):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(r):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(r):void 0}).format(this.number.evaluate(r))}eachChild(r){r(this.number),this.locale&&r(this.locale),this.currency&&r(this.currency),this.unit&&r(this.unit),this.minFractionDigits&&r(this.minFractionDigits),this.maxFractionDigits&&r(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const r={};return this.locale&&(r.locale=this.locale.serialize()),this.currency&&(r.currency=this.currency.serialize()),this.unit&&(r.unit=this.unit.serialize()),this.minFractionDigits&&(r["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(r["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),r]}}class e0{constructor(r){this.type=cr,this.input=r}static parse(r,n){if(r.length!==2)return n.error(`Expected 1 argument, but found ${r.length-1} instead.`);const c=n.parse(r[1],1);return c?c.type.kind!=="array"&&c.type.kind!=="string"&&c.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${eo(c.type)} instead.`):new e0(c):null}evaluate(r){const n=this.input.evaluate(r);if(typeof n=="string"||Array.isArray(n))return n.length;throw new Zn(`Expected value to be of type string or array, but found ${eo(Yt(n))} instead.`)}eachChild(r){r(this.input)}outputDefined(){return!1}serialize(){const r=["length"];return this.eachChild(n=>{r.push(n.serialize())}),r}}function Hb(a){return function(){a=1831565813+(a|=0)|0;let r=Math.imul(a^a>>>15,1|a);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}const nd={"==":Gb,"!=":$b,">":RI,"<":kI,">=":Bm,"<=":LI,array:vr,at:Dm,"at-interpolated":Xy,boolean:vr,case:Nm,coalesce:zm,collator:Rl,format:qh,image:Zh,in:Yy,"index-of":Om,interpolate:Is,"interpolate-hcl":Is,"interpolate-lab":Is,length:e0,let:Of,literal:Cr,match:Fm,number:vr,"number-format":Qy,object:vr,slice
vendor: 15,356 bytes, line 53
53:ju,step:zf,string:vr,"to-boolean":Na,"to-color":Na,"to-number":Na,"to-string":Na,var:Pm,within:Hc,distance:Vu,config:ed,split:Ky};function t0(a,[r,n,c,h]){r=r.evaluate(a),n=n.evaluate(a),c=c.evaluate(a);const m=h?h.evaluate(a):1,g=Fu(r,n,c,m);if(g)throw new Zn(g);return new Mi(r/255,n/255,c/255,m)}function qb(a,[r,n,c,h]){r=r.evaluate(a),n=n.evaluate(a),c=c.evaluate(a);const m=h?h.evaluate(a):1,g=function(E,I,A,P){return typeof E=="number"&&E>=0&&E<=360?typeof I=="number"&&I>=0&&I<=100&&typeof A=="number"&&A>=0&&A<=100?P===void 0||typeof P=="number"&&P>=0&&P<=1?null:`Invalid hsla value [${[E,I,A,P].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof P=="number"?[E,I,A,P]:[E,I,A]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof P=="number"?[E,I,A,P]:[E,I,A]).join(", ")}]: 'h' must be between 0 and 360.`}(r,n,c,m);if(g)throw new Zn(g);const x=`hsla(${r}, ${n}%, ${c}%, ${m})`,w=Mi.parse(x);if(!w)throw new Zn(`Failed to parse HSLA color: ${x}`);return w}function Zb(a,r){return a in r}function Vm(a,r){const n=r[a];return n===void 0?null:n}function Zc(a){return{type:a}}function r0(a){return{result:"success",value:a}}function Wc(a){return{result:"error",value:a}}function Xc(a,r){return!!a&&!!a.parameters&&a.parameters.indexOf(r)>-1}function Um(a){return a["property-type"]==="data-driven"}function Wb(a){return Xc(a.expression,"measure-light")}function Xb(a){return Xc(a.expression,"zoom")}function jm(a){return!!a.expression&&a.expression.interpolated}function Gm(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Yb(a){return a}function i0(a,r){const n=r.type==="color",c=a.stops&&typeof a.stops[0][0]=="object",h=c||!(c||a.property!==void 0),m=a.type||(jm(r)?"exponential":"interval");if(n&&((a=Ou({},a)).stops&&(a.stops=a.stops.map(E=>[E[0],Mi.parse(E[1])])),a.default=Mi.parse(a.default?a.default:r.default)),a.colorSpace&&a.colorSpace!=="rgb"&&!Lm[a.colorSpace])throw new Error(`Unknown color space: ${a.colorSpace}`);let g,x,w;if(m==="exponential")g=Jb;else if(m==="interval")g=Kb;else if(m==="categorical"){g=n0,x=Object.create(null);for(const E of a.stops)x[E[0]]=E[1];w=typeof a.stops[0][0]}else{if(m!=="identity")throw new Error(`Unknown function type "${m}"`);g=Yc}if(c){const E={},I=[];for(let D=0;D<a.stops.length;D++){const O=a.stops[D],V=O[0].zoom;E[V]===void 0&&(E[V]={zoom:V,type:a.type,property:a.property,default:a.default,stops:[]},I.push(V)),E[V].stops.push([O[0].value,O[1]])}const A=[];for(const D of I)A.push([E[D].zoom,i0(E[D],r)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:Is.interpolationFactor.bind(void 0,P),zoomStops:A.map(D=>D[0]),evaluate:({zoom:D},O)=>Jb({stops:A,base:a.base},r,D).evaluate(D,O)}}if(h){const E=m==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:Is.interpolationFactor.bind(void 0,E),zoomStops:a.stops.map(I=>I[0]),evaluate:({zoom:I})=>g(a,r,I,x,w)}}return{kind:"source",evaluate(E,I){const A=I&&I.properties?I.properties[a.property]:void 0;return A===void 0?Gu(a.default,r.default):g(a,r,A,x,w)}}}function Gu(a,r,n){return a!==void 0?a:r!==void 0?r:n!==void 0?n:void 0}function n0(a,r,n,c,h){return Gu(typeof n===h?c[n]:void 0,a.default,r.default)}function Kb(a,r,n){if(Uc(n)!=="number")return Gu(a.default,r.default);const c=a.stops.length;if(c===1||n<=a.stops[0][0])return a.stops[0][1];if(n>=a.stops[c-1][0])return a.stops[c-1][1];const h=km(a.stops.map(m=>m[0]),n);return a.stops[h][1]}function Jb(a,r,n){const c=a.base!==void 0?a.base:1;if(Uc(n)!=="number")return Gu(a.default,r.default);const h=a.stops.length;if(h===1||n<=a.stops[0][0])return a.stops[0][1];if(n>=a.stops[h-1][0])return a.stops[h-1][1];const m=km(a.stops.map(I=>I[0]),n),g=function(I,A,P,D){const O=D-P,V=I-P;return O===0?0:A===1?V/O:(Math.pow(A,V)-1)/(Math.pow(A,O)-1)}(n,c,a.stops[m][0],a.stops[m+1][0]),x=a.stops[m][1],w=a.stops[m+1][1];let E=Tf[r.type]||Yb;if(a.colorSpace&&a.colorSpace!=="rgb"){const I=Lm[a.colorSpace];E=(A,P)=>I.reverse(I.interpolate(I.forward(A),I.forward(P),g))}return typeof x.evaluate=="function"?{evaluate(...I){const A=x.evaluate.apply(void 0,I),P=w.evaluate.apply(void 0,I);if(A!==void 0&&P!==void 0)return E(A,P,g)}}:E(x,w,g)}function Yc(a,r,n){return r.type==="color"?n=Mi.parse(n):r.type==="formatted"?n=ds.fromString(n.toString()):r.type==="resolvedImage"?n=Cs.build(n.toString()):Uc(n)===r.type||r.type==="enum"&&r.values[n]||(n=void 0),Gu(n,a.default,r.default)}Co.register(nd,{error:[{kind:"error"},[Ai],(a,[r])=>{throw new Zn(r.evaluate(a))}],typeof:[Ai,[ki],(a,[r])=>eo(Yt(r.evaluate(a)))],"to-rgba":[Ko(cr,4),[Hs],(a,[r])=>r.evaluate(a).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Ko(cr,4),[Hs],(a,[r])=>r.evaluate(a).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Hs,[cr,cr,cr],t0],rgba:[Hs,[cr,cr,cr,cr],t0],hsl:[Hs,[cr,cr,cr],qb],hsla:[Hs,[cr,cr,cr,cr],qb],has:{type:Pi,overloads:[[[Ai],(a,[r])=>Zb(r.evaluate(a),a.properties())],[[Ai,cc],(a,[r,n])=>Zb(r.evaluate(a),n.evaluate(a))]]},get:{type:ki,overloads:[[[Ai],(a,[r])=>Vm(r.evaluate(a),a.properties())],[[Ai,cc],(a,[r,n])=>Vm(r.evaluate(a),n.evaluate(a))]]},"feature-state":[ki,[Ai],(a,[r])=>Vm(r.evaluate(a),a.featureState||{})],properties:[cc,[],a=>a.properties()],"geometry-type":[Ai,[],a=>a.geometryType()],worldview:[Ai,[],a=>a.globals.worldview||""],id:[ki,[],a=>a.id()],zoom:[cr,[],a=>a.globals.zoom],pitch:[cr,[],a=>a.globals.pitch||0],"distance-from-center":[cr,[],a=>a.distanceFromCenter()],"measure-light":[cr,[Ai],(a,[r])=>a.measureLight(r.evaluate(a))],"heatmap-density":[cr,[],a=>a.globals.heatmapDensity||0],"line-progress":[cr,[],a=>a.globals.lineProgress||0],"raster-value":[cr,[],a=>a.globals.rasterValue||0],"raster-particle-speed":[cr,[],a=>a.globals.rasterParticleSpeed||0],"sky-radial-progress":[cr,[],a=>a.globals.skyRadialProgress||0],accumulated:[ki,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[cr,Zc(cr),(a,r)=>{let n=0;for(const c of r)n+=c.evaluate(a);return n}],"*":[cr,Zc(cr),(a,r)=>{let n=1;for(const c of r)n*=c.evaluate(a);return n}],"-":{type:cr,overloads:[[[cr,cr],(a,[r,n])=>r.evaluate(a)-n.evaluate(a)],[[cr],(a,[r])=>-r.evaluate(a)]]},"/":[cr,[cr,cr],(a,[r,n])=>r.evaluate(a)/n.evaluate(a)],"%":[cr,[cr,cr],(a,[r,n])=>r.evaluate(a)%n.evaluate(a)],ln2:[cr,[],()=>Math.LN2],pi:[cr,[],()=>Math.PI],e:[cr,[],()=>Math.E],"^":[cr,[cr,cr],(a,[r,n])=>Math.pow(r.evaluate(a),n.evaluate(a))],sqrt:[cr,[cr],(a,[r])=>Math.sqrt(r.evaluate(a))],log10:[cr,[cr],(a,[r])=>Math.log(r.evaluate(a))/Math.LN10],ln:[cr,[cr],(a,[r])=>Math.log(r.evaluate(a))],log2:[cr,[cr],(a,[r])=>Math.log(r.evaluate(a))/Math.LN2],sin:[cr,[cr],(a,[r])=>Math.sin(r.evaluate(a))],cos:[cr,[cr],(a,[r])=>Math.cos(r.evaluate(a))],tan:[cr,[cr],(a,[r])=>Math.tan(r.evaluate(a))],asin:[cr,[cr],(a,[r])=>Math.asin(r.evaluate(a))],acos:[cr,[cr],(a,[r])=>Math.acos(r.evaluate(a))],atan:[cr,[cr],(a,[r])=>Math.atan(r.evaluate(a))],min:[cr,Zc(cr),(a,r)=>Math.min(...r.map(n=>n.evaluate(a)))],max:[cr,Zc(cr),(a,r)=>Math.max(...r.map(n=>n.evaluate(a)))],abs:[cr,[cr],(a,[r])=>Math.abs(r.evaluate(a))],round:[cr,[cr],(a,[r])=>{const n=r.evaluate(a);return n<0?-Math.round(-n):Math.round(n)}],floor:[cr,[cr],(a,[r])=>Math.floor(r.evaluate(a))],ceil:[cr,[cr],(a,[r])=>Math.ceil(r.evaluate(a))],"filter-==":[Pi,[Ai,ki],(a,[r,n])=>a.properties()[r.value]===n.value],"filter-id-==":[Pi,[ki],(a,[r])=>a.id()===r.value],"filter-type-==":[Pi,[Ai],(a,[r])=>a.geometryType()===r.value],"filter-<":[Pi,[Ai,ki],(a,[r,n])=>{const c=a.properties()[r.value],h=n.value;return typeof c==typeof h&&c<h}],"filter-id-<":[Pi,[ki],(a,[r])=>{const n=a.id(),c=r.value;return typeof n==typeof c&&n<c}],"filter->":[Pi,[Ai,ki],(a,[r,n])=>{const c=a.properties()[r.value],h=n.value;return typeof c==typeof h&&c>h}],"filter-id->":[Pi,[ki],(a,[r])=>{const n=a.id(),c=r.value;return typeof n==typeof c&&n>c}],"filter-<=":[Pi,[Ai,ki],(a,[r,n])=>{const c=a.properties()[r.value],h=n.value;return typeof c==typeof h&&c<=h}],"filter-id-<=":[Pi,[ki],(a,[r])=>{const n=a.id(),c=r.value;return typeof n==typeof c&&n<=c}],"filter->=":[Pi,[Ai,ki],(a,[r,n])=>{const c=a.properties()[r.value],h=n.value;return typeof c==typeof h&&c>=h}],"filter-id->=":[Pi,[ki],(a,[r])=>{const n=a.id(),c=r.value;return typeof n==typeof c&&n>=c}],"filter-has":[Pi,[ki],(a,[r])=>r.value in a.properties()],"filter-has-id":[Pi,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[Pi,[Ko(Ai)],(a,[r])=>r.value.indexOf(a.geometryType())>=0],"filter-id-in":[Pi,[Ko(ki)],(a,[r])=>r.value.indexOf(a.id())>=0],"filter-in-small":[Pi,[Ai,Ko(ki)],(a,[r,n])=>n.value.indexOf(a.properties()[r.value])>=0],"filter-in-large":[Pi,[Ai,Ko(ki)],(a,[r,n])=>function(c,h,m,g){for(;m<=g;){const x=m+g>>1;if(h[x]===c)return!0;h[x]>c?g=x-1:m=x+1}return!1}(a.properties()[r.value],n.value,0,n.value.length-1)],all:{type:Pi,overloads:[[[Pi,Pi],(a,[r,n])=>r.evaluate(a)&&n.evaluate(a)],[Zc(Pi),(a,r)=>{for(const n of r)if(!n.evaluate(a))return!1;return!0}]]},any:{type:Pi,overloads:[[[Pi,Pi],(a,[r,n])=>r.evaluate(a)||n.evaluate(a)],[Zc(Pi),(a,r)=>{for(const n of r)if(n.evaluate(a))return!0;return!1}]]},"!":[Pi,[Pi],(a,[r])=>!r.evaluate(a)],"is-supported-script":[Pi,[Ai],(a,[r])=>{const n=a.globals&&a.globals.isSupportedScript;return!n||n(r.evaluate(a))}],upcase:[Ai,[Ai],(a,[r])=>r.evaluate(a).toUpperCase()],downcase:[Ai,[Ai],(a,[r])=>r.evaluate(a).toLowerCase()],concat:[Ai,Zc(ki),(a,r)=>r.map(n=>Fa(n.evaluate(a))).join("")],"resolved-locale":[Ai,[mm],(a,[r])=>r.evaluate(a).resolvedLocale()],random:[cr,[cr,cr,ki],(a,r)=>{const[n,c,h]=r.map(g=>g.evaluate(a));if(n>c||n===c)return n;let m;if(typeof h=="string")m=function(g){let x=0;if(g.length===0)return x;for(let w=0;w<g.length;w++)x=(x<<5)-x+g.charCodeAt(w),x|=0;return x}(h);else{if(typeof h!="number")throw new Zn(`Invalid seed input: ${h}`);m=h}return n+Hb(m)()*(c-n)}]});class o0{constructor(r,n,c,h){this.expression=r,this._warningHistory={},this._evaluator=new Pf(c,h),this._defaultValue=n?function(m){return m.type==="color"&&(Gm(m.default)||Array.isArray(m.default))?new Mi(0,0,0,0):m.type==="color"?Mi.parse(m.default)||null:m.default===void 0?null:m.default}(n):null,this._enumValues=n&&n.type==="enum"?n.values:null,this.configDependencies=Am(r)}evaluateWithoutErrorHandling(r,n,c,h,m,g,x,w){return this._evaluator.globals=r,this._evaluator.feature=n,this._evaluator.featureState=c,this._evaluator.canonical=h||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=g,this._evaluator.featureTileCoord=x||null,this._evaluator.featureDistanceData=w||null,this.expression.evaluate(this._evaluator)}evaluate(r,n,c,h,m,g,x,w){this._evaluator.globals=r,this._evaluator.feature=n||null,this._evaluator.featureState=c||null,this._evaluator.canonical=h||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=g||null,this._evaluator.featureTileCoord=x||null,this._evaluator.featureDistanceData=w||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new Zn(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${E.message}`)),this._defaultValue}}}function s0(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in nd}function $u(a,r,n,c){const h=new Mm(nd,[],r?function(g){const x={color:Hs,string:Ai,number:cr,enum:Ai,boolean:Pi,formatted:Ef,resolvedImage:Sf};return g.type==="array"?Ko(x[g.value]||ki,g.length):x[g.type]}(r):void 0,void 0,void 0,n,c),m=h.parse(a,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return m?r0(new o0(m,r,n,c)):Wc(h.errors)}class $m{constructor(r,n,c,h){this.kind=r,this._styleExpression=n,this.isLightConstant=c,this.isLineProgressConstant=h,this.isStateDependent=r!=="constant"&&!Im(n.expression),this.configDependencies=Am(n.expression)}evaluateWithoutErrorHandling(r,n,c,h,m,g){return this._styleExpression.evaluateWithoutErrorHandling(r,n,c,h,m,g)}evaluate(r,n,c,h,m,g){return this._styleExpression.evaluate(r,n,c,h,m,g)}}class Kc{constructor(r,n,c,h,m,g){this.kind=r,this.zoomStops=c,this._styleExpression=n,this.isStateDependent=r!=="camera"&&!Im(n.expression),this.isLightConstant=m,this.isLineProgressConstant=g,this.configDependencies=Am(n.expression),this.interpolationType=h}evaluateWithoutErrorHandling(r,n,c,h,m,g){return this._styleExpression.evaluateWithoutErrorHandling(r,n,c,h,m,g)}evaluate(r,n,c,h,m,g){return this._styleExpression.evaluate(r,n,c,h,m,g)}interpolationFactor(r,n,c){return this.interpolationType?Is.interpolationFactor(this.interpolationType,r,n,c):0}}function a0(a,r,n,c){if((a=$u(a,r,n,c)).result==="error")return a;const h=a.value.expression,m=Jh(h);if(!m&&!Um(r))return Wc([new da("","data expressions not supported")]);const g=Qh(h,["zoom","pitch","distance-from-center"]);if(!g&&!Xb(r))return Wc([new da("","zoom expressions not supported")]);const x=Qh(h,["measure-light"]);if(!x&&!Wb(r))return Wc([new da("","measure-light expression not supported")]);const w=Qh(h,["line-progress"]);if(!w&&!function(A){return Xc(A.expression,"line-progress")}(r))return Wc([new da("","line-progress expression not supported")]);const E=r.expression&&r.expression.relaxZoomRestriction,I=Ff(h);return I||g||E?I instanceof da?Wc([I]):I instanceof Is&&!jm(r)?Wc([new da("",'"interpolate" expressions cannot be used with this property')]):r0(I?new Kc(m&&w?"camera":"composite",a.value,I.labels,I instanceof Is?I.interpolation:void 0,x,w):new $m(m&&w?"constant":"source",a.value,x,w)):Wc([new da("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Hu{constructor(r,n){this._parameters=r,this._specification=n,Ou(this,i0(this._parameters,this._specification))}static deserialize(r){return new Hu(r._parameters,r._specification)}static serialize(r){return{_parameters:r._parameters,_specification:r._specification}}}function Ff(a){let r=null;if(a instanceof Of)r=Ff(a.result);else if(a instanceof zm){for(const n of a.args)if(r=Ff(n),r)break}else(a instanceof zf||a instanceof Is)&&a.input instanceof Co&&a.input.name==="zoom"&&(r=a);return r instanceof da||a.eachChild(n=>{const c=Ff(n);c instanceof da?r=c:r&&c&&r!==c&&(r=new da("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}var l0,Qb,c0=function(){if(Qb)return l0;Qb=1,l0=r;var a=3;function r(n,c,h){var m=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;var g=new Int32Array(this.arrayBuffer);n=g[0],this.d=(c=g[1])+2*(h=g[2]);for(var x=0;x<this.d*this.d;x++){var w=g[a+x],E=g[a+x+1];m.push(w===E?null:g.subarray(w,E))}var I=g[a+m.length+1];this.keys=g.subarray(g[a+m.length],I),this.bboxes=g.subarray(I),this.insert=this._insertReadonly}else{this.d=c+2*h;for(var A=0;A<this.d*this.d;A++)m.push([]);this.keys=[],this.bboxes=[]}this.n=c,this.extent=n,this.padding=h,this.scale=c/n,this.uid=0;var P=h/c*n;this.min=-P,this.max=n+P}
53return r.prototype.insert=function(n,c,h,m,g){this._forEachCell(c,h,m,g,this._insertCell,this.uid++),this.keys.push(n),this.bboxes.push(c),this.bboxes.push(h),this.bboxes.push(m),this.bboxes.push(g)},r.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},r.prototype._insertCell=function(n,c,h,m,g,x){this.cells[g].push(x)},r.prototype.query=function(n,c,h,m,g){var x=this.min,w=this.max;if(n<=x&&c<=x&&w<=h&&w<=m&&!g)return Array.prototype.slice.call(this.keys);var E=[];return this._forEachCell(n,c,h,m,this._queryCell,E,{},g),E},r.prototype._queryCell=function(n,c,h,m,g,x,w,E){var I=this.cells[g];if(I!==null)for(var A=this.keys,P=this.bboxes,D=0;D<I.length;D++){var O=I[D];if(w[O]===void 0){var V=4*O;(E?E(P[V+0],P[V+1],P[V+2],P[V+3]):n<=P[V+2]&&c<=P[V+3]&&h>=P[V+0]&&m>=P[V+1])?(w[O]=!0,x.push(A[O])):w[O]=!1}}},r.prototype._forEachCell=function(n,c,h,m,g,x,w,E){for(var I=this._convertToCellCoord(n),A=this._convertToCellCoord(c),P=this._convertToCellCoord(h),D=this._convertToCellCoord(m),O=I;O<=P;O++)for(var V=A;V<=D;V++){var j=this.d*V+O;if((!E||E(this._convertFromCellCoord(O),this._convertFromCellCoord(V),this._convertFromCellCoord(O+1),this._convertFromCellCoord(V+1)))&&g.call(this,n,c,h,m,j,x,w,E))return}},r.prototype._convertFromCellCoord=function(n){return(n-this.padding)/this.scale},r.prototype._convertToCellCoord=function(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))},r.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var n=this.cells,c=a+this.cells.length+1+1,h=0,m=0;m<this.cells.length;m++)h+=this.cells[m].length;var g=new Int32Array(c+h+this.keys.length+this.bboxes.length);g[0]=this.extent,g[1]=this.n,g[2]=this.padding;for(var x=c,w=0;w<n.length;w++){var E=n[w];g[a+w]=x,g.set(E,x),x+=E.length}return g[a+n.length]=x,g.set(this.keys,x),g[a+n.length+1]=x+=this.keys.length,g.set(this.bboxes,x),x+=this.bboxes.length,g.buffer},l0}(),Jc=Il(c0);const Nf={};function Jt(a,r,n={}){Object.defineProperty(a,"_classRegistryKey",{value:r,writable:!1}),Nf[r]={klass:a,omit:n.omit||[]}}Jt(Object,"Object"),Jc.serialize=function(a,r){const n=a.toArrayBuffer();return r&&r.add(n),{buffer:n}},Jc.deserialize=function(a){return new Jc(a.buffer)},Object.defineProperty(Jc,"name",{value:"Grid"}),Jt(Jc,"Grid"),delete Tt.prototype.constructor,typeof DOMMatrix<"u"&&Jt(DOMMatrix,"DOMMatrix"),Jt(Mi,"Color"),Jt(Error,"Error"),Jt(ds,"Formatted"),Jt(_m,"FormattedSection"),Jt(fi,"AJAXError"),Jt(Cs,"ResolvedImage"),Jt(Hu,"StylePropertyFunction"),Jt(o0,"StyleExpression",{omit:["_evaluator"]}),Jt($s,"ImageId"),Jt(uc,"ImageVariant"),Jt(Kc,"ZoomDependentExpression"),Jt($m,"ZoomConstantExpression"),Jt(Co,"CompoundExpression",{omit:["_evaluate"]});for(const a in nd)Nf[nd[a]._classRegistryKey]||Jt(nd[a],`Expression${a}`);function Hm(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}function Bf(a){return self.ImageBitmap&&a instanceof ImageBitmap}function hc(a,r){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp)return a;if(Hm(a)||Bf(a))return r&&r.add(a),a;if(ArrayBuffer.isView(a))return r&&r.add(a.buffer),a;if(a instanceof ImageData)return r&&r.add(a.data.buffer),a;if(Array.isArray(a)){const n=[];for(const c of a)n.push(hc(c,r));return n}if(a instanceof Map){const n={$name:"Map",entries:[]};for(const[c,h]of a.entries())n.entries.push(hc(c),hc(h,r));return n}if(a instanceof Set){const n={$name:"Set"};let c=0;for(const h of a.values())n[++c]=hc(h);return n}if(a instanceof DOMMatrix){const n={$name:"DOMMatrix"},c=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const h of c)n[h]=a[h];return n}if(typeof a=="bigint")return{$name:"BigInt",value:a.toString()};if(typeof a=="object"){const n=a.constructor,c=n._classRegistryKey;if(!c)throw new Error(`Can't serialize object of unregistered class "${n.name}".`);const h=n.serialize?n.serialize(a,r):{};if(!n.serialize){for(const m in a)a.hasOwnProperty(m)&&(Nf[c].omit.indexOf(m)>=0||(h[m]=hc(a[m],r)));a instanceof Error&&(h.message=a.message)}if(h.$name)throw new Error("$name property is reserved for worker serialization logic.");return c!=="Object"&&(h.$name=c),h}throw new Error("can't serialize object of type "+typeof a)}function As(a){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="str
53ing"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||Hm(a)||Bf(a)||ArrayBuffer.isView(a)||a instanceof ImageData)return a;if(Array.isArray(a))return a.map(As);if(typeof a=="object"){const r=a.$name||"Object";if(r==="Map"){const h=a.entries||[],m=new Map;for(let g=0;g<h.length;g+=2)m.set(As(h[g]),As(h[g+1]));return m}if(r==="Set"){const h=new Set;for(const m of Object.keys(a))m!=="$name"&&h.add(As(a[m]));return h}if(r==="DOMMatrix"){let h;return h=a.is2D?[a.a,a.b,a.c,a.d,a.e,a.f]:[a.m11,a.m12,a.m13,a.m14,a.m21,a.m22,a.m23,a.m24,a.m31,a.m32,a.m33,a.m34,a.m41,a.m42,a.m43,a.m44],new DOMMatrix(h)}if(r==="BigInt")return BigInt(a.value);const{klass:n}=Nf[r];if(!n)throw new Error(`Can't deserialize unregistered class "${r}".`);if(n.deserialize)return n.deserialize(a);const c=Object.create(n.prototype);for(const h of Object.keys(a))h!=="$name"&&(c[h]=As(a[h]));return c}throw new Error("can't deserialize object of type "+typeof a)}const Tr={"Latin-1 Supplement":a=>a>=128&&a<=255,Arabic:a=>a>=1536&&a<=1791,"Arabic Supplement":a=>a>=1872&&a<=1919,"Arabic Extended-A":a=>a>=2208&&a<=2303,"Hangul Jamo":a=>a>=4352&&a<=4607,"Unified Canadian Aboriginal Syllabics":a=>a>=5120&&a<=5759,Khmer:a=>a>=6016&&a<=6143,"Unified Canadian Aboriginal Syllabics Extended":a=>a>=6320&&a<=6399,"General Punctuation":a=>a>=8192&&a<=8303,"Letterlike Symbols":a=>a>=8448&&a<=8527,"Number Forms":a=>a>=8528&&a<=8591,"Miscellaneous Technical":a=>a>=8960&&a<=9215,"Control Pictures":a=>a>=9216&&a<=9279,"Optical Character Recognition":a=>a>=9280&&a<=9311,"Enclosed Alphanumerics":a=>a>=9312&&a<=9471,"Geometric Shapes":a=>a>=9632&&a<=9727,"Miscellaneous Symbols":a=>a>=9728&&a<=9983,"Miscellaneous Symbols and Arrows":a=>a>=11008&&a<=11263,"CJK Radicals Supplement":a=>a>=11904&&a<=12031,"Kangxi Radicals":a=>a>=12032&&a<=12255,"Ideographic Description Characters":a=>a>=12272&&a<=12287,"CJK Symbols and Punctuation":a=>a>=12288&&a<=12351,Hiragana:a=>a>=12352&&a<=12447,Katakana:a=>a>=12448&&a<=12543,Bopomofo:a=>a>=12544&&a<=12591,"Hangul Compatibility Jamo":a=>a>=12592&&a<=12687,Kanbun:a=>a>=12688&&a<=12703,"Bopomofo Extended":a=>a>=12704&&a<=12735,"CJK Strokes":a=>a>=12736&&a<=12783,"Katakana Phonetic Extensions":a=>a>=12784&&a<=12799,"Enclosed CJK Letters and Months":a=>a>=12800&&a<=13055,"CJK Compatibility":a=>a>=13056&&a<=13311,"CJK Unified Ideographs Extension A":a=>a>=13312&&a<=19903,"Yijing Hexagram Symbols":a=>a>=19904&&a<=19967,"CJK Unified Ideographs":a=>a>=19968&&a<=40959,"Yi Syllables":a=>a>=40960&&a<=42127,"Yi Radicals":a=>a>=42128&&a<=42191,"Hangul Jamo Extended-A":a=>a>=43360&&a<=43391,"Hangul Syllables":a=>a>=44032&&a<=55215,"Hangul Jamo Extended-B":a=>a>=55216&&a<=55295,"Private Use Area":a=>a>=57344&&a<=63743,"CJK Compatibility Ideographs":a=>a>=63744&&a<=64255,"Arabic Presentation Forms-A":a=>a>=64336&&a<=65023,"Vertical Forms":a=>a>=65040&&a<=65055,"CJK Compatibility Forms":a=>a>=65072&&a<=65103,"Small Form Variants":a=>
53a>=65104&&a<=65135,"Arabic Presentation Forms-B":a=>a>=65136&&a<=65279,"Halfwidth and Fullwidth Forms":a=>a>=65280&&a<=65519,Osage:a=>a>=66736&&a<=66815,"CJK Unified Ideographs Extension B":a=>a>=131072&&a<=173791};function u0(a){for(const r of a)if(qm(r.charCodeAt(0)))return!0;return!1}function zI(a){for(const r of a)if(!DI(r.charCodeAt(0)))return!1;return!0}function DI(a){return!(Tr.Arabic(a)||Tr["Arabic Supplement"](a)||Tr["Arabic Extended-A"](a)||Tr["Arabic Presentation Forms-A"](a)||Tr["Arabic Presentation Forms-B"](a))}function qm(a){return!(a!==746&&a!==747&&(a<4352||!(Tr["Bopomofo Extended"](a)||Tr.Bopomofo(a)||Tr["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||Tr["CJK Compatibility Ideographs"](a)||Tr["CJK Compatibility"](a)||Tr["CJK Radicals Supplement"](a)||Tr["CJK Strokes"](a)||!(!Tr["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||Tr["CJK Unified Ideographs Extension A"](a)||Tr["CJK Unified Ideographs"](a)||Tr["Enclosed CJK Letters and Months"](a)||Tr["Hangul Compatibility Jamo"](a)||Tr["Hangul Jamo Extended-A"](a)||Tr["Hangul Jamo Extended-B"](a)||Tr["Hangul Jamo"](a)||Tr["Hangul Syllables"](a)||Tr.Hiragana(a)||Tr["Ideographic Description Characters"](a)||Tr.Kanbun(a)||Tr["Kangxi Radicals"](a)||Tr["Katakana Phonetic Extensions"](a)||Tr.Katakana(a)&&a!==12540||!(!Tr["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!Tr["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||Tr["Unified Canadian Aboriginal Syllabics"](a)||Tr["Unified Canadian Aboriginal Syllabics Extended"](a)||Tr["Vertical Forms"](a)||Tr["Yijing Hexagram Symbols"](a)||Tr["Yi Syllables"](a)||Tr["Yi Radicals"](a))))}function Zm(a){return!(qm(a)||function(r){return!!(Tr["Latin-1 Supplement"](r)&&(r===167||r===169||r===174||r===177||r===188||r===189||r===190||r===215||r===247)||Tr["General Punctuation"](r)&&(r===8214||r===8224||r===8225||r===8240||r===8241||r===8251||r===8252||r===8258||r===8263||r===8264||r===8265||r===8273)||Tr["Letterlike Symbols"](r)||Tr["Number Forms"](r)||Tr["Miscellaneous Technical"](r)&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||r===9003||r>=9085&&r<=9114||r>=9150&&r<=9165||r===9167||r>=9169&&r<=9179||r>=9186&&r<=9215)||Tr["Control Pictures"](r)&&r!==9251||Tr["Optical Character Recognition"](r)||Tr["Enclosed Alphanumerics"](r)||Tr["Geometric Shapes"](r)||Tr["Miscellaneous Symbols"](r)&&!(r>=9754&&r<=9759)||Tr["Miscellaneous Symbols and Arrows"](r)&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||Tr["CJK Symbols and Punctuation"](r)||Tr.Katakana(r)||Tr["Private Use Area"](r)||Tr["CJK Compatibility Forms"](r)||Tr["Small Form Variants"](r)||Tr["Halfwidth and Fullwidth Forms"](r)||r===8734||r===8756||r===8757||r>=9984&&r<=10087||r>=10102&&r<=10131||r===65532||r===65533)}(a))}function ew(a){return Tr.Arabic(a)||Tr["Arabic Supplement"](a)||Tr["Arabic Extended-A"](a)||Tr["Arabic Presentation Forms-A"](a)||Tr["Arabic Presentation Forms-B"](a)}function Wm(a){return a>=1424&&a<=2303||Tr["Arabic Presentation Forms-A"](a)||Tr["Arabic Presentation Forms-B"](a)}function OI(a,r){return!(!r&&Wm(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||Tr.Khmer(a))}function FI(a){for(const r of a)if(Wm(r.charCodeAt(0)))return!0;return!1}const qs={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let h0=null,ps=qs.unavailable,Qc=null;const tw=function(a){a&&typeof a=="string"&&a.indexOf("NetworkError")>-1&&(ps=qs.error),h0&&h0(a)};function d0(){f0.fire(new lc("pluginStateChange",{pluginStatus:ps,pluginURL:Qc}))}const f0=new Du,p0=function(){return ps},rw=function(){if(ps!==qs.deferred||!Qc)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ps=qs.loading,d0(),Qc&&yf({url:Qc},a=>{a?tw(a):(ps=qs.loaded,d0())})},Ll={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ps===qs.loaded||Ll.applyArabicShaping!=null,isLoading:()=>ps===qs.loading,setState(a){ps=a.pluginStatus,Qc=a.pluginURL},isParsing:()=>ps===qs.parsing,isParsed:()=>ps===qs.parsed,getPluginURL:()=>Qc};class Ni{constructor(r,n){this.zoom=r,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.transition=n.transition,this.pitch=n.pitch,this.brightness=n.brightness,this.worldview=n.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(r){return function(n,c){for(const h of n)if(!OI(h.charCo
53deAt(0),c))return!1;return!0}(r,Ll.isLoaded())}}class Vf{constructor(r,n,c,h){this.property=r,this.value=n,this.expression=function(m,g,x,w){if(Gm(m))return new Hu(m,g);if(s0(m)||Array.isArray(m)&&m.length>0){const E=a0(m,g,x,w);if(E.result==="error")throw new Error(E.value.map(I=>`${I.key}: ${I.message}`).join(", "));return E.value}{let E=m;return typeof m=="string"&&g.type==="color"&&(E=Mi.parse(m)),{kind:"constant",configDependencies:new Set,evaluate:()=>E}}}(n===void 0?r.specification.default:n,r.specification,c,h)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(r,n,c){return this.property.possiblyEvaluate(this,r,n,c)}}class Xm{constructor(r,n,c){this.property=r,this.value=new Vf(r,void 0,n,c)}transitioned(r,n){return new iw(this.property,this.value,n,Re({},r.transition,this.transition),r.now)}untransitioned(){return new iw(this.property,this.value,null,{},0)}}class Uf{constructor(r,n,c){this._properties=r,this._values=Object.create(r.defaultTransitionablePropertyValues),this._scope=n,this._options=c,this.configDependencies=new Set}getValue(r){return dr(this._values[r].value.value)}setValue(r,n){this._values.hasOwnProperty(r)||(this._values[r]=new Xm(this._values[r].property,this._scope,this._options)),this._values[r].value=new Vf(this._values[r].property,n===null?void 0:dr(n),this._scope,this._options),this._values[r].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[r].value.expression.configDependencies]))}setTransitionOrValue(r,n){n&&(this._options=n);const c=this._properties.properties;if(r)for(const h in r){const m=r[h];if(h.endsWith("-transition")){const g=h.slice(0,-11);c[g]&&this.setTransition(g,m)}else c.hasOwnProperty(h)&&this.setValue(h,m)}}getTransition(r){return dr(this._values[r].transition)}setTransition(r,n){this._values.hasOwnProperty(r)||(this._values[r]=new Xm(this._values[r].property)),this._values[r].transition=dr(n)||void 0}serialize(){const r={};for(const n of Object.keys(this._values)){const c=this.getValue(n);c!==void 0&&(r[n]=c);const h=this.getTransition(n);h!==void 0&&(r[`${n}-transition`]=h)}return r}transitioned(r,n){const c=new nw(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].transitioned(r,n._values[h]);return c}untransitioned(){const r=new nw(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].untransitioned();return r}}class iw{constructor(r,n,c,h,m){const g=h.delay||0,x=h.duration||0;m=m||0,this.property=r,this.value=n,this.begin=m+g,this.end=this.begin+x,r.specification.transition&&(h.delay||h.duration)&&(this.prior=c)}possiblyEvaluate(r,n,c){const h=r.now||0,m=this.value.possiblyEvaluate(r,n,c),g=this.prior;if(g){if(h>this.end)return this.prior=null,m;if(this.value.isDataDriven())return this.prior=null,m;if(h<this.begin)return g.possiblyEvaluate(r,n,c);{const x=(h-this.begin)/(this.end-this.begin);return this.property.interpolate(g.possiblyEvaluate(r,n,c),m,ee(x))}}return m}}class nw{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitioningPropertyValues)}possiblyEvaluate(r,n,c){const h=new ol(this._properties);for(const m of Object.keys(this._values))h._values[m]=this._values[m].possiblyEvaluate(r,n,c);return h}hasTransition(){for(const r of Object.keys(this._values))if(this._values[r].prior)return!0;return!1}}class eu{constructor(r,n,c){this._properties=r,this._values=Object.create(r.defaultPropertyValues),this._scope=n,this._options=c,this.configDependencies=new Set}getValue(r){return dr(this._values[r].value)}setValue(r,n){this._values[r]=new Vf(this._values[r].property,n===null?void 0:dr(n),this._scope,this._options),this._values[r].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[r].expression.configDependencies]))}serialize(){const r={};for(const n of Object.keys(this._values)){const c=this.getValue(n);c!==void 0&&(r[n]=c)}return r}possiblyEvaluate(r,n,c){const h=new ol(this._properties);for(const m of Object.keys(this._values))h._values[m]=this._values[m].possiblyEvaluate(r,n,c);return h}}
vendor: 6,130 bytes, line 53
53class qu{constructor(r,n,c){this.property=r,this.value=n,this.parameters=c}isConstant(){return this.value.kind==="constant"}constantOr(r){return this.value.kind==="constant"?this.value.value:r}evaluate(r,n,c,h){return this.property.evaluate(this.value,this.parameters,r,n,c,h)}}class ol{constructor(r){this._properties=r,this._values=Object.create(r.defaultPossiblyEvaluatedValues)}get(r){return this._values[r]}}class zt{constructor(r){this.specification=r}possiblyEvaluate(r,n){return r.expression.evaluate(n)}interpolate(r,n,c){const h=Tf[this.specification.type];return h?h(r,n,c):r}}class qt{constructor(r,n){this.specification=r,this.overrides=n}possiblyEvaluate(r,n,c,h){return new qu(this,r.expression.kind==="constant"||r.expression.kind==="camera"?{kind:"constant",value:r.expression.evaluate(n,null,{},c,h)}:r.expression,n)}interpolate(r,n,c){if(r.value.kind!=="constant"||n.value.kind!=="constant")return r;if(r.value.value===void 0||n.value.value===void 0)return new qu(this,{kind:"constant",value:void 0},r.parameters);const h=Tf[this.specification.type];return h?new qu(this,{kind:"constant",value:h(r.value.value,n.value.value,c)},r.parameters):r}evaluate(r,n,c,h,m,g){return r.kind==="constant"?r.value:r.evaluate(n,c,h,m,g)}}class od{constructor(r){this.specification=r}possiblyEvaluate(r,n,c,h){return!!r.expression.evaluate(n,null,{},c,h)}interpolate(){return!1}}class Ln{constructor(r){this.properties=r,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const n=new Ni(0,{});for(const c in r){const h=r[c];h.specification.overridable&&this.overridableProperties.push(c);const m=this.defaultPropertyValues[c]=new Vf(h,void 0),g=this.defaultTransitionablePropertyValues[c]=new Xm(h);this.defaultTransitioningPropertyValues[c]=g.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=m.possiblyEvaluate(n)}}}Jt(qt,"DataDrivenProperty"),Jt(zt,"DataConstantProperty"),Jt(od,"ColorRampProperty");var Ue=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
53,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"expression"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
53,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"ty
53pe":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
53,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"int
53erpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function ow(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function jf(a){if(Array.isArray(a))return a.map(jf);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const r={};for(const n in a)r[n]=jf(a[n]);return r}return ow(a)}function Gf(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>
vendor: 4,118 bytes, lines 53-59
53=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const r of a.slice(1))if(!Gf(r)&&typeof r!="boolean")return!1;return!0;default:return!0}}function sd(a,r="",n=null,c="fill"){if(a==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Gf(a)||(a=Km(a));const h=a;let m=!0;try{m=function(I){if(!ad(I))return I;let A=jf(I);return Ym(A),A=m0(A),A}(h)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
54This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
55and paste the contents of this message in the report.
56Thank you!
57Filter Expression:
58${JSON.stringify(h,null,2)}
59        `)}let g=null,x=null;if(c!=="background"&&c!=="sky"&&c!=="slot"){x=Ue[`filter_${c}`];const I=$u(m,x,r,n);if(I.result==="error")throw new Error(I.value.map(A=>`${A.key}: ${A.message}`).join(", "));g=(A,P,D)=>I.value.evaluate(A,P,{},D)}let w=null,E=null;if(m!==h){const I=$u(h,x,r,n);if(I.result==="error")throw new Error(I.value.map(A=>`${A.key}: ${A.message}`).join(", "));w=(A,P,D,O,V)=>I.value.evaluate(A,P,{},D,void 0,void 0,O,V),E=!Jh(I.value.expression)}return{filter:g,dynamicFilter:w||void 0,needGeometry:g0(m),needFeature:!!E}}function m0(a){if(!Array.isArray(a))return a;const r=function(n){if(zl.has(n[0])){for(let c=1;c<n.length;c++)if(ad(n[c]))return!0}return n}(a);return r===!0?r:r.map(n=>m0(n))}function Ym(a){let r=!1;const n=[];if(a[0]==="case"){for(let c=1;c<a.length-1;c+=2)r=r||ad(a[c]),n.push(a[c+1]);n.push(a[a.length-1])}else if(a[0]==="match"){r=r||ad(a[1]);for(let c=2;c<a.length-1;c+=2)n.push(a[c+1]);n.push(a[a.length-1])}else if(a[0]==="step"){r=r||ad(a[1]);for(let c=1;c<a.length-1;c+=2)n.push(a[c+1])}r&&(a.length=0,a.push("any",...n));for(let c=1;c<a.length;c++)Ym(a[c])}function ad(a){if(!Array.isArray(a))return!1;if((r=a[0])==="pitch"||r==="distance-from-center")return!0;var r;for(let n=1;n<a.length;n++)if(ad(a[n]))return!0;return!1}const zl=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function NI(a,r){return a<r?-1:a>r?1:0}function g0(a){if(!Array.isArray(a))return!1;if(a[0]==="within"||a[0]==="distance")return!0;for(let r=1;r<a.length;r++)if(g0(a[r]))return!0;return!1}function Km(a){if(!a)return!0;const r=a[0];return a.length<=1?r!=="any":r==="=="?_0(a[1],a[2],"=="):r==="!="?Jm(_0(a[1],a[2],"==")):r==="<"||r===">"||r==="<="||r===">="?_0(a[1],a[2],r):r==="any"?(n=a.slice(1),["any"].concat(n.map(Km))):r==="all"?["all"].concat(a.slice(1).map(Km)):r==="none"?["all"].concat(a.slice(1).map(Km).map(Jm)):r==="in"?sw(a[1],a.slice(2)):r==="!in"?Jm(sw(a[1],a.slice(2))):r==="has"?aw(a[1]):r!=="!has"||Jm(aw(a[1]));var n}function _0(a,r,n){switch(a){case"$type":return[`filter-type-${n}`,r];case"$id":return[`filter-id-${n}`,r];default:return[`filter-${n}`,a,r]}}function sw(a,r){if(r.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(n=>typeof n!=typeof r[0])?["filter-in-large",a,["literal",r.sort(NI)]]:["filter-in-small",a,["literal",r]]}}function aw(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function Jm(a){return["!",a]}const $f="�";function ld(a,r){return r?`${a}${$f}${r}`:a}const lw="-transition",BI=new Set(["fill","line","background","hillshade","raster"]);class Qo extends Du{constructor(r,n,c,h,m){if(super(),this.id=r.id,this.fqid=ld(this.id,c),this.type=r.type,this.scope=c,this.lut=h,this.options=m,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,r.type!=="custom"){if(this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type&&r.type!=="background"&&r.type!=="sky"&&r.type!=="slot"){this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter;
59const g=$u(this.filter,Ue[`filter_${r.type}`]);g.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...g.value.configDependencies]))}if(r.slot&&(this.slot=r.slot),n.layout&&(this._unevaluatedLayout=new eu(n.layout,this.scope,m),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),n.paint){this._transitionablePaint=new Uf(n.paint,this.scope,m);for(const g in r.paint)this.setPaintProperty(g,r.paint[g]);for(const g in r.layout)this.setLayoutProperty(g,r.layout[g]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ol(n.paint)}}}onAdd(r){}onRemove(r){}isDraped(r){return!this.is3D(!0)&&BI.has(this.type)}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,n){if(this.type==="custom"&&r==="visibility")return void(this.visibility=n);const c=this._unevaluatedLayout;c._properties.properties[r]&&(c.setValue(r,n),this.configDependencies=new Set([...this.configDependencies,...c.configDependencies]),r==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(r){return r.endsWith(lw)?this._transitionablePaint.getTransition(r.slice(0,-11)):this._transitionablePaint.getValue(r)}setPaintProperty(r,n){const c=this._transitionablePaint,h=c._properties.properties;if(r.endsWith(lw)){const A=r.slice(0,-11);return h[A]&&c.setTransition(A,n||void 0),!1}if(!h[r])return!1;const m=c._values[r],g=m.value.isDataDriven(),x=m.value;c.setValue(r,n),this.configDependencies=new Set([...this.configDependencies,...c.configDependencies]),this._handleSpecialPaintPropertyUpdate(r);const w=c._values[r].value,E=w.isDataDriven(),I=r.endsWith("pattern")||r==="line-dasharray";return E||g||I||this._handleOverridablePaintPropertyUpdate(r,x,w)}_handleSpecialPaintPropertyUpdate(r){}getProgramIds(){return null}getDefaultProgramParams(r,n,c){return null}_handleOverridablePaintPropertyUpdate(r,n,c){return!1}isHidden(r){return!!(this.minzoom&&r<this.minzoom)||!!(this.maxzoom&&r>=this.maxzoom)||this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,n){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,n)}
59serialize(){return er({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}is3D(r){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const r in this.paint._values){const n=this.paint.get(r);if(n instanceof qu&&Um(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}compileFilter(r){this._filterCompiled||(this._featureFilter=sd(this.filter,this.scope,r),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(r){this._stats&&(r.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(r){}queryIntersectsFeature(r,n,c,h,m,g,x,w,E){}}const VI={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Hf{constructor(r,n){this._structArray=r,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class dn{constructor(){this.capacity=-1,this.resize(0)}static serialize(r,n){return r._trim(),n&&n.add(r.arrayBuffer),{length:r.length,arrayBuffer:r.arrayBuffer}}static deserialize(r){const n=Object.create(this.prototype);return n.arrayBuffer=r.arrayBuffer,n.length=r.length,n.capacity=r.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(r){this.reserve(r),this.length=r}reserve(r){if(r>this.capacity){this.capacity=Math.max(r,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...r){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...r){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function si(a,r=1){let n=0,c=0;return{members:a.map(h=>{const m=VI[h.type].BYTES_PER_ELEMENT,g=n=y0(n,Math.max(r,m)),x=h.components||1;return c=Math.max(c,m),n+=m*x,{name:h.name,type:h.type,components:x,offset:g}}),size:y0(n,Math.max(c,r)),alignment:r}}function y0(a,r){return Math.ceil(a/r)*r}class Ps extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n){const c=this.length;return this.resize(c+1),this.emplace(c,r,n)}emplace(r,n,c){const h=2*r;return this.int16[h+0]=n,this.int16[h+1]=c,r}}Ps.prototype.bytesPerElement=4,Jt(Ps,"StructArrayLayout2i4");class cd extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c){const h=this.length;return this.resize(h+1),this.emplace(h,r,n,c)}emplace(r,n,c,h){const m=3*r;return this.int16[m+0]=n,this.int16[m+1]=c,this.int16[m+2]=h,r}}cd.prototype.bytesPerElement=6,Jt(cd,"StructArrayLayout3i6");class ud extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c,h){const m=this.length;return this.resize(m+1),this.emplace(m,r,n,c,h)}emplace(r,n,c,h,m){const g=4*r;return this.int16[g+0]=n,this.int16[g+1]=c,this.int16[g+2]=h,this.int16[g+3]=m,r}}ud.prototype.bytesPerElement=8,Jt(ud,"StructArrayLayout4i8");class Zu extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){const n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){return this.float32[1*r+0]=n,r}}Zu.prototype.bytesPerElement=4,Jt(Zu,"StructArrayLayout1f4");class v0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c){const h=this.length;return this.resize(h+1),this.emplace(h,r,n,c)}emplace(r,n,c,h){const m=4*r,g=2*r;return this.int16[m+0]=n,this.int16[m+1]=c,this.float32[g+1]=h,r}}v0.prototype.bytesPerElement=8,Jt(v0,"StructArrayLayout2i1f8");class x0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c){const h=this.length;return this.resize(h+1),this.emplace(h,r,n,c)}emplace(r,n,c,h){const m=4*r;return this.int16[m+0]=n,this.int16[m+1]=c,this.int16[m+2]=h,r}}x0.prototype.bytesPerElement=8,Jt(x0,"StructArrayLayout3i8");class Qm extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,n,c,h,m)}emplace(r,n,c,h,m,g){const x=5*r;
vendor: 21,873 bytes, line 59
59return this.int16[x+0]=n,this.int16[x+1]=c,this.int16[x+2]=h,this.int16[x+3]=m,this.int16[x+4]=g,r}}Qm.prototype.bytesPerElement=10,Jt(Qm,"StructArrayLayout5i10");class eg extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,r,n,c,h,m,g,x)}emplace(r,n,c,h,m,g,x,w){const E=6*r,I=12*r,A=3*r;return this.int16[E+0]=n,this.int16[E+1]=c,this.uint8[I+4]=h,this.uint8[I+5]=m,this.uint8[I+6]=g,this.uint8[I+7]=x,this.float32[A+2]=w,r}}eg.prototype.bytesPerElement=12,Jt(eg,"StructArrayLayout2i4ub1f12");class pa extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c){const h=this.length;return this.resize(h+1),this.emplace(h,r,n,c)}emplace(r,n,c,h){const m=3*r;return this.float32[m+0]=n,this.float32[m+1]=c,this.float32[m+2]=h,r}}pa.prototype.bytesPerElement=12,Jt(pa,"StructArrayLayout3f12");class tu extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,n,c,h,m)}emplace(r,n,c,h,m,g){const x=6*r,w=3*r;return this.uint16[x+0]=n,this.uint16[x+1]=c,this.uint16[x+2]=h,this.uint16[x+3]=m,this.float32[w+2]=g,r}}tu.prototype.bytesPerElement=12,Jt(tu,"StructArrayLayout4ui1f12");class hd extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,c,h){const m=this.length;return this.resize(m+1),this.emplace(m,r,n,c,h)}emplace(r,n,c,h,m){const g=4*r;return this.uint16[g+0]=n,this.uint16[g+1]=c,this.uint16[g+2]=h,this.uint16[g+3]=m,r}}hd.prototype.bytesPerElement=8,Jt(hd,"StructArrayLayout4ui8");class tg extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,r,n,c,h,m,g)}emplace(r,n,c,h,m,g,x){const w=6*r;return this.int16[w+0]=n,this.int16[w+1]=c,this.int16[w+2]=h,this.int16[w+3]=m,this.int16[w+4]=g,this.int16[w+5]=x,r}}tg.prototype.bytesPerElement=12,Jt(tg,"StructArrayLayout6i12");class rg extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E,I,A,P){const D=this.length;return this.resize(D+1),this.emplace(D,r,n,c,h,m,g,x,w,E,I,A,P)}emplace(r,n,c,h,m,g,x,w,E,I,A,P,D){const O=12*r;return this.int16[O+0]=n,this.int16[O+1]=c,this.int16[O+2]=h,this.int16[O+3]=m,this.uint16[O+4]=g,this.uint16[O+5]=x,this.uint16[O+6]=w,this.uint16[O+7]=E,this.int16[O+8]=I,this.int16[O+9]=A,this.int16[O+10]=P,this.int16[O+11]=D,r}}rg.prototype.bytesPerElement=24,Jt(rg,"StructArrayLayout4i4ui4i24");class dd extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,r,n,c,h,m,g)}emplace(r,n,c,h,m,g,x){const w=10*r,E=5*r;return this.int16[w+0]=n,this.int16[w+1]=c,this.int16[w+2]=h,this.float32[E+2]=m,this.float32[E+3]=g,this.float32[E+4]=x,r}}dd.prototype.bytesPerElement=20,Jt(dd,"StructArrayLayout3i3f20");class ru extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h){const m=this.length;return this.resize(m+1),this.emplace(m,r,n,c,h)}emplace(r,n,c,h,m){const g=4*r;return this.float32[g+0]=n,this.float32[g+1]=c,this.float32[g+2]=h,this.float32[g+3]=m,r}}ru.prototype.bytesPerElement=16,Jt(ru,"StructArrayLayout4f16");class b0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){const n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){return this.uint32[1*r+0]=n,r}}b0.prototype.bytesPerElement=4,Jt(b0,"StructArrayLayout1ul4");class Dl extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n){const c=this.length;return this.resize(c+1),this.emplace(c,r,n)}emplace(r,n,c){const h=2*r;return this.uint16[h+0]=n,this.uint16[h+1]=c,r}}Dl.prototype.bytesPerElement=4,Jt(Dl,"StructArrayLayout2ui4");class w0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E,I,A,P,D){const O=this.length;return this.resize(O+1),this.emplace(O,r,n,c,h,m,g,x,w,E,I,A,P,D)}emplace(r,n,c,h,m,g,x,w,E,I,A,P,D,O){const V=20*r,j=10*r;return this.int16[V+0]=n,this.int16[V+1]=c,this.int16[V+2]=h,this.int16[V+3]=m,this.int16[V+4]=g,this.float32[j+3]=x,this.float32[j+4]=w,this.float32[j+5]=E,this.float32[j+6]=I,this.int16[V+14]=A,this.uint32[j+8]=P,this.uint16[V+18]=D,this.uint16[V+19]=O,r}}w0.prototype.bytesPerElement=40,Jt(w0,"StructArrayLayout5i4f1i1ul2ui40");class ig extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,r,n,c,h,m,g,x)}emplace(r,n,c,h,m,g,x,w){const E=8*r;return this.int16[E+0]=n,this.int16[E+1]=c,this.int16[E+2]=h,this.int16[E+4]=m,this.int16[E+5]=g,this.int16[E+6]=x,this.int16[E+7]=w,r}}ig.prototype.bytesPerElement=16,Jt(ig,"StructArrayLayout3i2i2i16");class fd extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,n,c,h,m)}emplace(r,n,c,h,m,g){const x=4*r,w=8*r;return this.float32[x+0]=n,this.float32[x+1]=c,this.float32[x+2]=h,this.int16[w+6]=m,this.int16[w+7]=g,r}}fd.prototype.bytesPerElement=16,Jt(fd,"StructArrayLayout2f1f2i16");class pd extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,r,n,c,h,m,g)}emplace(r,n,c,h,m,g,x){const w=20*r,E=5*r;return this.uint8[w+0]=n,this.uint8[w+1]=c,this.float32[E+1]=h,this.float32[E+2]=m,this.float32[E+3]=g,this.float32[E+4]=x,r}}pd.prototype.bytesPerElement=20,Jt(pd,"StructArrayLayout2ub4f20");class gn extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,c){const h=this.length;return this.resize(h+1),this.emplace(h,r,n,c)}emplace(r,n,c,h){const m=3*r;return this.uint16[m+0]=n,this.uint16[m+1]=c,this.uint16[m+2]=h,r}}gn.prototype.bytesPerElement=6,Jt(gn,"StructArrayLayout3ui6");class md extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne,ae,Ie){const be=this.length;return this.resize(be+1),this.emplace(be,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne,ae,Ie)}emplace(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne,ae,Ie,be){const Te=30*r,Le=15*r,De=60*r;return this.int16[Te+0]=n,this.int16[Te+1]=c,this.int16[Te+2]=h,this.float32[Le+2]=m,this.float32[Le+3]=g,this.uint16[Te+8]=x,this.uint16[Te+9]=w,this.uint32[Le+5]=E,this.uint32[Le+6]=I,this.uint32[Le+7]=A,this.uint16[Te+16]=P,this.uint16[Te+17]=D,this.uint16[Te+18]=O,this.float32[Le+10]=V,this.float32[Le+11]=j,this.uint8[De+48]=X,this.uint8[De+49]=oe,this.uint8[De+50]=ne,this.uint32[Le+13]=ae,this.int16[Te+28]=Ie,this.uint8[De+58]=be,r}}md.prototype.bytesPerElement=60,Jt(md,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class T0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne,ae,Ie,be,Te,Le,De,lt,je,ht,Lt,gt,St,kt,st){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne,ae,Ie,be,Te,Le,De,lt,je,ht,Lt,gt,St,kt,st)}emplace(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne,ae,Ie,be,Te,Le,De,lt,je,ht,Lt,gt,St,kt,st,Ct){const $e=20*r,at=40*r,Dt=80*r;return this.float32[$e+0]=n,this.float32[$e+1]=c,this.int16[at+4]=h,this.int16[at+5]=m,this.int16[at+6]=g,this.int16[at+7]=x,this.int16[at+8]=w,this.int16[at+9]=E,this.int16[at+10]=I,this.int16[at+11]=A,this.int16[at+12]=P,this.uint16[at+13]=D,this.uint16[at+14]=O,this.uint16[at+15]=V,this.uint16[at+16]=j,this.uint16[at+17]=X,this.uint16[at+18]=oe,this.uint16[at+19]=ne,this.uint16[at+20]=ae,this.uint16[at+21]=Ie,this.uint16[at+22]=be,this.uint16[at+23]=Te,this.uint16[at+24]=Le,this.uint16[at+25]=De,this.uint16[at+26]=lt,this.uint16[at+27]=je,this.uint32[$e+14]=ht,this.float32[$e+15]=Lt,this.float32[$e+16]=gt,this.float32[$e+17]=St,this.float32[$e+18]=kt,this.uint8[Dt+76]=st,this.uint16[at+39]=Ct,r}}T0.prototype.bytesPerElement=80,Jt(T0,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class E0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g){const x=this.length;return this.resize(x+1),this.emplace(x,r,n,c,h,m,g)}emplace(r,n,c,h,m,g,x){const w=6*r;return this.float32[w+0]=n,this.float32[w+1]=c,this.float32[w+2]=h,this.float32[w+3]=m,this.float32[w+4]=g,this.float32[w+5]=x,r}}E0.prototype.bytesPerElement=24,Jt(E0,"StructArrayLayout6f24");class Wu extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m){const g=this.length;return this.resize(g+1),this.emplace(g,r,n,c,h,m)}emplace(r,n,c,h,m,g){const x=5*r;return this.float32[x+0]=n,this.float32[x+1]=c,this.float32[x+2]=h,this.float32[x+3]=m,this.float32[x+4]=g,r}}Wu.prototype.bytesPerElement=20,Jt(Wu,"StructArrayLayout5f20");class S0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,r,n,c,h,m,g,x)}emplace(r,n,c,h,m,g,x,w){const E=7*r;return this.float32[E+0]=n,this.float32[E+1]=c,this.float32[E+2]=h,this.float32[E+3]=m,this.float32[E+4]=g,this.float32[E+5]=x,this.float32[E+6]=w,r}}S0.prototype.bytesPerElement=28,Jt(S0,"StructArrayLayout7f28");class qf extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E,I,A){const P=this.length;return this.resize(P+1),this.emplace(P,r,n,c,h,m,g,x,w,E,I,A)}emplace(r,n,c,h,m,g,x,w,E,I,A,P){const D=11*r;return this.float32[D+0]=n,this.float32[D+1]=c,this.float32[D+2]=h,this.float32[D+3]=m,this.float32[D+4]=g,this.float32[D+5]=x,this.float32[D+6]=w,this.float32[D+7]=E,this.float32[D+8]=I,this.float32[D+9]=A,this.float32[D+10]=P,r}}qf.prototype.bytesPerElement=44,Jt(qf,"StructArrayLayout11f44");class C0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E){const I=this.length;return this.resize(I+1),this.emplace(I,r,n,c,h,m,g,x,w,E)}emplace(r,n,c,h,m,g,x,w,E,I){const A=9*r;return this.float32[A+0]=n,this.float32[A+1]=c,this.float32[A+2]=h,this.float32[A+3]=m,this.float32[A+4]=g,this.float32[A+5]=x,this.float32[A+6]=w,this.float32[A+7]=E,this.float32[A+8]=I,r}}C0.prototype.bytesPerElement=36,Jt(C0,"StructArrayLayout9f36");class iu extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n){const c=this.length;return this.resize(c+1),this.emplace(c,r,n)}emplace(r,n,c){const h=2*r;return this.float32[h+0]=n,this.float32[h+1]=c,r}}iu.prototype.bytesPerElement=8,Jt(iu,"StructArrayLayout2f8");class I0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,c,h){const m=this.length;return this.resize(m+1),this.emplace(m,r,n,c,h)}emplace(r,n,c,h,m){const g=6*r;return this.uint32[3*r+0]=n,this.uint16[g+2]=c,this.uint16[g+3]=h,this.uint16[g+4]=m,r}}I0.prototype.bytesPerElement=12,Jt(I0,"StructArrayLayout1ul3ui12");class A0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){const n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){return this.uint16[1*r+0]=n,r}}A0.prototype.bytesPerElement=2,Jt(A0,"StructArrayLayout1ui2");class ng extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j){const X=this.length;return this.resize(X+1),this.emplace(X,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j)}emplace(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X){const oe=16*r;return this.float32[oe+0]=n,this.float32[oe+1]=c,this.float32[oe+2]=h,this.float32[oe+3]=m,this.float32[oe+4]=g,this.float32[oe+5]=x,this.float32[oe+6]=w,this.float32[oe+7]=E,this.float32[oe+8]=I,this.float32[oe+9]=A,this.float32[oe+10]=P,this.float32[oe+11]=D,this.float32[oe+12]=O,this.float32[oe+13]=V,this.float32[oe+14]=j,this.float32[oe+15]=X,r}}ng.prototype.bytesPerElement=64,Jt(ng,"StructArrayLayout16f64");class gd extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,c,h,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,r,n,c,h,m,g,x)}emplace(r,n,c,h,m,g,x,w){const E=10*r,I=5*r;return this.uint16[E+0]=n,this.uint16[E+1]=c,this.uint16[E+2]=h,this.uint16[E+3]=m,this.float32[I+2]=g,this.float32[I+3]=x,this.float32[I+4]=w,r}}gd.prototype.bytesPerElement=20,Jt(gd,"StructArrayLayout4ui3f20");class P0 extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r){const n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){return this.int16[1*r+0]=n,r}}P0.prototype.bytesPerElement=2,Jt(P0,"StructArrayLayout1i2");class og extends dn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(r){const n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){return this.uint8[1*r+0]=n,r}}og.prototype.bytesPerElement=1,Jt(og,"StructArrayLayout1ub1");class M0 extends Hf{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}M0.prototype.size=40;class cw extends w0{get(r){return new M0(this,r)}}Jt(cw,"CollisionBoxArray");class sg extends Hf{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(r){this._structArray.uint8[this._pos1+49]=r}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(r){this._structArray.uint8[this._pos1+50]=r}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(r){this._structArray.uint32[this._pos4+13]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(r){this._structArray.uint8[this._pos1+58]=r}}sg.prototype.size=60;class Zf extends md{get(r){return new sg(this,r)}}Jt(Zf,"PlacedSymbolArray");class k0 extends Hf{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(r){this._structArray.uint32[this._pos4+14]=r}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(r){this._structArray.float32[this._pos4+18]=r}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}k0.prototype.size=80;class uw extends T0{get(r){return new k0(this,r)}}Jt(uw,"SymbolInstanceArray");class R0 extends Zu{getoffsetX(r){return this.float32[1*r+0]}}Jt(R0,"GlyphOffsetArray");class hw extends Ps{getx(r){return this.int16[2*r+0]}gety(r){return this.int16[2*r+1]}}Jt(hw,"SymbolLineVertexArray");class ag extends Hf{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}ag.prototype.size=12;class dw extends I0{get(r){return new ag(this,r)}}Jt(dw,"FeatureIndexArray");class fw extends Dl{geta_centroid_pos0(r){return this.uint16[2*r+0]}geta_centroid_pos1(r){return this.uint16[2*r+1]}}Jt(fw,"FillExtrusionCentroidArray");class pw extends Hf{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}pw.prototype.size=6;class mw extends cd{get(r){return new pw(this,r)}}Jt(mw,"FillExtrusionWallArray");const gw=si([{name:"a_pos",components:2,type:"Int16"}],4),UI=si([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),jI=si([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class xn{constructor(r=[]){this.segments=r}_prepareSegment(r,n,c,h){let m=this.segments[this.segments.length-1];return r>xn.MAX_VERTEX_ARRAY_LENGTH&&Ar(`Max vertices per segment is ${xn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}`),(!m||m.vertexLength+r>
59xn.MAX_VERTEX_ARRAY_LENGTH||m.sortKey!==h)&&(m={vertexOffset:n,primitiveOffset:c,vertexLength:0,primitiveLength:0},h!==void 0&&(m.sortKey=h),this.segments.push(m)),m}prepareSegment(r,n,c,h){return this._prepareSegment(r,n.length,c.length,h)}get(){return this.segments}destroy(){for(const r of this.segments)for(const n in r.vaos)r.vaos[n].destroy()}static simpleSegment(r,n,c,h){return new xn([{vertexOffset:r,primitiveOffset:n,vertexLength:c,primitiveLength:h,vaos:{},sortKey:0}])}}function _w(a,r){return 256*(a=J(Math.floor(a),0,255))+J(Math.floor(r),0,255)}xn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Jt(xn,"SegmentVector");const GI=si([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),L0=si([{name:"a_pattern_b",components:4,type:"Uint16"}]),$I=si([{name:"a_dash",components:4,type:"Uint16"}]);class Wf{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(r,n,c,h){this.ids.push(Xf(r)),this.positions.push(n,c,h)}eachPosition(r,n){const c=Xf(r);let h=0,m=this.ids.length-1;for(;h<m;){const g=h+m>>1;this.ids[g]>=c?m=g:h=g+1}for(;this.ids[h]===c;)n(this.positions[3*h],this.positions[3*h+1],this.positions[3*h+2]),h++}static serialize(r,n){const c=new Float64Array(r.ids),h=new Uint32Array(r.positions);return z0(c,h,0,c.length-1),n&&(n.add(c.buffer),n.add(h.buffer)),{ids:c,positions:h}}static deserialize(r){const n=new Wf;let c;n.ids=r.ids,n.positions=r.positions;for(const h of n.ids)h!==c&&n.uniqueIds.push(h),c=h;return n.indexed=!0,n}}function Xf(a){const r=+a;return!isNaN(r)&&Number.MIN_SAFE_INTEGER<=r&&r<=Number.MAX_SAFE_INTEGER?r:jh(String(a))}function z0(a,r,n,c){for(;n<c;){const h=a[n+c>>1];let m=n-1,g=c+1;for(;;){do m++;while(a[m]<h);do g--;while(a[g]>h);if(m>=g)break;lg(a,m,g),lg(r,3*m,3*g),lg(r,3*m+1,3*g+1),lg(r,3*m+2,3*g+2)}g-n<c-g?(z0(a,r,n,g),n=g+1):(z0(a,r,g+1,c),c=g)}}function lg(a,r,n){const c=a[r];a[r]=a[n],a[n]=c}Jt(Wf,"FeaturePositionMap");class Ua{constructor(r){this.gl=r.gl,this.initialized=!1}fetchUniformLocation(r,n){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(r,n),this.initialized=!0),!!this.location}set(r,n,c){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class cg extends Ua{constructor(r){super(r),this.current=0}set(r,n,c){this.fetchUniformLocation(r,n)&&this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}}class Vn extends Ua{constructor(r){super(r),this.current=0}set(r,n,c){this.fetchUniformLocation(r,n)&&this.current!==c&&(this.current=c,this.gl.uniform1f(this.location,c))}}class Ol extends Ua{constructor(r){super(r),this.current=[0,0]}set(r,n,c){this.fetchUniformLocation(r,n)&&(c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1])))}}class _d extends Ua{constructor(r){super(r),this.current=[0,0,0]}set(r,n,c){this.fetchUniformLocation(r,n)&&(c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2])))}}class Yf extends Ua{constructor(r){super(r),this.current=[0,0,0,0]}set(r,n,c){this.fetchUniformLocation(r,n)&&(c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]&&c[3]===this.current[3]||(this.current=c,this.gl.uniform4f(this.location,c[0],c[1],c[2],c[3])))}}class D0 extends Ua{constructor(r){super(r),this.current=Mi.transparent.toPremultipliedRenderColor(null)}set(r,n,c){this.fetchUniformLocation(r,n)&&(c.r===this.current.r&&c.g===this.current.g&&c.b===this.current.b&&c.a===this.current.a||(this.current=c,this.gl.uniform4f(this.location,c.r,c.g,c.b,c.a)))}}const yw=new Float32Array(16);class Kf extends Ua{constructor(r){super(r),this.current=yw}set(r,n,c){if(this.fetchUniformLocation(r,n)){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let h=1;h<16;h++)if(c[h]!==this.current[h]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}}}const HI=new Float32Array(9),vw=new Float32Array(4);class O0 extends Ua{constructor(r){super(r),this.current=vw}set(r,n,c){if(this.fetchUniformLocation(r,n)){for(let h=0;h<4;h++)if(c[h]!==this.current[h]){this.current=c,this.gl.uniformMatrix2fv(this.location,!1,c);break}}}}function F0(a){return[_w(255*a.r,255*a.g),_w(255*a.b,255*a.a)]}class Jf{constructor(r,n,c,h){this.value=r,this.uniformNames=n.map(m=>`u_${m}`),this.type=c,this.context=h}setUniform(r,n,c,h,m){const g=h.constantOr(this.value);n.set(r,m,g instanceof Mi?g.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):g)}getBinding(r,n){return this.type==="color"?new D0(r):new Vn(r)}}class yd{constructor(r,n){this.uniformNames=n.map(c=>`u_${c}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(r,n){this.pixelRatio=r.pixelRatio||1,this.pattern=r.tl.concat(r.br),this.patternTransition=n?n.tl.concat(n.br):this.pattern}setUniform(r,n,c,h,m){let g=null;m!=="u_pattern"&&m!=="u_dash"||(g=this.pattern),m==="u_pattern_b"&&(g=this.patternTransition),m==="u_pixel_ratio"&&(g=this.pixelRatio),g&&n.set(r,m,g)}getBinding(r,n){return n==="u_pattern"||n==="u_pattern_b"||n==="u_dash"?new Yf(r):new Vn(r)}}class dc{constructor(r,n,c,h){this.expression=r,this.type=c,this.maxValue=0,this.paintVertexAttributes=n.map(m=>({name:`a_${m}`,type:"Float32",components:c==="color"?2:1,offset:0})),this.paintVertexArray=new h}populatePaintArray(r,n,c,h,m,g,x,w){const E=this.paintVertexArray.length,I=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ni(0,{brightness:g,worldview:w}),n,{},m,h,x):this.expression.kind==="constant"&&this.expression.value,A=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ni(0,{brightness:g,worldview:w}),n,{},m,h,x):this.lutExpression.value)==="none";this.paintVertexArray.resize(r),this._setPaintValue(E,r,I,A?null:this.context.lut)}updatePaintArray(r,n,c,h,m,g,x,w){const E=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:x,worldview:w},c,h,void 0,m):this.expression.kind==="constant"&&this.expression.value,I=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ni(0,{brightness:x,worldview:w}),c,h,void 0,m):this.lutExpression.value)==="none";this._setPaintValue(r,n,E,I?null:this.context.lut)}
vendor: 10,039 bytes, line 59
59_setPaintValue(r,n,c,h){if(this.type==="color"){const m=F0(c.toPremultipliedRenderColor(h));for(let g=r;g<n;g++)this.paintVertexArray.emplace(g,m[0],m[1])}else{for(let m=r;m<n;m++)this.paintVertexArray.emplace(m,c);this.maxValue=Math.max(this.maxValue,Math.abs(c))}}upload(r){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=r.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ja{constructor(r,n,c,h,m,g){this.expression=r,this.uniformNames=n.map(x=>`u_${x}_t`),this.type=c,this.useIntegerZoom=h,this.context=m,this.maxValue=0,this.paintVertexAttributes=n.map(x=>({name:`a_${x}`,type:"Float32",components:c==="color"?4:2,offset:0})),this.paintVertexArray=new g}populatePaintArray(r,n,c,h,m,g,x,w){const E=this.expression.evaluate(new Ni(this.context.zoom,{brightness:g,worldview:w}),n,{},m,h,x),I=this.expression.evaluate(new Ni(this.context.zoom+1,{brightness:g,worldview:w}),n,{},m,h,x),A=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ni(0,{brightness:g,worldview:w}),n,{},m,h,x):this.lutExpression.value)==="none",P=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValue(P,r,E,I,A?null:this.context.lut)}updatePaintArray(r,n,c,h,m,g,x,w){const E=this.expression.evaluate({zoom:this.context.zoom,brightness:x,worldview:w},c,h,void 0,m),I=this.expression.evaluate({zoom:this.context.zoom+1,brightness:x,worldview:w},c,h,void 0,m),A=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ni(0,{brightness:x,worldview:w}),c,h,void 0,m):this.lutExpression.value)==="none";this._setPaintValue(r,n,E,I,A?null:this.context.lut)}_setPaintValue(r,n,c,h,m){if(this.type==="color"){const g=F0(c.toPremultipliedRenderColor(m)),x=F0(c.toPremultipliedRenderColor(m));for(let w=r;w<n;w++)this.paintVertexArray.emplace(w,g[0],g[1],x[0],x[1])}else{for(let g=r;g<n;g++)this.paintVertexArray.emplace(g,c,h);this.maxValue=Math.max(this.maxValue,Math.abs(c),Math.abs(h))}}upload(r){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=r.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(r,n,c,h,m){const g=this.useIntegerZoom?Math.floor(c.zoom):c.zoom,x=J(this.expression.interpolationFactor(g,this.context.zoom,this.context.zoom+1),0,1);n.set(r,m,x)}getBinding(r,n){return new Vn(r)}}class ma{constructor(r,n,c,h,m){this.expression=r,this.layerId=m,this.paintVertexAttributes=(c==="array"?$I:GI).members;for(let g=0;g<n.length;++g);this.paintVertexArray=new h,this.paintTransitionVertexArray=new hd}populatePaintArray(r,n,c,h){const m=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValues(m,r,n.patterns&&n.patterns[this.layerId],c)}updatePaintArray(r,n,c,h,m,g,x){this._setPaintValues(r,n,c.patterns&&c.patterns[this.layerId],g)}_setPaintValues(r,n,c,h){if(!h||!c)return;const m=h[c[0]],g=h[c[1]];if(m){if(m){const{tl:x,br:w,pixelRatio:E}=m;for(let I=r;I<n;I++)this.paintVertexArray.emplace(I,x[0],x[1],w[0],w[1],E)}if(g){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:x,br:w}=g;for(let E=r;E<n;E++)this.paintTransitionVertexArray.emplace(E,x[0],x[1],w[0],w[1])}}}upload(r){const n=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=r.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,n)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=r.createVertexBuffer(this.paintTransitionVertexArray,L0.members,n))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class ms{constructor(r,n,c=()=>!0){this.binders={},this._buffers=[],this.context=n;const h=[];for(const m in r.paint._values){const g=r.paint.get(m);if(m.endsWith("-use-theme")||!c(m)||!(g instanceof qu&&Um(g.property.specification)))continue;const x=ZI(m,r.type),w=g.value,E=g.property.specification.type,I=!!g.property.useIntegerZoom,A=m==="line-dasharray"||m.endsWith("pattern"),P=r.paint.get(`${m}-use-theme`),D=m==="line-dasharray"&&r.layout.get("line-cap").value.kind!=="constant"||P&&P.value.kind!=="constant";if(w.kind!=="constant"||D)if(w.kind==="source"||D||A){const O=xw(m,E,"source");this.binders[m]=A?new ma(w,x,E,O,r.id):new dc(w,x,E,O),h.push(`/a_${m}`)}else{const O=xw(m,E,"composite");this.binders[m]=new ja(w,x,E,I,n,O),h.push(`/z_${m}`)}else this.binders[m]=A?new yd(w.value,x):new Jf(w.value,x,E,n),h.push(`/u_${m}`);P&&(this.binders[m].lutExpression=P.value)}this.cacheKey=h.sort().join("")}getMaxValue(r){const n=this.binders[r];return n instanceof dc||n instanceof ja?n.maxValue:0}populatePaintArrays(r,n,c,h,m,g,x,w){for(const E in this.binders){const I=this.binders[E];I.context=this.context,(I instanceof dc||I instanceof ja||I instanceof ma)&&I.populatePaintArray(r,n,c,h,m,g,x,w)}}setConstantPatternPositions(r,n){for(const c in this.binders){const h=this.binders[c];h instanceof yd&&h.setConstantPatternPositions(r,n)}}getPatternTransitionVertexBuffer(r){const n=this.binders[r];return n instanceof ma?n.paintTransitionVertexBuffer:null}updatePaintArrays(r,n,c,h,m,g,x,w,E,I){let A=!1;const P=Object.keys(r),D=P.length!==0&&!w,O=D?P:n.uniqueIds;this.context.lut=m.lut;for(const V in this.binders){const j=this.binders[V];if(j.context=this.context,(j instanceof dc||j instanceof ja||j instanceof ma)&&j.expression&&j.expression.kind&&j.expression.kind!=="constant"&&(j.expression.isStateDependent===!0||j.expression.isLightConstant===!1)){const X=m.paint.get(V);j.expression=X.value;for(const oe of O){const ne=r[oe.toString()];n.eachPosition(oe,(ae,Ie,be)=>{const Te=h.feature(ae);j.updatePaintArray(Ie,be,Te,ne,g,x,E,I)})}if(!D)for(const oe of c.uniqueIds){const ne=r[oe.toString()];c.eachPosition(oe,(ae,Ie,be)=>{const Te=h.feature(ae);j.updatePaintArray(Ie,be,Te,ne,g,x,E,I)})}A=!0}}return A}defines(){const r=[];for(const n in this.binders){const c=this.binders[n];(c instanceof Jf||c instanceof yd)&&r.push(...c.uniformNames.map(h=>`#define HAS_UNIFORM_${h}`))}return r}getBinderAttributes(){const r=[];for(const n in this.binders){const c=this.binders[n];if(c instanceof dc||c instanceof ja||c instanceof ma)for(let h=0;h<c.paintVertexAttributes.length;h++)r.push(c.paintVertexAttributes[h].name);if(c instanceof ma)for(let h=0;h<L0.members.length;h++)r.push(L0.members[h].name)}return r}getBinderUniforms(){const r=[];for(const n in this.binders){const c=this.binders[n];if(c instanceof Jf||c instanceof yd||c instanceof ja)for(const h of c.uniformNames)r.push(h)}return r}getPaintVertexBuffers(){return this._buffers}getUniforms(r){const n=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Jf||h instanceof yd||h instanceof ja)for(const m of h.uniformNames)n.push({name:m,property:c,binding:h.getBinding(r,m)})}return n}setUniforms(r,n,c,h,m){for(const{name:g,property:x,binding:w}of c)this.binders[x].setUniform(r,w,m,h.get(x),g)}updatePaintBuffers(){this._buffers=[];for(const r in this.binders){const n=this.binders[r];(n instanceof dc||n instanceof ja||n instanceof ma)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer),n instanceof ma&&n.paintTransitionVertexBuffer&&this._buffers.push(n.paintTransitionVertexBuffer)}}upload(r){for(const n in this.binders){const c=this.binders[n];(c instanceof dc||c instanceof ja||c instanceof ma)&&c.upload(r)}this.updatePaintBuffers()}destroy(){for(const r in this.binders){const n=this.binders[r];(n instanceof dc||n instanceof ja||n instanceof ma)&&n.destroy()}}}class ga{constructor(r,n,c=()=>!0){this.programConfigurations={};for(const h of r)this.programConfigurations[h.id]=new ms(h,n,c);this.needsUpload=!1,this._featureMap=new Wf,this._featureMapWithoutIds=new Wf,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(r,n,c,h,m,g,x,w,E){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(r,n,h,m,g,x,w,E);n.id!==void 0?this._featureMap.add(n.id,c,this._bufferOffset,r):(this._featureMapWithoutIds.add(this._idlessCounter,c,this._bufferOffset,r),this._idlessCounter+=1),this._bufferOffset=r,this.needsUpload=!0}updatePaintArrays(r,n,c,h,m,g,x,w){for(const E of c)this.needsUpload=this.programConfigurations[E.id].updatePaintArrays(r,this._featureMap,this._featureMapWithoutIds,n,E,h,m,g,x||0,w)||this.needsUpload}get(r){return this.programConfigurations[r]}upload(r){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(r);this.needsUpload=!1}}destroy(){for(const r in this.programConfigurations)this.programConfigurations[r].destroy()}}const qI={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
59pwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function ZI(a,r){return qI[a]||[a.replace(`${r}-`,"").replace(/-/g,"_")]}const WI={"line-pattern":{source:tu,composite:tu},"fill-pattern":{source:tu,composite:tu},"fill-extrusion-pattern":{source:tu,composite:tu},"line-dasharray":{source:hd,composite:hd}},XI={color:{source:iu,composite:ru},number:{source:Zu,composite:iu}};function xw(a,r,n){const c=WI[a];return c&&c[n]||XI[r][n]}Jt(Jf,"ConstantBinder"),Jt(yd,"PatternConstantBinder"),Jt(dc,"SourceExpressionBinder"),Jt(ma,"PatternCompositeBinder"),Jt(ja,"CompositeExpressionBinder"),Jt(ms,"ProgramConfiguration",{omit:["_buffers"]}),Jt(ga,"ProgramConfigurationSet");const es=Vt/Math.PI/2,bw=5,d=6,i=16383,l=64,f=[l,32,16],_=-es,v=es;function b(a,r,n,c=es){return n=ai(n),[a*Math.sin(n)*c,-r*c,a*Math.cos(n)*c]}function S(a,r,n){return b(Math.cos(ai(a)),Math.sin(ai(a)),r,n)}const C=63710088e-1,k=2*Math.PI*C;class R{constructor(r,n){if(isNaN(r)||isNaN(n))throw new Error(`Invalid LngLat object: (${r}, ${n})`);if(this.lng=+r,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new R(Ce(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(r){const n=Math.PI/180,c=this.lat*n,h=r.lat*n,m=Math.sin(c)*Math.sin(h)+Math.cos(c)*Math.cos(h)*Math.cos((r.lng-this.lng)*n);return C*Math.acos(Math.min(m,1))}toBounds(r=0){const n=360*r/40075017,c=n/Math.cos(Math.PI/180*this.lat);return new F({lng:this.lng-c,lat:this.lat-n},{lng:this.lng+c,lat:this.lat+n})}toEcef(r){return S(this.lat,this.lng,es+r*es/C)}static convert(r){if(r instanceof R)return r;if(Array.isArray(r)&&(r.length===2||r.length===3))return new R(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&typeof r=="object"&&r!==null)return new R(Number("lng"in r?r.lng:r.lon),Number(r.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class F{constructor(r,n){if(r)if(n)this.setSouthWest(r).setNorthEast(n);else if(r.length===4){const c=r;this.setSouthWest([c[0],c[1]]).setNorthEast([c[2],c[3]])}else{const c=r;this.setSouthWest(c[0]).setNorthEast(c[1])}}setNorthEast(r){return this._ne=r instanceof R?new R(r.lng,r.lat):R.convert(r),this}setSouthWest(r){return this._sw=r instanceof R?new R(r.lng,r.lat):R.convert(r),this}extend(r){const n=this._sw,c=this._ne;let h,m;if(r instanceof R)h=r,m=r;else{if(!(r instanceof F))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(F.convert(r)):this.extend(R.convert(r)):typeof r=="object"&&r!==null&&r.hasOwnProperty("lat")&&(r.hasOwnProperty("lon")||r.hasOwnProperty("lng"))?this.extend(R.convert(r)):this;if(h=r._sw,m=r._ne,!h||!m)return this}return n||c?(n.lng=Math.min(h.lng,n.lng),n.lat=Math.min(h.lat,n.lat),c.lng=Math.max(m.lng,c.lng),c.lat=Math.max(m.lat,c.lat)):(this._sw=new R(h.lng,h.lat),this._ne=new R(m.lng,m.lat)),this}getCenter(){return new R((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new R(this.getWest(),this.getNorth())}getSouthEast(){return new R(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(r){const{lng:n,lat:c}=R.convert(r);let h=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(h=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=c&&c<=this._ne.lat&&h}static convert(r){if(r)return r instanceof F?r:new F(r)}}const z=0,N=25.5;function G(a){return k*Math.cos(a*Math.PI/180)}function U(a){return(180+a)/360}function W(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function Z(a,r){return a/G(r)}function re(a){return 360*a-180}function se(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180)
vendor: 4,106 bytes, line 59
59)-90}function le(a,r){return a*G(se(r))}const fe=85.051129;function we(a){return Math.cos(ai(J(a,-fe,fe)))}function Se(a,r){const n=J(r,z,N),c=Math.pow(2,n);return we(a)*k/(512*c)}function me(a){return 1/Math.cos(a*Math.PI/180)}function ge(a,r=0){const n=Math.exp(Math.PI*(1-(a.y+r/Vt)/(1<<a.z)*2));return 80150034*n/(n*n+1)/Vt/(1<<a.z)}class ye{constructor(r,n,c=0){this.x=+r,this.y=+n,this.z=+c}static fromLngLat(r,n=0){const c=R.convert(r);return new ye(U(c.lng),W(c.lat),Z(n,c.lat))}toLngLat(){return new R(re(this.x),se(this.y))}toAltitude(){return le(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/k*me(se(this.y))}}function Ze(a,r,n,c,h,m,g,x,w){const E=(r+c)/2,I=(n+h)/2,A=new Tt(E,I);x(A),function(P,D,O,V,j,X){const oe=O-j,ne=V-X;return Math.abs((V-D)*oe-(O-P)*ne)/Math.hypot(oe,ne)}(A.x,A.y,m.x,m.y,g.x,g.y)>=w?(Ze(a,r,n,E,I,m,A,x,w),Ze(a,E,I,c,h,A,g,x,w)):a.push(g)}function Me(a,r,n){let c=a[0],h=c.x,m=c.y;r(c);const g=[c];for(let x=1;x<a.length;x++){const w=a[x],{x:E,y:I}=w;r(w),Ze(g,h,m,E,I,c,w,r,n),h=E,m=I,c=w}return g}function ct(a,r,n,c){if(c(r,n)){const h=r.add(n)._mult(.5);ct(a,r,h,c),ct(a,h,n,c)}else a.push(n)}function Qe(a,r){let n=a[0];const c=[n];for(let h=1;h<a.length;h++){const m=a[h];ct(c,n,m,r),n=m}return c}const ft=Math.pow(2,14)-1,Rt=-ft-1;function We(a,r){const n=Math.round(a.x*r),c=Math.round(a.y*r);return a.x=J(n,Rt,ft),a.y=J(c,Rt,ft),(n<a.x||n>a.x+1||c<a.y||c>a.y+1)&&Ar("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a}function Pe(a,r,n){const c=a.loadGeometry(),h=a.extent,m=Vt/h;if(r&&n&&n.projection.isReprojectedInTileSpace){const g=1<<r.z,{scale:x,x:w,y:E,projection:I}=n,A=P=>{const D=re((r.x+P.x/h)/g),O=se((r.y+P.y/h)/g),V=I.project(D,O);P.x=(V.x*x-w)*h,P.y=(V.y*x-E)*h};for(let P=0;P<c.length;P++)if(a.type!==1)c[P]=Me(c[P],A,1);else{const D=[];for(const O of c[P])O.x<0||O.x>=h||O.y<0||O.y>=h||(A(O),D.push(O));c[P]=D}}for(const g of c)for(const x of g)We(x,m);return c}function nt(a,r){return{type:a.type,id:a.id,properties:a.properties,geometry:r?Pe(a):[]}}class Ke{constructor(r,n,c,h,m){this.properties={},this.extent=c,this.type=0,this.id=void 0,this._pbf=r,this._geometry=-1,this._keys=h,this._values=m,r.readFields(vt,this,n)}loadGeometry(){const r=this._pbf;r.pos=this._geometry;const n=r.readVarint()+r.pos,c=[];let h,m=1,g=0,x=0,w=0;for(;r.pos<n;){if(g<=0){const E=r.readVarint();m=7&E,g=E>>3}if(g--,m===1||m===2)x+=r.readSVarint(),w+=r.readSVarint(),m===1&&(h&&c.push(h),h=[]),h&&h.push(new Tt(x,w));else{if(m!==7)throw new Error(`unknown command ${m}`);h&&h.push(h[0].clone())}}return h&&c.push(h),c}bbox(){const r=this._pbf;r.pos=this._geometry;const n=r.readVarint()+r.pos;let c=1,h=0,m=0,g=0,x=1/0,w=-1/0,E=1/0,I=-1/0;for(;r.pos<n;){if(h<=0){const A=r.readVarint();c=7&A,h=A>>3}if(h--,c===1||c===2)m+=r.readSVarint(),g+=r.readSVarint(),m<x&&(x=m),m>w&&(w=m),g<E&&(E=g),g>I&&(I=g);else if(c!==7)throw new Error(`unknown command ${c}`)}return[x,E,w,I]}toGeoJSON(r,n,c){const h=this.extent*Math.pow(2,c),m=this.extent*r,g=this.extent*n,x=this.loadGeometry();function w(P){return[360*(P.x+m)/h-180,360/Math.PI*Math.atan(Math.exp((1-2*(P.y+g)/h)*Math.PI))-90]}function E(P){return P.map(w)}let I;if(this.type===1){const P=[];for(const O of x)P.push(O[0]);const D=E(P);I=P.length===1?{type:"Point",coordinates:D[0]}:{type:"MultiPoint",coordinates:D}}else if(this.type===2){const P=x.map(E);I=P.length===1?{type:"LineString",coordinates:P[0]}:{type:"MultiLineString",coordinates:P}}else{if(this.type!==3)throw new Error("unknown feature type");{const P=function(O){const V=O.length;if(V<=1)return[O];const j=[];let X,oe;for(let ne=0;ne<V;ne++){const ae=xt(O[ne]);ae!==0&&(oe===void 0&&(oe=ae<0),oe===ae<0?(X&&j.push(X),X=[O[ne]]):X&&X.push(O[ne]))}return X&&j.push(X),j}(x),D=[];for(const O of P)D.push(O.map(E));I=D.length===1?{type:"Polygon",coordinates:D[0]}:{type:"MultiPolygon",coordinates:D}}}const A={type:"Feature",geometry:I,properties:this.properties};return this.id!=null&&(A.id=this.id),A}}function vt(a,r,n){a===1?r.id=n.readVarint():a===2?function(c,h){const m=c.readVarint()+c.pos;for(;c.pos<m;
59){const g=h._keys[c.readVarint()],x=h._values[c.readVarint()];h.properties[g]=x}}(n,r):a===3?r.type=n.readVarint():a===4&&(r._geometry=n.pos)}function xt(a){let r=0;for(let n,c,h=0,m=a.length,g=m-1;h<m;g=h++)n=a[h],c=a[g],r+=(c.x-n.x)*(n.y+c.y);return r}Ke.types=["Unknown","Point","LineString","Polygon"];class Et{constructor(r,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(Bt,this,n),this.length=this._features.length}feature(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];const n=this._pbf.readVarint()+this._pbf.pos;return new Ke(this._pbf,n,this.extent,this._keys,this._values)}}function Bt(a,r,n){a===15?r.version=n.readVarint():a===1?r.name=n.readString():a===5?r.extent=n.readVarint():a===2?r._features.push(n.pos):a===3?r._keys.push(n.readString()):a===4&&r._values.push(function(c){let h=null;const m=c.readVarint()+c.pos;for(;c.pos<m;){const g=c.readVarint()>>3;h=g===1?c.readString():g===2?c.readFloat():g===3?c.readDouble():g===4?c.readVarint64():g===5?c.readVarint():g===6?c.readSVarint():g===7?c.readBoolean():null}if(h==null)throw new Error("unknown feature value");return h}(n))}class ir{constructor(r,n){this.layers=r.readFields(ur,{},n)}}function ur(a,r,n){if(a===3){const c=new Et(n,n.readVarint()+n.pos);c.length&&(r[c.name]=c)}}const Zt="3d_elevation_id",ar="level";class or{constructor(){this._valid=!1}reset(r){return this.feature=r,this._valid=!0,this._geometry=r.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(r,n){return this._valid&&r(n(this._geometry)),this}require(r,n,c){return this.get(r,!0,n,c)}optional(r,n,c){return this.get(r,!1,n,c)}success(){return this._valid}get(r,n,c,h){const m=this.feature.properties.hasOwnProperty(r)?+this.feature.properties[r]:void 0;return this._valid&&m!==void 0&&!Number.isNaN(m)?c(h?h(m):m):n&&(this._valid=!1),this}}class Pr{constructor(r,n){this.featureFunc=r,this.vertexFunc=n}parseFeature(r,n,c){return this.featureFunc(r,n,c)}parseVertex(r,n,c){return this.vertexFunc(r,n,c)}}const zr=new Pr((a,r,n)=>a.reset(r).require(Zt,c=>{n.id=c}).optional("fixed_height_relative",c=>{n.constantHeight=c},pi.decodeRelativeHeight).geometry(c=>{n.bounds=c},Ry).success(),(a,r,n)=>a.reset(r).require(Zt,c=>{n.id=c}).require("elevation_idx",c=>{n.idx=c}).require("extent",c=>{n.extent=c}).require("height_relative",c=>{n.height=c},pi.decodeRelativeHeight).geometry(c=>{n.position=c},pi.getPoint).success()),qr=new Pr((a,r,n)=>a.reset(r).require(Zt,c=>{n.id=c}).optional("fixed_height",c=>{n.constantHeight=c},pi.decodeMetricHeight).geometry(c=>{n.bounds=c},Ry).success(),(a,r,n)=>a.reset(r).require(Zt,c=>{n.id=c}).require("elevation_idx",c=>{n.idx=c}).require("extent",c=>{n.extent=c}).require("height",c=>{n.height=c},pi.decodeMetricHeight).geometry(c=>{n.position=c},pi.getPoint).success());class pi{static getPoint(r){return Yr(r[0][0].x,r[0][0].y)}static decodeRelativeHeight(r){return 1e-4*r*5}static decodeMetricHeight(r){return 1e-4*r}static parse(r){const n=[],c=[],h=r.length,m=new or;for(let x=0;x<h;x++){const w=r.feature(x),E=w.properties.version,I=(g=E)?g==="1.0.1"?qr:void 0:zr;if(I===void 0){Ar(`Unknown elevation feature version number ${E||"(unknown)"}`);continue}const A=w.properties.hasOwnProperty("type")?w.properties.type:void 0;if(A){if(Ke.types[w.type]==="Point"&&A==="curve_point"){const P={};I.parseVertex(m,w,P)&&n.push(P)}else if(Ke.types[w.type]==="Polygon"&&A==="curve_meta"){const P={};I.parseFeature(m,w,P)&&c.push(P)}}}var g;return{vertices:n,features:c}}}class kr{constructor(r,n){this.pos=r,this.dir=n}intersectsPlane(r,n,c){const h=Fi(n,this.dir);if(Math.abs(h)<1e-6)return!1;const m=((r[0]-this.pos[0])*n[0]+(r[1]-this.pos[1])*n[1])/h;return c[0]=this.pos[0]+this.dir[0]*m,c[1]=this.pos[1]+this.dir[1]*m,!0}}class mi{constructor(r,n){this.pos=r,this.dir=n}intersectsPlane(r,n,c){const h=Ur(n,this.dir);if(Math.abs(h)<1e-6)return!1;const m=((r[0]-this.pos[0])*n[0]+(r[1]-this.pos[1])*n[1]+(r[2]-this.pos[2])*n[2])/h;return c[0]=this.pos[0]+this.dir[0]*m,c[1]=this.pos[1]+this.dir[1]*m,c[2]=this.pos[2]+this.dir[2]*m,!0}closestPointOnSphere(r,n,c){if(function(D,O){var V=D[0],j=D[1],X=D[2],oe=O[0],ne=O[1],ae=O[2];return Math.abs(V-oe)<=M*Math.max(1,Math.abs(V),Math.abs(oe))&&Math.abs(j-ne)<=M*Math.max(1,Math.abs(j),Math.abs(ne))&&Math.abs(X-ae)<=M*Math.max(1,Math.abs(X),Math.abs(ae))}(this.pos,r)||n===0)return c[0]=c[1]=c[2]=0,!1;const[h,m,g]=this.dir,x=this.pos[0]-r[0],w=this.pos[1]-r[1],E=this.pos[2]-r[2],I=h*h+m*m+g*g,A=2*(x*h+w*m+E*g),P=A*A-4*I*(x*x+w*w+E*E-n*n);if(P<0){const D=Math.max(-A/2,0),O=x+h*D,V=w+m*D,j=E+g*D,X=Math.hypot(O,V,j);return c[0]=O*n/X,c[1]=V*n/X,c[2]=j*n/X,!1}{const D=(-A-Math.sqrt(P))/(2*I);if(D<0){const O=Math.hypot(x,w,E);return c[0]=x*n/O,c[1]=w*n/O,c[2]=E*n/O,!1}return c[0]=x+h*D,c[1]=w+m*D,c[2]=E+g*D,!0}}}class xi{constructor(r,n,c,h,m){this.TL=r,this.TR=n,this.BR=c,this.BL=h,this.horizon=m}static fromInvProjectionMatrix(r,n,c){const h=[-1,1,1],m=[1,1,1],g=[1,-1,1],x=[-1,-1,1],w=sn(h,h,r),E=sn(m,m,r),I=sn(g,g,r),A=sn(x,x,r);return new xi(w,E,I,A,n/c)}}
59function Zi(a,r,n){let c=1/0,h=-1/0;const m=[];for(const g of a){Xr(m,g,r);const x=Ur(m,n);c=Math.min(c,x),h=Math.max(h,x)}return[c,h]}function $r(a,r){let n=!0;for(let c=0;c<a.planes.length;c++){const h=a.planes[c];let m=0;for(let g=0;g<r.length;g++)m+=Ur(h,r[g])+h[3]>=0;if(m===0)return 0;m!==r.length&&(n=!1)}return n?2:1}function gi(a,r){for(const n of a.projections){const c=Zi(r,a.points[0],n.axis);if(n.projection[1]<c[0]||n.projection[0]>c[1])return 0}return 1}function vi(a,r){let n=0;const c=[0,0,0,0];for(let g=0;g<a.length;g++)c[0]=a[g][0],c[1]=a[g][1],c[2]=a[g][2],c[3]=1,(h=c)[0]*(m=r)[0]+h[1]*m[1]+h[2]*m[2]+h[3]*m[3]>=0&&n++;var h,m;return n}class Si{constructor(r,n){this.points=r||new Array(8).fill([0,0,0]),this.planes=n||new Array(6).fill([0,0,0,0]),this.bounds=Zr.fromPoints(this.points),this.projections=[],this.frustumEdges=[Xr([],this.points[2],this.points[3]),Xr([],this.points[0],this.points[3]),Xr([],this.points[4],this.points[0]),Xr([],this.points[5],this.points[1]),Xr([],this.points[6],this.points[2]),Xr([],this.points[7],this.points[3])];for(const c of this.frustumEdges){const h=[0,-c[2],c[1]],m=[c[2],0,-c[0]];this.projections.push({axis:h,projection:Zi(this.points,this.points[0],h)}),this.projections.push({axis:m,projection:Zi(this.points,this.points[0],m)})}}static fromInvProjectionMatrix(r,n,c,h){const m=Math.pow(2,c),g=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(E=>{const I=Uo([],E,r),A=1/I[3]/n*m;return(P=I)[0]=(D=I)[0]*(O=[A,A,h?1/I[3]:A,A])[0],P[1]=D[1]*O[1],P[2]=D[2]*O[2],P[3]=D[3]*O[3],P;var P,D,O}),x=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const I=fr([],qi([],Xr([],g[E[0]],g[E[1]]),Xr([],g[E[2]],g[E[1]]))),A=-Ur(I,g[E[1]]);return I.concat(A)}),w=[];for(let E=0;E<g.length;E++)w.push([g[E][0],g[E][1],g[E][2]]);return new Si(w,x)}intersectsPrecise(r,n,c){for(let h=0;h<n.length;h++)if(!vi(r,n[h]))return 0;for(let h=0;h<this.planes.length;h++)if(!vi(r,this.planes[h]))return 0;for(const h of c)for(const m of this.frustumEdges){const g=qi([],h,m),x=Fe(g);if(x===0)continue;jt(g,g,1/x);const w=Zi(this.points,this.points[0],g),E=Zi(r,this.points[0],g);if(w[0]>E[1]||E[0]>w[1])return 0}return 1}containsPoint(r){for(const n of this.planes){const c=n[3];if(Ur([n[0],n[1],n[2]],r)+c<0)return!1}return!0}}class Zr{static fromPoints(r){const n=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];for(const h of r)rt(n,n,h),Nt(c,c,h);return new Zr(n,c)}static fromTileIdAndHeight(r,n,c){const h=1<<r.canonical.z,m=r.canonical.x,g=r.canonical.y;return new Zr([m/h,g/h,n],[(m+1)/h,(g+1)/h,c])}static applyTransform(r,n){const c=r.getCorners();for(let h=0;h<c.length;++h)sn(c[h],c[h],n);return Zr.fromPoints(c)}static applyTransformFast(r,n){const c=[n[12],n[13],n[14]],h=[...c];for(let m=0;m<3;m++)for(let g=0;g<3;g++){const x=n[4*g+m],w=x*r.min[g],E=x*r.max[g];c[m]+=Math.min(w,E),h[m]+=Math.max(w,E)}return new Zr(c,h)}static projectAabbCorners(r,n){const c=r.getCorners();for(let h=0;h<c.length;++h)sn(c[h],c[h],n);return c}constructor(r,n){this.min=r,this.max=n,this.center=jt([],He([],this.min,this.max),.5)}quadrant(r){const n=[r%2==0,r<2],c=Be(this.min),h=Be(this.max);for(let m=0;m<n.length;m++)c[m]=n[m]?this.min[m]:this.center[m],h[m]=n[m]?this.center[m]:this.max[m];return h[2]=this.max[2],new Zr(c,h)}distanceX(r){return Math.max(Math.min(this.max[0],r[0]),this.min[0])-r[0]}distanceY(r){return Math.max(Math.min(this.max[1],r[1]),this.min[1])-r[1]}distanceZ(r){return Math.max(Math.min(this.max[2],r[2]),this.min[2])-r[2]}getCorners(){const r=this.min,n=this.max;return[[r[0],r[1],r[2]],[n[0],r[1],r[2]],[n[0],n[1],r[2]],[r[0],n[1],r[2]],[r[0],r[1],n[2]],[n[0],r[1],n[2]],[n[0],n[1],n[2]],[r[0],n[1],n[2]]]}intersects(r){return this.intersectsAabb(r.bounds)?$r(r,this.getCorners()):0}intersectsFlat(r){return this.intersectsAabb(r.bounds)?$r(r,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(r,n){return n||this.intersects(r)?gi(r,this.getCorners()):0}intersectsPreciseFlat(r,n){return n||this.intersectsFlat(r)?gi(r,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(r){for(let n=0;n<3;++n)if(this.min[n]>r.max[n]||r.min[n]>this.max[n])return!1;return!0}intersectsAabbXY(r){return!(this.min[0]>r.max[0]||r.min[0]>this.max[0]||this.min[1]>r.max[1]||r.min[1]>this.max[1])}encapsulate(r){for(let n=0;n<3;n++)this.min[n]=Math.min(this.min[n],r.min[n]),this.max[n]=Math.max(this.max[n],r.max[n])}encapsulatePoint(r){for(let n=0;n<3;n++)this.min[n]=Math.min(this.min[n],r[n]),this.max[n]=Math.max(this.max[n],r[n])}closestPoint(r){return[Math.max(Math.min(this.max[0],r[0]),this.min[0]),Math.max(Math.min(this.max[1],r[1]),this.min[1]),Math.max(Math.min(this.max[2],r[2]),this.min[2])]}}Jt(Zr,"Aabb");class Di{constructor(r,n){this.feature=r,this.metersToTile=n,this.index=0}get(){const r=this.feature.vertices[this.index],n=this.feature.vertexProps[this.index].dir,c=n[1],h=-n[0],m=(r.extent+1)*this.metersToTile;return[new Tt(Math.trunc(r.position[0]+c*m),Math.trunc(r.position[1]+h*m)),new Tt(Math.trunc(r.position[0]-c*m),Math.trunc(r.position[1]-h*m))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class bi{constructor(r,n,c,h,m,g){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=r,this.heightRange={min:c,max:c},this.safeArea=n,this.constantHeight=c,this.constantHeight==null&&(this.constantHeight!=null||h.length!==0)){this.vertices=h,this.edges=m,this.edges=this.edges.filter(x=>{return x.a<this.vertices.length&&x.b<this.vertices.length&&!((w=this.vertices[x.a].position)[0]===(E=this.vertices[x.b].position)[0]&&w[1]===E[1]);var w,E}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const x of this.vertices)this.vertexProps.push({dir:Yr(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,x.height),this.heightRange.max=Math.max(this.heightRange.max,x.height);for(const x of this.edges){const w=this.vertices[x.a].position,E=this.vertices[x.b].position,I=Rn(wr(),E,w),A=lo(I),P=An(wr(),I,1/A);this.edgeProps.push({vec:I,dir:P,len:A});const D=this.vertexProps[x.a].dir,O=this.vertexProps[x.b].dir;yi(D,D,P),yi(O,O,P)}for(const x of this.vertexProps)x.dir[0]===0&&x.dir[1]===0||Yo(x.dir,x.dir);this.tessellate(g)}}pointElevation(r){if(this.constantHeight!=null)return this.constantHeight;const n=this.getClosestEdge(r);if(n==null)return 0;const[c,h]=n;return _r(this.vertices[this.edges[c].a].height,this.vertices[this.edges[c].b].height,h)}computeSlopeNormal(r,n){const c=this.getClosestEdge(r);if(!c)return Je(0,0,1);const h=c[0],m=this.edges[h],g=this.edgeProps[h].vec,x=Je(g[0],g[1],(this.vertices[m.b].height-this.vertices[m.a].height)*n),w=Je(x[1],-x[0],0);qi(w,w,x);const E=Fe(w);return E>0?jt(w,w,1/E):Je(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(r){if(this.edges.length===0)return;let n=0,c=Number.POSITIVE_INFINITY,h=0;const m=Yr(r.x,r.y);for(let g=0;g<this.edges.length;g++){const x=this.edges[g],w=this.edgeProps[g].dir,E=new kr(m,this.edgeProps[g].dir),I=this.vertices[x.a].position,A=this.vertices[x.b].position,P=wr(),D=wr(),O=E.intersectsPlane(I,this.vertexProps[x.a].dir,P),V=E.intersectsPlane(A,this.vertexProps[x.b].dir,D);if(!O||!V)continue;const j=Rn(wr(),D,P),X=Rn(wr(),m,P),oe=Fi(j,j),ne=oe>0?Fi(X,j)/oe:0,ae=J(ne,0,1),Ie=Math.abs((ne-ae)*this.edgeProps[g].len),be=Rn(wr(),m,I),Te=Ie+Math.abs(Fi(be,Yr(w[1],-w[0])));Te<c&&(n=g,c=Te,h=ae)}return[n,h]}tessellate(r){for(let n=this.edges.length-1;n>=0;--n){const c=this.edges[n].a,h=this.edges[n].b,{position:m,height:g,extent:x}=this.vertices[c],{position:w,height:E,extent:I}=this.vertices[h],A=this.vertexProps[c].dir,P=this.vertexProps[h].dir,D=Je(m[0]/r,m[1]/r,g),O=Je(w[0]/r,w[1]/r,E),V=Je(A[1],-A[0],0
59);jt(V,V,x);const j=Je(P[1],-P[0],0);if(jt(j,j,I),this.distSqLines(Je(D[0]+.5*V[0],D[1]+.5*V[1],D[2]+.5*V[2]),Je(O[0]-.5*j[0],O[1]-.5*j[1],O[2]-.5*j[2]),Je(D[0]-.5*V[0],D[1]-.5*V[1],D[2]-.5*V[2]),Je(O[0]+.5*j[0],O[1]+.5*j[1],O[2]+.5*j[2]))<=.0025000000000000005)continue;const X=this.vertices.length,oe=yi(wr(),m,w);this.vertices.push({position:An(oe,oe,.5),height:.5*(g+E),extent:.5*(x+I)});const ne=yi(wr(),A,P);this.vertexProps.push({dir:Yo(ne,ne)}),this.edges.splice(n,1),this.edgeProps.splice(n,1),this.edges.push({a:c,b:X}),this.edges.push({a:X,b:h});const ae=Rn(wr(),this.vertices[X].position,m),Ie=lo(ae),be={vec:ae,dir:An(wr(),ae,1/Ie),len:Ie};this.edgeProps.push(be),this.edgeProps.push(be)}}distSqLines(r,n,c,h){const m=tt(Ye(),n,r),g=tt(Ye(),h,c),x=tt(Ye(),r,c),w=Ur(m,m),E=Ur(m,g),I=Ur(m,x),A=Ur(g,g),P=Ur(g,x),D=w*A-E*E;if(D===0){const j=Ur(x,g)/Ur(g,g);return li(zn(Ye(),c,h,j),r)}const O=(E*P-I*A)/D,V=(w*P-E*I)/D;return li(zn(Ye(),r,n,O),zn(Ye(),c,h,V))}}class bn{static parseFrom(r,n){const c=pi.parse(r);if(!c)return[];let{vertices:h,features:m}=c;const g=1/ge(n);m.sort((I,A)=>I.id-A.id),h.sort((I,A)=>I.id-A.id||I.idx-A.idx),h=h.filter((I,A,P)=>A===P.findIndex(D=>D.id===I.id&&D.idx===I.idx));const x=new Array;let w=0;const E=h.length;for(const I of m){if(I.constantHeight){x.push(new bi(I.id,I.bounds,I.constantHeight));continue}for(;w!==E&&h[w].id<I.id;)w++;if(w===E||h[w].id!==I.id)continue;const A=new Array,P=new Array,D=w;for(;w!==E&&h[w].id===I.id;){const O=h[w];if(A.push({position:O.position,height:O.height,extent:O.extent}),w!==D&&h[w-1].idx===O.idx-1){const V=w-D;P.push({a:V-1,b:V})}w++}x.push(new bi(I.id,I.bounds,void 0,A,P,g))}return x}static getElevationFeature(r,n){if(!n)return;const c=+r.properties[Zt];return Number.isNaN(c)?void 0:n.find(h=>h.id===c)}}class hi{constructor(r,n){this.zScale=1,this.xOffset=0,this.yOffset=0,r.equals(n)||(this.zScale=Math.pow(2,n.z-r.z),this.xOffset=(r.x*this.zScale-n.x)*Vt,this.yOffset=(r.y*this.zScale-n.y)*Vt)}constantElevation(r,n){if(r.constantHeight!=null)return this.computeBiasedHeight(r.constantHeight,n)}pointElevation(r,n,c){const h=this.constantElevation(n,c);return h??(r.x=r.x*this.zScale+this.xOffset,r.y=r.y*this.zScale+this.yOffset,this.computeBiasedHeight(n.pointElevation(r),c))}computeBiasedHeight(r,n){return n<=0?r:r+n*ce(0,n,r>=0?r:Math.abs(.5*r))}}Jt(bi,"ElevationFeature");class Ci{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(n=>n.fqid),this.index=r.index,this.hasPattern=!1,this.projection=r.projection,this.layoutVertexArray=new Ps,this.indexArray=new gn,this.segments=new xn,this.programConfigurations=new ga(r.layers,{zoom:r.zoom,lut:r.lut}),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Zu),this.worldview=r.worldview}updateFootprints(r,n){}populate(r,n,c,h){const m=this.layers[0],g=[];let x=null;m.type==="circle"&&(x=m.layout.get("circle-sort-key"));for(const{feature:E,id:I,index:A,sourceLayerIndex:P}of r){const D=this.layers[0]._featureFilter.needGeometry,O=nt(E,D);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom,{worldview:this.worldview}),O,c))continue;const V=x?x.evaluate(O,{},c):void 0,j={id:I,properties:E.properties,type:E.type,sourceLayerIndex:P,index:A,geometry:D?O.geometry:Pe(E,c,h),patterns:{},sortKey:V};g.push(j)}x&&g.sort((E,I)=>E.sortKey-I.sortKey);let w=null;h.projection.name==="globe"&&(this.globeExtVertexArray=new tg,w=h.projection);for(const E of g){const{geometry:I,index:A,sourceLayerIndex:P}=E,D=r[A].feature;this.addFeature(E,I,A,n.availableImages,c,w,n.brightness,n.elevationFeatures),n.featureIndex.insert(D,I,A,P,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(r,n,c,h,m,g,x){this.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,gw.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,jI.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=r.createVertexBuffer(this.elevatedLayoutVertexArray,UI.members))),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}
59addFeature(r,n,c,h,m,g,x,w){let E;this.elevationMode!=="none"&&(E=bn.getElevationFeature(r,w));for(const I of n)for(const A of I){const P=A.x,D=A.y;if(P<0||P>=Vt||D<0||D>=Vt)continue;if(g){const j=g.projectTilePoint(P,D,m),X=g.upVector(m,P,D);this.addGlobeExtVertex(j,X),this.addGlobeExtVertex(j,X),this.addGlobeExtVertex(j,X),this.addGlobeExtVertex(j,X)}const O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,r.sortKey),V=O.vertexLength;if(this.addCircleVertex(P,D,-1,-1),this.addCircleVertex(P,D,1,-1),this.addCircleVertex(P,D,1,1),this.addCircleVertex(P,D,-1,1),this.elevationMode!=="none"){const j=E?E.pointElevation(new Tt(P,D)):0;this.hasElevation=this.hasElevation||j!==0;for(let X=0;X<4;X++)this.elevatedLayoutVertexArray.emplaceBack(j)}this.indexArray.emplaceBack(V,V+1,V+2),this.indexArray.emplaceBack(V,V+2,V+3),O.vertexLength+=4,O.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,{},h,m,x,void 0,this.worldview)}addCircleVertex(r,n,c,h){this.layoutVertexArray.emplaceBack(2*r+(c+1)/2,2*n+(h+1)/2)}addGlobeExtVertex(r,n){this.globeExtVertexArray.emplaceBack(r.x,r.y,r.z,n[0]*16384,n[1]*16384,n[2]*16384)}}function Gi(a,r){for(let n=0;n<a.length;n++)if(Go(r,a[n]))return!0;for(let n=0;n<r.length;n++)if(Go(a,r[n]))return!0;return!!Io(a,r)}function Un(a,r,n){return!!Go(a,r)||!!jo(r,a,n)}function Nn(a,r){if(a.length===1)return Ga(r,a[0]);for(let n=0;n<r.length;n++){const c=r[n];for(let h=0;h<c.length;h++)if(Go(a,c[h]))return!0}for(let n=0;n<a.length;n++)if(Ga(r,a[n]))return!0;for(let n=0;n<r.length;n++)if(Io(a,r[n]))return!0;return!1}function jn(a,r,n){if(a.length>1){if(Io(a,r))return!0;for(let c=0;c<r.length;c++)if(jo(r[c],a,n))return!0}for(let c=0;c<a.length;c++)if(jo(a[c],r,n))return!0;return!1}function Io(a,r){if(a.length===0||r.length===0)return!1;for(let n=0;n<a.length-1;n++){const c=a[n],h=a[n+1];for(let m=0;m<r.length-1;m++)if(sl(c,h,r[m],r[m+1]))return!0}return!1}function sl(a,r,n,c){return ei(a,n,c)!==ei(r,n,c)&&ei(a,r,n)!==ei(a,r,c)}function gs(a,r,n){return(a.x-n.x)*(r.y-n.y)-(a.y-n.y)*(r.x-n.x)}function Zs(a,r,n,c){const h=gs(a,r,c),m=gs(a,r,n);if(Math.sign(h)===Math.sign(m))return;const g=gs(n,c,a),x=g+m-h;return Math.sign(g)!==Math.sign(x)?[g/(g-x),m/(m-h)]:void 0}function jo(a,r,n){const c=n*n;if(r.length===1)return a.distSqr(r[0])<c;for(let h=1;h<r.length;h++)if(_a(a,r[h-1],r[h])<c)return!0;return!1}function _a(a,r,n){const c=r.distSqr(n);if(c===0)return a.distSqr(r);const h=((a.x-r.x)*(n.x-r.x)+(a.y-r.y)*(n.y-r.y))/c;return a.distSqr(h<0?r:h>1?n:n.sub(r)._mult(h)._add(r))}function Ga(a,r){let n,c,h,m=!1;for(let g=0;g<a.length;g++){n=a[g];for(let x=0,w=n.length-1;x<n.length;w=x++)c=n[x],h=n[w],c.y>r.y!=h.y>r.y&&r.x<(h.x-c.x)*(r.y-c.y)/(h.y-c.y)+c.x&&(m=!m)}return m}function Go(a,r){let n=!1;for(let c=0,h=a.length-1;c<a.length;h=c++){const m=a[c],g=a[h];m.y>r.y!=g.y>r.y&&r.x<(g.x-m.x)*(r.y-m.y)/(g.y-m.y)+m.x&&(n=!n)}return n}function Dn(a,r,n,c,h){for(const g of a)if(r<=g.x&&n<=g.y&&c>=g.x&&h>=g.y)return!0;const m=[new Tt(r,n),new Tt(r,h),new Tt(c,h),new Tt(c,n)];if(a.length>2){for(const g of m)if(Go(a,g))return!0}for(let g=0;g<a.length-1;g++)if(Pn(a[g],a[g+1],m))return!0;return!1}function Pn(a,r,n){const c=n[0],h=n[2];if(a.x<c.x&&r.x<c.x||a.x>h.x&&r.x>h.x||a.y<c.y&&r.y<c.y||a.y>h.y&&r.y>h.y)return!1;const m=ei(a,r,n[0]);return m!==ei(a,r,n[1])||m!==ei(a,r,n[2])||m!==ei(a,r,n[3])}function Yi(a,r,n,c,h,m){let g=r.y-a.y,x=a.x-r.x;if(m=m||0){const w=g*g+x*x;if(w===0)return!0;const E=Math.sqrt(w);g/=E,x/=E}return!((n.x-a.x)*g+(n.y-a.y)*x-m<0||(c.x-a.x)*g+(c.y-a.y)*x-m<0||(h.x-a.x)*g+(h.y-a.y)*x-m<0)}function to(a,r,n,c,h,m,g){return!(Yi(a,r,c,h,m,g)||Yi(r,n,c,h,m,g)||Yi(n,a,c,h,m,g)||Yi(c,h,a,r,n,g)||Yi(h,m,a,r,n,g)||Yi(m,c,a,r,n,g))}function Ao(a,r,n){const c=r.paint.get(a).value;return c.kind==="constant"?c.value:n.programConfigurations.get(r.id).getMaxValue(a)}function On(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function ya(a,r,n,c,h){if(!r[0]&&!r[1])return a;const m=Tt.convert(r)._mult(h);n==="viewport"&&m._rotate(-c);const g=[];for(let x=0;x<a.length;x++)g.push(a[x].sub(m));return g}function Xu(a,r,n,c){const h=Tt.convert(a)._mult(c);return r==="viewport"&&h._rotate(-n),h}let nu,vd;function xd(a,r,n){var c=2*Math.PI*6378137/256/Math.pow(2,n);return[a*c-2*Math.PI*6378137/2,r*c-2*Math.PI*6378137/2]}Jt(Ci,"CircleBucket",{omit:["layers"]});class va{constructor(r,n,c){this.z=r,this.x=n,this.y=c,this.key=xa(0,r,r,n,c)}equals(r){return this.z===r.z&&this.x===r.x&&this.y===r.y}isChildOf(r){const n=this.z-r.z;return r.z===0||r.z<this.z&&r.x===this.x>>n&&r.y===this.y>>n}url(r,n){const c=function(m,g,x){var w=xd(256*m,256*(g=Math.pow(2,x)-g-1),x),E=xd(256*(m+1),256*(g+1),x);return w[0]+","+w[1]+","+E[0]+","+E[1]}(this.x,this.y,this.z),h=function(m,g,x){let w,E="";for(let I=m;I>0;I--)w=1<<I-1,E+=(g&w?1:0)+(x&w?2:0);return E}(this.z,this.x,this.y);return r[(this.x+this.y)%r.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",h).replace("{bbox-epsg-3857}",c)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Fl{constructor(r,n){this.wrap=r,this.canonical=n,this.key=xa(r,n.z,n.z,n.x,n.y)}}class ro{constructor(r,n,c,h,m){this.overscaledZ=r,this.wrap=n,this.canonical=new va(c,+h,
vendor: 5,412 bytes, line 59
59+m),this.key=n===0&&r===c?this.canonical.key:xa(n,r,c,h,m)}equals(r){return this.overscaledZ===r.overscaledZ&&this.wrap===r.wrap&&this.canonical.equals(r.canonical)}scaledTo(r){const n=this.canonical.z-r;return r>this.canonical.z?new ro(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ro(r,this.wrap,r,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(r,n=!0){if(this.overscaledZ===r&&n)return this.key;if(r>this.canonical.z)return xa(this.wrap*+n,r,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-r;return xa(this.wrap*+n,r,r,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(r){if(r.wrap!==this.wrap)return!1;const n=this.canonical.z-r.canonical.z;return r.overscaledZ===0||r.overscaledZ<this.overscaledZ&&r.canonical.z<this.canonical.z&&r.canonical.x===this.canonical.x>>n&&r.canonical.y===this.canonical.y>>n}children(r){if(this.overscaledZ>=r)return[new ro(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,c=2*this.canonical.x,h=2*this.canonical.y;return[new ro(n,this.wrap,n,c,h),new ro(n,this.wrap,n,c+1,h),new ro(n,this.wrap,n,c,h+1),new ro(n,this.wrap,n,c+1,h+1)]}isLessThan(r){return this.wrap<r.wrap||!(this.wrap>r.wrap)&&(this.overscaledZ<r.overscaledZ||!(this.overscaledZ>r.overscaledZ)&&(this.canonical.x<r.canonical.x||!(this.canonical.x>r.canonical.x)&&this.canonical.y<r.canonical.y))}wrapped(){return new ro(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(r){return new ro(this.overscaledZ,r,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Fl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function xa(a,r,n,c,h){const m=1<<Math.min(n,22);let g=m*(h%m)+c%m;return a&&n<22&&(g+=m*m*((a<0?-2*a-1:2*a)%(1<<2*(22-n)))),16*(32*g+n)+(r-n)}const Yu=[a=>{let r=a.canonical.x-1,n=a.wrap;return r<0&&(r=(1<<a.canonical.z)-1,n--),new ro(a.overscaledZ,n,a.canonical.z,r,a.canonical.y)},a=>{let r=a.canonical.x+1,n=a.wrap;return r===1<<a.canonical.z&&(r=0,n++),new ro(a.overscaledZ,n,a.canonical.z,r,a.canonical.y)},a=>new ro(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,(a.canonical.y===0?1<<a.canonical.z:a.canonical.y)-1),a=>new ro(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y===(1<<a.canonical.z)-1?0:a.canonical.y+1)];Jt(va,"CanonicalTileID"),Jt(ro,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const bQ=si([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:ww}=bQ,wQ=si([{name:"a_pos_3",components:3,type:"Int16"}]);var IU=si([{name:"a_pos",type:"Int16",components:2}]);function Tw(a){return a*es/C}const TQ=[new Zr([_,_,_],[v,v,v]),new Zr([_,_,_],[0,0,v]),new Zr([0,_,_],[v,0,v]),new Zr([_,0,_],[0,v,v]),new Zr([0,0,_],[v,v,v])];function AU(a,r,n,c=!0){const h=jt([],a._camera.position,a.worldSize),m=[r,n,1,1];Uo(m,m,a.pixelMatrixInverse),Gs(m,m,1/m[3]);const g=fr([],Xr([],m,h)),x=a.globeMatrix,w=[x[12],x[13],x[14]],E=Xr([],w,h),I=Fe(E),A=fr([],E),P=a.worldSize/(2*Math.PI),D=Ur(A,g),O=Math.asin(P/I);if(O<Math.acos(D)){if(!c)return null;const lt=[],je=[];jt(lt,g,I/D),fr(je,Xr(je,lt,E)),fr(g,He(g,E,jt(g,je,Math.tan(O)*I)))}const V=[];new mi(h,g).closestPointOnSphere(w,P,V);const j=fr([],ji(x,0)),X=fr([],ji(x,1)),oe=fr([],ji(x,2)),ne=Ur(j,V),ae=Ur(X,V),Ie=Ur(oe,V),be=Xe(Math.asin(-ae/P));let Te=Xe(Math.atan2(ne,Ie));Te=a.center.lng+function(lt,je){const ht=(je-lt+180)%360-180;return ht<-180?ht+360:ht}(a.center.lng,Te);const Le=U(Te),De=J(W(be),0,1);return new ye(Le,De)}class EQ{constructor(r,n,c){this.a=Xr([],r,c),this.b=Xr([],n,c),this.center=c;const h=fr([],this.a),m=fr([],this.b);this.angle=Math.acos(Ur(h,m))}}function YI(a,r){if(a.angle===0)return null;let n;return n=a.a[r]===0?1/a.angle*.5*Math.PI:1/a.angle*Math.atan(a.b[r]/a.a[r]/Math.sin(a.angle)-1/Math.tan(a.angle)),n<0||n>1?null:function(c,h,m,g){const x=Math.sin(m);return c*(Math.sin((1-g)*m)/x)+h*(Math.sin(g*m)/x)}(a.a[r],a.b[r],a.angle,J(n,0,1))+a.center[r]}function ou(a){if(a.z<=1)return TQ[a.z+2*a.y+a.x];const r=KI(Ew(a));return Zr.fromPoints(r)}function Ku(a,r,n){return jt(a,a,1-n),gr(a,a,r,n)}function PU(a,r,n){for(const c of a)sn(c,c,r),jt(c,c,n)}function MU(a,r,n,c){const h=r/a.worldSize,m=a.globeMatrix;if(n.z<=1){const De=ou(n).getCorners();return PU(De,m,h),Zr.fromPoints(De)}const g=Ew(n,c),x=KI(g,es+Tw(a._tileCoverLift));PU(x,m,h);const w=Number.MAX_VALUE,E=[-w,-w,-w],I=[w,w,w];if(g.contains(a.center)){for(const je of x)rt(I,I,je),Nt(E,E,je);E[2]=0;const De=a.point,lt=[De.x*h,De.y*h,0];return rt(I,I,lt),Nt(E,E,lt),new Zr(I,E)}if(a._tileCoverLift>0){for(const De of x)rt(I,I,De),Nt(E,E,De);return new Zr(I,E)}const A=[m[12]*h,m[13]*h,m[14]*h],P=g.getCenter(),D=J(a.center.lat,-fe,fe),O=J(P.lat,-fe,fe),V=U(a.center.lng),j=W(D);let X=V-U(P.lng);const oe=j-W(O);X>.5?X-=1:X<-.5&&(X+=1);let ne=0;Math.abs(X)>Math.abs(oe)?ne=X>=0?1:3:(ne=oe>=0?0:2,gr(A,A,[m[4]*h,m[5]*h,m[6]*h],-Math.sin(ai(oe>=0?g.getSouth():g.getNorth()))*es));const ae=x[ne],Ie=x[(ne+1)%4],be=new EQ(ae,Ie,A),Te=[YI(be,0)||ae[0],YI(be,1)||ae[1],YI(be,2)||ae[2]],Le=bd(a.zoom);if(Le>0){const De=function({x:je,y:ht,z:Lt},gt,St,kt,st){const Ct=1/(1<<Lt);let $e=je*Ct,at=$e+Ct,Dt=ht*Ct,At=Dt+Ct,sr=0;const Qt=($e+at)/2-kt;return Qt>
vendor: 10,771 bytes, line 59
59.5?sr=-1:Qt<-.5&&(sr=1),$e=(($e+sr)*gt-(kt*=gt))*St+kt,at=((at+sr)*gt-kt)*St+kt,Dt=(Dt*gt-(st*=gt))*St+st,At=(At*gt-st)*St+st,[[$e,At,0],[at,At,0],[at,Dt,0],[$e,Dt,0]]}(n,r,a._pixelsPerMercatorPixel,V,j);for(let je=0;je<x.length;je++)Ku(x[je],De[je],Le);const lt=He([],De[ne],De[(ne+1)%4]);jt(lt,lt,.5),Ku(Te,lt,Le)}for(const De of x)rt(I,I,De),Nt(E,E,De);return I[2]=Math.min(ae[2],Ie[2]),rt(I,I,Te),Nt(E,E,Te),new Zr(I,E)}function Ew({x:a,y:r,z:n},c=!1){const h=1/(1<<n),m=new R(re(a*h),r===(1<<n)-1&&c?-90:se((r+1)*h)),g=new R(re((a+1)*h),r===0&&c?90:se(r*h));return new F(m,g)}function KI(a,r=es){const n=ai(a.getNorth()),c=ai(a.getSouth()),h=Math.cos(n),m=Math.cos(c),g=Math.sin(n),x=Math.sin(c),w=a.getWest(),E=a.getEast();return[b(m,x,w,r),b(m,x,E,r),b(h,g,E,r),b(h,g,w,r)]}function N0(a,r,n,c){const h=1<<n.z,m=(a/Vt+n.x)/h;return S(se((r/Vt+n.y)/h),re(m),c)}function Sw({min:a,max:r}){return i/Math.max(r[0]-a[0],r[1]-a[1],r[2]-a[2])}const kU=new Float64Array(16);function Cw(a){const r=Sw(a),n=It(kU,[r,r,r]);return ie(n,n,Wr([],a.min))}function JI(a){const r=(c=a.min,(n=kU)[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=c[0],n[13]=c[1],n[14]=c[2],n[15]=1,n);var n,c;const h=1/Sw(a);return ke(r,r,[h,h,h])}function QI(a){const r=Vt/(2*Math.PI);return a/(2*Math.PI)/r}function RU(a,r){return Vt/(512*Math.pow(2,a))*Sw(ou(r))}function LU(a,r,n,c,h){const m=QI(n),g=[a,r,-n/(2*Math.PI)],x=pe(new Float64Array(16));return ie(x,x,g),ke(x,x,[m,m,m]),ot(x,x,ai(-h)),et(x,x,ai(-c)),x}function bd(a){return ce(bw,d,a)}function zU(a,r){const n=S(r.lat,r.lng),c=function(O){const V=S(O._center.lat,O._center.lng);let j=qi([],Je(0,1,0),V);const X=K([],-O.angle,V);j=sn(j,j,X),K(X,-O._pitch,j);const oe=fr([],V);return jt(oe,oe,Tw(O.cameraToCenterDistance/O.pixelsPerMeter)),sn(oe,oe,X),He([],V,oe)}(a);return g=(h=tt([],c,n))[0],x=h[1],w=h[2],E=(m=n)[0],I=m[1],A=m[2],D=(P=Math.sqrt(g*g+x*x+w*w)*Math.sqrt(E*E+I*I+A*A))&&Ur(h,m)/P,Math.acos(Math.min(Math.max(D,-1),1));var h,m,g,x,w,E,I,A,P,D}function eA(a,r){return zU(a,r)>Math.PI/2*1.01}const DU=ai(85),SQ=Math.cos(DU),CQ=Math.sin(DU),IQ=xe(),OU=a=>{const r=[];return a.paint.get("circle-pitch-alignment")==="map"&&r.push("PITCH_WITH_MAP"),a.paint.get("circle-pitch-scale")==="map"&&r.push("SCALE_WITH_MAP"),r};function FU(a,r,n,c,h,m,g,x,w){if(m&&a.queryGeometry.isAboveHorizon)return!1;m&&(w*=a.pixelToTileUnitsFactor);const E=a.tileID.canonical,I=n.projection.upVectorScale(E,n.center.lat,n.worldSize).metersToTile;for(const A of r)for(const P of A){const D=P.add(x),O=h&&n.elevation?n.elevation.exaggeration()*h.getElevationAt(D.x,D.y,!0):0,V=n.projection.projectTilePoint(D.x,D.y,E);if(O>0){const ne=n.projection.upVector(E,D.x,D.y);V.x+=ne[0]*I*O,V.y+=ne[1]*I*O,V.z+=ne[2]*I*O}const j=m?D:AQ(V.x,V.y,V.z,c),X=m?a.tilespaceRays.map(ne=>MQ(ne,O)):a.queryGeometry.screenGeometry,oe=Uo([],[V.x,V.y,V.z,1],c);if(!g&&m?w*=oe[3]/n.cameraToCenterDistance:g&&!m&&(w*=n.cameraToCenterDistance/oe[3]),m){const ne=se((P.y/Vt+E.y)/(1<<E.z));w/=n.projection.pixelsPerMeter(ne,1)/Z(1,ne)}if(Un(X,j,w))return!0}return!1}function AQ(a,r,n,c){const h=Uo([],[a,r,n,1],c);return new Tt(h[0]/h[3],h[1]/h[3])}const NU=Je(0,0,0),PQ=Je(0,0,1);function MQ(a,r){const n=Ye();return NU[2]=r,a.intersectsPlane(NU,PQ,n),new Tt(n[0],n[1])}class BU extends Ci{}let VU,UU,jU,GU;function $U(a,{width:r,height:n},c,h){if(h){if(h instanceof Uint8ClampedArray)h=new Uint8Array(h.buffer);else if(h.length!==r*n*c)throw new RangeError("mismatched image size")}else h=new Uint8Array(r*n*c);return a.width=r,a.height=n,a.data=h,a}function HU(a,r,n){const{width:c,height:h}=r;c===a.width&&h===a.height||(tA(a,r,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,c),height:Math.min(a.height,h)},n,null),a.width=c,a.height=h,a.data=r.data)}function tA(a,r,n,c,h,m,g,x){if(h.width===0||h.height===0)return r;if(h.width>a.width||h.height>a.height||n.x>a.width-h.width||n.y>a.height-h.height)throw new RangeError("out of range source coordinates for image copy");if(h.width>r.width||h.height>r.height||c.x>r.width-h.width||c.y>r.height-h.height)throw new RangeError("out of range destination coordinates for image copy");const w=a.data,E=r.data,I=m===4&&x;for(let A=0;A<h.height;A++){const P=((n.y+A)*a.width+n.x)*m,D=((c.y+A)*r.width+c.x)*m;if(I)for(let O=0;O<h.width;O++){const V=P+O*m+3,j=D+O*m;E[j+0]=255,E[j+1]=255,E[j+2]=255,E[j+3]=w[V]}else if(g)for(let O=0;O<h.width;O++){const V=P+O*m,j=D+O*m,X=new Mi(w[V+0]/255,w[V+1]/255,w[V+2]/255,w[V+3]).toNonPremultipliedRenderColor(g).toArray();E[j+0]=X[0],E[j+1]=X[1],E[j+2]=X[2],E[j+3]=X[3]}else for(let O=0;O<h.width*m;O++)E[D+O]=w[P+O]}return r}Jt(BU,"HeatmapBucket",{omit:["layers"]});class wd{constructor(r,n){$U(this,r,1,n)}resize(r){HU(this,new wd(r),1)}clone(){return new wd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(r,n,c,h,m){tA(r,n,c,h,m,1,null)}}class $o{constructor(r,n){$U(this,r,4,n)}resize(r){HU(this,new $o(r),4)}replace(r,n){n?this.data.set(r):this.data=r instanceof Uint8ClampedArray?new Uint8Array(r.buffer):r}clone(){return new $o({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(r,n,c,h,m,g,x){tA(r,n,c,h,m,4,g,x)}}class qU{constructor(r,n){this.width=r.width,this.height=r.height,this.data=n instanceof Uint8Array?new Float32Array(n.buffer):n}}function B0(a){const r={},n=a.resolution||256,c=a.clips?a.clips.length:1,h=a.image||new $o({width:n,height:c}),m=(g,x,w)=>{r[a.evaluationKey]=w;const E=a.expression.evaluate(r),I=E?E.toNonPremultipliedRenderColor(null):null;I&&(h.data[g+x+0]=Math.floor(255*I.r),h.data[g+x+1]=Math.floor(255*I.g),h.data[g+x+2]=Math.floor(255*I.b),h.data[g+x+3]=Math.floor(255*I.a))};if(a.clips)for(let g=0,x=0;g<c;++g,x+=4*n)for(let w=0,E=0;w<n;w++,E+=4){const I=w/(n-1),{start:A,end:P}=a.clips[g];m(x,E,A*(1-I)+P*I)}else for(let g=0,x=0;g<n;g++,x+=4)m(0,x,g/(n-1));return h}Jt(wd,"AlphaImage"),Jt($o,"RGBAImage");const kQ=si([{name:"a_pos",components:2,type:"Int16"}],4),RQ=si([{name:"a_road_z_offset",components:1,type:"Float32"}],4),LQ=si([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),zQ=si([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function ug(a,r,n=2){const c=r&&r.length,h=c?r[0]*n:a.length;let m=ZU(a,0,h,n,!0);const g=[];if(!m||m.next===m.prev)return g;let x,w,E;if(c&&(m=function(I,A,P,D){const O=[];for(let V=0,j=A.length;V<j;V++){const X=ZU(I,A[V]*D,V<j-1?A[V+1]*D:I.length,D,!1);X===X.next&&(X.steiner=!0),O.push(jQ(X))}O.sort(BQ);for(let V=0;V<O.length;V++)P=VQ(O[V],P);return P}(a,r,m,n)),a.length>80*n){x=a[0],w=a[1];let I=x,A=w;for(let P=n;P<h;P+=n){const D=a[P],O=a[P+1];D<x&&(x=D),O<w&&(w=O),D>I&&(I=D),O>A&&(A=O)}E=Math.max(I-x,A-w),E=E!==0?32767/E:0}return V0(m,g,n,x,w,E,0),g}function ZU(a,r,n,c,h){let m;if(h===function(g,x,w,E){let I=0;for(let A=x,P=w-E;A<w;A+=E)I+=(g[P]-g[A])*(g[A+1]+g[P+1]),P=A;return I}(a,r,n,c)>0)for(let g=r;g<n;g+=c)m=KU(g/c|0,a[g],a[g+1],m);else for(let g=n-c;g>=r;g-=c)m=KU(g/c|0,a[g],a[g+1],m);return m&&hg(m,m.next)&&(G0(m),m=m.next),m}function Qf(a,r){if(!a)return a;r||(r=a);let n,c=a;do if(n=!1,c.steiner||!hg(c,c.next)&&To(c.prev,c,c.next)!==0)c=c.next;else{if(G0(c),c=r=c.prev,c===c.next)break;n=!0}while(n||c!==r);return r}function V0(a,r,n,c,h,m,g){if(!a)return;!g&&m&&function(w,E,I,A){let P=w;do P.z===0&&(P.z=rA(P.x,P.y,E,I,A)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(D){let O,V=1;do{let j,X=D;D=null;let oe=null;for(O=0;X;){O++;let ne=X,ae=0;for(let be=0;be<V&&(ae++,ne=ne.nextZ,ne);be++);let Ie=V;for(;ae>0||Ie>0&&ne;)ae!==0&&(Ie===0||!ne||X.z<=ne.z)?(j=X,X=X.nextZ,ae--):(j=ne,ne=ne.nextZ,Ie--),oe?oe.nextZ=j:D=j,j.prevZ=oe,oe=j;X=ne}oe.nextZ=null,V*=2}while(O>1)}(P)}(a,c,h,m);let x=a;for(;a.prev!==a.next;){const w=a.prev,E=a.next;if(m?OQ(a,c,h,m):DQ(a))r.push(w.i,a.i,E.i),G0(a),a=E.next,x=E.next;else if((a=E)===x){g?g===1?V0(a=FQ(Qf(a),r),r,n,c,h,m,2):g===2&&NQ(a,r,n,c,h,m):V0(Qf(a),r,n,c,h,m,1);break}}}function DQ(a){const r=a.prev,n=a,c=a.next;if(To(r,n,c)>=0)return!1;const h=r.x,m=n.x,g=c.x,x=r.y,w=n.y,E=c.y,I=Math.min(h,m,g),A=Math.min(x,w,E),P=Math.max(h,m,g),D=Math.max(x,w,E);let O=c.next;for(;O!==r;){if(O.x>=I&&O.x<=P&&O.y>=A&&O.y<=D&&U0(h,x,m,w,g,E,O.x,O.y)&&To(O.prev,O,O.next)>=0)return!1;O=O.next}return!0}function OQ(a,r,n,c){const h=a.prev,m=a,g=a.next;if(To(h,m,g)>=0)return!1;const x=h.x,w=m.x,E=g.x,I=h.y,A=m.y,P=g.y,D=Math.min(x,w,E),O=Math.min(I,A,P),V=Math.max(x,w,E),j=Math.max(I,A,P),X=rA(D,O,r,n,c),oe=rA(V,j,r,n,c);let ne=a.prevZ,ae=a.nextZ;for(;ne&&ne.z>=X&&ae&&ae.z<=oe;){if(ne.x>=D&&ne.x<=V&&ne.y>=O&&ne.y<=j&&ne!==h&&ne!==g&&U0(x,I,w,A,E,P,ne.x,ne.y)&&To(ne.prev,ne,ne.next)>=0||(ne=ne.prevZ,ae.x>=D&&ae.x<=V&&ae.y>=O&&ae.y<=j&&ae!==h&&ae!==g&&U0(x,I,w,A,E,P,ae.x,ae.y)&&To(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;ne&&ne.z>=X;){if(ne.x>=D&&ne.x<=V&&ne.y>=O&&ne.y<=j&&ne!==h&&ne!==g&&U0(x,I,w,A,E,P,ne.x,ne.y)&&To(ne.prev,ne,ne.next)>=0)return!1;ne=ne.prevZ}for(;ae&&ae.z<=oe;){if(ae.x>=D&&ae.x<=V&&ae.y>=O&&ae.y<=j&&ae!==h&&ae!==g&&U0(x,I,w,A,E,P,ae.x,ae.y)&&To(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function FQ(a,r){let n=a;do{const c=n.prev,h=n.next.next;!hg(c,h)&&XU(c,n,n.next,h)&&j0(c,h)&&j0(h,c)&&(r.push(c.i,n.i,h.i),G0(n),G0(n.next),n=a=h),n=n.next}while(n!==a);return Qf(n)}function NQ(a,r,n,c,h,m){let g=a;do{let x=g.next.next;for(;x!==g.prev;){if(g.i!==x.i&&GQ(g,x)){let w=YU(g,x);return g=Qf(g,g.next),w=Qf(w,w.next),V0(g,r,n,c,h,m,0),void V0(w,r,n,c,h,m,0)}x=x.next}g=g.next}while(g!==a)}function BQ(a,r){let n=a.x-r.x;return n===0&&(n=a.y-r.y,n===0)&&(n=(a.next.y-a.y)/(a.next.x-a.x)-(r.next.y-r.y)/(r.next.x-r.x)),n}function VQ(a,r){const n=function(h,m){let g=m;const x=h.x,w=h.y;let E,I=-1/0;if(hg(h,g))return g;do{if(hg(h,g.next))return g.next;if(w<=g.y&&w>=g.next.y&&g.next.y!==g.y){const V=g.x+(w-g.y)*(g.next.x-g.x)/(g.next.y-g.y);if(V<=x&&V>I&&(I=V,E=g.x<g.next.x?g:g.next,V===x))return E}g=g.next}while(g!==m);if(!E)return null;const A=E,P=E.x,D=E.y;let O=1/0;g=E;do{if(x>=g.x&&g.x>=P&&x!==g.x&&WU(w<D?x:I,w,P,D,w<D?I:x,w,g.x,g.y)){const V=Math.abs(w-g.y)/(x-g.x);j0(g,h)&&(V<O||V===O&&(g.x>E.x||g.x===E.x&&UQ(E,g)))&&(E=g,O=V)}g=g.next}while(g!==A);return E}(a,r);if(!n)return r;const c=YU(n,a);return Qf(c,c.next),Qf(n,n.next)}function UQ(a,r){return To(a.prev,a,r.prev)<0&&To(r.next,a,a.next)<0}function rA(a,r,n,c,h){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-n)*h|0)|a<<8))|a<<4))|a<<2))|a<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-c)*h|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function jQ(a){let r=a,n=a;do(r.x<n.x||r.x===n.x&&r.y<n.y)&&(n=r),r=r.next;while(r!==a);return n}function WU(a,r,n,c,h,m,g,x){return(h-g)*(r-x)>=(a-g)*(m-x)&&(a-g)*(c-x)>
59=(n-g)*(r-x)&&(n-g)*(m-x)>=(h-g)*(c-x)}function U0(a,r,n,c,h,m,g,x){return!(a===g&&r===x)&&WU(a,r,n,c,h,m,g,x)}function GQ(a,r){return a.next.i!==r.i&&a.prev.i!==r.i&&!function(n,c){let h=n;do{if(h.i!==n.i&&h.next.i!==n.i&&h.i!==c.i&&h.next.i!==c.i&&XU(h,h.next,n,c))return!0;h=h.next}while(h!==n);return!1}(a,r)&&(j0(a,r)&&j0(r,a)&&function(n,c){let h=n,m=!1;const g=(n.x+c.x)/2,x=(n.y+c.y)/2;do h.y>x!=h.next.y>x&&h.next.y!==h.y&&g<(h.next.x-h.x)*(x-h.y)/(h.next.y-h.y)+h.x&&(m=!m),h=h.next;while(h!==n);return m}(a,r)&&(To(a.prev,a,r.prev)||To(a,r.prev,r))||hg(a,r)&&To(a.prev,a,a.next)>0&&To(r.prev,r,r.next)>0)}function To(a,r,n){return(r.y-a.y)*(n.x-r.x)-(r.x-a.x)*(n.y-r.y)}function hg(a,r){return a.x===r.x&&a.y===r.y}function XU(a,r,n,c){const h=Aw(To(a,r,n)),m=Aw(To(a,r,c)),g=Aw(To(n,c,a)),x=Aw(To(n,c,r));return h!==m&&g!==x||!(h!==0||!Iw(a,n,r))||!(m!==0||!Iw(a,c,r))||!(g!==0||!Iw(n,a,c))||!(x!==0||!Iw(n,r,c))}function Iw(a,r,n){return r.x<=Math.max(a.x,n.x)&&r.x>=Math.min(a.x,n.x)&&r.y<=Math.max(a.y,n.y)&&r.y>=Math.min(a.y,n.y)}function Aw(a){return a>0?1:a<0?-1:0}function j0(a,r){return To(a.prev,a,a.next)<0?To(a,r,a.next)>=0&&To(a,a.prev,r)>=0:To(a,r,a.prev)<0||To(a,a.next,r)<0}function YU(a,r){const n=iA(a.i,a.x,a.y),c=iA(r.i,r.x,r.y),h=a.next,m=r.prev;return a.next=r,r.prev=a,n.next=h,h.prev=n,c.next=n,n.prev=c,m.next=c,c.prev=m,c}function KU(a,r,n,c){const h=iA(a,r,n);return c?(h.next=c.next,h.prev=c,c.next.prev=h,c.next=h):(h.prev=h,h.next=h),h}function G0(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function iA(a,r,n){return{i:a,x:r,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function $0(a,r){const n=a.length;if(n<=1)return[a];const c=[];let h,m;for(let g=0;g<n;g++){const x=rn(a[g]);x!==0&&(a[g].area=Math.abs(x),m===void 0&&(m=x<0),m===x<0?(h&&c.push(h),h=[a[g]]):h.push(a[g]))}if(h&&c.push(h),r>1)for(let g=0;g<c.length;g++)c[g].length<=r||(Jo(c[g],r,1,c[g].length-1,$Q),c[g]=c[g].slice(0,r));return c}function $Q(a,r){return r.area-a.area}function JU(a,r,n=1){if(!a)return null;const c=typeof a=="string"?Cs.from(a).getPrimary():a.getPrimary(),h=typeof a=="string"?null:a.getSecondary();for(const m of[c,h]){if(!m)continue;const g=m.id.toString();r.has(g)||r.set(g,[]),m.scaleSelf(n),r.get(g).push(m)}return{primary:c.toString(),secondary:h?h.toString():null}}function nA(a,r,n,c){const h=c.patternDependencies;let m=!1;for(const g of r){const x=g.paint.get(`${a}-pattern`);x.isConstant()||(m=!0),JU(x.constantOr(null),h,n)&&(m=!0)}return m}function oA(a,r,n,c,h,m){const g=m.patternDependencies;for(const x of r){const w=x.paint.get(`${a}-pattern`).value;if(w.kind!=="constant"){let E=w.evaluate({zoom:c},n,{},m.availableImages);E=E&&E.name?E.name:E;const I=JU(E,g,h);if(!I)continue;const{primary:A,secondary:P}=I;A&&(n.patterns[x.id]=[A,P].filter(Boolean))}}return n}class QU{constructor(){this.polygons=new Map}add(r,...n){this.polygons.has(r)?this.polygons.get(r).push(...n):this.polygons.set(r,n)}merge(r){for(const[n,c]of r.polygons)this.add(n,...c)}}class ep{constructor(){this.portals=[]}static evaluate(r){if(r.length===0)return new ep;let n=[];for(const E of r)n.push(...E.portals);if(n.length===0)return new ep;const c=(E,I)=>E<=0&&I<=0||E>=Vt&&I>=Vt;for(const E of n){const I=E.va,A=E.vb;(c(I.x,A.x)||c(I.y,A.y))&&(E.type="border")}const h=n.filter(E=>E.type!=="unevaluated"),m=n.filter(E=>E.type==="unevaluated");if(m.length===0)return new ep;m.sort((E,I)=>E.hash===I.hash?E.isTunnel===I.isTunnel?0:E.isTunnel?-1:1:E.hash<I.hash?1:-1),n=h.concat(m);let g=h.length,x=g,w=g;do if(x++,x===n.length||n[g].hash!==n[x].hash){if(x-g==2){w<g&&(n[w]=n[g],n[g]=null);const E=n[w],I=n[x-1];E.type=E.isTunnel!==I.isTunnel?"tunnel":"polygon",E.connection={a:E.connection.a,b:I.connection.a},w++}g=x}while(g!==n.length);return n.splice(w),n.sort((E,I)=>E.hash<I.hash?1:-1),{portals:n}}}Jt(ep,"ElevationPortalGraph"),Jt(QU,"ElevationPolygons");class HQ{constructor(r,n,c){this.outPositions=r,this.outNormals=n,this.outIndices=c,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(r,n,c){let h=r[2];c!=null&&(h*=c);const m=this.getVec3Bits(r)<<96n|this.getVec3Bits(n),g=this.vertexLookup.get(m);
59if(g!=null)return g;const x=this.outPositions.length;this.vertexLookup.set(m,x);const w=Math.trunc(16384*n[0]),E=Math.trunc(16384*n[1]),I=Math.trunc(16384*n[2]);return this.outPositions.emplaceBack(r[0],r[1],h),this.outNormals.emplaceBack(w,E,I),x}addTriangle(r,n,c){this.outIndices.emplaceBack(r,n,c)}addTriangles(r,n,c){if(r.length===0)return;const h=c.length===1,m=Ye(),g=Ye();for(let x=0;x<r.length;x+=3){const w=n[r[x+0]],E=n[r[x+1]],I=n[r[x+2]],A=h?c[0]:c[r[x+1]],P=h?c[0]:c[r[x+2]];ze(m,w.x,w.y,h?c[0]:c[r[x+0]]);const D=this.addVertex(m,g);ze(m,E.x,E.y,A);const O=this.addVertex(m,g);ze(m,I.x,I.y,P);const V=this.addVertex(m,g);this.outIndices.emplaceBack(D,O,V)}}addQuad(r,n,c,h,m,g){const x=this.addVertex(r,m,g),w=this.addVertex(n,m,g),E=this.addVertex(c,m,g),I=this.addVertex(h,m,g);this.addTriangle(x,w,E),this.addTriangle(E,I,x)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}getBits(r){return this.view.setFloat32(0,r),BigInt(this.view.getUint32(0))}getVec3Bits(r){return this.getBits(r[0])<<64n|this.getBits(r[1])<<32n|this.getBits(r[2])}}class ba{constructor(r,n,c,h){this.unevaluatedPortals=new ep,this.portalPolygons=new QU,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new v0,this.vertexNormals=new x0,this.indexArray=new gn,this.tileToMeters=ge(r),this.bridgeProgramConfigurations=new ga(n,{zoom:c,lut:h},m=>m!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new ga(n,{zoom:c,lut:h},m=>m!=="fill-bridge-guard-rail-color")}addVertices(r,n){const c=this.unevalVertices.length;for(let h=0;h<r.length;h++)this.unevalVertices.push(r[h]),this.unevalHeights.push(n[h]);return c}addTriangles(r,n,c){const h=c?this.unevalTunnelTriangles:this.unevalTriangles;for(const m of r)h.push(m+n)}addRenderableRing(r,n,c,h,m,g){const x=[new Tt(m.min.x,m.min.y),new Tt(m.max.x,m.min.y),new Tt(m.max.x,m.max.y),new Tt(m.min.x,m.max.y)];for(let w=0;w<c-1;w++){const E=n+w,I=E+1,A=this.unevalVertices[E],P=this.unevalVertices[I];if(!(A.x>=m.min.x&&A.x<=m.max.x&&A.y>=m.min.y&&A.y<=m.max.y||P.x>=m.min.x&&P.x<=m.max.x&&P.y>=m.min.y&&P.y<=m.max.y||Pn(A,P,x))||this.isOnBorder(A.x,P.x)||this.isOnBorder(A.y,P.y))continue;const D=ba.computeEdgeHash(this.unevalVertices[E],this.unevalVertices[I]);let O,V=this.vertexHashLookup.get(ba.computePosHash(A));V!=null?O=V.next:(V=this.vertexHashLookup.get(ba.computePosHash(P)),O=V!=null?V.prev:D),this.unevalEdges.push({polygonIdx:r,a:E,b:I,hash:D,portalHash:O,isTunnel:h,type:"unevaluated",featureInfo:g})}}addPortalCandidates(r,n,c,h,m){if(n.length===0)return;this.portalPolygons.add(r,{geometry:n,zLevel:m});const g=n[0];this.vertexHashLookup.clear();let x=ba.computeEdgeHash(g[g.length-2],g[g.length-1]);for(let w=0;w<g.length-1;w++){const E=g[w+0],I=g[w+1],A=Yr(I.x-E.x,I.y-E.y),P=lo(A);if(P===0)continue;let D="unevaluated";const O=h.pointElevation(E),V=h.pointElevation(I);Math.abs(O)<.01&&Math.abs(V)<.01?D="entrance":(this.isOnBorder(E.x,I.x)||this.isOnBorder(E.y,I.y))&&(D="border");const j=ba.computeEdgeHash(E,I);this.unevaluatedPortals.portals.push({connection:{a:r,b:void 0},va:E,vb:I,vab:A,length:P,hash:j,isTunnel:c,type:D});const X=ba.computePosHash(E);this.vertexHashLookup.set(X,{prev:x,next:j}),x=j}}construct(r){if(this.unevalVertices.length===0)return;const n=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),c=P=>{P.primitiveLength=this.indexArray.length-P.primitiveOffset},h=new HQ(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(r.portals,this.unevalEdges);const m=n(),g=n(),x=n(),w=(P,D)=>{P.sort((V,j)=>V.type===D&&j.type!==D?-1:V.type!==D&&j.type===D?1:0);const O=P.findIndex(V=>V.type!==D);return O>=0?O:P.length};let E=0;this.unevalEdges.length>0&&(E=w(this.unevalEdges,"none"),this.constructBridgeStructures(h,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:E},this.tileToMeters)),c(x);const I=n(),A=n();if(this.unevalEdges.length>0){const P=this.unevalEdges.splice(E),D=w(P,"tunnel")+E;this.unevalEdges.push(...P),this.constructTunnelStructures(h,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:E},{min:E,max:D})}c(I),h.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),c(A),h.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),c(g),h.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),c(m),this.maskSegments=xn.simpleSegment(0,A.primitiveOffset,0,A.primitiveLength),this.depthSegments=xn.simpleSegment(0,g.primitiveOffset,0,g.primitiveLength),this.renderableBridgeSegments=xn.simpleSegment(0,x.primitiveOffset,0,x.primitiveLength),this.renderableTunnelSegments=xn.simpleSegment(0,I.primitiveOffset,0,I.primitiveLength),this.shadowCasterSegments=xn.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength)}update(r,n,c,h,m,g,x,w){this.bridgeProgramConfigurations.updatePaintArrays(r,n,m,c,h,g,x,w),this.tunnelProgramConfigurations.updatePaintArrays(r,n,m,c,h,g,x,w)}upload(r){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=r.createVertexBuffer(this.vertexPositions,LQ.members),this.vertexBufferNormal=r.createVertexBuffer(this.vertexNormals,zQ.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(r),this.tunnelProgramConfigurations.upload(r))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(r,n,c,h,m){const g=(x,w)=>{for(let E=0;E<w.length-1;E++){const I=w[E].featureIndex,A=w[E+1].vertexStart,P=r.feature(I);x.populatePaintArrays(A,P,I,{},c,n,h,void 0,m)}};g(this.bridgeProgramConfigurations,this.bridgeFeatureSections),g(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(r,n,c,h,m){const g=new Map;for(let x=h;x<m;x++){const w=c[x],E=w.a,I=w.b,A=ba.computePosHash(r[E]),P=ba.computePosHash(r[I]);let D=g.get(A);D||(D={},g.set(A,D));let O=g.get(P);O||(O={},g.set(P,O)),n[E]<=0&&n[I]<=0||(D.to=I,O.from=E)}return g}isTerminalVertex(r,n){const c=ba.computePosHash(this.unevalVertices[r]),h=n.get(c);return!h||!h.from||!h.to}constructBridgeStructures(r,n,c,h,m,g){r.clearVertexLookup();
vendor: 6,786 bytes, line 59
59const x=this.computeVertexConnections(n,c,h,m.min,m.max),w=1/g,E=.5*w,I=(St,kt)=>ze(St,n[kt].x,n[kt].y,c[kt]*w),A=Ye(),P=Ye(),D=Ye(),O=Ye(),V=Ye(),j=(St,kt)=>{const st=x.get(ba.computePosHash(n[kt])),Ct=st.from,$e=st.to;if(!Ct||!$e)return;I(A,Ct),I(P,kt),I(D,$e),tn(O),Wi(A,P)||(Xr(V,P,A),fr(O,V)),Wi(D,P)||(Xr(V,D,P),He(O,O,fr(V,V)));const at=Lo(O);return at>0?jt(St,O,1/at):void 0};let X=Number.POSITIVE_INFINITY;this.sortSubarray(h,m.min,m.max,(St,kt)=>St.featureInfo.featureIndex-kt.featureInfo.featureIndex);const oe=Ye(),ne=Ye(),ae=Ye(),Ie=Ye(),be=Ye(),Te=Ye(),Le=Ye(),De=Ye(),lt=Ye(),je=[Ye(),Ye(),Ye(),Ye()],ht=[Ye(),Ye(),Ye(),Ye()],Lt=[{coord:new Tt(0,0),height:0},{coord:new Tt(0,0),height:0}],gt=(St,kt)=>St>kt;for(let St=m.min;St<m.max;St++){const kt=h[St];if(!kt.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Lt,n,c,kt,gt))continue;const[st,Ct]=Lt;if(ze(oe,st.coord.x,st.coord.y,w*st.height),ze(ne,Ct.coord.x,Ct.coord.y,w*Ct.height),Wi(oe,ne))continue;Xr(ae,ne,oe),fr(ae,ae);const $e=j(De,kt.a)||ae,at=j(lt,kt.b)||ae;ze(Ie,$e[1],-$e[0],0),fr(Ie,Ie),ze(be,at[1],-at[0],0),fr(be,be),qi(De,Ie,$e),fr(Te,De),qi(De,be,at),fr(Le,De),He(je[0],oe,jt(De,Xr(De,Ie,Te),E)),He(je[1],oe,jt(De,He(De,Ie,Te),E)),He(je[2],oe,jt(De,Te,E)),je[3]=oe,He(ht[0],ne,jt(De,Xr(De,be,Le),E)),He(ht[1],ne,jt(De,He(De,be,Le),E)),He(ht[2],ne,jt(De,Le,E)),ht[3]=ne,X=this.addFeatureSection(kt.featureInfo.featureIndex,X,this.bridgeFeatureSections,r);const Dt=r.addVertex(je[0],Ie,g),At=r.addVertex(je[1],Ie,g),sr=r.addVertex(ht[0],be,g),Qt=r.addVertex(ht[1],be,g);r.addTriangle(Dt,At,sr),r.addTriangle(At,Qt,sr);const bt=r.addVertex(je[1],Te,g),Pt=r.addVertex(je[2],Te,g),rr=r.addVertex(ht[1],Le,g),Wt=r.addVertex(ht[2],Le,g);r.addTriangle(bt,Pt,rr),r.addTriangle(Pt,Wt,rr),Wr(Ie,Ie),Wr(be,be);const Ut=r.addVertex(je[2],Ie,g),Xt=r.addVertex(je[3],Ie,g),xr=r.addVertex(ht[2],be,g),Mr=r.addVertex(ht[3],be,g);r.addTriangle(Ut,Xt,xr),r.addTriangle(Xt,Mr,xr);const Or=this.isTerminalVertex(kt.a,x),Rr=this.isTerminalVertex(kt.b,x);st.height<.01&&Or&&r.addQuad(je[3],je[2],je[1],je[0],Wr($e,$e),g),Ct.height<.01&&Rr&&r.addQuad(ht[0],ht[1],ht[2],ht[3],at,g)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:r.getVertexCount()})}constructTunnelStructures(r,n,c,h,m,g){r.clearVertexLookup();let x=Number.POSITIVE_INFINITY;const w=(X,oe)=>X.featureInfo.featureIndex-oe.featureInfo.featureIndex;this.sortSubarray(h,m.min,m.max,w),this.sortSubarray(h,g.min,g.max,w);const E=X=>fr(X,X),I=[{coord:new Tt(0,0),height:0},{coord:new Tt(0,0),height:0}],A=(X,oe)=>X<oe,P=Ye(),D=Ye(),O=Ye(),V=Ye(),j=Ye();for(let X=m.min;X<m.max;X++){if(!this.prepareEdgePoints(I,n,c,h[X],A))continue;const[oe,ne]=I,ae=E(ze(j,-(ne.coord.y-oe.coord.y),ne.coord.x-oe.coord.x,0));x=this.addFeatureSection(h[X].featureInfo.featureIndex,x,this.tunnelFeatureSections,r),r.addQuad(ze(P,oe.coord.x,oe.coord.y,oe.height),ze(D,ne.coord.x,ne.coord.y,ne.height),ze(O,ne.coord.x,ne.coord.y,h[X].isTunnel?-.1:0),ze(V,oe.coord.x,oe.coord.y,h[X].isTunnel?-.1:0),ae)}for(let X=g.min;X<g.max;X++){const oe=h[X];oe.isTunnel&&([oe.a,oe.b]=[oe.b,oe.a]);const ne=n[oe.a],ae=n[oe.b],Ie=E(ze(j,-(ae.y-ne.y),ae.x-ne.x,0));x=this.addFeatureSection(oe.featureInfo.featureIndex,x,this.tunnelFeatureSections,r),r.addQuad(ze(P,ae.x,ae.y,0),ze(D,ne.x,ne.y,0),ze(O,ne.x,ne.y,c[oe.a]+4),ze(V,ae.x,ae.y,c[oe.b]+4),Ie),r.addQuad(ze(P,ne.x,ne.y,0),ze(D,ae.x,ae.y,0),ze(O,ae.x,ae.y,c[oe.b]+4),ze(V,ne.x,ne.y,c[oe.a]+4),Ie)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:r.getVertexCount()})}setElevatedPoint(r,n,c,h){r.coord.x=n,r.coord.y=c,r.height=h}prepareEdgePoints(r,n,c,h,m){let g=n[h.a].x,x=n[h.a].y,w=n[h.b].x,E=n[h.b].y,I=c[h.a],A=c[h.b];const P=m(I,0),D=m(A,0);if(P&&D)return this.setElevatedPoint(r[0],g,x,I),this.setElevatedPoint(r[1],w,E,A),!0;if(!P&&!D)return!1;if(P){if(!D){const O=A/(A-I);w=_r(w,g,O),E=_r(E,x,O),A=_r(A,I,O)}}else{const O=I/(I-A);g=_r(g,w,O),x=_r(x,E,O),I=_r(I,A,O)}return this.setElevatedPoint(r[0],g,x,I),this.setElevatedPoint(r[1],w,E,A),!0}prepareEdges(r,n){if(n.length===0)return;n.sort((x,w)=>x.hash===w.hash?w.polygonIdx-x.polygonIdx:w.hash>x.hash?1:-1);let c=0,h=0,m=0,g=n[c].polygonIdx;do h++,(h===n.length||n[c].hash!==n[h].hash)&&((h-c==1||n[h-1].polygonIdx!==g)&&(m<c&&(n[m]=n[c],n[c]=null),n[m].type="none",m++),c=h,c!==n.length&&(g=n[c].polygonIdx));while(c!==n.length);if(n.splice(m),n.length!==0&&r.length!==0){n.sort((E,I)=>E.portalHash<I.portalHash?1:-1);let x=0,w=0;for(;x!==n.length&&w!==r.length;){const E=n[x],I=r[w];E.portalHash>I.hash?x++:I.hash>E.portalHash?w++:(E.type=I.type,x++)}}}isOnBorder(r,n){return r<=0&&n<=0||r>=Vt&&n>=Vt}addFeatureSection(r,n,c,h){return r!==n&&(n=r,c.push({featureIndex:r,vertexStart:h.getVertexCount()}),h.clearVertexLookup()),n}sortSubarray(r,n,c,h){const m=r.slice(n,c);m.sort(h),r.splice(n,m.length,...m)}static computeEdgeHash(r,n){return(r.y===n.y&&r.x>n.x||r.y>n.y)&&([r,n]=[n,r]),BigInt(ba.computePosHash(r))<<32n|BigInt(ba.computePosHash(n))}static computePosHash(r){return((65535&r.x)<<16|65535&r.y)>>>0}}var ej,tj={exports:{}},rj=(ej||(ej=1,function(a,r){(function(n){function c(ue,he){return ue>he?1:ue<he?-1:0}var h=function(ue,he){ue===void 0&&(ue=c),he===void 0&&(he=!1),this._compare=ue,this._root=null,this._size=0,this._noDuplicates=!!he},m={size:{configurable:!0}};function g(ue,he,it,Ot,$t){var Gt=$t-Ot;if(Gt>0){var tr=Ot+Math.floor(Gt/2),Ir={key:he[tr],data:it[tr],parent:ue};return Ir.left=g(Ir,he,it,Ot,tr),Ir.right=g(Ir,he,it,tr+1,$t),Ir}return null}function x(ue,he,it,Ot,$t){if(!(it>=Ot)){for(var Gt=ue[it+Ot>>1],tr=it-1,Ir=Ot+1;;){do tr++;while($t(ue[tr],Gt)<0);do Ir--;while($t(ue[Ir],Gt)>0);if(tr>=Ir)break;var Jr=ue[tr];ue[tr]=ue[Ir],ue[Ir]=Jr,Jr=he[tr],he[tr]=he[Ir],he[Ir]=Jr}x(ue,he,it,Ir,$t),x(ue,he,Ir+1,Ot,$t)}}h.prototype.rotateLeft=function(ue){var he=ue.right;he&&(ue.right=he.left,he.left&&(he.left.parent=ue),he.parent=ue.parent),ue.parent?ue===ue.parent.left?ue.parent.left=he:ue.parent.right=he:this._root=he,he&&(he.left=ue),ue.parent=he},h.prototype.rotateRight=function(ue){var he=ue.left;he&&(ue.left=he.right,he.right&&(he.right.parent=ue),he.parent=ue.parent),ue.parent?ue===ue.parent.left?ue.parent.left=he:ue.parent.right=he:this._root=he,he&&(he.right=ue),ue.parent=he},h.prototype._splay=function(ue){for(;ue.parent;){var he=ue.parent;he.parent?he.left===ue&&he.parent.left===he?(this.rotateRight(he.parent),this.rotateRight(he)):he.right===ue&&he.parent.right===he?(this.rotateLeft(he.parent),this.rotateLeft(he)):he.left===ue&&he.parent.right===he?(this.rotateRight(he),this.rotateLeft(he)):(this.rotateLeft(he),this.rotateRight(he)):he.left===ue?this.rotateRight(he):this.rotateLeft(he)}},h.prototype.splay=function(ue){for(var he,it,Ot,$t,Gt;ue.parent;
59)(it=(he=ue.parent).parent)&&it.parent?((Ot=it.parent).left===it?Ot.left=ue:Ot.right=ue,ue.parent=Ot):(ue.parent=null,this._root=ue),$t=ue.left,Gt=ue.right,ue===he.left?(it&&(it.left===he?(he.right?(it.left=he.right,it.left.parent=it):it.left=null,he.right=it,it.parent=he):($t?(it.right=$t,$t.parent=it):it.right=null,ue.left=it,it.parent=ue)),Gt?(he.left=Gt,Gt.parent=he):he.left=null,ue.right=he,he.parent=ue):(it&&(it.right===he?(he.left?(it.right=he.left,it.right.parent=it):it.right=null,he.left=it,it.parent=he):(Gt?(it.left=Gt,Gt.parent=it):it.left=null,ue.right=it,it.parent=ue)),$t?(he.right=$t,$t.parent=he):he.right=null,ue.left=he,he.parent=ue)},h.prototype.replace=function(ue,he){ue.parent?ue===ue.parent.left?ue.parent.left=he:ue.parent.right=he:this._root=he,he&&(he.parent=ue.parent)},h.prototype.minNode=function(ue){if(ue===void 0&&(ue=this._root),ue)for(;ue.left;)ue=ue.left;return ue},h.prototype.maxNode=function(ue){if(ue===void 0&&(ue=this._root),ue)for(;ue.right;)ue=ue.right;return ue},h.prototype.insert=function(ue,he){var it=this._root,Ot=null,$t=this._compare;if(this._noDuplicates)for(;it;){if(Ot=it,$t(it.key,ue)===0)return;it=$t(it.key,ue)<0?it.right:it.left}else for(;it;)Ot=it,it=$t(it.key,ue)<0?it.right:it.left;return it={key:ue,data:he,left:null,right:null,parent:Ot},Ot?$t(Ot.key,it.key)<0?Ot.right=it:Ot.left=it:this._root=it,this.splay(it),this._size++,it},h.prototype.find=function(ue){for(var he=this._root,it=this._compare;he;){var Ot=it(he.key,ue);if(Ot<0)he=he.right;else{if(!(Ot>0))return he;he=he.left}}return null},h.prototype.contains=function(ue){for(var he=this._root,it=this._compare;he;){var Ot=it(ue,he.key);if(Ot===0)return!0;he=Ot<0?he.left:he.right}return!1},h.prototype.remove=function(ue){var he=this.find(ue);if(!he)return!1;if(this.splay(he),he.left)if(he.right){var it=this.minNode(he.right);it.parent!==he&&(this.replace(it,it.right),it.right=he.right,it.right.parent=it),this.replace(he,it),it.left=he.left,it.left.parent=it}else this.replace(he,he.left);else this.replace(he,he.right);return this._size--,!0},h.prototype.removeNode=function(ue){if(!ue)return!1;if(this.splay(ue),ue.left)if(ue.right){var he=this.minNode(ue.right);he.parent!==ue&&(this.replace(he,he.right),he.right=ue.right,he.right.parent=he),this.replace(ue,he),he.left=ue.left,he.left.parent=he}else this.replace(ue,ue.left);else this.replace(ue,ue.right);return this._size--,!0},h.prototype.erase=function(ue){var he=this.find(ue);if(he){this.splay(he);var it=he.left,Ot=he.right,$t=null;it&&(it.parent=null,$t=this.maxNode(it),this.splay($t),this._root=$t),Ot&&(it?$t.right=Ot:this._root=Ot,Ot.parent=$t),this._size--}},h.prototype.pop=function(){var ue=this._root,he=null;if(ue){for(;ue.left;)ue=ue.left;he={key:ue.key,data:ue.data},this.remove(ue.key)}return he},h.prototype.next=function(ue){var he=ue;if(he)if(he.right)for(he=he.right;he&&he.left;)he=he.left;else for(he=ue.parent;he&&he.right===ue;)ue=he,he=he.parent;return he},h.prototype.prev=function(ue){var he=ue;if(he)if(he.left)for(he=he.left;he&&he.right;)he=he.right;else for(he=ue.parent;he&&he.left===ue;)ue=he,he=he.parent;return he},h.prototype.forEach=function(ue){for(var he=this._root,it=[],Ot=!1,$t=0;!Ot;)he?(it.push(he),he=he.left):it.length>0?(ue(he=it.pop(),$t++),he=he.right):Ot=!0;return this},h.prototype.range=function(ue,he,it,Ot){for(var $t=[],Gt=this._compare,tr=this._root;$t.length!==0||tr;)if(tr)$t.push(tr),tr=tr.left;else{if(Gt((tr=$t.pop()).key,he)>0)break;if(Gt(tr.key,ue)>=0&&it.call(Ot,tr))return this;tr=tr.right}return this},h.prototype.keys=function(){for(var ue=this._root,he=[],it=[],Ot=!1;!Ot;)ue?(he.push(ue),ue=ue.left):he.length>0?(ue=he.pop(),it.push(ue.key),ue=ue.right):Ot=!0;return it},h.prototype.values=function(){for(var ue=this._root,he=[],it=[],Ot=!1;!Ot;)ue?(he.push(ue),ue=ue.left):he.length>0?(ue=he.pop(),it.push(ue.data),ue=ue.right):Ot=!0;return it},h.prototype.at=function(ue){for(var he=this._root,it=[],Ot=!1,$t=0;!Ot;)if(he)it.push(he),he=he.left;else if(it.length>0){if(he=it.pop(),$t===ue)return he;$t++,he=he.right}else Ot=!0;return null},h.prototype.load=function(ue,he,it){if(ue===void 0&&(ue=[]),he===void 0&&(he=[]),it===void 0&&(it=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var Ot=ue.length;return it&&x(ue,he,0,Ot-1,this._compare),this._root=g(null,ue,he,0,Ot),this._size=Ot,this},h.prototype.min=function(){var ue=this.minNode(this._root);return ue?ue.key:null},h.prototype.max=function(){var ue=this.maxNode(this._root);return ue?ue.key:null},h.prototype.isEmpty=function(){return this._root===null},m.size.get=function(){return this._size},h.createTree=function(ue,he,it,Ot,$t){return new h(it,$t).load(ue,he,Ot)},Object.defineProperties(h.prototype,m);var w=0,E=1,I=2,A=3,P=0,D=1,O=2,V=3;function j(ue,he,it){he===null?(ue.inOut=!1,ue.otherInOut=!0):(ue.isSubject===he.isSubject?(ue.inOut=!he.inOut,ue.otherInOut=he.otherInOut):(ue.inOut=!he.otherInOut,ue.otherInOut=he.isVertical()?!he.inOut:he.inOut),he&&(ue.prevInResult=!X(he,it)||he.isVertical()?he.prevInResult:he));var Ot=X(ue,it);ue.resultTransition=Ot?function($t,Gt){var tr,Ir=!$t.inOut,Jr=!$t.otherInOut;switch(Gt){case P:tr=Ir&&Jr;break;case D:tr=Ir||Jr;break;case V:tr=Ir^Jr;break;case O:tr=$t.isSubject?Ir&&!Jr:Jr&&!Ir}return tr?1:-1}(ue,it):0}function X(ue,he){switch(ue.type){case w:switch(he){case P:return!ue.otherInOut;case D:return ue.otherInOut;case O:return ue.isSubject&&ue.otherInOut||!ue.isSubject&&!ue.otherInOut;case V:return!0}break;case I:return he===P||he===D;case A:return he===O;case E:return!1}return!1}var oe=function(ue,he,it,Ot,$t){this.left=he,this.point=ue,this.otherEvent=it,this.isSubject=Ot,this.type=$t||w,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},ne={inResult:{configurable:!0}};function ae(ue,he){return ue[0]===he[0]&&ue[1]===he[1]}oe.prototype.isBelow=function(ue){var he=this.point,it=this.otherEvent.point;
59return this.left?(he[0]-ue[0])*(it[1]-ue[1])-(it[0]-ue[0])*(he[1]-ue[1])>0:(it[0]-ue[0])*(he[1]-ue[1])-(he[0]-ue[0])*(it[1]-ue[1])>0},oe.prototype.isAbove=function(ue){return!this.isBelow(ue)},oe.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},ne.inResult.get=function(){return this.resultTransition!==0},oe.prototype.clone=function(){var ue=new oe(this.point,this.left,this.otherEvent,this.isSubject,this.type);return ue.contourId=this.contourId,ue.resultTransition=this.resultTransition,ue.prevInResult=this.prevInResult,ue.isExteriorRing=this.isExteriorRing,ue.inOut=this.inOut,ue.otherInOut=this.otherInOut,ue},Object.defineProperties(oe.prototype,ne);var Ie=11102230246251565e-32,be=134217729,Te=(3+8*Ie)*Ie;function Le(ue,he,it,Ot,$t){var Gt,tr,Ir,Jr,Qr=he[0],jr=Ot[0],Bi=0,Cn=0;jr>Qr==jr>-Qr?(Gt=Qr,Qr=he[++Bi]):(Gt=jr,jr=Ot[++Cn]);var Fr=0;if(Bi<ue&&Cn<it)for(jr>Qr==jr>-Qr?(Ir=Gt-((tr=Qr+Gt)-Qr),Qr=he[++Bi]):(Ir=Gt-((tr=jr+Gt)-jr),jr=Ot[++Cn]),Gt=tr,Ir!==0&&($t[Fr++]=Ir);Bi<ue&&Cn<it;)jr>Qr==jr>-Qr?(Ir=Gt-((tr=Gt+Qr)-(Jr=tr-Gt))+(Qr-Jr),Qr=he[++Bi]):(Ir=Gt-((tr=Gt+jr)-(Jr=tr-Gt))+(jr-Jr),jr=Ot[++Cn]),Gt=tr,Ir!==0&&($t[Fr++]=Ir);for(;Bi<ue;)Ir=Gt-((tr=Gt+Qr)-(Jr=tr-Gt))+(Qr-Jr),Qr=he[++Bi],Gt=tr,Ir!==0&&($t[Fr++]=Ir);for(;Cn<it;)Ir=Gt-((tr=Gt+jr)-(Jr=tr-Gt))+(jr-Jr),jr=Ot[++Cn],Gt=tr,Ir!==0&&($t[Fr++]=Ir);return Gt===0&&Fr!==0||($t[Fr++]=Gt),Fr}function De(ue){return new Float64Array(ue)}var lt=33306690738754716e-32,je=22204460492503146e-32,ht=11093356479670487e-47,Lt=De(4),gt=De(8),St=De(12),kt=De(16),st=De(4);function Ct(ue,he,it){var Ot=function($t,Gt,tr,Ir,Jr,Qr){var jr=(Gt-Qr)*(tr-Jr),Bi=($t-Jr)*(Ir-Qr),Cn=jr-Bi;if(jr===0||Bi===0||jr>0!=Bi>0)return Cn;var Fr=Math.abs(jr+Bi);return Math.abs(Cn)>=lt*Fr?Cn:-function(fn,Ki,Ri,wn,cn,Ji,nn){var Oi,Gr,Vi,Tn,Sr,ci,un,Mn,pn,io,$i,Wn,Ws,Ho,Oo,Xs,lu,no,mo=fn-cn,qo=Ri-cn,_s=Ki-Ji,ts=wn-Ji;Lt[0]=(Oo=(Mn=mo-(un=(ci=be*mo)-(ci-mo)))*(io=ts-(pn=(ci=be*ts)-(ci-ts)))-((Ho=mo*ts)-un*pn-Mn*pn-un*io))-(($i=Oo-(lu=(Mn=_s-(un=(ci=be*_s)-(ci-_s)))*(io=qo-(pn=(ci=be*qo)-(ci-qo)))-((Xs=_s*qo)-un*pn-Mn*pn-un*io)))+(Sr=Oo-$i))+(Sr-lu),Lt[1]=(Ws=Ho-((Wn=Ho+$i)-(Sr=Wn-Ho))+($i-Sr))-(($i=Ws-Xs)+(Sr=Ws-$i))+(Sr-Xs),Lt[2]=Wn-((no=Wn+$i)-(Sr=no-Wn))+($i-Sr),Lt[3]=no;var Pd=function(oie,pG){for(var mG=pG[0],u3=1;u3<4;u3++)mG+=pG[u3];return mG}(0,Lt),bv=je*nn;if(Pd>=bv||-Pd>=bv||(Oi=fn-(mo+(Sr=fn-mo))+(Sr-cn),Vi=Ri-(qo+(Sr=Ri-qo))+(Sr-cn),Gr=Ki-(_s+(Sr=Ki-_s))+(Sr-Ji),Tn=wn-(ts+(Sr=wn-ts))+(Sr-Ji),Oi===0&&Gr===0&&Vi===0&&Tn===0)||(bv=ht*nn+Te*Math.abs(Pd),(Pd+=mo*Tn+ts*Oi-(_s*Vi+qo*Gr))>=bv||-Pd>=bv))return Pd;st[0]=(Oo=(Mn=Oi-(un=(ci=be*Oi)-(ci-Oi)))*(io=ts-(pn=(ci=be*ts)-(ci-ts)))-((Ho=Oi*ts)-un*pn-Mn*pn-un*io))-(($i=Oo-(lu=(Mn=Gr-(un=(ci=be*Gr)-(ci-Gr)))*(io=qo-(pn=(ci=be*qo)-(ci-qo)))-((Xs=Gr*qo)-un*pn-Mn*pn-un*io)))+(Sr=Oo-$i))+(Sr-lu),st[1]=(Ws=Ho-((Wn=Ho+$i)-(Sr=Wn-Ho))+($i-Sr))-(($i=Ws-Xs)+(Sr=Ws-$i))+(Sr-Xs),st[2]=Wn-((no=Wn+$i)-(Sr=no-Wn))+($i-Sr),st[3]=no;var Hre=Le(4,Lt,4,st,gt);st[0]=(Oo=(Mn=mo-(un=(ci=be*mo)-(ci-mo)))*(io=Tn-(pn=(ci=be*Tn)-(ci-Tn)))-((Ho=mo*Tn)-un*pn-Mn*pn-un*io))-(($i=Oo-(lu=(Mn=_s-(un=(ci=be*_s)-(ci-_s)))*(io=Vi-(pn=(ci=be*Vi)-(ci-Vi)))-((Xs=_s*Vi)-un*pn-Mn*pn-un*io)))+(Sr=Oo-$i))+(Sr-lu),st[1]=(Ws=Ho-((Wn=Ho+$i)-(Sr=Wn-Ho))+($i-Sr))-(($i=Ws-Xs)+(Sr=Ws-$i))+(Sr-Xs),st[2]=Wn-((no=Wn+$i)-(Sr=no-Wn))+($i-Sr),st[3]=no;var qre=Le(Hre,gt,4,st,St);st[0]=(Oo=(Mn=Oi-(un=(ci=be*Oi)-(ci-Oi)))*(io=Tn-(pn=(ci=be*Tn)-(ci-Tn)))-((Ho=Oi*Tn)-un*pn-Mn*pn-un*io))-(($i=Oo-(lu=(Mn=Gr-(un=(ci=be*Gr)-(ci-Gr)))*(io=Vi-(pn=(ci=be*Vi)-(ci-Vi)))-((Xs=Gr*Vi)-un*pn-Mn*pn-un*io)))+(Sr=Oo-$i))+(Sr-lu),st[1]=(Ws=Ho-((Wn=Ho+$i)-(Sr=Wn-Ho))+($i-Sr))-(($i=Ws-Xs)+(Sr=Ws-$i))+(Sr-Xs),st[2]=Wn-((no=Wn+$i)-(Sr=no-Wn))+($i-Sr),st[3]=no;var Zre=Le(qre,St,4,st,kt);return kt[Zre-1]}($t,Gt,tr,Ir,Jr,Qr,Fr)}(ue[0],ue[1],he[0],he[1],it[0],it[1]);return Ot>0?-1:Ot<0?1:0}function $e(ue,he){var it=ue.point,Ot=he.point;return it[0]>Ot[0]?1:it[0]<Ot[0]?-1:it[1]!==Ot[1]?it[1]>Ot[1]?1:-1:function($t,Gt,tr,Ir){return $t.left!==Gt.left?$t.left?1:-1:Ct(tr,$t.otherEvent.point,Gt.otherEvent.point)!==0?$t.isBelow(Gt.otherEvent.point)?-1:1:!$t.isSubject&&Gt.isSubject?1:-1}(ue,he,it)}
59function at(ue,he,it){var Ot=new oe(he,!1,ue,ue.isSubject),$t=new oe(he,!0,ue.otherEvent,ue.isSubject);return ae(ue.point,ue.otherEvent.point)&&console.warn("what is that, a collapsed segment?",ue),Ot.contourId=$t.contourId=ue.contourId,$e($t,ue.otherEvent)>0&&(ue.otherEvent.left=!0,$t.left=!1),ue.otherEvent.otherEvent=$t,ue.otherEvent=Ot,it.push($t),it.push(Ot),it}function Dt(ue,he){return ue[0]*he[1]-ue[1]*he[0]}function At(ue,he){return ue[0]*he[0]+ue[1]*he[1]}function sr(ue,he,it){var Ot=function(Jr,Qr,jr,Bi,Cn){var Fr=[Qr[0]-Jr[0],Qr[1]-Jr[1]],fn=[Bi[0]-jr[0],Bi[1]-jr[1]];function Ki(ci,un,Mn){return[ci[0]+un*Mn[0],ci[1]+un*Mn[1]]}var Ri=[jr[0]-Jr[0],jr[1]-Jr[1]],wn=Dt(Fr,fn),cn=wn*wn,Ji=At(Fr,Fr);if(cn>0){var nn=Dt(Ri,fn)/wn;if(nn<0||nn>1)return null;var Oi=Dt(Ri,Fr)/wn;return Oi<0||Oi>1?null:nn===0||nn===1?[Ki(Jr,nn,Fr)]:Oi===0||Oi===1?[Ki(jr,Oi,fn)]:[Ki(Jr,nn,Fr)]}if((cn=(wn=Dt(Ri,Fr))*wn)>0)return null;var Gr=At(Fr,Ri)/Ji,Vi=Gr+At(Fr,fn)/Ji,Tn=Math.min(Gr,Vi),Sr=Math.max(Gr,Vi);return Tn<=1&&Sr>=0?Tn===1?[Ki(Jr,Tn>0?Tn:0,Fr)]:Sr===0?[Ki(Jr,Sr<1?Sr:1,Fr)]:[Ki(Jr,Tn>0?Tn:0,Fr),Ki(Jr,Sr<1?Sr:1,Fr)]:null}(ue.point,ue.otherEvent.point,he.point,he.otherEvent.point),$t=Ot?Ot.length:0;if($t===0||$t===1&&(ae(ue.point,he.point)||ae(ue.otherEvent.point,he.otherEvent.point))||$t===2&&ue.isSubject===he.isSubject)return 0;if($t===1)return ae(ue.point,Ot[0])||ae(ue.otherEvent.point,Ot[0])||at(ue,Ot[0],it),ae(he.point,Ot[0])||ae(he.otherEvent.point,Ot[0])||at(he,Ot[0],it),1;var Gt=[],tr=!1,Ir=!1;return ae(ue.point,he.point)?tr=!0:$e(ue,he)===1?Gt.push(he,ue):Gt.push(ue,he),ae(ue.otherEvent.point,he.otherEvent.point)?Ir=!0:$e(ue.otherEvent,he.otherEvent)===1?Gt.push(he.otherEvent,ue.otherEvent):Gt.push(ue.otherEvent,he.otherEvent),tr&&Ir||tr?(he.type=E,ue.type=he.inOut===ue.inOut?I:A,tr&&!Ir&&at(Gt[1].otherEvent,Gt[0].point,it),2):Ir?(at(Gt[0],Gt[1].point,it),3):Gt[0]!==Gt[3].otherEvent?(at(Gt[0],Gt[1].point,it),at(Gt[1],Gt[2].point,it),3):(at(Gt[0],Gt[1].point,it),at(Gt[3].otherEvent,Gt[2].point,it),3)}function Qt(ue,he){if(ue===he)return 0;if(Ct(ue.point,ue.otherEvent.point,he.point)!==0||Ct(ue.point,ue.otherEvent.point,he.otherEvent.point)!==0)return ae(ue.point,he.point)?ue.isBelow(he.otherEvent.point)?-1:1:ue.point[0]===he.point[0]?ue.point[1]<he.point[1]?-1:1:$e(ue,he)===1?he.isAbove(ue.point)?-1:1:ue.isBelow(he.point)?-1:1;if(ue.isSubject!==he.isSubject)return ue.isSubject?-1:1;var it=ue.point,Ot=he.point;return it[0]===Ot[0]&&it[1]===Ot[1]?(it=ue.otherEvent.point)[0]===(Ot=he.otherEvent.point)[0]&&it[1]===Ot[1]?0:ue.contourId>he.contourId?1:-1:$e(ue,he)===1?1:-1}var bt=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Pt(ue,he,it,Ot){var $t,Gt=ue+1,tr=he[ue].point,Ir=he.length;for(Gt<Ir&&($t=he[Gt].point);Gt<Ir&&$t[0]===tr[0]&&$t[1]===tr[1];){if(!it[Gt])return Gt;++Gt<Ir&&($t=he[Gt].point)}for(Gt=ue-1;it[Gt]&&Gt>Ot;)Gt--;return Gt}bt.prototype.isExterior=function(){return this.holeOf==null};var rr=Ut,Wt=Ut;function Ut(ue,he){if(!(this instanceof Ut))return new Ut(ue,he);if(this.data=ue||[],this.length=this.data.length,this.compare=he||Xt,this.length>0)for(var it=(this.length>>1)-1;it>=0;it--)this._down(it)}function Xt(ue,he){return ue<he?-1:ue>he?1:0}Ut.prototype={push:function(ue){this.data.push(ue),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var ue=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),ue}},peek:function(){return this.data[0]},_up:function(ue){for(var he=this.data,it=this.compare,Ot=he[ue];ue>0;){var $t=ue-1>>1,Gt=he[$t];if(it(Ot,Gt)>=0)break;he[ue]=Gt,ue=$t}he[ue]=Ot},_down:function(ue){for(var he=this.data,it=this.compare,Ot=this.length>>1,$t=he[ue];ue<Ot;){var Gt=1+(ue<<1),tr=Gt+1,Ir=he[Gt];if(tr<this.length&&it(he[tr],Ir)<0&&(Gt=tr,Ir=he[tr]),it(Ir,$t)>=0)break;he[ue]=Ir,ue=Gt}he[ue]=$t}},rr.default=Wt;var xr=Math.max,Mr=Math.min,Or=0;function Rr(ue,he,it,Ot,$t,Gt){var tr,Ir,Jr,Qr,jr,Bi;for(tr=0,Ir=ue.length-1;tr<Ir;tr++)if(Qr=ue[tr+1],jr=new oe(Jr=ue[tr],!1,void 0,he),Bi=new oe(Qr,!1,jr,he),jr.otherEvent=Bi,Jr[0]!==Qr[0]||Jr[1]!==Qr[1]){jr.contourId=Bi.contourId=it,Gt||(jr.isExteriorRing=!1,Bi.isExteriorRing=!1),$e(jr,Bi)>0?Bi.left=!0:jr.left=!0;var Cn=Jr[0],Fr=Jr[1];$t[0]=Mr($t[0],Cn),$t[1]=Mr($t[1],Fr),$t[2]=xr($t[2],Cn),$t[3]=xr($t[3],Fr),Ot.push(jr),Ot.push(Bi)}}var ri=[];function Hr(ue,he,it){typeof ue[0][0][0]=="number"&&(ue=[ue]),typeof he[0][0][0]=="number"&&(he=[he]);var Ot=function(Fr,fn,Ki){var Ri=null;return Fr.length*fn.length==0&&(Ki===P?Ri=ri:Ki===O?Ri=Fr:Ki!==D&&Ki!==V||(Ri=Fr.length===0?fn:Fr)),Ri}(ue,he,it);if(Ot)return Ot===ri?null:Ot;var $t=[1/0,1/0,-1/0,-1/0],Gt=[1/0,1/0,-1/0,-1/0],tr=function(Fr,fn,Ki,Ri,wn){var cn,Ji,nn,Oi,Gr,Vi,Tn=new rr(null,$e);for(nn=0,Oi=Fr.length;nn<Oi;nn++)for(Gr=0,Vi=(cn=Fr[nn]).length;Gr<Vi;Gr++)(Ji=Gr===0)&&Or++,Rr(cn[Gr],!0,Or,Tn,Ki,Ji);for(nn=0,Oi=fn.length;nn<Oi;nn++)for(Gr=0,Vi=(cn=fn[nn]).length;Gr<Vi;Gr++)Ji=Gr===0,wn===O&&(Ji=!1),Ji&&Or++,Rr(cn[Gr],!1,Or,Tn,Ri,Ji);return Tn}(ue,he,$t,Gt,it);if(Ot=function(Fr,fn,Ki,Ri,wn){var cn=null;return(Ki[0]>Ri[2]||Ri[0]>Ki[2]||Ki[1]>Ri[3]||Ri[1]>Ki[3])&&(wn===P?cn=ri:wn===O?cn=Fr:wn!==D&&wn!==V||(cn=Fr.concat(fn))),cn}(ue,he,$t,Gt,it))return Ot===ri?null:Ot;for(var Ir=function(Fr){var fn,Ki,Ri=function(nn){var Oi,Gr,Vi,Tn,Sr=[];for(Gr=0,Vi=nn.length;Gr<Vi;Gr++)((Oi=nn[Gr]).left&&Oi.inResult||!Oi.left&&Oi.otherEvent.inResult)&&Sr.push(Oi);for(var ci=!1;!ci;)for(ci=!0,Gr=0,Vi=Sr.length;Gr<Vi;Gr++)Gr+1<Vi&&$e(Sr[Gr],Sr[Gr+1])===1&&(Tn=Sr[Gr],Sr[Gr]=Sr[Gr+1],Sr[Gr+1]=Tn,ci=!1);for(Gr=0,Vi=Sr.length;Gr<Vi;Gr++)(Oi=Sr[Gr]).otherPos=Gr;for(Gr=0,Vi=Sr.length;Gr<Vi;Gr++)(Oi=Sr[Gr]).left||(Tn=Oi.otherPos,Oi.otherPos=Oi.otherEvent.otherPos,Oi.otherEvent.otherPos=Tn);return Sr}(Fr),wn={},cn=[],Ji=function(){if(!wn[fn]){var nn=cn.length,Oi=function(Sr,ci,un){var Mn=new bt;if(Sr.prevInResult!=null){var pn=Sr.prevInResult,io=pn.outputContourId;if(pn.resultTransition>0){var $i=ci[io];if($i.holeOf!=null){var Wn=$i.holeOf;ci[Wn].holeIds.push(un),Mn.holeOf=Wn,Mn.depth=ci[io].depth}else ci[io].holeIds.push(un),Mn.holeOf=io,Mn.depth=ci[io].depth+1}else Mn.holeOf=null,Mn.depth=ci[io].depth}else Mn.holeOf=null,Mn.depth=0;return Mn}(Ri[fn],cn,nn),Gr=function(Sr){wn[Sr]=!0,Sr<Ri.length&&Ri[Sr]&&(Ri[Sr].outputContourId=nn)},Vi=fn,Tn=fn;for(Oi.points.push(Ri[fn].point);Gr(Vi),Gr(Vi=Ri[Vi].otherPos),Oi.points.push(Ri[Vi].point),!((Vi=Pt(Vi,Ri,wn,Tn))==Tn||Vi>=Ri.length)&&Ri[Vi];);cn.push(Oi)}};for(fn=0,Ki=Ri.length;fn<Ki;fn++)Ji();return cn}(function(Fr,fn,Ki,Ri,wn,cn){for(var Ji,nn,Oi,Gr=new h(Qt),Vi=[],Tn=Math.min(Ri[2],wn[2]);Fr.length!==0;){var Sr=Fr.pop();if(Vi.push(Sr),cn===P&&Sr.point[0]>Tn||cn===O&&Sr.point[0]>Ri[2])break;if(Sr.left){nn=Ji=Gr.insert(Sr),Ji=Ji!==(Oi=Gr.minNode())?Gr.prev(Ji):null,nn=Gr.next(nn);var ci=Ji?Ji.key:null;if(j(Sr,ci,cn),nn&&sr(Sr,nn.key,Fr)===2&&(j(Sr,ci,cn),j(nn.key,Sr,cn)),Ji&&sr(Ji.key,Sr,Fr)===2){var un=Ji;j(ci,(un=un!==Oi?Gr.prev(un):null)?un.key:null,cn),j(Sr,ci,cn)}}else nn=Ji=Gr.find(Sr=Sr.otherEvent),Ji&&nn&&(Ji=Ji!==Oi?Gr.prev(Ji):null,nn=Gr.next(nn),Gr.remove(Sr),nn&&Ji&&sr(Ji.key,nn.key,Fr))}return Vi}(tr,0,0,$t,Gt,it)),Jr=[],Qr=0;Qr<Ir.length;Qr++){var jr=Ir[Qr];if(jr.isExterior()){for(var Bi=[jr.points],Cn=0;Cn<jr.holeIds.length;Cn++)Bi.push(Ir[jr.holeIds[Cn]].points);Jr.push(Bi)}}return Jr}var ln={UNION:D,DIFFERENCE:O,INTERSECTION:P,XOR:V};n.diff=function(ue,he){return Hr(ue,he,O)},n.intersection=function(ue,he){return Hr(ue,he,P)},n.operations=ln,n.union=function(ue,he){return Hr(ue,he,D)},n.xor=function(ue,he){return Hr(ue,he,V)}
59,Object.defineProperty(n,"__esModule",{value:!0})})(r)}(0,tj.exports)),tj.exports);/**
60 * martinez v0.7.4
61 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
62 *
63 * @author Alex Milevski <[email protected]>
64 * @license MIT
65 * @preserve
66 */function Pw(a,r,n,c){const h=[],m=c===0?(g,x,w,E,I,A)=>{g.push(new Tt(A,w+(A-x)/(E-x)*(I-w)))}:(g,x,w,E,I,A)=>{g.push(new Tt(x+(A-w)/(I-w)*(E-x),A))};for(const g of a){const x=[];for(const w of g){if(w.length<=2)continue;const E=[];for(let P=0;P<w.length-1;P++){const D=w[P].x,O=w[P].y,V=w[P+1].x,j=w[P+1].y,X=c===0?D:O,oe=c===0?V:j;X<r?oe>r&&m(E,D,O,V,j,r):X>n?oe<n&&m(E,D,O,V,j,n):E.push(w[P]),oe<r&&X>=r&&m(E,D,O,V,j,r),oe>n&&X<=n&&m(E,D,O,V,j,n)}let I=w[w.length-1];const A=c===0?I.x:I.y;A>=r&&A<=n&&E.push(I),E.length&&(I=E[E.length-1],E[0].x===I.x&&E[0].y===I.y||E.push(E[0]),x.push(E))}x.length&&h.push(x)}return h}function qQ(a,r){const n=sA(a),c=sA([r]),h=rj.intersection(n,c);return h==null?[]:ij(h)}function ZQ(a,r){let c=sA(a,65536);for(;r.valid();r.next()){const[h,m]=r.get(),g=h.x*65536,x=h.y*65536,w=m.x*65536,E=m.y*65536,I=w-g,A=E-x,P=Math.hypot(I,A),D=Math.trunc(A/P*3),O=-Math.trunc(I/P*3);c=rj.diff(c,[[[g,x],[w,E],[w+D,E+O],[g+D,x+O],[g,x]]])}return ij(c,1/65536)}function sA(a,r=1){return[a.map(n=>n.map(c=>[c.x*r,c.y*r]))]}function ij(a,r=1){return a.map(n=>n.map((c,h)=>{const m=c.map(g=>new Tt(g[0]*r,g[1]*r).round());return h>0&&m.reverse(),m}))}class aA{constructor(r,n){this.layoutVertexArray=new Ps,this.indexArray=new gn,this.lineIndexArray=new Dl,this.triangleSegments=new xn,this.lineSegments=new xn,this.programConfigurations=new ga(r.layers,{zoom:r.zoom,lut:r.lut}),this.uploaded=!1,n&&(this.elevatedLayoutVertexArray=new Zu)}update(r,n,c,h,m,g,x,w){this.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x,w)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,kQ.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.lineIndexBuffer=r.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=r.createVertexBuffer(this.elevatedLayoutVertexArray,RQ.members))),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(r,n,c,h,m,g,x){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,n,c,h,m,g,void 0,x)}}class lA{constructor(r){this.zoom=r.zoom,this.pixelRatio=r.pixelRatio,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(n=>n.fqid),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=r.lut,this.bufferData=new aA(r,!1),this.elevationBufferData=new aA(r,!0),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.projection=r.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=r.sourceLayerIndex,this.worldview=r.worldview}updateFootprints(r,n){}populate(r,n,c,h){this.hasPattern=nA("fill",this.layers,this.pixelRatio,n);const m=this.layers[0].layout.get("fill-sort-key"),g=[];for(const{feature:x,id:w,index:E,sourceLayerIndex:I}of r){const A=this.layers[0]._featureFilter.needGeometry,P=nt(x,A);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom,{worldview:this.worldview}),P,c))continue;const D=m?m.evaluate(P,{},c,n.availableImages):void 0,O={id:w,properties:x.properties,type:x.type,sourceLayerIndex:I,index:E,geometry:A?P.geometry:Pe(x,c,h),patterns:{},sortKey:D};g.push(O)}m&&g.sort((x,w)=>x.sortKey-w.sortKey);for(const x of g){const{geometry:w,index:E,sourceLayerIndex:I}=x;if(this.hasPattern){const A=oA("fill",this.layers,x,this.zoom,this.pixelRatio,n);this.patternFeatures.push(A)}else this.addFeature(x,w,E,c,{},n.availableImages,n.brightness,n.elevationFeatures);n.featureIndex.insert(r[E].feature,w,E,I,this.index)}}update(r,n,c,h,m,g,x){this.bufferData.update(r,n,c,h,m,g,x,this.worldview),this.elevationBufferData.update(r,n,c,h,m,g,x,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(r,n,c,h,m,g,x,this.worldview)}addFeatures(r,n,c,h,m,g){for(const x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,n,c,h,g,r.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(r){this.bufferData.upload(r),this.elevationBufferData.upload(r),this.elevatedStructures&&this.elevatedStructures.upload(r)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
vendor: 33,712 bytes, line 66
66addFeature(r,n,c,h,m,g=[],x,w){const E=$0(n,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(r,E,h,c,w):this.addGeometry(E,this.bufferData),this.bufferData.populatePaintArrays(r,c,m,g,h,x,this.worldview),this.elevationBufferData.populatePaintArrays(r,c,m,g,h,x,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(r,n,c,h,m){this.elevatedStructures&&(this.elevatedStructures.construct(r),this.elevatedStructures.populatePaintArrays(n,c,h,m,this.worldview))}addElevatedRoadFeature(r,n,c,h,m){const g=new Array,x=bn.getElevationFeature(r,m);if(!x)return void this.addGeometry(n,this.bufferData);{const E=this.clipPolygonsToTile(n,1);E.length>0&&g.push({polygons:E,elevationFeature:x,elevationTileID:c})}const w={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(r,{},c),featureIndex:h};for(const E of g)if(E.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new ba(E.elevationTileID,this.layers,this.zoom,this.lut));const A=E.elevationFeature.isTunnel();let P=0;r.properties.hasOwnProperty(ar)&&(P=+r.properties[ar]);for(const D of E.polygons)this.elevatedStructures.addPortalCandidates(E.elevationFeature.id,D,A,E.elevationFeature,P)}E.elevationFeature.constantHeight==null&&(E.polygons=this.prepareElevatedPolygons(E.polygons,E.elevationFeature,E.elevationTileID));const I=new hi(c,E.elevationTileID);this.addElevatedGeometry(E.polygons,I,E.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,h,w)}}addElevatedGeometry(r,n,c,h,m,g){const x={elevation:c,elevationSampler:n,bias:h,index:m,featureInfo:g},[w,E]=this.addGeometry(r,this.elevationBufferData,x);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:w,max:E}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,w),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,E))}addGeometry(r,n,c){let h=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=null;c&&(g=c.elevationSampler.constantElevation(c.elevation,c.bias),g!=null&&(h=g,m=g));const x=(w,E,I)=>{if(c!=null)if(E.push(w),g!=null)n.elevatedLayoutVertexArray.emplaceBack(g),I.push(g);else{const A=c.elevationSampler.pointElevation(w,c.elevation,c.bias);n.elevatedLayoutVertexArray.emplaceBack(A),I.push(A),h=Math.min(h,A),m=Math.max(m,A)}};for(const w of r){let E=0;for(const ne of w)E+=ne.length;const I=n.triangleSegments.prepareSegment(E,n.layoutVertexArray,n.indexArray),A=I.vertexLength,P=[],D=[],O=[],V=[],j=[],X=n.layoutVertexArray.length;for(const ne of w){if(ne.length===0)continue;ne!==w[0]&&D.push(P.length/2);const ae=n.lineSegments.prepareSegment(ne.length,n.layoutVertexArray,n.lineIndexArray),Ie=ae.vertexLength;c&&j.push(n.layoutVertexArray.length-X),x(ne[0],O,V),n.layoutVertexArray.emplaceBack(ne[0].x,ne[0].y),n.lineIndexArray.emplaceBack(Ie+ne.length-1,Ie),P.push(ne[0].x),P.push(ne[0].y);for(let be=1;be<ne.length;be++)x(ne[be],O,V),n.layoutVertexArray.emplaceBack(ne[be].x,ne[be].y),n.lineIndexArray.emplaceBack(Ie+be-1,Ie+be),P.push(ne[be].x),P.push(ne[be].y);ae.vertexLength+=ne.length,ae.primitiveLength+=ne.length}const oe=ug(P,D);for(let ne=0;ne<oe.length;ne+=3)n.indexArray.emplaceBack(A+oe[ne],A+oe[ne+1],A+oe[ne+2]);if(oe.length>0&&c&&this.elevationMode==="hd-road-base"){const ne=c.elevation.isTunnel(),ae=c.elevation.safeArea,Ie=this.elevatedStructures.addVertices(O,V);this.elevatedStructures.addTriangles(oe,Ie,ne);const be=j.length;if(be>0){for(let Te=0;Te<be-1;Te++)this.elevatedStructures.addRenderableRing(c.index,j[Te]+Ie,j[Te+1]-j[Te],ne,ae,c.featureInfo);this.elevatedStructures.addRenderableRing(c.index,j[be-1]+Ie,O.length-j[be-1],ne,ae,c.featureInfo)}}I.vertexLength+=E,I.primitiveLength+=oe.length/3}return[h,m]}prepareElevatedPolygons(r,n,c){const h=1/ge(c),m=[];for(const g of r){const x=ZQ(g,new Di(n,h));m.push(...x)}return m}clipPolygonsToTile(r,n){const c=-n,h=-n,m=Vt+n,g=Vt+n;let x=0;const w=[],E=[];for(;x<r.length;x++){const P=r[x],D=Ry(P);(D.min.x>=c&&D.max.x<=m&&D.min.y>=h&&D.max.y<=g?w:E).push(P)}if(w.length===r.length)return r;const I=[new Tt(c,h),new Tt(m,h),new Tt(m,g),new Tt(c,g),new Tt(c,h)],A=w;for(const P of E)A.push(...qQ(P,I));return A}}let nj,oj,sj,aj;Jt(lA,"FillBucket",{omit:["layers","patternFeatures"]}),Jt(aA,"FillBufferData"),Jt(ba,"ElevatedStructures");class Mw{constructor(r,n,c,h){if(this.triangleCount=n.length/3,this.min=new Tt(0,0),this.max=new Tt(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||r.length===0)return;const[m,g]=[r[0].clone(),r[0].clone()];for(let A=1;A<r.length;++A){const P=r[A];m.x=Math.min(m.x,P.x),m.y=Math.min(m.y,P.y),g.x=Math.max(g.x,P.x),g.y=Math.max(g.y,P.y)}if(h){const A=Math.ceil(Math.max(g.x-m.x,g.y-m.y)/h);c=Math.max(c,A)}if(c===0)return;this.min=m,this.max=g;const x=this.max.sub(this.min);x.x=Math.max(x.x,1),x.y=Math.max(x.y,1);const w=Math.max(x.x,x.y)/c;this.cellsX=Math.max(1,Math.ceil(x.x/w)),this.cellsY=Math.max(1,Math.ceil(x.y/w)),this.xScale=1/w,this.yScale=1/w;const E=[];for(let A=0;A<this.triangleCount;A++){const P=r[n[3*A+0]].sub(this.min),D=r[n[3*A+1]].sub(this.min),O=r[n[3*A+2]].sub(this.min),V=su(Math.floor(Math.min(P.x,D.x,O.x)),this.xScale,this.cellsX),j=su(Math.floor(Math.max(P.x,D.x,O.x)),this.xScale,this.cellsX),X=su(Math.floor(Math.min(P.y,D.y,O.y)),this.yScale,this.cellsY),oe=su(Math.floor(Math.max(P.y,D.y,O.y)),this.yScale,this.cellsY),ne=new Tt(0,0),ae=new Tt(0,0),Ie=new Tt(0,0),be=new Tt(0,0);for(let Te=X;Te<=oe;++Te){ne.y=ae.y=Te*w,Ie.y=be.y=(Te+1)*w;for(let Le=V;Le<=j;++Le)ne.x=Ie.x=Le*w,ae.x=be.x=(Le+1)*w,(to(P,D,O,ne,ae,be)||to(P,D,O,ne,be,Ie))&&E.push({cellIdx:Te*this.cellsX+Le,triIdx:A})}}if(E.length===0)return;E.sort((A,P)=>A.cellIdx-P.cellIdx||A.triIdx-P.triIdx);let I=0;for(;I<E.length;){const A=E[I].cellIdx,P={start:this.payload.length,len:0};for(;I<E.length&&E[I].cellIdx===A;)++P.len,this.payload.push(E[I++].triIdx);this.cells[A]=P}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(r,n){if(this.triangleCount===0||this.cells.length===0||r.x>this.max.x||this.min.x>r.x||r.y>this.max.y||this.min.y>r.y)return;const c=su(r.x-this.min.x,this.xScale,this.cellsX),h=su(r.y-this.min.y,this.yScale,this.cellsY),m=this.cells[h*this.cellsX+c];if(m){this._lazyInitLookup();for(let g=0;g<m.len;g++){const x=this.payload[m.start+g],w=Math.floor(x/8),E=1<<x%8;if(!(this.lookup[w]&E)&&(this.lookup[w]|=E,n.push(x),n.length===this.triangleCount))return}}}query(r,n,c){if(this.triangleCount===0||this.cells.length===0||r.x>this.max.x||this.min.x>n.x||r.y>this.max.y||this.min.y>n.y)return;this._lazyInitLookup();const h=su(r.x-this.min.x,this.xScale,this.cellsX),m=su(n.x-this.min.x,this.xScale,this.cellsX),g=su(r.y-this.min.y,this.yScale,this.cellsY),x=su(n.y-this.min.y,this.yScale,this.cellsY);for(let w=g;w<=x;w++)for(let E=h;E<=m;E++){const I=this.cells[w*this.cellsX+E];if(I)for(let A=0;A<I.len;A++){const P=this.payload[I.start+A],D=Math.floor(P/8),O=1<<P%8;if(!(this.lookup[D]&O)&&(this.lookup[D]|=O,c.push(P),c.length===this.triangleCount))return}}}}function su(a,r,n){return Math.max(0,Math.min(n-1,Math.floor(a*r)))}Jt(Mw,"TriangleGridIndex");class lj{constructor(r){this.zoom=r.zoom,this.layers=r.layers,this.layerIds=this.layers.map(n=>n.fqid),this.index=r.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.footprints=[],this.worldview=r.worldview}updateFootprints(r,n){for(const c of this.footprints)n.push({footprint:c,id:r})}populate(r,n,c,h){const m=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of r){const I=this.layers[0]._featureFilter.needGeometry,A=nt(g,I);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom,{worldview:this.worldview}),A,c))continue;const P={id:x,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:I?A.geometry:Pe(g,c,h),patterns:{}};m.push(P)}for(const g of m){const{geometry:x,index:w,sourceLayerIndex:E}=g;this.addFeature(g,x,w,c,{},n.availableImages,n.brightness),n.featureIndex.insert(r[w].feature,x,w,E,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(r){}update(r,n,c,h,m,g,x){}destroy(){}addFeature(r,n,c,h,m,g=[],x){for(const w of $0(n,2)){const E=[],I=[],A=[],P=new Tt(1/0,1/0),D=new Tt(-1/0,-1/0);for(const j of w)if(j.length!==0){j!==w[0]&&A.push(I.length/2);for(let X=0;X<j.length;X++)I.push(j[X].x),I.push(j[X].y),E.push(j[X]),P.x=Math.min(P.x,j[X].x),P.y=Math.min(P.y,j[X].y),D.x=Math.max(D.x,j[X].x),D.y=Math.max(D.y,j[X].y)}const O=ug(I,A),V=new Mw(E,O,8,256);this.footprints.push({vertices:E,indices:O,grid:V,min:P,max:D})}}}Jt(lj,"ClipBucket",{omit:["layers"]});const WQ=si([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),XQ=si([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),YQ=si([{name:"a_centroid_pos",components:2,type:"Uint16"}]),KQ=si([{name:"a_join_normal_inside",components:3,type:"Int16"}]),JQ=si([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),QQ=si([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:eee}=WQ,H0=Number.MAX_SAFE_INTEGER,cj=H0-1;function uj(a,r,n,c){return a.order<r||a.order===H0||!(a.clipMask&n)||function(h,m){return m.length!==0&&m.find(g=>g===h)===void 0}(c,a.clipScope)}function kw(a,r){return a.x-r.x||a.y-r.y}function hj(a,r){return kw(a.min,r.min)===0&&kw(a.max,r.max)===0}function cA(a,r){return!(a.min.x>r.max.x||a.max.x<r.min.x||a.min.y>r.max.y||a.max.y<r.min.y)}function Rw(a,r){if(a.length!==r.length)return!1;for(let n=0;n<a.length;n++)if(a[n].sourceId!==r[n].sourceId||!hj(a[n],r[n])||a[n].order!==r[n].order||a[n].clipMask!==r[n].clipMask||!rl(a[n].clipScope,r[n].clipScope))return!1;return!0}function dj(a,r,n){const c=1/Vt,h=1/(1<<n.canonical.z),m=(r.x*c+n.canonical.x)*h+n.wrap,g=(r.y*c+n.canonical.y)*h;return{min:new Tt((a.x*c+n.canonical.x)*h+n.wrap,(a.y*c+n.canonical.y)*h),max:new Tt(m,g)}}function tee(a,r,n){const c=1<<n.canonical.z,h=((r.x-n.wrap)*c-n.canonical.x)*Vt,m=(r.y*c-n.canonical.y)*Vt;return{min:new Tt(((a.x-n.wrap)*c-n.canonical.x)*Vt,(a.y*c-n.canonical.y)*Vt),max:new Tt(h,m)}}function uA(a,r,n,c,h,m,g){const x=a.indices,w=a.vertices,E=[];for(let I=c;I<c+h;I+=3){const A=r[n[I+0]+m],P=r[n[I+1]+m],D=r[n[I+2]+m],O=Math.min(A.x,P.x,D.x),V=Math.max(A.x,P.x,D.x),j=Math.min(A.y,P.y,D.y),X=Math.max(A.y,P.y,D.y);E.length=0,a.grid.query(new Tt(O,j),new Tt(V,X),E);for(let oe=0;oe<E.length;oe++){const ne=E[oe];if(to(w[x[3*ne+0]],w[x[3*ne+1]],w[x[3*ne+2]],A,P,D,g))return!0}}return!1}function fj(a,r,n,c){if(!a||!n)return!1;let h=a.vertices;if(!r.canonical.equals(c.canonical)||r.wrap!==c.wrap){if(n.vertices.length<a.vertices.length)return fj(n,c,a,r);const m=r.canonical,g=c.canonical,x=Math.pow(2,g.z-m.z);h=a.vertices.map(w=>new Tt((w.x+m.x*Vt)*x-g.x*Vt,(w.y+m.y*Vt)*x-g.y*Vt))}return uA(n,h,a.indices,0,a.indices.length,0,0)}function pj(a,r,n,c){const h=Math.pow(2,c.z-n.z);return new Tt((a+n.x*Vt)*h-c.x*Vt,(r+n.y*Vt)*h-c.y*Vt)}function hA(a,r){const n=[];r.grid.queryPoint(a,n);const c=r.indices,h=r.vertices;for(let m=0;m<n.length;m++){const g=n[m];if(Go([h[c[3*g+0]],h[c[3*g+1]],h[c[3*g+2]]],a))return!0}return!1}const dA=[new Tt(0,0),new Tt(Vt,0),new Tt(Vt,Vt),new Tt(0,Vt)];function mj(a,r){const n=[];let c=[];if(!r||a.length<2)return[a];if(a.length===2)return Pn(a[0],a[1],dA)?[a]:[];for(let h=0;h<a.length+2;h++){const m=a[h%a.length],g=a[(h+1)%a.length],x=Pn(h===0?a[a.length-1]:a[(h-1)%a.length],m,dA),w=Pn(m,g,dA),E=x||w;E&&c.push(m),E&&w||c.length>0&&(c.length>1&&n.push(c),c=[])}return c.length>1&&n.push(c),n}const fA=Ke.types,ree=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],iee=["fill-extrusion-flood-light-ground-radius"],nee=Math.pow(2,13),oee=Math.pow(2,15)-1,gj=new Tt(0,1),Td=2147483648;function q0(a,r,n,c,h,m,g,x){a.emplaceBack((r<<1)+g,(n<<1)+m,(Math.floor(c*nee)<<1)+h,Math.round(x))}function Z0(a,r,n){a.emplaceBack(r.x*Vt,r.y*Vt,n?1:0)}function Lw(a,r,n,c,h,m){a.emplaceBack(r.x,r.y,(n.x<<1)+c,(n.y<<1)+h,m)}function W0(a,r,n){a.emplaceBack(r.x,r.y,r.z,n[0]*16384,n[1]*16384,n[2]*16384)}class _j{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class yj{constructor(){this.centroidXY=new Tt(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Tt(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Tt(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Tt(this.max.x-this.min.x,this.max.y-this.min.y)}}class vj{constructor(){this.acc=new Tt(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(r,n){r.min.x===Number.MAX_VALUE&&(r.min.x=r.max.x=n.x,r.min.y=r.max.y=n.y)}appendEdge(r,n,c){this.accCount++,this.acc._add(n);let h=!!this.borders;n.x<r.min.x?(r.min.x=n.x,h=!0):n.x>r.max.x&&(r.max.x=n.x,h=!0),n.y<r.min.y?(r.min.y=n.y,h=!0):n.y>r.max.y&&(r.max.y=n.y,h=!0),((n.x===0||n.x===Vt)&&n.x===c.x)!=((n.y===0||n.y===Vt)&&n.y===c.y)&&this.processBorderOverlap(n,c),h&&this.checkBorderIntersection(n,c)}checkBorderIntersection(r,n){n.x<0!=r.x<0&&this.addBorderIntersection(0,_r(n.y,r.y,(0-n.x)/(r.x-n.x))),n.x>Vt!=r.x>Vt&&this.addBorderIntersection(1,_r(n.y,r.y,(Vt-n.x)/(r.x-n.x))),n.y<0!=r.y<0&&this.addBorderIntersection(2,_r(n.x,r.x,(0-n.y)/(r.y-n.y))),n.y>Vt!=r.y>Vt&&this.addBorderIntersection(3,_r(n.x,r.x,(Vt-n.y)/(r.y-n.y)))}addBorderIntersection(r,n){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const c=this.borders[r];n<c[0]&&(c[0]=n),n>c[1]&&(c[1]=n)}processBorderOverlap(r,n){if(r.x===n.x){if(r.y===n.y)return;const c=r.x===0?0:1;this.addBorderIntersection(c,n.y),this.addBorderIntersection(c,r.y)}else{const c=r.y===0?2:3;this.addBorderIntersection(c,n.x),this.addBorderIntersection(c,r.x)}}centroid(){return this.accCount===0?new Tt(0,0):new Tt(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((r,n)=>r+ +(n[0]!==Number.MAX_VALUE),0):0}}function xj(a,r){const n=a.add(r)._unit(),c=J(a.x*n.x+a.y*n.y,-1,1);var h,m,g;return h=Math.acos(c),Math.min(4,Math.max(-4,Math.tan(h)))/4*oee*((m=a).x*(g=r).y-m.y*g.x<0?-1:1)}const see=[a=>a.x<0,a=>a.x>Vt,a=>a.y<0,a=>a.y>Vt];function aee(a,r,n,c){const h=[4];if(c===0)return h;n._mult(c);const m=a.sub(n),g=r.sub(n),x=[a,r,m,g];for(let w=0;w<4;w++)for(const E of x)if(see[w](E)){h.push(w);break}return h}class pA{constructor(r){this.vertexArray=new Qm,this.indexArray=new gn,this.programConfigurations=new ga(r.layers,{zoom:r.zoom,lut:r.lut},n=>iee.includes(n)),this._segments=new xn,this.hiddenByLandmarkVertexArray=new og,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new xn}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(r,n,c,h=!1){const m=r.length;if(m>2){let g=Math.max(0,this._segments.get().length-1);const x=this._segments._prepareSegment(4*m,this.vertexArray.length,2*this._segmentToGroundQuads[g].length);let w;g!==this._segments.get().length-1&&(g++,this._segmentToGroundQuads[g]=[],this._segmentToRegionTriCounts[g]=[0,0,0,0,0]);{const E=r[0],I=r[1];w=xj(E.sub(r[m-1])._perp()._unit(),I.sub(E)._perp()._unit())}for(let E=0;E<m;E++){const I=E===m-1?0:E+1,A=r[E],P=r[I],D=r[I===m-1?0:I+1],O=P.sub(A)._perp()._unit(),V=xj(O,D.sub(P)._perp()._unit()),j=w,X=V;if(mA(A,P,n)||h&&Tj(A,n)&&Tj(P,n)){w=V;continue}const oe=x.vertexLength;Lw(this.vertexArray,A,P,1,1,j),Lw(this.vertexArray,A,P,1,0,j),Lw(this.vertexArray,A,P,0,1,X),Lw(this.vertexArray,A,P,0,0,X),x.vertexLength+=4;const ne=aee(A,P,O,c);for(const ae of ne)this._segmentToGroundQuads[g].push({id:oe,region:ae}),this._segmentToRegionTriCounts[g][ae]+=2,x.primitiveLength+=2;w=V}}}prepareBorderSegments(){if(!this.hasData())return;const r=this._segments.get(),n=r.length;for(let c=0;c<n;c++)this._segmentToGroundQuads[c].sort((h,m)=>h.region-m.region);for(let c=0;c<n;c++){const h=this._segmentToGroundQuads[c],m=r[c],g=this._segmentToRegionTriCounts[c];g.reduce((w,E)=>w+E,0);let x=0;for(let w=0;w<=4;w++){const E=g[w];if(E!==0){let I=this.regionSegments[w];I||(I=this.regionSegments[w]=new xn);const A={vertexOffset:m.vertexOffset,primitiveOffset:m.primitiveOffset+x,vertexLength:m.vertexLength,primitiveLength:E};I.get().push(A)}x+=E}for(let w=0;w<h.length;w++){const E=h[w].id;this.indexArray.emplaceBack(E,E+1,E+3),this.indexArray.emplaceBack(E,E+3,E+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(r,n,c,h,m,g,x){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,r,n,c,h,m,g,void 0,x)}upload(r){this.hasData()&&(this.vertexBuffer=r.createVertexBuffer(this.vertexArray,XQ.members),this.indexBuffer=r.createIndexBuffer(this.indexArray))}uploadPaintProperties(r){this.hasData()&&this.programConfigurations.upload(r)}update(r,n,c,h,m,g,x,w){this.hasData()&&this.programConfigurations.updatePaintArrays(r,n,c,h,m,g,x,w)}updateHiddenByLandmark(r){this.updateHiddenByLandmarkRange(r.groundVertexArrayOffset,r.groundVertexCount,!!(r.flags&Td))}updateHiddenByLandmarkRange(r,n,c){if(!this.hasData())return;const h=n+r;if(n!==0){for(let m=r;m<h;++m)this.hiddenByLandmarkVertexArray.emplace(m,c?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(r){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=r.createVertexBuffer(this.hiddenByLandmarkVertexArray,JQ.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let r=0;r<=4;r++){const n=this.regionSegments[r];n&&n.destroy()}}}}class zw{constructor(r){this.zoom=r.zoom,this.canonical=r.canonical,this.overscaling=r.overscaling,this.layers=r.layers,this.pixelRatio=r.pixelRatio,this.layerIds=this.layers.map(n=>n.fqid),this.index=r.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=r.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new gn,this.footprintVertices=new Ps,this.footprintSegments=[],this.layoutVertexArray=new ud,this.centroidVertexArray=new fw,this.wallVertexArray=new mw,this.indexArray=new gn,this.programConfigurations=new ga(r.layers,{zoom:r.zoom,lut:r.lut},n=>ree.includes(n)),this.segments=new xn,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.groundEffect=new pA(r),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=r.worldview}updateFootprints(r,n){}populate(r,n,c,h){this.features=[],this.hasPattern=nA("fill-extrusion",this.layers,this.pixelRatio,n),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=ge(c),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of r){const E=this.layers[0]._featureFilter.needGeometry,I=nt(m,E);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom,{worldview:this.worldview}),I,c))continue;const A={id:g,sourceLayerIndex:w,index:x,geometry:E?I.geometry:Pe(m,c,h),properties:m.properties,type:m.type,patterns:{}},P=this.layoutVertexArray.length,D=fA[A.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:m.id,feature:oA("fill-extrusion",this.layers,A,this.zoom,this.pixelRatio,n)});else if(this.wallMode)for(const O of A.geometry)for(const V of mj(O,D))this.addFeature(m.id,A,[V],x,c,{},n.availableImages,h,n.brightness);else this.addFeature(m.id,A,A.geometry,x,c,{},n.availableImages,h,n.brightness);n.featureIndex.insert(m,A.geometry,x,w,this.index,P)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(r,n,c,h,m,g){for(const{featureId:x,feature:w}of this.features){const E=fA[w.type]==="Polygon",{geometry:I}=w;if(this.wallMode)for(const A of I)for(const P of mj(A,E))this.addFeature(x,w,[P],w.index,n,c,h,m,g);else this.addFeature(x,w,I,w.index,n,c,h,m,g)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(r,n,c,h,m,g,x){this.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x,this.worldview),this.groundEffect.update(r,n,m,c,h,g,x,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,eee),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.wallVertexBuffer=r.createVertexBuffer(this.wallVertexArray,KQ.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=r.createVertexBuffer(this.layoutVertexExtArray,QQ.members,!0)),this.groundEffect.upload(r)),this.groundEffect.uploadPaintProperties(r),this.programConfigurations.upload(r),this.uploaded=!0}uploadCentroid(r){this.groundEffect.uploadHiddenByLandmark(r),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=r.createVertexBuffer(this.centroidVertexArray,YQ.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(r,n,c,h,m,g,x,w,E){const I=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(n,{})/this.tileToMeter,A=[new Tt(0,0),new Tt(Vt,Vt)],P=w.projection,D=P.name==="globe",O=this.wallMode||fA[n.type]==="Polygon",V=new vj;V.centroidDataIndex=this.centroidData.length;const j=new yj;j.buildingId=r,n.properties&&n.properties.hasOwnProperty("building_id")&&(j.buildingId=n.properties.building_id);const X=this.layers[0].paint.get("fill-extrusion-base").evaluate(n,{},m)<=0,oe=this.layers[0].paint.get("fill-extrusion-height").evaluate(n,{},m);let ne;if(j.height=oe,j.vertexArrayOffset=this.layoutVertexArray.length,j.groundVertexArrayOffset=this.groundEffect.vertexArray.length,D&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new tg),this.wallMode){if(D)return void Ar("Non zero fill-extrusion-line-width is not yet supported on globe.");if(c.length!==1)return;ne=function(je){const ht=je[0].x===je[je.length-1].x&&je[0].y===je[je.length-1].y;(function(Pt){let rr=0;const Wt=Pt.length;for(let Ut=0;Ut<Wt;Ut++)rr+=(Pt[(Ut+1)%Wt].x-Pt[Ut].x)*(Pt[(Ut+1)%Wt].y+Pt[Ut].y);return rr>=0})(je)||(je=je.reverse());const gt={geometry:[],joinNormals:[],indices:[]},St=[],kt=[],st=[];let Ct=je.length;for(;Ct>=2&&je[Ct-1].equals(je[Ct-2]);)Ct--;if(Ct<(ht?3:2))return gt;let $e,at,Dt,At,sr,Qt=0;for(;Qt<Ct-1&&je[Qt].equals(je[Qt+1]);)Qt++;ht&&($e=je[Ct-2],sr=je[Qt].sub($e)._unit()._perp());for(let Pt=Qt;Pt<Ct;Pt++){if(Dt=Pt===Ct-1?ht?je[Qt+1]:void 0:je[Pt+1],Dt&&je[Pt].equals(Dt))continue;sr&&(At=sr),$e&&(at=$e),$e=je[Pt],sr=Dt?Dt.sub($e)._unit()._perp():At,At=At||sr;let rr=At.add(sr);rr.x===0&&rr.y===0||rr._unit();const Wt=rr.x*sr.x+rr.y*sr.y,Ut=Wt!==0?1/Wt:1/0,Xt=At.x*sr.y-At.y*sr.x>0;let xr="miter";const Mr=2;xr==="miter"&&Ut>Mr&&(xr="bevel"),xr==="bevel"&&(Ut>100&&(xr="flipbevel"),Ut<Mr&&(xr="miter"));const Or=(Rr,ri,Hr,ln)=>{const ue=new Tt(Rr.x,Rr.y),he=new Tt(Rr.x,Rr.y);ue.x+=ri.x*ln,ue.y+=ri.y*ln,he.x-=ri.x*Math.max(Hr,1),he.y-=ri.y*Math.max(Hr,1),st.push(ri),St.push(ue),kt.push(he)};if(xr==="miter")rr._mult(Ut),Or($e,rr,0,0);else if(xr==="flipbevel")rr=sr.mult(-1),Or($e,rr,0,0),Or($e,rr.mult(-1),0,0);else{const Rr=-Math.sqrt(Ut*Ut-1),ri=Xt?Rr:0,Hr=Xt?0:Rr;at&&Or($e,At,ri,Hr),Dt&&Or($e,sr,ri,Hr)}}gt.geometry=[...St,...kt.reverse(),St[0]],gt.joinNormals=[...st,...st.reverse(),st[st.length-1]];const bt=gt.geometry.length-1;for(let Pt=0;Pt<bt/2;Pt++)if(Pt+1<bt/2){let rr=Pt,Wt=Pt+1,Ut=bt-1-Pt,Xt=bt-2-Pt;rr=rr===0?bt-1:rr-1,Wt=Wt===0?bt-1:Wt-1,Ut=Ut===0?bt-1:Ut-1,Xt=Xt===0?bt-1:Xt-1,gt.indices.push(Ut),gt.indices.push(Wt),gt.indices.push(rr),gt.indices.push(Ut),gt.indices.push(Xt),gt.indices.push(Wt)}return gt}(c[0]),c=[ne.geometry]}const ae=(je,ht)=>je<(ht.length-1)/2||je===ht.length-1,Ie=this.wallMode?[c]:$0(c,500);for(let je=Ie.length-1;je>=0;je--){const ht=Ie[je];(ht.length===0||(be=ht[0]).every(Lt=>Lt.x<=0)||be.every(Lt=>Lt.x>=Vt)||be.every(Lt=>Lt.y<=0)||be.every(Lt=>Lt.y>=Vt))&&Ie.splice(je,1)}var be;let Te;if(D)Te=Ij(Ie,A,m);else{Te=[];for(const je of Ie)Te.push({polygon:je,bounds:A})}const Le=O?this.edgeRadius:0,De=Le>0&&this.zoom<17,lt=(je,ht)=>{if(je.length===0)return!1;const Lt=je[je.length-1];return ht.x===Lt.x&&ht.y===Lt.y};for(const{polygon:je,bounds:ht}of Te){let Lt=0,gt=0;for(const Ct of je)O&&!Ct[0].equals(Ct[Ct.length-1])&&Ct.push(Ct[0]),gt+=O?Ct.length-1:Ct.length;const St=this.segments.prepareSegment((O?5:4)*gt,this.layoutVertexArray,this.indexArray);j.footprintSegIdx<0&&(j.footprintSegIdx=this.footprintSegments.length),j.polygonSegIdx<0&&(j.polygonSegIdx=this.polygonSegments.length);const kt={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},st=new _j;if(st.vertexOffset=this.footprintVertices.length,st.indexOffset=3*this.footprintIndices.length,st.ringIndices=[],O){const Ct=[],$e=[];Lt=St.vertexLength;for(let Dt=0;Dt<je.length;Dt++){const At=je[Dt];At.length&&Dt!==0&&$e.push(Ct.length/2);const sr=[];let Qt,bt;Qt=At[1].sub(At[0])._perp()._unit(),st.ringIndices.push(At.length-1);for(let Pt=1;Pt<At.length;Pt++){const rr=At[Pt],Wt=At[Pt===At.length-1?1:Pt+1],Ut=rr.clone();if(Le){bt=Wt.sub(rr)._perp()._unit();const Xt=Qt.add(bt)._unit(),xr=Le*Math.min(4,1/(Qt.x*Xt.x+Qt.y*Xt.y));Ut.x+=xr*Xt.x,Ut.y+=xr*Xt.y,Ut.x=Math.round(Ut.x),Ut.y=Math.round(Ut.y),Qt=bt}if(!X||Le!==0&&!De||lt(sr,Ut)||sr.push(Ut),q0(this.layoutVertexArray,Ut.x,Ut.y,0,0,1,1,0),this.wallMode){const Xt=ae(Pt,At);Z0(this.wallVertexArray,ne.joinNormals[Pt],!Xt)}St.vertexLength++,this.footprintVertices.emplaceBack(rr.x,rr.y),Ct.push(rr.x,rr.y),D&&W0(this.layoutVertexExtArray,P.projectTilePoint(Ut.x,Ut.y,m),P.upVector(m,Ut.x,Ut.y))}X&&(Le===0||De)&&(sr.length!==0&&lt(sr,sr[0])&&sr.pop(),this.groundEffect.addData(sr,ht,I))}const at=this.wallMode?ne.indices:ug(Ct,$e);for(let Dt=0;Dt<at.length;Dt+=3)this.footprintIndices.emplaceBack(st.vertexOffset+at[Dt+0],st.vertexOffset+at[Dt+1],st.vertexOffset+at[Dt+2]),this.indexArray.emplaceBack(Lt+at[Dt],Lt+at[Dt+2],Lt+at[Dt+1]),St.primitiveLength++;st.indexCount+=at.length,st.vertexCount+=this.footprintVertices.length-st.vertexOffset}for(let Ct=0;Ct<je.length;Ct++){const $e=je[Ct];V.startRing(j,$e[0]);let at=$e.length>4&&Ej($e[$e.length-2],$e[0],$e[1]),Dt=Le?lee($e[$e.length-2],$e[0],$e[1],Le):0;const At=[];let sr,Qt,bt;Qt=$e[1].sub($e[0])._perp()._unit();let Pt=!0;for(let rr=1,Wt=0;rr<$e.length;rr++){let Ut=$e[rr-1],Xt=$e[rr];const xr=$e[rr===$e.length-1?1:rr+1];if(V.appendEdge(j,Xt,Ut),mA(Xt,Ut,ht)){Le&&(Qt=xr.sub(Xt)._perp()._unit(),Pt=!Pt);continue}const Mr=Xt.sub(Ut)._perp(),Or=Mr.x/(Math.abs(Mr.x)+Math.abs(Mr.y)),Rr=Mr.y>0?1:0,ri=Ut.dist(Xt);if(Wt+ri>32768&&(Wt=0),Le){bt=xr.sub(Xt)._perp()._unit();let he=wj(Ut,Xt,xr,bj(Qt,bt),Le);isNaN(he)&&(he=0);const it=Xt.sub(Ut)._unit();Ut=Ut.add(it.mult(Dt))._round(),Xt=Xt.add(it.mult(-he))._round(),Dt=he,Qt=bt,X&&this.zoom>=17&&(lt(At,Ut)||At.push(Ut),lt(At,Xt)||At.push(Xt))}const Hr=St.vertexLength,ln=$e.length>4&&Ej(Ut,Xt,xr);let ue=Sj(Wt,at,Pt);if(q0(this.layoutVertexArray,Ut.x,Ut.y,Or,Rr,0,0,ue),q0(this.layoutVertexArray,Ut.x,Ut.y,Or,Rr,0,1,ue),this.wallMode){const he=ae(rr-1,$e),it=ne.joinNormals[rr-1];Z0(this.wallVertexArray,it,he),Z0(this.wallVertexArray,it,he)}if(Wt+=ri,ue=Sj(Wt,ln,!Pt),at=ln,q0(this.layoutVertexArray,Xt.x,Xt.y,Or,Rr,0,0,ue),q0(this.layoutVertexArray,Xt.x,Xt.y,Or,Rr,0,1,ue),this.wallMode){const he=ae(rr,$e),it=ne.joinNormals[rr];Z0(this.wallVertexArray,it,he),Z0(this.wallVertexArray,it,he)}if(St.vertexLength+=4,this.indexArray.emplaceBack(Hr+0,Hr+1,Hr+2),this.indexArray.emplaceBack(Hr+1,Hr+3,Hr+2),St.primitiveLength+=2,Le){const he=Lt+(rr===1?$e.length-2:rr-2),it=rr===1?Lt:he+1;if(this.indexArray.emplaceBack(Hr+1,he,Hr+3),this.indexArray.emplaceBack(he,it,Hr+3),St.primitiveLength+=2,sr===void 0&&(sr=Hr),!mA(xr,$e[rr],ht)){const Ot=rr===$e.length-1?sr:St.vertexLength;this.indexArray.emplaceBack(Hr+2,Hr+3,Ot),this.indexArray.emplaceBack(Hr+3,Ot+1,Ot),this.indexArray.emplaceBack(Hr+3,it,Ot+1),St.primitiveLength+=3}Pt=!Pt}if(D){const he=this.layoutVertexExtArray,it=P.projectTilePoint(Ut.x,Ut.y,m),Ot=P.projectTilePoint(Xt.x,Xt.y,m),$t=P.upVector(m,Ut.x,Ut.y),Gt=P.upVector(m,Xt.x,Xt.y);W0(he,it,$t),W0(he,it,$t),W0(he,Ot,Gt),W0(he,Ot,Gt)}}O&&(Lt+=$e.length-1),X&&Le&&this.zoom>=17&&(At.length!==0&&lt(At,At[0])&&At.pop(),this.groundEffect.addData(At,ht,I,Le>0))}this.footprintSegments.push(st),kt.triangleCount=this.indexArray.length-kt.triangleArrayOffset,this.polygonSegments.push(kt),++j.footprintSegLen,++j.polygonSegLen}if(j.vertexCount=this.layoutVertexArray.length-j.vertexArrayOffset,j.groundVertexCount=this.groundEffect.vertexArray.length-j.groundVertexArrayOffset,j.vertexCount!==0){if(j.centroidXY=V.borders?gj:this.encodeCentroid(V,j),this.centroidData.push(j),V.borders){this.featuresOnBorder.push(V);const je=this.featuresOnBorder.length-1;for(let ht=0;ht<V.borders.length;ht++)V.borders[ht][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ht].push(je)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,h,g,x,m,E,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(n,h,g,x,m,E,this.worldview),this.maxHeight=Math.max(this.maxHeight,oe)}}sortBorders(){for(let r=0;r<this.borderFeatureIndices.length;r++)this.borderFeatureIndices[r].sort((n,c)=>this.featuresOnBorder[n].borders[r][0]-this.featuresOnBorder[c].borders[r][0])}splitToSubtiles(){const r=[];for(let x=0;x<this.centroidData.length;x++){const w=this.centroidData[x],E=+(w.min.y+w.max.y>Vt),I=2*E+(+(w.min.x+w.max.x>Vt)^E);for(let A=0;A<w.polygonSegLen;A++){const P=w.polygonSegIdx+A;r.push({centroidIdx:x,subtile:I,polygonSegmentIdx:P,triangleSegmentIdx:this.polygonSegments[P].triangleSegIdx})}}const n=new gn;r.sort((x,w)=>x.triangleSegmentIdx===w.triangleSegmentIdx?x.subtile-w.subtile:x.triangleSegmentIdx-w.triangleSegmentIdx);let c=0,h=0,m=0;for(const x of r){if(x.triangleSegmentIdx!==c)break;m++}const g=r.length;for(;h!==r.length;){c=r[h].triangleSegmentIdx;let x=0,w=h,E=h;for(let I=w;I<m&&r[I].subtile===x;I++)E++;for(;w!==m;){const I=r[w];x=I.subtile;const A=this.centroidData[I.centroidIdx].min.clone(),P=this.centroidData[I.centroidIdx].max.clone(),D={vertexOffset:this.segments.segments[c].vertexOffset,primitiveOffset:n.length,vertexLength:this.segments.segments[c].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let O=w;O<E;O++){const V=r[O],j=this.polygonSegments[V.polygonSegmentIdx],X=this.centroidData[V.centroidIdx].min,oe=this.centroidData[V.centroidIdx].max,ne=this.indexArray.uint16;for(let ae=j.triangleArrayOffset;ae<j.triangleArrayOffset+j.triangleCount;ae++)n.emplaceBack(ne[3*ae],ne[3*ae+1],ne[3*ae+2]);D.primitiveLength+=j.triangleCount,A.x=Math.min(A.x,X.x),A.y=Math.min(A.y,X.y),P.x=Math.max(P.x,oe.x),P.y=Math.max(P.y,oe.y)}D.primitiveLength>0&&this.triangleSubSegments.push({segment:D,min:A,max:P}),w=E;for(let O=w;O<m&&r[O].subtile===r[w].subtile;O++)E++}h=m;for(let I=h;I<g&&r[I].triangleSegmentIdx===r[h].triangleSegmentIdx;I++)m++}n._trim(),this.indexArray=n}getVisibleSegments(r,n,c){const h=new xn;if(this.wallMode){for(const V of this.triangleSubSegments)h.segments.push(V.segment);return h}let m=0,g=0;const x=1<<r.canonical.z;if(n){const V=n.getMinMaxForTile(r);V&&(m=V.min,g=V.max)}g+=this.maxHeight;const w=r.toUnwrapped();let E;const I=[w.canonical.x/x+w.wrap,w.canonical.y/x],A=[(w.canonical.x+1)/x+w.wrap,(w.canonical.y+1)/x],P=(V,j,X)=>[V[0]*(1-X[0])+j[0]*X[0],V[1]*(1-X[1])+j[1]*X[1]],D=[],O=[];for(const V of this.triangleSubSegments){D[0]=V.min.x/Vt,D[1]=V.min.y/Vt,O[0]=V.max.x/Vt,O[1]=V.max.y/Vt;const j=P(I,A,D),X=P(I,A,O);
66if(new Zr([j[0],j[1],m],[X[0],X[1],g]).intersectsPrecise(c)===0){E&&(h.segments.push(E),E=void 0);continue}const oe=V.segment;E&&E.vertexOffset!==oe.vertexOffset&&(h.segments.push(E),E=void 0),E?(E.vertexLength+=oe.vertexLength,E.primitiveLength+=oe.primitiveLength):E={vertexOffset:oe.vertexOffset,primitiveLength:oe.primitiveLength,vertexLength:oe.vertexLength,primitiveOffset:oe.primitiveOffset,sortKey:void 0,vaos:{}}}return E&&h.segments.push(E),h}encodeCentroid(r,n){const c=r.centroid(),h=n.span(),m=Math.min(7,Math.round(h.x*this.tileToMeter/10)),g=Math.min(7,Math.round(h.y*this.tileToMeter/10));return new Tt(J(c.x,1,Vt-1)<<3|m,J(c.y,1,Vt-1)<<3|g)}encodeBorderCentroid(r){if(!r.borders)return new Tt(0,0);const n=r.borders,c=Number.MAX_VALUE;if(n[0][0]!==c||n[1][0]!==c){const h=n[0][0]!==c?0:1;return new Tt(6|(n[0][0]!==c?0:65528),(n[h][0]+n[h][1])/2<<3|6)}{const h=n[2][0]!==c?2:3;return new Tt((n[h][0]+n[h][1])/2<<3|6,6|(n[2][0]!==c?0:65528))}}showCentroid(r){const n=this.centroidData[r.centroidDataIndex];n.flags&=2147483647,n.centroidXY.x=0,n.centroidXY.y=0,this.writeCentroidToBuffer(n)}writeCentroidToBuffer(r){this.groundEffect.updateHiddenByLandmark(r);const n=r.vertexArrayOffset,c=r.vertexCount+r.vertexArrayOffset,h=r.flags&Td?gj:r.centroidXY,m=this.centroidVertexArray.geta_centroid_pos0(n);if(this.centroidVertexArray.geta_centroid_pos1(n)!==h.y||m!==h.x){for(let g=n;g<c;++g)this.centroidVertexArray.emplace(g,h.x,h.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const r of this.centroidData)this.writeCentroidToBuffer(r)}updateReplacement(r,n,c){if(n.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=n.updateTime;const h=n.getReplacementRegionsForTile(r.toUnwrapped());if(Rw(this.activeReplacements,h))return;if(this.activeReplacements=h,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const g of this.centroidData)g.flags&=2147483647;const m=[];for(const g of this.activeReplacements){if(g.order<c)continue;const x=Math.max(1,Math.pow(2,g.footprintTileId.canonical.z-r.canonical.z));if(g.footprint.buildingId){const w=g.footprint.buildingId;for(const E of this.centroidData)E.buildingId===w&&(E.flags|=Td)}else for(const w of this.centroidData)if(!(w.flags&Td||g.min.x>w.max.x||w.min.x>g.max.x||g.min.y>w.max.y||w.min.y>g.max.y))for(let E=0;E<w.footprintSegLen;E++){const I=this.footprintSegments[w.footprintSegIdx+E];if(m.length=0,cee(this.footprintVertices,I.vertexOffset,I.vertexCount,g.footprintTileId.canonical,r.canonical,m),uA(g.footprint,m,this.footprintIndices.uint16,I.indexOffset,I.indexCount,-I.vertexOffset,-x)){w.flags|=Td;break}}}for(const g of this.centroidData)this.writeCentroidToBuffer(g);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(r,n,c){let h=!1;for(let m=0;m<c.footprintSegLen;m++){const g=this.footprintSegments[c.footprintSegIdx+m];let x=0;for(const w of g.ringIndices){for(let E=x,I=w+x-1;E<w+x;I=E++){const A=this.footprintVertices.int16[2*(E+g.vertexOffset)+0],P=this.footprintVertices.int16[2*(E+g.vertexOffset)+1],D=this.footprintVertices.int16[2*(I+g.vertexOffset)+1];P>n!=D>n&&r<(this.footprintVertices.int16[2*(I+g.vertexOffset)+0]-A)*(n-P)/(D-P)+A&&(h=!h)}x=w}}return h}getHeightAtTileCoord(r,n){let c=Number.NEGATIVE_INFINITY,h=!0;const m=4*(r+Vt)*Vt+(n+Vt);if(this.partLookup.hasOwnProperty(m)){const g=this.partLookup[m];return g?{height:g.height,hidden:!!(g.flags&Td)}:void 0}for(const g of this.centroidData)r>g.max.x||g.min.x>r||n>g.max.y||g.min.y>n||g.height<=c||this.footprintContainsPoint(r,n,g)&&(c=g.height,this.partLookup[m]=g,h=!!(g.flags&Td));if(c!==Number.NEGATIVE_INFINITY)return{height:c,hidden:h};this.partLookup[m]=void 0}}function bj(a,r){const n=a.add(r)._unit();return a.x*n.x+a.y*n.y}function lee(a,r,n,c){const h=r.sub(a)._perp()._unit(),m=n.sub(r)._perp()._unit();return wj(a,r,n,bj(h,m),c)}function wj(a,r,n,c,h){const m=Math.sqrt(1-c*c);return Math.min(a.dist(r)/3,r.dist(n)/3,h*m/c)}function mA(a,r,n){return a.x<n[0].x&&r.x<n[0].x||a.x>n[1].x&&r.x>n[1].x||a.y<n[0].y&&r.y<n[0].y||a.y>n[1].y&&r.y>n[1].y}function Tj(a,r){return a.x<r[0].x||a.x>r[1].x||a.y<r[0].y||a.y>r[1].y}function Ej(a,r,n){if(a.x<0||a.x>=Vt||r.x<0||r.x>=Vt||n.x<0||n.x>=Vt)return!1;const c=n.sub(r),h=c.perp(),m=a.sub(r);return(c.x*m.x+c.y*m.y)/Math.sqrt((c.x*c.x+c.y*c.y)*(m.x*m.x+m.y*m.y))>-.866&&h.x*m.x+h.y*m.y<0}function Sj(a,r,n){const c=r?2|a:-3&a;return n?1|c:-2&c}function Cj(){const a=Math.PI/32,r=Math.tan(a),n=C;return n*Math.sqrt(1+2*r*r)-n}
66function Ij(a,r,n){const c=1<<n.z,h=re(n.x/c),m=re((n.x+1)/c),g=se(n.y/c),x=se((n.y+1)/c);return function(w,E,I,A,P=0,D){const O=[];if(!w.length||!I||!A)return O;const V=(be,Te)=>{for(const Le of be)O.push({polygon:Le,bounds:Te})},j=Math.ceil(Math.log2(I)),X=Math.ceil(Math.log2(A)),oe=j-X,ne=[];for(let be=0;be<Math.abs(oe);be++)ne.push(oe>0?0:1);for(let be=0;be<Math.min(j,X);be++)ne.push(0),ne.push(1);let ae=w;if(ae=Pw(ae,E[0].y-P,E[1].y+P,1),ae=Pw(ae,E[0].x-P,E[1].x+P,0),!ae.length)return O;const Ie=[];for(ne.length?Ie.push({polygons:ae,bounds:E,depth:0}):V(ae,E);Ie.length;){const be=Ie.pop(),Te=be.depth,Le=ne[Te],De=be.bounds[0],lt=be.bounds[1],je=Le===0?De.x:De.y,ht=Le===0?lt.x:lt.y,Lt=D?D(Le,je,ht):.5*(je+ht),gt=Pw(be.polygons,je-P,Lt+P,Le),St=Pw(be.polygons,Lt-P,ht+P,Le);if(gt.length){const kt=[De,new Tt(Le===0?Lt:lt.x,Le===1?Lt:lt.y)];ne.length>Te+1?Ie.push({polygons:gt,bounds:kt,depth:Te+1}):V(gt,kt)}if(St.length){const kt=[new Tt(Le===0?Lt:De.x,Le===1?Lt:De.y),lt];ne.length>Te+1?Ie.push({polygons:St,bounds:kt,depth:Te+1}):V(St,kt)}}return O}(a,r,Math.ceil((m-h)/11.25),Math.ceil((g-x)/11.25),1,(w,E,I)=>{if(w===0)return .5*(E+I);{const A=se((n.y+E/Vt)/c);return(W(.5*(se((n.y+I/Vt)/c)+A))*c-n.y)*Vt}})}function cee(a,r,n,c,h,m){const g=Math.pow(2,c.z-h.z);for(let x=0;x<n;x++){let w=a.int16[2*(x+r)+0],E=a.int16[2*(x+r)+1];w=(w+h.x*Vt)*g-c.x*Vt,E=(E+h.y*Vt)*g-c.y*Vt,m.push(new Tt(w,E))}}let Aj,Pj;Jt(zw,"FillExtrusionBucket",{omit:["layers","features"]}),Jt(yj,"PartData"),Jt(_j,"FootprintSegment"),Jt(vj,"BorderCentroidData"),Jt(pA,"GroundEffect");class tp extends Tt{constructor(r,n,c){super(r,n),this.z=c}}class Mj extends tp{constructor(r,n,c,h){super(r,n,c),this.w=h}}function kj(a,r,n,c){const h=n==="x"?"y":"x",m=(c-a[n])/(r[n]-a[n]);a[h]=Math.round(a[h]+(r[h]-a[h])*m),a[n]=c,a.hasOwnProperty("z")&&(a.z=_r(a.z,r.z,m)),a.hasOwnProperty("w")&&(a.w=_r(a.w,r.w,m))}function Rj(a,r,n,c){const h=n,m=c;for(const g of["x","y"]){let x=a,w=r;x[g]>=w[g]&&(x=r,w=a),x[g]<h&&w[g]>h&&kj(x,w,g,h),x[g]<m&&w[g]>m&&kj(w,x,g,m)}}function Dw(a,r,n,c,h,m){const g=[];for(let x=0;x<a.length;x++){const w=a[x];let E;const I=g.length;let A=0;for(let P=0;P<w.length-1;P++){let D=w[P],O=w[P+1],V=0;const j=A;let X,oe;m&&(V=Math.hypot(O.x-D.x,O.y-D.y),A+=V,X=D,oe=O),D.x<r&&O.x<r||(D.x<r?D=new Tt(r,D.y+(r-D.x)/(O.x-D.x)*(O.y-D.y))._round():O.x<r&&(O=new Tt(r,D.y+(r-D.x)/(O.x-D.x)*(O.y-D.y))._round()),D.y<n&&O.y<n||(D.y<n?D=new Tt(D.x+(n-D.y)/(O.y-D.y)*(O.x-D.x),n)._round():O.y<n&&(O=new Tt(D.x+(n-D.y)/(O.y-D.y)*(O.x-D.x),n)._round()),D.x>=c&&O.x>=c||(D.x>=c?D=new Tt(c,D.y+(c-D.x)/(O.x-D.x)*(O.y-D.y))._round():O.x>=c&&(O=new Tt(c,D.y+(c-D.x)/(O.x-D.x)*(O.y-D.y))._round()),D.y>=h&&O.y>=h||(D.y>=h?D=new Tt(D.x+(h-D.y)/(O.y-D.y)*(O.x-D.x),h)._round():O.y>=h&&(O=new Tt(D.x+(h-D.y)/(O.y-D.y)*(O.x-D.x),h)._round()),E&&D.equals(E[E.length-1])||(E=[D],g.push(E),m&&m.push({progress:{min:j+Lj(X,oe,D)*V,max:1},parentIndex:x,prevPoint:X,nextPoint:oe})),E.push(O),m&&(m[m.length-1].progress.max=j+Lj(X,oe,O)*V,m[m.length-1].nextPoint=oe)))))}if(m&&A>0)for(let P=I;P<g.length;P++)m[P].progress.min/=A,m[P].progress.max/=A}return g}function uee(a,r,n,c,h){if(a.length<2)return void c.push(a);const m=[];for(;r.valid();){const[E,I]=r.get();for(let A=0;A<a.length-1;A++){const P=a[A],D=a[A+1],O=Zs(P,D,E,I);if(O){const[V]=O,j=new Tt(_r(P.x,D.x,V),_r(P.y,D.y,V));m.push({t:A+V,distance:0,point:j})}}r.next()}if(m.length===0)return void c.push(a);m.sort((E,I)=>E.t-I.t);let g=0,x=0,w=[];for(c.push(w);g!==a.length;){if(x===m.length){for(;g!==a.length;)w.length!==0&&w[w.length-1].equals(a[g])||w.push(a[g]),g++;break}m[x].t<=g?(w.length!==0&&w[w.length-1].equals(m[x].point)||w.push(m[x].point),Math.trunc(m[x].t),x++):(w.length!==0&&w[w.length-1].equals(a[g])||w.push(a[g]),g++)}}function Lj(a,r,n){return a.x!==r.x?(n.x-a.x)/(r.x-a.x):a.y!==r.y?(n.y-a.y)/(r.y-a.y):0}function X0(a,r){return a.x*r.x+a.y*r.y}function zj(a,r){if(a.length===1){let n=0;const c=r[n++];let h;for(;!h||c.equals(h);)if(h=r[n++],!h)return 1/0;for(;n<r.length;n++){const m=r[n],g=a[0],x=h.sub(c),w=m.sub(c),E=g.sub(c),I=X0(x,x),A=X0(x,w),P=X0(w,w),D=X0(E,x),O=X0(E,w),V=I*P-A*A,j=(P*D-A*O)/V,X=(I*O-A*D)/V,oe=c.z*(1-j-X)+h.z*j+m.z*X;if(isFinite(oe))return oe}return 1/0}{let n=1/0;for(const c of r)n=Math.min(n,c.z);return n}}function Dj(a,r,n,c,h,m,g,x){const w=g*h.getElevationAt(a,r,!0,!0),E=m[0]!==0,I=E?m[1]===0?g*(m[0]/7-450):g*function(A,P,D){const O=Math.floor(P[0]/8),V=Math.floor(P[1]/8),j=10*(P[0]-8*O),X=10*(P[1]-8*V),oe=A.getElevationAt(O,V,!0,!0),ne=A.getMeterToDEM(D),ae=Math.floor(.5*(j*ne-1)),Ie=Math.floor(.5*(X*ne-1)),be=A.tileCoordToPixel(O,V),Te=2*ae+1,Le=2*Ie+1,De=function(St,kt,st,Ct,$e){return[St.getElevationAtPixel(kt,st,!0),St.getElevationAtPixel(kt+$e,st,!0),St.getElevationAtPixel(kt,st+$e,!0),St.getElevationAtPixel(kt+Ct,st+$e,!0)]}(A,be.x-ae,be.y-Ie,Te,Le),lt=Math.abs(De[0]-De[1]),je=Math.abs(De[2]-De[3]),ht=Math.abs(De[0]-De[2])+Math.abs(De[1]-De[3]),Lt=Math.min(.25,.5*ne*(lt+je)/Te),gt=Math.min(.25,.5*ne*ht/Le);return oe+Math.max(Lt*j,gt*X)}(h,m,x):w;return{base:w+(n===0?-1:n),top:E?Math.max(I+c,w+n+2):w+c}}class hee{constructor(r){this._callback=r,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class dee{constructor(){this.tasks={},this.taskQueue=[],Ht(["process"],this),this.invoker=new hee(this.process),this.nextId=0}add(r,n){const c=this.nextId++,h=function({type:m,isSymbolTile:g,zoom:x}){return x=x||0,m==="message"?0:m!=="maybePrepare"||g?m!=="parseTile"||g?m==="parseTile"&&g?300-x:m==="maybePrepare"&&g?400-x:500:200-x:100-x}(n);if(h===0){try{r()}finally{}return null}return this.tasks[c]={fn:r,metadata:n,priority:h,id:c},this.taskQueue.push(c),this.invoker.trigger(),{cancel:()=>{delete this.tasks[c]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(c=>!!this.tasks[c]),!this.taskQueue.length)return;const r=this.pick();if(r===null)return;const n=this.tasks[r];if(delete this.tasks[r],this.taskQueue.length&&this.invoker.trigger(),!n)return;n.fn()}finally{}}pick(){let r=null,n=1/0;for(let h=0;h<this.taskQueue.length;h++){const m=this.tasks[this.taskQueue[h]];m.priority<n&&(n=m.priority,r=h)}if(r===null)return null;const c=this.taskQueue[r];return this.taskQueue.splice(r,1),c}remove(){this.invoker.remove()}}class Oj{constructor(r,n,c){this.target=r,this.parent=n,this.mapId=c,this.callbacks={},this.cancelCallbacks={},Ht(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
66=new dee}send(r,n,c,h,m=!1,g){const x=Math.round(1e18*Math.random()).toString(36).substring(0,10);c&&(c.metadata=g,this.callbacks[x]=c);const w=new Set;return this.target.postMessage({id:x,type:r,hasCallback:!!c,targetMapId:h,mustQueue:m,sourceMapId:this.mapId,data:hc(n,w)},w),{cancel:()=>{c&&delete this.callbacks[x],this.target.postMessage({id:x,type:"<cancel>",targetMapId:h,sourceMapId:this.mapId})}}}receive(r){const n=r.data;if(!n)return;const c=n.id;if(c&&(!n.targetMapId||this.mapId===n.targetMapId))if(n.type==="<cancel>"){const h=this.cancelCallbacks[c];delete this.cancelCallbacks[c],h&&h.cancel()}else if(n.mustQueue||Ei(self)){const h=this.callbacks[c],m=this.scheduler.add(()=>this.processTask(c,n),h&&h.metadata||{type:"message"});m&&(this.cancelCallbacks[c]=m)}else this.processTask(c,n)}processTask(r,n){if(delete this.cancelCallbacks[r],n.type==="<response>"){const c=this.callbacks[r];delete this.callbacks[r],c&&(n.error?c(As(n.error)):c(null,As(n.data)))}else{const c=new Set,h=n.hasCallback?(g,x)=>{this.target.postMessage({id:r,type:"<response>",sourceMapId:this.mapId,error:g?hc(g):null,data:hc(x,c)},c)}:()=>{},m=As(n.data);if(this.parent[n.type])this.parent[n.type](n.sourceMapId,m,h);else if(this.parent.getWorkerSource){const g=n.type.split("."),{source:x,scope:w}=m;this.parent.getWorkerSource(n.sourceMapId,g[0],x,w)[g[1]](m,h)}else h(new Error(`Could not find function ${n.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Y0={workerUrl:"",workerClass:null,workerParams:void 0};const gA="mapboxgl_preloaded_worker_pool";class rp{constructor(){this.active={}}acquire(r,n=rp.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<n;)this.workers.push(Y0.workerClass!=null?new Y0.workerClass:new self.Worker(Y0.workerUrl,Y0.workerParams));return this.active[r]=!0,this.workers.slice()}release(r){delete this.active[r],this.workers&&this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[gA]}numActive(){return Object.keys(this.active).length}}rp.workerCount=2;class dg{constructor(r,n,c="Worker",h=rp.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=Ge();const m=this.workerPool.acquire(this.id,h);for(let g=0;g<m.length;g++){const x=new dg.Actor(m[g],n,this.id);x.name=`${c} ${g}`,this.actors.push(x)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,n,c){Ee(this.actors,(h,m)=>{h.send(r,n,m)},c=c||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(r=>{r.remove()}),this.actors=[],this.workerPool.release(this.id)}}let K0,_A;function Ow(){return K0||(K0=new rp),K0}dg.Actor=Oj;class fee{constructor(r){this.module=r}createIntArray(r){const n=new Int32Array(r),c=this.module.malloc(n.length*n.BYTES_PER_ELEMENT);return this.module.heap32.set(n,c/n.BYTES_PER_ELEMENT),c}createFloatArray(r){const n=new Float32Array(r),c=this.module.malloc(n.length*n.BYTES_PER_ELEMENT);return this.module.heapF32.set(n,c/n.BYTES_PER_ELEMENT),c}createStringBuffer(r){const n=this.module.malloc(r.length+1);for(let c=0;c<r.length;++c)this.module.heapU8[n+c]=r.charCodeAt(c);return this.module.heapU8[n+r.length]=0,n}readStringBuffer(r){let n="";for(;this.module.heapU8[r]!==0;)n+=String.fromCharCode(this.module.heapU8[r]),++r;return n}setStyle(r){const n=r.entranceColorRgb,c=r.facadeGlazingColorRgb,h=r.roofColorRgb,m=r.wallColorRgb,g=r.normalScale;this.module.setStyle(n[0],n[1],n[2],c[0],c[1],c[2],h[0],h[1],h[2],m[0],m[1],m[2],g[0],g[1],g[2],r.tileToMeters)}setAOOptions(r,n){this.module.setAOOptions(r?1:0,n)}setMetricOptions(r,n){this.module.setMetricOptions(r?1:0,n)}setStructuralOptions(r){this.module.setStructuralOptions(r?1:0)}setFacadeOptions(r,n){this.module.setFacadeOptions(r,n?1:0)}setFauxFacadeOptions(r,n,c){this.module.setFauxFacadeOptions(r?1:0,n?1:0,c)}setFacadeClassifierOptions(r){this.module.setFacadeClassifierOptions(r)}generateMesh(r,n){for(const x of r){const w=this.createStringBuffer(x.roofType),E=[0],I=[];for(const D of x.coordinates)if(Array.isArray(D)){for(const O of D)I.push(O.x),I.push(O.y);E.push(I.length)}const A=this.createIntArray(E),P=this.createFloatArray(I);this.module.addFeature(x.id,x.sourceId,x.minHeight,x.height,w,x.roofType.length,P,A,E.length-1),this.module.free(w),this.module.free(A),this.module.free(P)}for(const x of n){let w;w=x.entrances?JSON.parse(x.entrances):[];const E=this.createFloatArray(w),I=[];for(const P of x.coordinates)I.push(P.x),I.push(P.y);const A=this.createFloatArray(I);this.module.addFacade(x.sourceId,x.crossPerc,x.distanceToRoad,E,w.length,A,I.length),this.module.free(E),this.module.free(A)}if(!this.module.generateMesh()){const x=this.module.getLastError();return this.readStringBuffer(x)}
66const c=this.module.getMeshCount(),h=new Array(c);for(let x=0;x<c;x++){const w=this.module.getPositionsPtr(x),E=this.module.getPositionsLength(x),I=new Float32Array(this.module.heapF32.buffer,w,E),A=this.module.getNormalsPtr(x),P=this.module.getNormalsLength(x),D=new Float32Array(this.module.heapF32.buffer,A,P),O=this.module.getColorsPtr(x),V=this.module.getColorsLength(x),j=new Uint8Array(this.module.heapU8.buffer,O,V),X=this.module.getAOPtr(x),oe=this.module.getAOLength(x),ne=new Float32Array(this.module.heapF32.buffer,X,oe),ae=this.module.getUVPtr(x),Ie=this.module.getUVLength(x),be=new Float32Array(this.module.heapF32.buffer,ae,Ie),Te=this.module.getFauxFacadePtr(x),Le=this.module.getFauxFacadeLength(x),De=new Uint8Array(this.module.heapU8.buffer,Te,Le),lt=this.module.getIndicesPtr(x),je=this.module.getIndicesLength(x),ht=new Int32Array(this.module.heap32.buffer,lt,je),Lt=this.module.getBuildingPart(x),gt=this.readStringBuffer(Lt);h[x]={positions:I,normals:D,colors:j,ao:ne,uv:be,isFauxFacade:De,indices:ht,buildingPart:gt}}const m=this.module.getRingCount(),g=[];for(let x=0;x<m;x++){const w=this.module.getRingPtr(x),E=this.module.getRingLength(x),I=new Float32Array(this.module.heapF32.buffer,w,E);g.push(I)}return{meshes:h,modifiedPolygonRings:g}}}let J0,yA,fc,fg,vA,pg=null,mg=null,Fj=null,Fw=null;function Nj(){return Ei(self)&&self.worker.dracoUrl?self.worker.dracoUrl:yA||Qn.DRACO_URL}function Bj(){if(Ei(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(fg)return fg;const a=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return fg=WebAssembly.validate(a)?Qn.MESHOPT_SIMD_URL:Qn.MESHOPT_URL,fg}function pee(){return Fw}const Nw={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},mee={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Q0={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Vj(a,r,n){const c=n.json.bufferViews.length,h=n.buffers.length;r.bufferView=c,n.json.bufferViews[c]={buffer:h,byteLength:a.byteLength},n.buffers[h]=a}const xA="KHR_draco_mesh_compression";function gee(a,r){const n=a.extensions&&a.extensions[xA];if(!n)return;const c=new fc.Decoder,h=$j(r,n.bufferView),m=new fc.Mesh;if(!c.DecodeArrayToMesh(h,h.byteLength,m))throw new Error("Failed to decode Draco mesh");const g=r.json.accessors[a.indices],x=Nw[g.componentType],w=g.count*x.BYTES_PER_ELEMENT,E=fc._malloc(w);x===Uint16Array?c.GetTrianglesUInt16Array(m,w,E):c.GetTrianglesUInt32Array(m,w,E),Vj(fc.memory.buffer.slice(E,E+w),g,r),fc._free(E);for(const I of Object.keys(n.attributes)){const A=c.GetAttributeByUniqueId(m,n.attributes[I]),P=r.json.accessors[a.attributes[I]],D=mee[P.componentType],O=P.count*Q0[P.type]*Nw[P.componentType].BYTES_PER_ELEMENT,V=fc._malloc(O);c.GetAttributeDataArrayForAllPoints(m,A,fc[D],O,V),Vj(fc.memory.buffer.slice(V,V+O),P,r),fc._free(V)}c.destroy(),m.destroy(),delete a.extensions[xA]}const Bw="EXT_meshopt_compression";function _ee(a,r){if(!a.extensions||!a.extensions[Bw])return;const n=a.extensions[Bw],c=new Uint8Array(r.buffers[n.buffer],n.byteOffset||0,n.byteLength||0),h=new Uint8Array(n.count*n.byteStride);vA.decodeGltfBuffer(h,n.count,n.byteStride,c,n.mode,n.filter),a.buffer=r.buffers.length,a.byteOffset=0,r.buffers[a.buffer]=h.buffer,delete a.extensions[Bw]}const Uj=1179937895,jj=new TextDecoder("utf8");function Gj(a,r){return new URL(a,r).href}function yee(a,r,n,c){return fetch(Gj(a.uri,c)).then(h=>h.arrayBuffer()).then(h=>{r.buffers[n]=h})}function $j(a,r){const n=a.json.bufferViews[r];return new Uint8Array(a.buffers[n.buffer],n.byteOffset||0,n.byteLength)}function vee(a,r,n,c){if(a.uri){const h=Gj(a.uri,c);return fetch(h).then(m=>m.blob()).then(m=>createImageBitmap(m)).then(m=>{r.images[n]=m})}if(a.bufferView!==void 0){const h=$j(r,a.bufferView),m=new Blob([h],{type:a.mimeType});return createImageBitmap(m).then(g=>{r.images[n]=g})}}function Hj(a,r=0,n){const c={json:null,images:[],buffers:[]};
66if(new Uint32Array(a,r,1)[0]===Uj){const I=new Uint32Array(a,r);let A=2;const P=(I[A++]>>2)-3,D=I[A++]>>2;if(A++,c.json=JSON.parse(jj.decode(I.subarray(A,A+D))),A+=D,A<P){const O=I[A++];A++;const V=r+(A<<2);c.buffers[0]=a.slice(V,V+O)}}else c.json=JSON.parse(jj.decode(new Uint8Array(a,r)));const{buffers:h,images:m,meshes:g,extensionsUsed:x,bufferViews:w}=c.json;let E=Promise.resolve();if(h){const I=[];for(let A=0;A<h.length;A++){const P=h[A];P.uri?I.push(yee(P,c,A,n)):c.buffers[A]||(c.buffers[A]=null)}E=Promise.all(I)}return E.then(()=>{const I=[],A=x&&x.includes(xA),P=x&&x.includes(Bw);if(A&&I.push(function(){if(!fc)return J0??(J0=function(D){let O,V=null;function j(){O=new Uint8Array(V.buffer)}function X(){throw new Error("Unexpected Draco error.")}const oe={a:{a:X,d:function(ne,ae,Ie){return O.copyWithin(ne,ae,ae+Ie)},c:function(ne){const ae=O.length,Ie=Math.max(ne>>>0,Math.ceil(1.2*ae)),be=Math.ceil((Ie-ae)/65536);try{return V.grow(be),j(),!0}catch{return!1}},b:X}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(D,oe):D.then(ne=>ne.arrayBuffer()).then(ne=>WebAssembly.instantiate(ne,oe))).then(ne=>{const{Rb:ae,Qb:Ie,P:be,T:Te,X:Le,Ja:De,La:lt,Qa:je,Va:ht,Wa:Lt,eb:gt,jb:St,f:kt,e:st,yb:Ct,zb:$e,Ab:at,Bb:Dt,Db:At,Gb:sr}=ne.instance.exports;V=st;const Qt=(()=>{let bt=0,Pt=0,rr=0,Wt=0;return Ut=>{rr&&(ae(Wt),ae(bt),Pt+=rr,rr=bt=0),bt||(Pt+=128,bt=Ie(Pt));const Xt=Ut.length+7&-8;let xr=bt;Xt>=Pt&&(rr=Xt,xr=Wt=Ie(Xt));for(let Mr=0;Mr<Ut.length;Mr++)O[xr+Mr]=Ut[Mr];return xr}})();return j(),kt(),{memory:st,_free:ae,_malloc:Ie,Mesh:class{constructor(){this.ptr=be()}destroy(){Te(this.ptr)}},Decoder:class{constructor(){this.ptr=De()}destroy(){St(this.ptr)}DecodeArrayToMesh(bt,Pt,rr){const Wt=Qt(bt),Ut=lt(this.ptr,Wt,Pt,rr.ptr);return!!Le(Ut)}GetAttributeByUniqueId(bt,Pt){return{ptr:je(this.ptr,bt.ptr,Pt)}}GetTrianglesUInt16Array(bt,Pt,rr){ht(this.ptr,bt.ptr,Pt,rr)}GetTrianglesUInt32Array(bt,Pt,rr){Lt(this.ptr,bt.ptr,Pt,rr)}GetAttributeDataArrayForAllPoints(bt,Pt,rr,Wt,Ut){gt(this.ptr,bt.ptr,Pt.ptr,rr,Wt,Ut)}},DT_INT8:Ct(),DT_UINT8:$e(),DT_INT16:at(),DT_UINT16:Dt(),DT_UINT32:At(),DT_FLOAT32:sr()}})}(fetch(Nj())),J0.then(D=>{fc=D,J0=void 0}))}()),P&&I.push(function(){if(vA)return;const D=function(O){let V;const j=WebAssembly.instantiateStreaming(O,{}).then(ne=>{V=ne.instance,V.exports.__wasm_call_ctors()}),X={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},oe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:j,supported:!0,decodeGltfBuffer(ne,ae,Ie,be,Te,Le){(function(De,lt,je,ht,Lt,gt,St){const kt=De.exports.sbrk,st=ht+3&-4,Ct=kt(st*Lt),$e=kt(gt.length),at=new Uint8Array(De.exports.memory.buffer);at.set(gt,$e);const Dt=lt(Ct,ht,Lt,$e,gt.length);if(Dt===0&&St&&St(Ct,st,Lt),je.set(at.subarray(Ct,Ct+ht*Lt)),kt(Ct-kt(0)),Dt!==0)throw new Error(`Malformed buffer data: ${Dt}`)})(V,V.exports[oe[Te]],ne,ae,Ie,be,V.exports[X[Le]])}}}(fetch(Bj()));return D.ready.then(()=>{vA=D})}()),m)for(let D=0;D<m.length;D++)I.push(vee(m[D],c,D,n));return(I.length?Promise.all(I):Promise.resolve()).then(()=>{if(A&&g)for(const{primitives:D}of g)for(const O of D)gee(O,c);if(P&&g&&w)for(const D of w)_ee(D,c);return c})})}function bA(a){switch(a){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function wA(a){switch(a){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class TA{constructor(r,n,c,h){this.context=r,this.format=c,this.useMipmap=h&&h.useMipmap,this.texture=r.gl.createTexture(),this.update(n,{premultiply:h&&h.premultiply})}update(r,n){const c=r&&r instanceof HTMLVideoElement&&r.width===0?r.videoWidth:r.width,h=r&&r instanceof HTMLVideoElement&&r.height===0?r.videoHeight:r.height,{context:m}=this,{gl:g}=m,{x,y:w}=n&&n.position?n.position:{x:0,y:0},E=x+c,I=w+h;!this.size||this.size[0]===E&&this.size[1]===I||(g.bindTexture(g.TEXTURE_2D,null),g.deleteTexture(this.texture),this.texture=g.createTexture(),this.size=null),g.bindTexture(g.TEXTURE_2D,this.texture),m.pixelStoreUnpackFlipY.set(!1),m.pixelStoreUnpack.set(1),m.pixelStoreUnpackPremultiplyAlpha.set(this.format===g.RGBA8&&(!n||n.premultiply!==!1));const A=r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||ImageBitmap&&r instanceof ImageBitmap;if(!this.size&&E>0&&I>0){const P=this.useMipmap?Math.floor(Math.log2(Math.max(E,I)))+1:1;g.texStorage2D(g.TEXTURE_2D,P,this.format,E,I),this.size=[E,I]}if(this.size)if(A)g.texSubImage2D(g.TEXTURE_2D,0,x,w,bA(this.format),wA(this.format),r);else{const P=r.data;P&&g.texSubImage2D(g.TEXTURE_2D,0,x,w,c,h,bA(this.format),wA(this.format),P)}this.useMipmap&&g.generateMipmap(g.TEXTURE_2D)}bind(r,n,c=!1){const{context:h}=this,{gl:m}=h;m.bindTexture(m.TEXTURE_2D,this.texture),r!==this.minFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,r),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,this.useMipmap&&!c?r===m.NEAREST?m.NEAREST_MIPMAP_NEAREST:m.LINEAR_MIPMAP_LINEAR:r),this.minFilter=r),n!==this.wrapS&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,n),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,n),this.wrapS=n)}bindExtraParam(r,n,c,h,m){const{context:g}=this,{gl:x}=g;x.bindTexture(x.TEXTURE_2D,this.texture),n!==this.magFilter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,n),this.magFilter=n),r!==this.minFilter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,this.useMipmap?r===x.NEAREST?x.NEAREST_MIPMAP_NEAREST:x.LINEAR_MIPMAP_LINEAR:r),this.minFilter=r),c!==this.wrapS&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,c),this.wrapS=c),h!==this.wrapT&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,h),this.wrapT=h),m!==this.compareMode&&(m?(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_COMPARE_MODE,x.COMPARE_REF_TO_TEXTURE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_COMPARE_FUNC,m)):x.texParameteri(x.TEXTURE_2D,x.TEXTURE_COMPARE_MODE,x.NONE),this.compareMode=m)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}class ev{constructor(r,n){this.context=r,this.texture=n}bind(r,n){const{context:c}=this,{gl:h}=c;h.bindTexture(h.TEXTURE_2D,this.texture),r!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,r),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,r),this.minFilter=r),n!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,n),this.wrapS=n)}}const xee=si([{name:"a_pos_3f",components:3,type:"Float32"}]),bee=si([{name:"a_color_3f",components:3,type:"Float32"}]),wee=si([{name:"a_color_4f",components:4,type:"Float32"}]),Tee=si([{name:"a_uv_2f",components:2,type:"Float32"}]),Eee=si([{name:"a_normal_3f",components:3,type:"Float32"}]),See=si([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Cee=si([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function qj(a,r){const n=Vw(a.projection,a.zoom,a.width,a.height),c=function(m,g,x,w,E){const I=new R(x.lng-180*Ed,x.lat),A=new R(x.lng+180*Ed,x.lat),P=m.project(I.lng,I.lat),D=m.project(A.lng,A.lat),O=-Math.atan2(D.y-P.y,D.x-P.x),V=ye.fromLngLat(x);V.y=J(V.y,-1+Ed,1-Ed);const j=V.toLngLat(),X=m.project(j.lng,j.lat),oe=ye.fromLngLat(j);oe.x+=Ed;const ne=oe.toLngLat(),ae=m.project(ne.lng,ne.lat),Ie=Wj(ae.x-X.x,ae.y-X.y,O),be=ye.fromLngLat(j);be.y+=Ed;const Te=be.toLngLat(),Le=m.project(Te.lng,Te.lat),De=Wj(Le.x-X.x,Le.y-X.y,O),lt=Math.abs(Ie.x)/Math.abs(De.y),je=pe([]);wt(je,je,-O*(1-(E?0:w)));const ht=pe([]);return ke(ht,ht,[1,1-(1-lt)*w,1]),ht[4]=-De.x/De.y*w,wt(ht,ht,O),_e(ht,je,ht),ht}
66(a.projection,0,a.center,n,r),h=Zj(a);return ke(c,c,[h,h,1]),c}function Zj(a){const r=a.projection,n=Vw(a.projection,a.zoom,a.width,a.height),c=EA(r,a.center),h=EA(r,R.convert(r.center));return Math.pow(2,c*n+(1-n)*h)}function Vw(a,r,n,c,h=1/0){const m=a.range;if(!m)return 0;const g=Math.min(h,Math.max(n,c)),x=Math.log(g/1024)/Math.LN2;return ce(m[0]+x,m[1]+x,r)}const Ed=1/4e4;function EA(a,r){const n=J(r.lat,-fe,fe),c=new R(r.lng-180*Ed,n),h=new R(r.lng+180*Ed,n),m=a.project(c.lng,n),g=a.project(h.lng,n),x=ye.fromLngLat(c),w=ye.fromLngLat(h),E=g.x-m.x,I=g.y-m.y,A=w.x-x.x,P=w.y-x.y,D=Math.sqrt((A*A+P*P)/(E*E+I*I));return Math.log(D)/Math.LN2}function Wj(a,r,n){const c=Math.cos(n),h=Math.sin(n);return{x:a*c-r*h,y:a*h+r*c}}function Xj(a,r,n){pe(a),wt(a,a,ai(r[2])),ot(a,a,ai(r[0])),et(a,a,ai(r[1])),ke(a,a,n),_e(a,a,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Uw(a,r,n,c,h,m,g,x){const w=[n[0]-r[0],n[1]-r[1],0],E=[c[0]-r[0],c[1]-r[1],0];if(Fe(w)<1e-12||Fe(E)<1e-12)return za(a);const I=qi([],w,E);fr(I,I),tt(E,c,r),w[2]=(m-h)*x,E[2]=(g-h)*x;const A=w;return qi(A,w,E),fr(A,A),lr(a,I,A)}function SA(a,r,n=!1){const c=bd(r.zoom),h=function(m,g,x){const w=g.worldSize,E=[m[12],m[13],m[14]],I=se(E[1]/w),A=re(E[0]/w),P=pe([]),D=Z(1,I)*w,O=Z(1,0)*w*Se(I,g.zoom),V=1/QI(w);let j=O*V;if(x){const ae=Vw(g.projection,g.zoom,g.width,g.height,1024);j=V*g.projection.pixelSpaceConversion(g.center.lat,w,ae)}const X=S(I,A);He(X,X,jt([],fr([],X),D*j*E[2]));const oe=function(ae){const Ie=[ae[0],ae[1],ae[2]];let be=[0,1,0];const Te=qi([],be,Ie);return qi(be,Ie,Te),di(be)===0&&(be=[0,1,0],qi(Te,Ie,be)),fr(Te,Te),fr(be,be),fr(Ie,Ie),[Te[0],Te[1],Te[2],0,be[0],be[1],be[2],0,Ie[0],Ie[1],Ie[2],0,ae[0],ae[1],ae[2],1]}(X);ke(P,P,[j,j,j*D]),ie(P,P,[-E[0],-E[1],-E[2]]);const ne=_e([],g.globeMatrix,oe);return _e(ne,ne,P),_e(ne,ne,m),ne}(a,r,n);if(c>0){const m=function(g,x){const w=x.worldSize,E=Z(1,0)*w*Se(x.center.lat,x.zoom)/QI(w),I=Z(1,x.center.lat)*w,A=pe([]);return et(A,A,ai(x.center.lng)),ot(A,A,ai(x.center.lat)),ie(A,A,[0,0,es]),ke(A,A,[E,E,E*I]),ie(A,A,[x.point.x-.5*w,x.point.y-.5*w,0]),_e(A,A,g),_e(A,x.globeMatrix,A)}(a,r);return function(g,x,w){const E=(O,V,j)=>{const X=Fe(O),oe=Fe(V),ne=Ku(O,V,j);return jt(ne,ne,1/Fe(ne)*_r(X,oe,j))},I=E([g[0],g[1],g[2]],[x[0],x[1],x[2]],w),A=E([g[4],g[5],g[6]],[x[4],x[5],x[6]],w),P=E([g[8],g[9],g[10]],[x[8],x[9],x[10]],w),D=Ku([g[12],g[13],g[14]],[x[12],x[13],x[14]],w);return[I[0],I[1],I[2],0,A[0],A[1],A[2],0,P[0],P[1],P[2],0,D[0],D[1],D[2],1]}(h,m,c)}return h}function Yj(a,r,n,c){const h=Zr.projectAabbCorners(c,n);let m=Number.MAX_VALUE,g=-1;for(let E=0;E<h.length;++E){const I=h[E];I[0]=(.5*I[0]+.5)*r.width,I[1]=(.5-.5*I[1])*r.height,I[2]<m&&(g=E,m=I[2])}const x=E=>new Tt(h[E][0],h[E][1]);let w;switch(g){case 0:case 6:w=[x(1),x(5),x(4),x(7),x(3),x(2),x(1)];break;case 1:case 7:w=[x(0),x(4),x(5),x(6),x(2),x(3),x(0)];break;case 3:case 5:w=[x(1),x(0),x(4),x(7),x(6),x(2),x(1)];break;default:w=[x(1),x(5),x(6),x(7),x(3),x(0),x(1)]}if(Gi(a,w))return m}const ip=64,gg={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Kj(a,r,n,c,h,m,g,x,w,E=!1){const I=n.zoom,A=n.project(c),P=Se(c.lat,I),D=1/P;pe(a),ie(a,a,[A.x+g[0]*D,A.y+g[1]*D,g[2]]);let O=1,V=1;const j=n.worldSize;if(E){if(n.projection.name==="mercator"){let ae=0;n.elevation&&(ae=n.elevation.getAtPointOrZero(new ye(A.x/j,A.y/j),0));const Ie=Uo([],[A.x,A.y,ae,1],n.projMatrix)[3]/n.cameraToCenterDistance;O=Ie,V=Ie*Se(n.center.lat,I)}else if(n.projection.name==="globe"){const ae=SA(a,n),Ie=[0,0,0,1];Uo(Ie,Ie,_e([],n.projMatrix,ae));const be=Ie[3]/n.cameraToCenterDistance,Te=bd(I),Le=n.projection.pixelsPerMeter(c.lat,j)*Se(c.lat,I),De=n.projection.pixelsPerMeter(n.center.lat,j)*Se(n.center.lat,I);O=be/_r(Le,we(n.center.lat),Te),V=be*P/Le,O*=De,V*=De}}else O=D;ke(a,a,[O,O,V]);const X=[...a],oe=r.orientation,ne=[];if(Xj(ne,[oe[0]+h[0],oe[1]+h[1],oe[2]+h[2]],m),_e(a,X,ne),x&&n.elevation){let ae=0;const Ie=[];if(w&&n.elevation){ae=function(Te,Le,De,lt,je){const ht=Le.elevation;if(!ht)return 0;const Lt=Zr.projectAabbCorners(De,lt),gt=Z(1,je.lat)*Le.worldSize,St=function(Pt,rr){const Wt=[0,0,1],Ut=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Xt of Ut){const xr=Pt[Xt.corners[0]],Mr=Pt[Xt.corners[1]],Or=Pt[Xt.corners[2]],Rr=[Mr[0]-xr[0],Mr[1]-xr[1],rr*(Mr[2]-xr[2])],ri=qi(Rr,Rr,[Or[0]-xr[0],Or[1]-xr[1],rr*(Or[2]-xr[2])]);fr(ri,ri),Xt.dotProductWithUp=Ur(ri,Wt)}return Ut.sort((Xt,xr)=>Xt.dotProductWithUp-xr.dotProductWithUp),Ut[0].corners}(Lt,gt),kt=Lt[St[0]],st=Lt[St[1]],Ct=Lt[St[2]],$e=Lt[St[3]],at=ht.getAtPointOrZero(new ye(kt[0]/Le.worldSize,kt[1]/Le.worldSize),0),Dt=ht.getAtPointOrZero(new ye(st[0]/Le.worldSize,st[1]/Le.worldSize),0),At=ht.getAtPointOrZero(new ye(Ct[0]/Le.worldSize,Ct[1]/Le.worldSize),0),sr=ht.getAtPointOrZero(new ye($e[0]/Le.worldSize,$e[1]/Le.worldSize),0),Qt=(at+sr)/2,bt=(Dt+At)/2;return Qt>bt?Dt<At?Uw(Te,st,$e,kt,Dt,sr,at,gt):Uw(Te,Ct,kt,$e,At,at,sr,gt):at<sr?Uw(Te,kt,st,Ct,at,Dt,At,gt):Uw(Te,$e,Ct,st,sr,At,Dt,gt),Math.max(Qt,bt)}(Ie,n,r.aabb,a,c);const be=_e([],ve([],Ie),ne);_e(a,X,be)}else ae=n.elevation.getAtPointOrZero(new ye(A.x/j,A.y/j),0);ae!==0&&(a[14]+=ae)}}function tv(a,r,n=!1){a.uploaded||(a.gfxTexture=new TA(r,a.image,n?r.gl.R8:r.gl.RGBA8,{useMipmap:a.sampler.minFilter>=r.gl.NEAREST_MIPMAP_NEAREST}),a.uploaded=!0,a.image=null)}function Iee(a,r,n){a.indexBuffer=r.createIndexBuffer(a.indexArray,!1,!0),a.vertexBuffer=r.createVertexBuffer(a.vertexArray,xee.members,!1,!0),a.normalArray&&(a.normalBuffer=r.createVertexBuffer(a.normalArray,Eee.members,!1,!0)),a.texcoordArray&&(a.texcoordBuffer=r.createVertexBuffer(a.texcoordArray,Tee.members,!1,!0)),a.colorArray&&(a.colorBuffer=r.createVertexBuffer(a.colorArray,(a.colorArray.bytesPerElement===12?bee:wee).members,!1,!0)),a.featureArray&&(a.pbrBuffer=r.createVertexBuffer(a.featureArray,Cee.members,!0)),a.segments=xn.simpleSegment(0,0,a.vertexArray.length,a.indexArray.length);const c=a.material;
66c.pbrMetallicRoughness.baseColorTexture&&tv(c.pbrMetallicRoughness.baseColorTexture,r),c.pbrMetallicRoughness.metallicRoughnessTexture&&tv(c.pbrMetallicRoughness.metallicRoughnessTexture,r),c.normalTexture&&tv(c.normalTexture,r),c.occlusionTexture&&tv(c.occlusionTexture,r,n),c.emissionTexture&&tv(c.emissionTexture,r)}function CA(a,r,n){if(a.meshes)for(const c of a.meshes)Iee(c,r,n);if(a.children)for(const c of a.children)CA(c,r,n)}function jw(a){if(a.meshes)for(const r of a.meshes)r.indexArray.destroy(),r.vertexArray.destroy(),r.colorArray&&r.colorArray.destroy(),r.normalArray&&r.normalArray.destroy(),r.texcoordArray&&r.texcoordArray.destroy(),r.featureArray&&r.featureArray.destroy();if(a.children)for(const r of a.children)jw(r)}function IA(a){if(a.meshes)for(const n of a.meshes)n.vertexBuffer&&(n.vertexBuffer.destroy(),n.indexBuffer.destroy(),n.normalBuffer&&n.normalBuffer.destroy(),n.texcoordBuffer&&n.texcoordBuffer.destroy(),n.colorBuffer&&n.colorBuffer.destroy(),n.pbrBuffer&&n.pbrBuffer.destroy(),n.segments.destroy(),n.material&&((r=n.material).pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()));var r;if(a.children)for(const n of a.children)IA(n)}function np(a,r){const n=a.json.bufferViews[r.bufferView],c=Nw[r.componentType];return new c(a.buffers[n.buffer],(r.byteOffset||0)+(n.byteOffset||0),r.count*(n.byteStride&&n.byteStride!==Q0[r.type]*c.BYTES_PER_ELEMENT?n.byteStride/c.BYTES_PER_ELEMENT:Q0[r.type]))}function AA(a,r,n,c){const h=Nw[r.componentType],m=function(I){switch(I){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(h),g=a.json.bufferViews[r.bufferView],x=g.byteStride?g.byteStride/h.BYTES_PER_ELEMENT:Q0[r.type],w=n.float32,E=w.length/n.capacity;for(let I=0,A=0;I<r.count*x;I+=x,A+=E)for(let P=0;P<E;P++)w[A+P]=c[I+P]*m;n._trim()}function Aee(a,r,n){const c=a.indices,h=a.attributes,m={};m.indexArray=new gn;const g=r.json.accessors[c],x=g.count/3;m.indexArray.reserve(x);const w=np(r,g);for(let P=0;P<x;
66P++)m.indexArray.emplaceBack(w[3*P],w[3*P+1],w[3*P+2]);m.indexArray._trim(),m.vertexArray=new pa;const E=r.json.accessors[h.POSITION];m.vertexArray.reserve(E.count);const I=np(r,E);for(let P=0;P<E.count;P++)m.vertexArray.emplaceBack(I[3*P],I[3*P+1],I[3*P+2]);if(m.vertexArray._trim(),m.aabb=new Zr(E.min,E.max),m.centroid=function(P,D){const O=[0,0,0],V=P.length;if(V>0){for(let j=0;j<V;j++){const X=3*P[j];O[0]+=D[X],O[1]+=D[X+1],O[2]+=D[X+2]}O[0]/=V,O[1]/=V,O[2]/=V}return O}(w,I),h.COLOR_0!==void 0){const P=r.json.accessors[h.COLOR_0],D=Q0[P.type],O=np(r,P);m.colorArray=D===3?new pa:new ru,m.colorArray.resize(P.count),AA(r,P,m.colorArray,O)}if(h.NORMAL!==void 0){m.normalArray=new pa;const P=r.json.accessors[h.NORMAL];m.normalArray.resize(P.count);const D=np(r,P);AA(r,P,m.normalArray,D)}if(h.TEXCOORD_0!==void 0&&n.length>0){m.texcoordArray=new iu;const P=r.json.accessors[h.TEXCOORD_0];m.texcoordArray.resize(P.count);const D=np(r,P);AA(r,P,m.texcoordArray,D)}if(h._FEATURE_ID_RGBA4444!==void 0){const P=r.json.accessors[h._FEATURE_ID_RGBA4444];r.json.extensionsUsed&&r.json.extensionsUsed.includes("EXT_meshopt_compression")&&(m.featureData=np(r,P))}h._FEATURE_RGBA4444!==void 0&&(m.featureData=new Uint32Array(np(r,r.json.accessors[h._FEATURE_RGBA4444]).buffer));const A=a.material;return m.material=function(P,D){const{emissiveFactor:O=[0,0,0],alphaMode:V="OPAQUE",alphaCutoff:j=.5,normalTexture:X,occlusionTexture:oe,emissiveTexture:ne,doubleSided:ae}=P,{baseColorFactor:Ie=[1,1,1,1],metallicFactor:be=1,roughnessFactor:Te=1,baseColorTexture:Le,metallicRoughnessTexture:De}=P.pbrMetallicRoughness||{},lt=oe?D[oe.index]:void 0;if(oe&&oe.extensions&&oe.extensions.KHR_texture_transform&&lt){const je=oe.extensions.KHR_texture_transform;lt.offsetScale=[je.offset[0],je.offset[1],je.scale[0],je.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Mi(...Ie),metallicFactor:be,roughnessFactor:Te,baseColorTexture:Le?D[Le.index]:void 0,metallicRoughnessTexture:De?D[De.index]:void 0},doubleSided:ae,emissiveFactor:new Mi(...O),alphaMode:V,alphaCutoff:j,normalTexture:X?D[X.index]:void 0,occlusionTexture:lt,emissionTexture:ne?D[ne.index]:void 0,defined:P.defined===void 0}}(A!==void 0?r.json.materials[A]:{defined:!1},n),m}function Jj(a,r,n){const{matrix:c,rotation:h,translation:m,scale:g,mesh:x,extras:w,children:E}=a,I={};if(I.matrix=c||function(A,P,D,O){var V=P[0],j=P[1],X=P[2],oe=P[3],ne=V+V,ae=j+j,Ie=X+X,be=V*ne,Te=V*ae,Le=V*Ie,De=j*ae,lt=j*Ie,je=X*Ie,ht=oe*ne,Lt=oe*ae,gt=oe*Ie,St=O[0],kt=O[1],st=O[2];return A[0]=(1-(De+je))*St,A[1]=(Te+gt)*St,A[2]=(Le-Lt)*St,A[3]=0,A[4]=(Te-gt)*kt,A[5]=(1-(be+je))*kt,A[6]=(lt+ht)*kt,A[7]=0,A[8]=(Le+Lt)*st,A[9]=(lt-ht)*st,A[10]=(1-(be+De))*st,A[11]=0,A[12]=D[0],A[13]=D[1],A[14]=D[2],A[15]=1,A}([],h||[0,0,0,1],m||[0,0,0],g||[1,1,1]),x!==void 0){I.meshes=n[x];const A=I.anchor=[0,0];for(const P of I.meshes){const{min:D,max:O}=P.aabb;A[0]+=D[0]+O[0],A[1]+=D[1]+O[1]}A[0]=Math.floor(A[0]/I.meshes.length/2),A[1]=Math.floor(A[1]/I.meshes.length/2)}if(w&&(w.id&&(I.id=w.id),w.lights&&(I.lights=function(A){if(!A.length)return[];const P=function(X){const oe=atob(X),ne=new Uint8Array(oe.length);for(let ae=0;ae<oe.length;ae++)ne[ae]=oe.codePointAt(ae);return ne}(A),D=[],O=P.length/24,V=new Uint16Array(P.buffer),j=new Float32Array(P.buffer);for(let X=0;X<O;X++){const oe=V[2*X*6]/30,ne=V[2*X*6+1]/30,ae=V[2*X*6+10]/100,Ie=j[6*X+1],be=j[6*X+2],Te=j[6*X+3],Le=j[6*X+4],De=Te-Ie,lt=Le-be,je=Math.hypot(De,lt);D.push({pos:[Ie+.5*De,be+.5*lt,ne],normal:[lt/je,-De/je,0],width:je,height:oe,depth:ae,points:[Ie,be,Te,Le]})}return D}(w.lights))),E){const A=[];for(const P of E)A.push(Jj(r.json.nodes[P],r,n));I.children=A}return I}function Pee(a){if(a.vertices.length===0||a.indices.length===0)return null;const r=new Mw(a.vertices,a.indices,8,256),[n,c]=[r.min.clone(),r.max.clone()];return{vertices:a.vertices,indices:a.indices,grid:r,min:n,max:c}}function Mee(a){if(!a.extras||!a.extras.ground)return null;const r=a.extras.ground;if(!r||!Array.isArray(r)||r.length===0)return null;const n=r[0];if(!n||!Array.isArray(n)||n.length===0)return null;const c=[];for(const g of n){if(!Array.isArray(g)||g.length!==2)continue;const x=g[0],w=g[1];typeof x=="number"&&typeof w=="number"&&c.push(new Tt(x,w))}if(c.length<3)return null;c.length>1&&c[c.length-1].equals(c[0])&&c.pop();let h=0;for(let g=0;g<c.length;g++){const x=c[g],w=c[(g+1)%c.length],E=c[(g+2)%c.length];h+=(x.x-w.x)*(E.y-w.y)-(E.x-w.x)*(x.y-w.y)}h>0&&c.reverse();const m=ug(c.flatMap(g=>[g.x,g.y]),[]);return m.length===0?null:{vertices:c,indices:m}}function kee(a,r){const n=[],c=[];let h=0;const m=[];for(const g of a){h=n.length;const x=g.vertexArray.float32,w=g.indexArray.uint16;for(let E=0;E<g.vertexArray.length;E++)m[0]=x[3*E+0],m[1]=x[3*E+1],m[2]=x[3*E+2],sn(m,m,r),n.push(new Tt(m[0],m[1]));for(let E=0;E<3*g.indexArray.length;E++)c.push(w[E]+h)}if(c.length%3!=0)return null;for(let g=0;g<c.length;g+=3){const x=n[c[g+0]],w=n[c[g+1]],E=n[c[g+2]];(x.x-w.x)*(E.y-w.y)-(E.x-w.x)*(x.y-w.y)>0&&([c[g+1],c[g+2]]=[c[g+2],c[g+1]])}return{vertices:n,indices:c}}function Qj(a){const r=function(w,E){const I=[],A=WebGL2RenderingContext;if(w.json.textures)for(const P of w.json.textures){const D={magFilter:A.LINEAR,minFilter:A.NEAREST,wrapS:A.REPEAT,wrapT:A.REPEAT};P.sampler!==void 0&&Object.assign(D,w.json.samplers[P.sampler]),I.push({image:E[P.source],sampler:D,uploaded:!1})}return I}(a,a.images),n=function(w,E){const I=[];for(const A of w.json.meshes){const P=[];for(const D of A.primitives)P.push(Aee(D,w,E));I.push(P)}return I}(a,r),{scenes:c,scene:h,nodes:m}=a.json,g=c?c[h||0].nodes:m,x=[];for(const w of g)x.push(Jj(m[w],a,n));return function(w,E,I){const A={},P=new Set;for(let D=0;D<w.length;D++){const O=I[E[D]];if(!O.extras)continue;const V=O.extras["mapbox:footprint:version"],j=O.extras["mapbox:footprint:id"];(V||j)&&P.add(D),V==="1.0.0"&&j&&(A[j]=D)}for(let D=0;D<w.length;D++){if(P.has(D))continue;const O=w[D],V=I[E[D]];if(!V.extras)continue;let j=null;O.id in A&&(j=kee(w[A[O.id]].meshes,O.matrix)),j||(j=Mee(V)),j&&(O.footprint=Pee(j))}if(P.size>0){const D=Array.from(P.values()).sort((O,V)=>O-V);for(let O=D.length-1;O>=0;O--)w.splice(D[O],1)}}(x,g,a.json.nodes),x}function Ree(a){a.heightmap=new Float32Array(4096),a.heightmap.fill(-1);const r=a.vertexArray.float32,n=a.aabb.min[0]-1,c=a.aabb.min[1]-1,h=ip/(a.aabb.max[0]-n+2),m=ip/(a.aabb.max[1]-c+2);for(let g=0;g<r.length;g+=3){const x=r[g+2],w=(r[g+0]-n)*h|0,E=(r[g+1]-c)*m|0;x>a.heightmap[E*ip+w]&&(a.heightmap[E*ip+w]=x)}}function e6(a,r,n,c,h){n.reserve(n.length+4*a.length),c.reserve(c.length+10*a.length),h.reserve(h.length+10*a.length);let m=c.length;for(const g of a){const x=Math.min(10,Math.max(4,1.3*g.height))*r,w=[-g.normal[1],g.normal[0],0],E=Math.min(.29,.1*g.width/g.depth),I=g.width-2*g.depth*r*(E+.01),A=gr([],g.pos,w,I/2),P=gr([],g.pos,w,-I/2),D=[A[0],A[1],A[2]+g.height],O=[P[0],P[1],P[2]+g.height],V=gr([],g.normal,w,E);jt(V,V,x);const j=gr([],g.normal,w,-E);jt(j,j,x),He(V,A,V),He(j,P,j),A[2]+=.1,P[2]+=.1,c.emplaceBack(V[0],V[1],V[2]),c.emplaceBack(j[0],j[1],j[2]),c.emplaceBack(A[0],A[1],A[2]),c.emplaceBack(P[0],P[1],P[2]),c.emplaceBack(D[0],D[1],D[2]),c.emplaceBack(O[0],O[1],O[2]),c.emplaceBack(A[0],A[1],A[2]),c.emplaceBack(P[0],P[1],P[2]),c.emplaceBack(V[0],V[1],V[2]),c.emplaceBack(j[0],j[1],j[2]);const X=I/x/2;h.emplaceBack(-X-E,-1,X,.8),h.emplaceBack(X+E,-1,X,.8),h.emplaceBack(-X,0,X,1.3),h.emplaceBack(X,0,X,1.3),h.emplaceBack(X+E,-.8,X,.7),h.emplaceBack(X+E,-.8,X,.7),h.emplaceBack(0,0,X,1.3),h.emplaceBack(0,0,X,1.3),h.emplaceBack(X+E,-1.2,X,.8),h.emplaceBack(X+E,-1.2,X,.8),n.emplaceBack(6+m,4+m,8+m),n.emplaceBack(7+m,9+m,5+m),n.emplaceBack(0+m,1+m,2+m),n.emplaceBack(1+m,3+m,2+m),m+=10}}function Lee(a,r){const n={};n.indexArray=new gn,n.vertexArray=new pa,n.colorArray=new ru,e6(a,r,n.indexArray,n.vertexArray,n.colorArray);const c={defined:!0};c.emissiveFactor=Mi.black;const h={};return h.baseColorFactor=Mi.white,c.pbrMetallicRoughness=h,n.material=c,n.aabb=new Zr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),n}const t6=si([{name:"a_pos_3f",components:3,type:"Float32"}]),zee=si([{name:"a_normal_3",components:3,type:"Int16"}]),r6=si([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Dee=si([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),i6=Ke.types,PA=32767;
66function Oee(a,r){const n=Vt+r;for(const c of a)for(const h of c)if(h.x<-r||h.x>n||h.y<-r||h.y>n)return!1;return!0}class n6{constructor(r){this.layoutAOArray=[],this.indexArrayForConflationUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.footprintLookup={},this.zoom=r.zoom,this.canonical=r.canonical,this.layers=r.layers,this.layerIds=this.layers.map(n=>n.fqid),this.index=r.index,this.hasPattern=!1,this.worldview=r.worldview,this.layoutVertexArray=new pa,this.layoutNormalArray=new cd,this.layoutColorArray=new Dl,this.indexArray=new gn,this.indexArrayForConflation=new gn,this.entranceBloom={layoutVertexArray:new pa,layoutVertexBuffer:null,layoutAttenuationArray:new ru,layoutAttenuationBuffer:null,layoutColorArray:new Dl,layoutColorBuffer:null,indexArray:new gn,indexArrayForConflation:new gn,indexBuffer:null,segmentsBucket:new xn},this.programConfigurations=new ga(r.layers,{zoom:r.zoom,lut:r.lut}),this.segmentsBucket=new xn,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.projection=r.projection,this.groundEffect=new pA(r)}get segments(){return this.segmentsBucket}get bloomGeometry(){return this.entranceBloom}updateFootprints(r,n){for(const c of this.footprints)n.push({footprint:c,id:r})}prepare(){return function(){if(Fw!=null||Fj!=null)return null;if(mg!=null)return mg;const r=fetch(Qn.BUILDING_GEN_URL);return mg=function(n){let c,h,m,g;function x(){c=new Uint8Array(g.buffer),h=new Int32Array(g.buffer),m=new Float32Array(g.buffer)}function w(){throw new Error("Unexpected BuildingGen error.")}const E=()=>{},I={a:{a:w,f:function(A){const P=c.length,D=Math.max(A>>>0,Math.ceil(1.2*P)),O=Math.ceil((D-P)/65536);try{return g.grow(O),x(),!0}catch{return!1}},g:w,b:E,c:E,d:E,e:E}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(n,I):n.then(A=>A.arrayBuffer()).then(A=>WebAssembly.instantiate(A,I))).then(A=>{const P=A.instance.exports;return(0,P.g)(),g=P.f,x(),new fee({setStyle:P.h,setAOOptions:P.i,setMetricOptions:P.j,setStructuralOptions:P.k,setFacadeOptions:P.l,setFauxFacadeOptions:P.m,setFacadeClassifierOptions:P.n,addFeature:P.o,addFacade:P.p,generateMesh:P.q,getLastError:P.r,getMeshCount:P.s,getPositionsPtr:P.t,getPositionsLength:P.u,getNormalsPtr:P.v,getNormalsLength:P.w,getColorsPtr:P.x,getColorsLength:P.y,getAOPtr:P.z,getAOLength:P.A,getUVPtr:P.B,getUVLength:P.C,getFauxFacadePtr:P.D,getFauxFacadeLength:P.E,getIndicesPtr:P.F,getIndicesLength:P.G,getBuildingPart:P.H,getRingCount:P.I,getRingPtr:P.J,getRingLength:P.K,free:P.L,malloc:P.M,heapU8:c,heap32:h,heapF32:m})})}(r).then(n=>(mg=null,Fw=n,Fw)).catch(n=>{Ar("Could not load building-gen"),mg=null,Fj=n}),mg}()}populate(r,n,c,h){const m=pee();if(!m)return;const g=ge(c);this.tileToMeter=g,this.brightness=n.brightness,m.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,g],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:g,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),m.setAOOptions(!1,.3),m.setMetricOptions(!1,16),m.setStructuralOptions(!0),m.setFacadeOptions(4,!0),m.setFauxFacadeOptions(!1,!1,1),m.setFacadeClassifierOptions(3);const x=new Map;for(const{feature:w}of r){if(i6[w.type]!=="LineString")continue;const E=this.layers[0]._featureFilter.needGeometry,I=nt(w,E);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom),I,c))continue;const A=E?I.geometry:Pe(w,c,h),P=[];for(const j of A)for(const X of j)P.push({x:X.x,y:X.y});const D={coordinates:P,crossPerc:w.properties.cross_perc,distanceToRoad:w.properties.distance_to_road,entrances:w.properties.entrances,sourceId:0},O=w.properties.source_id;let V=x.get(O);V||(V=[],x.set(O,V)),V.push(D)}this.maxHeight=0;for(const{feature:w,index:E}of r){if(i6[w.type]==="LineString")continue;const I=this.layers[0]._featureFilter.needGeometry,A=nt(w,I);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom),A,c))continue;const P=I?A.geometry:Pe(w,c,h),D=$0(P,500);if(!Oee(P,163))continue;const O=this.layers[0],V=O.layout.get("building-base").evaluate(w,{},c),j=O.layout.get("building-height").evaluate(w,{},c),X=O.layout.get("building-roof-shape").evaluate(w,{},c),oe=O.paint.get("building-ambient-occlusion-intensity"),ne=O.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if(X==="flat")continue;const ae=w.properties.source_id;let Ie;Ie=x.has(ae)?x.get(ae):[];const be=[],Te=new Tt(1/0,1/0),Le=new Tt(-1/0,-1/0);for(const bt of D)if(bt.length>0){const Pt=[];for(const rr of bt){const Wt=[];for(let Ut=rr.length-1;Ut>=0;Ut--){const Xt=rr[Ut];Wt.push({x:Xt.x,y:Xt.y}),Te.x=Math.min(Te.x,Xt.x),Te.y=Math.min(Te.y,Xt.y),Le.x=Math.max(Le.x,Xt.x),Le.y=Math.max(Le.y,Xt.y)}Pt.push(Wt)}be.push({id:w.id,height:j,minHeight:V,sourceId:0,roofType:X,coordinates:Pt})}const De=m.generateMesh(be,Ie);if(typeof De=="string"||De.meshes.length===0||De.modifiedPolygonRings.length===0)continue;let lt=0;for(const bt of De.meshes)lt+=bt.positions.length/3;const je=this.segmentsBucket.prepareSegment(lt,this.layoutVertexArray,this.indexArray),ht=[];let Lt=null,gt=0,St=-1;const kt=this.indexArray.length;let st=0;for(const bt of De.meshes){const Pt=this.layoutVertexArray.length;if(bt.buildingPart==="entrance"){const Wt=new Array;for(let Mr=0;Mr<bt.indices.length;Mr+=12){const Or=bt.positions[Mr+0],Rr=bt.positions[Mr+1],ri=bt.positions[Mr+3],Hr=bt.positions[Mr+4],ln=bt.positions[Mr+2],ue=bt.positions[Mr+8]-ln,he=1,it=ri-Or,Ot=Hr-Rr,$t=Math.hypot(it,Ot);Wt.push({pos:[Or+.5*it,Rr+.5*Ot,ln],normal:[Ot/$t,-it/$t,0],width:$t,height:ue,depth:he,points:[Or,Rr,ri,Hr]})}const Ut=this.entranceBloom.segmentsBucket.prepareSegment(10*Wt.length,this.entranceBloom.layoutVertexArray,this.entranceBloom.indexArray),Xt=this.entranceBloom.layoutVertexArray.length;gt=this.entranceBloom.indexArray.length,e6(Wt,.5/this.tileToMeter,this.entranceBloom.indexArray,this.entranceBloom.layoutVertexArray,this.entranceBloom.layoutAttenuationArray);const xr=this.entranceBloom.layoutVertexArray.length-Xt;St=this.entranceBloom.indexArray.length-gt;for(let Mr=0;Mr<xr;Mr++)this.entranceBloom.layoutColorArray.emplaceBack(65535,65535);Ut.vertexLength+=xr,Ut.primitiveLength+=St,Lt={part:bt.buildingPart,vertexOffset:Xt,vertexLength:xr}}for(let Wt=0;Wt<bt.positions.length;Wt+=3)st=Math.max(st,bt.positions[Wt+2]),this.layoutVertexArray.emplaceBack(bt.positions[Wt],bt.positions[Wt+1],bt.positions[Wt+2]);for(let Wt=0;Wt<bt.normals.length;Wt+=3)this.layoutNormalArray.emplaceBack(bt.normals[Wt+0]*PA,bt.normals[Wt+1]*PA,bt.normals[Wt+2]*PA);for(let Wt=0;Wt<bt.ao.length;Wt++)this.layoutAOArray.push(bt.ao[Wt]);for(let Wt=0;Wt<bt.colors.length;Wt+=3){const Ut=1+(bt.ao[Wt/3]-1)*oe;this.layoutColorArray.emplaceBack(bt.colors[Wt]*Ut<<8|bt.colors[Wt+1]*Ut,bt.colors[Wt+2]*Ut<<8)}const rr=je.vertexLength;for(let Wt=0;Wt<bt.indices.length;Wt+=3)this.indexArray.emplaceBack(rr+bt.indices[Wt],rr+bt.indices[Wt+1],rr+bt.indices[Wt+2]);je.vertexLength+=bt.positions.length/3,je.primitiveLength+=bt.indices.length/3,(bt.buildingPart==="roof"||bt.buildingPart==="wall"||bt.buildingPart==="facade_glazing"||bt.buildingPart==="entrance")&&ht.push({part:bt.buildingPart,vertexOffset:Pt,vertexLength:bt.positions.length/3})}this.maxHeight=Math.max(this.maxHeight,st),this.buildingFeatures.push({feature:A,segment:je,parts:ht,buildingBloom:Lt});const Ct=this.indexArray.length-kt,$e=[],at=[],Dt=new Tt(1/0,1/0),At=new Tt(-1/0,-1/0),sr=this.groundEffect.vertexArray.length;for(const bt of De.modifiedPolygonRings){const Pt=[],rr=new Tt(1/0,1/0),Wt=new Tt(-1/0,-1/0);for(let Ut=0;Ut<bt.length;Ut+=2){const Xt=bt.length-Ut-2;rr.x=Math.min(rr.x,bt[Xt]),rr.y=Math.min(rr.y,bt[Xt+1]),Wt.x=Math.max(Wt.x,bt[Xt]),Wt.y=Math.max(Wt.y,bt[Xt+1]);const xr=new Tt(bt[Xt],bt[Xt+1]);
66Pt.push(xr),$e.push(xr.x,xr.y),at.push(xr.clone())}Dt.x=Math.min(Dt.x,rr.x),Dt.y=Math.min(Dt.y,rr.y),At.x=Math.max(At.x,Wt.x),At.y=Math.max(At.y,Wt.y),this.groundEffect.addData(Pt,[rr,Wt],ne)}const Qt=this.groundEffect.vertexArray.length-sr;(Te.x<0||Le.x>Vt||Te.y<0||Le.y>Vt)&&this.featuresOnBorder.push({featureId:w.id,footprintIndex:this.footprints.length});{const bt=ug($e,null,2),Pt=new Mw(at,bt,8,256);let rr=w.id;w.properties&&w.properties.hasOwnProperty("building_id")&&(rr=w.properties.building_id),this.footprints.push({vertices:at,indices:bt,grid:Pt,min:Dt,max:At,buildingId:rr,hiddenFlags:0,indicesOffset:kt,indicesLength:Ct,bloomIndicesOffset:gt,bloomIndicesLength:St,groundEffectVertexOffset:sr,groundEffectVertexLength:Qt,segment:je,height:st})}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,w,E,{},n.availableImages,c,n.brightness),this.groundEffect.addPaintPropertiesData(w,E,{},n.availableImages,c,n.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0])}update(r,n,c,h,m,g,x){this.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x),this.groundEffect.update(r,n,m,c,h,g,x)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,t6.members),this.layoutNormalBuffer=r.createVertexBuffer(this.layoutNormalArray,zee.members),this.entranceBloom.layoutVertexBuffer=r.createVertexBuffer(this.entranceBloom.layoutVertexArray,t6.members),this.entranceBloom.layoutAttenuationBuffer=r.createVertexBuffer(this.entranceBloom.layoutAttenuationArray,Dee.members),this.uploadUpdatedColorBuffer(r),this.uploadUpdatedIndexBuffer(r),this.groundEffect.upload(r)),this.groundEffect.uploadPaintProperties(r),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.layoutNormalBuffer.destroy(),this.layoutColorBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segmentsBucket.destroy(),this.entranceBloom.layoutVertexBuffer.destroy(),this.entranceBloom.layoutColorBuffer.destroy(),this.entranceBloom.layoutAttenuationBuffer.destroy(),this.entranceBloom.indexBuffer.destroy(),this.entranceBloom.segmentsBucket.destroy())}updateFootprintHiddenFlags(r,n,c=!0){let h=!1;const m=c?n:0,g=0|(c?-1:~n);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const x of r){const w=this.footprints[x],E=w.hiddenFlags&g|m;w.hiddenFlags!==E&&(w.hiddenFlags=E,h=!0,this.groundEffect.updateHiddenByLandmarkRange(w.groundEffectVertexOffset,w.groundEffectVertexLength,w.hiddenFlags!==0))}return h&&(this.indexArrayForConflationUploaded=!1),h}uploadUpdatedIndexBuffer(r){if(this.groundEffect.uploadHiddenByLandmark(r),!this.indexArrayForConflationUploaded&&this.indexArray.length!==0){this.indexArrayForConflation.resize(this.indexArray.length),this.indexArrayForConflation.uint16.set(this.indexArray.uint16),this.entranceBloom.indexArrayForConflation.resize(this.entranceBloom.indexArray.length),this.entranceBloom.indexArrayForConflation.uint16.set(this.entranceBloom.indexArray.uint16);for(const n of this.footprints){const c=n.indicesOffset+n.indicesLength;if(n.hiddenFlags!==0){for(let m=n.indicesOffset;m<c;m++)this.indexArrayForConflation.uint16[3*m+0]=0,this.indexArrayForConflation.uint16[3*m+1]=0,this.indexArrayForConflation.uint16[3*m+2]=0;const h=n.bloomIndicesOffset+n.bloomIndicesLength;for(let m=n.bloomIndicesOffset;m<h;m++)this.entranceBloom.indexArrayForConflation.uint16[3*m+0]=0,this.entranceBloom.indexArrayForConflation.uint16[3*m+1]=0,this.entranceBloom.indexArrayForConflation.uint16[3*m+2]=0}}this.indexBuffer?this.indexBuffer.updateData(this.indexArrayForConflation):this.indexBuffer=r.createIndexBuffer(this.indexArrayForConflation,!0),this.entranceBloom.indexBuffer?this.entranceBloom.indexBuffer.updateData(this.entranceBloom.indexArrayForConflation):this.entranceBloom.indexBuffer=r.createIndexBuffer(this.entranceBloom.indexArrayForConflation,!0),this.indexArrayForConflationUploaded=!0}}uploadUpdatedColorBuffer(r){this.layoutColorBuffer?this.layoutColorBuffer.updateData(this.layoutColorArray):this.layoutColorBuffer=r.createVertexBuffer(this.layoutColorArray,r6.members,!0),this.entranceBloom.layoutColorBuffer?this.entranceBloom.layoutColorBuffer.updateData(this.entranceBloom.layoutColorArray):this.entranceBloom.layoutColorBuffer=r.createVertexBuffer(this.entranceBloom.layoutColorArray,r6.members,!0)}evaluate(r){const n=r.paint.get("building-ambient-occlusion-intensity");for(const c of this.buildingFeatures){const h=c.feature;h.properties["building-part"]="roof";const m=r.paint.get("building-color").evaluate(h,{},this.canonical),g=r.paint.get("building-emissive-strength").evaluate(h,{},this.canonical);h.properties["building-part"]="wall";const x=r.paint.get("building-color").evaluate(h,{},this.canonical),w=r.paint.get("building-emissive-strength").evaluate(h,{},this.canonical);h.properties["building-part"]="window";const E=r.paint.get("building-color").evaluate(h,{},this.canonical),I=r.paint.get("building-emissive-strength").evaluate(h,{},this.canonical);h.properties["building-part"]="door";const A=r.paint.get("building-color").evaluate(h,{},this.canonical),P=r.paint.get("building-emissive-strength").evaluate(h,{},this.canonical);for(const O of c.parts){let V,j=m;O.part==="roof"?(j=m,V=g):O.part==="wall"?(j=x,V=w):O.part==="facade_glazing"?(j=E,V=I):O.part==="entrance"&&(j=A,V=P),V=J(V,0,1);for(let X=0;X<O.vertexLength;X++){const oe=O.vertexOffset+X,ne=1+(this.layoutAOArray[oe]-1)*n;this.layoutColorArray.emplace(oe,j.r*ne*255<<8|j.g*ne*255,j.b*ne*255<<8|255*V)}}const D=c.buildingBloom;if(D)for(let O=0;O<D.vertexLength;O++)this.bloomGeometry.layoutColorArray.emplace(D.vertexOffset+O,25
665*A.r<<8|255*A.g,255*A.b<<8|51*P)}}needsEvaluation(r,n){const c=r.transform.projectionOptions,h=r.style.getBrightness();return!(this.uploaded&&c.name===this.projection.name&&this.brightness===h||(this.projection=c,this.brightness=h,0))}updateReplacement(r,n,c){if(n.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=n.updateTime;const h=n.getReplacementRegionsForTile(r.toUnwrapped());if(Rw(this.activeReplacements,h))return;this.activeReplacements=h;for(const g of this.footprints)g.hiddenFlags&=-2;const m=[];for(const g of this.activeReplacements){if(g.order<=cj)continue;const x=Math.max(1,Math.pow(2,g.footprintTileId.canonical.z-r.canonical.z));for(const w of this.footprints)w.min.x>g.max.x||w.max.x<g.min.x||w.min.y>g.max.y||w.max.y<g.min.y||(m.length=0,Fee(w.vertices,0,w.vertices.length,g.footprintTileId.canonical,r.canonical,m),uA(g.footprint,m,w.indices,0,w.indices.length,0,-x)&&(w.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const g of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(g.groundEffectVertexOffset,g.groundEffectVertexLength,g.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getHeightAtTileCoord(r,n){let c=Number.NEGATIVE_INFINITY,h=!0;const m=4*(r+Vt)*Vt+(n+Vt);if(this.footprintLookup.hasOwnProperty(m)){const x=this.footprintLookup[m];return x?{height:x.height,hidden:x.hiddenFlags!==0}:void 0}const g=new Tt(r,n);for(const x of this.footprints)r>x.max.x||x.min.x>r||n>x.max.y||x.min.y>n||x.height<=c||hA(g,x)&&(c=x.height,this.footprintLookup[m]=x,h=x.hiddenFlags!==0);if(c!==Number.NEGATIVE_INFINITY)return{height:c,hidden:h};this.footprintLookup[m]=void 0}}function Fee(a,r,n,c,h,m){const g=Math.pow(2,c.z-h.z);for(let x=0;x<n;x++){let w=a[x+r].x,E=a[x+r].y;w=(w+h.x*Vt)*g-c.x*Vt,E=(E+h.y*Vt)*g-c.y*Vt,m.push(new Tt(w,E))}}let o6,s6;Jt(n6,"BuildingBucket",{omit:["layers"]});const Nee=si([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Bee=si([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:Vee}=Nee,Uee=si([{name:"a_packed",components:3,type:"Float32"}]),{members:jee}=Uee,Gee=si([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:$ee}=Gee;class a6{constructor(r,n){this.width=r,this.height=n,this.nextRow=0,this.image=new wd({width:r,height:n}),this.positions={},this.uploaded=!1}getDash(r,n){const c=this.getKey(r,n);return this.positions[c]}trim(){const r=this.width,n=this.height=Mt(this.nextRow);this.image.resize({width:r,height:n})}getKey(r,n){return r.join(",")+n}getDashRanges(r,n,c){const h=[];let m=r.length%2==1?-r[r.length-1]*c:0,g=r[0]*c,x=!0;h.push({left:m,right:g,isDash:x,zeroLength:r[0]===0});let w=r[0];for(let E=1;E<r.length;E++){x=!x;const I=r[E];m=w*c,w+=I,g=w*c,h.push({left:m,right:g,isDash:x,zeroLength:I===0})}return h}addRoundDash(r,n,c){const h=n/2;for(let m=-c;m<=c;m++){const g=this.width*(this.nextRow+c+m);let x=0,w=r[x];for(let E=0;E<this.width;E++){E/w.right>1&&(w=r[++x]);const I=Math.abs(E-w.left),A=Math.abs(E-w.right),P=Math.min(I,A);let D;const O=m/c*(h+1);if(w.isDash){const V=h-Math.abs(O);D=Math.sqrt(P*P+V*V)}else D=h-Math.sqrt(P*P+O*O);this.image.data[g+E]=Math.max(0,Math.min(255,D+128))}}}addRegularDash(r,n){for(let w=r.length-1;w>=0;--w){const E=r[w],I=r[w+1];E.zeroLength?r.splice(w,1):I&&I.isDash===E.isDash&&(I.left=E.left,r.splice(w,1))}const c=r[0],h=r[r.length-1];c.isDash===h.isDash&&(c.left=h.left-this.width,h.right=c.right+this.width);const m=this.width*this.nextRow;let g=0,x=r[g];for(let w=0;w<this.width;w++){w/x.right>1&&(x=r[++g]);const E=Math.abs(w-x.left),I=Math.abs(w-x.right),A=Math.min(E,I);this.image.data[m+w]=Math.max(0,Math.min(255,(x.isDash?A:-A)+n+128))}}addDash(r,n){const c=this.getKey(r,n);if(this.positions[c])return this.positions[c];const h=n==="round",m=h?7:0,g=2*m+1;if(this.nextRow+g>this.height)return Ar("LineAtlas out of space"),null;r.length===0&&r.push(1);let x=0;for(let I=0;I<r.length;I++)r[I]<0&&(Ar("Negative value is found in line dasharray, replacing values with 0"),r[I]=0),x+=r[I];if(x!==0){const I=this.width/x,A=this.getDashRanges(r,this.width,I);h?this.addRoundDash(A,I,m):this.addRegularDash(A,n==="square"?.5*I:0)}const w=this.nextRow+m;this.nextRow+=g;const E={tl:[w,m],br:[x,0]};return this.positions[c]=E,E}}Jt(a6,"LineAtlas");const Hee=Ke.types,qee=Math.cos(Math.PI/180*37.5),Zee=Math.cos(Math.PI/180*5);class MA{constructor(r){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=r.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=r.overscaling,this.pixelRatio=r.pixelRatio,this.layers=r.layers,this.layerIds=this.layers.map(n=>n.fqid),this.index=r.index,this.projection=r.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={}
66,this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new eg,this.layoutVertexArray2=new pa,this.patternVertexArray=new pa,this.indexArray=new gn,this.programConfigurations=new ga(r.layers,{zoom:r.zoom,lut:r.lut}),this.segments=new xn,this.maxLineLength=0,this.zOffsetVertexArray=new pa,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.tessellationStep=r.tessellationStep?r.tessellationStep:Vt/64,this.worldview=r.worldview}updateFootprints(r,n){}populate(r,n,c,h){this.hasPattern=nA("line",this.layers,this.pixelRatio,n);const m=this.layers[0].layout.get("line-sort-key");this.tileToMeter=ge(c);const g=this.layers[0].layout.get("line-elevation-reference");if(g==="hd-road-markup")this.elevationType="road";else{const P=this.layers[0].layout.get("line-z-offset"),D=P.isConstant()&&!P.constantOr(0);this.elevationType=g!=="sea"&&g!=="ground"&&D?"none":"offset",this.elevationType==="offset"&&g==="none"&&Ar(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const x=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&x!==void 0;const w=[];
66for(const{feature:P,id:D,index:O,sourceLayerIndex:V}of r){const j=this.layers[0]._featureFilter.needGeometry,X=nt(P,j);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom,{worldview:this.worldview}),X,c))continue;const oe=m?m.evaluate(X,{},c):void 0,ne={id:D,properties:P.properties,type:P.type,sourceLayerIndex:V,index:O,geometry:j?X.geometry:Pe(P,c,h),patterns:{},sortKey:oe};w.push(ne)}m&&w.sort((P,D)=>P.sortKey-D.sortKey);const{lineAtlas:E,featureIndex:I}=n,A=this.addConstantDashes(E);for(const P of w){const{geometry:D,index:O,sourceLayerIndex:V}=P;if(A&&this.addFeatureDashes(P,E),this.hasPattern){const j=oA("line",this.layers,P,this.zoom,this.pixelRatio,n);this.patternFeatures.push(j)}else this.addFeature(P,D,O,c,E.positions,n.availableImages,n.brightness,n.elevationFeatures);I.insert(r[O].feature,D,O,V,this.index)}}addConstantDashes(r){let n=!1;for(const c of this.layers){const h=c.paint.get("line-dasharray").value,m=c.layout.get("line-cap").value;if(h.kind!=="constant"||m.kind!=="constant")n=!0;else{const g=m.value,x=h.value;if(!x)continue;r.addDash(x,g)}}return n}addFeatureDashes(r,n){const c=this.zoom;for(const h of this.layers){const m=h.paint.get("line-dasharray").value,g=h.layout.get("line-cap").value;if(m.kind==="constant"&&g.kind==="constant")continue;let x,w;if(m.kind==="constant"){if(x=m.value,!x)continue}else x=m.evaluate({zoom:c},r);w=g.kind==="constant"?g.value:g.evaluate({zoom:c},r),n.addDash(x,w),r.patterns[h.id]=[n.getKey(x,w)]}}update(r,n,c,h,m,g,x,w){this.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x,w)}addFeatures(r,n,c,h,m,g){for(const x of this.patternFeatures)this.addFeature(x,x.geometry,x.index,n,c,h,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=r.createVertexBuffer(this.layoutVertexArray2,jee)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=r.createVertexBuffer(this.patternVertexArray,$ee)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=r.createVertexBuffer(this.zOffsetVertexArray,Bee.members,!0)),this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,Vee),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(r){if(r.properties&&r.properties.hasOwnProperty("mapbox_clip_start")&&r.properties.hasOwnProperty("mapbox_clip_end"))return{start:+r.properties.mapbox_clip_start,end:+r.properties.mapbox_clip_end}}addFeature(r,n,c,h,m,g,x,w){const E=this.layers[0].layout,I=E.get("line-join").evaluate(r,{}),A=E.get("line-cap").evaluate(r,{}),P=E.get("line-miter-limit"),D=E.get("line-round-limit");this.lineClips=this.lineFeatureClips(r),this.lineFeature=r,this.zOffsetValue=E.get("line-z-offset").value;const O=this.layers[0].paint.get("line-width").value;if(O.kind!=="constant"&&O.isLineProgressConstant===!1&&(this.variableWidthValue=O),this.elevationType==="road"){const V=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(r,n,h,w,I,A,P,D)){const[j,X]=this.clipRuntimeLinesToTile(n,1);for(let oe=0;oe<j.length;oe++){const ne=j[oe],ae=X[oe],Ie={progress:{min:ae.progress.min,max:ae.progress.max},nextDir:this.computeSegNextDir(ae,ne),prevDir:this.computeSegPrevDir(ae,ne)};this.addLine(ne,r,h,I,A,P,D,Ie)}this.fillNonElevatedRoadSegment(V)}}else for(const V of n)this.addLine(V,r,h,I,A,P,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,m,g,h,x,void 0,this.worldview)}computeSegNextDir(r,n){return r.nextPoint.sub(n.at(-2)).unit()}computeSegPrevDir(r,n){return n[1].sub(r.prevPoint).unit()}clipLinesToTile(r,n){return Dw(r,-n,-n,Vt+n,Vt+n)}clipRuntimeLinesToTile(r,n){const c=[];return[Dw(r,-n,-n,Vt+n,Vt+n,c),c]}addElevatedRoadFeature(r,n,c,h,m,g,x,w){const E=[],I=bn.getElevationFeature(r,h);
66if(I){const A=this.clipLinesToTile(n,1),P=this.prepareElevatedLines(A,I,c);for(const D of P)E.push({geometry:D,elevation:I,elevationTileID:c,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(E.length===0)return!1;for(const A of E){const P=this.layoutVertexArray.length;this.addLine(A.geometry,r,c,m,g,x,w);const D=new hi(c,A.elevationTileID);if(A.elevation)for(let O=P;O<this.layoutVertexArray.length;O++){const V=new Tt(this.layoutVertexArray.int16[6*O]>>1,this.layoutVertexArray.int16[6*O+1]>>1),j=D.pointElevation(V,A.elevation,.05);this.updateHeightRange(j),this.zOffsetVertexArray.emplaceBack(j,0,0)}else this.fillNonElevatedRoadSegment(P)}return!0}prepareElevatedLines(r,n,c){if(n.constantHeight!=null)return r;const h=[],m=1/ge(c);for(const g of r)uee(g,new Di(n,m),0,h);return h}fillNonElevatedRoadSegment(r){for(let n=r;n<this.layoutVertexArray.length;n++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(r){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,r),this.heightRange.max=Math.max(this.heightRange.max,r)):this.heightRange={min:r,max:r}}addLine(r,n,c,h,m,g,x,w){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const E=h==="none";this.patternJoinNone=this.hasPattern&&E,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const I=w&&w.progress.min>0,A=w&&w.progress.max<1;if(this.lineClips){let Le={min:this.lineClips.start,max:this.lineClips.end},De=1;if(w){const ht=this.lineClips.end-this.lineClips.start;Le=function(Lt,gt,St){return{min:Ml(Lt.min,gt,St),max:Ml(Lt.max,gt,St)}}(w.progress,{min:0,max:1},Le),ht>0&&(De=(Le.max-Le.min)/ht)}const lt=+n.properties.mapbox_clip_feature_len,je=+n.properties.mapbox_clip_seg_len;if(Number.isNaN(lt)||Number.isNaN(je)){for(let Lt=0;Lt<r.length-1;Lt++)this.totalDistance+=r[Lt].dist(r[Lt+1]);const ht=this.totalDistance/(Le.max-Le.min);this.totalFeatureLength=Number.isFinite(ht)?ht:0,this.lineClips.start=Le.min,this.lineClips.end=Le.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=lt,this.distance=je*De,this.lineClips.start=Le.min,this.lineClips.end=Le.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const P=Hee[n.type]==="Polygon";let D=r.length;for(;D>=2&&r[D-1].equals(r[D-2]);)D--;let O=0;for(;O<D-1&&r[O].equals(r[O+1]);)O++;if(D<(P?3:2))return;h==="bevel"&&(g=1.05);const V=this.segments.prepareSegment(10*D,this.layoutVertexArray,this.indexArray);let j,X,oe,ne,ae,Ie,be,Te;w&&w.prevDir&&(Ie=w.prevDir.perp()),w&&w.nextDir&&(be=w.nextDir.perp()),this.e1=this.e2=-1,P&&(j=r[D-2],ae=r[O].sub(j)._unit()._perp());for(let Le=O;Le<D;Le++){if(oe=Le===D-1?P?r[O+1]:void 0:r[Le+1],oe&&r[Le].equals(oe))continue;ae&&(ne=ae),j&&(X=j),j=r[Le],Te=this.evaluateLineProgressFeatures(X?X.dist(j):0),ae=oe?oe.sub(j)._unit()._perp():ne,ne=ne||ae;const De=X&&oe;let lt=De?h:P||E?"butt":m;const je=ne.x*ae.x+ne.y*ae.y;if(E){const $e=function(at){if(at.patternJoinNone){const Dt=at.segmentPoints.length/2,At=at.lineSoFar-at.segmentStart;for(let sr=0;sr<Dt;++sr){const Qt=at.segmentPoints[2*sr+1],bt=Math.round(at.segmentPoints[2*sr])+.5+.25*Qt;at.patternVertexArray.emplaceBack(bt,At,at.segmentStart),at.patternVertexArray.emplaceBack(bt,At,at.segmentStart)}at.segmentPoints.length=0}at.e1=at.e2=-1};if(De&&je<Zee){this.updateDistance(X,j),this.addCurrentVertex(j,ne,1,1,V,Te),$e(this),this.addCurrentVertex(j,ae,-1,-1,V,Te);continue}if(X){if(!oe){this.updateDistance(X,j),this.addCurrentVertex(j,ne,1,1,V,Te),$e(this);continue}lt="miter"}}let ht=ne.add(ae);ht.x===0&&ht.y===0||ht._unit();const Lt=ht.x*ae.x+ht.y*ae.y,gt=Lt!==0?1/Lt:1/0,St=2*Math.sqrt(2-2*Lt),kt=Lt<qee&&X&&oe,st=ne.x*ae.y-ne.y*ae.x>0,Ct=this.overscaling<=16?15*Vt/(512*this.overscaling):0;if(De&&lt==="round"){if(gt<x)lt="miter";else if(gt<=2){const $e=kA(j,-10,Vt+10);lt=this.elevationType==="offset"&&($e||this.hasCrossSlope)?"miter":"fakeround"}}if(lt==="miter"&&gt>g&&(lt="bevel"),lt==="bevel"&&(gt>2&&(lt="flipbevel"),gt<g&&(lt="miter")),X&&!(lt==="miter"&&kt)&&this.updateDistance(X,j),lt==="miter")if(kt){const $e=j.dist(X);if($e>
vendor: 4,572 bytes, line 66
662*Ct){const Dt=j.sub(j.sub(X)._mult(Ct/$e)._round());this.updateDistance(X,Dt),this.addCurrentVertex(Dt,ne,0,0,V,Te),X=Dt}this.updateDistance(X,j),ht._mult(gt),this.addCurrentVertex(j,ht,0,0,V,Te);const at=j.dist(oe);if(at>2*Ct){const Dt=j.add(oe.sub(j)._mult(Ct/at)._round());this.updateDistance(j,Dt),this.addCurrentVertex(Dt,ae,0,0,V,Te),j=Dt}}else ht._mult(gt),this.addCurrentVertex(j,ht,0,0,V,Te);else if(lt==="flipbevel"){if(gt>100)ht=ae.mult(-1);else{const $e=gt*ne.add(ae).mag()/ne.sub(ae).mag();ht._perp()._mult($e*(st?-1:1))}this.addCurrentVertex(j,ht,0,0,V,Te),this.addCurrentVertex(j,ht.mult(-1),0,0,V,Te)}else if(lt==="bevel"||lt==="fakeround"){Te!=null&&X&&this.addCurrentVertex(j,be||ne,-1,-1,V,Te);const $e=j.dist(X)<=2*Ct&&lt!=="bevel",at=ht.mult(st?1:-1);at._mult(gt);const Dt=ae.mult(st?-1:1),At=ne.mult(st?-1:1),sr=this.evaluateLineProgressFeatures(this.distance);if(Te==null&&(this.addHalfVertex(j,at.x,at.y,!1,!st,0,V,sr),$e||this.addHalfVertex(j,at.x+2*At.x,at.y+2*At.y,!1,st,0,V,sr)),lt==="fakeround"){const Qt=Math.round(180*St/Math.PI/20);this.addHalfVertex(j,At.x,At.y,!1,st,0,V,sr);for(let bt=0;bt<Qt;bt++){let Pt=bt/Qt;if(Pt!==.5){const Wt=Pt-.5;Pt+=Pt*Wt*(Pt-1)*((1.0904+je*(je*(3.55645-1.43519*je)-3.2452))*Wt*Wt+(.848013+je*(.215638*je-1.06021)))}const rr=Dt.sub(At)._mult(Pt)._add(At)._unit();this.addHalfVertex(j,rr.x,rr.y,!1,st,0,V,sr)}this.addHalfVertex(j,Dt.x,Dt.y,!1,st,0,V,sr)}$e||Te!=null||this.addHalfVertex(j,at.x+2*Dt.x,at.y+2*Dt.y,!1,st,0,V,sr),Te!=null&&oe&&this.addCurrentVertex(j,Ie||ae,1,1,V,Te)}else if(lt==="butt")this.addCurrentVertex(j,ht,0,0,V,Te);else if(lt==="square"){if(!X){const $e=I?0:-1;this.addCurrentVertex(j,ht,$e,$e,V,Te)}if(this.addCurrentVertex(j,ht,0,0,V,Te),X){const $e=A?0:1;this.addCurrentVertex(j,ht,$e,$e,V,Te)}}else if(lt==="round"){if(X){const $e=!De&&be?be:ne;this.addCurrentVertex(j,$e,0,0,V,Te),!De&&A||this.addCurrentVertex(j,$e,1,1,V,Te,!0)}if(oe){const $e=!De&&Ie?Ie:ae;!De&&I||this.addCurrentVertex(j,$e,-1,-1,V,Te,!0),this.addCurrentVertex(j,$e,0,0,V,Te)}}}}addVerticesTo(r,n,c,h,m,g,x,w,E,I){const A=(n.w-r.w)/this.tessellationStep|0;let P=0;const D=this.scaledDistance;if(A>1){this.lineSoFar=r.w;const V=(n.x-r.x)/A,j=(n.y-r.y)/A,X=(n.z-r.z)/A,oe=(n.w-r.w)/A;for(let ne=1;ne<A;++ne){r.x+=V,r.y+=j,r.z+=X,this.lineSoFar+=oe,P+=oe;const ae=this.evaluateLineProgressFeatures(this.prevDistance+P);this.scaledDistance=(this.prevDistance+P)/this.totalDistance,this.addHalfVertex(r,c,h,I,!1,x,E,ae),this.addHalfVertex(r,m,g,I,!0,-w,E,ae)}}this.lineSoFar=n.w,this.scaledDistance=D;const O=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(n,c,h,I,!1,x,E,O),this.addHalfVertex(n,m,g,I,!0,-w,E,O)}evaluateLineProgressFeatures(r){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+r)/this.totalFeatureLength):Ar(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let n=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(n=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:n}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:n}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:n}}addCurrentVertex(r,n,c,h,m,g,x=!1){const w=n.x+n.y*c,E=n.y-n.x*c,I=n.y*h-n.x,A=-n.y-n.x*h;if(g!=null){const P=this.elevationType==="offset",D=-10,O=Vt+10,V=g.zOffset,j=new Mj(r.x,r.y,V,this.lineSoFar),X=!!P&&kA(r,D,O),oe=this.lineSoFar,ne=this.distance;if(this.currentVertex)if(X){const ae=this.currentVertexIsOutside,Ie=this.currentVertex,be=new Mj(r.x,r.y,V,this.lineSoFar);if(Rj(Ie,be,D,O),!kA(be,D,O)){if(ae){this.e1=this.e2=-1,this.distance-=Ie.dist(j),this.lineSoFar=Ie.w;const Te=this.evaluateLineProgressFeatures(Ie.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(Ie,w,E,x,!1,c,m,Te),this.addHalfVertex(Ie,I,A,x,!0,-h,m,Te),this.prevDistance=this.distance}this.distance=this.prevDistance+Ie.dist(be),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(Ie,be,w,E,I,A,c,h,m,x),this.distance=ne,this.scaledDistance=this.distance/this.totalDistance}}else{const ae=this.currentVertex;if(this.currentVertexIsOutside){Rj(ae,j,D,O),this.e1=this.e2=-1,this.distance-=ae.dist(j),this.scaledDistance=this.distance/this.totalDistance,this.lineS
66oFar=ae.w;const Ie=this.evaluateLineProgressFeatures(ae.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(ae,w,E,x,!1,c,m,Ie),this.addHalfVertex(ae,I,A,x,!0,-h,m,Ie),this.prevDistance=this.distance,this.distance=ne,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(ae,j,w,E,I,A,c,h,m,x)}else X||(this.addHalfVertex(r,w,E,x,!1,c,m,g),this.addHalfVertex(r,I,A,x,!0,-h,m,g));this.currentVertex=j,this.currentVertexIsOutside=X,this.lineSoFar=oe}else this.addHalfVertex(r,w,E,x,!1,c,m,g),this.addHalfVertex(r,I,A,x,!0,-h,m,g)}addHalfVertex({x:r,y:n},c,h,m,g,x,w,E){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),g||this.segmentPoints.push(this.lineSoFar-this.segmentStart,x)),this.layoutVertexArray.emplaceBack((r<<1)+(m?1:0),(n<<1)+(g?1:0),Math.round(63*c)+128,Math.round(63*h)+128,1+(x===0?0:x<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const A=_r(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,A)}const I=w.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,I),w.primitiveLength++),g?this.e2=I:this.e1=I,E!=null&&this.zOffsetVertexArray.emplaceBack(E.zOffset,E.variableWidth,E.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(r,n){this.prevDistance=this.distance,this.distance+=r.dist(n),this.updateScaledDistance()}}function kA(a,r,n){return a.x<r||a.x>n||a.y<r||a.y>n}let l6,c6;function u6(a,r,n){return r*(Vt/(a.tileSize*Math.pow(2,n-a.tileID.overscaledZ)))}Jt(MA,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const h6=(a,r,n)=>(1-n)*a+n*r;function d6(a,r){return 1/u6(a,1,r.tileZoom)}function f6(a,r,n,c){return a.translatePosMatrix(c||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const p6=a=>{const r=[];m6(a)&&r.push("RENDER_LINE_DASH"),a.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");const n=a.paint.get("line-trim-offset");n[0]===0&&n[1]===0||r.push("RENDER_LINE_TRIM_OFFSET"),a.paint.get("line-border-width").constantOr(1)!==0&&r.push("RENDER_LINE_BORDER");const c=a.layout.get("line-join").constantOr("miter")==="none",h=!!a.paint.get("line-pattern").constantOr(1);return c&&h&&r.push("LINE_JOIN_NONE"),r};function m6(a){const r=a.paint.get("line-dasharray").value;return r.value||r.kind!=="constant"}let RA;const g6=()=>RA||(RA={layout:l6||(l6=new Ln({"line-cap":new qt(Ue.layout_line["line-cap"]),"line-join":new qt(Ue.layout_line["line-join"]),"line-miter-limit":new zt(Ue.layout_line["line-miter-limit"]),"line-round-limit":new zt(Ue.layout_line["line-round-limit"]),"line-sort-key":new qt(Ue.layout_line["line-sort-key"]),"line-z-offset":new qt(Ue.layout_line["line-z-offset"]),"line-elevation-reference":new zt(Ue.layout_line["line-elevation-reference"]),"line-cross-slope":new zt(Ue.layout_line["line-cross-slope"]),visibility:new zt(Ue.layout_line.visibility),"line-width-unit":new zt(Ue.layout_line["line-width-unit"])})),paint:c6||(c6=new Ln({"line-opacity":new qt(Ue.paint_line["line-opacity"]),"line-color":new qt(Ue.paint_line["line-color"]),"line-translate":new zt(Ue.paint_line["line-translate"]),"line-translate-anchor":new zt(Ue.paint_line["line-translate-anchor"]),"line-width":new qt(Ue.paint_line["line-width"]),"line-gap-width":new qt(Ue.paint_line["line-gap-width"]),"line-offset":new qt(Ue.paint_line["line-offset"]),"line-blur":new qt(Ue.paint_line["line-blur"]),"line-dasharray":new qt(Ue.paint_line["line-dasharray"]),"line-pattern":new qt(Ue.paint_line["line-pattern"]),"line-pattern-cross-fade":new zt(Ue.paint_line["line-pattern-cross-fade"]),"line-gradient":new od(Ue.paint_line["line-gradient"]),"line-trim-offset":new zt(Ue.paint_line["line-trim-offset"]),"line-trim-fade-range":new zt(Ue.paint_line["line-trim-fade-range"]),"line-trim-color":new zt(Ue.paint_line["line-trim-color"]),"line-emissive-strength":new zt(Ue.paint_line["line-emissive-strength"]),"line-border-width":new qt(Ue.paint_line["line-border-width"]),"line-border-color":new qt(Ue.paint_line["line-border-color"]),"line-occlusion-opacity":new zt(Ue.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}
vendor: 4,515 bytes, line 66
66),"line-gradient-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},RA);class Wee extends qt{possiblyEvaluate(r,n){return n=new Ni(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,transition:n.transition,worldview:n.worldview}),super.possiblyEvaluate(r,n)}evaluate(r,n,c,h){return n=Re({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(r,n,c,h)}}let rv;function _6(a,r){return r>0?r+2*a:a}const Xee=si([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Yee=si([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Kee=si([{name:"a_projected_pos",components:4,type:"Float32"}],4);si([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Jee=si([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Qee=si([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),ete=si([{name:"a_texb",components:2,type:"Uint16"}]),tte=si([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),rte=si([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);si([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const y6=si([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ite=si([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);si([{name:"triangle",components:3,type:"Uint16"}]),si([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),si([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
vendor: 6,037 bytes, line 66
66]),si([{type:"Float32",name:"offsetX"}]),si([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Po=24;function nte(a,r,n){return a.sections.forEach(c=>{c.text=function(h,m,g){const x=m.layout.get("text-transform").evaluate(g,{});return x==="uppercase"?h=h.toLocaleUpperCase():x==="lowercase"&&(h=h.toLocaleLowerCase()),Ll.applyArabicShaping&&(h=Ll.applyArabicShaping(h)),h}(c.text,r,n)}),a}const iv={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function ote(a){return a==="︶"||a==="﹈"||a==="︸"||a==="﹄"||a==="﹂"||a==="︾"||a==="︼"||a==="︺"||a==="︘"||a==="﹀"||a==="︐"||a==="︓"||a==="︔"||a==="`"||a===" ̄"||a==="︑"||a==="︒"}function ste(a){return a==="︵"||a==="﹇"||a==="︷"||a==="﹃"||a==="﹁"||a==="︽"||a==="︻"||a==="︹"||a==="︗"||a==="︿"}const LA=4294967296,v6=1/LA,x6=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Gw=class{constructor(a=new Uint8Array(16)){this.buf=ArrayBuffer.isView(a)?a:new Uint8Array(a),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(a,r,n=this.length){for(;this.pos<n;){const c=this.readVarint(),h=c>>3,m=this.pos;this.type=7&c,a(h,r,this),this.pos===m&&this.skip(c)}return r}readMessage(a,r){return this.readFields(a,r,this.readVarint()+this.pos)}readFixed32(){const a=this.dataView.getUint32(this.pos,!0);return this.pos+=4,a}readSFixed32(){const a=this.dataView.getInt32(this.pos,!0);return this.pos+=4,a}readFixed64(){const a=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*LA;return this.pos+=8,a}readSFixed64(){const a=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*LA;return this.pos+=8,a}readFloat(){const a=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,a}readDouble(){const a=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,a}readVarint(a){const r=this.buf;let n,c;return c=r[this.pos++],n=127&c,c<128?n:(c=r[this.pos++],n|=(127&c)<<7,c<128?n:(c=r[this.pos++],n|=(127&c)<<14,c<128?n:(c=r[this.pos++],n|=(127&c)<<21,c<128?n:(c=r[this.pos],n|=(15&c)<<28,function(h,m,g){const x=g.buf;let w,E;if(E=x[g.pos++],w=(112&E)>>4,E<128||(E=x[g.pos++],w|=(127&E)<<3,E<128)||(E=x[g.pos++],w|=(127&E)<<10,E<128)||(E=x[g.pos++],w|=(127&E)<<17,E<128)||(E=x[g.pos++],w|=(127&E)<<24,E<128)||(E=x[g.pos++],w|=(1&E)<<31,E<128))return _g(h,w,m);throw new Error("Expected varint not more than 10 bytes")}(n,a,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const a=this.readVarint();return a%2==1?(a+1)/-2:a/2}readBoolean(){return!!this.readVarint()}readString(){const a=this.readVarint()+this.pos,r=this.pos;return this.pos=a,a-r>=12&&x6?x6.decode(this.buf.subarray(r,a)):function(n,c,h){let m="",g=c;for(;g<h;){const x=n[g];let w,E,I,A=null,P=x>239?4:x>223?3:x>191?2:1;if(g+P>h)break;P===1?x<128&&(A=x):P===2?(w=n[g+1],(192&w)==128&&(A=(31&x)<<6|63&w,A<=127&&(A=null))):P===3?(w=n[g+1],E=n[g+2],(192&w)==128&&(192&E)==128&&(A=(15&x)<<12|(63&w)<<6|63&E,(A<=2047||A>=55296&&A<=57343)&&(A=null))):P===4&&(w=n[g+1],E=n[g+2],I=n[g+3],(192&w)==128&&(192&E)==128&&(192&I)==128&&(A=(15&x)<<18|(63&w)<<12|(63&E)<<6|63&I,(A<=65535||A>=1114112)&&(A=null))),A===null?(A=65533,P=1):A>65535&&(A-=65536,m+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),m+=String.fromCharCode(A),g+=P}return m}(this.buf,r,a)}readBytes(){const a=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,a);return this.pos=a,r}readPackedVarint(a=[],r){const n=this.readPackedEnd();for(;this.pos<n;)a.push(this.readVarint(r));return a}readPackedSVarint(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readSVarint());return a}readPackedBoolean(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readBoolean());return a}readPackedFloat(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readFloat());return a}readPackedDouble(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readDouble());return a}readPackedFixed32(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readFixed32());return a}readPackedSFixed32(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readSFixed32());return a}readPackedFixed64(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readFixed64());return a}readPackedSFixed64(a=[]){const r=this.readPackedEnd();for(;this.pos<r;)a.push(this.readSFixed64());return a}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(a){const r=7&a;if(r===0)for(;this.buf[this.pos++]>127;);else if(r===2)this.pos=this.readVarint()+this.pos;else if(r===5)this.pos+=4;else{if(r!==1)throw new Error(`Unimplemented type: ${r}`);this.pos+=8}}writeTag(a,r){this.writeVarint(a<<3|r)}realloc(a){let r=this.length||16;for(;r<this.pos+a;)r*=2;if(r!==this.length){const n=new Uint8Array(r);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(a){this.realloc(4),this.dataView.setInt32(this.pos,a,!0),this.pos+=4}writeSFixed32(a){this.realloc(4),this.dataView.setInt32(this.pos,a,!0),this.pos+=4}
vendor: 2,410 bytes, line 66
66writeFixed64(a){this.realloc(8),this.dataView.setInt32(this.pos,-1&a,!0),this.dataView.setInt32(this.pos+4,Math.floor(a*v6),!0),this.pos+=8}writeSFixed64(a){this.realloc(8),this.dataView.setInt32(this.pos,-1&a,!0),this.dataView.setInt32(this.pos+4,Math.floor(a*v6),!0),this.pos+=8}writeVarint(a){(a=+a||0)>268435455||a<0?function(r,n){let c,h;if(r>=0?(c=r%4294967296|0,h=r/4294967296|0):(c=~(-r%4294967296),h=~(-r/4294967296),4294967295^c?c=c+1|0:(c=0,h=h+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(m,g,x){x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,x.buf[x.pos]=127&(m>>>=7)}(c,0,n),function(m,g){const x=(7&m)<<4;g.buf[g.pos++]|=x|((m>>>=3)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m|((m>>>=7)?128:0),m&&(g.buf[g.pos++]=127&m)))))}(h,n)}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))}writeSVarint(a){this.writeVarint(a<0?2*-a-1:2*a)}writeBoolean(a){this.writeVarint(+a)}writeString(a){a=String(a),this.realloc(4*a.length),this.pos++;const r=this.pos;this.pos=function(c,h,m){for(let g,x,w=0;w<h.length;w++){if(g=h.charCodeAt(w),g>55295&&g<57344){if(!x){g>56319||w+1===h.length?(c[m++]=239,c[m++]=191,c[m++]=189):x=g;continue}if(g<56320){c[m++]=239,c[m++]=191,c[m++]=189,x=g;continue}g=x-55296<<10|g-56320|65536,x=null}else x&&(c[m++]=239,c[m++]=191,c[m++]=189,x=null);g<128?c[m++]=g:(g<2048?c[m++]=g>>6|192:(g<65536?c[m++]=g>>12|224:(c[m++]=g>>18|240,c[m++]=g>>12&63|128),c[m++]=g>>6&63|128),c[m++]=63&g|128)}return m}(this.buf,a,this.pos);const n=this.pos-r;n>=128&&b6(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n}writeFloat(a){this.realloc(4),this.dataView.setFloat32(this.pos,a,!0),this.pos+=4}writeDouble(a){this.realloc(8),this.dataView.setFloat64(this.pos,a,!0),this.pos+=8}writeBytes(a){const r=a.length;this.writeVarint(r),this.realloc(r);for(let n=0;n<r;n++)this.buf[this.pos++]=a[n]}writeRawMessage(a,r){this.pos++;const n=this.pos;a(r,this);const c=this.pos-n;c>=128&&b6(n,c,this),this.pos=n-1,this.writeVarint(c),this.pos+=c}
66writeMessage(a,r,n){this.writeTag(a,2),this.writeRawMessage(r,n)}writePackedVarint(a,r){r.length&&this.writeMessage(a,ate,r)}writePackedSVarint(a,r){r.length&&this.writeMessage(a,lte,r)}writePackedBoolean(a,r){r.length&&this.writeMessage(a,hte,r)}writePackedFloat(a,r){r.length&&this.writeMessage(a,cte,r)}writePackedDouble(a,r){r.length&&this.writeMessage(a,ute,r)}writePackedFixed32(a,r){r.length&&this.writeMessage(a,dte,r)}writePackedSFixed32(a,r){r.length&&this.writeMessage(a,fte,r)}writePackedFixed64(a,r){r.length&&this.writeMessage(a,pte,r)}writePackedSFixed64(a,r){r.length&&this.writeMessage(a,mte,r)}writeBytesField(a,r){this.writeTag(a,2),this.writeBytes(r)}writeFixed32Field(a,r){this.writeTag(a,5),this.writeFixed32(r)}writeSFixed32Field(a,r){this.writeTag(a,5),this.writeSFixed32(r)}writeFixed64Field(a,r){this.writeTag(a,1),this.writeFixed64(r)}writeSFixed64Field(a,r){this.writeTag(a,1),this.writeSFixed64(r)}writeVarintField(a,r){this.writeTag(a,0),this.writeVarint(r)}writeSVarintField(a,r){this.writeTag(a,0),this.writeSVarint(r)}writeStringField(a,r){this.writeTag(a,2),this.writeString(r)}writeFloatField(a,r){this.writeTag(a,5),this.writeFloat(r)}writeDoubleField(a,r){this.writeTag(a,1),this.writeDouble(r)}writeBooleanField(a,r){this.writeVarintField(a,+r)}};function _g(a,r,n){return n?4294967296*r+(a>>>0):4294967296*(r>>>0)+(a>>>0)}function b6(a,r,n){const c=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(c);for(let h=n.pos-1;h>=a;h--)n.buf[h+c]=n.buf[h]}function ate(a,r){for(let n=0;n<a.length;n++)r.writeVarint(a[n])}function lte(a,r){for(let n=0;n<a.length;n++)r.writeSVarint(a[n])}function cte(a,r){for(let n=0;n<a.length;n++)r.writeFloat(a[n])}function ute(a,r){for(let n=0;n<a.length;n++)r.writeDouble(a[n])}function hte(a,r){for(let n=0;n<a.length;n++)r.writeBoolean(a[n])}function dte(a,r){for(let n=0;n<a.length;n++)r.writeFixed32(a[n])}function fte(a,r){for(let n=0;n<a.length;n++)r.writeSFixed32(a[n])}function pte(a,r){for(let n=0;n<a.length;n++)r.writeFixed64(a[n])}function mte(a,r){for(let n=0;n<a.length;n++)r.writeSFixed64(a[n])}const zA=3;function gte(a,r,n){r.glyphs=[],a===1&&n.readMessage(_te,r)}function _te(a,r,n){if(a===3){const{id:c,bitmap:h,width:m,height:g,left:x,top:w,advance:E}=n.readMessage(yte,{});r.glyphs.push({id:c,bitmap:new wd({width:m+2*zA,height:g+2*zA},h),metrics:{width:m,height:g,left:x,top:w,advance:E}})}else a===4?r.ascender=n.readSVarint():a===5&&(r.descender=n.readSVarint())}function yte(a,r,n){a===1?r.id=n.readVarint():a===2?r.bitmap=n.readBytes():a===3?r.width=n.readVarint():a===4?r.height=n.readVarint():a===5?r.left=n.readSVarint():a===6?r.top=n.readSVarint():a===7&&(r.advance=n.readVarint())}const w6=zA,wa={horizontal:1,vertical:2,horizontalOnly:3};class nv{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(r,n){const c=new nv;return c.scale=r||1,c.fontStack=n,c}static forImage(r){const n=new nv;return n.image=r,n}}class yg{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}
66static fromFeature(r,n,c){const h=new yg;for(let m=0;m<r.sections.length;m++){const g=r.sections[m];g.image?h.addImageSection(g,c):h.addTextSection(g,n)}return h}length(){return this.text.length}getSection(r){return this.sections[this.sectionIndex[r]]}getSections(){return this.sections}getSectionIndex(r){return this.sectionIndex[r]}getCodePoint(r){return this.text.codePointAt(r)}verticalizePunctuation(r){this.text=function(n,c){let h="";for(let m=0;m<n.length;m++){const g=n.charCodeAt(m+1)||null,x=n.charCodeAt(m-1)||null;h+=!c&&(g&&Zm(g)&&!iv[n[m+1]]||x&&Zm(x)&&!iv[n[m-1]])||!iv[n[m]]?n[m]:iv[n[m]]}return h}(this.text,r)}trim(){let r=0;for(let c=0;c<this.text.length&&$w[this.text.charCodeAt(c)];c++)r++;let n=this.text.length;for(let c=this.text.length-1;c>=0&&c>=r&&$w[this.text.charCodeAt(c)];c--)n--;this.text=this.text.substring(r,n),this.sectionIndex=this.sectionIndex.slice(r,n)}substring(r,n){const c=new yg;return c.text=this.text.substring(r,n),c.sectionIndex=this.sectionIndex.slice(r,n),c.sections=this.sections,c}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((r,n)=>Math.max(r,this.sections[n].scale),0)}addTextSection(r,n){this.text+=r.text,this.sections.push(nv.forText(r.scale,r.fontStack||n));const c=this.sections.length-1;for(let h=0;h<r.text.length;++h)this.sectionIndex.push(c)}addImageSection(r,n){const c=r.image?r.image.getPrimary():null;if(!c)return void Ar("Can't add FormattedSection with an empty image.");c.scaleSelf(n);const h=this.getNextImageSectionCharCode();h?(this.text+=String.fromCodePoint(h),this.sections.push(nv.forImage(c)),this.sectionIndex.push(this.sections.length-1)):Ar("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function DA(a,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V=1){const j=yg.fromFeature(a,h,V);A===wa.vertical&&j.verticalizePunctuation(P);let X=[];const oe=function(Te,Le,De,lt,je,ht){if(!Te)return[];const Lt=[],gt=function(Ct,$e,at,Dt,At,sr){let Qt=0;for(let bt=0;bt<Ct.length();bt++){const Pt=Ct.getSection(bt);Qt+=T6(Ct.getCodePoint(bt),Pt,Dt,At,$e,sr)}return Qt/Math.max(1,Math.ceil(Qt/at))}(Te,Le,De,lt,je,ht),St=Te.text.indexOf("​")>=0;let kt=0;for(let Ct=0;Ct<Te.length();Ct++){const $e=Te.getSection(Ct),at=Te.getCodePoint(Ct);if($w[at]||(kt+=T6(at,$e,lt,je,Le,ht)),Ct<Te.length()-1){const Dt=!((st=at)<11904||!(Tr["Bopomofo Extended"](st)||Tr.Bopomofo(st)||Tr["CJK Compatibility Forms"](st)||Tr["CJK Compatibility Ideographs"](st)||Tr["CJK Compatibility"](st)||Tr["CJK Radicals Supplement"](st)||Tr["CJK Strokes"](st)||Tr["CJK Symbols and Punctuation"](st)||Tr["CJK Unified Ideographs Extension A"](st)||Tr["CJK Unified Ideographs"](st)||Tr["Enclosed CJK Letters and Months"](st)||Tr["Halfwidth and Fullwidth Forms"](st)||Tr.Hiragana(st)||Tr["Ideographic Description Characters"](st)||Tr["Kangxi Radicals"](st)||Tr["Katakana Phonetic Extensions"](st)||Tr.Katakana(st)||Tr["Vertical Forms"](st)||Tr["Yi Radicals"](st)||Tr["Yi Syllables"](st)));(vte[at]||Dt||$e.image)&&Lt.push(S6(Ct+1,kt,gt,Lt,xte(at,Te.getCodePoint(Ct+1),Dt&&St),!1))}}var st;return C6(S6(Te.length(),kt,gt,Lt,0,!0))}(j,E,m,r,c,D),{processBidirectionalText:ne,processStyledBidirectionalText:ae}=Ll;if(ne&&j.sections.length===1){const Te=ne(j.toString(),oe);for(const Le of Te){const De=new yg;De.text=Le,De.sections=j.sections;for(let lt=0;lt<Le.length;lt++)De.sectionIndex.push(0);X.push(De)}}else if(ae){const Te=ae(j.text,j.sectionIndex,oe);for(const Le of Te){const De=new yg;De.text=Le[0],De.sectionIndex=Le[1],De.sections=j.sections,X.push(De)}}else X=function(Te,Le){const De=[],lt=Te.text;let je=0;for(const ht of Le)De.push(Te.substring(je,ht)),je=ht;return je<lt.length&&De.push(Te.substring(je,lt.length)),De}(j,oe);const Ie=[],be={positionedLines:Ie,text:j.toString(),top:I[1],bottom:I[1],left:I[0],right:I[0],writingMode:A,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(Te,Le,De,lt,je,ht,Lt,gt,St,kt,st,Ct){let $e=0,at=0,Dt=0;const At=gt==="right"?1:gt==="left"?0:.5;let sr=!1;for(const Ut of je){const Xt=Ut.getSections();for(const xr of Xt){if(xr.image)continue;const Mr=Le[xr.fontStack];if(Mr&&(sr=Mr.ascender!==void 0&&Mr.descender!==void 0,!sr))break}if(!sr)break}let Qt=0;for(const Ut of je){Ut.trim();const Xt=Ut.getMaxScale(),xr=(Xt-1)*Po,Mr={positionedGlyphs:[],lineOffset:0};Te.positionedLines[Qt]=Mr;const Or=Mr.positionedGlyphs;let Rr=0;
66if(!Ut.length()){at+=ht,++Qt;continue}let ri=0,Hr=0;for(let ue=0;ue<Ut.length();ue++){const he=Ut.getSection(ue),it=Ut.getSectionIndex(ue),Ot=Ut.getCodePoint(ue);let $t=he.scale,Gt=null,tr=null,Ir=null,Jr=Po,Qr=0,jr=St;jr===wa.vertical&&((bt=Ot)===12312||bt===12313||bt===12316||bt===12540||bt===12448)&&(jr=wa.horizontal);const Bi=!(jr===wa.horizontal||!st&&!qm(Ot)||st&&($w[Ot]||ew(Ot)));if(he.image){const Cn=lt.get(he.image.toString());if(!Cn)continue;Ir=he.image,Te.iconsInText=Te.iconsInText||!0,tr=Cn.paddedRect;const Fr=Cn.displaySize;$t=$t*Po/Ct,Gt={width:Fr[0],height:Fr[1],left:0,top:-w6,advance:Bi?Fr[1]:Fr[0],localGlyph:!1},Qr=sr?-Gt.height*$t:Xt*Po-17-Fr[1]*$t,Jr=Gt.advance;const fn=(Bi?Fr[0]:Fr[1])*$t-Po*Xt;fn>0&&fn>Rr&&(Rr=fn)}else{const Cn=De[he.fontStack];if(!Cn)continue;Cn[Ot]&&(tr=Cn[Ot]);const Fr=Le[he.fontStack];if(!Fr)continue;const fn=Fr.glyphs[Ot];if(!fn)continue;if(Gt=fn.metrics,Jr=Ot!==8203?Po:0,sr){const Ki=Fr.ascender!==void 0?Math.abs(Fr.ascender):0,Ri=Fr.descender!==void 0?Math.abs(Fr.descender):0,wn=(Ki+Ri)*$t;ri<wn&&(ri=wn,Hr=(Ki-Ri)/2*$t),Qr=-Ki*$t}else Qr=(Xt-$t)*Po-17}Bi?(Te.verticalizable=!0,Or.push({glyph:Ot,image:Ir,x:$e,y:at+Qr,vertical:Bi,scale:$t,localGlyph:Gt.localGlyph,fontStack:he.fontStack,sectionIndex:it,metrics:Gt,rect:tr}),$e+=Jr*$t+kt):(Or.push({glyph:Ot,image:Ir,x:$e,y:at+Qr,vertical:Bi,scale:$t,localGlyph:Gt.localGlyph,fontStack:he.fontStack,sectionIndex:it,metrics:Gt,rect:tr}),$e+=Gt.advance*$t+kt)}Or.length!==0&&(Dt=Math.max($e-kt,Dt),sr?I6(Or,At,Rr,Hr,ht*Xt/2):I6(Or,At,Rr,0,ht/2)),$e=0;const ln=ht*Xt+Rr;Mr.lineOffset=Math.max(Rr,xr),at+=ln,++Qt}var bt;const Pt=at,{horizontalAlign:rr,verticalAlign:Wt}=OA(Lt);(function(Ut,Xt,xr,Mr,Or,Rr){const ri=(Xt-xr)*Or,Hr=-Rr*Mr;for(const ln of Ut)for(const ue of ln.positionedGlyphs)ue.x+=ri,ue.y+=Hr})(Te.positionedLines,At,rr,Wt,Dt,Pt),Te.top+=-Wt*Pt,Te.bottom=Te.top+Pt,Te.left+=-rr*Dt,Te.right=Te.left+Dt,Te.hasBaseline=sr}(be,r,n,c,X,g,x,w,A,E,P,O),!function(Te){for(const Le of Te)if(Le.positionedGlyphs.length!==0)return!1;return!0}(Ie))return be}const $w={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},vte={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function T6(a,r,n,c,h,m){if(r.image){const g=c.get(r.image.toString());return g?g.displaySize[0]*r.scale*Po/m+h:0}{const g=n[r.fontStack],x=g&&g.glyphs[a];return x?x.metrics.advance*r.scale+h:0}}function E6(a,r,n,c){const h=Math.pow(a-r,2);return c?a<r?h/2:2*h:h+Math.abs(n)*n}
vendor: 6,267 bytes, line 66
66function xte(a,r,n){let c=0;return a===10&&(c-=1e4),n&&(c+=150),a!==40&&a!==65288||(c+=50),r!==41&&r!==65289||(c+=50),c}function S6(a,r,n,c,h,m){let g=null,x=E6(r,n,h,m);for(const w of c){const E=E6(r-w.x,n,h,m)+w.badness;E<=x&&(g=w,x=E)}return{index:a,x:r,priorBreak:g,badness:x}}function C6(a){return a?C6(a.priorBreak).concat(a.index):[]}function OA(a){let r=.5,n=.5;switch(a){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(a){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:r,verticalAlign:n}}function I6(a,r,n,c,h){if(!(r||n||c||h))return;const m=a.length-1,g=a[m],x=(g.x+g.metrics.advance*g.scale)*r;for(let w=0;w<=m;w++)a[w].x-=x,a[w].y+=n+c+h}function A6(a){return a.imagePrimary!==void 0&&a.top!==void 0&&a.bottom!==void 0&&a.left!==void 0&&a.right!==void 0}function bte(a,r,n,c){const{horizontalAlign:h,verticalAlign:m}=OA(c),g=n[0]-a.displaySize[0]*h,x=n[1]-a.displaySize[1]*m;return{imagePrimary:a,imageSecondary:r,top:x,bottom:x+a.displaySize[1],left:g,right:g+a.displaySize[0]}}function P6(a,r,n,c,h,m){const g=a.imagePrimary;let x;if(g.content){const j=g.content,X=g.pixelRatio||1;x=[j[0]/X,j[1]/X,g.displaySize[0]-j[2]/X,g.displaySize[1]-j[3]/X]}const w=r.left*m,E=r.right*m;let I,A,P,D;n==="width"||n==="both"?(D=h[0]+w-c[3],A=h[0]+E+c[1]):(D=h[0]+(w+E-g.displaySize[0])/2,A=D+g.displaySize[0]);const O=r.top*m,V=r.bottom*m;return n==="height"||n==="both"?(I=h[1]+O-c[0],P=h[1]+V+c[2]):(I=h[1]+(O+V-g.displaySize[1])/2,P=I+g.displaySize[1]),{imagePrimary:g,imageSecondary:void 0,top:I,right:A,bottom:P,left:D,collisionPadding:x}}function M6(a){return!a.imagePrimary.stretchX}function k6(a){return!a.imagePrimary.stretchY}function R6(a){return{width:a.right-a.left,height:a.bottom-a.top}}const au=128;function L6(a,r,n){const{expression:c}=r;if(c.kind==="constant")return{kind:"constant",layoutSize:c.evaluate(new Ni(a+1,{worldview:n}))};if(c.kind==="source")return{kind:"source"};{const{zoomStops:h,interpolationType:m}=c;let g=0;for(;g<h.length&&h[g]<=a;)g++;g=Math.max(0,g-1);let x=g;for(;x<h.length&&h[x]<a+1;)x++;x=Math.min(h.length-1,x);const w=h[g],E=h[x];return c.kind==="composite"?{kind:"composite",minZoom:w,maxZoom:E,interpolationType:m}:{kind:"camera",minZoom:w,maxZoom:E,minSize:c.evaluate(new Ni(w,{worldview:n})),maxSize:c.evaluate(new Ni(E,{worldview:n})),interpolationType:m}}}function FA(a,{uSize:r,uSizeT:n},{lowerSize:c,upperSize:h}){return a.kind==="source"?c/au:a.kind==="composite"?_r(c/au,h/au,n):r}function ov(a,r,n=1){let c=0,h=0;if(a.kind==="constant")h=a.layoutSize*n;else if(a.kind!=="source"){const{interpolationType:m,minZoom:g,maxZoom:x}=a,w=m?J(Is.interpolationFactor(m,r,g,x),0,1):0;a.kind==="camera"?h=_r(a.minSize,a.maxSize,w)*n:c=w*n}return{uSizeT:c,uSize:h}}class Ju extends Tt{constructor(r,n,c,h,m){super(r,n),this.angle=h,this.z=c,m!==void 0&&(this.segment=m)}clone(){return new Ju(this.x,this.y,this.z,this.angle,this.segment)}}function z6(a,r,n,c,h){if(r.segment===void 0)return!0;let m=r,g=r.segment+1,x=0;for(;x>-n/2;){if(g--,g<0)return!1;x-=a[g].dist(m),m=a[g]}x+=a[g].dist(a[g+1]),g++;const w=[];let E=0;for(;x<n/2;){const I=a[g],A=a[g+1];if(!A)return!1;let P=a[g-1].angleTo(I)-I.angleTo(A);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),w.push({distance:x,angleDelta:P}),E+=P;x-w[0].distance>c;)E-=w.shift().angleDelta;if(E>h)return!1;g++,x+=I.dist(A)}return!0}function D6(a){let r=0;for(let n=0;n<a.length-1;n++)r+=a[n].dist(a[n+1]);return r}function O6(a,r,n){return a?.6*r*n:0}function F6(a,r){return Math.max(a?a.right-a.left:0,r?r.right-r.left:0)}function wte(a,r,n,c,h,m){const g=O6(n,h,m),x=F6(n,c)*m;let w=0;const E=D6(a)/2;for(let I=0;I<a.length-1;I++){const A=a[I],P=a[I+1],D=A.dist(P);if(w+D>E){const O=(E-w)/D,V=_r(A.x,P.x,O),j=_r(A.y,P.y,O),X=new Ju(V,j,0,P.angleTo(A),I);return!g||z6(a,X,x,g,r)?X:void 0}w+=D}}function Tte(a,r,n,c,h,m,g,x,w){const E=O6(c,m,g),I=F6(c,h),A=I*g,P=a[0].x===0||a[0].x===w||a[0].y===0||a[0].y===w;return r-A<r/4&&(r=A+r/4),N6(a,P?r/2*x%r:(I/2+2*m)*g*x%r,r,E,n,A,P,!1,w)}function N6(a,r,n,c,h,m,g,x,w){const E=m/2,I=D6(a);let A=0,P=r-n,D=[];for(let O=0;O<a.length-1;O++){const V=a[O],j=a[O+1],X=V.dist(j),oe=j.angleTo(V);for(;P+n<A+X;){P+=n;const ne=(P-A)/X,ae=_r(V.x,j.x,ne),Ie=_r(V.y,j.y,ne);if(ae>=0&&ae<w&&Ie>=0&&Ie<w&&P-E>=0&&P+E<=I){const be=new Ju(ae,Ie,0,oe,O);c&&!z6(a,be,m,c,h)||D.push(be)}}A+=X}return x||D.length||g||(D=N6(a,A/2,n,c,h,m,g,!0,w)),D}function B6(a){let r=0,n=0;for(const g of a)r+=g.w*g.h,n=Math.max(n,g.w);a.sort((g,x)=>x.h-g.h);const c=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}];let h=0,m=0;for(const g of a)for(let x=c.length-1;x>=0;x--){const w=c[x];if(!(g.w>w.w||g.h>w.h)){if(g.x=w.x,g.y=w.y,m=Math.max(m,g.y+g.h),h=Math.max(h,g.x+g.w),g.w===w.w&&g.h===w.h){const E=c.pop();E&&x<c.length&&(c[x]=E)}else g.h===w.h?(w.x+=g.w,w.w-=g.w):g.w===w.w?(w.y+=g.h,w.h-=g.h):(c.push({x:w.x+g.w,y:w.y,w:w.w-g.w,h:g.h}),w.y+=g.h,w.h-=g.h);break}}return{w:h,h:m,fill:r/(h*m)||0}}Jt(Ju,"Anchor");const op=1;class sv{static getImagePositionScale(r,n,c){if(n&&r&&r.options&&r.options.transform){const h=r.options.transform;return{x:h.a,y:h.d}}return{x:c,y:c}}constructor(r,n,c,h){this.paddedRect=r;const{pixelRatio:m,version:g,stretchX:x,stretchY:w,content:E,sdf:I,usvg:A}=n;this.pixelRatio=m,this.stretchX=x,this.stretchY=w,this.content=E,this.version=g,this.padding=c,this.sdf=I,this.usvg=A,this.scale=sv.getImagePositionScale(h,A,m)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function NA(a,r,n){const c=uc.parse(a),h=function(m,g,x=[1,1]){return{x:0,y:0,w:(m.data?m.data.width:m.width*x[0])+2*g,h:(m.data?m.data.height:m.height*x[1])+2*g}}(r,n,[c.options.transform.a,c.options.transform.d]);return{bin:h,imagePosition:new sv(h,r,n,c),imageVariant:c}}class V6{constructor(r,n,c){const h=new Map,m=new Map;this.haveRenderCallbacks=[];const g=[];this.addImages(r,h,op,g),this.addImages(n,m,2,g);const{w:x,h:w}
66=B6(g),E=new $o({width:x||1,height:w||1});for(const[I,A]of r.entries()){const P=h.get(I).paddedRect;$o.copy(A.data,E,{x:0,y:0},{x:P.x+op,y:P.y+op},A.data,c,A.sdf)}for(const[I,A]of n.entries()){const P=m.get(I),D=P.paddedRect;let O=P.padding;const V=D.x+O,j=D.y+O,X=A.data.width,oe=A.data.height;O=O>1?O-1:O,$o.copy(A.data,E,{x:0,y:0},{x:V,y:j},A.data,c),$o.copy(A.data,E,{x:0,y:oe-O},{x:V,y:j-O},{width:X,height:O},c),$o.copy(A.data,E,{x:0,y:0},{x:V,y:j+oe},{width:X,height:O},c),$o.copy(A.data,E,{x:X-O,y:0},{x:V-O,y:j},{width:O,height:oe},c),$o.copy(A.data,E,{x:0,y:0},{x:V+X,y:j},{width:O,height:oe},c),$o.copy(A.data,E,{x:X-O,y:oe-O},{x:V-O,y:j-O},{width:O,height:O},c),$o.copy(A.data,E,{x:0,y:oe-O},{x:V+X,y:j-O},{width:O,height:O},c),$o.copy(A.data,E,{x:0,y:0},{x:V+X,y:j+oe},{width:O,height:O},c),$o.copy(A.data,E,{x:X-O,y:0},{x:V-O,y:j+oe},{width:O,height:O},c)}this.lut=c,this.image=E,this.iconPositions=h,this.patternPositions=m}addImages(r,n,c,h){for(const[m,g]of r.entries()){const{bin:x,imagePosition:w,imageVariant:E}=NA(m,g,c);n.set(m,w),h.push(x),g.hasRenderCallback&&this.haveRenderCallbacks.push(E.id)}}patchUpdatedImages(r,n,c){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(h=>r.hasImage(h,c)),r.dispatchRenderCallbacks(this.haveRenderCallbacks,c);for(const h of r.getUpdatedImages(c)){for(const m of this.iconPositions.keys()){const g=uc.parse(m);if($s.isEqual(g.id,h)){const x=r.getImage(h,c);this.patchUpdatedImage(this.iconPositions.get(m),x,n)}}for(const m of this.patternPositions.keys()){const g=uc.parse(m);if($s.isEqual(g.id,h)){const x=r.getImage(h,c);this.patchUpdatedImage(this.patternPositions.get(m),x,n)}}}}patchUpdatedImage(r,n,c){if(!r||!n||r.version===n.version)return;r.version=n.version;const[h,m]=r.tl,g=r.sdf;if(this.lut||g){const x={width:n.data.width,height:n.data.height},w=new $o(x);$o.copy(n.data,w,{x:0,y:0},{x:0,y:0},x,this.lut,g),c.update(w,{position:{x:h,y:m}})}else c.update(n.data,{position:{x:h,y:m}})}}Jt(sv,"ImagePosition"),Jt(V6,"ImageAtlas");const av=1e20;function U6(a,r,n,c,h,m,g,x,w){for(let E=r;E<r+c;E++)j6(a,n*m+E,m,h,g,x,w);for(let E=n;E<n+h;E++)j6(a,E*m+r,1,c,g,x,w)}function j6(a,r,n,c,h,m,g){m[0]=0,g[0]=-av,g[1]=av,h[0]=a[r];for(let x=1,w=0,E=0;x<c;x++){h[x]=a[r+x*n];const I=x*x;do{const A=m[w];E=(h[x]-h[A]+I-A*A)/(x-A)/2}while(E<=g[w]&&--w>-1);w++,m[w]=x,g[w]=E,g[w+1]=av}for(let x=0,w=0;x<c;x++){for(;g[w+1]<x;)w++;const E=m[w],I=x-E;a[r+x*n]=h[E]+I*I}}const pc=2,BA={none:0,ideographs:1,all:2};class vg{constructor(r,n,c){this.requestManager=r,this.localGlyphMode=n,this.localFontFamily=c,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(r){this.url=r}getGlyphs(r,n){const c=[],h=this.url||Qn.GLYPHS_URL;for(const m in r)for(const g of r[m])c.push({stack:m,id:g});Ee(c,({stack:m,id:g},x)=>{let w=this.entries[m];w||(w=this.entries[m]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let E=w.glyphs[g];if(E!==void 0)return void x(null,{stack:m,id:g,glyph:E});if(E=this._tinySDF(w,m,g),E)return w.glyphs[g]=E,void x(null,{stack:m,id:g,glyph:E});const I=Math.floor(g/256);if(256*I>65535)return Ar("glyphs > 65535 not supported"),void x(null,{stack:m,id:g,glyph:E});if(w.ranges[I])return void x(null,{stack:m,id:g,glyph:E});let A=w.requests[I];A||(A=w.requests[I]=[],vg.loadGlyphRange(m,I,h,this.requestManager,(P,D)=>{if(D){w.ascender=D.ascender,w.descender=D.descender;for(const O in D.glyphs)this._doesCharSupportLocalGlyph(+O)||(w.glyphs[+O]=D.glyphs[+O]);w.ranges[I]=!0}for(const O of A)O(P,D);delete w.requests[I]})),A.push((P,D)=>{P?x(P):D&&x(null,{stack:m,id:g,glyph:D.glyphs[g]||null})})},(m,g)=>{if(m)n(m);else if(g){const x={};for(const{stack:w,id:E,glyph:I}of g)x[w]===void 0&&(x[w]={}),x[w].glyphs===void 0&&(x[w].glyphs={}),x[w].glyphs[E]=I&&{id:I.id,bitmap:I.bitmap.clone(),metrics:I.metrics},x[w].ascender=this.entries[w].ascender,x[w].descender=this.entries[w].descender;n(null,x)}})}_doesCharSupportLocalGlyph(r){return this.localGlyphMode!==BA.none&&(this.localGlyphMode===BA.all?!!this.localFontFamily:!!this.localFontFamily&&(Tr["CJK Unified Ideographs"](r)||Tr["Hangul Syllables"](r)||Tr.Hiragana(r)||Tr.Katakana(r)||Tr["CJK Symbols and Punctuation"](r)||Tr["CJK Unified Ideographs Extension A"](r)||Tr["CJK Unified Ideographs Extension B"](r)||Tr.Osage(r)))}_tinySDF(r,n,c){const h=this.localFontFamily;if(!h||!this._doesCharSupportLocalGlyph(c))return;let m=r.tinySDF;if(!m){let V="400";/bold/i.test(n)?V="900":/medium/i.test(n)?V="500":/light/i.test(n)&&(V="200"),m=r.tinySDF=new vg.TinySDF({fontFamily:h,fontWeight:V,fontSize:24*pc,buffer:3*pc,radius:8*pc}),m.fontWeight=V}if(this.localGlyphs[m.fontWeight][c])return this.localGlyphs[m.fontWeight][c];const g=String.fromCodePoint(c),{data:x,width:w,height:E,glyphWidth:I,glyphHeight:A,glyphLeft:P,glyphTop:D,glyphAdvance:O}=m.draw(g);return this.localGlyphs[m.fontWeight][c]={id:c,bitmap:new wd({width:w,height:E},x),metrics:{width:I/pc,height:A/pc,left:P/pc,top:D/pc-27,advance:O/pc,localGlyph:!0}}}}vg.loadGlyphRange=function(a,r,n,c,h){const m=256*r,g=m+255,x=c.transformRequest(c.normalizeGlyphsURL(n).replace("{fontstack}",a).replace("{range}",`${m}-${g}`),_f.Glyphs);yf(x,(w,E)=>{if(w)h(w);else if(E){const I={},A=function(P){return new Gw(P).readFields(gte,{})}(E);for(const P of A.glyphs)I[P.id]=P;
66h(null,{glyphs:I,ascender:A.ascender,descender:A.descender})}})},vg.TinySDF=class{constructor({fontSize:a=24,buffer:r=3,radius:n=8,cutoff:c=.25,fontFamily:h="sans-serif",fontWeight:m="normal",fontStyle:g="normal"}={}){this.buffer=r,this.cutoff=c,this.radius=n;const x=this.size=a+4*r,w=this._createCanvas(x),E=this.ctx=w.getContext("2d",{willReadFrequently:!0});E.font=`${g} ${m} ${a}px ${h}`,E.textBaseline="alphabetic",E.textAlign="left",E.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(a){const r=document.createElement("canvas");return r.width=r.height=a,r}draw(a){const{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:c,actualBoundingBoxLeft:h,actualBoundingBoxRight:m}=this.ctx.measureText(a),g=Math.ceil(n),x=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-h))),w=Math.min(this.size-this.buffer,g+Math.ceil(c)),E=x+2*this.buffer,I=w+2*this.buffer,A=Math.max(E*I,0),P=new Uint8ClampedArray(A),D={data:P,width:E,height:I,glyphWidth:x,glyphHeight:w,glyphTop:g,glyphLeft:0,glyphAdvance:r};if(x===0||w===0)return D;const{ctx:O,buffer:V,gridInner:j,gridOuter:X}=this;O.clearRect(V,V,x,w),O.fillText(a,V,V+g);const oe=O.getImageData(V,V,x,w);X.fill(av,0,A),j.fill(0,0,A);for(let ne=0;ne<w;ne++)for(let ae=0;ae<x;ae++){const Ie=oe.data[4*(ne*x+ae)+3]/255;if(Ie===0)continue;const be=(ne+V)*E+ae+V;if(Ie===1)X[be]=0,j[be]=av;else{const Te=.5-Ie;X[be]=Te>0?Te*Te:0,j[be]=Te<0?Te*Te:0}}U6(X,0,0,E,I,E,this.f,this.v,this.z),U6(j,V,V,x,w,E,this.f,this.v,this.z);for(let ne=0;ne<A;ne++){const ae=Math.sqrt(X[ne])-Math.sqrt(j[ne]);P[ne]=Math.round(255-255*(ae/this.radius+this.cutoff))}return D}};const Sd=op;function G6(a,r){return a+r[1]-r[0]}function $6(a,r,n,c,h=1){const m=[],g=a.imagePrimary,x=g.pixelRatio,w=g.paddedRect.w-2*Sd,E=g.paddedRect.h-2*Sd,I=(a.right-a.left)*h,A=(a.bottom-a.top)*h,P=g.stretchX||[[0,w]],D=g.stretchY||[[0,E]],O=P.reduce(G6,0),V=D.reduce(G6,0),j=w-O,X=E-V;let oe=0,ne=O,ae=0,Ie=V,be=0,Te=j,Le=0,De=X;if(g.content&&c){const je=g.content;oe=Hw(P,0,je[0]),ae=Hw(D,0,je[1]),ne=Hw(P,je[0],je[2]),Ie=Hw(D,je[1],je[3]),be=je[0]-oe,Le=je[1]-ae,Te=je[2]-je[0]-ne,De=je[3]-je[1]-Ie}const lt=(je,ht,Lt,gt)=>{const St=qw(je.stretch-oe,ne,I,a.left*h),kt=Zw(je.fixed-be,Te,je.stretch,O),st=qw(ht.stretch-ae,Ie,A,a.top*h),Ct=Zw(ht.fixed-Le,De,ht.stretch,V),$e=qw(Lt.stretch-oe,ne,I,a.left*h),at=Zw(Lt.fixed-be,Te,Lt.stretch,O),Dt=qw(gt.stretch-ae,Ie,A,a.top*h),At=Zw(gt.fixed-Le,De,gt.stretch,V),sr=new Tt(St,st),Qt=new Tt($e,st),bt=new Tt($e,Dt),Pt=new Tt(St,Dt),rr=new Tt(kt/x,Ct/x),Wt=new Tt(at/x,At/x),Ut=r*Math.PI/180;if(Ut){const ri=Math.sin(Ut),Hr=Math.cos(Ut),ln=[Hr,-ri,ri,Hr];sr._matMult(ln),Qt._matMult(ln),Pt._matMult(ln),bt._matMult(ln)}const Xt=je.stretch+je.fixed,xr=Lt.stretch+Lt.fixed,Mr=ht.stretch+ht.fixed,Or=gt.stretch+gt.fixed,Rr=a.imageSecondary;return{tl:sr,tr:Qt,bl:Pt,br:bt,texPrimary:{x:g.paddedRect.x+Sd+Xt,y:g.paddedRect.y+Sd+Mr,w:xr-Xt,h:Or-Mr},texSecondary:Rr?{x:Rr.paddedRect.x+Sd+Xt,y:Rr.paddedRect.y+Sd+Mr,w:xr-Xt,h:Or-Mr}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rr,pixelOffsetBR:Wt,minFontScaleX:Te/x/I,minFontScaleY:De/x/A,isSDF:n}};if(c&&(g.stretchX||g.stretchY)){const je=H6(P,j,O),ht=H6(D,X,V);for(let Lt=0;Lt<je.length-1;Lt++){const gt=je[Lt],St=je[Lt+1];for(let kt=0;kt<ht.length-1;kt++)m.push(lt(gt,ht[kt],St,ht[kt+1]))}}else m.push(lt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:w+1},{fixed:0,stretch:E+1}));return m}function Hw(a,r,n){let c=0;for(const h of a)c+=Math.max(r,Math.min(n,h[1]))-Math.max(r,Math.min(n,h[0]));return c}function H6(a,r,n){const c=[{fixed:-Sd,stretch:0}];for(const[h,m]of a){const g=c[c.length-1];c.push({fixed:h-g.stretch,stretch:g.stretch}),c.push({fixed:h-g.stretch,stretch:g.stretch+(m-h)})}return c.push({fixed:r+Sd,stretch:n}),c}function qw(a,r,n,c){return a/r*n+c}function Zw(a,r,n,c){return a-r*n/c}function Ete(a,r,n,c){const h=r+a.positionedLines[c].lineOffset;return c===0?n+h/2:n+(h+(r+a.positionedLines[c-1].lineOffset))/2}function Ste(a,r=1,n=!1){let c=1/0,h=1/0,m=-1/0,g=-1/0;const x=a[0];for(let D=0;D<x.length;D++){const O=x[D];(!D||O.x<c)&&(c=O.x),(!D||O.y<h)&&(h=O.y),(!D||O.x>m)&&(m=O.x),(!D||O.y>g)&&(g=O.y)}const w=Math.min(m-c,g-h);let E=w/2;const I=new bm([],Cte);if(w===0)return new Tt(c,h);for(let D=c;D<m;D+=w)for(let O=h;O<g;O+=w)I.push(new xg(D+E,O+E,E,a));let A=function(D){let O=0,V=0,j=0;const X=D[0];for(let oe=0,ne=X.length,ae=ne-1;oe<ne;ae=oe++){const Ie=X[oe],be=X[ae],Te=Ie.x*be.y-be.x*Ie.y;V+=(Ie.x+be.x)*Te,j+=(Ie.y+be.y)*Te,O+=3*Te}return new xg(V/O,j/O,0,D)}(a),P=I.length;for(;I.length;){const D=I.pop();(D.d>A.d||!A.d)&&(A=D,n&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,P)),D.max-A.d<=r||(E=D.h/2,I.push(new xg(D.p.x-E,D.p.y-E,E,a)),I.push(new xg(D.p.x+E,D.p.y-E,E,a)),I.push(new xg(D.p.x-E,D.p.y+E,E,a)),I.push(new xg(D.p.x+E,D.p.y+E,E,a)),P+=4)}return n&&(console.log(`num probes: ${P}`),console.log(`best distance: ${A.d}`)),A.p}function Cte(a,r){return r.max-a.max}class xg{constructor(r,n,c,h){this.p=new Tt(r,n),this.h=c,this.d=function(m,g){let x=!1,w=1/0;for(let E=0;E<g.length;E++){const I=g[E];for(let A=0,P=I.length,D=P-1;A<P;D=A++){const O=I[A],V=I[D];O.y>m.y!=V.y>m.y&&m.x<(V.x-O.x)*(m.y-O.y)/(V.y-O.y)+O.x&&(x=!x),w=Math.min(w,_a(m,O,V))}}return(x?1:-1)*Math.sqrt(w)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}}const Ite=Object.keys,VA=Number.POSITIVE_INFINITY,Ate=Math.sqrt(2);function q6(a,[r,n]){let c=0,h=0;if(n===VA){r<0&&(r=0);const m=r/Ate;switch(a){case"top-right":case"top-left":h=m-7;break;case"bottom-right":case"bottom-left":h=7-m;break;case"bottom":h=7-r;break;case"top":h=r-7}switch(a){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=r;break;case"right":c=-r}}else{switch(r=Math.abs(r),n=Math.abs(n),a){case"top-right":case"top-left":case"top":h=n-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-n}switch(a){case"top-right":case"bottom-right":case"right":c=-r;break;case"top-left":case"bottom-left":case"left":c=r}}return[c,h]}
66function Ww(a,r,n,c,h,m,g,x,w){if(!r||!r.usvg)return;const E=R6(c),I=R6(h),A=m!=="both"&&m!=="width"||!M6(c)?1:I.width/E.width,P=m!=="both"&&m!=="height"||!k6(c)?1:I.height/E.height;n.scaleSelf(A,P);const D=n.toString();g.set(D,n),x.set(D,r);const{imagePosition:O}=NA(D,r,op);w.set(D,O)}function Z6(a,r,n,c,h,m,g,x,w){if(!a)return;const E=function(I,A,P,D,O,V){if(I.kind==="camera")return I.maxSize;if(I.kind==="composite"){const j=A.possiblyEvaluate(new Ni(I.maxZoom,{worldview:V}),P).evaluate(O,{},P),X=A.possiblyEvaluate(new Ni(I.minZoom,{worldview:V}),P).evaluate(O,{},P);return Math.max(j,X)}return A.possiblyEvaluate(new Ni(D,{worldview:V})).evaluate(O,{},P)}(r,n,c,h,m,w);return a.scaleSelf(E*x*g)}function W6(a,r,n,c,h,m,g,x,w){return{iconPrimary:Z6(a.getPrimary(),r,n,c,h,m,g,x,w),iconSecondary:Z6(a.getSecondary(),r,n,c,h,m,g,x,w)}}function Pte(a,r,n){if(!r)return;const c=n.get(a.toString()),h=n.get(r.toString());h&&(c.paddedRect.w===h.paddedRect.w&&c.paddedRect.h===h.paddedRect.h||Ar(`Mismatch in icon variant sizes: ${a.toString()} and ${r.toString()}`),c.usvg!==h.usvg&&Ar(`Mismatch in icon variant image types: ${a.id} and ${r.id}`))}function X6(a,r,n,c){if(!a)return;const h=r.get(n.toString());if(a.imagePrimary=h,c){const m=r.get(c.toString());a.imageSecondary=m}}function Mte(a,r){for(const n in a.horizontal)Y6(a.horizontal[n],r);Y6(a.vertical,r)}function Y6(a,r){if(a){for(const n of a.positionedLines)for(const c of n.positionedGlyphs)if(c.image!==null){const h=c.image.toString();c.rect=r.get(h).paddedRect}}}function UA(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kte(a,r,n,c,h,m,g,x,w){const E=jA(m.horizontal)||m.vertical,I=n.get("icon-text-fit-padding").evaluate(c,{},h);let A,P=r;return r&&w!=="none"&&(a.allowVerticalPlacement&&m.vertical&&(A=P6(r,m.vertical,w,I,x,g)),E&&(P=P6(r,E,w,I,x,g))),{defaultShapedIcon:P,verticallyShapedIcon:A}}function Rte(a,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X,oe,ne){let ae=g.textMaxSize.evaluate(r,{},P);ae===void 0?ae=x*g.textScaleFactor:ae*=g.textScaleFactor;const Ie=a.layers[0].layout,be=jA(n.horizontal)||n.vertical,Te=D.name==="globe",Le=Po,De=a.tilePixelRatio*ae/Le,lt=(kt=a.overscaling,a.zoom>18&&kt>2&&(kt>>=1),Math.max(Vt/(512*kt),1)*Ie.get("symbol-spacing")),je=Ie.get("text-padding")*a.tilePixelRatio,ht=Ie.get("icon-padding")*a.tilePixelRatio,Lt=ai(Ie.get("text-max-angle")),gt=Ie.get("icon-rotation-alignment")==="map"&&ne!=="point",St=lt/2;var kt;a.hasAnyIconTextFit===!1&&j!=="none"&&(a.hasAnyIconTextFit=!0);const st=r.properties?+r.properties[Zt]:null,Ct=st&&a.elevationFeatureIdToIndex?a.elevationFeatureIdToIndex.get(st):65535,$e=(at,Dt,At)=>{if(Dt.x<0||Dt.x>=Vt||Dt.y<0||Dt.y>=Vt)return;let sr=null;if(Te){const{x:Qt,y:bt,z:Pt}=D.projectTilePoint(Dt.x,Dt.y,At);sr={anchor:new Ju(Qt,bt,Pt,0,void 0),up:D.upVector(At,Dt.x,Dt.y)}}(function(Qt,bt,Pt,rr,Wt,Ut,Xt,xr,Mr,Or,Rr,ri,Hr,ln,ue,he,it,Ot,$t,Gt,tr,Ir,Jr,Qr,jr,Bi,Cn,Fr,fn){const Ki=Qt.addToLineVertexArray(bt,rr);let Ri,wn,cn,Ji,nn,Oi,Gr,Vi=0,Tn=0,Sr=0,ci=0,un=-1,Mn=-1;const pn={};let io=jh("");const $i=Pt?Pt.anchor:bt,Wn=Fr!=="none";let Ws=0,Ho=0;if(Mr._unevaluatedLayout.getValue("text-radial-offset")===void 0){const no=Mr.layout.get("text-offset").evaluate(tr,{},jr);Ws=no[0]*Po,Ho=no[1]*Po}else Ws=Mr.layout.get("text-radial-offset").evaluate(tr,{},jr)*Po,Ho=VA;if(Qt.allowVerticalPlacement&&Wt.vertical){const no=Wt.vertical;if(ue)Oi=GA(no),xr&&(Gr=GA(xr));else{const mo=Mr.layout.get("text-rotate").evaluate(tr,{},jr)+90;cn=Xw(Or,$i,bt,Rr,ri,Hr,no,ln,mo,he),xr&&(Ji=Xw(Or,$i,bt,Rr,ri,Hr,xr,Ot,mo))}}if(Ut){const no=Qt.iconSizeData,mo=Mr.layout.get("icon-rotate").evaluate(tr,{},jr),qo=$6(Ut,mo,Jr,Wn,Ir.iconScaleFactor),_s=xr?$6(xr,mo,Jr,Wn,Ir.iconScaleFactor):void 0;wn=Xw(Or,$i,bt,Rr,ri,Hr,Ut,Ot,mo,null),Vi=4*qo.length;let ts=null;no.kind==="source"?(ts=[au*Mr.layout.get("icon-size").evaluate(tr,{},jr)*Ir.iconScaleFactor],ts[0]>Cd&&Ar(`${Qt.layerIds[0]}: Value for "icon-size" is >= ${lv}. Reduce your "icon-size".`)):no.kind==="composite"&&(ts=[au*Ir.compositeIconSizes[0].evaluate(tr,{},jr)*Ir.iconScaleFactor,au*Ir.compositeIconSizes[1].evaluate(tr,{}
66,jr)*Ir.iconScaleFactor],(ts[0]>Cd||ts[1]>Cd)&&Ar(`${Qt.layerIds[0]}: Value for "icon-size" is >= ${lv}. Reduce your "icon-size".`)),Qt.addSymbols(Qt.icon,qo,ts,Gt,$t,tr,void 0,Pt,bt,Ki.lineStartIndex,Ki.lineLength,-1,Qr,jr,Bi,Cn),un=Qt.icon.placedSymbolArray.length-1,_s&&(Tn=4*_s.length,Qt.addSymbols(Qt.icon,_s,ts,Gt,$t,tr,wa.vertical,Pt,bt,Ki.lineStartIndex,Ki.lineLength,-1,Qr,jr,Bi,Cn),Mn=Qt.icon.placedSymbolArray.length-1)}for(const no in Wt.horizontal){const mo=no,qo=Wt.horizontal[mo];Ri||(io=jh(qo.text),ue?nn=GA(qo):Ri=Xw(Or,$i,bt,Rr,ri,Hr,qo,ln,Mr.layout.get("text-rotate").evaluate(tr,{},jr),he));const _s=qo.positionedLines.length===1;if(Sr+=K6(Qt,Pt,bt,qo,Xt,Mr,ue,tr,he,Ki,Wt.vertical?wa.horizontal:wa.horizontalOnly,_s?Ite(Wt.horizontal):[mo],pn,un,Ir,Qr,jr,Bi),_s)break}Wt.vertical&&(ci+=K6(Qt,Pt,bt,Wt.vertical,Xt,Mr,ue,tr,he,Ki,wa.vertical,["vertical"],pn,Mn,Ir,Qr,jr,Bi));let Oo=-1;const Xs=(no,mo)=>no?Math.max(no,mo):mo;Oo=Xs(nn,Oo),Oo=Xs(Oi,Oo),Oo=Xs(Gr,Oo);const lu=Oo>-1?1:0;Qt.glyphOffsetArray.length>=65535&&Ar("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),tr.sortKey!==void 0&&Qt.addToSortKeyRanges(Qt.symbolInstances.length,tr.sortKey),Qt.symbolInstances.emplaceBack(bt.x,bt.y,$i.x,$i.y,$i.z,pn.right>=0?pn.right:-1,pn.center>=0?pn.center:-1,pn.left>=0?pn.left:-1,pn.vertical>=0?pn.vertical:-1,un,Mn,io,Ri!==void 0?Ri:Qt.collisionBoxArray.length,Ri!==void 0?Ri+1:Qt.collisionBoxArray.length,cn!==void 0?cn:Qt.collisionBoxArray.length,cn!==void 0?cn+1:Qt.collisionBoxArray.length,wn!==void 0?wn:Qt.collisionBoxArray.length,wn!==void 0?wn+1:Qt.collisionBoxArray.length,Ji||Qt.collisionBoxArray.length,Ji?Ji+1:Qt.collisionBoxArray.length,Rr,Sr,ci,Vi,Tn,lu,0,Ws,Ho,Oo,0,Wn?1:0,fn)})(a,Dt,sr,at,n,c,m,h,a.layers[0],a.collisionBoxArray,r.index,r.sourceLayerIndex,a.index,je,oe,E,0,ht,gt,X,r,g,I,A,P,O,V,j,Ct)};if(ne==="line")for(const at of Dw(r.geometry,0,0,Vt,Vt)){const Dt=Tte(at,lt,Lt,n.vertical||be,c,Le,De,a.overscaling,Vt);for(const At of Dt)be&&Lte(a,be.text,St,At)||$e(at,At,P)}else if(ne==="line-center"){for(const at of r.geometry)if(at.length>1){const Dt=wte(at,Lt,n.vertical||be,c,Le,De);Dt&&$e(at,Dt,P)}}else if(r.type==="Polygon")for(const at of $0(r.geometry,0)){const Dt=Ste(at,16);$e(at[0],new Ju(Dt.x,Dt.y,0,0,void 0),P)}else if(r.type==="LineString")for(const at of r.geometry)$e(at,new Ju(at[0].x,at[0].y,0,0,void 0),P);else if(r.type==="Point")for(const at of r.geometry)for(const Dt of at)$e([Dt],new Ju(Dt.x,Dt.y,0,0,void 0),P)}const lv=255,Cd=lv*au;function K6(a,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j,X){const oe=function(Ie,be,Te,Le,De,lt,je,ht){const Lt=[];if(be.positionedLines.length===0)return Lt;const gt=Le.layout.get("text-rotate").evaluate(lt,{})*Math.PI/180,St=function(at){const Dt=at[0],At=at[1],sr=Dt*At;return sr>0?[Dt,-At]:sr<0?[-Dt,At]:Dt===0?[At,Dt]:[At,-Dt]}(Te);let kt=Math.abs(be.top-be.bottom);for(const at of be.positionedLines)kt-=at.lineOffset;const st=be.positionedLines.length,Ct=kt/st;let $e=be.top-Te[1];for(let at=0;at<st;++at){const Dt=be.positionedLines[at];$e=Ete(be,Ct,$e,at);for(const At of Dt.positionedGlyphs){if(!At.rect)continue;const sr=At.rect||{};let Qt=w6+1,bt=!0,Pt=1,rr=0;if(At.image){const tr=je.get(At.image.toString());if(!tr)continue;if(tr.sdf){Ar("SDF images are not supported in formatted text and will be ignored.");continue}bt=!1,Pt=tr.pixelRatio,Qt=op/Pt}const Wt=(De||ht)&&At.vertical,Ut=At.metrics.advance*At.scale/2,Xt=At.metrics,xr=At.rect;if(xr===null)continue;ht&&be.verticalizable&&(rr=At.image?Ut-At.metrics.width*At.scale/2:0);const Mr=De?[At.x+Ut,At.y]:[0,0];let Or=[0,0],Rr=[0,0],ri=!1;De||(Wt?(Rr=[At.x+Ut+St[0],At.y+St[1]-rr],ri=!0):Or=[At.x+Ut+Te[0],At.y+Te[1]-rr]);const Hr=xr.w*At.scale/(Pt*(At.localGlyph?pc:1)),ln=xr.h*At.scale/(Pt*(At.localGlyph?pc:1));let ue,he,it,Ot;if(Wt){const tr=At.y-$e,Ir=new Tt(-Ut,Ut-tr),Jr=-Math.PI/2,Qr=new Tt(...Rr);ue=new Tt(-Ut+Or[0],Or[1]),ue._rotateAround(Jr,Ir)._add(Qr),ue.x+=-tr+Ut,ue.y-=(Xt.left-Qt)*At.scale;const jr=At.image?Xt.advance*At.scale:Po*At.scale,Bi=String.fromCodePoint(At.glyph);ote(Bi)?ue.x+=(1-Qt)*At.scale:ste(Bi)?ue.x+=jr-Xt.height*At.scale+(-Qt-1)*At.scale:ue.x+=At.image||Xt.width+2*Qt===xr.w&&Xt.height+2*Qt===xr.h?(jr-ln)/2:(jr-(Xt.height+2*Qt)*At.scale)/2,he=new Tt(ue.x,ue.y-Hr),it=new Tt(ue.x+ln,ue.y),Ot=new Tt(ue.x+ln,ue.y-Hr)}else{const tr=(Xt.left-Qt)*At.scale-Ut+Or[0],Ir=(-Xt.top-Qt)*At.scale+Or[1],Jr=tr+Hr,Qr=Ir+ln;ue=new Tt(tr,Ir),he=new Tt(Jr,Ir),it=new Tt(tr,Qr),Ot=new Tt(Jr,Qr)}if(gt){let tr;tr=De?new Tt(0,0):ri?new Tt(St[0],St[1]):new Tt(Te[0],Te[1]),ue._rotateAroun
66d(gt,tr),he._rotateAround(gt,tr),it._rotateAround(gt,tr),Ot._rotateAround(gt,tr)}const $t=new Tt(0,0),Gt=new Tt(0,0);Lt.push({tl:ue,tr:he,bl:it,br:Ot,texPrimary:sr,texSecondary:void 0,writingMode:be.writingMode,glyphOffset:Mr,sectionIndex:At.sectionIndex,isSDF:bt,pixelOffsetTL:$t,pixelOffsetBR:Gt,minFontScaleX:0,minFontScaleY:0})}}return Lt}(0,c,w,m,g,x,h,a.allowVerticalPlacement),ne=a.textSizeData;let ae=null;ne.kind==="source"?(ae=[au*m.layout.get("text-size").evaluate(x,{},j)*O.textScaleFactor],ae[0]>Cd&&Ar(`${a.layerIds[0]}: Value for "text-size" is >= ${lv}. Reduce your "text-size".`)):ne.kind==="composite"&&(ae=[au*O.compositeTextSizes[0].evaluate(x,{},j)*O.textScaleFactor,au*O.compositeTextSizes[1].evaluate(x,{},j)*O.textScaleFactor],(ae[0]>Cd||ae[1]>Cd)&&Ar(`${a.layerIds[0]}: Value for "text-size" is >= ${lv}. Reduce your "text-size".`)),a.addSymbols(a.text,oe,ae,w,g,x,I,r,n,E.lineStartIndex,E.lineLength,D,V,j,X,!1);for(const Ie of A)P[Ie]=a.text.placedSymbolArray.length-1;return 4*oe.length}function jA(a){for(const r in a)return a[r];return null}function Xw(a,r,n,c,h,m,g,x,w,E){let I=g.top,A=g.bottom,P=g.left,D=g.right;if(A6(g)&&g.collisionPadding){const O=g.collisionPadding;P-=O[0],I-=O[1],D+=O[2],A+=O[3]}if(w){const O=new Tt(P,I),V=new Tt(D,I),j=new Tt(P,A),X=new Tt(D,A),oe=ai(w);let ne=new Tt(0,0);E&&(ne=new Tt(E[0],E[1])),O._rotateAround(oe,ne),V._rotateAround(oe,ne),j._rotateAround(oe,ne),X._rotateAround(oe,ne),P=Math.min(O.x,V.x,j.x,X.x),D=Math.max(O.x,V.x,j.x,X.x),I=Math.min(O.y,V.y,j.y,X.y),A=Math.max(O.y,V.y,j.y,X.y)}return a.emplaceBack(r.x,r.y,r.z,n.x,n.y,P,I,D,A,x,c,h,m),a.length-1}function GA(a){A6(a)&&a.collisionPadding&&(a.top-=a.collisionPadding[1],a.bottom+=a.collisionPadding[3]);const r=a.bottom-a.top;return r>0?Math.max(10,r):null}function Lte(a,r,n,c){const h=a.compareText;if(r in h){const m=h[r];for(let g=m.length-1;g>=0;g--)if(c.dist(m[g])<n)return!0}else h[r]=[];return h[r].push(c),!1}function J6(a,r){const n=a.fovAboveCenter,c=a.elevation?a.elevation.getMinElevationBelowMSL()*r:0,h=(a._camera.position[2]*a.worldSize-c)/Math.cos(a._pitch),m=Math.sin(n)*h/Math.sin(Math.max(Math.PI/2-a._pitch-n,.01));let g=Math.sin(a._pitch)*m+h;const x=h*(1/a._horizonShift);if(!a.elevation||a.elevation.exaggeration()===0){let w=Math.max(a.zoom-17,0);a.isOrthographic&&(w/=10),g*=1+w}return Math.min(1.01*g,x)}function cv(a,r){if(!r.isReprojectedInTileSpace)return{scale:1<<a.z,x:a.x,y:a.y,x2:a.x+1,y2:a.y+1,projection:r};const n=Math.pow(2,-a.z),c=a.x*n,h=(a.x+1)*n,m=a.y*n,g=(a.y+1)*n,x=re(c),w=re(h),E=se(m),I=se(g),A=r.project(x,E),P=r.project(w,E),D=r.project(w,I),O=r.project(x,I);let V=Math.min(A.x,P.x,D.x,O.x),j=Math.min(A.y,P.y,D.y,O.y),X=Math.max(A.x,P.x,D.x,O.x),oe=Math.max(A.y,P.y,D.y,O.y);const ne=n/16;function ae(be,Te,Le,De,lt,je){const ht=(Le+lt)/2,Lt=(De+je)/2,gt=r.project(re(ht),se(Lt)),St=Math.max(0,V-gt.x,j-gt.y,gt.x-X,gt.y-oe);V=Math.min(V,gt.x),X=Math.max(X,gt.x),j=Math.min(j,gt.y),oe=Math.max(oe,gt.y),St>ne&&(ae(be,gt,Le,De,ht,Lt),ae(gt,Te,ht,Lt,lt,je))}ae(A,P,c,m,h,m),ae(P,D,h,m,h,g),ae(D,O,h,g,c,g),ae(O,A,c,g,c,m),V-=ne,j-=ne,X+=ne,oe+=ne;const Ie=1/Math.max(X-V,oe-j);return{scale:Ie,x:V*Ie,y:j*Ie,x2:X*Ie,y2:oe*Ie,projection:r}}function Q6(a,{x:r,y:n},c=0){return new Tt(((r-c)*a.scale-a.x)*Vt,(n*a.scale-a.y)*Vt)}const zte=pe(new Float32Array(16));class Id{constructor(r){this.spec=r,this.name=r.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(r,n){return{x:0,y:0,z:0}}unproject(r,n){return new R(0,0)}projectTilePoint(r,n,c){return{x:r,y:n,z:0}}locationPoint(r,n,c,h=!0){return r._coordinatePoint(r.locationCoordinate(n,c),h)}pixelsPerMeter(r,n){return Z(1,r)*n}pixelSpaceConversion(r,n,c){return 1}farthestPixelDistance(r){return J6(r,r.pixelsPerMeter)}pointCoordinate(r,n,c,h){const m=r.horizonLineFromTop(!1),g=new Tt(n,Math.max(m,c));return r.rayIntersectionCoordinate(r.pointRayIntersection(g,h))}pointCoordinate3D(r,n,c){const h=new Tt(n,c);if(r.elevation)return r.elevation.pointCoordinate(h);{const m=this.pointCoordinate(r,h.x,h.y,0);return[m.x,m.y,m.z]}}isPointAboveHorizon(r,n){if(r.elevation&&r.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(r,n.x,n.y);const c=r.horizonLineFromTop();return n.y<c}createInversionMatrix(r,n){return zte}createTileMatrix(r,n,c){let h,m,g;const x=c.canonical,w=pe(new Float64Array(16));if(this.isReprojectedInTileSpace){const E=cv(x,this);h=1,m=E.x+c.wrap*E.scale,g=E.y,ke(w,w,[h/E.scale,h/E.scale,r.pixelsPerMeter/n])}else h=n/r.zoomScale(x.z),m=(x.x+Math.pow(2,x.z)*c.wrap)*h,g=x.y*h;return ie(w,w,[m,g,0]),ke(w,w,[h/Vt,h/Vt,1]),w}upVector(r,n,c){return[0,0,1]}upVectorScale(r,n,c){return{metersToTile:1}}}class Dte extends Id{constructor(r){super(r),this.range=[4,7],this.center=r.center||[-96,37.5];const[n,c]=this.parallels=r.parallels||[29.5,45.5],h=Math.sin(ai(n));this.n=(h+Math.sin(ai(c)))/2,this.c=1+h*(2*this.n-h),this.r0=Math.sqrt(this.c)/this.n}project(r,n){const{n:c,c:h,r0:m}=this,g=ai(r-this.center[0]),x=ai(n),w=Math.sqrt(h-2*c*Math.sin(x)
vendor: 6,849 bytes, line 66
66)/c;return{x:w*Math.sin(g*c),y:w*Math.cos(g*c)-m,z:0}}unproject(r,n){const{n:c,c:h,r0:m}=this,g=m+n;let x=Math.atan2(r,Math.abs(g))*Math.sign(g);g*c<0&&(x-=Math.PI*Math.sign(r)*Math.sign(g));const w=ai(this.center[0])*c;x=Ce(x,-Math.PI-w,Math.PI-w);const E=J(Xe(x/c)+this.center[0],-180,180),I=Math.asin(J((h-(r*r+g*g)*c*c)/(2*c),-1,1)),A=J(Xe(I),-fe,fe);return new R(E,A)}}const uv=1.340264,hv=-.081106,dv=893e-6,fv=.003796,Yw=Math.sqrt(3)/2;class Ote extends Id{project(r,n){n=n/180*Math.PI,r=r/180*Math.PI;const c=Math.asin(Yw*Math.sin(n)),h=c*c,m=h*h*h;return{x:.5*(r*Math.cos(c)/(Yw*(uv+3*hv*h+m*(7*dv+9*fv*h)))/Math.PI+.5),y:1-.5*(c*(uv+hv*h+m*(dv+fv*h))/Math.PI+1),z:0}}unproject(r,n){r=(2*r-.5)*Math.PI;let c=n=(2*(1-n)-1)*Math.PI,h=c*c,m=h*h*h;for(let I,A,P,D=0;D<12&&(A=c*(uv+hv*h+m*(dv+fv*h))-n,P=uv+3*hv*h+m*(7*dv+9*fv*h),I=A/P,c=J(c-I,-Math.PI/3,Math.PI/3),h=c*c,m=h*h*h,!(Math.abs(I)<1e-12));++D);const g=Yw*r*(uv+3*hv*h+m*(7*dv+9*fv*h))/Math.cos(c),x=Math.asin(Math.sin(c)/Yw),w=J(180*g/Math.PI,-180,180),E=J(180*x/Math.PI,-fe,fe);return new R(w,E)}}class Fte extends Id{constructor(r){super(r),this.wrap=!0,this.supportsWorldCopies=!0}project(r,n){return{x:.5+r/360,y:.5-n/360,z:0}}unproject(r,n){const c=360*(r-.5),h=J(360*(.5-n),-fe,fe);return new R(c,h)}}const bg=Math.PI/2;function Kw(a){return Math.tan((bg+a)/2)}class Nte extends Id{constructor(r){super(r),this.center=r.center||[0,30];const[n,c]=this.parallels=r.parallels||[30,30];let h=ai(n),m=ai(c);this.southernCenter=h+m<0,this.southernCenter&&(h=-h,m=-m);const g=Math.cos(h),x=Kw(h);this.n=h===m?Math.sin(h):Math.log(g/Math.cos(m))/Math.log(Kw(m)/x),this.f=g*Math.pow(Kw(h),this.n)/this.n}project(r,n){n=ai(n),this.southernCenter&&(n=-n),r=ai(r-this.center[0]);const c=1e-6,{n:h,f:m}=this;m>0?n<-bg+c&&(n=-bg+c):n>bg-c&&(n=bg-c);const g=m/Math.pow(Kw(n),h);let x=g*Math.sin(h*r),w=m-g*Math.cos(h*r);return x=.5*(x/Math.PI+.5),w=.5*(w/Math.PI+.5),{x,y:this.southernCenter?w:1-w,z:0}}unproject(r,n){r=(2*r-.5)*Math.PI,this.southernCenter&&(n=1-n),n=(2*(1-n)-.5)*Math.PI;const{n:c,f:h}=this,m=h-n,g=Math.sign(m),x=Math.sign(c)*Math.sqrt(r*r+m*m);let w=Math.atan2(r,Math.abs(m))*g;m*c<0&&(w-=Math.PI*Math.sign(r)*g);const E=J(Xe(w/c)+this.center[0],-180,180),I=J(Xe(2*Math.atan(Math.pow(h/x,1/c))-bg),-fe,fe);return new R(E,this.southernCenter?-I:I)}}class e8 extends Id{constructor(r){super(r),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(r,n){return{x:U(r),y:W(n),z:0}}unproject(r,n){const c=re(r),h=se(n);return new R(c,h)}}const t8=ai(fe);class Bte extends Id{project(r,n){const c=(n=ai(n))*n,h=c*c;return{x:.5*((r=ai(r))*(.8707-.131979*c+h*(h*(.003971*c-.001529*h)-.013791))/Math.PI+.5),y:1-.5*(n*(1.007226+c*(.015085+h*(.028874*c-.044475-.005916*h)))/Math.PI+1),z:0}}unproject(r,n){r=(2*r-.5)*Math.PI;let c=n=(2*(1-n)-1)*Math.PI,h=25,m=0,g=c*c;do{g=c*c;const E=g*g;m=(c*(1.007226+g*(.015085+E*(.028874*g-.044475-.005916*E)))-n)/(1.007226+g*(.045255+E*(.259866*g-.311325-.005916*11*E))),c=J(c-m,-t8,t8)}while(Math.abs(m)>1e-6&&--h>0);g=c*c;const x=J(Xe(r/(.8707+g*(g*(g*g*g*(.003971-.001529*g)-.013791)-.131979))),-180,180),w=Xe(c);return new R(x,w)}}const r8=ai(fe);class Vte extends Id{project(r,n){n=ai(n),r=ai(r);const c=Math.cos(n),h=2/Math.PI,m=Math.acos(c*Math.cos(r/2)),g=Math.sin(m)/m,x=.5*(r*h+2*c*Math.sin(r/2)/g)||0,w=.5*(n+Math.sin(n)/g)||0;return{x:.5*(x/Math.PI+.5),y:1-.5*(w/Math.PI+1),z:0}}unproject(r,n){let c=r=(2*r-.5)*Math.PI,h=n=(2*(1-n)-1)*Math.PI,m=25;const g=1e-6;let x=0,w=0;do{const E=Math.cos(h),I=Math.sin(h),A=2*I*E,P=I*I,D=E*E,O=Math.cos(c/2),V=Math.sin(c/2),j=2*O*V,X=V*V,oe=1-D*O*O,ne=oe?1/oe:0,ae=oe?Math.acos(E*O)*Math.sqrt(1/oe):0,Ie=.5*(2*ae*E*V+2*c/Math.PI)-r,be=.5*(ae*I+h)-n,Te=.5*ne*(D*X+ae*E*O*P)+1/Math.PI,Le=ne*(j*A/4-ae*I*V),De=.125*ne*(A*V-ae*I*D*j),lt=.5*ne*(P*O+ae*X*E)+.5,je=Le*De-lt*Te;x=(be*Le-Ie*lt)/je,w=(Ie*De-be*Te)/je,c=J(c-x,-Math.PI,Math.PI),h=J(h-w,-r8,r8)}while((Math.abs(x)>g||Math.abs(w)>g)&&--m>0);return new R(Xe(c),Xe(h))}}class i8 extends Id{constructor(r){super(r),this.center=r.center||[0,0],this.parallels=r.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ai(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(r,n){const{scale:c,cosPhi:h}=this;return{x:ai(r)*h*c+.5,y:-Math.sin(ai(n))/h*c+.5,z:0}}unproject(r,n){const{scale:c,cosPhi:h}=this,m=-(n-.5)/c,g=J(Xe((r-.5)/c)/h,-180,180),x=Math.asin(J(m*h,-1,1)),w=J(Xe(x),-fe,fe);return new R(g,w)}}class Ute extends e8{constructor(r){super(r),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(r,n,c){const h=N0(r,n,c);return sn(h,h,Cw(ou(c))),{x:h[0],y:h[1],z:h[2]}}locationPoint(r,n,c){const h=S(n.lat,n.lng),m=fr([],h),g=c?r._centerAltitude+c:r.elevation?r.elevation.getAtPointOrZero(r.locationCoordinate(n),r._centerAltitude):r._centerAltitude;gr(h,h,m,Z(1,0)*Vt*g);const x=pe(new Float64Array(16));return _e(x,r.pixelMatrix,r.globeMatrix),sn(h,h,x),new Tt(h[0],h[1])}pixelsPerMeter(r,n){return Z(1,0)*n}pixelSpaceConversion(r,n,c){const h=Z(1,r)*n,m=_r(Z(1,45)*n,h,c);return this.pixelsPerMeter(r,n)/m}createTileMatrix(r,n,c){const h=JI(ou(c.canonical));return _e(new Float64Array(16),r.globeMatrix,h)}createInversionMatrix(r,n){const{center:c}=r,h=Cw(ou(n));return et(h,h,ai(c.lng)),ot(h,h,ai(c.lat)),ke(h,h,[r._pixelsPerMercatorPixel,r._pixelsPerMercatorPixel,1]),Float32Array.from(h)}pointCoordinate(r,n,c,h){return AU(r,n,c,!0)||new ye(0,0)}pointCoordinate3D(r,n,c){const h=this.pointCoordinate(r,n,c,0);return[h.x,h.y,h.z]}isPointAboveHorizon(r,n){return!AU(r,n.x,n.y,!1)}farthestPixelDistance(r){const n=function(h,m){const g=h.cameraToCenterDistance,x=h._centerAltitude*m,w=h._camera,E=h._camera.forward(),I=He([],jt([],E,-g),[0,0,x]),A=h.worldSize/(2*Math.PI),P=[0,0,-A],D=h.width/h.height,O=Math.tan(h.fovAboveCenter),V=jt([],w.up(),O),j=jt([],w.right(),O*D),X=fr([],He([],He([],E,V),j)),oe=[];let ne;if(new mi(I,X).closestPointOnSphere(P,A,oe)){const ae=He([],oe,P),Ie=Xr([],ae,I);ne=Math.cos(h.fovAboveCenter)*Fe(Ie)}else{const ae=Xr([],I,P),Ie=Xr([],P,I);fr(Ie,Ie);const be=Fe(ae)-A;ne=Math.sqrt(be*(be+2*A));const Te=Math.acos(ne/(A+be))-Math.acos(Ur(E,Ie));ne*=Math.cos(Te)}return 1.01*ne}(r,this.pixelsPerMeter(r.center.lat,r.worldSize)),c=bd(r.zoom);if(c>0){const h=J6(r,Z(1,r.center.lat)*r.worldSize),m=r.worldSize/(2*Math.PI),g=Math.max(r.width,r.height)/r.worldSize*Math.PI;return _r(n,h+m*(1-Math.cos(g)),Math.pow(c,10))}return n}upVector(r,n,c){return N0(n,c,r,1)}upVectorScale(r){return{metersToTile:Tw(Sw(ou(r)))}}}function n8(a){const r=a.parallels,n=!!r&&Math.abs(r[0]+r[1])<.01;
vendor: 3,930 bytes, line 66
66switch(a.name){case"mercator":return new e8(a);case"equirectangular":return new Fte(a);case"naturalEarth":return new Bte(a);case"equalEarth":return new Ote(a);case"winkelTripel":return new Vte(a);case"albers":return n?new i8(a):new Dte(a);case"lambertConformalConic":return n?new i8(a):new Nte(a);case"globe":return new Ute(a)}throw new Error(`Invalid projection name: ${a.name}`)}const jte=Ke.types,Gte=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Jw(a,r,n,c,h,m,g,x,w,E,I,A,P){const D=x?Math.min(Cd,Math.round(x[0])):0,O=x?Math.min(Cd,Math.round(x[1])):0;a.emplaceBack(r,n,Math.round(32*c),Math.round(32*h),m,g,(D<<1)+(w?1:0),O,16*E,16*I,256*A,256*P)}function Qw(a,r,n){a.emplaceBack(r,n)}function e2(a,r,n,c,h,m,g){a.emplaceBack(r,n,c,h,m,g)}const t2=(a,r,n,c)=>{for(let h=0;h<r;h++)a.emplaceBack(n[0],n[1],n[2],c[0],c[1],c[2])};function r2(a,r,n,c,h){a.emplaceBack(r,n,c,h),a.emplaceBack(r,n,c,h),a.emplaceBack(r,n,c,h),a.emplaceBack(r,n,c,h)}function $te(a){for(const r of a.sections)if(FI(r.text))return!0;return!1}class $A{constructor(r){this.layoutVertexArray=new rg,this.indexArray=new gn,this.programConfigurations=r,this.segments=new xn,this.dynamicLayoutVertexArray=new ru,this.opacityVertexArray=new b0,this.placedSymbolArray=new Zf,this.iconTransitioningVertexArray=new Dl,this.globeExtVertexArray=new dd,this.zOffsetVertexArray=new Zu,this.orientationVertexArray=new E0}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(r,n,c,h,m){this.isEmpty()||(c&&(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,Xee.members),this.indexBuffer=r.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=r.createVertexBuffer(this.dynamicLayoutVertexArray,Kee.members,!0),this.opacityVertexBuffer=r.createVertexBuffer(this.opacityVertexArray,Gte,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=r.createVertexBuffer(this.iconTransitioningVertexArray,ete.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,Yee.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||m)&&(this.zOffsetVertexBuffer=r.createVertexBuffer(this.zOffsetVertexArray,Jee.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=r.createVertexBuffer(this.orientationVertexArray,Qee.members,!0)),this.opacityVertexBuffer.itemSize=1),(c||h)&&this.programConfigurations.upload(r))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Jt($A,"SymbolBuffers");class HA{constructor(r,n,c){this.layoutVertexArray=new r,this.layoutAttributes=n,this.indexArray=new c,this.segments=new xn,this.collisionVertexArray=new pd,this.collisionVertexArrayExt=new ru}upload(r){this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=r.createVertexBuffer(this.collisionVertexArray,tte.members,!0),this.collisionVertexBufferExt=r.createVertexBuffer(this.collisionVertexArrayExt,rte.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
66stroy())}}Jt(HA,"CollisionBuffers");class i2{constructor(r){this.collisionBoxArray=r.collisionBoxArray,this.zoom=r.zoom,this.lut=r.lut,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(g=>g.fqid),this.index=r.index,this.pixelRatio=r.pixelRatio,this.sourceLayerIndex=r.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=pe([]),this.placementViewportMatrix=pe([]);const n=this.layers[0]._unevaluatedLayout._values;this.worldview=r.worldview,this.textSizeData=L6(this.zoom,n["text-size"],this.worldview),this.iconSizeData=L6(this.zoom,n["icon-size"],this.worldview);const c=this.layers[0].layout,h=c.get("symbol-sort-key"),m=c.get("symbol-z-order");this.canOverlap=c.get("text-allow-overlap")||c.get("icon-allow-overlap")||c.get("text-ignore-placement")||c.get("icon-ignore-placement"),this.sortFeaturesByKey=m!=="viewport-y"&&h.constantOr(1)!==void 0,this.sortFeaturesByY=(m==="viewport-y"||m==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=c.get("text-writing-mode").map(g=>wa[g]),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.sourceID=r.sourceID,this.projection=r.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1}createArrays(){this.text=new $A(new ga(this.layers,{zoom:this.zoom,lut:this.lut},r=>r.startsWith("text")||r.startsWith("symbol"))),this.icon=new $A(new ga(this.layers,{zoom:this.zoom,lut:this.lut},r=>r.startsWith("icon")||r.startsWith("symbol"))),this.glyphOffsetArray=new R0,this.lineVertexArray=new hw,this.symbolInstances=new uw}calculateGlyphDependencies(r,n,c,h,m){for(const g of r){const x=g.codePointAt(0);if(x===void 0)break;if(n[x]=!0,h&&m&&x<=65535){const w=iv[g];w&&(n[w.charCodeAt(0)]=!0)}}}updateFootprints(r,n){}updateReplacement(r,n){if(n.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=n.updateTime;const c=n.getReplacementRegionsForTile(r.toUnwrapped(),!0);return!Rw(this.activeReplacements,c)&&(this.activeReplacements=c,!0)}populate(r,n,c,h){const m=this.layers[0],g=m.layout,x=this.projection.name==="globe",w=g.get("text-font"),E=g.get("text-field"),I=g.get("icon-image"),[A,P]=g.get("icon-size-scale-range"),D=J(n.scaleFactor||1,A,P),O=(E.value.kind!=="constant"||E.value.value instanceof ds&&!E.value.value.isEmpty()||E.value.value.toString().length>0)&&(w.value.kind!=="constant"||w.value.value.length>0),V=I.value.kind!=="constant"||!!I.value.value||Object.keys(I.parameters).length>0,j=g.get("symbol-sort-key");if(this.features=[],!O&&!V)return;const X=n.iconDependencies,oe=n.glyphDependencies,ne=n.availableImages,ae=new Ni(this.zoom,{worldview:this.worldview});for(const{feature:Ie,id:be,index:Te,sourceLayerIndex:Le}of r){const De=m._featureFilter.needGeometry,lt=nt(Ie,De);if(!m._featureFilter.filter(ae,lt,c))continue;if(De||(lt.geometry=Pe(Ie,c,h)),x&&Ie.type!==1&&c.z<=5){const St=lt.geometry,kt=.98078528056,st=(Ct,$e)=>Ur(N0(Ct.x,Ct.y,c,1),N0($e.x,$e.y,c,1))<kt;for(let Ct=0;Ct<St.length;Ct++)St[Ct]=Qe(St[Ct],st)}let je,ht;if(O){const St=m.getValueAndResolveTokens("text-field",lt,c,ne),kt=ds.factory(St);$te(kt)&&(this.hasRTLText=!0),(!this.hasRTLText||p0()==="unavailable"||this.hasRTLText&&Ll.isParsed())&&(je=nte(kt,m,lt))}if(V){const St=m.getValueAndResolveTokens("icon-image",lt,c,ne);ht=typeof St=="string"?Cs.build(St):St}if(!je&&!ht)continue;const Lt=this.sortFeaturesByKey?j.evaluate(lt,{},c):void 0,gt={id:be,text:je,icon:ht,index:Te,sourceLayerIndex:Le,geometry:lt.geometry,properties:Ie.properties,type:jte[Ie.type],sortKey:Lt};if(this.features.push(gt),ht){const St=this.layers[0]._unevaluatedLayout._values,{iconPrimary:kt,iconSecondary:st}=W6(ht,this.iconSizeData,St["icon-size"],c,this.zoom,gt,this.pixelRatio,D,this.worldview),Ct=kt.id.toString();if(X.has(Ct)?X.get(Ct).push(kt):X.set(Ct,[kt]),st){this.hasAnySecondaryIcon=!0;const $e=st.id.toString();X.has($e)?X.get($e).push(st):X.set($e,[st])}}if(je){const St=w.evaluate(lt,{},c).join(","),kt=g.get("text-rotation-alignment")==="map"&&g.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(wa.vertical)>=0;for(const st of je.sections)if(st.image){const Ct=st.image.getPrimary().scaleSelf(this.pixelRatio),$e=Ct.id.toString(),at=X.get($e)||[];at.push(Ct),X.set($e,at)}else{const Ct=u0(je.toString()),$e=st.fontStack||St,at=oe[$e]=oe[$e]||{};this.calculateGlyphDependencies(st.text,at,kt,this.allowVerticalPlacement,Ct)}}}if(g.get("symbol-placement")==="line"&&(this.features=function(Ie){const be={},Te={},Le=[];let De=0;function lt(gt){Le.push(Ie[gt]),De++}function je(gt,St,kt){const st=Te[gt];return delete Te[gt],Te[St]=st,Le[st].geometry[0].pop(),Le[st].geometry[0]=Le[st].geometry[0].concat(kt[0]),st}function ht(gt,St,kt){const st=be[St];return delete be[St],be[gt]=st,Le[st].geometry[0].shift(),Le[st].geometry[0]=kt[0].concat(Le[st].geometry[0]),st}function Lt(gt,St,kt){const st=kt?St[0][St[0].length-1]:St[0][0];return`${gt}:${st.x}:${st.y}`}for(let gt=0;gt<Ie.length;gt++){const St=Ie[gt],kt=St.geometry,st=St.text?St.text.toString():null;if(!st){lt(gt);continue}const Ct=Lt(st,kt),$e=Lt(st,kt,!0);if(Ct in Te&&$e in be&&Te[Ct]!==be[$e]){const at=ht(Ct,$e,kt),Dt=je(Ct,$e,Le[at].geometry);delete be[Ct],delete Te[$e],Te[Lt(st,Le[Dt].geometry,!0)]=Dt,Le[at].geometry=null}else Ct in Te?je(Ct,$e,kt):$e in be?ht(Ct,$e,kt):(lt(gt),be[Ct]=De-1,Te[$e]=De-1)}return Le.filter(gt=>gt.geometry)}(this.features)),g.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",n.elevationFeatures){!this.elevationFeatures&&n.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const Ie of n.elevationFeatures)this.elevationFeatureIdToIndex.set(Ie.id,this.elevationFeatures.length),this.elevationFeatures.push(Ie)}}else g.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((Ie,be)=>
66Ie.sortKey-be.sortKey)}update(r,n,c,h,m,g,x){this.text.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x,this.worldview),this.icon.programConfigurations.updatePaintArrays(r,n,m,c,h,g,x,this.worldview)}updateRoadElevation(r){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let n=!1;const c=ge(r),h=1/c;let m=!1,g=!1;for(let x=0;x<this.symbolInstances.length;x++){const w=this.symbolInstances.get(x),E=Je(1,0,0),I=Je(0,1,0),{numHorizontalGlyphVertices:A,numVerticalGlyphVertices:P,numIconVertices:D,numVerticalIconVertices:O}=w,V=A>0||P>0,j=D>0,X=this.elevationFeatures[w.elevationFeatureIndex];if(X){const oe=new Tt(w.tileAnchorX,w.tileAnchorY),ne=.075+X.pointElevation(oe);w.zOffset!==ne&&(n=!0,w.zOffset=ne);const ae=X.computeSlopeNormal(oe,h),Ie=lr(aa(),Je(0,0,1),ae);So(E,E,Ie),So(I,I,Ie),E[2]*=c,I[2]*=c,E[0]===1&&E[1]===0&&E[2]===0&&I[0]===0&&I[1]===1&&I[2]===0||(m=m||V,g=g||j)}if(V&&(t2(this.text.orientationVertexArray,A,E,I),t2(this.text.orientationVertexArray,P,E,I)),j){const{placedIconSymbolIndex:oe,verticalPlacedIconSymbolIndex:ne}=w;oe>=0&&t2(this.icon.orientationVertexArray,D,E,I),ne>=0&&t2(this.icon.orientationVertexArray,O,E,I)}}m||(this.text.orientationVertexArray=void 0),g||(this.icon.orientationVertexArray=void 0),n&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const r=(m,g,x)=>{c+=g,c>m.length&&m.resize(c);for(let w=-g;w<0;w++)m.emplace(w+c,x)},n=(m,g,x)=>{h+=g,h>m.length&&m.resize(h);for(let w=-g;w<0;w++)m.emplace(w+h,x)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let c=0,h=0;for(let m=0;m<this.symbolInstances.length;m++){const g=this.symbolInstances.get(m),{numHorizontalGlyphVertices:x,numVerticalGlyphVertices:w,numIconVertices:E}=g,I=g.zOffset,A=E>0;if((x>0||w>0)&&(r(this.text.zOffsetVertexArray,x,I),r(this.text.zOffsetVertexArray,w,I)),A){const{placedIconSymbolIndex:P,verticalPlacedIconSymbolIndex:D}=g;P>=0&&n(this.icon.zOffsetVertexArray,E,I),D>=0&&n(this.icon.zOffsetVertexArray,g.numVerticalIconVertices,I)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(r){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(r),this.iconCollisionBox.upload(r)),this.text.upload(r,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(r,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=n8(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(r,n){const c=this.lineVertexArray.length;if(r.segment!==void 0)for(const{x:h,y:m}of n)this.lineVertexArray.emplaceBack(h,m);return{lineStartIndex:c,lineLength:this.lineVertexArray.length-c}}addSymbols(r,n,c,h,m,g,x,w,E,I,A,P,D,O,V,j){const X=r.indexArray,oe=r.layoutVertexArray,ne=r.globeExtVertexArray,ae=r.segments.prepareSegment(4*n.length,oe,X,this.canOverlap?g.sortKey:void 0),Ie=this.glyphOffsetArray.length,be=ae.vertexLength,Te=this.allowVerticalPlacement&&x===wa.vertical?Math.PI/2:0,Le=g.text&&g.text.sections;for(let lt=0;lt<n.length;lt++){const{tl:je,tr:ht,bl:Lt,br:gt,texPrimary:St,texSecondary:kt,pixelOffsetTL:st,pixelOffsetBR:Ct,minFontScaleX:$e,minFontScaleY:at,glyphOffset:Dt,isSDF:At,sectionIndex:sr}=n[lt],Qt=ae.vertexLength,bt=Dt[1];if(Jw(oe,E.x,E.y,je.x,bt+je.y,St.x,St.y,c,At,st.x,st.y,$e,at),Jw(oe,E.x,E.y,ht.x,bt+ht.y,St.x+St.w,St.y,c,At,Ct.x,st.y,$e,at),Jw(oe,E.x,E.y,Lt.x,bt+Lt.y,St.x,St.y+St.h,c,At,st.x,Ct.y,$e,at),Jw(oe,E.x,E.y,gt.x,bt+gt.y,St.x+St.w,St.y+St.h,c,At,Ct.x,Ct.y,$e,at),w){const{x:Pt,y:rr,z:Wt}=w.anchor,[Ut,Xt,xr]=w.up;
vendor: 7,566 bytes, line 66
66e2(ne,Pt,rr,Wt,Ut,Xt,xr),e2(ne,Pt,rr,Wt,Ut,Xt,xr),e2(ne,Pt,rr,Wt,Ut,Xt,xr),e2(ne,Pt,rr,Wt,Ut,Xt,xr),r2(r.dynamicLayoutVertexArray,Pt,rr,Wt,Te)}else r2(r.dynamicLayoutVertexArray,E.x,E.y,E.z,Te);if(j){const Pt=kt||St;Qw(r.iconTransitioningVertexArray,Pt.x,Pt.y),Qw(r.iconTransitioningVertexArray,Pt.x+Pt.w,Pt.y),Qw(r.iconTransitioningVertexArray,Pt.x,Pt.y+Pt.h),Qw(r.iconTransitioningVertexArray,Pt.x+Pt.w,Pt.y+Pt.h)}X.emplaceBack(Qt,Qt+1,Qt+2),X.emplaceBack(Qt+1,Qt+2,Qt+3),ae.vertexLength+=4,ae.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Dt[0]),lt!==n.length-1&&sr===n[lt+1].sectionIndex||r.programConfigurations.populatePaintArrays(oe.length,g,g.index,{},D,O,V,Le&&Le[sr],this.worldview)}const De=w?w.anchor:E;r.placedSymbolArray.emplaceBack(De.x,De.y,De.z,E.x,E.y,Ie,this.glyphOffsetArray.length-Ie,be,I,A,E.segment,c?c[0]:0,c?c[1]:0,h[0],h[1],x,0,0,0,P,0)}_commitLayoutVertex(r,n,c,h,m,g,x){r.emplaceBack(n,c,h,m,g,Math.round(x.x),Math.round(x.y))}_addCollisionDebugVertices(r,n,c,h,m,g,x){const w=c.segments.prepareSegment(4,c.layoutVertexArray,c.indexArray),E=w.vertexLength,I=x.tileAnchorX,A=x.tileAnchorY;for(let D=0;D<4;D++)c.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(c.collisionVertexArrayExt,n,r.padding,x.zOffset),this._commitLayoutVertex(c.layoutVertexArray,h,m,g,I,A,new Tt(r.x1,r.y1)),this._commitLayoutVertex(c.layoutVertexArray,h,m,g,I,A,new Tt(r.x2,r.y1)),this._commitLayoutVertex(c.layoutVertexArray,h,m,g,I,A,new Tt(r.x2,r.y2)),this._commitLayoutVertex(c.layoutVertexArray,h,m,g,I,A,new Tt(r.x1,r.y2)),w.vertexLength+=4;const P=c.indexArray;P.emplaceBack(E,E+1),P.emplaceBack(E+1,E+2),P.emplaceBack(E+2,E+3),P.emplaceBack(E+3,E),w.primitiveLength+=4}_addTextDebugCollisionBoxes(r,n,c,h,m,g){for(let x=h;x<m;x++){const w=c.get(x),E=this.getSymbolInstanceTextSize(r,g,n,x);this._addCollisionDebugVertices(w,E,this.textCollisionBox,w.projectedAnchorX,w.projectedAnchorY,w.projectedAnchorZ,g)}}_addIconDebugCollisionBoxes(r,n,c,h,m,g){for(let x=h;x<m;x++){const w=c.get(x),E=this.getSymbolInstanceIconSize(r,n,g.placedIconSymbolIndex);this._addCollisionDebugVertices(w,E,this.iconCollisionBox,w.projectedAnchorX,w.projectedAnchorY,w.projectedAnchorZ,g)}}generateCollisionDebugBuffers(r,n,c){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new HA(ig,y6.members,Dl),this.iconCollisionBox=new HA(ig,y6.members,Dl);const h=ov(this.iconSizeData,r),m=ov(this.textSizeData,r,c);for(let g=0;g<this.symbolInstances.length;g++){const x=this.symbolInstances.get(g);this._addTextDebugCollisionBoxes(m,r,n,x.textBoxStartIndex,x.textBoxEndIndex,x),this._addTextDebugCollisionBoxes(m,r,n,x.verticalTextBoxStartIndex,x.verticalTextBoxEndIndex,x),this._addIconDebugCollisionBoxes(h,r,n,x.iconBoxStartIndex,x.iconBoxEndIndex,x),this._addIconDebugCollisionBoxes(h,r,n,x.verticalIconBoxStartIndex,x.verticalIconBoxEndIndex,x)}}getSymbolInstanceTextSize(r,n,c,h){const m=this.text.placedSymbolArray.get(n.rightJustifiedTextSymbolIndex>=0?n.rightJustifiedTextSymbolIndex:n.centerJustifiedTextSymbolIndex>=0?n.centerJustifiedTextSymbolIndex:n.leftJustifiedTextSymbolIndex>=0?n.leftJustifiedTextSymbolIndex:n.verticalPlacedTextSymbolIndex>=0?n.verticalPlacedTextSymbolIndex:h),g=FA(this.textSizeData,r,m)/Po;return this.tilePixelRatio*g}getSymbolInstanceIconSize(r,n,c){const h=this.icon.placedSymbolArray.get(c),m=FA(this.iconSizeData,r,h);return this.tilePixelRatio*m}_commitDebugCollisionVertexUpdate(r,n,c,h){r.emplaceBack(n,-c,-c,h),r.emplaceBack(n,c,-c,h),r.emplaceBack(n,c,c,h),r.emplaceBack(n,-c,c,h)}_updateTextDebugCollisionBoxes(r,n,c,h,m,g,x){for(let w=h;w<m;w++){const E=c.get(w),I=this.getSymbolInstanceTextSize(r,g,n,w);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,I,E.padding,g.zOffset)}}_updateIconDebugCollisionBoxes(r,n,c,h,m,g,x){for(let w=h;w<m;w++){const E=c.get(w),I=this.getSymbolInstanceIconSize(r,n,g.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,I,E.padding,g.zOffset)}}updateCollisionDebugBuffers(r,n,c,h){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const m=ov(this.iconSizeData,r,h),g=ov(this.textSizeData,r,c);for(let x=0;x<this.symbolInstances.length;x++){const w=this.symbolInstances.get(x);this._updateTextDebugCollisionBoxes(g,r,n,w.textBoxStartIndex,w.textBoxEndIndex,w,c),this._updateTextDebugCollisionBoxes(g,r,n,w.verticalTextBoxStartIndex,w.verticalTextBoxEndIndex,w,c),this._updateIconDebugCollisionBoxes(m,r,n,w.iconBoxStartIndex,w.iconBoxEndIndex,w,h),this._updateIconDebugCollisionBoxes(m,r,n,w.verticalIconBoxStartIndex,w.verticalIconBoxEndIndex,w,h)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(r,n,c,h,m,g,x,w,E){const I={};if(n<c){const{x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae,featureIndex:Ie}=r.get(n);I.textBox={x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae},I.textFeatureIndex=Ie}if(h<m){const{x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae,featureIndex:Ie}=r.get(h);I.verticalTextBox={x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae},I.verticalTextFeatureIndex=Ie}if(g<x){const{x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae,featureIndex:Ie}=r.get(g);I.iconBox={x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae},I.iconFeatureIndex=Ie}if(w<E){const{x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae,featureIndex:Ie}=r.get(w);I.verticalIconBox={x1:A,y1:P,x2:D,y2:O,padding:V,projectedAnchorX:j,projectedAnchorY:X,projectedAnchorZ:oe,tileAnchorX:ne,tileAnchorY:ae},I.verticalIconFeatureIndex=Ie}return I}deserializeCollisionBoxes(r){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const c=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(r,c.textBoxStartIndex,c.textBoxEndIndex,c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c.iconBoxStartIndex,c.iconBoxEndIndex,c.verticalIconBoxStartIndex,c.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(r,n){const c=r.placedSymbolArray.get(n),h=c.vertexStartIndex+4*c.numGlyphs;for(let m=c.vertexStartIndex;m<h;m+=4)r.indexArray.emplaceBack(m,m+1,m+2),r.indexArray.emplaceBack(m+1,m+2,m+3)}
vendor: 11,469 bytes, line 66
66getSortedSymbolIndexes(r){if(this.sortedAngle===r&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const n=Math.sin(r),c=Math.cos(r),h=[],m=[],g=[];for(let x=0;x<this.symbolInstances.length;++x){g.push(x);const w=this.symbolInstances.get(x);h.push(0|Math.round(n*w.tileAnchorX+c*w.tileAnchorY)),m.push(w.featureIndex)}return g.sort((x,w)=>h[x]-h[w]||m[w]-m[x]),g}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let r=0;r<this.symbolInstances.length;++r)this.symbolInstanceIndexesSortedZOffset.push(r)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((r,n)=>this.symbolInstances.get(n).zOffset-this.symbolInstances.get(r).zOffset)}addToSortKeyRanges(r,n){const c=this.sortKeyRanges[this.sortKeyRanges.length-1];c&&c.sortKey===n?c.symbolInstanceEnd=r+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:r+1})}sortFeatures(r){if(this.sortFeaturesByY&&this.sortedAngle!==r&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(r),this.sortedAngle=r,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const c=this.symbolInstances.get(n);this.featureSortOrder.push(c.featureIndex);const{rightJustifiedTextSymbolIndex:h,centerJustifiedTextSymbolIndex:m,leftJustifiedTextSymbolIndex:g,verticalPlacedTextSymbolIndex:x,placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:E}=c;h>=0&&this.addIndicesForPlacedSymbol(this.text,h),m>=0&&m!==h&&this.addIndicesForPlacedSymbol(this.text,m),g>=0&&g!==m&&g!==h&&this.addIndicesForPlacedSymbol(this.text,g),x>=0&&this.addIndicesForPlacedSymbol(this.text,x),w>=0&&this.addIndicesForPlacedSymbol(this.icon,w),E>=0&&this.addIndicesForPlacedSymbol(this.icon,E)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let o8,s8,qA;Jt(i2,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),i2.addDynamicAttributes=r2;class a8{constructor(r){this.type=r.property.overrides?r.property.overrides.runtimeType:$h,this.defaultValue=r}evaluate(r){if(r.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(r.formattedSection))return n.getOverride(r.formattedSection)}return r.feature&&r.featureState?this.defaultValue.evaluate(r.feature,r.featureState):this.defaultValue.property.specification.default}eachChild(r){this.defaultValue.isConstant()||r(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Jt(a8,"FormatSectionOverride",{omit:["defaultValue"]});const ZA=()=>qA||(qA={layout:o8||(o8=new Ln({"symbol-placement":new zt(Ue.layout_symbol["symbol-placement"]),"symbol-spacing":new zt(Ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new zt(Ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new qt(Ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new zt(Ue.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new zt(Ue.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new zt(Ue.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new zt(Ue.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new zt(Ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new zt(Ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new zt(Ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new qt(Ue.layout_symbol["icon-size"]),"icon-size-scale-range":new zt(Ue.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new qt(Ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qt(Ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new qt(Ue.layout_symbol["icon-image"]),"icon-rotate":new qt(Ue.layout_symbol["icon-rotate"]),"icon-padding":new zt(Ue.layout_symbol["icon-padding"]),"icon-keep-upright":new zt(Ue.layout_symbol["icon-keep-upright"]),"icon-offset":new qt(Ue.layout_symbol["icon-offset"]),"icon-anchor":new qt(Ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new zt(Ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new zt(Ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new zt(Ue.layout_symbol["text-rotation-alignment"]),"text-field":new qt(Ue.layout_symbol["text-field"]),"text-font":new qt(Ue.layout_symbol["text-font"]),"text-size":new qt(Ue.layout_symbol["text-size"]),"text-size-scale-range":new zt(Ue.layout_symbol["text-size-scale-range"]),"text-max-width":new qt(Ue.layout_symbol["text-max-width"]),"text-line-height":new qt(Ue.layout_symbol["text-line-height"]),"text-letter-spacing":new qt(Ue.layout_symbol["text-letter-spacing"]),"text-justify":new qt(Ue.layout_symbol["text-justify"]),"text-radial-offset":new qt(Ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new zt(Ue.layout_symbol["text-variable-anchor"]),"text-anchor":new qt(Ue.layout_symbol["text-anchor"]),"text-max-angle":new zt(Ue.layout_symbol["text-max-angle"]),"text-writing-mode":new zt(Ue.layout_symbol["text-writing-mode"]),"text-rotate":new qt(Ue.layout_symbol["text-rotate"]),"text-padding":new zt(Ue.layout_symbol["text-padding"]),"text-keep-upright":new zt(Ue.layout_symbol["text-keep-upright"]),"text-transform":new qt(Ue.layout_symbol["text-transform"]),"text-offset":new qt(Ue.layout_symbol["text-offset"]),"text-allow-overlap":new zt(Ue.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new zt(Ue.layout_symbol["text-ignore-placement"]),"text-optional":new zt(Ue.layout_symbol["text-optional"]),visibility:new zt(Ue.layout_symbol.visibility)})),paint:s8||(s8=new Ln({"icon-opacity":new qt(Ue.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new qt(Ue.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new qt(Ue.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new qt(Ue.paint_symbol["text-emissive-strength"]),"icon-color":new qt(Ue.paint_symbol["icon-color"]),"icon-halo-color":new qt(Ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new qt(Ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qt(Ue.paint_symbol["icon-halo-blur"]),"icon-translate":new zt(Ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new zt(Ue.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new zt(Ue.paint_symbol["icon-image-cross-fade"]),"text-opacity":new qt(Ue.paint_symbol["text-opacity"]),"text-occlusion-opacity":new qt(Ue.paint_symbol["text-occlusion-opacity"]),"text-color":new qt(Ue.paint_symbol["text-color"],{runtimeType:Hs,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new qt(Ue.paint_symbol["text-halo-color"]),"text-halo-width":new qt(Ue.paint_symbol["text-halo-width"]),"text-halo-blur":new qt(Ue.paint_symbol["text-halo-blur"]),"text-translate":new zt(Ue.paint_symbol["text-translate"]),"text-translate-anchor":new zt(Ue.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new zt(Ue.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new zt(Ue.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new zt(Ue.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new zt(Ue.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new qt(Ue.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},qA);class n2 extends Qo{constructor(r,n,c,h){super(r,ZA(),n,c,h),this._colorAdjustmentMatrix=pe([]),this.hasInitialOcclusionOpacityProperties=r.paint!==void 0&&("icon-occlusion-opacity"in r.paint||"text-occlusion-opacity"in r.paint)}recalculate(r,n){super.recalculate(r,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const c=this.layout.get("text-writing-mode");if(c){const h=[];for(const m of c)h.indexOf(m)<0&&h.push(m);this.layout._values["text-writing-mode"]=h}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(r,n,c,h){return this._saturation===r&&this._contrast===n&&this._brightnessMin===c&&this._brightnessMax===h||(this._colorAdjustmentMatrix=function(m,g,x,w){m=po(m),g=Jn(g);const E=xe(),I=m/3,A=1-2*I,P=[A,I,I,0,I,A,I,0,I,I,A,0,0,0,0,1],D=.5-.5*g,O=w-x;return _e(E,[O,0,0,0,0,O,0,0,0,0,O,0,x,x,x,1],[g,0,0,0,0,g,0,0,0,0,g,0,D,D,D,1]),_e(E,E,P),E}(r,n,c,h),this._saturation=r,this._contrast=n,this._brightnessMin=c,this._brightnessMax=h),this._colorAdjustmentMatrix}getValueAndResolveTokens(r,n,c,h){const m=this.layout.get(r).evaluate(n,{},c,h),g=this._unevaluatedLayout._values[r];return g.isDataDriven()||s0(g.value)||!m?m:function(x,w){return w.replace(/{([^{}]+)}/g,(E,I)=>I in x?String(x[I]):"")}(n.properties,m)}createBucket(r){return new i2(r)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const r of ZA().paint.overridableProperties){if(!n2.hasPaintOverride(this.layout,r))continue;const n=this.paint.get(r),c=new a8(n),h=new o0(c,n.property.specification,this.scope,this.options);let m=null;m=n.value.kind==="constant"||n.value.kind==="source"?new $m("source",h):new Kc("composite",h,n.value.zoomStops,n.value.interpolationType),this.paint._values[r]=new qu(n.property,m,n.parameters)}}_handleOverridablePaintPropertyUpdate(r,n,c){return!(!this.layout||n.isDataDriven()||c.isDataDriven())&&n2.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,n){const c=r.get("text-field"),h=ZA().paint.properties[n];let m=!1;const g=x=>{for(const w of x)if(h.overrides&&h.overrides.hasOverride(w))return void(m=!0)};if(c.value.kind==="constant"&&c.value.value instanceof ds)g(c.value.value.sections);else if(c.value.kind==="source"){const x=E=>{m||(E instanceof Cr&&Yt(E.value)===Ef?g(E.value.sections):E instanceof qh?g(E.sections):E.eachChild(x))},w=c.value;w._styleExpression&&x(w._styleExpression.expression)}return m}getProgramIds(){return["symbol"]}getDefaultProgramParams(r,n,c){return{config:new ms(this,{zoom:n,lut:c}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let l8,c8,u8,h8;var WA=si([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function o2(a,r,n,c,h,m,g,x){const w=[a,r,1,n,c,1,h,m,1],E=[g,x,1],I=$([],w),[A,P,D]=ao(E,E,I);return te(w,w,[A,0,0,0,P,0,0,0,D])}function d8(a,r,n,c,h,m,g,x){const w=function(E,I,A,P,D,O,V,j){const X=o2
vendor: 4,728 bytes, line 66
66(0,0,1,0,1,1,0,1),oe=o2(E,I,A,P,D,O,V,j);return te(oe,oe,$([],X))}(a,r,n,c,h,m,g,x);return[w[2]/w[8]/Vt,w[5]/w[8]/Vt]}function s2(a){return[a[0],Math.min(Math.max(a[1],-fe),fe)]}class f8 extends Du{constructor(r,n,c,h){super(),this.id=r,this.dispatcher=c,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(h),this.options=n,this._dirty=!1}load(r,n){if(this._loaded=n||!1,this.fire(new lc("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return r&&(this.coordinates=r),this._loaded=!0,void this._finishLoading();this._imageRequest=xf(this.map._requestManager.transformRequest(this.url,_f.Image),(c,h)=>{this._imageRequest=null,this._loaded=!0,c?this.fire(new ha(c)):h&&(this.image=h instanceof HTMLImageElement?ca.getImageData(h):h,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),this._finishLoading())})}loaded(){return this._loaded}updateImage(r){return r.url?(this._imageRequest&&r.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=r.url,this.load(r.coordinates,this._loaded),this):this}setTexture(r){if(!(r.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new ev(this.map.painter.context,r.handle),this.width=r.dimensions[0],this.height=r.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new lc("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(r){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof ev||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(r){if(this.coordinates=r,this._boundsArray=void 0,this._unsupportedCoords=!1,!r.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let n=r[0][1],c=r[0][1];for(const m of r)m[1]>c&&(c=m[1]),m[1]<n&&(n=m[1]);const h=(c+n)/2;if(h>fe?this.onNorthPole=!0:h<-fe&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const m=r.map(ye.fromLngLat);this.tileID=function(g){let x=1/0,w=1/0,E=-1/0,I=-1/0;for(const V of g)x=Math.min(x,V.x),w=Math.min(w,V.y),E=Math.max(E,V.x),I=Math.max(I,V.y);const A=Math.max(E-x,I-w),P=Math.max(0,Math.floor(-Math.log(A)/Math.LN2)),D=Math.pow(2,P);let O=Math.floor((x+E)/2*D);return O>1&&(O-=1),new va(P,O,Math.floor((w+I)/2*D))}(m),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new lc("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof ev||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(r){for(const X in this.tiles){const oe=this.tiles[X];oe.state!=="loaded"&&(oe.state="loaded",oe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const n=cv(new va(0,0,0),this.map.transform.projection),c=[n.projection.project(this.coordinates[0][0],this.coordinates[0][1]),n.projection.project(this.coordinates[1][0],this.coordinates[1][1]),n.projection.project(this.coordinates[2][0],this.coordinates[2][1]),n.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(X){const oe=X[1].x-X[0].x,ne=X[1].y-X[0].y,ae=X[2].x-X[1].x,Ie=X[2].y-X[1].y,be=X[3].x-X[2].x,Te=X[3].y-X[2].y,Le=X[0].x-X[3].x,De=X[0].y-X[3].y,lt=oe*Ie-ae*ne,je=ae*Te-be*Ie,ht=be*De-Le*Te,Lt=Le*ne-oe*De;return lt>0&&je>0&&ht>0&&Lt>0||lt<0&&je<0&&ht<0&&Lt<0}(c))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const h=cv(this.tileID,this.map.transform.projection),[m,g,x,w]=this.coordinates.map(X=>{const oe=h.projection.project(X[0],X[1]);return Q6(h,oe)._round()});this.perspectiveTransform=d8(m.x,m.y,g.x,g.y,x.x,x.y,w.x,w.y);const E=this._boundsArray=new ud;E.emplaceBack(m.x,m.y,0,0),E.emplaceBack(g.x,g.y,Vt,0),E.emplaceBack(w.x,w.y,0,Vt),E.emplaceBack(x.x,x.y,Vt,Vt),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=r.createVertexBuffer(E,WA.members),this.boundsSegments=xn.simpleSegment(0,0,4,2);const I=[],A=[s2((P=this.coordinates)[0]),s2(P[1]),s2(P[2]),s2(P[3])];var P;
vendor: 3,730 bytes, line 66
66const[D,O,V,j]=function(X){let oe=X[0][0],ne=oe,ae=X[0][1],Ie=ae;for(let be=1;be<X.length;be++)X[be][0]<oe?oe=X[be][0]:X[be][0]>ne&&(ne=X[be][0]),X[be][1]<ae?ae=X[be][1]:X[be][1]>Ie&&(Ie=X[be][1]);return[oe,ae,ne-oe,Ie-ae]}(A);{const X=new ud,[oe,ne,ae,Ie]=function(st){let Ct=st[0].x,$e=Ct,at=st[0].y,Dt=at;for(let At=1;At<st.length;At++)st[At].x<Ct?Ct=st[At].x:st[At].x>$e&&($e=st[At].x),st[At].y<at?at=st[At].y:st[At].y>Dt&&(Dt=st[At].y);return[Ct,at,$e-Ct,Dt-at]}(c),be=st=>[(st.x-oe)/ae,(st.y-ne)/Ie],[Te,Le,De,lt]=c.map(be),je=function(st,Ct,$e,at,Dt,At,sr,Qt){const bt=o2(0,0,1,0,1,1,0,1);return te(bt,bt,$([],o2(st,Ct,$e,at,Dt,At,sr,Qt)))}(Te[0],Te[1],Le[0],Le[1],De[0],De[1],lt[0],lt[1]);this.elevatedGlobePerspectiveTransform=d8(Te[0],Te[1],Le[0],Le[1],De[0],De[1],lt[0],lt[1]);const ht=(st,Ct)=>{I.push(st.lng);const $e=Math.round((st.lng-D)/V*Vt),at=Math.round((st.lat-O)/j*Vt),Dt=be(Ct),At=ao([],[Dt[0],Dt[1],1],je),sr=Math.round(At[0]/At[2]*Vt),Qt=Math.round(At[1]/At[2]*Vt);X.emplaceBack($e,at,sr,Qt)},Lt=c[3].x-c[0].x,gt=c[3].y-c[0].y,St=c[2].x-c[1].x,kt=c[2].y-c[1].y;for(let st=0;st<65;st++){const Ct=st/64,$e=[c[0].x+Ct*Lt,c[0].y+Ct*gt],at=[c[1].x+Ct*St,c[1].y+Ct*kt],Dt=at[0]-$e[0],At=at[1]-$e[1];for(let sr=0;sr<65;sr++){const Qt=sr/64,bt={x:$e[0]+Dt*Qt,y:$e[1]+At*Qt};ht(n.projection.unproject(bt.x,bt.y),bt)}}this.elevatedGlobeVertexBuffer=r.createVertexBuffer(X,WA.members)}{this.maxLongitudeTriangleSize=0;let X=[],oe=new gn;const ne=(ae,Ie,be)=>{oe.emplaceBack(ae,Ie,be);const Te=I[ae],Le=I[Ie],De=I[be],lt=Math.min(Math.min(Te,Le),De),je=Math.max(Math.max(Te,Le),De)-lt;je>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=je),X.push(lt+je/2)};for(let ae=0;ae<64;ae++)for(let Ie=0;Ie<64;Ie++){const be=65*ae+Ie,Te=be+1,Le=be+65,De=Le+1;ne(be,Le,Te),ne(Te,Le,De)}[X,oe]=function(ae,Ie){const be=Array.from({length:ae.length},(De,lt)=>lt);be.sort((De,lt)=>ae[De]-ae[lt]);const Te=[],Le=new gn;for(let De=0;De<be.length;De++){const lt=be[De];Te.push(ae[lt]);const je=3*lt,ht=je+1;Le.emplaceBack(Ie.uint16[je],Ie.uint16[ht],Ie.uint16[ht+1])}return[Te,Le]}(X,oe),this.elevatedGlobeTrianglesCenterLongitudes=X,this.elevatedGlobeIndexBuffer=r.createIndexBuffer(oe)}this.elevatedGlobeSegments=xn.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,V/Vt,0,j/Vt,0,0,O,D,0])}prepare(){const r=Object.keys(this.tiles).length!==0;if(this.tileID&&!r)return;const n=this.map.painter.context,c=n.gl;!this._dirty||this.texture instanceof ev||(this.texture?this.texture.update(this.image):(this.texture=new TA(n,this.image,c.RGBA8),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this._dirty=!1),r&&this._prepareData(n)}loadTile(r,n){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={},n(null)):(r.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(r){const n=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!n)return null;const c=this.elevatedGlobeTrianglesCenterLongitudes;let h=(m=r+180)+360*Math.round((c[0]-m)/360);var m;const g=new xn,x=(A,P)=>{g.segments.push({vertexOffset:0,primitiveOffset:A,vertexLength:n.segments[0].vertexLength,primitiveLength:P,sortKey:void 0,vaos:{}})},w=.51*this.maxLongitudeTriangleSize;if(Math.abs(c[0]-h)<=w){const A=Kn(c,0,c.length,h+w);return A===c.length||x(A,Li(c,A+1,c.length,h+360-w)-A),g}h<c[0]&&(h+=360);const E=Li(c,0,c.length,h-w);if(E===c.length)return x(0,c.length),g;x(0,E-0);const I=Kn(c,E+1,c.length,h+w);return I!==c.length&&x(I,c.length-I),g}}const Hte=(Math.pow(256,2)-1)/16907520;class p8 extends Qo{constructor(r,n,c,h){super(r,{layout:u8||(u8=ne
66w Ln({visibility:new zt(Ue.layout_raster.visibility)})),paint:h8||(h8=new Ln({"raster-opacity":new zt(Ue.paint_raster["raster-opacity"]),"raster-color":new od(Ue.paint_raster["raster-color"]),"raster-color-mix":new zt(Ue.paint_raster["raster-color-mix"]),"raster-color-range":new zt(Ue.paint_raster["raster-color-range"]),"raster-hue-rotate":new zt(Ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new zt(Ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new zt(Ue.paint_raster["raster-brightness-max"]),"raster-saturation":new zt(Ue.paint_raster["raster-saturation"]),"raster-contrast":new zt(Ue.paint_raster["raster-contrast"]),"raster-resampling":new zt(Ue.paint_raster["raster-resampling"]),"raster-fade-duration":new zt(Ue.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new zt(Ue.paint_raster["raster-emissive-strength"]),"raster-array-band":new zt(Ue.paint_raster["raster-array-band"]),"raster-elevation":new zt(Ue.paint_raster["raster-elevation"]),"raster-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},n,c,h),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(r){return!(r&&r._source instanceof f8&&(r._source.onNorthPole||r._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(r){r!=="raster-color"&&r!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(r){if(!this.hasColorMap()||!this._curRampRange)return;const n=this._transitionablePaint._values["raster-color"].value.expression,[c,h]=r||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(c)&&isNaN(h)||c===this._curRampRange[0]&&h===this._curRampRange[1]||(this.colorRamp=B0({expression:n,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:c,end:h}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[c,h])}}let m8,g8,_8,y8,v8;class x8 extends Qo{constructor(r,n,c,h){super(r,{layout:m8||(m8=new Ln({visibility:new zt(Ue["layout_raster-particle"].visibility)})),paint:g8||(g8=new Ln({"raster-particle-array-band":new zt(Ue["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new zt(Ue["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new od(Ue["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new zt(Ue["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new zt(Ue["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new zt(Ue["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new zt(Ue["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new zt(Ue["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},n,c,h),this._updateColorRamp(),this.lastInvalidatedAt=ca.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(r){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(r){return!1}_handleSpecialPaintPropertyUpdate(r){r!=="raster-particle-color"&&r!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),r==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const r=this._transitionablePaint._values["raster-particle-color"].value.expression,n=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=B0({expression:r,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:n}],resolution:256}),this.colorRampTexture=null}
66_invalidateAnimationState(){this.lastInvalidatedAt=ca.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class qte extends Qo{constructor(r,n){super(r,{},n,null),this.implementation=r,r.slot&&(this.slot=r.slot)}is3D(r){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(r){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(r){this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)}onRemove(r){this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)}}function XA(a,r,n){const c=[0,0,1],h=za([]);return qe(h,h,n?-ai(a)+Math.PI:ai(a)),Da(h,h,-ai(r)),So(c,c,h),fr(c,c)}const b8={None:0,Model:1,Symbol:2,FillExtrusion:4};class a2{constructor(r,n,c,h){this.message=(r?`${r}: `:"")+c,h&&(this.identifier=h),n!=null&&n.__line__&&(this.line=n.__line__)}}function YA(a,r){const n=a.indexOf("://")===-1;try{return new URL(a,n&&r?"http://example.com":void 0),!0}catch{return!1}}class w8{constructor(r,n){this.feature=r,this.instancedDataOffset=n,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class T8{constructor(){this.instancedDataArray=new ng,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class KA{constructor(r){this.zoom=r.zoom,this.canonical=r.canonical,this.layers=r.layers,this.layerIds=this.layers.map(n=>n.fqid),this.projection=r.projection,this.index=r.index,this.worldview=r.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=r.styleDefinedModelURLs}updateFootprints(r,n){}populate(r,n,c,h){this.tileToMeter=ge(c);const m=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of r){const I=x??(g.properties&&g.properties.hasOwnProperty("id")?g.properties.id:void 0),A=nt(g,m);if(!this.layers[0]._featureFilter.filter(new Ni(this.zoom,{worldview:this.worldview}),A,c))continue;const P={id:I,sourceLayerIndex:E,index:w,geometry:m?A.geometry:Pe(g,c,h),properties:g.properties,type:g.type,patterns:{}},D=this.addFeature(P,P.geometry,A);D&&n.featureIndex.insert(g,P.geometry,w,E,this.index,this.instancesPerModel[D].instancedDataArray.length,Vt/32)}this.lookup=null}update(r,n,c,h){for(const m in this.instancesPerModel){const g=this.instancesPerModel[m];for(const x in r)g.idToFeaturesIndex.hasOwnProperty(x)&&(this.evaluate(g.features[g.idToFeaturesIndex[x]],r[x],g,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let r=!1;for(const n in this.instancesPerModel){const c=this.instancesPerModel[n];for(const h of c.features){const m=this.layers[0],g=h.feature,x=this.canonical,w=m.paint.get("model-rotation").evaluate(g,{},x),E=m.paint.get("model-scale").evaluate(g,{},x),I=m.paint.get("model-translation").evaluate(g,{},x);Wi(h.rotation,w)&&Wi(h.scale,E)&&Wi(h.translation,I)||(this.evaluate(h,h.featureStates,c,!0),r=!0)}}return r}updateReplacement(r,n,c,h){if(n.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=n.updateTime;const m=n.getReplacementRegionsForTile(r.toUnwrapped(),!0);if(Rw(this.activeReplacements,m))return!1;this.activeReplacements=m;let g=!1;for(const x in this.instancesPerModel){const w=this.instancesPerModel[x],E=w.instancedDataArray;for(const I of w.features){const A=I.instancedDataOffset,P=I.instancedDataCount;for(let D=0;D<P;D++){const O=16*(D+A);let V=E.float32[O+0];const j=V>Vt;V=j?V-Vt:V;const X=Math.floor(V),oe=E.float32[O+1];let ne=!1;for(const ae of this.activeReplacements)if(!uj(ae,c,b8.Model,h)&&!(ae.min.x>X||X>ae.max.x||ae.min.y>oe||oe>ae.max.y)&&(ne=hA(pj(X,oe,r.canonical,ae.footprintTileId.canonical),ae.footprint),ne))break;E.float32[O]=ne?V+Vt:V,g=g||ne!==j}}}return g}isEmpty(){for(const r in this.instancesPerModel)if(this.instancesPerModel[r].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(r){if(!this.uploaded)for(const n in this.instancesPerModel){const c=this.instancesPerModel[n];c.instancedDataArray.length<0||c.instancedDataArray.length===0||(c.instancedDataBuffer?c.instancedDataBuffer.updateData(c.instancedDataArray):c.instancedDataBuffer=r.createVertexBuffer(c.instancedDataArray,See.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const n in this.instancesPerModel){const c=this.instancesPerModel[n];c.instancedDataArray.length!==0&&c.instancedDataBuffer&&c.instancedDataBuffer.destroy()}const r=this.layers[0].modelManager;if(r&&this.modelUris&&this.modelsRequested)for(const n of this.modelUris)r.removeModel(n,"",!0)}
66addFeature(r,n,c){const h=this.layers[0],m=h.layout.get("model-id").evaluate(c,{},this.canonical);if(!m)return Ar(`modelId is not evaluated for layer ${h.id} and it is not going to get rendered.`),m;(YA(m,!1)||this.styleDefinedModelURLs[m]!==void 0)&&(this.modelUris.includes(m)||this.modelUris.push(m)),this.instancesPerModel[m]||(this.instancesPerModel[m]=new T8);const g=this.instancesPerModel[m],x=g.instancedDataArray,w=new w8(c,x.length);for(const E of n)for(const I of E){if(I.x<0||I.x>=Vt||I.y<0||I.y>=Vt)continue;const A=(this.lookupDim-1)/Vt,P=this.lookupDim*(I.y*A|0)+I.x*A|0;if(this.lookup){if(this.lookup[P]!==0)continue;this.lookup[P]=1}this.instanceCount++;const D=x.length;x.resize(D+1),g.instancesEvaluatedElevation.push(0),x.float32[16*D]=I.x,x.float32[16*D+1]=I.y}return w.instancedDataCount=g.instancedDataArray.length-w.instancedDataOffset,w.instancedDataCount>0&&(r.id&&(g.idToFeaturesIndex[r.id]=g.features.length),g.features.push(w),this.evaluate(w,{},g,!1)),m}getModelUris(){return this.modelUris}evaluate(r,n,c,h){const m=this.layers[0],g=r.feature,x=this.canonical,w=r.rotation=m.paint.get("model-rotation").evaluate(g,n,x),E=r.scale=m.paint.get("model-scale").evaluate(g,n,x),I=r.translation=m.paint.get("model-translation").evaluate(g,n,x),A=m.paint.get("model-color").evaluate(g,n,x);A.a=m.paint.get("model-color-mix-intensity").evaluate(g,n,x);const P=[];this.maxVerticalOffset<I[2]&&(this.maxVerticalOffset=I[2]),this.maxScale=Math.max(Math.max(this.maxScale,E[0]),Math.max(E[1],E[2])),Xj(P,w,E);const D=Math.round(100*A.a)+A.b/1.05;for(let O=0;O<r.instancedDataCount;++O){const V=r.instancedDataOffset+O,j=16*V,X=c.instancedDataArray.float32;let oe=0;h&&(oe=X[j+6]-c.instancesEvaluatedElevation[V]);const ne=0|X[j+1];X[j]=(0|X[j])+A.r/1.05,X[j+1]=ne+A.g/1.05,X[j+2]=D,X[j+3]=1/(x.z>10?this.tileToMeter:ge(x,ne)),X[j+4]=I[0],X[j+5]=I[1],X[j+6]=I[2]+oe,X[j+7]=P[0],X[j+8]=P[1],X[j+9]=P[2],X[j+10]=P[4],X[j+11]=P[5],X[j+12]=P[6],X[j+13]=P[8],X[j+14]=P[9],X[j+15]=P[10],c.instancesEvaluatedElevation[V]=I[2]}}}let E8,S8;Jt(KA,"ModelBucket",{omit:["layers"]}),Jt(T8,"PerModelAttributes"),Jt(w8,"ModelFeature");class wg{constructor(r,n,c){this._demTile=r,this._dem=this._demTile.dem,this._scale=n,this._offset=c}static create(r,n,c){const h=c||r.findDEMTileFor(n);if(!h||!h.dem)return;const m=h.dem,g=h.tileID,x=1<<n.canonical.z-g.canonical.z;return new wg(h,m.dim/Vt/x,[(n.canonical.x/x-g.canonical.x)*m.dim,(n.canonical.y/x-g.canonical.y)*m.dim])}tileCoordToPixel(r,n){const c=n*this._scale+this._offset[1];return new Tt(Math.floor(r*this._scale+this._offset[0]),Math.floor(c))}getElevationAt(r,n,c,h){const m=r*this._scale+this._offset[0],g=n*this._scale+this._offset[1],x=Math.floor(m),w=Math.floor(g),E=this._dem;return h=!!h,c?_r(_r(E.get(x,w,h),E.get(x,w+1,h),g-w),_r(E.get(x+1,w,h),E.get(x+1,w+1,h),g-w),m-x):E.get(x,w,h)}getElevationAtPixel(r,n,c){return this._dem.get(r,n,!!c)}getMeterToDEM(r){return(1<<this._demTile.tileID.canonical.z)*Z(1,r)*this._dem.stride}}const JA=new Float32Array(262144),sp=new Uint8Array(262144);function C8(a){let r=0;if(a.meshes)for(const n of a.meshes)r=Math.max(r,n.aabb.max[2]);if(a.children)for(const n of a.children)r=Math.max(r,C8(n));return r}function I8(a,r,n){if(a.meshes)for(const c of a.meshes){if(c.aabb.min[0]===1/0)continue;const h=Zr.applyTransform(c.aabb,a.matrix);n.insert(r,h.min[0],h.min[1],h.max[0],h.max[1])}if(a.children)for(const c of a.children)I8(c,r,n)}const A8=["","wall","door","roof","window","lamp","logo"];class P8{constructor(r){this.node=r,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:r.id,geometry:[],properties:{height:C8(r)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Zr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let r=0;const n=new Zr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const c of this.node.meshes)this.node.lightMeshIndex!==r&&(c.transformedAabb=Zr.applyTransformFast(c.aabb,this.node.matrix),n.encapsulate(c.transformedAabb)),r++;this.aabb=n}return this.aabb}}class l2{constructor(r,n,c,h,m,g,x,w){this.id=c,this.layers=r,this.layerIds=this.layers.map(E=>E.fqid),this.stateDependentLayerIds=this.layers.filter(E=>E.isStateDependent()).map(E=>E.id),this.modelTraits|=gg.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,h&&(this.modelTraits|=gg.HasMapbox
vendor: 6,907 bytes, line 66
66MeshFeatures),m&&(this.modelTraits|=gg.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=g,this.worldview=w,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const E of n)this.nodesInfo.push(new P8(E)),I8(E,x.featureIndexArray.length,x.grid),x.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,x.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(r,n){for(const c of this.getNodesInfo()){const h=c.node;h.footprint&&n.push({footprint:h.footprint,id:r})}}update(r){const n=Object.keys(r).length!==0;if(n&&!this.stateDependentLayers.length)return;const c=n?this.stateDependentLayers:this.layers;if(!rl(r,this.states))for(const h of c)this.evaluate(h,r);this.states=structuredClone(r)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(r){if(!this.needsUpload)return;const n=this.getNodesInfo();for(const c of n){const h=c.node;this.uploaded?this.updatePbrBuffer(h):CA(h,r,!0)}for(const c of n)jw(c.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(r){let n=!1;if(!r.meshes)return n;for(const c of r.meshes)c.pbrBuffer&&(c.pbrBuffer.updateData(c.featureArray),n=!0);return n}needsReEvaluation(r,n,c){const h=r.transform.projectionOptions,m=r.style.getBrightness(),g=this.brightness!==m;if(!this.uploaded||this.dirty||h.name!==this.projection.name||pv(c.paint.get("model-color").value,g)||pv(c.paint.get("model-color-mix-intensity").value,g)||pv(c.paint.get("model-roughness").value,g)||pv(c.paint.get("model-emissive-strength").value,g)||pv(c.paint.get("model-height-based-emissive-strength-multiplier").value,g)){this.projection=h,this.brightness=m;const x=this.getNodesInfo();for(const w of x)w.state=null;return!0}return!1}evaluateTransform(r,n){if(r.transform.zoom===this.zoom)return;this.zoom=r.transform.zoom;const c=this.getNodesInfo(),h=this.id.canonical;for(const m of c){const g=m.feature;m.evaluatedTranslation=n.paint.get("model-translation").evaluate(g,{},h),m.evaluatedScale=n.paint.get("model-scale").evaluate(g,{},h)}}evaluate(r,n){const c=this.getNodesInfo();for(const h of c){if(!h.node.meshes)continue;const m=h.feature,g=n&&n[m.id];if(rl(g,h.state))continue;h.state=structuredClone(g);const x=h.node.meshes&&h.node.meshes[0].featureData,w=h.evaluatedColor[2],E=h.evaluatedRMEA[2],I=this.id.canonical;if(h.hasTranslucentParts=!1,x){for(let A=0;A<A8.length;A++){const P=A8[A];P.length&&(m.properties.part=P);const D=r.paint.get("model-color").evaluate(m,g,I).toPremultipliedRenderColor(null),O=r.paint.get("model-color-mix-intensity").evaluate(m,g,I);h.evaluatedColor[A]=[D.r,D.g,D.b,O],h.evaluatedRMEA[A][0]=r.paint.get("model-roughness").evaluate(m,g,I),h.evaluatedRMEA[A][2]=r.paint.get("model-emissive-strength").evaluate(m,g,I),h.evaluatedRMEA[A][3]=D.a,h.emissionHeightBasedParams[A]=r.paint.get("model-height-based-emissive-strength-multiplier").evaluate(m,g,I),!h.hasTranslucentParts&&D.a<1&&(h.hasTranslucentParts=!0)}delete m.properties.part,Wte(h,w!==h.evaluatedColor[2]||E!==h.evaluatedRMEA[2],this.modelTraits)}else h.evaluatedRMEA[0][2]=r.paint.get("model-emissive-strength").evaluate(m,g,I);h.evaluatedTranslation=r.paint.get("model-translation").evaluate(m,g,I),h.evaluatedScale=r.paint.get("model-scale").evaluate(m,g,I),this.updatePbrBuffer(h.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(r,n,c,h){const m=r.findDEMTileFor(c);if(m&&(m.tileID.canonical!==this.terrainTile||n!==this.terrainExaggeration)){if(m.dem&&m.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=m.tileID.overscaledZ;const g=wg.create(r,c,m);if(!g)return;this.modelTraits&gg.HasMapboxMeshFeatures&&this.updateDEM(r,g,c,h);for(const x of this.getNodesInfo()){const w=x.node;if(!w.footprint||!w.footprint.vertices||!w.footprint.vertices.length)continue;const E=w.footprint.vertices;let I=g.getElevationAt(E[0].x,E[0].y,!0,!0);for(let A=1;A<E.length;A++)I=Math.min(I,g.getElevationAt(E[A].x,E[A].y,!0,!0));w.elevation=I}}this.terrainTile=m.tileID.canonical,this.terrainExaggeration=n}}updateDEM(r,n,c,h){let m=n._dem._modifiedForSources[h];if(m===void 0&&(n._dem._modifiedForSources[h]=[],m=n._dem._modifiedForSources[h]),m.includes(c.canonical))return;const g=n._dem.dim;m.push(c.canonical);let x=!1;for(const w of this.getNodesInfo()){const E=w.node;if(!E.footprint||!E.footprint.grid)continue;const I=E.footprint.grid,A=n.tileCoordToPixel(I.min.x,I.min.y),P=n.tileCoordToPixel(I.max.x,I.max.y),D=Math.min(Math.min(g-P.y,A.x),Math.min(A.y,g-P.x));if(D<0)continue;const O=J(D,2,5);let V=Math.max(0,A.x-O),j=Math.max(0,A.y-O),X=Math.min(P.x+O,g-1),oe=Math.min(P.y+O,g-1);for(let be=j;be<=oe;++be)for(let Te=V;Te<=X;++Te)sp[be*g+Te]=255;let ne=0,ae=0;for(let be=0;be<I.cellsY;++be)for(let Te=0;Te<I.cellsX;++Te){if(!I.cells[be*I.cellsX+Te])continue;const Le=n.tileCoordToPixel(I.min.x+Te/I.xScale,I.min.y+be/I.yScale),De=n.tileCoordToPixel(I.min.x+(Te+1)/I.xScale,I.min.y+(be+1)/I.yScale);for(let lt=Le.y;lt<=Math.min(De.y+1,g-1);++lt)for(let je=Le.x;je<=Math.min(De.x+1,g-1);++je)sp[lt*g+je]===255&&(sp[lt*g+je]=0,ne+=n.getElevationAtPixel(je,lt),ae++)}const Ie=ne/ae;V=Math.max(1,A.x-O),j=Math.max(1,A.y-O),X=Math.min(P.x+O,g-2),oe=Math.min(P.y+O,g-2),x=!0;for(let be=j;be<=oe;++be)for(let Te=V;Te<=X;++Te)sp[be*g+Te]===0&&(JA[be*g+Te]=n._dem.set(Te,be,Ie));for(let be=1;be<O;++be){V=Math.max(1,A.x-be),j=Math.max(1,A.y-be),X=Math.min(P.x+be,g-2),oe=Math.min(P.y+be,g-2);for(let Te=j;Te<=oe;++Te)for(let Le=V;Le<=X;++Le){const De=Te*g+Le;if(sp[De]===255){let lt=0,je=0,ht=-1,Lt=-1;for(let gt=-1;gt<=1;++gt)for(let St=-1;St<=1;++St){const kt=(Te+gt)*g+Le+St;if(sp[kt]>=be)continue;const st=JA[kt],Ct=Math.abs(st);Ct>je&&(lt=st,je=Ct,ht=St,Lt=gt)}if(je>.1){const gt=1-(be+.5*Math.abs(ht*Lt))/O;let St=n._dem.get(Le,Te)+lt*gt;const kt=n._dem.get(Le+ht,Te+Lt),st=n._dem.get(Le-ht,Te-Lt,!0);(St-kt)*(St-st)>0&&(St=(kt+st)/2),JA[De]=n._dem.set(Le,Te,St),sp[De]=be}}}}}x&&(n._demTile.needsDEMTextureUpload=!0,n._dem._timestamp=ca.now())}setFilter(r){this.filter=r?sd(r):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(r=>this.filter.filter(new Ni(this.id.overscaledZ,{worldview:this.worldview}),r.feature,this.id.canonical)):this.nodesInfo}destroy(){const r=this.getNodesInfo();for(const n of r)jw(n.node),IA(n.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(r,n){if(n.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=n.updateTime;const c=n.getReplacementRegionsForTile(r.toUnwrapped());for(const h of this.getNodesInfo()){const m=h.node.footprint;h.hiddenByReplacement=!!m&&!c.find(g=>g.footprint===m)}}getHeightAtTileCoord(r,n){const c=[],h=[0,0,0],m=pe([]);for(const g of this.getNodesInfo()){const x=g.node.meshes[0],w=x.transformedAabb;if(r<w.min[0]||n<w.min[1]||r>w.max[0]||n>w.max[1])continue;
66if(g.node.hidden===!0)return{height:1/0,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};Ne(m,g.node.matrix),h[0]=r,h[1]=n,sn(h,h,m);const E=(h[0]-x.aabb.min[0])/(x.aabb.max[0]-x.aabb.min[0])*ip|0,I=Math.min(63,(h[1]-x.aabb.min[1])/(x.aabb.max[1]-x.aabb.min[1])*ip|0)*ip+Math.min(63,E),A=x.heightmap[I];if(!(A<0&&g.node.footprint))return g.hiddenByReplacement?void 0:{height:A,maxHeight:g.feature.properties.height,hidden:!1,verticalScale:g.evaluatedScale[2]};if(g.node.footprint.grid.query(new Tt(r,n),new Tt(r,n),c),c.length>0)return{height:void 0,maxHeight:g.feature.properties.height,hidden:g.hiddenByReplacement,verticalScale:g.evaluatedScale[2]}}}}function pv(a,r){return a instanceof $m&&!a.isLightConstant&&r}function Zte(a,r,n,c,h,m,g,x){let w=(61440&r|(61440&r)>>4)>>8,E=(3840&r|(3840&r)>>4)>>4,I=240&r|(240&r)>>4;n[3]>0&&(w=_r(w,255*n[0],n[3]),E=_r(E,255*n[1],n[3]),I=_r(I,255*n[2],n[3]));const A=w<<8|E,P=I<<8|Math.floor(255*c[3]),D=function(be){const Te=J(be,0,2);return Math.min(Math.round(.5*Te*255),255)}(c[2])<<8|15*c[0]<<4|15*c[1],O=J(h[0],0,1),V=J(h[1],0,1),j=J(h[2],0,1),X=J(h[3],0,1);let oe,ne,ae,Ie;if(O!==V&&g!==m&&V!==O){const be=g-m;ne=1/(be*(V-O)),ae=-(m+be*O)/(be*(V-O));const Te=J(h[4],-1,1);Ie=Math.pow(10,Te),oe=255*j<<8|255*X}else oe=65535,ne=0,ae=1,Ie=1;if(a.emplaceBack(A,P,D,oe,ne,ae,Ie),x){const be=x.length;x.clear();for(let Te=0;Te<be;Te++)x.emplaceBack(A,P,D,oe,ne,ae,Ie)}}function Wte(a,r,n){const c=a.node;let h=0;const m=n&gg.HasMeshoptCompression;for(const g of c.meshes){if(c.lights&&c.lightMeshIndex===h||!g.featureData)continue;g.featureArray=new gd,g.featureArray.reserve(g.featureData.length);let x=r;for(const w of g.featureData){const E=m?65535&w:w>>16&65535,I=m?w>>16&65535:65535&w,A=(15&I)<8?15&I:0,P=a.evaluatedRMEA[A],D=a.evaluatedColor[A],O=a.emissionHeightBasedParams[A];let V;if(x&&A===2&&c.lights&&(V=new gd,V.resize(10*c.lights.length)),Zte(g.featureArray,E,D,P,O,g.aabb.min[2],g.aabb.max[2],V),V&&x){x=!1;const j=c.meshes[c.lightMeshIndex];j.featureArray=V,j.featureArray._trim()}}g.featureArray._trim(),h++}}function M8(a,r,n,c){const h=1<<a.z;r.lat=se((c/Vt+a.y)/h),r.lng=re((n/Vt+a.x)/h)}function Xte(a,r,n,c){const h=a.getNodesInfo()[r];if(!h||h.hiddenByReplacement||!h.node.meshes)return;let m=Number.MAX_VALUE;const g=h.node,x=n.tile,w=c.calculatePosMatrix(x.tileID.toUnwrapped(),c.worldSize),E=h.evaluatedScale;let I=0;c.elevation&&g.elevation&&(I=g.elevation*c.elevation.exaggeration()),ie(w,w,[(g.anchor?g.anchor[0]:0)*(E[0]-1),(g.anchor?g.anchor[1]:0)*(E[1]-1),I]),ke(w,w,E);const A=n.queryGeometry,P=A.isPointQuery()?A.screenBounds:A.screenGeometry,D=function(V){const j=_e([],w,V.matrix);_e(j,c.expandedFarZProjMatrix,j);for(let X=0;X<V.meshes.length;++X){const oe=V.meshes[X];if(X===V.lightMeshIndex)continue;const ne=Yj(P,c,j,oe.aabb);ne!=null&&(m=Math.min(ne,m))}if(V.children)for(const X of V.children)D(X)};if(D(g),m===Number.MAX_VALUE)return;const O=new R(0,0);return M8(x.tileID.canonical,O,h.node.anchor[0],h.node.anchor[1]),{intersectionZ:m,position:O,feature:h.feature}}Jt(l2,"Tiled3dModelBucket",{omit:["layers"]}),Jt(P8,"Tiled3dModelFeature");const Yte={circle:class extends Qo{constructor(a,r,n,c){super(a,{layout:nu||(nu=new Ln({"circle-sort-key":new qt(Ue.layout_circle["circle-sort-key"]),"circle-elevation-reference":new zt(Ue.layout_circle["circle-elevation-reference"]),visibility:new zt(Ue.layout_circle.visibility)})),paint:vd||(vd=new Ln({"circle-radius":new qt(Ue.paint_circle["circle-radius"]),"circle-color":new qt(Ue.paint_circle["circle-color"]),"circle-blur":new qt(Ue.paint_circle["circle-blur"]),"circle-opacity":new qt(Ue.paint_circle["circle-opacity"]),"circle-translate":new zt(Ue.paint_circle["circle-translate"]),"circle-translate-anchor":new zt(Ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new zt(Ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new zt(Ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new qt(Ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new qt(Ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new qt(Ue.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new zt(Ue.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c)}createBucket(a){return new Ci(a)}queryRadius(a){const r=a;return Ao("circle-radius",this,r)+Ao("circle-stroke-width",this,r)+On(this.paint.get("circle-translate"))}queryIntersectsFeature(a,r,n,c,h,m,g,x){const w=Xu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),E=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return FU(a,c,m,g,x,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",w,E)}getProgramIds(){return["circle"]}getDefaultProgramParams(a,r,n){const c=OU(this);return{config:new ms(this,{zoom:r,lut:n}),defines:c,overrideFog:!1}}
vendor: 10,880 bytes, line 66
66is3D(a){return!a&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Qo{createBucket(a){return new BU(a)}constructor(a,r,n,c){super(a,{layout:VU||(VU=new Ln({visibility:new zt(Ue.layout_heatmap.visibility)})),paint:UU||(UU=new Ln({"heatmap-radius":new qt(Ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new qt(Ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new zt(Ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new od(Ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new zt(Ue.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(a){a==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=B0({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(a){return Ao("heatmap-radius",this,a)}queryIntersectsFeature(a,r,n,c,h,m,g,x){const w=this.paint.get("heatmap-radius").evaluate(r,n);return FU(a,c,m,g,x,!0,!0,new Tt(0,0),w)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(a,r,n){return a==="heatmap"?{config:new ms(this,{zoom:r,lut:n}),overrideFog:!1}:{}}},hillshade:class extends Qo{constructor(a,r,n,c){super(a,{layout:jU||(jU=new Ln({visibility:new zt(Ue.layout_hillshade.visibility)})),paint:GU||(GU=new Ln({"hillshade-illumination-direction":new zt(Ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new zt(Ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new zt(Ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new zt(Ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new zt(Ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new zt(Ue.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new zt(Ue.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(a,r,n){return{overrideFog:!1}}},fill:class extends Qo{constructor(a,r,n,c){super(a,{layout:nj||(nj=new Ln({"fill-sort-key":new qt(Ue.layout_fill["fill-sort-key"]),visibility:new zt(Ue.layout_fill.visibility),"fill-elevation-reference":new zt(Ue.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new qt(Ue.layout_fill["fill-construct-bridge-guard-rail"])})),paint:oj||(oj=new Ln({"fill-antialias":new zt(Ue.paint_fill["fill-antialias"]),"fill-opacity":new qt(Ue.paint_fill["fill-opacity"]),"fill-color":new qt(Ue.paint_fill["fill-color"]),"fill-outline-color":new qt(Ue.paint_fill["fill-outline-color"]),"fill-translate":new zt(Ue.paint_fill["fill-translate"]),"fill-translate-anchor":new zt(Ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new qt(Ue.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new zt(Ue.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new zt(Ue.paint_fill["fill-emissive-strength"]),"fill-z-offset":new qt(Ue.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new qt(Ue.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new qt(Ue.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c)}getProgramIds(){const a=this.paint.get("fill-pattern"),r=a&&a.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getDefaultProgramParams(a,r,n){return{config:new ms(this,{zoom:r,lut:n}),overrideFog:!1}}recalculate(a,r){super.recalculate(a,r);const n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(a){return new lA(a)}queryRadius(){return On(this.paint.get("fill-translate"))}queryIntersectsFeature(a,r,n,c,h,m){return!a.queryGeometry.isAboveHorizon&&Nn(ya(a.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),c)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(a){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const r=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return a!=null?r&&!a:r}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Qo{constructor(a,r,n,c){super(a,{layout:Aj||(Aj=new Ln({visibility:new zt(Ue["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new zt(Ue["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Pj||(Pj=new Ln({"fill-extrusion-opacity":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new qt(Ue["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new zt(Ue["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(a){return new zw(a)}queryRadius(){return On(this.paint.get("fill-extrusion-translate"))}is3D(a){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(a,r,n,c,h,m,g,x,w){const E=Xu(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),I=this.paint.get("fill-extrusion-height").evaluate(r,n),A=this.paint.get("fill-extrusion-base").evaluate(r,n),P=[0,0],D=x&&m.elevation,O=m.elevation?m.elevation.exaggeration():1,V=a.tile.getBucket(this);if(D&&V instanceof zw){const ae=V.centroidVertexArray,Ie=w+1;Ie<ae.length&&(P[0]=ae.geta_centroid_pos0(Ie),P[1]=ae.geta_centroid_pos1(Ie))}if(P[0]===0&&P[1]===1)return!1;m.projection.name==="globe"&&(c=Ij([c],[new Tt(0,0),new Tt(Vt,Vt)],a.tileID.canonical).map(ae=>ae.polygon).flat());const j=D?x:null,[X,oe]=function(ae,Ie,be,Te,Le,De,lt,je,ht,Lt,gt){return ae.projection.name==="globe"?function(St,kt,st,Ct,$e,at,Dt,At,sr,Qt,bt){const Pt=[],rr=[],Wt=St.projection.upVectorScale(bt,St.center.lat,St.worldSize).metersToTile,Ut=[0,0,0,1],Xt=[0,0,0,1],xr=(Or,Rr,ri,Hr)=>{Or[0]=Rr,Or[1]=ri,Or[2]=Hr,Or[3]=1},Mr=Cj();st>0&&(st+=Mr),Ct+=Mr;
vendor: 4,227 bytes, line 66
66for(const Or of kt){const Rr=[],ri=[];for(const Hr of Or){const ln=Hr.x+$e.x,ue=Hr.y+$e.y,he=St.projection.projectTilePoint(ln,ue,bt),it=St.projection.upVector(bt,Hr.x,Hr.y);let Ot=st,$t=Ct;if(Dt){const Gt=Dj(ln,ue,st,Ct,Dt,At,sr,Qt);Ot+=Gt.base,$t+=Gt.top}st!==0?xr(Ut,he.x+it[0]*Wt*Ot,he.y+it[1]*Wt*Ot,he.z+it[2]*Wt*Ot):xr(Ut,he.x,he.y,he.z),xr(Xt,he.x+it[0]*Wt*$t,he.y+it[1]*Wt*$t,he.z+it[2]*Wt*$t),sn(Ut,Ut,at),sn(Xt,Xt,at),Rr.push(new tp(Ut[0],Ut[1],Ut[2])),ri.push(new tp(Xt[0],Xt[1],Xt[2]))}Pt.push(Rr),rr.push(ri)}return[Pt,rr]}(ae,Ie,be,Te,Le,De,lt,je,ht,Lt,gt):lt?function(St,kt,st,Ct,$e,at,Dt,At,sr){const Qt=[],bt=[],Pt=[0,0,0,1];for(const rr of St){const Wt=[],Ut=[];for(const Xt of rr){const xr=Xt.x+Ct.x,Mr=Xt.y+Ct.y,Or=Dj(xr,Mr,kt,st,at,Dt,At,sr);Pt[0]=xr,Pt[1]=Mr,Pt[2]=Or.base,Pt[3]=1,Uo(Pt,Pt,$e),Pt[3]=Math.max(Pt[3],1e-5);const Rr=new tp(Pt[0]/Pt[3],Pt[1]/Pt[3],Pt[2]/Pt[3]);Pt[0]=xr,Pt[1]=Mr,Pt[2]=Or.top,Pt[3]=1,Uo(Pt,Pt,$e),Pt[3]=Math.max(Pt[3],1e-5);const ri=new tp(Pt[0]/Pt[3],Pt[1]/Pt[3],Pt[2]/Pt[3]);Wt.push(Rr),Ut.push(ri)}Qt.push(Wt),bt.push(Ut)}return[Qt,bt]}(Ie,be,Te,Le,De,lt,je,ht,Lt):function(St,kt,st,Ct,$e){const at=[],Dt=[],At=$e[8]*kt,sr=$e[9]*kt,Qt=$e[10]*kt,bt=$e[11]*kt,Pt=$e[8]*st,rr=$e[9]*st,Wt=$e[10]*st,Ut=$e[11]*st;for(const Xt of St){const xr=[],Mr=[];for(const Or of Xt){const Rr=Or.x+Ct.x,ri=Or.y+Ct.y,Hr=$e[0]*Rr+$e[4]*ri+$e[12],ln=$e[1]*Rr+$e[5]*ri+$e[13],ue=$e[2]*Rr+$e[6]*ri+$e[14],he=$e[3]*Rr+$e[7]*ri+$e[15],it=Hr+At,Ot=ln+sr,$t=ue+Qt,Gt=Math.max(he+bt,1e-5),tr=Hr+Pt,Ir=ln+rr,Jr=ue+Wt,Qr=Math.max(he+Ut,1e-5);xr.push(new tp(it/Gt,Ot/Gt,$t/Gt)),Mr.push(new tp(tr/Qr,Ir/Qr,Jr/Qr))}at.push(xr),Dt.push(Mr)}return[at,Dt]}(Ie,be,Te,Le,De)}(m,c,A,I,E,g,j,P,O,m.center.lat,a.tileID.canonical),ne=a.queryGeometry;return function(ae,Ie,be){let Te=1/0;Nn(be,Ie)&&(Te=zj(be,Ie[0]));for(let Le=0;Le<Ie.length;Le++){const De=Ie[Le],lt=ae[Le];for(let je=0;je<De.length-1;je++){const ht=De[je],Lt=[ht,De[je+1],lt[je+1],lt[je],ht];Gi(be,Lt)&&(Te=Math.min(Te,zj(be,Lt)))}}return Te!==1/0&&Te}(X,oe,ne.isPointQuery()?ne.screenBounds:ne.screenGeometry)}},building:class extends Qo{constructor(a,r,n,c){super(a,{layout:o6||(o6=new Ln({visibility:new zt(Ue.layout_building.visibility),"building-facade":new qt(Ue.layout_building["building-facade"]),"building-facade-floors":new qt(Ue.layout_building["building-facade-floors"]),"building-facade-window":new qt(Ue.layout_building["building-facade-window"]),"building-roof-shape":new qt(Ue.layout_building["building-roof-shape"]),"building-height":new qt(Ue.layout_building["building-height"]),"building-base":new qt(Ue.layout_building["building-base"])})),paint:s6||(s6=new Ln({"building-opacity":new zt(Ue.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new zt(Ue.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new zt(Ue.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new zt(Ue.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new zt(Ue.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new zt(Ue.paint_building["building-vertical-scale"]),"building-cast-shadows":new zt(Ue.paint_building["building-cast-shadows"]),"building-color":new qt(Ue.paint_building["building-color"]),"building-emissive-strength":new qt(Ue.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new zt(Ue.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new zt(Ue.paint_building["building-cutoff-fade-range"]),"building-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(a){return new n6(a)}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(a){return!0}},line:class extends Qo{constructor(a,r,n,c){const h=g6();super(a,h,r,n,c),h.layout&&(this.layout=new ol(h.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}
vendor: 4,504 bytes, line 66
66_handleSpecialPaintPropertyUpdate(a){if(a==="line-gradient"){const r=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=r._styleExpression&&r._styleExpression.expression instanceof zf,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(a,r){super.recalculate(a,r),this.paint._values["line-floorwidth"]=(()=>{if(rv)return rv;const n=g6();return rv=new Wee(n.paint.properties["line-width"].specification),rv.useIntegerZoom=!0,rv})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,a)}createBucket(a){return new MA(a)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(a,r,n){const c=p6(this);return{config:new ms(this,{zoom:r,lut:n}),defines:c,overrideFog:!1}}queryRadius(a){const r=a,n=_6(Ao("line-width",this,r),Ao("line-gap-width",this,r)),c=Ao("line-offset",this,r);return n/2+Math.abs(c)+On(this.paint.get("line-translate"))}queryIntersectsFeature(a,r,n,c,h,m){if(a.queryGeometry.isAboveHorizon)return!1;const g=ya(a.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),m.angle,a.pixelToTileUnitsFactor),x=a.pixelToTileUnitsFactor/2*_6(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),w=this.paint.get("line-offset").evaluate(r,n);return w&&(c=function(E,I){const A=[],P=new Tt(0,0);for(let D=0;D<E.length;D++){const O=E[D],V=[];for(let j=0;j<O.length;j++){const X=O[j],oe=O[j+1],ne=j===0?P:X.sub(O[j-1])._unit()._perp(),ae=j===O.length-1?P:oe.sub(X)._unit()._perp(),Ie=ne._add(ae)._unit();Ie._mult(1/(Ie.x*ae.x+Ie.y*ae.y)),V.push(Ie._mult(I)._add(X))}A.push(V)}return A}(c,w*a.pixelToTileUnitsFactor)),function(E,I,A){for(let P=0;P<I.length;P++){const D=I[P];if(E.length>=3){for(let O=0;O<D.length;O++)if(Go(E,D[O]))return!0}if(jn(E,D,A))return!0}return!1}(g,c,x)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(a){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:n2,background:class extends Qo{constructor(a,r,n,c){super(a,{layout:l8||(l8=new Ln({visibility:new zt(Ue.layout_background.visibility)})),paint:c8||(c8=new Ln({"background-pitch-alignment":new zt(Ue.paint_background["background-pitch-alignment"]),"background-color":new zt(Ue.paint_background["background-color"]),"background-pattern":new zt(Ue.paint_background["background-pattern"]),"background-opacity":new zt(Ue.paint_background["background-opacity"]),"background-emissive-strength":new zt(Ue.paint_background["background-emissive-strength"]),"background-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(a,r,n){return{overrideFog:!1}}is3D(a){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:p8,"raster-particle":x8,sky:class extends Qo{constructor(a,r,n,c){super(a,{layout:_8||(_8=new Ln({visibility:new zt(Ue.layout_sky.visibility)})),paint:y8||(y8=new Ln({"sky-type":new zt(Ue.paint_sky["sky-type"]),"sky-atmosphere-sun":new zt(Ue.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new zt(Ue.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new zt(Ue.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new zt(Ue.paint_sky["sky-gradient-radius"]),"sky-gradient":new od(Ue.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new zt(Ue.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new zt(Ue.paint_sky["sky-atmosphere-color"]),"sky-opacity":new zt(Ue.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvali
66dated=!0}_handleSpecialPaintPropertyUpdate(a){a==="sky-gradient"?this._updateColorRamp():a!=="sky-atmosphere-sun"&&a!=="sky-atmosphere-halo-color"&&a!=="sky-atmosphere-color"&&a!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=B0({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(a){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const r=a.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(a,r){if(this.paint.get("sky-type")==="atmosphere"){const c=this.paint.get("sky-atmosphere-sun"),h=!c,m=a.style.light,g=m.properties.get("position");return h&&m.properties.get("anchor")==="viewport"&&Ar("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),h?XA(g.azimuthal,90-g.polar,r):XA(c[0],90-c[1],r)}const n=this.paint.get("sky-gradient-center");return XA(n[0],90-n[1],r)}isSky(){return!0}markSkyboxValid(a){this._skyboxInvalidated=!1,this._lightPosition=a.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const a=this.paint.get("sky-type");return a==="atmosphere"?["skyboxCapture","skybox"]:a==="gradient"?["skyboxGradient"]:null}},slot:class extends Qo{constructor(a,r,n,c){super(a,{paint:v8||(v8=new Ln({}))},r,null)}},model:class extends Qo{constructor(a,r,n,c){super(a,{layout:E8||(E8=new Ln({visibility:new zt(Ue.layout_model.visibility),"model-id":new qt(Ue.layout_model["model-id"])})),paint:S8||(S8=new Ln({"model-opacity":new qt(Ue.paint_model["model-opacity"]),"model-rotation":new qt(Ue.paint_model["model-rotation"]),"model-scale":new qt(Ue.paint_model["model-scale"]),"model-translation":new qt(Ue.paint_model["model-translation"]),"model-color":new qt(Ue.paint_model["model-color"]),"model-color-mix-intensity":new qt(Ue.paint_model["model-color-mix-intensity"]),"model-type":new zt(Ue.paint_model["model-type"]),"model-cast-shadows":new zt(Ue.paint_model["model-cast-shadows"]),"model-receive-shadows":new zt(Ue.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new zt(Ue.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new qt(Ue.paint_model["model-emissive-strength"]),"model-roughness":new qt(Ue.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new qt(Ue.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new zt(Ue.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new zt(Ue.paint_model["model-front-cutoff"]),"model-color-use-theme":new qt({type:"string",default:"default","property-type":"data-driven"})}))},r,n,c),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(a){return new KA(a)}getProgramIds(){return["model"]}is3D(a){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(a){return a instanceof l2?Vt-1:0}queryIntersectsFeature(a,r,n,c,h,m){if(!this.modelManager)return!1;const g=this.modelManager,x=a.tile.getBucket(this);if(!(x&&x instanceof KA))return!1;for(const w in x.instancesPerModel){const E=x.instancesPerModel[w],I=r.id!==void 0?r.id:r.properties&&r.properties.hasOwnProperty("id")?r.properties.id:void 0;if(E.idToFeaturesIndex.hasOwnProperty(I)){const A=E.features[E.idToFeaturesIndex[I]],P=g.getModel(w,this.scope);if(!P)return!1;let D=xe();const O=new R(0,0),V=x.canonical;let j=Number.MAX_VALUE;for(let X=0;X<A.instancedDataCount;++X){const oe=16*(A.instancedDataOffset+X),ne=E.instancedDataArray.float32,ae=[ne[oe+4],ne[oe+5],ne[oe+6]];M8(V,O,ne[oe],0|ne[oe+1]),Kj(D,P,m,O,A.rotation,A.scale,ae,!1,!1,!1),m.projection.name==="globe"&&(D=SA(D,m));const Ie=_e([],m.projMatrix,D),be=a.queryGeometry,Te=Yj(be.isPointQuery()?be.
66screenBounds:be.screenGeometry,m,Ie,P.aabb);Te!=null&&(j=Math.min(Te,j))}return j!==Number.MAX_VALUE&&j}}return!1}_handleOverridablePaintPropertyUpdate(a,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven()||a!=="model-color"&&a!=="model-color-mix-intensity"&&a!=="model-rotation"&&a!=="model-scale"&&a!=="model-translation"&&a!=="model-emissive-strength")}_isPropertyZoomDependent(a){const r=this._transitionablePaint._values[a];return r!=null&&r.value!=null&&r.value.expression!=null&&r.value.expression instanceof Kc}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Qo{constructor(a,r,n,c){super(a,{layout:sj||(sj=new Ln({"clip-layer-types":new zt(Ue.layout_clip["clip-layer-types"]),"clip-layer-scope":new zt(Ue.layout_clip["clip-layer-scope"])})),paint:aj||(aj=new Ln({}))},r,n,c)}recalculate(a,r){super.recalculate(a,r)}createBucket(a){return new lj(a)}is3D(a){return!0}}},QA=new Mi(0,0,0),e3={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},t3={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},c2={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},Kte={PAINT_ORDER_FILL_AND_STROKE:1},mv={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},k8={MASK_TYPE_LUMINANCE:1};function Jte(a,r,n){a===1&&r.icons.push(function(c,h){return function(m){if(m.usvg_tree.height||(m.usvg_tree.height=m.usvg_tree.width),!m.metadata)return m;const{metadata:g}=m;if(g.content_area){const{content_area:x}=g;x.top==null&&(x.top=x.left),x.width==null&&(x.width=m.usvg_tree.width),x.height==null&&(x.height=x.width)}return g.stretch_x&&g.stretch_x.length&&R8(g,"x"),g.stretch_y&&g.stretch_y.length&&R8(g,"y"),m}(c.readFields(Qte,{name:void 0},h))}(n,n.readVarint()+n.pos))}function R8(a,r){const n=[],c=a[`stretch_${r}`];let h=null;for(let m=0;m<c.length;m++)h===null?h=n.length===0?c[0]:n[n.length-1][1]+c[m]:(n.push([h,h+c[m]]),h=null);a[`stretch_${r}_areas`]=n}function Qte(a,r,n){a===1?r.name=n.readString():a===2?r.metadata=function(c,h){return c.readFields(ere,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},h)}(n,n.readVarint()+n.pos):a===3&&(r.usvg_tree=function(c,h){return c.readFields(ire,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},h)}(n,n.readVarint()+n.pos),r.data="usvg_tree")}function ere(a,r,n){a===1?r.stretch_x=n.readPackedVarint():a===2?r.stretch_y=n.readPackedVarint():a===3?r.content_area=function(c,h){return c.readFields(tre,{left:0},h)}(n,n.readVarint()+n.pos):a===4&&r.variables.push(function(c,h){return c.readFields(rre,{name:void 0},h)}(n,n.readVarint()+n.pos))}function tre(a,r,n){a===1?r.left=n.readVarint():a===2?r.width=n.readVarint():a===3?r.top=n.readVarint():a===4&&(r.height=n.readVarint())}function rre(a,r,n){a===1?r.name=n.readString():a===2&&(r.rgb_color=d2(n.readVarint()),r.value="rgb_color")}function ire(a,r,n){a===1?r.width=r.height=n.readVarint():a===2?r.height=n.readVarint():a===3?r.children.push(u2(n,n.readVarint()+n.pos)):a===4?r.linear_gradients.push(function(c,h){return c.readFields(ure,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},h)}(n,n.readVarint()+n.pos)):a===5?r.radial_gradients.push(function(c,h){return c.readFields(dre,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},h)}(n,n.readVarint()+n.pos)):a===7?r.clip_paths.push(function(c,h){return c.readFields(fre,{children:[]},h)}(n,n.readVarint()+n.pos)):a===8&&r.masks.push(function(c,h){const m=c.readFields(pre,{left:0,width:20,mask_type:k8.MASK_TYPE_LUMINANCE,children:[]},h);return m.height==null&&(m.height=m.width),m.top==null&&(m.top=m.left),m}(n,n.readVarint()+n.pos))}function u2(a,r){return a.readFields(nre,{},r)}function nre(a,r,n){a===1?(r.group=function(c,h){return c.readFields(ore,{opacity:255,children:[]},h)}(n,n.readVarint()+n.pos),r.node="group"):a===2&&(r.path=function(c,h){return c.readFields(are,{paint_order:1,commands:[],step:1,diffs:[],rule:e3.PATH_RULE_NON_ZERO},h)}(n,n.readVarint()+n.pos),r.node="path")}function ore(a,r,n){a===1?r.transform=h2(n,n.readVarint()+n.pos):a===2?r.opacity=n.readVarint():a===5?r.clip_path_idx=n.readVarint():a===6?r.mask_idx=n.readVarint():a===7&&r.children.push(u2(n,n.readVarint()+n.pos))}function h2(a,r){return a.readFields(sre,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},r)}function sre(a,r,n){a===1?r.sx=n.readFloat():a===2?r.ky=n.readFloat():a===3?r.k
66x=n.readFloat():a===4?r.sy=n.readFloat():a===5?r.tx=n.readFloat():a===6&&(r.ty=n.readFloat())}function are(a,r,n){a===1?r.fill=function(c,h){return c.readFields(lre,{rgb_color:QA,paint:"rgb_color",opacity:255},h)}(n,n.readVarint()+n.pos):a===2?r.stroke=function(c,h){return c.readFields(cre,{rgb_color:QA,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},h)}(n,n.readVarint()+n.pos):a===3?r.paint_order=n.readVarint():a===5?n.readPackedVarint(r.commands):a===6?r.step=n.readFloat():a===7?n.readPackedSVarint(r.diffs):a===8&&(r.rule=n.readVarint())}function lre(a,r,n){a===1?(r.rgb_color=d2(n.readVarint()),r.paint="rgb_color"):a===2?(r.linear_gradient_idx=n.readVarint(),r.paint="linear_gradient_idx"):a===3?(r.radial_gradient_idx=n.readVarint(),r.paint="radial_gradient_idx"):a===5&&(r.opacity=n.readVarint())}function d2(a){return new Mi((a>>16&255)/255,(a>>8&255)/255,(255&a)/255,1)}function cre(a,r,n){a===1?(r.rgb_color=d2(n.readVarint()),r.paint="rgb_color"):a===2?(r.linear_gradient_idx=n.readVarint(),r.paint="linear_gradient_idx"):a===3?(r.radial_gradient_idx=n.readVarint(),r.paint="radial_gradient_idx"):a===5?n.readPackedFloat(r.dasharray):a===6?r.dashoffset=n.readFloat():a===7?r.miterlimit=n.readFloat():a===8?r.opacity=n.readVarint():a===9?r.width=n.readFloat():a===10?r.linecap=n.readVarint():a===11&&(r.linejoin=n.readVarint())}function ure(a,r,n){a===1?r.transform=h2(n,n.readVarint()+n.pos):a===2?r.spread_method=n.readVarint():a===3?r.stops.push(L8(n,n.readVarint()+n.pos)):a===4?r.x1=n.readFloat():a===5?r.y1=n.readFloat():a===6?r.x2=n.readFloat():a===7&&(r.y2=n.readFloat())}function L8(a,r){return a.readFields(hre,{offset:0,opacity:255,rgb_color:QA},r)}function hre(a,r,n){a===1?r.offset=n.readFloat():a===2?r.opacity=n.readVarint():a===3&&(r.rgb_color=d2(n.readVarint()))}function dre(a,r,n){a===1?r.transform=h2(n,n.readVarint()+n.pos):a===2?r.spread_method=n.readVarint():a===3?r.stops.push(L8(n,n.readVarint()+n.pos)):a===4?r.cx=n.readFloat():a===5?r.cy=n.readFloat():a===6?r.r=n.readFloat():a===7?r.fx=n.readFloat():a===8?r.fy=n.readFloat():a===9&&(r.fr=n.readFloat())}function fre(a,r,n){a===1?r.transform=h2(n,n.readVarint()+n.pos):a===2?r.clip_path_idx=n.readVarint():a===3&&r.children.push(u2(n,n.readVarint()+n.pos))}function pre(a,r,n){a===1?r.left=r.top=n.readFloat():a===2?r.width=r.height=n.readFloat():a===3?r.top=n.readFloat():a===4?r.height=n.readFloat():a===5?r.mask_type=n.readVarint():a===6?r.mask_idx=n.readVarint():a===7&&r.children.push(u2(n,n.readVarint()+n.pos))}class mre{static calculate(r={},n=[]){const c=new Map,h=new Map;if(Object.keys(r).length===0)return c;n.forEach(m=>{h.set(m.name,m.rgb_color||new Mi(0,0,0))});for(const[m,g]of Object.entries(r))h.has(m)?c.set(h.get(m).toString(),g):console.warn(`Ignoring unknown image variable "${m}"`);return c}}function Tg(a,r=255,n){const c=r/255,h=a.toString(),m=n.has(h)?n.get(h).clone():a.clone();return m.a*=c,m.toString()}function gv(a,r){if(!Mu()){const n=document.createElement("canvas");return n.width=a,n.height=r,n}return new OffscreenCanvas(a,r)}function gre(a,r){const n=mre.calculate(r.params,a.metadata?a.metadata.variables:[]),c=a.usvg_tree,h=c.width,m=c.height,g=r.transform?r.transform:new DOMMatrix,x=Math.max(1,Math.round(h*g.a)),w=Math.max(1,Math.round(m*g.d)),E=new DOMMatrix([x/h,0,0,w/m,0,0]),I=gv(x,w).getContext("2d");return r3(I,E,c,c,n),I.getImageData(0,0,x,w)}function r3(a,r,n,c,h){for(const m of c.children)z8(a,r,n,m,h)}function z8(a,r,n,c,h){c.group?(a.save(),function(m,g,x,w,E){const I=w.mask_idx!=null?x.masks[w.mask_idx]:null,A=w.clip_path_idx!=null?x.clip_paths[w.clip_path_idx]:null;if(w.transform&&(g=Eg(w.transform).preMultiplySelf(g)),!function(O,V,j){return O.opacity!==255||V||j}(w,A!=null,I!=null))return void r3(m,g,x,w,E);const P=gv(m.canvas.width,m.canvas.height),D=P.getContext("2d");r3(D,g,x,w,E),A&&U8(D,g,x,A),I&&j8(D,g,x,I,E),m.globalAlpha=w.opacity/255,m.drawImage(P,0,0)}(a,r,n,c.group,h),a.restore()):c.path&&(a.save(),function(m,g,x,w,E){m.setTransform(g),w.paint_order===Kte.PAINT_ORDER_FILL_AND_STROKE?(D8(m,x,w,E),F8(m,x,w,E)):(F8(m,x,w,E),D8(m,x,w,E))}
66(a,r,n,c.path,h),a.restore())}function D8(a,r,n,c){const h=n.fill;if(!h)return;const m=h.opacity/255;switch(a.save(),a.beginPath(),G8(n,a),h.paint){case"rgb_color":a.fillStyle=Tg(h.rgb_color,h.opacity,c);break;case"linear_gradient_idx":{const g=r.linear_gradients[h.linear_gradient_idx];g.transform&&a.setTransform(Eg(g.transform).preMultiplySelf(a.getTransform())),a.fillStyle=N8(a,g,m,c);break}case"radial_gradient_idx":{const g=r.radial_gradients[h.radial_gradient_idx];g.transform&&a.setTransform(Eg(g.transform).preMultiplySelf(a.getTransform())),a.fillStyle=B8(a,g,m,c)}}a.fill(O8(n)),a.restore()}function O8(a){return a.rule===e3.PATH_RULE_NON_ZERO?"nonzero":a.rule===e3.PATH_RULE_EVEN_ODD?"evenodd":void 0}function F8(a,r,n,c){const h=n.stroke;if(!h)return;const m=$8(n);a.lineWidth=h.width,a.miterLimit=h.miterlimit,a.setLineDash(h.dasharray),a.lineDashOffset=h.dashoffset;const g=h.opacity/255;switch(h.paint){case"rgb_color":a.strokeStyle=Tg(h.rgb_color,h.opacity,c);break;case"linear_gradient_idx":a.strokeStyle=N8(a,r.linear_gradients[h.linear_gradient_idx],g,c,!0);break;case"radial_gradient_idx":a.strokeStyle=B8(a,r.radial_gradients[h.radial_gradient_idx],g,c,!0)}switch(h.linejoin){case c2.LINE_JOIN_MITER_CLIP:case c2.LINE_JOIN_MITER:a.lineJoin="miter";break;case c2.LINE_JOIN_ROUND:a.lineJoin="round";break;case c2.LINE_JOIN_BEVEL:a.lineJoin="bevel"}switch(h.linecap){case t3.LINE_CAP_BUTT:a.lineCap="butt";break;case t3.LINE_CAP_ROUND:a.lineCap="round";break;case t3.LINE_CAP_SQUARE:a.lineCap="square"}a.stroke(m)}function N8(a,r,n,c,h=!1){if(r.stops.length===1){const P=r.stops[0];return Tg(P.rgb_color,P.opacity*n,c)}const{x1:m,y1:g,x2:x,y2:w}=r;let E=new DOMPoint(m,g),I=new DOMPoint(x,w);if(h){const P=Eg(r.transform);E=P.transformPoint(E),I=P.transformPoint(I)}const A=a.createLinearGradient(E.x,E.y,I.x,I.y);for(const P of r.stops)A.addColorStop(P.offset,Tg(P.rgb_color,P.opacity*n,c));return A}function B8(a,r,n,c,h=!1){if(r.stops.length===1){const X=r.stops[0];return Tg(X.rgb_color,X.opacity*n,c)}const m=Eg(r.transform),{fx:g,fy:x,fr:w,cx:E,cy:I,r:A}=r;let P=new DOMPoint(g,x),D=new DOMPoint(E,I),O=w,V=A;if(h){P=m.transformPoint(P),D=m.transformPoint(D);const X=(m.a+m.d)/2;O=w*X,V=r.r*X}const j=a.createRadialGradient(P.x,P.y,O,D.x,D.y,V);for(const X of r.stops)j.addColorStop(X.offset,Tg(X.rgb_color,X.opacity*n,c));return j}function V8(a,r,n,c){const h=c.transform?Eg(c.transform).preMultiplySelf(r):r,m=gv(a.canvas.width,a.canvas.height),g=m.getContext("2d");for(const w of c.children)if(w.group)V8(g,h,n,w.group);else if(w.path){const E=w.path,I=new Path2D;I.addPath($8(E),h),g.fill(I,O8(E))}const x=c.clip_path_idx!=null?n.clip_paths[c.clip_path_idx]:null;x&&U8(g,h,n,x),a.globalCompositeOperation="source-over",a.drawImage(m,0,0)}function U8(a,r,n,c){const h=gv(a.canvas.width,a.canvas.height);V8(h.getContext("2d"),r,n,c),a.globalCompositeOperation="destination-in",a.drawImage(h,0,0)}function j8(a,r,n,c,h){if(c.children.length===0)return;const m=c.mask_idx!=null?n.masks[c.mask_idx]:null;m&&j8(a,r,n,m,h);const g=a.canvas.width,x=a.canvas.height,w=gv(g,x),E=w.getContext("2d"),I=c.width,A=c.height,P=c.left,D=c.top,O=new Path2D,V=new Path2D;V.rect(P,D,I,A),O.addPath(V,r),E.clip(O);for(const oe of c.children)z8(E,r,n,oe,h);const j=E.getImageData(0,0,g,x),X=j.data;if(c.mask_type===k8.MASK_TYPE_LUMINANCE)for(let oe=0;oe<X.length;oe+=4)X[oe+3]=X[oe+3]/255*(.2126*X[oe]+.7152*X[oe+1]+.0722*X[oe+2]);E.putImageData(j,0,0),a.globalCompositeOperation="destination-in",a.drawImage(w,0,0)}function Eg(a){return a?new DOMMatrix([a.sx,a.ky,a.kx,a.sy,a.tx,a.ty]):new DOMMatrix}function G8(a,r){const n=a.step;let c=a.diffs[0]*n,h=a.diffs[1]*n;r.moveTo(c,h);for(let m=0,g=2;m<a.commands.length;m++)switch(a.commands[m]){case mv.PATH_COMMAND_MOVE:c+=a.diffs[g++]*n,h+=a.diffs[g++]*n,r.moveTo(c,h);break;case mv.PATH_COMMAND_LINE:c+=a.diffs[g++]*n,h+=a.diffs[g++]*n,r.lineTo(c,h);break;case mv.PATH_COMMAND_QUAD:{const x=c+a.diffs[g++]*n,w=h+a.diffs[g++]*n;c=x+a.diffs[g++]*n,h=w+a.diffs[g++]*n,r.quadraticCurveTo(x,w,c,h);break}case mv.PATH_COMMAND_CUBIC:{const x=c+a.diffs[g++]*n,w=h+a.diffs[g++]*n,E=x+a.diffs[g++]*n,I=w+a.diffs[g++]*n;c=E+a.diffs[g++]*n,h=I+a.diffs[g++]*n,r.bezierCurveTo(x,w,E,I,c,h);break}case mv.PATH_COMMAND_CLOSE:r.closePath()}return r}function $8(a){return G8(a,new Path2D)}class f2{constructor(r){this.capacity=r,this.cache=new Map}get(r){if(!this.cache.has(r))return;const n=this.cache.get(r);return this.cache.delete(r),this.cache.set(r,n),n}put(r,n){this.cache.has(r)?this.cache.delete(r):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(r,n)}delete(r){this.cache.delete(r)}}Jt(f2,"LRUCache");class i3{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new $o(r,r.data)}getFromCache(r,n,c){return this.cacheMap.has(c)||this.cacheMap.set(c,new f2(150)),this.cacheMap.get(c).get(ld(r.toString(),n))}setInCache(r,n,c,h){this.cacheDependenciesMap.has(h)||this.cacheDependenciesMap.set(h,new Map),this.cacheMap.has(h)||this.cacheMap.set(h,new f2(150));const m=this.cacheDependenciesMap.get(h),g=ld(r.id.toString(),c);m.get(g)||m.set(g,new Set);const x=this.cacheMap.get(h),w=r.toString();m.get(g).add(w),x.put(ld(r.toString(),c),n)}removeImagesFromCacheByIds(r,n,c=0){if(!this.cacheMap.has(c)||!this.cacheDependenciesMap.has(c))return;const h=this.cacheMap.get(c),m=this.cacheDependenciesMap.get(c);for(const g of r){const x=ld(g.toString(),n);if(m.has(x)){for(const w of m.get(x))h.delete(w);m.delete(x)}}}rasterize(r,n,c,h,m=gre){const g=this.getFromCache(r,c,h);if(g)return g.clone();const x=m(n.icon,r.options),w=i3._getImage(x);return this.setInCache(r,w,c,h),w.clone()}}class H8{constructor(r){this.size=r,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(r,n){const c=this.toIdx(r,n);return{min:this.minimums[c],max:this.maximums[c]}}isLeaf(r,n){return this.leaves[this.toIdx(r,n)]}toIdx(r,n){return n*this.size+r}}function q8(a,r,n,c){let h=0,m=Number.MAX_VALUE;for(let g=0;g<3;g++)if(Math.abs(c[g])<1e-15){if(n[g]<a[g]||n[g]>r[g])return null}else{const x=1/c[g];let w=(a[g]-n[g])*x,E=(r[g]-n[g])*x;if(w>E){const I=w;w=E,E=I}if(w>h&&(h=w),E<m&&(m=E),h>m)return null}return h}function Z8(a,r,n,c,h,m,g,x,w,E,I){const A=c-a,P=h-r,D=m-n,O=g-a,V=x-r,j=w-n,X=I[1]*j-I[2]*V,oe=I[2]*O-I[0]*j,ne=I[0]*V-I[1]
vendor: 4,495 bytes, line 66
66*O,ae=A*X+P*oe+D*ne;if(Math.abs(ae)<1e-15)return null;const Ie=1/ae,be=E[0]-a,Te=E[1]-r,Le=E[2]-n,De=(be*X+Te*oe+Le*ne)*Ie;if(De<0||De>1)return null;const lt=Te*D-Le*P,je=Le*A-be*D,ht=be*P-Te*A,Lt=(I[0]*lt+I[1]*je+I[2]*ht)*Ie;return Lt<0||De+Lt>1?null:(O*lt+V*je+j*ht)*Ie}function W8(a,r,n){return(a-r)/(n-r)}function X8(a,r,n,c,h,m,g,x,w){const E=1<<n,I=m-c,A=g-h,P=(a+1)/E*I+c,D=(r+0)/E*A+h,O=(r+1)/E*A+h;x[0]=(a+0)/E*I+c,x[1]=D,w[0]=P,w[1]=O}class Y8{constructor(r){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=r,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const n=function(m){const g=Math.ceil(Math.log2(m.dim/8)),x=[];let w=Math.ceil(Math.pow(2,g));const E=1/w,I=(D,O,V,j,X)=>{const oe=j?1:0,ne=(D+1)*V-oe,ae=O*V,Ie=(O+1)*V-oe;X[0]=D*V,X[1]=ae,X[2]=ne,X[3]=Ie};let A=new H8(w);const P=[];for(let D=0;D<w*w;D++){I(D%w,Math.floor(D/w),E,!1,P);const O=Ad(P[0],P[1],m),V=Ad(P[2],P[1],m),j=Ad(P[2],P[3],m),X=Ad(P[0],P[3],m);A.minimums.push(Math.min(O,V,j,X)),A.maximums.push(Math.max(O,V,j,X)),A.leaves.push(1)}for(x.push(A),w/=2;w>=1;w/=2){const D=x[x.length-1];A=new H8(w);for(let O=0;O<w*w;O++){I(O%w,Math.floor(O/w),2,!0,P);const V=D.getElevation(P[0],P[1]),j=D.getElevation(P[2],P[1]),X=D.getElevation(P[2],P[3]),oe=D.getElevation(P[0],P[3]),ne=D.isLeaf(P[0],P[1]),ae=D.isLeaf(P[2],P[1]),Ie=D.isLeaf(P[2],P[3]),be=D.isLeaf(P[0],P[3]),Te=Math.min(V.min,j.min,X.min,oe.min),Le=Math.max(V.max,j.max,X.max,oe.max),De=ne&&ae&&Ie&&be;A.maximums.push(Le),A.minimums.push(Te),A.leaves.push(Le-Te<=5&&De?1:0)}x.push(A)}return x}(this.dem),c=n.length-1,h=n[c];this._addNode(h.minimums[0],h.maximums[0],h.leaves[0]),this._construct(n,0,0,c,0)}raycastRoot(r,n,c,h,m,g,x=1){return q8([r,n,-100],[c,h,this.maximums[0]*x],m,g)}raycast(r,n,c,h,m,g,x=1){if(!this.nodeCount)return null;const w=this.raycastRoot(r,n,c,h,m,g,x);if(w==null)return null;const E=[],I=[],A=[],P=[],D=[{idx:0,t:w,nodex:0,nodey:0,depth:0}];for(;D.length>0;){const{idx:O,t:V,nodex:j,nodey:X,depth:oe}=D.pop();if(this.leaves[O]){X8(j,X,oe,r,n,c,h,A,P);const ae=1<<oe,Ie=(j+0)/ae,be=(j+1)/ae,Te=(X+0)/ae,Le=(X+1)/ae,De=Ad(Ie,Te,this.dem)*x,lt=Ad(be,Te,this.dem)*x,je=Ad(be,Le,this.dem)*x,ht=Ad(Ie,Le,this.dem)*x,Lt=Z8(A[0],A[1],De,P[0],A[1],lt,P[0],P[1],je,m,g),gt=Z8(P[0],P[1],je,A[0],P[1],ht,A[0],A[1],De,m,g),St=Math.min(Lt!==null?Lt:Number.MAX_VALUE,gt!==null?gt:Number.MAX_VALUE);if(St!==Number.MAX_VALUE)return St;{const kt=gr([],m,g,V);if(K8(De,lt,ht,je,W8(kt[0],A[0],P[0]),W8(kt[1],A[1],P[1]))>=kt[2])return V}continue}let ne=0;for(let ae=0;ae<this._siblingOffset.length;ae++){X8((j<<1)+this._siblingOffset[ae][0],(X<<1)+this._siblingOffset[ae][1],oe+1,r,n,c,h,A,P),A[2]=-100,P[2]=this.maximums[this.childOffsets[O]+ae]*x;const Ie=q8(A,P,m,g);if(Ie!=null){const be=Ie;E[ae]=be;let Te=!1;for(let Le=0;Le<ne&&!Te;Le++)be>=E[I[Le]]&&(I.splice(Le,0,ae),Te=!0);Te||(I[ne]=ae),ne++}}for(let ae=0;ae<ne;ae++){const Ie=I[ae];D.push({idx:this.childOffsets[O]+Ie,t:E[Ie],nodex:(j<<1)+this._siblingOffset[Ie][0],nodey:(X<<1)+this._siblingOffset[Ie][1],depth:oe+1})}}return null}_addNode(r,n,c){return this.minimums.push(r),this.maximums.push(n),this.leaves.push(c),this.childOffsets.push(0),this.nodeCount++}_construct(r,n,c,h,m){if(r[h].isLeaf(n,c)===1)return;this.childOffsets[m]||(this.childOffsets[m]=this.nodeCount);const g=h-1,x=r[g];let w=0,E=0;for(let I=0;I<this._siblingOffset.length;I++){const A=2*n+this._siblingOffset[I][0],P=2*c+this._siblingOffset[I][1],D=x.getElevation(A,P),O=x.isLeaf(A,P),V=this._addNode(D.min,D.max,O);O&&(w|=1<<I),E||(E=V)}for(let I=0;I<this._siblingOffset.length;I++)w&1<<I||this._construct(r,2*n+this._siblingOffset[I][0],2*c+this._siblingOffset[I][1],g,E+I)}}function K8(a,r,n,c,h,m){return _r(_r(a,n,m),_r(r,c,m),h)}function Ad(a,r,n){const c=n.dim,h=J(a*c-.5,0,c-1),m=J(r*c-.5,0,c-1),g=Math.floor(h),x=Math.floor(m),w=Math.min(g+1,c-1),E=Math.min(x+1,c-1);return K8(n.get(g,x),n.get(w,x),n.get(g,E),n.get(w,E),h-g,m-x)}const _re={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function yre(a,r,n){return(256*a*256+256*r+n)/10-1e4}function vre(a,r,n){return 256*a+r+n/256-32768}class p2{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(r,n,c,h=!1){if(this.uid=r,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(c&&c!=="mapbox"&&c!=="terrarium")return void Ar(`"${c}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=n.height;
vendor: 5,274 bytes, line 66
66const m=this.dim=n.height-2,g=new Uint32Array(n.data.buffer);if(this.pixels=new Uint8Array(n.data.buffer),this.floatView=new Float32Array(n.data.buffer),this.borderReady=h,this._modifiedForSources={},!h){for(let w=0;w<m;w++)g[this._idx(-1,w)]=g[this._idx(0,w)],g[this._idx(m,w)]=g[this._idx(m-1,w)],g[this._idx(w,-1)]=g[this._idx(w,0)],g[this._idx(w,m)]=g[this._idx(w,m-1)];g[this._idx(-1,-1)]=g[this._idx(0,0)],g[this._idx(m,-1)]=g[this._idx(m-1,0)],g[this._idx(-1,m)]=g[this._idx(0,m-1)],g[this._idx(m,m)]=g[this._idx(m-1,m-1)]}const x=c==="terrarium"?vre:yre;for(let w=0;w<g.length;++w){const E=4*w;this.floatView[w]=x(this.pixels[E],this.pixels[E+1],this.pixels[E+2])}this._timestamp=ca.now()}_buildQuadTree(){this._tree=new Y8(this)}get(r,n,c=!1){c&&(r=J(r,-1,this.dim),n=J(n,-1,this.dim));const h=this._idx(r,n);return this.floatView[h]}set(r,n,c){const h=this._idx(r,n),m=this.floatView[h];return this.floatView[h]=c,c-m}static getUnpackVector(r){return _re[r]}_idx(r,n){if(r<-1||r>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(r+1)}static pack(r,n){const c=[0,0,0,0],h=p2.getUnpackVector(n);let m=Math.floor((r+h[3])/h[2]);return c[2]=m%256,m=Math.floor(m/256),c[1]=m%256,m=Math.floor(m/256),c[0]=m,c}getPixels(){return new qU({width:this.stride,height:this.stride},this.pixels)}backfillBorder(r,n,c){if(this.dim!==r.dim)throw new Error("dem dimension mismatch");let h=n*this.dim,m=n*this.dim+this.dim,g=c*this.dim,x=c*this.dim+this.dim;switch(n){case-1:h=m-1;break;case 1:m=h+1}switch(c){case-1:g=x-1;break;case 1:x=g+1}const w=-n*this.dim,E=-c*this.dim;for(let I=g;I<x;I++)for(let A=h;A<m;A++){const P=4*this._idx(A,I),D=4*this._idx(A+w,I+E);this.pixels[P+0]=r.pixels[D+0],this.pixels[P+1]=r.pixels[D+1],this.pixels[P+2]=r.pixels[D+2],this.pixels[P+3]=r.pixels[D+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function xre(a,r,n){a===1?r.headerLength=n.readFixed32():a===2?r.x=n.readVarint():a===3?r.y=n.readVarint():a===4?r.z=n.readVarint():a===5&&r.layers.push(function(c,h){return c.readFields(Sre,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},h)}(n,n.readVarint()+n.pos))}function bre(a,r,n){a===1?(r.delta_filter=function(c,h){return c.readFields(wre,{blockSize:0},h)}(n,n.readVarint()+n.pos),r.filter="delta_filter"):a===2?(n.readVarint(),r.filter="zigzag_filter"):a===3?(n.readVarint(),r.filter="bitshuffle_filter"):a===4&&(n.readVarint(),r.filter="byteshuffle_filter")}function wre(a,r,n){a===1&&(r.blockSize=n.readVarint())}function Tre(a,r,n){a===1?(n.readVarint(),r.codec="gzip_data"):a===2?(n.readVarint(),r.codec="jpeg_image"):a===3?(n.readVarint(),r.codec="webp_image"):a===4&&(n.readVarint(),r.codec="png_image")}function Ere(a,r,n){let c=0,h=0;a===1?r.firstByte=n.readFixed64():a===2?r.lastByte=n.readFixed64():a===3?r.filters.push(function(m,g){return m.readFields(bre,{},g)}(n,n.readVarint()+n.pos)):a===4?r.codec=function(m,g){return m.readFields(Tre,{},g)}(n,n.readVarint()+n.pos):a===5?h=n.readFloat():a===6?c=n.readFloat():a===7?r.bands.push(n.readString()):a===8?r.offset=n.readDouble():a===9&&(r.scale=n.readDouble()),r.offset===0&&(r.offset=h),r.scale===0&&(r.scale=c)}function Sre(a,r,n){a===1?r.version=n.readVarint():a===2?r.name=n.readString():a===3?r.units=n.readString():a===4?r.tileSize=n.readVarint():a===5?r.buffer=n.readVarint():a===6?r.pixelFormat=n.readVarint():a===7&&r.dataIndex.push(function(c,h){return c.readFields(Ere,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},h)}(n,n.readVarint()+n.pos))}function Cre(a,r,n){if(a===2)(function(c,h,m){c.readFields(Ire,m,h)})(n,n.readVarint()+n.pos,r);else if(a===3)throw new Error("Not implemented")}function Ire(a,r,n){if(a===1){let c=0;const h=n.readVarint()+n.pos;for(;n.pos<h;)r[c++]=n.readVarint()}}function Are(a,r){if(r.length!==4)throw new Error(`Expected data of dimension 4 but got ${r.length}.`);let n=r[3];for(let c=2;c>=1;c--){const h=c===1?1:0,m=c===2?1:0;for(let g=0;g<r[0];g++){const x=r[1]*g;for(let w=h;w<r[1];w++){const E=r[2]*(w+x);for(let I=m;I<r[2];I++){const A=r[3]*(I+E);for(let P=0;P<r[3];P++){const D=A+P;a[D]+=a[D-n]}}}}n*=r[c]}return a}function Pre(a){for(let r=0,n=a.length;r<n;r++)a[r]=a[r]>>>1^-(1&a[r]);return a}function Mre(a,r){switch(r){case"uint32":return a;case"uint16":for(let n=0;n<a.length;n+=2){const c=a[n],h=a[n+1];a[n]=(240&c)>>4|(61440&c)>>8|(240&h)<<4|61440&h,a[n+1]=15&c|(3840&c)>>4|(15&h)<<8|(3840&h)<<4}return a;case"uint8":for(let n=0;n<a.length;n+=4){const c=a[n],h=a[n+1],m=a[n+2],g=a[n+3];a[n+0]=(192&c)>>6|(192&h)>>4|(192&m)>>2|192&g,a[n+1]=(48&c)>>4|(48&h)>>2|48&m|(48&g)<<2,a[n+2]=(12&c)>>2|12&h|(12&m)<<2|(12&g)<<4,a[n+3]=3&c|(3&h)<<2|(3&m)<<4|(3&g)<<6}return a;default:throw new Error(`Invalid pixel format, "${r}"`)}}Jt(p2,"DEMData"),Jt(Y8,"DemMinMaxQuadTree",{omit:["dem"]});var al=Uint8Array,_v=Uint16Array,kre=Int32Array,J8=new al([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Q8=new al([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Rre=new al([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eG=function(a,r){for(var n=new _v(31),c=0;c<31;++c)n[c]=r+=1<<a[c-1];var h=new kre(n[30]);for(c=1;c<30;++c)for(var m=n[c];m<n[c+1];
vendor: 1,043 bytes, line 66
66++m)h[m]=m-n[c]<<5|c;return{b:n,r:h}},tG=eG(J8,2),rG=tG.b,Lre=tG.r;rG[28]=258,Lre[258]=28;for(var zre=eG(Q8,0).b,iG=new _v(32768),co=0;co<32768;++co){var Sg=(43690&co)>>1|(21845&co)<<1;iG[co]=((65280&(Sg=(61680&(Sg=(52428&Sg)>>2|(13107&Sg)<<2))>>4|(3855&Sg)<<4))>>8|(255&Sg)<<8)>>1}var yv=function(a,r,n){for(var c=a.length,h=0,m=new _v(r);h<c;++h)a[h]&&++m[a[h]-1];var g,x=new _v(r);for(h=1;h<r;++h)x[h]=x[h-1]+m[h-1]<<1;g=new _v(1<<r);var w=15-r;for(h=0;h<c;++h)if(a[h])for(var E=h<<4|a[h],I=r-a[h],A=x[a[h]-1]++<<I,P=A|(1<<I)-1;A<=P;++A)g[iG[A]>>w]=E;return g},vv=new al(288);for(co=0;co<144;++co)vv[co]=8;for(co=144;co<256;++co)vv[co]=9;for(co=256;co<280;++co)vv[co]=7;for(co=280;co<288;++co)vv[co]=8;var nG=new al(32);for(co=0;co<32;++co)nG[co]=5;var Dre=yv(vv,9),Ore=yv(nG,5),n3=function(a){for(var r=a[0],n=1;n<a.length;++n)a[n]>r&&(r=a[n]);return r},mc=function(a,r,n){var c=r/8|0;return(a[c]|a[c+1]<<8)>>(7&r)&n},o3=function(a,r){var n=r/8|0;return(a[n]|a[n+1]<<8|a[n+2]<<16)>>(7&r)},Fre=["unexpected EOF","invalid block type","invali
66d length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],gc=function(a,r,n){var c=new Error(r||Fre[a]);if(c.code=a,Error.captureStackTrace&&Error.captureStackTrace(c,gc),!n)throw c;return c},Nre=new al(0),Bre=typeof TextDecoder<"u"&&new TextDecoder;try{Bre.decode(Nre,{stream:!0})}catch{}const Vre={gzip_data:"gzip"};class Nl extends Error{constructor(r){super(r),this.name="MRTError"}}const Ure={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},oG={uint32:1,uint16:2,uint8:4},jre={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let s3;class m2{constructor(r=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=r}getLayer(r){const n=this.layers[r];if(!n)throw new Nl(`Layer '${r}' not found`);return n}getHeaderLength(r){const n=new Uint8Array(r),c=new DataView(r);if(n[0]!==13)throw new Nl("File is not a valid MRT.");return c.getUint32(1,!0)}parseHeader(r){const n=new Uint8Array(r),c=this.getHeaderLength(r);if(n.length<c)throw new Nl(`Expected header with length >= ${c} but got buffer of length ${n.length}`);const h=new s3(n.subarray(0,c)).readFields(xre,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==h.x||this.y!==h.y||this.z!==h.z))throw new Nl(`Invalid attempt to parse header ${h.z}/${h.x}/${h.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=h.x,this.y=h.y,this.z=h.z;for(const m of h.layers)this.layers[m.name]=new sG(m,{cacheSize:this._cacheSize});return this}createDecodingTask(r){const n=[],c=this.getLayer(r.layerName);for(let h of r.blockIndices){const m=c.dataIndex[h],g=m.firstByte-r.firstByte,x=m.lastByte-r.firstByte;if(c._blocksInProgress.has(h))continue;const w={layerName:c.name,firstByte:g,lastByte:x,pixelFormat:c.pixelFormat,blockIndex:h,blockShape:[m.bands.length].concat(c.bandShape),buffer:c.buffer,codec:m.codec.codec,filters:m.filters.map(E=>E.filter)};c._blocksInProgress.add(h),n.push(w)}return new aG(n,()=>{n.forEach(h=>c._blocksInProgress.delete(h.blockIndex))},(h,m)=>{if(n.forEach(g=>c._blocksInProgress.delete(g.blockIndex)),h)throw h;m.forEach(g=>{this.getLayer(g.layerName).processDecodedData(g)})})}}class sG{constructor({version:r,name:n,units:c,tileSize:h,pixelFormat:m,buffer:g,dataIndex:x},w){if(this.version=r,this.version!==1)throw new Nl(`Cannot parse raster layer encoded with MRT version ${r}`);this.name=n,this.units=c,this.tileSize=h,this.buffer=g,this.pixelFormat=Ure[m],this.dataIndex=x,this.bandShape=[h+2*g,h+2*g,oG[this.pixelFormat]],this._decodedBlocks=new f2(w?w.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return oG[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:r})=>r).flat()}processDecodedData(r){const n=r.blockIndex.toString();this._decodedBlocks.get(n)||this._decodedBlocks.put(n,r.data)}getBlockForBand(r){let n=0;switch(typeof r){case"string":for(const[c,h]of this.dataIndex.entries()){for(const[m,g]of h.bands.entries())if(g===r)return{bandIndex:n+m,blockIndex:c,blockBandIndex:m};n+=h.bands.length}break;case"number":for(const[c,h]of this.dataIndex.entries()){if(r>=n&&r<n+h.bands.length)return{bandIndex:r,blockIndex:c,blockBandIndex:r-n};n+=h.bands.length}break;default:throw new Nl(`Invalid band \`${JSON.stringify(r)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(r){let n=1/0,c=-1/0;const h=[],m=new Set;for(const g of r){const{blockIndex:x}=this.getBlockForBand(g);if(x<0)throw new Nl(`Invalid band: ${JSON.stringify(g)}`);const w=this.dataIndex[x];h.includes(x)||h.push(x),m.add(x),n=Math.min(n,w.firstByte),c=Math.max(c,w.lastByte)}if(m.size>this.cacheSize)throw new Nl(`Number of blocks to decode (${m.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:n,lastByte:c,blockIndices:h}}hasBand(r){const{blockIndex:n}=this.getBlockForBand(r);return n>=0}hasDataForBand(r){const{blockIndex:n}=this.getBlockForBand(r);return n>=0&&!!this._decodedBlocks.get(n.toString())}getBandView(r){const{blockIndex:n,blockBandIndex:c}=this.getBlockForBand(r);if(n<0)throw new Nl(`Band not found: ${JSON.stringify(r)}`);const h=this._decodedBlocks.get(n.toString());if(!h)throw new Nl(`Data for band ${JSON.stringify(r)} of layer "${this.name}" not decoded.`);const m=this.dataIndex[n],g=this.bandShape.reduce((E,I)=>E*I,1),x=c*g,w=h.subarray(x,x+g);return{data:w,bytes:new Uint8Array(w.buffer).subarray(w.byteOffset,w.b
vendor: 11,183 bytes, line 66
66yteOffset+w.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:m.offset,scale:m.scale}}}m2.setPbf=function(a){s3=a};class aG{constructor(r,n,c){this.tasks=r,this._onCancel=n,this._onComplete=c,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(r,n){this._finalized||(this._onComplete(r,n),this._finalized=!0)}}m2.performDecoding=function(a,r){const n=new Uint8Array(a);return Promise.all(r.tasks.map(c=>{const{layerName:h,firstByte:m,lastByte:g,pixelFormat:x,blockShape:w,blockIndex:E,filters:I,codec:A}=c,P=n.subarray(m,g+1),D=new Uint32Array(w[0]*w[1]*w[2]);let O;if(A!=="gzip_data")throw new Nl(`Unhandled codec: ${A}`);return O=function(V,j){if(!globalThis.DecompressionStream&&j==="gzip_data")return Promise.resolve(((ae=function(Te){Te[0]==31&&Te[1]==139&&Te[2]==8||gc(6,"invalid gzip data");var Le=Te[3],De=10;4&Le&&(De+=2+(Te[10]|Te[11]<<8));for(var lt=(Le>>3&1)+(Le>>4&1);lt>0;lt-=!Te[De++]);return De+(2&Le)}(ne=V))+8>ne.length&&gc(6,"invalid gzip data"),function(Te,Le,De,lt){var je=Te.length;if(!je||Le.f&&!Le.l)return De||new al(0);var ht=!De,Lt=ht||Le.i!=2,gt=Le.i;ht&&(De=new al(3*je));var St,kt,st=function(wn){var cn=De.length;if(wn>cn){var Ji=new al(Math.max(2*cn,wn));Ji.set(De),De=Ji}},Ct=Le.f||0,$e=Le.p||0,at=Le.b||0,Dt=Le.l,At=Le.d,sr=Le.m,Qt=Le.n,bt=8*je;do{if(!Dt){Ct=mc(Te,$e,1);var Pt=mc(Te,$e+1,3);if($e+=3,!Pt){var rr=Te[(ue=4+(($e+7)/8|0))-4]|Te[ue-3]<<8,Wt=ue+rr;if(Wt>je){gt&&gc(0);break}Lt&&st(at+rr),De.set(Te.subarray(ue,Wt),at),Le.b=at+=rr,Le.p=$e=8*Wt,Le.f=Ct;continue}if(Pt==1)Dt=Dre,At=Ore,sr=9,Qt=5;else if(Pt==2){var Ut=mc(Te,$e,31)+257,Xt=mc(Te,$e+10,15)+4,xr=Ut+mc(Te,$e+5,31)+1;$e+=14;for(var Mr=new al(xr),Or=new al(19),Rr=0;Rr<Xt;++Rr)Or[Rre[Rr]]=mc(Te,$e+3*Rr,7);$e+=3*Xt;var ri=n3(Or),Hr=(1<<ri)-1,ln=yv(Or,ri);for(Rr=0;Rr<xr;){var ue,he=ln[mc(Te,$e,Hr)];if($e+=15&he,(ue=he>>4)<16)Mr[Rr++]=ue;else{var it=0,Ot=0;for(ue==16?(Ot=3+mc(Te,$e,3),$e+=2,it=Mr[Rr-1]):ue==17?(Ot=3+mc(Te,$e,7),$e+=3):ue==18&&(Ot=11+mc(Te,$e,127),$e+=7);Ot--;)Mr[Rr++]=it}}var $t=Mr.subarray(0,Ut),Gt=Mr.subarray(Ut);sr=n3($t),Qt=n3(Gt),Dt=yv($t,sr),At=yv(Gt,Qt)}else gc(1);if($e>bt){gt&&gc(0);break}}Lt&&st(at+131072);for(var tr=(1<<sr)-1,Ir=(1<<Qt)-1,Jr=$e;;Jr=$e){var Qr=(it=Dt[o3(Te,$e)&tr])>>4;if(($e+=15&it)>bt){gt&&gc(0);break}if(it||gc(2),Qr<256)De[at++]=Qr;else{if(Qr==256){Jr=$e,Dt=null;break}var jr=Qr-254;Qr>264&&(jr=mc(Te,$e,(1<<(Fr=J8[Rr=Qr-257]))-1)+rG[Rr],$e+=Fr);var Bi=At[o3(Te,$e)&Ir],Cn=Bi>>4;if(Bi||gc(3),$e+=15&Bi,Gt=zre[Cn],Cn>3){var Fr=Q8[Cn];Gt+=o3(Te,$e)&(1<<Fr)-1,$e+=Fr}if($e>bt){gt&&gc(0);break}Lt&&st(at+131072);var fn=at+jr;if(at<Gt){var Ki=0-Gt,Ri=Math.min(Gt,fn);for(Ki+at<0&&gc(3);at<Ri;++at)De[at]=(void 0)[Ki+at]}for(;at<fn;++at)De[at]=De[at-Gt]}}Le.l=Dt,Le.p=Jr,Le.b=at,Le.f=Ct,Dt&&(Ct=1,Le.m=sr,Le.d=At,Le.n=Qt)}while(!Ct);return at!=De.length&&ht?(St=De,((kt=at)==null||kt>St.length)&&(kt=St.length),new al(St.subarray(0,kt))):De.subarray(0,at)}(ne.subarray(ae,-8),{i:2},new al(((X=ne)[(oe=X.length)-4]|X[oe-3]<<8|X[oe-2]<<16|X[oe-1]<<24)>>>0))));var X,oe,ne,ae;const Ie=Vre[j];if(!Ie)throw new Error(`Unhandled codec: ${j}`);const be=new globalThis.DecompressionStream(Ie);return new Response(new Blob([V]).stream().pipeThrough(be)).arrayBuffer().then(Te=>new Uint8Array(Te))}(P,A).then(V=>(function(j,X){j.readFields(Cre,X)}(new s3(V),D),new jre[x](D.buffer))),O.then(V=>{for(let j=I.length-1;j>=0;j--)switch(I[j]){case"delta_filter":Are(V,w);break;case"zigzag_filter":Pre(V);break;case"bitshuffle_filter":Mre(V,x);break;default:throw new Nl(`Unhandled filter "${I[j]}"`)}return{layerName:h,blockIndex:E,data:V}}).catch(V=>{throw V})}))},Jt(aG,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Jt(m2,"MapboxRasterTile"),Jt(sG,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class lG{constructor(r){this._stringToNumber={},this._numberToString=[];for(let n=0;n<r.length;n++){const c=r[n];this._stringToNumber[c]=n,this._numberToString[n]=c}}encode(r){return this._stringToNumber[r]}decode(r){return this._numberToString[r]}}const Gre=["id","tile","layer","source","sourceLayer","state"];class Cg{constructor(r,n,c,h,m){this.type="Feature",this._vectorTileFeature=r,this._z=n,this._x=c,this._y=h,this.properties=r.properties,this.id=m}clone(){const r=new Cg(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(r.state=Object.assign({},this.state)),this.layer&&(r.layer=Object.assign({},this.layer)),this.source&&(r.source=this.source),this.sourceLayer&&(r.sourceLayer=this.sourceLayer),r}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(r){this._geometry=r}toJSON(){const r={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const n of Gre)this[n]!==void 0&&(r[n]=this[n]);return r}}class cG{constructor(r,n){this.tileID=r,this.x=r.canonical.x,this.y=r.canonical.y,this.z=r.canonical.z,this.grid=new Jc(Vt,16,0),this.featureIndexArray=new dw,this.promoteId=n,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(r,n,c,h,m,g=0,x=0){const w=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(c,h,m,g);const E=this.grid;for(let I=0;I<n.length;I++){const A=n[I],P=[1/0,1/0,-1/0,-1/0];for(let D=0;D<A.length;D++){const O=A[D];P[0]=Math.min(P[0],O.x),P[1]=Math.min(P[1],O.y),P[2]=Math.max(P[2],O.x),P[3]=Math.max(P[3],O.y)}x!==0&&(P[0]-=x,P[1]-=x,P[2]+=x,P[3]+=x),P[0]<Vt&&P[1]<Vt&&P[2]>=0&&P[3]>=0&&E.insert(w,P[0],P[1],P[2],P[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new ir(new Gw(this.rawTileData)).layers,this.sourceLayerCoder=new lG(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const r in this.vtLayers)this.vtFeatures[r]=[]}return this.vtLayers}query(r,n){const{tilespaceGeometry:c,transform:h,tileTransform:m,pixelPosMatrix:g,availableImages:x,worldview:w}=n;this.loadVTLayers(),this.serializedLayersCache.clear();const E=c.bufferedTilespaceBounds,I=this.grid.query(E.min.x,E.min.y,E.max.x,E.max.y,(O,V,j,X)=>Dn(c.bufferedTilespaceGeometry,O,V,j,X));I.sort($re);let A=null;h.elevation&&I.length>0&&(A=wg.create(h.elevation,this.tileID));const P={};let D;for(let O=0;O<I.length;O++){const V=I[O];if(V===D)continue;D=V;const j=this.featureIndexArray.get(V);let X=null;this.is3DTile?this.loadMatchingModelFeature(P,j,r,c,h,w):this.loadMatchingFeature(P,j,r,x,w,(oe,ne,ae,Ie=0)=>(X||(X=Pe(oe,this.tileID.canonical,m)),ne.queryIntersectsFeature(c,oe,ae,X,this.z,h,g,A,Ie)))}return P}loadMatchingFeature(r,n,c,h,m,g){const{featureIndex:x,bucketIndex:w,sourceLayerIndex:E,layoutVertexArrayOffset:I}=n,A=this.bucketLayerIDs[w],P=c.layers,D=Object.keys(P);if(D.length&&!Er(D,A))return;const O=c.sourceCache,V=this.sourceLayerCoder.decode(E),j=this.vtLayers[V].feature(x),X=this.getId(j,V);for(let oe=0;oe<A.length;oe++){const ne=A[oe];if(!P[ne])continue;const{styleLayer:ae,targets:Ie}=P[ne];let be={};X!==void 0&&(be=O.getFeatureState(ae.sourceLayer,X));const Te=!g||g(j,ae,be,I);if(!Te)continue;const Le=new Cg(j,this.z,this.x,this.y,X);Le.tile=this.tileID.canonical,Le.state=be;let De=this.serializedLayersCache.get(ne);De||(De=ae.serialize(),De.id=ne,this.serializedLayersCache.set(ne,De)),Le.source=De.source,Le.sourceLayer=De["source-layer"],Le.layer=Re({},De),Le.layer.paint=uG(De.paint,ae.paint,j,be,h),Le.layer.layout=uG(De.layout,ae.layout,j,be,h);let lt=!1;for(const je of Ie){this.updateFeatureProperties(Le,je);const{filter:ht}=je;if(ht){if(j.properties=Le.properties,ht.needGeometry){const Lt=nt(j,!0);if(!ht.filter(new Ni(this.tileID.overscaledZ,{worldview:m}),Lt,this.tileID.canonical))continue}else if(!ht.filter(new Ni(this.tileID.overscaledZ,{worldview:m}),j))continue}lt=!0,je.targetId&&this.addFeatureVariant(Le,je)}lt&&this.appendToResult(r,ne,x,Le,Te)}}loadMatchingModelFeature(r,n,c,h,m,g){const{featureIndex:x,bucketIndex:w}=n,E=this.bucketLayerIDs[w],I=c.layers,A=Object.keys(I);if(!A.length||Er(A,E))for(let P=0;P<E.length;P++){const D=E[P],{styleLayer:O,targets:V}=I[D];if(O.type!=="model")continue;const j=h.tile,X=j.getBucket(O);if(!(X&&X instanceof l2))continue;const oe=Xte(X,x,h,m);if(!oe)continue;const{z:ne,x:ae,y:Ie}=j.tileID.canonical,{feature:be,intersectionZ:Te,position:Le}=oe;let De={};be.id!==void 0&&(De=c.sourceCache.getFeatureState(O.sourceLayer,be.id));const lt=new Cg({},ne,ae,Ie,be.id);lt.tile=this.tileID.canonical,lt.state=De,lt.properties=be.properties,lt.geometry={type:"Point",coordinates:[Le.lng,Le.lat]};let je=this.serializedLayersCache.get(D);je||(je=O.serialize(),je.id=D,this.serializedLayersCache.set(D,je)),lt.source=je.source,lt.sourceLayer=je["source-layer"],lt.layer=Re({},je);let ht=!1;for(const Lt of V){this.updateFeatureProperties(lt,Lt);const{filter:gt}=Lt;if(gt){if(be.properties=lt.properties,gt.needGeometry){if(!gt.filter(new Ni(this.tileID.overscaledZ,{worldview:g}),be,this.tileID.canonical))continue}else if(!gt.filter(new Ni(this.tileID.overscaledZ,{worldview:g}),be))continue}ht=!0,Lt.targetId&&this.addFeatureVariant(lt,Lt)}ht&&this.appendToResult(r,D,x,lt,Te)}}updateFeatureProperties(r,n,c){if(n.properties){const h={};for(const m in n.properties){const g=n.properties[m].evaluate({zoom:this.z},r._vectorTileFeature,r.state,r.tile,c);g!=null&&(h[m]=g)}r.properties=h}}addFeatureVariant(r,n,c){const h={target:n.target,namespace:n.namespace,uniqueFeatureID:n.uniqueFeatureID};n.properties&&(h.properties=r.properties),r.variants=r.variants||{},r.variants[n.targetId]=r.variants[n.targetId]||[],r.variants[n.targetId].push(h)}appendToResult(r,n,c,h,m){let g=r[n];g===void 0&&(g=r[n]=[]),g.push({featureIndex:c,feature:h,intersectionZ:m})}lookupSymbolFeatures(r,n,c,h,m,g){const x={};this.loadVTLayers();for(const w of r)this.loadMatchingFeature(x,{bucketIndex:n,sourceLayerIndex:c,featureIndex:w,layoutVertexArrayOffset:0},h,m,g);return x}loadFeature(r){const{featureIndex:n,sourceLayerIndex:c}=r;this.loadVTLayers();const h=this.sourceLayerCoder.decode(c),m=this.vtFeatures[h];if(m[n])return m[n];const g=this.vtLayers[h].feature(n);return m[n]=g,g}hasLayer(r){for(const n of this.bucketLayerIDs)for(const c of n)if(r===c)return!0;return!1}getId(r,n){let c=r.id;if(this.promoteId){const h=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[n];if(h!=null)if(Array.isArray(h)){if(!this.promoteIdExpression){const m=$u(h);if(m.result!=="success"){const g=m.value.map(x=>`${x.key}: ${x.message}`).join(", ");return void Ar(`Failed to create expression for promoteId: ${g}`)}this.promoteIdExpression=m.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new Pf),c=this.promoteIdExpression.evaluate({zoom:0},r)}else c=r.properties[h];typeof c=="boolean"&&(c=Number(c))}return c}}function uG(a,r,n,c,h){return Kt(a,(m,g)=>{const x=r instanceof ol?r.get(g):null;return x&&x.evaluate?x.evaluate(n,c,void 0,h):x})}function $re(a,r){return r-a}Jt(cG,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const hG=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,339 bytes, line 66
66];class a3{static from(r){if(!(r instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,c]=new Uint8Array(r,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const h=c>>4;if(h!==1)throw new Error(`Got v${h} data when expected v1.`);const m=hG[15&c];if(!m)throw new Error("Unrecognized array type.");const[g]=new Uint16Array(r,2,1),[x]=new Uint32Array(r,4,1);return new a3(x,g,m,r)}constructor(r,n=64,c=Float64Array,h){if(isNaN(r)||r<0)throw new Error(`Unpexpected numItems value: ${r}.`);this.numItems=+r,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=c,this.IndexArrayType=r<65536?Uint16Array:Uint32Array;const m=hG.indexOf(this.ArrayType),g=2*r*this.ArrayType.BYTES_PER_ELEMENT,x=r*this.IndexArrayType.BYTES_PER_ELEMENT,w=(8-x%8)%8;if(m<0)throw new Error(`Unexpected typed array class: ${c}.`);h&&h instanceof ArrayBuffer?(this.data=h,this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+x+w,2*r),this._pos=2*r,this._finished=!0):(this.data=new ArrayBuffer(8+g+x+w),this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+x+w,2*r),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+m]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=r)}add(r,n){const c=this._pos>>1;return this.ids[c]=c,this.coords[this._pos++]=r,this.coords[this._pos++]=n,c}finish(){const r=this._pos>>1;if(r!==this.numItems)throw new Error(`Added ${r} items when expected ${this.numItems}.`);return l3(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(r,n,c,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:g,nodeSize:x}=this,w=[0,m.length-1,0],E=[];for(;w.length;){const I=w.pop()||0,A=w.pop()||0,P=w.pop()||0;if(A-P<=x){for(let j=P;j<=A;j++){const X=g[2*j],oe=g[2*j+1];X>=r&&X<=c&&oe>=n&&oe<=h&&E.push(m[j])}continue}const D=P+A>>1,O=g[2*D],V=g[2*D+1];O>=r&&O<=c&&V>=n&&V<=h&&E.push(m[D]),(I===0?r<=O:n<=V)&&(w.push(P),w.push(D-1),w.push(1-I)),(I===0?c>=O:h>=V)&&(w.push(D+1),w.push(A),w.push(1-I))}return E}within(r,n,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:m,nodeSize:g}=this,x=[0,h.length-1,0],w=[],E=c*c;for(;x.length;){const I=x.pop()||0,A=x.pop()||0,P=x.pop()||0;if(A-P<=g){for(let j=P;j<=A;j++)fG(m[2*j],m[2*j+1],r,n)<=E&&w.push(h[j]);continue}const D=P+A>>1,O=m[2*D],V=m[2*D+1];fG(O,V,r,n)<=E&&w.push(h[D]),(I===0?r-c<=O:n-c<=V)&&(x.push(P),x.push(D-1),x.push(1-I)),(I===0?r+c>=O:n+c>=V)&&(x.push(D+1),x.push(A),x.push(1-I))}return w}}function l3(a,r,n,c,h,m){if(h-c<=n)return;const g=c+h>>1;dG(a,r,g,c,h,m),l3(a,r,n,c,g-1,1-m),l3(a,r,n,g+1,h,1-m)}function dG(a,r,n,c,h,m){for(;h>c;){if(h-c>600){const E=h-c+1,I=n-c+1,A=Math.log(E),P=.5*Math.exp(2*A/3),D=.5*Math.sqrt(A*P*(E-P)/E)*(I-E/2<0?-1:1);dG(a,r,n,Math.max(c,Math.floor(n-I*P/E+D)),Math.min(h,Math.floor(n+(E-I)*P/E+D)),m)}const g=r[2*n+m];let x=c,w=h;for(xv(a,r,c,n),r[2*h+m]>g&&xv(a,r,c,h);x<w;){for(xv(a,r,x,w),x++,w--;r[2*x+m]<g;)x++;for(;r[2*w+m]>g;)w--}r[2*c+m]===g?xv(a,r,c,w):(w++,xv(a,r,w,h)),w<=n&&(c=w+1),n<=w&&(h=w-1)}}function xv(a,r,n,c){c3(a,n,c),c3(r,2*n,2*c),c3(r,2*n+1,2*c+1)}function c3(a,r,n){const c=a[r];a[r]=a[n],a[n]=c}function fG(a,r,n,c){const h=a-n,m=r-c;return h*h+m*m}s.$=Co,s.A=lc,s.B=uc,s.C=ld,s.D=dg,s.E=Du,s.F=2,s.G=sv,s.H=B6,s.I=$s,s.J=Uc,s.K=class extends a2{},s.L=Ou,s.M=ow,s.N=jm,s.O=Um,s.P=Tt,s.Q=Xb,s.R=_f,s.S=s0,s.T=TA,s.U=jf,s.V=a2,s.W=a0,s.X=$u,s.Y=Im,s.Z=Qh,s._=Jh,s.a=function(a){return Qn.API_CDN_URL_REGEX.test(a)},s.a$=Ge,s.a0=Py,s.a1=Gf,s.a2=Gm,s.a3=Wb,s.a4=function(a){const r=a.value;let n=[];if(!r)return n;const c=Uc(r);return c!=="string"?(n=n.concat([new a2(a.key,r,`string expected, "${c}" found`)]),n):(YA(r,!0)||(n=n.concat([new a2(a.key,r,`invalid url "${r}"`)])),n)},s.a5=Ue,s.a6=Uf,s.a7=Ln,s.a8=zt,s.a9=class{constructor(a){this.specification=a}possiblyEvaluate(a,r){return Xi(a.expression.evaluate(r))}interpolate(a,r,n){return{x:_r(a.x,r.x,n),y:_r(a.y,r.y,n),z:_r(a.z,r.z,n),azimuthal:_r(a.azimuthal,r.azimuthal,n),polar:_r(a.polar,r.polar,n)}}},s.aA=Uo,s.aB=es,s.aC=Go,s.aD=U,s.aE=Me,s.aF=function(a,r){const n={};for(let c=0;c<r.length;c++){const h=r[c];h in a&&(n[h]=a[h])}return n}
66,s.aG=F,s.aH=W,s.aI=class{constructor(a){this.entries={},this.scheduler=a}request(a,r,n,c){const h=this.entries[a]=this.entries[a]||{callbacks:[]};if(h.result){const[m,g]=h.result;return this.scheduler?this.scheduler.add(()=>{c(m,g)},r):c(m,g),()=>{}}return h.callbacks.push(c),h.cancel||(h.cancel=n((m,g)=>{h.result=[m,g];for(const x of h.callbacks)this.scheduler?this.scheduler.add(()=>{x(m,g)},r):x(m,g);setTimeout(()=>delete this.entries[a],3e3)})),()=>{h.result||(h.callbacks=h.callbacks.filter(m=>m!==c),h.callbacks.length||(h.cancel(),delete this.entries[a]))}}},s.aJ=function(a,r,n){const c=JSON.stringify(a.request);return a.data&&(this.deduped.entries[c]={result:[null,a.data]}),this.deduped.request(c,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom},h=>{const m=yf(a.request,(g,x,w,E)=>{g?h(g):x&&h(null,{vectorTile:n?void 0:new ir(new Gw(x)),rawData:x,cacheControl:w,expires:E})});return()=>{m.cancel(),h()}},r)},s.aK=function(a){Ey++,Ey>ac&&(a.getActor().send("enforceCacheSizeLimit",il),Ey=0)},s.aL=function(a){return a<=1?1:Math.pow(2,Math.floor(Math.log(a)/Math.LN2))},s.aM=ro,s.aN=p8,s.aO=x8,s.aP=f8,s.aQ=function(a,r){const n=document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let c=0;c<a.length;c++){const h=document.createElement("source");gI(a[c])||(n.crossOrigin="Anonymous"),h.src=a[c],n.appendChild(h)}return{cancel:()=>{}}},s.aR=ev,s.aS=function(a){return fetch(a).then(r=>r.arrayBuffer()).then(r=>Hj(r,0,a))},s.aT=Qj,s.aU=class{constructor(a,r,n,c){this.id=a,this.position=r!=null?new R(r[0],r[1]):new R(0,0),this.orientation=n??[0,0,0],this.nodes=c,this.uploaded=!1,this.aabb=new Zr([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(a,r){if(_e(a.matrix,r,a.matrix),a.meshes)for(const n of a.meshes){const c=Zr.applyTransformFast(n.aabb,a.matrix);this.aabb.encapsulate(c)}if(a.children)for(const n of a.children)this._applyTransformations(n,a.matrix)}computeBoundsAndApplyParent(){const a=pe([]);for(const r of this.nodes)this._applyTransformations(r,a)}computeModelMatrix(a,r,n,c,h,m,g=!1){Kj(this.matrix,this,a.transform,this.position,r,n,c,h,m,g)}upload(a){if(!this.uploaded){for(const r of this.nodes)CA(r,a);for(const r of this.nodes)jw(r);this.uploaded=!0}}destroy(){for(const a of this.nodes)IA(a)}},s.aV=Ht,s.aW=cv,s.aX=re,s.aY=se,s.aZ=ud,s.a_=gn,s.aa=Ni,s.ab=Kc,s.ac=ye,s.ad=sn,s.ae=Fe,s.af=ce,s.ag=ol,s.ah=bd,s.ai=_r,s.aj=Vt,s.ak=Tb,s.al=ai,s.am=Mi,s.an=class{constructor(a){this.specification=a}possiblyEvaluate(a,r){return function([n,c]){const h=Xi([1,n,c]);return{x:h.x,y:h.y,z:h.z}}(a.expression.evaluate(r))}interpolate(a,r,n){return{x:_r(a.x,r.x,n),y:_r(a.y,r.y,n),z:_r(a.z,r.z,n)}}},s.ao=function(a,r,n=0,c=!0){const h=new Tt(n,n),m=a.sub(h),g=r.add(h),x=[m,new Tt(g.x,m.y),g,new Tt(m.x,g.y)];return c&&x.push(m.clone()),x},s.ap=function(a,r){const n=[];for(let c=0;c<a.length;c++){const h=Ce(c-1,-1,a.length-1),m=Ce(c+1,-1,a.length-1),g=a[c],x=a[m],w=a[h].sub(g).unit(),E=x.sub(g).unit(),I=E.angleWithSep(w.x,w.y),A=w.add(E).unit().mult(-1*r/Math.sin(I/2));n.push(g.add(A))}return n},s.aq=Q6,s.ar=Dn,s.as=function(a,r,n=0){return Je(((r.x-n)*a.scale-a.x)*Vt,(r.y*a.scale-a.y)*Vt,le(r.z,r.y))},s.at=Xr,s.au=fr,s.av=mi,s.aw=u6,s.ax=function(a){let r=1/0,n=1/0,c=-1/0,h=-1/0;for(const m of a)r=Math.min(r,m.x),n=Math.min(n,m.y),c=Math.max(c,m.x),h=Math.max(h,m.y);return{min:new Tt(r,n),max:new Tt(c,h)}},s.ay=J,s.az=_e,s.b=function(a){return Qn.API_FONTS_REGEX.test(a)},s.b$=UA,s.b0=cw,s.b1=i2,s.b2=function(){Ll.isLoading()||Ll.isLoaded()||p0()!=="deferred"||rw()},s.b3=sd,s.b4=nt,s.b5=Cg,s.b6=ti,s.b7=MA,s.b8=lA,s.b9=Pe,s.bA=function(a,r){const{x:n,y:c}=a.point,h=LU(n,c,a.worldSize/a._pixelsPerMercatorPixel,0,0);return _e(h,h,JI(ou(r)))},s.bB=B,s.bC=tn,s.bD=function(a,r){return Math.hypot(r[0]-a[0],r[1]-a[1],r[2]-a[2])},s.bE=gr,s.bF=qi,s.bG=Ur,s.bH=ov,s.bI=wa,s.bJ=FA,s.bK=function(a,r,n,c,h){const m=5*r+2;a.float32[m+0]=n,a.float32[m+1]=c,a.float32[m+2]=h},s.bL=r2,s.bM=Yr,s.bN=An,s.bO=yi,s.bP=wo,s.bQ=Ce,s.bR=function(a,r,n,c){var h=new L(4);return h[0]=a,h[1]=r,h[2]=n,h[3]=c,h},s.bS=Dw,s.bT=Gi,s.bU=Po,s.bV=uj,s.bW=b8,s.bX=pj,s.bY=hA,s.bZ=OA,s.b_=q6,s.ba=Ps,s.bb=A0,s.bc=IU,s.bd=xn,s.be=ug,s.bf=WA,s.bg=function(a,r){const n=bd(r.zoom);if(n===0)return ou(a);
66const c=Ew(a),h=KI(c),m=U(c.getWest())*r.worldSize,g=U(c.getEast())*r.worldSize,x=W(c.getNorth())*r.worldSize,w=W(c.getSouth())*r.worldSize,E=[m,x,0],I=[g,x,0],A=[m,w,0],P=[g,w,0],D=Ne([],r.globeMatrix);return sn(E,E,D),sn(I,I,D),sn(A,A,D),sn(P,P,D),h[0]=Ku(h[0],A,n),h[1]=Ku(h[1],P,n),h[2]=Ku(h[2],I,n),h[3]=Ku(h[3],E,n),Zr.fromPoints(h)},s.bh=Cw,s.bi=Ne,s.bj=N0,s.bk=Ku,s.bl=cd,s.bm=wQ,s.bn=It,s.bo=ie,s.bp=m2,s.bq=Gw,s.br=yf,s.bs=function(a,r){const n=[];for(const c in a)c in r||n.push(c);return n},s.bt=Ee,s.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.bv=rl,s.bw=function(a){var r=new L(16);return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],r[9]=a[9],r[10]=a[10],r[11]=a[11],r[12]=a[12],r[13]=a[13],r[14]=a[14],r[15]=a[15],r},s.bx=pe,s.by=wt,s.bz=xe,s.c=Do,s.c$=45,s.c0=a3,s.c1=jt,s.c2=Lo,s.c3=za,s.c4=function(a,r,n){n*=.5;var c=r[0],h=r[1],m=r[2],g=r[3],x=Math.sin(n),w=Math.cos(n);return a[0]=c*w+h*x,a[1]=h*w-c*x,a[2]=m*w+g*x,a[3]=g*w-m*x,a},s.c5=Da,s.c6=ji,s.c7=function(a,r){return a[0]=-r[0],a[1]=-r[1],a[2]=-r[2],a[3]=r[3],a},s.c8=ve,s.c9=function(a,r,n,c,h){var m,g=1/Math.tan(r/2);return a[0]=g/n,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=g,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,h!=null&&h!==1/0?(a[10]=(h+c)*(m=1/(c-h)),a[14]=2*h*c*m):(a[10]=-1,a[14]=-2*c),a},s.cA=va,s.cB=MU,s.cC=function(a,r,n,c,h,m,g,x,w){if(w.name==="globe")return MU(a,r,new va(n,c,h),!1);const E=cv({z:n,x:c,y:h},w);return new Zr([(m+E.x/E.scale)*r,r*(E.y/E.scale),g],[(m+E.x2/E.scale)*r,r*(E.y2/E.scale),x])},s.cD=function(a,r,n){return a[0]=Math.min(r[0],n[0]),a[1]=Math.min(r[1],n[1]),a[2]=Math.min(r[2],n[2]),a[3]=Math.min(r[3],n[3]),a},s.cE=function(a,r,n){return a[0]=Math.max(r[0],n[0]),a[1]=Math.max(r[1],n[1]),a[2]=Math.max(r[2],n[2]),a[3]=Math.max(r[3],n[3]),a},s.cF=function(a){const r=Math.round((a+45+360)%360/90)%4;return Y[r]},s.cG=fe,s.cH=Gs,s.cI=d,s.cJ=function(a){const r=pe(new Float64Array(16));_e(r,a.pixelMatrix,a.globeMatrix);const n=[0,_,0],c=[0,v,0];return sn(n,n,r),sn(c,c,r),[n[0]>0&&n[0]<=a.width&&n[1]>0&&n[1]<=a.height&&!eA(a,new R(a.center.lat,90)),c[0]>0&&c[0]<=a.width&&c[1]>0&&c[1]<=a.height&&!eA(a,new R(a.center.lat,-90))]},s.cK=function(a,r){const{scale:n}=a.tileTransform,c=n*Vt/(a.tileSize*Math.pow(2,r.zoom-a.tileID.overscaledZ+a.tileID.canonical.z));return function(h,m,g){var x=m[1],w=m[2],E=m[3],I=g[0],A=g[1];return h[0]=m[0]*I,h[1]=x*I,h[2]=w*A,h[3]=E*A,h}(new Float32Array(4),r.inverseAdjustmentMatrix,[c,c])},s.cL=Vw,s.cM=Ae,s.cN=qj,s.cO=function(a){const r=qj(a,!0);return B([],[r[0],r[1],r[4],r[5]])},s.cP=ke,s.cQ=xi,s.cR=ot,s.cS=function(a){const{x:r,y:n}=a.point,{lng:c,lat:h}=a._center;return LU(r,n,a.worldSize,c,h)},s.cT=Oe,s.cU=Xe,s.cV=xa,s.cW=Pn,s.cX=bw,s.cY=function(a,r,n){let c=0;for(let h=0;h<2;++h)a[h]>0&&(c+=(a[h]-0)*(a[h]-0)),r[h]<0&&(c+=(0-r[h])*(0-r[h]));return c},s.cZ=function(a){return a*a*a*a*a},s.c_=G,s.ca=function(a,r,n,c,h,m,g){var x=1/(r-n),w=1/(c-h),E=1/(m-g);return a[0]=-2*x,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*w,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*E,a[11]=0,a[12]=(r+n)*x,a[13]=(h+c)*w,a[14]=(g+m)*E,a[15]=1,a},s.cb=Z,s.cc=function(a,r,n){a[4*r+0]=n[0],a[4*r+1]=n[1],a[4*r+2]=n[2],a[4*r+3]=n[3]},s.cd=cg,s.ce=_d,s.cf=Vn,s.cg=Ol,s.ch=Kf,s.ci=R,s.cj=n8,s.ck=function(){var a=new L(4);return L!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a},s.cl=function(a,r,n){var c=r[0],h=r[1],m=r[2],g=r[3],x=Math.sin(n),w=Math.cos(n);return a[0]=c*w+m*x,a[1]=h*w+g*x,a[2]=c*-x+m*w,a[3]=h*-x+g*w,a},s.cm=function(a,r){return a[0]===r[0]&&a[1]===r[1]&&a[2]===r[2]&&a[3]===r[3]},s.cn=Wi,s.co=function(a){return Math.hypot(a[0],a[1],a[2],a[3])},s.cp=nr,s.cq=So,s.cr=Fl,s.cs=3,s.ct=2,s.cu=7,s.cv=6,s.cw=zn,s.cx=Ye,s.cy=Si,s.cz=Zj,s.d=function(a){return Qn.API_TILEJSON_REGEX.test(a)},s.d$=(a,r,n,c,h,m,g,x,w,E)=>{const I=a.transform,A=I.calculatePixelsToTileUnitsMatrix(r),P=n.paint.get("line-trim-color-use-theme").constantOr("default")==="none",D=I.pitch<15?h6(.07,.7,J((14-I.zoom)/5,0,1)):.07;return{u_matrix:f6(a,r,n,c),u_pixels_to_tile_units:A,u_device_pixel_ratio:m,u_width_scale:g,u_floor_width_scale:x,u_units_to_pixels:[1/I.pixelsToGLUnits[0],1/I.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:h,u_texsize:m6(n)&&r.lineAtlasTexture?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:d6(r,a.transform),u_alpha_discard_threshold:0,u_trim_offset:w,u_trim_fade_range:n.paint.get("line-trim-fade-range"),u_trim_color:n.paint.get("line-trim-color").toPremultipliedRenderColor(P?null:n.lut).toArray01(),u_emissive_strength:n.paint.get("line-emissive-strength"),u_zbias_factor:D,u_tile_to_meter:ge(r.tileID.canonical,0),u_ground_shadow_factor:E}},s.d0=Yf,s.d1=function(a,r,n){const c=Math.sqrt(a*a+r*r+n*n),h=c>0?Math.acos(n/c)*Pl:0;let m=a!==0||r!==0?Math.atan2(-r,-a)*Pl+90:0;return m<0&&(m+=360),[c,m,h]},s.d2=Je,s.d3=Xi,s.d4=ge,s.d5=He,s.d6=Zr,s.d7=tt,s.d8=function(a){return[Math.pow(a[0],1/2.2),Math.pow(a[1],1/2.2),Math.pow(a[2],1/2.2)]},s.d9=YA,s.dA=Ew,s.dB=function(a){const r=fe-5;a=J(a,-r,r)/r*90;const n=Math.pow(Math.abs(Math.sin(ai(a))),3);return Math.round(n*(f.length-1))},s.dC=function(a,r,n,c){const h=r.getNorth(),m=r.getSouth(),g=r.getWest(),x=r.getEast(),w=1<<a.z,E=x-g,I=h-m,A=E/l,P=-I/f[n],D=[0,A,0,P,0,0,h,g,0];if(a.z>0){const O=180/c;te(D,D,[O/E+1,0,0,0,O/I+1,0,-.5*O/A,.5*O/P,1])}return D[2]=w,D[5]=a.x,D[8]=a.y,D},s.dD=ou,s.dE=function(a,r,n){const c=pe(new Float64Array(16)),h=(r/(1<<a)-.5)*Math.PI*2;return et(c,n.globeMatrix,h),Float32Array.from(c)},s.dF=class{isDataAvailableAtPoint(a){const r=this._source();if(this.isUsingMockSource()||!r||a.y<0||a.y>1)return!1;const n=r.getSource().maxzoom,c=1<<n,h=Math.floor(a.x),m=Math.floor((a.x-h)*c),g=Math.floor(a.y*c),x=this.findDEMTileFor(new ro(n,h,n,m,g));return!(!x||!x.dem)}getAtPointOrZero(a,r=0){return this.getAtPoint(a,r)||0}getAtPoint(a,r,n=!0){if(this.isUsingMockSource())return null;r==null&&(r=null);const c=this._source();if(!c||a.y<0||a.y>1)return r;const h=c.getSource().maxzoom,m=1<<h,g=Math.floor(a.x),x=a.x-g,w=new ro(h,g,h,Math.floor(x*m),Math.floor(a.y*m)),E=this.findDEMTileFor(w);if(!E||!E.dem)return r;const I=E.dem,A=1<<E.tileID.canonical.z,P=(x*A-E.tileID.canonical.x)*I.dim,D=(a.y*A-E.tileID.canonical.y)*I.dim,O=Math.floor(P),V=Math.floor(D);return(n?this.exaggeration():1)*_r(_r(I.get(O,V),I.get(O,V+1),D-V),_r(I.get(O+1,V),I.get(O+1,V+1),D-V),P-O)}getAtTileOffset(a,r,n){const c=1<<a.canonical.z;return this.getAtPointOrZero(new ye(a.wrap+(a.canonical.x+r/Vt)/c,(a.canonical.y+n/Vt)/c))}getAtTileOffsetFunc(a,r,n,c){return h=>
vendor: 12,025 bytes, line 66
66{const m=this.getAtTileOffset(a,h.x,h.y),g=c.upVector(a.canonical,h.x,h.y);return jt(g,g,m*c.upVectorScale(a.canonical,r,n).metersToTile),g}}getForTilePoints(a,r,n,c){if(this.isUsingMockSource())return!1;const h=wg.create(this,a,c);return!!h&&(r.forEach(m=>{m[2]=this.exaggeration()*h.getElevationAt(m[0],m[1],n)}),!0)}getMinMaxForTile(a){if(this.isUsingMockSource())return null;const r=this.findDEMTileFor(a);if(!r||!r.dem)return null;const n=r.dem.tree,c=r.tileID,h=1<<a.canonical.z-c.canonical.z;let m=a.canonical.x/h-c.canonical.x,g=a.canonical.y/h-c.canonical.y,x=0;for(let w=0;w<a.canonical.z-c.canonical.z&&!n.leaves[x];w++){m*=2,g*=2;const E=2*Math.floor(g)+Math.floor(m);x=n.childOffsets[x]+E,m%=1,g%=1}return{min:this.exaggeration()*n.minimums[x],max:this.exaggeration()*n.maximums[x]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(a,r,n){throw new Error("Pure virtual method called.")}pointCoordinate(a){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(a){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const a=this.visibleDemTiles;if(a.length===0)return null;let r=!1,n=Number.MAX_VALUE,c=Number.MIN_VALUE;for(const h of a){const m=this.getMinMaxForTile(h.tileID);m&&(n=Math.min(n,m.min),c=Math.max(c,m.max),r=!0)}return r?{min:n,max:c}:null}},s.dG=qU,s.dH=Tw,s.dI=function(a,r){return[Math.pow(a[0],2.2)*r,Math.pow(a[1],2.2)*r,Math.pow(a[2],2.2)*r]},s.dJ=H,s.dK=function(a,r){var n=Math.sin(r),c=Math.cos(r);return a[0]=c,a[1]=n,a[2]=0,a[3]=-n,a[4]=c,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},s.dL=ao,s.dM=RU,s.dN=Jn,s.dO=po,s.dP=256,s.dQ=function(a,r){const n=[0,0,0];return sn(n,n,Cw(ou(r.canonical))),sn(n,n,a),n},s.dR=a=>({u_matrix:new Kf(a),u_texsize:new Ol(a),u_pixels_to_tile_units:new O0(a),u_device_pixel_ratio:new Vn(a),u_width_scale:new Vn(a),u_floor_width_scale:new Vn(a),u_image:new cg(a),u_units_to_pixels:new Ol(a),u_tile_units_to_pixels:new Vn(a),u_alpha_discard_threshold:new Vn(a),u_trim_offset:new Ol(a),u_trim_fade_range:new Ol(a),u_trim_color:new Yf(a),u_emissive_strength:new Vn(a),u_zbias_factor:new Vn(a),u_tile_to_meter:new Vn(a),u_ground_shadow_factor:new _d(a),u_pattern_transition:new Vn(a)}),s.dS=a=>({u_matrix:new Kf(a),u_pixels_to_tile_units:new O0(a),u_device_pixel_ratio:new Vn(a),u_width_scale:new Vn(a),u_floor_width_scale:new Vn(a),u_units_to_pixels:new Ol(a),u_dash_image:new cg(a),u_gradient_image:new cg(a),u_image_height:new Vn(a),u_texsize:new Ol(a),u_tile_units_to_pixels:new Vn(a),u_alpha_discard_threshold:new Vn(a),u_trim_offset:new Ol(a),u_trim_fade_range:new Ol(a),u_trim_color:new Yf(a),u_emissive_strength:new Vn(a),u_zbias_factor:new Vn(a),u_tile_to_meter:new Vn(a),u_ground_shadow_factor:new _d(a)}),s.dT=a=>({u_camera_to_center_distance:new Vn(a),u_extrude_scale:new O0(a),u_device_pixel_ratio:new Vn(a),u_matrix:new Kf(a),u_inv_rot_matrix:new Kf(a),u_merc_center:new Ol(a),u_tile_id:new _d(a),u_zoom_transition:new Vn(a),u_up_dir:new _d(a),u_emissive_strength:new Vn(a)}),s.dU=fd,s.dV=ite,s.dW=OU,s.dX=(a,r,n,c,h,m)=>{const g=a.transform,x=g.projection.name==="globe";let w;if(m.paint.get("circle-pitch-alignment")==="map")if(x){const I=RU(g.zoom,r.canonical)*g._pixelsPerMercatorPixel;w=Float32Array.from([I,0,0,I])}else w=g.calculatePixelsToTileUnitsMatrix(n);else w=new Float32Array([g.pixelsToGLUnits[0],0,0,g.pixelsToGLUnits[1]]);const E={u_camera_to_center_distance:a.transform.getCameraToCenterDistance(g.projection),u_matrix:a.translatePosMatrix(r.projMatrix,n,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ca.devicePixelRatio,u_extrude_scale:w,u_inv_rot_matrix:IQ,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:m.paint.get("circle-emissive-strength")};if(x){E.u_inv_rot_matrix=c,E.u_merc_center=h,E.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],E.u_zoom_transition=bd(g.zoom);const I=h[0]*Vt,A=h[1]*Vt;E.u_up_dir=g.projection.upVector(new va(0,0,0),I,A)}return E},s.dY=p6,s.dZ=Cs,s.d_=(a,r,n,c,h,m,g,x,w,E)=>{const I=a.transform,A=I.pitch<15?h6(.07,.7,J((14-I.zoom)/5,0,1)):.07,P=n.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:f6(a,r,n,c),u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:I.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:h,u_width_scale:m,u_floor_width_scale:g,u_image:0,u_tile_units_to_pixels:d6(r,I),u_units_to_pixels:[1/I.pixelsToGLUnits[0],1/I.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:x,u_trim_fade_range:n.paint.get("line-trim-fade-range"),u_trim_color:n.paint.get("line-trim-color").toPremultipliedRenderColor(P?null:n.lut).toArray01(),u_emissive_strength:n.paint.get("line-emissive-strength"),u_zbias_factor:A,u_tile_to_meter:ge(r.tileID.canonical,0),u_ground_shadow_factor:w,u_pattern_transition:E}},s.da=function(a,r){return a.readFields(Jte,{icons:[]},r)},s.db=Ow,s.dc=vg,s.dd=BA,s.de=dm,s.df=tw,s.dg=Oa,s.dh=jh,s.di=dr,s.dj=function(a){const r=a.indexOf($f);return r>=0?a.slice(0,r):a},s.dk=function(a){return a.indexOf($f)>=0},s.dl=function(a){const r=a.lastIndexOf($f);return r>=0?a.slice(r+1):""},s.dm=function(a){const r=[],n=a.id;return n===void 0&&r.push({message:`layers.${n}: missing required property "id"`}),a.render===void 0&&r.push({message:`layers.${n}: missing required method "render"`}),a.renderingMode&&a.renderingMode!=="2d"&&a.renderingMode!=="3d"&&r.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),r},s.dn=function(a,r,n,c){return a.type==="custom"?new qte(a,r):new Yte[a.type](a,r,n,c)},s.dp=er,s.dq=function(a){const r=a.indexOf($f);return r>=0?a.slice(r+1):""},s.dr=class extends Cg{constructor(a,r){super(a._vectorTileFeature,a._z,a._x,a._y,a.id),a.state&&(this.state=Object.assign({},a.state)),this.target=r.target,this.namespace=r.namespace,r.properties&&(this.properties=r.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=a.source,this.sourceLayer=a.sourceLayer,this.layer=a.layer)}toJSON(){const a=super.toJSON();return a.target=this.target,a.namespace=this.namespace,a}},s.ds=f0,s.dt=Vh,s.du=function(a){return a({pluginStatus:ps,pluginURL:Qc}),f0.on("pluginStateChange",a),a},s.dv=D0,s.dw=class extends Ua{constructor(a){super(a),this.current=HI}set(a,r,n){if(this.fetchUniformLocation(a,r)){for(let c=0;c<9;c++)if(n[c]!==this.current[c]){this.current=n,this.gl.uniformMatrix3fv(this.location,!1,n);break}}}},s.dx=ee,s.dy=function(a,r,n){const c=bd(n.zoom),h=a.style.map._antialias,m=a.terrain&&a.terrain.exaggeration()>0;return c===0&&!h&&!m},s.dz=function(a){const r=a.pixelsPerMeter,n=r/Z(1,a.center.lat),c=pe(new Float64Array(16));return ie(c,c,[a.point.x,a.point.y,0]),ke(c,c,[n,n,r]),Float32Array.from(c)},s.e=Qn,s.e$=p0,s.e0=Mt,s.e1=B0,s.e2=le,s.e3=Yu,s.e4=zw,s.e5=Cj,s.e6=Td,s.e7=450,s.e8=7,s.e9=Se,s.eA=function(a,r,n,c,h,m,g,x,w,E,I,A,P,D,O,V){var j=new L(16);return j[0]=a,j[1]=r,j[2]=n,j[3]=c,j[4]=h,j[5]=m,j[6]=g,j[7]=x,j[8]=w,j[9]=E,j[10]=I,j[11]=A,j[12]=P,j[13]=D,j[14]=O,j[15]=V,j},s.eB=C,s.eC=C0,s.eD=qf,s.eE=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Tt(1/0,1/0),max:new Tt(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(a,r=!1){const n=dj(new Tt(0,0),new Tt(Vt,Vt),a),c=[];if(r&&!cA(n,this._globalClipBounds))return c;for(const h of this._activeRegions){if(h.hiddenByOverlap||!cA(n,h))continue;const m=tee(h.min,h.max,a);c.push({min:m.min,max:m.max,sourceId:this._sourceIds[h.priority],footprint:h.footprint,footprintTileId:h.tileId,order:h.order,clipMask:h.clipMask,clipScope:h.clipScope})}return c}setSources(a){this._setSources(a.map(r=>({getSourceId:()=>r.cache.id,getFootprints:()=>{const n=[];for(const c of r.cache.getVisibleCoordinates()){const h=r.cache.getTile(c).buckets[r.layer];h&&h.updateFootprints(c.toUnwrapped(),n)}return n},getOrder:()=>r.order,getClipMask:()=>r.clipMask,getClipScope:()=>r.clipScope})))}_addSource(a){const r=a.getFootprints();if(r.length===0)return;const n=a.getOrder(),c=a.getClipMask(),h=a.getClipScope();for(const m of r){if(!m.footprint)continue;const g=dj(m.footprint.min,m.footprint.max,m.id);this._activeRegions.push({min:g.min,max:g.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:m.id,footprint:m.footprint,order:n,clipMask:c,clipScope:h})}this._sourceIds.push(a.getSourceId())}_computeReplacement(){this._activeRegions.sort((r,n)=>r.priority-n.priority||kw(r.min,n.min)||kw(r.max,n.max)||r.order-n.order||r.clipMask-n.clipMask||function(c,h){const m=(g,x)=>g+x;return c.length-h.length||c.reduce(m,"").localeCompare(h.reduce(m,""))}(r.clipScope,n.clipScope));let a=this._activeRegions.length!==this._prevRegions.length;if(!a){let r=0;for(;!a&&r!==this._activeRegions.length;){const n=this._activeRegions[r],c=this._prevRegions[r];a=n.priority!==c.priority||!hj(n,c)||n.order!==c.order||n.clipMask!==c.clipMask||!rl(n.clipScope,c.clipScope),++r}}if(a){++this._updateTime;for(const n of this._activeRegions)n.order!==H0&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,n.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,n.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,n.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,n.max.y));const r=n=>{const c=this._activeRegions;if(n>=c.length)return n;const h=c[n].priority;for(;n<c.length&&c[n].priority===h;)++n;return n};if(this._sourceIds.length>1){let n=0,c=r(n);for(;n!==c;){let h=n;const m=n;for(;h!==c;){const g=this._activeRegions[h];g.hiddenByOverlap=!1;for(let x=0;x<m;x++){const w=this._activeRegions[x];if(!w.hiddenByOverlap&&g.order===H0&&cA(g,w)&&(g.hiddenByOverlap=fj(g.footprint,g.tileId,w.footprint,w.tileId),g.hiddenByOverlap))break}++h}n=c,c=r(n)}}}}_setSources(a){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let r=a.length-1;r>=0;r--)this._addSource(a[r]);this._computeReplacement()}},s.eF=H0,s.eG=class{constructor(a){this._createGrid(a),this._createPoles(a)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const a of this._poleSegments)a.destroy();for(const a of this._gridSegments)a.withSkirts.destroy(),a.withoutSkirts.destroy()}_fillGridMeshWithLods(a,r){const n=new Ps,c=new gn,h=[],m=a+1+2,g=r[0]+1,x=r[0]+1+(1+r.length),w=(E,I,A)=>{let P=E===m-1?E-2:E===0?E:E-1;return P+=A?24575:0,[P,I]};for(let E=0;E<m;++E)n.emplaceBack(...w(E,0,!0));for(let E=0;E<g;++E)for(let I=0;I<m;++I)n.emplaceBack(...w(I,E,(I===0||I===m-1)&&!0));for(let E=0;E<r.length;++E){const I=r[E];for(let A=0;A<m;++A)n.emplaceBack(...w(A,I,!0))}for(let E=0;E<r.length;++E){const I=c.length,A=r[E]+1+2,P=new gn;for(let V=0;V<A-1;V++){const j=V===A-2,X=j?m*(x-r.length+E-V):m;for(let oe=0;oe<m-1;oe++){const ne=V*m+oe;V===0||j||oe===0||oe===m-2?(P.emplaceBack(ne+1,ne,ne+X),P.emplaceBack(ne+X,ne+X+1,ne+1)):(c.emplaceBack(ne+1,ne,ne+X),c.emplaceBack(ne+X,ne+X+1,ne+1))}}const D=xn.simpleSegment(0,I,n.length,c.length-I);for(let V=0;V<P.uint16.length;V+=3)c.emplaceBack(P.uint16[V],P.uint16[V+1],P.uint16[V+2]);const O=xn.simpleSegment(0,I,n.length,c.length-I);h.push({withoutSkirts:D,withSkirts:O})}return{vertices:n,indices:c,segments:h}}_createGrid(a){const r=this._fillGridMeshWithLods(l,f);this._gridSegments=r.segments,this._gridBuffer=a.createVertexBuffer(r.vertices,IU.members),this._gridIndexBuffer=a.createIndexBuffer(r.
66indices,!0)}_createPoles(a){const r=new gn;for(let g=0;g<=l;g++)r.emplaceBack(0,g+1,g+2);this._poleIndexBuffer=a.createIndexBuffer(r,!0);const n=new Wu,c=new Wu,h=new Wu,m=new Wu;this._poleSegments=[];for(let g=0,x=0;g<bw;g++){const w=360/(1<<g);n.emplaceBack(0,-es,0,.5,0),c.emplaceBack(0,-es,0,.5,1),h.emplaceBack(0,-es,0,.5,.5),m.emplaceBack(0,-es,0,.5,.5);for(let E=0;E<=l;E++){let I=E/l,A=0;const P=_r(0,w,I),[D,O,V]=b(SQ,CQ,P,es);n.emplaceBack(D,O,V,I,A),c.emplaceBack(D,O,V,I,1-A);const j=ai(P);I=.5+.5*Math.sin(j),A=.5+.5*Math.cos(j),h.emplaceBack(D,O,V,I,A),m.emplaceBack(D,O,V,I,1-A)}this._poleSegments.push(xn.simpleSegment(x,0,66,64)),x+=66}this._poleNorthVertexBuffer=a.createVertexBuffer(n,ww,!1),this._poleSouthVertexBuffer=a.createVertexBuffer(c,ww,!1),this._texturedPoleNorthVertexBuffer=a.createVertexBuffer(h,ww,!1),this._texturedPoleSouthVertexBuffer=a.createVertexBuffer(m,ww,!1)}getGridBuffers(a,r){return[this._gridBuffer,this._gridIndexBuffer,r?this._gridSegments[a].withSkirts:this._gridSegments[a].withoutSkirts]}getPoleBuffers(a,r){return[r?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,r?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[a]]}},s.eH=cj,s.eI=q,s.eJ=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eK=Q,s.eL=me,s.eM=function(a,r,n){return a[0]=r[0]/n[0],a[1]=r[1]/n[1],a[2]=r[2]/n[2],a},s.eN=Ro,s.eO=S,s.eP=di,s.eQ=ze,s.eR=function([a,r,n]){const c=Math.hypot(a,r,n),h=Math.atan2(a,n),m=.5*Math.PI-Math.acos(-r/c);return new R(Xe(h),Xe(m))},s.eS=zo,s.eT=EA,s.eU=function(a){const r=a.navigator?a.navigator.userAgent:null;return!!function(n){if(an==null){const c=n.navigator?n.navigator.userAgent:null;an=!!n.safari||!(!c||!(/\b(iPad|iPhone|iPod)\b/.test(c)||c.match("Safari")&&!c.match("Chrome")))}return an}(a)&&!(!r||!(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},s.eV=function(a,r){il=a,ac=r},s.eW=eA,s.eX=zU,s.eY=function(a){const r=[0,0,0],n=pe(new Float64Array(16));return _e(n,a.pixelMatrix,a.globeMatrix),sn(r,r,n),new Tt(r[0],r[1])},s.eZ=function(){const a=K0;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(gA),K0=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},s.e_=function(){Ow().acquire(gA)},s.ea=function(a,r){if(a===r){var n=r[1],c=r[2],h=r[3],m=r[6],g=r[7],x=r[11
66];a[1]=r[4],a[2]=r[8],a[3]=r[12],a[4]=n,a[6]=r[9],a[7]=r[13],a[8]=c,a[9]=m,a[11]=r[14],a[12]=h,a[13]=g,a[14]=x}else a[0]=r[0],a[1]=r[4],a[2]=r[8],a[3]=r[12],a[4]=r[1],a[5]=r[5],a[6]=r[9],a[7]=r[13],a[8]=r[2],a[9]=r[6],a[10]=r[10],a[11]=r[14],a[12]=r[3],a[13]=r[7],a[14]=r[11],a[15]=r[15];return a},s.eb=Hte,s.ec=si,s.ed=P0,s.ee=256,s.ef=JI,s.eg=pa,s.eh=et,s.ei=function(a,r){return a[0]=r[0],a[1]=r[1],a[2]=r[2],a[3]=r[4],a[4]=r[5],a[5]=r[6],a[6]=r[8],a[7]=r[9],a[8]=r[10],a},s.ej=Wu,s.ek=S0,s.el=Hb,s.em=function(a,r,n,c,h){return J((a-r)/(n-r)*(h-c)+c,c,h)},s.en=qe,s.eo=function(a,r){var n=r[0],c=r[1],h=r[2],m=r[3],g=r[4],x=r[5],w=r[6],E=r[7],I=r[8],A=I*g-x*E,P=-I*m+x*w,D=E*m-g*w,O=n*A+c*P+h*D;return O?(a[0]=A*(O=1/O),a[1]=(-I*c+h*E)*O,a[2]=(x*c-h*g)*O,a[3]=P*O,a[4]=(I*n-h*w)*O,a[5]=(-x*n+h*m)*O,a[6]=D*O,a[7]=(-E*n+c*w)*O,a[8]=(g*n-c*m)*O,a):null},s.ep=2,s.eq=Wr,s.er=SA,s.es=[1,1,1],s.et=class{constructor(a,r,n,c){this.context=a,this.format=c,this.size=n,this.texture=a.gl.createTexture();const[h,m,g]=this.size,{gl:x}=a;x.bindTexture(x.TEXTURE_3D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),x.texImage3D(x.TEXTURE_3D,0,this.format,h,m,g,0,bA(this.format),wA(this.format),r.data)}bind(a,r){const{context:n}=this,{gl:c}=n;c.bindTexture(c.TEXTURE_3D,this.texture),a!==this.minFilter&&(c.texParameteri(c.TEXTURE_3D,c.TEXTURE_MAG_FILTER,a),c.texParameteri(c.TEXTURE_3D,c.TEXTURE_MIN_FILTER,a),this.minFilter=a),r!==this.wrapS&&(c.texParameteri(c.TEXTURE_3D,c.TEXTURE_WRAP_S,r),c.texParameteri(c.TEXTURE_3D,c.TEXTURE_WRAP_T,r),this.wrapS=r)}destroy(){const{gl:a}=this.context;a.deleteTexture(this.texture),this.texture=null}},s.eu=wg,s.ev=oc,s.ew=function(a,r,n,c){var h=r[0],m=r[1],g=r[2],x=r[3];return a[0]=h+c*(n[0]-h),a[1]=m+c*(n[1]-m),a[2]=g+c*(n[2]-g),a[3]=x+c*(n[3]-x),a},s.ex=gg,s.ey=Dl,s.ez=iu,s.f=function(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(r,n)=>String.fromCharCode(+("0x"+n))))},s.f0=function(a,r,n=!1){if(ps===qs.deferred||ps===qs.loading||ps===qs.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Qc=ca.resolveURL(a),ps=qs.deferred,h0=r,d0(),n||rw()},s.f1=function(a){fg=ca.resolveURL(a),pg||(pg=new dg(Ow(),new Du)),pg.broadcast("setMeshoptUrl",fg)},s.f2=Bj,s.f3=function(a){yA=ca.resolveURL(a),pg||(pg=new dg(Ow(),new Du)),pg.broadcast("setDracoUrl",yA)},s.f4=Nj,s.f5=Y0,s.f6=function(a){const r=ku();if(!r)return;const n=r.delete(sc);a&&n.then(()=>a()).catch(a)},s.f7=rp,s.f8=Jt,s.f9=wd,s.fa=pc,s.fb=lG,s.fc=cG,s.fd=a6,s.fe=Zt,s.ff="hd_road_elevation",s.fg=bn,s.fh=Kt,s.fi=ep,s.fj=NA,s.fk=op,s.fl=function(a,r,n,c,h,m,g,x=1,w,E,I){a.createArrays(),a.tilePixelRatio=Vt/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;const A=a.layers[0].layout,P=a.layers[0]._unevaluatedLayout._values,D={};D.scaleFactor=x,D.textSizeScaleRange=A.get("text-size-scale-range"),D.iconSizeScaleRange=A.get("icon-size-scale-range");const[O,V]=D.textSizeScaleRange,[j,X]=D.iconSizeScaleRange;D.textScaleFactor=J(D.scaleFactor,O,V),D.iconScaleFactor=J(D.scaleFactor,j,X);const oe=P["text-size"],ne=P["icon-size"];if(a.textSizeData.kind==="composite"){const{minZoom:De,maxZoom:lt}=a.textSizeData;D.compositeTextSizes=[oe.possiblyEvaluate(new Ni(De,{worldview:I}),m),oe.possiblyEvaluate(new Ni(lt,{worldview:I}),m)]}if(a.iconSizeData.kind==="composite"){const{minZoom:De,maxZoom:lt}=a.iconSizeData;D.compositeIconSizes=[ne.possiblyEvaluate(new Ni(De,{worldview:I}),m),ne.possiblyEvaluate(new Ni(lt,{worldview:I}),m)]}D.layoutTextSize=oe.possiblyEvaluate(new Ni(g+1,{worldview:I}),m),D.layoutIconSize=ne.possiblyEvaluate(new Ni(g+1,{worldview:I}),m),D.textMaxSize=oe.possiblyEvaluate(new Ni(18,{worldview:I}),m);const ae=A.get("symbol-placement"),Ie=A.get("text-rotation-alignment")==="map"&&ae!=="point",be=A.get("text-size");let Te=!1;const Le=[];for(const De of a.features){const lt=A.get("text-font").evaluate(De,{},m).join(","),je=be.evaluate(De,{},m)*D.textScaleFactor,ht=D.layoutTextSize.evaluate(De,{},m)*D.textScaleFactor,Lt=D.layoutIconSize.evaluate(De,{},m)*D.iconScaleFactor,gt={horizontal:{},vertical:void 0},St=De.text;let kt,st=[0,0];if(St){const Xt=St.toString(),xr=A.get("text-letter-spacing").evaluate(De,{},m)*Po,Mr=A.get("text-line-height").evaluate(De,{},m)*Po,Or=zI(Xt)?xr:0,Rr=A.get("text-anchor").evaluate(De,{},m),ri=A.get("text-variable-anchor");if(!ri){const it=A.get("text-radial-offset").evaluate(De,{},m);if(it)st=q6(Rr,[it*Po,VA]);else{const Ot=A.get("text-offset").evaluate(De,{},m);st=[Ot[0]*Po,Ot[1]*Po]}}
66let Hr=Ie?"center":A.get("text-justify").evaluate(De,{},m);const ln=ae==="point",ue=ln?A.get("text-max-width").evaluate(De,{},m)*Po:1/0,he=it=>{a.allowVerticalPlacement&&u0(Xt)&&(gt.vertical=DA(St,r,n,h,lt,ue,Mr,Rr,it,Or,st,wa.vertical,!0,ht,je,w))};if(!Ie&&ri){const it=Hr==="auto"?ri.map($t=>UA($t)):[Hr];let Ot=!1;for(let $t=0;$t<it.length;$t++){const Gt=it[$t];if(!gt.horizontal[Gt])if(Ot)gt.horizontal[Gt]=gt.horizontal[0];else{const tr=DA(St,r,n,h,lt,ue,Mr,"center",Gt,Or,st,wa.horizontal,!1,ht,je,w);tr&&(gt.horizontal[Gt]=tr,Ot=tr.positionedLines.length===1)}}he("left")}else{if(Hr==="auto"&&(Hr=UA(Rr)),ln||A.get("text-writing-mode").indexOf("horizontal")>=0||!u0(Xt)){const it=DA(St,r,n,h,lt,ue,Mr,Rr,Hr,Or,st,wa.horizontal,!1,ht,je,w);it&&(gt.horizontal[Hr]=it)}he(ln?"left":Hr)}}let Ct,$e,at,Dt,At,sr,Qt=!1;const bt=A.get("icon-text-fit").evaluate(De,{},m);if(De.icon&&De.icon.hasPrimary()){const Xt=W6(De.icon,a.iconSizeData,P["icon-size"],m,a.zoom,De,w,D.iconScaleFactor,I);Ct=Xt.iconPrimary,at=Xt.iconSecondary;const xr=Ct.toString();if($e=c.get(xr),$e&&(At=A.get("icon-offset").evaluate(De,{},m),sr=A.get("icon-anchor").evaluate(De,{},m),kt=bte(h.get(xr),at?h.get(at.toString()):void 0,At,sr),Qt=$e.sdf,a.sdfIcons===void 0?a.sdfIcons=$e.sdf:a.sdfIcons!==$e.sdf&&Ar("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),($e.pixelRatio!==a.pixelRatio||A.get("icon-rotate").constantOr(1)!==0)&&(a.iconsNeedLinear=!0)),at){const Mr=at.toString();Dt=c.get(Mr)}}Te=Te||!(!De.icon||!De.icon.hasSecondary());const Pt=jA(gt.horizontal)||gt.vertical;
66a.iconsInText||(a.iconsInText=!!Pt&&Pt.iconsInText);const rr=ht*D.textScaleFactor/Po,{defaultShapedIcon:Wt,verticallyShapedIcon:Ut}=kte(a,kt,A,De,m,gt,rr,At,bt);bt!=="none"&&kt&&(M6(kt)||k6(kt))&&(Ww(0,$e,Ct,kt,Wt,bt,E,c,h),Ww(0,Dt,at,kt,Wt,bt,E,c,h),Ut&&(Ww(0,$e,Ct,kt,Ut,bt,E,c,h),Ww(0,Dt,at,kt,Ut,bt,E,c,h))),kt=Wt,Le.push({feature:De,shapedTextOrientations:gt,shapedText:Pt,shapedIcon:kt,iconPrimary:Ct,iconSecondary:at,iconOffset:At,iconAnchor:sr,verticallyShapedIcon:Ut,layoutTextSize:ht,layoutIconSize:Lt,textOffset:st,isSDFIcon:Qt,iconTextFit:bt})}return{featureData:Le,sizes:D,hasAnySecondaryIcon:Te,textAlongLine:Ie,symbolPlacement:ae}},s.fm=V6,s.fn=function(a,r,n,c,h,m,g,x,w,E){const{featureData:I,hasAnySecondaryIcon:A,sizes:P,textAlongLine:D,symbolPlacement:O}=r;for(const V of I){const{shapedIcon:j,verticallyShapedIcon:X,feature:oe,shapedTextOrientations:ne,shapedText:ae,layoutTextSize:Ie,textOffset:be,isSDFIcon:Te,iconPrimary:Le,iconSecondary:De,iconTextFit:lt,iconOffset:je}=V;X6(j,E.iconPositions,Le,De),X6(X,E.iconPositions,Le,De),Mte(ne,E.iconPositions),Pte(Le,De,E.iconPositions),(ae||j)&&Rte(a,oe,ne,j,X,w,P,Ie,0,be,Te,c,h,g,x,A,lt,je,D,O)}n&&a.generateCollisionDebugBuffers(m,a.collisionBoxArray,P.textScaleFactor)},s.fo=ir,s.fp=p2,s.fq=Ke,s.fr=function(a){let r=0;if(new Uint32Array(a,0,1)[0]!==Uj){const n=new Uint32Array(a,0,7),[,,c,h,m,g]=n;r=n.byteLength+h+m+g+m,(c!==a.byteLength||r>=a.byteLength)&&Ar("Invalid b3dm header information.")}return Hj(a,r)},s.fs=function(a,r){const n=Qj(a);for(const c of n){for(const h of c.meshes)Ree(h);c.lights&&(c.lightMeshIndex=c.meshes.length,c.meshes.push(Lee(c.lights,r)))}return n},s.ft=l2,s.fu=Ei,s.fv=Oj,s.fw=Ll,s.fx=qs,s.fy=function(a){Nh(),kl!=null&&kl.then(r=>{r.keys().then(n=>{for(let c=0;c<n.length-a;c++)r.delete(n[c]).catch(h=>Ar(h.message))}).catch(n=>Ar(n.message))}).catch(r=>Ar(r.message))},s.g=function(a,r){return Vh(Re(a,{method:"GET"}),r)},s.h=Re,s.i=function(a){return Qn.API_STYLE_REGEX.test(a)&&!Do(a)},s.j=function(a){return a.indexOf("mapbox:")===0},s.k=zi,s.l=Sy,s.m=function(a){return decodeURIComponent(atob(a).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""))},s.n=function(a,r){return Vh(Re(a,{type:"json"}),r)},s.o=xf,s.p=function(a,r){return Vh(Re(a,{method:"POST"}),r)},s.q=ca,s.r=$o,s.s=function(a){try{const r=self[a];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=Mu,s.u=function(){return function a(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,a)}()},s.v=function(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)},s.w=Ar,s.x=function(){return _A||(_A=new rp),_A},s.y=i3,s.z=ha}),y(["./shared"],function(s){function M(Xe){const Y=Xe?Xe.url.toString():void 0;return Y?performance.getEntriesByName(Y):[]}function L(Xe){if(typeof Xe=="number"||typeof Xe=="boolean"||typeof Xe=="string"||Xe==null)return JSON.stringify(Xe);if(Array.isArray(Xe)){let ee="[";for(const q of Xe)ee+=`${L(q)},`;return`${ee}]`}let Y="{";for(const ee of Object.keys(Xe).sort())Y+=`${ee}:${L(Xe[ee])},`;return`${Y}}`}function B(Xe){let Y="";for(const ee of s.bu)Y+=`/${L(Xe[ee])}`;return Y}class H{constructor(Y){this.keyCache={},this._layers={},this._layerConfigs={},Y&&this.replace(Y)}replace(Y,ee){this._layerConfigs={},this._layers={},this.update(Y,[],ee)}update(Y,ee,q){this._options=q;for(const J of Y)this._layerConfigs[J.id]=J,(this._layers[J.id]=s.dn(J,this.scope,null,this._options)).compileFilter(q),this.keyCache[J.id]&&delete this.keyCache[J.id];for(const J of ee)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const Q=function(J,ce){const Ce={};for(let Re=0;Re<J.length;Re++){const dt=J[Re];let Ge=ce&&ce[dt.id];Ge||(dt.type==="symbol"?Ge=dt.id:(Ge=B(dt),dt.type==="line"&&dt.paint&&function Ht(Kt){return typeof Kt=="string"&&Kt==="line-progress"||(Array.isArray(Kt)?Kt.some(Ht):!(!Kt||typeof Kt!="object")&&Object.values(Kt).some(Ht))}(dt.paint["line-width"])&&(Ge+=`/${L(dt.paint["line-width"])}`))),ce&&(ce[dt.id]=Ge);let Mt=Ce[Ge];Mt||(Mt=Ce[Ge]=[]),Mt.push(dt)}const Ee=[];for(const Re in Ce)Ee.push(Ce[Re]);return Ee}(Object.values(this._layerConfigs),this.keyCache);for(const J of Q){const ce=J.map(Mt=>this._layers[Mt.id]),Ce=ce[0];if(Ce.visibility==="none")continue;const Ee=Ce.source||"";let Re=this.familiesBySource[Ee];Re||(Re=this.familiesBySource[Ee]={});const dt=Ce.sourceLayer||"_geojsonTileLayer";let Ge=Re[dt];Ge||(Ge=Re[dt]=[]),Ge.push(ce)}}}const $=1*s.fa;class te{constructor(Y){const ee={},q=[];for(const Ce in Y){const Ee=Y[Ce],Re=ee[Ce]={};for(const dt in Ee.glyphs){const Ge=Ee.glyphs[+dt];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const Mt=Ge.metrics.localGlyph?$:1,Ht={x:0,y:0,w:Ge.bitmap.width+2*Mt,h:Ge.bitmap.height+2*Mt};q.push(Ht),Re[dt]=Ht}}const{w:Q,h:J}=s.H(q),ce=new s.f9({width:Q||1,height:J||1});for(const Ce in Y){const Ee=Y[Ce];for(const Re in Ee.glyphs){const dt=Ee.glyphs[+Re];if(!dt||dt.bitmap.width===0||dt.bitmap.height===0)continue;const Ge=ee[Ce][Re],Mt=dt.metrics.localGlyph?$:1;
66s.f9.copy(dt.bitmap,ce,{x:0,y:0},{x:Ge.x+Mt,y:Ge.y+Mt},dt.bitmap)}}this.image=ce,this.positions=ee}}s.f8(te,"GlyphAtlas");class xe{constructor(Y){this.tileID=new s.aM(Y.tileID.overscaledZ,Y.tileID.wrap,Y.tileID.canonical.z,Y.tileID.canonical.x,Y.tileID.canonical.y),this.tileZoom=Y.tileZoom,this.uid=Y.uid,this.zoom=Y.zoom,this.lut=Y.lut,this.canonical=Y.tileID.canonical,this.pixelRatio=Y.pixelRatio,this.tileSize=Y.tileSize,this.source=Y.source,this.scope=Y.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Y.showCollisionBoxes,this.collectResourceTiming=!!Y.request&&Y.request.collectResourceTiming,this.promoteId=Y.promoteId,this.isSymbolTile=Y.isSymbolTile,this.tileTransform=s.aW(Y.tileID.canonical,Y.projection),this.projection=Y.projection,this.worldview=Y.worldview,this.localizableLayerIds=Y.localizableLayerIds,this.brightness=Y.brightness,this.extraShadowCaster=!!Y.extraShadowCaster,this.tessellationStep=Y.tessellationStep,this.scaleFactor=Y.scaleFactor,this.worldview=Y.worldview}parse(Y,ee,q,Q,J,ce){this.status="parsing",this.data=Y,this.collisionBoxArray=new s.b0;const Ce=new s.fb(Object.keys(Y.layers).sort()),Ee=new s.fc(this.tileID,this.promoteId);Ee.bucketLayerIDs=[];const Re={},dt=new s.fd(256,256),Ge={featureIndex:Ee,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:dt,availableImages:q,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},Mt=[],Ht=ee.familiesBySource[this.source];for(const er in Ht){const dr=Y.layers[er];if(!dr)continue;let Er=!1,Kr=!1,Ar=!1;for(const Ei of Ht[er])Ei[0].type==="symbol"?Er=!0:Kr=!0,Ei[0].is3D()&&Ei[0].type!=="model"&&(Ar=!0);if(this.extraShadowCaster&&!Ar||this.isSymbolTile===!0&&!Er||this.isSymbolTile===!1&&!Kr)continue;dr.version===1&&s.w(`Vector tile source "${this.source}" layer "${er}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ei=Ce.encode(er),rn=[];let Xi=!1;for(let Ei=0,ti=0;Ei<dr.length;Ei++){const an=dr.feature(Ei),ji=Ee.getId(an,er);if(this.localizableLayerIds&&this.localizableLayerIds.has(er)){const Li=an.properties?an.properties.worldview:null;if(this.worldview&&typeof Li=="string")if(Li==="all")an.properties.$localized=!0;else{if(!Li.split(",").includes(this.worldview))continue;an.properties.$localized=!0,an.properties.worldview=this.worldview}}!Xi&&an.properties&&an.properties.hasOwnProperty(s.fe)&&(Xi=!0),rn.push({feature:an,id:ji,index:ti,sourceLayerIndex:ei}),ti++}Xi&&!Ge.elevationFeatures&&Y.layers.hasOwnProperty(s.ff)&&(Ge.elevationFeatures=s.fg.parseFrom(Y.layers[s.ff],this.canonical));for(const Ei of Ht[er]){const ti=Ei[0];if(this.extraShadowCaster&&(!ti.is3D()||ti.type==="model")||this.isSymbolTile!==void 0&&ti.type==="symbol"!==this.isSymbolTile||ti.minzoom&&this.zoom<Math.floor(ti.minzoom)||ti.maxzoom&&this.zoom>=ti.maxzoom||ti.visibility==="none")continue;pe(Ei,this.zoom,Ge.brightness,q,this.worldview);const an=Re[ti.id]=ti.createBucket({index:Ee.bucketLayerIDs.length,layers:Ei,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ei,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:Q,worldview:this.worldview});Ee.bucketLayerIDs.push(Ei.map(Li=>s.C(Li.id,Li.scope)));let ji=an.prepare?an.prepare():null;ji!=null?(ji=ji.then(()=>an.populate(rn,Ge,this.tileID.canonical,this.tileTransform)),Mt.push(ji)):an.populate(rn,Ge,this.tileID.canonical,this.tileTransform)}}const Kt=()=>{let er,dr,Er,Kr,Ar,ei;dt.trim();const rn={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Xi=()=>{if(er)return this.status="done",ce(er);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(Re).filter(ti=>!ti.isEmpty()),featureIndex:Ee,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ge.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(dr&&Er&&Kr){const ti=new te(dr),an=new Map;for(const[Kn,Jn]of Er.entries()){const{imagePosition:po}=s.fj(Kn,Jn,s.fk);an.set(Kn,po)}const ji={};for(const Kn in Re){const Jn=Re[Kn];Jn instanceof s.b1&&(pe(Jn.layers,this.zoom,Ge.brightness,q,this.worldview),ji[Kn]=s.fl(Jn,dr,ti.positions,Er,an,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Ar,this.worldview))}const Li={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(J,Er,Ar,()=>{Li.iconsPending=!1,Ei(ji,ti,Li)}),this.rasterizeIfNeeded(J,Kr,ei,()=>{Li.patternsPending=!1,Ei(ji,ti,Li)})}},Ei=(ti,an,ji,Li)=>
66{if(ji.iconsPending||ji.patternsPending)return;const Kn=new s.fm(Er,Kr,this.lut);for(const Jn in Re){const po=Re[Jn];if(Jn in ti)s.fn(po,ti[Jn],this.showCollisionBoxes,q,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Er,Kn);else if(po.hasPattern&&(po instanceof s.b7||po instanceof s.b8||po instanceof s.e4)){pe(po.layers,this.zoom,Ge.brightness,q,this.worldview);const Ml=Object.fromEntries(Kn.patternPositions);po.addFeatures(Ge,this.tileID.canonical,Ml,q,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(Re).filter(Jn=>!Jn.isEmpty()),featureIndex:Ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:an.image,lineAtlas:dt,imageAtlas:Kn,brightness:Ge.brightness})};if(!this.extraShadowCaster){const ti=s.fh(Ge.glyphDependencies,Li=>Object.keys(Li).map(Number));Object.keys(ti).length?J.send("getGlyphs",{uid:this.uid,stacks:ti},(Li,Kn)=>{er||(er=Li,dr=Kn,Xi())},void 0,!1,rn):dr={};const an=Array.from(Ge.iconDependencies.keys()).map(Li=>s.I.parse(Li));an.length?J.send("getImages",{images:an,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Li,Kn)=>{er||(er=Li,Er=new Map,Ar=this.updateImageMapAndGetImageTaskQueue(Er,Kn,Ge.iconDependencies),Xi())},void 0,!1,rn):(Er=new Map,Ar=new Map);const ji=Array.from(Ge.patternDependencies.keys()).map(Li=>s.I.parse(Li));ji.length?J.send("getImages",{images:ji,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Li,Kn)=>{er||(er=Li,Kr=new Map,ei=this.updateImageMapAndGetImageTaskQueue(Kr,Kn,Ge.patternDependencies),Xi())},void 0,!1,rn):(Kr=new Map,ei=new Map)}if(Ge.elevationFeatures&&Ge.elevationFeatures.length>0){const ti=[];for(const ji of Object.values(Re))if(ji instanceof s.b8){const Li=ji.getUnevaluatedPortalGraph();Li&&ti.push(Li)}const an=s.fi.evaluate(ti);for(const ji of Object.values(Re))if(ji instanceof s.b8){const Li=Y.layers[Ce.decode(ji.sourceLayerIndex)];ji.setEvaluatedPortalGraph(an,Li,this.tileID.canonical,Ge.availableImages,Ge.brightness)}}Xi()};Mt.length>0?Promise.allSettled(Mt).then(Kt).catch(ce):Kt()}rasterizeIfNeeded(Y,ee,q,Q){Array.from(ee.values()).some(J=>J.usvg)?this.rasterize(Y,ee,q,Q):Q()}updateImageMapAndGetImageTaskQueue(Y,ee,q){const Q=new Map;for(const J of ee.keys()){const ce=q.get(J)||[];for(const Ce of ce){const Ee=Ce.toString(),Re=ee.get(Ce.id.toString());Re.usvg?Q.has(Ee)||(Q.set(Ee,Ce),Y.set(Ee,Object.assign({},Re))):Y.set(Ee,Re)}}return Q}rasterize(Y,ee,q,Q){this.rasterizeTask=Y.send("rasterizeImages",{scope:this.scope,tasks:q},(J,ce)=>{if(!J)for(const[Ce,Ee]of ce.entries()){const Re=Object.assign(ee.get(Ce),{data:Ee});ee.set(Ce,Re)}Q()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function pe(Xe,Y,ee,q,Q){const J=new s.aa(Y,{brightness:ee,worldview:Q});for(const ce of Xe)ce.recalculate(J,q)}class Ne extends s.E{constructor(Y,ee,q,Q,J,ce,Ce){super(),this.actor=Y,this.layerIndex=ee,this.availableImages=q,this.availableModels=Q,this.loadVectorData=ce||s.aJ,this.loading={},this.loaded={},this.deduped=new s.aI(Y.scheduler),this.isSpriteLoaded=J,this.scheduler=Y.scheduler,this.brightness=Ce}loadTile(Y,ee){const q=Y.uid,Q=Y&&Y.request,J=Q&&Q.collectResourceTiming,ce=this.loading[q]=new xe(Y);ce.abort=this.loadVectorData(Y,(Ce,Ee)=>{const Re=!this.loading[q];if(delete this.loading[q],ce.cancelRasterize(),Re||Ce||!Ee)return ce.status="done",Re||(this.loaded[q]=ce),ee(Ce);const dt=Ee.rawData,Ge={};Ee.expires&&(Ge.expires=Ee.expires),Ee.cacheControl&&(Ge.cacheControl=Ee.cacheControl),ce.vectorTile=Ee.vectorTile||new s.fo(new s.bq(dt));const Mt=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Ht,Kt)=>{if(Ht||!Kt)return ee(Ht);const er={};if(J){const dr=M(Q);dr.length>0&&(er.resourceTiming=JSON.parse(JSON.stringify(dr)))}ee(null,s.h({rawTileData:dt.slice(0)},Kt,Ge,er))})};this.isSpriteLoaded?Mt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Mt,{type:"parseTile",isSymbolTile:Y.isSymbolTile,zoom:Y.tileZoom}):Mt()}),this.loaded=this.loaded||{},this.loaded[q]=ce})}reloadTile(Y,ee){const q=this.loaded,Q=Y.uid;if(q&&q[Q]){const J=q[Q];J.scaleFactor=Y.scaleFactor,J.showCollisionBoxes=Y.showCollisionBoxes,J.projection=Y.projection,J.brightness=Y.brightness,J.tileTransform=s.aW(Y.tileID.canonical,Y.projection),J.extraShadowCaster=Y.extraShadowCaster,J.lut=Y.lut,J.worldview=Y.worldview;const ce=(Ce,Ee)=>{const Re=J.reloadCallback;Re&&(delete J.reloadCallback,J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Re)),ee(Ce,Ee)};J.status==="parsing"?J.reloadCallback=ce:J.status==="done"&&(J.vectorTile?J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else ee(null,void 0)}abortTile(Y,ee){const q=Y.uid,Q=this.loading[q];Q&&(Q.abort&&Q.abort(),delete this.loading[q]),ee()}removeTile(Y,ee){const q=this.loaded,Q=Y.uid;q&&q[Q]&&delete q[Q],ee()}}class _e{loadTile(Y,ee){const{uid:q,encoding:Q,rawImageData:J,padding:ce}=Y,Ce=ImageBitmap&&J instanceof ImageBitmap?this.getImageData(J,ce):J;ee(null,new s.fp(q,Ce,Q,ce<1))}reloadTile(Y,ee){ee(null,null)}abortTile(Y,ee){ee()}removeTile(Y,ee){ee()}getImageData(Y,ee){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Y.width,Y.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=Y.width,this.offscreenCanvas.height=Y.height,this.offscreenCanvasContext.drawImage(Y,0,0,Y.width,Y.height);const q=this.offscreenCanvasContext.getImageData(-ee,-ee,Y.width+2*ee,Y.height+2*ee);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),q}}s.bp.setPbf(s.bq);class ie{constructor(Y){this._mrt=new s.bp(Y.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=Y.uid,this.tileID=Y.tileID,this.source=Y.source}
66parse(Y,ee){const q=this._mrt;this.status="parsing",this._entireBuffer=Y;try{q.parseHeader(Y),this._isHeaderLoaded=!0;const Q=[];for(const J in q.layers){const ce=q.getLayer(J),Ce=ce.getDataRange(ce.getBandList()),Ee=q.createDecodingTask(Ce),Re=Y.slice(Ce.firstByte,Ce.lastByte+1),dt=s.bp.performDecoding(Re,Ee).then(Ge=>Ee.complete(null,Ge)).catch(Ge=>Ee.complete(Ge,null));Q.push(dt)}Promise.allSettled(Q).then(()=>ee(null,q)).catch(J=>ee(J))}catch(Q){ee(Q)}}}class ke{constructor(Y){this.actor=Y,this.loading={},this.loaded={}}loadTile(Y,ee){const q=Y.uid,Q=Y.request,J=this.loading[q]=new ie(Y),{cancel:ce}=s.br(Q,(Ce,Ee,Re,dt)=>{const Ge=!this.loading[q];if(delete this.loading[q],Ge||Ce||!Ee)return J.status="done",Ge||(this.loaded[q]=J),ee(Ce);J.parse(Ee,(Mt,Ht)=>{if(Mt||!Ht)return ee(Mt);ee(null,Ht,Re,dt)}),this.loaded[q]=J});J.abort=ce}reloadTile(Y,ee){ee(null,void 0)}abortTile(Y,ee){const q=Y.uid,Q=this.loading[q];Q&&(Q.abort&&Q.abort(),delete this.loading[q]),ee()}removeTile(Y,ee){const q=Y.uid;this.loaded[q]&&delete this.loaded[q],ee()}decodeRasterArray(Y,ee){s.bp.performDecoding(Y.buffer,Y.task).then(q=>ee(null,q)).catch(q=>ee(q))}}const ot=s.fq.prototype.toGeoJSON;class et{constructor(Y){this._feature=Y,this.extent=s.aj,this.type=Y.type,this.properties=Y.tags,"id"in Y&&!isNaN(Y.id)&&(this.id=parseInt(Y.id,10))}loadGeometry(){if(this._feature.type===1){const Y=[];for(const ee of this._feature.geometry)Y.push([new s.P(ee[0],ee[1])]);return Y}{const Y=[];for(const ee of this._feature.geometry){const q=[];for(const Q of ee)q.push(new s.P(Q[0],Q[1]));Y.push(q)}return Y}}toGeoJSON(Y,ee,q){return ot.call(this,Y,ee,q)}}class wt{constructor(Y,ee){this.name=Y,this.extent=s.aj,this.length=ee.length,this._jsonFeatures=ee}feature(Y){return new et(this._jsonFeatures[Y])}}class It{constructor(Y){this.layers={},this.extent=s.aj;for(const ee of Object.keys(Y))this.layers[ee]=new wt(ee,Y[ee])}}const K=64/4096,ve=128;class Ae{constructor(){this.features=new Map}clear(){this.features.clear()}load(Y=[],ee){for(const q of Y){const Q=q.id;if(Q==null)continue;let J=this.features.get(Q);J&&this.updateCache(J,ee),q.geometry?(J=Be(q),this.updateCache(J,ee),this.features.set(Q,J)):this.features.delete(Q),this.updateCache(J,ee)}}updateCache(Y,ee){for(const{canonical:q,uid:Q}of Object.values(ee)){const{z:J,x:ce,y:Ce}=q;Ye(Y,Math.pow(2,J),ce,Ce)&&delete ee[Q]}}getTile(Y,ee,q){const Q=Math.pow(2,Y),J=[];for(const ce of this.features.values())Ye(ce,Q,ee,q)&&J.push(He(ce,Q,ee,q));return{features:J}}getFeatures(){return[...this.features.values()]}}function Ye({minX:Xe,minY:Y,maxX:ee,maxY:q},Q,J,ce){return Xe<(J+1+K)/Q&&Y<(ce+1+K)/Q&&ee>(J-K)/Q&&q>(ce-K)/Q}function Be(Xe){const{id:Y,geometry:ee,properties:q}=Xe;if(!ee)return;if(ee.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:Q,coordinates:J}=ee,ce={id:Y,type:1,geometry:[],tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Ce=ce.geometry;if(Q==="Point")Fe(J,Ce,ce);else if(Q==="MultiPoint")for(const Ee of J)Fe(Ee,Ce,ce);else if(Q==="LineString")ce.type=2,Je(J,Ce,ce);else if(Q==="MultiLineString")ce.type=2,ze(J,Ce,ce);else if(Q==="Polygon")ce.type=3,ze(J,Ce,ce,!0);else{if(Q!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const Ee of J)ze(Ee,Ce,ce,!0)}return ce}function Fe([Xe,Y],ee,q){const Q=s.aD(Xe);let J=s.aH(Y);J=J<0?0:J>1?1:J,ee.push(Q,J),q.minX=Math.min(q.minX,Q),q.minY=Math.min(q.minY,J),q.maxX=Math.max(q.maxX,Q),q.maxY=Math.max(q.maxY,J)}function Je(Xe,Y,ee,q=!1,Q=!1){const J=[];for(const ce of Xe)Fe(ce,J,ee);Y.push(J),q&&function(ce,Ce){let Ee=0;for(let Re=0,dt=ce.length,Ge=dt-2;Re<dt;Ge=Re,Re+=2)Ee+=(ce[Re]-ce[Ge])*(ce[Re+1]+ce[Ge+1]);if(Ee>0===Ce)for(let Re=0,dt=ce.length;Re<dt/2;Re+=2){const Ge=ce[Re],Mt=ce[Re+1];ce[Re]=ce[dt-2-Re],ce[Re+1]=ce[dt-1-Re],ce[dt-2-Re]=Ge,ce[dt-1-Re]=Mt}}(J,Q)}function ze(Xe,Y,ee,q=!1){for(let Q=0;Q<Xe.length;Q++)Je(Xe[Q],Y,ee,q,Q===0)}function He(Xe,Y,ee,q){const{id:Q,type:J,geometry:ce,tags:Ce}=Xe,Ee=[];if(J===1)(function(Re,dt,Ge,Mt,Ht){for(let Kt=0;Kt<Re.length;Kt+=2){const er=Math.round(s.aj*(Re[Kt+0]*dt-Ge)),dr=Math.round(s.aj*(Re[Kt+1]*dt-Mt));Ht.push([er,dr])}})(ce,Y,ee,q,Ee);else for(const Re of ce)tt(Re,Y,ee,q,Ee);return{id:Q,type:J,geometry:Ee,tags:Ce}}function tt(Xe,Y,ee,q,Q){const J=-ve,ce=s.aj+ve;let Ce;for(let Ee=0;Ee<Xe.length-2;Ee+=2){let Re=Math.round(s.aj*(Xe[Ee+0]*Y-ee)),dt=Math.round(s.aj*(Xe[Ee+1]*Y-q)),Ge=Math.round(s.aj*(Xe[Ee+2]*Y-ee)),Mt=Math.round(s.aj*(Xe[Ee+3]*Y-q));const Ht=Ge-Re,Kt=Mt-dt;Re<J&&Ge<J||(Re<J?(dt+=Math.round(Kt*((J-Re)/Ht)),Re=J):Ge<J&&(Mt=dt+Math.round(Kt*((J-Re)/Ht)),Ge=J),dt<J&&Mt<J||(dt<J?(Re+=Math.round(Ht*((J-dt)/Kt)),dt=J):Mt<J&&(Ge=Re+Math.round(Ht*((J-dt)/Kt)),Mt=J),Re>=ce&&Ge>=ce||(Re>=ce?(dt+=Math.round(Kt*((ce-Re)/Ht)),Re=ce):Ge>=ce&&(Mt=dt+Math.round(Kt*((ce-Re)/Ht)),Ge=ce),dt>=ce&&Mt>=ce||(dt>=ce?(Re+=Math.round(Ht*((ce-dt)/Kt)),dt=ce):Mt>=ce&&(Ge=Re+Math.round(Ht*((ce-dt)/Kt)),Mt=ce),Ce&&Re===Ce[Ce.length-1][0]&&dt===Ce[Ce.length-1][1]||(Ce=[[Re,dt]],Q.push(Ce)),Ce.push([Ge,Mt])))))}}function Oe({name:Xe,features:Y},ee){ee.writeStringField(1,Xe),ee.writeVarintField(5,s.aj);const q=new Map,Q=new Map,J={keys:q,values:Q,feature:null};for(const ce of Y)J.feature=ce,ee.writeMessage(2,rt,J);for(const ce of q.keys())ee.writeStringField(3,ce);for(const ce of Q.keys())ee.writeMessage(4,di,ce)}function rt(Xe,Y){const ee=Xe.feature;ee.id===void 0||isNaN(+ee.id)||Y.writeVarintField(1,+ee.id),ee.tags&&Y.writeMessage(2,Nt,Xe),Y.writeVarintField(3,ee.type),Y.writeMessage(4,li,ee)}function Nt({keys:Xe,values:Y,feature:ee},q){for(const Q of Object.keys(ee.tags)){let J=ee.tags[Q];if(J===null)continue;let ce=Xe.get(Q);ce===void 0&&(ce=Xe.size,Xe.set(Q,ce)),q.writeVarint(ce);const Ce=typeof J;Ce!=="string"&&Ce!=="boolean"&&Ce!=="number"&&(J=JSON.stringify(J));let Ee=Y.get(J);Ee===void 0&&(Ee=Y.size,Y.set(J,Ee)),q.writeVarint(Ee)}}function jt(Xe,Y){return(Y<<3)+(7&Xe)}function gr(Xe){return Xe<<1^Xe>>31}function li(Xe,Y){const{geometry:ee,type:q}=Xe;let Q=0,J=0;if(q===1){Y.writeVarint(jt(1,ee.length));for(const ce of ee){const Ce=ce[0]-Q,Ee=ce[1]-J;Y.writeVarint(gr(Ce)),Y.writeVarint(gr(Ee)),Q+=Ce,J+=Ee}}else for(const ce of ee){Y.writeVarint(jt(1,1));const Ce=ce.length-(q===3?1:0);for(let Ee=0;Ee<Ce;Ee++){Ee===1&&Y.writeVarint(jt(2,Ce-1));const Re=ce[Ee][0]-Q,dt=ce[Ee][1]-J;Y.writeVarint(gr(Re)),Y.writeVarint(gr(dt)),Q+=Re,J+=dt}q===3&&Y.writeVarint(jt(7,1))}}function di(Xe,Y){const ee=typeof Xe;ee==="string"?Y.writeStringField(1,Xe):ee==="boolean"?Y.writeBooleanField(7,Xe):ee==="number"&&(Xe%1!=0?Y.writeDoubleField(3,Xe):Xe<0?Y.writeSVarintField(6,Xe):Y.writeVarintField(5,Xe))}const Wr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Xe=>Xe},fr=Math.fround||(Ur=new Float32Array(1),Xe=>(Ur[0]=+Xe,Ur[0]));var Ur;const qi=3,zn=5,sn=6;class ao{constructor(Y){this.options=Object.assign(Object.create(Wr),Y),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Y){const{log:ee,minZoom:q,maxZoom:Q}=this.options;ee&&console.time("total time");const J=`prepare ${Y.length} points`;ee&&console.time(J),this.points=Y;const ce=[];for(let Ee=0;Ee<Y.length;Ee++){const Re=Y[Ee];if(!Re.geometry)continue;const[dt,Ge]=Re.geometry.coordinates,Mt=fr(Wi(dt)),Ht=fr(Xr(Ge));
vendor: 4,229 bytes, line 66
66ce.push(Mt,Ht,1/0,Ee,-1,1),this.options.reduce&&ce.push(0)}let Ce=this.trees[Q+1]=this._createTree(ce);ee&&console.timeEnd(J);for(let Ee=Q;Ee>=q;Ee--){const Re=+Date.now();Ce=this.trees[Ee]=this._createTree(this._cluster(Ce,Ee)),ee&&console.log("z%d: %d clusters in %dms",Ee,Ce.numItems,+Date.now()-Re)}return ee&&console.timeEnd("total time"),this}getClusters(Y,ee){let q=((Y[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,Y[1]));let J=Y[2]===180?180:((Y[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,Y[3]));if(Y[2]-Y[0]>=360)q=-180,J=180;else if(q>J){const Ge=this.getClusters([q,Q,180,ce],ee),Mt=this.getClusters([-180,Q,J,ce],ee);return Ge.concat(Mt)}const Ce=this.trees[this._limitZoom(ee)],Ee=Ce.range(Wi(q),Xr(ce),Wi(J),Xr(Q)),Re=Ce.data,dt=[];for(const Ge of Ee){const Mt=this.stride*Ge;dt.push(Re[Mt+zn]>1?So(Re,Mt,this.clusterProps):this.points[Re[Mt+qi]])}return dt}getChildren(Y){const ee=this._getOriginId(Y),q=this._getOriginZoom(Y),Q="No cluster with the specified id.",J=this.trees[q];if(!J)throw new Error(Q);const ce=J.data;if(ee*this.stride>=ce.length)throw new Error(Q);const Ce=this.options.radius/(this.options.extent*Math.pow(2,q-1)),Ee=J.within(ce[ee*this.stride],ce[ee*this.stride+1],Ce),Re=[];for(const dt of Ee){const Ge=dt*this.stride;ce[Ge+4]===Y&&Re.push(ce[Ge+zn]>1?So(ce,Ge,this.clusterProps):this.points[ce[Ge+qi]])}if(Re.length===0)throw new Error(Q);return Re}getLeaves(Y,ee,q){const Q=[];return this._appendLeaves(Q,Y,ee=ee||10,q=q||0,0),Q}getTile(Y,ee,q){const Q=this.trees[this._limitZoom(Y)],J=Math.pow(2,Y),{extent:ce,radius:Ce}=this.options,Ee=Ce/ce,Re=(q-Ee)/J,dt=(q+1+Ee)/J,Ge={features:[]};return this._addTileFeatures(Q.range((ee-Ee)/J,Re,(ee+1+Ee)/J,dt),Q.data,ee,q,J,Ge),ee===0&&this._addTileFeatures(Q.range(1-Ee/J,Re,1,dt),Q.data,J,q,J,Ge),ee===J-1&&this._addTileFeatures(Q.range(0,Re,Ee/J,dt),Q.data,-1,q,J,Ge),Ge.features.length?Ge:null}getClusterExpansionZoom(Y){let ee=this._getOriginZoom(Y)-1;for(;ee<=this.options.maxZoom;){const q=this.getChildren(Y);if(ee++,q.length!==1)break;Y=q[0].properties.cluster_id}return ee}_appendLeaves(Y,ee,q,Q,J){const ce=this.getChildren(ee);for(const Ce of ce){const Ee=Ce.properties;if(Ee&&Ee.cluster?J+Ee.point_count<=Q?J+=Ee.point_count:J=this._appendLeaves(Y,Ee.cluster_id,q,Q,J):J<Q?J++:Y.push(Ce),Y.length===q)break}return J}_createTree(Y){const ee=new s.c0(Y.length/this.stride|0,this.options.nodeSize,Float32Array);for(let q=0;q<Y.length;q+=this.stride)ee.add(Y[q],Y[q+1]);return ee.finish(),ee.data=Y,ee}_addTileFeatures(Y,ee,q,Q,J,ce){for(const Ce of Y){const Ee=Ce*this.stride,Re=ee[Ee+zn]>1;let dt,Ge,Mt;if(Re)dt=tn(ee,Ee,this.clusterProps),Ge=ee[Ee],Mt=ee[Ee+1];else{const er=this.points[ee[Ee+qi]];dt=er.properties;const[dr,Er]=er.geometry.coordinates;Ge=Wi(dr),Mt=Xr(Er)}const Ht={type:1,geometry:[[Math.round(this.options.extent*(Ge*J-q)),Math.round(this.options.extent*(Mt*J-Q))]],tags:dt};let Kt;Kt=Re||this.options.generateId?ee[Ee+qi]:this.points[ee[Ee+qi]].id,Kt!==void 0&&(Ht.id=Kt),ce.features.push(Ht)}}_limitZoom(Y){return Math.max(this.options.minZoom,Math.min(Math.floor(+Y),this.options.maxZoom+1))}_cluster(Y,ee){const{radius:q,extent:Q,reduce:J,minPoints:ce}=this.options,Ce=q/(Q*Math.pow(2,ee)),Ee=Y.data,Re=[],dt=this.stride;for(let Ge=0;Ge<Ee.length;Ge+=dt){if(Ee[Ge+2]<=ee)continue;Ee[Ge+2]=ee;const Mt=Ee[Ge],Ht=Ee[Ge+1],Kt=Y.within(Ee[Ge],Ee[Ge+1],Ce),er=Ee[Ge+zn];let dr=er;for(const Er of Kt){const Kr=Er*dt;Ee[Kr+2]>ee&&(dr+=Ee[Kr+zn])}if(dr>er&&dr>=ce){let Er,Kr=Mt*er,Ar=Ht*er,ei=-1;const rn=(Ge/dt<<5)+(ee+1)+this.points.length;for(const Xi of Kt){const Ei=Xi*dt;if(Ee[Ei+2]<=ee)continue;Ee[Ei+2]=ee;const ti=Ee[Ei+zn];Kr+=Ee[Ei]*ti,Ar+=Ee[Ei+1]*ti,Ee[Ei+4]=rn,J&&(Er||(Er=this._map(Ee,Ge,!0),ei=this.clusterProps.length,this.clusterProps.push(Er)),J(Er,this._map(Ee,Ei)))}Ee[Ge+4]=rn,Re.push(Kr/dr,Ar/dr,1/0,rn,-1,dr),J&&Re.push(ei)}else{for(let Er=0;Er<dt;Er++)Re.push(Ee[Ge+Er]);if(dr>1)for(const Er of Kt){const Kr=Er*dt;if(!(Ee[Kr+2]<=ee)){Ee[Kr+2]=ee;for(let Ar=0;Ar<dt;Ar++)Re.push(Ee[Kr+Ar])}}}}return Re}_getOriginId(Y){return Y-this.points.length>>5}_getOriginZoom(Y){return(Y-this.points.length)%32}_map(Y,ee,q){if(Y[ee+zn]>1){const ce=this.clusterProps[Y[ee+sn]];
vendor: 11,410 bytes, line 66
66return q?Object.assign({},ce):ce}const Q=this.points[Y[ee+qi]].properties,J=this.options.map(Q);return q&&J===Q?Object.assign({},J):J}}function So(Xe,Y,ee){return{type:"Feature",id:Xe[Y+qi],properties:tn(Xe,Y,ee),geometry:{type:"Point",coordinates:[(q=Xe[Y],360*(q-.5)),Ro(Xe[Y+1])]}};var q}function tn(Xe,Y,ee){const q=Xe[Y+zn],Q=q>=1e4?`${Math.round(q/1e3)}k`:q>=1e3?Math.round(q/100)/10+"k":q,J=Xe[Y+sn],ce=J===-1?{}:Object.assign({},ee[J]);return Object.assign(ce,{cluster:!0,cluster_id:Xe[Y+qi],point_count:q,point_count_abbreviated:Q})}function Wi(Xe){return Xe/360+.5}function Xr(Xe){const Y=Math.sin(Xe*Math.PI/180),ee=.5-.25*Math.log((1+Y)/(1-Y))/Math.PI;return ee<0?0:ee>1?1:ee}function Ro(Xe){const Y=(180-360*Xe)*Math.PI/180;return 360*Math.atan(Math.exp(Y))/Math.PI-90}function Lo(Xe,Y,ee,q){let Q=q;const J=Y+(ee-Y>>1);let ce,Ce=ee-Y;const Ee=Xe[Y],Re=Xe[Y+1],dt=Xe[ee],Ge=Xe[ee+1];for(let Mt=Y+3;Mt<ee;Mt+=3){const Ht=oc(Xe[Mt],Xe[Mt+1],Ee,Re,dt,Ge);if(Ht>Q)ce=Mt,Q=Ht;else if(Ht===Q){const Kt=Math.abs(Mt-J);Kt<Ce&&(ce=Mt,Ce=Kt)}}Q>q&&(ce-Y>3&&Lo(Xe,Y,ce,q),Xe[ce+2]=Q,ee-ce>3&&Lo(Xe,ce,ee,q))}function oc(Xe,Y,ee,q,Q,J){let ce=Q-ee,Ce=J-q;if(ce!==0||Ce!==0){const Ee=((Xe-ee)*ce+(Y-q)*Ce)/(ce*ce+Ce*Ce);Ee>1?(ee=Q,q=J):Ee>0&&(ee+=ce*Ee,q+=Ce*Ee)}return ce=Xe-ee,Ce=Y-q,ce*ce+Ce*Ce}function Gs(Xe,Y,ee,q){const Q={id:Xe??null,type:Y,geometry:ee,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")zo(Q,ee);else if(Y==="Polygon")zo(Q,ee[0]);else if(Y==="MultiLineString")for(const J of ee)zo(Q,J);else if(Y==="MultiPolygon")for(const J of ee)zo(Q,J[0]);return Q}function zo(Xe,Y){for(let ee=0;ee<Y.length;ee+=3)Xe.minX=Math.min(Xe.minX,Y[ee]),Xe.minY=Math.min(Xe.minY,Y[ee+1]),Xe.maxX=Math.max(Xe.maxX,Y[ee]),Xe.maxY=Math.max(Xe.maxY,Y[ee+1])}function Uo(Xe,Y,ee,q){if(!Y.geometry)return;const Q=Y.geometry.coordinates;if(Q&&Q.length===0)return;const J=Y.geometry.type,ce=Math.pow(ee.tolerance/((1<<ee.maxZoom)*ee.extent),2);let Ce=[],Ee=Y.id;if(ee.promoteId?Ee=Y.properties[ee.promoteId]:ee.generateId&&(Ee=q||0),J==="Point")aa(Q,Ce);else if(J==="MultiPoint")for(const Re of Q)aa(Re,Ce);else if(J==="LineString")za(Q,Ce,ce,!1);else if(J==="MultiLineString"){if(ee.lineMetrics){for(const Re of Q)Ce=[],za(Re,Ce,ce,!1),Xe.push(Gs(Ee,"LineString",Ce,Y.properties));return}Da(Q,Ce,ce,!1)}else if(J==="Polygon")Da(Q,Ce,ce,!0);else{if(J!=="MultiPolygon"){if(J==="GeometryCollection"){for(const Re of Y.geometry.geometries)Uo(Xe,{id:Ee,geometry:Re,properties:Y.properties},ee,q);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Re of Q){const dt=[];Da(Re,dt,ce,!0),Ce.push(dt)}}Xe.push(Gs(Ee,J,Ce,Y.properties))}function aa(Xe,Y){Y.push(qe(Xe[0]),pt(Xe[1]),0)}function za(Xe,Y,ee,q){let Q,J,ce=0;for(let Ee=0;Ee<Xe.length;Ee++){const Re=qe(Xe[Ee][0]),dt=pt(Xe[Ee][1]);Y.push(Re,dt,0),Ee>0&&(ce+=q?(Q*dt-Re*J)/2:Math.sqrt(Math.pow(Re-Q,2)+Math.pow(dt-J,2))),Q=Re,J=dt}const Ce=Y.length-3;Y[2]=1,Lo(Y,0,Ce,ee),Y[Ce+2]=1,Y.size=Math.abs(ce),Y.start=0,Y.end=Y.size}function Da(Xe,Y,ee,q){for(let Q=0;Q<Xe.length;Q++){const J=[];za(Xe[Q],J,ee,q),Y.push(J)}}function qe(Xe){return Xe/360+.5}function pt(Xe){const Y=Math.sin(Xe*Math.PI/180),ee=.5-.25*Math.log((1+Y)/(1-Y))/Math.PI;return ee<0?0:ee>1?1:ee}function yt(Xe,Y,ee,q,Q,J,ce,Ce){if(q/=Y,J>=(ee/=Y)&&ce<q)return Xe;if(ce<ee||J>=q)return null;const Ee=[];for(const Re of Xe){const dt=Re.geometry;let Ge=Re.type;const Mt=Q===0?Re.minX:Re.minY,Ht=Q===0?Re.maxX:Re.maxY;if(Mt>=ee&&Ht<q){Ee.push(Re);continue}if(Ht<ee||Mt>=q)continue;let Kt=[];if(Ge==="Point"||Ge==="MultiPoint")pr(dt,Kt,ee,q,Q);else if(Ge==="LineString")nr(dt,Kt,ee,q,Q,!1,Ce.lineMetrics);else if(Ge==="MultiLineString")wr(dt,Kt,ee,q,Q,!1);else if(Ge==="Polygon")wr(dt,Kt,ee,q,Q,!0);else if(Ge==="MultiPolygon")for(const er of dt){const dr=[];wr(er,dr,ee,q,Q,!0),dr.length&&Kt.push(dr)}if(Kt.length){if(Ce.lineMetrics&&Ge==="LineString"){for(const er of Kt)Ee.push(Gs(Re.id,Ge,er,Re.tags));continue}Ge!=="LineString"&&Ge!=="MultiLineString"||(Kt.length===1?(Ge="LineString",Kt=Kt[0]):Ge="MultiLineString"),Ge!=="Point"&&Ge!=="MultiPoint"||(Ge=Kt.length===3?"Point":"MultiPoint"),Ee.push(Gs(Re.id,Ge,Kt,Re.tags))}}return Ee.length?Ee:null}function pr(Xe,Y,ee,q,Q){for(let J=0;J<Xe.length;J+=3){const ce=Xe[J+Q];ce>=ee&&ce<=q&&Yr(Y,Xe[J],Xe[J+1],Xe[J+2])}}function nr(Xe,Y,ee,q,Q,J,ce){let Ce=lr(Xe);const Ee=Q===0?yi:Rn;let Re,dt,Ge=Xe.start;for(let dr=0;dr<Xe.length-3;dr+=3){const Er=Xe[dr],Kr=Xe[dr+1],Ar=Xe[dr+2],ei=Xe[dr+3],rn=Xe[dr+4],Xi=Q===0?Er:Kr,Ei=Q===0?ei:rn;let ti=!1;ce&&(Re=Math.sqrt(Math.pow(Er-ei,2)+Math.pow(Kr-rn,2))),Xi<ee?Ei>ee&&(dt=Ee(Ce,Er,Kr,ei,rn,ee),ce&&(Ce.start=Ge+Re*dt)):Xi>q?Ei<q&&(dt=Ee(Ce,Er,Kr,ei,rn,q),ce&&(Ce.start=Ge+Re*dt)):Yr(Ce,Er,Kr,Ar),Ei<ee&&Xi>=ee&&(dt=Ee(Ce,Er,Kr,ei,rn,ee),ti=!0),Ei>q&&Xi<=q&&(dt=Ee(Ce,Er,Kr,ei,rn,q),ti=!0),!J&&ti&&(ce&&(Ce.end=Ge+Re*dt),Y.push(Ce),Ce=lr(Xe)),ce&&(Ge+=Re)}let Mt=Xe.length-3;const Ht=Xe[Mt],Kt=Xe[Mt+1],er=Q===0?Ht:Kt;er>=ee&&er<=q&&Yr(Ce,Ht,Kt,Xe[Mt+2]),Mt=Ce.length-3,J&&Mt>=3&&(Ce[Mt]!==Ce[0]||Ce[Mt+1]!==Ce[1])&&Yr(Ce,Ce[0],Ce[1],Ce[2]),Ce.length&&Y.push(Ce)}function lr(Xe){const Y=[];return Y.size=Xe.size,Y.start=Xe.start,Y.end=Xe.end,Y}function wr(Xe,Y,ee,q,Q,J){for(const ce of Xe)nr(ce,Y,ee,q,Q,J,!1)}function Yr(Xe,Y,ee,q){Xe.push(Y,ee,q)}function yi(Xe,Y,ee,q,Q,J){const ce=(J-Y)/(q-Y);return Yr(Xe,J,ee+(Q-ee)*ce,1),ce}function Rn(Xe,Y,ee,q,Q,J){const ce=(J-ee)/(Q-ee);return Yr(Xe,Y+(q-Y)*ce,J,1),ce}function An(Xe,Y){const ee=[];for(let q=0;q<Xe.length;q++){const Q=Xe[q],J=Q.type;let ce;if(J==="Point"||J==="MultiPoint"||J==="LineString")ce=lo(Q.geometry,Y);else if(J==="MultiLineString"||J==="Polygon"){ce=[];for(const Ce of Q.geometry)ce.push(lo(Ce,Y))}else if(J==="MultiPolygon"){ce=[];for(const Ce of Q.geometry){const Ee=[];for(const Re of Ce)Ee.push(lo(Re,Y));ce.push(Ee)}}ee.push(Gs(Q.id,J,ce,Q.tags))}return ee}function lo(Xe,Y){const ee=[];ee.size=Xe.size,Xe.start!==void 0&&(ee.start=Xe.start,ee.end=Xe.end);for(let q=0;q<Xe.length;q+=3)ee.push(Xe[q]+Y,Xe[q+1],Xe[q+2]);return ee}function Yo(Xe,Y){if(Xe.transformed)return Xe;const ee=1<<Xe.z,q=Xe.x,Q=Xe.y;for(const J of Xe.features){const ce=J.geometry,Ce=J.type;if(J.geometry=[],Ce===1)for(let Ee=0;Ee<ce.length;Ee+=2)J.geometry.push(Fi(ce[Ee],ce[Ee+1],Y,ee,q,Q));else for(let Ee=0;Ee<ce.length;Ee++){const Re=[];for(let dt=0;dt<ce[Ee].length;dt+=2)Re.push(Fi(ce[Ee][dt],ce[Ee][dt+1],Y,ee,q,Q));J.geometry.push(Re)}}return Xe.transformed=!0,Xe}function Fi(Xe,Y,ee,q,Q,J){return[Math.round(ee*(Xe*q-Q)),Math.round(ee*(Y*q-J))]}function tl(Xe,Y,ee,q,Q){const J=Y===Q.maxZoom?0:Q.tolerance/((1<<Y)*Q.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:Xe.length,source:null,x:ee,y:q,z:Y,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Ce of Xe)Cl(ce,Ce,J,Q);return ce}function Cl(Xe,Y,ee,q){const Q=Y.geometry,J=Y.type,ce=[];if(Xe.minX=Math.min(Xe.minX,Y.minX),Xe.minY=Math.min(Xe.minY,Y.minY),Xe.maxX=Math.max(Xe.maxX,Y.maxX),Xe.maxY=Math.max(Xe.maxY,Y.maxY),J==="Point"||J==="MultiPoint")for(let Ce=0;Ce<Q.length;Ce+=3)ce.push(Q[Ce],Q[Ce+1]),Xe.numPoints++,Xe.numSimplified++;else if(J==="LineString")wo(ce,Q,Xe,ee,!1,!1);else if(J==="MultiLineString"||J==="Polygon")for(let Ce=0;Ce<Q.length;Ce++)wo(ce,Q[Ce],Xe,ee,J==="Polygon",Ce===0);else if(J==="MultiPolygon")for(let Ce=0;Ce<Q.length;Ce++){const Ee=Q[Ce];for(let Re=0;Re<Ee.length;Re++)wo(ce,Ee[Re],Xe,ee,!0,Re===0)}if(ce.length){let Ce=Y.tags||null;if(J==="LineString"&&q.lineMetrics){Ce={};for(const Re in Y.tags)Ce[Re]=Y.tags[Re];Ce.mapbox_clip_start=Q.start/Q.size,Ce.mapbox_clip_end=Q.end/Q.size}const Ee={geometry:ce,type:J==="Polygon"||J==="MultiPolygon"?3:J==="LineString"||J==="MultiLineString"?2:1,tags:Ce};Y.id!==null&&(Ee.id=Y.id),Xe.features.push(Ee)}}function wo(Xe,Y,ee,q,Q,J){const ce=q*q;if(q>0&&Y.size<(Q?ce:q))return void(ee.numPoints+=Y.length/3);const Ce=[];for(let Ee=0;Ee<Y.length;Ee+=3)(q===0||Y[Ee+2]>ce)&&(ee.numSimplified++,Ce.push(Y[Ee],Y[Ee+1])),ee.numPoints++;Q&&function(Ee,Re){let dt=0;for(let Ge=0,Mt=Ee.length,Ht=Mt-2;Ge<Mt;Ht=Ge,Ge+=2)dt+=(Ee[Ge]-Ee[Ht])*(Ee[Ge+1]+Ee[Ht+1]);if(dt>0===Re)for(let Ge=0,Mt=Ee.length;Ge<Mt/2;Ge+=2){const Ht=Ee[Ge],Kt=Ee[Ge+1];Ee[Ge]=Ee[Mt-2-Ge],Ee[Ge+1]=Ee[Mt-1-Ge],Ee[Mt-2-Ge]=Ht,Ee[Mt-1-Ge]=Kt}}(Ce,J),Xe.push(Ce)}const Il={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Al{constructor(Y,ee){const q=(ee=this.options=function(J,ce){for(const Ce in ce)J[Ce]=ce[Ce];return J}(Object.create(Il),ee)).debug;if(q&&console.time("preprocess data"),ee.maxZoom<0||ee.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(ee.promoteId&&ee.generateId)throw new Error("promoteId and generateId cannot be used together.");let Q=function(J,ce){const Ce=[];if(J.type==="FeatureCollection")for(let Ee=0;Ee<J.features.length;Ee++)Uo(Ce,J.features[Ee],ce,Ee);else Uo(Ce,J.type==="Feature"?J:{geometry:J},ce);return Ce}(Y,ee);this.tiles={},this.tileCoords=[],q&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",ee.indexMaxZoom,ee.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Q=function(J,ce){const Ce=ce.buffer/ce.extent;let Ee=J;const Re=yt(J,1,-1-Ce,Ce,0,-1,2,ce),dt=yt(J,1,1-Ce,2+Ce,0,-1,2,ce);return(Re||dt)&&(Ee=yt(J,1,-Ce,1+Ce,0,-1,2,ce)||[],Re&&(Ee=An(Re,1).concat(Ee)),dt&&(Ee=Ee.concat(An(dt,-1)))),Ee}(Q,ee),Q.length&&this.splitTile(Q,0,0,0),q&&(Q.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(Y,ee,q,Q,J,ce,Ce){const Ee=[Y,ee,q,Q],Re=this.options,dt=Re.debug;for(;Ee.length;){Q=Ee.pop(),q=Ee.pop(),ee=Ee.pop(),Y=Ee.pop();const Ge=1<<ee,Mt=Fc(ee,q,Q);let Ht=this.tiles[Mt];if(!Ht&&(dt>1&&console.time("creation"),Ht=this.tiles[Mt]=tl(Y,ee,q,Q,Re),this.tileCoords.push({z:ee,x:q,y:Q}),dt)){dt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ee,q,Q,Ht.numFeatures,Ht.numPoints,Ht.numSimplified),console.timeEnd("creation"));const ti=`z${ee}`;this.stats[ti]=(this.stats[ti]||0)+1,this.total++}if(Ht.source=Y,J==null){if(ee===Re.indexMaxZoom||Ht.numPoints<=Re.indexMaxPoints)continue}else{if(ee===Re.maxZoom||ee===J)continue;if(J!=null){const ti=J-ee;if(q!==ce>>ti||Q!==Ce>>ti)continue}}if(Ht.source=null,Y.length===0)continue;dt>1&&console.time("clipping");const Kt=.5*Re.buffer/Re.extent,er=.5-Kt,dr=.5+Kt,Er=1+Kt;let Kr=null,Ar=null,ei=null,rn=null,Xi=yt(Y,Ge,q-Kt,q+dr,0,Ht.minX,Ht.maxX,Re),Ei=yt(Y,Ge,q+er,q+Er,0,Ht.minX,Ht.maxX,Re);Y=null,Xi&&(Kr=yt(Xi,Ge,Q-Kt,Q+dr,1,Ht.minY,Ht.maxY,Re),Ar=yt(Xi,Ge,Q+er,Q+Er,1,Ht.minY,Ht.maxY,Re),Xi=null),Ei&&(ei=yt(Ei,Ge,Q-Kt,Q+dr,1,Ht.minY,Ht.maxY,Re),rn=yt(Ei,Ge,Q+er,Q+Er,1,Ht.minY,Ht.maxY,Re),Ei=null),dt>1&&console.timeEnd("clipping"),Ee.push(Kr||[],ee+1,2*q,2*Q),Ee.push(Ar||[],ee+1,2*q,2*Q+1),Ee.push(ei||[],ee+1,2*q+1,2*Q),Ee.push(rn||[],ee+1,2*q+1,2*Q+1)}}getTile(Y,ee,q){Y=+Y,ee=+ee,q=+q;const Q=this.options,{extent:J,debug:ce}=Q;if(Y<0||Y>24)return null;const Ce=1<<Y,Ee=Fc(Y,ee=ee+Ce&Ce-1,q);if(this.tiles[Ee])return Yo(this.tiles[Ee],J);ce>1&&console.log("drilling down to z%d-%d-%d",Y,ee,q);let Re,dt=Y,Ge=ee,Mt=q;for(;!Re&&dt>0;)dt--,Ge>>=1,Mt>>=1,Re=this.tiles[Fc(dt,Ge,Mt)];return Re&&Re.source?(ce>
661&&(console.log("found parent tile z%d-%d-%d",dt,Ge,Mt),console.time("drilling down")),this.splitTile(Re.source,dt,Ge,Mt,Y,ee,q),ce>1&&console.timeEnd("drilling down"),this.tiles[Ee]?Yo(this.tiles[Ee],J):null):null}}function Fc(Xe,Y,ee){return 32*((1<<Xe)*ee+Y)+Xe}function Tt(Xe,Y){const ee=Xe.tileID.canonical;if(!this._geoJSONIndex)return void Y(null,null);const q=this._geoJSONIndex.getTile(ee.z,ee.x,ee.y);if(!q)return void Y(null,null);const Q=Re=>Re.tags&&"3d_elevation_id"in Re.tags&&"source"in Re.tags&&Re.tags.source==="elevation",J=q.features.filter(Re=>Q(Re));let ce={_geojsonTileLayer:q.features};J.length>0&&(ce={_geojsonTileLayer:q.features.filter(Re=>!Q(Re)),hd_road_elevation:J});const Ce=new It(ce),Ee=function(Re){const dt=new s.bq;for(const Ge of Object.keys(Re))dt.writeMessage(3,Oe,{name:Ge,features:Re[Ge]});return dt.finish()}(ce).buffer;Y(null,{vectorTile:Ce,rawData:Ee})}class rl extends Ne{constructor(Y,ee,q,Q,J,ce,Ce){super(Y,ee,q,Q,J,Tt,Ce),ce&&(this.loadGeoJSON=ce),this._dynamicIndex=new Ae}loadData(Y,ee){const q=Y&&Y.request,Q=q&&q.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(Y,(J,ce)=>{if(J||!ce)return ee(J);if(typeof ce!="object")return ee(new Error(`Input data given to '${Y.source}' is not a valid GeoJSON object.`));{try{if(Y.filter){const Ee=s.X(Y.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ee.result==="error")throw new Error(Ee.value.map(Re=>`${Re.key}: ${Re.message}`).join(", "));ce.features=ce.features.filter(Re=>Ee.value.evaluate({zoom:0},Re))}Y.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),Y.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),Y.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=Y.cluster?new ao(function({superclusterOptions:Ee,clusterProperties:Re}){if(!Re||!Ee)return Ee;const dt={},Ge={},Mt={accumulated:null,zoom:0},Ht={properties:null},Kt=Object.keys(Re);for(const er of Kt){const[dr,Er]=Re[er],Kr=s.X(Er),Ar=s.X(typeof dr=="string"?[dr,["accumulated"],["get",er]]:dr);dt[er]=Kr.value,Ge[er]=Ar.value}return Ee.map=er=>{Ht.properties=er;const dr={};for(const Er of Kt)dr[Er]=dt[Er].evaluate(Mt,Ht);return dr},Ee.reduce=(er,dr)=>{Ht.properties=dr;for(const Er of Kt)Mt.accumulated=er[Er],er[Er]=Ge[Er].evaluate(Mt,Ht)},Ee}(Y)).load(ce.features):Y.dynamic?this._dynamicIndex:function(Ee,Re){return new Al(Ee,Re)}(ce,Y.geojsonVtOptions)}catch(Ee){return ee(Ee)}const Ce={};if(Q){const Ee=M(q);Ee&&(Ce.resourceTiming={},Ce.resourceTiming[Y.source]=JSON.parse(JSON.stringify(Ee)))}ee(null,Ce)}})}reloadTile(Y,ee){const q=this.loaded;return q&&q[Y.uid]?Y.partial?ee(null,void 0):super.reloadTile(Y,ee):this.loadTile(Y,ee)}loadGeoJSON(Y,ee){if(Y.request)s.n(Y.request,ee);else{if(typeof Y.data!="string")return ee(new Error(`Input data given to '${Y.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return ee(null,JSON.parse(Y.data))}catch{return ee(new Error(`Input data given to '${Y.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(Y,ee){try{ee(null,this._geoJSONIndex.getClusterExpansionZoom(Y.clusterId))}catch(q){ee(q)}}getClusterChildren(Y,ee){try{ee(null,this._geoJSONIndex.getChildren(Y.clusterId))}catch(q){ee(q)}}getClusterLeaves(Y,ee){try{ee(null,this._geoJSONIndex.getLeaves(Y.clusterId,Y.limit,Y.offset))}catch(q){ee(q)}}}class Fh{constructor(Y,ee,q){this.tileID=new s.aM(Y.tileID.overscaledZ,Y.tileID.wrap,Y.tileID.canonical.z,Y.tileID.canonical.x,Y.tileID.canonical.y),this.tileZoom=Y.tileZoom,this.uid=Y.uid,this.zoom=Y.zoom,this.canonical=Y.tileID.canonical,this.pixelRatio=Y.pixelRatio,this.tileSize=Y.tileSize,this.source=Y.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=Y.projection,this.brightness=ee,this.worldview=q}parse(Y,ee,q,Q){this.status="parsing";const J=new s.aM(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),ce=[],Ce=ee.familiesBySource[q.source],Ee=new s.fc(J,q.promoteId);Ee.bucketLayerIDs=[],Ee.is3DTile=!0,s.fr(Y).then(Re=>{if(!Re)return Q(new Error("Could not parse tile"));const dt=Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("MAPBOX_mesh_features")||Re.json.asset.extras&&Re.json.asset.extras.MAPBOX_mesh_features,Ge=Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("EXT_meshopt_compression"),Mt=new s.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const Ht in Ce)for(const Kt of Ce[Ht]){const er=Kt[0];Ee.bucketLayerIDs.push(Kt.map(Kr=>s.C(Kr.id,Kr.scope))),er.recalculate(Mt,[]);const dr=s.fs(Re,1/s.d4(q.tileID.canonical)),Er=new s.ft(Kt,dr,J,dt,Ge,this.brightness,Ee,this.worldview);dt||(Er.needsUpload=!0),ce.push(Er),Er.evaluate(er)}this.status="done",Q(null,{buckets:ce,featureIndex:Ee,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Re=>Q(new Error(Re.message)))}}class Pl{constructor(Y,ee,q,Q,J,ce,Ce,Ee){this.actor=Y,this.layerIndex=ee,this.availableImages=q,this.availableModels=Q,this.brightness=Ce,this.loading={},this.loaded={},this.worldview=Ee}loadTile(Y,ee){const q=Y.uid,Q=this.loading[q]=new Fh(Y,this.brightness,this.worldview);s.br(Y.request,(J,ce)=>{const Ce=!this.loading[q];return delete this.loading[q],Ce||J?(Q.status="done",Ce||(this.loaded[q]=Q),ee(J)):ce&&ce.byteLength!==0?void Q.parse(ce,this.layerIndex,Y,(Ee,Re)=>{Q.status="done",this.loaded=this.loaded||{},this.loaded[q]=Q,Ee||!Re?ee(Ee):ee(null,Re)}):(Q.status="done",this.loaded[q]=Q,ee())})}reloadTile(Y,ee){const q=this.loaded,Q=Y.uid;if(q&&q[Q]){const J=q[Q];J.projection=Y.projection,J.brightness=Y.brightness;const ce=(Ce,Ee)=>{J.reloadCallback&&(delete J.reloadCallback,this.loadTile(Y,ee)),ee(Ce,Ee)};J.status==="parsing"?J.reloadCallback=ce:J.status==="done"&&this.loadTile(Y,ee)}}abortTile(Y,ee){const q=Y.uid;this.loading[q]&&delete this.loading[q],ee()}removeTile(Y,ee){const q=this.loaded,Q=Y.uid;q&&q[Q]&&delete q[Q],ee()}}class ai{constructor(Y){this.self=Y,this.actor=new s.fv(Y,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cj({name:"mercator"}),this.workerSourceTypes={vector:Ne,geojson:rl,"raster-dem":_e,"raster-array":ke,"batched-model":Pl},this.workerSources={}
66,this.self.registerWorkerSource=(ee,q)=>{if(this.workerSourceTypes[ee])throw new Error(`Worker source with name "${ee}" already registered.`);this.workerSourceTypes[ee]=q},this.self.registerRTLTextPlugin=ee=>{if(s.fw.isParsed())throw new Error("RTL text plugin already registered.");s.fw.setState({pluginStatus:s.fx.parsed,pluginURL:s.fw.getPluginURL()}),s.fw.applyArabicShaping=ee.applyArabicShaping,s.fw.processBidirectionalText=ee.processBidirectionalText,s.fw.processStyledBidirectionalText=ee.processStyledBidirectionalText;for(const q of this.rtlPluginParsingListeners)q(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(Y,ee,q){delete this.layerIndexes[Y],delete this.availableImages[Y],delete this.availableModels[Y],delete this.workerSources[Y],q()}checkIfReady(Y,ee,q){q()}setReferrer(Y,ee){this.referrer=ee}spriteLoaded(Y,ee){this.isSpriteLoaded[Y]||(this.isSpriteLoaded[Y]={});const{scope:q,isLoaded:Q}=ee;if(this.isSpriteLoaded[Y][q]=Q,this.workerSources[Y]&&this.workerSources[Y][q])for(const J in this.workerSources[Y][q]){const ce=this.workerSources[Y][q][J];for(const Ce in ce){const Ee=ce[Ce];Ee instanceof Ne&&(Ee.isSpriteLoaded=Q,Ee.fire(new s.A("isSpriteLoaded")))}}}setImages(Y,ee,q){this.availableImages[Y]||(this.availableImages[Y]={});const{scope:Q,images:J}=ee;if(this.availableImages[Y][Q]=J,this.workerSources[Y]&&this.workerSources[Y][Q]){for(const ce in this.workerSources[Y][Q]){const Ce=this.workerSources[Y][Q][ce];for(const Ee in Ce)Ce[Ee].availableImages=J}q()}else q()}setModels(Y,{scope:ee,models:q},Q){if(this.availableModels[Y]||(this.availableModels[Y]={}),this.availableModels[Y][ee]=q,this.workerSources[Y]&&this.workerSources[Y][ee]){for(const J in this.workerSources[Y][ee]){const ce=this.workerSources[Y][ee][J];for(const Ce in ce)ce[Ce].availableModels=q}Q()}else Q()}setProjection(Y,ee){this.projections[Y]=s.cj(ee)}setBrightness(Y,ee,q){this.brightness=ee,q()}setWorldview(Y,ee,q){this.worldview=ee,q()}setLayers(Y,ee,q){this.getLayerIndex(Y,ee.scope).replace(ee.layers,ee.options),q()}updateLayers(Y,ee,q){this.getLayerIndex(Y,ee.scope).update(ee.layers,ee.removedIds,ee.options),q()}loadTile(Y,ee,q){ee.projection=this.projections[Y]||this.defaultProjection,this.getWorkerSource(Y,ee.type,ee.source,ee.scope).loadTile(ee,q)}decodeRasterArray(Y,ee,q){this.getWorkerSource(Y,ee.type,ee.source,ee.scope).decodeRasterArray(ee,q)}reloadTile(Y,ee,q){ee.projection=this.projections[Y]||this.defaultProjection,this.getWorkerSource(Y,ee.type,ee.source,ee.scope).reloadTile(ee,q)}abortTile(Y,ee,q){this.getWorkerSource(Y,ee.type,ee.source,ee.scope).abortTile(ee,q)}removeTile(Y,ee,q){this.getWorkerSource(Y,ee.type,ee.source,ee.scope).removeTile(ee,q)}removeSource(Y,ee,q){if(!(this.workerSources[Y]&&this.workerSources[Y][ee.scope]&&this.workerSources[Y][ee.scope][ee.type]&&this.workerSources[Y][ee.scope][ee.type][ee.source]))return;const Q=this.workerSources[Y][ee.scope][ee.type][ee.source];delete this.workerSources[Y][ee.scope][ee.type][ee.source],Q.removeSource!==void 0?Q.removeSource(ee,q):q()}loadWorkerSource(Y,ee,q){try{this.self.importScripts(ee.url),q()}catch(Q){q(Q.toString())}}syncRTLPluginState(Y,ee,q){if(s.fw.isParsed())q(null,!0);else if(s.fw.isParsing())this.rtlPluginParsingListeners.push(q);else try{s.fw.setState(ee);const Q=s.fw.getPluginURL();!s.fw.isLoaded()||s.fw.isParsed()||s.fw.isParsing()||Q==null||(s.fw.setState({pluginStatus:s.fx.parsing,pluginURL:s.fw.getPluginURL()}),this.self.importScripts(Q),s.fw.isParsed()?q(null,!0):this.rtlPluginParsingListeners.push(q))}catch(Q){q(Q.toString())}}setDracoUrl(Y,ee){this.dracoUrl=ee}getAvailableImages(Y,ee){this.availableImages[Y]||(this.availableImages[Y]={});let q=this.availableImages[Y][ee];return q||(q=[]),q}getAvailableModels(Y,ee){this.availableModels[Y]||(this.availableModels[Y]={});let q=this.availableModels[Y][ee];return q||(q={}),q}getLayerIndex(Y,ee){this.layerIndexes[Y]||(this.layerIndexes[Y]={});let q=this.layerIndexes[Y][ee];return q||(q=this.layerIndexes[Y][ee]=new H,q.scope=ee),q}getWorkerSource(Y,ee,q,Q){const J=this.workerSources;return J[Y]||(J[Y]={}),J[Y][Q]||(J[Y][Q]={}),J[Y][Q][ee]||(J[Y][Q][ee]={}),this.isSpriteLoaded[Y]||(this.isSpriteLoaded[Y]={}),J[Y][Q][ee][q]||(J[Y][Q][ee][q]=new this.workerSourceTypes[ee]({send:(ce,Ce,Ee,Re,dt,Ge)=>this.actor.send(ce,Ce,Ee,Y,dt,Ge),scheduler:this.actor.scheduler},this.getLayerIndex(Y,Q),this.getAvailableImages(Y,Q),this.getAvailableModels(Y,Q),this.isSpriteLoaded[Y][Q],void 0,this.brightness,this.worldview)),J[Y][Q][ee][q]}rasterizeImagesWorker(Y,ee,q){const Q=new Map;for(const[J,{image:ce,imageVariant:Ce}]of ee.tasks.entries()){const Ee=this.imageRasterizer.rasterize(Ce,ce,ee.scope,Y);Q.set(J,Ee)}q(void 0,Q)}removeRasterizedImages(Y,ee,q){this.imageRasterizer.removeImagesFromCacheByIds(ee.imageIds,ee.scope,Y),q()}enforceCacheSizeLimit(Y,ee){s.fy(ee)}getWorkerPerformanceMetrics(Y,ee,q){q(void 0,void 0)}}return s.fu(self)&&(self.worker=new ai(self)),ai}),y(["./shared"],function(s){var M="3.14.0";const L={create:"create",load:"load",fullLoad:"fullLoad"},B={mark(d){performance.mark(d)},measure(d,i,l){performance.measure(d,i,l)}};function H(d){const i=d.name.split("?")[0];return s.a(i)&&i.includes("mapbox-gl.js")?"javascript":s.a(i)&&i.includes("mapbox-gl.css")?"css":s.b(i)?"fontRange":s.c(i)?"sprite":s.i(i)?"style":s.d(i)?"tilejson":"other"}var $,te={},xe=function(){if($)return te;function d(f){return!i(f)}function i(f){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var v,b,S=new Blob([""],{type:"text/javascript"}),C=URL.createObjectURL(S);try{b=new Worker(C),v=!0}catch{v=!1}return b&&b.terminate(),URL.revokeObjectURL(C),v}()?function(){var v=document.createElement("canvas");v.width=v.height=1;var b=v.getContext("2d");if(!b)return!1;var S=b.getImageData(0,0,1,1);return S&&S.width===v.width}()?(l[_=f&&f.failIfMajorPerformanceCaveat]===void 0&&(l[_]=function(v){var b,S=function(C){var k=document.createElement("canvas"),R=Object.create(d.webGLContextAttributes);return R.failIfMajorPerformanceCaveat=C,k.getContext("webgl2",R)}(v);if(!S)return!1;try{b=S.createShader(S.VERTEX_SHADER)}catch{return!1}return!(!b||S.isContextLost())&&(S.shaderSource(b,"void main() {}"),S.compileShader(b),S.getShaderParameter(b,S.COMPILE_STATUS)===!0)}(_)),l[_]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var _}
66$=1,te.supported=d,te.notSupportedReason=i;var l={};return d.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},te}();function pe(d,i,l){const f=document.createElement(d);return i!=null&&(f.className=i),l&&l.appendChild(f),f}function Ne(d,i,l){const f=document.createElementNS("http://www.w3.org/2000/svg",d);for(const _ of Object.keys(i))f.setAttributeNS(null,_,String(i[_]));return l&&l.appendChild(f),f}const _e=typeof document<"u"?document.documentElement&&document.documentElement.style:null,ie=_e&&_e.userSelect!==void 0?"userSelect":"WebkitUserSelect";let ke;function ot(){_e&&ie&&(ke=_e[ie],_e[ie]="none")}function et(){_e&&ie&&(_e[ie]=ke)}function wt(d){d.preventDefault(),d.stopPropagation(),window.removeEventListener("click",wt,!0)}function It(){window.addEventListener("click",wt,!0),window.setTimeout(()=>{window.removeEventListener("click",wt,!0)},0)}function K(d,i){const l=d.getBoundingClientRect();return Ye(d,l,i)}function ve(d,i){const l=d.getBoundingClientRect(),f=[];for(let _=0;_<i.length;_++)f.push(Ye(d,l,i[_]));return f}function Ae(d){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&d.button===2&&d.ctrlKey?0:d.button}function Ye(d,i,l){const f=d.offsetWidth===i.width?1:d.offsetWidth/i.width;return new s.P((l.clientX-i.left)*f,(l.clientY-i.top)*f)}const Be="01",Fe="NO_ACCESS_TOKEN";class Je{constructor(i,l,f){this._transformRequestFn=i,this._customAccessToken=l,this._silenceAuthErrors=!!f,this._createSkuToken()}_createSkuToken(){const i=function(){let l="";for(let f=0;f<10;f++)l+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Be,l].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,l){return this._transformRequestFn&&this._transformRequestFn(i,l)||{url:i}}normalizeStyleURL(i,l){if(!s.j(i))return i;const f=He(i);return f.params.push(`sdk=js-${M}`),f.path=`/styles/v1${f.path}`,this._makeAPIURL(f,this._customAccessToken||l)}normalizeGlyphsURL(i,l){if(!s.j(i))return i;const f=He(i);return f.path=`/fonts/v1${f.path}`,this._makeAPIURL(f,this._customAccessToken||l)}normalizeModelURL(i,l){if(!s.j(i))return i;const f=He(i);return f.path=`/models/v1${f.path}`,this._makeAPIURL(f,this._customAccessToken||l)}normalizeSourceURL(i,l,f,_){if(!s.j(i))return i;const v=He(i);return v.path=`/v4/${v.authority}.json`,v.params.push("secure"),f&&v.params.push(`language=${f}`),_&&v.params.push(`worldview=${_}`),this._makeAPIURL(v,this._customAccessToken||l)}normalizeIconsetURL(i,l){const f=He(i);return s.j(i)?(f.path=`/styles/v1${f.path}/iconset.pbf`,this._makeAPIURL(f,this._customAccessToken||l)):tt(f)}normalizeSpriteURL(i,l,f,_){const v=He(i);return s.j(i)?(v.path=`/styles/v1${v.path}/sprite${l}${f}`,this._makeAPIURL(v,this._customAccessToken||_)):(v.path+=`${l}${f}`,tt(v))}normalizeTileURL(i,l,f){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!s.j(i))return i;const _=He(i);_.path=_.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${l||f&&_.authority!=="raster"&&f===512?"@2x":""}${s.l.supported?".webp":"$1"}`),_.authority==="raster"?_.path=`/${s.e.RASTER_URL_PREFIX}${_.path}`:_.authority==="rasterarrays"?_.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${_.path}`:_.authority==="3dtiles"?_.path=`/${s.e.TILES3D_URL_PREFIX}${_.path}`:(_.path=_.path.replace(/^.+\/v4\//,"/"),_.path=`/${s.e.TILE_URL_VERSION}${_.path}`);const v=this._customAccessToken||function(b){for(const S of b){const C=S.match(/^access_token=(.*)$/);if(C)return C[1]}return null}(_.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&v&&this._skuToken&&_.params.push(`sku=${this._skuToken}`),this._makeAPIURL(_,v)}canonicalizeTileURL(i,l){const f=He(i);if(!f.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!f.path.match(/\.[\w]+$/))return i;let _="mapbox://";f.path.match(/^\/raster\/v1\//)?_+=`raster/${f.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:f.path.match(/^\/rasterarrays\/v1\//)?_+=`rasterarrays/${f.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:_+=`tiles/${f.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let v=f.params;return l&&(v=v.filter(b=>!b.match(/^access_token=/))),v.length&&(_+=`?${v.join("&")}`),_}canonicalizeTileset(i,l){const f=!!l&&s.j(l),_=[];for(const v of i.tiles||[])s.k(v)?_.push(this.canonicalizeTileURL(v,f)):_.push(v);return _}_makeAPIURL(i,l){const f="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",_=He(s.e.API_URL);if(i.protocol=_.protocol,i.authority=_.authority,i.protocol==="http"){const v=i.params.indexOf("secure");v>=0&&i.params.splice(v,1)}if(_.path!=="/"&&(i.path=`${_.path}${i.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return tt(i);if(l=l||s.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!l)throw new Error(`An API access token is required to use Mapbox GL. ${f}`);if(l[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${f}`)}return i.params=i.params.filter(v=>v.indexOf("access_token")===-1),i.params.push(`access_token=${l||""}`),tt(i)}}const ze=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function He(d){const i=d.match(ze);if(!i)throw new Error("Unable to parse URL object");return{protocol:i[1],authority:i[2],path:i[3]||"/",params:i[4]?i[4].split("&"):[]}}function tt(d){const i=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${i}`}const Oe="mapbox.eventData";function rt(d){if(!d)return null;const i=d.split(".");if(!i||i.length!==3)return null;try{return JSON.parse(s.m(i[1]))}catch{return null}}class Nt{constructor(i){this.type=i,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){const l=rt(s.e.ACCESS_TOKEN);let f="";return f=l&&l.u?s.f(l.u):s.e.ACCESS_TOKEN||"",i?`${Oe}.${i}:${f}`:`${Oe}:${f}`}fetchEventData(){const i=s.s("localStorage"),l=this.getStorageKey(),f=this.getStorageKey("uuid");if(i)try{const _=localStorage.getItem(l);_&&(this.eventData=JSON.parse(_));const v=localStorage.getItem(f);v&&(this.anonId=v)}catch{s.w("Unable to read from LocalStorage")}}saveEventData(){const i=s.s("localStorage"),l=this.getStorageKey(),f=this.getStorageKey("uuid"),_=this.anonId;if(i&&_)try{localStorage.setItem(f,_),Object.keys(this.eventData).length>=1&&localStorage.setItem(l,JSON.stringify(this.eventData))}catch{s.w("Unable to write to LocalStorage")}}processRequests(i){}postEvent(i,l,f,_){if(!s.e.EVENTS_URL)return;const v=He(s.e.EVENTS_URL);v.params.push(`access_token=${_||s.e.ACCESS_TOKEN||""}`);const b={event:this.type,created:new Date(i).toISOString()},S=l?s.h(b,l):b,C={url:tt(v),headers:{"Content-Type":"text/plain"},body:JSON.stringify([S])};this.pendingRequest=s.p(C,k=>{this.pendingRequest=null,f(k),this.saveEventData(),this.processRequests(_)})}queueRequest(i,l){this.queue.push(i),this.processRequests(l)}}const jt=new class extends Nt{constructor(d){super("appUserTurnstile"),this._customAccessToken=d}postTurnstileEvent(d,i){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(d)&&d.some(l=>s.j(l)||s.k(l))&&this.queueRequest(Date.now(),i)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const i=rt(s.e.ACCESS_TOKEN),l=i?i.u:s.e.ACCESS_TOKEN;let f=l!==this.eventData.tokenU;s.v(this.anonId)||(this.anonId=s.u(),f=!0);const _=this.queue.shift();if(this.eventData.lastSuccess){const v=new Date(this.eventData.lastSuccess),b=new Date(_),S=(_-this.eventData.lastSuccess)/864e5;f=f||S>=1||S<-1||v.getDate()!==b.getDate()}else f=!0;f?this.postEvent(_,{sdkIdentifier:"mapbox-gl-js",sdkVersion:M,skuId:Be,"enabled.telemetry":!1,userId:this.anonId},v=>{v||(this.eventData.lastSuccess=_,this.eventData.tokenU=l)},d):this.processRequests()}},gr=jt.postTurnstileEvent.bind(jt),li=new class extends Nt{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(d,i,l,f){this.skuToken=i,this.errorCb=f,s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN?this.queueRequest({id:d,timestamp:Date.now()},l):this.errorCb(new Error(Fe)))}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{id:i,timestamp:l}=this.queue.shift();i&&this.success[i]||(this.anonId||this.fetchEventData(),s.v(this.anonId)||(this.anonId=s.u()),this.postEvent(l,{sdkIdentifier:"mapbox-gl-js",sdkVersion:M,skuId:Be,skuToken:this.skuToken,userId:this.anonId},f=>{f?this.errorCb(f):i&&(this.success[i]=!0)},d))}remove(){this.errorCb=null}},di=li.postMapLoadEvent.bind(li),Wr=new class extends Nt{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(d){let i=this.mapInstanceIdMap.get(d);
66return i||(i=s.u(),this.mapInstanceIdMap.set(d,i)),i}getEventId(d){const i=this.eventIdPerMapInstanceMap.get(d)||0;return this.eventIdPerMapInstanceMap.set(d,i+1),i}postStyleLoadEvent(d,i){const{map:l,style:f,importedStyles:_}=i;if(!s.e.EVENTS_URL||!d&&!s.e.ACCESS_TOKEN)return;const v=this.getMapInstanceId(l),b={mapInstanceId:v,eventId:this.getEventId(v),style:f};_.length&&(b.importedStyles=_),this.queueRequest({timestamp:Date.now(),payload:b},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:i,payload:l}=this.queue.shift();this.postEvent(i,l,()=>{},d)}},fr=Wr.postStyleLoadEvent.bind(Wr),Ur=new class extends Nt{constructor(){super("gljs.performance")}postPerformanceEvent(d,i){s.e.EVENTS_URL&&(d||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:i,performanceData:l}=this.queue.shift(),f=function(_){const v=performance.getEntriesByType("resource"),b=performance.getEntriesByType("mark"),S=function(N){const G={};if(N){for(const U in N)if(U!=="other")for(const W of N[U]){const Z=`${U}ResolveRangeMin`,re=`${U}ResolveRangeMax`,se=`${U}RequestCount`,le=`${U}RequestCachedCount`;G[Z]=Math.min(G[Z]||1/0,W.startTime),G[re]=Math.max(G[re]||-1/0,W.responseEnd);const fe=we=>{G[we]===void 0&&(G[we]=0),++G[we]};W.transferSize!==void 0&&W.transferSize===0&&fe(le),fe(se)}}return G}(function(N,G){const U={};if(N)for(const W of N){const Z=G(W);U[Z]===void 0&&(U[Z]=[]),U[Z].push(W)}return U}(v,H)),C=window.devicePixelRatio,k=navigator.connection||navigator.mozConnection||navigator.webkitConnection,R=k?k.effectiveType:void 0,F={counters:[],metadata:[],attributes:[]},z=(N,G,U)=>{U!=null&&N.push({name:G,value:U.toString()})};for(const N in S)z(F.counters,N,S[N]);if(_.interactionRange[0]!==1/0&&_.interactionRange[1]!==-1/0&&(z(F.counters,"interactionRangeMin",_.interactionRange[0]),z(F.counters,"interactionRangeMax",_.interactionRange[1])),b)for(const N of Object.keys(L)){const G=L[N],U=b.find(W=>W.name===G);U&&z(F.counters,G,U.startTime)}
66return z(F.counters,"visibilityHidden",_.visibilityHidden),z(F.attributes,"style",function(N){if(N)for(const G of N){const U=G.name.split("?")[0];if(s.i(U)){const W=U.split("/").slice(-2);if(W.length===2)return`mapbox://styles/${W[0]}/${W[1]}`}}}(v)),z(F.attributes,"terrainEnabled",_.terrainEnabled?"true":"false"),z(F.attributes,"fogEnabled",_.fogEnabled?"true":"false"),z(F.attributes,"projection",_.projection),z(F.attributes,"zoom",_.zoom),z(F.metadata,"devicePixelRatio",C),z(F.metadata,"connectionEffectiveType",R),z(F.metadata,"navigatorUserAgent",navigator.userAgent),z(F.metadata,"screenWidth",window.screen.width),z(F.metadata,"screenHeight",window.screen.height),z(F.metadata,"windowWidth",window.innerWidth),z(F.metadata,"windowHeight",window.innerHeight),z(F.metadata,"mapWidth",_.width/C),z(F.metadata,"mapHeight",_.height/C),z(F.metadata,"webglRenderer",_.renderer),z(F.metadata,"webglVendor",_.vendor),z(F.metadata,"sdkVersion",M),z(F.metadata,"sdkIdentifier","mapbox-gl-js"),F}(l);for(const _ of f.metadata);for(const _ of f.counters);for(const _ of f.attributes);this.postEvent(i,f,()=>{},d)}},qi=Ur.postPerformanceEvent.bind(Ur),zn=new class extends Nt{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(d,i,l,f){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const _=He(s.e.API_URL+s.e.SESSION_PATH);_.params.push(`sku=${i||""}`),_.params.push(`access_token=${f||s.e.ACCESS_TOKEN||""}`);const v={url:tt(_),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(v,b=>{this.pendingRequest=null,l(b),this.saveEventData(),this.processRequests(f)})}getSessionAPI(d,i,l,f){this.skuToken=i,this.errorCb=f,s.e.SESSION_PATH&&s.e.API_URL&&(l||s.e.ACCESS_TOKEN?this.queueRequest({id:d,timestamp:Date.now()},l):this.errorCb(new Error(Fe)))}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{id:i,timestamp:l}=this.queue.shift();i&&this.success[i]||this.getSession(l,this.skuToken,f=>{f?this.errorCb(f):i&&(this.success[i]=!0)},d)}remove(){this.errorCb=null}},sn=zn.getSessionAPI.bind(zn),ao=new Set;function So(d,i){i?ao.add(d):ao.delete(d)}class tn{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(i,l){this._updatedSourceCaches[i]=l,this.setDirty()}discardSourceCacheUpdate(i){delete this._updatedSourceCaches[i]}updateLayer(i){const l=i.scope;this._updatedLayers[l]=this._updatedLayers[l]||new Set,this._updatedLayers[l].add(i.id),this.setDirty()}removeLayer(i){const l=i.scope;this._removedLayers[l]=this._removedLayers[l]||{},this._updatedLayers[l]=this._updatedLayers[l]||new Set,this._removedLayers[l][i.id]=i,this._updatedLayers[l].delete(i.id),this._updatedPaintProps.delete(i.fqid),this.setDirty()}getRemovedLayer(i){return this._removedLayers[i.scope]?this._removedLayers[i.scope][i.id]:null}discardLayerRemoval(i){this._removedLayers[i.scope]&&delete this._removedLayers[i.scope][i.id]}getLayerUpdatesByScope(){const i={};for(const l in this._updatedLayers)i[l]=i[l]||{},i[l].updatedIds=Array.from(this._updatedLayers[l].values());for(const l in this._removedLayers)i[l]=i[l]||{},i[l].removedIds=Object.keys(this._removedLayers[l]);return i}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(i){this._updatedPaintProps.add(i.fqid),this.setDirty()}getUpdatedImages(i){return this._updatedImages[i]?Array.from(this._updatedImages[i].values()):[]}updateImage(i,l){this._updatedImages[l]=this._updatedImages[l]||new Set,this._updatedImages[l].add(s.I.toString(i)),this.setDirty()}resetUpdatedImages(i){this._updatedImages[i]&&this._updatedImages[i].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function Wi(d){const{userImage:i}=d;return!!(i&&i.render&&i.render())&&(d.data.replace(new Uint8Array(i.data.buffer)),!0)}class Xr extends s.E{constructor(i){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=i,i!=="raster"&&s.t()&&(this.imageRasterizerDispatcher=new s.D(s.x(),this,"Image Rasterizer Worker",1))}addScope(i){this.loaded.set(i,!1),this.imageProviders.set(i,new Map),this.images.set(i,new Map),this.updatedImages.set(i,new Set),this.callbackDispatchedThisFrame.set(i,new Set),this.patterns.set(i,new Map),this.atlasImage.set(i,new s.r({width:1,height:1}))}removeScope(i){this.loaded.delete(i),this.imageProviders.delete(i),this.images.delete(i),this.updatedImages.delete(i),this.callbackDispatchedThisFrame.delete(i),this.patterns.delete(i),this.atlasImage.delete(i);const l=this.atlasTexture.get(i);l&&(l.destroy(),this.atlasTexture.delete(i))}addImageProvider(i,l){this.imageProviders.has(l)||this.imageProviders.set(l,new Map),this.imageProviders.get(l).set(i.id,i)}removeImageProvider(i,l){this.imageProviders.has(l)&&this.imageProviders.get(l).delete(i)}getPendingImageProviders(){const i=[];for(const l of this.imageProviders.values())for(const f of l.values())f.hasPendingRequests()&&i.push(f);return i}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new s.y),this._imageRasterizer}isLoaded(){for(const i of this.loaded.keys())if(!this.loaded.get(i))return!1;return!0}
vendor: 6,062 bytes, line 66
66setLoaded(i,l){if(this.loaded.get(l)!==i&&(this.loaded.set(l,i),i)){for(const{ids:f,callback:_}of this.requestors)this._notify(f,l,_);this.requestors=[]}}hasImage(i,l){return!!this.getImage(i,l)}getImage(i,l){return this.images.get(l).get(i.toString())}addImage(i,l,f){this._validate(i,f)&&this.images.get(l).set(i.toString(),f)}_validate(i,l){let f=!0;return this._validateStretch(l.stretchX,l.data&&l.data.width)||(this.fire(new s.z(new Error(`Image "${i.name}" has invalid "stretchX" value`))),f=!1),this._validateStretch(l.stretchY,l.data&&l.data.height)||(this.fire(new s.z(new Error(`Image "${i.name}" has invalid "stretchY" value`))),f=!1),this._validateContent(l.content,l)||(this.fire(new s.z(new Error(`Image "${i.name}" has invalid "content" value`))),f=!1),f}_validateStretch(i,l){if(!i)return!0;let f=0;for(const _ of i){if(_[0]<f||_[1]<_[0]||l<_[1])return!1;f=_[1]}return!0}_validateContent(i,l){return i?i.length!==4||!l.usvg&&(i[0]<0||l.data.width<i[0]||i[1]<0||l.data.height<i[1]||i[2]<0||l.data.width<i[2]||i[3]<0||l.data.height<i[3])?!1:!(i[2]<i[0]||i[3]<i[1]):!0}updateImage(i,l,f){const _=this.images.get(l).get(i.toString());f.version=_.version+1,this.images.get(l).set(i.toString(),f),this.updatedImages.get(l).add(i),this.removeFromImageRasterizerCache(i,l)}clearUpdatedImages(i){this.updatedImages.get(i).clear()}removeFromImageRasterizerCache(i,l){this.spriteFormat!=="raster"&&(s.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[i],scope:l}):this.imageRasterizer.removeImagesFromCacheByIds([i],l))}removeImage(i,l){const f=this.images.get(l),_=f.get(i.toString());f.delete(i.toString()),this.patterns.get(l).delete(i.toString()),this.removeFromImageRasterizerCache(i,l),_.userImage&&_.userImage.onRemove&&_.userImage.onRemove()}listImages(i){return Array.from(this.images.get(i).keys()).map(l=>s.I.from(l))}getImages(i,l,f){const _=[],v=[],b=this.imageProviders.get(l);for(const R of i){if(!R.iconsetId){_.push(R);continue}const F=b.get(R.iconsetId);F&&(this.getImage(R,l)?v.push(R):F.addPendingRequest(R))}if(_.length===0)return void this._notify(v,l,f);let S=!0;const C=!!this.loaded.get(l),k=this.images.get(l);if(!C)for(const R of _)k.has(R.toString())||(S=!1);C||S?this._notify(_,l,f):this.requestors.push({ids:_,scope:l,callback:f})}rasterizeImages(i,l){const f=new Map,{tasks:_,scope:v}=i;for(const[b,S]of _.entries()){const C=this.getImage(S.id,v);C&&f.set(b,{image:C,imageVariant:S})}this._rasterizeImages(v,f,l)}_rasterizeImages(i,l,f){if(s.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:l,scope:i},f);else{const _=new Map;for(const[v,{image:b,imageVariant:S}]of l.entries())_.set(v,this.imageRasterizer.rasterize(S,b,i,0));f(void 0,_)}}getUpdatedImages(i){return this.updatedImages.get(i)||new Set}_notify(i,l,f){const _=this.images.get(l),v=new Map;for(const b of i){if(!_.get(b.toString())){if(b.iconsetId)continue;this.fire(new s.A("styleimagemissing",{id:b.name}))}const S=_.get(b.toString());if(!S){s.w(`Image "${b.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const C={data:S.usvg?null:S.data.clone(),pixelRatio:S.pixelRatio,sdf:S.sdf,usvg:S.usvg,version:S.version,stretchX:S.stretchX,stretchY:S.stretchY,content:S.content,hasRenderCallback:!!(S.userImage&&S.userImage.render)};S.usvg&&Object.assign(C,{width:S.icon.usvg_tree.width,height:S.icon.usvg_tree.height}),v.set(s.I.toString(b),C)}f(null,v)}getPixelSize(i){const{width:l,height:f}=this.atlasImage.get(i);return{width:l,height:f}}getPattern(i,l,f){const _=i.toString(),v=this.patterns.get(l),b=v.get(_),S=this.getImage(i,l);if(!S)return null;if(b){if(b.position.version===S.version)return b.position;b.position.version=S.version}else{if(S.usvg&&!S.data){const C=this.getPatternInFlightId(_,l);if(this.patternsInFlight.has(C))return null;this.patternsInFlight.add(C);const k=new s.B(i).scaleSelf(s.q.devicePixelRatio),R=new Map([[k.toString(),{image:S,imageVariant:k}]]);return this._rasterizeImages(l,R,(F,z)=>this.storePatternImage(k,l,S,f,z)),null}this.storePattern(i,l,S)}return this._updatePatternAtlas(l,f),v.get(_).position}getPatternInFlightId(i,l){return s.C(i,l)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(i,l,f,_,v){const b=i.toString(),S=v?v.get(b):void 0;S&&(f.data=S,this.storePattern(i.id,l,f),this._updatePatternAtlas(l,_),this.patternsInFlight.delete(this.getPatternInFlightId(i.id.toString(),l)))}storePattern(i,l,f){const _={w:f.data.width+2*s.F,h:f.data.height+2*s.F,x:0,y:0},v=new s.G(_,f,s.F);this.patterns.get(l).set(i.toString(),{bin:_,position:v})}destroyAtlasTextures(){for(const i of this.atlasTexture.values())i&&i.destroy();this.atlasTexture.clear()}bind(i,l){const f=i.gl;let _=this.atlasTexture.get(l);_?this.dirty&&(_.update(this.atlasImage.get(l)),this.dirty=!1):(_=new s.T(i,this.atlasImage.get(l),f.RGBA8),this.atlasTexture.set(l,_)),_.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(i,l){const f=this.patterns.get(i),_=Array.from(f.values()).map(({bin:k})=>k),{w:v,h:b}=s.H(_),S=this.atlasImage.get(i);S.resize({width:v||1,height:b||1});const C=this.images.get(i);for(const[k,{bin:R,position:F}]of f.entries()){let z=F.padding;const N=R.x+z,G=R.y+z,U=C.get(k).data,W=U.width,Z=U.height;z=z>1?z-1:z,s.r.copy(U,S,{x:0,y:0},{x:N,y:G},{width:W,height:Z},l),s.r.copy(U,S,{x:0,y:Z-z},{x:N,y:G-z},{width:W,height:z},l),s.r.copy(U,S,{x:0,y:0},{x:N,y:G+Z},{width:W,height:z},l),s.r.copy(U,S,{x:W-z,y:0},{x:N-z,y:G},{width:z,height:Z},l),s.r.copy(U,S,{x:0,y:0},{x:N+W,y:G},{width:z,height:Z},l),s.r.copy(U,S,{x:W-z,y:Z-z},{x:N-z,y:G-z},{width:z,height:z},l),s.r.copy(U,S,{x:0,y:Z-z},{x:N+W,y:G-z},{width:z,height:z},l),s.r.copy(U,S,{x:0,y:0},{x:N+W,y:G+Z},{width:z,height:z},l),s.r.copy(U,S,{x:W-z,y:0},{x:N-z,y:G+Z},{width:z,height:z},l)}this.dirty=!0}beginFrame(){for(const i of this.images.keys())this.callbackDispatchedThisFrame.set(i,new Set)}
66dispatchRenderCallbacks(i,l){const f=this.images.get(l);for(const _ of i){if(this.callbackDispatchedThisFrame.get(l).has(_.toString()))continue;this.callbackDispatchedThisFrame.get(l).add(_.toString());const v=f.get(_.toString());Wi(v)&&this.updateImage(_,l,v)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ro(d){const i=d.key,l=d.value,f=d.valueSpec||{},_=d.objectElementValidators||{},v=d.style,b=d.styleSpec;let S=[];const C=s.J(l);if(C!=="object")return[new s.V(i,l,`object expected, ${C} found`)];for(const k in l){const R=k.split(".")[0];let F;_[R]?F=_[R]:f[R]?F=Fi:_["*"]?F=_["*"]:f["*"]&&(F=Fi),F?S=S.concat(F({key:(i&&`${i}.`)+k,value:l[k],valueSpec:f[R]||f["*"],style:v,styleSpec:b,object:l,objectKey:k},l)):S.push(new s.K(i,l[k],`unknown property "${k}"`))}for(const k in f)_[k]||f[k].required&&f[k].default===void 0&&l[k]===void 0&&S.push(new s.V(i,l,`missing required property "${k}"`));return S}function Lo(d){const i=d.value,l=d.valueSpec,f=d.style,_=d.styleSpec,v=d.key,b=d.arrayElementValidator||Fi;if(s.J(i)!=="array")return[new s.V(v,i,`array expected, ${s.J(i)} found`)];if(l.length&&i.length!==l.length)return[new s.V(v,i,`array length ${l.length} expected, length ${i.length} found`)];if(l["min-length"]&&i.length<l["min-length"])return[new s.V(v,i,`array length at least ${l["min-length"]} expected, length ${i.length} found`)];let S={type:l.value,values:l.values,minimum:l.minimum,maximum:l.maximum,function:void 0};_.$version<7&&(S.function=l.function),s.J(l.value)==="object"&&(S=l.value);let C=[];for(let k=0;k<i.length;k++)C=C.concat(b({array:i,arrayIndex:k,value:i[k],valueSpec:S,style:f,styleSpec:_,key:`${v}[${k}]`},!0));return C}function oc(d){const i=d.key,l=d.value,f=d.valueSpec;let _=s.J(l);if(_==="number"&&l!=l&&(_="NaN"),_!=="number")return[new s.V(i,l,`number expected, ${_} found`)];if("minimum"in f){let v=f.minimum;if(s.J(f.minimum)==="array"&&(v=f.minimum[d.arrayIndex]),l<v)return[new s.V(i,l,`${l} is less than the minimum value ${v}`)]}if("maximum"in f){let v=f.maximum;if(s.J(f.maximum)==="array"&&(v=f.maximum[d.arrayIndex]),l>v)return[new s.V(i,l,`${l} is greater than the maximum value ${v}`)]}return[]}function Gs(d){const i=d.valueSpec,l=s.M(d.value.type);let f,_,v,b={};const S=l!=="categorical"&&d.value.property===void 0,C=!S,k=s.J(d.value.stops)==="array"&&s.J(d.value.stops[0])==="array"&&s.J(d.value.stops[0][0])==="object",R=Ro({key:d.key,value:d.value,valueSpec:d.styleSpec.function,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{stops:function(N){if(l==="identity")return[new s.V(N.key,N.value,'identity function may not have a "stops" property')];let G=[];const U=N.value;return G=G.concat(Lo({key:N.key,value:U,valueSpec:N.valueSpec,style:N.style,styleSpec:N.styleSpec,arrayElementValidator:F})),s.J(U)==="array"&&U.length===0&&G.push(new s.V(N.key,U,"array must have at least one stop")),G},default:function(N){return Fi({key:N.key,value:N.value,valueSpec:i,style:N.style,styleSpec:N.styleSpec})}}});return l==="identity"&&S&&R.push(new s.V(d.key,d.value,'missing required property "property"')),l==="identity"||d.value.stops||R.push(new s.V(d.key,d.value,'missing required property "stops"')),l==="exponential"&&d.valueSpec.expression&&!s.N(d.valueSpec)&&R.push(new s.V(d.key,d.value,"exponential functions not supported")),d.styleSpec.$version>=8&&(C&&!s.O(d.valueSpec)?R.push(new s.V(d.key,d.value,"property functions not supported")):S&&!s.Q(d.valueSpec)&&R.push(new s.V(d.key,d.value,"zoom functions not supported"))),l!=="categorical"&&!k||d.value.property!==void 0||R.push(new s.V(d.key,d.value,'"property" property is required')),R;function F(N){let G=[];const U=N.value,W=N.key;if(s.J(U)!=="array")return[new s.V(W,U,`array expected, ${s.J(U)} found`)];if(U.length!==2)return[new s.V(W,U,`array length 2 expected, length ${U.length} found`)];if(k){if(s.J(U[0])!=="object")return[new s.V(W,U,`object expected, ${s.J(U[0])} found`)];if(U[0].zoom===void 0)return[new s.V(W,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new s.V(W,U,"object stop key must have value")];const Z=s.M(U[0].zoom);if(typeof Z!="number")return[new s.V(W,U[0].zoom,"stop zoom values must be numbers")];if(v&&v>Z)return[new s.V(W,U[0].zoom,"stop zoom values must appear in ascending order")];Z!==v&&(v=Z,_=void 0,b={}
66),G=G.concat(Ro({key:`${W}[0]`,value:U[0],valueSpec:{zoom:{}},style:N.style,styleSpec:N.styleSpec,objectElementValidators:{zoom:oc,value:z}}))}else G=G.concat(z({key:`${W}[0]`,value:U[0],style:N.style,styleSpec:N.styleSpec},U));return s.S(s.U(U[1]))?G.concat([new s.V(`${W}[1]`,U[1],"expressions are not allowed in function stops.")]):G.concat(Fi({key:`${W}[1]`,value:U[1],valueSpec:i,style:N.style,styleSpec:N.styleSpec}))}function z(N,G){const U=s.J(N.value),W=s.M(N.value),Z=N.value!==null?N.value:G;if(f){if(U!==f)return[new s.V(N.key,Z,`${U} stop domain type must match previous stop domain type ${f}`)]}else f=U;if(U!=="number"&&U!=="string"&&U!=="boolean"&&typeof W!="number"&&typeof W!="string"&&typeof W!="boolean")return[new s.V(N.key,Z,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&l!=="categorical"){let re=`number expected, ${U} found`;return s.O(i)&&l===void 0&&(re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(N.key,Z,re)]}return l!=="categorical"||U!=="number"||typeof W=="number"&&isFinite(W)&&Math.floor(W)===W?l!=="categorical"&&U==="number"&&typeof W=="number"&&typeof _=="number"&&_!==void 0&&W<_?[new s.V(N.key,Z,"stop domain values must appear in ascending order")]:(_=W,l==="categorical"&&W in b?[new s.V(N.key,Z,"stop domain values must be unique")]:(b[W]=!0,[])):[new s.V(N.key,Z,`integer expected, found ${String(W)}`)]}}function zo(d){const i=(d.expressionContext==="property"?s.W:s.X)(s.U(d.value),d.valueSpec);if(i.result==="error")return i.value.map(f=>new s.V(`${d.key}${f.key}`,d.value,f.message));const l=i.value.expression||i.value._styleExpression.expression;if(d.expressionContext==="property"&&d.propertyKey==="text-font"&&!l.outputDefined())return[new s.V(d.key,d.value,`Invalid data expression for "${d.propertyKey}". Output values must be contained as literals within the expression.`)];if(d.expressionContext==="property"&&d.propertyType==="layout"&&!s.Y(l))return[new s.V(d.key,d.value,'"feature-state" data expressions are not supported with layout properties.')];if(d.expressionContext==="filter")return Uo(l,d);if(d.expressionContext&&d.expressionContext.indexOf("cluster")===0){if(!s.Z(l,["zoom","feature-state"]))return[new s.V(d.key,d.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(d.expressionContext==="cluster-initial"&&!s._(l))return[new s.V(d.key,d.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Uo(d,i){const l=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const _ of i.valueSpec.expression.parameters)l.delete(_);if(l.size===0)return[];const f=[];return d instanceof s.$&&l.has(d.name)?[new s.V(i.key,i.value,`["${d.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(d.eachChild(_=>{f.push(...Uo(_,i))}),f)}function aa(d){const i=d.key,l=d.value,f=d.valueSpec,_=[];return Array.isArray(f.values)?f.values.indexOf(s.M(l))===-1&&_.push(new s.V(i,l,`expected one of [${f.values.join(", ")}], ${JSON.stringify(l)} found`)):Object.keys(f.values).indexOf(s.M(l))===-1&&_.push(new s.V(i,l,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(l)} found`)),_}function za(d){return s.a1(s.U(d.value))?zo(s.L({},d,{expressionContext:"filter",valueSpec:d.styleSpec[`filter_${d.layerType||"fill"}`]})):Da(d)}function Da(d){const i=d.value,l=d.key;if(s.J(i)!=="array")return[new s.V(l,i,`array expected, ${s.J(i)} found`)];const f=d.styleSpec;let _,v=[];if(i.length<1)return[new s.V(l,i,"filter array must have at least 1 element")];switch(v=v.concat(aa({key:`${l}[0]`,value:i[0],valueSpec:f.filter_operator,style:d.style,styleSpec:d.styleSpec})),s.M(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&s.M(i[1])==="$type"&&v.push(new s.V(l,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&v.push(new s.V(l,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(_=s.J(i[1]),_!=="string"&&v.push(new s.V(`${l}[1]`,i[1],`string expected, ${_}
66 found`)));for(let b=2;b<i.length;b++)_=s.J(i[b]),s.M(i[1])==="$type"?v=v.concat(aa({key:`${l}[${b}]`,value:i[b],valueSpec:f.geometry_type,style:d.style,styleSpec:d.styleSpec})):_!=="string"&&_!=="number"&&_!=="boolean"&&v.push(new s.V(`${l}[${b}]`,i[b],`string, number, or boolean expected, ${_} found`));break;case"any":case"all":case"none":for(let b=1;b<i.length;b++)v=v.concat(Da({key:`${l}[${b}]`,value:i[b],style:d.style,styleSpec:d.styleSpec}));break;case"has":case"!has":_=s.J(i[1]),i.length!==2?v.push(new s.V(l,i,`filter array for "${i[0]}" operator must have 2 elements`)):_!=="string"&&v.push(new s.V(`${l}[1]`,i[1],`string expected, ${_} found`))}return v}function qe(d,i){const l=d.key,f=d.style,_=d.layer,v=d.styleSpec,b=d.value,S=d.objectKey,C=v[`${i}_${d.layerType}`];if(!C)return[];const k=S.match(/^(.*)-use-theme$/);if(i==="paint"&&k&&C[k[1]])return s.S(b)?[].concat(Fi({key:d.key,value:b,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:f,styleSpec:v,expressionContext:"property",propertyType:i,propertyKey:S})):Fi({key:l,value:b,valueSpec:{type:"string"},style:f,styleSpec:v});const R=S.match(/^(.*)-transition$/);if(i==="paint"&&R&&C[R[1]]&&C[R[1]].transition)return Fi({key:l,value:b,valueSpec:v.transition,style:f,styleSpec:v});const F=d.valueSpec||C[S];if(!F)return[new s.K(l,b,`unknown property "${S}"`)];let z;if(s.J(b)==="string"&&s.O(F)&&!F.tokens&&(z=/^{([^}]+)}$/.exec(b))){const G=`\`{ "type": "identity", "property": ${z?JSON.stringify(z[1]):'"_"'} }\``;return[new s.V(l,b,`"${S}" does not support interpolation syntax
67Use an identity property function instead: ${G}.`)]}const N=[];if(d.layerType==="symbol")S!=="text-field"||!f||f.glyphs||f.imports||N.push(new s.V(l,b,'use of "text-field" requires a style "glyphs" property')),S==="text-font"&&s.a2(s.U(b))&&s.M(b.type)==="identity"&&N.push(new s.V(l,b,'"text-font" does not support identity functions'));else if(d.layerType==="model"&&i==="paint"&&_&&_.layout&&_.layout.hasOwnProperty("model-id")&&s.O(F)&&(s.a3(F)||s.Q(F))){const G=s.W(s.U(b),F),U=G.value.expression||G.value._styleExpression.expression;U&&!s.Z(U,["measure-light"])&&(S==="model-emissive-strength"&&s._(U)&&s.Y(U)||N.push(new s.V(l,b,`${S} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return N.concat(Fi({key:d.key,value:b,valueSpec:F,style:f,styleSpec:v,expressionContext:"property",propertyType:i,propertyKey:S}))}function pt(d){return qe(d,"paint")}function yt(d){return qe(d,"layout")}function pr(d){let i=[];const l=d.value,f=d.key,_=d.style,v=d.styleSpec;l.type||l.ref||i.push(new s.V(f,l,'either "type" or "ref" is required'));let b=s.M(l.type);const S=s.M(l.ref);if(l.id){const C=s.M(l.id);for(let k=0;k<d.arrayIndex;k++){const R=_.layers[k];s.M(R.id)===C&&i.push(new s.V(f,l.id,`duplicate layer id "${l.id}", previously used at line ${R.id.__line__}`))}}if("ref"in l){let C;["type","source","source-layer","filter","layout"].forEach(k=>{k in l&&i.push(new s.V(f,l[k],`"${k}" is prohibited for ref layers`))}),_.layers.forEach(k=>{s.M(k.id)===S&&(C=k)}),C?C.ref?i.push(new s.V(f,l.ref,"ref cannot reference another ref layer")):b=s.M(C.type):typeof S=="string"&&i.push(new s.V(f,l.ref,`ref layer "${S}" not found`))}else if(b!=="background"&&b!=="sky"&&b!=="slot")if(l.source){const C=_.sources&&_.sources[l.source],k=C&&s.M(C.type);C?k==="vector"&&b==="raster"?i.push(new s.V(f,l.source,`layer "${l.id}" requires a raster source`)):k==="raster"&&b!=="raster"?i.push(new s.V(f,l.source,`layer "${l.id}" requires a vector source`)):k!=="vector"||l["source-layer"]?k==="raster-dem"&&b!=="hillshade"?i.push(new s.V(f,l.source,"raster-dem source can only be used with layer type 'hillshade'.")):k!=="raster-array"||["raster","raster-particle"].includes(b)?b==="line"&&l.paint&&(l.paint["line-gradient"]||l.paint["line-trim-offset"])&&k==="geojson"&&!C.lineMetrics?i.push(new s.V(f,l,`layer "${l.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):b==="raster-particle"&&k!=="raster-array"&&i.push(new s.V(f,l.source,`layer "${l.id}" requires a 'raster-array' source.`)):i.push(new s.V(f,l.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new s.V(f,l,`layer "${l.id}" must specify a "source-layer"`)):i.push(new s.V(f,l.source,`source "${l.source}" not found`))}else i.push(new s.V(f,l,'missing required property "source"'));
67return i=i.concat(Ro({key:f,value:l,valueSpec:v.layer,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Fi({key:`${f}.type`,value:l.type,valueSpec:v.layer.type,style:d.style,styleSpec:d.styleSpec,object:l,objectKey:"type"}),filter:C=>za(s.L({layerType:b},C)),layout:C=>Ro({layer:l,key:C.key,value:C.value,valueSpec:{},style:C.style,styleSpec:C.styleSpec,objectElementValidators:{"*":k=>yt(s.L({layerType:b},k))}}),paint:C=>Ro({layer:l,key:C.key,value:C.value,valueSpec:{},style:C.style,styleSpec:C.styleSpec,objectElementValidators:{"*":k=>pt(s.L({layerType:b,layer:l},k))}})}})),i}function nr(d){const i=d.value,l=d.key,f=s.J(i);return f!=="string"?[new s.V(l,i,`string expected, ${f} found`)]:[]}const lr={promoteId:function d({key:i,value:l}){if(s.J(l)==="string")return nr({key:i,value:l});if(Array.isArray(l)){const f=[],_=s.U(l),v=s.X(_);return v.result==="error"&&v.value.forEach(b=>{f.push(new s.V(`${i}${b.key}`,null,`${b.message}`))}),s.Z(v.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||f.push(new s.V(`${i}`,null,"promoteId expression should be only feature dependent")),f}{const f=[];for(const _ in l)f.push(...d({key:`${i}.${_}`,value:l[_]}));return f}}};function wr(d){const i=d.value,l=d.key,f=d.styleSpec,_=d.style;if(!i.type)return[new s.V(l,i,'"type" is required')];const v=s.M(i.type);let b=[];switch(["vector","raster","raster-dem","raster-array"].includes(v)&&(i.url||i.tiles||b.push(new s.K(l,i,'Either "url" or "tiles" is required.'))),v){case"vector":case"raster":case"raster-dem":case"raster-array":return b=b.concat(Ro({key:l,value:i,valueSpec:f[`source_${v.replace("-","_")}`],style:d.style,styleSpec:f,objectElementValidators:lr})),b;case"geojson":if(b=Ro({key:l,value:i,valueSpec:f.source_geojson,style:_,styleSpec:f,objectElementValidators:lr}),i.cluster)for(const S in i.clusterProperties){const[C,k]=i.clusterProperties[S],R=typeof C=="string"?[C,["accumulated"],["get",S]]:C;b.push(...zo({key:`${l}.${S}.map`,value:k,expressionContext:"cluster-map"})),b.push(...zo({key:`${l}.${S}.reduce`,value:R,expressionContext:"cluster-reduce"}))}return b;case"video":return Ro({key:l,value:i,valueSpec:f.source_video,style:_,styleSpec:f});case"image":return Ro({key:l,value:i,valueSpec:f.source_image,style:_,styleSpec:f});case"canvas":return[new s.V(l,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return aa({key:`${l}.type`,value:i.type,valueSpec:{values:Yr(f)}})}}function Yr(d){return d.source.reduce((i,l)=>{const f=d[l];return f.type.type==="enum"&&(i=i.concat(Object.keys(f.type.values))),i},[])}function yi(d){const i=d.value,l=d.styleSpec,f=l.light,_=d.style;let v=[];const b=s.J(i);if(i===void 0)return v;if(b!=="object")return v=v.concat([new s.V("light",i,`object expected, ${b} found`)]),v;for(const S in i){const C=S.match(/^(.*)-transition$/),k=S.match(/^(.*)-use-theme$/);v=v.concat(k&&f[k[1]]?Fi({key:S,value:i[S],valueSpec:{type:"string"},style:_,styleSpec:l}):C&&f[C[1]]&&f[C[1]].transition?Fi({key:S,value:i[S],valueSpec:l.transition,style:_,styleSpec:l}):f[S]?Fi({key:S,value:i[S],valueSpec:f[S],style:_,styleSpec:l}):[new s.V(S,i[S],`unknown property "${S}"`)])}return v}function Rn(d){const i=d.value;let l=[];if(!i)return l;const f=s.J(i);if(f!=="object")return l=l.concat([new s.V("light-3d",i,`object expected, ${f} found`)]),l;const _=d.styleSpec,v=_["light-3d"],b=d.key,S=d.style,C=d.style.lights;for(const F of["type","id"])if(!(F in i))return l=l.concat([new s.V("light-3d",i,`missing property ${F} on light`)]),l;if(i.type&&C)for(let F=0;F<d.arrayIndex;F++){const z=s.M(i.type),N=C[F];s.M(N.type)===z&&l.push(new s.V(b,i.id,`duplicate light type "${i.type}", previously defined at line ${N.id.__line__}`))}const k=`properties_light_${i.type}`;if(!(k in _))return l=l.concat([new s.V("light-3d",i,`Invalid light type ${i.type}`)]),l;const R=_[k];for(const F in i)if(F==="properties"){const z=i[F],N=s.J(z);if(N!=="object")return l=l.concat([new s.V("properties",z,`object expected, ${N} found`)]),l;
67for(const G in z){const U=G.match(/^(.*)-transition$/),W=G.match(/^(.*)-use-theme$/);l=l.concat(W&&R[W[1]]?Fi({key:F,value:z[G],valueSpec:{type:"string"},style:S,styleSpec:_}):U&&R[U[1]]&&R[U[1]].transition?Fi({key:F,value:i[F],valueSpec:_.transition,style:S,styleSpec:_}):R[G]?Fi({key:G,value:z[G],valueSpec:R[G],style:S,styleSpec:_}):[new s.K(d.key,z[G],`unknown property "${G}"`)])}}else l=l.concat(v[F]?Fi({key:F,value:i[F],valueSpec:v[F],style:S,styleSpec:_}):[new s.K(F,i[F],`unknown property "${F}"`)]);return l}function An(d){const i=d.value,l=d.key,f=d.style,_=d.styleSpec,v=_.terrain;let b=[];const S=s.J(i);if(i===void 0||S==="null")return b;if(S!=="object")return b=b.concat([new s.V("terrain",i,`object expected, ${S} found`)]),b;for(const C in i){const k=C.match(/^(.*)-transition$/),R=C.match(/^(.*)-use-theme$/);b=b.concat(R&&v[R[1]]?Fi({key:C,value:i[C],valueSpec:{type:"string"},style:f,styleSpec:_}):k&&v[k[1]]&&v[k[1]].transition?Fi({key:C,value:i[C],valueSpec:_.transition,style:f,styleSpec:_}):v[C]?Fi({key:C,value:i[C],valueSpec:v[C],style:f,styleSpec:_}):[new s.K(C,i[C],`unknown property "${C}"`)])}if(i.source){const C=f.sources&&f.sources[i.source],k=C&&s.M(C.type);C?k!=="raster-dem"&&b.push(new s.V(l,i.source,`terrain cannot be used with a source of type ${String(k)}, it only be used with a "raster-dem" source type`)):b.push(new s.V(l,i.source,`source "${i.source}" not found`))}else b.push(new s.V(l,i,'terrain is missing required property "source"'));return b}function lo(d){const i=d.value,l=d.style,f=d.styleSpec,_=f.fog;let v=[];const b=s.J(i);if(i===void 0)return v;if(b!=="object")return v=v.concat([new s.V("fog",i,`object expected, ${b} found`)]),v;for(const S in i){const C=S.match(/^(.*)-transition$/),k=S.match(/^(.*)-use-theme$/);v=v.concat(k&&_[k[1]]?Fi({key:S,value:i[S],valueSpec:{type:"string"},style:l,styleSpec:f}):C&&_[C[1]]&&_[C[1]].transition?Fi({key:S,value:i[S],valueSpec:f.transition,style:l,styleSpec:f}):_[S]?Fi({key:S,value:i[S],valueSpec:_[S],style:l,styleSpec:f}):[new s.K(S,i[S],`unknown property "${S}"`)])}return v}const Yo={"*":()=>[],array:Lo,boolean:function(d){const i=d.value,l=d.key,f=s.J(i);return f!=="boolean"?[new s.V(l,i,`boolean expected, ${f} found`)]:[]},number:oc,color:function(d){const i=d.key,l=d.value,f=s.J(l);return f!=="string"?[new s.V(i,l,`color expected, ${f} found`)]:s.a0.parseCSSColor(l)===null?[new s.V(i,l,`color expected, "${l}" found`)]:[]},enum:aa,filter:za,function:Gs,layer:pr,object:Ro,source:wr,model:s.a4,light:yi,"light-3d":Rn,terrain:An,fog:lo,string:nr,formatted:function(d){return nr(d).length===0?[]:zo(d)},resolvedImage:function(d){return nr(d).length===0?[]:zo(d)},projection:function(d){const i=d.value,l=d.styleSpec,f=l.projection,_=d.style;let v=[];const b=s.J(i);if(b==="object")for(const S in i)v=v.concat(Fi({key:S,value:i[S],valueSpec:f[S],style:_,styleSpec:l}));else b!=="string"&&(v=v.concat([new s.V("projection",i,`object or string expected, ${b} found`)]));return v},import:function(d){const{value:i,styleSpec:l}=d,{data:f,..._}=i;Object.defineProperty(_,"__line__",{value:i.__line__,enumerable:!1});let v=Ro(s.L({},d,{value:_,valueSpec:l.import}));return s.M(_.id)===""&&v.push(new s.V(`${d.key}.id`,_,"import id can't be an empty string")),f&&(v=v.concat(Cl(f,l,{key:`${d.key}.data`}))),v},iconset:function(d){const i=d.value,l=d.key,f=d.styleSpec,_=d.style;if(!i.type)return[new s.V(l,i,'"type" is required')];const v=s.M(i.type);let b=[];if(b=b.concat(Ro({key:l,value:i,valueSpec:f[`iconset_${v}`],style:_,styleSpec:f})),v==="source"&&i.source){const S=_.sources&&_.sources[i.source],C=S&&s.M(S.type);S?C!=="raster-array"&&b.push(new s.V(l,i.source,`iconset cannot be used with a source of type ${String(C)}, it only be used with a "raster-array" source type`)):b.push(new s.V(l,i.source,`source "${i.source}" not found`))}return b}};function Fi(d,i=!1){const l=d.value,f=d.valueSpec,_=d.styleSpec;if(f.expression&&s.a2(s.M(l)))return Gs(d);if(f.expression&&s.S(s.U(l)))return zo(d);if(f.type&&Yo[f.type]){const v=Yo[f.type](d);return i===!0&&v.length>0&&s.J(d.value)==="array"?zo(d):v}return Ro(s.L({},d,{valueSpec:f.type?_[f.type]:f}))}function tl(d){const i=d.value,l=d.key,f=nr(d);return f.length||(i.indexOf("{fontstack}")===-1&&f.push(new s.V(l,i,'"glyphs" url must include a "{fontstack}" token')),i.indexOf("{range}")===-1&&f.push(new s.V(l,i,'"glyphs" url must include a "{range}" token'))),f}function Cl(d,i=s.a5,l={}){return Fi({key:l.key||"",value:d,valueSpec:i.$root,styleSpec:i,style:d,objectElementValidators:{glyphs:tl,"*":()=>[]}})}function wo(d,i=s.a5){return Q(Cl(d,i))}const Il=d=>Q(wr(d)),Al=d=>Q(yi(d)),Fc=d=>Q(Rn(d)),Tt=d=>Q(An(d)),rl=d=>Q(lo(d)),Fh=d=>Q(function(i){const l=i.value,f=i.style,_=i.styleSpec,v=_.snow;let b=[];const S=s.J(l);if(l===void 0)return b;if(S!=="object")return b=b.concat([new s.V("snow",l,`object expected, ${S} found`)]),b;for(const C in l){const k=C.match(/^(.*)-transition$/);b=b.concat(k&&v[k[1]]&&v[k[1]].transition?Fi({key:C,value:l[C],valueSpec:_.transition,style:f,styleSpec:_}):v[C]?Fi({key:C,value:l[C],valueSpec:v[C],style:f,styleSpec:_}):[new s.K(C,l[C],`unknown property "${C}"`)])}return b}(d)),Pl=d=>Q(function(i){const l=i.value,f=i.style,_=i.styleSpec,v=_.rain;let b=[];const S=s.J(l);if(l===void 0)return b;if(S!=="object")return b=b.concat([new s.V("rain",l,`object expected, ${S} found`)]),b;for(const C in l){const k=C.match(/^(.*)-transition$/);b=b.concat(k&&v[k[1]]&&v[k[1]].transition?Fi({key:C,value:l[C],valueSpec:_.transition,style:f,styleSpec:_}):v[C]?Fi({key:C,value:l[C],valueSpec:v[C],style:f,styleSpec:_}):[new s.K(C,l[C],`unknown property "${C}"`)])}return b}(d)),ai=d=>Q(pr(d)),Xe=d=>Q(za(d)),Y=d=>Q(pt(d)),ee=d=>Q(yt(d)),q=d=>Q(s.a4(d));function Q(d){return d.slice().sort((i,l)=>i.line&&l.line?i.line-l.line:0)}
67function J(d,i){let l=!1;if(i&&i.length)for(const f of i)f instanceof s.K?s.w(f.message):(d.fire(new s.z(new Error(f.message))),l=!0);return l}let ce;class Ce extends s.E{constructor(i,l="flat"){super(),this._transitionable=new s.a6(ce||(ce=new s.a7({anchor:new s.a8(s.a5.light.anchor),position:new s.a9(s.a5.light.position),color:new s.a8(s.a5.light.color),intensity:new s.a8(s.a5.light.intensity)}))),this.setLight(i,l),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(i,l,f={}){this._validate(Al,i,f)||(this._transitionable.setTransitionOrValue(i),this.id=l)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(i,l,f){return(!f||f.validate!==!1)&&J(this,i.call(wo,s.h({value:l,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}}let Ee=class extends s.E{constructor(d,i,l,f,_){super(),this.scope=l,this._transitionable=new s.a6(new s.a7({source:new s.a8(s.a5.terrain.source),exaggeration:new s.a8(s.a5.terrain.exaggeration)}),l,f),this._transitionable.setTransitionOrValue(d,f),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i,this.worldview=_}get(){return this._transitionable.serialize()}set(d,i){this._transitionable.setTransitionOrValue(d,i)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}getExaggeration(d){return this._transitioning.possiblyEvaluate(new s.aa(d,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const d=this._transitionable._values.exaggeration;if(!d)return null;const i=d.value.expression;if(!i)return null;let l=-1,f=-1,_=1;for(const v of i.zoomStops)_=i.evaluate(new s.aa(v,{worldview:this.worldview})),_>.01?(l=v,f=-1):f=v;return _<.01&&l>0&&f>l?[l,f]:null}isZoomDependent(){const d=this._transitionable._values.exaggeration;return d!=null&&d.value!=null&&d.value.expression!=null&&d.value.expression instanceof s.ab}};const Re=45,dt=65,Ge=.05;function Mt(d,i,l,f){const _=s.af(Re,dt,l),[v,b]=Ht(d,f);let S=1-Math.min(1,Math.exp((i-v)/(b-v)*-6));return S*=S*S,S=Math.min(1,1.00747*S),S*_*d.alpha}function Ht(d,i){const l=.5/Math.tan(.5*i);return[d.range[0]+l,d.range[1]+l]}function Kt(d,i,l,f,_){const v=s.ad([],[i,l,f],_.mercatorFogMatrix);return Mt(d,s.ae(v),_.pitch,_._fov)}function er(d,i,l,f,_,v,b){const S=[[l,f,0],[_,f,0],[_,v,0],[l,v,0]];let C=Number.MAX_VALUE,k=-Number.MAX_VALUE;for(const R of S){const F=s.ad([],R,i),z=s.ae(F);C=Math.min(C,z),k=Math.max(k,z)}return[Mt(d,C,b.pitch,b._fov),Mt(d,k,b.pitch,b._fov)]}class dr extends s.E{constructor(i,l,f,_){super();const v=new s.a7({range:new s.a8(s.a5.fog.range),color:new s.a8(s.a5.fog.color),"color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.a8(s.a5.fog["high-color"]),"high-color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.a8(s.a5.fog["space-color"]),"space-color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new s.a8(s.a5.fog["horizon-blend"]),"star-intensity":new s.a8(s.a5.fog["star-intensity"]),"vertical-range":new s.a8(s.a5.fog["vertical-range"])});this._transitionable=new s.a6(v,f,new Map(_)),this.set(i,_),this._transitioning=this._transitionable.untransitioned(),this._transform=l,this.properties=new s.ag(v),this.scope=f}get state(){const i=this._transform,l=i.projection.name==="globe",f=s.ah(i.zoom),_=this.properties.get("range"),v=[.5,3];return{range:l?[s.ai(v[0],_[0],f),s.ai(v[1],_[1],f)]:_,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,l,f={}){if(this._validate(rl,i,f))return;const _=s.h({},i);for(const v of Object.keys(s.a5.fog))_[v]===void 0&&(_[v]=s.a5.fog[v].default);this._options=_,this._transitionable.setTransitionOrValue(this._options,l)}getOpacity(i){if(!this._transform.projection.supportsFog)return 0;const l=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.af(Re,dt,i))*l.a}getOpacityAtLatLng(i,l){return this._transform.projection.supportsFog?function(f,_,v){const b=s.ac.fromLngLat(_),S=v.elevation?v.elevation.getAtPointOrZero(b):0;return Kt(f,b.x,b.y,S,v)}(this.state,i,l):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];const l=this._transform.calculateFogTileMatrix(i.toUnwrapped());return er(this.state,l,0,0,s.aj,s.aj,this._transform)}getOpacityForBounds(i,l,f,_,v){return this._transform.projection.supportsFog?er(this.state,i,l,f,_,v,this._transform):[1,1]}getFovAdjustedRange(i){return this._transform.projection.supportsFog?Ht(this.state,i):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;const l=[4,5,6,7];for(const f of l){const _=i.points[f];let v;if(_[2]>=0)v=_;else{const b=i.points[f-4];v=s.ak(b,_,b[2]/(b[2]-_[2]))}if(Kt(this.state,v[0],v[1],0,this._transform)>=Ge)return!0}return!1}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(i,l,f){return(!f||f.validate!==!1)&&J(this,i.call(wo,s.h({value:l,style:{glyphs:!0,sprite:!0},styleSpec:s.a5}
67)))}}let Er,Kr,Ar,ei,rn=class extends s.E{constructor(d,i,l,f){super();const _=Er||(Er=new s.a7({density:new s.a8(s.a5.snow.density),intensity:new s.a8(s.a5.snow.intensity),color:new s.a8(s.a5.snow.color),opacity:new s.a8(s.a5.snow.opacity),vignette:new s.a8(s.a5.snow.vignette),"vignette-color":new s.a8(s.a5.snow["vignette-color"]),"center-thinning":new s.a8(s.a5.snow["center-thinning"]),direction:new s.a8(s.a5.snow.direction),"flake-size":new s.a8(s.a5.snow["flake-size"])}));this._transitionable=new s.a6(_,l,new Map(f)),this.set(d,f),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ag(_),this.scope=l}get state(){const d=this.properties.get("opacity"),i=this.properties.get("color"),l=this.properties.get("direction"),f=s.al(l[0]),_=-Math.max(s.al(l[1]),.01),v=[Math.cos(f)*Math.cos(_),Math.sin(f)*Math.cos(_),Math.sin(_)],b=this.properties.get("vignette"),S=this.properties.get("vignette-color");return S.a=b,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.am(i.r,i.g,i.b,i.a*d),direction:v,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:S}}get(){return this._transitionable.serialize()}set(d,i,l={}){if(this._validate(Fh,d,l))return;const f=s.h({},d);for(const _ of Object.keys(s.a5.snow))f[_]===void 0&&(f[_]=s.a5.snow[_].default);this._options=f,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,i,l){return(!l||l.validate!==!1)&&J(this,d.call(wo,s.h({value:i,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}},Xi=class extends s.E{constructor(d,i,l,f){super();const _=Kr||(Kr=new s.a7({density:new s.a8(s.a5.rain.density),intensity:new s.a8(s.a5.rain.intensity),color:new s.a8(s.a5.rain.color),opacity:new s.a8(s.a5.rain.opacity),vignette:new s.a8(s.a5.rain.vignette),"vignette-color":new s.a8(s.a5.rain["vignette-color"]),"center-thinning":new s.a8(s.a5.rain["center-thinning"]),direction:new s.a8(s.a5.rain.direction),"droplet-size":new s.a8(s.a5.rain["droplet-size"]),"distortion-strength":new s.a8(s.a5.rain["distortion-strength"])}));this._transitionable=new s.a6(_,l,new Map(f)),this.set(d,f),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ag(_),this.scope=l}get state(){const d=this.properties.get("opacity"),i=this.properties.get("color"),l=this.properties.get("direction"),f=s.al(l[0]),_=-Math.max(s.al(l[1]),.01),v=[Math.cos(f)*Math.cos(_),Math.sin(f)*Math.cos(_),Math.sin(_)],b=this.properties.get("vignette-color");return b.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.am(i.r,i.g,i.b,i.a*d),direction:v,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:b}}get(){return this._transitionable.serialize()}set(d,i,l={}){if(this._validate(Pl,d,l))return;const f=s.h({},d);for(const _ of Object.keys(s.a5.rain))f[_]===void 0&&(f[_]=s.a5.rain[_].default);this._options=f,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,i,l){return(!l||l.validate!==!1)&&J(this,d.call(wo,s.h({value:i,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}};class Ei extends s.E{constructor(i,l,f,_){super(),this.scope=f,this._options=i,this.properties=new s.ag(l),this._transitionable=new s.a6(l,f,new Map(_)),this._transitionable.setTransitionOrValue(i.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(i){this._transitionable.setTransitionOrValue(this._options.properties,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(i,l){this._options=i,this._transitionable.setTransitionOrValue(i.properties,l)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ti{constructor(i,l,f){this.screenBounds=i,this.cameraPoint=f.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=l,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,f)}static createFromScreenPoints(i,l){let f,_;if(i instanceof s.P||typeof i[0]=="number"){const v=s.P.convert(i);f=[v],_=l.isPointAboveHorizon(v)}else{const v=s.P.convert(i[0]),b=s.P.convert(i[1]),S=v.add(b)._div(2);f=[v,b],_=s.ao(v,b).every(C=>l.isPointAboveHorizon(C))&&l.isPointAboveHorizon(S)}return new ti(f,_,l)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(i){return s.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],i)}bufferedCameraGeometry(i){const l=this.screenBounds[0],f=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],_=s.ao(l,f,0,!1);return this.cameraPoint.y>f.y&&(this.cameraPoint.x>l.x&&this.cameraPoint.x<f.x?_.splice(3,0,this.cameraPoint):this.cameraPoint.x>=f.x?_[2]=this.cameraPoint:this.cameraPoint.x<=l.x&&(_[3]=this.cameraPoint)),s.ap(_,i)}bufferedCameraGeometryGlobe(i){const l=this.screenBounds[0],f=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],_=s.ao(l,f,i),v=this.cameraPoint.clone();switch(3*((v.y>l.y)+(v.y>f.y))+((v.x>l.x)+(v.x>f.x))){case 0:_[0]=v,_[4]=v.clone();break;case 1:_.splice(1,0,v);break;case 2:_[1]=v;break;case 3:_.splice(4,0,v);break;case 5:_.splice(2,0,v);break;case 6:_[3]=v;break;case 7:_.splice(3,0,v);break;case 8:_[2]=v}return _}containsTile(i,l,f,_=0){const v=i.queryPadding/l._pixelsPerMercatorPixel+1,b=f?this._bufferedCameraMercator(v,l):this._bufferedScreenMercator(v,l);let S=i.tileID.wrap+(b.unwrapped?_:0);const C=b.polygon.map(W=>s.aq(i.tileTransform,W,S));if(!s.ar(C,0,0,s.aj,s.aj))return;S=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?_:0);const k=this.screenGeometryMercator.polygon.map(W=>s.as(i.tileTransform,W,S)),R=k.map(W=>new s.P(W[0],W[1])),F=l.getFreeCameraOptions().position||new s.ac(0,0,0),z=s.as(i.tileTransform,F,S),N=k.map(W=>{const Z=s.at(W,W,z);return s.au(Z,Z),new s.av(z,Z)}),G=s.aw(i,1,l.zoom)*l._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:R,tilespaceRays:N,bufferedTilespaceGeometry:C,bufferedTilespaceBounds:(U=s.ax(C),U.min.x=s.ay(U.min.x,0,s.aj),U.min.y=s.ay(U.min.y,0,s.aj),U.max.x=s.ay(U.max.x,
670,s.aj),U.max.y=s.ay(U.max.y,0,s.aj),U),tile:i,tileID:i.tileID,pixelToTileUnitsFactor:G};var U}_bufferedScreenMercator(i,l){const f=Li(i);if(this._screenRaycastCache[f])return this._screenRaycastCache[f];{let _;return _=l.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(i),l):{polygon:this.bufferedScreenGeometry(i).map(v=>l.pointCoordinate3D(v)),unwrapped:!0},this._screenRaycastCache[f]=_,_}}_bufferedCameraMercator(i,l){const f=Li(i);if(this._cameraRaycastCache[f])return this._cameraRaycastCache[f];{let _;return _=l.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),l):{polygon:this.bufferedCameraGeometry(i).map(v=>l.pointCoordinate3D(v)),unwrapped:!0},this._cameraRaycastCache[f]=_,_}}_projectAndResample(i,l){const f=function(v,b){const S=s.az([],b.pixelMatrix,b.globeMatrix),C=[0,-s.aB,0,1],k=[0,s.aB,0,1],R=[0,0,0,1];s.aA(C,C,S),s.aA(k,k,S),s.aA(R,R,S);const F=new s.P(C[0]/C[3],C[1]/C[3]),z=new s.P(k[0]/k[3],k[1]/k[3]),N=s.aC(v,F)&&C[3]<R[3],G=s.aC(v,z)&&k[3]<R[3];if(!N&&!G)return null;const U=function(Se,me,ge){for(let ye=1;ye<Se.length;ye++){const Ze=ji(me.pointCoordinate3D(Se[ye-1]).x),Me=ji(me.pointCoordinate3D(Se[ye]).x);if(ge<0){if(Ze<Me)return{idx:ye,t:-Ze/(Me-1-Ze)}}else if(Me<Ze)return{idx:ye,t:(1-Ze)/(Me+1-Ze)}}return null}(v,b,N?-1:1);if(!U)return null;const{idx:W,t:Z}=U;let re=W>1?an(v.slice(0,W),b):[],se=W<v.length?an(v.slice(W),b):[];re=re.map(Se=>new s.P(ji(Se.x),Se.y)),se=se.map(Se=>new s.P(ji(Se.x),Se.y));const le=[...re];le.length===0&&le.push(se[se.length-1]);const fe=s.ai(le[le.length-1].y,(se.length===0?re[0]:se[0]).y,Z);let we;return we=N?[new s.P(0,fe),new s.P(0,0),new s.P(1,0),new s.P(1,fe)]:[new s.P(1,fe),new s.P(1,1),new s.P(0,1),new s.P(0,fe)],le.push(...we),se.length===0?le.push(re[0]):le.push(...se),{polygon:le.map(Se=>new s.ac(Se.x,Se.y)),unwrapped:!1}}(i,l);if(f)return f;const _=function(v,b){let S=!1,C=-1/0,k=0;for(let F=0;F<v.length-1;F++)v[F].x>C&&(C=v[F].x,k=F);for(let F=0;F<v.length-1;F++){const z=(k+F)%(v.length-1),N=v[z],G=v[z+1];Math.abs(N.x-G.x)>.5&&(N.x<G.x?(N.x+=1,z===0&&(v[v.length-1].x+=1)):(G.x+=1,z+1===v.length-1&&(v[0].x+=1)),S=!0)}const R=s.aD(b.center.lng);return S&&R<Math.abs(R-1)&&v.forEach(F=>{F.x-=1}),{polygon:v,unwrapped:S}}(an(i,l).map(v=>new s.P(ji(v.x),v.y)),l);return{polygon:_.polygon.map(v=>new s.ac(v.x,v.y)),unwrapped:_.unwrapped}}}function an(d,i){return s.aE(d,l=>{const f=i.pointCoordinate3D(l);l.x=f.x,l.y=f.y},1/256)}function ji(d){return d<0?1+d%1:d%1}function Li(d){return 100*d|0}function Kn(d,i,l,f,_){const v=function(S,C){if(S)return _(S);if(C){if(d.url&&C.tiles&&d.tiles&&delete d.tiles,C.variants){if(!Array.isArray(C.variants))return _(new Error("variants must be an array"));for(const R of C.variants){if(R==null||typeof R!="object"||R.constructor!==Object)return _(new Error("variant must be an object"));if(!Array.isArray(R.capabilities))return _(new Error("capabilities must be an array"));if(R.capabilities.length===1&&R.capabilities[0]==="meshopt"){C=s.h(C,R);break}}}const k=s.aF(s.h({},C,d),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);k.tiles=i.canonicalizeTileset(k,d.url),_(null,k)}},b=function(S,C,k){if(!S)return null;if(!C&&!k)return S;k=k||S.worldview_default;const R=Object.values(S.language||{});if(R.length===0)return null;const F=Object.values(S.worldview||{});if(F.length===0)return null;const z=R.every(G=>G===C),N=F.every(G=>G===k);return z&&N?S:C in(S.language_options||{})||k in(S.worldview_options||{})?null:S.language_options&&S.worldview_options?S:null}(d.data,l,f);return b?s.q.frame(()=>v(null,b)):d.url?s.n(i.transformRequest(i.normalizeSourceURL(d.url,null,l,f),s.R.Source),v):s.q.frame(()=>{const{data:S,...C}=d;v(null,C)})}function Jn(d,i){const l=Math.pow(2,i.z),f=Math.floor(s.aD(d.getWest())*l),_=Math.floor(s.aH(d.getNorth())*l),v=Math.ceil(s.aD(d.getEast())*l),b=Math.ceil(s.aH(d.getSouth())*l);return i.x>=f&&i.x<v&&i.y>=_&&i.y<b}class po{constructor(i,l,f){this.bounds=i?s.aG.convert(this.validateBounds(i)):null,this.minzoom=l||0,this.maxzoom=f||24}
67validateBounds(i){return Array.isArray(i)&&i.length===4?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}addExtraBounds(i){if(i){this.extraBounds||(this.extraBounds=[]);for(const l of i)this.extraBounds.push(s.aG.convert(this.validateBounds(l)))}}contains(i){if(i.z>this.maxzoom||i.z<this.minzoom||this.bounds&&!Jn(this.bounds,i))return!1;if(!this.extraBounds)return!0;for(const l of this.extraBounds)if(Jn(l,i))return!0;return!1}static fromTileJSON(i){if(!i.bounds&&!i.extra_bounds)return null;const l=new po(i.bounds,i.minzoom,i.maxzoom);return l.addExtraBounds(i.extra_bounds),l}}class Ml extends s.E{constructor(i,l,f,_){if(super(),this.id=i,this.dispatcher=f,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.h(this,s.aF(l,["url","scheme","tileSize","promoteId"])),this._options=s.h({type:"vector"},l),this._collectResourceTiming=!!l.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(_),this._tileWorkers={},this._deduped=new s.aI}load(i){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const l=Array.isArray(this.map._language)?this.map._language.join():this.map._language,f=this.map.getWorldview();this._tileJSONRequest=Kn(this._options,this.map._requestManager,l,f,(_,v)=>{if(this._tileJSONRequest=null,this._loaded=!0,_)l&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${l}`),f&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${f}`),this.fire(new s.z(_));else if(v){if(s.h(this,v),this.hasWorldviews=!!v.worldview_options,v.worldview_default&&(this.worldviewDefault=v.worldview_default),v.vector_layers){this.vectorLayers=v.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const b of v.vector_layers)this.vectorLayerIds.push(b.id),v.worldview&&v.worldview[b.source]&&this.localizableLayerIds.add(b.id)}this.tileBounds=po.fromTileJSON(v),gr(v.tiles,this.map._requestManager._customAccessToken),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}i&&i(_)})}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();const i=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return s.h({},this._options)}loadTile(i,l){const f=i.tileID.canonical.url(this.tiles,this.scheme),_=this.map._requestManager.normalizeTileURL(f),v=this.map._requestManager.transformRequest(_,s.R.Tile),b=this.map.style?this.map.style.getLut(this.scope):null,S=b?{image:b.image.clone()}:null,C={request:v,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,lut:S,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
67ype,source:this.id,scope:this.scope,pixelRatio:s.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:i.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault};if(this.hasWorldviews&&s.j(f)&&(C.localizableLayerIds=this.localizableLayerIds),C.request.collectResourceTiming=this._collectResourceTiming,i.actor&&i.state!=="expired")i.state==="loading"?i.reloadCallback=l:i.request=i.actor.send("reloadTile",C,k.bind(this));else if(i.actor=this._tileWorkers[_]=this._tileWorkers[_]||this.dispatcher.getActor(),this.dispatcher.ready)i.request=i.actor.send("loadTile",C,k.bind(this),void 0,!0);else{const R=s.aJ.call({deduped:this._deduped},C,(F,z)=>{F||!z?k.call(this,F):(C.data={cacheControl:z.cacheControl,expires:z.expires,rawData:z.rawData.slice(0)},i.actor&&i.actor.send("loadTile",C,k.bind(this),void 0,!0))},!0);i.request={cancel:R}}function k(R,F){return delete i.request,i.aborted?l(null):R&&R.status!==404?l(R):(F&&F.resourceTiming&&(i.resourceTiming=F.resourceTiming),this.map._refreshExpiredTiles&&F&&i.setExpiryData(F),i.loadVectorData(F,this.map.painter),s.aK(this.dispatcher),l(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.t
67ype,source:this.id,scope:this.scope})}unloadTile(i,l){i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Qn extends s.E{constructor(i,l,f,_){super(),this.id=i,this.dispatcher=f,this.setEventedParent(_),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.h({type:"raster"},l),s.h(this,s.aF(l,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const l=this.map.getWorldview();this._tileJSONRequest=Kn(this._options,this.map._requestManager,null,l,(f,_)=>{this._tileJSONRequest=null,this._loaded=!0,f?this.fire(new s.z(f)):_&&(s.h(this,_),_.raster_layers&&(this.rasterLayers=_.raster_layers,this.rasterLayerIds=this.rasterLayers.map(v=>v.id)),this.tileBounds=po.fromTileJSON(_),gr(_.tiles),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))),i&&i(f)})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();const i=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return s.h({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i,l){const f=s.q.devicePixelRatio>=2,_=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),f,this.tileSize);i.request=s.o(this.map._requestManager.transformRequest(_,s.R.Tile),(v,b,S,C)=>(delete i.request,i.aborted?(i.state="unloaded",l(null)):v?(i.state="errored",l(v)):b?(this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:S,expires:C}),i.setTexture(b,this.map.painter),i.state="loaded",s.aK(this.dispatcher),void l(null)):l(null)))}abortTile(i,l){i.request&&(i.request.cancel(),delete i.request),l&&l()}unloadTile(i,l){i.texture&&i.texture instanceof s.T?(i.destroy(!0),i.texture&&i.texture instanceof s.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),l&&l()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class zi extends Qn{constructor(i,l,f,_){super(i,l,f,_),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=s.h({type:"raster-array"},l)}triggerRepaint(i){const l=this.map.painter._terrain,f=this.map.style.getSourceCache(this.id);l&&l.enabled&&f&&l._clearRenderCacheForTile(f.id,i.tileID),this.map.triggerRepaint()}loadTile(i,l){const f=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),_=this.map._requestManager.transformRequest(f,s.R.Tile),v={request:_,uid:i.uid,tileID:i.tileID,type:this.t
67ype,source:this.id,scope:this.scope,partial:this.partial};i.source=this.id,i.scope=this.scope,i.requestParams=_,i.actor||(i.actor=this.dispatcher.getActor());const b=(S,C,k,R)=>{if(delete i.request,i.aborted)return i.state="unloaded",l(null);if(S)return S.name==="AbortError"?void 0:(i.state="errored",l(S));if(this.map._refreshExpiredTiles&&C&&i.setExpiryData({cacheControl:k,expires:R}),this.partial)i.state="empty";else{if(!C)return l(null);i.state="loaded",i._isHeaderLoaded=!0,i._mrt=C}l(null)};i.request=this.partial?i.fetchHeader(void 0,b.bind(this)):i.actor.send("loadTile",v,b.bind(this),void 0,!0)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(i,l){const f=i.texturePerLayer;if(i.flushAllQueues(),f.size){i.destroy(!0);for(const _ of f.values())this.map.painter.saveTileTexture(_)}else i.destroy()}prepareTile(i,l,f,_){i._isHeaderLoaded&&(i.state!=="empty"&&(i.state="reloading"),i.fetchBand(l,f,_,(v,b)=>{if(v)return i.state="errored",this.fire(new s.z(v)),void this.triggerRepaint(i);b&&(i._isHeaderLoaded=!0,i.setTexturePerLayer(f,b,this.map.painter),i.state="loaded",this.triggerRepaint(i))}))}getInitialBand(i){if(!this.rasterLayers)return 0;const l=this.rasterLayers.find(({id:v})=>v===i),f=l&&l.fields,_=f&&f.bands&&f.bands;return _?_[0]:0}getTextureDescriptor(i,l,f){if(!i)return;const _=l.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!_)return;let v=null;l instanceof s.aN?v=l.paint.get("raster-array-band"):l instanceof s.aO&&(v=l.paint.get("raster-particle-array-band"));const b=v||this.getInitialBand(_);if(b==null)return;if(!i.textureDescriptorPerLayer.get(l.id))return void this.prepareTile(i,_,l.id,b);if(i.updateNeeded(l.id,b)&&!f)return;const S=i.textureDescriptorPerLayer.get(l.id);return Object.assign({},S,{texture:i.texturePerLayer.get(l.id)})}getImages(i,l){const f=new Map;for(const _ of i)for(const v of l){const[b,S]=v.split("/"),C=_.getLayer(b);if(!C||!C.hasBand(S)||!C.hasDataForBand(S))continue;const{bytes:k,tileSize:R,buffer:F}=C.getBandView(S),z=R+2*F,N={data:new s.r({width:z,height:z},k),pixelRatio:2,sdf:!1,usvg:!1,version:0};f.set(v,N)}return f}}const Do={vector:Ml,raster:Qn,"raster-dem":class extends Qn{constructor(d,i,l,f){super(d,i,l,f),this.type="raster-dem",this.maxzoom=22,this._options=s.h({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(d,i){const l=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function f(_,v){_&&(d.state="errored",i(_)),v&&(d.dem=v,d.dem.onDeserialize(),d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0,d.state="loaded",i(null))}d.request=s.o(this.map._requestManager.transformRequest(l,s.R.Tile),(function(_,v,b,S){if(delete d.request,d.aborted)d.state="unloaded",i(null);else if(_)d.state="errored",i(_);else if(v){this.map._refreshExpiredTiles&&d.setExpiryData({cacheControl:b,expires:S});const C=ImageBitmap&&v instanceof ImageBitmap&&s.t(),k=1-(v.width-s.aL(v.width))/2;k<1||d.neighboringTiles||(d.neighboringTiles=this._getNeighboringTiles(d.tileID));const R=C?v:s.q.getImageData(v,k),F={uid:d.uid,tileID:d.tileID,source:this.id,type:this.t
67ype,scope:this.scope,rawImageData:R,encoding:this.encoding,padding:k};d.actor&&d.state!=="expired"||(d.actor=this.dispatcher.getActor(),d.actor.send("loadTile",F,f.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(d){const i=d.canonical,l=Math.pow(2,i.z),f=(i.x-1+l)%l,_=i.x===0?d.wrap-1:d.wrap,v=(i.x+1+l)%l,b=i.x+1===l?d.wrap+1:d.wrap,S={};return S[new s.aM(d.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},S[new s.aM(d.overscaledZ,b,i.z,v,i.y).key]={backfilled:!1},i.y>0&&(S[new s.aM(d.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1},S[new s.aM(d.overscaledZ,d.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},S[new s.aM(d.overscaledZ,b,i.z,v,i.y-1).key]={backfilled:!1}),i.y+1<l&&(S[new s.aM(d.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1},S[new s.aM(d.overscaledZ,d.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},S[new s.aM(d.overscaledZ,b,i.z,v,i.y+1).key]={backfilled:!1}),S}},"raster-array":zi,geojson:class extends s.E{constructor(d,i,l,f){super(),this.id=d,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=l.getActor(),this.setEventedParent(f),this._data=i.data,this._options=s.h({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.minzoom!==void 0&&(this.minzoom=i.minzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const _=s.aj/this.tileSize;this.workerOptions=s.h({source:this.id,scope:this.scope,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(i.buffer!==void 0?i.buffer:128)*_,tolerance:(i.tolerance!==void 0?i.tolerance:.375)*_,extent:s.aj,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:s.aj,radius:(i.clusterRadius!==void 0?i.clusterRadius:50)*_,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter,dynamic:i.dynamic},i.workerOptions)}onAdd(d){this.map=d,this.setData(this._data)}setData(d){return this._data=d,this._updateWorkerData(),this}updateData(d){if(!this._options.dynamic)return this.fire(new s.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof d!="string"&&(d.type==="Feature"&&(d={type:"FeatureCollection",features:[d]}),d.type!=="FeatureCollection"))return this.fire(new s.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof d!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const i=new Map;for(const l of this._data.features)i.set(l.id,l);for(const l of d.features)i.set(l.id,l);this._data.features=[...i.values()]}else this._data=d;return this._updateWorkerData(!0),this}getClusterExpansionZoom(d,i){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:d,source:this.id,scope:this.scope},i),this}getClusterChildren(d,i){return this.actor.send("geojson.getClusterChildren",{clusterId:d,source:this.id,scope:this.scope},i),this}getClusterLeaves(d,i,l,f){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:d,limit:i,offset:l},f),this}_updateWorkerData(d=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.A("dataloading",{dataType:"source"})),this._loaded=!1;const i=s.h({append:d},this.workerOptions);i.scope=this.scope;const l=this._data;typeof l=="string"?(i.request=this.map._requestManager.transformRequest(s.q.resolveURL(l),s.R.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(l),this._pendingLoad=this.actor.send(`${this.type}.loadData`,i,(f,_)=>{if(this._loaded=!0,this._pendingLoad=null,f)this.fire(new s.z(f));else{const v={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&_&&_.resourceTiming&&_.resourceTiming[this.id]&&(v.resourceTiming=_.resourceTiming[this.id]),d&&(this._partialReload=!0),this.fire(new s.A("data",v)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(d),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const d=s.C(this.id,this.scope);this.map.style.clearSource(d),this._updateWorkerData()}loadTile(d,i){const l=d.actor?"reloadTile":"loadTile";d.actor=this.actor;const f=this.map.style?this.map.style.getLut(this.scope):null,_=f?{image:f.image.clone()}
67:null,v=this._partialReload,b={type:this.type,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:_,scope:this.scope,pixelRatio:s.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:v,worldview:this.map.getWorldview()};d.request=this.actor.send(l,b,(S,C)=>v&&!C?(d.state="loaded",i(null)):(delete d.request,d.destroy(),d.aborted?i(null):S?i(S):(d.loadVectorData(C,this.map.painter,l==="reloadTile"),i(null))),void 0,l==="loadTile")}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.aborted=!0}unloadTile(d,i){this.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}onRemove(d){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return s.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aP{constructor(d,i,l,f){super(d,i,l,f),this.roundZoom=!0,this.type="video",this.options=i}load(){this._loaded=!1;const d=this.options;this.urls=[];for(const i of d.urls)this.urls.push(this.map._requestManager.transformRequest(i,s.R.Source).url);s.aQ(this.urls,(i,l)=>{this._loaded=!0,i?this.fire(new s.z(i)):l&&(this.video=l,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(d){if(this.video){const i=this.video.seekable;d<i.start(0)||d>i.end(0)?this.fire(new s.z(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=d}}getVideo(){return this.video}
67onAdd(d){this.map||(this.map=d,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const d=this.map.painter.context,i=d.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(d,this.video,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(d)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aP,model:class extends s.E{constructor(d,i,l,f){super(),this.id=d,this.type="model",this.models=[],this._loaded=!1,this._options=i}load(){const d=[];for(const i in this._options.models){const l=this._options.models[i],f=s.aS(this.map._requestManager.transformRequest(l.uri,s.R.Model).url).then(_=>{if(!_)return;const v=s.aT(_),b=new s.aU(i,l.position,l.orientation,v);b.computeBoundsAndApplyParent(),this.models.push(b)}).catch(_=>{this.fire(new s.z(new Error(`Could not load model ${i} from ${l.uri}: ${_.message}`)))});d.push(f)}Promise.allSettled(d).then(()=>{this._loaded=!0,this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this._loaded=!0,this.fire(new s.z(new Error(`Could not load models: ${i.message}`)))})}onAdd(d){this.map=d,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(d,i){}serialize(){return this._options}},"batched-model":class extends s.E{constructor(d,i,l,f){super(),this.type="batched-model",this.id=d,this.tileSize=512,this._options=i,this.tiles=this._options.tiles,this.maxzoom=i.maxzoom||19,this.minzoom=i.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=l,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(f)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(d){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,l=this.map.getWorldview();this._tileJSONRequest=Kn(this._options,this.map._requestManager,i,l,(f,_)=>{this._tileJSONRequest=null,this._loaded=!0,f?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),l&&l.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${l}`),this.fire(new s.z(f))):_&&(s.h(this,_),_.bounds&&(this.tileBounds=new po(_.bounds,this.minzoom,this.maxzoom)),gr(_.tiles,this.map._requestManager._customAccessToken),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))),d&&d(f)})}hasTransition(){return!1}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loaded(){return this._loaded}loadTile(d,i){const l=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme)),f={request:this.map._requestManager.transformRequest(l,s.R.Tile),data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.t
67ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.q.devicePixelRatio,promoteId:this.promoteId};if(d.actor&&d.state!=="expired")if(d.state==="loading")d.reloadCallback=i;else{if(d.buckets){const v=Object.values(d.buckets);for(const b of v)b.dirty=!0;return void(d.state="loaded")}d.request=d.actor.send("reloadTile",f,_.bind(this))}else d.actor=this.dispatcher.getActor(),d.request=d.actor.send("loadTile",f,_.bind(this),void 0,!0);function _(v,b){return d.aborted?i(null):v&&v.status!==404?i(v):(this.map._refreshExpiredTiles&&b&&d.setExpiryData(b),d.loadModelData(b,this.map.painter),d.state="loaded",void i(null))}}serialize(){return s.h({},this._options)}},canvas:class extends s.aP{constructor(d,i,l,f){super(d,i,l,f),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(v=>typeof v!="number"))||this.fire(new s.z(new s.V(`sources.${d}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.z(new s.V(`sources.${d}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new s.z(new s.V(`sources.${d}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new s.z(new s.V(`sources.${d}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.z(new s.V(`sources.${d}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(d){this.map=d,this.load(),this.canvas&&this.animate&&this.play()}onRemove(d){this.pause()}prepare(){let d=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,d=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,d=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context;this.texture?!d&&!this._playing||this.texture instanceof s.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(i,this.canvas,i.gl.RGBA8,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const d of[this.canvas.width,this.canvas.height])if(isNaN(d)||d<=0)return!0;return!1}},custom:class extends s.E{constructor(d,i,l,f){super(),this.id=d,this.type="custom",this._dataType="raster",this._dispatcher=l,this._implementation=i,this.setEventedParent(f),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new po(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),s.h(this,s.aF(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(d){this.map=d,this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(d),this.load()}onRemove(d){this._implementation.onRemove&&this._implementation.onRemove(d)}hasTile(d){if(this._implementation.hasTile){const{x:i,y:l,z:f}=d.canonical;return this._implementation.hasTile({x:i,y:l,z:f})}return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,i){const{x:l,y:f,z:_}=d.tileID.canonical,v=new AbortController;d.request=Promise.resolve(this._implementation.loadTile({x:l,y:f,z:_},{signal:v.signal})).then((function(b){return delete d.request,d.aborted?(d.state="unloaded",i(null)):b===void 0?(d.state="errored",i(null)):b===null?(this.loadTileData(d,{width:this.tileSize,height:this.tileSize,data:null}),d.state="loaded",i(null)):function(S){return S instanceof ImageData||S instanceof HTMLCanvasElement||S instanceof ImageBitmap||S instanceof HTMLImageElement}(b)?(this.loadTileData(d,b),d.state="loaded",void i(null)):(d.state="errored",i(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(b=>{b.name!=="AbortError"&&(d.state="errored",i(b))}),d.request.cancel=()=>v.abort()}loadTileData(d,i){d.setTexture(i,this.map.painter)}unloadTile(d,i){if(d.texture&&d.texture instanceof s.T?(d.destroy(!0),d.texture&&d.texture instanceof s.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),this._implementation.unloadTile){const{x:l,y:f,z:_}=d.tileID.canonical;this._implementation.unloadTile({x:l,y:f,z:_})}i&&i()}abortTile(d,i){d.request&&d.request.cancel&&(d.request.cancel(),delete d.request),i&&i()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(d=>
67({x:d.canonical.x,y:d.canonical.y,z:d.canonical.z}))}_clearTiles(){const d=s.C(this.id,this.scope);this.map.style.clearSource(d)}_update(){this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}}},hs=function(d,i,l,f){const _=new Do[i.type](d,i,l,f);if(_.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${_.id}`);return s.aV(["load","abort","unload","serialize","prepare"],_),_};function Es(d,i,l=""){return`${l}:${i.id||""}:${i.layer.id}:${function(f){if("layerId"in f)return`layer:${f.layerId}`;{const{featuresetId:_,importId:v}=f;return`featureset:${_}${v?`:import:${v}`:""}`}}(d.target)}`}function Pu(d,i,l,f=""){if(d.uniqueFeatureID){const _=Es(d,i,f);if(l.has(_))return!0;l.add(_)}return!1}function Nc(d,i,l,f,_=!1){const v=i.sourceCache.transform,b=i.sourceCache.tilesIn(d,i.has3DLayers,_);b.sort(Mu);const S=[];for(const C of b){const k=C.tile.queryRenderedFeatures(i,C,l,f,v,_);Object.keys(k).length&&S.push({wrappedTileID:C.tile.tileID.wrapped().key,queryResults:k})}return S.length===0?{}:function(C){const k={},R={};for(const F of C){const z=F.queryResults,N=F.wrappedTileID,G=R[N]=R[N]||{};for(const U in z){const W=z[U],Z=G[U]=G[U]||{},re=k[U]=k[U]||[];for(const se of W)Z[se.featureIndex]||(Z[se.featureIndex]=!0,re.push(se))}}return k}(S)}function Sn(d,i,l,f,_,v){const b={},S=f.queryRenderedSymbols(d),C=[];for(const k of Object.keys(S).map(Number))C.push(_[k]);C.sort(Mu);for(const k of C){const R=k.featureIndex.lookupSymbolFeatures(S[k.bucketInstanceId],k.bucketIndex,k.sourceLayerIndex,i,l,v);for(const F in R){const z=b[F]=b[F]||[],N=R[F];N.sort((G,U)=>{const W=k.featureSortOrder;if(W){const Z=W.indexOf(G.featureIndex);return W.indexOf(U.featureIndex)-Z}return U.featureIndex-G.featureIndex});for(const G of N)z.push(G)}}return b}function la(d,i){const l=d.getRenderableIds().map(v=>d.getTileByID(v)),f=[],_={};for(let v=0;v<l.length;v++){const b=l[v],S=b.tileID.canonical.key;_[S]||(_[S]=!0,b.querySourceFeatures(f,i))}return f}function Mu(d,i){const l=d.tileID,f=i.tileID;return l.overscaledZ-f.overscaledZ||l.canonical.y-f.canonical.y||l.wrap-f.wrap||l.canonical.x-f.canonical.x}function ca(d,i){const l={};if(!i)return l;for(const f of d){const _=f.layerIds.map(v=>i.getLayer(v)).filter(Boolean);if(_.length!==0){f.layers=_,f.stateDependentLayerIds&&(f.stateDependentLayers=f.stateDependentLayerIds.map(v=>_.filter(b=>b.id===v)[0]));for(const v of _)l[v.fqid]=f}}return l}const ua=32,Oa=33,sc=new Uint16Array(8184);for(let d=0;d<2046;d++){let i=d+2,l=0,f=0,_=0,v=0,b=0,S=0;for(1&i?_=v=b=ua:l=f=S=ua;(i>>=1)>1;){const k=l+_>>1,R=f+v>>1;1&i?(_=l,v=f,l=b,f=S):(l=_,f=v,_=b,v=S),b=k,S=R}const C=4*d;sc[C+0]=l,sc[C+1]=f,sc[C+2]=_,sc[C+3]=v}const il=new Uint16Array(2178),ac=new Uint8Array(1089),pf=new Uint16Array(1089);function kl(d){return d===0?-.03125:d===32?.03125:0}const mf={type:2,extent:s.aj,loadGeometry:()=>[[new s.P(0,0),new s.P(s.aj+1,0),new s.P(s.aj+1,s.aj+1),new s.P(0,s.aj+1),new s.P(0,0)]]};class ku{constructor(i,l,f,_,v,b){this.tileID=i,this.uid=s.a$(),this.uses=0,this.tileSize=l,this.tileZoom=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=v,_&&_.style&&(this._lastUpdatedBrightness=_.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",_&&_.transform&&(this.projection=_.transform.projection),this.worldview=b}registerFadeDuration(i){const l=i+this.timeAdded;l<s.q.now()||this.fadeEndTime&&l<this.fadeEndTime||(this.fadeEndTime=l)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=s.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,l,f){if(this.unloadVectorData(),this.state="loaded",i){i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=ca(i.buckets,l.style),this.hasSymbolBuckets=!1;for(const _ in this.buckets){const v=this.buckets[_];if(v instanceof s.b1){if(this.hasSymbolBuckets=!0,!f)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const _ in this.buckets){const v=this.buckets[_];if(v instanceof s.b1&&v.hasRTLText){this.hasRTLText=!0,s.b2();break}}this.queryPadding=0;for(const _ in this.buckets){const v=this.buckets[_],b=l.style.getOwnLayer(_);if(!b)continue;const S=b.queryRadius(v);this.queryPadding=Math.max(this.queryPadding,S)}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new s.b0}unloadVectorData(){if(this.hasData()){for(const i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(i,l,f){i&&(i.resourceTiming&&(this.resourceTiming=i.resourceTiming),this.buckets=Object.assign({},this.buckets,ca(i.buckets,l.style)),i.featureIndex&&(this.latestFeatureIndex=i.featureIndex))}getBucket(i){return this.buckets[i.fqid]}upload(i){for(const _ in this.buckets){const v=this.buckets[_];v.uploadPending()&&v.upload(i)}const l=i.gl,f=this.imageAtlas;f&&!f.uploaded&&(this.imageAtlasTexture=new s.T(i,f.image,l.RGBA8,{useMipmap:!!f.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(i,this.glyphAtlasImage,l.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(i,this.lineAtlas.image,l.R8),this.lineAtlas.uploaded=!0)}prepare(i,l,f){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture,f),!l||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const _=l.style.getBrightness();(this._lastUpdatedBrightness||_)&&(this._lastUpdatedBrightness&&_&&Math.abs(this._lastUpdatedBrightness-_)<.001||(this.updateBuckets(l,this._lastUpdatedBrightness!==_),this._lastUpdatedBrightness=_))}queryRenderedFeatures(i,l,f,_,v,b){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const S=function(C,k){const R=s.bn([],[.5*C.width,.5*-C.height,1]);return s.bo(R,R,[1,-1,0]),s.az(R,R,C.calculateProjMatrix(k.toUnwrapped())),Float32Array.from(R)}(v,this.tileID);return this.latestFeatureIndex.query(i,{tilespaceGeometry:l,pixelPosMatrix:S,transform:_,availableImages:f,tileTransform:this.tileTransform,worldview:this.worldview})}querySourceFeatures(i,l){const f=this.latestFeatureIndex;if(!f||!f.rawTileData)return;const _=f.loadVTLayers(),v=l?l.sourceLayer:"",b=_._geojsonTileLayer||_[v];if(!b)return;const S=s.b3(l&&l.filter),{z:C,x:k,y:R}=this.tileID.canonical,F={z:C,x:k,y:R};for(let z=0;z<b.length;z++){const N=b.feature(z);if(S.needGeometry){const W=s.b4(N,!0);if(!S.filter(new s.aa(this.tileID.overscaledZ,{worldview:this.worldview}),W,this.tileID.canonical))continue}else if(!S.filter(new s.aa(this.tileID.overscaledZ,{worldview:this.worldview}),N))continue;const G=f.getId(N,v),U=new s.b5(N,C,k,R,G);U.tile=F,i.push(U)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(i){const l=this.expirationTime;if(i.cacheControl){const f=s.b6(i.cacheControl);f["max-age"]&&(this.expirationTime=Date.now()+1e3*f["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){const f=Date.now();let _=!1;if(this.expirationTime>f)_=!1;else if(l)if(this.expirationTime<l)_=!0;else{const v=this.expirationTime-l;v?this.expirationTime=f+Math.max(v,3e4):_=!0}else _=!0;_?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(i){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&i&&this.updateBuckets(i)}updateBuckets(i,l){if(!this.latestFeatureIndex||!i.style)return;const f=this.latestFeatureIndex.loadVTLayers(),_=i.style.listImages(),v=i.style.getBrightness();for(const b in this.buckets){if(!i.style.hasLayer(b))continue;const S=this.buckets[b],C=S.layers[0],k=C.sourceLayer||"_geojsonTileLayer",R=f[k],F=i.style.getLayerSourceCache(C);let z={};F&&(z=F._state.getState(k,void 0));const N=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},G=Object.keys(z).length>0&&!l;G&&!S.stateDependentLayers.length&&!l||S.update(z,R,_,N,G?S.stateDependentLayers:S.layers,l,v),(S instanceof s.b7||S instanceof s.b8)&&i._terrain&&i._terrain.enabled&&F&&S.uploadPending()&&i._terrain._clearRenderCacheForTile(F.id,this.tileID);const U=i&&i.style&&i.style.getOwnLayer(b);U&&(this.queryPadding=Math.max(this.queryPadding,U.queryRadius(S)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=s.q.now()+i}setTexture(i,l){const f=l.context,_=f.gl;this.texture=this.texture||l.getTileTexture(i.width),this.texture&&this.texture instanceof s.T?this.texture.update(i):(this.texture=new s.T(f,i,_.RGBA8,{useMipmap:!0}),this.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE))}
vendor: 6,278 bytes, line 67
67setDependencies(i,l){const f={};for(const _ of l)f[_]=!0;this.dependencies[i]=f}hasDependency(i,l){for(const f of i){const _=this.dependencies[f];if(_){for(const v of l)if(_[v])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,l){if(!l||l.name==="mercator"||this._tileDebugBuffer)return;const f=s.b9(mf,this.tileID.canonical,this.tileTransform)[0],_=new s.ba,v=new s.bb;for(let b=0;b<f.length;b++){const{x:S,y:C}=f[b];_.emplaceBack(S,C),v.emplaceBack(b)}v.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(v),this._tileDebugBuffer=i.createVertexBuffer(_,s.bc.members),this._tileDebugSegments=s.bd.simpleSegment(0,0,_.length,v.length)}_makeTileBoundsBuffers(i,l){if(this._tileBoundsBuffer||!l||l.name==="mercator")return;const f=s.b9(mf,this.tileID.canonical,this.tileTransform)[0];let _,v;if(this.isRaster){const b=function(S,C){const k=s.aW(S,C),R=Math.pow(2,S.z);for(let W=0;W<Oa;W++)for(let Z=0;Z<Oa;Z++){const re=s.aX((S.x+(Z+kl(Z))/ua)/R),se=s.aY((S.y+(W+kl(W))/ua)/R),le=C.project(re,se),fe=W*Oa+Z;il[2*fe+0]=Math.round((le.x*k.scale-k.x)*s.aj),il[2*fe+1]=Math.round((le.y*k.scale-k.y)*s.aj)}ac.fill(0),pf.fill(0);for(let W=2045;W>=0;W--){const Z=4*W,re=sc[Z+0],se=sc[Z+1],le=sc[Z+2],fe=sc[Z+3],we=re+le>>1,Se=se+fe>>1,me=we+Se-se,ge=Se+re-we,ye=se*Oa+re,Ze=fe*Oa+le,Me=Se*Oa+we,ct=Math.hypot((il[2*ye+0]+il[2*Ze+0])/2-il[2*Me+0],(il[2*ye+1]+il[2*Ze+1])/2-il[2*Me+1])>=16;ac[Me]=ac[Me]||(ct?1:0),W<1022&&(ac[Me]=ac[Me]||ac[(se+ge>>1)*Oa+(re+me>>1)]||ac[(fe+ge>>1)*Oa+(le+me>>1)])}const F=new s.aZ,z=new s.a_;let N=0;function G(W,Z){const re=Z*Oa+W;return pf[re]===0&&(F.emplaceBack(il[2*re+0],il[2*re+1],W*s.aj/ua,Z*s.aj/ua),pf[re]=++N),pf[re]-1}function U(W,Z,re,se,le,fe){const we=W+re>>1,Se=Z+se>>1;if(Math.abs(W-le)+Math.abs(Z-fe)>1&&ac[Se*Oa+we])U(le,fe,W,Z,we,Se),U(re,se,le,fe,we,Se);else{const me=G(W,Z),ge=G(re,se),ye=G(le,fe);z.emplaceBack(me,ge,ye)}}return U(0,0,ua,ua,ua,0),U(ua,ua,0,0,0,ua),{vertices:F,indices:z}}(this.tileID.canonical,l);_=b.vertices,v=b.indices}else{_=new s.aZ,v=new s.a_;for(const{x:S,y:C}of f)_.emplaceBack(S,C,0,0);const b=s.be(_.int16.subarray(0,4*_.length),void 0,4);for(let S=0;S<b.length;S+=3)v.emplaceBack(b[S],b[S+1],b[S+2])}this._tileBoundsBuffer=i.createVertexBuffer(_,s.bf.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(v),this._tileBoundsSegments=s.bd.simpleSegment(0,0,_.length,v.length)}_makeGlobeTileDebugBuffers(i,l){const f=l.projection;if(!f||f.name!=="globe"||l.freezeTileCoverage)return;const _=this.tileID.canonical,v=s.bg(_,l),b=s.bh(v),S=s.ah(l.zoom);let C;S>0&&(C=s.bi(new Float64Array(16),l.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,_,l,b,C,S),this._makeGlobeTileDebugTextBuffer(i,_,l,b,C,S)}_globePoint(i,l,f,_,v,b,S){let C=s.bj(i,l,f);if(b){const k=1<<f.z,R=s.aD(_.center.lng),F=s.aH(_.center.lat),z=(f.x+.5)/k-R;let N=0;z>.5?N=-1:z<-.5&&(N=1);let G=(i/s.aj+f.x)/k+N,U=(l/s.aj+f.y)/k;G=(G-R)*_._pixelsPerMercatorPixel+R,U=(U-F)*_._pixelsPerMercatorPixel+F;const W=[G*_.worldSize,U*_.worldSize,0];s.ad(W,W,b),C=s.bk(C,W,S)}return s.ad(C,C,v)}_makeGlobeTileDebugBorderBuffer(i,l,f,_,v,b){const S=new s.ba,C=new s.bb,k=new s.bl,R=(z,N,G,U,W)=>{const Z=(G-z)/(W-1),re=(U-N)/(W-1),se=S.length;for(let le=0;le<W;le++){const fe=z+le*Z,we=N+le*re;S.emplaceBack(fe,we);const Se=this._globePoint(fe,we,l,f,_,v,b);k.emplaceBack(Se[0],Se[1],Se[2]),C.emplaceBack(se+le)}},F=s.aj;R(0,0,F,0,16),R(F,0,F,F,16),R(F,F,0,F,16),R(0,F,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(C),this._tileDebugBuffer=i.createVertexBuffer(S,s.bc.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(k,s.bm.members),this._tileDebugSegments=s.bd.simpleSegment(0,0,S.length,C.length)}_makeGlobeTileDebugTextBuffer(i,l,f,_,v,b){const S=s.aj/4,C=new s.ba,k=new s.a_,R=new s.bl,F=25;k.reserve(32),C.reserve(F),R.reserve(F);const z=(N,G)=>F*N+G;for(let N=0;N<F;N++){const G=N*S;for(let U=0;U<F;U++){const W=U*S;C.emplaceBack(W,G);const Z=this._globePoint(W,G,l,f,_,v,b);R.emplaceBack(Z[0],Z[1],Z[2])}}for(let N=0;N<4;N++)for(let G=0;G<4;G++){const U=z(N,G),W=z(N,G+1),Z=z(N+1,G),re=z(N+1,G+1);k.emplaceBack(U,W,Z),k.emplaceBack(Z,W,re)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(k),this._tileDebugTextBuffer=i.createVertexBuffer(C,s.bc.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(R,s.bm.members),this._tileDebugTextSegments=s.bd.simpleSegment(0,0,F,32)}destroy(i=!1){for(const l in this.buckets)this.buckets[l].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!i&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}s.bp.setPbf(s.bq);class Nh extends ku{constructor(i,l,f,_,v){super(i,l,f,_,v),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
67getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(i){return this._mrt&&this._mrt.getLayer(i)}setTexturePerLayer(i,l,f){const _=f.context,v=_.gl;let b=this.texturePerLayer.get(i)||f.getTileTexture(l.width);b&&b instanceof s.T?b.update(l,{premultiply:!1}):b=new s.T(_,l,v.RGBA8,{premultiply:!1}),this.texturePerLayer.has(i)||this.texturePerLayer.set(i,b)}flushQueues(i){const l=this._workQueuePerLayer.get(i)||[],f=this._fetchQueuePerLayer.get(i)||[];for(;l.length;)l.pop()();for(;f.length;)f.pop()()}flushAllQueues(){for(const i of this._workQueuePerLayer.keys()){const l=this._workQueuePerLayer.get(i)||[];for(;l.length;)l.pop()()}for(const i of this._fetchQueuePerLayer.keys()){const l=this._fetchQueuePerLayer.get(i)||[];for(;l.length;)l.pop()()}}fetchHeader(i=16384,l){const f=this._mrt=new s.bp(30),_=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=s.br(_,(v,b,S,C)=>{if(v)l(v);else try{const k=f.getHeaderLength(b);if(k>i)return void(this.request=this.fetchHeader(k,l));f.parseHeader(b),this._isHeaderLoaded=!0;let R=0;for(const F of Object.values(f.layers))R=Math.max(R,F.dataIndex[F.dataIndex.length-1].lastByte);b.byteLength>=R&&(this.entireBuffer=b),l(null,this.entireBuffer||b,S,C)}catch(k){l(k)}}),this.request}fetchBand(i,l,f,_){const v=this._mrt;if(!this._isHeaderLoaded||!v)return void _(new Error("Tile header is not ready"));const b=this.actor;if(!b)return void _(new Error("Can't fetch tile band without an actor"));let S;const C=(z,N)=>{if(S.complete(z,N),z)return void _(z);this.updateTextureDescriptor(i,l,f);const G=this.textureDescriptorPerLayer.get(l);_(null,G&&G.img)},k=(z,N)=>{if(z)return _(z);const G=b.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:N,task:S},C,void 0,!0),U=this._workQueuePerLayer.get(l)||[];U.push(()=>{G&&G.cancel(),S.cancel()}),this._workQueuePerLayer.has(l)||this._workQueuePerLayer.set(l,U)},R=v.getLayer(i);if(!R)return void _(new Error(`Unknown sourceLayer "${i}"`));if(R.hasDataForBand(f)){this.updateTextureDescriptor(i,l,f);const z=this.textureDescriptorPerLayer.get(l);return void _(null,z?z.img:null)}const F=R.getDataRange([f]);if(S=v.createDecodingTask(F),!S||S.tasks.length)if(this.flushQueues(l),this.entireBuffer)k(null,this.entireBuffer.slice(F.firstByte,F.lastByte+1));else{const z=Object.assign({},this.requestParams,{headers:{Range:`bytes=${F.firstByte}-${F.lastByte}`}}),N=s.br(z,k),G=this._fetchQueuePerLayer.get(l)||[];G.push(()=>{N.cancel(),S.cancel()}),this._fetchQueuePerLayer.has(l)||this._fetchQueuePerLayer.set(l,G)}else _(null)}updateNeeded(i,l){return(!this.textureDescriptorPerLayer.get(i)||this.textureDescriptorPerLayer.get(i).band!==l)&&this.state!=="errored"}updateTextureDescriptor(i,l,f){if(!this._mrt)return;const _=this._mrt.getLayer(i);if(!_||!_.hasBand(f)||!_.hasDataForBand(f))return;const{bytes:v,tileSize:b,buffer:S,offset:C,scale:k}=_.getBandView(f),R=b+2*S,F=new s.r({width:R,height:R},v),z=this.texturePerLayer.get(l);z&&z instanceof s.T&&z.update(F,{premultiply:!1}),this.textureDescriptorPerLayer.set(l,{layer:i,band:f,img:F,buffer:S,offset:C,tileSize:b,format:_.pixelFormat,mix:[k,256*k,65536*k,16777216*k]})}destroy(i=!1){if(super.destroy(i),delete this._mrt,!i)for(const l of this.texturePerLayer.values())l&&l instanceof s.T&&l.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class Ey{constructor(i,l){this.max=i,this.onRemove=l,this.reset()}reset(){for(const i in this.data)for(const l of this.data[i])l.timeout&&clearTimeout(l.timeout),this.onRemove(l.value);return this.data={},this.order=[],this}add(i,l,f){const _=i.wrapped().key;this.data[_]===void 0&&(this.data[_]=[]);const v={value:l,timeout:void 0};if(f!==void 0&&(v.timeout=setTimeout(()=>{this.remove(i,v)},f)),this.data[_].push(v),this.order.push(_),this.order.length>this.max){const b=this._getAndRemoveByKey(this.order[0]);b&&this.onRemove(b)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const l=this.data[i].shift();return l.timeout&&clearTimeout(l.timeout),this.data[i].length===0&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),l.value}getByKey(i){const l=this.data[i];return l?l[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,l){if(!this.has(i))return this;const f=i.wrapped().key,_=l===void 0?0:this.data[f].indexOf(l),v=this.data[f][_];return this.data[f].splice(_,1),v.timeout&&clearTimeout(v.timeout),this.data[f].length===0&&delete this.data[f],this.onRemove(v.value),this.order.splice(this.order.indexOf(f),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}filter(i){const l=[];for(const f in this.data)for(const _ of this.data[f])i(_.value)||l.push(_);for(const f of l)this.remove(f.value.tileID,f)}}class Sy{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,l,f){const _=String(l);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][_]=this.stateChanges[i][_]||{},s.h(this.stateChanges[i][_],f),this.deletedStates[i]===null){this.deletedStates[i]={};for(const v in this.state[i])v!==_&&(this.deletedStates[i][v]=null)}else if(this.deletedStates[i]&&this.deletedStates[i][_]===null){this.deletedStates[i][_]={};for(const v in this.state[i][_])f[v]||(this.deletedStates[i][_][v]=null)}else for(const v in f)this.deletedStates[i]&&this.deletedStates[i][_]&&this.deletedStates[i][_][v]===null&&delete this.deletedStates[i][_][v]}removeFeatureState(i,l,f){if(this.deletedStates[i]===null)return;const _=String(l);if(this.deletedStates[i]=this.deletedStates[i]||{},f&&l!==void 0)this.deletedStates[i][_]!==null&&(this.deletedStates[i][_]=this.deletedStates[i][_]||{},this.deletedStates[i][_][f]=null);else if(l!==void 0)if(this.stateChanges[i]&&this.stateChanges[i][_])for(f in this.deletedStates[i][_]={},this.stateChanges[i][_])this.deletedStates[i][_][f]=null;else this.deletedStates[i][_]=null;else this.deletedStates[i]=null}getState(i,l){const f=this.state[i]||{},_=this.stateChanges[i]||{},v=this.deletedStates[i];if(v===null)return{};if(l!==void 0){const S=String(l),C=s.h({},f[S],_[S]);if(v){const k=v[l];
67if(k===null)return{};for(const R in k)delete C[R]}return C}const b=s.h({},f,_);if(v)for(const S in v)delete b[S];return b}initializeTileState(i,l){i.refreshFeatureState(l)}coalesceChanges(i,l){const f={};for(const _ in this.stateChanges){this.state[_]=this.state[_]||{};const v={};for(const b in this.stateChanges[_])this.state[_][b]||(this.state[_][b]={}),s.h(this.state[_][b],this.stateChanges[_][b]),v[b]=this.state[_][b];f[_]=v}for(const _ in this.deletedStates){this.state[_]=this.state[_]||{};const v={};if(this.deletedStates[_]===null)for(const b in this.state[_])v[b]={},this.state[_][b]={};else for(const b in this.deletedStates[_]){if(this.deletedStates[_][b]===null)this.state[_][b]={};else if(this.state[_][b])for(const S of Object.keys(this.deletedStates[_][b]))delete this.state[_][b][S];v[b]=this.state[_][b]}f[_]=f[_]||{},s.h(f[_],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(f).length!==0)for(const _ in i)i[_].refreshFeatureState(l)}}class Ss extends s.E{constructor(i,l,f){super(),this.id=i,this._onlySymbols=f,l.on("data",_=>{_.dataType==="source"&&_.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&_.dataType==="source"&&_.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),l.on("error",()=>{this._sourceErrored=!0}),this._source=l,this._tiles={},this._cache=new Ey(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Sy,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(i){this.map=i,this._minTileCacheSize=this._minTileCacheSize===void 0&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&i?i._maxTileC
vendor: 4,322 bytes, line 67
67acheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const i in this._tiles)if(!this._tiles[i].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,l){return i.isSymbolTile=this._onlySymbols,i.isExtraShadowCaster=this._shadowCasterTiles[i.tileID.key],this._source.loadTile(i,l)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i)}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i)}serialize(){return this._source.serialize()}prepare(i){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const l in this._tiles){const f=this._tiles[l];f.upload(i),f.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(Ru).map(i=>i.key)}getRenderableIds(i,l){const f=[];for(const _ in this._tiles)this._isIdRenderable(+_,i,l)&&f.push(this._tiles[_]);return i?f.sort((_,v)=>{const b=_.tileID,S=v.tileID,C=new s.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),k=new s.P(S.canonical.x,S.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-S.overscaledZ||k.y-C.y||k.x-C.x}).map(_=>_.tileID.key):f.map(_=>_.tileID).sort(Ru).map(_=>_.key)}hasRenderableParent(i){const l=this.findLoadedParent(i,0);return!!l&&this._isIdRenderable(l.tileID.key)}_isIdRenderable(i,l,f){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(l||!this._tiles[i].holdingForFade())&&(f||!this._shadowCasterTiles[i])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)this._tiles[i].state!=="errored"&&this._reloadTile(+i,"reloading")}}_reloadTile(i,l){const f=this._tiles[i];f&&(f.state!=="loading"&&(f.state=l),this._loadTile(f,this._tileLoaded.bind(this,f,i,l)))}_tileLoaded(i,l,f,_){if(_)if(i.state="errored",_.status!==404)this._source.fire(new s.z(_,{tile:i}));else{if(this._source.fire(new s.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:i})),!(i.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const v=this.map.painter.terrain;this.update(this.transform,v.getScaledDemTileSize(),!0),v.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=s.q.now(),f==="expired"&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(l,i),this._source.type==="raster-dem"&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new s.A("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){const l=this.getRenderableIds();for(let _=0;_<l.length;_++){const v=l[_];if(i.neighboringTiles&&i.neighboringTiles[v]){const b=this.getTileByID(v);f(i,b),f(b,i)}}function f(_,v){if(!_.dem||_.dem.borderReady)return;_.needsHillshadePrepare=!0,_.needsDEMTextureUpload=!0;let b=v.tileID.canonical.x-_.tileID.canonical.x;const S=v.tileID.canonical.y-_.tileID.canonical.y,C=Math.pow(2,_.tileID.canonical.z),k=v.tileID.key;b===0&&S===0||Math.abs(S)>1||(Math.abs(b)>1&&(Math.abs(b+C)===1?b+=C:Math.abs(b-C)===1&&(b-=C)),v.dem&&_.dem&&(_.dem.backfillBorder(v.dem,b,S),_.neighboringTiles&&_.neighboringTiles[k]&&(_.neighboringTiles[k].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,l,f,_){for(const v in this._tiles){let b=this._tiles[v];if(_[v]||!b.hasData()||b.tileID.overscaledZ<=l||b.tileID.overscaledZ>f)continue;let S=b.tileID;for(;b&&b.tileID.overscaledZ>l+1;){const k=b.tileID.scaledTo(b.tileID.overscaledZ-1);b=this._tiles[k.key],b&&b.hasData()&&(S=k)}let C=S;for(;C.overscaledZ>l;)if(C=C.scaledTo(C.overscaledZ-1),i[C.key]){_[S.key]=S;break}}}findLoadedParent(i,l){if(i.key in this._loadedParentTiles){const f=this._loadedParentTiles[i.key];return f&&f.tileID.overscaledZ>=l?f:null}for(let f=i.overscaledZ-1;f>=l;f--){const _=i.scaledTo(f),v=this._getLoadedTile(_);
67if(v)return v}}_getLoadedTile(i){const l=this._tiles[i.key];return l&&l.hasData()?l:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,l){l=l||this._source.tileSize;const f=Math.ceil(i.width/l)+1,_=Math.ceil(i.height/l)+1,v=Math.floor(f*_*5),b=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,v):v,S=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,b):b;this._cache.setMaxSize(S)}handleWrapJump(i){const l=Math.round((i-(this._prevLng===void 0?i:this._prevLng))/360);if(this._prevLng=i,l){const f={};for(const _ in this._tiles){const v=this._tiles[_];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+l),f[v.tileID.key]=v}this._tiles=f;for(const _ in this._timers)clearTimeout(this._timers[_]),delete this._timers[_];for(const _ in this._tiles)this._setTileReloadTimer(+_,this._tiles[_])}}update(i,l,f,_,v){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!f)return;this.updateCacheSize(i,l),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const b=this._source.type==="batched-model";let S,C=this._source.maxzoom;const k=this.map&&this.map.painter?this.map.painter._terrain:null;if(k&&k.sourceCache===this&&k.attenuationRange()){const z=k.attenuationRange()[0],N=Math.floor(z)-Math.log2(k.getDemUpscale());C>N&&(C=N)}if(this.used||this.usedForTerrain){if(this._source.tileID)S=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new s.aM(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y));else if(this.tileCoverLift!==0){const z=i.clone();z.tileCoverLift=this.tileCoverLift,S=z.coveringTiles({tileSize:l||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:C,roundZoom:this._source.roundZoom&&!f,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:b}),this._source.minzoom<=1&&i.projection.name==="globe"&&(S.push(new s.aM(1,0,1,0,0)),S.push(new s.aM(1,0,1,1,0)),S.push(new s.aM(1,0,1,0,1)),S.push(new s.aM(1,0,1,1,1)))}else if(S=i.coveringTiles({tileSize:l||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:C,roundZoom:this._source.roundZoom&&!f,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:b}),this._source.hasTile){const z=this._source.hasTile.bind(this._source);S=S.filter(N=>z(N))}}else S=[];if(S.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!gf(this._source.type)){const z=i.coveringZoomLevel({tileSize:l||this._source.tileSize,roundZoom:this._source.roundZoom&&!f}),N=Math.min(z,this._source.maxzoom);if(b){const G=i.extendTileCover(S,N);for(const U of G)S.push(U)}else if(v){const G=i.extendTileCoverToNearPlane(S,this.transform.getFrustum(N),N);for(const U of G)S.push(U)}else if(this.castsShadows&&_){const G=i.extendTileCover(S,N,_);for(const U of G)this._shadowCasterTiles[U.key]=!0,S.push(U)}}const R=this._updateRetainedTiles(S);if(gf(this._source.type)&&S.length!==0){const z={},N={},G=Object.keys(R);for(const W of G){const Z=R[W],re=this._tiles[W];if(!re||re.fadeEndTime&&re.fadeEndTime<=s.q.now())continue;const se=this.findLoadedParent(Z,Math.max(Z.overscaledZ-Ss.maxOverzooming,this._source.minzoom));se&&(this._addTile(se.tileID),z[se.tileID.key]=se.tileID),N[W]=Z}const U=S[S.length-1].overscaledZ;for(const W in this._tiles){const Z=this._tiles[W];if(R[W]||!Z.hasData())continue;let re=Z.tileID;for(;re.overscaledZ>U;){re=re.scaledTo(re.overscaledZ-1);const se=this._tiles[re.key];if(se&&se.hasData()&&N[re.key]){R[W]=Z.tileID;break}}}for(const W in z)R[W]||(this._coveredTiles[W]=!0,R[W]=z[W])}for(const z in R)this._tiles[z].clearFadeHold();const F=s.bs(this._tiles,R);for(const z of F){const N=this._tiles[z];N.hasSymbolBuckets&&!N.holdingForFade()?N.setHoldDuration(this.map._fadeDuration):N.hasSymbolBuckets&&!N.symbolFadeFinished()||this._removeTile(+z)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){const l={};if(i.length===0)return l;const f={},_=i.reduce((k,R)=>
vendor: 11,803 bytes, line 67
67Math.min(k,R.overscaledZ),1/0),v=i[0].overscaledZ,b=Math.max(v-Ss.maxOverzooming,this._source.minzoom),S=Math.max(v+Ss.maxUnderzooming,this._source.minzoom),C={};for(const k of i){const R=this._addTile(k);l[k.key]=k,R.hasData()||_<this._source.maxzoom&&(C[k.key]=k)}this._retainLoadedChildren(C,_,S,l);for(const k of i){let R=this._tiles[k.key];if(R.hasData())continue;if(k.canonical.z>=this._source.maxzoom){const z=k.children(this._source.maxzoom)[0],N=this.getTile(z);if(N&&N.hasData()){l[z.key]=z;continue}}else{const z=k.children(this._source.maxzoom);if(l[z[0].key]&&l[z[1].key]&&l[z[2].key]&&l[z[3].key])continue}let F=R.wasRequested();for(let z=k.overscaledZ-1;z>=b;--z){const N=k.scaledTo(z);if(f[N.key]||(f[N.key]=!0,R=this.getTile(N),!R&&F&&(R=this._addTile(N)),R&&(l[N.key]=N,F=R.wasRequested(),R.hasData())))break}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const i in this._tiles){const l=[];let f,_=this._tiles[i].tileID;for(;_.overscaledZ>0;){if(_.key in this._loadedParentTiles){f=this._loadedParentTiles[_.key];break}l.push(_.key);const v=_.scaledTo(_.overscaledZ-1);if(f=this._getLoadedTile(v),f)break;_=v}for(const v of l)this._loadedParentTiles[v]=f}}_addTile(i){let l=this._tiles[i.key];if(l)return l.isExtraShadowCaster!==!0||this._shadowCasterTiles[i.key]||this._reloadTile(i.key,"reloading"),l;l=this._cache.getAndRemove(i),l&&(this._setTileReloadTimer(i.key,l),l.tileID=i,this._state.initializeTileState(l,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,l)));const f=!!l;if(!f){const _=this.map?this.map.painter:null,v=this._source.tileSize*i.overscaleFactor();l=this._source.type==="raster-array"?new Nh(i,v,this.transform.tileZoom,_,this._isRaster):new ku(i,v,this.transform.tileZoom,_,this._isRaster,this._source.worldview),this._loadTile(l,this._tileLoaded.bind(this,l,i.key,l.state))}return l.uses++,this._tiles[i.key]=l,f||this._source.fire(new s.A("dataloading",{tile:l,coord:l.tileID,dataType:"source"})),l}_setTileReloadTimer(i,l){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const f=l.getExpiryTimeout();f&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},f))}_removeTile(i){const l=this._tiles[i];l&&(l.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),l.uses>0||(l.hasData()&&l.state!=="reloading"||l.state==="empty"?this._cache.add(l.tileID,l,l.getExpiryTimeout()):(l.aborted=!0,this._abortTile(l),this._unloadTile(l))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const i in this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(i,l,f){const _=[],v=this.transform;if(!v)return _;const b=v.projection.name==="globe",S=s.aD(v.center.lng);for(const C in this._tiles){const k=this._tiles[C];if(f&&k.clearQueryDebugViz(),k.holdingForFade())continue;let R;if(b){const F=k.tileID.canonical;if(F.z===0){const z=[Math.abs(s.ay(S,...Bh(F,-1))-S),Math.abs(s.ay(S,...Bh(F,1))-S)];R=[0,2*z.indexOf(Math.min(...z))-1]}else{const z=[Math.abs(s.ay(S,...Bh(F,-1))-S),Math.abs(s.ay(S,...Bh(F,0))-S),Math.abs(s.ay(S,...Bh(F,1))-S)];R=[z.indexOf(Math.min(...z))-1]}}else R=[0];for(const F of R){const z=i.containsTile(k,v,l,F);z&&_.push(z)}}return _}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(i){return this._getRenderableCoordinates(i)}_getRenderableCoordinates(i,l){const f=this.getRenderableIds(i,l).map(v=>this._tiles[v].tileID),_=this.transform.projection.name==="globe";for(const v of f)v.projMatrix=this.transform.calculateProjMatrix(v.toUnwrapped()),v.expandedProjMatrix=_?this.transform.calculateProjMatrix(v.toUnwrapped(),!1,!0):v.projMatrix;return f}sortCoordinatesByDistance(i){const l=i.slice(),f=this.transform._camera.position,_=this.transform._camera.forward(),v={};for(const b of l){const S=1/(1<<b.canonical.z);v[b.key]=((b.canonical.x+.5)*S+b.wrap-f[0])*_[0]+((b.canonical.y+.5)*S-f[1])*_[1]-f[2]*_[2]}return l.sort((b,S)=>v[b.key]-v[S.key]),l}hasTransition(){if(this._source.hasTransition())return!0;if(gf(this._source.type))for(const i in this._tiles){const l=this._tiles[i];if(l.fadeEndTime!==void 0&&l.fadeEndTime>=s.q.now())return!0}return!1}setFeatureState(i,l,f){this._state.updateState(i=i||"_geojsonTileLayer",l,f)}removeFeatureState(i,l,f){this._state.removeFeatureState(i=i||"_geojsonTileLayer",l,f)}getFeatureState(i,l){return this._state.getState(i=i||"_geojsonTileLayer",l)}setDependencies(i,l,f){const _=this._tiles[i];_&&_.setDependencies(l,f)}reloadTilesForDependencies(i,l){for(const f in this._tiles)this._tiles[f].hasDependency(i,l)&&this._reloadTile(+f,"reloading");this._cache.filter(f=>!f.hasDependency(i,l))}_preloadTiles(i,l){if(!this._sourceLoaded){const C=()=>{this._sourceLoaded&&(this._source.off("data",C),this._preloadTiles(i,l))};return void this._source.on("data",C)}const f=new Map,_=Array.isArray(i)?i:[i],v=this.map.painter.terrain,b=this.usedForTerrain&&v?v.getScaledDemTileSize():this._source.tileSize;for(const C of _){const k=C.coveringTiles({tileSize:b,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const R of k)f.set(R.key,R);this.usedForTerrain&&C.updateElevation(!1)}const S=Array.from(f.values());s.bt(S,(C,k)=>{const R=new ku(C,this._source.tileSize*C.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(R,F=>{this._source.type==="raster-dem"&&R.dem&&this._backfillDEM(R),k(F,R)})},l)}}function Ru(d,i){const l=Math.abs(2*d.wrap)-+(d.wrap<0),f=Math.abs(2*i.wrap)-+(i.wrap<0);return d.overscaledZ-i.overscaledZ||f-l||i.canonical.y-d.canonical.y||i.canonical.x-d.canonical.x}function gf(d){return d==="raster"||d==="image"||d==="video"||d==="custom"}function Bh(d,i){const l=1<<d.z;return[d.x/l+i,(d.x+1)/l+i]}Ss.maxOverzooming=10,Ss.maxUnderzooming=3;class _b{constructor(i){this.style=i,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const i=!1,l=!1;for(const f in this.style._mergedLayers){const _=this.style._mergedLayers[f];if(_.type==="fill-extrusion"||_.type==="building")this.layers.push({layer:_,visible:i,visibilityChanged:l});else if(_.type==="model"){const v=this.style.getLayerSource(_);v&&v.type==="batched-model"&&this.layers.push({layer:_,visible:i,visibilityChanged:l})}}}onNewFrame(i){this.layersGotHidden=!1;for(const l of this.layers){const f=l.layer;let _=!1;f.type==="fill-extrusion"?_=!f.isHidden(i)&&f.paint.get("fill-extrusion-opacity")>0:f.type==="building"?_=!f.isHidden(i)&&f.paint.get("building-opacity")>0:f.type==="model"&&(_=!f.isHidden(i)&&f.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!_&&l.visible,l.visible=_}}updateZOffset(i,l){this.currentBuildingBuckets=[];for(const _ of this.layers){const v=_.layer,b=this.style.getLayerSourceCache(v);let S=1;v.type==="fill-extrusion"?S=_.visible?v.paint.get("fill-extrusion-vertical-scale"):0:v.type==="building"&&(S=_.visible?v.paint.get("building-vertical-scale"):0);let C=b?b.getTile(l):null;if(!C&&b)for(const k in b._tiles){const R=b._tiles[k];if(l.canonical.isChildOf(R.tileID.canonical)){C=R;break}}this.currentBuildingBuckets.push({bucket:C?C.getBucket(v):null,tileID:C?C.tileID:l,verticalScale:S})}i.hasAnyZOffset=!1;let f=!1;for(let _=0;_<i.symbolInstances.length;_++){const v=i.symbolInstances.get(_),b=v.zOffset,S=this._getHeightAtTileOffset(l,v.tileAnchorX,v.tileAnchorY);v.zOffset=S!==Number.NEGATIVE_INFINITY?S:b,f||b===v.zOffset||(f=!0),i.hasAnyZOffset||v.zOffset===0||(i.hasAnyZOffset=!0)}f&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(i,l,f,_){let v=l,b=f;if(i.canonical.z!==_.canonical.z){const S=_.canonical,C=1/(1<<i.canonical.z-S.z);v=(l+i.canonical.x*s.aj)*C-S.x*s.aj|0,b=(f+i.canonical.y*s.aj)*C-S.y*s.aj|0}return{tileX:v,tileY:b}}_getHeightAtTileOffset(i,l,f){let _,v;for(let b=0;b<this.layers.length;++b){const S=this.layers[b].layer;if(S.type!=="fill-extrusion"&&S.type!=="building")continue;const{bucket:C,tileID:k,verticalScale:R}=this.currentBuildingBuckets[b];if(!C)continue;const{tileX:F,tileY:z}=this._mapCoordToOverlappingTile(i,l,f,k),N=C.getHeightAtTileCoord(F,z);N&&N.height!==void 0&&(N.hidden?_=N.height:v=Math.max(N.height*R,v||0))}if(v!==void 0)return v;for(let b=0;b<this.layers.length;++b){const S=this.layers[b];if(S.layer.type!=="model"||!S.visible)continue;const{bucket:C,tileID:k}=this.currentBuildingBuckets[b];if(!C)continue;const{tileX:R,tileY:F}=this._mapCoordToOverlappingTile(i,l,f,k),z=C.getHeightAtTileCoord(R,F);if(z&&!z.hidden)return z.height===void 0&&_!==void 0?Math.min(z.maxHeight,_)*z.verticalScale:z.height?z.height*z.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function yb(d,i){const l={};for(const f in d)f!=="ref"&&(l[f]=d[f]);return s.bu.forEach(f=>{f in i&&(l[f]=i[f])}),l}function _f(d){d=d.slice();const i=Object.create(null);for(let l=0;l<d.length;l++)i[d[l].id]=d[l];for(let l=0;l<d.length;l++)"ref"in d[l]&&(d[l]=yb(d[l],i[d[l].ref]));return d}const fi={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function dm(d,i,l){l.push({command:fi.addSource,args:[d,i[d]]})}function Vh(d,i,l){i.push({command:fi.removeSource,args:[d]}),l[d]=!0}function yf(d,i,l,f){Vh(d,l,f),dm(d,i,l)}function gI(d,i,l){let f;for(f in d[l])if(d[l].hasOwnProperty(f)&&f!=="data"&&!s.bv(d[l][f],i[l][f]))return!1;for(f in i[l])if(i[l].hasOwnProperty(f)&&f!=="data"&&!s.bv(d[l][f],i[l][f]))return!1;return!0}function vf(d,i,l,f,_,v){let b;for(b in i=i||{},d=d||{})d.hasOwnProperty(b)&&(s.bv(d[b],i[b])||l.push({command:v,args:[f,b,i[b],_]}));for(b in i)i.hasOwnProperty(b)&&!d.hasOwnProperty(b)&&(s.bv(d[b],i[b])||l.push({command:v,args:[f,b,i[b],_]}))}function Lu(d){return d.id}function Bc(d,i){return d[i.id]=i,d}function xf(d,i,l){const f=i.createTileMatrix(d,d.worldSize,l.toUnwrapped());return s.az(new Float32Array(16),d.projMatrix,f)}function vb(d,i,l){if(i.projection.name===l.projection.name)return d.projMatrix;const f=l.clone();return f.setProjection(i.projection),xf(f,i.getProjection(),d)}function fm(d,i,l){return i.name===l.projection.name?d.projMatrix:xf(l,i,d)}class xb{constructor(i,l){this.reset(i,l)}reset(i,l){this.points=i||[],this._distances=[0];for(let f=1;f<this.points.length;f++)this._distances[f]=this._distances[f-1]+this.points[f].dist(this.points[f-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(l||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(i){if(this.points.length===1)return this.points[0];i=s.ay(i,0,1);let l=1,f=this._distances[l];const _=i*this.paddedLength+this.padding;
vendor: 4,334 bytes, line 67
67for(;f<_&&l<this._distances.length;)f=this._distances[++l];const v=l-1,b=this._distances[v],S=f-b,C=S>0?(_-b)/S:0;return this.points[v].mult(1-C).add(this.points[l].mult(C))}}class Uh{constructor(i,l,f){const _=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(i/f),this.yCellCount=Math.ceil(l/f);for(let b=0;b<this.xCellCount*this.yCellCount;b++)_.push([]),v.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=i,this.height=l,this.xScale=this.xCellCount/i,this.yScale=this.yCellCount/l,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(i,l,f,_,v){this._forEachCell(l,f,_,v,this._insertBoxCell,this.boxUid++),this.boxKeys.push(i),this.bboxes.push(l),this.bboxes.push(f),this.bboxes.push(_),this.bboxes.push(v)}insertCircle(i,l,f,_){this._forEachCell(l-_,f-_,l+_,f+_,this._insertCircleCell,this.circleUid++),this.circleKeys.push(i),this.circles.push(l),this.circles.push(f),this.circles.push(_)}_insertBoxCell(i,l,f,_,v,b){this.boxCells[v].push(b)}_insertCircleCell(i,l,f,_,v,b){this.circleCells[v].push(b)}_query(i,l,f,_,v,b){if(f<0||i>this.width||_<0||l>this.height)return!v&&[];const S=[];if(i<=0&&l<=0&&this.width<=f&&this.height<=_){if(v)return!0;for(let C=0;C<this.boxKeys.length;C++)S.push({key:this.boxKeys[C],x1:this.bboxes[4*C],y1:this.bboxes[4*C+1],x2:this.bboxes[4*C+2],y2:this.bboxes[4*C+3]});for(let C=0;C<this.circleKeys.length;C++){const k=this.circles[3*C],R=this.circles[3*C+1],F=this.circles[3*C+2];S.push({key:this.circleKeys[C],x1:k-F,y1:R-F,x2:k+F,y2:R+F})}return b?S.filter(b):S}return this._forEachCell(i,l,f,_,this._queryCell,S,{hitTest:v,seenUids:{box:{},circle:{}}},b),v?S.length>0:S}_queryCircle(i,l,f,_,v){const b=i-f,S=i+f,C=l-f,k=l+f;if(S<0||b>this.width||k<0||C>this.height)return!_&&[];const R=[];return this._forEachCell(b,C,S,k,this._queryCellCircle,R,{hitTest:_,circle:{x:i,y:l,radius:f},seenUids:{box:{},circle:{}}},v),_?R.length>0:R}query(i,l,f,_,v){return this._query(i,l,f,_,!1,v)}hitTest(i,l,f,_,v){return this._query(i,l,f,_,!0,v)}hitTestCircle(i,l,f,_){return this._queryCircle(i,l,f,!0,_)}_queryCell(i,l,f,_,v,b,S,C){const k=S.seenUids,R=this.boxCells[v];if(R!==null){const z=this.bboxes;for(const N of R)if(!k.box[N]){k.box[N]=!0;const G=4*N;if(i<=z[G+2]&&l<=z[G+3]&&f>=z[G+0]&&_>=z[G+1]&&(!C||C(this.boxKeys[N]))){if(S.hitTest)return b.push(!0),!0;b.push({key:this.boxKeys[N],x1:z[G],y1:z[G+1],x2:z[G+2],y2:z[G+3]})}}}const F=this.circleCells[v];if(F!==null){const z=this.circles;for(const N of F)if(!k.circle[N]){k.circle[N]=!0;const G=3*N;if(this._circleAndRectCollide(z[G],z[G+1],z[G+2],i,l,f,_)&&(!C||C(this.circleKeys[N]))){if(S.hitTest)return b.push(!0),!0;{const U=z[G],W=z[G+1],Z=z[G+2];b.push({key:this.circleKeys[N],x1:U-Z,y1:W-Z,x2:U+Z,y2:W+Z})}}}}}_queryCellCircle(i,l,f,_,v,b,S,C){const k=S.circle,R=S.seenUids,F=this.boxCells[v];if(F!==null){const N=this.bboxes;for(const G of F)if(!R.box[G]){R.box[G]=!0;const U=4*G;if(this._circleAndRectCollide(k.x,k.y,k.radius,N[U+0],N[U+1],N[U+2],N[U+3])&&(!C||C(this.boxKeys[G])))return b.push(!0),!0}}const z=this.circleCells[v];if(z!==null){const N=this.circles;for(const G of z)if(!R.circle[G]){R.circle[G]=!0;const U=3*G;if(this._circlesCollide(N[U],N[U+1],N[U+2],k.x,k.y,k.radius)&&(!C||C(this.circleKeys[G])))return b.push(!0),!0}}}_forEachCell(i,l,f,_,v,b,S,C){const k=this._convertToXCellCoord(i),R=this._convertToYCellCoord(l),F=this._convertToXCellCoord(f),z=this._convertToYCellCoord(_);for(let N=k;N<=F;N++)for(let G=R;G<=z;G++)if(v.call(this,i,l,f,_,this.xCellCount*G+N,b,S,C))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,l,f,_,v,b){const S=_-i,C=v-l,k=f+b;return k*k>S*S+C*C}_circleAndRectCollide(i,l,f,_,v,b,S){const C=(b-_)/2,k=Math.abs(i-(_+C));if(k>C+f)return!1;const R=(S-v)/2,F=Math.abs(l-(v+R));if(F>R+f)return!1;if(k<=C||F<=R)return!0;const z=k-C,N=F-R;return z*z+N*N<=f*f}}const zu={unknown:0,flipRequired:1,flipNotRequired:2},bb=Math.tan(85*Math.PI/180);function bf(d,i,l,f,_,v,b){const S=s.bz();if(l)if(v.name==="globe"){const C=s.bA(_,i);s.az(S,S,C)}else{const C=s.bB([],b);S[0]=C[0],S[1]=C[1],S[4]=C[2],S[5]=C[3],f||s.by(S,S,_.angle)}
67else s.az(S,_.labelPlaneMatrix,d);return S}function jh(d,i,l,f,_,v,b){const S=bf(d,i,l,f,_,v,b);return v.name==="globe"&&l||(S[2]=S[6]=S[10]=S[14]=0),S}function lc(d,i,l,f,_,v,b){if(l){if(v.name==="globe"){const S=bf(d,i,l,f,_,v,b);return s.bi(S,S),s.az(S,d,S),S}{const S=s.bw(d),C=s.bx([]);return C[0]=b[0],C[1]=b[1],C[4]=b[2],C[5]=b[3],s.az(S,S,C),f||s.by(S,S,-_.angle),S}}return _.glCoordMatrix}function ha(d,i,l,f){const _=[d,i,l,1];l?s.aA(_,_,f):wb(_,_,f);const v=_[3];return _[0]/=v,_[1]/=v,_[2]/=v,_}function Cy(d,i){return Math.min(.5+d/i*.5,1.5)}function Iy(d,i){const l=d[0]/d[3],f=d[1]/d[3];return l>=-i[0]&&l<=i[0]&&f>=-i[1]&&f<=i[1]}function Du(d,i,l,f,_,v,b,S,C,k){const R=l.transform,F=f?d.textSizeData:d.iconSizeData,z=s.bH(F,l.transform.zoom),N=R.projection.name==="globe",G=[256/l.width*2+1,256/l.height*2+1],U=f?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;U.clear();let W=null;N&&(W=f?d.text.globeExtVertexArray:d.icon.globeExtVertexArray);const Z=d.lineVertexArray,re=f?d.text.placedSymbolArray:d.icon.placedSymbolArray,se=l.transform.width/l.transform.height;let le,fe=!1;for(let we=0;we<re.length;we++){const Se=re.get(we),{numGlyphs:me,writingMode:ge}=Se;if(ge!==s.bI.vertical||fe||le===s.bI.horizontal||(fe=!0),le=ge,(Se.hidden||ge===s.bI.vertical)&&!fe){Gh(me,U);continue}fe=!1;const ye=new s.P(Se.tileAnchorX,Se.tileAnchorY);let{x:Ze,y:Me,z:ct}=R.projection.projectTilePoint(ye.x,ye.y,k.canonical);if(C){const[ir,ur,Zt]=C(ye);Ze+=ir,Me+=ur,ct+=Zt}const Qe=[Ze,Me,ct,1];if(s.aA(Qe,Qe,i),!Iy(Qe,G)){Gh(me,U);continue}const ft=Qe[3],Rt=Cy(l.transform.getCameraToCenterDistance(R.projection),ft),We=s.bJ(F,z,Se),Pe=b?We/Rt:We*Rt,nt=ha(Ze,Me,ct,_);if(nt[3]<=0){Gh(me,U);continue}let Ke={};const vt=s.al(d.layers[0].layout.get("text-max-angle")),xt=Math.cos(vt),Et=b?null:C,Bt=pm(Se,Pe,!1,S,i,_,v,d.glyphOffsetArray,Z,U,W,nt,ye,Ke,se,Et,R.projection,k,b,xt);fe=Bt.useVertical,Et&&Bt.needsFlipping&&(Ke={}),(Bt.notEnoughRoom||fe||Bt.needsFlipping&&pm(Se,Pe,!0,S,i,_,v,d.glyphOffsetArray,Z,U,W,nt,ye,Ke,se,Et,R.projection,k,b,xt).notEnoughRoom)&&Gh(me,U)}f?(d.text.dynamicLayoutVertexBuffer.updateData(U),W&&d.text.globeExtVertexBuffer&&d.text.globeExtVertexBuffer.updateData(W)):(d.icon.dynamicLayoutVertexBuffer.updateData(U),W&&d.icon.globeExtVertexBuffer&&d.icon.globeExtVertexBuffer.updateData(W))}function $s(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W){const{lineStartIndex:Z,glyphStartIndex:re,segment:se}=S,le=re+S.numGlyphs,fe=Z+S.lineLength,we=i.getoffsetX(re),Se=i.getoffsetX(le-1),me=wf(d*we,l,f,_,v,b,se,Z,fe,C,k,R,F,z,!0,N,G,U,W);if(!me)return null;const ge=wf(d*Se,l,f,_,v,b,se,Z,fe,C,k,R,F,z,!0,N,G,U,W);return ge?{first:me,last:ge}:null}function Ay(d,i,l,f){return d===s.bI.horizontal&&Math.abs(f)>Math.abs(l)?{useVertical:!0}:d===s.bI.vertical?f>0?{needsFlipping:!0}:null:i!==zu.unknown&&function(_,v){return _===0||Math.abs(v/_)>bb}(l,f)?i===zu.flipRequired?{needsFlipping:!0}:null:l<0?{needsFlipping:!0}:null}function pm(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z,re,se){const le=i/24,fe=d.lineOffsetX*le,we=d.lineOffsetY*le,{lineStartIndex:Se,glyphStartIndex:me,numGlyphs:ge,segment:ye,writingMode:Ze,flipState:Me}=d,ct=Se+d.lineLength,Qe=ft=>{if(R){const[nt,Ke,vt]=ft.up,xt=k.length;s.bK(R,xt+0,nt,Ke,vt),s.bK(R,xt+1,nt,Ke,vt),s.bK(R,xt+2,nt,Ke,vt),s.bK(R,xt+3,nt,Ke,vt)}const[Rt,We,Pe]=ft.point;s.bL(k,Rt,We,Pe,ft.angle)};if(ge>1){const ft=$s(le,S,fe,we,l,F,z,d,C,v,N,U,!1,W,Z,re,se);if(!ft)return{notEnoughRoom:!0};if(f&&!l){let[Rt,We,Pe]=ft.first.point,[nt,Ke,vt]=ft.last.point;[Rt,We]=ha(Rt,We,Pe,b),[nt,Ke]=ha(nt,Ke,vt,b);const xt=Ay(Ze,Me,(nt-Rt)*G,Ke-We);if(d.flipState=xt&&xt.needsFlipping?zu.flipRequired:zu.flipNotRequired,xt)return xt}Qe(ft.first);for(let Rt=me+1;Rt<me+ge-1;Rt++){const We=wf(le*S.getoffsetX(Rt),fe,we,l,F,z,ye,Se,ct,C,v,N,U,!1,!1,W,Z,re,se);if(!We)return k.length-=4*(Rt-me),{notEnoughRoom:!0};Qe(We)}Qe(ft.last)}else{if(f&&!l){const Rt=ha(z.x,z.y,0,_),We=Se+ye+1,Pe=new s.P(C.getx(We),C.gety(We)),nt=ha(Pe.x,Pe.y,0,_),Ke=nt[3]>0?nt:Mi(z,Pe,Rt,1,_,void 0,W,Z.canonical),vt=Ay(Ze,Me,(Ke[0]-Rt[0])*G,Ke[1]-Rt[1]);if(d.flipState=vt&&vt.needsFlipping?zu.flipRequired:zu.flipNotRequired,vt)return vt}const ft=wf(le*S.getoffsetX(me),fe,we,l,F,z,ye,Se,ct,C,v,N,U,!1,!1,W,Z,re,se);
67if(!ft)return{notEnoughRoom:!0};Qe(ft)}return{}}function Py(d,i,l,f,_){const{x:v,y:b,z:S}=f.projectTilePoint(d.x,d.y,i);if(!_)return ha(v,b,S,l);const[C,k,R]=_(d);return ha(v+C,b+k,S+R,l)}function Mi(d,i,l,f,_,v,b,S){const C=Py(d.sub(i)._unit()._add(d),S,_,b,v);return s.at(C,l,C),s.au(C,C),s.bE(C,l,C,f)}function wf(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z,re){const se=f?d-i:d+i;let le=se>0?1:-1,fe=0;f&&(le*=-1,fe=Math.PI),le<0&&(fe+=Math.PI);let we=S+b+(le>0?0:1)|0,Se=_,me=_,ge=0,ye=0;const Ze=Math.abs(se),Me=[],ct=[];let Qe=v,ft=Qe,Rt=s.bC([]);const We=()=>Mi(ft,Qe,me,Ze-ge+1,R,z,U,W.canonical);for(;ge+ye<=Ze;){if(we+=le,we<S||we>=C)return null;if(me=Se,ft=Qe,Me.push(me),N&&ct.push(ft),Qe=new s.P(k.getx(we),k.gety(we)),Se=F[we],!Se){const Zt=Py(Qe,W.canonical,R,U,z);Se=Zt[3]>0?F[we]=Zt:We()}ge+=ye;const ir=s.at([],Se,me),ur=s.bD(me,Se);if(l&&ur>0&&ye>0&&s.bG(Rt,ir)/(ye*ur)<re)return null;ye=ur,Rt=ir}G&&z&&(F[we]&&(Se=We(),ye=s.bD(me,Se),Rt=s.at([],Se,me)),F[we]=Se);const Pe=(Ze-ge)/ye,nt=Qe.sub(ft)._mult(Pe)._add(ft),Ke=s.bE([],me,Rt,Pe);let vt=[0,0,1],xt=Rt[0],Et=Rt[1];if(Z&&(vt=U.upVector(W.canonical,nt.x,nt.y),vt[0]!==0||vt[1]!==0||vt[2]!==1)){const ir=[vt[2],0,-vt[0]],ur=s.bF([],vt,ir);s.au(ir,ir),s.au(ur,ur),xt=s.bG(Rt,ir),Et=s.bG(Rt,ur)}if(l){const ir=s.bF([],vt,Rt);s.au(ir,ir),s.bE(Ke,Ke,ir,l*le)}const Bt=fe+Math.atan2(Et,xt);return Me.push(Ke),N&&ct.push(nt),{point:Ke,angle:Bt,path:Me,tilePath:ct,up:vt}}function Gh(d,i){const l=i.length,f=l+4*d;i.resize(f),i.float32.fill(-1/0,4*l,4*f)}function wb(d,i,l){const f=i[0],_=i[1];return d[0]=l[0]*f+l[4]*_+l[12],d[1]=l[1]*f+l[5]*_+l[13],d[3]=l[3]*f+l[7]*_+l[15],d}const _r=100;class Tb{constructor(i,l,f=new Uh(i.width+200,i.height+200,25),_=new Uh(i.width+200,i.height+200,25)){this.transform=i,this.grid=f,this.ignoredGrid=_,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+_r,this.screenBottomBoundary=i.height+_r,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.fogState=l}placeCollisionBox(i,l,f,_,v,b,S,C,k,R,F){let z=f.projectedAnchorX,N=f.projectedAnchorY,G=f.projectedAnchorZ;const U=f.tileAnchorX,W=f.tileAnchorY,Z=f.elevation,re=f.tileID,se=i.getProjection();if(Z&&re){const[ct,Qe,ft]=se.upVector(re.canonical,f.tileAnchorX,f.tileAnchorY),Rt=se.upVectorScale(re.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;z+=ct*Z*Rt,N+=Qe*Z*Rt,G+=ft*Z*Rt}const le=i.projection.name==="globe",fe=i.projection.name==="globe"?s.ah(this.transform.zoom):0;if(re&&le&&fe<1&&!b){const ct=1<<re.canonical.z,Qe=s.bM(U,W);s.bN(Qe,Qe,1/s.aj),s.bO(Qe,Qe,s.bM(re.canonical.x,re.canonical.y)),s.bN(Qe,Qe,1/ct),s.bP(Qe,Qe,s.bM(_[0],_[1])),Qe[0]=s.bQ(Qe[0],-.5,.5),s.bN(Qe,Qe,s.aj);
vendor: 32,198 bytes, line 67
67const ft=s.bR(Qe[0],Qe[1],s.aj/(2*Math.PI),1);s.aA(ft,ft,v),z=s.ai(z,ft[0],fe),N=s.ai(N,ft[1],fe),G=s.ai(G,ft[2],fe)}const we=this.projectAndGetPerspectiveRatio(R,z,N,G,f.tileID,se.name==="globe"||!!Z||this.transform.pitch>0,se),Se=k*we.perspectiveRatio,me=(f.x1*l+S.x-f.padding)*Se+we.point.x,ge=(f.y1*l+S.y-f.padding)*Se+we.point.y,ye=(f.x2*l+S.x+f.padding)*Se+we.point.x,Ze=(f.y2*l+S.y+f.padding)*Se+we.point.y,Me=we.perspectiveRatio<=.55||we.occluded;return!this.isInsideGrid(me,ge,ye,Ze)||!C&&this.grid.hitTest(me,ge,ye,Ze,F)||Me?{box:[],offscreen:!1,occluded:we.occluded}:{box:[me,ge,ye,Ze],offscreen:this.isOffscreen(me,ge,ye,Ze),occluded:!1}}placeCollisionCircles(i,l,f,_,v,b,S,C,k,R,F,z,N,G,U){const W=[],Z=this.transform.elevation,re=i.getProjection(),se=Z?Z.getAtTileOffsetFunc(U,this.transform.center.lat,this.transform.worldSize,re):null,le=new s.P(f.tileAnchorX,f.tileAnchorY);let{x:fe,y:we,z:Se}=re.projectTilePoint(le.x,le.y,U.canonical);if(se){const[vt,xt,Et]=se(le);fe+=vt,we+=xt,Se+=Et}const me=re.name==="globe",ge=this.projectAndGetPerspectiveRatio(S,fe,we,Se,U,me||!!Z||this.transform.pitch>0,re),{perspectiveRatio:ye}=ge,Ze=(F?b/ye:b*ye)/s.bU,Me=ha(fe,we,Se,C),ct=f.lineOffsetX*Ze,Qe=f.lineOffsetY*Ze,ft=s.al(i.layers[0].layout.get("text-max-angle")),Rt=Math.cos(ft),We=ge.signedDistanceFromCamera>0?$s(Ze,v,ct,Qe,!1,Me,le,f,_,C,{},Z&&!F?se:null,F&&!!Z,re,U,F,Rt):null;let Pe=!1,nt=!1,Ke=!0;if(We&&!ge.occluded){const vt=.5*N*ye+G,xt=new s.P(-100,-100),Et=new s.P(this.screenRightBoundary,this.screenBottomBoundary),Bt=new xb,{first:ir,last:ur}=We,Zt=ir.path.length;let ar=[];for(let zr=Zt-1;zr>=1;zr--)ar.push(ir.path[zr]);for(let zr=1;zr<ur.path.length;zr++)ar.push(ur.path[zr]);const or=2.5*vt;k&&(ar=ar.map(([zr,qr,pi],kr)=>(se&&!me&&(pi=se(kr<Zt-1?ir.tilePath[Zt-1-kr]:ur.tilePath[kr-Zt+2])[2]),ha(zr,qr,pi,k))),ar.some(zr=>zr[3]<=0)&&(ar=[]));let Pr=[];if(ar.length>0){let zr=1/0,qr=-1/0,pi=1/0,kr=-1/0;for(const mi of ar)zr=Math.min(zr,mi[0]),pi=Math.min(pi,mi[1]),qr=Math.max(qr,mi[0]),kr=Math.max(kr,mi[1]);qr>=xt.x&&zr<=Et.x&&kr>=xt.y&&pi<=Et.y&&(Pr=[ar.map(mi=>new s.P(mi[0],mi[1]))],(zr<xt.x||qr>Et.x||pi<xt.y||kr>Et.y)&&(Pr=s.bS(Pr,xt.x,xt.y,Et.x,Et.y)))}for(const zr of Pr){Bt.reset(zr,.25*vt);let qr=0;qr=Bt.length<=.5*vt?1:Math.ceil(Bt.paddedLength/or)+1;for(let pi=0;pi<qr;pi++){const kr=pi/Math.max(qr-1,1),mi=Bt.lerp(kr),xi=mi.x+_r,Zi=mi.y+_r;W.push(xi,Zi,vt,0);const $r=xi-vt,gi=Zi-vt,vi=xi+vt,Si=Zi+vt;if(Ke=Ke&&this.isOffscreen($r,gi,vi,Si),nt=nt||this.isInsideGrid($r,gi,vi,Si),!l&&this.grid.hitTestCircle(xi,Zi,vt,z)&&(Pe=!0,!R))return{circles:[],offscreen:!1,collisionDetected:Pe,occluded:!1}}}}return{circles:!R&&Pe||!nt?[]:W,offscreen:Ke,collisionDetected:Pe,occluded:ge.occluded}}queryRenderedSymbols(i){if(i.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const l=[];let f=1/0,_=1/0,v=-1/0,b=-1/0;for(const R of i){const F=new s.P(R.x+_r,R.y+_r);f=Math.min(f,F.x),_=Math.min(_,F.y),v=Math.max(v,F.x),b=Math.max(b,F.y),l.push(F)}const S=this.grid.query(f,_,v,b).concat(this.ignoredGrid.query(f,_,v,b)),C={},k={};for(const R of S){const F=R.key;if(C[F.bucketInstanceId]===void 0&&(C[F.bucketInstanceId]={}),C[F.bucketInstanceId][F.featureIndex])continue;const z=[new s.P(R.x1,R.y1),new s.P(R.x2,R.y1),new s.P(R.x2,R.y2),new s.P(R.x1,R.y2)];s.bT(l,z)&&(C[F.bucketInstanceId][F.featureIndex]=!0,k[F.bucketInstanceId]===void 0&&(k[F.bucketInstanceId]=[]),k[F.bucketInstanceId].push(F.featureIndex))}return k}insertCollisionBox(i,l,f,_,v){(l?this.ignoredGrid:this.grid).insert({bucketInstanceId:f,featureIndex:_,collisionGroupID:v},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,l,f,_,v){const b=l?this.ignoredGrid:this.grid,S={bucketInstanceId:f,featureIndex:_,collisionGroupID:v};for(let C=0;C<i.length;C+=4)b.insertCircle(S,i[C],i[C+1],i[C+2])}projectAndGetPerspectiveRatio(i,l,f,_,v,b,S){const C=[l,f,_,1];let k=!1;_||this.transform.pitch>0?(s.aA(C,C,i),this.fogState&&v&&S.name!=="globe"&&(k=function(z,N,G,U,W,Z){const re=Z.calculateFogTileMatrix(W),se=[N,G,U];return s.ad(se,se,re),Mt(z,s.ae(se),Z.pitch,Z._fov)}(this.fogState,l,f,_,v.toUnwrapped(),this.transform)>.9)):wb(C,C,i);const R=C[3];return{point:new s.P((C[0]/R+1)/2*this.transform.width+_r,(-C[1]/R+1)/2*this.transform.height+_r),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(S)/R*.5,1.5),signedDistanceFromCamera:R,occluded:b&&C[2]>R||k}}isOffscreen(i,l,f,_){return f<_r||i>=this.screenRightBoundary||_<_r||l>this.screenBottomBoundary}isInsideGrid(i,l,f,_){return f>=0&&i<this.gridRightBoundary&&_>=0&&l<this.gridBottomBoundary}getViewportMatrix(){const i=s.bx([]);return s.bo(i,i,[-100,-100,0]),i}}class Tf{constructor(i,l,f,_){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?l:-l))):_&&f?1:0,this.placed=f}isHidden(){return this.opacity===0&&!this.placed}}class Ou{constructor(i,l,f,_,v,b=!1){this.text=new Tf(i?i.text:null,l,f,v),this.icon=new Tf(i?i.icon:null,l,_,v),this.clipped=b}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class da{constructor(i,l,f,_=!1){this.text=i,this.icon=l,this.skipFade=f,this.clipped=_}}class My{constructor(){this.invProjMatrix=s.bz(),this.viewportMatrix=s.bz(),this.circles=[]}}class $h{constructor(i,l,f,_,v){this.bucketInstanceId=i,this.featureIndex=l,this.sourceLayerIndex=f,this.bucketIndex=_,this.tileID=v}}class cr{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){const l=++this.maxGroupID;this.collisionGroups[i]={ID:l,predicate:f=>f.collisionGroupID===l}}return this.collisionGroups[i]}}function Ai(d,i,l,f,_){const{horizontalAlign:v,verticalAlign:b}=s.bZ(d),S=-(v-.5)*i,C=-(b-.5)*l,k=s.b_(d,f);return new s.P(S+k[0]*_,C+k[1]*_)}function Pi(d,i,l,f,_){const v=new s.P(d,i);return l&&v._rotate(f?_:-_),v}class Hs{constructor(i,l,f,_,v,b){this.transform=i.clone(),this.projection=i.projection.name,this.collisionIndex=new Tb(this.transform,v),this.buildingIndex=b,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=l,this.retainedQueryData={},this.collisionGroups=new cr(f),this.collisionCircleArrays={},this.prevPlacement=_,_&&(_.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,l,f,_,v=1){const b=f.getBucket(l),S=f.latestFeatureIndex;if(!b||!S||l.fqid!==b.layerIds[0])return;const C=b.layers[0].layout,k=b.layers[0].paint,R=f.collisionBoxArray,F=Math.pow(2,this.transform.zoom-f.tileID.overscaledZ),z=f.tileSize/s.aj,N=f.tileID.toUnwrapped();this.transform.setProjection(b.projection);const G=(U=f.tileID,W=b.getProjection(),Z=this.transform,W.name===this.projection?Z.calculateProjMatrix(U.toUnwrapped()):xf(Z,W,U));var U,W,Z;const re=C.get("text-pitch-alignment")==="map",se=C.get("text-rotation-alignment")==="map";l.compileFilter(l.options);const le=l.dynamicFilter(),fe=l.dynamicFilterNeedsFeature(),we=this.transform.calculatePixelsToTileUnitsMatrix(f),Se=jh(G,f.tileID.canonical,re,se,this.transform,b.getProjection(),we);let me=null;const ge=b.getProjection().createInversionMatrix(this.transform,f.tileID.canonical);if(re){const Pe=lc(G,f.tileID.canonical,re,se,this.transform,b.getProjection(),we);me=s.az([],this.transform.labelPlaneMatrix,Pe)}let ye=null;le&&f.latestFeatureIndex&&(ye={unwrappedTileID:N,dynamicFilter:le,dynamicFilterNeedsFeature:fe}),this.retainedQueryData[b.bucketInstanceId]=new $h(b.bucketInstanceId,S,b.sourceLayerIndex,b.index,f.tileID);const[Ze,Me]=b.layers[0].layout.get("text-size-scale-range"),ct=s.ay(v,Ze,Me),[Qe,ft]=C.get("icon-size-scale-range"),Rt=s.ay(v,Qe,ft),We={bucket:b,layout:C,paint:k,posMatrix:G,invMatrix:ge,mercatorCenter:[s.aD(this.transform.center.lng),s.aH(this.transform.center.lat)],textLabelPlaneMatrix:Se,labelToScreenMatrix:me,clippingData:ye,scale:F,textPixelRatio:z,holdingForFade:f.holdingForFade(),collisionBoxArray:R,partiallyEvaluatedTextSize:s.bH(b.textSizeData,this.transform.zoom,ct),partiallyEvaluatedIconSize:s.bH(b.iconSizeData,this.transform.zoom,Rt),collisionGroup:this.collisionGroups.get(b.sourceID),latestFeatureIndex:f.latestFeatureIndex};if(_)for(const Pe of b.sortKeyRanges){const{sortKey:nt,symbolInstanceStart:Ke,symbolInstanceEnd:vt}=Pe;i.push({sortKey:nt,symbolInstanceStart:Ke,symbolInstanceEnd:vt,parameters:We})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:We})}attemptAnchorPlacement(i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z,re,se,le,fe){const{textOffset0:we,textOffset1:Se,crossTileID:me}=U,ge=[we,Se],ye=Ai(i,b,S,ge,C),Ze=this.collisionIndex.placeCollisionBox(Z,C,l,f,_,v,Pi(ye.x,ye.y,k,R,this.transform.angle),G,F,z,N.predicate);if(se){const Me=Z.getSymbolInstanceIconSize(fe,this.transform.zoom,U.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Z,Me,se,f,_,v,Pi(ye.x,ye.y,k,R,this.transform.angle),G,F,z,N.predicate).box.length===0)return}if(Ze.box.length>0){let Me;return this.prevPlacement&&this.prevPlacement.variableOffsets[me]&&this.prevPlacement.placements[me]&&this.prevPlacement.placements[me].text&&(Me=this.prevPlacement.variableOffsets[me].anchor),this.variableOffsets[me]={textOffset:ge,width:b,height:S,anchor:i,textScale:C,prevAnchor:Me},this.markUsedJustification(Z,i,U,re),Z.allowVerticalPlacement&&(this.markUsedOrientation(Z,re,U),this.placedOrientations[me]=re),{shift:ye,placedGlyphBoxes:Ze}}}placeLayerBucketPart(i,l,f,_,v=1){const{bucket:b,layout:S,paint:C,posMatrix:k,textLabelPlaneMatrix:R,labelToScreenMatrix:F,clippingData:z,textPixelRatio:N,mercatorCenter:G,invMatrix:U,holdingForFade:W,collisionBoxArray:Z,partiallyEvaluatedTextSize:re,partiallyEvaluatedIconSize:se,collisionGroup:le,latestFeatureIndex:fe}=i.parameters,we=S.get("text-optional"),Se=S.get("icon-optional"),me=S.get("text-allow-overlap"),ge=S.get("icon-allow-overlap"),ye=S.get("text-rotation-alignment")==="map",Ze=S.get("icon-rotation-alignment")==="map",Me=S.get("text-pitch-alignment")==="map",ct=C.get("symbol-z-offset"),Qe=S.get("symbol-elevation-reference")==="sea",ft=S.get("symbol-placement"),[Rt,We]=S.get("text-size-scale-range"),[Pe,nt]=S.get("icon-size-scale-range"),Ke=s.ay(v,Rt,We),vt=s.ay(v,Pe,nt),xt=S.get("text-variable-anchor"),Et=ye&&ft!=="point",Bt=Ze&&ft!=="point",ir=xt&&b.hasTextData(),ur=b.hasIconTextFit()&&ir&&b.hasIconData();this.transform.setProjection(b.projection);const Zt=ir||Et,ar=Bt||ur;let or=me&&(ge||!b.hasIconData()||Se),Pr=ge&&(me||!b.hasTextData()||we);const zr=!ct.isConstant();!b.collisionArrays&&Z&&b.deserializeCollisionBoxes(Z),f&&_&&b.updateCollisionDebugBuffers(this.transform.zoom,Z,Ke,vt);const qr=(kr,mi,xi)=>{const{crossTileID:Zi,numVerticalGlyphVertices:$r}=kr;let gi=null;if(z&&z.dynamicFilterNeedsFeature||zr){const Dn=this.retainedQueryData[b.bucketInstanceId];gi=fe.loadFeature({featureIndex:kr.featureIndex,bucketIndex:Dn.bucketIndex,sourceLayerIndex:Dn.sourceLayerIndex,layoutVertexArrayOffset:0})}if(z&&!(0,z.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},gi,this.retainedQueryData[b.bucketInstanceId].tileID.canonical,new s.P(kr.tileAnchorX,kr.tileAnchorY),this.transform.calculateDistanceTileData(z.unwrappedTileID)))return this.placements[Zi]=new da(!1,!1,!1,!0),void l.add(Zi);const vi=ct.evaluate(gi,{});if(l.has(Zi))return;if(W)return void(this.placements[Zi]=new da(!1,!1,!1));let Si=!1,Zr=!1,Di=!0,bi=!1,bn=!1,hi=null,Ci={box:null,offscreen:null,occluded:null},Gi={box:null},Un=null,Nn=null,jn=null,Io=0,sl=0,gs=0;xi.textFeatureIndex?Io=xi.textFeatureIndex:kr.useRuntimeCollisionCircles&&(Io=kr.featureIndex),xi.verticalTextFeatureIndex&&(sl=xi.verticalTextFeatureIndex);const Zs=Dn=>{Dn.tileID=this.retainedQueryData[b.bucketInstanceId].tileID;const Pn=this.transform.elevation;Dn.elevation=Qe?vi:vi+(Pn?Pn.getAtTileOffset(Dn.tileID,Dn.tileAnchorX,Dn.tileAnchorY):0),Dn.elevation+=kr.zOffset},jo=xi.textBox;if(jo){Zs(jo);const Dn=Yi=>{let to=s.bI.horizontal;if(b.allowVerticalPlacement&&!Yi&&this.prevPlacement){const Ao=this.prevPlacement.placedOrientations[Zi];Ao&&(this.placedOrientations[Zi]=Ao,to=Ao,this.markUsedOrientation(b,to,kr))}return to},Pn=(Yi,to)=>{if(b.allowVerticalPlacement&&$r>0&&xi.verticalTextBox){for(const Ao of b.writingModes)if(Ao===s.bI.vertical?(Ci=to(),Gi=Ci):Ci=Yi(),Ci&&Ci.box&&Ci.box.length)break}else Ci=Yi()};if(xt){let Yi=xt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Zi]){const On=this.prevPlacement.variableOffsets[Zi];Yi.indexOf(On.anchor)>0&&(Yi=Yi.filter(ya=>ya!==On.anchor),Yi.unshift(On.anchor))}const to=(On,ya,Xu)=>{const nu=b.getSymbolInstanceTextSize(re,kr,this.transform.zoom,mi),vd=(On.x2-On.x1)*nu+2*On.padding,xd=(On.y2-On.y1)*nu+2*On.padding,va=kr.hasIconTextFit&&!ge?ya:null;va&&Zs(va);let Fl={box:[],offscreen:!1,occluded:!1};const ro=me?2*Yi.length:Yi.length;for(let xa=0;xa<ro;++xa){const Yu=this.attemptAnchorPlacement(Yi[xa%Yi.length],On,G,U,Zt,vd,xd,nu,ye,Me,N,k,le,xa>=Yi.length,kr,mi,b,Xu,va,re,se);if(Yu&&(Fl=Yu.placedGlyphBoxes,Fl&&Fl.box&&Fl.box.length)){Si=!0,hi=Yu.shift;break}}return Fl};Pn(()=>to(jo,xi.iconBox,s.bI.horizontal),()=>{const On=xi.verticalTextBox;return On&&Zs(On),b.allowVerticalPlacement&&!(Ci&&Ci.box&&Ci.box.length)&&$r>0&&On?to(On,xi.verticalIconBox,s.bI.vertical):{box:null,offscreen:null,occluded:null}}),Ci&&(Si=Ci.box,Di=Ci.offscreen,bi=Ci.occluded);const Ao=Dn(!(!Ci||!Ci.box));if(!Si&&this.prevPlacement){const On=this.prevPlacement.variableOffsets[Zi];On&&(this.variableOffsets[Zi]=On,this.markUsedJustification(b,On.anchor,kr,Ao))}}else{const Yi=(to,Ao)=>{const On=b.getSymbolInstanceTextSize(re,kr,this.transform.zoom,mi,v),ya=this.collisionIndex.placeCollisionBox(b,On,to,G,U,Zt,new s.P(0,0),me,N,k,le.predicate);return ya&&ya.box&&ya.box.length&&(this.markUsedOrientation(b,Ao,kr),this.placedOrientations[Zi]=Ao),ya};Pn(()=>Yi(jo,s.bI.horizontal),()=>{const to=xi.verticalTextBox;return b.allowVerticalPlacement&&$r>0&&to?(Zs(to),Yi(to,s.bI.vertical)):{box:null,offscreen:null,occluded:null}}),Dn(!!(Ci&&Ci.box&&Ci.box.length))}}if(Un=Ci,Si=Un&&Un.box&&Un.box.length>0,Di=Un&&Un.offscreen,bi=Un&&Un.occluded,kr.useRuntimeCollisionCircles){const Dn=b.text.placedSymbolArray.get(kr.centerJustifiedTextSymbolIndex>=0?kr.centerJustifiedTextSymbolIndex:kr.verticalPlacedTextSymbolIndex),Pn=s.bJ(b.textSizeData,re,Dn),Yi=S.get("text-padding");Nn=this.collisionIndex.placeCollisionCircles(b,me,Dn,b.lineVertexArray,b.glyphOffsetArray,Pn,k,R,F,f,Me,le.predicate,kr.collisionCircleDiameter*Pn/s.bU,Yi,this.retainedQueryData[b.bucketInstanceId].tileID),Si=me||Nn.circles.length>0&&!Nn.collisionDetected,Di=Di&&Nn.offscreen,bi=Nn.occluded}if(xi.iconFeatureIndex&&(gs=xi.iconFeatureIndex),xi.iconBox){const Dn=Pn=>{Zs(Pn);const Yi=kr.hasIconTextFit&&hi?Pi(hi.x,hi.y,ye,Me,this.transform.angle):new s.P(0,0),to=b.getSymbolInstanceIconSize(se,this.transform.zoom,kr.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(b,to,Pn,G,U,ar,Yi,ge,N,k,le.predicate)};Gi&&Gi.box&&Gi.box.length&&xi.verticalIconBox?(jn=Dn(xi.verticalIconBox),Zr=jn.box.length>0):(jn=Dn(xi.iconBox),Zr=jn.box.length>0),Di=Di&&jn.offscreen,bn=jn.occluded}const _a=we||kr.numHorizontalGlyphVertices===0&&$r===0,Ga=Se||kr.numIconVertices===0;if(_a||Ga?Ga?_a||(Zr=Zr&&Si):Si=Zr&&Si:Zr=Si=Zr&&Si,Si&&Un&&Un.box&&this.collisionIndex.insertCollisionBox(Un.box,S.get("text-ignore-placement"),b.bucketInstanceId,Gi&&Gi.box&&sl?sl:Io,le.ID),Zr&&jn&&this.collisionIndex.insertCollisionBox(jn.box,S.get("icon-ignore-placement"),b.bucketInstanceId,gs,le.ID),Nn&&(Si&&this.collisionIndex.insertCollisionCircles(Nn.circles,S.get("text-ignore-placement"),b.bucketInstanceId,Io,le.ID),f)){const Dn=b.bucketInstanceId;let Pn=this.collisionCircleArrays[Dn];Pn===void 0&&(Pn=this.collisionCircleArrays[Dn]=new My);for(let Yi=0;Yi<Nn.circles.length;Yi+=4)Pn.circles.push(Nn.circles[Yi+0]),Pn.circles.push(Nn.circles[Yi+1]),Pn.circles.push(Nn.circles[Yi+2]),Pn.circles.push(Nn.collisionDetected?1:0)}const Go=b.projection.name!=="globe";or=or&&(Go||!bi),Pr=Pr&&(Go||!bn),this.placements[Zi]=new da(Si||or,Zr||Pr,Di||b.justReloaded),l.add(Zi)},pi=this.retainedQueryData[b.bucketInstanceId].tileID;if(b.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(b,pi),b.elevationType==="road"&&b.updateRoadElevation(pi.canonical),b.updateZOffset(),b.sortFeaturesByY){const kr=b.getSortedSymbolIndexes(this.transform.angle);for(let mi=kr.length-1;mi>=0;--mi){const xi=kr[mi];qr(b.symbolInstances.get(xi),xi,b.collisionArrays[xi])}b.hasAnyZOffset&&s.w(`${b.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(b.hasAnyZOffset){const kr=b.getSortedIndexesByZOffset();for(let mi=0;mi<kr.length;++mi){const xi=kr[mi];qr(b.symbolInstances.get(xi),xi,b.collisionArrays[xi])}}else for(let kr=i.symbolInstanceStart;kr<i.symbolInstanceEnd;kr++)qr(b.symbolInstances.get(kr),kr,b.collisionArrays[kr]);if(f&&b.bucketInstanceId in this.collisionCircleArrays){const kr=this.collisionCircleArrays[b.bucketInstanceId];s.bi(kr.invProjMatrix,k),kr.viewportMatrix=this.collisionIndex.getViewportMatrix()}b.justReloaded=!1}markUsedJustification(i,l,f,_){const{leftJustifiedTextSymbolIndex:v,centerJustifiedTextSymbolIndex:b,rightJustifiedTextSymbolIndex:S,verticalPlacedTextSymbolIndex:C,crossTileID:k}=f,R=s.b$(l),F=_===s.bI.vertical?C:R==="left"?v:R==="center"?b:R==="right"?S:-1;v>=0&&(i.text.placedSymbolArray.get(v).crossTileID=F>=0&&v!==F?0:k),b>=0&&(i.text.placedSymbolArray.get(b).crossTileID=F>=0&&b!==F?0:k),S>=0&&(i.text.placedSymbolArray.get(S).crossTileID=F>=0&&S!==F?0:k),C>=0&&(i.text.placedSymbolArray.get(C).crossTileID=F>=0&&C!==F?0:k)}markUsedOrientation(i,l,f){const _=l===s.bI.horizontal||l===s.bI.horizontalOnly?l:0,v=l===s.bI.vertical?l:0,{leftJustifiedTextSymbolIndex:b,centerJustifiedTextSymbolIndex:S,rightJustifiedTextSymbolIndex:C,verticalPlacedTextSymbolIndex:k}=f,R=i.text.placedSymbolArray;b>=0&&(R.get(b).placedOrientation=_),S>=0&&(R.get(S).placedOrientation=_),C>=0&&(R.get(C).placedOrientation=_),k>=0&&(R.get(k).placedOrientation=v)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const l=this.prevPlacement;let f=!1;this.prevZoomAdjustment=l?l.zoomAdjustment(this.transform.zoom):0;const _=l?l.symbolFadeChange(i):1,v=l?l.opacities:{},b=l?l.variableOffsets:{},S=l?l.placedOrientations:{};for(const C in this.placements){const k=this.placements[C],R=v[C];R?(this.opacities[C]=new Ou(R,_,k.text,k.icon,null,k.clipped),f=f||k.text!==R.text.placed||k.icon!==R.icon.placed):(this.opacities[C]=new Ou(null,_,k.text,k.icon,k.skipFade,k.clipped),f=f||k.text||k.icon)}for(const C in v){const k=v[C];if(!this.opacities[C]){const R=new Ou(k,_,!1,!1);R.isHidden()||(this.opacities[C]=R,f=f||k.text.placed||k.icon.placed)}}for(const C in b)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=b[C]);for(const C in S)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=S[C]);f?this.lastPlacementChangeTime=i:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=l?l.lastPlacementChangeTime:i)}updateLayerOpacities(i,l,f,_){const v=new Set;for(const b of l){const S=b.getBucket(i);S&&b.latestFeatureIndex&&i.fqid===S.layerIds[0]&&(this.updateBucketOpacities(S,v,b,b.collisionBoxArray,f,_,b.tileID,i.scope),S.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(S,b.tileID),S.elevationType==="road"&&S.updateRoadElevation(b.tileID.canonical),S.updateZOffset())}}updateBucketOpacities(i,l,f,_,v,b,S,C){i.hasTextData()&&i.text.opacityVertexArray.clear(),i.hasIconData()&&i.icon.opacityVertexArray.clear(),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();const k=i.layers[0].layout,R=i.layers[0].paint,F=!!i.layers[0].dynamicFilter(),z=new Ou(null,0,!1,!1,!0),N=k.get("text-allow-overlap"),G=k.get("icon-allow-overlap"),U=k.get("text-variable-anchor"),W=k.get("text-rotation-alignment")==="map",Z=k.get("text-pitch-alignment")==="map",re=R.get("symbol-z-offset"),se=k.get("symbol-elevation-reference")==="sea",le=!re.isConstant(),fe=new Ou(null,0,N&&(G||!i.hasIconData()||k.get("icon-optional")),G&&(N||!i.hasTextData()||k.get("text-optional")),!0);!i.collisionArrays&&_&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(_);const we=(me,ge,ye)=>{for(let Ze=0;Ze<ge/4;Ze++)me.opacityVertexArray.emplaceBack(ye)};let Se=0;b&&i.updateReplacement(S,b);for(let me=0;me<i.symbolInstances.length;me++){const ge=i.symbolInstances.get(me),{numHorizontalGlyphVertices:ye,numVerticalGlyphVertices:Ze,crossTileID:Me,numIconVertices:ct,tileAnchorX:Qe,tileAnchorY:ft}=ge;let Rt=null;const We=this.retainedQueryData[i.bucketInstanceId];le&&ge&&We&&(Rt=f.latestFeatureIndex.loadFeature({featureIndex:ge.featureIndex,bucketIndex:We.bucketIndex,sourceLayerIndex:We.sourceLayerIndex,layoutVertexArrayOffset:0}));const Pe=re.evaluate(Rt,{}),nt=l.has(Me);let Ke=this.opacities[Me];nt?Ke=z:Ke||(Ke=fe,this.opacities[Me]=Ke),l.add(Me);const vt=ye>0||Ze>0,xt=ct>0,Et=this.placedOrientations[Me],Bt=Et===s.bI.vertical,ir=Et===s.bI.horizontal||Et===s.bI.horizontalOnly;!vt&&!xt||Ke.isHidden()||Se++;let ur=!1;if((vt||xt)&&b)for(const Zt of i.activeReplacements){if(s.bV(Zt,v,s.bW.Symbol,C)||Zt.min.x>Qe||Qe>Zt.max.x||Zt.min.y>ft||ft>Zt.max.y)continue;const ar=s.bX(Qe,ft,S.canonical,Zt.footprintTileId.canonical);if(ur=s.bY(ar,Zt.footprint),ur)break}if(vt){const Zt=ur?Vc:Hh(Ke.text);we(i.text,ye,Bt?Vc:Zt),we(i.text,Ze,ir?Vc:Zt);const ar=Ke.text.isHidden(),{leftJustifiedTextSymbolIndex:or,centerJustifiedTextSymbolIndex:Pr,rightJustifiedTextSymbolIndex:zr,verticalPlacedTextSymbolIndex:qr}=ge,pi=i.text.placedSymbolArray,kr=ar||Bt?1:0;or>=0&&(pi.get(or).hidden=kr),Pr>=0&&(pi.get(Pr).hidden=kr),zr>=0&&(pi.get(zr).hidden=kr),qr>=0&&(pi.get(qr).hidden=ar||ir?1:0);const mi=this.variableOffsets[Me];mi&&this.markUsedJustification(i,mi.anchor,ge,Et);const xi=this.placedOrientations[Me];xi&&(this.markUsedJustification(i,"left",ge,xi),this.markUsedOrientation(i,xi,ge))}if(xt){const Zt=ur?Vc:Hh(Ke.icon),{placedIconSymbolIndex:ar,verticalPlacedIconSymbolIndex:or}=ge,Pr=i.icon.placedSymbolArray,zr=Ke.icon.isHidden()?1:0;ar>=0&&(we(i.icon,ct,Bt?Vc:Zt),Pr.get(ar).hidden=zr),or>=0&&(we(i.icon,ge.numVerticalIconVertices,ir?Vc:Zt),Pr.get(or).hidden=zr)}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){const Zt=i.collisionArrays[me];if(Zt){let ar=new s.P(0,0),or=!0;if(Zt.textBox||Zt.verticalTextBox){if(U){const zr=this.variableOffsets[Me];zr?(ar=Ai(zr.anchor,zr.width,zr.height,zr.textOffset,zr.textScale),W&&ar._rotate(Z?this.transform.angle:-this.transform.angle)):or=!1}F&&(or=!Ke.clipped),Zt.textBox&&cc(i.textCollisionBox.collisionVertexArray,Ke.text.placed,!or||Bt,Pe,se,ar.x,ar.y),Zt.verticalTextBox&&cc(i.textCollisionBox.collisionVertexArray,Ke.text.placed,!or||ir,Pe,se,ar.x,ar.y)}const Pr=or&&!!(!ir&&Zt.verticalIconBox);Zt.iconBox&&cc(i.iconCollisionBox.collisionVertexArray,Ke.icon.placed,Pr,Pe,se,ge.hasIconTextFit?ar.x:0,ge.hasIconTextFit?ar.y:0),Zt.verticalIconBox&&cc(i.iconCollisionBox.collisionVertexArray,Ke.icon.placed,!Pr,Pe,se,ge.hasIconTextFit?ar.x:0,ge.hasIconTextFit?ar.y:0)}}}if(i.fullyClipped=Se===0,i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=me.invProjMatrix,i.placementViewportMatrix=me.viewportMatrix,i.collisionCircleArray=me.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(i){return this.fadeDuration===0?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(i,l){const f=this.zoomAtLastRecencyCheck===l?1-this.zoomAdjustment(l):1;return this.zoomAtLastRecencyCheck=l,this.commitTime+this.fadeDuration*f>i}setStale(){this.stale=!0}}function cc(d,i,l,f,_,v,b){d.emplaceBack(i?1:0,l?1:0,v||0,b||0,f,_?1:0),d.emplaceBack(i?1:0,l?1:0,v||0,b||0,f,_?1:0),d.emplaceBack(i?1:0,l?1:0,v||0,b||0,f,_?1:0),d.emplaceBack(i?1:0,l?1:0,v||0,b||0,f,_?1:0)}const ki=Math.pow(2,25),mm=Math.pow(2,24),Ef=Math.pow(2,17),Sf=Math.pow(2,16),Ko=Math.pow(2,9),eo=Math.pow(2,8),_I=Math.pow(2,1);function Hh(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const i=d.placed?1:0,l=Math.floor(127*d.opacity);return l*ki+i*mm+l*Ef+i*Sf+l*Ko+i*eo+l*_I+i}const Vc=0;class Cf{constructor(i){this._sortAcrossTiles=i.layout.get("symbol-z-order")!=="viewport-y"&&i.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(i,l,f,_,v,b){const S=this._bucketParts;for(;this._currentTileIndex<i.length;)if(l.getBucketParts(S,_,i[this._currentTileIndex],this._sortAcrossTiles,b),this._currentTileIndex++,v())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,S.sort((C,k)=>C.sortKey-k.sortKey));this._currentPartIndex<S.length;){const C=S[this._currentPartIndex];if(l.placeLayerBucketPart(C,this._seenCrossTileIDs,f,C.symbolInstanceStart===0,b),this._currentPartIndex++,v())return!0}return!1}}class gm{constructor(i,l,f,_,v,b,S,C,k){this.placement=new Hs(i,v,b,S,C,k),this._currentPlacementIndex=l.length-1,this._forceFullPlacement=f,this._showCollisionBoxes=_,this._done=!1}isDone(){return this._done}continuePlacement(i,l,f,_,v){const b=s.q.now(),S=()=>{const C=s.q.now()-b;return!this._forceFullPlacement&&C>2};for(;this._currentPlacementIndex>=0;){const C=l[i[this._currentPlacementIndex]],k=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=k)&&(!C.maxzoom||C.maxzoom>k)){const R=C,F=R.layout.get("symbol-z-elevate"),z=R.layout.get("symbol-sort-key").constantOr(1)!==void 0,N=R.layout.get("symbol-z-order"),G=N==="viewport-y"||N==="auto"&&!(N!=="viewport-y"&&z),U=R.layout.get("text-allow-overlap")||R.layout.get("icon-allow-overlap")||R.layout.get("text-ignore-placement")||R.layout.get("icon-ignore-placement"),W=G&&U,Z=this._inProgressLayer=this._inProgressLayer||new Cf(R),re=s.C(C.source,C.scope);if(Z.continuePlacement(F||W?_[re]:f[re],this.placement,this._showCollisionBoxes,C,S,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const If=512/s.aj/2;class _m{constructor(i,l,f){this.tileID=i,this.bucketInstanceId=f,this.index=new s.c0(l.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const _=i.canonical.x*s.aj,v=i.canonical.y*s.aj;for(let b=0;b<l.length;b++){const{key:S,crossTileID:C,tileAnchorX:k,tileAnchorY:R}=l.get(b),F=Math.floor((_+k)*If),z=Math.floor((v+R)*If);this.index.add(F,z),this.keys.push(S),this.crossTileIDs.push(C)}this.index.finish()}findMatches(i,l,f){const _=this.tileID.canonical.z<l.canonical.z?1:Math.pow(2,this.tileID.canonical.z-l.canonical.z),v=If/Math.pow(2,l.canonical.z-this.tileID.canonical.z),b=l.canonical.x*s.aj,S=l.canonical.y*s.aj;for(let C=0;C<i.length;C++){const k=i.get(C);if(k.crossTileID)continue;const{key:R,tileAnchorX:F,tileAnchorY:z}=k,N=Math.floor((b+F)*v),G=Math.floor((S+z)*v),U=this.index.range(N-_,G-_,N+_,G+_).sort((W,Z)=>W-Z);for(const W of U){const Z=this.crossTileIDs[W];if(this.keys[W]===R&&!f.has(Z)){f.add(Z),k.crossTileID=Z;break}}}}}class ds{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class uc{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){const l=Math.round((i-this.lng)/360);if(l!==0)for(const f in this.indexes){const _=this.indexes[f],v={};for(const b in _){const S=_[b];S.tileID=S.tileID.unwrapTo(S.tileID.wrap+l),v[S.tileID.key]=S}this.indexes[f]=v}this.lng=i}addBucket(i,l,f){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===l.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let v=0;v<l.symbolInstances.length;v++)l.symbolInstances.get(v).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]=new Set);const _=this.usedCrossTileIDs[i.overscaledZ];for(const v in this.indexes){const b=this.indexes[v];if(Number(v)>i.overscaledZ)for(const S in b){const C=b[S];C.tileID.isChildOf(i)&&C.findMatches(l.symbolInstances,i,_)}else{const S=b[i.scaledTo(Number(v)).key];S&&S.findMatches(l.symbolInstances,i,_)}}for(let v=0;v<l.symbolInstances.length;v++){const b=l.symbolInstances.get(v);b.crossTileID||(b.crossTileID=f.generate(),_.add(b.crossTileID))}return this.indexes[i.overscaledZ]===void 0&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new _m(i,l.symbolInstances,l.bucketInstanceId),!0}removeBucketCrossTileIDs(i,l){for(const f of l.crossTileIDs)this.usedCrossTileIDs[i].delete(f)}removeStaleBuckets(i){let l=!1;for(const f in this.indexes){const _=this.indexes[f];for(const v in _)i[_[v].bucketInstanceId]||(this.removeBucketCrossTileIDs(f,_[v]),delete _[v],l=!0)}return l}}class Cs{constructor(){this.layerIndexes={},this.crossTileIDs=new ds,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,l,f,_){let v=this.layerIndexes[i.fqid];v===void 0&&(v=this.layerIndexes[i.fqid]=new uc);let b=!1;const S={};_.name!=="globe"&&v.handleWrapJump(f);for(const C of l){const k=C.getBucket(i);k&&i.fqid===k.layerIds[0]&&(k.bucketInstanceId||(k.bucketInstanceId=++this.maxBucketInstanceId),v.addBucket(C.tileID,k,this.crossTileIDs)&&(b=!0),S[k.bucketInstanceId]=!0)}return v.removeStaleBuckets(S)&&(b=!0),b}pruneUnusedLayers(i){const l={};i.forEach(f=>{l[f]=!0});for(const f in this.layerIndexes)l[f]||delete this.layerIndexes[f]}}const Fu=771;class Br{constructor(i,l,f,_){this.blendFunction=i,this.blendColor=l.toNonPremultipliedRenderColor(null),this.mask=f,this.blendEquation=_}}Br.Replace=[1,0,1,0],Br.disabled=new Br(Br.Replace,s.am.transparent,[!1,!1,!1,!1]),Br.unblended=new Br(Br.Replace,s.am.transparent,[!0,!0,!0,!0]),Br.alphaBlended=new Br([1,Fu,1,Fu],s.am.transparent,[!0,!0,!0,!0]),Br.alphaBlendedNonPremultiplied=new Br([770,Fu,770,Fu],s.am.transparent,[!0,!0,!0,!0]),Br.multiply=new Br([774,0,774,0],s.am.transparent,[!0,!0,!0,!0]);class Yt{constructor(i,l,f){this.func=i,this.mask=l,this.range=f}}Yt.ReadOnly=!1,Yt.ReadWrite=!0,Yt.disabled=new Yt(519,Yt.ReadOnly,[0,1]);const Fa=7680;class Cr{constructor(i,l,f,_,v,b){this.test=i,this.ref=l,this.mask=f,this.fail=_,this.depthFail=v,this.pass=b}}Cr.disabled=new Cr({func:519,mask:0},0,0,Fa,Fa,Fa);const Zn=1029,Af=2305;class vr{constructor(i,l,f){this.enable=i,this.mode=l,this.frontFace=f}}function qh(d,i){const l=s.c6(d,3);s.c8(d,i),s.cc(d,3,l)}function Zh(d,i){const l=s.c3([]);return s.c4(l,l,-i),s.c5(l,l,-d),l}function Uc(d,i){const l=[d[0],d[1],0],f=[i[0],i[1],0];if(s.ae(l)>=1e-15){const b=s.au([],l);s.c1(f,b,s.bG(f,b)),i[0]=f[0],i[1]=f[1]}const _=s.bF([],i,d);if(s.c2(_)<1e-15)return null;const v=Math.atan2(-_[1],_[0]);return Zh(Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2]),v)}vr.disabled=new vr(!1,Zn,Af),vr.backCCW=new vr(!0,Zn,Af),vr.backCW=new vr(!0,Zn,2304),vr.frontCW=new vr(!0,1028,2304),vr.frontCCW=new vr(!0,1028,Af);class Eb{constructor(i,l){this.position=i,this.orientation=l}get position(){return this._position}
vendor: 1,600 bytes, line 67
67set position(i){if(i){const l=i instanceof s.ac?i:new s.ac(i[0],i[1],i[2]);this._renderWorldCopies&&(l.x=s.bQ(l.x,0,1)),this._position=l}else this._position=null}lookAtPoint(i,l){if(this.orientation=null,!this.position)return;const f=this.position,_=this._elevation?this._elevation.getAtPointOrZero(s.ac.fromLngLat(i)):0,v=s.ac.fromLngLat(i,_),b=[v.x-f.x,v.y-f.y,v.z-f.z];l||(l=[0,0,1]),l[2]=Math.abs(l[2]),this.orientation=Uc(b,l)}setPitchBearing(i,l){this.orientation=Zh(s.al(i),s.al(-l))}}class Na{constructor(i,l){this._transform=s.bx([]),this.orientation=l,this.position=i}get mercatorPosition(){const i=this.position;return new s.ac(i[0],i[1],i[2])}get position(){const i=s.c6(this._transform,3);return[i[0],i[1],i[2]]}set position(i){var l;i&&s.cc(this._transform,3,[(l=i)[0],l[1],l[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||s.c3([]),i&&qh(this._transform,this._orientation)}getPitchBearing(){const i=this.forward(),l=this.right();return{bearing:Math.atan2(-l[1],l[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,l){this._orientation=Zh(i,l),qh(this._transform,this._orientation)}forward(){const i=s.c6(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){const i=s.c6(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){const i=s.c6(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,l){const f=new Float64Array(16);return s.bi(f,this.getWorldToCamera(i,l)),f}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,l,f){const _=this.position;s.c1(_,_,-i);const v=new Float64Array(16);
67return s.bn(v,[f,f,f]),s.bo(v,v,_),v[10]*=l,v}getWorldToCamera(i,l){const f=new Float64Array(16),_=new Float64Array(4),v=this.position;return s.c7(_,this._orientation),s.c1(v,v,-i),s.c8(f,_),s.bo(f,f,v),f[1]*=-1,f[5]*=-1,f[9]*=-1,f[13]*=-1,f[8]*=l,f[9]*=l,f[10]*=l,f[11]*=l,f}getCameraToClipPerspective(i,l,f,_){const v=new Float64Array(16);return s.c9(v,i,l,f,_),v}getCameraToClipOrthographic(i,l,f,_,v,b){const S=new Float64Array(16);return s.ca(S,i,l,f,_,v,b),S}getDistanceToElevation(i,l=!1){const f=i===0?0:s.cb(i,l?s.aY(this.position[1]):this.position[1]),_=this.forward();return(f-this.position[2])/_[2]}clone(){return new Na([...this.position],[...this.orientation])}}const fs={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Pf{constructor(i=0,l=0,f=0,_=0){if(isNaN(i)||i<0||isNaN(l)||l<0||isNaN(f)||f<0||isNaN(_)||_<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=l,this.left=f,this.right=_}interpolate(i,l,f){return l.top!=null&&i.top!=null&&(this.top=s.ai(i.top,l.top,f)),l.bottom!=null&&i.bottom!=null&&(this.bottom=s.ai(i.bottom,l.bottom,f)),l.left!=null&&i.left!=null&&(this.left=s.ai(i.left,l.left,f)),l.right!=null&&i.right!=null&&(this.right=s.ai(i.right,l.right,f)),this}getCenter(i,l){const f=s.ay((this.left+i-this.right)/2,0,i),_=s.ay((this.top+l-this.bottom)/2,0,l);return new s.P(f,_)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new Pf(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Co=15;class ky{constructor(i,l,f,_,v,b,S){this.tileSize=512,this._renderWorldCopies=v===void 0||v,this._minZoom=i||0,this._maxZoom=l||22,this._minPitch=f??0,this._maxPitch=_??60,this.setProjection(b),this.setMaxBounds(S),this.width=0,this.height=0,this._center=new s.ci(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Pf,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Na,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const i=new ky(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
vendor: 1,249 bytes, line 67
67xaggeration=this._centerAltitudeValidForExaggeration,i.tileSize=this.tileSize,i.mercatorFromTransition=this.mercatorFromTransition,i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._seaLevelZoom=this._seaLevelZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i.frustumCorners=this.frustumCorners,i._allowWorldUnderZoom=this._allowWorldUnderZoom,i}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Co}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(i,l=!1){const f=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
67xaggeration;(this._seaLevelZoom==null||f)&&this._updateCameraOnTerrain(),(i||f)&&this._constrainCamera(l),this._calcMatrices()}getProjection(){return s.aF(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};const l=this.projection?this.getProjection():void 0;this.projection=s.cj(this.projectionOptions);const f=this.getProjection(),_=!s.bv(l,f);return _&&this._calcMatrices(),this.mercatorFromTransition=!1,_}setOrthographicProjectionAtLowPitch(i){return this._orthographicProjectionAtLowPitch!==i&&(this._orthographicProjectionAtLowPitch=i,this._calcMatrices(),!0)}setMercatorFromTransition(){const i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.cj({name:"mercator"});const l=i!==this.projection.name;return l&&this._calcMatrices(),l}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get cameraWorldSize(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.cb(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bQ(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(i){const l=-i*Math.PI/180;this.angle!==l&&(this._unmodified=!1,this.angle=l,this._calcMatrices(),this.rotationMatrix=s.ck(),s.cl(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const l=s.ay(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==l&&(this._unmodified=!1,this._pitch=l,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=s.al(i),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const i=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/i)}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(i){const l=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==l&&(this._unmodified=!1,this._setZoom(l),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(i){this._tileCoverLift!==i&&(this._tileCoverLift=i)}_updateCameraOnTerrain(){const i=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,l=this.elevation&&i===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
vendor: 6,191 bytes, line 67
670&&this._centerAltitudeValidForExaggeration;if(!this._elevation||i===Number.NEGATIVE_INFINITY&&(!l||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const f=this._elevation;l||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&f.exaggeration()&&this._centerAltitudeValidForExaggeration!==f.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*f.exaggeration(),this._centerAltitudeValidForExaggeration=f.exaggeration()):(this._centerAltitude=i||0,this._centerAltitudeValidForExaggeration=f.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const i=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(i)}sampleAverageElevation(){if(!this._elevation)return 0;const i=this._elevation,l=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],f=this.horizonLineFromTop();let _=0,v=0;for(let b=0;b<l.length;b++){const S=new s.P(l[b][0]*this.width,f+l[b][1]*(this.height-f)),C=i.pointCoordinate(S);if(!C)continue;const k=1/Math.hypot(C[0]-this._camera.position[0],C[1]-this._camera.position[1]);_+=C[3]*k,v+=k}return v===0?NaN:_/v}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const i=this._seaLevelZoom,l=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),f=this.pixelsPerMeter/this.worldSize*l,_=this._mercatorZfromZoom(i),v=this._mercatorZfromZoom(this._maxZoom),b=Math.max(_-f,v);this._setZoom(this._zoomFromMercatorZ(b))}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}computeZoomRelativeTo(i){const l=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,i.toAltitude()));let f;f=i.z<this._camera.position[2]?[l.x,l.y,l.z]:[i.x,i.y,i.z];const _=s.ae(s.at([],this._camera.position,f));return s.ay(this._zoomFromMercatorZ(_),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let l=!1;if(i.orientation&&!s.cm(i.orientation,this._camera.orientation)&&(l=this._setCameraOrientation(i.orientation)),i.position){const f=[i.position.x,i.position.y,i.position.z];s.cn(f,this._camera.position)||(this._setCameraPosition(f),l=!0)}l&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const i=this._camera.position,l=new Eb;return l.position=new s.ac(i[0],i[1],i[2]),l.orientation=this._camera.orientation,l._elevation=this.elevation,l._renderWorldCopies=this.renderWorldCopies,l}_setCameraOrientation(i){if(!s.co(i))return!1;s.cp(i,i);const l=s.cq([],[0,0,-1],i),f=s.cq([],[0,-1,0],i);if(f[2]<0)return!1;const _=Uc(l,f);return!!_&&(this._camera.orientation=_,!0)}_setCameraPosition(i){const l=this.zoomScale(this.minZoom)*this.tileSize,f=this.zoomScale(this.maxZoom)*this.tileSize,_=this.cameraToCenterDistance;i[2]=s.ay(i[2],_/f,_/l),this._camera.position=i}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,l,f){this._unmodified=!1,this._edgeInsets.interpolate(i,l,f),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const l=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,l)}getVisibleUnwrappedCoordinates(i){const l=[new s.cr(0,i)];if(this.renderWorldCopies){const f=this.pointCoordinate(new s.P(0,0)),_=this.pointCoordinate(new s.P(this.width,0)),v=this.pointCoordinate(new s.P(this.width,this.height)),b=this.pointCoordinate(new s.P(0,this.height)),S=Math.floor(Math.min(f.x,_.x,v.x,b.x)),C=Math.floor(Math.max(f.x,_.x,v.x,b.x)),k=1;for(let R=S-k;R<=C+k;R++)R!==0&&l.push(new s.cr(R,i))}return l}isLODDisabled(i){return(!i||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(i,l,f){let _=[];const v=f!=null,b=!v;if(b&&this.zoom<l||v&&f[0]===0&&f[1]===0)return _;const S=new Set,C=(R,F,z,N,G)=>{const U=s.cV(F,R,z,N,G);S.has(U)||(_.push(new s.aM(R,F,z,N,G)),S.add(U))};for(let R=0;R<i.length;R++){const F=i[R];if(b&&F.canonical.z!==l)continue;const z=F.canonical,N=F.overscaledZ,G=F.wrap,U=1<<z.z,W=z.x+1<U,Z=z.x>0,re=z.y+1<U,se=z.y>0,le=F.wrap-(Z?0:1),fe=F.wrap+(W?0:1),we=Z?z.x-1:U-1,Se=W?z.x+1:0;if(v)f[0]<0?(C(N,fe,z.z,Se,z.y),f[1]<0&&re&&(C(N,G,z.z,z.x,z.y+1),C(N,fe,z.z,Se,z.y+1)),f[1]>0&&se&&(C(N,G,z.z,z.x,z.y-1),C(N,fe,z.z,Se,z.y-1))):f[0]>0?(C(N,le,z.z,we,z.y),f[1]<0&&re&&(C(N,G,z.z,z.x,z.y+1),C(N,le,z.z,we,z.y+1)),f[1]>0&&se&&(C(N,G,z.z,z.x,z.y-1),C(N,le,z.z,we,z.y-1))):f[1]<0&&re?C(N,G,z.z,z.x,z.y+1):se&&C(N,G,z.z,z.x,z.y-1);else{const me=F.visibleQuadrants;1&me&&(C(N,le,z.z,we,z.y),se&&(C(N,G,z.z,z.x,z.y-1),C(N,le,z.z,we,z.y-1))),2&me&&(C(N,fe,z.z,Se,z.y),se&&(C(N,G,z.z,z.x,z.y-1),C(N,fe,z.z,Se,z.y-1))),4&me&&(C(N,le,z.z,we,z.y),re&&(C(N,G,z.z,z.x,z.y+1),C(N,le,z.z,we,z.y+1))),8&me&&(C(N,fe,z.z,Se,z.y),re&&(C(N,G,z.z,z.x,z.y+1),C(N,fe,z.z,Se,z.y+1)))}}const k=[];for(const R of _)_.some(F=>R.isChildOf(F))||k.push(R);if(_=k.filter(R=>!i.some(F=>!!(R.overscaledZ<l&&F.isChildOf(R))||R.equals(F)||R.isChildOf(F))),b){const R=1<<l,F=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=[R*F.x,R*F.y],N=4,G=N*N;_=_.filter(U=>{const W=U.canonical.x+.5-z[0],Z=U.canonical.y+.5-z[1];return W*W+Z*Z<G})}return _}extendTileCoverToNearPlane(i,l,f){const _=[],v=new Set;for(const re of i)v.add(re.key);const b=(re,se,le,fe,we)=>{const Se=s.cV(se,re,le,fe,we);
67v.has(Se)||(_.push(new s.aM(re,se,le,fe,we)),v.add(Se))},S=i.reduce((re,se)=>Math.max(re,se.overscaledZ),f),C=1<<f,k=[new s.P(0,0),new s.P(s.aj,0),new s.P(s.aj,s.aj),new s.P(0,s.aj)],R=new s.P(0,0),F=new s.P(0,0),z=(re,se)=>{const le=Math.floor(re[0]),fe=Math.floor(re[1]),we=(re[0]-le)*s.aj,Se=(re[1]-fe)*s.aj,me=Math.floor(se[0]),ge=Math.floor(se[1]),ye=(se[0]-me)*s.aj,Ze=(se[1]-ge)*s.aj;for(let Me=-1;Me<=1;Me++){const ct=le+Me;if(!(ct<0||ct>=C)){R.x=we-Me*s.aj,F.x=ye-(ct-me)*s.aj;for(let Qe=-1;Qe<=1;Qe++){const ft=fe+Qe;R.y=Se-Qe*s.aj,F.y=Ze-(ft-ge)*s.aj,s.cW(R,F,k)&&b(S,0,f,ct,ft)}}}},N=l.points,G=N[s.cs],U=N[s.ct],W=this._projectToGround(G,N[s.cu]),Z=this._projectToGround(U,N[s.cv]);return z(G,W),z(U,Z),_}_projectToGround(i,l){return s.cw(s.cx(),i,l,i[2]/(i[2]-l[2]))}coveringTiles(i){let l=this.coveringZoomLevel(i);const f=l,_=this.elevation&&this.elevation.exaggeration(),v=_&&!i.isTerrainDEM,b=this.projection.name==="mercator";if(i.minzoom!==void 0&&l<i.minzoom)return[];i.maxzoom!==void 0&&l>i.maxzoom&&(l=i.maxzoom);const S=this.locationCoordinate(this.center),C=this.center.lat,k=1<<l,R=[k*S.x,k*S.y,0],F=this.projection.name==="globe",z=!F,N=s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,l,z),G=F?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),U=k*s.cb(1,this.center.lat),W=this._camera.position[2]/s.cb(1,this.center.lat),Z=[k*G.x,k*G.y,W*(z?1:U)],re=F||_,se=this.cameraToCenterDistance/i.tileSize*(i.roundZoom?1:.502),le=this.isLODDisabled(!0)?l:0;let fe;if(this._elevation&&i.isTerrainDEM)fe=1e4*this._elevation.exaggeration();else if(this._elevation){const Pe=this._elevation.getMinMaxForVisibleTiles();fe=Pe?Pe.max:this._centerAltitude}else fe=this._centerAltitude;const we=i.isTerrainDEM?-fe:this._elevation?this._elevation.getMinElevationBelowMSL():0,Se=this.projection.isReprojectedInTileSpace?s.cz(this):1,me=Pe=>{const Ke=new s.ac(Pe.x+25e-6,Pe.y,Pe.z),vt=new s.ac(Pe.x,Pe.y+25e-6,Pe.z),xt=Pe.toLngLat(),Et=Ke.toLngLat(),Bt=vt.toLngLat(),ir=this.locationCoordinate(xt),ur=this.locationCoordinate(Et),Zt=this.locationCoordinate(Bt),ar=Math.hypot(ur.x-ir.x,ur.y-ir.y),or=Math.hypot(Zt.x-ir.x,Zt.y-ir.y);return Math.sqrt(ar*or)*Se/25e-6},ge=Pe=>{const nt=fe,Ke=we;return{aabb:s.cC(this,k,0,0,0,Pe,Ke,nt,this.projection),zoom:0,x:0,y:0,minZ:Ke,maxZ:nt,wrap:Pe,fullyVisible:!1}},ye=[];let Ze=[];const Me=l,ct=i.reparseOverscaled?f:l,Qe=(W-this._centerAltitude)*U,ft=Pe=>{if(!this._elevation||!Pe.tileID||!b)return;const nt=this._elevation.getMinMaxForTile(Pe.tileID),Ke=Pe.aabb;nt?(Ke.min[2]=nt.min,Ke.max[2]=nt.max,Ke.center[2]=(Ke.min[2]+Ke.max[2])/2):(Pe.shouldSplit=We(Pe),Pe.shouldSplit||(Ke.min[2]=Ke.max[2]=Ke.center[2]=this._centerAltitude))},Rt=(Pe,nt)=>{if(.707*nt<Pe)return 1;const Ke=nt/Pe;return Ke/(1.4144271570014144+(Math.pow(1.1,Ke-1.4144271570014144+1)-1)/(1.1-1)-1)},We=Pe=>{if(Pe.zoom<le)return!0;if(Pe.zoom===Me)return!1;if(Pe.shouldSplit!=null)return Pe.shouldSplit;const nt=Pe.aabb.distanceX(Z),Ke=Pe.aabb.distanceY(Z);let vt=Qe,xt=1;if(F){vt=Pe.aabb.distanceZ(Z);const or=Math.pow(2,Pe.zoom),Pr=s.aY((Pe.y+1)/or),zr=s.aY(Pe.y/or),qr=Math.min(Math.max(C,Pr),zr),pi=s.c_(qr)/s.c_(C);if(xt=qr===C?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,pi/this._mercatorScaleRatio),this.zoom<=s.cX&&Pe.zoom===Me-1&&pi>=.9)return!0}else if(v&&(vt=Pe.aabb.distanceZ(Z)*U),this.projection.isReprojectedInTileSpace&&f<=5){const or=Math.pow(2,Pe.zoom),Pr=me(new s.ac((Pe.x+.5)/or,(Pe.y+.5)/or));xt=Pr>.85?1:Pr}if(!b){const or=Math.sqrt(nt*nt+Ke*Ke+vt*vt);let Pr=(1<<Me-Pe.zoom)*se*xt;return Pr*=Rt(Math.max(vt,Qe),or),or<Pr}let Et=Number.MAX_VALUE,Bt=0;const ir=Pe.aabb.getCorners(),ur=[];for(const or of ir){s.at(ur,or,Z),F||(v?ur[2]*=U:ur[2]=Qe);const Pr=s.bG(ur,this._camera.forward());Pr<Et&&(Et=Pr,Bt=Math.abs(ur[2]))}let Zt=(1<<Me-Pe.zoom)*se*xt;if(Zt*=Rt(Math.max(Bt,Qe),Et),Et<Zt)return!0;const ar=Pe.aabb.closestPoint(R);return ar[0]===R[0]&&ar[1]===R[1]};if(this.renderWorldCopies)for(let Pe=1;Pe<=3;Pe++)ye.push(ge(-Pe)),ye.push(ge(Pe));for(ye.push(ge(0));ye.length>0;){const Pe=ye.pop(),nt=Pe.x,Ke=Pe.y;let vt=Pe.fullyVisible;const xt=()=>this.projection.name==="globe"&&(Pe.y===0||Pe.y===(1<<Pe.zoom)-1);if(!vt){let Et=re?Pe.aabb.intersects(N):Pe.aabb.intersectsFlat(N);if(Et===0&&xt()){const Bt=new s.cA(Pe.zoom,nt,Ke);Et=s.cB(this,k,Bt,!0).intersects(N)}if(Et===0)continue;vt=Et===2}if(Pe.zoom!==Me&&We(Pe))for(let Et=0;Et<4;Et++){const Bt=(nt<<1)+Et%2,ir=(Ke<<1)+(Et>>1),ur={aabb:b?Pe.aabb.quadrant(Et):s.cC(this,k,Pe.zoom+1,Bt,ir,Pe.wrap,Pe.minZ,Pe.maxZ,this.projection),zoom:Pe.zoom+1,x:Bt,y:ir,wrap:Pe.wrap,fullyVisible:vt,tileID:void 0,shouldSplit:void 0,minZ:Pe.minZ,maxZ:Pe.maxZ};v&&!F&&(ur.tileID=new s.aM(Pe.zoom+1===Me?ct:Pe.zoom+1,Pe.wrap,Pe.zoom+1,Bt,ir),ft(ur)),ye.pu
67sh(ur)}else{const Et=Pe.zoom===Me?ct:Pe.zoom;if(i.minzoom&&i.minzoom>Et)continue;let Bt=0;if(!vt){let ar=re?Pe.aabb.intersectsPrecise(N):Pe.aabb.intersectsPreciseFlat(N);if(ar===0&&xt()){const or=new s.cA(Pe.zoom,nt,Ke);ar=s.cB(this,k,or,!0).intersectsPrecise(N)}if(ar===0)continue;if(i.calculateQuadrantVisibility)if(N.containsPoint(Pe.aabb.center))Bt=15;else for(let or=0;or<4;or++)Pe.aabb.quadrant(or).intersects(N)!==0&&(Bt|=1<<or)}const ir=R[0]-(.5+nt+(Pe.wrap<<Pe.zoom))*(1<<l-Pe.zoom),ur=R[1]-.5-Ke,Zt=Pe.tileID?Pe.tileID:new s.aM(Et,Pe.wrap,Pe.zoom,nt,Ke);i.calculateQuadrantVisibility&&(Zt.visibleQuadrants=Bt),Ze.push({tileID:Zt,distanceSq:ir*ir+ur*ur})}}if(this.fogCullDistSq){const Pe=this.fogCullDistSq,nt=this.horizonLineFromTop();Ze=Ze.filter(Ke=>{const vt=[0,0,0,1],xt=[s.aj,s.aj,0,1],Et=this.calculateFogTileMatrix(Ke.tileID.toUnwrapped());s.aA(vt,vt,Et),s.aA(xt,xt,Et);const Bt=s.cD([],vt,xt),ir=s.cE([],vt,xt),ur=s.cY(Bt,ir);if(ur===0)return!0;let Zt=!1;const ar=this._elevation;if(ar&&ur>Pe&&nt!==0){const or=this.calculateProjMatrix(Ke.tileID.toUnwrapped());let Pr;i.isTerrainDEM||(Pr=ar.getMinMaxForTile(Ke.tileID)),Pr||(Pr={min:we,max:fe});const zr=s.cF(this.rotation),qr=[zr[0]*s.aj,zr[1]*s.aj,Pr.max];s.ad(qr,qr,or),Zt=(1-qr[1])*this.height*.5<nt}return ur<Pe||Zt})}return Ze.sort((Pe,nt)=>Pe.distanceSq-nt.distanceSq).map(Pe=>Pe.tileID)}resize(i,l){this.width=i,this.height=l,this.pixelsToGLUnits=[2/i,-2/l],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const l=s.ay(i.lat,-s.cG,s.cG),f=this.projection.project(i.lng,l);return new s.P(f.x*this.worldSize,f.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cb(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,l){let f,_;const v=this.centerPoint;if(this.projection.name==="globe"){const S=this.worldSize;f=(l.x-v.x)/S,_=(l.y-v.y)/S}else{const S=this.pointCoordinate(l),C=this.pointCoordinate(v);f=S.x-C.x,_=S.y-C.y}const b=this.locationCoordinate(i);this.setLocation(new s.ac(b.x-f,b.y-_))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i,l){return this.projection.locationPoint(this,i,l)}locationPoint3D(i,l){return this.projection.locationPoint(this,i,l,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i,l){return this.coordinateLocation(this.pointCoordinate3D(i,l))}locationCoordinate(i,l){const f=l?s.cb(l,i.lat):void 0,_=this.projection.project(i.lng,i.lat);return new s.ac(_.x,_.y,f)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(i,l){const f=l??this._centerAltitude,_=[i.x,i.y,0,1],v=[i.x,i.y,1,1];s.aA(_,_,this.pixelMatrixInverse),s.aA(v,v,this.pixelMatrixInverse);const b=v[3];s.cH(_,_,1/_[3]),s.cH(v,v,1/b);const S=_[2],C=v[2];return{p0:_,p1:v,t:S===C?0:(f-S)/(C-S)}}screenPointToMercatorRay(i){const l=[i.x,i.y,0,1],f=[i.x,i.y,1,1];return s.aA(l,l,this.pixelMatrixInverse),s.aA(f,f,this.pixelMatrixInverse),s.cH(l,l,1/l[3]),s.cH(f,f,1/f[3]),l[2]=s.cb(l[2],this._center.lat)*this.worldSize,f[2]=s.cb(f[2],this._center.lat)*this.worldSize,s.cH(l,l,1/this.worldSize),s.cH(f,f,1/this.worldSize),new s.av([l[0],l[1],l[2]],s.au([],s.at([],f,l)))}rayIntersectionCoordinate(i){const{p0:l,p1:f,t:_}=i,v=s.cb(l[2],this._center.lat),b=s.cb(f[2],this._center.lat);return new s.ac(s.ai(l[0],f[0],_)/this.worldSize,s.ai(l[1],f[1],_)/this.worldSize,s.ai(v,b,_))}pointCoordinate(i,l=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,l)}pointCoordinate3D(i,l){if(!this.elevation)return this.pointCoordinate(i,l);let f=this.projection.pointCoordinate3D(this,i.x,i.y);if(f)return new s.ac(f[0],f[1],f[2]);let _=0,v=this.horizonLineFromTop();if(i.y>v)return this.pointCoordinate(i,l);const b=.02*v,S=i.clone();for(let C=0;C<10&&v-_>b;C++){S.y=s.ai(_,v,.66);const k=this.projection.pointCoordinate3D(this,S.x,S.y);k?(v=S.y,f=k):_=S.y}return f?new s.ac(f[0],f[1],f[2]):this.pointCoordinate(i)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=s.cI)return!this.isPointAboveHorizon(i);const l=this.pointCoordinate(i);return l.y>=0&&l.y<=1}_coordinatePoint(i,l){const f=l&&this.elevation?this.elevation.getAtPointOrZero(i,this._centerAltitude):this._centerAltitude,_=[i.x*this.worldSize,i.y*this.worldSize,f+i.toAltitude(),1];return s.aA(_,_,this.pixelMatrix),_[3]>0?new s.P(_[0]/_[3],_[1]/_[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:i,left:l}=this._edgeInsets,f=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,v=this.pointLocation3D(new s.P(l,i)),b=this.pointLocation3D(new s.P(_,i)),S=this.pointLocation3D(new s.P(_,f)),C=this.pointLocation3D(new s.P(l,f));let k=Math.min(v.lng,b.lng,S.lng,C.lng),R=Math.max(v.lng,b.lng,S.lng,C.lng),F=Math.min(v.lat,b.lat,S.lat,C.lat),z=Math.max(v.lat,b.lat,S.lat,C.lat);const N=Math.pow(2,-this.zoom)/16*270,G=this.projection.name==="globe"?1:4,U=(W,Z,re,se,le)=>{const fe=(W+re)/2,we=(Z+se)/2,Se=new s.P(fe,we),{lng:me,lat:ge}=this.pointLocation3D(Se),ye=Math.max(0,k-me,F-ge,me-R,ge-z);k=Math.min(k,me),R=Math.max(R,me),F=Math.min(F,ge),z=Math.max(z,ge),(le<G||ye>N)&&(U(W,Z,fe,we,le+1),U(fe,we,re,se,le+1))};if(U(l,i,_,i,1),U(_,i,_,f,1),U(_,f,l,f,1),U(l,f,l,i,1),this.projection.name==="globe"){const[W,Z]=s.cJ(this);
67W?(z=90,R=180,k=-180):Z&&(F=-90,R=180,k=-180)}return new s.aG(new s.ci(k,F),new s.ci(R,z))}_getBoundsRectangular(i,l){const{top:f,left:_}=this._edgeInsets,v=this.height-this._edgeInsets.bottom,b=this.width-this._edgeInsets.right,S=new s.P(_,f),C=new s.P(b,f),k=new s.P(b,v),R=new s.P(_,v);let F=this.pointCoordinate(S,i),z=this.pointCoordinate(C,i);const N=this.pointCoordinate(k,l),G=this.pointCoordinate(R,l),U=(W,Z)=>(Z.y-W.y)/(Z.x-W.x);return F.y>1&&z.y>=0?F=new s.ac((1-G.y)/U(G,F)+G.x,1):F.y<0&&z.y<=1&&(F=new s.ac(-G.y/U(G,F)+G.x,0)),z.y>1&&F.y>=0?z=new s.ac((1-N.y)/U(N,z)+N.x,1):z.y<0&&F.y<=1&&(z=new s.ac(-N.y/U(N,z)+N.x,0)),new s.aG().extend(this.coordinateLocation(F)).extend(this.coordinateLocation(z)).extend(this.coordinateLocation(G)).extend(this.coordinateLocation(N))}_getBoundsRectangularTerrain(){const i=this.elevation;if(!i.visibleDemTiles.length||i.isUsingMockSource())return this._getBoundsRectangular(0,0);const l=i.visibleDemTiles.reduce((f,_)=>{if(_.dem){const v=_.dem.tree;f.min=Math.min(f.min,v.minimums[0]),f.max=Math.max(f.max,v.maximums[0])}return f},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(l.min*i.exaggeration(),l.max*i.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(i=!0){const l=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,f=this.height/2-l*(1-this._horizonShift);return i?Math.max(0,f):f}getMaxBounds(){return this.maxBounds}setMaxBounds(i){this.maxBounds=i,this.minLat=-s.cG,this.maxLat=s.cG,this.minLng=-180,this.maxLng=180,i&&(this.minLat=i.getSouth(),this.maxLat=i.getNorth(),this.minLng=i.getWest(),this.maxLng=i.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aD(this.minLng)*this.tileSize,this.worldMaxX=s.aD(this.maxLng)*this.tileSize,this.worldMinY=s.aH(this.maxLat)*this.tileSize,this.worldMaxY=s.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,l){return this.projection.createTileMatrix(this,l,i)}calculateDistanceTileData(i){const l=i.key,f=this._distanceTileDataCache;if(f[l])return f[l];const _=i.canonical,v=1/this.height,b=this.cameraWorldSize,S=b/this.zoomScale(_.z),C=(_.x+Math.pow(2,_.z)*i.wrap)*S,k=_.y*S,R=this.point;R.x*=b/this.worldSize,R.y*=b/this.worldSize;const F=this.angle,z=Math.sin(-F),N=-Math.cos(-F);return f[l]={bearing:[z,N],center:[(R.x-C)*v,(R.y-k)*v],scale:S/s.aj*v},f[l]}calculateFogTileMatrix(i){const l=i.key,f=this._fogTileMatrixCache;if(f[l])return f[l];const _=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,i);return s.az(_,this.worldToFogMatrix,_),f[l]=new Float32Array(_),f[l]}calculateProjMatrix(i,l=!1,f=!1){const _=i.key;let v;if(v=f?this._expandedProjMatrixCache:l?this._alignedProjMatrixCache:this._projMatrixCache,v[_])return v[_];const b=this.calculatePosMatrix(i,this.worldSize);let S;return S=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:f?this.expandedFarZProjMatrix:l?this.alignedProjMatrix:this.projMatrix,s.az(b,S,b),v[_]=new Float32Array(b),v[_]}calculatePixelsToTileUnitsMatrix(i){const l=i.tileID.key,f=this._pixelsToTileUnitsCache;if(f[l])return f[l];const _=s.cK(i,this);return f[l]=_,f[l]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const i=1/this.worldSize,l=s.bn([],[i,i,i]);return s.az(l,l,this.globeMatrix),l}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const i=this._elevation;this._updateCameraState();const l=s.cb(1,this._center.lat)*this.worldSize,f=this._computeCameraPosition(l),_=this._camera.forward(),v=s.cb(1,this._center.lat);f[2]/=v,_[2]/=v,s.au(_,_);const b=i.raycast(f,_,i.exaggeration());if(b){const S=s.bE([],f,_,b),C=new s.ac(S[0],S[1],s.cb(S[2],s.aY(S[1]))),k=(C.z+s.ae([C.x-f[0],C.y-f[1],C.z-f[2]*v]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(k),this._centerAltitude=C.toAltitude(),this._center=this.coordinateLocation(C),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(i=!1){if(!this._elevation)return;const l=this._elevation,f=s.cb(1,this._center.lat)*this.worldSize,_=this._computeCameraPosition(f),v=l.getAtPointOrZero(new s.ac(..._)),b=this.pixelsPerMeter/this.worldSize*v,S=this._minimumHeightOverTerrain(),C=_[2]-b;if(C<=S)if(C<0||i){const k=this.locationCoordinate(this._center,this._centerAltitude),R=[_[0],_[1],k.z-_[2]],F=s.ae(R);R[2]-=(S-C)/this._pixelsPerMercatorPixel;const z=s.ae(R);if(z===0)return;s.c1(R,R,F/z*this._pixelsPerMercatorPixel),this._camera.position=[_[0],_[1],k.z*this._pixelsPerMercatorPixel-R[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||i){const z=this.center;return z.lat=s.ay(z.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!i)&&(z.lng=s.ay(z.lng,this.minLng,this.maxLng)),this.center=z,void(this._constraining=!1)}const l=this._unmodified,{x:f,y:_}=this.point;let v=0,b=f,S=_;const C=this.width/2,k=this.height/2,R=this.worldMinY*this.scale,F=this.worldMaxY*this.scale;if(_-k<R&&(S=R+k),_+k>F&&(S=F-k),F-R<this.height&&(v=Math.max(v,this.height/(F-R)),S=(F+R)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const z=this.worldMinX*this.scale,N=this.worldMaxX*this.scale,G=this.worldSize/2-(z+N)/2;b=(f+G+this.worldSize)%this.worldSize-G,b-C<z&&(b=z+C),b+C>N&&(b=N-C),N-z<this.width&&(v=Math.max(v,this.width/(N-z)),b=(N+z)/2)}b===f&&S===_||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(b,S))),v&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(v)),this._constrainCamera(),this._unmodified=l,this._constraining=!1}_minZoomForBounds(){let i=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(i=Math.max(i,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),i}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
67_calcMatrices(){if(!this.height)return;const i=this.centerOffset,l=this.projection.name==="globe",f=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.cb(1,this.center.lat)/s.cb(1,s.c$));const _=s.cL(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,_),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const v=this.projection.zAxisUnit==="meters"?f:1,b=this._camera.getWorldToCamera(this.worldSize,v);let S;const C=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(C[8]=2*-i.x/this.width,C[9]=2*i.y/this.height,this.isOrthographic){let ge=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ye=ge*this.aspect,Ze=-ye,Me=-ge;ye-=i.x,Ze-=i.x,ge+=i.y,Me+=i.y,S=this._camera.getCameraToClipOrthographic(Ze,ye,Me,ge,this._nearZ,this._farZ),((ct,Qe,ft,Rt)=>{for(let We=0;We<16;We++)ct[We]=s.ai(Qe[We],ft[We],Rt)})(S,S,C,s.cZ(this.pitch>=Co?1:this.pitch/Co))}else S=C;const k=s.cM([],C,b);let R=s.cM([],S,b);if(this.projection.isReprojectedInTileSpace){const ge=this.locationCoordinate(this.center),ye=s.bx([]);s.bo(ye,ye,[ge.x*this.worldSize,ge.y*this.worldSize,0]),s.az(ye,ye,s.cN(this)),s.bo(ye,ye,[-ge.x*this.worldSize,-ge.y*this.worldSize,0]),s.az(R,R,ye),s.az(k,k,ye),this.inverseAdjustmentMatrix=s.cO(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cP([],R,[this.worldSize,this.worldSize,this.worldSize/v,1]),this.projMatrix=R,this.invProjMatrix=s.bi(new Float64Array(16),this.projMatrix),l){const ge=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ge[8]=2*-i.x/this.width,ge[9]=2*i.y/this.height,this.expandedFarZProjMatrix=s.cM([],ge,b)}else this.expandedFarZProjMatrix=this.projMatrix;const F=s.bi([],S);this.frustumCorners=s.cQ.fromInvProjectionMatrix(F,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!l);const z=new Float32Array(16);s.bx(z),s.cP(z,z,[1,-1,1]),s.cR(z,z,this._pitch),s.by(z,z,this.angle);const N=s.c9(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bw(N);const G=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;N[8]=2*-i.x/this.width,N[9]=2*(i.y+G)/this.height,this.skyboxMatrix=s.az(z,N,z);const U=this.point,W=U.x,Z=U.y,re=this.width%2/2,se=this.height%2/2,le=Math.cos(this.angle),fe=Math.sin(this.angle),we=W-Math.round(W)+le*re+fe*se,Se=Z-Math.round(Z)+le*se+fe*re,me=new Float64Array(R);if(s.bo(me,me,[we>.5?we-1:we,Se>.5?Se-1:Se,0]),this.alignedProjMatrix=me,R=s.bz(),s.cP(R,R,[this.width/2,-this.height/2,1]),s.bo(R,R,[1,-1,0]),this.labelPlaneMatrix=R,R=s.bz(),s.cP(R,R,[1,-1,1]),s.bo(R,R,[-1,-1,0]),s.cP(R,R,[2/this.width,2/this.height,1]),this.glCoordMatrix=R,this.pixelMatrix=s.az(new Float64Array(16),this.labelPlaneMatrix,k),this._calcFogMatrices(),this._distanceTileDataCache={},R=s.bi(new Float64Array(16),this.pixelMatrix),!R)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=R,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.cS(this);const ge=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.ad(ge,ge,b),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=R;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const i=this.cameraWorldSizeForFog,l=this.cameraPixelsPerMeter,f=this._camera.position,_=1/this.height/this._pixelsPerMercatorPixel,v=[i,i,l];s.c1(v,v,_),s.c1(f,f,-1),s.cT(f,f,v);const b=s.bz();s.bo(b,b,f),s.cP(b,b,v),this.mercatorFogMatrix=b,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,l,_)}_computeCameraPosition(i){const l=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,f=this._camera.forward(),_=this.point,v=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*l-i/this.worldSize*this._centerAltitude;return[_.x/this.worldSize-f[0]*v,_.y/this.worldSize-f[1]*v,i/this.worldSize*this._centerAltitude-f[2]*v]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(i){const l=this._maxCameraBoundsDistance()*Math.cos(this._pitch),f=this._camera.position[2],_=i[2];let v=1;this.projection.wrap&&(this.center=this.center.wrap()),_>0&&(v=Math.min((l-f)/_,1)),this._camera.position=s.bE([],this._camera.position,i,v),this._updateStateFromCamera()}_updateStateFromCamera(){const i=this._camera.position,l=this._camera.forward(),{pitch:f,bearing:_}=this._camera.getPitchBearing(),v=s.cb(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,b=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.al(this._maxPitch)),S=Math.max((i[2]-v)/Math.cos(f),b),C=this._zoomFromMercatorZ(S);s.bE(i,i,l,S),this._pitch=s.ay(f,s.al(this.minPitch),s.al(this.maxPitch)),this.angle=s.bQ(_,-Math.PI,Math.PI),this._setZoom(s.ay(C,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ac(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){const i=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,i)*this.tileSize))}zoomFromMercatorZAdjusted(i){let l=0,f=s.cI,_=0,v=1/0;for(;f-l>1e-6&&f>l;){const b=l+.5*(f-l),S=this.tileSize*Math.pow(2,b),C=this.getCameraToCenterDistance(this.projection,b,S),k=this.scaleZoom(C/(Math.max(0,i)*this.tileSize)),R=Math.abs(b-k);R<v&&(v=R,_=b),b<k?l=b:f=b}return _}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(i,l){const f=Math.min(i.x,l.x),_=Math.max(i.x,l.x),v=Math.min(i.y,l.y),b=Math.max(i.y,l.y);if(v<this.horizonLineFromTop(!1))return!0;
67if(this.projection.name!=="mercator")return!1;const S=[new s.P(f,v),new s.P(_,b),new s.P(f,b),new s.P(_,v)],C=this.renderWorldCopies?-3:0,k=this.renderWorldCopies?4:1;for(const R of S){const F=this.pointRayIntersection(R);if(F.t<0)return!0;const z=this.rayIntersectionCoordinate(F);if(z.x<C||z.y<0||z.x>k||z.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cU(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(i,l){const f=s.ae(s.at([],this._camera.position,i)),_=this._zoomFromMercatorZ(f)+l;return f-this._mercatorZfromZoom(_)}getCameraPoint(){if(this.projection.name==="globe"){const i=function([l,f,_],v){const b=[l,f,_,1];s.aA(b,b,v);const S=b[3]=Math.max(b[3],1e-6);return b[0]/=S,b[1]/=S,b[2]/=S,b}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(i[0],i[1])}{const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,i))}}getCameraToCenterDistance(i,l=this.zoom,f=this.worldSize){const _=s.cL(i,l,this.width,this.height,1024),v=i.pixelSpaceConversion(this.center.lat,f,_);let b=.5/Math.tan(.5*this._fov)*this.height*v;return this.isOrthographic&&(b=s.ai(1,b,s.cZ(this.pitch>=Co?1:this.pitch/Co))),b}getWorldToCameraMatrix(){const i=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.az(i,i,this.globeMatrix),i}getFrustum(i){return s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,this.projection.zAxisUnit==="meters")}}const Rl=(d,i)=>{if(i>0&&d.terrain&&s.w("Cutoff is currently disabled on terrain"),i<=0||d.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const l=d.transform,f=Math.max(Math.abs(l._zoom-(d.minCutoffZoom-1)),1),_=l.isLODDisabled(!1)?s.af(60,45,l.pitch):s.af(30,15,l.pitch),v=l._farZ-l._nearZ,b=i*l.height,S=((1-(C=_))*l.cameraToCenterDistance+C*(l._farZ+b))*f;var C;return{shouldRenderCutoff:_<1,uniformValues:{u_cutoff_params:[l._nearZ,l._farZ,(S-l._nearZ)/v,(S-b-l._nearZ)/v]}}},Jo={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class Mf{constructor(i,l){this.aabb=i,this.lastCascade=l}}class yI{add(i,l){const f=this.receivers[i.key];f!==void 0?(f.aabb.min[0]=Math.min(f.aabb.min[0],l.min[0]),f.aabb.min[1]=Math.min(f.aabb.min[1],l.min[1]),f.aabb.min[2]=Math.min(f.aabb.min[2],l.min[2]),f.aabb.max[0]=Math.max(f.aabb.max[0],l.max[0]),f.aabb.max[1]=Math.max(f.aabb.max[1],l.max[1]),f.aabb.max[2]=Math.max(f.aabb.max[2],l.max[2])):this.receivers[i.key]=new Mf(l,null)}clear(){this.receivers={}}get(i){return this.receivers[i.key]}computeRequiredCascades(i,l,f){const _=s.d6.fromPoints(i.points);let v=0;for(const b in this.receivers){const S=this.receivers[b];if(!S||!_.intersectsAabb(S.aabb))continue;S.aabb.min=_.closestPoint(S.aabb.min),S.aabb.max=_.closestPoint(S.aabb.max);const C=S.aabb.getCorners();for(let k=0;k<f.length;k++){let R=!0;for(const F of C){const z=[F[0]*l,F[1]*l,F[2]];if(s.ad(z,z,f[k].matrix),z[0]<-1||z[0]>1||z[1]<-1||z[1]>1){R=!1;break}}if(S.lastCascade=k,v=Math.max(v,k),R)break}}return v+1}}class vI{constructor(i){this.painter=i,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new yI,this._depthMode=new Yt(i.context.gl.LEQUAL,Yt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,i.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),i.tp.registerParameter(Jo,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),i.tp.registerParameter(Jo,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),i.tp.registerParameter(Jo,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),i.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const i of this._cascades)i.texture.destroy(),i.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,l){const f=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!l||!l.properties)return;const _=l.properties.get("shadow-intensity");if(!l.shadowsEnabled()||_<=0||(this._shadowLayerCount=f.style.order.reduce((G,U)=>{const W=f.style._mergedLayers[U];return G+(W.hasShadowPass()&&!W.isHidden(i.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const v=f.context,b=Jo.shadowMapResolution,S=Jo.shadowMapResolution;if(this._cascades.length===0||Jo.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let G=0;G<Jo.cascadeCount;++G){const U=f._shadowMapDebug,W=v.gl,Z=v.createFramebuffer(b,S,U,"texture"),re=ne
67w s.T(v,{width:b,height:S,data:null},W.DEPTH_COMPONENT16);if(Z.depthAttachment.set(re.texture),U){const se=new s.T(v,{width:b,height:S,data:null},W.RGBA8);Z.colorAttachment.set(se.texture)}this._cascades.push({framebuffer:Z,texture:re,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cy,scale:0})}}this.shadowDirection=Wh(l);let C=0;if(i.elevation){const G=i.elevation,U=[1e4,-1e4];G.visibleDemTiles.filter(W=>W.dem).forEach(W=>{const Z=W.dem.tree;U[0]=Math.min(U[0],Z.minimums[0]),U[1]=Math.max(U[1],Z.maximums[0])}),U[0]!==1e4&&(C=(U[1]-U[0])*G.exaggeration())}const k=1.5*i.cameraToCenterDistance,R=3*k,F=new Float64Array(16);for(let G=0;G<this._cascades.length;++G){const U=this._cascades[G];let W=i.height/50,Z=1;Jo.cascadeCount===1?Z=R:G===0?Z=k:(W=k,Z=R);const[re,se]=Xh(i,this.shadowDirection,W,Z,Jo.shadowMapResolution,C);U.scale=i.scale,U.matrix=re,U.boundingSphereRadius=se,s.bi(F,U.matrix),U.frustum=s.cy.fromInvProjectionMatrix(F,1,0,!0),U.far=Z}const z=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[z].far,this._cascades[z].far],this._uniformValues.u_shadow_intensity=_,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Jo.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Jo.shadowMapResolution,this._uniformValues.u_shadowmap_0=fs.ShadowMap0,this._uniformValues.u_shadowmap_1=fs.ShadowMap0+1,this._groundShadowTiles=f.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const N=f.transform.elevation;for(const G of this._groundShadowTiles){let U={min:0,max:0};if(N){const W=N.getMinMaxForTile(G);W&&(U=W)}this.addShadowReceiver(G.toUnwrapped(),U.min,U.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(i){this._enabled=i}drawShadowPass(i,l){if(!this.enabled)return;const f=this.painter,_=f.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(f.transform.getFrustum(0),f.transform.worldSize,this._cascades),_.viewport.set([0,0,Jo.shadowMapResolution,Jo.shadowMapResolution]);for(let v=0;v<this._numCascadesToRender;++v){f.currentShadowCascade=v,_.bindFramebuffer.set(this._cascades[v].framebuffer.framebuffer),_.clear({color:s.am.white,depth:1});for(const b of i.order){const S=i._mergedLayers[b];if(!S.hasShadowPass()||S.isHidden(f.transform.zoom))continue;const C=i.getLayerSourceCache(S),k=C?l[C.id]:void 0;(S.type==="model"||k&&k.length)&&f.renderLayer(f,C,S,k)}}f.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const i=this.painter,l=i.style,f=i.context,_=f.gl,v=l.directionalLight,b=l.ambientLight;if(!v||!b)return;const S=[],C=Rl(i,i.longestCutoffRange);C.shouldRenderCutoff&&S.push("RENDER_CUTOFF"),S.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&S.push("NORMAL_OFFSET");const k=Nu(l,v,b),R=new Yt(_.LEQUAL,Yt.ReadOnly,i.depthRangeFor3D),F=new Cr({func:_.EQUAL,mask:255},0,255,_.KEEP,_.KEEP,_.KEEP);for(const z of this._groundShadowTiles){const N=z.toUnwrapped(),G=i.isTileAffectedByFog(z),U=i.getOrCreateProgram("groundShadow",{defines:S,overrideFog:G});this.setupShadows(N,U),i.uploadCommonUniforms(f,U,N,null,C);const W={u_matrix:i.transform.calculateProjMatrix(N),u_ground_shadow_factor:k};U.draw(i,_.TRIANGLES,R,F,Br.multiply,vr.disabled,W,"ground_shadow",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments,null,i.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Br.unblended:Br.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(i){const l=this.painter.transform,f=l.calculatePosMatrix(i,l.worldSize);return s.az(f,this._cascades[this.painter.currentShadowCascade].matrix,f),Float32Array.from(f)}calculateShadowPassMatrixFromMatrix(i){return s.az(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}setupShadows(i,l,f){if(!this.enabled)return;const _=this.painter.transform,v=this.painter.context,b=v.gl,S=this._uniformValues,C=new Float64Array(16),k=_.calculatePosMatrix(i,_.worldSize);for(let R=0;R<this._cascades.length;R++)s.az(C,this._cascades[R].matrix,k),S[R===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(C),v.activeTexture.set(b.TEXTURE0+fs.ShadowMap0+R),this._cascades[R].texture.bindExtraParam(b.LINEAR,b.LINEAR,b.CLAMP_TO_EDGE,b.CLAMP_TO_EDGE,b.GREATER);if(this.useNormalOffset=!!f,this.useNormalOffset){const R=s.d4(i.canonical),F=2/_.tileSize*s.aj/Jo.shadowMapResolution,z=F*this._cascades[0].boundingSphereRadius,N=F*this._cascades[this._cascades.length-1].boundingSphereRadius,G=(f==="vector-tile"?1:3)*function(U,W,Z,re,se){const le=s.ay((U-22)/-22,0,1
67);return .125*(1-le)+4*le}(_.zoom);S.u_shadow_normal_offset=[R,z*G,N*G],S.u_shadow_bias=[1e-4,.0012,.012]}else S.u_shadow_bias=[36e-5,.0012,.012];l.setShadowUniformValues(v,S)}setupShadowsFromMatrix(i,l,f=!1){if(!this.enabled)return;const _=this.painter.context,v=_.gl,b=this._uniformValues,S=new Float64Array(16);for(let C=0;C<Jo.cascadeCount;C++)s.az(S,this._cascades[C].matrix,i),b[C===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(S),_.activeTexture.set(v.TEXTURE0+fs.ShadowMap0+C),this._cascades[C].texture.bindExtraParam(v.LINEAR,v.LINEAR,v.CLAMP_TO_EDGE,v.CLAMP_TO_EDGE,v.GREATER);if(this.useNormalOffset=f,f){const C=Jo.normalOffset;b.u_shadow_normal_offset=[1,C,C],b.u_shadow_bias=[6e-5,.0012,.012]}else b.u_shadow_bias=[36e-5,.0012,.012];l.setShadowUniformValues(_,b)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,l,f,_){if(_[2]>=0)return{};const v=function(C,k,R){const F=R/(1<<C.canonical.z);return new s.d6([C.canonical.x*F+C.wrap*R,C.canonical.y*F+C.wrap*R,0],[(C.canonical.x+1)*F+C.wrap*R,(C.canonical.y+1)*F+C.wrap*R,k])}(i,l,f).getCorners(),b=l/-_[2];_[0]<0?(s.d5(v[0],v[0],[_[0]*b,0,0]),s.d5(v[3],v[3],[_[0]*b,0,0])):_[0]>0&&(s.d5(v[1],v[1],[_[0]*b,0,0]),s.d5(v[2],v[2],[_[0]*b,0,0])),_[1]<0?(s.d5(v[0],v[0],[0,_[1]*b,0]),s.d5(v[1],v[1],[0,_[1]*b,0])):_[1]>0&&(s.d5(v[2],v[2],[0,_[1]*b,0]),s.d5(v[3],v[3],[0,_[1]*b,0]));const S={};return S.vertices=v,S.planes=[jc(v[1],v[0],v[4]),jc(v[2],v[1],v[5]),jc(v[3],v[2],v[6]),jc(v[0],v[3],v[7])],S}addShadowReceiver(i,l,f){this._receivers.add(i,s.d6.fromTileIdAndHeight(i,l,f))}getMaxCascadeForTile(i){const l=this._receivers.get(i);return l&&l.lastCascade?l.lastCascade:0}}function jc(d,i,l){const f=s.at([],l,i),_=s.at([],d,i),v=s.bF([],f,_),b=s.ae(v);return b===0?[0,0,1,0]:(s.c1(v,v,1/b),[v[0],v[1],v[2],-s.bG(v,i)])}function Wh(d){const i=d.properties.get("direction"),l=s.d1(i.x,i.y,i.z);l[2]=s.ay(l[2],0,75);const f=s.d3([l[0],l[1],l[2]]);return s.d2(f.x,f.y,f.z)}function Nu(d,i,l){const f=i.properties.get("color-use-theme")==="none",_=i.properties.get("color"),v=i.properties.get("intensity"),b=i.properties.get("direction"),S=[b.x,b.y,b.z],C=l.properties.get("color-use-theme")==="none",k=l.properties.get("color"),R=l.properties.get("intensity"),F=Math.max(s.bG([0,0,1],S),0),z=[0,0,0];s.c1(z,k.toPremultipliedRenderColor(C?null:d.getLut(i.scope)).toArray01Linear().slice(0,3),R);const N=[0,0,0];return s.c1(N,_.toPremultipliedRenderColor(f?null:d.getLut(l.scope)).toArray01Linear().slice(0,3),F*v),s.d8([z[0]>0?z[0]/(z[0]+N[0]):0,z[1]>0?z[1]/(z[1]+N[1]):0,z[2]>0?z[2]/(z[2]+N[2]):0])}function Xh(d,i,l,f,_,v){const b=d.zoom,S=d.scale,C=d.worldSize,k=1/C,R=d.aspect,F=Math.sqrt(1+R*R)*Math.tan(.5*d.fovX),z=F*F,N=f-l,G=f+l;let U,W;z>N/G?(U=f,W=f*F):(U=.5*G*(1+z),W=.5*Math.sqrt(N*N+2*(f*f+l*l)*z+G*G*z*z));const Z=d.projection.pixelsPerMeter(d.center.lat,C),re=d._camera.getCameraToWorldMercator(),se=[0,0,-U*k];s.ad(se,se,re);let le=W*k;const fe=d._edgeInsets;if(!(fe.left===0&&fe.top===0&&fe.right===0&&fe.bottom===0||fe.left===fe.right&&fe.top===fe.bottom)){const vt=d._camera.getWorldToCamera(d.worldSize,d.projection.zAxisUnit==="meters"?Z:1),xt=d._camera.getCameraToClipPerspective(d._fov,d.width/d.height,l,f);xt[8]=2*-d.centerOffset.x/d.width,xt[9]=2*d.centerOffset.y/d.height;const Et=new Float64Array(16);s.cM(Et,xt,vt);const Bt=new Float64Array(16);s.bi(Bt,Et);const ir=s.cy.fromInvProjectionMatrix(Bt,C,b,!0);for(const ur of ir.points){const Zt=((we=ur)[0]/=S,we[1]/=S,we[2]=s.cb(we[2],d._center.lat),we);le=Math.max(le,s.c2(s.d7([],se,Zt)))}}var we;le*=_/(_-1);const Se=Math.acos(i[2]),me=Math.atan2(-i[0],-i[1]),ge=new Na;ge.position=se,ge.setPitchBearing(Se,me);const ye=ge.getWorldToCamera(C,Z),Ze=le*C,Me=Math.min(d._mercatorZfromZoom(17)*C*-2,-2*Ze),ct=ge.getCameraToClipOrthographic(-Ze,Ze,-Ze,Ze,Me,(Ze+v*Z)/i[2]),Qe=new Float64Array(16);s.az(Qe,ct,ye);const ft=s.d2(Math.floor(1e6*se[0])/1e6*C,Math.floor(1e6*se[1])/1e6*C,0),Rt=.5*_,We=[0,0,0];s.ad(We,ft,Qe),s.c1(We,We,Rt);const Pe=[Math.floor(We[0]),Math.floor(We[1]),Math.floor(We[2])],nt=[0,0,0];s.at(nt,We,Pe),s.c1(nt,nt,-1/Rt);const Ke=new Float64Array(16);return s.bx(Ke),s.bo(Ke,Ke,nt),s.az(Qe,Ke,Qe),[Qe,Ze]}class Sb extends s.E{constructor(i){super(),this.requestManager=i,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(i,l){return s.aS(this.requestManager.transformRequest(l,s.R.Model).url).then(f=>{if(!f)return;const _=s.aT(f),v=new s.aU(i,void 0,void 0,_);return v.computeBoundsAndApplyParent(),v}).catch(f=>{if(f&&f.status===404)return null;this.fire(new s.z(new Error(`Could not load model ${i} from ${l}: ${f.message}`)))})}load(i,l,f={forceReload:!1}){this.models[l]||(this.models[l]={});const _=Object.keys(i),v=[],b=[];for(const S of _){const C=i[S];this.hasURLBeenRequested(C)&&!f.forceReload||(this.modelByURL[C]={modelId:S,scope:l}
67,v.push(this.loadModel(S,C)),b.push(S)),this.models[l][S]||(this.models[l][S]={model:null,numReferences:1})}this.numModelsLoading[l]=(this.numModelsLoading[l]||0)+b.length,Promise.allSettled(v).then(S=>{for(let C=0;C<S.length;C++){const{status:k}=S[C];if(k==="rejected")continue;const{value:R}=S[C];this.models[l][b[C]]||(this.models[l][b[C]]={model:null,numReferences:1}),this.models[l][b[C]].model=R}this.numModelsLoading[l]-=b.length,this.fire(new s.A("data",{dataType:"style"}))}).catch(S=>{this.fire(new s.z(new Error(`Could not load models: ${S.message}`)))})}isLoaded(){for(const i in this.numModelsLoading)if(this.numModelsLoading[i]>0)return!1;return!0}hasModel(i,l,f={exactIdMatch:!1}){return!!(f.exactIdMatch?this.getModel(i,l):this.getModelByURL(this.modelUris[l][i]))}getModel(i,l){return this.models[l]||(this.models[l]={}),this.models[l][i]?this.models[l][i].model:void 0}getModelByURL(i){if(!i)return null;const l=this.modelByURL[i];return l?this.models[l.scope][l.modelId].model:null}hasModelBeenAdded(i,l){return this.models[l]&&this.models[l][i]!==void 0}getModelURIs(i){return this.modelUris[i]||{}}addModel(i,l,f){this.models[f]||(this.models[f]={}),this.modelUris[f]||(this.modelUris[f]={});const _=this.requestManager.normalizeModelURL(l);if((this.hasModel(i,f,{exactIdMatch:!0})||this.hasModelBeenAdded(i,f))&&this.modelUris[f][i]===_)this.models[f][i].numReferences++;else if(this.hasURLBeenRequested(_)){const{scope:v,modelId:b}=this.modelByURL[_];this.models[v][b].numReferences++}else this.modelUris[f][i]=_,this.load({[i]:this.modelUris[f][i]},f)}addModelURLs(i,l){this.models[l]||(this.models[l]={}),this.modelUris[l]||(this.modelUris[l]={});const f=this.modelUris[l];for(const _ in i)f[_]=this.requestManager.normalizeModelURL(i[_])}reloadModels(i){this.load(this.modelUris[i],i,{forceReload:!0})}addModelsFromBucket(i,l){this.models[l]||(this.models[l]={}),this.modelUris[l]||(this.modelUris[l]={});const f={};for(const _ of i)this.hasModel(_,l,{exactIdMatch:!0})||this.hasURLBeenRequested(_)?this.models[l][_].numReferences++:this.modelUris[l][_]&&!this.hasURLBeenRequested(_)?f[_]=this.modelUris[l][_]:!this.hasURLBeenRequested(_)&&s.d9(_,!1)&&(this.modelUris[l][_]=this.requestManager.normalizeModelURL(_),f[_]=this.modelUris[l][_]);this.load(f,l)}hasURLBeenRequested(i){return this.modelByURL[i]!==void 0}removeModel(i,l,f=!1,_=!1){if(this.models[l]&&this.models[l][i]&&(this.models[l][i].numReferences--,this.models[l][i].numReferences===0||_)){const v=this.modelUris[l][i];f||delete this.modelUris[l][i],delete this.modelByURL[v];const b=this.models[l][i].model;if(!b)return;delete this.models[l][i],b.destroy()}}destroy(){for(const i of Object.keys(this.models))for(const l of Object.keys(this.models[i])){const f=this.models[i][l].model;delete this.models[i][l],f&&f.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(i){return this.models[i]||(this.models[i]={}),Object.keys(this.models[i])}upload(i,l){this.models[l]||(this.models[l]={});for(const f in this.models[l])this.models[l][f].model&&this.models[l][f].model.upload(i.context)}}const ym=new s.a7({data:new s.a8(s.a5.colorTheme.data)});class Ry{constructor(i){this._scope=i,this._buildingQueryParams={target:{featuresetId:"building-outline",importId:this._scope}},this._floorQueryParams={target:{featuresetId:"floor-outline",importId:this._scope}}}execute(i){const l=this._makeBuildingsQueryArea(i),f=this._makeFloorsQueryArea(i),_=i.queryRenderedFeatures(l,this._buildingQueryParams).filter(S=>S.properties.shape_type==="building").reduce((S,C)=>{const k=C.properties.id;return C.properties.shape_type!=="building"||S.some(R=>R.properties.id===k)||S.push(C),S},[]),v=i.queryRenderedFeatures(f,this._floorQueryParams).filter(S=>S.properties.shape_type==="floor").reduce((S,C)=>{const k=C.properties.id;return C.properties.shape_type!=="floor"||S.some(R=>R.properties.id===k)||S.push(C),S},[]),b=[i.getCenter().lng,i.getCenter().lat];return{floors:v,building:this._findBuildingAtCenter(b,_)||(_.length>0?_[0]:null)}}_makeBuildingsQueryArea(i){const l=i.transform.width,f=i.transform.height,_=Math.min(l,f),v=_*(1/8),b=_*(1/8),S=.5*(l-v),C=.5*(f-b);return[new s.P(S,C),new s.P(S+v,C+b)]}_makeFloorsQueryArea(i){const l=i.transform.width,f=i.transform.height,_=l*(2/3),v=f*(2/3),b=.5*(l-_),S=.5*(f-v);return[new s.P(b,S),new s.P(b+_,S+v)]}_findBuildingAtCenter(i,l){for(const f of l)if(f.geometry.type==="Polygon"&&this._pointInPolygon(i,f.geometry.coordinates[0]))return f;return null}_pointInPolygon(i,l){let f=!1;for(let _=0,v=l.length-1;_<l.length;v=_++){const b=l[_][0],S=l[_][1],C=l[v][1];S>i[1]!=C>i[1]&&i[0]<(l[v][0]-b)*(i[1]-S)/(C-S)+b&&(f=!f)}return f}}class Gc{constructor(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}setBuildingId(i){this._selectedBuildingId=i}
67setFloors(i){if(this._floors=i.filter(l=>l.properties.building_id===this._selectedBuildingId),!this._selectedFloorId||!this._floors.map(l=>l.properties.id).includes(this._selectedFloorId)){const l=this._floors.map(f=>({id:f.properties.id,level:f.properties.floor_level})).reduce((f,_)=>{const v=Math.abs(f.level-1),b=Math.abs(_.level-1);return b<v||b===v&&_.level>f.level?_:f});this._selectedFloorId=l.id}}setFloorId(i){this._selectedFloorId=i}getSelectedFloorId(){return this._selectedFloorId}getCurrentBuildingFloors(){return this._floors}reset(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}}const xI={"mbx-indoor-level-selected":{default:["literal",[]]}};function Cb(d){return d=d||{},Object.assign(d,xI)}class bI extends s.E{constructor(i){super(),s.aV(["_onLoad","_onMove"],this),this._map=i,this._floorSelectionState=new Gc,this._queryIndoor(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=null,this._floorSelectionState=null}_onLoad(){this._map.style.forEachFragmentStyle(i=>{i.stylesheet.indoor&&(this._indoorDataQuery?this.fire(new s.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._scope=i.scope,this._indoorDataQuery=new Ry(this._scope)))}),this._map._addIndoorControl(),this._queryIndoor()}_onMove(){this._queryIndoor()}_queryIndoor(){if(!this._indoorDataQuery||!this._map.isStyleLoaded())return;if(this._map.transform.zoom<16)return void this._clearIndoorData();const i=this._indoorDataQuery.execute(this._map);i&&i.floors.length!==0?(this._floorSelectionState.getSelectedFloorId()||this._map._addIndoorControl(),this._selectFloors(i)):this._clearIndoorData()}
67_selectFloors(i){if(i.building)this._floorSelectionState.setBuildingId(i.building.properties.id),this._floorSelectionState.setFloors(i.floors),this._updateUI();else{const l=this._floorSelectionState.getSelectedFloorId();if(l&&i.floors.some(f=>f.properties.id===l))return;this._clearIndoorData()}}_clearIndoorData(){this._floorSelectionState.reset(),this._map._removeIndoorControl(),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[]])}_updateUI(){const i=this._floorSelectionState.getCurrentBuildingFloors().map(f=>({id:f.properties.id,name:f.properties.name,shortName:f.properties.floor_level,levelOrder:f.properties.floor_level})),l=this._floorSelectionState.getSelectedFloorId();l?(this._updateIndoorConfig(),this.fire(new s.A("indoorupdate",{selectedFloorId:l,floors:i}))):console.warn("IndoorManager: Selected floor is not set")}_updateIndoorConfig(){const i=this._floorSelectionState.getSelectedFloorId();i?this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[i]]):console.warn("IndoorManager: Selected floor is not set")}selectFloor(i){this._floorSelectionState.setFloorId(i),this._updateIndoorConfig()}}function Ib(d){if(!d.metadata||!d.metadata.content_area)return;const i=s.q.devicePixelRatio,{left:l,top:f,width:_,height:v}=d.metadata.content_area,b=l*i,S=f*i;return[b,S,b+_*i,S+v*i]}function Ab(d){if(d)return d.map(([i,l])=>[i*s.q.devicePixelRatio,l*s.q.devicePixelRatio])}class Ly{constructor(i,l,f){this.id=i,this.scope=l,this.sourceCache=f,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(i){this.missingRequests.has(i.name)||this.pendingRequests.has(i.name)||this.pendingRequests.add(i.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const i=new Map;if(!this.sourceCache.loaded())return i;const l=this.sourceCache.getVisibleCoordinates();if(l.length===0)return i;const f=this.sourceCache.getSource();if(!(f instanceof zi))return i;const _=l.map(b=>this.sourceCache.getTile(b)),v=f.getImages(_,Array.from(this.pendingRequests));for(const[b,S]of v)i.set(s.I.from({name:b,iconsetId:this.id}),S),this.pendingRequests.delete(b);for(const b of this.pendingRequests)this.missingRequests.add(b);return this.pendingRequests.clear(),i}}const $c=(d,i)=>J(d,i&&i.filter(l=>l.identifier!=="source.canvas")),Pb=s.aF(fi,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Mb=s.aF(fi,["setCenter","setZoom","setBearing","setPitch"]),vm=new Set(["background","sky","slot","custom"]),Hc={version:8,layers:[],sources:{}},kf={duration:300,delay:0};class Ba extends s.E{constructor(i,l={}){super(),this.map=i,this.scope=l.scope||"",this.globalId=null,this.fragments=[],this.importDepth=l.importDepth||0,this.importsCache=l.importsCache||new Map,this.resolvedImports=l.resolvedImports||new Set,this.transition=s.h({},kf),this._buildingIndex=new _b(this),this.crossTileSymbolIndex=new Cs,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=l.styleChanges||new tn,this.dispatcher=l.dispatcher?l.dispatcher:new s.D(s.db(),this),l.imageManager?this.imageManager=l.imageManager:(this.imageManager=new Xr(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=l.glyphManager?l.glyphManager:new s.dc(i._requestManager,l.localFontFamily?s.dd.all:l.localIdeographFontFamily?s.dd.ideographs:s.dd.none,l.localFontFamily||l.localIdeographFontFamily),l.modelManager?this.modelManager=l.modelManager:(this.modelManager=new Sb(i._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={}
67,this._order=[],this._markersNeedUpdate=!1,this.options=l.configOptions?l.configOptions:new Map,this._configDependentLayers=l.configDependentLayers?l.configDependentLayers:new Set,this._config=l.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:l.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=l.initialConfig,this.dispatcher.broadcast("setReferrer",s.de());const f=this;this._rtlTextPluginCallback=Ba.registerForPluginStateChange(_=>{f.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:_.pluginStatus,pluginURL:_.pluginURL},(v,b)=>{if(s.df(v),b&&b.every(S=>S))for(const S in f._sourceCaches){const C=f._sourceCaches[S],k=C.getSource().type;k!=="vector"&&k!=="geojson"||C.reload()}})}),this.on("data",_=>{if(_.dataType!=="source"||_.sourceDataType!=="metadata")return;const v=this.getOwnSource(_.sourceId);if(v&&v.vectorLayerIds)for(const b in this._layers){const S=this._layers[b];S.source===v.id&&this._validateLayer(S)}})}load(i){return i?(typeof i=="string"?this.loadURL(i):this.loadJSON(i),this):this}_getGlobalId(i){if(!i)return null;if(typeof i=="string"){if(s.j(i))return i;const l=s.dg(i);if(!l.startsWith("http"))try{return new URL(l,location.href).toString()}catch{return l}return l}return`json://${s.dh(JSON.stringify(i))}`}_diffStyle(i,l,f){this.globalId=this._getGlobalId(i);const _=(v,b)=>{try{b(null,this.setState(v,f))}catch(S){b(S,!1)}};if(typeof i=="string"){const v=this.map._requestManager.normalizeStyleURL(i),b=this.map._requestManager.transformRequest(v,s.R.Style);s.n(b,(S,C)=>{S?this.fire(new s.z(S)):C&&_(C,l)})}else typeof i=="object"&&_(i,l)}loadURL(i,l={}){this.fire(new s.A("dataloading",{dataType:"style"}));const f=typeof l.validate=="boolean"?l.validate:!s.j(i);this.globalId=this._getGlobalId(i),i=this.map._requestManager.normalizeStyleURL(i,l.accessToken),this.resolvedImports.add(i);const _=this.importsCache.get(i);if(_)return this._load(_,f);const v=this.map._requestManager.transformRequest(i,s.R.Style);this._request=s.n(v,(b,S)=>{if(this._request=null,b)this.fire(new s.z(b));else if(S)return this.importsCache.set(i,S),this._load(S,f)})}loadJSON(i,l={}){this.fire(new s.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(i),this._request=s.q.frame(()=>{this._request=null,this._load(i,l.validate!==!1)})}loadEmpty(){this.fire(new s.A("dataloading",{dataType:"style"})),this._load(Hc,!1)}_loadImports(i,l,f){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const _=[];for(const v of i){const b=this._createFragmentStyle(v),S=new Promise(R=>{b.once("style.import.load",R),b.once("error",R)}).then(()=>this.mergeAll());if(_.push(S),this.resolvedImports.has(v.url)){b.loadEmpty();continue}const C=v.data||this.importsCache.get(v.url);C?(b.loadJSON(C,{validate:l}),this._isInternalStyle(C)&&(b.globalId=null)):v.url?b.loadURL(v.url,{validate:l}):b.loadEmpty();const k={style:b,id:v.id,config:v.config};if(f){const R=this.fragments.findIndex(({id:F})=>F===f);this.fragments=this.fragments.slice(0,R).concat(k).concat(this.fragments.slice(R))}else this.fragments.push(k)}return Promise.allSettled(_)}getImportGlobalIds(i=this,l=new Set){for(const f of i.fragments)f.style.globalId&&l.add(f.style.globalId),this.getImportGlobalIds(f.style,l);return[...l.values()]}_createFragmentStyle(i){const l=this.scope?s.C(i.id,this.scope):i.id;let f;const _=this._initialConfig&&this._initialConfig[l];(i.config||_)&&(f=s.h({},i.config,_));const v=new Ba(this.map,{scope:l,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:f,configOptions:this.options,colorThemeOverride:i["color-theme"],configDependentLayers:this._configDependentLayers});return v.setEventedParent(this.map,{style:v}),v}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(i){return this.isRootStyle()&&(i.fragment||!!i.schema&&i.fragment!==!1)}_load(i,l){const f=i.indoor?Cb(i.schema):i.schema;if(this._isInternalStyle(i)){const b=s.h({},Hc,{imports:[{id:"basemap",data:i,url:""}]});return void this._load(b,l)}if(this.updateConfig(this._config,f),l&&$c(this,wo(i)))return;this._loaded=!0,this.stylesheet=s.di(i);const _=()=>{for(const k in i.sources)this.addSource(k,i.sources[k],{validate:!1,isInitialLoad:!0});if(i.iconsets)for(const k in i.iconsets)this.addIconset(k,i.iconsets[k]);i.sprite?this._loadIconset(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&i.glyphs&&this.glyphManager.setURL(i.glyphs);
67const b=_f(this.stylesheet.layers);if(this._order=b.map(k=>k.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const k=this.stylesheet.lights[0];this.light=new Ce(k.properties,k.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Ce(this.stylesheet.light)),this._layers={};for(const k of b){const R=s.dn(k,this.scope,this._styleColorTheme.lut,this.options);R.configDependencies.size!==0&&this._configDependentLayers.add(R.fqid),R.setEventedParent(this,{layer:{id:R.id}}),this._layers[R.id]=R;const F=this.getOwnLayerSourceCache(R),z=!!this.directionalLight&&this.directionalLight.shadowsEnabled();F&&R.canCastShadows()&&z&&(F.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const S=this.stylesheet.terrain;S&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(S,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.A("data",{dataType:"style"}));const C=this.isRootStyle();i.imports?this._loadImports(i.imports,l).then(()=>{this._reloadImports(),this.fire(new s.A(C?"style.load":"style.import.load"))}).catch(k=>{this.fire(new s.z(new Error("Failed to load imports",k))),this.fire(new s.A(C?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.A(C?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const v=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(v){const b=this._evaluateColorThemeData(v);this._loadColorTheme(b).then(()=>{_()}).catch(S=>{s.w(`Couldn't load color theme from the stylesheet: ${S}`),_()})}else this._styleColorTheme.lut=null,_()}isRootStyle(){return this.importDepth===0}mergeAll(){let i,l,f,_,v,b,S,C,k,R;const F={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(z=>{if(z.stylesheet){if(z.light!=null&&(i=z.light),z.stylesheet.lights)for(const N of z.stylesheet.lights)N.type==="ambient"&&z.ambientLight!=null&&(l=z.ambientLight),N.type==="directional"&&z.directionalLight!=null&&(f=z.directionalLight);_=this._prioritizeTerrain(_,z.terrain,z.stylesheet.terrain),z.stylesheet.fog&&z.fog!=null&&(v=z.fog),z.stylesheet.snow&&z.snow!=null&&(b=z.snow),z.stylesheet.rain&&z.rain!=null&&(S=z.rain),z.stylesheet.camera!=null&&(R=z.stylesheet.camera),z.stylesheet.projection!=null&&(C=z.stylesheet.projection),z.stylesheet.transition!=null&&(k=z.stylesheet.transition),F[z.scope]=z._styleColorTheme}}),this.light=i,this.ambientLight=l,this.directionalLight=f,this.fog=v,this.snow=b,this.rain=S,this._styleColorThemeForScope=F,_===null?delete this.terrain:this.terrain=_,this.camera=R||{"camera-projection":"perspective"},this.projection=C||{name:"mercator"},this.transition=s.h({},kf,k),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(i){const l=f=>{for(const _ of f.fragments)l(_.style);i(f)};l(this)}_prioritizeTerrain(i,l,f){const _=i&&i.drapeRenderMode===0;return f===null?l&&l.drapeRenderMode===0?l:_?i:null:l!=null&&(!i||_||l&&l.drapeRenderMode===1)?l:i}mergeTerrain(){let i;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(l=>{i=this._prioritizeTerrain(i,l.terrain,l.stylesheet.terrain)}),i===null?delete this.terrain:this.terrain=i}mergeProjection(){let i;this.forEachFragmentStyle(l=>{l.stylesheet.projection!=null&&(i=l.stylesheet.projection)}),this.projection=i||{name:"mercator"}}mergeSources(){const i={},l={},f={};this.forEachFragmentStyle(_=>{for(const v in _._sourceCaches){const b=s.C(v,_.scope);i[b]=_._sourceCaches[v]}for(const v in _._otherSourceCaches){const b=s.C(v,_.scope);l[b]=_._otherSourceCaches[v]}for(const v in _._symbolSourceCaches){const b=s.C(v,_.scope);f[b]=_._symbolSourceCaches[v]}}),this._mergedSourceCaches=i,this._mergedOtherSourceCaches=l,this._mergedSymbolSourceCaches=f}mergeLayers(){const i={},l=[],f={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(v=>{for(const b of v._order){const S=v._layers[b];if(S.type==="slot"){const C=s.dj(b);if(i[C])continue;i[C]=[]}S.slot&&i[S.slot]?i[S.slot].push(S):l.push(S)}}),this._mergedOrder=[];const _=(v=[])=>{for(const b of v)if(b.type==="slot"){const S=s.dj(b.id);i[S]&&_(i[S]),this._mergedSlots.push(S)}else{const S=s.C(b.id,b.scope);this._mergedOrder.push(S),f[S]=b,b.is3D(!!this.terrain)&&(this._has3DLayers=!0),b.type==="circle"&&(this._hasCircleLayers=!0),b.type==="symbol"&&(this._hasSymbolLayers=!0),b.type==="clip"&&(this._clipLayerPresent=!0)}};_(l),this._mergedOrder.sort((v,b)=>{const S=f[v],C=f[b];return S.hasInitialOcclusionOpacityProperties?C.is3D(!!this.terrain)?1:0:S.is3D(!!this.terrain)&&C.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=f,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=s.h({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(i){return i.data?function(l,f,_,v){const b=s.h({},f);for(const C of Object.keys(s.a5.colorTheme))b[C]===void 0&&(b[C]=s.a5.colorTheme[C].default);const S=new s.a6(ym,l,new Map(_));return S.setTransitionOrValue(b,_),S.untransitioned().possiblyEvaluate(new s.aa(0,{worldview:void 0}))}(this.scope,i,this.options).get("data"):null}_loadColorTheme(i){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const l=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((f,_)=>{const v="data:image/png;base64,";if(!i||i.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void f();let b=i;b.startsWith(v)||(b=v+b);const S=s.I.from("mapbox-reserved-lut"),C=new Image;C.src=b,C.onerror=()=>{this._styleColorTheme.lutLoading=!1,_(new Error("Failed to load image data"))},C.onload=()=>
67{if(this._styleColorTheme.lutLoadingCorrelationID!==l)return void f();this._styleColorTheme.lutLoading=!1;const{width:k,height:R,data:F}=s.q.getImageData(C);if(R>32)return void _(new Error("The height of the image must be less than or equal to 32 pixels."));if(k!==R*R)return void _(new Error("The width of the image must be equal to the height squared."));this.getImage(S)&&this.removeImage(S),this.addImage(S,{data:new s.r({width:k,height:R},F),pixelRatio:1,sdf:!1,usvg:!1,version:0});const z=this.imageManager.getImage(S,this.scope);z?(this._styleColorTheme.lut={image:z.data,data:i},f()):_(new Error("Missing LUT image."))}})}getLut(i){const l=this._styleColorThemeForScope[i];return l?l.lut:null}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(i){this._spriteRequest=function(l,f,_){let v,b,S;const C=s.q.devicePixelRatio>1?"@2x":"";let k=s.n(f.transformRequest(f.normalizeSpriteURL(l,C,".json"),s.R.SpriteJSON),(z,N)=>{k=null,S||(S=z,v=N,F())}),R=s.o(f.transformRequest(f.normalizeSpriteURL(l,C,".png"),s.R.SpriteImage),(z,N)=>{R=null,S||(S=z,b=N,F())});function F(){if(S)_(S);else if(v&&b){const z=s.q.getImageData(b),N={};for(const G in v){const{width:U,height:W,x:Z,y:re,sdf:se,pixelRatio:le,stretchX:fe,stretchY:we,content:Se}=v[G],me=new s.r({width:U,height:W});s.r.copy(z,me,{x:Z,y:re},{x:0,y:0},{width:U,height:W},null),N[G]={data:me,pixelRatio:le,sdf:se,stretchX:fe,stretchY:we,content:Se,usvg:!1}}_(null,N)}}return{cancel(){k&&(k.cancel(),k=null),R&&(R.cancel(),R=null)}}}(i,this.map._requestManager,(l,f)=>{if(this._spriteRequest=null,l)this.fire(new s.z(l));else if(f){const _=new Map;for(const v in f)_.set(s.I.from(v),f[v]);this.addImages(_)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.A("data",{dataType:"style"}))})}addIconset(i,l){if(l.type==="sprite")return void this._loadSprite(l.url);const f=this.getOwnSourceCache(l.source);if(!f)return void this.fire(new s.z(new Error(`Source "${l.source}" as specified by iconset "${i}" does not exist and cannot be used as an iconset source`)));const _=f.getSource();if(_.type!=="raster-array")return void this.fire(new s.z(new Error(`Source "${l.source}" as specified by iconset "${i}" is not a "raster-array" source and cannot be used as an iconset source`)));_.partial=!1;const v=new Ly(i,this.scope,f);this.imageManager.addImageProvider(v,this.scope)}removeIconset(i){this.imageManager.removeImageProvider(i,this.scope)}_loadIconset(i){if(!s.j(i)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(i);const l=this.map._spriteFormat==="auto";var f,_;this._spriteRequest=(_=(v,b)=>{if(this._spriteRequest=null,v)l?this._loadSprite(i):this.fire(new s.z(v));else if(b){const S=new Map;for(const C in b)S.set(s.I.from(C),b[C]);this.addImages(S)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.A("data",{dataType:"style"}))},s.br((f=this.map._requestManager).transformRequest(f.normalizeIconsetURL(i),s.R.Iconset),(v,b)=>{if(v)return void _(v);const S={},C=s.da(new s.bq(b));for(const k of C.icons){const R={version:1,pixelRatio:s.q.devicePixelRatio,content:Ib(k),stretchX:k.metadata?Ab(k.metadata.stretch_x_areas):void 0,stretchY:k.metadata?Ab(k.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:k};S[k.name]=R}_(null,S)}))}_validateLayer(i){const l=this.getOwnSource(i.source);if(!l)return;const f=i.sourceLayer;f&&(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(f)===-1)&&this.fire(new s.z(new Error(`Source layer "${f}" does not exist on source "${l.id}" as specified by style layer "${i.id}"`)))}
67loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:i}of this.fragments)if(!i.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((i,l)=>{const f=this.fragments[l];return f&&f.style&&(i.data=f.style.serialize()),i})}_serializeSources(){const i={};for(const l in this._sourceCaches){const f=this._sourceCaches[l].getSource();i[f.id]||(i[f.id]=f.serialize())}return i}_serializeLayers(i){const l=[];for(const f of i){const _=this._layers[f];_&&_.type!=="custom"&&l.push(_.serialize())}return l}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(i){return i?this.order:this._mergedOrder}isLayerDraped(i){return!!this.terrain&&i.isDraped(this.getLayerSourceCache(i))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(i){const l=this.getOwnLayer(i);if(l)return l;this.fire(new s.z(new Error(`The layer '${i}' does not exist in the map's style.`)))}_checkSource(i){const l=this.getOwnSource(i);if(l)return l;this.fire(new s.z(new Error(`The source '${i}' does not exist in the map's style.`)))}precompilePrograms(i,l){const f=this.map.painter;if(f)for(let _=i.minzoom||0;_<(i.maxzoom||25.5);_++){const v=i.getProgramIds();if(v)for(const b of v){const S=i.getDefaultProgramParams(b,l.zoom,this._styleColorTheme.lut);S&&(f.style=this,this.fog&&(f._fogVisible=!0,S.overrideFog=!0,f.getOrCreateProgram(b,S)),f._fogVisible=!1,S.overrideFog=!1,f.getOrCreateProgram(b,S),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(S.overrideRtt=!0,f.getOrCreateProgram(b,S)))}}}update(i){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i);const l=this.calculateLightsBrightness();i.brightness=l||0,l!==this._brightness&&(this._brightness=l,this.dispatcher.broadcast("setBrightness",l)),i.worldview!==this._worldview&&(this._worldview=i.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const f=this._changes.isDirty();let _=!1;if(this._changes.isDirty()){const S=this._changes.getLayerUpdatesByScope();for(const C in S){const{updatedIds:k,removedIds:R}=S[C];(k||R)&&(this._updateWorkerLayers(C,k,R),_=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(i),this.light&&this.light.updateTransitions(i),this.ambientLight&&this.ambientLight.updateTransitions(i),this.directionalLight&&this.directionalLight.updateTransitions(i),this.fog&&this.fog.updateTransitions(i),this.snow&&this.snow.updateTransitions(i),this.rain&&this.rain.updateTransitions(i),this._changes.reset()}const v={};for(const S in this._mergedSourceCaches){const C=this._mergedSourceCaches[S];v[S]=C.used,C.used=!1,C.tileCoverLift=0}for(const S of this._mergedOrder){const C=this._mergedLayers[S];if(C.recalculate(i,this._availableImages),!C.isHidden(i.zoom)){const k=this.getLayerSourceCache(C);k&&(k.used=!0,k.tileCoverLift=Math.max(k.tileCoverLift,C.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
67{this.precompilePrograms(C,i)}):this.precompilePrograms(C,i))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&_&&this.mergeLayers();const b=this.imageManager.getPendingImageProviders();for(const S of b)S.sourceCache.used=!0;for(const S in v){const C=this._mergedSourceCaches[S];v[S]!==C.used&&C.getSource().fire(new s.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:C.getSource().id}))}this.light&&this.light.recalculate(i),this.terrain&&this.terrain.recalculate(i),this.fog&&this.fog.recalculate(i),this.snow&&this.snow.recalculate(i),this.rain&&this.rain.recalculate(i),this.z=i.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),f&&this.fire(new s.A("data",{dataType:"style"}))}updateImageProviders(){const i=this.imageManager.getPendingImageProviders();for(const l of i){const f=l.resolvePendingRequests(),_=this.getFragmentStyle(l.scope);_&&_.addImages(f)}}_updateTilesForChangedImages(){const i={};for(const l in this._mergedSourceCaches){const f=this._mergedSourceCaches[l].getSource().scope;i[f]=i[f]||this._changes.getUpdatedImages(f),i[f].length!==0&&this._mergedSourceCaches[l].reloadTilesForDependencies(["icons","patterns"],i[f])}for(const l in i)this._changes.resetUpdatedImages(l)}_updateWorkerLayers(i,l,f){const _=this.getFragmentStyle(i);_&&this.dispatcher.broadcast("updateLayers",{layers:l?_._serializeLayers(l):[],scope:i,removedIds:f||[],options:_.options})}setState(i,l){if(this._checkLoaded(),$c(this,wo(i)))return!1;(i=s.di(i)).layers=_f(i.layers);const f=function(b,S){if(!b)return[{command:fi.setStyle,args:[S]}];let C=[];try{if(!s.bv(b.version,S.version))return[{command:fi.setStyle,args:[S]}];if(s.bv(b.center,S.center)||C.push({command:fi.setCenter,args:[S.center]}),s.bv(b.zoom,S.zoom)||C.push({command:fi.setZoom,args:[S.zoom]}),s.bv(b.bearing,S.bearing)||C.push({command:fi.setBearing,args:[S.bearing]}),s.bv(b.pitch,S.pitch)||C.push({command:fi.setPitch,args:[S.pitch]}),s.bv(b.sprite,S.sprite)||C.push({command:fi.setSprite,args:[S.sprite]}),s.bv(b.glyphs,S.glyphs)||C.push({command:fi.setGlyphs,args:[S.glyphs]}),s.bv(b.imports,S.imports)||function(N=[],G=[],U){G=G||[];const W=(N=N||[]).map(Lu),Z=G.map(Lu),re=N.reduce(Bc,{}),se=G.reduce(Bc,{}),le=W.slice();let fe,we,Se,me;for(fe=0,we=0;fe<W.length;fe++)Se=W[fe],se.hasOwnProperty(Se)?we++:(U.push({command:fi.removeImport,args:[Se]}),le.splice(le.indexOf(Se,we),1));for(fe=0,we=0;fe<Z.length;fe++)Se=Z[Z.length-1-fe],le[le.length-1-fe]!==Se&&(re.hasOwnProperty(Se)?(U.push({command:fi.removeImport,args:[Se]}),le.splice(le.lastIndexOf(Se,le.length-we),1)):we++,me=le[le.length-fe],U.push({command:fi.addImport,args:[se[Se],me]}),le.splice(le.length-fe,0,Se));for(const ge of G){const ye=re[ge.id];ye&&(delete ye.data,s.bv(ye,ge)||U.push({command:fi.updateImport,args:[ge.id,ge]}))}}(b.imports,S.imports,C),s.bv(b.transition,S.transition)||C.push({command:fi.setTransition,args:[S.transition]}),s.bv(b.light,S.light)||C.push({command:fi.setLight,args:[S.light]}),s.bv(b.fog,S.fog)||C.push({command:fi.setFog,args:[S.fog]}),s.bv(b.snow,S.snow)||C.push({command:fi.setSnow,args:[S.snow]}),s.bv(b.rain,S.rain)||C.push({command:fi.setRain,args:[S.rain]}),s.bv(b.projection,S.projection)||C.push({command:fi.setProjection,args:[S.projection]}),s.bv(b.lights,S.lights)||C.push({command:fi.setLights,args:[S.lights]}),s.bv(b.camera,S.camera)||C.push({command:fi.setCamera,args:[S.camera]}),s.bv(b.iconsets,S.iconsets)||function(N,G,U){let W;for(W in G=G||{},N=N||{})N.hasOwnProperty(W)&&(G.hasOwnProperty(W)||U.push({command:fi.removeIconset,args:[W]}));for(W in G){if(!G.hasOwnProperty(W))continue;const Z=G[W];N.hasOwnProperty(W)?s.bv(N[W],Z)||(U.push({command:fi.removeIconset,args:[W]}),U.push({command:fi.addIconset,args:[W,Z]})):U.push({command:fi.addIconset,args:[W,Z]})}}(b.iconsets,S.iconsets,C),!s.bv(b["color-theme"],S["color-theme"]))return[{command:fi.setStyle,args:[S]}];const k={},R=[];(function(N,G,U,W){let Z;for(Z in G=G||{},N=N||{})N.hasOwnProperty(Z)&&(G.hasOwnProperty(Z)||Vh(Z,U,W));for(Z in G){if(!G.hasOwnProperty(Z))continue;const re=G[Z];N.hasOwnProperty(Z)?s.bv(N[Z],re)||(N[Z].type==="geojson"&&re.type==="geojson"&&gI(N,G,Z)?U.push({command:fi.setGeoJSONSourceData,args:[Z,re.data]}):yf(Z,G,U,W)):dm(Z,G,U)}})(b.sources,S.sources,R,k);const F=[];
67b.layers&&b.layers.forEach(N=>{N.source&&k[N.source]?C.push({command:fi.removeLayer,args:[N.id]}):F.push(N)});let z=b.terrain;z&&k[z.source]&&(C.push({command:fi.setTerrain,args:[void 0]}),z=void 0),C=C.concat(R),s.bv(z,S.terrain)||C.push({command:fi.setTerrain,args:[S.terrain]}),function(N,G,U){G=G||[];const W=(N=N||[]).map(Lu),Z=G.map(Lu),re=N.reduce(Bc,{}),se=G.reduce(Bc,{}),le=W.slice(),fe=Object.create(null);let we,Se,me,ge,ye,Ze,Me;for(we=0,Se=0;we<W.length;we++)me=W[we],se.hasOwnProperty(me)?Se++:(U.push({command:fi.removeLayer,args:[me]}),le.splice(le.indexOf(me,Se),1));for(we=0,Se=0;we<Z.length;we++)me=Z[Z.length-1-we],le[le.length-1-we]!==me&&(re.hasOwnProperty(me)?(U.push({command:fi.removeLayer,args:[me]}),le.splice(le.lastIndexOf(me,le.length-Se),1)):Se++,Ze=le[le.length-we],U.push({command:fi.addLayer,args:[se[me],Ze]}),le.splice(le.length-we,0,me),fe[me]=!0);for(we=0;we<Z.length;we++)if(me=Z[we],ge=re[me],ye=se[me],!fe[me]&&!s.bv(ge,ye))if(s.bv(ge.source,ye.source)&&s.bv(ge["source-layer"],ye["source-layer"])&&s.bv(ge.type,ye.type)){for(Me in vf(ge.layout,ye.layout,U,me,null,fi.setLayoutProperty),vf(ge.paint,ye.paint,U,me,null,fi.setPaintProperty),s.bv(ge.slot,ye.slot)||U.push({command:fi.setSlot,args:[me,ye.slot]}),s.bv(ge.filter,ye.filter)||U.push({command:fi.setFilter,args:[me,ye.filter]}),s.bv(ge.minzoom,ye.minzoom)&&s.bv(ge.maxzoom,ye.maxzoom)||U.push({command:fi.setLayerZoomRange,args:[me,ye.minzoom,ye.maxzoom]}),ge)ge.hasOwnProperty(Me)&&Me!=="layout"&&Me!=="paint"&&Me!=="filter"&&Me!=="metadata"&&Me!=="minzoom"&&Me!=="maxzoom"&&Me!=="slot"&&(Me.indexOf("paint.")===0?vf(ge[Me],ye[Me],U,me,Me.slice(6),fi.setPaintProperty):s.bv(ge[Me],ye[Me])||U.push({command:fi.setLayerProperty,args:[me,Me,ye[Me]]}));for(Me in ye)ye.hasOwnProperty(Me)&&!ge.hasOwnProperty(Me)&&Me!=="layout"&&Me!=="paint"&&Me!=="filter"&&Me!=="metadata"&&Me!=="minzoom"&&Me!=="maxzoom"&&Me!=="slot"&&(Me.indexOf("paint.")===0?vf(ge[Me],ye[Me],U,me,Me.slice(6),fi.setPaintProperty):s.bv(ge[Me],ye[Me])||U.push({command:fi.setLayerProperty,args:[me,Me,ye[Me]]}))}else U.push({command:fi.removeLayer,args:[me]}),Ze=le[le.lastIndexOf(me)+1],U.push({command:fi.addLayer,args:[ye,Ze]})}(F,S.layers,C)}catch(k){console.warn("Unable to compute style diff:",k),C=[{command:fi.setStyle,args:[S]}]}return C}(this.serialize(),i).filter(b=>!(b.command in Mb));if(f.length===0)return!1;const _=f.filter(b=>!(b.command in Pb));if(_.length>0)throw new Error(`Unimplemented: ${_.map(b=>b.command).join(", ")}.`);const v=[];return f.forEach(b=>{v.push(this[b.command](...b.args))}),l&&Promise.all(v).then(l).catch(l),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}
67addImages(i){if(i.size===0)return this;for(const[l,f]of i.entries()){if(this.getImage(l))return this.fire(new s.z(new Error(`An image with the name "${l.name}" already exists.`)));this.imageManager.addImage(l,this.scope,f),this._changes.updateImage(l,this.scope)}return this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this}addImage(i,l){return this.getImage(i)?this.fire(new s.z(new Error(`An image with the name "${i.name}" already exists.`))):(this.imageManager.addImage(i,this.scope,l),this._changes.updateImage(i,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this)}updateImage(i,l,f=!1){this.imageManager.updateImage(i,this.scope,l),f&&(this._changes.updateImage(i,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})))}getImage(i){return this.imageManager.getImage(i,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._changes.updateImage(i,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this):this.fire(new s.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(i){return this.modelManager.addModelURLs(i,this.scope),this._updateWorkerModels(),this.fire(new s.A("data",{dataType:"style"})),this}addModel(i,l,f={}){return this._checkLoaded(),this._validate(q,`models.${i}`,l,null,f)||(this.modelManager.addModel(i,l,this.scope),this.fire(new s.A("data",{dataType:"style"}))),this}hasModel(i){return this.modelManager.hasModel(i,this.scope)}removeModel(i){return this.hasModel(i)?(this.modelManager.removeModel(i,this.scope,!1,!0),this.fire(new s.A("data",{dataType:"style"})),this):this.fire(new s.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(i,l,f={}){if(this._checkLoaded(),this.getOwnSource(i)!==void 0)throw new Error(`There is already a source with ID "${i}".`);if(!l.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(l).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(l.type)>=0&&this._validate(Il,`sources.${i}`,l,null,f))return;this.map&&this.map._collectResourceTiming&&(l.collectResourceTiming=!0);const _=hs(i,l,this.dispatcher,this);_.scope=this.scope,_.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(_.id),source:_.serialize(),sourceId:_.id}));const v=b=>{const S=(b?"symbol:":"other:")+_.id,C=s.C(S,this.scope),k=this._sourceCaches[S]=new Ss(C,_,b);(b?this._symbolSourceCaches:this._otherSourceCaches)[_.id]=k,k.onAdd(this.map)};v(!1),l.type!=="vector"&&l.type!=="geojson"||v(!0),_.onAdd&&_.onAdd(this.map),f.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(i){this._checkLoaded();const l=this.getOwnSource(i);if(!l)throw new Error("There is no source with this ID");for(const _ in this._layers)if(this._layers[_].source===i)return this.fire(new s.z(new Error(`Source "${i}" cannot be removed while layer "${_}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===i)return this.fire(new s.z(new Error(`Source "${i}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const _=Object.entries(this.stylesheet.iconsets).find(([v,b])=>b.type==="source"&&b.source===i);if(_)return this.fire(new s.z(new Error(`Source "${i}" cannot be removed while iconset "${_[0]}" is using it.`)))}const f=this.getOwnSourceCaches(i);for(const _ of f){const v=s.dj(_.id);delete this._sourceCaches[v],this._changes.discardSourceCacheUpdate(_.id),_.fire(new s.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:_.getSource().id})),_.setEventedParent(null),_.clearTiles()}return delete this._otherSourceCaches[i],delete this._symbolSourceCaches[i],this.mergeSources(),l.setEventedParent(null),l.onRemove&&l.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(i,l){this._checkLoaded(),this.getOwnSource(i).setData(l),this._changes.setDirty()}getOwnSource(i){const l=this.getOwnSourceCache(i);return l&&l.getSource()}getOwnSources(){const i=[];for(const l in this._otherSourceCaches){const f=this.getOwnSourceCache(l);f&&i.push(f.getSource())}return i}areTilesLoaded(){const i=this._mergedSourceCaches;for(const l in i){const f=i[l]._tiles;for(const _ in f){const v=f[_];if(v.state!=="loaded"&&v.state!=="errored")return!1}}return!0}setLights(i){if(this._checkLoaded(),!i)return delete this.ambientLight,void delete this.directionalLight;const l=this._getTransitionParameters();
vendor: 5,836 bytes, line 67
67for(const v of i){if(this._validate(Fc,"lights",v))return;switch(v.type){case"ambient":if(this.ambientLight){const b=this.ambientLight;b.set(v),b.updateTransitions(l)}else this.ambientLight=new Ei(v,Ar||(Ar=new s.a7({color:new s.a8(s.a5.properties_light_ambient.color),"color-use-theme":new s.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.a8(s.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const b=this.directionalLight;b.set(v),b.updateTransitions(l)}else this.directionalLight=new Ei(v,ei||(ei=new s.a7({direction:new s.an(s.a5.properties_light_directional.direction),color:new s.a8(s.a5.properties_light_directional.color),"color-use-theme":new s.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.a8(s.a5.properties_light_directional.intensity),"cast-shadows":new s.a8(s.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new s.a8(s.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.a8(s.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const f=Object.assign(l,{worldview:this.map.getWorldview()}),_=new s.aa(this.z||0,f);this.ambientLight&&this.ambientLight.recalculate(_),this.directionalLight&&this.directionalLight.recalculate(_),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const i=this.directionalLight,l=this.ambientLight;if(!i||!l)return;const f=z=>.2126*(z[0]<=.03928?z[0]/12.92:Math.pow((z[0]+.055)/1.055,2.4))+.7152*(z[1]<=.03928?z[1]/12.92:Math.pow((z[1]+.055)/1.055,2.4))+.0722*(z[2]<=.03928?z[2]/12.92:Math.pow((z[2]+.055)/1.055,2.4)),_=i.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),v=i.properties.get("intensity"),b=i.properties.get("direction"),S=1-s.d1(b.x,b.y,b.z)[2]/90,C=f(_)*v*S,k=l.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),R=l.properties.get("intensity"),F=f(k)*R;return Number(((C+F)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const i=[];return this.directionalLight&&i.push(this.directionalLight.get()),this.ambientLight&&i.push(this.ambientLight.get()),i}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(i){if(i==null||i===""&&this.isRootStyle())return this;if(s.dk(i)){const l=s.dl(i),f=this.fragments.find(({id:v})=>v===l);if(!f)return;const _=s.dj(i);return f.style.getFragmentStyle(_)}{const l=this.fragments.find(({id:f})=>f===i);return l?l.style:void 0}}setFeaturesetSelectors(i){if(!i)return;const l={},f=(_,v="")=>`${_}::${v}`;this._featuresetSelectors={};for(const _ in i){const v=this._featuresetSelectors[_]=[];for(const b of i[_].selectors){if(b.featureNamespace){const C=this.getOwnLayer(b.layer);if(!C){s.w(`Layer is undefined for selector: ${b.layer}`);continue}const k=f(C.source,C.sourceLayer);if(k in l&&l[k]!==b.featureNamespace){s.w(`"featureNamespace ${b.featureNamespace} of featureset ${_}'s selector is not associated to the same source, skip this selector`);continue}l[k]=b.featureNamespace}let S;if(b.properties)for(const C in b.properties){const k=s.X(b.properties[C]);k.result==="success"&&(S=S||{},S[C]=k.value)}v.push({layerId:b.layer,namespace:b.featureNamespace,properties:S,uniqueFeatureID:b._uniqueFeatureID})}}}getFeaturesetDescriptors(i){const l=this.getFragmentStyle(i);if(!l||!l.stylesheet.featuresets)return[];const f=[];for(const _ in l.stylesheet.featuresets)f.push({featuresetId:_,importId:l.scope?l.scope:void 0});return f}getFeaturesetLayers(i,l){const f=this.getFragmentStyle(l),_=f.stylesheet.featuresets;if(!_||!_[i])return this.fire(new s.z(new Error(`The featureset '${i}' does not exist in the map's style and cannot be queried.`))),[];const v=[];for(const b of _[i].selectors){const S=f.getOwnLayer(b.layer);S&&v.push(S)}return v}getConfigProperty(i,l){const f=this.getFragmentStyle(i);if(!f)return null;const _=s.C(l,f.scope),v=f.options.get(_),b=v?v.value||v.default:null;return b?b.serialize():null}setConfigProperty(i,l,f){const _=this.getFragmentStyle(i);if(!_)return;const v=_.stylesheet.indoor?Cb(_.stylesheet.schema):_.stylesheet.schema;if(!v||!v[l])return;const b=s.X(f);if(b.result!=="success")return void $c(this,b.value);const S=b.value.expression,C=s.C(l,_.scope),k=_.options.get(C);if(!k)return;let R;const{minValue:F,maxValue:z,stepValue:N,type:G,values:U}=v[l],W=s.X(v[l].default);W.result==="success"&&(R=W.value.expression),R?(this.options.set(C,Object.assign({},k,{value:S,default:R,minValue:F,maxValue:z,stepValue:N,type:G,values:U})),this.updateConfigDependencies(l)):this.fire(new s.z(new Error(`No schema defined for the config option "${l}" in the "${i}" fragment.`)))}getConfig(i){const l=this.getFragmentStyle(i);if(!l)return null;const f=l.stylesheet.schema;if(!f)return null;const _={};for(const v in f){const b=s.C(v,l.scope),S=l.options.get(b),C=S?S.value||S.default:null;_[v]=C?C.serialize():null}return _}setConfig(i,l){const f=this.getFragmentStyle(i);f&&(f.updateConfig(l,f.stylesheet.schema),this.updateConfigDependencies())}getSchema(i){const l=this.getFragmentStyle(i);return l?l.stylesheet.schema:null}setSchema(i,l){const f=this.getFragmentStyle(i);f&&(f.stylesheet.schema=l,f.updateConfig(f._config,l),this.updateConfigDependencies())}updateConfig(i,l){if(this._config=i,i||l)if(l)for(const f in l){let _,v;const b=s.X(l[f].default);if(b.result==="success"&&(_=b.value.expression),i&&i[f]!==void 0){const z=s.X(i[f]);z.result==="success"&&(v=z.value.expression)}const{minValue:S,maxValue:C,stepValue:k,type:R,values:F}=l[f];if(_){const z=s.C(f,this.scope);this.options.set(z,{default:_,value:v,minValue:S,maxValue:C,stepValue:k,type:R,values:F})}
67else this.fire(new s.z(new Error(`No schema defined for config option "${f}".`)))}else this.fire(new s.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(i){for(const l of this._configDependentLayers){const f=this.getLayer(l);if(f){if(i&&!f.configDependencies.has(i))continue;f.possiblyEvaluateVisibility(),this._updateLayer(f)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(l=>{const f=l._styleColorTheme.colorThemeOverride?l._styleColorTheme.colorThemeOverride:l._styleColorTheme.colorTheme;if(f){const _=l._evaluateColorThemeData(f);(!l._styleColorTheme.lut&&_!==""||l._styleColorTheme.lut&&_!==l._styleColorTheme.lut.data)&&l.setColorTheme(f)}}),this._changes.setDirty()}addLayer(i,l,f={}){this._checkLoaded();const _=i.id;if(this._layers[_])return void this.fire(new s.z(new Error(`Layer with i
67d "${_}" already exists on this map`)));let v;if(i.type==="custom"){if($c(this,s.dm(i)))return;v=s.dn(i,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof i.source=="object"&&(this.addSource(_,i.source),i=s.di(i),i=s.h(i,{source:_})),this._validate(ai,`layers.${_}`,i,{arrayIndex:-1},f))return;v=s.dn(i,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(v),v.setEventedParent(this,{layer:{id:_}})}v.configDependencies.size!==0&&this._configDependentLayers.add(v.fqid);let b=this._order.length;if(l){const R=this._order.indexOf(l);if(R===-1)return void this.fire(new s.z(new Error(`Layer with id "${l}" does not exist on this map.`)));v.slot===this._layers[l].slot?b=R:s.w(`Layer with id "${l}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(b,0,_),this._layerOrderChanged=!0,this._layers[_]=v;const S=this.getOwnLayerSourceCache(v),C=!!this.directionalLight&&this.directionalLight.shadowsEnabled();S&&v.canCastShadows()&&C&&(S.castsShadows=!0);const k=this._changes.getRemovedLayer(v);if(k&&v.source&&S&&v.type!=="custom"){this._changes.discardLayerRemoval(v);const R=s.C(v.source,v.scope);k.type!==v.type?this._changes.updateSourceCache(R,"clear"):(this._changes.updateSourceCache(R,"reload"),S.pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map),v.scope=this.scope,this.mergeLayers()}moveLayer(i,l){this._checkLoaded();const f=this._checkLayer(i);if(!f||i===l)return;const _=this._order.indexOf(i);this._order.splice(_,1);let v=this._order.length;if(l){const b=this._order.indexOf(l);
67if(b===-1)return void this.fire(new s.z(new Error(`Layer with id "${l}" does not exist on this map.`)));f.slot===this._layers[l].slot?v=b:s.w(`Layer with id "${l}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(v,0,i),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(i){this._checkLoaded();const l=this._checkLayer(i);if(!l)return;l.setEventedParent(null);const f=this._order.indexOf(i);this._order.splice(f,1),delete this._layers[i],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(l.fqid),this._changes.removeLayer(l);const _=this.getOwnLayerSourceCache(l);if(_&&_.castsShadows){let v=!1;for(const b in this._layers)if(this._layers[b].source===l.source&&this._layers[b].canCastShadows()){v=!0;break}_.castsShadows=v}l.onRemove&&l.onRemove(this.map),this.mergeLayers()}getOwnLayer(i){return this._layers[i]}hasLayer(i){return i in this._mergedLayers}hasLayerType(i){for(const l in this._layers)if(this._layers[l].type===i)return!0;return!1}setLayerZoomRange(i,l,f){this._checkLoaded();const _=this._checkLayer(i);_&&(_.minzoom===l&&_.maxzoom===f||(l!=null&&(_.minzoom=l),f!=null&&(_.maxzoom=f),this._updateLayer(_)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(i,l){this._checkLoaded();const f=this._checkLayer(i);f&&f.slot!==l&&(f.slot=l,this._updateLayer(f))}setFilter(i,l,f={}){this._checkLoaded();const _=this._checkLayer(i);if(_&&!s.bv(_.filter,l))return l==null?(_.filter=void 0,void this._updateLayer(_)):void(this._validate(Xe,`layers.${_.id}.filter`,l,{layerType:_.type},f)||(_.filter=s.di(l),this._updateLayer(_)))}getFilter(i){const l=this._checkLayer(i);if(l)return s.di(l.filter)}setLayoutProperty(i,l,f,_={}){this._checkLoaded();const v=this._checkLayer(i);if(v&&!s.bv(v.getLayoutProperty(l),f)){if(f!=null&&(!_||_.validate!==!1)&&$c(v,ee.call(wo,{key:`layers.${i}.layout.${l}`,layerType:v.type,objectKey:l,value:f,styleSpec:s.a5,style:{glyphs:!0,sprite:!0}})))return;v.setLayoutProperty(l,f),v.configDependencies.size!==0&&this._configDependentLayers.add(v.fqid),this._updateLayer(v)}}getLayoutProperty(i,l){const f=this._checkLayer(i);if(f)return f.getLayoutProperty(l)}setPaintProperty(i,l,f,_={}){this._checkLoaded();const v=this._checkLayer(i);if(!v||s.bv(v.getPaintProperty(l),f)||f!=null&&(!_||_.validate!==!1)&&$c(v,Y.call(wo,{key:`layers.${i}.paint.${l}`,layerType:v.type,objectKey:l,value:f,styleSpec:s.a5})))return;const b=v.setPaintProperty(l,f);v.configDependencies.size!==0&&this._configDependentLayers.add(v.fqid),b&&this._updateLayer(v),this._changes.updatePaintProperties(v)}getPaintProperty(i,l){const f=this._checkLayer(i);if(f)return f.getPaintProperty(l)}setFeatureState(i,l){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){const{featuresetId:C,importId:k}=i.target,R=this.getFragmentStyle(k),F=R.getFeaturesetLayers(C);for(const{source:z,sourceLayer:N}of F)R.setFeatureState({id:i.id,source:z,sourceLayer:N},l)}else if("layerId"in i.target){const{layerId:C}=i.target,k=this.getLayer(C);this.setFeatureState({id:i.id,source:k.source,sourceLayer:k.sourceLayer},l)}return}const f=i.source,_=i.sourceLayer,v=this._checkSource(f);if(!v)return;const b=v.type;if(b==="geojson"&&_)return void this.fire(new s.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(b==="vector"&&!_)return void this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")));i.id===void 0&&this.fire(new s.z(new Error("The feature id parameter must be provided.")));const S=this.getOwnSourceCaches(f);for(const C of S)C.setFeatureState(_,i.id,l)}removeFeatureState(i,l){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){const{featuresetId:C,importId:k}=i.target,R=this.getFragmentStyle(k),F=R.getFeaturesetLayers(C);for(const{source:z,sourceLayer:N}of F)R.removeFeatureState({id:i.id,source:z,sourceLayer:N},l)}else if("layerId"in i.target){const{layerId:C}=i.target,k=this.getLayer(C);this.removeFeatureState({id:i.id,source:k.source,sourceLayer:k.sourceLayer},l)}return}const f=i.source,_=this._checkSource(f);if(!_)return;const v=_.type,b=v==="vector"?i.sourceLayer:void 0;if(v==="vector"&&!b)return void this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(l&&typeof i.id!="string"&&typeof i.id!="number")return void this.fire(new s.z(new Error("A feature id is required to remove its specific state property.")));const S=this.getOwnSourceCaches(f);for(const C of S)C.removeFeatureState(b,i.id,l)}getFeatureState(i){if(this._checkLoaded(),"target"in i){let v;if("featuresetId"in i.target){const{featuresetId:b,importId:S}=i.target,C=this.getFragmentStyle(S),k=C.getFeaturesetLayers(b);for(const{source:R,sourceLayer:F}of k){const z=C.getFeatureState({id:i.id,source:R,sourceLayer:F});if(z&&!v)v=z;else if(!s.bv(v,z))return void this.fire(new s.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in i.target){const{layerId:b}=i.target,S=this.getLayer(b);v=this.getFeatureState({id:i.id,source:S.source,sourceLayer:S.sourceLayer})}return v}const l=i.source,f=i.sourceLayer,_=this._checkSource(l);if(_){if(_.type!=="vector"||f)return i.id===void 0&&this.fire(new s.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(l)[0].getFeatureState(f,i.id);this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=s.h({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return s.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const i=this.getTerrain(),l=i&&this.terrain&&this.terrain.scope===this.scope?i:this.stylesheet.terrain;return s.dp({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:l,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},f=>f!==void 0)}_updateFilteredLayers(i){for(const l of Object.values(this._mergedLayers))i(l)&&this._updateLayer(l)}_updateLayer(i){this._changes.updateLayer(i);const l=this.getLayerSourceCache(i),f=s.C(i.source,i.scope),_=this._changes.getUpd
vendor: 9,938 bytes, line 67
67atedSourceCaches();i.source&&!_[f]&&l&&l.getSource().type!=="raster"&&(this._changes.updateSourceCache(f,"reload"),l.pause()),i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){const l=S=>this._mergedLayers[S].is3D(!!this.terrain),f=this.order,_={},v=[];for(let S=f.length-1;S>=0;S--){const C=f[S];if(l(C)){_[C]=S;for(const k of i){const R=k[C];if(R)for(const F of R)v.push(F)}}}v.sort((S,C)=>C.intersectionZ-S.intersectionZ);const b=[];for(let S=f.length-1;S>=0;S--){const C=f[S];if(l(C))for(let k=v.length-1;k>=0;k--){const R=v[k].feature;if(R.layer&&_[R.layer.id]<S)break;b.push(R),v.pop()}else for(const k of i){const R=k[C];if(R)for(const F of R)b.push(F.feature)}}return b}queryRenderedFeatures(i,l,f){let _;l&&!Array.isArray(l)&&l.filter&&(this._validate(Xe,"queryRenderedFeatures.filter",l.filter,null,l),_=s.b3(l.filter));const v={},b=R=>{if(vm.has(R.type))return;const F=this.getOwnLayerSourceCache(R),z=v[F.id]=v[F.id]||{sourceCache:F,layers:{},has3DLayers:!1};R.is3D(!!this.terrain)&&(z.has3DLayers=!0),z.layers[R.fqid]=z.layers[R.fqid]||{styleLayer:R,targets:[]},z.layers[R.fqid].targets.push({filter:_})};if(l&&l.layers){if(!Array.isArray(l.layers))return this.fire(new s.z(new Error("parameters.layers must be an Array."))),[];for(const R of l.layers){const F=this._layers[R];if(!F)return this.fire(new s.z(new Error(`The layer '${R}' does not exist in the map's style and cannot be queried for features.`))),[];b(F)}}else for(const R in this._layers)b(this._layers[R]);const S=this._queryRenderedFeatures(i,v,f),C=this._flattenAndSortRenderedFeatures(S),k=[];for(const R of C)s.dq(R.layer.id)===this.scope&&k.push(R);return k}queryRenderedFeatureset(i,l,f){let _;l&&!Array.isArray(l)&&l.filter&&(this._validate(Xe,"queryRenderedFeatures.filter",l.filter,null,l),_=s.b3(l.filter));const v="mock",b=[];if(l&&l.target)b.push(Object.assign({},l,{targetId:v,filter:_}));else{const R=this.getFeaturesetDescriptors();for(const F of R)b.push({targetId:v,filter:_,target:F});for(const{style:F}of this.fragments){const z=F.getFeaturesetDescriptors();for(const N of z)b.push({targetId:v,filter:_,target:N})}}const S=this.queryRenderedTargets(i,b,f),C=[],k=new Set;for(const R of S)for(const F of R.variants[v])Pu(F,R,k)||C.push(new s.dr(R,F));return C}queryRenderedTargets(i,l,f){const _={},v=(S,C,k,R)=>{const F=_[C.id]=_[C.id]||{sourceCache:C,layers:{},has3DLayers:!1};if(F.layers[S.fqid]=F.layers[S.fqid]||{styleLayer:S,targets:[]},S.is3D(!!this.terrain)&&(F.has3DLayers=!0),!R)return k.uniqueFeatureID=!1,void F.layers[S.fqid].targets.push(k);F.layers[S.fqid].targets.push(Object.assign({},k,{namespace:R.namespace,properties:R.properties,uniqueFeatureID:R.uniqueFeatureID}))};for(const S of l)if("featuresetId"in S.target){const{featuresetId:C,importId:k}=S.target,R=this.getFragmentStyle(k);if(!R||!R._featuresetSelectors)continue;const F=R._featuresetSelectors[C];if(!F){this.fire(new s.z(new Error(`The featureset '${C}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const z of F){const N=R.getOwnLayer(z.layerId);N&&!vm.has(N.type)&&v(N,R.getOwnLayerSourceCache(N),S,z)}}else if("layerId"in S.target){const{layerId:C}=S.target,k=this.getLayer(C);if(!k||vm.has(k.type))continue;v(k,this.getLayerSourceCache(k),S)}const b=this._queryRenderedFeatures(i,_,f);return this._flattenAndSortRenderedFeatures(b)}_queryRenderedFeatures(i,l,f){const _=[],v=!!this.map._showQueryGeometry,b=ti.createFromScreenPoints(i,f);for(const S in l){const C=Nc(b,l[S],this._availableImages,f,v);Object.keys(C).length&&_.push(C)}if(this.placement)for(const S in l){if(!l[S].sourceCache._onlySymbols)continue;const C=Sn(b.screenGeometry,l[S],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(C).length&&_.push(C)}return _}querySourceFeatures(i,l){const f=l&&l.filter;f&&this._validate(Xe,"querySourceFeatures.filter",f,null,l);let _=[];const v=this.getOwnSourceCaches(i);for(const b of v)_=_.concat(la(b,l));return _}addSourceType(i,l,f){return Ba.getSourceType(i)?f(new Error(`A source type called "${i}" already exists.`)):(Ba.setSourceType(i,l),l.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:l.workerSourceURL},f):f(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(i,l,f={}){this._checkLoaded();const _=this.light.getLight();let v=!1;for(const S in i)if(!s.bv(i[S],_[S])){v=!0;break}if(!v)return;const b=this._getTransitionParameters();this.light.setLight(i,l,f),this.light.updateTransitions(b)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(i,l=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),l===0&&delete this.terrain,i===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let f=i;const _=i.source==null;if(l===1){if(this.disableElevatedTerrain)return;if(typeof f.source=="object"){const S="terrain-dem-src";this.addSource(S,f.source),f=s.di(f),f=s.h(f,{source:S})}const v=s.h({},f),b={};if(this.terrain&&_){v.source=this.terrain.get().source;const S=this.terrain?this.getFragmentStyle(this.terrain.scope):null;S&&(b.style=S.serialize())}if(this._validate(Tt,"terrain",v,b))return}if(!this.terrain||this.terrain.scope!==this.scope&&!_||this.terrain&&l!==this.terrain.drapeRenderMode){if(!f)return;this._createTerrain(f,l),this.fire(new s.A("data",{dataType:"style"}))}else{const v=this.terrain,b=v.get();for(const S of Object.keys(s.a5.terrain))!f.hasOwnProperty(S)&&s.a5.terrain[S].default&&(f[S]=s.a5.terrain[S].default);for(const S in i)if(!s.bv(i[S],b[S])){v.set(i,this.options),this.stylesheet.terrain=i;const C=this._getTransitionParameters({duration:0});v.updateTransitions(C),this.fire(new s.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){const l=this.fog=new dr(i,this.map.transform,this.scope,this.options);this.stylesheet.fog=l.get();const f=this._getTransitionParameters({duration:0});l.updateTransitions(f)}_createSnow(i){const l=this.snow=new rn(i,this.map.transform,this.scope,this.options);this.stylesheet.snow=l.get();const f=this._getTransitionParameters({duration:0});l.updateTransitions(f)}_createRain(i){const l=this.rain=new Xi(i,this.map.transform,this.scope,this.options);this.stylesheet.rain=l.get();const f=this._getTransitionParameters({duration:0});l.updateTransitions(f)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const l=this.fog;if(!s.bv(l.get(),i)){l.set(i,this.options),this.stylesheet.fog=l.get();const f=this._getTransitionParameters({duration:0});l.updateTransitions(f)}}else this._createFog(i);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(i){if(this._checkLoaded(),!i)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const l=this.snow;if(!s.bv(l.get(),i)){l.set(i,this.options),this.stylesheet.snow=l.get();const f=this._getTransitionParameters({duration:0});l.updateTransitions(f)}}else this._createSnow(i);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(i){if(this._checkLoaded(),!i)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const l=this.rain;if(!s.bv(l.get(),i)){l.set(i,this.options),this.stylesheet.rain=l.get();const f=this._getTransitionParameters({duration:0});l.updateTransitions(f)}}else this._createRain(i);this._markersNeedUpdate=!0}_reloadColorTheme(){const i=()=>{for(const _ in this._layers)this._layers[_].lut=this._styleColorTheme.lut;for(const _ in this._sourceCaches)this._sourceCaches[_].clearTiles()},l=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!l)return this._styleColorTheme.lut=null,void i();const f=this._evaluateColorThemeData(l);this._loadColorTheme(f).then(()=>{this.fire(new s.A("colorthemeset")),i()}).catch(_=>{s.w(`Couldn't set color theme: ${_}`)})}setColorTheme(i){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=i,this._reloadColorTheme()}setImportColorTheme(i,l){const f=this.getFragmentStyle(i);f&&(f._styleColorTheme.colorThemeOverride=l,f._reloadColorTheme())}_getTransitionParameters(i){return{now:s.q.now(),transition:s.h(this.transition,i)}}updateDrapeFirstLayers(){if(!this.terrain)return;const i=[],l=[];for(const f of this._mergedOrder)this.isLayerDraped(this._mergedLayers[f])?i.push(f):l.push(f);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...l)}_createTerrain(i,l){const f=this.terrain=new Ee(i,l,this.scope,this.options,this.map.getWorldview());l===1&&(this.stylesheet.terrain=i),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const _=this._getTransitionParameters({duration:0});f.updateTransitions(_)}_force3DLayerUpdate(){for(const i in this._layers){const l=this._layers[i];l.type==="fill-extrusion"&&this._updateLayer(l)}}
67_forceSymbolLayerUpdate(){for(const i in this._layers){const l=this._layers[i];l.type==="symbol"&&this._updateLayer(l)}}_validate(i,l,f,_,v={}){if(v&&v.validate===!1)return!1;const b=s.h({},this.serialize());return $c(this,i.call(wo,s.h({key:l,style:b,value:f,styleSpec:s.a5},_)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.ds.off("pluginStateChange",this._rtlTextPluginCallback);for(const i in this._mergedLayers)this._mergedLayers[i].setEventedParent(null);for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles(),this._mergedSourceCaches[i].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(i){const l=this.getSourceCaches(i);for(const f of l)f.clearTiles()}clearSources(){for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles()}clearLayers(){for(const i in this._mergedLayers){const l=this._mergedLayers[i];l._clear&&l._clear()}}reloadSource(i){const l=this.getSourceCaches(i);for(const f of l)f.resume(),f.reload()}
67reloadSources(){for(const i of this.getSources())i.reload&&i.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(i=>{i.modelManager.reloadModels(i.scope)})}updateSources(i){let l;this.directionalLight&&(l=Wh(this.directionalLight));const f=new Set;for(const _ in this._mergedLayers){const v=this._mergedLayers[_];v.hasElevation()&&!f.has(v.source)&&f.add(v.source)}for(const _ in this._mergedSourceCaches){const v=this._mergedSourceCaches[_],b=f.has(v._source.id);v.update(i,void 0,void 0,l,b)}}_generateCollisionBoxes(){for(const i in this._sourceCaches){const l=this._sourceCaches[i];l.resume(),l.reload()}}_updatePlacement(i,l,f,_,v,b,S=!1){let C=!1,k=!1;const R={},F={};for(const z of this._mergedOrder){const N=this._mergedLayers[z];if(N.type!=="symbol")continue;const G=s.C(N.source,N.scope);let U=R[G];if(!U){const Z=this.getLayerSourceCache(N);if(!Z)continue;const re=Z.getRenderableIds(!0).map(se=>Z.getTileByID(se));F[G]=re.slice(),U=R[G]=re.sort((se,le)=>le.tileID.overscaledZ-se.tileID.overscaledZ||(se.tileID.isLessThan(le.tileID)?-1:1))}const W=this.crossTileSymbolIndex.addLayer(N,U,l.center.lng,l.projection);C=C||W}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),S=S||this._layerOrderChanged||_===0,this._layerOrderChanged&&this.fire(new s.A("neworder")),(S||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.q.now(),l.zoom))&&(this.pauseablePlacement=new gm(l,this._mergedOrder,S,f,_,v,this.placement,this.fog&&l.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,R,F,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.q.now()),k=!0),C&&this.pauseablePlacement.placement.setStale()),k||C){this._buildingIndex.onNewFrame(l.zoom);for(let z=0;z<this._mergedOrder.length;z++){const N=this._mergedLayers[this._mergedOrder[z]];if(N.type!=="symbol")continue;const G=this.isLayerClipped(N);this.placement.updateLayerOpacities(N,R[s.C(N.source,N.scope)],z,G?b:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.q.now())}}_releaseSymbolFadeTiles(){for(const i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}addImport(i,l){this._checkLoaded();const f=this.stylesheet.imports=this.stylesheet.imports||[];if(f.findIndex(({id:v})=>v===i.id)!==-1)return void this.fire(new s.z(new Error(`Import with id '${i.id}' already exists in the map's style.`)));if(!l)return f.push(i),this._loadImports([i],!0);const _=f.findIndex(({id:v})=>v===l);return _===-1&&this.fire(new s.z(new Error(`Import with id "${l}" does not exist on this map.`))),this.stylesheet.imports=f.slice(0,_).concat(i).concat(f.slice(_)),this._loadImports([i],!0,l)}updateImport(i,l){this._checkLoaded();const f=this.stylesheet.imports||[],_=this.getImportIndex(i);return _===-1?this:typeof l=="string"?(this.setImportUrl(i,l),this):(l.url&&l.url!==f[_].url&&this.setImportUrl(i,l.url),s.bv(l.config,f[_].config)||this.setImportConfig(i,l.config,l.data.schema),s.bv(l.data,f[_].data)||this.setImportData(i,l.data),this)}moveImport(i,l){this._checkLoaded();let f=this.stylesheet.imports||[];const _=this.getImportIndex(i);if(_===-1)return this;const v=this.getImportIndex(l);if(v===-1)return this;const b=f[_],S=this.fragments[_];return f=f.filter(({id:C})=>C!==i),this.fragments=this.fragments.filter(({id:C})=>C!==i),this.stylesheet.imports=f.slice(0,v).concat(b).concat(f.slice(v)),this.fragments=this.fragments.slice(0,v).concat(S).concat(this.fragments.slice(v)),this.mergeLayers(),this}setImportUrl(i,l){this._checkLoaded();const f=this.stylesheet.imports||[],_=this.getImportIndex(i);if(_===-1)return this;f[_].url=l;const v=this.fragments[_];return v.style=this._createFragmentStyle(f[_]),v.style.on("style.import.load",()=>this.mergeAll()),v.style.loadURL(l),this}setImportData(i,l){this._checkLoaded();const f=this.getImportIndex(i),_=this.stylesheet.imports||[];return f===-1?this:l?(this.fragments[f].style.setState(l),this._reloadImports(),this):(delete _[f].data,this.setImportUrl(i,_[f].url))}setImportConfig(i,l,f){this._checkLoaded();const _=this.getImportIndex(i),v=this.stylesheet.imports||[];if(_===-1)return this;l?v[_].config=l:delete v[_].config;const b=this.fragments[_];f&&b.style.stylesheet&&(b.style.stylesheet.schema=f);const S=b.style.stylesheet&&b.style.stylesheet.schema;return b.config=l,b.style.updateConfig(l,S),this.updateConfigDependencies(),this}removeImport(i){this._checkLoaded();const l=this.stylesheet.imports||[],f=this.getImportIndex(i);f!==-1&&(l.splice(f,1),this.fragments[f].style._remove(),this.fragments.splice(f,1),this._reloadImports())}getImportIndex(i){const l=(this.stylesheet.imports||[]).findIndex(f=>f.id===i);return l===-1&&this.fire(new s.z(new Error(`Import '${i}' does not exist in the map's style and cannot be updated.`))),l}getLayer(i){return this._mergedLayers[i]}getSources(){const i=[];for(const l in this._mergedOtherSourceCaches){const f=this._mergedOtherSourceCaches[l];f&&i.push(f.getSource())}return i}getSource(i,l){const f=this.getSourceCache(i,l);return f&&f.getSource()}getLayerSource(i){const l=this.getLayerSourceCache(i);return l&&l.getSource()}getSourceCache(i,l){const f=s.C(i,l);return this._mergedOtherSourceCaches[f]}
67getLayerSourceCache(i){const l=s.C(i.source,i.scope);return i.type==="symbol"?this._mergedSymbolSourceCaches[l]:this._mergedOtherSourceCaches[l]}getSourceCaches(i){if(i==null)return Object.values(this._mergedSourceCaches);const l=[];return this._mergedOtherSourceCaches[i]&&l.push(this._mergedOtherSourceCaches[i]),this._mergedSymbolSourceCaches[i]&&l.push(this._mergedSymbolSourceCaches[i]),l}updateSourceCaches(){const i=this._changes.getUpdatedSourceCaches();for(const l in i){const f=i[l];f==="reload"?this.reloadSource(l):f==="clear"&&this.clearSource(l)}}updateLayers(i){const l=this._changes.getUpdatedPaintProperties();for(const f of l){const _=this.getLayer(f);_&&_.updateTransitions(i)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(i){this.stylesheet.glyphs=i,this.glyphManager.setURL(i)}getImages(i,l,f){this.imageManager.getImages(l.images,l.scope,f),this._updateTilesForChangedImages();const _=b=>{if(b){const S=l.images.map(C=>s.I.toString(C));b.setDependencies(l.tileID.key,l.type,S)}},v=s.C(l.source,l.scope);_(this._mergedOtherSourceCaches[v]),_(this._mergedSymbolSourceCaches[v]),l.images.some(b=>b.iconsetId)&&this.fire(new s.A("data",{dataType:"style"}))}rasterizeImages(i,l,f){this.imageManager.rasterizeImages(l,f)}getGlyphs(i,l,f){this.glyphManager.getGlyphs(l.stacks,f)}getResource(i,l,f){return s.dt(l,f)}getOwnSourceCache(i){return this._otherSourceCaches[i]}getOwnLayerSourceCache(i){return i.type==="symbol"?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}getOwnSourceCaches(i){const l=[];return this._otherSourceCaches[i]&&l.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&l.push(this._symbolSourceCaches[i]),l}_isSourceCacheLoaded(i){const l=this.getOwnSourceCaches(i);return l.length===0?(this.fire(new s.z(new Error(`There is no source with ID '${i}'`))),!1):l.every(f=>f.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(i,l){if(!this._clipLayerPresent&&i.type!=="fill-extrusion"&&i.type!=="building")return!1;const f=i.type==="fill-extrusion"&&(i.sourceLayer==="building"||i.sourceLayer==="procedural_buildings"),_=i.type==="building";if(i.is3D(!!this.terrain)){if(f||_||l&&l.type==="batched-model"||i.type==="model")return!0}else if(i.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(i=>{i.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Ba.getSourceType=function(d){return Do[d]},Ba.setSourceType=function(d,i){Do[d]=i},Ba.registerForPluginStateChange=s.du;var zy=`
68#define EPSILON 0.0000001
69#define PI 3.141592653589793
70#ifdef RENDER_CUTOFF
71float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
72#endif`,Yh=`
73out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)
74{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
75#ifdef INDICATOR_CUTOUT
76uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
77#endif
78vec4 applyCutout(vec4 color,float height) {
79#ifdef INDICATOR_CUTOUT
80float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));
80return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
81#else
82return color;
83#endif
84}
85#ifdef DEBUG_WIREFRAME
86#define HANDLE_WIREFRAME_DEBUG \\
87glFragColor=vec4(0.7,0.0,0.0,0.7); \\
88gl_FragDepth=gl_FragCoord.z-0.0001;
89#else
90#define HANDLE_WIREFRAME_DEBUG
91#endif
92#ifdef RENDER_CUTOFF
93uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
94#endif
95vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,Kh=`
96#define EXTENT 8192.0
97#define RAD_TO_DEG 180.0/PI
98#define DEG_TO_RAD PI/180.0
99#define GLOBE_RADIUS EXTENT/PI/2.0
100float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
101#ifdef PROJECTION_GLOBE_VIEW
102vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
103#ifndef PROJECTED_POS_ON_VIEWPORT
104float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
105#else
106return vec3(0.0);
107#endif
108}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
109#endif
110vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
111unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
112);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
113#ifdef RENDER_CUTOFF
114uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
115#endif
116const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
117{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Dy="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
117void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",xm=`
118#define ELEVATION_SCALE 7.0
119#define ELEVATION_OFFSET 450.0
120#ifdef PROJECTION_GLOBE_VIEW
121uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
122mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
123#else
124vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
125#endif
126#ifdef TERRAIN
127uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
128#ifdef TERRAIN_DEM_FLOAT_FORMAT
129vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
130#else
131float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
132#endif
133}float prevElevation(vec2 apos) {
134#ifdef TERRAIN_DEM_FLOAT_FORMAT
135vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
136#else
137float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
138#endif
139}
140#ifdef TERRAIN_VERTEX_MORPHING
141float elevation(vec2 apos) {
142#ifdef ZERO_EXAGGERATION
143return 0.0;
144#endif
145float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
146#else
147float elevation(vec2 apos) {
148#ifdef ZERO_EXAGGERATION
149return 0.0;
150#endif
151return currentElevation(apos);}
152#endif
153vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
154#else
155float elevation(vec2 pos) { return 0.0; }
156#endif
157#ifdef DEPTH_OCCLUSION
158uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;
159#ifdef DEPTH_D24
160float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}
161#else
162highp float unpack_depth_rgba(vec4 rgba_depth)
163{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
164#endif
165bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
166#ifdef DEPTH_D24
167float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
168#else
169float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
170#endif
171return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
171size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
172#ifdef DEPTH_D24
173highp vec4 depth=vec4(
174texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r
175);depth=unpack_depth4(depth);
176#else
177highp vec4 depth=vec4(
178unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))
179);
180#endif
181return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {
182#ifdef DEPTH_D24
183highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
184#else
185highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
186#endif
187res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}
188#else
189bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
190#endif//DEPTH_OCCLUSION`,fa=`#ifdef FOG
191uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
192#endif`,bm=`#ifdef FOG
193uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;
194#ifdef FLIP_Y
195uv.y=1.0-uv.y;
196#endif
197highp vec3 ray_dir=mix(
198mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
198vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
199#endif`,Vt=`#ifdef RASTER_ARRAY
200uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
201);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)
202);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
203#endif`,Oy=`#ifdef RASTER_ARRAY
204uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}
205#endif
206uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,wm=`#ifdef RENDER_SHADOWS
207uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
208#endif//RENDER_SHADOWS`,Tm=`#ifdef RENDER_SHADOWS
209precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
209p float bias) {
210#ifdef CLIP_ZERO_TO_ONE
211highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
212#else
213highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
214#endif
215return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;
216#ifdef SHADOWS_SINGLE_CASCADE
217vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);
218#else
219light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);
220#endif
221}highp float calculate_shadow_bias(float NDotL) {
222#ifdef NORMAL_OFFSET
223return 0.5*u_shadow_bias.x;
224#else
225return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
226#endif
227}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)
228{highp vec2 biasUV=vec2(
229pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
230#endif`;const Rf=[];nl(zy,Rf),nl(Kh,Rf),nl(Yh,Rf);const Bu={"_prelude_fog.vertex.glsl":fa,"_prelude_terrain.vertex.glsl":xm,"_prelude_shadow.vertex.glsl":wm,"_prelude_fog.fragment.glsl":bm,"_prelude_shadow.fragment.glsl":Tm,"_prelude_lighting.glsl":`
231#ifdef LIGHTING_3D_MODE
232uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
232));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
233#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":Vt,"_prelude_raster_particle.glsl":Oy},Va={};oi("",xm),oi(bm,fa),oi(Tm,wm),oi(Vt,""),oi(Oy,"");const Em=oi(Yh,Kh),qc=zy;var Lf={background:oi(`#include "_prelude_fog.fragment.glsl"
234#include "_prelude_lighting.glsl"
235uniform vec4 u_color;uniform float u_opacity;
236#ifdef LIGHTING_3D_MODE
237in vec4 v_color;
238#endif
239void main() {vec4 out_color;
240#ifdef LIGHTING_3D_MODE
241out_color=v_color;
242#else
243out_color=u_color;
244#endif
245#ifdef FOG
246out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
247#endif
248glFragColor=out_color*u_opacity;
249#ifdef OVERDRAW_INSPECTOR
250glFragColor=vec4(1.0);
251#endif
252HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
253#include "_prelude_lighting.glsl"
254in vec2 a_pos;uniform mat4 u_matrix;
255#ifdef LIGHTING_3D_MODE
256uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;
257#endif
258void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
259#ifdef LIGHTING_3D_MODE
260v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
261#endif
262#ifdef FOG
263v_fog_pos=fog_position(a_pos);
264#endif
265}`),backgroundPattern:oi(`#include "_prelude_fog.fragment.glsl"
266#include "_prelude_lighting.glsl"
267uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
268#ifdef LIGHTING_3D_MODE
269out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
270#endif
271#ifdef FOG
272out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
273#endif
274glFragColor=out_color*u_opacity;
275#ifdef OVERDRAW_INSPECTOR
276glFragColor=vec4(1.0);
277#endif
278HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
279uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
280#ifdef FOG
281v_fog_pos=fog_position(a_pos);
282#endif
283}`),building:oi(`#include "_prelude_fog.fragment.glsl"
284#include "_prelude_shadow.fragment.glsl"
285#include "_prelude_lighting.glsl"
286const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;
287#ifdef BUILDING_FAUX_FACADE
288in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;
289#endif
290#ifdef RENDER_SHADOWS
291in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
292#endif
293uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}
294#ifdef BUILDING_FAUX_FACADE
295float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}
295float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
296#if 0
297if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;
298#else
299if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;
300#endif
301return out_color;}
302#endif
303vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;
304#ifdef BUILDING_FAUX_FACADE
305if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
306#endif
307vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
308#ifdef RENDER_SHADOWS
309shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
310#else
311shadowed_lighting_factor=dot(normal,u_lighting_directional_dir);
312#endif
313color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,base_color.rgb,emissive);
314#ifdef FOG
315color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
316#endif
317color.rgb=linearTosRGB(color.rgb);color*=u_opacity;
318#ifdef INDICATOR_CUTOUT
319color=applyCutout(color,v_pos.z);
320#endif
321glFragColor=color; 
322#ifdef DEBUG_SHOW_NORMALS
323color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
324#endif
325#ifdef OVERDRAW_INSPECTOR
326glFragColor=vec4(1.0);
327#endif
328HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
329#include "_prelude_shadow.vertex.glsl"
330in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
331#ifdef BUILDING_FAUX_FACADE
332out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;
333#endif
334#ifdef RENDER_SHADOWS
335uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
336#endif
337const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
338#ifdef BUILDING_FAUX_FACADE
339mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}
340#endif
341#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
342#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
343void main() {
344#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
345#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
346vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;
347#ifdef BUILDING_FAUX_FACADE
348v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);}
349#endif
350v_pos=a_pos_3f;
351#ifdef RENDER_CUTOFF
352vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
353#endif
354#ifdef RENDER_SHADOWS
355vec3 shadow_pos=v_pos;
356#ifdef NORMAL_OFFSET
357vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
358#endif
359v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);v_depth_shadows=gl_Position.w;
360#endif
361#ifdef FOG
362v_fog_pos=fog_position(v_pos);
363#endif
364gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}`),buildingBloom:oi(`in vec4 v_color_emissive;
365#pragma mapbox: define-attribute highp vec4 bloom_attenuation
366#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
367float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
368#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
369float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
369opacity*=saturate(1.0-distance*distance);
370#endif
371glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
372#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
373#pragma mapbox: define-attribute highp vec4 bloom_attenuation
374out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
375#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
376#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
377#ifdef HAS_ATTRIBUTE_a_part_color_emissive
378vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
379#else
380v_color_emissive=vec4(1.0);
381#endif
382gl_Position=u_matrix*vec4(a_pos_3f,1.0);}`),buildingDepth:oi(`in highp float v_depth;void main() {
383#ifndef DEPTH_TEXTURE
384glFragColor=pack_depth(v_depth);
385#endif
386}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:oi(`#include "_prelude_fog.fragment.glsl"
387#include "_prelude_lighting.glsl"
388in vec3 v_data;in float v_visibility;
389#pragma mapbox: define highp vec4 color
390#pragma mapbox: define mediump float radius
391#pragma mapbox: define lowp float blur
392#pragma mapbox: define lowp float opacity
393#pragma mapbox: define highp vec4 stroke_color
394#pragma mapbox: define mediump float stroke_width
395#pragma mapbox: define lowp float stroke_opacity
396uniform float u_emissive_strength;void main() {
397#pragma mapbox: initialize highp vec4 color
398#pragma mapbox: initialize mediump float radius
399#pragma mapbox: initialize lowp float blur
400#pragma mapbox: initialize lowp float opacity
401#pragma mapbox: initialize highp vec4 stroke_color
402#pragma mapbox: initialize mediump float stroke_width
403#pragma mapbox: initialize lowp float stroke_opacity
404vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 
405smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
406smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
407antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
408);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
409#ifdef LIGHTING_3D_MODE
410out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
411#endif
412#ifdef FOG
413out_color=fog_apply_premultiplied(out_color,v_fog_pos);
414#endif
415glFragColor=out_color*(v_visibility*opacity_t);
416#ifdef OVERDRAW_INSPECTOR
417glFragColor=vec4(1.0);
418#endif
419}`,`#include "_prelude_fog.vertex.glsl"
420#include "_prelude_terrain.vertex.glsl"
421#define NUM_VISIBILITY_RINGS 2
422#define INV_SQRT2 0.70710678
423#define ELEVATION_BIAS 0.0001
424#define NUM_SAMPLES_PER_RING 16
425uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
426#ifdef PROJECTION_GLOBE_VIEW
427in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
428#endif
429#ifdef ELEVATED_ROADS
430in float a_circle_z_offset;
431#endif
432out vec3 v_data;out float v_visibility;
433#pragma mapbox: define highp vec4 color
434#pragma mapbox: define mediump float radius
435#pragma mapbox: define lowp float blur
436#pragma mapbox: define lowp float opacity
437#pragma mapbox: define highp vec4 stroke_color
438#pragma mapbox: define mediump float stroke_width
439#pragma mapbox: define lowp float stroke_opacity
440vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
441#if defined(TERRAIN)
442return elevation(pos)+ELEVATION_BIAS;
443#else
444return 0.0;
445#endif
446}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
447#ifdef PITCH_WITH_MAP
448#ifdef PROJECTION_GLOBE_VIEW
449return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
450#else
451return u_matrix*( world_center+vec4(sample_offset,0,0) );
452#endif
453#else
454return projected_center+vec4(sample_offset,0,0);
455#endif
456}float get_sample_step() {
457#ifdef PITCH_WITH_MAP
458return 2.0*PI/float(NUM_SAMPLES_PER_RING);
459#else
460return PI/float(NUM_SAMPLES_PER_RING);
461#endif
462}void main(void) {
463#pragma mapbox: initialize highp vec4 color
464#pragma mapbox: initialize mediump float radius
465#pragma mapbox: initialize lowp float blur
466#pragma mapbox: initialize lowp float opacity
467#pragma mapbox: initialize highp vec4 stroke_color
468#pragma mapbox: initialize mediump float stroke_width
469#pragma mapbox: initialize lowp float stroke_opacity
470vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
471#ifdef PROJECTION_GLOBE_VIEW
472vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
473#else 
474surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
475#endif
476#ifdef ELEVATED_ROADS
477world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
478#endif
479vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
480#ifdef PITCH_WITH_MAP
481#ifdef SCALE_WITH_MAP
482view_scale=1.0;
483#else
484view_scale=projected_center.w/u_camera_to_center_distance;
485#endif
486#else
487#ifdef SCALE_WITH_MAP
488view_scale=u_camera_to_center_distance;
489#else
490view_scale=projected_center.w;
491#endif
492#endif
493gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
494#ifdef TERRAIN
495float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
496#ifdef PITCH_WITH_MAP
497float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
498#else
499occlusion_world_center=world_center;occlusion_projected_center=projected_center;
500#endif
501for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
502#else
503visibility=1.0;
504#endif
505#ifdef PROJECTION_GLOBE_VIEW
506visibility=1.0;
507#endif
508v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
509#ifdef FOG
510v_fog_pos=fog_position(world_center.xyz);
511#endif
512}`),clippingMask:oi("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:oi(`#include "_prelude_fog.fragment.glsl"
513uniform highp float u_intensity;in vec2 v_extrude;
514#pragma mapbox: define highp float weight
515#define GAUSS_COEF 0.3989422804014327
516void main() {
517#pragma mapbox: initialize highp float weight
518float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
519#ifdef FOG
520if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
521#endif
522#ifdef OVERDRAW_INSPECTOR
523glFragColor=vec4(1.0);
524#endif
525HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
526#include "_prelude_fog.vertex.glsl"
527uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
528#ifdef PROJECTION_GLOBE_VIEW
529in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
530#endif
531out vec2 v_extrude;
532#pragma mapbox: define highp float weight
533#pragma mapbox: define mediump float radius
534const highp float ZERO=1.0/255.0/16.0;
535#define GAUSS_COEF 0.3989422804014327
536void main(void) {
537#pragma mapbox: initialize highp float weight
538#pragma mapbox: initialize mediump float radius
539vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
540#ifdef PROJECTION_GLOBE_VIEW
541vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
542#else
543pos=vec3(tilePos+extrude,elevation(tilePos));
544#endif
545gl_Position=u_matrix*vec4(pos,1);
546#ifdef FOG
547v_fog_pos=fog_position(pos);
548#endif
549}`),heatmapTexture:oi(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;
550#ifdef OVERDRAW_INSPECTOR
551glFragColor=vec4(0.0);
552#endif
553HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:oi("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
554in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
555#ifdef PROJECTION_GLOBE_VIEW
556uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
557#endif
558out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
559#ifdef PROJECTION_GLOBE_VIEW
560#ifndef PROJECTED_POS_ON_VIEWPORT
561vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
562#endif
563#endif
564vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
5650.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:oi("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
566mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
5670.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:oi("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
568in vec2 a_pos;
569#ifdef PROJECTION_GLOBE_VIEW
570in vec3 a_pos_3;
571#endif
572out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
573#ifdef PROJECTION_GLOBE_VIEW
574gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
575#else
576gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
577#endif
578}`),elevatedStructuresDepth:oi(`void main() {
579#ifndef DEPTH_TEXTURE
580glFragColor=vec4(0.);
581#endif
582}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:oi(`#ifdef DEPTH_RECONSTRUCTION
583in float v_height;
584#endif
585void main() {
586#ifdef DEPTH_RECONSTRUCTION
587if (v_height >=0.0)
588discard;
589#endif
590glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
591#ifdef DEPTH_RECONSTRUCTION
592out float v_height;
593#endif
594void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
595#ifdef DEPTH_RECONSTRUCTION
596if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
597#endif
598gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:oi(`#include "_prelude_fog.fragment.glsl"
599#include "_prelude_lighting.glsl"
600#include "_prelude_shadow.fragment.glsl"
601in vec3 v_normal;in float v_height;
602#ifdef RENDER_SHADOWS
603in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
604#endif
605vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
605vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
606{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;
607#pragma mapbox: define highp vec4 structure_color
608void main() {
609#pragma mapbox: initialize highp vec4 structure_color
610vec3 color=structure_color.xyz;
611#ifdef LIGHTING_3D_MODE
612vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);
613#ifdef RENDER_SHADOWS
614float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
615#else
616color=apply_lighting(color,transformed_normal);
617#endif
618color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}
619#endif
620#ifdef FOG
621color=fog_apply(color,v_fog_pos);
622#endif
623vec4 out_color=vec4(color,1.0);
624#ifdef INDICATOR_CUTOUT
625out_color=applyCutout(out_color,v_height);
626#endif
627#ifdef FEATURE_CUTOUT
628out_color=apply_feature_cutout(out_color,gl_FragCoord);
629#endif
630glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
631#include "_prelude_shadow.vertex.glsl"
632in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
633#ifdef RENDER_SHADOWS
634uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;
635#endif
636#pragma mapbox: define highp vec4 structure_color
637void main() {
638#pragma mapbox: initialize highp vec4 structure_color
639v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);
640#ifdef RENDER_SHADOWS
641vec3 shd_pos0=pos;vec3 shd_pos1=pos;
642#ifdef NORMAL_OFFSET
643vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
644#endif
645v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
646#endif
647#ifdef FOG
648v_fog_pos=fog_position(a_pos);
649#endif
650}`),fill:oi(`#include "_prelude_fog.fragment.glsl"
651#include "_prelude_lighting.glsl"
652#include "_prelude_shadow.fragment.glsl"
653#pragma mapbox: define highp vec4 color
654#pragma mapbox: define lowp float opacity
655uniform float u_emissive_strength;
656#ifdef RENDER_SHADOWS
657uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
658#endif
659#ifdef ELEVATED_ROADS
660in highp float v_road_z_offset;
661#endif
662#ifdef INDICATOR_CUTOUT
663in highp float v_z_offset;
664#endif
665void main() {
666#pragma mapbox: initialize highp vec4 color
667#pragma mapbox: initialize lowp float opacity
668vec4 out_color=color;
669#ifdef LIGHTING_3D_MODE
670out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
671#ifdef RENDER_SHADOWS
672float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
673#endif
674#endif
675#ifdef FOG
676out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
677#endif
678out_color*=opacity;
679#ifdef INDICATOR_CUTOUT
680if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
681#endif
682#ifdef FEATURE_CUTOUT
683out_color=apply_feature_cutout(out_color,gl_FragCoord);
684#endif
685glFragColor=out_color;
686#ifdef OVERDRAW_INSPECTOR
687glFragColor=vec4(1.0);
688#endif
689HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
690#include "_prelude_shadow.vertex.glsl"
691in vec2 a_pos;
692#ifdef ELEVATED_ROADS
693in float a_road_z_offset;out highp float v_road_z_offset;
694#endif
695#ifdef RENDER_SHADOWS
696uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
697#endif
698#ifdef INDICATOR_CUTOUT
699out highp float v_z_offset;
700#endif
701uniform mat4 u_matrix;
702#pragma mapbox: define highp vec4 color
703#pragma mapbox: define lowp float opacity
704#pragma mapbox: define highp float z_offset
705void main() {
706#pragma mapbox: initialize highp vec4 color
707#pragma mapbox: initialize lowp float opacity
708#pragma mapbox: initialize highp float z_offset
709#ifdef ELEVATED_ROADS
710z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
711#endif
712float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
713#ifdef RENDER_SHADOWS
714vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
715#ifdef NORMAL_OFFSET
716vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
717#endif
718v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
719#endif
720#ifdef FOG
721v_fog_pos=fog_position(a_pos);
722#endif
723#ifdef INDICATOR_CUTOUT
724v_z_offset=z_offset;
725#endif
726}`),fillOutline:oi(`#include "_prelude_fog.fragment.glsl"
727#include "_prelude_lighting.glsl"
728#include "_prelude_shadow.fragment.glsl"
729in highp vec2 v_pos;uniform float u_emissive_strength;
730#ifdef RENDER_SHADOWS
731uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
732#endif
733#pragma mapbox: define highp vec4 outline_color
734#pragma mapbox: define lowp float opacity
735void main() {
736#pragma mapbox: initialize highp vec4 outline_color
737#pragma mapbox: initialize lowp float opacity
738float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
739#ifdef LIGHTING_3D_MODE
740out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
741#ifdef RENDER_SHADOWS
742float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
743#endif
744#endif
745#ifdef FOG
746out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
747#endif
748#ifdef FEATURE_CUTOUT
749out_color=apply_feature_cutout(out_color,gl_FragCoord);
750#endif
751glFragColor=out_color*(alpha*opacity);
752#ifdef OVERDRAW_INSPECTOR
753glFragColor=vec4(1.0);
754#endif
755HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
756#include "_prelude_shadow.vertex.glsl"
757in vec2 a_pos;
758#ifdef ELEVATED_ROADS
759in float a_road_z_offset;
760#endif
761#ifdef RENDER_SHADOWS
762uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
763#endif
764uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
765#pragma mapbox: define highp vec4 outline_color
766#pragma mapbox: define lowp float opacity
767#pragma mapbox: define highp float z_offset
768void main() {
769#pragma mapbox: initialize highp vec4 outline_color
770#pragma mapbox: initialize lowp float opacity
771#pragma mapbox: initialize highp float z_offset
772#ifdef ELEVATED_ROADS
773z_offset+=a_road_z_offset;
774#endif
775float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
776#ifdef FLIP_Y
777v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
778#else
779v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
780#endif
781#ifdef RENDER_SHADOWS
782vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
783#ifdef NORMAL_OFFSET
784vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
785#endif
786v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
787#endif
788#ifdef FOG
789v_fog_pos=fog_position(a_pos);
790#endif
791}`),fillOutlinePattern:oi(`#include "_prelude_fog.fragment.glsl"
792#include "_prelude_lighting.glsl"
793#include "_prelude_shadow.fragment.glsl"
794uniform vec2 u_texsize;uniform sampler2D u_image;
795#ifdef FILL_PATTERN_TRANSITION
796uniform float u_pattern_transition;
797#endif
798uniform float u_emissive_strength;
799#ifdef RENDER_SHADOWS
800uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
801#endif
802in highp vec2 v_pos;in highp vec2 v_pos_world;
803#pragma mapbox: define lowp float opacity
804#pragma mapbox: define lowp vec4 pattern
805#ifdef FILL_PATTERN_TRANSITION
806#pragma mapbox: define mediump vec4 pattern_b
807#endif
808void main() {
809#pragma mapbox: initialize lowp float opacity
810#pragma mapbox: initialize mediump vec4 pattern
811#ifdef FILL_PATTERN_TRANSITION
812#pragma mapbox: initialize mediump vec4 pattern_b
813#endif
814vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
815#ifdef FILL_PATTERN_TRANSITION
816vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
817#endif
818#ifdef LIGHTING_3D_MODE
819out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
820#ifdef RENDER_SHADOWS
821float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
822#endif
823#endif
824#ifdef FEATURE_CUTOUT
825out_color=apply_feature_cutout(out_color,gl_FragCoord);
826#endif
827#ifdef FOG
828out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
829#endif
830glFragColor=out_color*(alpha*opacity);
831#ifdef OVERDRAW_INSPECTOR
832glFragColor=vec4(1.0);
833#endif
834HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
835#include "_prelude_shadow.vertex.glsl"
836uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
837#ifdef ELEVATED_ROADS
838in float a_road_z_offset;
839#endif
840#ifdef RENDER_SHADOWS
841uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
842#endif
843out highp vec2 v_pos;out highp vec2 v_pos_world;
844#pragma mapbox: define lowp float opacity
845#pragma mapbox: define lowp vec4 pattern
846#ifdef FILL_PATTERN_TRANSITION
847#pragma mapbox: define mediump vec4 pattern_b
848#endif
849#pragma mapbox: define lowp float pixel_ratio
850#pragma mapbox: define highp float z_offset
851void main() {
852#pragma mapbox: initialize lowp float opacity
853#pragma mapbox: initialize mediump vec4 pattern
854#ifdef FILL_PATTERN_TRANSITION
855#pragma mapbox: initialize mediump vec4 pattern_b
856#endif
857#pragma mapbox: initialize lowp float pixel_ratio
858#pragma mapbox: initialize highp float z_offset
859vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
860#ifdef ELEVATED_ROADS
861z_offset+=a_road_z_offset;
862#endif
863float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
864#ifdef FLIP_Y
865v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
866#else
867v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
868#endif
869#ifdef RENDER_SHADOWS
870vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
871#ifdef NORMAL_OFFSET
872vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
873#endif
874v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
875#endif
876#ifdef FOG
877v_fog_pos=fog_position(a_pos);
878#endif
879}`),fillPattern:oi(`#include "_prelude_fog.fragment.glsl"
880#include "_prelude_lighting.glsl"
881#include "_prelude_shadow.fragment.glsl"
882uniform vec2 u_texsize;uniform sampler2D u_image;
883#ifdef FILL_PATTERN_TRANSITION
884uniform float u_pattern_transition;
885#endif
886in highp vec2 v_pos;uniform float u_emissive_strength;
887#ifdef RENDER_SHADOWS
888uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
889#endif
890#ifdef ELEVATED_ROADS
891in highp float v_road_z_offset;
892#endif
893#pragma mapbox: define lowp float opacity
894#pragma mapbox: define lowp vec4 pattern
895#ifdef FILL_PATTERN_TRANSITION
896#pragma mapbox: define mediump vec4 pattern_b
897#endif
898void main() {
899#pragma mapbox: initialize lowp float opacity
900#pragma mapbox: initialize mediump vec4 pattern
901#ifdef FILL_PATTERN_TRANSITION
902#pragma mapbox: initialize mediump vec4 pattern_b
903#endif
904vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
905#ifdef FILL_PATTERN_TRANSITION
906vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
907#endif
908#ifdef LIGHTING_3D_MODE
909out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
910#ifdef RENDER_SHADOWS
911float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
912#ifdef ELEVATED_ROADS
913out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
914#else
915out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
916#endif
917#endif
918#endif
919#ifdef FEATURE_CUTOUT
920out_color=apply_feature_cutout(out_color,gl_FragCoord);
921#endif
922#ifdef FOG
923out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
924#endif
925glFragColor=out_color*opacity;
926#ifdef OVERDRAW_INSPECTOR
927glFragColor=vec4(1.0);
928#endif
929HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
930#include "_prelude_shadow.vertex.glsl"
931uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
932#ifdef ELEVATED_ROADS
933in float a_road_z_offset;out highp float v_road_z_offset;
934#endif
935#ifdef RENDER_SHADOWS
936uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
937#endif
938out highp vec2 v_pos;
939#pragma mapbox: define lowp float opacity
940#pragma mapbox: define lowp vec4 pattern
941#ifdef FILL_PATTERN_TRANSITION
942#pragma mapbox: define mediump vec4 pattern_b
943#endif
944#pragma mapbox: define lowp float pixel_ratio
945#pragma mapbox: define highp float z_offset
946void main() {
947#pragma mapbox: initialize lowp float opacity
948#pragma mapbox: initialize mediump vec4 pattern
949#pragma mapbox: initialize lowp float pixel_ratio
950#pragma mapbox: initialize highp float z_offset
951#ifdef FILL_PATTERN_TRANSITION
952#pragma mapbox: initialize mediump vec4 pattern_b
953#endif
954vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
955#ifdef ELEVATED_ROADS
956z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
957#endif
958float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
959#ifdef RENDER_SHADOWS
960vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
961#ifdef NORMAL_OFFSET
962vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
963#endif
964v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
965#endif
966#ifdef FOG
967v_fog_pos=fog_position(a_pos);
968#endif
969}`),fillExtrusion:oi(`#include "_prelude_fog.fragment.glsl"
970#include "_prelude_shadow.fragment.glsl"
971#include "_prelude_lig
971hting.glsl"
972in vec4 v_color;in vec4 v_flat;
973#ifdef RENDER_SHADOWS
974in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
975#endif
976uniform lowp float u_opacity;
977#ifdef FAUX_AO
978uniform lowp vec2 u_ao;in vec2 v_ao;
979#endif
980#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
981in vec4 v_roof_color;
982#endif
983#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
984in highp vec3 v_normal;
985#endif
986uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
987#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
988in float v_flood_radius;in float v_has_floodlight;
989#endif
990in float v_height;
991#pragma mapbox: define highp float emissive_strength
992void main() {
993#pragma mapbox: initialize highp float emissive_strength
994#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
995vec3 normal=normalize(v_normal);
996#endif
997float z;vec4 color=v_color;
998#ifdef ZERO_ROOF_RADIUS
999z=float(normal.z > 0.00001);
1000#ifdef LIGHTING_3D_MODE
1001normal=mix(normal,vec3(0.0,0.0,1.0),z);
1002#else
1003color=mix(v_color,v_roof_color,z);
1004#endif
1005#endif
1006float h=max(0.0,v_height);float ao_shade=1.0;
1007#ifdef FAUX_AO
1008float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
1009#ifdef ZERO_ROOF_RADIUS
1010concave*=(1.0-z);
1011#endif
1012float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
1013#ifdef LIGHTING_3D_MODE
1014#ifdef FLOOD_LIGHT
1015color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
1016#else
1017color.rgb*=ao_shade;
1018#endif
1019#else
1020color.rgb*=ao_shade;
1021#endif
1022#endif
1023#ifdef LIGHTING_3D_MODE
1024float flood_radiance=0.0;
1025#ifdef FLOOD_LIGHT
1026flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
1027#endif
1028#ifdef RENDER_SHADOWS
1029#ifdef FLOOD_LIGHT
1030float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
1031#else
1032float shadowed_lighting_factor;
1033#ifdef RENDER_CUTOFF
1034shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
1035#else
1036shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
1037#endif
1038color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
1039#endif
1040#else
1041color.rgb=apply_lighting(color.rgb,normal);
1042#ifdef FLOOD_LIGHT
1043color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
1044#endif
1045#endif
1046color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
1047#endif
1048#ifdef FOG
1049color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
1050#endif
1051#ifdef INDICATOR_CUTOUT
1052color=applyCutout(color,h);
1053#endif
1054#ifdef FEATURE_CUTOUT
1055color=apply_feature_cutout(color,gl_FragCoord);
1056#endif
1057glFragColor=color;
1058#ifdef OVERDRAW_INSPECTOR
1059glFragColor=vec4(1.0);
1060#endif
1061HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1062#include "_prelude_terrain.vertex.glsl"
1063#include "_prelude_shadow.vertex.glsl"
1064#include "_prelude_lighting.glsl"
1065uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1066#ifdef RENDER_WALL_MODE
1067in vec3 a_join_normal_inside;
1068#endif
1069#ifdef PROJECTION_GLOBE_VIEW
1070in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1071#endif
1072#ifdef TERRAIN
1073uniform int u_height_type;uniform int u_base_type;
1074#endif
1075uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
1076#ifdef RENDER_SHADOWS
1077uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
1078#endif
1079#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1080out vec4 v_roof_color;
1081#endif
1082#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1083out highp vec3 v_normal;
1084#endif
1085#ifdef FAUX_AO
1086uniform lowp vec2 u_ao;out vec2 v_ao;
1087#endif
1088#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1089out float v_flood_radius;out float v_has_floodlight;
1090#endif
1091out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1092#pragma mapbox: define highp float base
1093#pragma mapbox: define highp float height
1094#pragma mapbox: define highp vec4 color
1095#pragma mapbox: define highp float flood_light_wall_radius
1096#pragma mapbox: define highp float line_width
1097#pragma mapbox: define highp float emissive_strength
1098void main() {
1099#pragma mapbox: initialize highp float base
1100#pragma mapbox: initialize highp float height
1101#pragma mapbox: initialize highp vec4 color
1102#pragma mapbox: initialize highp float flood_light_wall_radius
1103#pragma mapbox: initialize highp float line_width
1104#pragma mapbox: initialize highp float emissive_strength
1105base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
1106#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1107v_normal=normal;
1108#endif
1109base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1110#if defined(HAS_CENTROID) || defined(TERRAIN)
1111centroid_pos=a_centroid_pos;
1112#endif
1113float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1114#ifdef TERRAIN
1115bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1116#else
1117h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
1118#endif
1119#ifdef PROJECTION_GLOBE_VIEW
1120float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1121#endif
1122float cutoff=1.0;vec3 scaled_pos=pos;
1123#ifdef RENDER_CUTOFF
1124vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
1125#ifdef CLIP_ZERO_TO_ONE
1126cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1127#else
1128cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1129#endif
1130if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
1131#endif
1132float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1133#ifdef RENDER_WALL_MODE
1134vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1135#endif
1136gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1137#ifdef RENDER_SHADOWS
1138vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1139#ifdef NORMAL_OFFSET
1140vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1141#endif
1142v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);
1143#endif
1144float NdotL=0.0;float colorvalue=0.0;
1145#ifndef LIGHTING_3D_MODE
1146colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
1147(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1148#endif
1149#ifdef FAUX_AO
1150float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1151#ifdef TERRAIN
1152top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1153#endif
1154v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1155#ifdef PROJECTION_GLOBE_VIEW
1156top_height+=u_height_lift;
1157#endif
1158gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1159#endif
1160#ifdef LIGHTING_3D_MODE
1161#ifdef FLOOD_LIGHT
1162float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
1163#endif
1164v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);
1165#else
1166v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
1167#endif
1168#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1169float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
1170#endif
1171#ifdef FOG
1172v_fog_pos=fog_position(pos);
1173#endif
1174}`),fillExtrusionDepth:oi(`in highp float v_depth;void main() {
1175#ifndef DEPTH_TEXTURE
1176glFragColor=pack_depth(v_depth);
1177#endif
1178}`,`#include "_prelude_terrain.vertex.glsl"
1179uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1180#ifdef TERRAIN
1181uniform int u_height_type;uniform int u_base_type;
1182#endif
1183in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1184#ifdef RENDER_WALL_MODE
1185in vec3 a_join_normal_inside;
1186#endif
1187#pragma mapbox: define highp float base
1188#pragma mapbox: define highp float height
1189#pragma mapbox: define highp float line_width
1190#pragma mapbox: define highp vec4 color
1191out highp float v_depth;void main() {
1192#pragma mapbox: initialize highp float base
1193#pragma mapbox: initialize highp float height
1194#pragma mapbox: initialize highp float line_width
1195#pragma mapbox: initialize highp vec4 color
1196base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1197#if defined(HAS_CENTROID) || defined(TERRAIN)
1198centroid_pos=a_centroid_pos;
1199#endif
1200vec3 pos;
1201#ifdef TERRAIN
1202bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1203#else
1204pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1205#endif
1206#ifdef RENDER_WALL_MODE
1207vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1208#endif
1209float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:oi(`#include "_prelude_fog.fragment.glsl"
1210#include "_prelude_lighting.glsl"
1211uniform vec2 u_texsize;uniform sampler2D u_image;
1212#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1213uniform float u_pattern_transition;
1214#endif
1215#ifdef FAUX_AO
1216uniform lowp vec2 u_ao;in vec3 v_ao;
1217#endif
1218#ifdef LIGHTING_3D_MODE
1219in vec3 v_normal;
1220#endif
1221in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1222#pragma mapbox: define highp float base
1223#pragma mapbox: define highp float height
1224#pragma mapbox: define mediump vec4 pattern
1225#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1226#pragma mapbox: define mediump vec4 pattern_b
1227#endif
1228#pragma mapbox: define highp float pixel_ratio
1229void main() {
1230#pragma mapbox: initialize highp float base
1231#pragma mapbox: initialize highp float height
1232#pragma mapbox: initialize mediump vec4 pattern
1233#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1234#pragma mapbox: initialize mediump vec4 pattern_b
1235#endif
1236#pragma mapbox: initialize highp float pixel_ratio
1237vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1238#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1239vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1240#endif
1241#ifdef LIGHTING_3D_MODE
1242out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1243#else
1244out_color=out_color*v_lighting;
1245#endif
1246#ifdef FAUX_AO
1247float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1247),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
1248#endif
1249#ifdef FOG
1250out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1251#endif
1252#ifdef INDICATOR_CUTOUT
1253out_color=applyCutout(out_color,height);
1254#endif
1255glFragColor=out_color;
1256#ifdef OVERDRAW_INSPECTOR
1257glFragColor=vec4(1.0);
1258#endif
1259HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1260#include "_prelude_terrain.vertex.glsl"
1261#include "_prelude_lighting.glsl"
1262uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1263#ifdef RENDER_WALL_MODE
1264in vec3 a_join_normal_inside;
1265#endif
1266#ifdef PROJECTION_GLOBE_VIEW
1267in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1268#endif
1269#ifdef TERRAIN
1270uniform int u_height_type;uniform int u_base_type;
1271#endif
1272out highp vec2 v_pos;out vec4 v_lighting;
1273#ifdef FAUX_AO
1274uniform lowp vec2 u_ao;out vec3 v_ao;
1275#endif
1276#ifdef LIGHTING_3D_MODE
1277out vec3 v_normal;
1278#endif
1279#pragma mapbox: define highp float base
1280#pragma mapbox: define highp float height
1281#pragma mapbox: define highp vec4 color
1282#pragma mapbox: define mediump vec4 pattern
1283#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1284#pragma mapbox: define mediump vec4 pattern_b
1285#endif
1286#pragma mapbox: define highp float pixel_ratio
1287#pragma mapbox: define highp float line_width
1288void main() {
1289#pragma mapbox: initialize highp float base
1290#pragma mapbox: initialize highp float height
1291#pragma mapbox: initialize highp vec4 color
1292#pragma mapbox: initialize mediump vec4 pattern
1293#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1294#pragma mapbox: initialize mediump vec4 pattern_b
1295#endif
1296#pragma mapbox: initialize highp float pixel_ratio
1297#pragma mapbox: initialize highp float line_width
1298vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
1299#if defined(HAS_CENTROID) || defined(TERRAIN)
1300centroid_pos=a_centroid_pos;
1301#endif
1302float ele=0.0;float h=z;vec3 p;float c_ele;
1303#ifdef TERRAIN
1304bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
1305#else
1306p=vec3(pos_nx.xy,z);
1307#endif
1308#ifdef PROJECTION_GLOBE_VIEW
1309float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1310#endif
1311#ifdef RENDER_WALL_MODE
1312vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
1313#endif
1314float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
1315? pos_nx.xy
1316: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
1317#ifdef LIGHTING_3D_MODE
1318NdotL=calculate_NdotL(normal);
1319#else
1320NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1321#endif
1322if (normal.y !=0.0) {float r=0.84;
1323#ifndef LIGHTING_3D_MODE
1324r=mix(0.7,0.98,1.0-u_lightintensity);
1325#endif
1326NdotL*=(
1327(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1328#ifdef FAUX_AO
1329float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1330#ifdef TERRAIN
1331top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1332#endif
1333v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1334#ifdef PROJECTION_GLOBE_VIEW
1335top_height+=u_height_lift;
1336#endif
1337gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1338#endif
1339#ifdef LIGHTING_3D_MODE
1340v_normal=normal;
1341#else
1342v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1343#endif
1344#ifdef FOG
1345v_fog_pos=fog_position(p);
1346#endif
1347}`),groundShadow:oi(`#include "_prelude_shadow.fragment.glsl"
1348precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1349#ifdef FOG
1350in float v_fog_opacity;
1351#endif
1352void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
1353#ifdef RENDER_CUTOFF
1354shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1355#endif
1356#ifdef FOG
1357shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1358#endif
1359#ifdef INDICATOR_CUTOUT
1360shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1361#endif
1362glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1363uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
1364#ifdef FOG
1365out float v_fog_opacity;
1366#endif
1367void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);
1368#ifdef FOG
1369v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
1370#endif
1371}`),fillExtrusionGroundEffect:oi(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
1372#ifdef SDF_SUBPASS
1373in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
1374#ifdef FOG
1375in highp float v_fog;
1376#endif
1377#endif
1378void main() {
1379#ifdef CLEAR_SUBPASS
1380vec4 color=vec4(1.0);
1381#ifdef CLEAR_FROM_TEXTURE
1382color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1383#endif
1384glFragColor=color;
1385#else
1386#ifdef SDF_SUBPASS
1387highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
1388#ifdef FOG
1389fog=v_fog;
1390#endif
1391#ifdef RENDER_CUTOFF
1392fog*=v_cutoff_opacity;
1393#endif
1394glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1395#else
1396vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1397#ifdef OVERDRAW_INSPECTOR
1398color=vec4(1.0);
1399#endif
1400glFragColor=color;
1401#endif
1402HANDLE_WIREFRAME_DEBUG;
1403#endif
1404}`,`#include "_prelude_fog.vertex.glsl"
1405in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
1406#ifdef SDF_SUBPASS
1407out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1408#ifdef FOG
1409out highp float v_fog;
1410#endif
1411#endif
1412uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1413#pragma mapbox: define highp float flood_light_ground_radius
1414const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1415#pragma mapbox: initialize highp float flood_light_ground_radius
1416vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
1417#ifdef SDF_SUBPASS
1418v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
1419#ifdef FOG
1420v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1421#endif
1422#endif
1423float hidden_by_landmark=0.0;
1424#ifdef HAS_CENTROID
1425hidden_by_landmark=a_hidden_by_landmark;
1426#endif
1427float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));
1428#ifdef RENDER_CUTOFF
1429v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1430#endif
1431}`),hillshadePrepare:oi(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
1432(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1433)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1434deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:oi(`#include "_prelude_fog.fragment.glsl"
1435#include "_prelude_lighting.glsl"
1436uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
1437#ifdef LIGHTING_3D_MODE
1438glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1439#endif
1440#ifdef FOG
1441glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1442#endif
1443#ifdef OVERDRAW_INSPECTOR
1444glFragColor=vec4(1.0);
1445#endif
1446HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1447uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
1448#ifdef FOG
1449v_fog_pos=fog_position(a_pos);
1450#endif
1451}`),line:oi(`#include "_prelude_fog.fragment.glsl"
1452#include "_prelude_lighting.glsl"
1453#include "_prelude_shadow.fragment.glsl"
1454uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1454uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1455#ifdef ELEVATED_ROADS
1456in highp float v_road_z_offset;
1457#endif
1458#ifdef RENDER_LINE_DASH
1459uniform sampler2D u_dash_image;in vec2 v_tex;
1460#endif
1461#ifdef RENDER_LINE_GRADIENT
1462uniform sampler2D u_gradient_image;
1463#endif
1464#ifdef INDICATOR_CUTOUT
1465in highp float v_z_offset;
1466#endif
1467#ifdef RENDER_SHADOWS
1468uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1469#endif
1470float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;
1471#pragma mapbox: define highp vec4 color
1472#pragma mapbox: define lowp float floorwidth
1473#pragma mapbox: define lowp vec4 dash
1474#pragma mapbox: define lowp float blur
1475#pragma mapbox: define lowp float opacity
1476#pragma mapbox: define lowp float border_width
1477#pragma mapbox: define lowp vec4 border_color
1478float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1479#pragma mapbox: initialize highp vec4 color
1480#pragma mapbox: initialize lowp float floorwidth
1481#pragma mapbox: initialize lowp vec4 dash
1482#pragma mapbox: initialize lowp float blur
1483#pragma mapbox: initialize lowp float opacity
1484#pragma mapbox: initialize lowp float border_width
1485#pragma mapbox: initialize lowp vec4 border_color
1486float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);
1487#ifdef RENDER_LINE_DASH
1488float sdfdist=texture(u_dash_image,v_tex).r;
1488float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1489#endif
1490highp vec4 out_color;
1491#ifdef RENDER_LINE_GRADIENT
1492out_color=texture(u_gradient_image,v_uv.xy);
1493#else
1494out_color=color;
1495#endif
1496float trim_alpha=1.0;
1497#ifdef RENDER_LINE_TRIM_OFFSET
1498highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
1499#endif
1500if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1501#ifdef RENDER_LINE_BORDER
1502float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
1503#endif
1504#ifdef LIGHTING_3D_MODE
1505out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1506#ifdef RENDER_SHADOWS
1507float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1508#ifdef ELEVATED_ROADS
1509out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1510#else
1511out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1512#endif
1513#endif
1514#endif
1515#ifdef FOG
1516out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1517#endif
1518out_color*=(alpha*opacity);
1519#ifdef INDICATOR_CUTOUT
1520out_color=applyCutout(out_color,v_z_offset);
1521#endif
1522#ifdef FEATURE_CUTOUT
1523out_color=apply_feature_cutout(out_color,gl_FragCoord);
1524#endif
1525glFragColor=out_color;
1526#ifdef OVERDRAW_INSPECTOR
1527glFragColor=vec4(1.0);
1528#endif
1529HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1530#include "_prelude_shadow.vertex.glsl"
1531#include "_prelude_terrain.vertex.glsl"
1532#define EXTRUDE_SCALE 0.015873016
1533in vec2 a_pos_normal;in vec4 a_data;
1534#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1535in vec3 a_z_offset_width;
1536#endif
1537#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1538in highp vec3 a_packed;
1539#endif
1540#ifdef RENDER_LINE_DASH
1541in float a_linesofar;
1542#endif
1543uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;
1544#ifdef ELEVATED
1545uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1546#ifdef ELEVATION_REFERENCE_SEA
1547return 0.0;
1548#else
1549return elevation(apos);
1550#endif
1551}
1552#endif
1553out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;
1554#ifdef ELEVATED_ROADS
1555out highp float v_road_z_offset;
1556#endif
1557#ifdef RENDER_LINE_DASH
1558uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1559#endif
1560#ifdef RENDER_LINE_GRADIENT
1561uniform float u_image_height;
1562#endif
1563#ifdef INDICATOR_CUTOUT
1564out highp float v_z_offset;
1565#endif
1566#ifdef RENDER_SHADOWS
1567uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1568#endif
1569#pragma mapbox: define highp vec4 color
1570#pragma mapbox: define lowp float floorwidth
1571#pragma mapbox: define lowp vec4 dash
1572#pragma mapbox: define lowp float blur
1573#pragma mapbox: define lowp float opacity
1574#pragma mapbox: define mediump float gapwidth
1575#pragma mapbox: define lowp float offset
1576#pragma mapbox: define mediump float width
1577#pragma mapbox: define lowp float border_width
1578#pragma mapbox: define lowp vec4 border_color
1579void main() {
1580#pragma mapbox: initialize highp vec4 color
1581#pragma mapbox: initialize lowp float floorwidth
1582#pragma mapbox: initialize lowp vec4 dash
1583#pragma mapbox: initialize lowp float blur
1584#pragma mapbox: initialize lowp float opacity
1585#pragma mapbox: initialize mediump float gapwidth
1586#pragma mapbox: initialize lowp float offset
1587#pragma mapbox: initialize mediump float width
1588#pragma mapbox: initialize lowp float border_width
1589#pragma mapbox: initialize lowp vec4 border_color
1590float a_z_offset;
1591#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1592a_z_offset=a_z_offset_width.x;
1593#endif
1594float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth;
1595#ifdef VARIABLE_LINE_WIDTH
1596float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;
1597#else
1598halfwidth=(u_width_scale*width)/2.0;
1599#endif
1600offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1600vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1601#ifdef ELEVATED_ROADS
1602v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1603#else
1604#ifdef ELEVATED
1605vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1606#ifdef CROSS_SLOPE_VERTICAL
1607float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1608#else
1609#ifdef CROSS_SLOPE_HORIZONTAL
1610float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1611#else
1612float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1613#endif
1614#endif
1615gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1616#else
1617gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1618#endif
1619#endif
1620#ifdef ELEVATED_ROADS
1621#ifdef RENDER_SHADOWS
1622vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1623#ifdef NORMAL_OFFSET
1624vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1625#endif
1626v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1627#endif
1628#endif
1629#ifndef RENDER_TO_TEXTURE
1630float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1631#else
1632v_gamma_scale=1.0;
1633#endif
1634#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1635highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];
1636#ifdef RENDER_LINE_GRADIENT
1637highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);
1638#else
1639v_uv=vec3(a_uv_x,0.0,line_progress);
1640#endif
1641#endif
1642#ifdef RENDER_LINE_DASH
1643float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
1644#endif
1645v_width2=vec2(outset,inset);
1646#ifdef FOG
1647v_fog_pos=fog_position(pos);
1648#endif
1649#ifdef INDICATOR_CUTOUT
1650v_z_offset=a_z_offset;
1651#endif
1652}`),linePattern:oi(`#include "_prelude_fog.fragment.glsl"
1653#include "_prelude_lighting.glsl"
1654#include "_prelude_shadow.fragment.glsl"
1655uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1656#ifdef LINE_PATTERN_TRANSITION
1657uniform float u_pattern_transition;
1658#endif
1659in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1660#ifdef RENDER_LINE_TRIM_OFFSET
1661in highp vec3 v_uv;
1662#endif
1663#ifdef ELEVATED_ROADS
1664in highp float v_road_z_offset;
1665#endif
1666#ifdef LINE_JOIN_NONE
1667in vec2 v_pattern_data;
1668#endif
1669#ifdef INDICATOR_CUTOUT
1670in highp float v_z_offset;
1671#endif
1672#ifdef RENDER_SHADOWS
1673uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1674#endif
1675uniform float u_emissive_strength;
1676#pragma mapbox: define mediump vec4 pattern
1677#ifdef LINE_PATTERN_TRANSITION
1678#pragma mapbox: define mediump vec4 pattern_b
1679#endif
1680#pragma mapbox: define mediump float pixel_ratio
1681#pragma mapbox: define mediump float blur
1682#pragma mapbox: define mediump float opacity
1683void main() {
1684#pragma mapbox: initialize mediump vec4 pattern
1685#ifdef LINE_PATTERN_TRANSITION
1686#pragma mapbox: initialize mediump vec4 pattern_b
1687#endif
1688#pragma mapbox: initialize mediump float pixel_ratio
1689#pragma mapbox: initialize mediump float blur
1690#pragma mapbox: initialize mediump float opacity
1691vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
1692#ifdef LINE_PATTERN_TRANSITION
1693vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1694#endif
1695#ifdef RENDER_LINE_TRIM_OFFSET
1696highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}
1697#endif
1698#ifdef LINE_JOIN_NONE
1699highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}
1700#endif
1701#ifdef LIGHTING_3D_MODE
1702color=apply_lighting_with_emission_ground(color,u_emissive_strength);
1703#ifdef RENDER_SHADOWS
1704float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1705#ifdef ELEVATED_ROADS
1706color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1707#else
1708color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1709#endif
1710#endif
1711#endif
1712#ifdef FOG
1713color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1714#endif
1715color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1716#ifdef INDICATOR_CUTOUT
1717color=applyCutout(color,v_z_offset);
1718#endif
1719glFragColor=color;
1720#ifdef OVERDRAW_INSPECTOR
1721glFragColor=vec4(1.0);
1722#endif
1723HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1724#include "_prelude_shadow.vertex.glsl"
1725#include "_prelude_terrain.vertex.glsl"
1726#define scale 0.015873016
1727in vec2 a_pos_normal;in vec4 a_data;
1728#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1729in vec3 a_z_offset_width;
1730#endif
1731#ifdef RENDER_LINE_TRIM_OFFSET
1732in highp vec3 a_packed;
1733#endif
1734in highp float a_linesofar;
1735#ifdef LINE_JOIN_NONE
1736in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1737#endif
1738#ifdef INDICATOR_CUTOUT
1739out highp float v_z_offset;
1740#endif
1741uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;
1742#ifdef ELEVATED
1743uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1744#ifdef ELEVATION_REFERENCE_SEA
1745return 0.0;
1746#else
1747return elevation(apos);
1748#endif
1749}
1750#endif
1751out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1752#ifdef RENDER_LINE_TRIM_OFFSET
1753out highp vec3 v_uv;
1754#endif
1755#ifdef ELEVATED_ROADS
1756out highp float v_road_z_offset;
1757#endif
1758#ifdef RENDER_SHADOWS
1759uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1760#endif
1761#pragma mapbox: define mediump float blur
1762#pragma mapbox: define mediump float opacity
1763#pragma mapbox: define mediump float offset
1764#pragma mapbox: define mediump float gapwidth
1765#pragma mapbox: define mediump float width
1766#pragma mapbox: define mediump float floorwidth
1767#pragma mapbox: define mediump vec4 pattern
1768#ifdef LINE_PATTERN_TRANSITION
1769#pragma mapbox: define mediump vec4 pattern_b
1770#endif
1771#pragma mapbox: define mediump float pixel_ratio
1772void main() {
1773#pragma mapbox: initialize mediump float blur
1774#pragma mapbox: initialize mediump float opacity
1775#pragma mapbox: initialize mediump float offset
1776#pragma mapbox: initialize mediump float gapwidth
1777#pragma mapbox: initialize mediump float width
1778#pragma mapbox: initialize mediump float floorwidth
1779#pragma mapbox: initialize mediump vec4 pattern
1780#ifdef LINE_PATTERN_TRANSITION
1781#pragma mapbox: initialize mediump vec4 pattern_b
1782#endif
1783#pragma mapbox: initialize mediump float pixel_ratio
1784float a_z_offset;
1785#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1786a_z_offset=a_z_offset_width.x;
1787#endif
1788float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1788vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1789#ifdef ELEVATED_ROADS
1790v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1791#else
1792#ifdef ELEVATED
1793vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1794#ifdef CROSS_SLOPE_VERTICAL
1795float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1796#else
1797#ifdef CROSS_SLOPE_HORIZONTAL
1798float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1799#else
1800float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1801#endif
1802#endif
1803gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1804#else
1805gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1806#endif
1807#endif
1808#ifdef ELEVATED_ROADS
1809#ifdef RENDER_SHADOWS
1810vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1811#ifdef NORMAL_OFFSET
1812vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1813#endif
1814v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1815#endif
1816#endif
1817#ifndef RENDER_TO_TEXTURE
1818float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1819#else
1820v_gamma_scale=1.0;
1821#endif
1822#ifdef RENDER_LINE_TRIM_OFFSET
1823highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
1824#endif
1825v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
1826#ifdef LINE_JOIN_NONE
1827v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
1828#endif
1829#ifdef FOG
1830v_fog_pos=fog_position(pos);
1831#endif
1832#ifdef INDICATOR_CUTOUT
1833v_z_offset=a_z_offset;
1834#endif
1835}`),raster:oi(`#include "_prelude_fog.fragment.glsl"
1836#include "_prelude_lighting.glsl"
1837#include "_prelude_raster_array.glsl"
1838uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;
1839#ifdef PROJECTION_GLOBE_VIEW
1840in float v_split_fade;
1841#endif
1842uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;
1843#ifndef RASTER_ARRAY
1844uniform highp sampler2D u_image0;uniform sampler2D u_image1;
1845#endif
1846#ifdef RASTER_COLOR
1847uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1848#endif
1849void main() {vec4 color0,color1,color;vec2 value;
1850#ifdef RASTER_COLOR
1851#ifdef RASTER_ARRAY
1852#ifdef RASTER_ARRAY_LINEAR
1853value=mix(
1854raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1855);
1856#else
1857value=mix(
1858raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1859);
1860#endif
1861if (value.y > 0.0) value.x/=value.y;
1862#else
1863color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
1864#endif
1865color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
1866#else
1867color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
1868#endif
1869color.a*=u_opacity;
1870#ifdef GLOBE_POLES
1871color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
1872#endif
1873vec3 rgb=color.rgb;rgb=vec3(
1874dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
1875#ifdef LIGHTING_3D_MODE
1876out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
1877#endif
1878#ifdef FOG
1879highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
1880#endif
1881glFragColor=vec4(out_color*color.a,color.a);
1882#ifdef PROJECTION_GLOBE_VIEW
1883glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
1884#endif
1885#ifdef RENDER_CUTOFF
1886glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
1887#endif
1888#ifdef OVERDRAW_INSPECTOR
1889glFragColor=vec4(1.0);
1890#endif
1891HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1892uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
1893#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1894#ifdef GLOBE_POLES
1895in vec3 a_globe_pos;in vec2 a_uv;
1896#else
1897in vec2 a_pos;in vec2 a_texture_pos;
1898#endif
1899out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
1900#ifdef PROJECTION_GLOBE_VIEW
1901out float v_split_fade;
1902#endif
1903void main() {vec2 uv;
1904#ifdef GLOBE_POLES
1905vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
1906#ifdef FOG
1907v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
1908#endif
1909#else
1910float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
1911#ifdef PROJECTION_GLOBE_VIEW
1912vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
1913v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1913if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1914#ifdef FOG
1915v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1916#endif
1917#else
1918gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1919#ifdef FOG
1920v_fog_pos=fog_position(a_pos);
1921#endif
1922#endif
1923#endif
1924v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
1925#ifdef RENDER_CUTOFF
1926v_depth=gl_Position.z;
1927#endif
1928}`),rasterParticle:oi(`#include "_prelude_fog.fragment.glsl"
1929#include "_prelude_lighting.glsl"
1930uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;
1931#ifdef LIGHTING_3D_MODE
1932out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;
1933#endif
1934#ifdef FOG
1935highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
1936#endif
1937glFragColor=vec4(out_color*color.a,color.a);
1938#ifdef OVERDRAW_INSPECTOR
1939glFragColor=vec4(1.0);
1940#endif
1941HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1942uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
1943#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1944in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
1945#ifdef PROJECTION_GLOBE_VIEW
1946vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1947#ifdef FOG
1948v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1949#endif
1950#else
1951uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1952#ifdef FOG
1953v_fog_pos=fog_position(a_pos);
1954#endif
1955#endif
1956v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:oi("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl"
1957in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
1958mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:oi("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:oi(`#include "_prelude_raster_particle.glsl"
1959uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
1959vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(
1960linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
1961);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:oi(`#include "_prelude_lighting.glsl"
1962#include "_prelude_shadow.fragment.glsl"
1963#define SDF_PX 8.0
1964#define SDF 1.0
1965#define ICON 0.0
1966uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;
1967#ifdef ICON_TRANSITION
1968uniform float u_icon_transition;
1969#endif
1970#ifdef COLOR_ADJUSTMENT
1971uniform mat4 u_color_adj_mat;
1972#endif
1973#ifdef INDICATOR_CUTOUT
1974in highp float v_z_offset;
1975#else
1976#ifdef RENDER_SHADOWS
1977in highp float v_z_offset;
1978#endif
1979#endif
1980in vec2 v_tex_a;
1981#ifdef ICON_TRANSITION
1982in vec2 v_tex_b;
1983#endif
1984in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
1985#ifdef RENDER_TEXT_AND_SYMBOL
1986in float is_sdf;in vec2 v_tex_a_icon;
1987#endif
1988#ifdef RENDER_SHADOWS
1989uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1990#endif
1991#pragma mapbox: define highp vec4 fill_color
1992#pragma mapbox: define highp vec4 halo_color
1993#pragma mapbox: define lowp float opacity
1994#pragma mapbox: define lowp float halo_width
1995#pragma mapbox: define lowp float halo_blur
1996#pragma mapbox: define lowp float emissive_strength
1997void main() {
1998#pragma mapbox: initialize highp vec4 fill_color
1999#pragma mapbox: initialize highp vec4 halo_color
2000#pragma mapbox: initialize lowp float opacity
2001#pragma mapbox: initialize lowp float halo_width
2002#pragma mapbox: initialize lowp float halo_blur
2003#pragma mapbox: initialize lowp float emissive_strength
2004vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
2005#ifdef RENDER_TEXT_AND_SYMBOL
2006if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
2007#ifdef OVERDRAW_INSPECTOR
2008glFragColor=vec4(1.0);
2009#endif
2010return;}
2011#endif
2012#ifdef RENDER_SDF
2013float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;
2014#else
2015#ifdef ICON_TRANSITION
2016vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);
2017#else
2018out_color=texture(u_texture,v_tex_a);
2019#endif
2020#ifdef COLOR_ADJUSTMENT
2021out_color=u_color_adj_mat*out_color;
2022#endif
2023#endif
2024out_color*=opacity*fade_opacity;
2025#ifdef LIGHTING_3D_MODE
2026out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
2027#ifdef RENDER_SHADOWS
2028float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
2029#ifdef TERRAIN
2030out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2031#else
2032out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2033#endif
2034#endif
2035#endif
2036#ifdef INDICATOR_CUTOUT
2037out_color=applyCutout(out_color,v_z_offset);
2038#endif
2039#ifdef FEATURE_CUTOUT
2040out_color=apply_feature_cutout(out_color,gl_FragCoord);
2041#endif
2042glFragColor=out_color;
2043#ifdef OVERDRAW_INSPECTOR
2044glFragColor=vec4(1.0);
2045#endif
2046HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2047#include "_prelude_shadow.vertex.glsl"
2048in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
2049#ifdef Z_OFFSET
2050in float a_auto_z_offset;
2051#endif
2052#ifdef PROJECTION_GLOBE_VIEW
2053in vec3 a_globe_anchor;in vec3 a_globe_normal;
2054#endif
2055#ifdef ICON_TRANSITION
2056in vec2 a_texb;
2057#endif
2058#ifdef OCCLUSION_QUERIES
2059in float a_occlusion_query_opacity;
2060#endif
2061#ifdef ELEVATED_ROADS
2062in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2063#endif
2064#ifdef INDICATOR_CUTOUT
2065out highp float v_z_offset;
2066#else
2067#ifdef RENDER_SHADOWS
2068out highp float v_z_offset;
2069#endif
2070#endif
2071uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
2072#ifdef PROJECTION_GLOBE_VIEW
2073uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
2074#endif
2075out vec2 v_tex_a;
2076#ifdef ICON_TRANSITION
2077out vec2 v_tex_b;
2078#endif
2079out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2080#ifdef RENDER_TEXT_AND_SYMBOL
2081out float is_sdf;out vec2 v_tex_a_icon;
2082#endif
2083#ifdef RENDER_SHADOWS
2084uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
2085#endif
2086#pragma mapbox: define highp vec4 fill_color
2087#pragma mapbox: define highp vec4 halo_color
2088#pragma mapbox: define lowp float opacity
2089#pragma mapbox: define lowp float halo_width
2090#pragma mapbox: define lowp float halo_blur
2091#pragma mapbox: define lowp float emissive_strength
2092#pragma mapbox: define lowp float occlusion_opacity
2093#pragma mapbox: define lowp float z_offset
2094void main() {
2095#pragma mapbox: initialize highp vec4 fill_color
2096#pragma mapbox: initialize highp vec4 halo_color
2097#pragma mapbox: initialize lowp float opacity
2098#pragma mapbox: initialize lowp float halo_width
2099#pragma mapbox: initialize lowp float halo_blur
2100#pragma mapbox: initialize lowp float emissive_strength
2101#pragma mapbox: initialize lowp float occlusion_opacity
2102#pragma mapbox: initialize lowp float z_offset
2103vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);
2104#ifdef Z_OFFSET
2105e+=a_auto_z_offset;
2106#endif
2107vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2108#ifdef PROJECTION_GLOBE_VIEW
2109mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
2110#else
2111world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2112#endif
2113vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
2114camera_to_anchor_distance/u_camera_to_center_distance :
2115u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
21160.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
2117#ifdef PROJECTION_GLOBE_VIEW
2118vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;
2119#else
2120offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2121#endif
2122vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2123#ifdef PROJECTION_GLOBE_VIEW
2124#ifdef PROJECTED_POS_ON_VIEWPORT
2125projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2126#else
2127vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);    
2128#endif
2129#else
2130projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2131#endif
2132highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
2133#ifdef TERRAIN
2134#ifdef PITCH_WITH_MAP_TERRAIN
2135vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2136#endif
2137#endif
2138#ifdef Z_OFFSET
2139z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2140#else
2141z+=u_pitch_with_map ? z_offset : 0.0;
2142#endif
2143float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));
2144#ifdef DEPTH_OCCLUSION
2145float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2146#endif
2147#ifdef OCCLUSION_QUERIES
2148float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2149#endif
2150float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2151#ifdef PROJECTION_GLOBE_VIEW
2152vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2153#else
2154#ifdef ELEVATED_ROADS
2155vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2156#else
2157pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2158#endif
2159#endif
2160gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;
2161#ifdef RENDER_TEXT_AND_SYMBOL
2162is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2163#endif
2164#ifdef ICON_TRANSITION
2165v_tex_b=a_texb/u_texsize;
2166#endif
2167#ifdef RENDER_SHADOWS
2168vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2169#ifdef NORMAL_OFFSET
2170vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
2171#endif
2172v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
2173#endif
2174#ifdef INDICATOR_CUTOUT
2175v_z_offset=e;
2176#else
2177#ifdef RENDER_SHADOWS
2178v_z_offset=e;
2179#endif
2180#endif
2181}`),terrainRaster:oi(`#include "_prelude_fog.fragment.glsl"
2182#include "_prelude_shadow.fragment.glsl"
2183#include "_prelude_lighting.glsl"
2184uniform sampler2D u_image0;in vec2 v_pos0;
2185#ifdef FOG
2186in float v_fog_opacity;
2187#endif
2188#ifdef RENDER_SHADOWS
2189in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2190#endif
2191uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2192#ifdef LIGHTING_3D_MODE
2193const vec3 normal=vec3(0.0,0.0,1.0);
2194#ifdef RENDER_SHADOWS
2195float cutoffOpacity=1.0;
2196#ifdef RENDER_CUTOFF
2197cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2198#endif
2199#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2200vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
2201#else
2202float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
2203#endif
2204#else
2205float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2206#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2207color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;
2208#endif
2209#endif
2210#else
2211color=image_color;
2212#endif
2213#ifdef FOG
2214#ifdef ZERO_EXAGGERATION
2215color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2216#else
2217color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2218#endif
2219#endif
2220glFragColor=color;
2221#ifdef OVERDRAW_INSPECTOR
2222glFragColor=vec4(1.0);
2223#endif
2224HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2225#include "_prelude_terrain.vertex.glsl"
2226uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
2227#ifdef FOG
2228out float v_fog_opacity;
2229#endif
2230#ifdef RENDER_SHADOWS
2231uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
2232#endif
2233void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
2234#ifdef FOG
2235#ifdef ZERO_EXAGGERATION
2236v_fog_pos=fog_position(decodedPos);
2237#else
2238v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2239#endif
2240#endif
2241#ifdef RENDER_SHADOWS
2242vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
2243#endif
2244}`),terrainDepth:oi("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2245uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:oi(`#include "_prelude_fog.fragment.glsl"
2246in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_su
2246n_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
2247cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
2248#ifdef FOG
2249sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2250#endif
2251sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2252#ifdef OVERDRAW_INSPECTOR
2253glFragColor=vec4(1.0);
2254#endif
2255}`,Dy),skyboxGradient:oi(`#include "_prelude_fog.fragment.glsl"
2256in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
2257#ifdef FOG
2258color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2259#endif
2260color*=u_opacity;glFragColor=color;
2261#ifdef OVERDRAW_INSPECTOR
2262glFragColor=vec4(1.0);
2263#endif
2264}`,Dy),skyboxCapture:oi
vendor: 3,792 bytes, lines 2264-2275
2264(`
2265in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
2266#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2267#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2268#define MIE_G                   0.76
2269#define DENSITY_HEIGHT_SCALE_R  8000.0
2270#define DENSITY_HEIGHT_SCALE_M  1200.0
2271#define PLANET_RADIUS           6360e3
2272#define ATMOSPHERE_RADIUS       6420e3
2273#define SAMPLE_STEPS            10
2274#define DENSITY_STEPS           4
2275float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2275Raster:oi(`#include "_prelude_fog.fragment.glsl"
2276#include "_prelude_lighting.glsl"
2277uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;
2278#ifndef FOG
2279uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
2280#endif
2281void main() {vec4 color;
2282#ifdef CUSTOM_ANTIALIASING
2283highp vec2 uv=gl_FragCoord.xy/u_viewport;
2284#ifdef FLIP_Y
2285uv.y=1.0-uv.y;
2286#endif
2287highp vec3 ray_dir=mix(
2288mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
2289#ifdef LIGHTING_3D_MODE
2290#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2291raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);
2292#else
2293raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2294#endif
2295#else
2296color=vec4(raster.rgb*antialias,raster.a*antialias);
2297#endif
2298#else
2299color=texture(u_image0,v_pos0);
2300#ifdef LIGHTING_3D_MODE
2301#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2302color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;
2303#else
2304color=apply_lighting_ground(color);
2305#endif
2306#endif
2307#endif
2308#ifdef FOG
2309color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2310#endif
2311color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2312#ifdef OVERDRAW_INSPECTOR
2313glFragColor=vec4(1.0);
2314#endif
2315HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2316#include "_prelude_terrain.vertex.glsl"
2317uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
2318#ifdef GLOBE_POLES
2319in vec3 a_globe_pos;in vec2 a_uv;
2320#else
2321in vec2 a_pos;
2322#endif
2323out vec2 v_pos0;void main() {
2324#ifdef GLOBE_POLES
2325vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2326#else
2327float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
2328#endif
2329v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2330#ifdef GLOBE_POLES
2331vec3 up_vector=globe_derived_up_vector;
2332#else
2333vec3 up_vector=elevationVector(tile_pos);
2334#endif
2335float height=elevation(tile_pos);globe_pos+=up_vector*height;
2336#ifndef GLOBE_POLES
2337globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2338#endif
2339#ifdef GLOBE_POLES
2340vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2341#else
2342vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
2343#endif
2344gl_Position=u_proj_matrix*interpolated_pos;
2345#ifdef FOG
2346v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2347#endif
2348}`),globeAtmosphere:oi(`#include "_prelude_fog.fragment.glsl"
2349uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
2350#ifdef PROJECTION_GLOBE_VIEW
2351globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
2352#ifdef ALPHA_PASS
2353glFragColor=vec4(0,0,0,0);return;
2354#else
2355#ifdef NATIVE
2356glFragColor=vec4(1,1,1,1);
2357#else
2358glFragColor=vec4(0,0,0,1);
2359#endif
2360return;
2361#endif
2362}
2363#endif
2364highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
23650.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2366#ifdef PROJECTION_GLOBE_VIEW
2367highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
2368PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
2369#else
2370horizon_angle=horizon_angle_mercator;
2371#endif
2372horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2372vec3 color_stop_2=u_space_color.rgb;
2373#ifdef ALPHA_PASS
2374float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
2375#else
2376vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);
2377#endif
2378}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
2379mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
2380mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:oi(`#include "_prelude_fog.fragment.glsl"
2381#include "_prelude_shadow.fragment.glsl"
2382#include "_prelude_lighting.glsl"
2383uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2384#ifdef RENDER_SHADOWS
2385in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2386#endif
2387#ifdef OCCLUSION_TEXTURE_TRANSFORM
2388uniform vec4 u_occlusionTextureTransform;
2389#endif
2390#pragma mapbox: define-attribute highp vec3 normal_3f
2391#pragma mapbox: define-attribute highp vec3 color_3f
2392#pragma mapbox: define-attribute highp vec4 color_4f
2393#pragma mapbox: define-attribute highp vec2 uv_2f
2394#pragma mapbox: initialize-attribute highp vec3 normal_3f
2395#pragma mapbox: initialize-attribute highp vec3 color_3f
2396#pragma mapbox: initialize-attribute highp vec4 color_4f
2397#pragma mapbox: initialize-attribute highp vec2 uv_2f
2398#ifdef HAS_ATTRIBUTE_a_pbr
2399in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2400#endif
2401#ifdef HAS_TEXTURE_u_baseColorTexture
2402uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2403#endif
2404#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2405uniform sampler2D u_metallicRoughnessTexture;
2406#endif
2407#ifdef HAS_TEXTURE_u_occlusionTexture
2408uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2409#endif
2410#ifdef HAS_TEXTURE_u_normalTexture
2411uniform sampler2D u_normalTexture;
2412#endif
2413#ifdef HAS_TEXTURE_u_emissionTexture
2414uniform sampler2D u_emissionTexture;
2415#endif
2416#ifdef APPLY_LUT_ON_GPU
2417uniform highp sampler3D u_lutTexture;
2418#endif
2419#ifdef TERRAIN_FRAGMENT_OCCLUSION
2420in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2421#ifdef DEPTH_D24
2422highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2423#else
2424highp float unpack_depth_rgba(highp vec4 rgba_depth)
2425{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
2426#endif
2427bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2428#ifdef DEPTH_D24
2429highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2430#else
2431highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2432#endif
2433return v_depth > depth+0.0005;}
2434#endif
2435#define saturate(_x) clamp(_x,0.,1.)
2436vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
2437{
2438#ifdef LIGHTING_3D_MODE
2439vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2440#ifdef RENDER_SHADOWS
2441lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2442#else
2443lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2444#endif
2445return apply_lighting(albedo,transformed_normal,lighting_factor);
2446#else
2447vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2447Color),vec3(1.0));return c3;
2448#endif
2449}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2450#ifdef HAS_ATTRIBUTE_a_color_3f
2451albedo*=vec4(color_3f,1.0);
2452#endif
2453#ifdef HAS_ATTRIBUTE_a_pbr
2454#else
2455#ifdef HAS_ATTRIBUTE_a_color_4f
2456albedo*=color_4f;
2457#endif
2458#endif
2459#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2460vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2461#ifdef UNPREMULT_TEXTURE_IN_SHADER
2462if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2463#endif
2464if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2465#endif
2466vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2467#ifdef APPLY_LUT_ON_GPU
2468color=applyLUT(u_lutTexture,color);
2469#endif
2470return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2471#ifdef HAS_TEXTURE_u_normalTexture
2472highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;
2473#ifdef FLIP_Y
2474T=-T;B=-B;
2475#endif
2476highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
2477#else
2478return mat3(1.0);
2479#endif
2480}highp vec3 getNormal(){highp vec3 n;
2481#ifdef HAS_ATTRIBUTE_a_normal_3f
2482n=normalize(normal_3f);
2483#else
2484highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));
2485#ifdef FLIP_Y
2486n=normalize(cross(fdx,fdy));
2487#else
2488n=normalize(cross(fdx,fdy))*-1.0;
2489#endif
2490#endif
2491#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2492vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
2493#endif
2494return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
2495#ifdef HAS_ATTRIBUTE_a_pbr
2496mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2497#endif
2498#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2499vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2500#endif
2501const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
2502{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
2503{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2504{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
2505{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
2506{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
2507{
2508#ifdef LIGHTING_3D_MODE
2509return mat.diffuseColor;
2510#else
2511return mat.diffuseColor/PI;
2512#endif
2513}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2514{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
2515{vec3 env_light=vec3(0.65,0.65,0.65);
2516#ifdef LIGHTING_3D_MODE
2517float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2518#endif
2519vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
2520{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
2521#ifdef RENDER_SHADOWS
2522lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2523#else
2524lighting_factor=NdotL;
2525#endif
2526vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2526Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2527#if !defined(LIGHTING_3D_MODE)
2528const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
2529#endif
2530color*=intensityFactor;return color;}void main() {
2531#ifdef TERRAIN_FRAGMENT_OCCLUSION
2532if (isOccluded()) {discard;}
2533#endif
2534vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2535#ifdef LIGHTING_3D_MODE
2536lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2537#endif
2538vec4 finalColor;
2539#ifdef DIFFUSE_SHADED
2540vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2541#ifdef HAS_TEXTURE_u_occlusionTexture
2542float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2543#endif
2544finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2545#else
2546Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2547#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2548#ifdef OCCLUSION_TEXTURE_TRANSFORM
2549vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2550#else
2551vec2 uv=uv_2f;
2552#endif
2553ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2554#endif
2555vec4 emissive=u_emissiveFactor;
2556#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2557emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2558#endif
2559#ifdef APPLY_LUT_ON_GPU
2560float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2561#endif
2562color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2563#ifdef HAS_ATTRIBUTE_a_pbr
2564float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;
2565#ifdef APPLY_LUT_ON_GPU
2566color_mix=applyLUT(u_lutTexture,color_mix);
2567#endif
2568color=mix(color,color_mix,min(1.0,resEmission));
2569#ifdef HAS_ATTRIBUTE_a_color_4f
2570float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2570y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
2571#endif
2572#endif
2573vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2574#endif
2575#ifdef FOG
2576finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2577#endif
2578#ifdef RENDER_CUTOFF
2579finalColor*=v_cutoff_opacity;
2580#endif
2581#ifdef INDICATOR_CUTOUT
2582finalColor=applyCutout(finalColor,v_position_height.w);
2583#endif
2584#ifdef FEATURE_CUTOUT
2585finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
2586#endif
2587glFragColor=finalColor;
2588#ifdef OVERDRAW_INSPECTOR
2589glFragColor=vec4(1.0);
2590#endif
2591HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2592#include "_prelude_shadow.vertex.glsl"
2593in vec3 a_pos_3f;
2594#pragma mapbox: define-attribute highp vec3 normal_3f
2595#pragma mapbox: define-attribute highp vec2 uv_2f
2596#pragma mapbox: define-attribute highp vec3 color_3f
2597#pragma mapbox: define-attribute highp vec4 color_4f
2598#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2599#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2600uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2601#ifdef INSTANCED_ARRAYS
2602in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2603#else
2604uniform highp mat4 u_normal_matrix;
2605#endif
2606#ifdef RENDER_SHADOWS
2607uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
2608#endif
2609out vec4 v_position_height;out lowp vec4 v_color_mix;
2610#ifdef TERRAIN_FRAGMENT_OCCLUSION
2611out highp float v_depth;
2612#endif
2613#ifdef HAS_ATTRIBUTE_a_pbr
2614out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2615#endif
2616vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2617#pragma mapbox: initialize-attribute highp vec3 normal_3f
2618#pragma mapbox: initialize-attribute highp vec2 uv_2f
2619#pragma mapbox: initialize-attribute highp vec3 color_3f
2620#pragma mapbox: initialize-attribute highp vec4 color_4f
2621#pragma mapbox: initialize-attribute-custom highp vec4 pbr
2622#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2623highp mat4 normal_matrix;
2624#ifdef INSTANCED_ARRAYS
2625normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2626#else
2627normal_matrix=u_normal_matrix;
2628#endif
2629vec3 local_pos;mat3 rs;
2630#ifdef MODEL_POSITION_ON_GPU
2631vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
2632#else
2633local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
2634#endif
2635v_position_height.w=a_pos_3f.z;
2636#ifdef HAS_ATTRIBUTE_a_pbr
2637vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
2638#endif
2639#ifdef FOG
2640v_fog_pos=fog_position(local_pos);
2641#endif
2642#ifdef RENDER_CUTOFF
2643v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2644#endif
2645#ifdef TERRAIN_FRAGMENT_OCCLUSION
2646v_depth=gl_Position.z/gl_Position.w;
2647#endif
2648#ifdef HAS_ATTRIBUTE_a_normal_3f
2649#ifdef MODEL_POSITION_ON_GPU
2650float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
2651#else
2652normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2653#endif
2654#endif
2655#ifdef HAS_ATTRIBUTE_a_pbr
2656#ifdef HAS_ATTRIBUTE_a_color_4f
2657v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
2658#endif
2659#endif
2660#ifdef RENDER_SHADOWS
2661vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2662#ifdef NORMAL_OFFSET
2663#ifdef HAS_ATTRIBUTE_a_normal_3f
2664#ifdef MODEL_POSITION_ON_GPU
2665vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2666#else
2667vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2668#endif
2669#endif
2670#endif
2671v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;
2672#endif
2673}`),modelDepth:oi(`in highp float v_depth;void main() {
2674#ifndef DEPTH_TEXTURE
2675glFragColor=pack_depth(v_depth);
2676#endif
2677}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
2678#ifdef MODEL_POSITION_ON_GPU
2679#ifdef INSTANCED_ARRAYS
2680in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2681#else
2682uniform highp mat4 u_instance;
2683#endif
2684uniform highp mat4 u_node_matrix;
2685#endif
2686void main() {
2687#ifdef MODEL_POSITION_ON_GPU
2688highp mat4 instance;
2689#ifdef INSTANCED_ARRAYS
2690instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2691#else
2692instance=u_instance;
2693#endif
2694vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2694rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);
2695#else
2696gl_Position=u_matrix*vec4(a_pos_3f,1);
2697#endif
2698v_depth=gl_Position.z/gl_Position.w;}`),stars:oi(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2699{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
2700in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:oi("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",`
2701in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
2702uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
2703uniform float u_horizontalOscillationRate; 
2704uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
2705localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:oi("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",`
2706in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
2707uniform float u_velocity; 
2708uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2708pos*=halfBoxSize; 
2709pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+
2710localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:oi("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:oi("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2711in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;
2712#ifdef TERRAIN
2713float e=elevation(world_pos.xy);world_pos.z+=e;
2714#endif
2715vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function nl(d,i){const l=d.replace(/\s*\/\/[^\n]*\n/g,`
2716`).split(`
2717`);for(let f of l)if(f=f.trim(),f[0]==="#"&&f.includes("if")&&!f.includes("endif")){f=f.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const _=f.split(" ");for(const v of _)i.includes(v)||i.push(v)}}function oi(d,i){const l=/#include\s+"([^"]+)"/g,f=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let _=i.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);_&&(_=_.map(k=>{const R=k.split(" ");return R[R.length-1]}),_=[...new Set(_)]);const v={},b=[],S=[];if(d=d.replace(l,(k,R)=>(S.push(R),"")),(i=i.replace(l,(k,R)=>(b.push(R),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let C=[...Rf];nl(d,C),nl(i,C);for(const k of[...b,...S])Bu[k]||console.error(`Undefined include: ${k}`),Va[k]||(Va[k]=[],nl(Bu[k],Va[k])),C=[...C,...Va[k]];return{fragmentSource:d=d.replace(f,(k,R,F,z,N)=>(v[N]=!0,R==="define"?`
2718#ifndef HAS_UNIFORM_u_${N}
2719in ${F} ${z} ${N};
2720#else
2721uniform ${F} ${z} u_${N};
2722#endif
2723`:R==="initialize"?`
2724#ifdef HAS_UNIFORM_u_${N}
2725    ${F} ${z} ${N} = u_${N};
2726#endif
2727`:R==="define-attribute"?`
2728#ifdef HAS_ATTRIBUTE_a_${N}
2729    in ${F} ${z} ${N};
2730#endif
2731`:R==="initialize-attribute"?"":void 0)),vertexSource:i=i.replace(f,(k,R,F,z,N)=>{const G=z==="float"?"vec2":z,U=N.match(/color/)?"color":G;return R==="define-attribute-vertex-shader-only"?`
2732#ifdef HAS_ATTRIBUTE_a_${N}
2733in ${F} ${z} a_${N};
2734#endif
2735`:v[N]?R==="define"?`
2736#ifndef HAS_UNIFORM_u_${N}
2737uniform lowp float u_${N}_t;
2738in ${F} ${G} a_${N};
2739out ${F} ${z} ${N};
2740#else
2741uniform ${F} ${z} u_${N};
2742#endif
2743`:R==="initialize"?U==="vec4"?`
2744#ifndef HAS_UNIFORM_u_${N}
2745    ${N} = a_${N};
2746#else
2747    ${F} ${z} ${N} = u_${N};
2748#endif
2749`:`
2750#ifndef HAS_UNIFORM_u_${N}
2751    ${N} = unpack_mix_${U}(a_${N}, u_${N}_t);
2752#else
2753    ${F} ${z} ${N} = u_${N};
2754#endif
2755`:R==="define-attribute"?`
2756#ifdef HAS_ATTRIBUTE_a_${N}
2757    in ${F} ${z} a_${N};
2758    out ${F} ${z} ${N};
2759#endif
2760`:R==="initialize-attribute"?`
2761#ifdef HAS_ATTRIBUTE_a_${N}
2762    ${N} = a_${N};
2763#endif
2764`:void 0:R==="define"?`
2765#ifndef HAS_UNIFORM_u_${N}
2766uniform lowp float u_${N}_t;
2767in ${F} ${G} a_${N};
2768#else
2769uniform ${F} ${z} u_${N};
2770#endif
2771`:R==="define-instanced"?U==="mat4"?`
2772#ifdef INSTANCED_ARRAYS
2773in vec4 a_${N}0;
2774in vec4 a_${N}1;
2775in vec4 a_${N}2;
2776in vec4 a_${N}3;
2777#else
2778uniform ${F} ${z} u_${N};
2779#endif
2780`:`
2781#ifdef INSTANCED_ARRAYS
2782in ${F} ${G} a_${N};
2783#else
2784uniform ${F} ${z} u_${N};
2785#endif
2786`:R==="initialize-attribute-custom"?`
2787#ifdef HAS_ATTRIBUTE_a_${N}
2788    ${F} ${z} ${N} = a_${N};
2789#endif
2790`:U==="vec4"?`
2791#ifndef HAS_UNIFORM_u_${N}
2792    ${F} ${z} ${N} = a_${N};
2793#else
2794    ${F} ${z} ${N} = u_${N};
2795#endif
2796`:`
2797#ifndef HAS_UNIFORM_u_${N}
2798    ${F} ${z} ${N} = unpack_mix_${U}(a_${N}, u_${N}_t);
2799#else
2800    ${F} ${z} ${N} = u_${N};
2801#endif
2802`}),staticAttributes:_,usedDefines:C,vertexIncludes:b,fragmentIncludes:S}}class wI{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,l,f,_,v,b,S,C){this.context=i;let k=this.boundPaintVertexBuffers.length!==_.length;for(let F=0;!k&&F<_.length;F++)this.boundPaintVertexBuffers[F]!==_[F]&&(k=!0);let R=this.boundDynamicVertexBuffers.length!==S.length;for(let F=0;!R&&F<S.length;F++)this.boundDynamicVertexBuffers[F]!==S[F]&&(R=!0);if(!this.vao||this.boundProgram!==l||this.boundLayoutVertexBuffer!==f||k||R||this.boundIndexBuffer!==v||this.boundVertexOffset!==b)this.freshBind(l,f,_,v,b,S,C);else{i.bindVertexArrayOES.set(this.vao);for(const F of S)F&&(F.bind(),C&&F.instanceCount&&F.setVertexAttribDivisor(i.gl,l,C));v&&v.dynamicDraw&&v.bind()}}freshBind(i,l,f,_,v,b,S){const C=i.numAttributes,k=this.context,R=k.gl;this.vao&&this.destroy(),this.vao=k.gl.createVertexArray(),k.bindVertexArrayOES.set(this.vao),this.boundProgram=i,this.boundLayoutVertexBuffer=l,this.boundPaintVertexBuffers=f,this.boundIndexBuffer=_,this.boundVertexOffset=v,this.boundDynamicVertexBuffers=b,l.enableAttributes(R,i),l.bind(),l.setVertexAttribPointers(R,i,v);for(const F of f)F.enableAttributes(R,i),F.bind(),F.setVertexAttribPointers(R,i,v);for(const F of b)F&&(F.enableAttributes(R,i),F.bind(),F.setVertexAttribPointers(R,i,v),S&&F.instanceCount&&F.setVertexAttribDivisor(R,i,S));_&&_.bind(),k.currentNumAttributes=C}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Fy(d,i){const l=Math.pow(2,i.canonical.z),f=i.canonical.y;return[new s.ac(0,f/l).toLngLat().lat,new s.ac(0,(f+1)/l).toLngLat().lat]}function TI(d,i,l,f,_,v,b){const S=d.context,C=S.gl,k=l.hillshadeFBO;if(!k)return;d.prepareDrawTile();const R=d.isTileAffectedByFog(i),F=d.getOrCreateProgram("hillshade",{overrideFog:R});S.activeTexture.set(C.TEXTURE0),C.bindTexture(C.TEXTURE_2D,k.colorAttachment.get());const z=((W,Z,re,se)=>{const le=re.paint.get("hillshade-shadow-color"),fe=re.paint.get("hillshade-shadow-color-use-theme").
vendor: 10,475 bytes, line 2802
2802constantOr("default")==="none",we=re.paint.get("hillshade-highlight-color"),Se=re.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",me=re.paint.get("hillshade-accent-color"),ge=re.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ye=re.paint.get("hillshade-emissive-strength");let Ze=s.al(re.paint.get("hillshade-illumination-direction"));if(re.paint.get("hillshade-illumination-anchor")==="viewport")Ze-=W.transform.angle;else if(W.style&&W.style.enable3dLights()&&W.style.directionalLight){const ct=W.style.directionalLight.properties.get("direction"),Qe=s.d1(ct.x,ct.y,ct.z);Ze=s.al(Qe[1])}const Me=!W.options.moving;return{u_matrix:se||W.transform.calculateProjMatrix(Z.tileID.toUnwrapped(),Me),u_image:0,u_latrange:Fy(0,Z.tileID),u_light:[re.paint.get("hillshade-exaggeration"),Ze],u_shadow:le.toPremultipliedRenderColor(fe?null:re.lut),u_highlight:we.toPremultipliedRenderColor(Se?null:re.lut),u_emissive_strength:ye,u_accent:me.toPremultipliedRenderColor(ge?null:re.lut)}})(d,l,f,d.terrain?i.projMatrix:null);d.uploadCommonUniforms(S,F,i.toUnwrapped());const{tileBoundsBuffer:N,tileBoundsIndexBuffer:G,tileBoundsSegments:U}=d.getTileBoundsBuffers(l);F.draw(d,C.TRIANGLES,_,v,b,vr.disabled,z,f.id,N,G,U)}function Ny(d,i,l){if(!i.needsDEMTextureUpload)return;const f=d.context,_=f.gl;f.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||d.getTileTexture(l.stride);const v=l.getPixels();i.demTexture?i.demTexture.update(v,{premultiply:!1}):i.demTexture=new s.T(f,v,_.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function kb(d,i,l){const f=d.context,_=f.gl;if(!i.dem)return;const v=i.dem;if(f.activeTexture.set(_.TEXTURE1),Ny(d,i,v),!i.demTexture)return;i.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);const b=v.dim;f.activeTexture.set(_.TEXTURE0);let S=i.hillshadeFBO;if(!S){const z=new s.T(f,{width:b,height:b,data:null},_.RGBA8);z.bind(_.LINEAR,_.CLAMP_TO_EDGE),S=i.hillshadeFBO=f.createFramebuffer(b,b,!0,"renderbuffer"),S.colorAttachment.set(z.texture)}f.bindFramebuffer.set(S.framebuffer),f.viewport.set([0,0,b,b]);const{tileBoundsBuffer:C,tileBoundsIndexBuffer:k,tileBoundsSegments:R}=d.getMercatorTileBoundsBuffers(),F=[];d.linearFloatFilteringSupported()&&F.push("TERRAIN_DEM_FLOAT_FORMAT"),d.getOrCreateProgram("hillshadePrepare",{defines:F}).draw(d,_.TRIANGLES,Yt.disabled,Cr.disabled,Br.unblended,vr.disabled,((z,N)=>{const G=N.stride,U=s.bz();return s.ca(U,0,s.aj,-s.aj,0,0,1),s.bo(U,U,[0,-s.aj,0]),{u_matrix:U,u_image:1,u_dimension:[G,G],u_zoom:z.overscaledZ}})(i.tileID,v),l.id,C,k,R),i.needsHillshadePrepare=!1}class vn{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class EI extends vn{getDefault(){return s.am.transparent.toNonPremultipliedRenderColor(null)}set(i){const l=this.current;(i.r!==l.r||i.g!==l.g||i.b!==l.b||i.a!==l.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class SI extends vn{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class CI extends vn{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class II extends vn{getDefault(){return[!0,!0,!0,!0]}set(i){const l=this.current;(i[0]!==l[0]||i[1]!==l[1]||i[2]!==l[2]||i[3]!==l[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Rb extends vn{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class AI extends vn{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Sm extends vn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){const l=this.current;(i.func!==l.func||i.ref!==l.ref||i.mask!==l.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class PI extends vn{getDefault(){const i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){const l=this.current;(i[0]!==l[0]||i[1]!==l[1]||i[2]!==l[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class Lb extends vn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;i?l.enable(l.STENCIL_TEST):l.disable(l.STENCIL_TEST),this.current=i,this.dirty=!1}}class By extends vn{getDefault(){return[0,1]}set(i){const l=this.current;(i[0]!==l[0]||i[1]!==l[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class Cm extends vn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;i?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),this.current=i,this.dirty=!1}}class Vy extends vn{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class Vu extends vn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;i?l.enable(l.BLEND):l.disable(l.BLEND),this.current=i,this.dirty=!1}}class Jh extends vn{getDefault(){const i=this.gl;return[i.ONE,i.ZERO,i.ONE,i.ZERO]}set(i){const l=this.current;(i[0]!==l[0]||i[1]!==l[1]||i[2]!==l[2]||i[3]!==l[3]||this.dirty)&&(this.gl.blendFuncSeparate(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Im extends vn{getDefault(){return s.am.transparent.toNonPremultipliedRenderColor(null)}set(i){const l=this.current;(i.r!==l.r||i.g!==l.g||i.b!==l.b||i.a!==l.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Am extends vn{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(i,i),this.current=i,this.dirty=!1)}}class Qh extends vn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;i?l.enable(l.CULL_FACE):l.disable(l.CULL_FACE),this.current=i,this.dirty=!1}}class zb extends vn{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class Uy extends vn{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}let Db=class extends vn{getDefault(){return null}set(d){(d!==this.current||this.dirty)&&(this.gl.useProgram(d),this.current=d,this.dirty=!1)}};class ed extends vn{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class Pm extends vn{getDefault(){const i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){const l=this.current;(i[0]!==l[0]||i[1]!==l[1]||i[2]!==l[2]||i[3]!==l[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Mm extends vn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.bindFramebuffer(l.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class jy extends vn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.bindRenderbuffer(l.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class km extends vn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.bindTexture(l.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class zf extends vn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.bindBuffer(l.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Ob extends vn{getDefault(){return null}set(i){const l=this.gl;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Fb extends vn{getDefault(){return null}set(i){this.gl&&(i!==this.current||this.dirty)&&(this.gl.bindVertexArray(i),this.current=i,this.dirty=!1)}}class Nb extends vn{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.pixelStorei(l.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class td extends vn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Bb extends vn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const l=this.gl;l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class Gy extends vn{constructor(i,l){super(i),this.context=i,this.parent=l}getDefault(){return null}}class MI extends Gy{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const l=this.gl;l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class Vb extends Gy{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const l=this.gl;l.framebufferRenderbuffer(l.FRAMEBUFFER,this.attachment(),l.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class $y extends Gy{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const l=this.gl;l.framebufferTexture2D(l.FRAMEBUFFER,this.attachment(),l.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class Hy extends Vb{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const qy=(d,i,l)=>({u_matrix:d,u_image0:0,u_skirt_height:i,u_ground_shadow_factor:l}),Rm=(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U)=>({u_proj_matrix:Float32Array.from(d),u_globe_matrix:i,u_normalize_matrix:Float32Array.from(f),u_merc_matrix:l,u_zoom_transition:_,u_merc_center:v,u_image0:0,u_frustum_tl:b,u_frustum_tr:S,u_frustum_br:C,u_frustum_bl:k,u_globe_pos:R,u_globe_radius:F,u_viewport:z,u_grid_matrix:U?Float32Array.from(U):new Float32Array(9),u_skirt_height:N,u_far_z_cutoff:G});function Zy(d,i){return d!=null&&i!=null&&!(!d.hasData()||!i.hasData())&&d.demTexture!=null&&i.demTexture!=null&&d.tileID.key!==i.tileID.key}const Uu=new class{constructor(){this.operations={}}newMorphing(d,i,l,f,_){if(d in this.operations){const v=this.operations[d];v.to.tileID.key!==l.tileID.key&&(v.queued=l)}else this.operations[d]={startTime:f,phase:0,duration:_,from:i,to:l,queued:null}}getMorphValuesForProxy(d){if(!(d in this.operations))return null;const i=this.operations[d];return{from:i.from,to:i.to,phase:i.phase}}update(d){for(const i in this.operations){const l=this.operations[i];for(l.phase=(d-l.startTime)/l.duration;l.phase>
2802=1||!this._validOp(l);)if(!this._nextOp(l,d)){delete this.operations[i];break}}}_nextOp(d,i){return!!d.queued&&(d.from=d.to,d.to=d.queued,d.queued=null,d.phase=0,d.startTime=i,!0)}_validOp(d){return d.from.hasData()&&d.to.hasData()}},Ub={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rd(d,i,l){if(i===0)return 0;const f=i<1&&l===514?.25/i:1;return 6*Math.pow(1.5,22-d)*Math.max(i,1)*f}function Df(d,i){const l=1<<d.z;return!i&&(d.x===0||d.x===l-1)||d.y===0||d.y===l-1}const Lm=d=>({u_matrix:d});function Is(d,i,l,f,_){if(_>0){const v=s.q.now(),b=(v-d.timeAdded)/_,S=i?(v-i.timeAdded)/_:-1,C=l.getSource(),k=f.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),R=!i||Math.abs(i.tileID.overscaledZ-k)>Math.abs(d.tileID.overscaledZ-k),F=R&&d.refreshedUponExpiration?1:s.ay(R?b:1-S,0,1);return d.refreshedUponExpiration&&b>=1&&(d.refreshedUponExpiration=!1),i?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}class Wy extends Ss{constructor(i){const l=hs("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},i.style.dispatcher,i.style);super("mock-dem",l,!1),l.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,l){i.state="loaded",l(null)}}class zm extends Ss{constructor(i){const l=hs("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},i.style.dispatcher,i.style);super("proxy",l,!1),l.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(i,l,f){if(i.freezeTileCoverage)return;this.transform=i;const _=i.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((v,b)=>{if(v[b.key]="",!this._tiles[b.key]){const S=new ku(b,this._source.tileSize*b.overscaleFactor(),i.tileZoom,void 0,void 0,this._source.worldview);S.state="loaded",this._tiles[b.key]=S}return v},{});for(const v in this._tiles)v in _||(this.freeFBO(v),this._tiles[v].unloadVectorData(),delete this._tiles[v])}freeFBO(i){const l=this.proxyCachedFBO[i];if(l!==void 0){const f=Object.values(l);this.renderCachePool.push(...f),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Of extends s.aM{constructor(i,l,f){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=l,this.projMatrix=f}}class Dm extends s.dF{constructor(i,l){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},i.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[f,_,v]=function(C){const k=new s.ba,R=new s.a_,F=131;k.reserve(17161),R.reserve(33800);const z=s.aj/128,N=s.aj+z/2,G=N+z;for(let W=-z;W<G;W+=z)for(let Z=-z;Z<G;Z+=z){const re=Z<0||Z>N||W<0||W>N?24575:0,se=s.ay(Math.round(Z),0,s.aj),le=s.ay(Math.round(W),0,s.aj);k.emplaceBack(se+re,le)}const U=(W,Z)=>{const re=Z*F+W;R.emplaceBack(re+1,re,re+F),R.emplaceBack(re+F,re+F+1,re+1)};for(let W=1;W<129;W++)for(let Z=1;Z<129;Z++)U(Z,W);return[0,129].forEach(W=>{for(let Z=0;Z<130;Z++)U(Z,W),U(W,Z)}),[k,R,32768]}(),b=i.context;this.gridBuffer=b.createVertexBuffer(f,s.bc.members),this.gridIndexBuffer=b.createIndexBuffer(_),this.gridSegments=s.bd.simpleSegment(0,0,f.length,_.length),this.gridNoSkirtSegments=s.bd.simpleSegment(0,0,f.length,v),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new zm(l.map),this.orthoMatrix=s.bz(),s.ca(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.aj,0,s.aj,0,1);const S=b.gl;this._overlapStencilMode=new Cr({func:S.GEQUAL,mask:255},0,255,S.KEEP,S.KEEP,S.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=l,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Wy(l.map),this._pendingGroundEffectLayers=[]}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),this._style=i,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(i,l,f){if(i&&i.terrain){this._style!==i&&(this.style=i,this._evaluationZoom=void 0);const _=i.terrain.properties,v=i.terrain.drapeRenderMode===0,b=i.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.q.now();const S=i.terrain&&i.terrain.scope,C=_.get("source"),k=v?this._mockSourceCache:i.getSourceCache(C,S);if(!k)return void s.w(`Couldn't find terrain source "${C}".`);if(this.sourceCache=k,this._attenuationRange=i.terrain.getAttenuationRange(),this._exaggeration=b?this.calculateExaggeration(l):_.get("exaggeration"),!l.projection.requiresDraping&&b&&this._exaggeration===0)return void this._disable();this.enabled=!0;const R=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
2803This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const F=this.getScaledDemTileSize();this.sourceCache.update(l,F,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,R(),this._initializing=!0),R(),l.updateElevation(!0,f),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(l),this._emptyDEMTextureDirty=!0,this._previousZoom=l.zoom}else this._disable()}calculateExaggeration(i){if(this._attenuationRange&&i.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(i.zoom);const l=this._previousCameraAltitude,f=i.getFreeCameraOptions().position.z/i.pixelsPerMeter*i.worldSize;this._previousCameraAltitude=f;const _=l!=null?f-l:Number.MAX_VALUE;if(Math.abs(_)<2)return this._exaggeration;const v=i.zoom,b=this._style.terrain;if(!this._previousUpdateTimestamp)return b.getExaggeration(v);let S=v-this._previousZoom;const C=this._previousUpdateTimestamp;let k=v;this._evaluationZoom!=null&&(k=this._evaluationZoom,Math.abs(v-k)>.5&&(S=.5*(v-k+S)),S*_<0&&(k+=S)),this._evaluationZoom=k;const R=b.getExaggeration(k),F=R===b.getExaggeration(Math.max(0,k-.1));if(F&&Math.abs(R-this._exaggeration)<.01)return R;let z=Math.min(.1,.00375*(this._updateTimestamp-C));return(F||R<.1||Math.abs(S)<1e-4)&&(z=Math.min(.2,4*z)),s.ai(this._exaggeration,R,z)}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(i){i.coord&&i.dataType==="source"?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):i.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const i in this._style._mergedSourceCaches)this._style._mergedSourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(i=>
vendor: 6,327 bytes, line 2803
2803i.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(i){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const l=this.proxySourceCache,f=this.painter.transform;this._initializing&&(this._initializing=f._centerAltitude===0&&this.getAtPointOrZero(s.ac.fromLngLat(f.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const _=this.proxyCoords=l.getIds().map(C=>{const k=l.getTileByID(C).tileID;return k.projMatrix=f.calculateProjMatrix(k.toUnwrapped()),k});(function(C,k){const R=k.transform.pointCoordinate(k.transform.getCameraPoint()),F=new s.P(R.x,R.y);C.sort((z,N)=>{if(N.overscaledZ-z.overscaledZ)return N.overscaledZ-z.overscaledZ;const G=new s.P(z.canonical.x+(1<<z.canonical.z)*z.wrap,z.canonical.y),U=new s.P(N.canonical.x+(1<<N.canonical.z)*N.wrap,N.canonical.y),W=F.mult(1<<z.canonical.z);return W.x-=.5,W.y-=.5,W.distSqr(G)-W.distSqr(U)})})(_,this.painter);const v=this.proxyToSource||{};this.proxyToSource={},_.forEach(C=>{this.proxyToSource[C.key]={}}),this.terrainTileForTile={};const b=this._style._mergedSourceCaches;for(const C in b){const k=b[C];if(!k.used||(k!==this.sourceCache&&this.resetTileLookupCache(k.id),this._setupProxiedCoordsForOrtho(k,i[C],v),k.usedForTerrain))continue;const R=i[C];k.getSource().reparseOverscaled&&this._assignTerrainTiles(R)}this.proxiedCoords[l.id]=_.map(C=>new Of(C,C.key,this.orthoMatrix)),this._assignTerrainTiles(_),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(v),this.renderingToTexture=!1;const S={};this._visibleDemTiles=[];for(const C of this.proxyCoords){const k=this.terrainTileForTile[C.key];if(!k)continue;const R=k.tileID.key;R in S||(this._visibleDemTiles.push(k),S[R]=R)}}_assignTerrainTiles(i){this._initializing||i.forEach(l=>{if(this.terrainTileForTile[l.key])return;const f=this._findTileCoveringTileID(l,this.sourceCache);f&&(this.terrainTileForTile[l.key]=f)})}_prepareDEMTextures(){const i=this.painter.context,l=i.gl;for(const f in this.terrainTileForTile){const _=this.terrainTileForTile[f],v=_.dem;!v||_.demTexture&&!_.needsDEMTextureUpload||(i.activeTexture.set(l.TEXTURE1),Ny(this.painter,_,v))}}_prepareDemTileUniforms(i,l,f,_){if(!l||l.demTexture==null)return!1;const v=i.tileID.canonical,b=Math.pow(2,l.tileID.canonical.z-v.z),S=_||"";return f[`u_dem_tl${S}`]=[v.x*b%1,v.y*b%1],f[`u_dem_scale${S}`]=b,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let i=0;const l=this._visibleDemTiles.reduce((f,_)=>{if(!_.dem)return f;const v=_.dem.tree.minimums[0];return v>0&&i++,f+v},0);return i?l/i:0}_updateEmptyDEMTexture(){const i=this.painter.context,l=i.gl;i.activeTexture.set(l.TEXTURE2);const f=this._getLoadedAreaMinimum(),_=new s.dG({width:1,height:1},new Float32Array([f]));this._emptyDEMTextureDirty=!1;let v=this._emptyDEMTexture;return v?v.update(_,{premultiply:!1}):v=this._emptyDEMTexture=new s.T(i,_,l.R32F,{premultiply:!1}),v}setupElevationDraw(i,l,f){const _=this.painter.context,v=_.gl,b={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};b.u_exaggeration=this.exaggeration();let S=null,C=null,k=1;if(f&&f.morphing&&this._useVertexMorphing){const N=f.morphing.srcDemTile,G=f.morphing.dstDemTile;k=f.morphing.phase,N&&G&&(this._prepareDemTileUniforms(i,N,b,"_prev")&&(C=N),this._prepareDemTileUniforms(i,G,b)&&(S=G))}const R=N=>N&&N.demTexture&&this.painter.linearFloatFilteringSupported()?v.LINEAR:v.NEAREST;let F=null;var z;if(this.enabled?C&&S?(F=S.demTexture,_.activeTexture.set(v.TEXTURE4),C.demTexture.bind(R(C),v.CLAMP_TO_EDGE),b.u_dem_lerp=k):(S=this.terrainTileForTile[i.tileID.key],F=this._prepareDemTileUniforms(i,S,b)?S.demTexture:this.emptyDEMTexture):F=this.emptyDEMTexture,_.activeTexture.set(v.TEXTURE2),F&&(b.u_dem_size=(z=F).size[0]===1?1:z.size[0]-2,F.bind(R(S),v.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(f&&f.useDepthForOcclusion,l,b),f&&f.useMeterToDem&&S){const N=(1<<S.tileID.canonical.z)*s.cb(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;b.u_meter_to_dem=N}if(f&&f.labelPlaneMatrixInv&&(b.u_label_plane_matrix_inv=f.labelPlaneMatrixInv),l.setTerrainUniformValues(_,b),this.painter.transform.projection.name==="globe"){const N=this.globeUniformValues(this.painter.transform,i.tileID.canonical,f&&f.useDenormalizedUpVectorScale);l.setGlobeUniformValues(_,N)}}globeUniformValues(i,l,f){const _=i.projection;return{u_tile_tl_up:_.upVector(l,0,0),u_tile_tr_up:_.upVector(l,s.aj,0),u_tile_br_up:_.upVector(l,s.aj,s.aj),u_tile_bl_up:_.upVector(l,0,s.aj),u_tile_up_scale:f?s.dH(1):_.upVectorScale(l,i.center.lat,i.worldSize).metersToTile}}renderToBackBuffer(i){const l=this.painter,f=this.painter.context;i.length!==0&&(f.bindFramebuffer.set(null),f.viewport.set([0,0,l.width,l.height]),l.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(_,v,b,S,C){if(_.transform.projection.name==="globe")(function(k,R,F,z,N){const G=k.context,U=G.gl;let W,Z;const re=k.transform,se=s.dy(k,G,re),le=(ct,Qe)=>{if(Z===Qe)return;const ft=[Ub[Qe],"PROJECTION_GLOBE_VIEW"];se&&ft.push("CUSTOM_ANTIALIASING");const Rt=k.isTileAffectedByFog(ct);W=k.getOrCreateProgram("globeRaster",{defines:ft,overrideFog:Rt}),Z=Qe},fe=k.colorModeForRenderPass(),we=new Yt(U.LEQUAL,Yt.ReadWrite,k.depthRangeFor3D);Uu.update(N);const Se=s.dz(re),me=[s.aD(re.center.lng),s.aH(re.center.lat)],ge=k.globeSharedBuffers,ye=[re.width*s.q.devicePixelRatio,re.height*s.q.devicePixelRatio],Ze=Float32Array.from(re.globeMatrix),Me={useDenormalizedUpVectorScale:!0};{const ct=k.transform,Qe=rd(ct.zoom,R.exaggeration(),R.sourceCache._source.tileSize);Z=-1;
2803const ft=U.TRIANGLES;for(const Rt of z){const We=F.getTile(Rt),Pe=Cr.disabled,nt=R.prevTerrainTileForTile[Rt.key],Ke=R.terrainTileForTile[Rt.key];Zy(nt,Ke)&&Uu.newMorphing(Rt.key,nt,Ke,N,250),G.activeTexture.set(U.TEXTURE0),We.texture&&We.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE);const vt=Uu.getMorphValuesForProxy(Rt.key),xt=vt?1:0;vt&&s.L(Me,{morphing:{srcDemTile:vt.from,dstDemTile:vt.to,phase:s.dx(vt.phase)}});const Et=s.dA(Rt.canonical),Bt=s.dB(Et.getCenter().lat),ir=s.dC(Rt.canonical,Et,Bt,ct.worldSize/ct._pixelsPerMercatorPixel),ur=s.bh(s.dD(Rt.canonical)),Zt=Rm(ct.expandedFarZProjMatrix,Ze,Se,ur,s.ah(ct.zoom),me,ct.frustumCorners.TL,ct.frustumCorners.TR,ct.frustumCorners.BR,ct.frustumCorners.BL,ct.globeCenterInViewSpace,ct.globeRadius,ye,Qe,ct._farZ,ir);if(le(Rt,xt),W&&(R.setupElevationDraw(We,W,Me),k.uploadCommonUniforms(G,W,Rt.toUnwrapped()),ge)){const[ar,or,Pr]=ge.getGridBuffers(Bt,Qe!==0);W.draw(k,ft,we,Pe,fe,vr.backCCW,Zt,"globe_raster",ar,or,Pr)}}}if(ge&&(k.renderDefaultNorthPole||k.renderDefaultSouthPole)){const ct=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];se&&ct.push("CUSTOM_ANTIALIASING"),W=k.getOrCreateProgram("globeRaster",{defines:ct});for(const Qe of z){const{x:ft,y:Rt,z:We}=Qe.canonical,Pe=Rt===0,nt=Rt===(1<<We)-1,[Ke,vt,xt,Et]=ge.getPoleBuffers(We,!1);if(Et&&(Pe||nt)){const Bt=F.getTile(Qe);G.activeTexture.set(U.TEXTURE0),Bt.texture&&Bt.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE);let ir=s.dE(We,ft,re);const ur=s.bh(s.dD(Qe.canonical)),Zt=(ar,or)=>ar.draw(k,U.TRIANGLES,we,Cr.disabled,fe,vr.disabled,Rm(re.expandedFarZProjMatrix,ir,ir,ur,0,me,re.frustumCorners.TL,re.frustumCorners.TR,re.frustumCorners.BR,re.frustumCorners.BL,re.globeCenterInViewSpace,re.globeRadius,ye,0,re._farZ),"globe_pole_raster",or,xt,Et);R.setupElevationDraw(Bt,W,Me),k.uploadCommonUniforms(G,W,Qe.toUnwrapped()),Pe&&k.renderDefaultNorthPole&&Zt(W,Ke),nt&&k.renderDefaultSouthPole&&(ir=s.cP(s.bz(),ir,[1,-1,1]),Zt(W,vt))}}}})(_,v,b,S,C);
vendor: 4,257 bytes, line 2803
2803else{const k=_.context,R=k.gl;let F,z;const N=_.shadowRenderer,G=Rl(_,_.longestCutoffRange),U=fe=>{if(z===fe)return;const we=[];we.push(Ub[fe]),G.shouldRenderCutoff&&we.push("RENDER_CUTOFF"),N&&(we.push("RENDER_SHADOWS","DEPTH_TEXTURE"),N.useNormalOffset&&we.push("NORMAL_OFFSET")),F=_.getOrCreateProgram("terrainRaster",{defines:we}),z=fe},W=_.colorModeForRenderPass(),Z=new Yt(R.LEQUAL,Yt.ReadWrite,_.depthRangeFor3D);Uu.update(C);const re=_.transform,se=rd(re.zoom,v.exaggeration(),v.sourceCache._source.tileSize);let le=[0,0,0];if(N){const fe=_.style.directionalLight,we=_.style.ambientLight;fe&&we&&(le=Nu(_.style,fe,we))}{z=-1;const fe=R.TRIANGLES,[we,Se]=[v.gridIndexBuffer,v.gridSegments];for(const me of S){const ge=b.getTile(me),ye=Cr.disabled,Ze=v.prevTerrainTileForTile[me.key],Me=v.terrainTileForTile[me.key];Zy(Ze,Me)&&Uu.newMorphing(me.key,Ze,Me,C,250),k.activeTexture.set(R.TEXTURE0),ge.texture&&ge.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const ct=Uu.getMorphValuesForProxy(me.key),Qe=ct?1:0;let ft;ct&&(ft={morphing:{srcDemTile:ct.from,dstDemTile:ct.to,phase:s.dx(ct.phase)}});const Rt=qy(me.projMatrix,Df(me.canonical,re.renderWorldCopies)?se/10:se,le);if(U(Qe),!F)continue;v.setupElevationDraw(ge,F,ft);const We=me.toUnwrapped();N&&N.setupShadows(We,F),_.uploadCommonUniforms(k,F,We,null,G),F.draw(_,fe,Z,ye,W,vr.backCCW,Rt,"terrain_raster",v.gridBuffer,we,Se)}}}}(l,this,this.proxySourceCache,i,this._updateTimestamp),this.renderingToTexture=!0,l.gpuTimingDeferredRenderEnd(),i.splice(0,i.length))}renderBatch(i){if(this._drapedRenderBatches.length===0)return i+1;this.renderingToTexture=!0;const l=this.painter,f=this.painter.context,_=this.proxySourceCache,v=this.proxiedCoords[_.id],b=this._drapedRenderBatches.shift(),S=l.style.order,C=[];let k=0;for(const R of v){const F=_.getTileByID(R.proxyTileKey),z=_.proxyCachedFBO[R.key]?_.proxyCachedFBO[R.key][i]:void 0,N=z!==void 0?_.renderCache[z]:this.pool[k++],G=z!==void 0;if(F.texture=N.tex,G&&!N.dirty){C.push(F.tileID);continue}let U;f.bindFramebuffer.set(N.fb.framebuffer),this.renderedToTile=!1,N.dirty&&(f.clear({color:s.am.transparent,stencil:0}),N.dirty=!1);for(let W=b.start;W<=b.end;++W){const Z=l.style._mergedLayers[S[W]];if(Z.isHidden(l.transform.zoom))continue;const re=l.style.getLayerSourceCache(Z),se=re?this.proxyToSource[R.key][re.id]:[R];if(!se)continue;const le=se;f.viewport.set([0,0,N.fb.width,N.fb.height]),U!==(re?re.id:null)&&(this._setupStencil(N,se,Z,re),U=re?re.id:null),l.renderLayer(l,re,Z,le)}if(this._drapedRenderBatches.length===0)for(const W of this._pendingGroundEffectLayers){const Z=l.style._mergedLayers[S[W]];if(Z.isHidden(l.transform.zoom))continue;const re=l.style.getLayerSourceCache(Z),se=re?this.proxyToSource[R.key][re.id]:[R];if(!se)continue;const le=se;f.viewport.set([0,0,N.fb.width,N.fb.height]),U!==(re?re.id:null)&&(this._setupStencil(N,se,Z,re),U=re?re.id:null),l.renderLayer(l,re,Z,le)}this.renderedToTile?(N.dirty=!0,C.push(F.tileID)):G||--k,k===5&&(k=0,this.renderToBackBuffer(C))}return this.renderToBackBuffer(C),this.renderingToTexture=!1,f.bindFramebuffer.set(null),f.viewport.set([0,0,l.width,l.height]),b.end+1}postRender(){}isLayerOrderingCorrect(i){const l=i.order.length;let f=-1,_=l;for(let v=0;v<l;++v)this._style.isLayerDraped(i._mergedLayers[i.order[v]])?f=Math.max(f,v):_=Math.min(_,v);return _>f}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(l=>l.dem).forEach(l=>{i=Math.min(i,l.dem.tree.minimums[0])}),i===0?i:(i-30)*this._exaggeration}raycast(i,l,f){if(!this._visibleDemTiles)return null;const _=this._visibleDemTiles.filter(v=>v.dem).map(v=>{const b=v.tileID,S=1<<b.overscaledZ,{x:C,y:k}=b.canonical,R=C/S,F=(C+1)/S,z=k/S,N=(k+1)/S;return{minx:R,miny:z,maxx:F,maxy:N,t:v.dem.tree.raycastRoot(R,z,F,N,i,l,f),tile:v}});_.sort((v,b)=>(v.t!==null?v.t:Number.MAX_VALUE)-(b.t!==null?b.t:Number.MAX_VALUE));for(const v of _){if(v.t==null)return null;const b=v.tile.dem.tree.raycast(v.minx,v.miny,v.maxx,v.maxy,i,l,f);if(b!=null)return b}return null}_createFBO(){const i=this.painter.context,l=i.gl,f=this.drapeBufferSize;i.activeTexture.set(l.TEXTURE0);const _=new s.T(i,{width:f[0],height:f[1],data:null},l.RGBA8);_.bind(l.LINEAR,l.CLAMP_TO_EDGE);const v=i.createFramebuffer(f[0],f[1],!0,null);
2803return v.colorAttachment.set(_.texture),v.depthAttachment=new Hy(i,v.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=i.createRenderbuffer(i.gl.DEPTH_STENCIL,f[0],f[1]),this._stencilRef=0,v.depthAttachment.set(this._sharedDepthStencil),i.clear({stencil:0})):v.depthAttachment.set(this._sharedDepthStencil),i.extTextureFilterAnisotropic&&l.texParameterf(l.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax),{fb:v,tex:_,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{const l=this._style._mergedLayers[i],f=l.isHidden(this.painter.transform.zoom);return l.type==="hillshade"||l.type==="custom"?!f&&l.shouldRedrape():!f&&l.hasTransition()})}_clearLineLayersFromRenderCache(){let i=!1;for(const f of this._style.getSources())if(f instanceof Ml){i=!0;break}if(!i)return;const l={};for(let f=0;f<this._style.order.length;++f){const _=this._style._mergedLayers[this._style.order[f]],v=this._style.getLayerSourceCache(_);if(v&&!l[v.id]&&!_.isHidden(this.painter.transform.zoom)&&_.type==="line"&&_.widthExpression()instanceof s.ab){l[v.id]=!0;for(const b of this.proxyCoords){const S=this.proxyToSource[b.key][v.id];if(S)for(const C of S)this._clearRenderCacheForTile(v.id,C)}}}}_clearRasterLayersFromRenderCache(){let i=!1;for(const f in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[f]._source instanceof Qn){i=!0;break}if(!i)return;const l={};for(let f=0;f<this._style.order.length;++f){const _=this._style._mergedLayers[this._style.order[f]],v=this._style.getLayerSourceCache(_);if(!v||l[v.id]||_.isHidden(this.painter.transform.zoom)||_.type!=="raster")continue;const b=_.paint.get("raster-fade-duration");for(const S of this.proxyCoords){const C=this.proxyToSource[S.key][v.id];if(C)for(const k of C){const R=Is(v.getTile(k),v.findLoadedParent(k,0),v,this.painter.transform,b);(R.opacity!==1||R.mix!==0)&&this._clearRenderCacheForTile(v.id,k)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const i=this._style.order,l=i.length;if(l===0)return;const f=[];this._pendingGroundEffectLayers=[];let _,v=0,b=this._style._mergedLayers[i[v]];for(;!this._style.isLayerDraped(b)&&b.isHidden(this.painter.transform.zoom)&&++v<l;)b=this._style._mergedLayers[i[v]];for(;v<l;++v){const S=this._style._mergedLayers[i[v]];S.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(S)?_===void 0&&(_=v):(S.t
vendor: 4,258 bytes, line 2803
2803ype==="fill-extrusion"&&this._pendingGroundEffectLayers.push(v),_!==void 0&&(f.push({start:_,end:v-1}),_=void 0)))}if(_!==void 0&&f.push({start:_,end:v-1}),f.length!==0){const S=f[f.length-1];this._pendingGroundEffectLayers.every(C=>C>S.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=f}_setupRenderCache(i){const l=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,l.renderCache.length>l.renderCachePool.length){const b=Object.values(l.proxyCachedFBO);l.proxyCachedFBO={};for(let S=0;S<b.length;++S){const C=Object.values(b[S]);l.renderCachePool.push(...C)}}return}this._clearRasterLayersFromRenderCache();const f=this.proxyCoords,_=this._tilesDirty;for(let b=f.length-1;b>=0;b--){const S=f[b];if(l.getTileByID(S.key),l.proxyCachedFBO[S.key]!==void 0){const C=i[S.key],k=this.proxyToSource[S.key];let R=0;for(const F in k){const z=k[F],N=C[F];if(!N||N.length!==z.length||z.some((G,U)=>G!==N[U]||_[F]&&_[F].hasOwnProperty(G.key))){R=-1;break}++R}for(const F in l.proxyCachedFBO[S.key])l.renderCache[l.proxyCachedFBO[S.key][F]].dirty=R<0||R!==Object.values(C).length}}const v=[...this._drapedRenderBatches];v.sort((b,S)=>S.end-S.start-(b.end-b.start));for(const b of v)for(const S of f){if(l.proxyCachedFBO[S.key])continue;let C=l.renderCachePool.pop();C===void 0&&l.renderCache.length<50&&(C=l.renderCache.length,l.renderCache.push(this._createFBO())),C!==void 0&&(l.proxyCachedFBO[S.key]={},l.proxyCachedFBO[S.key][b.start]=C,l.renderCache[C].dirty=!0)}this._tilesDirty={}}_setupStencil(i,l,f,_){if(!_||!this._sourceTilesOverlap[_.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const v=this.painter.context,b=v.gl;if(l.length<=1)return void(this._overlapStencilType=!1);let S;if(f.isTileClipped())S=l.length,this._overlapStencilMode.test={func:b.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(l[0].overscaledZ>l[l.length-1].overscaledZ))return void(this._overlapStencilType=!1);S=1,this._overlapStencilMode.test={func:b.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+S>255&&(v.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=S,this._overlapStencilMode.ref=this._stencilRef,f.isTileClipped()&&this._renderTileClippingMasks(l,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(i){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[i.key]),this._overlapStencilMode):Cr.disabled}_renderTileClippingMasks(i,l){const f=this.painter,_=this.painter.context,v=_.gl;f._tileClippingMaskIDs={},_.setColorMode(Br.disabled),_.setDepthMode(Yt.disabled);const b=f.getOrCreateProgram("clippingMask");for(const S of i){const C=f._tileClippingMaskIDs[S.key]=--l;b.draw(f,v.TRIANGLES,Yt.disabled,new Cr({func:v.ALWAYS,mask:0},C,255,v.KEEP,v.KEEP,v.REPLACE),Br.disabled,vr.disabled,Lm(S.projMatrix),"$clipping",f.tileExtentBuffer,f.quadTriangleIndexBuffer,f.tileExtentSegments)}}pointCoordinate(i){const l=this.painter.transform;if(i.x<0||i.x>l.width||i.y<0||i.y>l.height)return null;const f=[i.x,i.y,1,1];s.aA(f,f,l.pixelMatrixInverse),s.cH(f,f,1/f[3]),f[0]/=l.worldSize,f[1]/=l.worldSize;const _=l._camera.position,v=s.cb(1,l.center.lat),b=[_[0],_[1],_[2]/v,0],S=s.d7([],f.slice(0,3),b);s.au(S,S);const C=this.raycast(b,S,this._exaggeration);return C!==null&&C?(s.bE(b,b,S,C),b[3]=b[2],b[2]*=v,b):null}_setupProxiedCoordsForOrtho(i,l,f){if(i.getSource()instanceof s.aP)return this._setupProxiedCoordsForImageSource(i,l,f);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};const _=this.proxiedCoords[i.id]=[],v=this.proxyCoords;for(let C=0;C<v.length;C++){const k=v[C],R=this._findTileCoveringTileID(k,i);if(R){const F=this._createProxiedId(k,R,f[k.key]&&f[k.key][i.id]);_.push(F),this.proxyToSource[k.key][i.id]=[F]}}let b=!1;const S=new Set;for(let C=0;C<l.length;C++){const k=i.getTile(l[C]);if(!k||!k.hasData())continue;const R=this._findTileCoveringTileID(k.tileID,this.proxySourceCache);
2803if(R&&R.tileID.canonical.z!==k.tileID.canonical.z){const F=this.proxyToSource[R.tileID.key][i.id],z=this._createProxiedId(R.tileID,k,f[R.tileID.key]&&f[R.tileID.key][i.id]);F?F.splice(F.length-1,0,z):this.proxyToSource[R.tileID.key][i.id]=[z];const N=this.proxyToSource[R.tileID.key][i.id];S.has(N)||S.add(N),_.push(z),b=!0}}if(this._sourceTilesOverlap[i.id]=b,b&&this._debugParams.sortTilesHiZFirst)for(const C of S)C.sort((k,R)=>R.overscaledZ-k.overscaledZ)}_setupProxiedCoordsForImageSource(i,l,f){if(!i.getSource().loaded())return;const _=this.proxiedCoords[i.id]=[],v=this.proxyCoords,b=i.getSource(),S=b.tileID;if(!S)return;const C=new s.P(S.x,S.y)._div(1<<S.z),k=b.coordinates.map(s.ac.fromLngLat).reduce((F,z)=>(F.min.x=Math.min(F.min.x,z.x-C.x),F.min.y=Math.min(F.min.y,z.y-C.y),F.max.x=Math.max(F.max.x,z.x-C.x),F.max.y=Math.max(F.max.y,z.y-C.y),F),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),R=(F,z)=>{const N=F.wrap+F.canonical.x/(1<<F.canonical.z),G=F.canonical.y/(1<<F.canonical.z),U=s.aj/(1<<F.canonical.z),W=z.wrap+z.canonical.x/(1<<z.canonical.z),Z=z.canonical.y/(1<<z.canonical.z);return N+U<W+k.min.x||N>W+k.max.x||G+U<Z+k.min.y||G>Z+k.max.y};for(let F=0;F<v.length;F++){const z=v[F];for(let N=0;N<l.length;N++){const G=i.getTile(l[N]);if(!G||!G.hasData()||R(z,G.tileID))continue;const U=this._createProxiedId(z,G,f[z.key]&&f[z.key][i.id]),W=this.proxyToSource[z.key][i.id];W?W.push(U):this.proxyToSource[z.key][i.id]=[U],_.push(U)}}}_createProxiedId(i,l,f){let _=this.orthoMatrix;if(f){const v=f.find(b=>b.key===l.tileID.key);if(v)return v}if(l.tileID.key!==i.key){const v=i.canonical.z-l.tileID.canonical.z;let b,S,C;_=s.bz();const k=l.tileID.wrap-i.wrap<<i.overscaledZ;v>0?(b=s.aj>>v,S=b*((l.tileID.canonical.x<<v)-i.canonical.x+k),C=b*((l.tileID.canonical.y<<v)-i.canonical.y)):(b=s.aj<<-v,S=s.aj*(l.tileID.canonical.x-(i.canonical.x+k<<-v)),C=s.aj*(l.tileID.canonical.y-(i.canonical.y<<-v))),s.ca(_,0,b,0,b,0,1),s.bo(_,_,[S,C,0])}return new Of(l.tileID,i.key,_)}_findTileCoveringTileID(i,l){let f=l.getTile(i);if(f&&f.hasData())return f;const _=this._findCoveringTileCache[l.id],v=_[i.key];if(f=v?l.getTileByID(v):null,f&&f.hasData()||v===null)return f;let b=f?f.tileID:i,S=b.overscaledZ;const C=l.getSource().minzoom,k=[];if(!v){const F=l.getSource().maxzoom;if(i.canonical.z>=F){const z=i.canonical.z-F;l.getSource().reparseOverscaled?(S=Math.max(i.canonical.z+2,l.transform.tileZoom),b=new s.aM(S,i.wrap,F,i.canonical.x>>z,i.canonical.y>>z)):z!==0&&(S=F,b=new s.aM(S,i.wrap,F,i.canonical.x>>z,i.canonical.y>>z))}b.key!==i.key&&(k.push(b.key),f=l.getTile(b))}const R=F=>{k.forEach(z=>{_[z]=F}),k.length=0};for(S-=1;S>=C&&(!f||!f.hasData());S--){f&&R(f.tileID.key);const F=b.calculateScaledKey(S);if(f=l.getTileByID(F),f&&f.hasData())break;const z=_[F];if(z===null)break;z===void 0?k.push(F):f=l.getTileByID(z)}return R(f?f.tileID.key:null),f&&f.hasData()?f:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,l){let f=this._tilesDirty[i];f||(f=this._tilesDirty[i]={}),f[l.key]=!0}}function Xy(d,i,l){const f=function(S,C,k){const R=s.bG(C,S),F=s.bG(k,[.2126,.7152,.0722]),z=(G,U,W)=>(1-W)*G+W*U,N=z(1-.3*Math.min(F,1),1,Math.min(R+1,1));return z(.92,1,Math.asin(s.ay(C[2],-1,1))/Math.PI+.5)*N}(d,[0,0,1],i),_=[0,0,0];s.c1(_,l.slice(0,3),f);const v=[0,0,0];s.c1(v,i.slice(0,3),d[2]);const b=[0,0,0];return s.d5(b,_,v),s.d8(b)}const Yy=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Om=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class Fm{static cacheKey(i,l,f,_){let v=`${l}${_?_.cacheKey:""}`;for(const b of f)i.usedDefines.includes(b)&&(v+=`/${b}`);return v}constructor(i,l,f,_,v,b){const S=i.gl;this.program=S.createProgram(),this.configuration=_,this.name=l,this.fixedDefines=[...b];const C=_?_.getBinderAttributes():[],k=(f.staticAttributes||[]).concat(C);let R=_?_.defines():[];R=R.concat(b.map(W=>`#define ${W}`));const F=`#version 300 es
2804`;let z=F+R.concat("precision mediump float;",qc,Em.fragmentSource).join(`
2805`);for(const W of f.fragmentIncludes)z+=`
2806${Bu[W]}`;z+=`
2807${f.fragmentSource}`;let N=F+R.concat("precision highp float;",qc,Em.vertexSource).join(`
2808`);for(const W of f.vertexIncludes)N+=`
2809${Bu[W]}`;this.forceManualRenderingForInstanceIDShaders=i.forceManualRenderingForInstanceIDShaders&&f.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(N+=`
2810uniform int u_instanceID;
2811`),N+=`
2812${f.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(N=N.replaceAll("gl_InstanceID","u_instanceID"));const G=S.createShader(S.FRAGMENT_SHADER);if(S.isContextLost())return void(this.failedToCreate=!0);S.shaderSource(G,z),S.compileShader(G),S.attachShader(this.program,G);const U=S.createShader(S.VERTEX_SHADER);if(S.isContextLost())this.failedToCreate=!0;
2812else{S.shaderSource(U,N),S.compileShader(U),S.attachShader(this.program,U),this.attributes={},this.numAttributes=k.length;for(let W=0;W<this.numAttributes;W++)if(k[W]){const Z=k[W].startsWith("a_")?k[W]:`a_${k[W]}`;S.bindAttribLocation(this.program,W,Z),this.attributes[Z]=W}S.linkProgram(this.program),S.deleteShader(U),S.deleteShader(G),this.fixedUniforms=v(i),this.binderUniforms=_?_.getUniforms(i):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(W=>({u_instanceID:new s.cd(W)}))(i)),(b.includes("TERRAIN")||l.indexOf("symbol")!==-1||l.indexOf("circle")!==-1)&&(this.terrainUniforms=(W=>({u_dem:new s.cd(W),u_dem_prev:new s.cd(W),u_dem_tl:new s.cg(W),u_dem_scale:new s.cf(W),u_dem_tl_prev:new s.cg(W),u_dem_scale_prev:new s.cf(W),u_dem_size:new s.cf(W),u_dem_lerp:new s.cf(W),u_exaggeration:new s.cf(W),u_depth:new s.cd(W),u_depth_size_inv:new s.cg(W),u_depth_range_unpack:new s.cg(W),u_occluder_half_size:new s.cf(W),u_occlusion_depth_offset:new s.cf(W),u_meter_to_dem:new s.cf(W),u_label_plane_matrix_inv:new s.ch(W)}))(i)),b.includes("GLOBE")&&(this.globeUniforms=(W=>({u_tile_tl_up:new s.ce(W),u_tile_tr_up:new s.ce(W),u_tile_br_up:new s.ce(W),u_tile_bl_up:new s.ce(W),u_tile_up_scale:new s.cf(W)}))(i)),b.includes("FOG")&&(this.fogUniforms=(W=>({u_fog_matrix:new s.ch(W),u_fog_range:new s.cg(W),u_fog_color:new s.d0(W),u_fog_horizon_blend:new s.cf(W),u_fog_vertical_limit:new s.cg(W),u_fog_temporal_offset:new s.cf(W),u_frustum_tl:new s.ce(W),u_frustum_tr:new s.ce(W),u_frustum_br:new s.ce(W),u_frustum_bl:new s.ce(W),u_globe_pos:new s.ce(W),u_globe_radius:new s.cf(W),u_globe_transition:new s.cf(W),u_is_globe:new s.cd(W),u_viewport:new s.cg(W)}))(i)),b.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(W=>({u_cutoff_params:new s.d0(W)}))(i)),b.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(W=>({u_lighting_ambient_color:new s.ce(W),u_lighting_directional_dir:new s.ce(W),u_lighting_directional_color:new s.ce(W),u_ground_radiance:new s.ce(W)}))(i)),b.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(W=>({u_light_matrix_0:new s.ch(W),u_light_matrix_1:new s.ch(W),u_fade_range:new s.cg(W),u_shadow_normal_offset:new s.ce(W),u_shadow_intensity:new s.cf(W),u_shadow_texel_size:new s.cf(W),u_shadow_map_resolution:new s.cf(W),u_shadow_direction:new s.ce(W),u_shadow_bias:new s.ce(W),u_shadowmap_0:new s.cd(W),u_shadowmap_1:new s.cd(W)}))(i))}}setTerrainUniformValues(i,l){if(!this.terrainUniforms)return;const f=this.terrainUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const _ in l)f[_]&&f[_].set(this.program,_,l[_])}}setGlobeUniformValues(i,l){if(!this.globeUniforms)return;const f=this.globeUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const _ in l)f[_]&&f[_].set(this.program,_,l[_])}}setFogUniformValues(i,l){if(!this.fogUniforms)return;const f=this.fogUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const _ in l)f[_].set(this.program,_,l[_])}}setCutoffUniformValues(i,l){if(!this.cutoffUniforms)return;const f=this.cutoffUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const _ in l)f[_].set(this.program,_,l[_])}}setLightsUniformValues(i,l){if(!this.lightsUniforms)return;const f=this.lightsUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const _ in l)f[_].set(this.program,_,l[_])}}setShadowUniformValues(i,l){if(this.failedToCreate||!this.shadowUniforms)return;const f=this.shadowUniforms;i.program.set(this.program);for(const _ in l)f[_].set(this.program,_,l[_])}_drawDebugWireframe(i,l,f,_,v,b,S,C,k,R){const F=i.options.wireframe;if(F.terrain===!1&&F.layers2D===!1&&F.layers3D===!1)return;const z=i.context;if(!(!(!F.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!F.layers2D||i._terrain&&i._terrain.renderingToTexture||!Yy.includes(this.name))||!(!F.layers3D||!Om.includes(this.name))))return;const N=z.gl,G=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,v,z);if(!G)return;const U=[...this.fixedDefines];U.push("DEBUG_WIREFRAME");const W=i.getOrCreateProgram(this.name,{config:this.configuration,defines:U});z.program.set(W.program);const Z=(le,fe,we)=>{if(fe[le]&&we[le])for(const Se in fe[le])we[le][Se]&&we[le][Se].set(we.program,Se,fe[le][Se].current)};k&&k.setUniforms(W.program,z,W.binderUniforms,S,{zoom:C}),Z("fixedUniforms",this,W),Z("terrainUniforms",this,W),Z("globeUniforms",this,W),Z("fogUniforms",this,W),Z("lightsUniforms",this,W),Z("shadowUniforms",this,W),G.bind(),z.setColorMode(new Br([N.ONE,N.ONE_MINUS_SRC_ALPHA,N.ZERO,N.ONE],s.am.transparent,[!0,!0,!0,!1])),z.setDepthMode(new Yt(l.func===N.LESS?N.LEQUAL:l.func,Yt.ReadOnly,l.range)),z.setStencilMode(Cr.disabled);const re=3*b.primitiveLength*2,se=3*b.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const le=R||1;for(let fe=0;fe<le;++fe)W.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",fe),N.drawElements(N.LINES,re,N.UNSIGNED_SHORT,se)}else R&&R>1?N.drawElementsInstanced(N.LINES,re,N.UNSIGNED_SHORT,se,R):N.drawElements(N.LINES,re,N.UNSIGNED_SHORT,se);v.bind(),z.program.set(this.program),z.setDepthMode(l),z.setStencilMode(f),z.setColorMode(_)}checkUniforms(i,l,f){if(this.fixedDefines.includes(l)){for(const _ of Object.keys(f))if(!f[_].initialized)throw new Error(`Program '${this.name}', from draw '${i}': uniform ${_} not set but required by ${l} being defined`)}}draw(i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W){const Z=i.context,re=Z.gl;if(this.failedToCreate)return;Z.program.set(this.program),Z.setDepthMode(f),Z.setStencilMode(_),Z.setColorMode(v),Z.setCullFace(b);
2812for(const fe of Object.keys(this.fixedUniforms))this.fixedUniforms[fe].set(this.program,fe,S[fe]);G&&G.setUniforms(this.program,Z,this.binderUniforms,z,{zoom:N});const se={[re.POINTS]:1,[re.LINES]:2,[re.TRIANGLES]:3,[re.LINE_STRIP]:1}[l];this.checkUniforms(C,"RENDER_SHADOWS",this.shadowUniforms);const le=W&&W>0?1:void 0;for(const fe of F.get()){const we=fe.vaos||(fe.vaos={});if((we[C]||(we[C]=new wI)).bind(Z,this,k,G?G.getPaintVertexBuffers():[],R,fe.vertexOffset,U||[],le),this.forceManualRenderingForInstanceIDShaders){const Se=W||1;for(let me=0;me<Se;++me)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",me),R?re.drawElements(l,fe.primitiveLength*se,re.UNSIGNED_SHORT,fe.primitiveOffset*se*2):re.drawArrays(l,fe.vertexOffset,fe.vertexLength)}else W&&W>1?re.drawElementsInstanced(l,fe.primitiveLength*se,re.UNSIGNED_SHORT,fe.primitiveOffset*se*2,W):R?re.drawElements(l,fe.primitiveLength*se,re.UNSIGNED_SHORT,fe.primitiveOffset*se*2):re.drawArrays(l,fe.vertexOffset,fe.vertexLength);l===re.TRIANGLES&&R&&this._drawDebugWireframe(i,f,_,v,R,fe,z,N,G,W)}}}function Nm(d,i,l=0){const f=Math.pow(2,i.tileID.overscaledZ),_=i.tileSize*Math.pow(2,d.transform.tileZoom)/f,v=_*(i.tileID.canonical.x+i.tileID.wrap*f),b=_*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.aw(i,1,d.transform.tileZoom),u_pixel_coord_upper:[v>>16,b>>16],u_pixel_coord_lower:[65535&v,65535&b],u_pattern_transition:l}}const ju={terrain:0,flat:1},Ky=s.bz(),Jy=(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z)=>{const re=i.style.light,se=re.properties.get("position"),le=[se.x,se.y,se.z],fe=s.dJ();re.properties.get("anchor")==="viewport"&&(s.dK(fe,-i.transform.angle),s.dL(le,le,fe));const we=re.properties.get("color").toPremultipliedRenderColor(null),Se=i.transform,me={u_matrix:d,u_lightpos:le,u_lightintensity:re.properties.get("intensity"),u_lightcolor:[we.r,we.g,we.b],u_vertical_gradient:+l,u_opacity:f,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ky,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:ju[k],u_base_type:ju[R],u_ao:_,u_edge_radius:v,u_width_scale:b,u_flood_light_color:G,u_vertical_scale:U,u_flood_light_intensity:W,u_ground_shadow_factor:Z};return Se.projection.name==="globe"&&(me.u_tile_id=[S.canonical.x,S.canonical.y,1<<S.canonical.z],me.u_zoom_transition=F,me.u_inv_rot_matrix=N,me.u_merc_center=z,me.u_up_dir=Se.projection.upVector(new s.cA(0,0,0),z[0]*s.aj,z[1]*s.aj),me.u_height_lift=C),me},jb=(d,i,l,f,_,v)=>({u_matrix:d,u_edge_radius:i,u_width_scale:l,u_vertical_scale:f,u_height_type:ju[_],u_base_type:ju[v]}),id=(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z)=>{const re=Jy(d,i,l,f,_,v,b,S,k,R,F,z,N,G,U,W,1,[0,0,0]),se={u_height_factor:-Math.pow(2,S.overscaledZ)/C.tileSize/8};return s.h(re,Nm(i,C,Z),se)},Gb=(d,i,l)=>({u_matrix:d,u_emissive_strength:i,u_ground_shadow_factor:l}),$b=(d,i,l,f,_,v=0)=>s.h(Gb(d,i,_),Nm(l,f,v)),kI=(d,i,l,f)=>({u_matrix:d,u_world:l,u_emissive_strength:i,u_ground_shadow_factor:f}),RI=(d,i,l,f,_,v,b=0)=>s.h($b(d,i,l,f,v,b),{u_world:_}),LI=(d,i)=>({u_matrix:d,u_ground_shadow_factor:i}),Bm=(d,i,l,f,_)=>({u_matrix:d,u_camera_pos:[i[0],i[1],i[2]],u_depth_bias:l,u_height_scale:f,u_reset_depth:_}),Qy=(d,i)=>({u_matrix:d,u_normal_matrix:i,u_opacity:1}),e0=d=>({u_matrix:d}),Hb=d=>({u_matrix:d}),nd=(d,i,l,f,_,v,b,S)=>{const C=s.aj/v.tileSize;return{u_matrix:d,u_inv_rot_matrix:i,u_camera_to_center_distance:l.getCameraToCenterDistance(S),u_extrude_scale:[l.pixelsToGLUnits[0]/C,l.pixelsToGLUnits[1]/C],u_zoom_transition:f,u_tile_id:b,u_merc_center:_}},t0=(d,i,l=1)=>({u_matrix:d,u_color:i,u_overlay:0,u_overlay_scale:l}),qb=s.bz(),Zb=(d,i,l,f,_,v,b)=>{const S=d.transform,C=S.projection.name==="globe",k=C?s.dM(S.zoom,i.canonical)*S._pixelsPerMercatorPixel:s.aw(l,1,v),R={u_matrix:i.projMatrix,u_extrude_scale:k,u_intensity:b,u_inv_rot_matrix:qb,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(C){R.u_inv_rot_matrix=f,R.u_merc_center=_,R.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],R.u_zoom_transition=s.ah(S.zoom);const F=_[0]*s.aj,z=_[1]*s.aj;R.u_up_dir=S.projection.upVector(new s.cA(0,0,0),F,z)}return R};function Vm(d,[i,l,f,_],[v,b]){if(v===b)return[0,0,0,0];const S=255*(d-1)/(d*(b-v));return[i*S,l*S,f*S,_*S]}function Zc(d,i,[l,f]){return l===f?0:.5/d+(i-l)*(d-1)/(d*(f-l))}const r0=(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z,re,se,le)=>({u_matrix:d,u_normalize_matrix:i,u_globe_matrix:l,u_merc_matrix:f,u_grid_matrix:_,u_tl_parent:v,u_scale_parent:k,u_fade_t:R.mix,u_opacity:R.opacity*F.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:F.paint.get("raster-brightness-min"),u_brightness_high:F.paint.get("raster-brightness-max"),u_saturation_factor:s.dO(F.paint.get("raster-saturation")),u_contrast_factor:s.dN(F.paint.get("raster-contrast")),u_spin_weights:Wc(F.paint.get("raster-hue-rotate")),u_perspective_transform:z,u_raster_elevation:N,u_zoom_transition:b,u_merc_center:S,u_cutoff_params:C,u_colorization_mix:Vm(s.dP,U,Z),u_colorization_offset:Zc(s.dP,W,Z),u_color_ramp:G,u_texture_offset:[se/(re+2*se),re/(re+2*se)],u_texture_res:[re+2*se,re+2*se],u_emissive_strength:le});function Wc(d){d*=Math.PI/180;const i=Math.sin(d),l=Math.cos(d);return[(2*l+1)/3,(-Math.sqrt(3)*i-l+1)/3,(Math.sqrt(3)*i-l+1)/3]}const Xc=.05,Um=(d,i,l,f,_,v,b,S,C,k,R,F)=>({u_matrix:d,u_normalize_matrix:i,u_globe_matrix:l,u_merc_matrix:f,u_grid_matrix:_,u_tl_parent:v,u_scale_parent:k,u_fade_t:R.mix,u_opacity:R.opacity,u_image0:0,u_image1:1,u_raster_elevation:F,u_zoom_transition:b,u_merc_center:S,u_cutoff_params:C}),Wb=(d,i,l,f,_,v,b,S,C,k)=>({u_particle_texture:d,u_particle_texture_side_len:i,u_tile_offset:l,u_velocity:f,u_color_ramp:v,u_velocity_res:_,u_max_speed:b,u_uv_offset:S,u_data_scale:[255*C[0],255*C[1]],u_data_offset:k,u_particle_pos_scale:1.1,u_particle_pos_offset:[Xc,Xc]}),Xb=(d,i,l,f,_,v,b,S,C,k)=>({u_particle_texture:d,u_particle_texture_side_len:i,u_velocity:l,u_velocity_res:f,u_max_speed:_,u_speed_factor:v,u_reset_rate:b,u_rand_seed:Math.random(),u_uv_offset:S,u_data_scale:[255*C[0],255*C[1]],u_data_offset:k,u_particle_pos_scale:1.1,u_particle_pos_offset:[Xc,Xc]}),jm=s.bz(),Gm=(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z,re,se,le,fe,we,Se)=>{const me=_.transform,ge={u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="c
2812amera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:me.getCameraToCenterDistance(re),u_rotate_symbol:+l,u_aspect_ratio:me.width/me.height,u_fade_change:_.options.fadeDuration?_.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:b,u_coord_matrix:S,u_is_text:+k,u_elevation_from_sea:C?1:0,u_pitch_with_map:+f,u_texsize:R,u_texsize_icon:F,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:jm,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:jm,u_up_vector:[0,-1,0],u_color_adj_mat:fe,u_icon_transition:we||0,u_gamma_scale:f?_.transform.getCameraToCenterDistance(re)*Math.cos(_.terrain?0:_.transform._pitch):1,u_device_pixel_ratio:s.q.devicePixelRatio,u_is_halo:1,u_scale_factor:Se||1,u_ground_shadow_factor:se,u_inv_matrix:s.bi(s.bz(),b),u_normal_scale:le};return re.name==="globe"&&(ge.u_tile_id=[N.canonical.x,N.canonical.y,1<<N.canonical.z],ge.u_zoom_transition=G,ge.u_inv_rot_matrix=W,ge.u_merc_center=U,ge.u_camera_forward=me._camera.forward(),ge.u_ecef_origin=s.dQ(me.globeMatrix,N.toUnwrapped()),ge.u_tile_matrix=Float32Array.from(me.globeMatrix),ge.u_up_vector=Z),ge},Yb=(d,i,l,f)=>({u_matrix:d,u_emissive_strength:i,u_opacity:l,u_color:f}),i0=(d,i,l,f,_,v,b,S,C)=>s.h(function(k,R,F,z,N,G){const{width:U,height:W}=z.imageManager.getPixelSize(R),Z=Math.pow(2,G.tileID.overscaledZ),re=G.tileSize*Math.pow(2,z.transform.tileZoom)/Z,se=re*(G.tileID.canonical.x+G.tileID.wrap*Z),le=re*G.tileID.canonical.y;return{u_image:0,u_pattern_tl:F.tl,u_pattern_br:F.br,u_texsize:[U,W],u_pattern_size:F.displaySize,u_pattern_units_to_pixels:N?[z.transform.width,-1*z.transform.height]:[1/s.aw(G,1,z.transform.tileZoom),1/s.aw(G,1,z.transform.tileZoom)],u_pixel_coord_upper:[se>>16,le>>16],u_pixel_coord_lower:[65535&se,65535&le]}}(0,v,b,f,S,C),{u_matrix:d,u_emissive_strength:i,u_opacity:l}),Gu=new Float32Array(s.bx([])),n0=(d,i,l,f,_,v,b,S,C,k,R,F,z,N=[0,0,0],G)=>{const U=_.style.light,W=U.properties.get("position"),Z=[-W.x,-W.y,W.z],re=s.dJ();U.properties.get("anchor")==="viewport"&&(s.dK(re,-_.transform.angle),s.dL(Z,Z,re));const se=R.alphaMode==="MASK",le=U.properties.get("color").toNonPremultipliedRenderColor(null),fe=z.paint.get("model-ambient-occlusion-intensity"),we=z.paint.get("model-color").constantOr(s.am.white).toNonPremultipliedRenderColor(null);return we.a=z.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:d,u_lighting_matrix:i,u_normal_matrix:l,u_node_matrix:f||Gu,u_lightpos:Z,u_lightintensity:U.properties.get("intensity"),u_lightcolor:[le.r,le.g,le.b],u_camera_pos:N,u_opacity:v,u_baseTextureIsAlpha:0,u_alphaMask:+se,u_alphaCutoff:R.alphaCutoff,u_baseColorFactor:b.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:S.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:C,u_roughnessFactor:k,u_baseColorTexture:fs.BaseColor,u_metallicRoughnessTexture:fs.MetallicRoughness,u_normalTexture:fs.Normal,u_occlusionTexture:fs.Occlusion,u_emissionTexture:fs.Emission,u_lutTexture:fs.LUT,u_color_mix:we.toArray01(),u_aoIntensity:fe,u_emissive_strength:F,u_occlusionTextureTransform:G||[0,0,0,0]}},Kb=(d,i=Gu,l=Gu)=>({u_matrix:d,u_instance:i,u_node_matrix:l}),Jb={fillExtrusion:d=>({u_matrix:new s.ch(d),u_lightpos:new s.ce(d),u_lightintensity:new s.cf(d),u_lightcolor:new s.ce(d),u_vertical_gradient:new s.cf(d),u_opacity:new s.cf(d),u_edge_radius:new s.cf(d),u_width_scale:new s.cf(d),u_ao:new s.cg(d),u_height_type:new s.cd(d),u_base_type:new s.cd(d),u_tile_id:new s.ce(d),u_zoom_transition:new s.cf(d),u_inv_rot_matrix:new s.ch(d),u_merc_center:new s.cg(d),u_up_dir:new s.ce(d),u_height_lift:new s.cf(d),u_flood_light_color:new s.ce(d),u_vertical_scale:new s.cf(d),u_flood_light_intensity:new s.cf(d),u_ground_shadow_factor:new s.ce(d)}),fillExtrusionDepth:d=>({u_matrix:new s.ch(d),u_edge_radius:new s.cf(d),u_width_scale:new s.cf(d),u_vertical_scale:new s.cf(d),u_height_type:new s.cd(d),u_base_type:new s.cd(d)}),fillExtrusionPattern:d=>({u_matrix:new s.ch(d),u_lightpos:new s.ce(d),u_lightintensity:new s.cf(d),u_lightcolor:new s.ce(d),u_vertical_gradient:new s.cf(d),u_height_factor:new s.cf(d),u_edge_radius:new s.cf(d),u_width_scale:new s.cf(d),u_ao:new s.cg(d),u_height_type:new s.cd(d),u_base_type:new s.cd(d),u_tile_id:new s.ce(d),u_zoom_transition:new s.cf(d),u_inv_rot_matrix:new s.ch(d),u_merc_center:new s.cg(d),u_up_dir:new s.ce(d),u_height_lift:new s.cf(d),u_image:new s.cd(d),u_texsize:new s.cg(d),u_pixel_coord_upper:new s.cg(d),u_pixel_coord_lower:new s.cg(d),u_tile_units_to_pixels:new s.cf(d),u_opacity:new s.cf(d),u_pattern_transition:new s.cf(d)}),fillExtrusionGroundEffect:d=>({u_matrix:new s.ch(d),u_opacity:new s.cf(d),u_ao_pass:new s.cf(d),u_meter_to_tile:new s.cf(d),u_ao:new s.cg(d),u_flood_light_intensity:new s.cf(d),u_flood_light_color:new s.ce(d),u_attenuation:new s.cf(d),u_edge_radius:new s.cf(d),u_fb:new s.cd(d),u_fb_size:new s.cf(d),u_dynamic_offset:new s.cf(d)}),fill:d=>({u_matrix:new s.ch(d),u_emissive_strength:new s.cf(d),u_ground_shadow_factor:new s.ce(d)}),fillPattern:d=>({u_matrix:new s.ch(d),u_emissive_strength:new s.cf(d),u_image:new s.cd(d),u_texsize:new s.cg(d),u_pixel_coord_upper:new s.cg(d),u_pixel_coord_lower:new s.cg(d),u_tile_units_to_pixels:new s.cf(d),u_ground_shadow_factor:new s.ce(d),u_pattern_transition:new s.cf(d)}),fillOutline:d=>({u_matrix:new s.ch(d),u_emissive_strength:new s.cf(d),u_world:new s.cg(d),u_ground_shadow_factor:new s.ce(d)}),fillOutlinePattern:d=>({u_matrix:new s.ch(d),u_emissive_strength:new s.cf(d),u_world:new s.cg(d),u_image:new s.cd(d),u_texsize:new s.cg(d),u_pixel_coord_upper:new s.cg(d),u_pixel_coord_lower:new s.cg(d),u_tile_units_to_pixels:new s.cf(d),u_ground_shadow_factor:new s.ce(d),u_pattern_transition:new s.cf(d)}),building:d=>({u_matrix:new s.ch(d),u_normal_matrix:new s.ch(d),u_opacity:new s.cf(d)}),buildingBloom:d=>({u_matrix:new s.ch(d)}),buildingDepth:d=>({u_matrix:new s.ch(d)}),elevatedStructuresDepth:d=>({u_matrix:new s.ch(d),u_depth_bias:new s.cf(d)}),elevatedStructures:d=>({u_matrix:new s.ch(d),u_ground_shadow_factor:new s.ce(d)}),elevatedStructuresDepthReconstruct:d=>({u_matrix:new s.ch(d),u_camera_pos:new s.ce(d),u_depth_bias:new s.cf(d),u_height_scale:new s.cf(d),u_reset_depth:new s.cf(d)}),circle:s.dT,collisionBox:d=>({u_matrix:new s.ch(d),u_inv_rot_matrix:new s.ch(d),u_camera_to_center_distance:new s.cf(d),u_extrude_scale:new s.cg(d),u_zoom_transition:new s.cf(d),u_merc_center:new s.cg(d),u_tile_id:new s.ce(d)}),collisionCircle:d=>({u_matrix:new s.ch(d),u_inv_matrix:new s.ch(d),u_camera_to_center_distance:new s.cf(d),u_viewport_size:new s.cg(d)}),debug:d=>({u_color:new s.dv(d),u_matrix:new s.ch(d),u_overlay:new s.cd(d),u_overlay_scale:new s.cf(d)}),clippingMask:d=>({u_matrix:new s.ch(d)}),heatmap:d=>({u_extrude_scale:new s.cf(d),u_intensity:new s.cf(d),u_matrix:new s.ch(d),u_inv_rot_matrix:new s.ch(d),u_merc_center:new s.cg(d),u_tile_id:new s.ce(d),u_zoom_transition:new s.cf(d),u_up_dir:new s.ce(d)}),heatmapTexture:d=>({u_image:new s.cd(d),u_color_ramp:new s.cd(d),u_opacity:new s.cf(d)}),hillshade:d=>({u_matrix:new s.ch(d),u_image:new s.cd(d),u_latrange:new s.cg(d),u_light:new s.cg(d),u_shadow:new s.dv(d),u_highlight:new s.dv(d),u_emissive_strength:new s.cf(d),u_accent:new s.dv(d)}),hillshadePrepare:d=>({u_matrix:new s.ch(d),u_image:new s.cd(d),u_dimension:new s.cg(d),u_zoom:new s.cf(d)}),line:s.dS,linePattern:s.dR,raster:d=>({u_matrix:new s.ch(d),u_normalize_matrix:new s.ch(d),u_globe_matrix:new s.ch(d),u_merc_matrix:new s.ch(d),u_grid_matrix:new s.dw(d),u_tl_parent:new s.cg(d),u_scale_parent:new s.cf(d),u_fade_t:new s.cf(d),u_opacity:new s.cf(d),u_image0:new s.cd(d),u_image1:new s.cd(d),u_brightness_low:new s.cf(d),u_brightness_high:new s.cf(d),u_saturation_factor:new s.cf(d),u_contrast_factor:new s.cf(d),u_spin_weights:new s.ce(d),u_perspective_transform:new s.cg(d),u_raster_elevation:new s.cf(d),u_zoom_transition:new s.cf(d),u_merc_center:new s.cg(d),u_cutoff_params:new s.d0(d),u_colorization_mix:new s.d0(d),u_colorization_offset:new s.cf(d),u_color_ramp:new s.cd(d),u_texture_offset:new s.cg(d),u_texture_res:new s.cg(d),u_emissive_strength:new s.cf(d)}),rasterParticle:d=>({u_matrix:new s.ch(d),u_normalize_matrix:new s.ch(d),u_globe_matrix:new s.ch(d),u_merc_matrix:new s.ch(d),u_grid_matrix:new s.dw(d),u_tl_parent:new s.cg(d),u_scale_parent:new s.cf(d),u_fade_t:new s.cf(d),u_opacity:new s.cf(d),u_image0:new s.cd(d),u_image1:new s.cd(d),u_raster_elevation:new s.cf(d),u_zoom_transition:new s.cf(d),u_merc_center:new s.cg(d),u_cutoff_params:new s.d0(d)}),rasterParticleTexture:d=>({u_texture:new s.cd(d),u_opacity:new s.cf(d)}),rasterParticleDraw:d=>({u_particle_texture:new s.cd(d),u_particle_texture_side_len:new s.cf(d),u_tile_offset:new s.cg(d),u_velocity:new s.cd(d),u_color_ramp:new s.cd(d),u_velocity_res:new s.cg(d),u_max_speed:new s.cf(d),u_uv_offset:new s.cg(d),u_data_scale:new s.cg(d),u_data_offset:new s.cf(d),u_particle_pos_scale:new s.cf(d),u_particle_pos_offset:new s.cg(d)}),rasterParticleUpdate:d=>({u_particle_texture:new s.cd(d),u_particle_texture_side_len:new s.cf(d),u_velocity:new s.cd(d),u_velocity_res:new s.cg(d),u_max_speed:new s.cf(d),u_speed_factor:new s.cf(d),u_reset_rate:new s.cf(d),u_rand_seed:new s.cf(d),u_uv_offset:new s.cg(d),u_data_scale:new s.cg(d),u_data_offset:new s.cf(d),u_particle_pos_scale:new s.cf(d),u_particle_pos_offset:new s.cg(d)}),symbol:d=>({u_is_size_zoom_constant:new s.cd(d),u_is_size_feature_constant:new s.cd(d),u_size_t:new s.cf(d),u_size:new s.cf(d),u_camera_to_center_distance:new s.cf(d),u_rotate_symbol:new s.cd(d),u_aspect_ratio:new s.cf(d),u_fade_change:new s.cf(d),u_matrix:new s.ch(d),u_label_plane_matrix:new s.ch(d),u_coord_matrix:new s.ch(d),u_is_text:new s.cd(d),u_elevation_from_sea:new s.cd(d),u_pitch_with_map:new s.cd(d),u_texsize:new s.cg(d),u_texsize_icon:new s.cg(d),u_texture:new s.cd(d),u_texture_icon:new s.cd(d),u_gamma_scale:new s.cf(d),u_device_pixel_ratio:new s.cf(d),u_tile_id:new s.ce(d),u_zoom_transition:new s.cf(d),u_inv_rot_matrix:new s.ch(d),u_merc_center:new s.cg(d),u_camera_forward:new s.ce(d),u_tile_matrix:new s.ch(d),u_up_vector:new s.ce(d),u_ecef_origin:new s.ce(d),u_is_halo:new s.cd(d),u_icon_transition:new s.cf(d),u_color_adj_mat:new s.ch(d),u_scale_factor:new s.cf(d),u_ground_shadow_factor:new s.ce(d),u_inv_matrix:new s.ch(d),u_normal_scale:new s.cf(d)}),background:d=>({u_matrix:new s.ch(d),u_emissive_strength:new s.cf(d),u_opacity:new s.cf(d),u_color:new s.dv(d)}),backgroundPattern:d=>({u_matrix:new s.ch(d),u_emissive_strength:new s.cf(d),u_opacity:new s.cf(d),u_image:new s.cd(d),u_pattern_tl:new s.cg(d),u_pattern_br:new s.cg(d),u_texsize:new s.cg(d),u_pattern_size:new s.cg(d),u_pixel_coord_upper:new s.cg(d),u_pixel_coord_lower:new s.cg(d),u_pattern_units_to_pixels:new s.cg(d)}),terrainRaster:d=>({u_matrix:new s.ch(d),u_image0:new s.cd(d),u_skirt_height:new s.cf(d),u_ground_shadow_factor:new s.ce(d)}),skybox:d=>({u_matrix:new s.ch(d),u_sun_direction:new s.ce(d),u_cubemap:new s.cd(d),u_opacity:new s.cf(d),u_temporal_offset:new s.cf(d)}),skyboxGradient:d=>({u_matrix:new s.ch(d),u_color_ramp:new s.cd(d),u_center_direction:new s.ce(d),u_radius:new s.cf(d),u_opacity:new s.cf(d),u_temporal_offset:new s.cf(d)}),skyboxCapture:d=>({u_matrix_3f:new s.dw(d),u_sun_direction:new s.ce(d),u_sun_intensity:new s.cf(d),u_color_tint_r:new s.d0(d),u_color_tint_m:new s.d0(d),u_luminance:new s.cf(d)}),globeRaster:d=>({u_proj_matrix:new s.ch(d),u_globe_matrix:new s.ch(d),u_normalize_matrix:new s.ch(d),u_merc_matrix:new s.ch(d),u_zoom_transition:new s.cf(d),u_merc_center:new s.cg(d),u_image0:new s.cd(d),u_grid_matrix:new s.dw(d),u_skirt_height:new s.cf(d),u_far_z_cutoff:new s.cf(d),u_frustum_tl:new s.ce(d),u_frustum_tr:new s.ce(d),u_frustum_br:new s.ce(d),u_frustum_bl:new s.ce(d),u_globe_pos:new s.ce(d),u_globe_radius:new s.cf(d),u_viewport:new s.cg(d)}),globeAtmosphere:d=>({u_frustum_tl:new s.ce(d),u_frustum_tr:new s.ce(d),u_frustum_br:new s.ce(d),u_frustum_bl:new s.ce(d),u_horizon:new s.cf(d),u_transition:new s.cf(d),u_fadeout_range:new s.cf(d),u_color:new s.d0(d),u_high_color:new s.d0(d),u_space_color:new s.d0(d),u_temporal_offset:new s.cf(d),u_horizon_angle:new s.cf(d)}),model:d=>({u_matrix:new s.ch(d),u_lighting_matrix:new s.ch(d),u_normal_matrix:new s.ch(d),u_node_matrix:new s.ch(d),u_lightpos:new s.ce(d),u_lightintensity:new s.cf(d),u_lightcolor:new s.ce(d),u_camera_pos:new s.ce(d),u_opacity:new s.cf(d),u_baseColorFactor:new s.d0(d),u_emissiveFactor:new s.d0(d),u_metallicFactor:new s.cf(d),u_roughnessFactor:new s.cf(d),u_baseTextureIsAlpha:new s.cd(d),u_alph
2812aMask:new s.cd(d),u_alphaCutoff:new s.cf(d),u_baseColorTexture:new s.cd(d),u_metallicRoughnessTexture:new s.cd(d),u_normalTexture:new s.cd(d),u_occlusionTexture:new s.cd(d),u_emissionTexture:new s.cd(d),u_lutTexture:new s.cd(d),u_color_mix:new s.d0(d),u_aoIntensity:new s.cf(d),u_emissive_strength:new s.cf(d),u_occlusionTextureTransform:new s.d0(d)}),modelDepth:d=>({u_matrix:new s.ch(d),u_instance:new s.ch(d),u_node_matrix:new s.ch(d)}),groundShadow:d=>({u_matrix:new s.ch(d),u_ground_shadow_factor:new s.ce(d)}),stars:d=>({u_matrix:new s.ch(d),u_up:new s.ce(d),u_right:new s.ce(d),u_intensity_multiplier:new s.cf(d)}),snowParticle:d=>({u_modelview:new s.ch(d),u_projection:new s.ch(d),u_time:new s.cf(d),u_cam_pos:new s.ce(d),u_velocityConeAperture:new s.cf(d),u_velocity:new s.cf(d),u_horizontalOscillationRadius:new s.cf(d),u_horizontalOscillationRate:new s.cf(d),u_boxSize:new s.cf(d),u_billboardSize:new s.cf(d),u_simpleShapeParameters:new s.cg(d),u_screenSize:new s.cg(d),u_thinningCenterPos:new s.cg(d),u_thinningShape:new s.ce(d),u_thinningAffectedRatio:new s.cf(d),u_thinningParticleOffset:new s.cf(d),u_particleColor:new s.d0(d),u_direction:new s.ce(d)}),rainParticle:d=>({u_modelview:new s.ch(d),u_projection:new s.ch(d),u_time:new s.cf(d),u_cam_pos:new s.ce(d),u_texScreen:new s.cd(d),u_velocityConeAperture:new s.cf(d),u_velocity:new s.cf(d),u_boxSize:new s.cf(d),u_rainDropletSize:new s.cg(d),u_distortionStrength:new s.cf(d),u_rainDirection:new s.ce(d),u_color:new s.d0(d),u_screenSize:new s.cg(d),u_thinningCenterPos:new s.cg(d),u_thinningShape:new s.ce(d),u_thinningAffectedRatio:new s.cf(d),u_thinningParticleOffset:new s.cf(d),u_shapeDirectionalPower:new s.cf(d),u_shapeNormalPower:new s.cf(d),u_mode:new s.cf(d)}),vignette:d=>({u_vignetteShape:new s.ce(d),u_vignetteColor:new s.d0(d)}),occlusion:d=>({u_matrix:new s.ch(d),u_anchorPos:new s.ce(d),u_screenSizePx:new s.cg(d),u_occluderSizePx:new s.cg(d),u_color:new s.d0(d)})};class Yc{constructor(i,l,f,_){this.id=Yc.uniqueIdxCounter,Yc.uniqueIdxCounter++,this.context=i;const v=i.gl;this.buffer=v.createBuffer(),this.dynamicDraw=!!f,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),v.bufferData(v.ELEMENT_ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||_||l.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){this.id=Yc.uniqueIdxCounter,Yc.uniqueIdxCounter++;const l=this.context.gl;this.context.unbindVAO(),this.bind(),l.bufferSubData(l.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Yc.uniqueIdxCounter=0;const o0={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class s0{constructor(i,l,f,_,v,b){this.length=l.length,this.attributes=f,this.itemSize=l.bytesPerElement,this.dynamicDraw=_,this.instanceCount=b,this.context=i;const S=i.gl;this.buffer=S.createBuffer(),i.bindVertexBuffer.set(this.buffer),S.bufferData(S.ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?S.DYNAMIC_DRAW:S.STATIC_DRAW),this.dynamicDraw||v||l.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){const l=this.context.gl;this.bind(),l.bufferSubData(l.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,l){for(let f=0;f<this.attributes.length;f++){const _=l.attributes[this.attributes[f].name];_!==void 0&&i.enableVertexAttribArray(_)}}setVertexAttribPointers(i,l,f){for(let _=0;_<this.attributes.length;_++){const v=this.attributes[_],b=l.attributes[v.name];b!==void 0&&i.vertexAttribPointer(b,v.components,i[o0[v.type]],!1,this.itemSize,v.offset+this.itemSize*(f||0))}}setVertexAttribDivisor(i,l,f){for(let _=0;_<this.attributes.length;_++){const v=l.attributes[this.attributes[_].name];v!==void 0&&this.instanceCount&&this.instanceCount>0&&i.vertexAttribDivisor(v,f)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class $u{constructor(i,l,f,_,v){this.context=i,this.width=l,this.height=f;const b=this.framebuffer=i.gl.createFramebuffer();
2812_&&(this.colorAttachment=new MI(i,b)),v&&(this.depthAttachmentType=v,this.depthAttachment=v==="renderbuffer"?new Vb(i,b):new $y(i,b))}destroy(){const i=this.context.gl;if(this.colorAttachment){const l=this.colorAttachment.get();l&&i.deleteTexture(l)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const l=this.depthAttachment.get();l&&i.deleteRenderbuffer(l)}else{const l=this.depthAttachment.get();l&&i.deleteTexture(l)}i.deleteFramebuffer(this.framebuffer)}}class $m{constructor(i,l){this.gl=i,this.clearColor=new EI(this),this.clearDepth=new SI(this),this.clearStencil=new CI(this),this.colorMask=new II(this),this.depthMask=new Rb(this),this.stencilMask=new AI(this),this.stencilFunc=new Sm(this),this.stencilOp=new PI(this),this.stencilTest=new Lb(this),this.depthRange=new By(this),this.depthTest=new Cm(this),this.depthFunc=new Vy(this),this.blend=new Vu(this),this.blendFunc=new Jh(this),this.blendColor=new Im(this),this.blendEquation=new Am(this),this.cullFace=new Qh(this),this.cullFaceSide=new zb(this),this.frontFace=new Uy(this),this.program=new Db(this),this.activeTexture=new ed(this),this.viewport=new Pm(this),this.bindFramebuffer=new Mm(this),this.bindRenderbuffer=new jy(this),this.bindTexture=new km(this),this.bindVertexBuffer=new zf(this),this.bindElementBuffer=new Ob(this),this.bindVertexArrayOES=new Fb(this),this.pixelStoreUnpack=new Nb(this),this.pixelStoreUnpackPremultiplyAlpha=new td(this),this.pixelStoreUnpackFlipY=new Bb(this),this.options=l?Object.assign({},l):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=i.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=i.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=i.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=l&&!!l.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=i.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),this.maxPointSize=i.getParameter(i.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(i,l,f){return new Yc(this,i,l,f)}createVertexBuffer(i,l,f,_,v){return new s0(this,i,l,f,_,v)}createRenderbuffer(i,l,f){const _=this.gl,v=_.createRenderbuffer();return this.bindRenderbuffer.set(v),_.renderbufferStorage(_.RENDERBUFFER,i,l,f),this.bindRenderbuffer.set(null),v}createFramebuffer(i,l,f,_){return new $u(this,i,l,f,_)}clear({color:i,depth:l,stencil:f,colorMask:_}){const v=this.gl;let b=0;i&&(b|=v.COLOR_BUFFER_BIT,this.clearColor.set(i.toNonPremultipliedRenderColor(null)),this.colorMask.set(_||[!0,!0,!0,!0])),l!==void 0&&(b|=v.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(l),this.depthMask.set(!0)),f!==void 0&&(b|=v.STENCIL_BUFFER_BIT,this.clearStencil.set(f),this.stencilMask.set(255)),v.clear(b)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass
vendor: 1,505 bytes, line 2812
2812]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){s.bv(i.blendFunction,Br.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor),i.blendEquation?this.blendEquation.set(i.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(i.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Kc;function a0(d,i,l,f,_,v,b){const S=d.context,C=S.gl,k=d.transform,R=[s.aD(k.center.lng),s.aH(k.center.lat)],F=l.layout.get("symbol-placement"),z=l.layout.get("text-variable-anchor"),N=l.layout.get("icon-rotation-alignment")==="map",G=l.layout.get("text-rotation-alignment")==="map",U=F!=="point",W=[];let Z=0,re=0;for(let ge=0;ge<f.length;ge++){const ye=f[ge],Ze=i.getTile(ye),Me=Ze.getBucket(l);if(!Me)continue;const ct=Me.getProjection().createInversionMatrix(k,ye.canonical),Qe=[],ft=vb(ye,Me,k),Rt=!b&&N&&U,We=b&&G&&U,Pe=z&&Me.hasTextData(),nt=Me.hasIconTextFit()&&Pe&&Me.hasIconData(),Ke=Rt||We||b&&Pe||nt,vt=Me.projection.name==="globe",xt=vt?s.ah(k.zoom):0;vt&&(Qe.push("PROJECTION_GLOBE_VIEW"),Ke&&Qe.push("PROJECTED_POS_ON_VIEWPORT"));const Et=d.getOrCreateProgram("collisionBox",{defines:Qe});let Bt=ft;_[0]===0&&_[1]===0||(Bt=d.translatePosMatrix(ft,Ze,_,v));const ir=b?Me.textCollisionBox:Me.iconCollisionBox,ur=Me.collisionCircleArray;if(ur.length>0){const ar=s.bz(),or=Bt;s.cM(ar,Me.placementInvProjMatrix,k.glCoordMatrix),s.cM(ar,ar,Me.placementViewportMatrix),W.pu
2812sh({circleArray:ur,circleOffset:re,transform:or,invTransform:ar,projection:Me.getProjection()}),Z+=ur.length/4,re=Z}if(!ir)continue;d.terrain&&d.terrain.setupElevationDraw(Ze,Et);const Zt=vt?[ye.canonical.x,ye.canonical.y,1<<ye.canonical.z]:[0,0,0];Et.draw(d,C.LINES,Yt.disabled,Cr.disabled,d.colorModeForRenderPass(),vr.disabled,nd(Bt,ct,k,xt,R,Ze,Zt,Me.getProjection()),l.id,ir.layoutVertexBuffer,ir.indexBuffer,ir.segments,null,k.zoom,null,[ir.collisionVertexBuffer,ir.collisionVertexBufferExt])}if(!b||!W.length)return;const se=d.getOrCreateProgram("collisionCircle"),le=new s.dU;le.resize(4*Z),le._trim();let fe=0;for(const ge of W)for(let ye=0;ye<ge.circleArray.length/4;ye++){const Ze=4*ye,Me=ge.circleArray[Ze+0],ct=ge.circleArray[Ze+1],Qe=ge.circleArray[Ze+2],ft=ge.circleArray[Ze+3];le.emplace(fe++,Me,ct,Qe,ft,0),le.emplace(fe++,Me,ct,Qe,ft,1),le.emplace(fe++,Me,ct,Qe,ft,2),le.emplace(fe++,Me,ct,Qe,ft,3)}(!Kc||Kc.length<2*Z)&&(Kc=function(ge){const ye=2*ge,Ze=new s.a_;Ze.resize(ye),Ze._trim();for(let Me=0;Me<ye;Me++){const ct=6*Me;Ze.uint16[ct+0]=4*Me+0,Ze.uint16[ct+1]=4*Me+1,Ze.uint16[ct+2]=4*Me+2,Ze.uint16[ct+3]=4*Me+2,Ze.uint16[ct+4]=4*Me+3,Ze.uint16[ct+5]=4*Me+0}return Ze}(Z));const we=S.createIndexBuffer(Kc,!0),Se=S.createVertexBuffer(le,s.dV.members,!0);for(const ge of W){const ye={u_matrix:ge.transform,u_inv_matrix:ge.invTransform,u_camera_to_center_distance:(me=k).getCameraToCenterDistance(ge.projection),u_viewport_size:[me.width,me.height]};se.draw(d,C.TRIANGLES,Yt.disabled,Cr.disabled,d.colorModeForRenderPass(),vr.disabled,ye,l.id,Se,we,s.bd.simpleSegment(0,2*ge.circleOffset,ge.circleArray.length,ge.circleArray.length/2),null,k.zoom)}var me;Se.destroy(),we.destroy()}const Hu=s.bz();function Ff(d){const i=d._camera.getWorldToCamera(d.worldSize,1),l=s.az([],i,d.globeMatrix);s.bi(l,l);const f=[0,0,0],_=[0,1,0,0];return s.aA(_,_,l),f[0]=_[0],f[1]=_[1],f[2]=_[2],s.au(f,f),f}function l0({width:d,height:i,anchor:l,textOffset:f,textScale:_},v){const{horizontalAlign:b,verticalAlign:S}=s.bZ(l),C=-(b-.5)*d,k=-(S-.5)*i,R=s.b_(l,f);return new s.P((C/_+R[0])*v,(k/_+R[1])*v)}function Qb(d,i,l,f,_,v,b,S,C,k){const R=d.text.placedSymbolArray,F=d.text.dynamicLayoutVertexArray,z=d.icon.dynamicLayoutVertexArray,N={},G=d.getProjection(),U=fm(b,G,_),W=_.elevation,Z=G.upVectorScale(b.canonical,_.center.lat,_.worldSize).metersToTile;F.clear();for(let re=0;re<R.length;re++){const se=R.get(re),{tileAnchorX:le,tileAnchorY:fe,numGlyphs:we}=se,Se=se.hidden||!se.crossTileID||d.allowVerticalPlacement&&!se.placedOrientation?null:f[se.crossTileID];if(Se){let me=0,ge=0,ye=0;if(W){const nt=W?W.getAtTileOffset(b,le,fe):0,[Ke,vt,xt]=G.upVector(b.canonical,le,fe);me=nt*Ke*Z,ge=nt*vt*Z,ye=nt*xt*Z}let[Ze,Me,ct,Qe]=ha(se.projectedAnchorX+me,se.projectedAnchorY+ge,se.projectedAnchorZ+ye,l?U:v);const ft=Cy(_.getCameraToCenterDistance(G),Qe);let Rt=s.bJ(d.textSizeData,C,se)*ft/s.bU;l&&(Rt*=d.tilePixelRatio/S);const We=l0(Se,Rt);l?({x:Ze,y:Me,z:ct}=G.projectTilePoint(le+We.x,fe+We.y,b.canonical),[Ze,Me,ct]=ha(Ze+me,Me+ge,ct+ye,v)):(i&&We._rotate(-_.angle),Ze+=We.x,Me+=We.y,ct=0);const Pe=d.allowVerticalPlacement&&se.placedOrientation===s.bI.vertical?Math.PI/2:0;for(let nt=0;nt<we;nt++)s.bL(F,Ze,Me,ct,Pe);k&&se.associatedIconIndex>=0&&(N[se.associatedIconIndex]={x:Ze,y:Me,z:ct,angle:Pe})}else Gh(we,F)}if(k){z.clear();const re=d.icon.placedSymbolArray;for(let se=0;se<re.length;se++){const le=re.get(se),{numGlyphs:fe}=le,we=N[se];if(le.hidden||!we)Gh(fe,z);else{const{x:Se,y:me,z:ge,angle:ye}=we;for(let Ze=0;Ze<fe;Ze++)s.bL(z,Se,me,ge,ye)}}d.icon.dynamicLayoutVertexBuffer.updateData(z)}d.text.dynamicLayoutVertexBuffer.updateData(F)}function c0(d,i,l,f,_,v,b={}){const S=l.paint.get("icon-translate"),C=l.paint.get("text-translate"),k=l.paint.get("icon-translate-anchor"),R=l.paint.get("text-translate-anchor"),F=l.layout.get("icon-rotation-alignment"),z=l.layout.get("text-rotation-alignment"),N=l.layout.get("icon-pitch-alignment"),G=l.layout.get("text-pitch-alignment"),U=l.layout.get("icon-keep-upright"),W=l.layout.get("text-keep-upright"),Z=l.paint.get("icon-color-saturation"),re=l.paint.get("icon-color-contrast"),se=l.paint.get("icon-color-brightness-min"),le=l.paint.get("icon-color-brightness-max"),fe=l.layout.get("symbol-elevation-reference")==="sea",we=d.context,Se=we.gl,me=d.transform,ge=F==="map",ye=z==="map",Ze=N==="map",Me=G==="map",ct=l.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Qe=!1;
2812const ft=d.depthModeForSublayer(0,Yt.ReadOnly),Rt=new Yt(d.context.gl.LEQUAL,Yt.ReadOnly,d.depthRangeFor3D),We=[s.aD(me.center.lng),s.aH(me.center.lat)],Pe=l.layout.get("text-variable-anchor"),nt=me.projection.name==="globe",Ke=[],vt=[0,-1,0];for(const xt of f){const Et=i.getTile(xt),Bt=Et.getBucket(l);if(!Bt||Bt.projection.name==="mercator"&&nt||Bt.fullyClipped)continue;const ir=Bt.projection.name==="globe",ur=ir?s.ah(me.zoom):0,Zt=fm(xt,Bt.getProjection(),me),ar=me.calculatePixelsToTileUnitsMatrix(Et),or=Pe&&Bt.hasTextData(),Pr=Bt.hasIconTextFit()&&or&&Bt.hasIconData(),zr=Bt.getProjection().createInversionMatrix(me,xt.canonical),qr=(1<<Et.tileID.canonical.z)*s.aj/d.transform.worldSize,pi=Di=>{let bi=[0,0,0];if(Di){const bn=d.style.directionalLight,hi=d.style.ambientLight;bn&&hi&&(bi=Nu(d.style,bn,hi))}return bi},kr=Di=>{me.depthOcclusionForSymbolsAndCircles&&(l.hasInitialOcclusionOpacityProperties||d.terrain)&&(Di.push("DEPTH_D24"),Di.push("DEPTH_OCCLUSION"))},mi=()=>{const Di=ge&&l.layout.get("symbol-placement")!=="point",bi=[];kr(bi);const bn=Di||Pr,hi=Bt.elevationType==="road",Ci=d.shadowRenderer,Gi=hi&&Ze&&!!Ci&&Ci.enabled,Un=pi(Gi),Nn=hi&&Ze&&!d.terrain?Rt:ft,jn=l.paint.get("icon-image-cross-fade");d.terrainRenderModeElevated()&&Ze&&bi.push("PITCH_WITH_MAP_TERRAIN"),ir&&(bi.push("PROJECTION_GLOBE_VIEW"),bn&&bi.push("PROJECTED_POS_ON_VIEWPORT")),jn>0&&Bt.hasAnySecondaryIcon&&bi.push("ICON_TRANSITION"),!Bt.icon.zOffsetVertexBuffer||hi&&d.terrain||bi.push("Z_OFFSET"),Z===0&&re===0&&se===0&&le===1||bi.push("COLOR_ADJUSTMENT"),Bt.sdfIcons&&bi.push("RENDER_SDF"),Gi&&bi.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),hi&&Ze&&!d.terrain&&Bt.icon.orientationVertexBuffer&&bi.push("ELEVATED_ROADS");const Io=Bt.icon.programConfigurations.get(l.id),sl=d.getOrCreateProgram("symbol",{config:Io,defines:bi}),gs=Et.imageAtlasTexture?Et.imageAtlasTexture.size:[0,0],Zs=Bt.iconSizeData,jo=s.bH(Zs,me.zoom),_a=Ze||!me.isOrthographic,Ga=bf(Zt,Et.tileID.canonical,Ze,ge,me,Bt.getProjection(),ar),Go=lc(Zt,Et.tileID.canonical,Ze,ge,me,Bt.getProjection(),ar),Dn=d.translatePosMatrix(Go,Et,S,k,!0),Pn=d.translatePosMatrix(Zt,Et,S,k),Yi=bn?Hu:Ga,to=ge&&!Ze&&!Di;let Ao=vt;!nt&&!me.mercatorFromTransition||ge||(Ao=Ff(me));const On=ir?Ao:vt,ya=l.getColorAdjustmentMatrix(Z,re,se,le),Xu=Gm(Zs.kind,jo,to,Ze,d,Pn,Yi,Dn,fe,!1,gs,[0,0],0,xt,ur,We,zr,On,Bt.getProjection(),Un,qr,ya,jn,null),nu=Et.imageAtlasTexture?Et.imageAtlasTexture:null,vd=l.layout.get("icon-size").constantOr(0)!==1||Bt.iconsNeedLinear,xd=Bt.sdfIcons||d.options.rotating||d.options.zooming||vd||_a?Se.LINEAR:Se.NEAREST,va=Bt.sdfIcons&&l.paint.get("icon-halo-width").constantOr(1)!==0,Fl=d.terrain&&Ze&&Di?s.bi(s.bz(),Ga):Hu;if(Di&&Bt.icon){const ro=me.elevation,xa=ro?ro.getAtTileOffsetFunc(xt,me.center.lat,me.worldSize,Bt.getProjection()):null,Yu=jh(Zt,Et.tileID.canonical,Ze,ge,me,Bt.getProjection(),ar);Du(Bt,Zt,d,!1,Yu,Go,Ze,U,xa,xt)}return{program:sl,buffers:Bt.icon,uniformValues:Xu,atlasTexture:nu,atlasTextureIcon:null,atlasInterpolation:xd,atlasInterpolationIcon:null,isSDF:Bt.sdfIcons,hasHalo:va,depthMode:Nn,tile:Et,renderWithShadows:Gi,labelPlaneMatrixInv:Fl}},xi=()=>{const Di=ye&&l.layout.get("symbol-placement")!=="point",bi=[],bn=Di||Pe||Pr,hi=Bt.elevationType==="road",Ci=d.shadowRenderer,Gi=hi&&Me&&!!Ci&&Ci.enabled,Un=pi(Gi),Nn=hi&&Me&&!d.terrain?Rt:ft;d.terrainRenderModeElevated()&&Me&&bi.push("PITCH_WITH_MAP_TERRAIN"),ir&&(bi.push("PROJECTION_GLOBE_VIEW"),bn&&bi.push("PROJECTED_POS_ON_VIEWPORT")),!Bt.text.zOffsetVertexBuffer||hi&&d.terrain||bi.push("Z_OFFSET"),Bt.iconsInText&&bi.push("RENDER_TEXT_AND_SYMBOL"),bi.push("RENDER_SDF"),Gi&&bi.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),hi&&Me&&!d.terrain&&Bt.text.orientationVertexBuffer&&bi.push("ELEVATED_ROADS"),kr(bi);const jn=Bt.text.programConfigurations.get(l.id),Io=d.getOrCreateProgram("symbol",{config:jn,defines:bi});let sl,gs=[0,0],Zs=null;const jo=Bt.textSizeData;Bt.iconsInText&&(gs=Et.imageAtlasTexture?Et.imageAtlasTexture.size:[0,0],Zs=Et.imageAtlasTexture?Et.imageAtlasTexture:null,sl=Me||!me.isOrthographic||d.options.rotating||d.options.zooming||jo.kind==="composite"||jo.kind==="camera"?Se.LINEAR:Se.NEAREST);const _a=Et.glyphAtlasTexture?Et.glyphAtlasTexture.size:[0,0],Ga=l.layout.get("text-size-scale-range"),Go=s.ay(d.scaleFactor,Ga[0],Ga[1]),Dn=s.bH(jo,me.zoom,Go),Pn=bf(Zt,Et.tileID.canonical,Me,ye,me,Bt.getProjection(),ar),Yi=lc(Zt,Et.tileID.canonical,Me,ye,me,Bt.getProjection(),ar),to=d.translatePosMatrix(Yi,Et,C,R,!0),Ao=d.translatePosMatrix(Zt,Et,C,R),On=bn?Hu:Pn,ya=ye&&!Me&&!Di;let Xu=vt;!nt&&!me.mercatorFromTransition||ye||(Xu=Ff(me));const nu=Gm(jo.kind,Dn,ya,Me,d,Ao,On,to,fe,!0,_a,gs,0,xt,ur,We,zr,ir?Xu:vt,Bt.getProjection(),Un,qr,null,null,Go),vd=Et.glyphAtlasTexture?Et.glyphAtlasTexture:null,xd=Se.LINEAR,va=l.paint.get("text-halo-width").constantOr(1)!==0,Fl=d.terrain&&Me&&Di?s.bi(s.bz(),Pn):Hu;if(Di&&Bt.text){const ro=me.elevation,xa=ro?ro.getAtTileOffsetFunc(xt,me.center.lat,me.worldSize,Bt.getProjection()):null,Yu=jh(Zt,
2812Et.tileID.canonical,Me,ye,me,Bt.getProjection(),ar);Du(Bt,Zt,d,!0,Yu,Yi,Me,W,xa,xt)}return{program:Io,buffers:Bt.text,uniformValues:nu,atlasTexture:vd,atlasTextureIcon:Zs,atlasInterpolation:xd,atlasInterpolationIcon:sl,isSDF:!0,hasHalo:va,depthMode:Nn,tile:Et,renderWithShadows:Gi,labelPlaneMatrixInv:Fl}},Zi=Bt.icon.segments.get().length,$r=Bt.text.segments.get().length,gi=Zi&&!b.onlyText?mi():null,vi=$r&&!b.onlyIcons?xi():null,Si=l.paint.get("icon-opacity").constantOr(1),Zr=l.paint.get("text-opacity").constantOr(1);if(ct&&Bt.canOverlap){Qe=!0;const Di=Si&&!b.onlyText?Bt.icon.segments.get():[],bi=Zr&&!b.onlyIcons?Bt.text.segments.get():[];for(const bn of Di)Ke.push({segments:new s.bd([bn]),sortKey:bn.sortKey,state:gi});for(const bn of bi)Ke.push({segments:new s.bd([bn]),sortKey:bn.sortKey,state:vi})}else b.onlyText||Ke.push({segments:Si?Bt.icon.segments:new s.bd([]),sortKey:0,state:gi}),b.onlyIcons||Ke.push({segments:Zr?Bt.text.segments:new s.bd([]),sortKey:0,state:vi})}Qe&&Ke.sort((xt,Et)=>xt.sortKey-Et.sortKey);for(const xt of Ke){const Et=xt.state;if(Et)if(d.terrain?d.terrain.setupElevationDraw(Et.tile,Et.program,{useDepthForOcclusion:me.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Et.labelPlaneMatrixInv}):d.setupDepthForOcclusion(me.depthOcclusionForSymbolsAndCircles,Et.program),we.activeTexture.set(Se.TEXTURE0),Et.atlasTexture&&Et.atlasTexture.bind(Et.atlasInterpolation,Se.CLAMP_TO_EDGE,!0),Et.atlasTextureIcon&&(we.activeTexture.set(Se.TEXTURE1),Et.atlasTextureIcon&&Et.atlasTextureIcon.bind(Et.atlasInterpolationIcon,Se.CLAMP_TO_EDGE,!0)),Et.renderWithShadows&&d.shadowRenderer.setupShadows(Et.tile.tileID.toUnwrapped(),Et.program,"vector-tile"),d.uploadCommonLightUniforms(d.context,Et.program),Et.hasHalo){const Bt=Et.uniformValues;Bt.u_is_halo=1,Jc(Et.buffers,xt.segments,l,d,Et.program,Et.depthMode,_,v,Bt,2),Bt.u_is_halo=0}else{if(Et.isSDF){const Bt=Et.uniformValues;Et.hasHalo&&(Bt.u_is_halo=1,Jc(Et.buffers,xt.segments,l,d,Et.program,Et.depthMode,_,v,Bt,1)),Bt.u_is_halo=0}Jc(Et.buffers,xt.segments,l,d,Et.program,Et.depthMode,_,v,Et.uniformValues,1)}}}function Jc(d,i,l,f,_,v,b,S,C,k){const R=[d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer,d.iconTransitioningVertexBuffer,d.globeExtVertexBuffer,d.zOffsetVertexBuffer,d.orientationVertexBuffer];_.draw(f,f.context.gl.TRIANGLES,v,b,S,vr.disabled,C,l.id,d.layoutVertexBuffer,d.indexBuffer,i,l.paint,f.transform.zoom,d.programConfigurations.get(l.id),R,k)}function Nf(d,i){const l=1<<d.canonical.z,f=(i.x*l-d.canonical.x-d.wrap*l)*s.aj,_=(i.y*l-d.canonical.y)*s.aj,v=s.e2(i.z,i.y);return s.d2(f,_,v)}function Jt(d,i,l,f,_){if(!l.layout||l.layout.get("fill-elevation-reference")==="none")return;const v=d.context.gl,b=new Yt(d.context.gl.LEQUAL,Yt.ReadWrite,d.depthRangeFor3D),S=new Yt(d.context.gl.GREATER,Yt.ReadWrite,d.depthRangeFor3D),C=function(N){const G=s.cU(N.pitch);let U=.01;return N.isOrthographic&&(U=s.ai(1e-4,U,s.cZ(G>=Co?1:G/Co))),2*U}(d.transform),k=d.transform.getFreeCameraOptions().position,R="elevatedStructuresDepthReconstruct",F=d.getOrCreateProgram(R,{defines:["DEPTH_RECONSTRUCTION"]}),z=d.getOrCreateProgram(R);for(const N of f){const G=i.getTile(N),U=G.getBucket(l);if(!U)continue;const W=U.elevatedStructures;if(!W)continue;const Z=U.elevationBufferData.heightRange,re=Nf(N.toUnwrapped(),k),se=d.translatePosMatrix(N.projMatrix,G,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor"));let le,fe,we,Se;if(_==="initialize"){if(!Z||Z.min>=1||W.depthSegments.segments[0].primitiveLength===0)continue;le=Bm(se,re,C,1,0),fe=b,we=W.depthSegments,Se=F}else if(_==="reset"){if(!Z||Z.min>=0||W.maskSegments.segments[0].primitiveLength===0)continue;le=Bm(se,re,0,0,1),fe=S,we=W.maskSegments,Se=F}else if(_==="geometry"){if(W.depthSegments.segments[0].primitiveLength===0)continue;le=Bm(se,re,C,1,0),fe=b,we=W.depthSegments,Se=z}Se.draw(d,v.TRIANGLES,fe,Cr.disabled,Br.disabled,vr.disabled,le,l.id,W.vertexBuffer,W.indexBuffer,we,l.paint,d.transform.zoom)}}function Hm(d,i,l){const{painter:f,sourceCache:_,layer:v,coords:b,colorMode:S,elevationType:C,terrainEnabled:k,pass:R}=d,F=f.context.gl,z=v.paint.get("fill-pattern"),N=v.paint.get("fill-pattern-cross-fade"),G=z.constantOr(null);let U=C;C!=="road"||i&&!k||(U="none");const W=U==="road",Z=d.painter.shadowRenderer,re=W&&!!Z&&Z.enabled,se=new Yt(f.context.gl.LEQUAL,Yt.ReadOnly,f.depthRangeFor3D);let le=[0,0,0];if(re){const Se=f.style.directionalLight,me=f.style.ambientLight;Se&&me&&(le=Nu(f.style,Se,me))}const fe=z&&z.constantOr(1),we=(Se,me)=>{let ge,ye,Ze,Me,ct;me?(ge=fe&&!v.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ze=F.LINES):(ge=fe?"fillPattern":"fill",Ze=F.TRIANGLES);
2812for(const Qe of b){const ft=_.getTile(Qe);if(fe&&!ft.patternsLoaded())continue;const Rt=ft.getBucket(v);if(!Rt)continue;const We=i?Rt.elevationBufferData:Rt.bufferData;if(We.isEmpty())continue;f.prepareDrawTile();const Pe=We.programConfigurations.get(v.id),nt=f.isTileAffectedByFog(Qe),Ke=[],vt=[];W&&(Ke.push("ELEVATED_ROADS"),vt.push(We.elevatedLayoutVertexBuffer)),re&&Ke.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),fe&&(f.context.activeTexture.set(F.TEXTURE0),ft.imageAtlasTexture&&ft.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),Pe.updatePaintBuffers());let xt=!1;if(G&&ft.imageAtlas){const Zt=ft.imageAtlas,ar=s.dZ.from(G),or=ar.getPrimary().scaleSelf(s.q.devicePixelRatio).toString(),Pr=ar.getSecondary(),zr=Zt.patternPositions.get(or),qr=Pr?Zt.patternPositions.get(Pr.scaleSelf(s.q.devicePixelRatio).toString()):null;xt=!!zr&&!!qr,zr&&Pe.setConstantPatternPositions(zr,qr)}N>0&&(xt||Pe.getPatternTransitionVertexBuffer("fill-pattern"))&&Ke.push("FILL_PATTERN_TRANSITION");const Et=f.getOrCreateProgram(ge,{config:Pe,overrideFog:nt,defines:Ke}),Bt=f.translatePosMatrix(Qe.projMatrix,ft,v.paint.get("fill-translate"),v.paint.get("fill-translate-anchor"));re&&Z.setupShadows(ft.tileID.toUnwrapped(),Et,"vector-tile");const ir=v.paint.get("fill-emissive-strength");if(me){Me=We.lineIndexBuffer,ct=We.lineSegments;const Zt=f.terrain&&f.terrain.renderingToTexture?f.terrain.drapeBufferSize:[F.drawingBufferWidth,F.drawingBufferHeight];ye=ge==="fillOutlinePattern"&&fe?RI(Bt,ir,f,ft,Zt,le,N):kI(Bt,ir,Zt,le)}else Me=We.indexBuffer,ct=We.triangleSegments,ye=fe?$b(Bt,ir,f,ft,le,N):Gb(Bt,ir,le);f.uploadCommonUniforms(f.context,Et,Qe.toUnwrapped());let ur=Se;(C==="road"&&!k||C==="offset")&&(ur=se),Et.draw(f,Ze,ur,l||f.stencilModeForClipping(Qe),S,vr.disabled,ye,v.id,We.layoutVertexBuffer,Me,ct,v.paint,f.transform.zoom,Pe,vt)}};f.renderPass===R&&we(f.depthModeForSublayer(1,f.renderPass==="opaque"?Yt.ReadWrite:Yt.ReadOnly),!1),U==="none"&&f.renderPass==="translucent"&&v.paint.get("fill-antialias")&&we(f.depthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,Yt.ReadOnly),!0)}function Bf(d,i,l,f,_,v,b,S){l.resetLayerRenderingStats(d);const C=d.context,k=C.gl,R=d.transform,F=l.paint.get("fill-extrusion-pattern"),z=l.paint.get("fill-extrusion-pattern-cross-fade"),N=F.constantOr(null),G=F.constantOr(1),U=l.paint.get("fill-extrusion-opacity"),W=d.style.enable3dLights(),Z=l.paint.get(W&&!G?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),re=[l.paint.get("fill-extrusion-ambient-occlusion-intensity"),Z],se=l.layout.get("fill-extrusion-edge-radius"),le=se>0&&!l.paint.get("fill-extrusion-rounded-roof"),fe=le?0:se,we=R.projection.name==="globe"?s.e5():0,Se=R.projection.name==="globe",me=Se?s.ah(R.zoom):0,ge=[s.aD(R.center.lng),s.aH(R.center.lat)],ye=l.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ze=l.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ye?null:l.lut).toArray01().slice(0,3),Me=l.paint.get("fill-extrusion-flood-light-intensity"),ct=l.paint.get("fill-extrusion-vertical-scale"),Qe=l.paint.get("fill-extrusion-line-width").constantOr(1)!==0,ft=l.paint.get("fill-extrusion-height-alignment"),Rt=l.paint.get("fill-extrusion-base-alignment"),We=Rl(d,l.paint.get("fill-extrusion-cutoff-fade-range")),Pe=[];let nt;Se&&Pe.push("PROJECTION_GLOBE_VIEW"),re[0]>0&&Pe.push("FAUX_AO"),le&&Pe.push("ZERO_ROOF_RADIUS"),S&&Pe.push("HAS_CENTROID"),Me>0&&Pe.push("FLOOD_LIGHT"),We.shouldRenderCutoff&&Pe.push("RENDER_CUTOFF"),Qe&&Pe.push("RENDER_WALL_MODE");const Ke=d.renderPass==="shadow",vt=d.shadowRenderer,xt=Ke&&!!vt,Et=Ke?vr.disabled:vr.backCCW;d.shadowRenderer&&(d.shadowRenderer.useNormalOffset=!0);let Bt=[0,0,0];if(vt){const Zt=d.style.directionalLight,ar=d.style.ambientLight;Zt&&ar&&(Bt=Nu(d.style,Zt,ar)),Ke||(Pe.push("RENDER_SHADOWS","DEPTH_TEXTURE"),vt.useNormalOffset&&Pe.push("NORMAL_OFFSET")),nt=Pe.concat(["SHADOWS_SINGLE_CASCADE"])}const ir=xt?"fillExtrusionDepth":G?"fillExtrusionPattern":"fillExtrusion",ur=l.getLayerRenderingStats();for(const Zt of f){const ar=i.getTile(Zt),or=ar.getBucket(l);if(!or||or.projection.name!==R.projection.name)continue;let Pr=!1;vt&&(Pr=vt.getMaxCascadeForTile(Zt.toUnwrapped())===0);const zr=d.isTileAffectedByFog(Zt),qr=or.programConfigurations.get(l.id);let pi=!1;if(N&&ar.imageAtlas){const vi=ar.imageAtlas,Si=s.dZ.from(N),Zr=Si.getPrimary().scaleSelf(s.q.devicePixelRatio).toString(),Di=Si.getSecondary(),bi=vi.patternPositions.get(Zr),bn=Di?vi.patternPositions.get(Di.scaleSelf(s.q.devicePixelRatio).toString()):null;pi=!!bi&&!!bn,bi&&qr.setConstantPatternPositions(bi,bn)}z>0&&(pi||qr.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Pe.push("FILL_EXTRUSION_PATTERN_TRANSITION");const kr=d.getOrCreateProgram(ir,{config:qr,defines:Pr?nt:Pe,overrideFog:zr});if(d.terrain&&d.terrain.setupElevationDraw(ar,kr,{useMeterToDem:!0}),!or.centroidVertexBuffer){const vi=kr.attributes.a_centroid_pos;vi!==void 0&&k.vertexAttrib2f(vi,0,0)}!Ke&&vt&&vt.setupShadows(ar.tileID.toUnwrapped(),kr,"vector-tile"),G&&(d.context.activeTexture.set(k.TEXTURE0),ar.imageAtlasTexture&&ar.imageAtlasTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE),qr.updatePaintBuffers());const mi=l.paint.get("fill-extrusion-vertical-gradient"),xi=1/or.tileToMeter;let Zi;if(Ke&&vt){if(qm(ar.tileID,or.maxHeight,d))continue;const vi=vt.calculateShadowPassMatrixFromTile(ar.tileID.toUnwrapped());Zi=jb(vi,fe,xi,ct,ft,Rt)}else{const vi=d.translatePosMatrix(Zt.expandedProjMatrix,ar,l.paint.get("fill-extrusion-translate"),l.paint.get("fill-extrusion-translate-anchor")),Si=R.projection.createInversionMatrix(R,Zt.canonical);Zi=G?id(vi,d,mi,U,re,fe,xi,Zt,ar,we,ft,Rt,me,ge,Si,Ze,ct,z):Jy(vi,d,mi,U,re,fe,xi,Zt,we,ft,Rt,me,ge,Si,Ze,ct,Me,Bt)}d.uploadCommonUniforms(C,kr,Zt.toUnwrapped(),null,We);let $r=or.segments;if(R.projection.name==="mercator"&&!Ke&&($r=or.getVisibleSegments(ar.tileID,d.terrain,d.transform.getFrustum(0)),!$r.get().length))continue;if(ur)if(Ke)for(const vi of $r.get())ur.numRenderedVerticesInShadowPass+=vi.primitiveLength;else for(const vi of $r.get())ur.numRenderedVerticesInTransparentPass+=vi.primitiveLength;const gi=[];(d.terrain||S)&&gi.push(or.centroidVertexBuffer),Se&&gi.push(or.layoutVertexExtBuffer),Qe&&gi.push(or.wallVertexBuffer),kr.draw(d,C.gl.TRIANGLES,_,v,b,Et,Zi,l.id,or.layoutVertexBuffer,or.indexBuffer,$r,l.paint,d.transform.zoom,qr,gi)}d.shadowRenderer&&(d.shadowRenderer.useNormalOffset=!1)}class hc{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function As(d,i,l,f,_,v,b,S,C,k,R,F,z,N,G,U,W,Z,re,se){const le=i.context,fe=le.gl,we=i.transform,Se=i.transform.zoom,me=[],ge=d.translate,ye=d.translateAnchor,Ze=d.edgeRadius,Me=Rl(i,d.cutoffFadeRange);R==="clear"?(me.push("CLEAR_SUBPASS"),se&&(me.push("CLEAR_FROM_TEXTURE"),le.activeTexture.set(fe.TEXTURE0),se.bind(fe.LINEAR,fe.CLAMP_TO_EDGE))):R==="sdf"&&me.push("SDF_SUBPASS"),Z&&me.push("HAS_CENTROID"),Me.shouldRenderCutoff&&me.push("RENDER_CUTOFF");const ct=(Qe,ft,Rt,We,Pe)=>{const nt=ft.programConfigurations.get(f.id),Ke=i.isTileAffectedByFog(Qe),vt=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:nt,defines:me,overrideFog:Ke}),xt=((Bt,ir,ur,Zt,ar,or,Pr,zr,qr,pi,kr)=>({u_matrix:ir,u_opacity:ur,u_ao_pass:Zt?1:0,u_meter_to_tile:ar,u_ao:or,u_flood_light_intensity:Pr,u_flood_light_color:zr,u_attenuation:qr,u_edge_radius:pi,u_fb:0,u_fb_size:kr,u_dynamic_offset:1}))(0,We,F,k,Pe,[z,N*Pe],G,U,W,Se>=17?0:Ze*Pe,se?se.size[0]:0),Et=[];Z&&Et.push(ft.hiddenByLandmarkVertexBuffer),i.uploadCommonUniforms(le,vt,Qe.toUnwrapped(),null,Me),vt.draw(i,le.gl.TRIANGLES,v,b,S,C,xt,f.id,ft.vertexBuffer,ft.indexBuffer,Rt,f.paint,Se,nt,Et)};
2812for(const Qe of _){const ft=l.getTile(Qe),Rt=ft.getBucket(f);if(!Rt||Rt.projection.name!==we.projection.name||!Rt.groundEffect||Rt.groundEffect&&!Rt.groundEffect.hasData())continue;const We=Rt.groundEffect,Pe=1/Rt.tileToMeter;{const nt=i.translatePosMatrix(Qe.projMatrix,ft,ge,ye),Ke=We.getDefaultSegment();ct(Qe,We,Ke,nt,Pe)}if(re)for(let nt=0;nt<4;nt++){const Ke=s.e3[nt](Qe),vt=l.getTile(Ke);if(!vt)continue;const xt=vt.getBucket(f);if(!xt||xt.projection.name!==we.projection.name||!xt.groundEffect||xt.groundEffect&&!xt.groundEffect.hasData())continue;const Et=xt.groundEffect;let Bt,ir;nt===0?(Bt=[-s.aj,0,0],ir=1):nt===1?(Bt=[s.aj,0,0],ir=0):nt===2?(Bt=[0,-s.aj,0],ir=3):(Bt=[0,s.aj,0],ir=2);const ur=Et.regionSegments[ir];if(!ur)continue;const Zt=new Float32Array(16);s.bo(Zt,Qe.projMatrix,Bt),ct(Qe,Et,ur,i.translatePosMatrix(Zt,ft,ge,ye),Pe)}}}function Tr(d,i,l,f,_,v,b){f.centroidVertexArray.length===0&&f.createCentroidsBuffer();const S=v?v.findDEMTileFor(l):null;if(!(S&&S.dem||b))return;v&&S&&S.dem&&f.selfDEMTileTimestamp!==S.dem._timestamp&&(f.borderDoneWithNeighborZ=[-1,-1,-1,-1],f.selfDEMTileTimestamp=S.dem._timestamp);const C=Z=>new s.P(Math.ceil((Z+s.e7)*s.e8),0),k=Z=>{const re=i.getSource().minzoom,se=fe=>{const we=i.getTileByID(fe);if(we&&we.hasData())return we.getBucket(_)},le=[0,-1,1];for(const fe of le){if(Z.overscaledZ+fe<re)continue;const we=se(Z.calculateScaledKey(Z.overscaledZ+fe));if(we)return we}},R=[0,0,0],F=(Z,re)=>(R[0]=Math.min(Z.min.y,re.min.y),R[1]=Math.max(Z.max.y,re.max.y),R[2]=s.aj-re.min.x>Z.max.x?re.min.x-s.aj:Z.max.x,R),z=(Z,re)=>(R[0]=Math.min(Z.min.x,re.min.x),R[1]=Math.max(Z.max.x,re.max.x),R[2]=s.aj-re.min.y>Z.max.y?re.min.y-s.aj:Z.max.y,R),N=[(Z,re)=>F(Z,re),(Z,re)=>F(re,Z),(Z,re)=>z(Z,re),(Z,re)=>z(re,Z)],G=(Z,re,se,le,fe,we,Se)=>{if(!v)return 0;const me=[[we?se:Z,we?Z:se,0],[we?se:re,we?re:se,0]],ge=Se<0?s.aj+Se:Se,ye=[we?ge:(Z+re)/2,we?(Z+re)/2:ge,0];return se===0&&Se<0||se!==0&&Se>0?v.getForTilePoints(fe,[ye],!0,le):me.push(ye),v.getForTilePoints(l,me,!0,S),Math.max(me[0][2],me[1][2],ye[2])/v.exaggeration()};for(let Z=0;Z<4;Z++){const re=f.borderFeatureIndices[Z];if(re.length===0)continue;const se=s.e3[Z](l),le=k(se);if(!(le&&le instanceof s.e4))continue;const fe=v?v.findDEMTileFor(se):null;if(!(fe&&fe.dem||b)||(v&&fe&&fe.dem&&f.borderDEMTileTimestamp[Z]!==fe.dem._timestamp&&(f.borderDoneWithNeighborZ[Z]=-1,f.borderDEMTileTimestamp[Z]=fe.dem._timestamp),f.borderDoneWithNeighborZ[Z]===le.canonical.z))continue;le.centroidVertexArray.length===0&&le.createCentroidsBuffer();const we=(Z<2?1:5)-Z,Se=le.borderDoneWithNeighborZ[we]!==f.canonical.z,me=le.borderFeatureIndices[we];let ge=0;if(f.canonical.z!==le.canonical.z){for(const ye of re)f.showCentroid(f.featuresOnBorder[ye]);if(Se)for(const ye of me)le.showCentroid(le.featuresOnBorder[ye]);f.borderDoneWithNeighborZ[Z]=le.canonical.z,le.borderDoneWithNeighborZ[we]=f.canonical.z}for(const ye of re){const Ze=f.featuresOnBorder[ye],Me=f.centroidData[Ze.centroidDataIndex],ct=Ze.borders[Z];let Qe;for(;ge<me.length;){Qe=le.featuresOnBorder[me[ge]];const ft=Qe.borders[we];if(ft[1]>ct[0]+3||ft[0]>ct[0]-3)break;le.showCentroid(Qe),ge++}if(Qe&&ge<me.length){const ft=ge;let Rt=0;for(;!(Qe.borders[we][0]>ct[1]-3)&&(Rt++,++ge!==me.length);)Qe=le.featuresOnBorder[me[ge]];Qe=le.featuresOnBorder[me[ft]];let We=!1;if(Rt>=1){const Ke=Qe.borders[we];Math.abs(ct[0]-Ke[0])<3&&Math.abs(ct[1]-Ke[1])<3&&(Rt=1,We=!0,ge=ft+1)}else if(Rt===0){f.showCentroid(Ze);continue}const Pe=le.centroidData[Qe.centroidDataIndex];b&&We&&(((U=Me).flags|(W=Pe).flags)&s.e6?(U.flags|=s.e6,W.flags|=s.e6):(U.flags&=~s.e6,W.flags&=~s.e6));const nt=Ze.intersectsCount()>1||Qe.intersectsCount()>1;if(Rt>1)ge=ft,Me.centroidXY=Pe.centroidXY=new s.P(0,0);else if(fe&&fe.dem&&!nt){const Ke=N[Z](Me,Pe),vt=Z%2?s.aj-1:0,xt=G(Ke[0],Math.min(s.aj-1,Ke[1]),vt,fe,se,Z<2,Ke[2]);Me.centroidXY=Pe.centroidXY=C(xt)}else nt?Me.centroidXY=Pe.centroidXY=new s.P(0,0):(Me.centroidXY=f.encodeBorderCentroid(Ze),Pe.centroidXY=le.encodeBorderCentroid(Qe));f.writeCentroidToBuffer(Me),le.writeCentroidToBuffer(Pe)}else f.showCentroid(Ze)}f.borderDoneWithNeighborZ[Z]=le.canonical.z,le.borderDoneWithNeighborZ[we]=f.canonical.z}var U,W;(f.needsCentroidUpdate||!f.centroidVertexBuffer&&f.centroidVertexArray.length!==0)&&f.uploadCentroid(d)}const u0=[1,0,0],zI=[0,1,0],DI=[0,0,1];function qm(d,i,l){const f=l.transform,_=l.shadowRenderer;if(!_)return!0;const v=d.toUnwrapped(),b=f.tileSize*_._cascades[l.currentShadowCascade].scale;let S=i;if(f.elevation){const U=f.elevation.getMinMaxForTile(d);U&&(S+=U.max)}const C=[..._.shadowDirection];C[2]=-C[2];const k=_.computeSimplifiedTileShadowVolume(v,S,b,C);if(!k)return!1;const R=[u0,zI,DI,C,[C[0],0,C[2]],[0,C[1],C[2]]],F=f.projection.name==="globe",z=f.scaleZoom(b),N=s.cy.fromInvProjectionMatrix(f.invProjMatrix,f.worldSize,z,!F),G=_.getCurrentCascadeFrustum();return N.intersectsPrecise(k.vertices,k.planes,R)===0||G.intersectsPrecise(k.vertices,k.planes,R)===0}function Zm(d){const{painter:i,source:l,layer:f,coords:_}=d,v=d.defines,b=i.context,S=i.renderPass==="shadow",C=i.renderPass==="light-beam",k=i.shadowRenderer;let R;k&&(R=v.concat(["SHADOWS_SINGLE_CASCADE"]));const F=s.e9(i.transform.center.lat,i.transform.zoom);for(const z of _){const N=l.getTile(z),G=N.getBucket(f);if(!G)continue;let U=!1;k&&(U=k.getMaxCascadeForTile(z.toUnwrapped())===0);const W=G.programConfigurations.get(f.id);let Z,re,se=i.translatePosMatrix(z.expandedProjMatrix,N,[0,0],"map");if(se=s.cP(s.bz(),se,[1,1,d.verticalScale]),S&&k){if(qm(N.tileID,G.maxHeight*F,i))continue;let le=k.calculateShadowPassMatrixFromTile(N.tileID.toUnwrapped());le=s.cP(s.bz(),le,[1,1,d.verticalScale]),re=Hb(le),Z=i.getOrCreateProgram("buildingDepth",{config:W,defines:U?R:v,overrideFog:!1})}else if(C)Z=i.getOrCreateProgram("buildingBloom",{config:W,defines:U?R:v,overrideFog:!1}),re=e0(se);else{const le=i.transform.calculatePosMatrix(z.toUnwrapped(),i.transform.worldSize);s.cP(le,le,[1,1,d.verticalScale]);const fe=s.bz();s.cP(fe,le,[1,-1,1/F]),s.bi(fe,fe),s.ea(fe,fe),re=Qy(se,fe),Z=i.getOrCreateProgram("building",{config:W,defines:U?R:v,overrideFog:!1}
vendor: 6,969 bytes, line 2812
2812),k&&k.setupShadowsFromMatrix(le,Z,!0)}if(i.uploadCommonUniforms(b,Z,z.toUnwrapped(),null,null),C){const le=G.bloomGeometry;Z.draw(i,b.gl.TRIANGLES,d.depthMode,Cr.disabled,d.blendMode,vr.disabled,re,f.id,le.layoutVertexBuffer,le.indexBuffer,le.segmentsBucket,f.paint,i.transform.zoom,W,[le.layoutAttenuationBuffer,le.layoutColorBuffer])}else Z.draw(i,b.gl.TRIANGLES,d.depthMode,Cr.disabled,d.blendMode,S?vr.disabled:vr.backCW,re,f.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,f.paint,i.transform.zoom,W,[G.layoutNormalBuffer,G.layoutColorBuffer])}}function ew(d){return[d[0]*s.eb,d[1]*s.eb,d[2]*s.eb,0]}function Wm(d,i,l,f,_,v,b,S,C){const k=f.getSource(),R=l.globeSharedBuffers;if(!R)return;let F,z,N;if(i&&(F=f.getTile(i)),k instanceof s.aP?(z=k.texture,N=s.dE(0,0,l.transform)):F&&i&&(z=F.texture,N=s.dE(i.canonical.z,i.canonical.x,l.transform)),!z||!N)return;d||(N=s.cP(s.bz(),N,[1,-1,1]));const G=l.context,U=G.gl,W=_.paint.get("raster-resampling")==="nearest"?U.NEAREST:U.LINEAR,Z=l.colorModeForDrapableLayerRenderPass(v),re=b.defines;re.push("GLOBE_POLES");const se=new Yt(U.LEQUAL,Yt.ReadWrite,l.depthRangeFor3D),le=Float32Array.from(l.transform.expandedFarZProjMatrix),fe=Float32Array.from(s.bh(s.dD(new s.cA(0,0,0))));l.terrain&&l.terrain.prepareDrawTile(),G.activeTexture.set(U.TEXTURE0),z.bind(W,U.CLAMP_TO_EDGE),G.activeTexture.set(U.TEXTURE1),z.bind(W,U.CLAMP_TO_EDGE),"useMipmap"in z&&G.extTextureFilterAnisotropic&&l.transform.pitch>20&&U.texParameterf(U.TEXTURE_2D,G.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,G.extTextureFilterAnisotropicMax);const[we,Se,me,ge]=i?R.getPoleBuffers(i.canonical.z,!1):R.getPoleBuffers(0,!0),ye=_.paint.get("raster-elevation");let Ze;d?(Ze=we,l.renderDefaultNorthPole=ye!==0):(Ze=Se,l.renderDefaultSouthPole=ye!==0);const Me=ew(b.mix),ct=((ft,Rt,We,Pe,nt,Ke,vt,xt,Et,Bt,ir,ur,Zt)=>r0(ft,Rt,We,new Float32Array(16),new Float32Array(9),[0,0],Pe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ke,[0,0],xt,2,Bt,ir,ur,1,0,Zt))(le,fe,N,s.ah(l.transform.zoom),0,_,0,ye,0,Me,b.offset,b.range,v),Qe=l.getOrCreateProgram("raster",{defines:re});l.uploadCommonUniforms(G,Qe,null),Qe.draw(l,U.TRIANGLES,se,C,Z,S,ct,_.id,Ze,me,ge)}function OI(d){const i=d._nearZ,l=d.projection.farthestPixelDistance(d),f=l-i,_=.2*d.height,v=i+_;return[i,l,(v-_-i)/f,(v-i)/f]}function FI(d,i,l,f){if(d)return i instanceof zi&&d instanceof Nh?i.getTextureDescriptor(d,l,!0):{texture:d.texture,mix:ew(f.mix),offset:f.offset,buffer:0,tileSize:1}}var qs=s.ec([{name:"a_index",type:"Int16",components:1}]);class h0{constructor(i,l,f,_){const v={width:f[0],height:f[1],data:null},b=i.gl;this.targetColorTexture=new s.T(i,v,b.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(i,v,b.RGBA8,{useMipmap:!1}),this.context=i,this.updateParticleTexture(l,_),this.lastInvalidatedAt=0}updateParticleTexture(i,l){if(this.particleTextureDimension===l.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const f=this.context.gl,_=l.width*l.height;this.particleTexture0=new s.T(this.context,l,f.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,l,f.RGBA8,{premultiply:!1,useMipmap:!1});const v=new s.ed;v.reserve(_);for(let b=0;b<_;b++)v.emplaceBack(b);this.particleIndexBuffer=this.context.createVertexBuffer(v,qs.members,!0),this.particleSegment=s.bd.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=l.width}update(i){return!(this.lastInvalidatedAt<i&&(this.lastInvalidatedAt=s.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function ps(d,i,l){if(!d)return null;const f=i.getTextureDescriptor(d,l,!0);if(!f)return null;let{texture:_,mix:v,offset:b,tileSize:S,buffer:C,format:k}=f;if(!_||!k)return null;let R=!1;return k==="uint32"&&(R=!0,v[3]=0,v=Vm(s.ee,v,[0,l.paint.get("raster-particle-max-speed")]),b=Zc(s.ee,b,[0,l.paint.get("raster-particle-max-speed")])),{texture:_,textureOffset:[C/(S+2*C),S/(S+2*C)],tileSize:S,scalarData:R,scale:v,offset:b,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[k]]}}function Qc(d){const i=d._nearZ,l=d.projection.farthestPixelDistance(d),f=l-i,_=.2*d.height,v=i+_;return[i,l,(v-_-i)/f,(v-i)/f]}const tw=new s.am(1,0,0,1),d0=new s.am(0,1,0,1),f0=new s.am(0,0,1,1),p0=new s.am(1,0,1,1),rw=new s.am(0,1,1,1);function Ll(d,i,l,f,_,v){for(let b=0;b<l.length;b++)if(_){const k=new s.am(f.r*.8,f.g*.8,f.b*.8,1);Ni(d,i,l[b],f,-1,-1,v),Ni(d,i,l[b],f,-1,1,v),Ni(d,i,l[b],f,1,1,v),Ni(d,i,l[b],f,1,-1,v),Ni(d,i,l[b],k,0,0,v)}else Ni(d,i,l[b],f,0,0,v)}function Ni(d,i,l,f,_,v,b){const S=d.context,C=d.transform,k=S.gl,R=C.projection.name==="globe",F=R?["PROJECTION_GLOBE_VIEW"]:[];let z=s.bw(l.projMatrix);if(R&&s.ah(C.zoom)>0){const Me=s.bg(l.canonical,C),ct=s.ef(Me);z=s.az(new Float32Array(16),C.globeMatrix,ct),s.az(z,C.projMatrix,z)}const N=s.bz();N[12]+=2*_/(s.q.devicePixelRatio*C.width),N[13]+=2*v/(s.q.devicePixelRatio*C.height),s.az(z,N,z);const G=d.getOrCreateProgram("debug",{defines:F}),U=i.getTileByID(l.key);d.terrain&&d.terrain.setupElevationDraw(U,G);const W=Yt.disabled,Z=Cr.disabled,re=d.colorModeForRenderPass(),se="$debug";S.activeTexture.set(k.TEXTURE0),d.emptyTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE),R?U._makeGlobeTileDebugBuffers(d.context,C):U._makeDebugTileBoundsBuffers(d.context,C.projection);const le=U._tileDebugBuffer||d.debugBuffer,fe=U._tileDebugIndexBuffer||d.debugIndexBuffer,we=U._tileDebugSegments||d.debugSegments;if(G.draw(d,k.LINE_STRIP,W,Z,re,vr.disabled,t0(z,f.toPremultipliedRenderColor(null)),se,le,fe,we,null,null,null,[U._globeTileDebugBorderBuffer]),b){const Me=U.latestRawTileData,ct=Math.floor((Me&&Me.byteLength||0)/1024);let Qe=l.canonical.toString();l.overscaledZ!==l.canonical.z&&(Qe+=` => ${l.overscaledZ}`),Qe+=` ${U.state}`,Qe+=` ${ct}kb`,function(ft,Rt){ft.initDebugOverlayCanvas();const We=ft.debugOverlayCanvas,Pe=ft.context.gl,nt=ft.debugOverlayCanvas.getContext("2d");nt.clearRect(0,0,We.width,We.height),nt.shadowColor="white",nt.shadowBlur=2,nt.lineWidth=1.5,nt.strokeStyle="white",nt.textBaseline="top",nt.font="bold 36px Open Sans, sans-serif",nt.fillText(Rt,5,5),nt.strokeText(Rt,5,5),ft.debugOverlayTexture.update(We),ft.debugOverlayTexture.bind(Pe.LINEAR,Pe.CLAMP_TO_EDGE)}(d,Qe)}const Se=i.getTile(l).tileSize,me=512/Math.min(Se,512)*(l.overscaledZ/C.zoom)*.5,ge=U._tileDebugTextBuffer||d.debugBuffer,ye=U._tileDebugTextIndexBuffer||d.quadTriangleIndexBuffer,Ze=U._tileDebugTextSegments||d.debugSegments;G.draw(d,k.TRIANGLES,W,Z,Br.alphaBlended,vr.disabled,t0(z,s.am.transparent.toPremultipliedRenderColor(null),me),se,ge,ye,Ze,null,null,null,[U._globeTileDebugTextBuffer])}
2812function Vf(d,i,l,f){Uf(d,0,i+l/2,d.transform.width,l,f)}function Xm(d,i,l,f){Uf(d,i-l/2,0,l,d.transform.height,f)}function Uf(d,i,l,f,_,v){const b=d.context,S=b.gl;S.enable(S.SCISSOR_TEST),S.scissor(i*s.q.devicePixelRatio,l*s.q.devicePixelRatio,f*s.q.devicePixelRatio,_*s.q.devicePixelRatio),b.clear({color:v}),S.disable(S.SCISSOR_TEST)}const iw=s.ec([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:nw}=iw;function eu(d,i,l,f){d.emplaceBack(i,l,f)}class qu{constructor(i){this.vertexArray=new s.eg,this.indices=new s.a_,eu(this.vertexArray,-1,-1,1),eu(this.vertexArray,1,-1,1),eu(this.vertexArray,-1,1,1),eu(this.vertexArray,1,1,1),eu(this.vertexArray,-1,-1,-1),eu(this.vertexArray,1,-1,-1),eu(this.vertexArray,-1,1,-1),eu(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=i.createVertexBuffer(this.vertexArray,nw),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=s.bd.simpleSegment(0,0,36,12)}}function ol(d,i,l,f,_,v){const b=d.context.gl,S=i.paint.get("sky-atmosphere-color"),C=i.paint.get("sky-atmosphere-halo-color"),k=i.paint.get("sky-atmosphere-sun-intensity"),R=((F,z,N,G,U)=>({u_matrix_3f:F,u_sun_direction:z,u_sun_intensity:N,u_color_tint_r:[G.r,G.g,G.b,G.a],u_color_tint_m:[U.r,U.g,U.b,U.a],u_luminance:5e-5}))(s.ei(s.dJ(),f),_,k,S.toPremultipliedRenderColor(null),C.toPremultipliedRenderColor(null));b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+v,i.skyboxTexture,0),l.draw(d,b.TRIANGLES,Yt.disabled,Cr.disabled,Br.unblended,vr.frontCW,R,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const zt=s.ec([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class qt{constructor(i){const l=new s.ej;l.emplaceBack(-1,1,1,0,0),l.emplaceBack(1,1,1,1,0),l.emplaceBack(1,-1,1,1,1),l.emplaceBack(-1,-1,1,0,1);const f=new s.a_;f.emplaceBack(0,1,2),f.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(l,zt.members),this.indexBuffer=i.createIndexBuffer(f),this.segments=s.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const od=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Ln{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Ue{constructor(i){this.colorModeAlphaBlendedWriteRGB=new Br([1,Fu,1,Fu],s.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Br([1,0,1,0],s.am.transparent,[!1,!1,!1,!0]),this.params=new Ln,this.updateNeeded=!0,i.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),i.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(i){const l=i.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new qt(l);const f=this.params.sizeRange,_=this.params.intensityRange,v=function(R){const F=s.el(30),z=[];for(let N=0;N<R;++N){const G=2*Math.PI*F(),U=Math.acos(1-2*F())-.5*Math.PI;z.push(s.d2(Math.cos(U)*Math.cos(G),Math.cos(U)*Math.sin(G),Math.sin(U)))}return z}(this.params.starsCount),b=s.el(300),S=new s.ek,C=new s.a_;let k=0;for(let R=0;R<v.length;++R){const F=s.c1([],v[R],200),z=Math.max(0,1+.01*f*(1*b()-.5)),N=Math.max(0,1+.01*_*(1*b()-.5));S.emplaceBack(F[0],F[1],F[2],-1,-1,z,N),S.emplaceBack(F[0],F[1],F[2],1,-1,z,N),S.emplaceBack(F[0],F[1],F[2],1,1,z,N),S.emplaceBack(F[0],F[1],F[2],-1,1,z,N),
vendor: 5,629 bytes, line 2812
2812C.emplaceBack(k+0,k+1,k+2),C.emplaceBack(k+0,k+2,k+3),k+=4}this.starsVx=l.createVertexBuffer(S,od.members),this.starsIdx=l.createIndexBuffer(C),this.starsSegments=s.bd.simpleSegment(0,0,S.length,C.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(i,l){const f=i.context,_=f.gl,v=i.transform,b=new Yt(_.LEQUAL,Yt.ReadOnly,[0,1]),S=s.ah(v.zoom),C=i.style.getLut(l.scope),k=l.properties.get("color-use-theme")==="none",R=l.properties.get("color").toNonPremultipliedRenderColor(k?null:C).toArray01(),F=l.properties.get("high-color-use-theme")==="none",z=l.properties.get("high-color").toNonPremultipliedRenderColor(F?null:C).toArray01(),N=l.properties.get("space-color-use-theme")==="none",G=l.properties.get("space-color").toNonPremultipliedRenderColor(N?null:C).toArray01(),U=5e-4,W=s.em(l.properties.get("horizon-blend"),0,1,U,.25),Z=s.dy(i,f,v)&&W===U?v.worldSize/(2*Math.PI*1.025)-1:v.globeRadius,re=i.frameCounter/1e3%1,se=s.ae(v.globeCenterInViewSpace),le=Math.sqrt(Math.pow(se,2)-Math.pow(Z,2)),fe=Math.acos(le/se),we=Se=>{const me=v.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Se&&me.push("ALPHA_PASS");const ge=i.getOrCreateProgram("globeAtmosphere",{defines:me}),ye=((Me,ct,Qe,ft,Rt,We,Pe,nt,Ke,vt,xt,Et)=>({u_frustum_tl:Me,u_frustum_tr:ct,u_frustum_br:Qe,u_frustum_bl:ft,u_horizon:Rt,u_transition:We,u_fadeout_range:Pe,u_color:nt,u_high_color:Ke,u_space_color:vt,u_temporal_offset:xt,u_horizon_angle:Et}))(v.frustumCorners.TL,v.frustumCorners.TR,v.frustumCorners.BR,v.frustumCorners.BL,v.frustumCorners.horizon,S,W,R,z,G,re,fe);i.uploadCommonUniforms(f,ge);const Ze=this.atmosphereBuffer;Ze&&ge.draw(i,_.TRIANGLES,b,Cr.disabled,Se?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,vr.backCW,ye,Se?"atmosphere_glow_alpha":"atmosphere_glow",Ze.vertexBuffer,Ze.indexBuffer,Ze.segments)};we(!1),we(!0)}drawStars(i,l){const f=s.ay(l.properties.get("star-intensity"),0,1);if(f===0)return;const _=i.context,v=_.gl,b=i.transform,S=i.getOrCreateProgram("stars"),C=s.c3([]);s.c5(C,C,-b._pitch),s.c4(C,C,-b.angle),s.c5(C,C,s.al(b._center.lat)),s.en(C,C,-s.al(b._center.lng));const k=s.c8(new Float32Array(16),C),R=s.az([],b.starsProjMatrix,k),F=s.ei([],k),z=s.eo([],F),N=[0,1,0];s.dL(N,N,z),s.c1(N,N,this.params.sizeMultiplier);const G=[1,0,0];s.dL(G,G,z),s.c1(G,G,this.params.sizeMultiplier);const U=(W=N,Z=G,re=f,{u_matrix:Float32Array.from(R),u_up:W,u_right:Z,u_intensity_multiplier:re});var W,Z,re;i.uploadCommonUniforms(_,S),this.starsVx&&this.starsIdx&&S.draw(i,v.TRIANGLES,Yt.disabled,Cr.disabled,this.colorModeAlphaBlendedWriteRGB,vr.disabled,U,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class ow{constructor(){this.visibleTiles=[]}updateBorders(i,l){const f=[],_=[],v=i._getRenderableCoordinates(!1,!0);for(const C of v){const k=i.getTile(C);if(!k.hasData())continue;const R=k.getBucket(l);R&&(R.isEmpty()||(f.push(C.key),_.push({bucket:R,tileID:C.canonical})))}let b=f.length!==this.visibleTiles.length;if(!b){f.sort();for(let C=0;C<f.length;C++)if(f[C]!==this.visibleTiles[C]){b=!0;break}}if(!b)return;const S=new Set;this.visibleTiles=f,_.sort((C,k)=>C.tileID.z-k.tileID.z||C.tileID.x-k.tileID.x||C.tileID.y-k.tileID.y);for(const C of _){const k=new Array,R=new Array,F=C.bucket;for(const z of F.featuresOnBorder)S.has(z.featureId)?R.push(z.footprintIndex):(S.add(z.featureId),k.push(z.footprintIndex));F.updateFootprintHiddenFlags(k,s.ep,!1),F.updateFootprintHiddenFlags(R,s.ep,!0)}}}function jf(d,i){const l=[...d],f=i.cameraWorldSizeForFog/i.worldSize,_=s.bx([]);return s.cP(_,_,[f,f,1]),s.az(l,_,l),s.az(l,i.worldToFogMatrix,l),l}function Gf(d,i,l,f,_){const v=l.material,b=f.context,{baseColorTexture:S,metallicRoughnessTexture:C}=v.pbrMetallicRoughness,{normalTexture:k,occlusionTexture:R,emissionTexture:F}=v;function z(G,U,W){if(G&&(d.push(U),b.activeTexture.set(b.gl.TEXTURE0+W),G.gfxTexture)){const{minFilter:Z,magFilter:re,wrapS:se,wrapT:le}=G.sampler;G.gfxTexture.bindExtraParam(Z,re,se,le)}}z(S,"HAS_TEXTURE_u_baseColorTexture",fs.BaseColor),z(C,"HAS_TEXTURE_u_metallicRoughnessTexture",fs.MetallicRoughness),z(k,"HAS_TEXTURE_u_normalTexture",fs.Normal),z(R,"HAS_TEXTURE_u_occlusionTexture",fs.Occlusion),z(F,"HAS_TEXTURE_u_emissionTexture",fs.Emission),_&&(_.texture||(_.texture=new s.et(f.context,_.image,[_.image.height,_.image.height,_.image.height],b.gl.RGBA8)),b.activeTexture.set(b.gl.TEXTURE0+fs.LUT),_.texture&&_.texture.bind(b.gl.LINEAR,b.gl.CLAMP_TO_EDGE),d.push("APPLY_LUT_ON_GPU")),l.texcoordBuffer&&(d.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(l.texcoordBuffer)),l.colorBuffer&&(d.push(l.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(l.colorBuffer)),l.normalBuffer&&(d.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(l.normalBuffer)),l.pbrBuffer&&(d.push("HAS_ATTRIBUTE_a_pbr"),d.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(l.pbrBuffer)),v.alphaMode!=="OPAQUE"&&v.alphaMode!=="MASK"||d.push("UNPREMULT_TEXTURE_IN_SHADER"),v.defined||d.push("DIFFUSE_SHADED");const N=f.shadowRenderer;N&&(d.push("RENDER_SHADOWS","DEPTH_TEXTURE"),N.useNormalOffset&&d.push("NORMAL_OFFSET"))}function sd(d,i,l,f,_,v){const b=l.paint.get("model-opacity").constantOr(1),S=i.context,C=new Yt(i.context.gl.LEQUAL,Yt.ReadWrite,i.depthRangeFor3D),k=i.transform,R=d.mesh,F=R.material,z=F.pbrMetallicRoughness,N=i.style.fog;let G;G=i.transform.projection.zAxisUnit==="pixels"?[...d.nodeModelMatrix]:s.az([],f.zScaleMatrix,d.nodeModelMatrix),s.az(G,f.negCameraPosMatrix,G);const U=s.bi([],G);s.ea(U,U);
2812const W=l.paint.get("model-color-use-theme").constantOr("default")==="none",Z=l.paint.get("model-emissive-strength").constantOr(0),re=n0(new Float32Array(d.worldViewProjection),new Float32Array(G),new Float32Array(U),null,i,b,z.baseColorFactor,F.emissiveFactor,z.metallicFactor,z.roughnessFactor,F,Z,l),se={defines:[]},le=[],fe=i.shadowRenderer;fe&&(fe.useNormalOffset=!1),Gf(se.defines,le,R,i,W?null:l.lut);let we=null;if(N){const ge=jf(d.nodeModelMatrix,i.transform);if(we=new Float32Array(ge),k.projection.name!=="globe"){const ye=R.aabb.min,Ze=R.aabb.max,[Me,ct]=N.getOpacityForBounds(ge,ye[0],ye[1],Ze[0],Ze[1]);se.overrideFog=Me>=Ge||ct>=Ge}}const Se=Rl(i,l.paint.get("model-cutoff-fade-range"));Se.shouldRenderCutoff&&se.defines.push("RENDER_CUTOFF");const me=i.getOrCreateProgram("model",se);i.uploadCommonUniforms(S,me,null,we,Se),i.renderPass!=="shadow"&&fe&&fe.setupShadowsFromMatrix(d.nodeModelMatrix,me),me.draw(i,S.gl.TRIANGLES,C,_,v,R.material.doubleSided?vr.disabled:vr.backCCW,re,l.id,R.vertexBuffer,R.indexBuffer,R.segments,l.paint,i.transform.zoom,void 0,le)}function m0(d,i,l,f,_,v,b){let S;S=d.projection.name==="globe"?s.er(l,d):[...l],s.az(S,S,i.matrix);const C=s.az([],f,S);if(i.meshes)for(const k of i.meshes){if(k.material.alphaMode!=="BLEND"){b.push({mesh:k,depth:0,modelIndex:_,worldViewProjection:C,nodeModelMatrix:S});continue}const R=s.ad([],k.centroid,C);!d.isOrthographic&&R[2]<=0||v.push({mesh:k,depth:R[2],modelIndex:_,worldViewProjection:C,nodeModelMatrix:S})}if(i.children)for(const k of i.children)m0(d,k,l,f,_,v,b)}function Ym(d,i,l,f){const _=l.shadowRenderer;if(!_)return;const v=_.getShadowPassDepthMode(),b=_.getShadowPassColorMode(),S=_.calculateShadowPassMatrixFromMatrix(i),C=Kb(S);l.getOrCreateProgram("modelDepth",{defines:l._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(l,l.context.gl.TRIANGLES,v,Cr.disabled,b,vr.backCCW,C,f.id,d.vertexBuffer,d.indexBuffer,d.segments,f.paint,l.transform.zoom,void 0,void 0)}function ad(d,i,l){const f=i.updateZoomBasedPaintProperties(),_=function(v,b,S){let C,k,R,F=v.terrain?v.terrain.exaggeration():0;if(v.terrain&&F>0){const z=v.terrain,N=z.findDEMTileFor(S);N&&N.dem?C=s.eu.create(z,S,N):F=0}if(F===0&&(b.terrainElevationMin=0,b.terrainElevationMax=0),F===b.validForExaggeration&&(F===0||C&&C._demTile&&C._demTile.tileID===b.validForDEMTile.id&&C._dem._timestamp===b.validForDEMTile.timestamp))return!1;for(const z in b.instancesPerModel){const N=b.instancesPerModel[z];for(let G=0;G<N.instancedDataArray.length;++G){const U=(C?F*C.getElevationAt(0|N.instancedDataArray.float32[16*G],0|N.instancedDataArray.float32[16*G+1],!0,!0):0)+N.instancesEvaluatedElevation[G];N.instancedDataArray.float32[16*G+6]=U,k=k?Math.min(b.terrainElevationMin,U):U,R=R?Math.max(b.terrainElevationMax,U):U}}return b.terrainElevationMin=k||0,b.terrainElevationMax=R||0,b.validForExaggeration=F,b.validForDEMTile=C&&C._demTile?{id:C._demTile.tileID,timestamp:C._dem._timestamp}:{id:void 0,timestamp:0},!0}(d,i,l);(f||_)&&(i.uploaded=!1,i.upload(d.context))}const zl={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d6([0,0,0],[s.aj,s.aj,0])};function NI(d,i){const l=1<<d.canonical.z,f=i.getFreeCameraOptions().position,_=i.elevation,v=d.canonical.x/l,b=(d.canonical.x+1)/l,S=d.canonical.y/l,C=(d.canonical.y+1)/l;let k=i._centerAltitude;if(_){const N=_.getMinMaxForTile(d);N&&N.max>k&&(k=N.max)}const R=s.ay(f.x,v,b)-f.x,F=s.ay(f.y,S,C)-f.y,z=s.cb(k,i.center.lat)-f.z;return i._zoomFromMercatorZ(Math.sqrt(R*R+F*F+z*z))}function g0(d,i,l,f,_,v,b){const S=d.context,C=d.renderPass==="shadow",k=d.shadowRenderer,R=C&&k?k.getShadowPassDepthMode():new Yt(S.gl.LEQUAL,Yt.ReadWrite,d.depthRangeFor3D),F=d.isTileAffectedByFog(v);if(l.meshes)for(const z of l.meshes){const N=["MODEL_POSITION_ON_GPU"],G=[];let U,W,Z;f.instancedDataArray.length>20&&N.push("INSTANCED_ARRAYS");const re=Rl(d,i.paint.get("model-cutoff-fade-range"));if(re.shouldRenderCutoff&&N.push("RENDER_CUTOFF"),C&&k)U=d.getOrCreateProgram("modelDepth",{defines:N}),W=Kb(b.shadowTileMatrix,b.shadowTileMatrix,Float32Array.from(l.matrix)),Z=k.getShadowPassColorMode();
2812else{Gf(N,G,z,d,i.paint.get("model-color-use-theme").constantOr("default")==="none"?null:i.lut),U=d.getOrCreateProgram("model",{defines:N,overrideFog:F});const le=z.material,fe=le.pbrMetallicRoughness,we=i.paint.get("model-opacity").constantOr(1),Se=i.paint.get("model-emissive-strength").constantOr(0);W=n0(v.expandedProjMatrix,Float32Array.from(l.matrix),new Float32Array(16),null,d,we,fe.baseColorFactor,le.emissiveFactor,fe.metallicFactor,fe.roughnessFactor,le,Se,i,_),k&&(b.shadowUniformsInitialized?U.setShadowUniformValues(S,k.getShadowUniformValues()):(k.setupShadows(v.toUnwrapped(),U,"model-tile"),b.shadowUniformsInitialized=!0)),Z=re.shouldRenderCutoff||we<1||le.alphaMode!=="OPAQUE"?Br.alphaBlended:Br.unblended}d.uploadCommonUniforms(S,U,v.toUnwrapped(),null,re);const se=z.material.doubleSided?vr.disabled:vr.backCCW;if(f.instancedDataArray.length>20)G.push(f.instancedDataBuffer),U.draw(d,S.gl.TRIANGLES,R,Cr.disabled,Z,se,W,i.id,z.vertexBuffer,z.indexBuffer,z.segments,i.paint,d.transform.zoom,void 0,G,f.instancedDataArray.length);else{const le=C?"u_instance":"u_normal_matrix";for(let fe=0;fe<f.instancedDataArray.length;++fe)W[le]=new Float32Array(f.instancedDataArray.arrayBuffer,64*fe,16),U.draw(d,S.gl.TRIANGLES,R,Cr.disabled,Z,se,W,i.id,z.vertexBuffer,z.indexBuffer,z.segments,i.paint,d.transform.zoom,void 0,G)}}if(l.children)for(const z of l.children)g0(d,i,z,f,_,v,b)}const Km=[1,-1,1];function _0(d,i,l,f){if(!l.modelManager)return!0;const _=l.modelManager;if(!l.shadowRenderer)return!0;const v=l.shadowRenderer,b=i.aabb;let S=!0,C=d.maxHeight;if(C===0){let R=0;for(const F in d.instancesPerModel){const z=_.getModel(F,f);z?R=Math.max(R,Math.max(Math.max(z.aabb.max[0],z.aabb.max[1]),z.aabb.max[2])):S=!1}C=d.maxScale*R*1.41+d.maxVerticalOffset,S&&(d.maxHeight=C)}b.max[2]=C,b.min[2]+=d.terrainElevationMin,b.max[2]+=d.terrainElevationMax,s.ad(b.min,b.min,i.tileMatrix),s.ad(b.max,b.max,i.tileMatrix);const k=b.intersects(v.getCurrentCascadeFrustum());return l.currentShadowCascade===0&&(d.isInsideFirstShadowMapFrustum=k===2),k===0}function sw(d,i){const l=d.uniformValues.u_cutoff_params[0],f=d.uniformValues.u_cutoff_params[1],_=d.uniformValues.u_cutoff_params[2],v=d.uniformValues.u_cutoff_params[3];return f===l||v===_?1:s.ay(((i-l)/(f-l)-_)/(v-_),0,1)}function aw(d,i,l,f){if(i.pitch<20)return 1;const _=i.getWorldToCameraMatrix();s.az(_,_,d);const v=s.bR(l.min[0],l.min[1],l.min[2],1);let b=s.aA(s.ev(),v,_),S=b,C=b;v[1]=l.max[1],b=s.aA(s.ev(),v,_),S=b[1]<S[1]?b:S,C=b[1]>C[1]?b:C,v[0]=l.max[0],b=s.aA(s.ev(),v,_),S=b[1]<S[1]?b:S,C=b[1]>C[1]?b:C,v[1]=l.min[1],b=s.aA(s.ev(),v,_),S=b[1]<S[1]?b:S,C=b[1]>C[1]?b:C;const k=s.ay(f[0],0,1),R=100*i.pixelsPerMeter*s.ay(f[1],0,1),F=s.ay(f[2],0,1),z=s.ew(s.ev(),S,C,k),N=Math.tan(.5*i.fovX),G=-z[2]*N;if(R===0)return z[1]<-Math.abs(G)?F:1;const U=(-Math.abs(G)-z[1])/R,W=(re,se,le)=>(1-le)*re+le*se,Z=s.ay(W(1,F,U),F,1);return W(1,Z,s.ay((i.pitch-20)/20,0,1))}class Jm{}class $f{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(i,l,f){{const F=this._storage.get(l.id);if(F)return F.lastUsedFrameIdx=i,F.buf}const _=f.gl,v=_.getBufferParameter(_.ELEMENT_ARRAY_BUFFER,_.BUFFER_SIZE),b=new ArrayBuffer(v),S=new Int16Array(b);_.getBufferSubData(_.ELEMENT_ARRAY_BUFFER,0,new Int16Array(b));const C=new s.ey;for(let F=0;F<v/2;F+=3){const z=S[F],N=S[F+1],G=S[F+2];C.emplaceBack(z,N),C.emplaceBack(N,G),C.emplaceBack(G,z)}const k=f.bindVertexArrayOES.current,R=new Jm;return R.buf=new Yc(f,C),R.lastUsedFrameIdx=i,this._storage.set(l.id,R),f.bindVertexArrayOES.set(k),R.buf}update(i){for(const[l,f]of this._storage)i-f.lastUsedFrameIdx>30&&(f.buf.destroy(),this._storage.delete(l))}destroy(){for(const[i,l]of this._storage)l.buf.destroy(),this._storage.delete(i)}}class ld{constructor(i){this.occluderSize=30,this.depthOffset=-1e-4,i.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),i.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const lw=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class BI{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Qo{constructor(i,l){this.revealStart=11,this.revealRange=2,i.registerParameter(this,[...l,"Reveal"],"revealStart",{min:0,max:17,step:.05}
2812),i.registerParameter(this,[...l,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const VI=s.ec([{type:"Float32",name:"a_pos_2f",components:2}]);class Hf{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(i,l){const f=i.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const b=new s.ez,S=new s.a_;b.emplaceBack(-1,-1),b.emplaceBack(1,-1),b.emplaceBack(1,1),b.emplaceBack(-1,1),S.emplaceBack(0,1,2),S.emplaceBack(0,2,3),this.vignetteVx=i.context.createVertexBuffer(b,VI.members),this.vignetteIdx=i.context.createIndexBuffer(S)}const _=s.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){i.uploadCommonUniforms(i.context,f);const b={u_vignetteShape:(v={vignetteShape:[l.start,l.range,Math.pow(10,l.fadePower)],vignetteColor:[l.color.r,l.color.g,l.color.b,l.color.a*l.strength]}).vignetteShape,u_vignetteColor:v.vignetteColor};f.draw(i,i.context.gl.TRIANGLES,Yt.disabled,Cr.disabled,Br.alphaBlended,vr.disabled,b,"vignette",this.vignetteVx,this.vignetteIdx,_)}var v}}class dn{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(i,l){const f=i.getFreeCameraOptions().position,_=f.toAltitude(),v=f.toLngLat(),b=s.al(v.lng),S=s.al(v.lat),C=i.pixelsPerMeter/l,k=b*s.eB,R=s.eB*Math.log(Math.tan(Math.PI/4+S/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const F=-this._offsetYPrev+R,z=-this._elevationPrev+_;this._accumulatedOffsetX+=(-this._offsetXPrev+k)*C,this._accumulatedOffsetY+=F*C,this._accumulatedElevation+=z*C,this._offsetXPrev=k,this._offsetYPrev=R,this._elevationPrev=_}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function si(d,i){return[-(d[0]-Math.floor(d[0]/i)*i),-(d[1]-Math.floor(d[1]/i)*i),-(d[2]-Math.floor(d[2]/i)*i)]}function y0(d){const i=s.el(1323123451230),l=[];for(let f=0;f<d;++f){const _=2*i()-1,v=2*i()-1,b=2*i()-1;l.push(s.d2(_,v,b))}return l}function Ps(d,i,l,f,_){const v=s.ay((_-l)/(f-l),0,1);return(1-v)*d+v*i}class cd{constructor(i){this._movement=new dn,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Hf,this._ppmScaleFactor=i}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(i,l){const f=i.transform;this._movement.update(f,this._ppmScaleFactor);const _=f.starsProjMatrix,v=s.c3([]);s.c5(v,v,s.al(90)-f._pitch),s.c4(v,v,-f.angle);const b=s.c8(new Float32Array(16),v),S=s.eA(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),C=s.ea([],S),k=s.az([],C,b),R=Date.now()/1e3;return this._accumulatedTimeFromStart+=(R-this._prevTime)*l,this._prevTime=R,{projectionMatrix:_,modelviewMatrix:k}}}class ud extends cd{constructor(i){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new Qo(i.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(i){const l=i.context;if(!this.particlesVx){const f=y0(this.particlesCount),_=new s.eC,v=new s.a_;let b=0;const S=s.el(1323123451230);for(let C=0;C<f.length;++C){const k=f[C],R=[2*S()-1,S(),S(),S()];_.emplaceBack(k[0],k[1],k[2],-1,-1,...R),_.emplaceBack(k[0],k[1],k[2],1,-1,...R),_.emplaceBack(k[0],k[1],k[2],1,1,...R),_.emplaceBack(k[0],k[1],k[2],-1,1,...R),v.emplaceBack(b+0,b+1,b+2),v.emplaceBack(b+0,b+2,b+3),b+=4}this.particlesVx=l.createVertexBuffer(_,lw.members),this.particlesIdx=l.createIndexBuffer(v)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.rain)return;const l=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},f=i.transform.zoom;if(l.revealStart>f)return;const _=Ps(0,1,l.revealStart,l.revealStart+l.revealRange,f);if(!this.particlesVx||!this.particlesIdx)return;const v=structuredClone(this._params);let b=[-v.direction.x,v.direction.y,-100];s.au(b,b);
2812const S=structuredClone(this._vignetteParams);S.strength*=_,v.overrideStyleParameters||(v.intensity=i.style.rain.state.density,v.timeFactor=i.style.rain.state.intensity,v.color=structuredClone(i.style.rain.state.color),b=structuredClone(i.style.rain.state.direction),v.screenThinning.intensity=i.style.rain.state.centerThinning,v.dropletSizeX=i.style.rain.state.dropletSize[0],v.dropletSizeYScale=i.style.rain.state.dropletSize[1]/i.style.rain.state.dropletSize[0],v.distortionStrength=100*i.style.rain.state.distortionStrength,S.strength=1,S.color=structuredClone(i.style.rain.state.vignetteColor));const C=this.updateOnRender(i,v.timeFactor),k=i.context,R=k.gl,F=i.transform;this.screenTexture&&this.screenTexture.size[0]===i.width&&this.screenTexture.size[1]===i.height||(this.screenTexture=new s.T(k,{width:i.width,height:i.height,data:null},R.RGBA8)),v.distortionStrength>0&&(k.activeTexture.set(R.TEXTURE0),this.screenTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),R.copyTexSubImage2D(R.TEXTURE_2D,0,0,0,0,0,i.width,i.height));const z=i.getOrCreateProgram("rainParticle");i.uploadCommonUniforms(k,z),k.activeTexture.set(R.TEXTURE0),this.screenTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const N=[v.color.r,v.color.g,v.color.b,v.color.a],G=(U,W)=>{const Z=si(this._movement.getPosition(),U),re=v.dropletSizeX,se=v.dropletSizeX*v.dropletSizeYScale,le=i.width/2,fe=i.height/2,we=Ps(0,v.screenThinning.start,0,1,v.screenThinning.intensity),Se=Ps(.001,v.screenThinning.range,0,1,v.screenThinning.intensity),me=Ps(0,v.screenThinning.particleOffset,0,1,v.screenThinning.intensity),ge=(ye={modelview:C.modelviewMatrix,projection:C.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Z,velocityConeAperture:v.velocityConeAperture,velocity:v.velocity,boxSize:U,rainDropletSize:[re,se],distortionStrength:v.distortionStrength,rainDirection:b,color:N,screenSize:[F.width,F.height],thinningCenterPos:[le,fe],thinningShape:[we,Se,Math.pow(10,v.screenThinning.fadePower)],thinningAffectedRatio:v.screenThinning.affectedRatio,thinningParticleOffset:me,shapeDirectionalPower:v.shapeDirPower,shapeNormalPower:v.shapeNormalPower,mode:W?0:1},{u_modelview:Float32Array.from(ye.modelview),u_projection:Float32Array.from(ye.projection),u_time:ye.time,u_cam_pos:ye.camPos,u_texScreen:0,u_velocityConeAperture:ye.velocityConeAperture,u_velocity:ye.velocity,u_boxSize:ye.boxSize,u_rainDropletSize:ye.rainDropletSize,u_distortionStrength:ye.distortionStrength,u_rainDirection:ye.rainDirection,u_color:ye.color,u_screenSize:ye.screenSize,u_thinningCenterPos:ye.thinningCenterPos,u_thinningShape:ye.thinningShape,u_thinningAffectedRatio:ye.thinningAffectedRatio,u_thinningParticleOffset:ye.thinningParticleOffset,u_shapeDirectionalPower:ye.shapeDirectionalPower,u_shapeNormalPower:ye.shapeNormalPower,u_mode:ye.mode});var ye;const Ze=Math.round(v.intensity*this.particlesCount),Me=s.bd.simpleSegment(0,0,4*Ze,2*Ze);z.draw(i,R.TRIANGLES,Yt.disabled,Cr.disabled,Br.alphaBlended,vr.disabled,ge,"rain_particles",this.particlesVx,this.particlesIdx,Me)};v.distortionStrength>0&&G(v.boxSize,!0),G(v.boxSize,!1),this._vignette.draw(i,S)}}const Zu=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class v0 extends cd{constructor(i){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Qo(i.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(i){const l=i.context;if(!this.particlesVx){const f=y0(this.particlesCount),_=new s.eD,v=new s.a_;let b=0;const S=s.el(1323123451230);for(let C=0;C<f.length;++C){const k=f[C],R=S(),F=S(),z=S(),N=[C/f.length,R,F,z],G=[S(),S()];_.emplaceBack(k[0],k[1],k[2],-1,-1,...N,...G),_.emplaceBack(k[0],k[1],k[2],1,-1,...N,...G),_.emplaceBack(k[0],k[1],k[2],1,1,...N,...G),_.emplaceBack(k[0],k[1],k[2],-1,1,...N,...G),v.emplaceBack(b+0,b+1,b+2),v.emplaceBack(b+0,b+2,b+3),b+=4}this.particlesVx=l.createVertexBuffer(_,Zu.members),this.particlesIdx=l.createIndexBuffer(v)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.snow)return;const l=structuredClone(this._params);let f=[-l.direction.x,l.direction.y,-100];s.au(f,f);
2812const _=structuredClone(this._vignetteParams),v=l.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},b=i.transform.zoom;if(v.revealStart>b)return;const S=Ps(0,1,v.revealStart,v.revealStart+v.revealRange,b);_.strength*=S,l.overrideStyleParameters||(l.intensity=i.style.snow.state.density,l.timeFactor=i.style.snow.state.intensity,l.color=structuredClone(i.style.snow.state.color),f=structuredClone(i.style.snow.state.direction),l.screenThinning.intensity=i.style.snow.state.centerThinning,l.billboardSize=2.79*i.style.snow.state.flakeSize,_.strength=1,_.color=structuredClone(i.style.snow.state.vignetteColor));const C=this.updateOnRender(i,l.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const k=i.context,R=k.gl,F=i.transform,z=i.getOrCreateProgram("snowParticle");i.uploadCommonUniforms(k,z),((N,G,U)=>{const W=si(this._movement.getPosition(),N),Z=F.width/2,re=F.height/2,se=Ps(0,U.screenThinning.start,0,1,U.screenThinning.intensity),le=Ps(.001,U.screenThinning.range,0,1,U.screenThinning.intensity),fe=Ps(0,U.screenThinning.particleOffset,0,1,U.screenThinning.intensity),we=(Se={modelview:C.modelviewMatrix,projection:C.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:W,velocityConeAperture:U.velocityConeAperture,velocity:U.velocity,horizontalOscillationRadius:U.horizontalOscillationRadius,horizontalOscillationRate:U.horizontalOscillationRate,boxSize:N,billboardSize:1*U.billboardSize,simpleShapeParameters:[U.shapeFadeStart,U.shapeFadePower],screenSize:[F.width,F.height],thinningCenterPos:[Z,re],thinningShape:[se,le,Math.pow(10,U.screenThinning.fadePower)],thinningAffectedRatio:U.screenThinning.affectedRatio,thinningParticleOffset:fe,color:[U.color.r,U.color.g,U.color.b,U.color.a],direction:f},{u_modelview:Float32Array.from(Se.modelview),u_projection:Float32Array.from(Se.projection),u_time:Se.time,u_cam_pos:Se.camPos,u_velocityConeAperture:Se.velocityConeAperture,u_velocity:Se.velocity,u_horizontalOscillationRadius:Se.horizontalOscillationRadius,u_horizontalOscillationRate:Se.horizontalOscillationRate,u_boxSize:Se.boxSize,u_billboardSize:Se.billboardSize,u_simpleShapeParameters:Se.simpleShapeParameters,u_screenSize:Se.screenSize,u_thinningCenterPos:Se.thinningCenterPos,u_thinningShape:Se.thinningShape,u_thinningAffectedRatio:Se.thinningAffectedRatio,u_thinningParticleOffset:Se.thinningParticleOffset,u_particleColor:Se.color,u_direction:Se.direction});var Se;const me=Math.round(U.intensity*this.particlesCount),ge=s.bd.simpleSegment(0,0,4*me,2*me);this.particlesVx&&this.particlesIdx&&z.draw(i,R.TRIANGLES,Yt.disabled,Cr.disabled,Br.alphaBlended,vr.disabled,we,"snow_particles",this.particlesVx,this.particlesIdx,ge)})(l.boxSize,0,l),this._vignette.draw(i,_)}}const x0={symbol:function(d,i,l,f,_){if(d.renderPass!=="translucent")return;const v=Cr.disabled,b=d.colorModeForRenderPass(),S=l.layout.get("text-variable-anchor"),C=l.layout.get("text-size-scale-range"),k=s.ay(d.scaleFactor,C[0],C[1]);S&&function(z,N,G,U,W,Z,re,se){const le=N.transform,fe=W==="map",we=Z==="map";for(const Se of z){const me=U.getTile(Se),ge=me.getBucket(G);if(!ge||!ge.text||!ge.text.segments.get().length)continue;const ye=s.bH(ge.textSizeData,le.zoom,se),Ze=fm(Se,ge.getProjection(),le),Me=le.calculatePixelsToTileUnitsMatrix(me),ct=bf(Ze,me.tileID.canonical,we,fe,le,ge.getProjection(),Me),Qe=ge.hasIconTextFit()&&ge.hasIconData();ye&&Qb(ge,fe,we,re,le,ct,Se,Math.pow(2,le.zoom-me.tileID.overscaledZ),ye,Qe)}}(f,d,l,i,l.layout.get("text-rotation-alignment"),l.layout.get("text-pitch-alignment"),_,k);const R=l.paint.get("icon-opacity").constantOr(1)!==0,F=l.paint.get("text-opacity").constantOr(1)!==0;l.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(R||F)?c0(d,i,l,f,v,b):(R&&c0(d,i,l,f,v,b,{onlyIcons:!0}),F&&c0(d,i,l,f,v,b,{onlyText:!0})),i.map.showCollisionBoxes&&(a0(d,i,l,f,l.paint.get("text-translate"),l.paint.get("text-translate-anchor"),!0),a0(d,i,l,f,l.paint.get("icon-translate"),l.paint.get("icon-translate-anchor"),!1))},circle:function(d,i,l,f){if(d.renderPass!=="translucent")return;const _=l.paint.get("circle-opacity"),v=l.paint.get("circle-stroke-width"),b=l.paint.get("circle-stroke-opacity"),S=l.layout.get("
2812circle-sort-key").constantOr(1)!==void 0,C=l.paint.get("circle-emissive-strength");if(_.constantOr(1)===0&&(v.constantOr(1)===0||b.constantOr(1)===0))return;const k=d.context,R=k.gl,F=d.transform,z=!(!d.terrain||!d.terrain.enabled),N=l.layout.get("circle-elevation-reference"),G=d.depthModeForSublayer(0,Yt.ReadOnly),U=new Yt(d.context.gl.LEQUAL,Yt.ReadOnly,d.depthRangeFor3D),W=N==="none"||z?G:U,Z=Cr.disabled,re=d.colorModeForDrapableLayerRenderPass(C),se=F.projection.name==="globe",le=[s.aD(F.center.lng),s.aH(F.center.lat)],fe=[];for(let Se=0;Se<f.length;Se++){const me=f[Se],ge=i.getTile(me),ye=ge.getBucket(l);if(!ye||ye.projection.name!==F.projection.name)continue;const Ze=ye.programConfigurations.get(l.id),Me=ye.layoutVertexBuffer,ct=ye.globeExtVertexBuffer,Qe=ye.indexBuffer,ft=s.dW(l),Rt=[ct],We=d.isTileAffectedByFog(me);se&&ft.push("PROJECTION_GLOBE_VIEW"),ft.push("DEPTH_D24"),d.terrain&&F.depthOcclusionForSymbolsAndCircles&&ft.push("DEPTH_OCCLUSION"),ye.hasElevation&&!d.terrain&&(ft.push("ELEVATED_ROADS"),Rt.push(ye.elevatedLayoutVertexBuffer));const Pe=d.getOrCreateProgram("circle",{config:Ze,defines:ft,overrideFog:We}),nt=F.projection.createInversionMatrix(F,me.canonical),Ke={programConfiguration:Ze,program:Pe,layoutVertexBuffer:Me,dynamicBuffers:Rt,indexBuffer:Qe,uniformValues:s.dX(d,me,ge,nt,le,l),tile:ge};if(S){const vt=ye.segments.get();for(const xt of vt)fe.push({segments:new s.bd([xt]),sortKey:xt.sortKey,state:Ke})}else fe.push({segments:ye.segments,sortKey:0,state:Ke})}S&&fe.sort((Se,me)=>Se.sortKey-me.sortKey);const we={useDepthForOcclusion:F.depthOcclusionForSymbolsAndCircles};for(const Se of fe){const{programConfiguration:me,program:ge,layoutVertexBuffer:ye,dynamicBuffers:Ze,indexBuffer:Me,uniformValues:ct,tile:Qe}=Se.state,ft=Se.segments;d.terrain&&d.terrain.setupElevationDraw(Qe,ge,we),d.uploadCommonUniforms(k,ge,Qe.tileID.toUnwrapped()),ge.draw(d,R.TRIANGLES,W,Z,re,vr.disabled,ct,l.id,ye,Me,ft,l.paint,F.zoom,me,Ze)}},heatmap:function(d,i,l,f){if(l.paint.get("heatmap-opacity")!==0)if(d.renderPass==="offscreen"){const _=d.context,v=_.gl,b=Cr.disabled,S=new Br([v.ONE,v.ONE,v.ONE,v.ONE],s.am.transparent,[!0,!0,!0,!0]);(function(N,G,U,W){const Z=N.gl,re=G.width*W,se=G.height*W;N.activeTexture.set(Z.TEXTURE1),N.viewport.set([0,0,re,se]);let le=U.heatmapFbo;if(!le||le&&(le.width!==re||le.height!==se)){le&&le.destroy();const fe=Z.createTexture();Z.bindTexture(Z.TEXTURE_2D,fe),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_WRAP_S,Z.CLAMP_TO_EDGE),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_WRAP_T,Z.CLAMP_TO_EDGE),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_MIN_FILTER,Z.LINEAR),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_MAG_FILTER,Z.LINEAR),le=U.heatmapFbo=N.createFramebuffer(re,se,!0,null),function(we,Se,me,ge,ye,Ze){const Me=we.gl;Me.texImage2D(Me.TEXTURE_2D,0,we.extRenderToTextureHalfFloat?Me.RGBA16F:Me.RGBA,ye,Ze,0,Me.RGBA,we.extRenderToTextureHalfFloat?Me.HALF_FLOAT:Me.UNSIGNED_BYTE,null),ge.colorAttachment.set(me)}(N,0,fe,le,re,se)}else Z.bindTexture(Z.TEXTURE_2D,le.colorAttachment.get()),N.bindFramebuffer.set(le.framebuffer)})(_,d,l,d.transform.projection.name==="globe"?.5:.25),_.clear({color:s.am.transparent});const C=d.transform,k=C.projection.name==="globe",R=k?["PROJECTION_GLOBE_VIEW"]:[],F=k?vr.frontCCW:vr.disabled,z=[s.aD(C.center.lng),s.aH(C.center.lat)];for(let N=0;N<f.length;N++){const G=f[N];if(i.hasRenderableParent(G))continue;const U=i.getTile(G),W=U.getBucket(l);if(!W||W.projection.name!==C.projection.name)continue;const Z=d.isTileAffectedByFog(G),re=W.programConfigurations.get(l.id),se=d.getOrCreateProgram("heatmap",{config:re,defines:R,overrideFog:Z}),{zoom:le}=d.transform;d.terrain&&d.terrain.setupElevationDraw(U,se),d.uploadCommonUniforms(_,se,G.toUnwrapped());const fe=C.projection.createInversionMatrix(C,G.canonical);se.draw(d,v.TRIANGLES,Yt.disabled,b,S,F,Zb(d,G,U,fe,z,le,l.paint.get("heatmap-intensity")),l.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,l.paint,d.transform.zoom,re,k?[W.globeExtVertexBuffer]:null)}_.viewport.set([0,0,d.width,d.height])}else d.renderPass==="translucent"&&(d.context.setColorMode(d.colorModeForRenderPass()),function(_,v){const b=_.context,S=b.gl,C=v.heatmapFbo;if(!C)return;b.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,C.colorAttachment.get()),b.activeTexture.set(S.TEXTURE1);let k=v.colorRampTexture;k||(k=v.colorRampTexture=new s.T(b,v.colorRamp,S.RGBA8)),k.bind(S.LINEAR,S.CLAMP_TO_EDGE),_.getOrCreateProgram("heatmapTexture").draw(_,S.TRIANGLES,Yt.disabled,Cr.disabled,_.colorModeForRenderPass(),vr.disabled,((R,F,z,N)=>({u_image:0,u_color_ramp:1,u_opacity:F.paint.get("heatmap-opacity")}))(0,v),v.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments,v.paint,_.transform.zoom)}(d,l))},line:function(d,i,l,f){if(d.renderPass!=="translucent")return;const _=l.paint.get("line-opacity"),v=l.paint.get("line-width");if(_.constantOr(1)===0||v.constantOr(1)===0)return;const b=l.paint.get("line-emissive-strength"),S=l.paint.get("line-occlusion-opacity"),C=l.layout.get("line-elevation-reference"),k=l.layout.get("line-width-unit")==="meters",R=C==="sea",F=!(!d.terrain||!d.terrain.enabled),z=d.context,N=z.gl;if(l.hasElevatedBuckets&&d.transform.projection.name==="globe")return;const G=l.layout.get("line-cross-slope"),U=G!==void 0,W=G<1,Z=d.colorModeForDrapableLayerRenderPass(b),re=d.terrain&&d.terrain.renderingToTexture,se=re?1:s.q.devicePixelRatio,le=l.paint.get("line-dasharray"),fe=le.constantOr(1),we=l.layout.get("line-cap"),Se=le.constantOr(null),me=we.constantOr(null),ge=l.paint.get("line-pattern"),ye=ge.constantOr(1),Ze=l.paint.get("line-pattern-cross-fade"),Me=ge.constantOr(null),ct=l.paint.get("line-opacity").constantOr(1);let Qe=!ye&&ct!==1||d.depthOcclusion&&S>0&&S<1;
2812const ft=l.paint.get("line-gradient"),Rt=ye?"linePattern":"line",We=s.dY(l);let Pe;if(re&&d.terrain&&d.terrain.clipOrMaskOverlapStencilType()&&(Qe=!1),S!==0&&d.depthOcclusion){const xt=l.paint._values["line-opacity"];xt&&xt.value&&xt.value.kind==="constant"?Pe=xt.value:s.w(`Occlusion opacity for layer ${l.id} is supported only when line-opacity isn't data-driven.`)}v.value.kind!=="constant"&&v.value.isLineProgressConstant===!1&&We.push("VARIABLE_LINE_WIDTH");const nt=(xt,Et,Bt,ir,ur,Zt)=>{for(const ar of xt){const or=i.getTile(ar);if(ye&&!or.patternsLoaded())continue;const Pr=or.getBucket(l);if(!Pr||Pr.elevationType!=="none"&&!ur||Pr.elevationType==="none"&&ur)continue;d.prepareDrawTile();const zr=[...Et],qr=d.shadowRenderer,pi=Pr.elevationType==="road"&&!!qr&&qr.enabled;let kr=[0,0,0];if(pi){const hi=d.style.directionalLight,Ci=d.style.ambientLight;hi&&Ci&&(kr=Nu(d.style,hi,Ci)),zr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const mi=Pr.programConfigurations.get(l.id);let xi=!1;if(Me&&or.imageAtlas){const hi=s.dZ.from(Me),Ci=hi.getPrimary().scaleSelf(se).toString(),Gi=or.imageAtlas.patternPositions.get(Ci),Un=hi.getSecondary(),Nn=Un?or.imageAtlas.patternPositions.get(Un.scaleSelf(se).toString()):null;xi=!!Gi&&!!Nn,Gi&&mi.setConstantPatternPositions(Gi,Nn)}Ze>0&&(xi||mi.getPatternTransitionVertexBuffer("line-pattern"))&&zr.push("LINE_PATTERN_TRANSITION");const Zi=d.isTileAffectedByFog(ar),$r=d.getOrCreateProgram(Rt,{config:mi,defines:zr,overrideFog:Zi});if(!ye&&Se&&me&&or.lineAtlas){const hi=or.lineAtlas.getDash(Se,me);hi&&mi.setConstantPatternPositions(hi)}pi&&qr.setupShadows(or.tileID.toUnwrapped(),$r,"vector-tile");let[gi,vi]=l.paint.get("line-trim-offset");(me==="round"||me==="square")&&gi!==vi&&(gi===0&&(gi-=1),vi===1&&(vi+=1));const Si=re?ar.projMatrix:null,Zr=k?1/Pr.tileToMeter/s.aw(or,1,d.transform.zoom):1,Di=k?1/Pr.tileToMeter/s.aw(or,1,Math.floor(d.transform.zoom)):1,bi=ye?s.d_(d,or,l,Si,se,Zr,Di,[gi,vi],kr,Ze):s.d$(d,or,l,Si,Pr.lineClipsArray.length,se,Zr,Di,[gi,vi],kr);if(ft){const hi=Pr.gradients[l.id];let Ci=hi.texture;if(l.gradientVersion!==hi.version){let Gi=256;if(l.stepInterpolant){const Un=i.getSource().maxzoom,Nn=ar.canonical.z===Un?Math.ceil(1<<d.transform.maxZoom-ar.canonical.z):1;Gi=s.ay(s.e0(Pr.maxLineLength/s.aj*1024*Nn),256,z.maxTextureSize)}hi.gradient=s.e1({expression:l.gradientExpression(),evaluationKey:"lineProgress",resolution:Gi,image:hi.gradient||void 0,clips:Pr.lineClipsArray}),hi.texture?hi.texture.update(hi.gradient):hi.texture=new s.T(z,hi.gradient,N.RGBA8),hi.version=l.gradientVersion,Ci=hi.texture}z.activeTexture.set(N.TEXTURE1),Ci.bind(l.stepInterpolant?N.NEAREST:N.LINEAR,N.CLAMP_TO_EDGE)}fe&&(z.activeTexture.set(N.TEXTURE0),or.lineAtlasTexture&&or.lineAtlasTexture.bind(N.LINEAR,N.REPEAT),mi.updatePaintBuffers()),ye&&(z.activeTexture.set(N.TEXTURE0),or.imageAtlasTexture&&or.imageAtlasTexture.bind(N.LINEAR,N.CLAMP_TO_EDGE),mi.updatePaintBuffers()),ur&&!R&&d.terrain.setupElevationDraw(or,$r),d.uploadCommonUniforms(z,$r,ar.toUnwrapped());const bn=hi=>{Pe!=null&&(Pe.value=ct*S),$r.draw(d,N.TRIANGLES,Bt,hi,Z,vr.disabled,bi,l.id,Pr.layoutVertexBuffer,Pr.indexBuffer,Pr.segments,l.paint,d.transform.zoom,mi,[Pr.layoutVertexBuffer2,Pr.patternVertexBuffer,Pr.zOffsetVertexBuffer]),Pe!=null&&(Pe.value=ct)};if(Qe&&!ur){const hi=d.stencilModeForClipping(ar).ref;hi===0&&re&&z.clear({stencil:0});const Ci={func:N.EQUAL,mask:255};
2812bi.u_alpha_discard_threshold=.8,bn(new Cr(Ci,hi,255,N.KEEP,N.KEEP,N.INVERT)),bi.u_alpha_discard_threshold=0,bn(new Cr(Ci,hi,255,N.KEEP,N.KEEP,N.KEEP))}else bi.u_alpha_discard_threshold=Qe&&ur&&Zt?.8:0,bn(ur?ir:d.stencilModeForClipping(ar))}};let Ke=d.depthModeForSublayer(0,Yt.ReadOnly);const vt=new Yt(d.depthOcclusion?N.GREATER:N.LEQUAL,Yt.ReadOnly,d.depthRangeFor3D);if(l.hasNonElevatedBuckets){const xt=!re&&d.terrain;S!==0&&xt?s.w(`Occlusion opacity for layer ${l.id} is supported on terrain only if the layer has line-z-offset enabled.`):xt?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${l.id}.`):nt(f,We,Ke,Cr.disabled,!1,!0)}if(l.hasElevatedBuckets){C==="hd-road-markup"?F||(Ke=vt,We.push("ELEVATED_ROADS")):(We.push("ELEVATED"),Ke=vt,U&&We.push(W?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),R&&We.push("ELEVATION_REFERENCE_SEA"));const xt=Qe?d.stencilModeFor3D():Cr.disabled;d.forceTerrainMode=!0,nt(f,We,Ke,xt,!0,!0),Qe&&nt(f,We,Ke,xt,!0,!1),d.forceTerrainMode=!1}Qe&&(d.resetStencilClippingMasks(),re&&z.clear({stencil:0})),S===0||d.depthOcclusion||re||d.layersWithOcclusionOpacity.push(d.currentLayer)},fill:function(d,i,l,f){const _=l.paint.get("fill-color"),v=l.paint.get("fill-opacity");if(v.constantOr(1)===0)return;const b=l.paint.get("fill-emissive-strength"),S=d.colorModeForDrapableLayerRenderPass(b),C=l.paint.get("fill-pattern"),k=d.opaquePassEnabledForLayer()&&!C.constantOr(1)&&_.constantOr(s.am.transparent).a===1&&v.constantOr(0)===1?"opaque":"translucent";let R="none";l.layout.get("fill-elevation-reference")!=="none"?R="road":l.paint.get("fill-z-offset").constantOr(1)!==0&&(R="offset");const F=!(!d.terrain||!d.terrain.enabled),z={painter:d,sourceCache:i,layer:l,coords:f,colorMode:S,elevationType:R,terrainEnabled:F,pass:k};if(d.renderPass!=="shadow")if(R!=="offset"){if(Hm(z,!1),R==="road"){const N=!F&&d.renderPass==="translucent";N&&Jt(d,i,l,f,"geometry"),Hm(z,!0,Cr.disabled),N&&function(G){const{painter:U,sourceCache:W,layer:Z,coords:re,colorMode:se}=G,le=U.context.gl,fe=G.painter.shadowRenderer,we=!!fe&&fe.enabled,Se=new Yt(U.context.gl.LEQUAL,Yt.ReadOnly,U.depthRangeFor3D);let me=[0,0,0];if(we){const ye=U.style.directionalLight,Ze=U.style.ambientLight;ye&&Ze&&(me=Nu(U.style,ye,Ze))}const ge=ye=>{for(const Ze of re){const Me=W.getTile(Ze),ct=Me.getBucket(Z);if(!ct)continue;const Qe=ct.elevatedStructures;if(!Qe)continue;let ft,Rt;if(ye?(ft=Qe.renderableBridgeSegments,Rt=Qe.bridgeProgramConfigurations.get(Z.id)):(ft=Qe.renderableTunnelSegments,Rt=Qe.tunnelProgramConfigurations.get(Z.id)),!ft||ft.segments[0].primitiveLength===0)continue;Rt.updatePaintBuffers(),U.prepareDrawTile();const We=U.isTileAffectedByFog(Ze),Pe=[];we&&Pe.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const nt=U.getOrCreateProgram("elevatedStructures",{config:Rt,overrideFog:We,defines:Pe}),Ke=U.translatePosMatrix(Ze.projMatrix,Me,Z.paint.get("fill-translate"),Z.paint.get("fill-translate-anchor"));we&&fe.setupShadows(Me.tileID.toUnwrapped(),nt,"vector-tile");const vt=LI(Ke,me);U.uploadCommonUniforms(U.context,nt,Ze.toUnwrapped()),nt.draw(U,le.TRIANGLES,Se,Cr.disabled,se,vr.backCCW,vt,Z.id,Qe.vertexBuffer,Qe.indexBuffer,ft,Z.paint,U.transform.zoom,Rt,[Qe.vertexBufferNormal])}};ge(!0),ge(!1)}(z)}}else Hm(z,!1,d.stencilModeFor3D());else d.shadowRenderer&&R==="road"&&!F&&function(N){const{painter:G,sourceCache:U,layer:W,coords:Z}=N,re=G.context.gl,se=N.painter.shadowRenderer;for(const le of Z){const fe=U.getTile(le),we=fe.getBucket(W);if(!we)continue;const Se=we.elevatedStructures;if(!Se||!Se.shadowCasterSegments||Se.shadowCasterSegments.segments[0].primitiveLength===0)continue;G.prepareDrawTile();const me=we.bufferData.programConfigurations.get(W.id),ge=G.isTileAffectedByFog(le),ye=G.getOrCreateProgram("elevatedStructuresDepth",{config:me,overrideFog:ge}),Ze=se.calculateShadowPassMatrixFromTile(fe.tileID.toUnwrapped());G.uploadCommonUniforms(G.context,ye,le.toUnwrapped());const Me={u_matrix:Ze,u_depth_bias:0};ye.draw(G,re.TRIANGLES,se.getShadowPassDepthMode(),Cr.disabled,se.getShadowPassColorMode(),vr.disabled,Me,W.id,Se.vertexBuffer,Se.indexBuffer,Se.shadowCasterSegments,W.paint,G.transform.zoom,me)}}(z)},"fill-extrusion":function(d,i,l,f){const _=l.paint.get("fill-extrusion-opacity"),v=d.context,b=v.gl,S=d.terrain,C=S&&S.renderingToTexture;if(_===0)return;const k=d.conflationActive&&d.style.isLayerClipped(l,i.getSource()),R=d.style.order.indexOf(l.fqid);if(k&&function(F,z,N,G,U){for(const W of G){const Z=z.getTile(W).getBucket(N);Z&&(Z.updateReplacement(W,F.replacementSource,U),Z.uploadCentroid(F.context))}}(d,i,l,f,R),S||k)for(const F of f){const z=i.getTile(F).getBucket(l);z&&Tr(d.context,i,F,z,l,S,k)}if(d.renderPass==="shadow"&&d.shadowRenderer){const F=d.shadowRenderer;if(S&&_<.65&&l._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ab)return;const z=F.getShadowPassDepthMode(),N=F.getShadowPassColorMode();
2812Bf(d,i,l,f,z,Cr.disabled,N,k)}else if(d.renderPass==="translucent"){const F=!l.paint.get("fill-extrusion-pattern").constantOr(1),z=l.paint.get("fill-extrusion-color").constantOr(s.am.white);if(!C&&z.a!==0){const N=new Yt(d.context.gl.LEQUAL,Yt.ReadWrite,d.depthRangeFor3D);_===1&&F?Bf(d,i,l,f,N,Cr.disabled,Br.unblended,k):(Bf(d,i,l,f,N,Cr.disabled,Br.disabled,k),Bf(d,i,l,f,N,d.stencilModeFor3D(),d.colorModeForRenderPass(),k),d.resetStencilClippingMasks())}if(d.style.enable3dLights()&&F&&(!S&&d.transform.projection.name!=="globe"||C)){const N=l.paint.get("fill-extrusion-opacity"),G=l.paint.get("fill-extrusion-ambient-occlusion-intensity"),U=l.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),W=l.paint.get("fill-extrusion-flood-light-intensity"),Z=l.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",re=l.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Z?null:l.lut).toArray01().slice(0,3),se=G>0&&U>0,le=W>0,fe=(me,ge,ye)=>(1-ye)*me+ye*ge,we=new hc;we.translate=l.paint.get("fill-extrusion-translate"),we.translateAnchor=l.paint.get("fill-extrusion-translate-anchor"),we.edgeRadius=l.layout.get("fill-extrusion-edge-radius"),we.cutoffFadeRange=l.paint.get("fill-extrusion-cutoff-fade-range");const Se=me=>{const ge=d.depthModeForSublayer(1,Yt.ReadOnly,b.LEQUAL,!0),ye=l.paint.get(me?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ze=fe(.1,3,ye),Me=d._showOverdrawInspector;if(!Me){const ct=new Cr({func:b.ALWAYS,mask:255},255,255,b.KEEP,b.KEEP,b.REPLACE),Qe=new Br([b.ONE,b.ONE,b.ONE,b.ONE],s.am.transparent,[!1,!1,!1,!0],b.MIN);As(we,d,i,l,f,ge,ct,Qe,vr.disabled,me,"sdf",N,G,U,W,re,Ze,k,!1)}{const ct=Me?Cr.disabled:new Cr({func:b.EQUAL,mask:255},255,255,b.KEEP,b.DECR,b.DECR),Qe=Me?d.colorModeForRenderPass():new Br([b.ONE_MINUS_DST_ALPHA,b.DST_ALPHA,b.ONE,b.ONE],s.am.transparent,[!0,!0,!0,!0]);As(we,d,i,l,f,ge,ct,Qe,vr.disabled,me,"color",N,G,U,W,re,Ze,k,!1)}};if(C){const me=(ge,ye,Ze)=>{const Me=d.depthModeForSublayer(1,Yt.ReadOnly,b.LEQUAL,!1),ct=l.paint.get(ge?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Qe=fe(.1,3,ct);{const ft=new Br([b.ONE,b.ONE,b.ONE,b.ONE],s.am.transparent,[!1,!1,!1,!0]);As(we,d,i,l,f,Me,Cr.disabled,ft,vr.disabled,ge,"clear",N,G,U,W,re,Qe,k,ye)}{const ft=new Cr({func:b.ALWAYS,mask:255},255,255,b.KEEP,b.KEEP,b.REPLACE),Rt=new Br([b.ONE,b.ONE,b.ONE,b.ONE],s.am.transparent,[!1,!1,!1,!0],b.MIN);As(we,d,i,l,f,Me,ft,Rt,vr.disabled,ge,"sdf",N,G,U,W,re,Qe,k,ye)}{const ft=ge?b.ZERO:b.ONE_MINUS_DST_ALPHA,Rt=new Cr({func:b.EQUAL,mask:255},255,255,b.KEEP,b.DECR,b.DECR),We=new Br([ft,b.DST_ALPHA,b.ONE_MINUS_DST_ALPHA,b.ZERO],s.am.transparent,[!0,!0,!0,!0]);As(we,d,i,l,f,Me,Rt,We,vr.disabled,ge,"color",N,G,U,W,re,Qe,k,ye)}{const ft=new Br([b.ONE,b.ONE,b.ONE,ge?b.ZERO:b.ONE],s.am.transparent,[!1,!1,!1,!0],ge?b.FUNC_ADD:b.MAX);As(we,d,i,l,f,Me,Cr.disabled,ft,vr.disabled,ge,"clear",N,G,U,W,re,Qe,k,ye,Ze)}};if(se||le){let ge;if(d.prepareDrawTile(),S){const ye=S.drapeBufferSize[0],Ze=S.drapeBufferSize[1];ge=S.framebufferCopyTexture,ge&&(!ge||ge.size[0]===ye&&ge.size[1]===Ze)||(ge&&ge.destroy(),ge=S.framebufferCopyTexture=new s.T(v,new s.r({width:ye,height:Ze}),b.RGBA8)),ge.bind(b.LINEAR,b.CLAMP_TO_EDGE),b.copyTexSubImage2D(b.TEXTURE_2D,0,0,0,0,0,ye,Ze)}se&&me(!0,!1,ge),le&&me(!1,!0,ge)}}else se&&Se(!0),le&&Se(!1),(se||le)&&d.resetStencilClippingMasks()}}},building:function(d,i,l,f){d.currentLayer<d.firstLightBeamLayer&&(d.firstLightBeamLayer=d.currentLayer);const _=l.paint.get("building-ambient-occlusion-ground-intensity"),v=l.paint.get("building-ambient-occlusion-ground-radius"),b=l.paint.get("building-ambient-occlusion-ground-attenuation");let S=_>0&&v>0,C=!0;const k=l.paint.get("building-vertical-scale");k<1&&(C=!1);const R=d.conflationActive&&d.style.isLayerClipped(l,i.getSource()),F=d.style.order.indexOf(l.fqid);if(function(z,N,G,U,W,Z){for(const re of Z){const se=N.getTile(re).getBucket(G);se&&(W&&se.updateReplacement(re,z.replacementSource,U),se.uploadUpdatedIndexBuffer(z.context))}}(d,i,l,F,R,f),function(z,N,G,U){for(const W of U){const Z=N.getTile(W).getBucket(G);Z&&Z.needsEvaluation(z,G)&&(Z.evaluate(G),Z.uploadUpdatedColorBuffer(z.context))}}(d,i,l,f),l.resetLayerRenderingStats(d),d.shadowRenderer&&(d.shadowRenderer.useNormalOffset=!0),d.renderPass==="shadow"&&d.shadowRenderer){const z=d.shadowRenderer,N=[],G=z.getShadowPassDepthMode();Zm({painter:d,source:i,layer:l,coords:f,defines:N,blendMode:z.getShadowPassColorMode(),depthMode:G,verticalScale:k})}else if(d.renderPass==="translucent"){S&&function(U,W,Z,re,se,le,fe,we,Se,me,ge,ye,Ze){const Me=U.context.gl,ct=U.depthModeForSublayer(1,Yt.ReadOnly,Me.LEQUAL,!0),Qe=.1*(1-(ft=ge))+3*ft;var ft;const Rt=U._showOverdrawInspector,We=ye,Pe=new hc;Rt||As(Pe,U,W,Z,re,ct,new Cr({func:Me.ALWAYS,mask:255},255,255,Me.KEEP,Me.KEEP,Me.REPLACE),new Br([Me.ONE,Me.ONE,Me.ONE,Me.ONE],s.am.transparent,[!1,!1,!1,!0],Me.MIN),vr.disabled,se,"sdf",1,fe,we,0,me,Qe,We,!1);{const nt=Rt?Cr.disabled:new Cr({func:Me.EQUAL,mask:255},255,255,Me.KEEP,Me.DECR,Me.DECR),Ke=Rt?U.colorModeForRenderPass():new Br([Me.ONE_MINUS_DST_ALPHA,Me.DST_ALPHA,Me.ONE,Me.ONE],s.am.transparent,[!0,!0,!0,!0]);As(Pe,U,W,Z,re,ct,nt,Ke,vr.disabled,se,"color",1,fe,we,0,me,Qe,We,!1)}}(d,i,l,f,!0,0,_,v,0,[0,0,0],b,R);let z=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];C&&(z=z.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),d.shadowRenderer.useNormalOffset&&(z=z.concat("NORMAL_OFFSET"));const N=new Yt(d.context.gl.LEQUAL,Yt.ReadWrite,d.depthRangeFor3D),G=d.colorModeForRenderPass();Zm({painter:d,source:i,layer:l,coords:f,defines:z,blendMode:G,depthMode:N,verticalScale:k})}else if(d.renderPass==="light-beam"){const z=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],N=new Yt(d.context.gl.LEQUAL,Yt.ReadOnly,d.depthRangeFor3D);Zm({painter:d,source:i,layer:l,coords:f,defines:z,blendMode:Br.alphaBlended,depthMode:N,verticalScale:k})}d.shadowRenderer&&(d.shadowRenderer.useNormalOffset=!1),d.resetStencilClippingMasks()},hillshade:function(d,i,l,f){if(d.renderPass!=="offscreen"&&d.renderPass!=="translucent"||d.style.disableElevatedTerrain)return;const _=d.context,v=d.terrain&&d.terrain.renderingToTexture,[b,S]=d.renderPass!=="translucent"||v?[{},f]:d.stencilConfigForOverlap(f);for(const C of S){const k=i.getTile(C);if(k.needsHillshadePrepare&&d.renderPass==="offscreen")kb(d,k,l);else if(d.renderPass==="translucent"){const R=d.depthModeForSublayer(0,Yt.ReadOnly),F=l.paint.get("hillshade-emissive-strength"),z=d.colorModeForDrapableLayerRenderPass(F),N=v&&d.terrain?d.terrain.stencilModeForRTTOverlap(C):b[C.overscaledZ];TI(d,C,k,l,R,N,z)}}_.viewport.set([0,0,d.width,d.height]),d.resetStencilClippingMasks()},raster:function(d,i,l,f,_,v){if(d.renderPass!=="translucent"||l.paint.get("raster-opacity")===0)return;const b=d.transform.projection.name==="globe",S=l.paint.get("raster-elevation")!==0,C=S&&b;if(d.renderElevatedRasterBackface&&!C)return;const k=d.context,R=k.gl,F=i.getSource(),z=function(we,Se,me,ge){const ye=Se.paint.get("raster-color"),Ze=we.type==="raster-array",Me=[],ct=Se.paint.get("raster-resampling"),Qe=Se.paint.get("raster-color-mix");let ft=Se.paint.get("raster-color-range");const Rt=[Qe[0],Qe[1],Qe[2],0],We=Qe[3];let Pe=ct==="nearest"?ge.NEAREST:ge.LINEAR;
2812if(Ze&&(Me.push("RASTER_ARRAY"),ye||Me.push("RASTER_COLOR"),ct==="linear"&&Me.push("RASTER_ARRAY_LINEAR"),Pe=ge.NEAREST,!ft&&we.rasterLayers)){const nt=we.rasterLayers.find(({id:Ke})=>Ke===Se.sourceLayer);nt&&nt.fields&&nt.fields.range&&(ft=nt.fields.range)}if(ft=ft||[0,1],ye){Me.push("RASTER_COLOR"),me.activeTexture.set(ge.TEXTURE2),Se.updateColorRamp(ft);let nt=Se.colorRampTexture;nt||(nt=Se.colorRampTexture=new s.T(me,Se.colorRamp,ge.RGBA8)),nt.bind(ge.LINEAR,ge.CLAMP_TO_EDGE)}return{mix:Rt,range:ft,offset:We,defines:Me,resampling:Pe}}(F,l,k,R);if(F instanceof s.aP&&!f.length&&!b)return;const N=l.paint.get("raster-emissive-strength"),G=d.colorModeForDrapableLayerRenderPass(N),U=d.terrain&&d.terrain.renderingToTexture,W=!d.options.moving,Z=l.paint.get("raster-resampling")==="nearest"?R.NEAREST:R.LINEAR;if(F instanceof s.aP&&!f.length&&(F.onNorthPole||F.onSouthPole)){const we=S?d.stencilModeFor3D():Cr.disabled;return void Wm(!!F.onNorthPole,null,d,i,l,N,z,vr.disabled,we)}if(!f.length)return;const[re,se]=F instanceof s.aP||U?[{},f]:d.stencilConfigForOverlap(f),le=se[se.length-1].overscaledZ;C&&z.defines.push("PROJECTION_GLOBE_VIEW"),S&&z.defines.push("RENDER_CUTOFF");const fe=(we,Se,me)=>{for(const ge of we){const ye=ge.toUnwrapped(),Ze=i.getTile(ge);if(U&&(!Ze||!Ze.hasData()))continue;k.activeTexture.set(R.TEXTURE0);const Me=FI(Ze,F,l,z);if(!Me||!Me.texture)continue;const{texture:ct,mix:Qe,offset:ft,tileSize:Rt,buffer:We}=Me;let Pe,nt;U?(Pe=Yt.disabled,nt=ge.projMatrix):S?(Pe=new Yt(R.LEQUAL,Yt.ReadWrite,d.depthRangeFor3D),nt=b?Float32Array.from(d.transform.expandedFarZProjMatrix):d.transform.calculateProjMatrix(ye,W)):(Pe=d.depthModeForSublayer(ge.overscaledZ-le,l.paint.get("raster-opacity")===1?Yt.ReadWrite:Yt.ReadOnly,R.LESS),nt=d.transform.calculateProjMatrix(ye,W));const Ke=d.terrain&&U?d.terrain.stencilModeForRTTOverlap(ge):re[ge.overscaledZ],vt=v?0:l.paint.get("raster-fade-duration");Ze.registerFadeDuration(vt);const xt=i.findLoadedParent(ge,0),Et=Is(Ze,xt,i,d.transform,vt);let Bt,ir;d.terrain&&d.terrain.prepareDrawTile(),k.activeTexture.set(R.TEXTURE0),ct.bind(Z,R.CLAMP_TO_EDGE),k.activeTexture.set(R.TEXTURE1),xt?(xt.texture&&xt.texture.bind(Z,R.CLAMP_TO_EDGE),Bt=Math.pow(2,xt.tileID.overscaledZ-Ze.tileID.overscaledZ),ir=[Ze.tileID.canonical.x*Bt%1,Ze.tileID.canonical.y*Bt%1]):ct.bind(Z,R.CLAMP_TO_EDGE),"useMipmap"in ct&&k.extTextureFilterAnisotropic&&d.transform.pitch>20&&R.texParameterf(R.TEXTURE_2D,k.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,k.extTextureFilterAnisotropicMax);const ur=d.transform;let Zt;const ar=S?OI(ur):[0,0,0,0];let or,Pr,zr,qr,pi,kr=0;if(C&&F instanceof s.aP&&F.coordinates.length>3)or=Float32Array.from(s.bh(s.dD(new s.cA(0,0,0)))),Pr=Float32Array.from(ur.globeMatrix),zr=Float32Array.from(s.dz(ur)),qr=[s.aD(ur.center.lng),s.aH(ur.center.lat)],Zt=F.elevatedGlobePerspectiveTransform,pi=F.elevatedGlobeGridMatrix||new Float32Array(9);else if(C){const $r=s.dA(ge.canonical);kr=s.dB($r.getCenter().lat),or=Float32Array.from(s.bh(s.dD(ge.canonical))),Pr=Float32Array.from(ur.globeMatrix),zr=Float32Array.from(s.dz(ur)),qr=[s.aD(ur.center.lng),s.aH(ur.center.lat)],Zt=[0,0],pi=Float32Array.from(s.dC(ge.canonical,$r,kr,ur.worldSize/ur._pixelsPerMercatorPixel))}else Zt=F instanceof s.aP?F.perspectiveTransform:[0,0],or=new Float32Array(16),Pr=new Float32Array(9),zr=new Float32Array(16),qr=[0,0],pi=new Float32Array(9);const mi=r0(nt,or,Pr,zr,pi,ir||[0,0],s.ah(d.transform.zoom),qr,ar,Bt||1,Et,l,Zt,S?l.paint.get("raster-elevation"):0,2,Qe,ft,z.range,Rt,We,N),xi=d.isTileAffectedByFog(ge),Zi=d.getOrCreateProgram("raster",{defines:z.defines,overrideFog:xi});if(d.uploadCommonUniforms(k,Zi,ye),F instanceof s.aP){const $r=F.elevatedGlobeVertexBuffer,gi=F.elevatedGlobeIndexBuffer;if(U||!b)F.boundsBuffer&&F.boundsSegments&&Zi.draw(d,R.TRIANGLES,Pe,Cr.disabled,G,vr.disabled,mi,l.id,F.boundsBuffer,d.quadTriangleIndexBuffer,F.boundsSegments);else if($r&&gi){const vi=ur.zoom<=s.cX?F.elevatedGlobeSegments:F.getSegmentsForLongitude(ur.center.lng);vi&&Zi.draw(d,R.TRIANGLES,Pe,Cr.disabled,G,Se,mi,l.id,$r,gi,vi)}}else if(C){Pe=new Yt(R.LEQUAL,Yt.ReadOnly,d.depthRangeFor3D);const $r=d.globeSharedBuffers;if($r){const[gi,vi,Si]=$r.getGridBuffers(kr,!1);Zi.draw(d,R.TRIANGLES,Pe,me||Ke,d.colorModeForRenderPass(),Se,mi,l.id,gi,vi,Si)}}else{const{tileBoundsBuffer:$r,tileBoundsIndexBuffer:gi,tileBoundsSegments:vi}=d.getTileBoundsBuffers(Ze);Zi.draw(d,R.TRIANGLES,Pe,Ke,G,vr.disabled,mi,l.id,$r,gi,vi)}}if(!(F instanceof s.aP)&&C)for(const ge of we){const ye=ge.canonical.y===(1<<ge.canonical.z)-1;ge.canonical.y===0&&Wm(!0,ge,d,i,l,N,z,Se,me||Cr.disabled),ye&&Wm(!1,ge,d,i,l,N,z,Se===vr.frontCW?vr.backCW:vr.frontCW,me||Cr.disabled)}};C?fe(se,d.renderElevatedRasterBackface?vr.backCW:vr.frontCW,d.stencilModeFor3D()):fe(se,vr.disabled,void 0),d.resetStencilClippingMasks()},"raster-particle":function(d,i,l,f,_,v){d.renderPass==="offscreen"&&function(b,S,C,k){if(!k.length)return;const R=b.context,F=R.gl,z=S.getSource();if(!(z instanceof zi))return;const N=Math.ceil(Math.sqrt(C.paint.get("raster-particle-count")));let G=C.particlePositionRGBAImage;if(!G||G.width!==N){const se=function(le){const fe=le*le,we=new Uint8Array(4*fe),Se=function(ge){return ge|=0,ge=Math.imul(2747636419^ge,2654435769),ge=Math.imul(ge^ge>>>16,2654435769),((ge=Math.imul(ge^ge>>>16,2654435769))>>>0)/4294967296},me=1/1.1;for(let ge=0;ge<fe;ge++){const ye=me*(Se(2*ge+0)+Xc),Ze=me*(Se(2*ge+1)+Xc),Me=255*ye%1,ct=255*Ze%1,Qe=Me,ft=Ze-ct/255,Rt=ct;we[4*ge+0]=255*(ye-Me/255),we[4*ge+1]=255*Qe,we[4*ge+2]=255*ft,we[4*ge+3]=255*Rt}return we}(N);G=C.particlePositionRGBAImage=new s.r({width:N,height:N},se)}let U=C.particleFramebuffer;U?U.width!==N&&(U.destroy(),U=C.particleFramebuffer=R.createFramebuffer(N,N,!0,null)):U=C.particleFramebuffer=R.createFramebuffer(N,N,!0,null);const W=[];for(const se of k){const le=S.getTile(se);if(!(le instanceof Nh))continue;const fe=ps(le,z,C);if(!fe)continue;const we=[le.tileSize,le.tileSize];let Se=C.tileFramebuffer;Se||(Se=C.tileFramebuffer=R.createFramebuffer(we[0],we[1],!0,null));let me=le.rasterParticleState;me||(me=le.rasterParticleState=new h0(R,se,we,G));const ge=me.update(C.lastInvalidatedAt);me.particleTextureDimension!==N&&me.updateParticleTexture(se,G);const ye=me.targetColorTexture;me.targetColorTexture=me.backgroundColorTexture,me.backgroundColorTexture=ye;const Ze=me.particleTexture0;me.particleTexture0=me.particleTexture1,me.particleTexture1=Ze,W.push([se,fe,me,ge])}if(W.length===0)return;const Z=s.q.now(),re=C.previousDrawTimestamp?.001*(Z-C.previousDrawTimestamp):.0167;if(C.previousDrawTimestamp=Z,C.hasColorMap()){R.activeTexture.set(F.TEXTURE0+2);let se=C.colorRampTexture;se||(se=C.colorRampTexture=new s.T(R,C.colorRamp,F.RGBA8)),se.bind(F.LINEAR,F.CLAMP_TO_EDGE)}R.bindFramebuffer.set(C.tileFramebuffer.framebuffer),function(se,le,fe){const we=se.context,Se=we.gl,me=le.tileFramebuffer;we.activeTexture.set(Se.TEXTURE0);
vendor: 5,172 bytes, line 2812
2812const ge={u_texture:0,u_opacity:1.05*(Ze=le.paint.get("raster-particle-fade-opacity-factor"))/(Ze+.05)},ye=se.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var Ze;for(const Me of fe){const[,,ct,Qe]=Me;me.colorAttachment.set(ct.targetColorTexture.texture),we.viewport.set([0,0,me.width,me.height]),we.clear({color:s.am.transparent}),Qe&&(ct.backgroundColorTexture.bind(Se.NEAREST,Se.CLAMP_TO_EDGE),ye.draw(se,Se.TRIANGLES,Yt.disabled,Cr.disabled,Br.alphaBlended,vr.disabled,ge,le.id,se.viewportBuffer,se.quadTriangleIndexBuffer,se.viewportSegments))}}(b,C,W),function(se,le,fe,we){const Se=se.context,me=Se.gl,ge=fe.tileFramebuffer,ye=se.transform.projection.name==="globe",Ze=fe.paint.get("raster-particle-max-speed");for(const Me of we){const[ct,Qe,ft]=Me;Se.activeTexture.set(me.TEXTURE0+0),Qe.texture.bind(me.LINEAR,me.CLAMP_TO_EDGE),ge.colorAttachment.set(ft.targetColorTexture.texture);const Rt=se.getOrCreateProgram("rasterParticleDraw",{defines:Qe.defines,overrideFog:!1});Se.activeTexture.set(me.TEXTURE0+1);const We=Qe.scalarData?[]:[0,1,2,3].map(Ke=>s.e3[Ke](ct));We.push(ct);const Pe=ct.canonical.x,nt=ct.canonical.y;for(const Ke of We){const vt=le.getTile(ye?Ke.wrapped():Ke);if(!vt)continue;const xt=vt.rasterParticleState;if(!xt)continue;const Et=Ke.canonical.x+(1<<Ke.canonical.z)*(Ke.wrap-ct.wrap),Bt=Ke.canonical.y;xt.particleTexture0.bind(me.NEAREST,me.CLAMP_TO_EDGE);const ir=Wb(1,xt.particleTexture0.size[0],[Et-Pe,Bt-nt],0,Qe.texture.size,2,Ze,Qe.textureOffset,Qe.scale,Qe.offset);Rt.draw(se,me.POINTS,Yt.disabled,Cr.disabled,Br.alphaBlended,vr.disabled,ir,fe.id,xt.particleIndexBuffer,void 0,xt.particleSegment)}}}(b,S,C,W),R.bindFramebuffer.set(C.particleFramebuffer.framebuffer),function(se,le,fe,we){const Se=se.context,me=Se.gl,ge=le.paint.get("raster-particle-max-speed"),ye=we*le.paint.get("raster-particle-speed-factor")*.15,Ze=function(ct){return Math.pow(ct,6)}(.01+1*le.paint.get("raster-particle-reset-rate-factor")),Me=le.particleFramebuffer;Se.viewport.set([0,0,Me.width,Me.height]);for(const ct of fe){const[,Qe,ft]=ct;Se.activeTexture.set(me.TEXTURE0+0),Qe.texture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Se.activeTexture.set(me.TEXTURE0+1);const Rt=ft.particleTexture0;Rt.bind(me.NEAREST,me.CLAMP_TO_EDGE);const We=Xb(1,Rt.size[0],0,Qe.texture.size,ge,ye,Ze,Qe.textureOffset,Qe.scale,Qe.offset);Me.colorAttachment.set(ft.particleTexture1.texture),Se.clear({color:s.am.transparent}),se.getOrCreateProgram("rasterParticleUpdate",{defines:Qe.defines}).draw(se,me.TRIANGLES,Yt.disabled,Cr.disabled,Br.unblended,vr.disabled,We,le.id,se.viewportBuffer,se.quadTriangleIndexBuffer,se.viewportSegments)}}(b,C,W,re)}(d,i,l,f),d.renderPass==="translucent"&&(function(b,S,C,k,R){const F=b.context,z=F.gl,N=S.getSource().tileSize,G=5*(1-s.af(s.cI,s.cI+1,b.transform.zoom))*N+C.paint.get("raster-particle-elevation"),U=!b.options.moving,W=b.transform.projection.name==="globe";if(!k.length)return;const[Z,re]=b.stencilConfigForOverlap(k),se=[];W&&se.push("PROJECTION_GLOBE_VIEW");const le=b.stencilModeFor3D();for(const fe of re){const we=fe.toUnwrapped(),Se=S.getTile(fe);if(!Se.rasterParticleState)continue;const me=Se.rasterParticleState,ge=100;Se.registerFadeDuration(ge);const ye=S.findLoadedParent(fe,0),Ze=Is(Se,ye,S,b.transform,ge);let Me,ct;b.terrain&&b.terrain.prepareDrawTile(),F.activeTexture.set(z.TEXTURE0),me.targetColorTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),F.activeTexture.set(z.TEXTURE1),ye&&ye.rasterParticleState?(ye.rasterParticleState.targetColorTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),Me=Math.pow(2,ye.tileID.overscaledZ-Se.tileID.overscaledZ),ct=[Se.tileID.canonical.x*Me%1,Se.tileID.canonical.y*Me%1]):me.targetColorTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Qe=W?Float32Array.from(b.transform.expandedFarZProjMatrix):b.transform.calculateProjMatrix(we,U),ft=b.transform,Rt=Qc(ft),We=s.dA(fe.canonical),Pe=s.dB(We.getCenter().lat);let nt,Ke,vt,xt,Et;W?(nt=Float32Array.from(s.bh(s.dD(fe.canonical))),Ke=Float32Array.from(ft.globeMatrix),vt=Float32Array.from(s.dz(ft)),xt=[s.aD(ft.center.lng),s.aH(ft.center.lat)],Et=Float32Array.from(s.dC(fe.canonical,We,Pe,ft.worldSize/ft._pixelsPerMercatorPixel))):(nt=new Float32Array(16),Ke=new Float32Array(9),vt=new Float32Array(16),xt=[0,0],Et=new Float32Array(9));const Bt=Um(Qe,nt,Ke,vt,Et,ct||[0,0],s.ah(b.transform.zoom),xt,Rt,Me||1,Ze,G),ir=b.isTileAffectedByFog(fe),ur=b.getOrCreateProgram("rasterParticle",{defines:se,overrideFog:ir});if(b.uploadCommonUniforms(F,ur,we),W){const Zt=new Yt(z.LEQUAL,Yt.ReadOnly,b.depthRangeFor3D),ar=0,or=b.globeSharedBuffers;if(or){const[Pr,zr,qr]=or.getGridBuffers(Pe,ar!==0);ur.draw(b,z.TRIANGLES,Zt,le,Br.alphaBlended,b.renderElevatedRasterBackface?vr.frontCCW:vr.backCCW,Bt,C.id,Pr,zr,qr)}}else{const Zt=b.depthModeForSublayer(0,Yt.ReadOnly),ar=Z[fe.overscaledZ],{tileBoundsBuffer:or,tileBoundsIndexBuffer:Pr,tileBoundsSegments:zr}=b.getTileBoundsBuffers(Se);ur.draw(b,z.TRIANGLES,Zt,ar,Br.alphaBlended,vr.disabled,Bt,C.id,or,Pr,zr)}}b.resetStencilClippingMasks()}(d,i,l,f),d.style.map.triggerRepaint())},background:function(d,i,l,f){const _=l.paint.get("background-color"),v=l.paint.get("background-color-use-theme").
2812constantOr("default")==="none",b=l.paint.get("background-opacity"),S=l.paint.get("background-emissive-strength"),C=l.paint.get("background-pitch-alignment")==="viewport";if(b===0)return;const k=d.context,R=k.gl,F=d.transform,z=F.tileSize,N=l.paint.get("background-pattern");let G;if(N!==void 0&&(N===null||(G=d.imageManager.getPattern(s.I.from(N.toString()),l.scope,d.style.getLut(l.scope)),!G)))return;const U=!N&&_.a===1&&b===1&&d.opaquePassEnabledForLayer()?"opaque":"translucent";if(d.renderPass!==U)return;const W=Cr.disabled,Z=d.depthModeForSublayer(0,U==="opaque"?Yt.ReadWrite:Yt.ReadOnly),re=d.colorModeForDrapableLayerRenderPass(S),se=N?"backgroundPattern":"background";let le,fe=f;if(fe||(le=d.getBackgroundTiles(),fe=Object.values(le).map(we=>we.tileID)),N&&(k.activeTexture.set(R.TEXTURE0),d.imageManager.bind(d.context,l.scope)),C){const we=d.getOrCreateProgram(se,{overrideFog:!1,overrideRtt:!0}),Se=new Float32Array(s.bx([])),me=new s.aM(0,0,0,0,0),ge=N?i0(Se,S,b,d,0,l.scope,G,C,{tileID:me,tileSize:z}):Yb(Se,S,b,_.toPremultipliedRenderColor(v?null:l.lut));we.draw(d,R.TRIANGLES,Z,W,re,vr.disabled,ge,l.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments)}else for(const we of fe){const Se=d.isTileAffectedByFog(we),me=d.getOrCreateProgram(se,{overrideFog:Se}),ge=we.toUnwrapped(),ye=f?we.projMatrix:d.transform.calculateProjMatrix(ge);d.prepareDrawTile();const Ze=i?i.getTile(we):le?le[we.key]:new ku(we,z,F.zoom,d),Me=N?i0(ye,S,b,d,0,l.scope,G,C,{tileID:we,tileSize:z}):Yb(ye,S,b,_.toPremultipliedRenderColor(v?null:l.lut));d.uploadCommonUniforms(k,me,ge);const{tileBoundsBuffer:ct,tileBoundsIndexBuffer:Qe,tileBoundsSegments:ft}=d.getTileBoundsBuffers(Ze);me.draw(d,R.TRIANGLES,Z,W,re,vr.disabled,Me,l.id,ct,Qe,ft)}},sky:function(d,i,l){const f=d._atmosphere?s.ah(d.transform.zoom):1,_=l.paint.get("sky-opacity")*f;if(_===0)return;const v=d.context,b=l.paint.get("sky-type"),S=new Yt(v.gl.LEQUAL,Yt.ReadOnly,[0,1]),C=d.frameCounter/1e3%1;b==="atmosphere"?d.renderPass==="offscreen"?l.needsSkyboxCapture(d)&&(function(k,R,F,z){const N=k.context,G=N.gl;let U=R.skyboxFbo;if(!U){U=R.skyboxFbo=N.createFramebuffer(32,32,!0,null),R.skyboxGeometry=new qu(N),R.skyboxTexture=N.gl.createTexture(),G.bindTexture(G.TEXTURE_CUBE_MAP,R.skyboxTexture),G.texParameteri(G.TEXTURE_CUBE_MAP,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_CUBE_MAP,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_CUBE_MAP,G.TEXTURE_MIN_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_CUBE_MAP,G.TEXTURE_MAG_FILTER,G.LINEAR);for(let se=0;se<6;++se)G.texImage2D(G.TEXTURE_CUBE_MAP_POSITIVE_X+se,0,G.RGBA,32,32,0,G.RGBA,G.UNSIGNED_BYTE,null)}N.bindFramebuffer.set(U.framebuffer),N.viewport.set([0,0,32,32]);const W=R.getCenter(k,!0),Z=k.getOrCreateProgram("skyboxCapture"),re=new Float64Array(16);s.bx(re),s.eh(re,re,.5*-Math.PI),ol(k,R,Z,re,W,0),s.bx(re),s.eh(re,re,.5*Math.PI),ol(k,R,Z,re,W,1),s.bx(re),s.cR(re,re,.5*-Math.PI),ol(k,R,Z,re,W,2),s.bx(re),s.cR(re,re,.5*Math.PI),ol(k,R,Z,re,W,3),s.bx(re),ol(k,R,Z,re,W,4),s.bx(re),s.eh(re,re,Math.PI),ol(k,R,Z,re,W,5),N.viewport.set([0,0,k.width,k.height])}(d,l),l.markSkyboxValid(d)):d.renderPass==="sky"&&function(k,R,F,z,N){const G=k.context,U=G.gl,W=k.transform,Z=k.getOrCreateProgram("skybox");G.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_CUBE_MAP,R.skyboxTexture);const re=((se,le,fe,we,Se)=>({u_matrix:se,u_sun_direction:le,u_cubemap:0,u_opacity:we,u_temporal_offset:Se}))(W.skyboxMatrix,R.getCenter(k,!1),0,z,N);k.uploadCommonUniforms(G,Z),Z.draw(k,U.TRIANGLES,F,Cr.disabled,k.colorModeForRenderPass(),vr.backCW,re,"skybox",R.skyboxGeometry.vertexBuffer,R.skyboxGeometry.indexBuffer,R.skyboxGeometry.segment)}(d,l,S,_,C):b==="gradient"&&d.renderPass==="sky"&&function(k,R,F,z,N){const G=k.context,U=G.gl,W=k.transform,Z=k.getOrCreateProgram("skyboxGradient");R.skyboxGeometry||(R.skyboxGeometry=new qu(G)),G.activeTexture.set(U.TEXTURE0);let re=R.colorRampTexture;re||(re=R.colorRampTexture=new s.T(G,R.colorRamp,U.RGBA8)),re.bind(U.LINEAR,U.CLAMP_TO_EDGE);const se=((le,fe,we,Se,me)=>({u_matrix:le,u_color_ramp:0,u_center_direction:fe,u_radius:s.al(we),u_opacity:Se,u_temporal_offset:me}))(W.skyboxMatrix,R.getCenter(k,!1),R.paint.get("sky-gradient-radius"),z,N);k.uploadCommonUniforms(G,Z),Z.draw(k,U.TRIANGLES,F,Cr.disabled,k.colorModeForRenderPass(),vr.backCW,se,"skyboxGradient",R.skyboxGeometry.vertexBuffer,R.skyboxGeometry.indexBuffer,R.skyboxGeometry.segment)}(d,l,S,_,C)},custom:function(d,i,l,f){const _=d.context,v=l.implementation;if(!d.transform.projection.unsupportedLayers||!d.transform.projection.unsupportedLayers.includes("custom")||d.terrain&&(d.terrain.renderingToTexture||d.renderPass==="offscreen")&&l.isDraped(i)){if(d.renderPass==="offscreen"){const b=v.prerender;if(b){if(d.setCustomLayerDefaults(),_.setColorMode(d.colorModeForRenderPass()),d.transform.projection.name==="globe"){const S=d.transform.pointMerc;b.call(v,_.gl,d.transform.customLayerMatrix(),d.transform.getProjection(),d.transform.globeToMercatorMatrix(),s.ah(d.transform.zoom),[S.x,S.y],d.transform.pixelsPerMeterRatio)}else b.call(v,_.gl,d.transform.customLayerMatrix());_.setDirty(),d.setBaseState()}}else if(d.renderPass==="translucent"){if(d.terrain&&d.terrain.renderingToTexture){const S=v.renderToTile;if(S){const C=f[0].canonical,k={x:C.x+f[0].wrap*(v.wrapTileId?0:1<<C.z),y:C.y,z:C.z};_.setDepthMode(Yt.disabled),_.setStencilMode(Cr.disabled),_.setColorMode(d.colorModeForRenderPass()),d.setCustomLayerDefaults(),S.call(v,_.gl,k),_.setDirty(),d.setBaseState()}return}d.setCustomLayerDefaults(),_.setColorMode(d.colorModeForRenderPass()),_.setStencilMode(Cr.disabled);const b=v.renderingMode==="3d"?new Yt(d.context.gl.LEQUAL,Yt.ReadWrite,d.depthRangeFor3D):d.depthModeForSublayer(0,Yt.ReadOnly);if(_.setDepthMode(b),d.transform.projection.name==="globe"){const S=d.transform.pointMerc;v.render(_.gl,d.transform.customLayerMatrix(),d.transform.getProjection(),d.transform.globeToMercatorMatrix(),s.ah(d.transform.zoom),[S.x,S.y],d.transform.pixelsPerMeterRatio)}else v.render(_.gl,d.transform.customLayerMatrix());_.setDirty(),d.setBaseState(),_.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(d,i,l,f){if(d.renderPass==="opaque")return;const _=l.paint.get("model-opacity").constantOr(1);if(_===0)return;const v=l.paint.get("model-cast-shadows");
2812if(d.renderPass==="shadow"&&(!v||d.terrain&&_<.65&&l._transitionablePaint._values["model-opacity"].value.expression instanceof s.ab))return;const b=d.shadowRenderer,S=l.paint.get("model-receive-shadows");b&&(b.useNormalOffset=!0,S||(b.enabled=!1));const C=()=>{b&&(b.useNormalOffset=!0,S||(b.enabled=!0))},k=i.getSource();if(d.renderPass==="light-beam"&&k.type!=="batched-model")return;if(k.type==="vector"||k.type==="geojson")return function(Z,re,se,le,fe){const we=Z.transform;if(we.projection.name!=="mercator")return void s.w(`Drawing 3D models for ${we.projection.name} projection is not yet implemented`);const Se=we.getFreeCameraOptions().position;if(!Z.modelManager)return;const me=Z.modelManager;se.modelManager=me;const ge=Z.shadowRenderer;if(!se._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ye=se._unevaluatedLayout._values["model-id"],Ze=Object.assign({},se.layout.get("model-id").parameters),Me=Z.style.order.indexOf(se.fqid);for(const ct of le){const Qe=re.getTile(ct).getBucket(se);if(!Qe||Qe.projection.name!==we.projection.name)continue;const ft=Qe.getModelUris();ft&&!Qe.modelsRequested&&(me.addModelsFromBucket(ft,fe),Qe.modelsRequested=!0);const Rt=NI(ct,we);Ze.zoom=Rt;const We=ye.possiblyEvaluate(Ze);if(ad(Z,Qe,ct),zl.shadowUniformsInitialized=!1,zl.useSingleShadowCascade=!!ge&&ge.getMaxCascadeForTile(ct.toUnwrapped())===0,Z.renderPass==="shadow"&&ge){if(Z.currentShadowCascade===1&&Qe.isInsideFirstShadowMapFrustum)continue;const Ke=we.calculatePosMatrix(ct.toUnwrapped(),we.worldSize);if(zl.tileMatrix.set(Ke),zl.shadowTileMatrix=Float32Array.from(ge.calculateShadowPassMatrixFromMatrix(Ke)),zl.aabb.min.fill(0),zl.aabb.max[0]=zl.aabb.max[1]=s.aj,zl.aabb.max[2]=0,_0(Qe,zl,Z,se.scope))continue}
2812const Pe=1<<ct.canonical.z,nt=[((Se.x-ct.wrap)*Pe-ct.canonical.x)*s.aj,(Se.y*Pe-ct.canonical.y)*s.aj,Se.z*Pe*s.aj];Z.conflationActive&&Object.keys(Qe.instancesPerModel).length>0&&Z.style.isLayerClipped(se,re.getSource())&&Qe.updateReplacement(ct,Z.replacementSource,Me,fe)&&(Qe.uploaded=!1,Qe.upload(Z.context));for(let Ke in Qe.instancesPerModel){const vt=Qe.instancesPerModel[Ke];vt.features.length>0&&(Ke=We.evaluate(vt.features[0].feature,{}));const xt=me.getModel(Ke,fe);if(xt||me.hasURLBeenRequested(Ke)||Qe.modelUris.includes(Ke)||(Qe.modelUris.push(Ke),Qe.modelsRequested=!1),xt&&xt.uploaded)for(const Et of xt.nodes)g0(Z,se,Et,vt,nt,ct,zl)}}}(d,i,l,f,k.type==="vector"?l.scope:""),void C();if(!k.loaded())return;if(k.type==="batched-model")return function(Z,re,se,le){se.resetLayerRenderingStats(Z);const fe=Z.context,we=Z.transform,Se=Z.style.fog,me=Z.shadowRenderer;if(we.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${we.projection.name} projection is not yet implemented`);const ge=Z.transform.getFreeCameraOptions().position,ye=s.c1([],[ge.x,ge.y,ge.z],Z.transform.worldSize),Ze=s.eq([],ye),Me=s.bx([]),ct=s.e9(we.center.lat,we.zoom),Qe=s.bn([],[1,1,1/ct]);s.bo(Me,Me,Ze);const ft=se.paint.get("model-opacity").constantOr(1),Rt=new Yt(fe.gl.LEQUAL,Yt.ReadWrite,Z.depthRangeFor3D),We=new Yt(fe.gl.LEQUAL,Yt.ReadOnly,Z.depthRangeFor3D),Pe=new s.d6([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),nt=Z.renderPass==="shadow",Ke=nt&&me?me.getCurrentCascadeFrustum():we.getFrustum(we.scaleZoom(we.worldSize)),vt=se.paint.get("model-front-cutoff"),xt=vt[2]<1,Et=Rl(Z,se.paint.get("model-cutoff-fade-range")),Bt=se.getLayerRenderingStats();(function(ir,ur,Zt,ar){const or=ir.terrain?ir.terrain.exaggeration():0,Pr=ir.transform.zoom;for(const zr of ar){const qr=ur.getTile(zr).getBucket(Zt);qr&&(qr.setFilter(Zt.filter),ir.conflationActive&&qr.updateReplacement(zr,ir.replacementSource),qr.evaluateTransform(ir,Zt),ir.terrain&&or>0&&qr.elevationUpdate(ir.terrain,or,zr,Zt.source),qr.needsReEvaluation(ir,Pr,Zt)&&qr.evaluate(Zt))}})(Z,re,se,le),function(){let ir,ur,Zt;xt?(ir=le.length-1,ur=-1,Zt=-1):(ir=0,ur=le.length,Zt=1);const ar=new Float64Array(16),or=s.cx(),Pr=new s.P(0,0);for(let zr=ir;zr!==ur;zr+=Zt){const qr=le[zr],pi=re.getTile(qr).getBucket(se);if(!pi||!pi.uploaded)continue;let kr=!1;me&&(kr=me.getMaxCascadeForTile(qr.toUnwrapped())===0);const mi=we.calculatePosMatrix(qr.toUnwrapped(),we.worldSize),xi=pi.modelTraits;!nt&&xt&&(s.bi(ar,mi),s.ad(or,ye,ar),Pr.x=or[0],Pr.y=or[1]);const Zi=[];pi.setFilter(se.filter);for(const $r of pi.getNodesInfo()){if($r.hiddenByReplacement||!$r.node.meshes)continue;const gi=$r.node;let vi=0;Z.terrain&&gi.elevation&&(vi=gi.elevation*Z.terrain.exaggeration());const Si=(()=>{const Io=$r.aabb;return Pe.min=[...Io.min],Pe.max=[...Io.max],Pe.min[2]+=vi,Pe.max[2]+=vi,s.ad(Pe.min,Pe.min,mi),s.ad(Pe.max,Pe.max,mi),Pe})(),Zr=$r.evaluatedScale;if(Zr[0]<=1&&Zr[1]<=1&&Zr[2]<=1&&Si.intersects(Ke)===0)continue;if(!nt&&xt){const Io=.16666666666666666;$r.cameraCollisionOpacity=ye[0]>Si.min[0]&&ye[0]<Si.max[0]&&ye[1]>Si.min[1]&&ye[1]<Si.max[1]&&ye[2]*ct<Si.max[2]&&gi.footprint&&s.bY(Pr,gi.footprint)?Math.max($r.cameraCollisionOpacity-Io,0):Math.min(1,$r.cameraCollisionOpacity+Io)}const Di=[...mi],bi=1/s.d4(qr.canonical),bn=gi.anchor?gi.anchor[0]:0,hi=gi.anchor?gi.anchor[1]:0;s.bo(Di,Di,[bn*(Zr[0]-1)+$r.evaluatedTranslation[0]*bi,hi*(Zr[1]-1)+$r.evaluatedTranslation[1]*bi,vi+$r.evaluatedTranslation[2]]),s.cn(Zr,s.es)||s.cP(Di,Di,Zr);const Ci=s.az([],Di,gi.matrix),Gi=s.az([],we.expandedFarZProjMatrix,Ci),Un=s.az([],we.expandedFarZProjMatrix,Di),Nn=s.aA([],[bn,hi,vi,1],Gi)[2];gi.hidden=!1;let jn=ft;nt||(xt&&(jn*=$r.cameraCollisionOpacity,jn*=aw(Di,we,$r.aabb,vt)),jn*=sw(Et,Nn)),jn!==0?Zi.push({nodeInfo:$r,depth:Nn,opacity:jn,wvpForNode:Gi,wvpForTile:Un,nodeModelMatrix:Ci,tileModelMatrix:Di}):gi.hidden=!0}nt||Zi.sort(($r,gi)=>!xt||$r.opacity===1&&gi.opacity===1?$r.depth<gi.depth?-1:1:$r.opacity===1?-1:gi.opacity===1?1:$r.depth>gi.depth?-1:1);for(const $r of Zi){const gi=$r.nodeInfo,vi=gi.node;let Si=s.az([],Qe,$r.tileModelMatrix);s.az(Si,Me,Si);const Zr=s.bi([],Si);s.ea(Zr,Zr),s.cP(Zr,Zr,Km),Si=s.az(Si,Si,vi.matrix);const Di=Z.renderPass==="light-beam",bi=se.paint.get("model-color-use-theme").
2812constantOr("default")==="none",bn=xi&s.ex.HasMapboxMeshFeatures,hi=bn?0:gi.evaluatedRMEA[0][2];for(let Ci=0;Ci<vi.meshes.length;++Ci){const Gi=vi.meshes[Ci],Un=Ci===vi.lightMeshIndex;let Nn=$r.wvpForNode;if(Un){if(!Di&&!Z.terrain&&Z.shadowRenderer){Z.currentLayer<Z.firstLightBeamLayer&&(Z.firstLightBeamLayer=Z.currentLayer);continue}Nn=$r.wvpForTile}else if(Di)continue;const jn={defines:[]},Io=[];if(!nt&&me&&(me.useNormalOffset=!!Gi.normalBuffer),Gf(jn.defines,Io,Gi,Z,bi?null:se.lut),bn||jn.defines.push("DIFFUSE_SHADED"),kr&&jn.defines.push("SHADOWS_SINGLE_CASCADE"),Bt&&(nt?Bt.numRenderedVerticesInShadowPass+=Gi.vertexArray.length:Bt.numRenderedVerticesInTransparentPass+=Gi.vertexArray.length),nt){Ym(Gi,$r.nodeModelMatrix,Z,se);continue}let sl=null;if(Se){const Go=jf($r.nodeModelMatrix,Z.transform);if(sl=new Float32Array(Go),we.projection.name!=="globe"){const Dn=Gi.aabb.min,Pn=Gi.aabb.max,[Yi,to]=Se.getOpacityForBounds(Go,Dn[0],Dn[1],Pn[0],Pn[1]);jn.overrideFog=Yi>=Ge||to>=Ge}}const gs=Gi.material;let Zs;gs.occlusionTexture&&gs.occlusionTexture.offsetScale&&(Zs=gs.occlusionTexture.offsetScale,jn.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const jo=Z.getOrCreateProgram("model",jn);!nt&&me&&me.setupShadowsFromMatrix($r.tileModelMatrix,jo,me.useNormalOffset),Z.uploadCommonUniforms(fe,jo,null,sl);const _a=gs.pbrMetallicRoughness;_a.metallicFactor=.9,_a.roughnessFactor=.5;const Ga=n0(new Float32Array(Nn),new Float32Array(Si),new Float32Array(Zr),new Float32Array(vi.matrix),Z,$r.opacity,_a.baseColorFactor,gs.emissiveFactor,_a.metallicFactor,_a.roughnessFactor,gs,hi,se,[0,0,0],Zs);!Un&&(gi.hasTranslucentParts||$r.opacity<1)&&jo.draw(Z,fe.gl.TRIANGLES,Rt,Cr.disabled,Br.disabled,vr.backCCW,Ga,se.id,Gi.vertexBuffer,Gi.indexBuffer,Gi.segments,se.paint,Z.transform.zoom,void 0,Io),jo.draw(Z,fe.gl.TRIANGLES,Un?We:Rt,Cr.disabled,Un||$r.opacity<1||gi.hasTranslucentParts?Br.alphaBlended:Br.unblended,vr.backCCW,Ga,se.id,Gi.vertexBuffer,Gi.indexBuffer,Gi.segments,se.paint,Z.transform.zoom,void 0,Io)}}}}()}(d,i,l,f),void C();if(k.type!=="model")return;const R=k.getModels(),F=[],z=d.transform.getFreeCameraOptions().position,N=s.c1([],[z.x,z.y,z.z],d.transform.worldSize);s.eq(N,N);const G=[],U=[];let W=0;for(const Z of R){const re=l.paint.get("model-rotation").constantOr(null),se=l.paint.get("model-scale").constantOr(null),le=l.paint.get("model-translation").constantOr(null);Z.computeModelMatrix(d,re,se,le,!0,!0,!1);const fe=s.bx([]),we=s.e9(Z.position.lat,d.transform.zoom),Se=s.bn([],[1,1,1/we]);s.bo(fe,fe,N),F.push({zScaleMatrix:Se,negCameraPosMatrix:fe});for(const me of Z.nodes)m0(d.transform,me,Z.matrix,d.transform.expandedFarZProjMatrix,W,G,U);W++}if(G.sort((Z,re)=>re.depth-Z.depth),d.renderPass!=="shadow"){if(_===1)for(const Z of U)sd(Z,d,l,F[Z.modelIndex],Cr.disabled,d.colorModeForRenderPass());else{for(const Z of U)sd(Z,d,l,F[Z.modelIndex],Cr.disabled,Br.disabled);for(const Z of U)sd(Z,d,l,F[Z.modelIndex],d.stencilModeFor3D(),d.colorModeForRenderPass());d.resetStencilClippingMasks()}for(const Z of G)sd(Z,d,l,F[Z.modelIndex],Cr.disabled,d.colorModeForRenderPass());C()}else{for(const Z of U)Ym(Z.mesh,Z.nodeModelMatrix,d,l);for(const Z of G)Ym(Z.mesh,Z.nodeModelMatrix,d,l);C()}}},Qm={line:function(d,i,l){if(d.hasElevatedBuckets=!1,d.hasNonElevatedBuckets=!1,d._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||d._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(i){const f=i.getVisibleCoordinates();for(const _ of f){const v=i.getTile(_).getBucket(d);if(v&&(v.elevationType!=="none"?d.hasElevatedBuckets=!0:d.hasNonElevatedBuckets=!0,d.hasElevatedBuckets&&d.hasNonElevatedBuckets))break}}}else d.hasNonElevatedBuckets=!0},model:function(d,i,l){const f=i.getSource();if(!f.loaded())return;if(f.type==="vector"||f.type==="geojson")return void(l.modelManager&&l.modelManager.upload(l,f.type==="vector"?d.scope:""));if(f.type==="batched-model"||f.type!=="model")return;const _=f.getModels();for(const v of _)v.upload(l.context)},raster:function(d,i,l){const f=i.getSource();if(!(f instanceof zi&&f.loaded()))return;const _=d.sourceLayer||f.rasterLayerIds&&f.rasterLayerIds[0];if(!_)return;const v=d.paint.get("raster-array-band")||f.getInitialBand(_);if(v==null)return;const b=i.getIds().map(S=>i.getTileByID(S));for(const S of b)S.updateNeeded(d.id,v)&&f.prepareTile(S,_,d.id,v)},"raster-particle":function(d,i,l){const f=i.getSource();if(!(f instanceof zi&&f.loaded()))return;const _=d.sourceLayer||f.rasterLayerIds&&f.rasterLayerIds[0];if(!_)return;const v=d.paint.get("raster-particle-array-band")||f.getInitialBand(_);if(v==null)return;const b=i.getIds().map(S=>i.getTileByID(S));for(const S of b)S.updateNeeded(d.id,v)&&f.prepareTile(S,_,d.id,v)}},eg={fill:Jt},pa={fill:function(d,i,l,f){if(!l.layout||l.layout.get("fill-elevation-reference")==="none")return;const _=d.context.gl,v=new Yt(_.LEQUAL,Yt.ReadOnly,d.depthRangeFor3D),b=new Cr({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),S=d.transform.getFreeCameraOptions().position,C=d.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const k of f){const R=i.getTile(k),F=R.getBucket(l);if(!F)continue;const z=F.elevatedStructures;if(!z||z.depthSegments.segments[0].primitiveLength===0)continue;const N=Nf(k.toUnwrapped(),S),G=d.translatePosMatrix(k.projMatrix,R,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor")),U=Bm(G,N,0,1,0);C.draw(d,_.TRIANGLES,v,b,Br.disabled,vr.disabled,U,l.id,z.vertexBuffer,z.indexBuffer,z.depthSegments,l.paint,d.transform.zoom)}}};class tu{constructor(i,l,f,_,v,b){this.context=new $m(i,l),this.transform=f,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=v,this._timeStamp=s.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const S=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const k of S)this._debugParams.enabledLayers[k]=!0;v.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),v.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),v.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),v.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),v.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),v.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const k of S)v.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],k);this.occlusionParams=new ld(v),this.setup(),this.numSublayers=Ss.maxUnderzooming+Ss.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eE,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new vI(this),this._wireframeDebugCache=new $f,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const C=new s.r({width:1,height:1},Uint8Array.of(0,0,0,0));
2812this.emptyDepthTexture=new s.T(this.context,C,i.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=_,this.worldview=b}updateTerrain(i,l){const f=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(f||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Dm(this,i));const _=this._terrain;this.transform.elevation=f?_:null,_.update(i,this.transform,l),this.transform.elevation&&!_.enabled&&(this.transform.elevation=null)}_updateFog(i){const l=i.fog;if(!l||this.transform.projection.name==="globe"||l.getOpacity(this.transform.pitch)<1||l.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[f,_]=l.getFovAdjustedRange(this.transform._fov);if(f>_)return void(this.transform.fogCullDistSq=null);const v=f+.78*(_-f);this.transform.fogCullDistSq=v*v}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(i){i&&!this._terrain&&(this._terrain=new Dm(this,this.style)),this._forceTerrainMode=i}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(i,l){if(this.width=i*s.q.devicePixelRatio,this.height=l*s.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style.order)this.style._mergedLayers[f].resize()}setup(){const i=this.context,l=new s.ba;l.emplaceBack(0,0),l.emplaceBack(s.aj,0),l.emplaceBack(0,s.aj),l.emplaceBack(s.aj,s.aj),this.tileExtentBuffer=i.createVertexBuffer(l,s.bc.members),this.tileExtentSegments=s.bd.simpleSegment(0,0,4,2);const f=new s.ba;f.emplaceBack(0,0),f.emplaceBack(s.aj,0),f.emplaceBack(0,s.aj),f.emplaceBack(s.aj,s.aj),this.debugBuffer=i.createVertexBuffer(f,s.bc.members),this.debugSegments=s.bd.simpleSegment(0,0,4,5);const _=new s.ba;_.emplaceBack(-1,-1),_.emplaceBack(1,-1),_.emplaceBack(-1,1),_.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(_,s.bc.members),this.viewportSegments=s.bd.simpleSegment(0,0,4,2);const v=new s.aZ;v.emplaceBack(0,0,0,0),v.emplaceBack(s.aj,0,s.aj,0),v.emplaceBack(0,s.aj,0,s.aj),v.emplaceBack(s.aj,s.aj,s.aj,s.aj),this.mercatorBoundsBuffer=i.createVertexBuffer(v,s.bf.members),this.mercatorBoundsSegments=s.bd.simpleSegment(0,0,4,2);const b=new s.a_;b.emplaceBack(0,1,2),b.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(b);const S=new s.bb;for(const k of[0,1,3,2,0])S.emplaceBack(k);this.debugIndexBuffer=i.createIndexBuffer(S),this.emptyTexture=new s.T(i,new s.r({width:1,height:1},Uint8Array.of(0,0,0,0)),i.gl.RGBA8),this.identityMat=s.bz();const C=this.context.gl;this.stencilClearMode=new Cr({func:C.ALWAYS,mask:0},0,255,C.ZERO,C.ZERO,C.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const i=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,i.TRIANGLES,Yt.disabled,this.stencilClearMode,Br.disabled,vr.disabled,Lm(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(i,l,f){if(!l||this.currentStencilSource===l.id||!i.isTileClipped()||!f||f.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let S=!1;for(const C of f)if(this._tileClippingMaskIDs[C.key]===void 0){S=!0;break}if(!S)return}this.currentStencilSource=l.id;const _=this.context,v=_.gl;this.nextStencilID+f.length>256&&this.clearStencil(),_.setColorMode(Br.disabled),_.setDepthMode(Yt.disabled);const b=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const S of f){const C=l.getTile(S),k=this._tileClippingMaskIDs[S.key]=this.nextStencilID++,{tileBoundsBuffer:R,tileBoundsIndexBuffer:F,tileBoundsSegments:z}=this.getTileBoundsBuffers(C);b.draw(this,v.TRIANGLES,Yt.disabled,new Cr({func:v.ALWAYS,mask:0},k,255,v.KEEP,v.KEEP,v.REPLACE),Br.disabled,vr.disabled,Lm(S.projMatrix),"$clipping",R,F,z)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,l=this.context.gl;return new Cr({func:l.NOTEQUAL,mask:255},i,255,l.KEEP,l.KEEP,l.REPLACE)}stencilModeForClipping(i){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(i);const l=this.context.gl;return new Cr({func:l.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,l.KEEP,l.KEEP,l.REPLACE)}stencilConfigForOverlap(i){const l=this.context.gl,f=i.sort((b,S
2812)=>S.overscaledZ-b.overscaledZ),_=f[f.length-1].overscaledZ,v=f[0].overscaledZ-_+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const b={};for(let S=0;S<v;S++)b[S+_]=new Cr({func:l.GEQUAL,mask:255},S+this.nextStencilID,255,l.KEEP,l.KEEP,l.REPLACE);return this.nextStencilID+=v,[b,f]}return[{[_]:Cr.disabled},f]}colorModeForRenderPass(){const i=this.context.gl;return this._showOverdrawInspector?new Br([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new s.am(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Br.unblended:Br.alphaBlended}colorModeForDrapableLayerRenderPass(i){const l=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new Br([l.ONE,l.ONE_MINUS_SRC_ALPHA,l.CONSTANT_ALPHA,l.ONE_MINUS_SRC_ALPHA],new s.am(0,0,0,i===void 0?0:i),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(i,l,f,_=!1){if(this.depthOcclusion)return new Yt(this.context.gl.GREATER,Yt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!_)return Yt.disabled;const v=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new Yt(f||this.context.gl.LEQUAL,l,[v,v])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const i=this.context.gl,l=Math.ceil(this.width),f=Math.ceil(this.height),_=this.context.bindFramebuffer.get(),v=i.getParameter(i.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===l&&this.depthFBO.height===f||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),l!==0&&f!==0&&(this.depthFBO=new $u(this.context,l,f,!1,"texture"),this.depthTexture=new s.T(this.context,{width:l,height:f,data:null},i.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(_),i.bindTexture(i.TEXTURE_2D,v),this.depthFBO&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),i.blitFramebuffer(0,0,l,f,0,0,l,f,i.DEPTH_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((i,l)=>i+l/this._fpsHistory.length,0))}render(i,l){const f=s.q.now();this._dt=f-this._timeStamp,this._timeStamp=f,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=i.map.repaint,this.style=i,this.options=l;const _=this.style._mergedLayers,v=!(!this.terrain||!this.terrain.enabled),b=()=>this.style._getOrder(v).filter(We=>{const Pe=_[We];return!(Pe.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Pe.type]});let S=b(),C=!1,k=!1,R=null;for(const We of S){const Pe=_[We];Pe.type==="circle"?C=!0:Pe.type==="building"?R=Pe:Pe.type==="symbol"&&(Pe.hasInitialOcclusionOpacityProperties?k=!0:C=!0)}let F=S.map(We=>_[We]);const z=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(s.q.now()),this.imageManager.beginFrame();let N=0,G=!1;for(const We in z){const Pe=z[We];Pe.used&&(Pe.prepare(this.context),Pe.getSource().usedInConflation&&++N)}let U=!1;for(const We of F)We.isHidden(this.transform.zoom)||(We.type==="clip"&&(U=!0),this.prepareLayer(We));const W={},Z={},re={},se={},le={};for(const We in z){const Pe=z[We];W[We]=Pe.getVisibleCoordinates(),Z[We]=W[We].slice().reverse(),re[We]=Pe.getVisibleCoordinates(!0).reverse(),se[We]=Pe.getShadowCasterCoordinates(),le[We]=Pe.sortCoordinatesByDistance(W[We])}const fe=We=>{const Pe=this.style.getLayerSourceCache(We);return Pe&&Pe.used?Pe.getSource():null};if(N||U||this._clippingActiveLastFrame){const We=[],Pe=[];let nt=0;for(const Ke of F)this.isSourceForClippingOrConflation(Ke,fe(Ke))&&(We.push(Ke),Pe.push(nt)),nt++;if(We&&(U||We.length>1)||this._clippingActiveLastFrame){U=!1;const Ke=[];for(let vt=0;vt<We.length;vt++){const xt=We[vt],Et=Pe[vt],Bt=this.style.getLayerSourceCache(xt);if(!Bt||!Bt.used||!Bt.getSource().usedInConflation&&xt.type!=="clip"&&xt.type!=="building")continue;let ir=s.eF,ur=s.bW.None;const Zt=[];let ar=!0;if(xt.type==="building")ir=s.eH;else if(xt.type==="clip"){ir=Et;
2812for(const or of xt.layout.get("clip-layer-types"))ur|=or==="model"?s.bW.Model:or==="symbol"?s.bW.Symbol:s.bW.FillExtrusion;for(const or of xt.layout.get("clip-layer-scope"))Zt.push(or);xt.isHidden(this.transform.zoom)?ar=!1:U=!0}ar&&Ke.push({layer:xt.fqid,cache:Bt,order:ir,clipMask:ur,clipScope:Zt})}this.replacementSource.setSources(Ke),G=!0}}this._clippingActiveLastFrame=U,G||this.replacementSource.clear(),this.conflationActive=G,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let We=0;We<F.length;We++){const Pe=F[We],nt=Pe.cutoffRange();if(this.longestCutoffRange=Math.max(nt,this.longestCutoffRange),nt>0){const Ke=fe(Pe);Ke&&(this.minCutoffZoom=Math.max(Ke.minzoom,this.minCutoffZoom)),Pe.minzoom&&(this.minCutoffZoom=Math.max(Pe.minzoom,this.minCutoffZoom))}Pe.is3D(v)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=We),this._lastOcclusionLayer=We)}const we=this.style&&this.style.fog;we?(this._fogVisible=we.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=we.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(re),this.opaquePassCutoff=0,S=b(),F=S.map(We=>_[We]));const Se=this._shadowRenderer;if(Se){Se.updateShadowParameters(this.transform,this.style.directionalLight);for(const We in z)for(const Pe of W[We]){let nt={min:0,max:0};this.terrain&&(nt=this.terrain.getMinMaxForTile(Pe)||nt),Se.addShadowReceiver(Pe.toUnwrapped(),nt.min,nt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eG(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Ue(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const me=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),ge=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(me&&!this._snow&&(this._snow=new v0(this)),!me&&this._snow&&(this._snow.destroy(),delete this._snow),ge&&!this._rain&&(this._rain=new ud(this)),!ge&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),R){this.buildingTileBorderManager||(this.buildingTileBorderManager=new ow);const We=this.style.getLayerSourceCache(R);this.buildingTileBorderManager.updateBorders(We,R)}if(!ao.has(this.context.gl))return;this.renderPass="offscreen";for(const We of F){const Pe=i.getLayerSourceCache(We);if(!We.hasOffscreenPass()||We.isHidden(this.transform.zoom))continue;const nt=Pe?Z[Pe.id]:void 0;(We.type==="custom"||We.type==="raster"||We.type==="raster-particle"||We.isSky()||nt&&nt.length)&&this.renderLayer(this,Pe,We,nt)}this.depthRangeFor3D=[0,1-(F.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,se)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ye=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Ze=(()=>{if(l.showOverdrawInspector)return s.am.black;const We=this.style.fog;if(We&&this.transform.projection.supportsFog){const Pe=this.style.getLut(We.scope);if(!ye){const nt=We.properties.get("color-use-theme")==="none",Ke=We.properties.get("color").toNonPremultipliedRenderColor(nt?null:Pe).toArray01();return new s.am(...Ke)}if(ye){const nt=We.properties.get("space-color-use-theme")==="none",Ke=We.properties.get("space-color").toNonPremultipliedRenderColor(nt?null:Pe).toArray01();return new s.am(...Ke)}}return s.am.transparent})();if(this.context.clear({color:Ze,depth:1}),this.clearStencil(),this._showOverdrawInspector=l.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ye&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=S.length-1;this.currentLayer>=0;this.currentLayer--){const We=F[this.currentLayer],Pe=i.getLayerSourceCache(We);if(We.isSky())continue;const nt=Pe?(We.is3D(v)?le:Z)[Pe.id]:void 0;this._renderTileClippingMasks(We,Pe,nt),this.renderLayer(this,Pe,We,nt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ye&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isH
2812orizonVisible()))for(this.currentLayer=0;this.currentLayer<S.length;this.currentLayer++){const We=F[this.currentLayer],Pe=i.getLayerSourceCache(We);We.isSky()&&this.renderLayer(this,Pe,We,Pe?Z[Pe.id]:void 0)}function Me(We,Pe){let nt;return Pe&&(nt=(We.type==="symbol"?re:We.is3D(v)?le:Z)[Pe.id]),nt}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<S.length;){const We=F[this.currentLayer];if(We.type==="raster"||We.type==="raster-particle"){const Pe=i.getLayerSourceCache(We);this.renderLayer(this,Pe,We,Me(We,Pe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let ct=0;Se&&(ct=Se.getShadowCastingLayerCount());let Qe=!1,ft=-1;for(let We=0;We<S.length;++We){const Pe=F[We];Pe.isHidden(this.transform.zoom)||Pe.is3D(v)&&(ft=We)}k&&ft===-1&&(C=!0);let Rt=!1;for(;this.currentLayer<S.length;){const We=F[this.currentLayer],Pe=i.getLayerSourceCache(We);if(We.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(We)){if(We.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Rt&&We.is3D(v)&&!v){const nt=this.currentLayer,Ke=vt=>{for(this.currentLayer=0;this.currentLayer<F.length;this.currentLayer++){const xt=F[this.currentLayer];if(eg[xt.type]){const Et=this.style.getLayerSourceCache(xt);eg[xt.type](this,Et,xt,Me(xt,Et),vt)}}};Ke("initialize"),Ke("reset"),this.currentLayer=nt,Rt=!0}if(C&&!Qe&&this.terrain&&!this.transform.isOrthographic&&(Qe=!0,this.blitDepth()),k&&ft!==-1&&this.currentLayer===ft+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(We,Pe,Pe?W[Pe.id]:void 0),this.renderLayer(this,Pe,We,Me(We,Pe)),!this.terrain&&Se&&ct>0&&We.hasShadowPass()&&--ct==0){{this.clearStencil(),this.resetStencilClippingMasks();const nt=this.currentLayer;for(this.currentLayer=0;this.currentLayer<F.length;this.currentLayer++){const Ke=F[this.currentLayer];if(pa[Ke.type]){const vt=this.style.getLayerSourceCache(Ke);pa[Ke.type](this,vt,Ke,Me(Ke,vt))}}this.currentLayer=nt}if(Se.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const nt=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=nt;this.currentLayer++){const Ke=F[this.currentLayer];if(!Ke.hasLightBeamPass())continue;const vt=i.getLayerSourceCache(Ke);this.renderLayer(this,vt,Ke,vt?Z[vt.id]:void 0)}this.currentLayer=nt,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const nt=this.currentLayer;this.depthOcclusion=!0;for(const Ke of this.layersWithOcclusionOpacity){this.currentLayer=Ke;const vt=F[this.currentLayer],xt=i.getLayerSourceCache(vt),Et=xt?Z[xt.id]:void 0;this.terrain||this._renderTileClippingMasks(vt,xt,xt?W[xt.id]:void 0),this.renderLayer(this,xt,vt,Et)}this.depthOcclusion=!1,this.currentLayer=nt,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let We=null;F.forEach(Pe=>{const nt=i.getLayerSourceCache(Pe);nt&&!Pe.isHidden(this.transform.zoom)&&nt.getVisibleCoordinates().length&&(!We||We.getSource().maxzoom<nt.getSource().maxzoom)&&(We=nt)}),We&&this.options.showTileBoundaries&&Ll(this,We,We.getVisibleCoordinates(),s.am.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Ll(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.am(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(We){const Pe=We.transform.padding;Vf(We,We.transform.height-(Pe.top||0),3,tw),Vf(We,Pe.bottom||0,3,d0),Xm(We,Pe.left||0,3,f0),Xm(We,We.transform.width-(Pe.right||0),3,p0);const nt=We.transform.centerPoint;(function(Ke,vt,xt,Et){Uf(Ke,vt-1,xt-10,2,20,Et),Uf(Ke,vt-10,xt-1,20,2,Et)})(We,nt.x,We.transform.height-nt.y,rw)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
2812anvasCopy()),G||(this.conflationActive=!1)}prepareLayer(i){this.gpuTimingStart(i);const{unsupportedLayers:l}=this.transform.projection,f=!l||!l.includes(i.type);if(Qm[i.type]&&(f||this.terrain&&i.type==="custom")){const _=this.style.getLayerSourceCache(i);Qm[i.type](i,_,this)}this.gpuTimingEnd()}renderLayer(i,l,f,_){f.isHidden(this.transform.zoom)||(f.type==="background"||f.type==="sky"||f.type==="custom"||f.type==="model"||f.type==="raster"||f.type==="raster-particle"||_&&_.length)&&(this.id=f.id,this.gpuTimingStart(f),i.transform.projection.unsupportedLayers&&i.transform.projection.unsupportedLayers.includes(f.type)&&(!i.terrain||f.type!=="custom")||f.type==="clip"||x0[f.type](i,l,f,_,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;const l=this.context.extTimerQuery,f=this.context.gl;let _=this.gpuTimers[i.id];_||(_=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:f.createQuery()}),_.calls++,f.beginQuery(l.TIME_ELAPSED_EXT,_.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const i=this.context.extTimerQuery,l=this.context.gl,f=l.createQuery();this.deferredRenderGpuTimeQueries.push(f),l.beginQuery(i.TIME_ELAPSED_EXT,f)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){const i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){const l={};for(const f in i){const _=i[f],v=this.context.extTimerQuery,b=v.getQueryParameter(_.query,this.context.gl.QUERY_RESULT)/1e6;v.deleteQueryEXT(_.query),l[f]=b}return l}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;const l=this.context.gl;let f=0;for(const _ of i)f+=l.getQueryParameter(_,l.QUERY_RESULT)/1e6,l.deleteQuery(_);return f}translatePosMatrix(i,l,f,_,v){if(!f[0]&&!f[1])return i;const b=v?_==="map"?this.transform.angle:0:_==="viewport"?-this.transform.angle:0;if(b){const k=Math.sin(b),R=Math.cos(b);f=[f[0]*R-f[1]*k,f[0]*k+f[1]*R]}const S=[v?f[0]:s.aw(l,f[0],this.transform.zoom),v?f[1]:s.aw(l,f[1],this.transform.zoom),0],C=new Float32Array(16);return s.bo(C,i,S),C}saveTileTexture(i){if(i.context!==this.context)return;const l=i.size[0],f=this._tileTextures[l];f?f.push(i):this._tileTextures[l]=[i]}getTileTexture(i){const l=this._tileTextures[i];return l&&l.length>0?l.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(i,l,f){const _=f===void 0?this.terrain&&this.terrain.renderingToTexture:f,v=[];return this.style&&this.style.enable3dLights()&&(i==="globeRaster"||i==="terrainRaster"?(v.push("LIGHTING_3D_MODE"),v.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):_||v.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||v.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(v.push("TERRAIN"),this.linearFloatFilteringSupported()&&v.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&v.push("GLOBE"),!this._fogVisible||_||l!==void 0&&!l||v.push("FOG","FOG_DITHERING"),_&&v.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&v.push("OVERDRAW_INSPECTOR"),v}getOrCreateProgram(i,l){this.cache=this.cache||{};const f=l&&l.defines||[],_=l&&l.config,v=this.currentGlobalDefines(i,l&&l.overrideFog,l&&l.overrideRtt).concat(f),b=Fm.cacheKey(Lf[i],i,v,_);return this.cache[b]||(this.cache[b]=new Fm(this.context,i,Lf[i],_,Jb[i],v)),this.cache[b]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
vendor: 39,910 bytes, line 2812
2812stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(i,l){if(this.style.enable3dLights()){const f=this.style.directionalLight,_=this.style.ambientLight;if(f&&_){const v=((b,S,C)=>{const k=b.properties.get("direction"),R=b.properties.get("color-use-theme")==="none",F=b.properties.get("color").toNonPremultipliedRenderColor(R?null:C.getLut(b.scope)).toArray01(),z=b.properties.get("intensity"),N=S.properties.get("color-use-theme")==="none",G=S.properties.get("color").toNonPremultipliedRenderColor(N?null:C.getLut(S.scope)).toArray01(),U=S.properties.get("intensity"),W=[k.x,k.y,k.z],Z=s.dI(G,U),re=s.dI(F,z);return{u_lighting_ambient_color:Z,u_lighting_directional_dir:W,u_lighting_directional_color:re,u_ground_radiance:Xy(W,re,Z)}})(f,_,this.style);l.setLightsUniformValues(i,v)}}}uploadCommonUniforms(i,l,f,_,v){if(this.uploadCommonLightUniforms(i,l),this.terrain&&this.terrain.renderingToTexture)return;const b=this.style.fog;if(b){const S=b.getOpacity(this.transform.pitch),C=((k,R,F,z,N,G,U,W,Z,re,se,le)=>{const fe=k.transform,we=R.properties.get("color-use-theme")==="none",Se=R.properties.get("color").toNonPremultipliedRenderColor(we?null:k.style.getLut(R.scope)).toArray01();Se[3]=z;const me=k.frameCounter/1e3%1,[ge,ye]=R.properties.get("vertical-range");return{u_fog_matrix:F?fe.calculateFogTileMatrix(F):le||k.identityMat,u_fog_range:R.getFovAdjustedRange(fe._fov),u_fog_color:Se,u_fog_horizon_blend:R.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ge,ye),ye],u_fog_temporal_offset:me,u_frustum_tl:N,u_frustum_tr:G,u_frustum_br:U,u_frustum_bl:W,u_globe_pos:Z,u_globe_radius:re,u_viewport:se,u_globe_transition:s.ah(fe.zoom),u_is_globe:+(fe.projection.name==="globe")}})(this,b,f,S,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.q.devicePixelRatio,this.transform.height*s.q.devicePixelRatio],_);l.setFogUniformValues(i,C)}v&&l.setCutoffUniformValues(i,v.uniformValues)}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){const i=this.canvasCopy();i&&(this.frameCopies.push(i),this.tileLoaded=!1)}canvasCopy(){const i=this.context.gl,l=i.createTexture();return i.bindTexture(i.TEXTURE_2D,l),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),l}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const i=this.style&&this.style.fog;return!!i&&i.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const i=this._backgroundTiles,l=this._backgroundTiles={},f=this.transform.coveringTiles({tileSize:512});for(const _ of f)l[_.key]=i[_.key]||new ku(_,512,this.transform.tileZoom,this,void 0,this.worldview);return l}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(i,l){return!(!i.is3D(!(!this.terrain||!this.terrain.enabled))||i.type!=="clip"&&i.type!=="building"&&(i.minzoom&&i.minzoom>this.transform.zoom||(this.style._clipLayerPresent||i.sourceLayer!=="building"&&i.sourceLayer!=="procedural_buildings")&&(!l||l.type!=="batched-model")))}isTileAffectedByFog(i){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let l=this._cachedTileFogOpacities[i.key];return l||(this._cachedTileFogOpacities[i.key]=l=this.style.fog.getOpacityForTile(i)),l[0]>=Ge||l[1]>=Ge}setupDepthForOcclusion(i,l,f){const _=this.context,v=_.gl,b=!!f;var S;f||(f={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),_.activeTexture.set(v.TEXTURE3),i&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(v.NEAREST,v.CLAMP_TO_EDGE),f.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],f.u_depth_range_unpack=[2/((S=this.depthRangeFor3D)[1]-S[0]),-1-2*S[0]/(S[1]-S[0])],f.u_occluder_half_size=.5*this.occlusionParams.occluderSize,f.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(v.NEAREST,v.CLAMP_TO_EDGE),_.activeTexture.set(v.TEXTURE0),b||l.setTerrainUniformValues(_,f)}}function hd(d,i){let l=!1,f=null;const _=()=>{f=null,l&&(d(),f=setTimeout(_,i),l=!1)};return()=>(l=!0,f||_(),f)}class tg{constructor(i){this._hashName=i&&encodeURIComponent(i),s.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=hd(this._updateHashUnthrottled.bind(this),300)}addTo(i){return this._map=i,window.addEventListener("hashchange",this._onHashChange,!1),i.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const i=this._map;if(!i)return"";const l=rg(i);if(this._hashName){const f=this._hashName;let _=!1;const v=location.hash.slice(1).split("&").map(b=>{const S=b.split("=")[0];return S===f?(_=!0,`${S}=${l}`):b}).filter(b=>b);return _||v.push(`${f}=${l}`),`#${v.join("&")}`}return`#${l}`}_getCurrentHash(){const i=location.hash.replace("#","");if(this._hashName){let l;return i.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(l=f)}),(l&&l[1]||"").split("/")}return i.split("/")}_onHashChange(){const i=this._map;if(!i)return!1;const l=this._getCurrentHash();if(l.length>=3&&!l.some(f=>isNaN(Number(f)))){const f=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(l[3]||0):i.getBearing();return i.jumpTo({center:[+l[2],+l[1]],zoom:+l[0],bearing:f,pitch:+(l[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function rg(d,i){const l=d.getCenter(),f=Math.round(100*d.getZoom())/100,_=Math.ceil((f*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,_),b=Math.round(l.lng*v)/v,S=Math.round(l.lat*v)/v,C=d.getBearing(),k=d.getPitch();let R=i?`/${b}/${S}/${f}`:`${f}/${S}/${b}`;return(C||k)&&(R+="/"+Math.round(10*C)/10),k&&(R+=`/${Math.round(k)}`),R}const dd={linearity:.3,easing:s.eI(0,0,.3,1)},ru=s.h({deceleration:2500,maxSpeed:1400},dd),b0=s.h({deceleration:20,maxSpeed:1400},dd),Dl=s.h({deceleration:1e3,maxSpeed:360},dd),w0=s.h({deceleration:1e3,maxSpeed:90},dd);class ig{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.q.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,l=s.q.now();for(;i.length>0&&l-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const l={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)l.zoom+=v.zoomDelta||0,l.bearing+=v.bearingDelta||0,l.pitch+=v.pitchDelta||0,v.panDelta&&l.pan._add(v.panDelta),v.around&&(l.around=v.around),v.pinchAround&&(l.pinchAround=v.pinchAround);const f=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,_={};if(l.pan.mag()){const v=pd(l.pan.mag(),f,s.h({},ru,i||{}));_.offset=l.pan.mult(v.amount/l.pan.mag()),_.center=this._map.transform.center,fd(_,v)}if(l.zoom){const v=pd(l.zoom,f,b0);_.zoom=this._map.transform.zoom+v.amount,fd(_,v)}if(l.bearing){const v=pd(l.bearing,f,Dl);_.bearing=this._map.transform.bearing+s.ay(v.amount,-179,179),fd(_,v)}if(l.pitch){const v=pd(l.pitch,f,w0);_.pitch=this._map.transform.pitch+v.amount,fd(_,v)}if(_.zoom||_.bearing){const v=l.pinchAround===void 0?l.around:l.pinchAround;_.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),_.noMoveStart=!0,_}}function fd(d,i){(!d.duration||d.duration<i.duration)&&(d.duration=i.duration,d.easing=i.easing)}function pd(d,i,l){const{maxSpeed:f,linearity:_,deceleration:v}=l,b=s.ay(d*_/(i/1e3),-f,f),S=Math.abs(b)/(v*_);return{easing:l.easing,duration:1e3*S,amount:b*(S/2)}}class gn extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,l,f,_={}){const v=K(l.getCanvasContainer(),f),b=l.unproject(v);super(i,s.h({point:v,lngLat:b,originalEvent:f},_)),this._defaultPrevented=!1,this.target=l}}class md extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,l,f){const _=i==="touchend"?f.changedTouches:f.touches,v=ve(l.getCanvasContainer(),_),b=v.map(C=>l.unproject(C)),S=v.reduce((C,k,R,F)=>C.add(k.div(F.length)),new s.P(0,0));super(i,{points:v,point:S,lngLats:b,lngLat:l.unproject(S),originalEvent:f}),this._defaultPrevented=!1}}class T0 extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,l){super("wheel",{originalEvent:l}),this._defaultPrevented=!1}}class E0{constructor(i,l){this._map=i,this._clickTolerance=l.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new T0(this._map,i))}mousedown(i,l){return this._mousedownPos=l,this._firePreventable(new gn(i.type,this._map,i))}mouseup(i){this._map.fire(new gn(i.type,this._map,i))}preclick(i){const l=s.h({},i);l.type="preclick",this._map.fire(new gn(l.type,this._map,l))}click(i,l){this._mousedownPos&&this._mousedownPos.dist(l)>=this._clickTolerance||(this.preclick(i),this._map.fire(new gn(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new gn(i.type,this._map,i))}mouseover(i){this._map.fire(new gn(i.type,this._map,i))}mouseout(i){this._map.fire(new gn(i.type,this._map,i))}touchstart(i){return this._firePreventable(new md(i.type,this._map,i))}touchmove(i){this._map.fire(new md(i.type,this._map,i))}touchend(i){this._map.fire(new md(i.type,this._map,i))}touchcancel(i){this._map.fire(new md(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wu{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new gn(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new gn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new gn(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class S0{constructor(i,l){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=l.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,l){this.isEnabled()&&i.shiftKey&&i.button===0&&(ot(),this._startPos=this._lastPos=l,this._active=!0)}mousemoveWindow(i,l){if(!this._active)return;const f=l,_=this._startPos,v=this._lastPos;if(!_||!v||v.equals(f)||!this._box&&f.dist(_)<this._clickTolerance)return;this._lastPos=f,this._box||(this._box=pe("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));const b=Math.min(_.x,f.x),S=Math.max(_.x,f.x),C=Math.min(_.y,f.y),k=Math.max(_.y,f.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${b}px,${C}px)`,this._box.style.width=S-b+"px",this._box.style.height=k-C+"px")})}mouseupWindow(i,l){if(!this._active)return;const f=this._startPos,_=l;if(f&&i.button===0){if(this.reset(),It(),f.x!==_.x||f.y!==_.y)return this._map.fire(new s.A("boxzoomend",{originalEvent:i})),{cameraAnimation:v=>v.fitScreenCoordinates(f,_,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",i)}}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),et(),delete this._startPos,delete this._lastPos}_fireEvent(i,l){return this._map.fire(new s.A(i,{originalEvent:l}))}}function qf(d,i){const l={};for(let f=0;f<d.length;f++)l[d[f].identifier]=i[f];return l}class C0{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(i,l,f){(this.centroid||f.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=i.timeStamp),f.length===this.numTouches&&(this.centroid=function(_){const v=new s.P(0,0);for(const b of _)v._add(b);return v.div(_.length)}(l),this.touches=qf(f,l)))}touchmove(i,l,f){if(this.aborted||!this.centroid)return;const _=qf(f,l);for(const v in this.touches){const b=_[v];(!b||b.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(i,l,f){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),f.length===0){const _=!this.aborted&&this.centroid;if(this.reset(),_)return _}}}class iu{constructor(i){this.singleTap=new C0(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,l,f){this.singleTap.touchstart(i,l,f)}touchmove(i,l,f){this.singleTap.touchmove(i,l,f)}touchend(i,l,f){const _=this.singleTap.touchend(i,l,f);if(_){const v=i.timeStamp-this.lastTime<500,b=!this.lastTap||this.lastTap.dist(_)<30;if(v&&b||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=_,this.count===this.numTaps)return this.reset(),_}}}class I0{constructor(){this._zoomIn=new iu({numTouches:1,numTaps:2}),this._zoomOut=new iu({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,l,f){this._zoomIn.touchstart(i,l,f),this._zoomOut.touchstart(i,l,f)}touchmove(i,l,f){this._zoomIn.touchmove(i,l,f),this._zoomOut.touchmove(i,l,f)}touchend(i,l,f){const _=this._zoomIn.touchend(i,l,f),v=this._zoomOut.touchend(i,l,f);return _?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()+1,around:b.unproject(_)},{originalEvent:i})}):v?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()-1,around:b.unproject(v)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const A0={0:1,2:2},ng={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class gd{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(i,l){return!1}_move(i,l){return{}}mousedown(i,l){if(this._lastPoint)return;const f=Ae(i);this._correctButton(i,f)&&(this._lastPoint=l,this._eventButton=f)}mousemoveWindow(i,l){const f=this._lastPoint;if(f){if(i.preventDefault(),this._eventButton!=null&&function(_,v){const b=A0[v];return _.buttons===void 0||(_.buttons&b)!==b}(i,this._eventButton))this.reset();else if(this._moved||!(l.dist(f)<this._clickTolerance))return this._moved=!0,this._lastPoint=l,this._move(f,l)}}mouseupWindow(i){this._lastPoint&&Ae(i)===this._eventButton&&(this._moved&&It(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class P0 extends gd{mousedown(i,l){super.mousedown(i,l),this._lastPoint&&(this._active=!0)}_correctButton(i,l){return l===0&&!i.ctrlKey}_move(i,l){return{around:l,panDelta:l.sub(i)}}}class og extends gd{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?ng[i.pitchRotateKey]:void 0}_correctButton(i,l){return this._pitchRotateKey?l===0&&i[this._pitchRotateKey]:l===0&&i.ctrlKey||l===2}_move(i,l){const f=.8*(l.x-i.x);if(f)return this._active=!0,{bearingDelta:f}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class M0 extends gd{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?ng[i.pitchRotateKey]:void 0}_correctButton(i,l){return this._pitchRotateKey?l===0&&i[this._pitchRotateKey]:l===0&&i.ctrlKey||l===2}_move(i,l){const f=-.5*(l.y-i.y);if(f)return this._active=!0,{pitchDelta:f}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class cw{constructor(i,l){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=l.clickTolerance||1,this.reset(),s.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(i,l,f){return this._calculateTransform(i,l,f)}touchmove(i,l,f){if(this._active&&!(f.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(f.length===1&&!s.eJ())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return i.cancelable&&i.preventDefault(),this._calculateTransform(i,l,f)}}touchend(i,l,f){this._calculateTransform(i,l,f),this._active&&f.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,l,f){f.length>0&&(this._active=!0);const _=qf(f,l),v=new s.P(0,0),b=new s.P(0,0);let S=0;for(const k in _){const R=_[k],F=this._touches[k];F&&(v._add(R),b._add(R.sub(F)),S++,_[k]=R)}if(this._touches=_,S<this._minTouches||!b.mag())return;const C=b.div(S);return this._sum._add(C),this._sum.mag()<this._clickTolerance?void 0:{around:v.div(S),panDelta:C}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=pe("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class sg{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,l,f){return{}}touchstart(i,l,f){this._firstTwoTouches||f.length<2||(this._firstTwoTouches=[f[0].identifier,f[1].identifier],this._start([l[0],l[1]]))}touchmove(i,l,f){const _=this._firstTwoTouches;if(!_)return;i.preventDefault();const[v,b]=_,S=Zf(f,l,v),C=Zf(f,l,b);if(!S||!C)return;const k=this._aroundCenter?null:S.add(C).div(2);return this._move([S,C],k,i)}touchend(i,l,f){if(!this._firstTwoTouches)return;const[_,v]=this._firstTwoTouches,b=Zf(f,l,_),S=Zf(f,l,v);b&&S||(this._active&&It(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Zf(d,i,l){for(let f=0;f<d.length;f++)if(d[f].identifier===l)return i[f]}function k0(d,i){return Math.log(d/i)/Math.LN2}class uw extends sg{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,l){const f=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(k0(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:k0(this._distance,f),pinchAround:l}}}function R0(d,i){return 180*d.angleWith(i)/Math.PI}class hw extends sg{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,l){const f=this._vector;if(this._vector=i[0].sub(i[1]),f&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:R0(this._vector,f),pinchAround:l}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const l=25/(Math.PI*this._minDiameter)*360,f=this._startVector;if(!f)return!1;const _=R0(i,f);return Math.abs(_)<l}}function ag(d){return Math.abs(d.y)>Math.abs(d.x)}class dw extends sg{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(i){this._lastPoints=i,ag(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,l,f){const _=this._lastPoints;if(!_)return;const v=i[0].sub(_[0]),b=i[1].sub(_[1]);return this._map._cooperativeGestures&&!s.eJ()&&f.touches.length<3||(this._valid=this.gestureBeginsVertically(v,b,f.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:(v.y+b.y)/2*-.5})}gestureBeginsVertically(i,l,f){if(this._valid!==void 0)return this._valid;const _=i.mag()>=2,v=l.mag()>=2;if(!_&&!v)return;if(!_||!v)return this._firstMove==null&&(this._firstMove=f),f-this._firstMove<100&&void 0;const b=i.y>0==l.y>0;return ag(i)&&ag(l)&&b}}const fw={panStep:100,bearingStep:15,pitchStep:10};class pw{constructor(){const i=fw;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let l=0,f=0,_=0,v=0,b=0;switch(i.keyCode){case 61:case 107:case 171:case 187:l=1;break;case 189:case 109:case 173:l=-1;break;case 37:i.shiftKey?f=-1:(i.preventDefault(),v=-1);break;case 39:i.shiftKey?f=1:(i.preventDefault(),v=1);break;case 38:i.shiftKey?_=1:(i.preventDefault(),b=-1);break;case 40:i.shiftKey?_=-1:(i.preventDefault(),b=1);break;default:return}return this._rotationDisabled&&(f=0,_=0),{cameraAnimation:S=>{const C=S.getZoom();S.easeTo({duration:300,easeId:"keyboardHandler",easing:mw,zoom:l?Math.round(C)+l*(i.shiftKey?2:1):C,bearing:S.getBearing()+f*this._bearingStep,pitch:S.getPitch()+_*this._pitchStep,offset:[-v*this._panStep,-b*this._panStep],center:S.getCenter()},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function mw(d){return d*(2-d)}const gw=4.000244140625,UI=1/450;class jI{constructor(i,l){this._map=i,this._el=i.getCanvasContainer(),this._handler=l,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=UI,s.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(i.ctrlKey||i.metaKey||this.isZooming()||s.eJ()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let l=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const f=s.q.now(),_=f-(this._lastWheelEventTime||0);this._lastWheelEventTime=f,l!==0&&l%gw==0?this._type="wheel":l!==0&&Math.abs(l)<4?this._type="trackpad":_>400?(this._type=null,this._lastValue=l,this._timeout=window.setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(_*l)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,l+=this._lastValue)),i.shiftKey&&l&&(l/=4),this._type&&(this._lastWheelEvent=i,this._delta-=l,this._active||this._start(i)),i.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const l=K(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:l,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._map.transform;this._type==="wheel"&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const l=()=>i._terrainEnabled()&&this._aroundCoord?i.computeZoomRelativeTo(this._aroundCoord):i.zoom;if(this._delta!==0){const k=this._type==="wheel"&&Math.abs(this._delta)>gw?this._wheelZoomRate:this._defaultZoomRate;let R=2/(1+Math.exp(-Math.abs(this._delta*k)));this._delta<0&&R!==0&&(R=1/R);const F=l(),z=Math.pow(2,F),N=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):z;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(N*R))),this._type==="wheel"&&(this._startZoom=F,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:l(),_=this._startZoom,v=this._easing;let b,S=!1;if(this._type==="wheel"&&_&&v){const k=Math.min((s.q.now()-this._lastWheelEventTime)/200,1),R=v(k);b=s.ai(_,f,R),k<1?this._frameId||(this._frameId=!0):S=!0}else b=f,S=!0;this._active=!0,S&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let C=b-l();return C*this._lastDelta<0&&(C=0),{noInertia:!0,needsRenderFrame:!S,zoomDelta:C,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let l=s.eK;if(this._prevEase){const f=this._prevEase,_=(s.q.now()-f.start)/f.duration,v=f.easing(_+.01)-f.easing(_),b=.27/Math.sqrt(v*v+1e-4)*.01,S=Math.sqrt(.0729-b*b);l=s.eI(b,S,.25,1)}return this._prevEase={start:s.q.now(),duration:i,easing:l},l}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=pe("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class xn{constructor(i,l){this._clickZoom=i,this._tapZoom=l}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class _w{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,l){return i.preventDefault(),{cameraAnimation:f=>{f.easeTo({duration:300,zoom:f.getZoom()+(i.shiftKey?-1:1),around:f.unproject(l)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class GI{constructor(){this._tap=new iu({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(i,l,f){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?f.length>0&&(this._swipePoint=l[0],this._swipeTouch=f[0].identifier):this._tap.touchstart(i,l,f))}touchmove(i,l,f){if(this._tapTime){if(this._swipePoint){if(f[0].identifier!==this._swipeTouch)return;const _=l[0],v=_.y-this._swipePoint.y;return this._swipePoint=_,i.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(i,l,f)}touchend(i,l,f){this._tapTime?this._swipePoint&&f.length===0&&this.reset():this._tap.touchend(i,l,f)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class L0{constructor(i,l,f){this._el=i,this._mousePan=l,this._touchPan=f}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class $I{constructor(i,l,f){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=l,this._mousePitch=f}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Wf{constructor(i,l,f,_){this._el=i,this._touchZoom=l,this._touchRotate=f,this._tapDragZoom=_,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Xf=d=>d.zoom||d.drag||d.pitch||d.rotate;class z0 extends s.A{}class lg{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,l){const f=s.at([],l,i);this.radius=s.ae(f[2]<0?s.eM([],f,this.constants):[f[0],f[1],0])}projectRay(i){s.eM(i,i,this.constants),s.au(i,i),s.eN(i,i,this.constants);const l=s.c1([],i,this.radius);if(l[2]>0){const f=s.c1([],[0,0,1],s.bG(l,[0,0,1])),_=s.c1([],s.au([],[l[0],l[1],0]),this.radius),v=s.d5([],l,s.c1([],s.at([],s.d5([],_,f),l),2));l[0]=v[0],l[1]=v[1]}return l}}function Ua(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta}class cg{constructor(i,l){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ig(i),this._bearingSnap=l.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new lg,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(l),s.aV(["handleEvent","handleWindowEvent"],this);const f=this._el;this._listeners=[[f,"touchstart",{passive:!0}],[f,"touchmove",{passive:!1}],[f,"touchend",void 0],[f,"touchcancel",void 0],[f,"mousedown",void 0],[f,"mousemove",void 0],[f,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[f,"mouseover",void 0],[f,"mouseout",void 0],[f,"dblclick",void 0],[f,"click",void 0],[f,"keydown",{capture:!1}],[f,"keyup",void 0],[f,"wheel",{passive:!1}],[f,"contextmenu",void 0],[window,"blur",void 0]];for(const[_,v,b]of this._listeners){const S=_===document?this.handleWindowEvent:this.handleEvent;_.addEventListener(v,S,b)}}destroy(){for(const[i,l,f]of this._listeners){const _=i===document?this.handleWindowEvent:this.handleEvent;i.removeEventListener(l,_,f)}}_addDefaultHandlers(i){const l=this._map,f=l.getCanvasContainer();this._add("mapEvent",new E0(l,i));const _=l.boxZoom=new S0(l,i);this._add("boxZoom",_);const v=new I0,b=new _w;l.doubleClickZoom=new xn(b,v),this._add("tapZoom",v),this._add("clickZoom",b);const S=new GI;this._add("tapDragZoom",S);const C=l.touchPitch=new dw(l);this._add("touchPitch",C);const k=new og(i),R=new M0(i);l.dragRotate=new $I(i,k,R),this._add("mouseRotate",k,["mousePitch"]),this._add("mousePitch",R,["mouseRotate"]);const F=new P0(i),z=new cw(l,i);l.dragPan=new L0(f,F,z),this._add("mousePan",F),this._add("touchPan",z,["touchZoom","touchRotate"]);const N=new hw,G=new uw;l.touchZoomRotate=new Wf(f,G,N,S),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",G,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Wu(l));const U=l.scrollZoom=new jI(l,this);this._add("scrollZoom",U,["mousePan"]);const W=l.keyboard=new pw;this._add("keyboard",W);for(const Z of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])i.interactive&&i[Z]&&l[Z].enable(i[Z])}_add(i,l,f){this._handlers.push({handlerName:i,handler:l,allowed:f}),this._handlersById[i]=l}stop(i){if(!this._updatingCamera){for(const{handler:l}of this._handlers)l.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Xf(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(i,l,f){for(const _ in i)if(_!==f&&(!l||l.indexOf(_)<0))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){const l=[];for(const f of i)this._el.contains(f.target)&&l.push(f);return l}handleEvent(i,l){this._updatingCamera=!0;const f=i.type==="renderFrame",_=f?void 0:i,v={needsRenderFrame:!1},b={},S={},C=i.touches?this._getMapTouches(i.touches):void 0,k=C?ve(this._el,C):f?void 0:K(this._el,i);for(const{handlerName:z,handler:N,allowed:G}of this._handlers){if(!N.isEnabled())continue;let U;this._blockedByActive(S,G,z)?N.reset():N[l||i.type]&&(U=N[l||i.type](i,k,C),this.mergeHandlerResult(v,b,U,z,_),U&&U.needsRenderFrame&&this._triggerRenderFrame()),(U||N.isActive())&&(S[z]=N)}const R={};for(const z in this._previousActiveHandlers)S[z]||(R[z]=_);this._previousActiveHandlers=S,(Object.keys(R).length||Ua(v))&&(this._changes.push([v,b,R]),this._triggerRenderFrame()),(Object.keys(S).length||Ua(v))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:F}=v;F&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],F(this._map))}mergeHandlerResult(i,l,f,_,v){if(!f)return;s.h(i,f);const b={handlerName:_,originalEvent:f.originalEvent||v};f.zoomDelta!==void 0&&(l.zoom=b),f.panDelta!==void 0&&(l.drag=b),f.pitchDelta!==void 0&&(l.pitch=b),f.bearingDelta!==void 0&&(l.rotate=b)}_applyChanges(){const i={},l={},f={};for(const[_,v,b]of this._changes)_.panDelta&&(i.panDelta=(i.panDelta||new s.P(0,0))._add(_.panDelta)),_.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+_.zoomDelta),_.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+_.bearingDelta),_.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+_.pitchDelta),_.around!==void 0&&(i.around=_.around),_.aroundCoord!==void 0&&(i.aroundCoord=_.aroundCoord),_.pinchAround!==void 0&&(i.pinchAround=_.pinchAround),_.noInertia&&(i.noInertia=_.noInertia),s.h(l,v),s.h(f,b);this._updateMapTransform(i,l,f),this._changes=[]}_updateMapTransform(i,l,f){const _=this._map,v=_.transform,b=re=>[re.x,re.y,re.z];if((re=>{const se=this._eventsInProgress.drag;return se&&!this._handlersById[se.handlerName].isActive()})()&&!Ua(i)){const re=v.zoom;v.cameraElevationReference="sea",this._originalZoom!=null&&v._orthographicProjectionAtLowPitch&&v.projection.name!=="globe"&&v.pitch===0?(v.cameraElevationReference="ground",v.zoom=this._originalZoom):(v.recenterOnTerrain(),v.cameraElevationReference="ground"),re!==v.zoom&&this._map._update(!0)}if(v._isCameraConstrained&&_._stop(!0),!Ua(i))return void this._fireEvents(l,f,!0);let{panDelta:S,zoomDelta:C,bearingDelta:k,pitchDelta:R,around:F,aroundCoord:z,pinchAround:N}=i;v._isCameraConstrained&&(C>0&&(C=0),v._isCameraConstrained=!1),N!==void 0&&(F=N),(C||(re=>l[re]&&!this._eventsInProgress[re])("drag"))&&F&&(this._dragOrigin=b(v.pointCoordinate3D(F)),this._originalZoom=v.zoom,this._trackingEllipsoid.setup(v._camera.position,this._dragOrigin)),v.cameraElevationReference="sea",_._stop(!0),F=F||_.transform.centerPoint,k&&(v.bearing+=k),R&&(v.pitch+=R),v._updateCameraState();const G=[0,0,0];if(S)if(v.projection.name==="mercator"){const re=this._trackingEllipsoid.projectRay(v.screenPointToMercatorRay(F).dir),se=this._trackingEllipsoid.projectRay(v.screenPointToMercatorRay(F.sub(S)).dir);G[0]=se[0]-re[0],G[1]=se[1]-re[1]}else{const re=v.pointCoordinate(F);if(v.projection.name==="globe"){S=S.rotate(-v.angle);const se=v._pixelsPerMercatorPixel/v.worldSize;G[0]=-S.x*s.eL(s.aY(re.y))*se,G[1]=-S.y*s.eL(v.center.lat)*se}else{const se=v.pointCoordinate(F.sub(S));re&&se&&(G[0]=se.x-re.x,G[1]=se.y-re.y)}}const U=v.zoom,W=[0,0,0];if(C){const re=b(z||v.pointCoordinate3D(F)),se={dir:s.au([],s.at([],re,v._camera.position))};if(se.dir[2]<0){const le=v.zoomDeltaToMovement(re,C);s.c1(W,se.dir,le)}}const Z=s.d5(G,G,W);v._translateCameraConstrained(Z),C&&Math.abs(v.zoom-U)>1e-4&&v.recenterOnTerrain(),v.cameraElevationReference="ground",this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(l,f,!0)}_fireEvents(i,l,f){const _=Xf(this._eventsInProgress),v=Xf(i),b={};for(const R in i){const{originalEvent:F}=i[R];this._eventsInProgress[R]||(b[`${R}start`]=F),this._eventsInProgress[R]=i[R]}!_&&v&&this._fireEvent("movestart",v.originalEvent);for(const R in b)this._fireEvent(R,b[R]);v&&this._fireEvent("move",v.originalEvent);for(const R in i){const{originalEvent:F}=i[R];this._fireEvent(R,F)}const S={};let C;for(const R in this._eventsInProgress){const{handlerName:F,originalEvent:z}=this._eventsInProgress[R];this._handlersById[F].isActive()||(delete this._eventsInProgress[R],C=l[F]||z,S[`${R}end`]=C)}for(const R in S)this._fireEvent(R,S[R]);const k=Xf(this._eventsInProgress);if(f&&(_||v)&&!k){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;
2812R?(F(R.bearing||this._map.getBearing())&&(R.bearing=0),this._map.easeTo(R,{originalEvent:C})):(this._map.fire(new s.A("moveend",{originalEvent:C})),F(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,l){this._map.fire(new s.A(i,l?{originalEvent:l}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new z0("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Vn="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Ol extends s.E{constructor(i,l){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=l.bearingSnap,this._respectPrefersReducedMotion=l.respectPrefersReducedMotion!==!1,s.aV(["_renderFrameCallback"],this)}getCenter(){return new s.ci(this.transform.center.lng,this.transform.center.lat)}setCenter(i,l){return this.jumpTo({center:i},l)}panBy(i,l,f){return i=s.P.convert(i).mult(-1),this.panTo(this.transform.center,s.h({offset:i},l),f)}panTo(i,l,f){return this.easeTo(s.h({center:i},l),f)}getZoom(){return this.transform.zoom}setZoom(i,l){return this.jumpTo({zoom:i},l),this}zoomTo(i,l,f){return this.easeTo(s.h({zoom:i},l),f)}zoomIn(i,l){return this.zoomTo(this.getZoom()+1,i,l),this}zoomOut(i,l){return this.zoomTo(this.getZoom()-1,i,l),this}getBearing(){return this.transform.bearing}setBearing(i,l){return this.jumpTo({bearing:i},l),this}getPadding(){return this.transform.padding}setPadding(i,l){return this.jumpTo({padding:i},l),this}rotateTo(i,l,f){return this.easeTo(s.h({bearing:i},l),f)}resetNorth(i,l){return this.rotateTo(0,s.h({duration:1e3},i),l),this}resetNorthPitch(i,l){return this.easeTo(s.h({bearing:0,pitch:0,duration:1e3},i),l),this}snapToNorth(i,l){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,l):this}getPitch(){return this.transform.pitch}setPitch(i,l){return this.jumpTo({pitch:i},l),this}cameraForBounds(i,l){i=s.aG.convert(i);const f=l&&l.bearing||0,_=l&&l.pitch||0,v=i.getNorthWest(),b=i.getSouthEast();return this._cameraForBounds(this.transform,v,b,f,_,l)}_extendPadding(i){const l={top:0,right:0,bottom:0,left:0};return i==null?s.h({},l,this.transform.padding):typeof i=="number"?{top:i,bottom:i,right:i,left:i}:s.h({},l,i)}_extendCameraOptions(i){return(i=s.h({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(i,l){const f=l.max[0]-l.min[0],_=l.max[1]-l.min[1];return f/_>i.aspect?f/(2*Math.tan(.5*i.fovX)*i.aspect):_/(2*Math.tan(.5*i.fovY)*i.aspect)}_cameraForBoundsOnGlobe(i,l,f,_,v,b){const S=i.clone(),C=this._extendCameraOptions(b);S.bearing=_,S.pitch=v;const k=s.ci.convert(l),R=s.ci.convert(f),F=.5*(k.lat+R.lat),z=.5*(k.lng+R.lng),N=s.eO(F,z),G=s.au([],N),U=s.au([],s.bF([],G,[0,1,0])),W=s.bF([],U,G),Z=[U[0],U[1],U[2],0,W[0],W[1],W[2],0,G[0],G[1],G[2],0,0,0,0,1],re=[N,s.eO(k.lat,k.lng),s.eO(R.lat,k.lng),s.eO(R.lat,R.lng),s.eO(k.lat,R.lng),s.eO(F,k.lng),s.eO(F,R.lng),s.eO(k.lat,z),s.eO(R.lat,z)];let se=s.d6.fromPoints(re.map(Ke=>[s.bG(U,Ke),s.bG(W,Ke),s.bG(G,Ke)]));const le=s.ad([],se.center,Z);s.eP(le)===0&&s.eQ(le,0,0,1),s.au(le,le),s.c1(le,le,s.aB),S.center=s.eR(le);const fe=S.getWorldToCameraMatrix(),we=s.bi(new Float64Array(16),fe);se=s.d6.applyTransform(se,s.az([],fe,Z));const Se=this._extendAABB(se,S,C,_);if(!Se)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");se=Se,s.ad(le,le,fe);const me=.5*(se.max[2]-se.min[2]),ge=this._minimumAABBFrustumDistance(S,se),ye=s.c1([],[0,0,1],me),Ze=s.d5(ye,le,ye),Me=ge+(S.pitch===0?0:s.bD(le,Ze)),ct=S.globeCenterInViewSpace,Qe=s.at([],le,[ct[0],ct[1],ct[2]]);s.au(Qe,Qe),s.c1(Qe,Qe,Me);const ft=s.d5([],le,Qe);s.ad(ft,ft,we);const Rt=s.eB/s.aB,We=s.ae(ft),Pe=s.cb(Math.max(We*Rt-s.eB,Number.EPSILON),0),nt=Math.min(S.zoomFromMercatorZAdjusted(Pe),C.maxZoom);return nt>.5*(s.cX+s.cI)?(S.setProjection({name:"mercator"}),S.zoom=nt,this._cameraForBounds(S,l,f,_,v,b)):{center:S.center,zoom:nt,bearing:_,pitch:v}}_extendAABB(i,l,f,_){const v=.5*((f.padding.left||0)+(f.padding.right||0)),b=.5*((f.padding.top||0)+(f.padding.bottom||0)),S=b,C=v,k=v,R=b,F=l.width-(C+k),z=l.height-(S+R),N=s.at([],i.max,i.min),G=Math.min(F/N[0],z/N[1]),U=Math.min(l.scaleZoom(l.scale*G),f.maxZoom);if(isNaN(U))return null;const W=l.scale/l.zoomScale(U),Z=new s.d6([i.min[0]-C*W,i.min[1]-R*W,i.min[2]],[i.max[0]+k*W,i.max[1]+S*W,i.max[2]]),re=(typeof f.offset.x=="number"&&typeof f.offset.y=="number"?new s.P(f.offset.x,f.offset.y):s.P.convert(f.offset)).rotate(-s.al(_));return Z.center[0]-=re.x*W,Z.center[1]+=re.y*W,Z}queryTerrainElevation(i,l){const f=this.transform.elevation;return f?(l=s.h({},{exaggerated:!0},l),f.getAtPoint(s.ac.fromLngLat(i),null,l.exaggerated)):null}_cameraForBounds(i,l,f,_,v,b){if(i.projection.name==="globe")return this._cameraForBoundsOnGlobe(i,l,f,_,v,b);const S=i.clone(),C=this._extendCameraOptions(b);S.bearing=_,S.pitch=v;
vendor: 12,173 bytes, line 2812
2812const k=s.ci.convert(l),R=s.ci.convert(f),F=new s.ci(k.lng,R.lat),z=new s.ci(R.lng,k.lat),N=S.project(k),G=S.project(R),U=this.queryTerrainElevation(k),W=this.queryTerrainElevation(R),Z=this.queryTerrainElevation(F),re=this.queryTerrainElevation(z),se=[[N.x,N.y,Math.min(U||0,W||0,Z||0,re||0)],[G.x,G.y,Math.max(U||0,W||0,Z||0,re||0)]];let le=s.d6.fromPoints(se);const fe=S.getWorldToCameraMatrix(),we=s.bi(new Float64Array(16),fe);le=s.d6.applyTransform(le,fe);const Se=this._extendAABB(le,S,C,_);if(!Se)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");le=Se;const me=.5*s.at([],le.max,le.min)[2],ge=this._minimumAABBFrustumDistance(S,le),ye=[0,0,1,0];s.aA(ye,ye,fe),s.eS(ye,ye);const Ze=s.c1([],ye,ge+me),Me=s.d5([],le.center,Ze);s.ad(le.center,le.center,we),s.ad(Me,Me,we);const ct=S.unproject(new s.P(le.center[0],le.center[1])),Qe=s.eT(S.projection,ct),ft=Math.pow(2,Qe),Rt=Math.min(S._zoomFromMercatorZ(Me[2]*S.pixelsPerMeter*ft/S.worldSize),C.maxZoom);return S.mercatorFromTransition&&Rt<.5*(s.cX+s.cI)?(S.setProjection({name:"globe"}),S.zoom=Rt,this._cameraForBounds(S,l,f,_,v,b)):{center:ct,zoom:Rt,bearing:_,pitch:v}}fitBounds(i,l,f){const _=this.cameraForBounds(i,l);return this._fitInternal(_,l,f)}fitScreenCoordinates(i,l,f,_,v){const b=s.P.convert(i),S=s.P.convert(l),C=new s.P(Math.min(b.x,S.x),Math.min(b.y,S.y)),k=new s.P(Math.max(b.x,S.x),Math.max(b.y,S.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(b,S))return this;const R=this.transform.pointLocation3D(C),F=this.transform.pointLocation3D(k),z=this.transform.pointLocation3D(new s.P(C.x,k.y)),N=this.transform.pointLocation3D(new s.P(k.x,C.y)),G=[Math.min(R.lng,F.lng,z.lng,N.lng),Math.min(R.lat,F.lat,z.lat,N.lat)],U=[Math.max(R.lng,F.lng,z.lng,N.lng),Math.max(R.lat,F.lat,z.lat,N.lat)],W=_&&_.pitch?_.pitch:this.getPitch(),Z=this._cameraForBounds(this.transform,G,U,f,W,_);return this._fitInternal(Z,_,v)}_fitInternal(i,l,f){return i?(l=s.h(i,l)).linear?this.easeTo(l,f):this.flyTo(l,f):this}jumpTo(i,l){this.stop();const f=i.preloadOnly?this.transform.clone():this.transform;let _=!1,v=!1,b=!1;"zoom"in i&&f.zoom!==+i.zoom&&(_=!0,f.zoom=+i.zoom),i.center!==void 0&&(f.center=s.ci.convert(i.center)),"bearing"in i&&f.bearing!==+i.bearing&&(v=!0,f.bearing=+i.bearing),"pitch"in i&&f.pitch!==+i.pitch&&(b=!0,f.pitch=+i.pitch);const S=typeof i.padding=="number"?this._extendPadding(i.padding):i.padding;if(i.padding!=null&&!f.isPaddingEqual(S))if(i.retainPadding===!1){const C=f.clone();C.padding=S,f.setLocationAtPoint(f.center,C.centerPoint)}else f.padding=S;return i.preloadOnly?(this._preloadTiles(f),this):(this.fire(new s.A("movestart",l)).fire(new s.A("move",l)),_&&this.fire(new s.A("zoomstart",l)).fire(new s.A("zoom",l)).fire(new s.A("zoomend",l)),v&&this.fire(new s.A("rotatestart",l)).fire(new s.A("rotate",l)).fire(new s.A("rotateend",l)),b&&this.fire(new s.A("pitchstart",l)).fire(new s.A("pitch",l)).fire(new s.A("pitchend",l)),this.fire(new s.A("moveend",l)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(Vn),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,l){const f=this.transform;if(!f.projection.supportsFreeCamera)return s.w(Vn),this;this.stop();const _=f.zoom,v=f.pitch,b=f.bearing;f.setFreeCameraOptions(i);const S=_!==f.zoom,C=v!==f.pitch,k=b!==f.bearing;return this.fire(new s.A("movestart",l)).fire(new s.A("move",l)),S&&this.fire(new s.A("zoomstart",l)).fire(new s.A("zoom",l)).fire(new s.A("zoomend",l)),k&&this.fire(new s.A("rotatestart",l)).fire(new s.A("rotate",l)).fire(new s.A("rotateend",l)),C&&this.fire(new s.A("pitchstart",l)).fire(new s.A("pitch",l)).fire(new s.A("pitchend",l)),this.fire(new s.A("moveend",l)),this}easeTo(i,l){this._stop(!1,i.easeId),((i=s.h({offset:[0,0],duration:500,easing:s.eK},i)).animate===!1||this._prefersReducedMotion(i))&&(i.duration=0);const f=this.transform,_=this.getZoom(),v=this.getBearing(),b=this.getPitch(),S=this.getPadding(),C="zoom"in i?+i.zoom:_,k="bearing"in i?this._normalizeBearing(i.bearing,v):v,R="pitch"in i?+i.pitch:b,F=this._extendPadding(i.padding),z=s.P.convert(i.offset);let N,G,U;if(f.projection.name==="globe"){const ye=s.ac.fromLngLat(f.center),Ze=z.rotate(-f.angle);ye.x+=Ze.x/f.worldSize,ye.y+=Ze.y/f.worldSize;const Me=ye.toLngLat(),ct=s.ci.convert(i.center||Me);this._normalizeCenter(ct),N=f.centerPoint.add(Ze),G=new s.P(ye.x,ye.y).mult(f.worldSize),U=new s.P(s.aD(ct.lng),s.aH(ct.lat)).mult(f.worldSize).sub(G)}else{N=f.centerPoint.add(z);const ye=f.pointLocation(N),Ze=s.ci.convert(i.center||ye);this._normalizeCenter(Ze),G=f.project(ye),U=f.project(Ze).sub(G)}const W=f.zoomScale(C-_);let Z,re;i.around&&(Z=s.ci.convert(i.around),re=f.locationPoint(Z));const se=this._zooming||C!==_,le=this._rotating||v!==k,fe=this._pitching||R!==b,we=!f.isPaddingEqual(F),Se=i.retainPadding===!1?f.clone():f,me=ye=>Ze=>{if(se&&(ye.zoom=s.ai(_,C,Ze)),le&&(ye.bearing=s.ai(v,k,Ze)),fe&&(ye.pitch=s.ai(b,R,Ze)),we&&(Se.interpolatePadding(S,F,Ze),N=Se.centerPoint.add(z)),Z)ye.setLocationAtPoint(Z,re);else{const Me=ye.zoomScale(ye.zoom-_),ct=C>_?Math.min(2,W):Math.max(.5,W),Qe=Math.pow(ct,1-Ze),ft=ye.unproject(G.add(U.mult(Ze*Qe)).mult(Me));ye.setLocationAtPoint(ye.renderWorldCopies?ft.wrap():ft,N)}return i.preloadOnly||this._fireMoveEvents(l),ye};if(i.preloadOnly){const ye=this._emulate(me,i.duration,f);return this._preloadTiles(ye),this}const ge={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=se,this._rotating=le,this._pitching=fe,this._padding=we,this._easeId=i.easeId,this._prepareEase(l,i.noMoveStart,ge),this._ease(me(f),ye=>{f.cameraElevationReference==="sea"&&f.recenterOnTerrain(),this._afterEase(l,ye)},i),this}_prepareEase(i,l,f={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),l||f.moving||this.fire(new s.A("movestart",i)),this._zooming&&!f.zooming&&this.fire(new s.A("zoomstart",i)),this._rotating&&!f.rotating&&this.fire(new s.A("rotatestart",i)),this._pitching&&!f.pitching&&this.fire(new s.A("pitchstart",i))}_fireMoveEvents(i){this.fire(new s.A("move",i)),this._zooming&&this.fire(new s.A("zoom",i)),this._rotating&&this.fire(new s.A("rotate",i)),this._pitching&&this.fire(new s.A("pitch",i))}_afterEase(i,l){if(this._easeId&&l&&this._easeId===l)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const f=this._zooming,_=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,f&&this.fire(new s.A("zoomend",i)),_&&this.fire(new s.A("rotateend",i)),v&&this.fire(new s.A("pitchend",i)),this.fire(new s.A("moveend",i))}flyTo(i,l){if(this._prefersReducedMotion(i)){const Ke=s.aF(i,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ke,l)}this.stop(),i=s.h({offset:[0,0],speed:1.2,curve:1.42,easing:s.eK},i);const f=this.transform,_=this.getZoom(),v=this.getBearing(),b=this.getPitch(),S=this.getPadding(),C="zoom"in i?s.ay(+i.zoom,f.minZoom,f.maxZoom):_,k="bearing"in i?this._normalizeBearing(i.bearing,v):v,R="pitch"in i?+i.pitch:b,F=this._extendPadding(i.padding),z=f.zoomScale(C-_),N=s.P.convert(i.offset);let G=f.centerPoint.add(N);const U=f.pointLocation(G),W=s.ci.convert(i.center||U);this._normalizeCenter(W);const Z=f.project(U),re=f.project(W).sub(Z);let se=i.curve;const le=Math.max(f.width,f.height),fe=le/z,we=re.mag();if("minZoom"in i){const Ke=s.ay(Math.min(i.minZoom,_,C),f.minZoom,f.maxZoom),vt=le/f.zoomScale(Ke-_);se=Math.sqrt(vt/we*2)}const Se=se*se;function me(Ke){const vt=(fe*fe-le*le+(Ke?-1:1)*Se*Se*we*we)/(2*(Ke?fe:le)*Se*we);return Math.log(Math.sqrt(vt*vt+1)-vt)}function ge(Ke){return(Math.exp(Ke)-Math.exp(-Ke))/2}function ye(Ke){return(Math.exp(Ke)+Math.exp(-Ke))/2}const Ze=me(0);let Me=function(Ke){return ye(Ze)/ye(Ze+se*Ke)},ct=function(Ke){return le*((ye(Ze)*(ge(vt=Ze+se*Ke)/ye(vt))-ge(Ze))/Se)/we;var vt},Qe=(me(1)-Ze)/se;if(Math.abs(we)<1e-6||!isFinite(Qe)){if(Math.abs(le-fe)<1e-6)return this.easeTo(i,l);const Ke=fe<le?-1:1;Qe=Math.abs(Math.log(fe/le))/se,ct=function(){return 0},Me=function(vt){return Math.exp(Ke*se*vt)}}i.duration="duration"in i?+i.duration:1e3*Qe/("screenSpeed"in i?+i.screenSpeed/se:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0);const ft=v!==k,Rt=R!==b,We=!f.isPaddingEqual(F),Pe=i.retainPadding===!1?f.clone():f,nt=Ke=>vt=>{const xt=vt*Qe,Et=1/Me(xt);Ke.zoom=vt===1?C:_+Ke.scaleZoom(Et),ft&&(Ke.bearing=s.ai(v,k,vt)),Rt&&(Ke.pitch=s.ai(b,R,vt)),We&&(Pe.interpolatePadding(S,F,vt),G=Pe.centerPoint.add(N));const Bt=vt===1?W:Ke.unproject(Z.add(re.mult(ct(xt))).mult(Et));return Ke.setLocationAtPoint(Ke.renderWorldCopies?Bt.wrap():Bt,G),Ke._updateCameraOnTerrain(),i.preloadOnly||this._fireMoveEvents(l),Ke};if(i.preloadOnly){const Ke=this._emulate(nt,i.duration,f);return this._preloadTiles(Ke),this}return this._zooming=!0,this._rotating=ft,this._pitching=Rt,this._padding=We,this._prepareEase(l,!1),this._ease(nt(f),()=>this._afterEase(l),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(i){}_cancelRenderFrame(i){}_stop(i,l){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const f=this._onEaseEnd;this._onEaseEnd=void 0,f.call(this,l)}if(!i){const f=this.handlers;f&&f.stop(!1)}return this}_ease(i,l,f){f.animate===!1||f.duration===0?(i(1),l()):(this._easeStart=s.q.now(),this._easeOptions=f,this._onEaseFrame=i,this._onEaseEnd=l,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const i=Math.min((s.q.now()-this._easeStart)/this._easeOptions.duration,1),l=this._onEaseFrame;l&&l(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,l){i=s.bQ(i,-180,180);const f=Math.abs(i-l);return Math.abs(i-360-l)<f&&(i-=360),Math.abs(i+360-l)<f&&(i+=360),i}_normalizeCenter(i){const l=this.transform;if(l.maxBounds||l.projection.name!=="globe"&&!l.renderWorldCopies)return;const f=i.lng-l.center.lng;i.lng+=f>180?-360:f<-180?360:0}_prefersReducedMotion(i){return this._respectPrefersReducedMotion&&s.q.prefersReducedMotion&&!(i&&i.essential)}_emulate(i,l,f){const _=Math.ceil(15*l/1e3),v=[],b=i(f.clone());for(let S=0;S<=_;S++){const C=b(S/_);v.push(C.clone())}return v}_preloadTiles(i,l){}}class _d{constructor(i={}){this.options=i,s.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){const l=this.options&&this.options.compact,f=i._getUIString("AttributionControl.ToggleAttribution");this._map=i,this._container=pe("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=pe("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",f);const _=pe("span","mapboxgl-ctrl-icon",this._compactButton);return _.setAttribute("aria-hidden","true"),_.setAttribute("title",f),this._innerContainer=pe("div","mapboxgl-ctrl-attrib-inner",this._container),l&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),l===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
2812se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let i=this._editLink;i||(i=this._editLink=this._container.querySelector(".mapbox-improve-map"));const l=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.e.ACCESS_TOKEN}];if(i){const f=l.reduce((_,v,b)=>(v.value&&(_+=`${v.key}=${v.value}${b<l.length-1?"&":""}`),_),"?");i.href=`${s.e.FEEDBACK_URL}/${f}#${rg(this._map,!0)}`,i.rel="noopener nofollow"}}_updateData(i){!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){const _=this._map.style.stylesheet;this.styleOwner=_.owner,this.styleId=_.id}const l=this._map.style._mergedSourceCaches;for(const _ in l){const v=l[_];if(v.used){const b=v.getSource();b.attribution&&i.indexOf(b.attribution)<0&&i.push(b.attribution)}}i.sort((_,v)=>_.length-v.length),i=i.filter((_,v)=>{for(let b=v+1;b<i.length;b++)if(i[b].indexOf(_)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));const f=i.join(" | ");f!==this._attribHTML&&(this._attribHTML=f,i.length?(this._innerContainer.innerHTML=f,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Yf{constructor(){s.aV(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=pe("div","mapboxgl-ctrl");const l=pe("a","mapboxgl-ctrl-logo");return l.target="_blank",l.rel="noopener nofollow",l.href="https://www.mapbox.com/",l.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),l.setAttribute("rel","noopener nofollow"),this._container.appendChild(l),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&i.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const i=this._map.style._sourceCaches;if(Object.entries(i).length===0)return!0;for(const l in i){const f=i[l].getSource();if(f.hasOwnProperty("mapbox_logo")&&!f.mapbox_logo)return!1}return!0}_updateCompact(){const i=this._container.children;if(i.length){const l=i[0];this._map.getCanvasContainer().offsetWidth<250?l.classList.add("mapboxgl-compact"):l.classList.remove("mapboxgl-compact")}}}class D0{constructor(){s.aV(["_onIndoorUpdate"],this)}onAdd(i){return this._map=i,this._container=pe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("indoorupdate",l=>this._onIndoorUpdate({selectedFloorId:l.selectedFloorId,floors:l.floors})),this._container}_createButton(i,l){const f=pe("button",i,this._container);return f.type="button",f.addEventListener("click",l),f}_setButtonTitle(i,l){this._map&&(i.setAttribute("aria-label",l),i.innerHTML=`<strong>${l}</strong>`,i.firstElementChild&&i.firstElementChild.setAttribute("title",l))}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("indoorupdate",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(i){if(!i||!i.floors)return void(this._container.style.display="none");const l=this._model;this._model=i,this._container.style.display="inline-block";const f=i.floors.sort((_,v)=>_.levelOrder-v.levelOrder);
2812l?(Array.from(this._container.children).forEach(_=>_.remove()),this.addCurrentFloors(f)):this.addCurrentFloors(f)}addCurrentFloors(i){for(const l of i){const f=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(l.id),Array.from(this._container.children).forEach(_=>{_.classList.remove("mapboxgl-ctrl-level-button-selected")}),f.classList.add("mapboxgl-ctrl-level-button-selected")});this._setButtonTitle(f,l.shortName),this._model&&l.id===this._model.selectedFloorId&&(this._map._selectIndoorFloor(l.id),f.classList.add("mapboxgl-ctrl-level-button-selected")),this._container.append(f)}}}class yw{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const l=++this._id;return this._queue.push({callback:i,id:l,cancelled:!1}),l}remove(i){const l=this._currentlyRunning,f=l?this._queue.concat(l):this._queue;for(const _ of f)if(_.id===i)return void(_.cancelled=!0)}run(i=0){const l=this._currentlyRunning=this._queue;this._queue=[];for(const f of l)if(!f.cancelled&&(f.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Kf{constructor(i){this.jumpTo(i)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;const l=s.dx((i-this._startTime)/(this._endTime-this._startTime));return this._start*(1-l)+this._end*l}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,l,f){this._start=this.getValue(l),this._end=i,this._startTime=l,this._endTime=l+f}}const HI={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class vw extends s.A{constructor(i,l,f,_){const{point:v,lngLat:b,originalEvent:S,target:C}=i;super(i.type,{point:v,lngLat:b,originalEvent:S,target:C}),this.preventDefault=()=>{i.preventDefault()},this.id=l,this.interaction=f,this.feature=_}}class O0{constructor(i){this.map=i,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(i,l){if(this.typeById.has(i))throw new Error(`Interaction id "${i}" already exists.`);const f=l.filter;let _=l.type;f&&this.filters.set(i,s.b3(f)),_==="mouseover"&&(_="mouseenter"),_==="mouseout"&&(_="mouseleave");const v=this.interactionsByType.get(_)||new Map;_==="mouseenter"||_==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(i,l)):v.size===0&&this.map.on(_,this.handleType),v.size===0&&this.interactionsByType.set(_,v),v.set(i,l),this.typeById.set(i,_)}get(i){const l=this.typeById.get(i);if(!l)return;const f=this.interactionsByType.get(l);return f?f.get(i):void 0}remove(i){const l=this.typeById.get(i);if(!l)return;this.typeById.delete(i),this.filters.delete(i);const f=this.interactionsByType.get(l);f&&(f.delete(i),l==="mouseenter"||l==="mouseleave"?(this.delegatedInteractions.delete(i),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):f.size===0&&this.map.off(l,this.handleType))}queryTargets(i,l){const f=[];for(const[_,v]of l)v.target&&f.push({targetId:_,target:v.target,filter:this.filters.get(_)});return this.map.style.queryRenderedTargets(i,f,this.map.transform)}handleMove(i){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const l=this.queryTargets(i.point,Array.from(this.delegatedInteractions).reverse());l.length&&(i.type="mouseenter",this.handleType(i,l));const f=new Map;for(const[_,{feature:v}]of this.prevHoveredFeatures)this.hoveredFeatures.has(_)||f.set(v.id,v);f.size&&(i.type="mouseleave",this.handleType(i,Array.from(f.values())
vendor: 4,900 bytes, line 2812
2812))}handleOut(i){const l=Array.from(this.hoveredFeatures.values()).map(({feature:f})=>f);l.length&&(i.type="mouseleave",this.handleType(i,l)),this.hoveredFeatures.clear()}handleType(i,l){const f=i.type==="mouseenter";if(f&&!this.interactionsByType.has(i.type))return void s.w("mouseenter interaction required for mouseleave to work.");const _=Array.from(this.interactionsByType.get(i.type)).reverse(),v=!!l;l=l||this.queryTargets(i.point,_);let b=!1;const S=new Set;for(const C of l){for(const[k,R]of _){if(!R.target)continue;const F=C.variants?C.variants[k]:null;if(F){for(const z of F){if(Pu(z,C,S,k))continue;const N=new s.dr(C,z),G=Es(z,C,k);v&&(N.state=this.map.getFeatureState(N));const U=f?this.prevHoveredFeatures.get(G):null,W=new vw(i,k,R,N),Z=U?U.stop:R.handler(W);if(f&&this.hoveredFeatures.set(G,{feature:C,stop:Z}),Z!==!1){b=!0;break}}if(b)break}}if(b)break}if(!b)for(const[C,k]of _){const{handler:R,target:F}=k;if(!F&&R(new vw(i,C,k,null))!==!1)break}}}function F0(d,i){if(Array.isArray(d)&&Array.isArray(i)){const l=new Set(d),f=new Set(i);return l.size===f.size&&d.every(_=>f.has(_))}return s.bv(d,i)}const Jf={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},yd={showCompass:!0,showZoom:!0,visualizePitch:!1};class dc{constructor(i,l,f=!1){this._clickTolerance=10,this.element=l,this.mouseRotate=new og({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,f&&(this.mousePitch=new M0({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),s.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),l.addEventListener("mousedown",this.mousedown),l.addEventListener("touchstart",this.touchstart,{passive:!1}),l.addEventListener("touchmove",this.touchmove),l.addEventListener("touchend",this.touchend),l.addEventListener("touchcancel",this.reset)}down(i,l){this.mouseRotate.mousedown(i,l),this.mousePitch&&this.mousePitch.mousedown(i,l),ot()}move(i,l){const f=this.map,_=this.mouseRotate.mousemoveWindow(i,l),v=_&&_.bearingDelta;if(v&&f.setBearing(f.getBearing()+v),this.mousePitch){const b=this.mousePitch.mousemoveWindow(i,l),S=b&&b.pitchDelta;S&&f.setPitch(f.getPitch()+S)}}off(){const i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){et(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(s.h({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),K(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,K(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){i.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ve(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){i.targetTouches.length!==1?this.reset():(this._lastPos=ve(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){i.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function ja(d,i,l){if(d=new s.ci(d.lng,d.lat),i){const f=new s.ci(d.lng-360,d.lat),_=new s.ci(d.lng+360,d.lat),v=360*Math.ceil(Math.abs(d.lng-l.center.lng)/360),b=l.locationPoint3D(d).distSqr(i),S=i.x<0||i.y<0||i.x>l.width||i.y>l.height;l.locationPoint3D(f).distSqr(i)<b&&(S||Math.abs(f.lng-l.center.lng)<v)?d=f:l.locationPoint3D(_).distSqr(i)<b&&(S||Math.abs(_.lng-l.center.lng)<v)&&(d=_)}for(;Math.abs(d.lng-l.center.lng)>180;){const f=l.locationPoint3D(d);if(f.x>=0&&f.y>=0&&f.x<=l.width&&f.y<=l.height)break;d.lng>l.center.lng?d.lng-=360:d.lng+=360}return d}
2812const ma={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},ms={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class ga extends s.E{constructor(i,l){super(),(i instanceof HTMLElement||l)&&(i=s.h({element:i},l)),s.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:f="center",color:_="#3FB1CE",scale:v=1,draggable:b=!1,clickTolerance:S=0,rotation:C=ms.rotation,rotationAlignment:k=ms.rotationAlignment,pitchAlignment:R=ms.pitchAlignment,occludedOpacity:F=ms.occludedOpacity,altitude:z=ms.altitude}=i||{};this._anchor=f,this._color=_,this._scale=v,this._draggable=b,this._clickTolerance=S,this._rotation=C,this._rotationAlignment=k,this._pitchAlignment=R,this._occludedOpacity=F,this._altitude=z,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),i&&i.element?(this._element=i.element,this._offset=s.P.convert(i&&i.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(i&&i.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",U=>{U.preventDefault()}),this._element.addEventListener("mousedown",U=>{U.preventDefault()});const N=this._element.classList;for(const U in ma)N.remove(`mapboxgl-marker-anchor-${U}`);N.add(`mapboxgl-marker-anchor-${this._anchor}`);const G=i&&i.className?i.className.trim().split(/\s+/):[];N.add(...G),this._popup=null}_createDefaultMarker(){const i=pe("div"),l=Ne("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},i);if(this._altitude===0){const f=Ne("radialGradient",{id:"shadowGradient"},Ne("defs",{},l));Ne("stop",{offset:"10%","stop-opacity":.4},f),Ne("stop",{offset:"100%","stop-opacity":.05},f),Ne("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},l)}return Ne("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},l),Ne("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},l),Ne("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},l),i}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),i.on("click",this._onMapClick)),this}remove(){const i=this._map;return i&&(i.off("click",this._onMapClick),i.off("move",this._updateMoving),i.off("moveend",this._update),i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler),i.off("mouseup",this._onUp),i.off("touchend",this._onUp),i.off("mousemove",this._onMove),i.off("touchmove",this._onMove),i.off("remove",this._clearFadeTimer),i._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=s.ci.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(i){return i===this._altitude||(this._defaultMarker&&(this._altitude===0&&i!==0||this._altitude!==0&&i===0)&&(this._element=this._createDefaultMarker()),this._altitude=i||ms.alt
vendor: 8,574 bytes, lines 2812-2817
2812itude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const _=Math.sqrt(Math.pow(13.5,2)/2);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[_,-1*(38.1-13.5+_)],"bottom-right":[-_,-1*(38.1-13.5+_)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,i._marker=this,i._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(i){const l=i.code,f=i.charCode||i.keyCode;l!=="Space"&&l!=="Enter"&&f!==32&&f!==13||this.togglePopup()}_onMapClick(i){const l=i.originalEvent.target,f=this._element;this._popup&&(l===f||f.contains(l))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i?(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(i.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const i=this._map,l=this._pos;if(!i||!l)return!1;const f=i.unproject(l,this._altitude),_=i.getFreeCameraOptions();if(!_.position)return!1;const v=_.position.toLngLat();return v.distanceTo(f)<.9*v.distanceTo(this._lngLat)}_evaluateOpacity(){const i=this._map;if(!i)return;const l=this._pos;if(!l||l.x<0||l.x>i.transform.width||l.y<0||l.y>i.transform.height)return void this._clearFadeTimer();const f=i.unproject(l,this._altitude);let _;i._showingGlobe()&&s.eW(i.transform,this._lngLat)?_=0:(_=1-i._queryFogOpacity(f),i.transform._terrainEnabled()&&i.getTerrain()&&this._behindTerrain()&&(_*=this._occludedOpacity)),this._element.style.opacity=`${_}`,this._element.style.pointerEvents=_>0?"auto":"none",this._popup&&this._popup._setOpacity(_),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const i=this._pos;if(!i||!this._map)return;const l=this._offset.mult(this._scale);this._element.style.transform=`
2813            translate(${i.x}px,${i.y}px)
2814            ${ma[this._anchor]}
2815            ${this._calculateXYTransform()} ${this._calculateZTransform()}
2816            translate(${l.x}px,${l.y}px)
2817        `}_calculateXYTransform(){const i=this._pos,l=this._map,f=this.getPitchAlignment();if(!l||!i||f!=="map")return"";if(!l._showingGlobe()){const C=l.getPitch();return C?`rotateX(${C}deg)`:""}const _=s.cU(s.eX(l.transform,this._lngLat)),v=i.sub(s.eY(l.transform)),b=Math.abs(v.x)+Math.abs(v.y);if(b===0)return"";const S=_/b;return`rotateX(${-v.y*S}deg) rotateY(${v.x*S}deg)`}_calculateZTransform(){const i=this._pos,l=this._map;if(!l||!i)return"";let f=0;const _=this.getRotationAlignment();if(_==="map")if(l._showingGlobe()){const v=l.project(new s.ci(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),b=l.project(new s.ci(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(v);f=s.cU(Math.atan2(b.y,b.x))-90}else f=-l.getBearing();else if(_==="horizon"){const v=s.af(4,6,l.getZoom()),b=s.eY(l.transform);b.y+=v*l.transform.height;const S=i.sub(b),C=s.cU(Math.atan2(S.y,S.x));f=(C>90?C-270:C+90)*(1-v)}return f+=this._rotation,f?`rotateZ(${f}deg)`:""}_update(i){cancelAnimationFrame(this._updateFrameId);const l=this._map;l&&(l.transform.renderWorldCopies&&(this._lngLat=ja(this._lngLat,this._pos,l.transform)),this._pos=l.project(this._lngLat,this._altitude),i===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),l._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(l._showingGlobe()||l.getTerrain()||l.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(i){return this._offset=s.P.convert(i),this._update(),this}addClassName(i){return this._element.classList.add(i),this}removeClassName(i){return this._element.classList.remove(i),this}toggleClassName(i){return this._element.classList.toggle(i)}_onMove(i){const l=this._map;if(!l)return;const f=this._pointerdownPos,_=this._positionDelta;if(f&&_){if(!this._isDragging){const v=this._clickTolerance||l._clickTolerance;if(i.point.dist(f)<v)return;this._isDragging=!0}this._pos=i.point.sub(_),this._lngLat=l.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.A("dragstart"))),this.fire(new s.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const i=this._map;i&&(i.off("mousemove",this._onMove),i.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.A("dragend")),this._state="inactive"}_addDragHandler(i){const l=this._map,f=this._pos;l&&f&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(f),this._pointerdownPos=i.point,this._state="pending",l.on("mousemove",this._onMove),l.on("touchmove",this._onMove),l.once("mouseup",this._onUp),l.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;const l=this._map;return l&&(i?(l.on("mousedown",this._addDragHandler),l.on("touchstart",this._addDragHandler)):(l.off("mousedown",this._addDragHandler),l.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||ms.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||ms.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||ms.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(i){return this._occludedOpacity=i||ms.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const qI={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},ZI={maxWidth:100,unit:"metric"},WI={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},XI={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},xw=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function es(d=new s.P(0,0),i="bottom"){if(typeof d=="number"){const l=Math.round(Math.sqrt(.5*Math.pow(d,2)));switch(i){case"top":return new s.P(0,d);case"top-left":return new s.P(l,l);case"top-right":return new s.P(-l,l);case"bottom":return new s.P(0,-d);case"bottom-left":return new s.P(l,-l);case"bottom-right":return new s.P(-l,-l);case"left":return new s.P(d,0);case"right":return new s.P(-d,0)}return new s.P(0,0)}return d instanceof s.P||Array.isArray(d)?s.P.convert(d):s.P.convert(d[i]||[0,0])}return{version:M,supported:xe.supported,setRTLTextPlugin:s.f0,getRTLTextPluginStatus:s.e$,Map:class extends Ol{constructor(d){B.mark(L.create);const i=d;if((d=s.h({},Jf,d)).minZoom!=null&&d.maxZoom!=null&&d.minZoom>d.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(d.minPitch!=null&&d.maxPitch!=null&&d.minPitch>d.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(d.minPitch!=null&&d.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(d.maxPitch!=null&&d.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(d.antialias&&s.eU(window)&&(d.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ky(d.minZ
2817oom,d.maxZoom,d.minPitch,d.maxPitch,d.renderWorldCopies,null,null),d),this._repaint=!!d.repaint,this._interactive=d.interactive,this._minTileCacheSize=d.minTileCacheSize,this._maxTileCacheSize=d.maxTileCacheSize,this._failIfMajorPerformanceCaveat=d.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=d.preserveDrawingBuffer,this._antialias=d.antialias,this._trackResize=d.trackResize,this._bearingSnap=d.bearingSnap,this._refreshExpiredTiles=d.refreshExpiredTiles,this._fadeDuration=d.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=d.crossSourceCollisions,this._collectResourceTiming=d.collectResourceTiming,this._language=this._parseLanguage(d.language),this._worldview=d.worldview,this._renderTaskQueue=new yw,this._domRenderTaskQueue=new yw,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.a$(),this._locale=s.h({},HI,d.locale),this._clickTolerance=d.clickTolerance,this._cooperativeGestures=d.cooperativeGestures,this._performanceMetricsCollection=d.performanceMetricsCollection,this._tessellationStep=d.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=d.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Kf(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=d.scaleFactor,this._requestManager=new Je(d.transformRequest,d.accessToken,d.testMode),this._silenceAuthErrors=!!d.testMode,this._contextCreateOptions=d.contextCreateOptions?Object.assign({},d.contextCreateOptions):{},typeof d.container=="string"){const l=document.getElementById(d.container);if(!l)throw new Error(`Container '${d.container.toString()}' not found.`);this._container=l}else{if(!(d.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=d.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),d.maxBounds&&this.setMaxBounds(d.maxBounds),this._spriteFormat=d.spriteFormat,s.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new BI),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new cg(this,d),this._localFontFamily=d.localFontFamily,this._localIdeographFontFamily=d.localIdeographFontFamily,(d.style||!d.testMode)&&this.setStyle(d.style||s.e.DEFAULT_STYLE,{config:d.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),d.projection&&this.setProjection(d.projection),this.indoor=new bI(this),d.hash&&(this._hash=new tg(typeof d.hash=="string"&&d.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){i.center==null&&i.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch});const l=d.bounds;l&&(this.resize(),this.fitBounds(l,s.h({},d.fitBoundsOptions,{duration:0})))}this.resize(),d.attributionControl&&this.addControl(new _d({customAttribution:d.customAttribution}
vendor: 4,772 bytes, line 2817
2817)),this._logoControl=new Yf,this.addControl(this._logoControl,d.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new s.A(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new s.A(`${l.dataType}dataloading`,l))}),this._interactions=new O0(this)}_getMapId(){return this._mapId}addControl(d,i){if(i===void 0&&(i=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new s.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const l=d.onAdd(this);this._controls.push(d);const f=this._controlPositions[i];return i.indexOf("bottom")!==-1?f.insertBefore(l,f.firstChild):f.appendChild(l),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new s.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(d);return i>-1&&this._controls.splice(i,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(d){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new s.A("movestart",d)).fire(new s.A("move",d)),this.fire(new s.A("resize",d)),i&&this.fire(new s.A("moveend",d)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(d){return this.transform.setMaxBounds(s.aG.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom)return this.transform.minZoom=d,this._update(),this.getZoom()<d?this.setZoom(d):this.fire(new s.A("zoomstart")).fire(new s.A("zoom")).fire(new s.A("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom)return this.transform.maxZoom=d,this._update(),this.getZoom()>d?this.setZoom(d):this.fire(new s.A("zoomstart")).fire(new s.A("zoom")).fire(new s.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch)return this.transform.minPitch=d,this._update(),this.getPitch()<d?this.setPitch(d):this.fire(new s.A("pitchstart")).fire(new s.A("pitch")).fire(new s.A("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(d>=this.transform.minPitch)return this.transform.maxPitch=d,this._update(),this.getPitch()>d?this.setPitch(d):this.fire(new s.A("pitchstart")).fire(new s.A("pitch")).fire(new s.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(d){return this._scaleFactor=d,this.painter.scaleFactor=d,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(i=>i.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.renderWorldCopies=d,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(d){return d==="auto"?navigator.language:Array.isArray(d)?d.length===0?void 0:d.map(i=>i==="auto"?navigator.language:i):d}setLanguage(d){const i=this._parseLanguage(d);if(!this.style||i===this._language)return this;this._language=i,this.style.reloadSources();for(const l of this._controls)l._setLanguage&&l._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(d){return this.style&&d!==this._worldview?(this._worldview=d,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(d){return this._lazyInitEmptyStyle(),d?typeof d=="str
2817ing"&&(d={name:d}):d=null,this._useExplicitProjection=!!d,this._prioritizeAndUpdateProjection(d,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const d=this.transform,i=d.projection.name;let l;i==="globe"&&d.zoom>=s.cI?(d.setMercatorFromTransition(),l=!0):i==="mercator"&&d.zoom<s.cI&&(d.setProjection({name:"globe"}),l=!0),l&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(d,i){return this._updateProjection(d||i||{name:"mercator"})}_updateProjection(d){let i;return i=d.name==="globe"&&this.transform.zoom>=s.cI?this.transform.setMercatorFromTransition():this.transform.setProjection(d),this.style.applyProjectionUpdate(),i&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(d,i){return this.transform.locationPoint3D(s.ci.convert(d),i)}unproject(d,i){return this.transform.pointLocation3D(s.P.convert(d),i)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(d,i,l){const f=_=>{let v=[];if(Array.isArray(i)){const b=i.filter(S=>this.getLayer(S));v=b.length?this.queryRenderedFeatures(_,{layers:b}):[]}else v=this.queryRenderedFeatures(_,{target:i});return v};if(d==="mouseenter"||d==="mouseover"){let _=!1;return{listener:l,targets:i,delegates:{mousemove:b=>{const S=f(b.point);S.length?_||(_=!0,l.call(this,new gn(d,this,b.originalEvent,{features:S}))):_=!1},mouseout:()=>{_=!1}}}}if(d==="mouseleave"||d==="mouseout"){let _=!1;return{listener:l,targets:i,delegates:{mousemove:S=>{f(S.point).length?_=!0:_&&(_=!1,l.call(this,new gn(d,this,S.originalEvent)))},mouseout:S=>{_&&(_=!1,l.call(this,new gn(d,this,S.originalEvent)))}}}}{const _=v=>{const b=f(v.point);b.length&&(v.features=b,l.call(this,v),delete v.features)};return{listener:l,targets:i,delegates:{[d]:_}}}}on(d,i,l){if(typeof i=="function"||l===void 0)return super.on(d,i);if(typeof i=="string"&&(i=[i]),!this._areTargetsValid(i))return this;const f=this._createDelegatedListener(d,i,l);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(f);for(const _ in f.delegates)this.on(_,f.delegates[_]);return this}once(d,i,l){if(typeof i=="function"||l===void 0)return super.once(d,i);if(typeof i=="string"&&(i=[i]),!this._areTargetsValid(i))return this;const f=this._createDelegatedListener(d,i,l);for(const _ in f.delegates)this.once(_,f.delegates[_]);return this}off(d,i,l){if(typeof i=="function"||l===void 0)return super.off(d,i);if(typeof i=="string"&&(i=[i]),!this._areTargetsValid(i))return this;const f=this._delegatedListeners?this._delegatedListeners[d]:void 0;return f&&(_=>{for(let v=0;v<_.length;v++){const b=_[v];if(b.listener===l&&F0(b.targets,i)){for(const S in b.delegates)this.off(S,b.delegates[S]);return _.splice(v,1),this}}})(f),this}queryRenderedFeatures(d,i){if(!this.style)return[];if(d===void 0||d instanceof s.P||Array.isArray(d)||i!==void 0||(i=d,d=void 0),d=d||[[0,0],[this.transform.width,this.transform.height]],!i){const v=this.style.queryRenderedFeatures(d,void 0,this.transform),b=this.style.queryRenderedFeatureset(d,void 0,this.transform);return v.concat(b)}let l=!0;if(i.target&&(l=this._isTargetValid(i.target),l&&!i.layers))return this.style.queryRenderedFeatureset(d,i,this.transform);let f=!0;if(i.layers&&Array.isArray(i.layers)){for(const v of i.layers)if(!this._isValidId(v)){f=!1;break}if(f&&!i.target)return this.style.queryRenderedFeatures(d,i,this.transform)}let _=[];return f&&(_=_.concat(this.style.queryRenderedFeatures(d,i,this.transform))),l&&(_=_.concat(this.style.queryRenderedFeatureset(d,i,this.transform))),_}querySourceFeatures(d,i){return!d||typeof d=="string"&&!this._isValidId(d)?[]:this.style.querySourceFeatures(d,i)}isPointOnSurface(d){const{name:i}=this.transform.projection;return i!=="globe"&&i!=="mercator"&&s.w(`${i} projection does not support isPointOnSurface, this API may behave unex
2817pectedly.`),this.transform.isPointOnSurface(s.P.convert(d))}addInteraction(d,i){return this._interactions.add(d,i),this}removeInteraction(d){return this._interactions.remove(d),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(d){return this._cooperativeGestures=d,this}setStyle(d,i){return i=s.h({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i),this.style&&d&&i.diff!==!1&&i.localFontFamily===this._localFontFamily&&i.localIdeographFontFamily===this._localIdeographFontFamily&&!i.config?(this.style._diffStyle(d,(l,f)=>{if(l){const _=typeof l=="string"?l:l instanceof Error?l.message:l.error;s.w(`Unable to perform style diff: ${_}. Rebuilding the style from scratch.`),this._updateStyle(d,i)}else f&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(d,i))}_getUIString(d){const i=this._locale[d];if(i==null)throw new Error(`Missing UI string '${d}'`);return i}_updateStyle(d,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),d){const l=s.h({},i);i&&i.config&&(l.initialConfig=i.config,delete l.config),this.style=new Ba(this,l).load(d),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ba(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(d){return d==null?(this.fire(new s.z(new Error("IDs can't be empty."))),!1):!s.dk(d)||(this.fire(new s.z(new Error(`IDs can't contain special symbols: "${d}".`))),!1)}_isTargetValid(d){return"featuresetId"in d?this._isValidId("importId"in d?d.importId:d.featuresetId):"layerId"in d&&this._isValidId(d.layerId)}_areTargetsValid(d){if(Array.isArray(d)){for(const i of d)if(!this._isValidId(i))return!1;return!0}return this._isTargetValid(d)}addSource(d,i){return this._isValidId(d)?(this._lazyInitEmptyStyle(),this.style.addSource(d,i),this._update(!0)):this}isSourceLoaded(d){return!!this._isValidId(d)&&!!this.style&&this.style._isSourceCacheLoaded(d)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(d,i,l){this._lazyInitEmptyStyle(),this.style.addSourceType(d,i,l)}removeSource(d){return this._isValidId(d)?(this.style.removeSource(d),this._updateTerrain(),this._update(!0)):this}getSource(d){return this._isValidId(d)?this.style.getOwnSource(d):null}addImage(d,i,{pixelRatio:l=1,sdf:f=!1,stretchX:_,stretchY:v,content:b}={}){this._lazyInitEmptyStyle();const S=s.I.from(d);if(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:C,height:k,data:R}=s.q.getImageData(i);this.style.addImage(S,{data:new s.r({width:C,height:k},R),pixelRatio:l,stretchX:_,stretchY:v,content:b,sdf:f,version:0,usvg:!1})}else if(i.width===void 0||i.height===void 0)this.fire(new s.z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:C,height:k}=i,R=i;this.style.addImage(S,{data:new s.r({width:C,height:k},new Uint8Array(R.data)),pixelRatio:l,stretchX:_,stretchY:v,content:b,sdf:f,usvg:!1,version:0,userImage:R}),R.onAdd&&R.onAdd(this,d)}}updateImage(d,i){this._lazyInitEmptyStyle();const l=s.I.from(d),f=this.style.getImage(l);if(!f)return void this.fire(new s.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const _=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?s.q.getImageData(i):i,{width:v,height:b,data:S}=_;if(v===void 0||b===void 0)return void this.fire(new s.z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(v!==(f.usvg?f.icon.usvg_tree.width:f.data.width)||b!==(f.usvg?f.icon.usvg_tree.height:f.data.height))return void this.fire(new s.z(new Error(`The width and height of the updated image (${v}, ${b})
2818                must be that same as the previous version of the image
2819                (${f.data.width}, ${f.data.height})`)));const C=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);let k=!1;f.usvg?(f.data=new s.r({width:v,height:b},new Uint8Array(S)),f.usvg=!1,f.icon=void 0,k=!0):f.data.replace(S,C),this.style.updateImage(l,f,k)}hasImage(d){return d?!!this.style&&!!this.style.getImage(s.I.from(d)):(this.fire(new s.z(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(s.I.from(d))}loadImage(d,i){s.o(this._requestManager.transformRequest(d,s.R.Image),(l,f)=>{i(l,f instanceof HTMLImageElement?s.q.getImageData(f):f)})}listImages(){return this.style.listImages().map(d=>d.name)}
vendor: 4,348 bytes, line 2819
2819addModel(d,i){this._lazyInitEmptyStyle(),this.style.addModel(d,i)}hasModel(d){return d?this.style.hasModel(d):(this.fire(new s.z(new Error("Missing required model id"))),!1)}removeModel(d){this.style.removeModel(d)}listModels(){return this.style.listModels()}addLayer(d,i){return this._isValidId(d.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(d,i),this._update(!0)):this}getSlot(d){const i=this.getLayer(d);return i&&i.slot||null}setSlot(d,i){return this.style.setSlot(d,i),this.style.mergeLayers(),this._update(!0)}addImport(d,i){return this.style.addImport(d,i).catch(l=>this.fire(new s.z(new Error("Failed to add import",l)))),this}updateImport(d,i){return typeof i!="string"&&i.id!==d?(this.removeImport(d),this.addImport(i)):(this.style.updateImport(d,i),this._update(!0))}removeImport(d){return this.style.removeImport(d),this}moveImport(d,i){return this.style.moveImport(d,i),this._update(!0)}moveLayer(d,i){return this._isValidId(d)?(this.style.moveLayer(d,i),this._update(!0)):this}removeLayer(d){return this._isValidId(d)?(this.style.removeLayer(d),this._update(!0)):this}getLayer(d){if(!this._isValidId(d))return null;const i=this.style.getOwnLayer(d);return i?i.type==="custom"?i.implementation:i.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(d,i,l){return this._isValidId(d)?(this.style.setLayerZoomRange(d,i,l),this._update(!0)):this}setFilter(d,i,l={}){return this._isValidId(d)?(this.style.setFilter(d,i,l),this._update(!0)):this}getFilter(d){return this._isValidId(d)?this.style.getFilter(d):null}setPaintProperty(d,i,l,f={}){return this._isValidId(d)?(this.style.setPaintProperty(d,i,l,f),this._update(!0)):this}getPaintProperty(d,i){return this._isValidId(d)?this.style.getPaintProperty(d,i):null}setLayoutProperty(d,i,l,f={}){return this._isValidId(d)?(this.style.setLayoutProperty(d,i,l,f),this._update(!0)):this}getLayoutProperty(d,i){return this._isValidId(d)?this.style.getLayoutProperty(d,i):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(d){return this.style.setGlyphsUrl(d),this._update(!0)}getSchema(d){return this.style.getSchema(d)}setSchema(d,i){return this.style.setSchema(d,i),this._update(!0)}getConfig(d){return this.style.getConfig(d)}setConfig(d,i){return this.style.setConfig(d,i),this._update(!0)}getConfigProperty(d,i){return this.style.getConfigProperty(d,i)}setConfigProperty(d,i,l){return this.style.setConfigProperty(d,i,l),this._update(!0)}getFeaturesetDescriptors(d){return this.style.getFeaturesetDescriptors(d)}setLights(d){if(this._lazyInitEmptyStyle(),d&&d.length===1&&d[0].type==="flat"){const i=d[0];i.properties?this.style.setFlatLight(i.properties,i.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(d),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const d=this.style.getLights()||[];return d.length===0&&d.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),d}setLight(d,i={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:d}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(d){return this._lazyInitEmptyStyle(),!d&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(d),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(d){return this._lazyInitEmptyStyle(),this.style.setFog(d),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(d){return this._lazyInitEmptyStyle(),this.style.setSnow(d),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(d){return this._lazyInitEmptyStyle(),this.style.setRain(d),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(d){return this._lazyInitEmptyStyle(),this.style.setColorTheme(d),this._update(!0)}setImportColorTheme(d,i){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(d,i),this._update(!0)}setCamera(d){return this.style.setCamera(d),this._triggerCameraUpdate(d)}_triggerCameraUpdate(d){return this._update(this.transform.setOrthogra
2819phicProjectionAtLowPitch(d["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(d){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.ci.convert(d),this.transform):0}setFeatureState(d,i){return d.source&&!this._isValidId(d.source)?this:(this.style.setFeatureState(d,i),this._update())}removeFeatureState(d,i){return d.source&&!this._isValidId(d.source)?this:(this.style.removeFeatureState(d,i),this._update())}getFeatureState(d){return d.source&&!this._isValidId(d.source)?null:this.style.getFeatureState(d)}_selectIndoorFloor(d){this.indoor.selectFloor(d)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new D0),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const d=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300;let l,f,_,v=this._container;for(;v&&(!f||!_);){const b=window.getComputedStyle(v).transform;b&&b!=="none"&&(l=b.match(/matrix.*\((.+)\)/)[1].split(", "),l[0]&&l[0]!=="0"&&l[0]!=="1"&&(f=l[0]),l[3]&&l[3]!=="0"&&l[3]!=="1"&&(_=l[3])),v=v.parentElement}this._containerWidth=f?Math.abs(d/f):d,this._containerHeight=_?Math.abs(i/_):i}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const d=this._container;d.classList.add("mapboxgl-map"),(this._missingCSSCanary=pe("div","mapboxgl-canary",d)).style.visibility="hidden",this._detectMissingCSS();const i=this._canvasContainer=pe("div","mapboxgl-canvas-container",d);this._canvas=pe("canvas","mapboxgl-canvas",i),this._interactive&&(i.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const l=this._controlContainer=pe("div","mapboxgl-control-container",d),f=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(_=>{f[_]=pe("div",`mapboxgl-ctrl-${_}`,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,i){const l=s.q.devicePixelRatio||1;this._canvas.width=l*Math.ceil(d),this._canvas.height=l*Math.ceil(i),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${i}px`}_addMarker(d){this._markers.push(d)}_removeMarker(d){const i=this._markers.indexOf(d);i!==-1&&this._markers.splice(i,1)}_addPopup(d){this._popups.push(d)}_removePopup(d){const i=this._popups.indexOf(d);i!==-1&&this._popups.splice(i,1)}_setupPainter(){const d=s.h({},xe.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl2",d);i?(So(i,!0),this.painter=new tu(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",l=>{l.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.l.testSupport(i)):this.fire(new s.z(new Error("Failed to initialize WebGL")))}_contextLost(d){d.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.A("webglcontextlost",{originalEvent:d}))}_contextRestored(d){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.A("webglcontextrestored",{originalEvent:d}))}_onMapScroll(d){if(d.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(d){return this.style?(this._styleDirty=this._styleDirty||d,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_requestDomTask(d){!this.loaded()||this.loaded()&&!this.isMoving()?d():this._domRenderTaskQueue.add(d)}_render(d){let i;this.fire(new s.A("renderstart")),++this._frameId;const l=this.painter.context.extTimerQuery,f=s.q.now(),_=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(i=_.createQuery(),_.beginQuery(l.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
2819(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(d),this._domRenderTaskQueue.run(d),this._removed)return;this._updateProjectionTransition();const v=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const k=this.transform.zoom,R=this.transform.pitch,F=s.q.now(),z=new s.aa(k,{now:F,fadeDuration:v,pitch:R,transition:this.style.transition,worldview:this._worldview});this.style.update(z)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let b=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),b=this._updateAverageElevation(f),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):b=this._updateAverageElevation(f);const S=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,v,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),S&&(this._placementDirty=S.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:v,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,B.mark(L.load),this.fire(new s.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const k=s.q.now()-f;_.endQuery(l.TIME_ELAPSED_EXT),setTimeout(()=>{const R=_.getQueryParameter(i,_.QUERY_RESULT)/1e6;_.deleteQuery(i),this.fire(new s.A("gpu-timing-frame",{cpuTime:k,gpuTime:R}))},50)}if(this.listens("gpu-timing-layer")){const k=this.painter.collectGpuTimers();setTimeout(()=>{const R=this.painter.queryGpuTimers(k);this.fire(new s.A("gpu-timing-layer",{layerTimes:R}))},50)}if(this.listens("gpu-timing-deferred-render")){const k=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const R=this.painter.queryGpuTimeDeferredRender(k);this.fire(new s.A("gpu-timing-deferred-render",{gpuTime:R}))},50)}const C=this._sourcesDirty||this._styleDirty||this._placementDirty||b;if(C||this._repaint)this.triggerRepaint();
vendor: 9,283 bytes, line 2819
2819else{const k=this.idle();if(k&&(b=this._updateAverageElevation(f,!0)),b)this.triggerRepaint();else if(this._triggerFrame(!1),k&&(this.fire(new s.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const R=this._calculateSpeedIndex();this.fire(new s.A("speedindexcompleted",{speedIndex:R})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||C||(this._fullyLoaded=!0,B.mark(L.fullLoad),this._performanceMetricsCollection&&qi(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(d){for(const i of this._markers)d&&!this.getRenderWorldCopies()&&(i._lngLat=i._lngLat.wrap()),i._update();for(const i of this._popups)!d||this.getRenderWorldCopies()||i._trackPointer||(i._lngLat=i._lngLat.wrap()),i._update()}_updateAverageElevation(d,i=!1){const l=_=>(this.transform.averageElevation=_,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&l(0);const f=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(f||(i||d-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(d)){const _=this.transform.averageElevation;let v=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(v)?v=0:this._averageElevationLastSampledAt=d;const b=Math.abs(_-v);if(b>1){if(this._isInitialLoad||f)return this._averageElevation.jumpTo(v),l(v);this._averageElevation.easeTo(v,d,300)}else if(b>1e-4)return this._averageElevation.jumpTo(v),l(v)}return!!this._averageElevation.isEasing(d)&&l(this._averageElevation.getValue(d))}_authenticate(){sn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,d=>{if(d&&(d.message===Fe||d.status===401)){const i=this.painter.context.gl;So(i,!1),this._logoControl instanceof Yf&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.z(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),di(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&fr(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const d=this._isDragging();this.painter.updateTerrain(this.style,d)}_calculateSpeedIndex(){const d=this.painter.canvasCopy(),i=this.painter.getCanvasCopiesAndTimestamps();i.timeStamps.push(performance.now());const l=this.painter.context.gl,f=l.createFramebuffer();function _(v){l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,v,0);const b=new Uint8Array(l.drawingBufferWidth*l.drawingBufferHeight*4);return l.readPixels(0,0,l.drawingBufferWidth,l.drawingBufferHeight,l.RGBA,l.UNSIGNED_BYTE,b),b}return l.bindFramebuffer(l.FRAMEBUFFER,f),this._canvasPixelComparison(_(d),i.canvasCopies.map(_),i.timeStamps)}_canvasPixelComparison(d,i,l){let f=l[1]-l[0];const _=d.length/4;for(let v=0;v<i.length;v++){const b=i[v];let S=0;for(let C=0;C<b.length;C+=4)b[C]===d[C]&&b[C+1]===d[C+1]&&b[C+2]===d[C+2]&&b[C+3]===d[C+3]&&(S+=1);f+=(l[v+2]-l[v+1])*(1-S/_)}return f}remove(){this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const d=this.painter.context.gl.getExtension("WEBGL_lose_context");d&&d.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),ao.delete(this.painter.context.gl),zn.remove(),li.remove(),this._removed=!0,this.fire(new s.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(d){this._renderNextFrame=this._renderNextFrame||d,this.style&&!this._frame&&(this._frame=s.q.frame(i=>{const l=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,l&&this._render(i)}))}_preloadTiles(d){const i=this.style?this.style.getSourceCaches():[];return s.bt(i,(l,f)=>l._preloadTiles(d,f),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(d){this._trackResize&&this.resize({originalEvent:d})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(d){this._showParseStatus!==d&&(this._showParseStatus=d,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(d){this._showTerrainWireframe!==d&&(this._showTerrainWireframe=d,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(d){this._showLayers2DWireframe!==d&&(this._showLayers2DWireframe=d,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(d){this._showLayers3DWireframe!==d&&(this._showLayers3DWireframe=d,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(d){this._speedIndexTiming!==d&&(this._speedIndexTiming=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,this._tp.refreshUI(),d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(d){this._showTileAABBs!==d&&(this._showTileAABBs=d,this._tp.refreshUI(),d&&this._update())}_setCacheLimits(d,i){s.eV(d,i)}get version(){return M}},NavigationControl:class{constructor(d={}){this.options=s.h({},yd,d),this._container=pe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(s.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),pe("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>{this._map&&this._map.zoomOut({},{originalEvent:i})}),pe("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{const l=this._map;l&&(this.options.visualizePitch?l.resetNorthPitch({},{originalEvent:i}):l.resetNorth({},{originalEvent:i}))}),this._compassIcon=pe("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const d=this._map;if(!d)return;const i=d.getZoom(),l=i===d.getMaxZoom(),f=i===d.getMinZoom();this._zoomInButton.disabled=l,this._zoomOutButton.disabled=f,this._zoomInButton.setAttribute("aria-disabled",l.toString()),this._zoomOutButton.setAttribute("aria-disabled",f.toString())}_rotateCompassArrow(){const d=this._map;if(!d)return;const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(d.transform.pitch*(Math.PI/180)
2819),.5)}) rotateX(${d.transform.pitch}deg) rotateZ(${d.transform.angle*(180/Math.PI)}deg)`:`rotate(${d.transform.angle*(180/Math.PI)}deg)`;d._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(d){return this._map=d,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),d.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&d.on("pitch",this._rotateCompassArrow),d.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dc(d,this._compass,this.options.visualizePitch)),this._container}onRemove(){const d=this._map;d&&(this._container.remove(),this.options.showZoom&&d.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&d.off("pitch",this._rotateCompassArrow),d.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(d,i){const l=pe("button",d,this._container);return l.type="button",l.addEventListener("click",i),l}_setButtonTitle(d,i){if(!this._map)return;const l=this._map._getUIString(`NavigationControl.${i}`);d.setAttribute("aria-label",l),d.firstElementChild&&d.firstElementChild.setAttribute("title",l)}},GeolocateControl:class extends s.E{constructor(d={}){super();const i=navigator.geolocation;this.options=s.h({geolocation:i},qI,d),s.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=hd(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(d){return this._map=d,this._container=pe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(d){const i=(l=!!this.options.geolocation)=>{this._supportsGeolocation=l,d(l)};this._supportsGeolocation!==void 0?d(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(l=>i(l.state!=="denied")).catch(()=>i()):i()}_isOutOfMapMaxBounds(d){const i=this._map.getMaxBounds(),l=d.coords;return!!i&&(l.longitude<i.getWest()||l.longitude>i.getEast()||l.latitude<i.getSouth()||l.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(d){if(this._map){if(this._isOutOfMapMaxBounds(d))return this._setErrorState(),this.fire(new s.A("outofmaxbounds",d)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=d,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(d),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(d),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.A("geolocate",d)),this._finish()}}_updateCamera(d){const i=new s.ci(d.coords.longitude,d.coords.latitude),l=d.coords.accuracy,f=this._map.getBearing(),_=s.h({bearing:f},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(l),_,{geolocateSource:!0})}_updateMarker(d){if(d){const i=new s.ci(d.coords.longitude,d.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=d.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const d=this._map.transform,i=s.cb(1,d._center.lat)*d.worldSize,l=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(d){if(this._map){if(this.options.trackUserLocation)if(d.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(d.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.A("error",d)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(d){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=pe("button","mapboxgl-ctrl-geolocate",this._container),pe("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",d===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2819se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=pe("div","mapboxgl-user-location"),this._dotElement.appendChild(pe("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(pe("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ga({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=pe("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ga({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.A("trackuserlocationend")))})}}_onDeviceOrientation(d){this._userLocationDotMarker&&(d.webkitCompassHeading?this._heading=d.webkitCompassHeading:d.absolute===!0&&(this._heading=-1*d.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let d;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(d={maximumAge:6e5,timeout:0},this._noTimeout=!0):(d=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,d),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const d=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(i=>{i==="granted"&&d()}).catch(console.error):d()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2819se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:_d,ScaleControl:class{constructor(d={}){this.options=s.h({},ZI,d),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),s.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const d=this.options.maxWidth||100,i=this._map,l=i._containerHeight/2,f=i._containerWidth/2-d/2,_=i.unproject([f,l]),v=i.unproject([f+d,l]),b=_.distanceTo(v);if(this.options.unit==="imperial"){const S=3.2808*b;S>5280?this._setScale(d,S/5280,"mile"):this._setScale(d,S,"foot")}else this.options.unit==="nautical"?this._setScale(d,b/1852,"nautical-mile"):b>=1e3?this._setScale(d,b/1e3,"kilometer"):this._setScale(d,b,"meter")}_setScale(d,i,l){this._map._requestDomTask(()=>{const f=function(v){const b=Math.pow(10,`${Math.floor(v)}`.length-1);let S=v/b;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:S>=1?1:function(C){const k=Math.pow(10,Math.ceil(-Math.log(C)/Math.LN10));return Math.round(C*k)/k}(S),b*S}(i),_=f/i;this._container.innerHTML=this._isNumberFormatSupported&&l!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:l}).format(f):`${f}&nbsp;${WI[l]}`,this._container.style.width=d*_+"px"})}onAdd(d){return this._map=d,this._language=d.getLanguage(),this._container=pe("div","mapboxgl-ctrl mapboxgl-ctrl-scale",d.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(d){this._language=d,this._update()}setUnit(d){this.options.unit=d,this._update()}},FullscreenControl:class{constructor(d={}){this._fullscreen=!1,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:s.w("Full screen control 'container' must be a DOM element.")),s.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=pe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const d=this._fullscreenButton=pe("button","mapboxgl-ctrl-fullscreen",this._controlContainer);pe("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",d)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:D0,Popup:class extends s.E{constructor(d){super(),this.options=s.h(Object.create(XI),d),this._altitude=this.options.altitude,s.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(d&&d.className?d.className.trim().split(/\s+/):[])}addTo(d){return this._map&&this.remove(),this._map=d,this.options.closeOnClick&&d.on("preclick",this._onClose),this.options.closeOnMove&&d.on("move",this._onClose),d.on("remove",this.remove),this._update(),d._addPopup(this),this._focusFirstElement(),this._trackPointer?(d.on("mousemove",this._onMouseEvent),d.on("mouseup",this._onMouseEvent),d._canvasContainer.classList.add("mapboxgl-track-pointer")):d.on("move",this._update),this.fire(new s.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const d=this._map;return d&&(d.off("move",this._update),d.off("move",this._onClose),d.off("preclick",this._onClose),d.off("
2819click",this._onClose),d.off("remove",this.remove),d.off("mousemove",this._onMouseEvent),d.off("mouseup",this._onMouseEvent),d.off("drag",this._onMouseEvent),d._canvasContainer&&d._canvasContainer.classList.remove("mapboxgl-track-pointer"),d._removePopup(this),this._map=void 0),this.fire(new s.A("close")),this}getLngLat(){return this._lngLat}setLngLat(d){this._lngLat=s.ci.convert(d),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(d){return this._altitude=d,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const d=this._map;return d&&(d.off("move",this._update),d.on("mousemove",this._onMouseEvent),d.on("drag",this._onMouseEvent),d._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const i=document.createDocumentFragment(),l=document.createElement("body");let f;for(l.innerHTML=d;f=l.firstChild,f;)i.appendChild(f);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){let i=this._content;if(i)for(;i.hasChildNodes();)i.firstChild&&i.removeChild(i.firstChild);else i=this._content=pe("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(d),this.options.closeButton){const l=this._closeButton=pe("button","mapboxgl-popup-close-button",i);l.type="button",l.setAttribute("aria-label","Close popup"),l.innerHTML='<span aria-hidden="true">&#215;</span>',l.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(d){return this._classList.add(d),this._updateClassList(),this}removeClassName(d){return this._classList.delete(d),this._updateClassList(),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){let i;return this._classList.delete(d)?i=!1:(this._classList.add(d),i=!0),this._updateClassList(),i}_onMouseEvent(d){this._update(d.point)}_getAnchor(d){if(this.options.anchor)return this.options.anchor;const i=this._map,l=this._container,f=this._pos;if(!i||!l||!f)return"bottom";const _=l.offsetWidth,v=l.offsetHeight,b=f.x<_/2,S=f.x>i.transform.width-_/2;if(f.y+d<v)return b?"top-left":S?"top-right":"top";if(f.y>i.transform.height-v){if(b)return"bottom-left";if(S)return"bottom-right"}return b?"left":S?"right":"bottom"}_updateClassList(){const d=this._container;if(!d)return;const i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),d.className=i.join(" ")}_update(d){const i=this._map,l=this._content;if(!i||!this._lngLat&&!this._trackPointer||!l)return;let f=this._container;if(f||(f=this._container=pe("div","mapboxgl-popup",i.getContainer()),this._tip=pe("div","mapboxgl-popup-tip",f),f.appendChild(l)),this.options.maxWidth&&f.style.maxWidth!==this.options.maxWidth&&(f.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ja(this._lngLat,this._pos,i.transform)),!this._trackPointer||d){const _=this._pos=this._trackPointer&&d instanceof s.P?d:i.project(this._lngLat,this._altitude),v=es(this.options.offset),b=this._anchor=this._getAnchor(v.y),S=es(this.options.offset,b),C=_.add(S).round();i._requestDomTask(()=>{this._container&&b&&(this._container.style.transform=`${ma[b]} translate(${C.x}px,${C.y}px)`)})}if(!this._marker&&i._showingGlobe()){const _=s.eW(i.transform,this._lngLat)?0:1;this._setOpacity(_)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const d=this._container.querySelector(xw);d&&d.focus()}_onClose(){this.remove()}_setOpacity(d){this._container&&(this._container.style.opacity=`${d}`),this._content&&(this._content.style.pointerEvents=d?"auto":"none")}},Marker:ga,Style:Ba,LngLat:s.ci,LngLatBounds:s.aG,Point:s.P,MercatorCoordinate:s.ac,FreeCameraOptions:Eb,Evented:s.E,config:s.e,prewarm:s.e_,clearPrewarmedResources:s.eZ,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(d){s.e.ACCESS_TOKEN=d},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(d){s.e.API_URL=d},get workerCount(){return s.f7.workerCount},set workerCount(d){s.f7.workerCount=d},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(d){s.e.MAX_PARALLEL_IMAGE_REQUESTS=d}
2819,clearStorage(d){s.f6(d)},get workerUrl(){return s.f5.workerUrl},set workerUrl(d){s.f5.workerUrl=d},get workerClass(){return s.f5.workerClass},set workerClass(d){s.f5.workerClass=d},get workerParams(){return s.f5.workerParams},set workerParams(d){s.f5.workerParams=d},get dracoUrl(){return s.f4()},set dracoUrl(d){s.f3(d)},get meshoptUrl(){return s.f2()},set meshoptUrl(d){s.f1(d)},setNow:s.q.setNow,restoreNow:s.q.restoreNow}});var T=p;return T})})(gL);var Dq=gL.exports;const hS=Ig(Dq);function _L({children:e,show:t,type:o,showAlertIcon:u,className:p,toggle:y,buttons:T}){const s=M=>{switch(M){case"alert-info":default:return Ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",className:"stroke-info h-6 w-6 shrink-0",children:Ve.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})});case"alert-warning":return Ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 shrink-0 stroke-current",fill:"none",viewBox:"0 0 24 24",children:Ve.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})});case"alert-error":return Ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 shrink-0 stroke-current",fill:"none",viewBox:"0 0 24 24",children:Ve.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})}};return t&&Ve.jsxs("div",{role:"alert",className:`alert ${o??"alert-info"} ${p} ${y&&"alert-vertical flex flex-col items-start gap-2"}`,children:[Ve.jsx("span",{children:e}),y?Ve.jsx("div",{className:"flex gap-2",children:T==null?void 0:T.map((M,L)=>Ve.jsx("button",{className:"btn btn-sm btn-success",onClick:M.onClick,children:M.label},L))}):u&&s(o)]})}var Oq="Expected a function",yL=NaN,Fq="[object Symbol]",Nq=/^\s+|\s+$/g,Bq=/^[-+]0x[0-9a-f]+$/i,Vq=/^0b[01]+$/i,Uq=/^0o[0-7]+$/i,jq=parseInt,Gq=typeof _c=="object"&&_c&&_c.Object===Object&&_c,$q=typeof self=="object"&&self&&self.Object===Object&&self,Hq=Gq||$q||Function("return this")(),qq=Object.prototype,Zq=qq.toString,Wq=Math.max,Xq=Math.min,dS=function(){return Hq.Date.now()};function Yq(e,t,o){var u,p,y,T,s,M,L=0,B=!1,H=!1,$=!0;if(typeof e!="function")throw new TypeError(Oq);t=vL(t)||0,fS(o)&&(B=!!o.leading,H="maxWait"in o,y=H?Wq(vL(o.maxWait)||0,t):y,$="trailing"in o?!!o.trailing:$);function te(wt){var It=u,K=p;return u=p=void 0,L=wt,T=e.apply(K,It),T}function xe(wt){return L=wt,s=setTimeout(_e,t),B?te(wt):T}function pe(wt){var It=wt-M,K=wt-L,ve=t-It;return H?Xq(ve,y-K):ve}function Ne(wt){var It=wt-M,K=wt-L;return M===void 0||It>=t||It<0||H&&K>=y}function _e(){var wt=dS();if(Ne(wt))return ie(wt);s=setTimeout(_e,pe(wt))}function ie(wt){return s=void 0,$&&u?te(wt):(u=p=void 0,T)}function ke(){s!==void 0&&clearTimeout(s),L=0,u=M=p=s=void 0}function ot(){return s===void 0?T:ie(dS())}function et(){var wt=dS(),It=Ne(wt);if(u=arguments,p=this,M=wt,It){if(s===void 0)return xe(M);if(H)return s=setTimeout(_e,t),te(M)}return s===void 0&&(s=setTimeout(_e,t)),T}return et.cancel=ke,et.flush=ot,et}function fS(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Kq(e){return!!e&&typeof e=="object"}function Jq(e){return typeof e=="symbol"||Kq(e)&&Zq.call(e)==Fq}function vL(e){if(typeof e=="number")return e;if(Jq(e))return yL;if(fS(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=fS(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Nq,"");var o=Vq.test(e);return o||Uq.test(e)?jq(e.slice(2),o?2:8):Bq.test(e)?yL:+e}var Qq=Yq;const eZ=Ig(Qq),tZ=({onSelect:e})=>{const[t,o]=mt.useState(""),[u,p]=mt.useState([]),[y,T]=mt.useState(!1),s=async B=>{if(!B){p([]),T(!1);return}const H=new URLSearchParams({access_token:"pk.eyJ1IjoiZ3JlZW5hY2NvdW50IiwiYSI6ImNtMDZ0aG5qOTBwaWUyaXNiN2dqOHc2bnkifQ.uOs7BSk4kQZ7iA6ebq5GmA",language:"de",country:"DE",types:"region,postcode,district,place,locality,neighborhood"});try{const te=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(B)}.json?${H.toString()}`)).json();p(te.features),T(!0)}catch($){console.error("Error fetching geocoding data: ",$)}},M=eZ(s,500),L=B=>{e(B),T(!1),o("")};return Ve.jsxs("div",{children:[Ve.jsxs("div",{className:"flex join radius-leaf",children:[Ve.jsx("input",{className:"input flex-1 join-item focus:outline-hidden bg-white border-none",type:"text",onCh
2819ange:B=>{o(B.target.value),M(B.target.value)},onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),s(t))},placeholder:"Geben Sie Ihre Gemeinde oder PLZ ein",value:t,"data-testid":"location-search-input",autoFocus:!0}),Ve.jsx("button",{className:"btn bg-white join-item",type:"button",onClick:()=>s(t),children:Ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",version:"1.1",id:"Capa_1",x:"0px",y:"0px",viewBox:"0 0 513.749 513.749",width:"16",height:"16",children:Ve.jsx("g",{children:Ve.jsx("path",{d:"M504.352,459.061l-99.435-99.477c74.402-99.427,54.115-240.344-45.312-314.746S119.261-9.277,44.859,90.15   S-9.256,330.494,90.171,404.896c79.868,59.766,189.565,59.766,269.434,0l99.477,99.477c12.501,12.501,32.769,12.501,45.269,0   c12.501-12.501,12.501-32.769,0-45.269L504.352,459.061z M225.717,385.696c-88.366,0-160-71.634-160-160s71.634-160,160-160   s160,71.634,160,160C385.623,314.022,314.044,385.602,225.717,385.696z"})})})})]}),y&&u.length>0&&Ve.jsx("ul",{className:"card bg-base-100 my-4 py-4 divide-x-2",children:u.map(B=>Ve.jsxs("li",{className:"cursor-pointer px-4 py-2 hover:bg-base-300",onClick:()=>L(B),children:[Ve.jsx("div",{children:B.text}),Ve.jsx("small",{className:"block text-gray-400",children:B.place_name})]},B.id))})]})};function rZ({className:e}){return Ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",focusable:"false",children:[Ve.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),Ve.jsx("path",{d:"M3 6h18"}),Ve.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}const iZ=({parcelGroup:e,onRemoveParcel:t})=>Ve.jsx("div",{className:"absolute top-0 left-0 z-20 max-w-[min(100%,22rem)] overflow-hidden border border-base-300 bg-base-100/90 text-xs leading-tight shadow-sm pointer-events-auto",children:Ve.jsx("div",{className:"max-h-[40vh] overflow-y-auto",children:Ve.jsx("table",{className:"table table-xs w-full border-collapse [&_td]:px-1.5 [&_td]:py-0.5",children:Ve.jsx("tbody",{children:Object.entries(e).flatMap(([o,u])=>Object.entries(u).flatMap(([p,y])=>y.map(({id:T,parcelUnit:s},M)=>Ve.jsxs("tr",{children:[Ve.jsx("td",{className:"max-w-[7rem] truncate",title:o,children:o}),Ve.jsx("td",{className:"whitespace-nowrap",children:p}),Ve.jsx("td",{className:"whitespace-nowrap",children:s??""}),Ve.jsx("td",{className:"whitespace-nowrap",children:T&&Ve.jsx("button",{type:"button","data-testid":`remove-parcel-${T}`,"aria-label":`Flurstück ${s??T} entfernen`,onClick:()=>t(T),className:"flex text-error",children:Ve.jsx(rZ,{className:"size-3"})})})]},T??`${o}-${p}-${M}`))))})})})}),nZ={type:"raster",tiles:["https://geoservices.bayern.de/od/wms/alkis/v1/parzellarkarte?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=by_alkis_parzellarkarte_umr_schwarz&STYLES=&CRS=EPSG:3857&WIDTH=256&HEIGHT=256&FORMAT=image/png&TRANSPARENT=true&BBOX={bbox-epsg-3857}"],tileSize:256,bounds:[8.97,47.27,13.84,50.56],attribution:"&copy; Bayerische Vermessungsverwaltung (ALKIS-Parzellarkarte, CC BY 4.0)"},oZ=(e,t)=>{var y;if(!((y=e==null?void 0:e.tiles)!=null&&y.length))return;const o=e.tiles[0],[u]=o.split("?"),p=`${u}${t}`;e.setTiles([p])};class sZ extends hS.Map{constructor(){super(...arguments);de(this,"state",{});de(this,"notifyStateChange")}subscribe(o){this.notifyStateChange=o}getState(){return this.state}changeState(o){var p;Object.keys(o).every(y=>this.state[y]===o[y])||(this.state={...this.state,...o},(p=this.notifyStateChange)==null||p.call(this))}async setVectorTileUrlWhenReady(o,u){var y;await this.waitForSourceReady(o);const p=this.getSource(o);!((y=p==null?void 0:p.tiles)!=null&&y.length)||p.tiles[0].endsWith(u)||oZ(p,u)}async waitForSourceReady(o){this.isStyleLoaded()||await new Promise(u=>this.once("style.load",()=>u())),await new Promise(u=>{if(this.getSource(o))return u();const p=y=>{y.sourceId===o&&this.getSource(o)&&(this.off("sourcedata",p),u())};this.on("sourcedata",p)}),this.isSourceLoaded(o)||await new Promise(u=>{const p=y=>{y.sourceId===o&&y.isSourceLoaded&&(this.off("sourcedata",p),u())};this.on("sourcedata",p)})}onClickOrTap(o){let u=!1,p=!1;const y=()=>{u=!1,p=!1},T=()=>{u=!0},s=L=>{u||(p=!0,o(L))},M=L=>{if(p){p=!1;return}o(L)};return this.on("touchstart",y),this.on("touchmove",T),this.on("touchend",s),this.on("click",M),()=>{this.off("touchstart",y),this.off("touchmove",T),this.off("touchend",s),this.off("click",M)}}}const Aa={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMB
2819INE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},xl={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},fo={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},Pa={POLYGON:"polygon",LINE:"line_string",POINT:"point"},ni={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},_n={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},ea={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},O_={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},Fs={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},ns={ACTIVE:"true",INACTIVE:"false"},xL=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],aZ=-90,pS=-85,lZ=90,mS=85,bL=Object.freeze(Object.defineProperty({__proto__:null,LAT_MAX:lZ,LAT_MIN:aZ,LAT_RENDERED_MAX:mS,LAT_RENDERED_MIN:pS,LNG_MAX:270,LNG_MIN:-270,activeStates:ns,classes:Aa,cursors:fo,events:ea,geojsonTypes:ni,interactions:xL,meta:Fs,modes:_n,sources:xl,types:Pa,updateActions:O_},Symbol.toStringTag,{value:"Module"}));function Qx(e){return function(t){const o=t.featureTarget;return!o||!o.properties?!1:o.properties.meta===e}}function wL(e){return!e.originalEvent||!e.originalEvent.shiftKey?!1:e.originalEvent.button===0}function Wd(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===ns.ACTIVE&&e.featureTarget.properties.meta===Fs.FEATURE}function gS(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===ns.INACTIVE&&e.featureTarget.properties.meta===Fs.FEATURE}function e1(e){return e.featureTarget===void 0}function _S(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.meta===Fs.FEATURE}function F_(e){const t=e.featureTarget;return!t||!t.properties?!1:t.properties.meta===Fs.VERTEX}function t1(e){return e.originalEvent?e.originalEvent.shiftKey===!0:!1}function r1(e){return e.key==="Escape"||e.keyCode===27}function i1(e){return e.key==="Enter"||e.keyCode===13}function yS(e){return e.key==="Backspace"||e.keyCode===8}function vS(e){return e.key==="Delete"||e.keyCode===46}function TL(e){return e.key==="1"||e.keyCode===49}function EL(e){return e.key==="2"||e.keyCode===50}function SL(e){return e.key==="3"||e.keyCode===51}function CL(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function cZ(){return!0}const uZ=Object.freeze(Object.defineProperty({__proto__:null,isActiveFeature:Wd,isBackspaceKey:yS,isDeleteKey:vS,isDigit1Key:TL,isDigit2Key:EL,isDigit3Key:SL,isDigitKey:CL,isEnterKey:i1,isEscapeKey:r1,isFeature:_S,isInactiveFeature:gS,isOfMetaType:Qx,isShiftDown:t1,isShiftMousedown:wL,isTrue:cZ,isVertex:F_,noTarget:e1},Symbol.toStringTag,{value:"Module"}));var xS={},n1={};n1.RADIUS=6378137,n1.FLATTENING=1/298.257223563,n1.POLAR_RADIUS=63567523142e-4;var IL=n1;xS.geometry=AL,xS.ring=bS;function AL(e){var t=0,o;switch(e.type){case"Polygon":return PL(e.coordinates);case"MultiPolygon":for(o=0;o<e.coordinates.length;o++)t+=PL(e.coordinates[o]);return t;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(o=0;o<e.geometries.length;o++)t+=AL(e.geometries[o]);return t}}function PL(e){var t=0;if(e&&e.length>0){t+=Math.abs(bS(e[0]));for(var o=1;o<e.length;o++)t-=Math.abs(bS(e[o]))}return t}function bS(e){var t,o,u,p,y,T,s,M=0,L=e.length;if(L>2){for(s=0;s<L;s++)s===L-2?(p=L-2,y=L-1,T=0):s===L-1?(p=L-1,y=0,T=1):(p=s,y=s+1,T=s+2),t=e[p],o=e[y],u=e[T],M+=(wS(u[0])-wS(t[0]))*Math.sin(wS(o[1]));M=M*IL.RADIUS*IL.RADIUS/2}return M}function wS(e){return e*Math.PI/180}const ML={Point:0,LineString:1,MultiLineString:1,Polygon:2};function hZ(e,t){const o=ML[e.geometry.type]-ML[t.geometry.type];return o===0&&e.geometry.type===ni.POLYGON?e.area-t.area:o}function kL(e){return e.map(t=>(t.geometry.type===ni.POLYGON&&(t.area=xS.geometry({type:ni.FEATURE,property:{},geometry:t.geometry})),t)).sort(hZ).map(t=>(delete t.area,t))}function RL(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function bl(e){if(this._items={},this._nums={},this._length=e?e.length:0,!!e)for(let t=0,o=e.length;t<o;
2819t++)this.add(e[t]),e[t]!==void 0&&(typeof e[t]=="string"?this._items[e[t]]=t:this._nums[e[t]]=t)}bl.prototype.add=function(e){return this.has(e)?this:(this._length++,typeof e=="string"?this._items[e]=this._length:this._nums[e]=this._length,this)},bl.prototype.delete=function(e){return this.has(e)===!1?this:(this._length--,delete this._items[e],delete this._nums[e],this)},bl.prototype.has=function(e){return typeof e!="string"&&typeof e!="number"?!1:this._items[e]!==void 0||this._nums[e]!==void 0},bl.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,o)=>t.v-o.v).map(t=>t.k)},bl.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const dZ=[Fs.FEATURE,Fs.MIDPOINT,Fs.VERTEX],$p={click:fZ,touch:pZ};function fZ(e,t,o){return LL(e,t,o,o.options.clickBuffer)}function pZ(e,t,o){return LL(e,t,o,o.options.touchBuffer)}function LL(e,t,o,u){if(o.map===null)return[];const p=e?RL(e,u):t,y={};o.options.styles&&(y.layers=o.options.styles.map(L=>L.id).filter(L=>o.map.getLayer(L)!=null));const T=o.map.queryRenderedFeatures(p,y).filter(L=>dZ.indexOf(L.properties.meta)!==-1),s=new bl,M=[];return T.forEach(L=>{const B=L.properties.id;s.has(B)||(s.add(B),M.push(L))}),kL(M)}function o1(e,t){const o=$p.click(e,null,t),u={mouse:fo.NONE};return o[0]&&(u.mouse=o[0].properties.active===ns.ACTIVE?fo.MOVE:fo.POINTER,u.feature=o[0].properties.meta),t.events.currentModeName().indexOf("draw")!==-1&&(u.mouse=fo.ADD),t.ui.queueMapClasses(u),t.ui.updateMapClasses(),o[0]}function TS(e,t){const o=e.x-t.x,u=e.y-t.y;return Math.sqrt(o*o+u*u)}const mZ=4,gZ=12,_Z=500;function ES(e,t,o={}){const u=o.fineTolerance!=null?o.fineTolerance:mZ,p=o.grossTolerance!=null?o.grossTolerance:gZ,y=o.interval!=null?o.interval:_Z;e.point=e.point||t.point,e.time=e.time||t.time;const T=TS(e.point,t.point);return T<u||T<p&&t.time-e.time<y}const yZ=25,vZ=250;function SS(e,t,o={}){const u=o.tolerance!=null?o.tolerance:yZ,p=o.interval!=null?o.interval:vZ;return e.point=e.point||t.point,e.time=e.time||t.time,TS(e.point,t.point)<u&&t.time-e.time<p}const CS=function(e,t){const o={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},u={on(y,T,s){if(o[y]===void 0)throw new Error(`Invalid event type: ${y}`);o[y].push({selector:T,fn:s})},render(y){t.store.featureChanged(y)}},p=function(y,T){const s=o[y];let M=s.length;for(;M--;){const L=s[M];if(L.selector(T)){L.fn.call(u,T)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(u),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(y){p("drag",y)},click(y){p("click",y)},mousemove(y){p("mousemove",y)},mousedown(y){p("mousedown",y)},mouseup(y){p("mouseup",y)},mouseout(y){p("mouseout",y)},keydown(y){p("keydown",y)},keyup(y){p("keyup",y)},touchstart(y){p("touchstart",y)},touchmove(y){p("touchmove",y)},touchend(y){p("touchend",y)},tap(y){p("tap",y)}}},xZ=((e,t=21)=>(o=t)=>{let u="",p=o|0;for(;p--;)u+=e[Math.random()*e.length|0];return u})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function IS(){return xZ()}const ta=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||IS(),this.type=t.geometry.type};ta.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},ta.prototype.incomingCoords=function(e){this.setCoordinates(e)},ta.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},ta.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},ta.prototype.setProperty=function(e,t){this.properties[e]=t},ta.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:ni.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.t
2819ype}}))},ta.prototype.internal=function(e){const t={id:this.id,meta:Fs.FEATURE,"meta:type":this.type,active:ns.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const o in this.properties)t[`user_${o}`]=this.properties[o];return{type:ni.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const Th=function(e,t){ta.call(this,e,t)};Th.prototype=Object.create(ta.prototype),Th.prototype.isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"},Th.prototype.updateCoordinate=function(e,t,o){arguments.length===3?this.coordinates=[t,o]:this.coordinates=[e,t],this.changed()},Th.prototype.getCoordinate=function(){return this.getCoordinates()};const Pc=function(e,t){ta.call(this,e,t)};Pc.prototype=Object.create(ta.prototype),Pc.prototype.isValid=function(){return this.coordinates.length>1},Pc.prototype.addCoordinate=function(e,t,o){this.changed();const u=parseInt(e,10);this.coordinates.splice(u,0,[t,o])},Pc.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},Pc.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},Pc.prototype.updateCoordinate=function(e,t,o){const u=parseInt(e,10);this.coordinates[u]=[t,o],this.changed()};const Ja=function(e,t){ta.call(this,e,t),this.coordinates=this.coordinates.map(o=>o.slice(0,-1))};Ja.prototype=Object.create(ta.prototype),Ja.prototype.isValid=function(){return this.coordinates.length===0?!1:this.coordinates.every(e=>e.length>2)},Ja.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()},Ja.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},Ja.prototype.addCoordinate=function(e,t,o){this.changed();const u=e.split(".").map(y=>parseInt(y,10));this.coordinates[u[0]].splice(u[1],0,[t,o])},Ja.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(u=>parseInt(u,10)),o=this.coordinates[t[0]];o&&(o.splice(t[1],1),o.length<3&&this.coordinates.splice(t[0],1))},Ja.prototype.getCoordinate=function(e){const t=e.split(".").map(u=>parseInt(u,10)),o=this.coordinates[t[0]];return JSON.parse(JSON.stringify(o[t[1]]))},Ja.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))},Ja.prototype.updateCoordinate=function(e,t,o){this.changed();const u=e.split("."),p=parseInt(u[0],10),y=parseInt(u[1],10);this.coordinates[p]===void 0&&(this.coordinates[p]=[]),this.coordinates[p][y]=[t,o]};const bZ={MultiPoint:Th,MultiLineString:Pc,MultiPolygon:Ja},s1=(e,t,o,u,p)=>{const y=o.split("."),T=parseInt(y[0],10),s=y[1]?y.slice(1).join("."):null;return e[T][t](s,u,p)},ra=function(e,t){if(ta.call(this,e,t),delete this.coordinates,this.model=bZ[t.geometry.type],this.model===void 0)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};ra.prototype=Object.create(ta.prototype),ra.prototype._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(o=>new t(this.ctx,{id:IS(),type:ni.FEATURE,properties:{}
2819,geometry:{coordinates:o,type:this.type.replace("Multi","")}}))},ra.prototype.isValid=function(){return this.features.every(e=>e.isValid())},ra.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},ra.prototype.getCoordinate=function(e){return s1(this.features,"getCoordinate",e)},ra.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===ni.POLYGON?e.getCoordinates():e.coordinates)))},ra.prototype.updateCoordinate=function(e,t,o){s1(this.features,"updateCoordinate",e,t,o),this.changed()},ra.prototype.addCoordinate=function(e,t,o){s1(this.features,"addCoordinate",e,t,o),this.changed()},ra.prototype.removeCoordinate=function(e){s1(this.features,"removeCoordinate",e),this.changed()},ra.prototype.getFeatures=function(){return this.features};function Qi(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}Qi.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},Qi.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,o)=>(t[o.feature_id]===void 0&&(t[o.feature_id]=!0,this._ctx.store.get(o.feature_id).changed()),t),{})},Qi.prototype.getSelected=function(){return this._ctx.store.getSelected()},Qi.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},Qi.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},Qi.prototype.getFeature=function(e){return this._ctx.store.get(e)},Qi.prototype.select=function(e){return this._ctx.store.select(e)},Qi.prototype.deselect=function(e){return this._ctx.store.deselect(e)},Qi.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},Qi.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},Qi.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},Qi.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},Qi.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},Qi.prototype.changeMode=function(e,t={},o={}){return this._ctx.events.changeMode(e,t,o)},Qi.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},Qi.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},Qi.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},Qi.prototype.featuresAt=function(e,t,o="click"){if(o!=="click"&&o!=="touch")throw new Error("invalid buffer type");return $p[o](e,t,this._ctx)},Qi.prototype.newFeature=function(e){const t=e.geometry.type;return t===ni.POINT?new Th(this._ctx,e):t===ni.LINE_STRING?new Pc(this._ctx,e):t===ni.POLYGON?new Ja(this._ctx,e):new ra(this._ctx,e)},Qi.prototype.isInstanceOf=function(e,t){if(e===ni.POINT)return t instanceof Th;if(e===ni.LINE_STRING)return t instanceof Pc;if(e===ni.POLYGON)return t instanceof Ja;if(e==="MultiFeature")return t instanceof ra;throw new Error(`Unknown feature class: ${e}`)},Qi.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)},Qi.prototype.onSetup=function(){},Qi.prototype.onDrag=function(){},Qi.prototype.onClick=function(){},Qi.prototype.onMouseMove=function(){},Qi.prototype.onMouseDown=function(){},Qi.prototype.onMouseUp=function(){},Qi.prototype.onMouseOut=function(){},Qi.prototype.onKeyUp=function(){},Qi.prototype.onKeyDown=function(){},Qi.prototype.onTouchStart=function(){},Qi.prototype.onTouchMove=function(){},Qi.prototype.onTouchEnd=function(){},Qi.prototype.onTap=function(){},Qi.prototype.onStop=function(){},Qi.prototype.onTrash=function(){},Qi.prototype.onCombineFeature=function(){},Qi.prototype.onUncombineFeature=function(){},Qi.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const zL={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},wZ=Object.keys(zL);function TZ(e){const t=Object.keys(e);return function(o,u={}){let p={};const y=t.reduce((s,M)=>(s[M]=e[M],s),new Qi(o));function T(s){return M=>y[s](p,M)}
2819return{start(){p=y.onSetup(u),wZ.forEach(s=>{const M=zL[s];let L=()=>!1;e[M]&&(L=()=>!0),this.on(s,L,T(M))})},stop(){y.onStop(p)},trash(){y.onTrash(p)},combineFeatures(){y.onCombineFeatures(p)},uncombineFeatures(){y.onUncombineFeatures(p)},render(s,M){y.toDisplayFeatures(p,s,M)}}}}function EZ(e){const t=Object.keys(e.options.modes).reduce(($,te)=>($[te]=TZ(e.options.modes[te]),$),{});let o={},u={};const p={};let y=null,T=null;p.drag=function($,te){te({point:$.point,time:new Date().getTime()})?(e.ui.queueMapClasses({mouse:fo.DRAG}),T.drag($)):$.originalEvent.stopPropagation()},p.mousedrag=function($){p.drag($,te=>!ES(o,te))},p.touchdrag=function($){p.drag($,te=>!SS(u,te))},p.mousemove=function($){if(($.originalEvent.buttons!==void 0?$.originalEvent.buttons:$.originalEvent.which)===1)return p.mousedrag($);const xe=o1($,e);$.featureTarget=xe,T.mousemove($)},p.mousedown=function($){o={time:new Date().getTime(),point:$.point};const te=o1($,e);$.featureTarget=te,T.mousedown($)},p.mouseup=function($){const te=o1($,e);$.featureTarget=te,ES(o,{point:$.point,time:new Date().getTime()})?T.click($):T.mouseup($)},p.mouseout=function($){T.mouseout($)},p.touchstart=function($){if(!e.options.touchEnabled)return;u={time:new Date().getTime(),point:$.point};const te=$p.touch($,null,e)[0];$.featureTarget=te,T.touchstart($)},p.touchmove=function($){if(e.options.touchEnabled)return T.touchmove($),p.touchdrag($)},p.touchend=function($){if($.originalEvent.preventDefault(),!e.options.touchEnabled)return;const te=$p.touch($,null,e)[0];$.featureTarget=te,SS(u,{time:new Date().getTime(),point:$.point})?T.tap($):T.touchend($)};const s=$=>{const te=yS($),xe=vS($),pe=CL($);return!(te||xe||pe)};p.keydown=function($){($.srcElement||$.target).classList.contains(Aa.CANVAS)&&((yS($)||vS($))&&e.options.controls.trash?($.preventDefault(),T.trash()):s($)?T.keydown($):TL($)&&e.options.controls.point?M(_n.DRAW_POINT):EL($)&&e.options.controls.line_string?M(_n.DRAW_LINE_STRING):SL($)&&e.options.controls.polygon&&M(_n.DRAW_POLYGON))},p.keyup=function($){s($)&&T.keyup($)},p.zoomend=function(){e.store.changeZoom()},p.data=function($){if($.dataType==="style"){const{setup:te,map:xe,options:pe,store:Ne}=e;pe.styles.some(ie=>xe.getLayer(ie.id))||(te.addLayers(),Ne.setDirty(),Ne.render())}};function M($,te,xe={}){T.stop();const pe=t[$];if(pe===void 0)throw new Error(`${$} is not valid`);y=$;const Ne=pe(e,te);T=CS(Ne,e),xe.silent||e.map.fire(ea.MODE_CHANGE,{mode:$}),e.store.setDirty(),e.store.render()}const L={trash:!1,combineFeatures:!1,uncombineFeatures:!1};function B($){let te=!1;Object.keys($).forEach(xe=>{if(L[xe]===void 0)throw new Error("Invalid action type");L[xe]!==$[xe]&&(te=!0),L[xe]=$[xe]}),te&&e.map.fire(ea.ACTIONABLE,{actions:L})}return{start(){y=e.options.defaultMode,T=CS(t[y](e),e)},changeMode:M,actionable:B,currentModeName(){return y},currentModeRender($,te){return T.render($,te)},fire($,te){e.map&&e.map.fire($,te)},addEventListeners(){e.map.on("mousemove",p.mousemove),e.map.on("mousedown",p.mousedown),e.map.on("mouseup",p.mouseup),e.map.on("data",p.data),e.map.on("touchmove",p.touchmove),e.map.on("touchstart",p.touchstart),e.map.on("touchend",p.touchend),e.container.addEventListener("mouseout",p.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",p.keydown),e.container.addEventListener("keyup",p.keyup))},removeEventListeners(){e.map.off("mousemove",p.mousemove),e.map.off("mousedown",p.mousedown),e.map.off("mouseup",p.mouseup),e.map.off("data",p.data),e.map.off("touchmove",p.touchmove),e.map.off("touchstart",p.touchstart),e.map.off("touchend",p.touchend),e.container.removeEventListener("mouseout",p.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",p.keydown),e.container.removeEventListener("keyup",p.keyup))},trash($){T.trash($)},combineFeatures(){T.combineFeatures()},uncombineFeatures(){T.uncombineFeatures()},getMode(){return y}}}function N_(e){return[].concat(e).filter(t=>t!==void 0)}function SZ(){const e=this;if(!(e.ctx.map&&e.ctx.map.getSource(xl.HOT)!==void 0))return M();const o=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:o});let u=[],p=[];e.isDirty?p=e.getAllIds():(u=e.getChangedIds().filter(L=>e.get(L)!==void 0),p=e.sources.hot.filter(L=>L.properties.id&&u.indexOf(L.properties.id)===-1&&e.get(L.properties.id)!==void 0).map(L=>L.properties.id)),e.sources.hot=[];const y=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(L=>{const B=L.properties.id||L.properties.parent;return u.indexOf(B)===-1});const T=y!==e.sources.cold.length||p.length>0;u.forEach(L=>s(L,"hot")),p.forEach(L=>s(L,"cold"));function s(L,B){const $=e.get(L).internal(o);e.ctx.events.currentModeRender($,te=>{te.properties.mode=o,e.sources[B].push(te)})}T&&e.ctx.map.getSource(xl.COLD).setData({type:ni.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(xl.HOT).setData({type:ni.FEATURE_COLLECTION,features:e.sources.hot}),M();function M(){e.isDirty=!1,e.clearChangedIds()}}function Yn(e){this._features={},this._featureIds=new bl,this._selectedFeatureIds=new bl,this._selectedCoordinates=[],this._changedFeatureIds=new bl,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]};let t;this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,SZ.call(this),this._emitSelectionChange&&(this.ctx.events.fire(ea.SELECTION_CHANGE,{features:this.getSelected().map(o=>o.toGeoJSON()),points:this.getSelectedCoordinates().map(o=>({type:ni.FEATURE,properties:{},geometry:{type:ni.POINT,coordinates:o.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(ea.RENDER,{})}))},this.isDirty=!1}Yn.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},Yn.prototype.setDirty=function(){return this.isDirty=!0,this},Yn.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0){const u=this.get(e);this.ctx.events.fire(ea.CREATE,{features:[u.toGeoJSON()]})}return this},Yn.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0&&this.ctx.events.fire(ea.UPDATE,{action:t.action?t.action:O_.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},Yn.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},Yn.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},Yn.prototype.getAllIds=function(){return this._featureIds.values()},Yn.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},Yn.prototype.delete=function(e,t={}){const o=[];return N_(e).forEach(u=>{this._featureIds.has(u)&&(this._featureIds.delete(u),this._selectedFeatureIds.delete(u),t.silent||o.indexOf(this._features[u])===-1&&o.push(this._features[u].toGeoJSON()),delete this._features[u],this.isDirty=!0)}),o.length&&this.ctx.events.fire(ea.DELETE,{features:o}),DL(this,t),this},Yn.prototype.get=function(e){return this._features[e]},Yn.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])},Yn.prototype.select=function(e,t={}){return N_(e).forEach(o=>
2819{this._selectedFeatureIds.has(o)||(this._selectedFeatureIds.add(o),this._changedFeatureIds.add(o),t.silent||(this._emitSelectionChange=!0))}),this},Yn.prototype.deselect=function(e,t={}){return N_(e).forEach(o=>{this._selectedFeatureIds.has(o)&&(this._selectedFeatureIds.delete(o),this._changedFeatureIds.add(o),t.silent||(this._emitSelectionChange=!0))}),DL(this,t),this},Yn.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},Yn.prototype.setSelected=function(e,t={}){return e=N_(e),this.deselect(this._selectedFeatureIds.values().filter(o=>e.indexOf(o)===-1),{silent:t.silent}),this.select(e.filter(o=>!this._selectedFeatureIds.has(o)),{silent:t.silent}),this},Yn.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},Yn.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},Yn.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},Yn.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))},Yn.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))},Yn.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},Yn.prototype.setFeatureProperty=function(e,t,o,u={}){this.get(e).setProperty(t,o),this.featureChanged(e,{silent:u.silent,action:O_.CHANGE_PROPERTIES})};function DL(e,t={}){const o=e._selectedCoordinates.filter(u=>e._selectedFeatureIds.has(u.feature_id));e._selectedCoordinates.length!==o.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=o}Yn.prototype.storeMapConfig=function(){xL.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})},Yn.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})},Yn.prototype.getInitialConfigValue=function(e){return this._mapInitialConfig[e]!==void 0?this._mapInitialConfig[e]:!0};const CZ=["mode","feature","mouse"];function IZ(e){const t={};let o=null,u={mode:null,feature:null,mouse:null},p={mode:null,feature:null,mouse:null};function y(){T({mode:null,feature:null,mouse:null}),s()}function T(te){p=Object.assign(p,te)}function s(){if(!e.container)return;const te=[],xe=[];CZ.forEach(pe=>{p[pe]!==u[pe]&&(te.push(`${pe}-${u[pe]}`),p[pe]!==null&&xe.push(`${pe}-${p[pe]}`))}),te.length>0&&e.container.classList.remove(...te),xe.length>0&&e.container.classList.add(...xe),u=Object.assign(u,p)}function M(te,xe={}){const pe=document.createElement("button");return pe.className=`${Aa.CONTROL_BUTTON} ${xe.className}`,pe.setAttribute("title",xe.title),xe.container.appendChild(pe),pe.addEventListener("click",Ne=>{if(Ne.preventDefault(),Ne.stopPropagation(),Ne.target===o){L(),xe.onDeactivate();return}B(te),xe.onActivate()},!0),pe}function L(){o&&(o.classList.remove(Aa.ACTIVE_BUTTON),o=null)}function B(te){L();const xe=t[te];xe&&xe&&te!=="trash"&&(xe.classList.add(Aa.ACTIVE_BUTTON),o=xe)}function H(){const te=e.options.controls,xe=document.createElement("div");return xe.className=`${Aa.CONTROL_GROUP} ${Aa.CONTROL_BASE}`,te&&(te[Pa.POINT]&&(t[Pa.POINT]=M(Pa.POINT,{container:xe,className:Aa.CONTROL_BUTTON_POINT,title:`Marker tool ${e.options.keybindings?"(1)":""}`,onActivate:()=>e.events.changeMode(_n.DRAW_POINT),onDeactivate:()=>e.events.trash()})),te[Pa.LINE]&&(t[Pa.LINE]=M(Pa.LINE,{container:xe,className:Aa.CONTROL_BUTTON_LINE,title:`LineString tool ${e.options.keybindings?"(2)":""}`,onActivate:()=>e.events.changeMode(_n.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),te[Pa.POLYGON]&&(t[Pa.POLYGON]=M(Pa.POLYGON,{container:xe,className:Aa.CONTROL_BUTTON_POLYGON,title:`Polygon tool ${e.options.keybindings?"(3)":""}`,onActivate:()=>e.events.changeMode(_n.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),te.trash&&(t.trash=M("trash",{container:xe,className:Aa.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),te.combine_features&&(t.combine_features=M("combineFeatures",{container:xe,className:Aa.CONTROL_BUTTON_COMB
2819INE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),te.uncombine_features&&(t.uncombine_features=M("uncombineFeatures",{container:xe,className:Aa.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),xe}function $(){Object.keys(t).forEach(te=>{const xe=t[te];xe.parentNode&&xe.parentNode.removeChild(xe),delete t[te]})}return{setActiveButton:B,queueMapClasses:T,updateMapClasses:s,clearMapClasses:y,addButtons:H,removeButtons:$}}function AZ(e){let t=null,o=null;const u={onRemove(){return e.map.off("load",u.connect),clearInterval(o),u.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",u.connect),clearInterval(o),u.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(p){if(e.map=p,e.events=EZ(e),e.ui=IZ(e),e.container=p.getContainer(),e.store=new Yn(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=p.boxZoom.isEnabled(),p.boxZoom.disable();const y=p.dragPan.isEnabled();p.dragPan.disable(),p.dragPan.enable(),y||p.dragPan.disable()}return p.loaded()?u.connect():(p.on("load",u.connect),o=setInterval(()=>{p.loaded()&&u.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(xl.COLD,{data:{type:ni.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(xl.HOT,{data:{type:ni.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(p=>{e.map.addLayer(p)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(p=>{e.map.getLayer(p.id)&&e.map.removeLayer(p.id)}),e.map.getSource(xl.COLD)&&e.map.removeSource(xl.COLD),e.map.getSource(xl.HOT)&&e.map.removeSource(xl.HOT)}};return e.setup=u,u}const AS="#3bb2d0",B_="#fbb03b",OL="#fff",FL=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],B_,AS],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],B_,AS],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":OL}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],B_,AS]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":OL}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":B_}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":B_}}];function Eh(e,t){this.x=e,this.y=t}Eh.prototype={clone(){return new Eh(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,o=e.y-this.y;return t*t+o*o},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,o=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=o,this},_add(e){return this.x+=e.x,this.y+=e.y,this}
2819,_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),o=Math.sin(e),u=t*this.x-o*this.y,p=o*this.x+t*this.y;return this.x=u,this.y=p,this},_rotateAround(e,t){const o=Math.cos(e),u=Math.sin(e),p=t.x+o*(this.x-t.x)-u*(this.y-t.y),y=t.y+u*(this.x-t.x)+o*(this.y-t.y);return this.x=p,this.y=y,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Eh},Eh.convert=function(e){if(e instanceof Eh)return e;if(Array.isArray(e))return new Eh(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new Eh(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};function PS(e,t){const o=t.getBoundingClientRect();return new Eh(e.clientX-o.left-(t.clientLeft||0),e.clientY-o.top-(t.clientTop||0))}function Hp(e,t,o,u){return{type:ni.FEATURE,properties:{meta:Fs.VERTEX,parent:e,coord_path:o,active:u?ns.ACTIVE:ns.INACTIVE},geometry:{type:ni.POINT,coordinates:t}}}var ia=63710088e-1,PZ={centimeters:ia*100,centimetres:ia*100,degrees:360/(2*Math.PI),feet:ia*3.28084,inches:ia*39.37,kilometers:ia/1e3,kilometres:ia/1e3,meters:ia,metres:ia,miles:ia/1609.344,millimeters:ia*1e3,millimetres:ia*1e3,nauticalmiles:ia/1852,radians:1,yards:ia*1.0936};function MS(e,t,o={}){const u={type:"Feature"};return(o.id===0||o.id)&&(u.id=o.id),o.bbox&&(u.bbox=o.bbox),u.properties=t||{},u.geometry=e,u}function NL(e,t,o={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!kS(e[0])||!kS(e[1]))throw new Error("coordinates must contain numbers");return MS({type:"Point",coordinates:e},t,o)}function MZ(e,t,o={}){for(const p of e){if(p.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(p[p.length-1].length!==p[0].length)throw new Error("First and last Position are not equivalent.");for(let y=0;y<p[p.length-1].length;y++)if(p[p.length-1][y]!==p[0][y])throw new Error("First and last Position are not equivalent.")}return MS({type:"Polygon",coordinates:e},t,o)}function kZ(e,t,o={}){return MS({type:"MultiPolygon",coordinates:e},t,o)}function RZ(e,t="kilometers"){const o=PZ[t];
2819if(!o)throw new Error(t+" units is invalid");return e*o}function a1(e){return e%360*Math.PI/180}function kS(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function RS(e,t,o){if(e!==null)for(var u,p,y,T,s,M,L,B=0,H=0,$,te=e.type,xe=te==="FeatureCollection",pe=te==="Feature",Ne=xe?e.features.length:1,_e=0;_e<Ne;_e++){L=xe?e.features[_e].geometry:pe?e.geometry:e,$=L?L.type==="GeometryCollection":!1,s=$?L.geometries.length:1;for(var ie=0;ie<s;ie++){var ke=0,ot=0;if(T=$?L.geometries[ie]:L,T!==null){M=T.coordinates;var et=T.type;switch(B=0,et){case null:break;case"Point":if(t(M,H,_e,ke,ot)===!1)return!1;H++,ke++;break;case"LineString":case"MultiPoint":for(u=0;u<M.length;u++){if(t(M[u],H,_e,ke,ot)===!1)return!1;H++,et==="MultiPoint"&&ke++}et==="LineString"&&ke++;break;case"Polygon":case"MultiLineString":for(u=0;u<M.length;u++){for(p=0;p<M[u].length-B;p++){if(t(M[u][p],H,_e,ke,ot)===!1)return!1;H++}et==="MultiLineString"&&ke++,et==="Polygon"&&ot++}et==="Polygon"&&ke++;break;case"MultiPolygon":for(u=0;u<M.length;u++){for(ot=0,p=0;p<M[u].length;p++){for(y=0;y<M[u][p].length-B;y++){if(t(M[u][p][y],H,_e,ke,ot)===!1)return!1;H++}ot++}ke++}break;case"GeometryCollection":for(u=0;u<T.geometries.length;u++)if(RS(T.geometries[u],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function BL(e,t){var o,u,p,y,T,s,M,L,B,H,$=0,te=e.type==="FeatureCollection",xe=e.type==="Feature",pe=te?e.features.length:1;for(o=0;o<pe;o++){for(s=te?e.features[o].geometry:xe?e.geometry:e,L=te?e.features[o].properties:xe?e.properties:{},B=te?e.features[o].bbox:xe?e.bbox:void 0,H=te?e.features[o].id:xe?e.id:void 0,M=s?s.type==="GeometryCollection":!1,T=M?s.geometries.length:1,p=0;p<T;p++){if(y=M?s.geometries[p]:s,y===null){if(t(null,$,L,B,H)===!1)return!1;continue}switch(y.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(y,$,L,B,H)===!1)return!1;break}case"GeometryCollection":{for(u=0;u<y.geometries.length;u++)if(t(y.geometries[u],$,L,B,H)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}$++}}function LZ(e,t,o){var u=o;return BL(e,function(p,y,T,s,M){u=t(u,p,y,T,s,M)}),u}function zZ(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return VL(e);case"FeatureCollection":return DZ(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return LS(e);default:throw new Error("unknown GeoJSON type")}}function VL(e){const t={type:"Feature"};return Object.keys(e).forEach(o=>{switch(o){case"type":case"properties":case"geometry":return;default:t[o]=e[o]}}),t.properties=UL(e.properties),e.geometry==null?t.geometry=null:t.geometry=LS(e.geometry),t}function UL(e){const t={};return e&&Object.keys(e).forEach(o=>{const u=e[o];typeof u=="object"?u===null?t[o]=null:Array.isArray(u)?t[o]=u.map(p=>p):t[o]=UL(u):t[o]=u}),t}function DZ(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(o=>{switch(o){case"type":case"features":return;default:t[o]=e[o]}}),t.features=e.features.map(o=>VL(o)),t}function LS(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),e.type==="GeometryCollection"?(t.geometries=e.geometries.map(o=>LS(o)),t):(t.coordinates=jL(e.coordinates),t)}function jL(e){const t=e;return typeof t[0]!="object"?t.slice():t.map(o=>jL(o))}function GL(e,t={}){return $L(e,"mercator",t)}function OZ(e,t={}){return $L(e,"wgs84",t)}function $L(e,t,o={}){o=o||{};var u=o.mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&kS(e[0])?e=t==="mercator"?HL(e):qL(e):(u!==!0&&(e=zZ(e)),RS(e,function(p){var y=t==="mercator"?HL(p):qL(p);p[0]=y[0],p[1]=y[1]})),e}function HL(e){var t=Math.PI/180,o=6378137,u=20037508342789244e-9,p=Math.abs(e[0])<=180?e[0]:e[0]-FZ(e[0])*360,y=[o*p*t,o*Math.log(Math.tan(Math.PI*.25+.5*e[1]*t))];return y[0]>u&&(y[0]=u),y[0]<-u&&(y[0]=-u),y[1]>u&&(y[1]=u),y[1]<-u&&(y[1]=-u),y}function qL(e){var t=180/Math.PI,o=6378137;return[e[0]*t/o,(Math.PI*.5-2*Math.atan(Math.exp(-e[1]/o)))*t]}function FZ(e){return e<0?-1:e>0?1:0}function ZL(e,t,o){const u=t.geometry.coordinates,p=o.geometry.coordinates;if(u[1]>mS||u[1]<pS||p[1]>mS||p[1]<pS)return null;const y=GL(u),T=GL(p),s=H=>Number(H.toFixed(8)),M=(H,$)=>(H+$)/2,L=OZ([M(y[0],T[0]),M(y[1],T[1])]),B=[s(L[0]),s(L[1])];return{type:ni.FEATURE,properties:{meta:Fs.MIDPOINT,parent:e,lng:B[0],lat:B[1],coord_path:o.properties.coord_path},geometry:{type:ni.POINT,coordinates:B}}}function l1(e,t={},o=null){const{type:u,coordinates:p}=e.geometry,y=e.properties&&e.properties.id;let T=[];u===ni.POINT?T.push(Hp(y,p,o,M(o))):u===ni.POLYGON?p.forEach((B,H)=>{s(B,o!==null?`${o}.${H}`:String(H))}):u===ni.LINE_STRING?s(p,o):u.indexOf(ni.MULTI_PREFIX)===0&&L();function s(B,H){let $="",te=null;B.forEach((xe,pe)=>{const Ne=H!=null?`${H}.${pe}`:String(pe),_e=Hp(y,xe,Ne,M(Ne));if(t.midpoints&&te){const ke=ZL(y,te,_e);ke&&T.push(ke)}te=_e;const ie=JSON.stringify(xe);$!==ie&&T.push(_e),pe===0&&($=ie)})}function M(B){return t.selectedPaths?t.selectedPaths.indexOf(B)!==-1:!1}function L(){const B=u.replace(ni.MULTI_PREFIX,"");p.forEach((H,$)=>{const te={type:ni.FEATURE,properties:e.properties,geometry:{type:B,coordinates:H}};T=T.concat(l1(te,t,$))})}return T}const Yl={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:c1,LAT_MAX:u1,LAT_RENDERED_MIN:WL,LAT_RENDERED_MAX:XL,LNG_MIN:YL,LNG_MAX:KL}=bL;function NZ(e){const t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],o=[e.geometry.coordinates].flat(t),u=o.map(s=>s[0]),p=o.map(s=>s[1]),y=s=>Math.min.apply(null,s),T=s=>Math.max.apply(null,s);return[y(u),y(p),T(u),T(p)]}function zS(e,t){let o=c1,u=u1,p=c1,y=u1,T=KL,s=YL;e.forEach(L=>
2819{const B=NZ(L),H=B[1],$=B[3],te=B[0],xe=B[2];H>o&&(o=H),$<u&&(u=$),$>p&&(p=$),H<y&&(y=H),te<T&&(T=te),xe>s&&(s=xe)});const M=t;return o+M.lat>XL&&(M.lat=XL-o),p+M.lat>u1&&(M.lat=u1-p),u+M.lat<WL&&(M.lat=WL-u),y+M.lat<c1&&(M.lat=c1-y),T+M.lng<=YL&&(M.lng+=Math.ceil(Math.abs(M.lng)/360)*360),s+M.lng>=KL&&(M.lng-=Math.ceil(Math.abs(M.lng)/360)*360),M}function DS(e,t){const o=zS(e.map(u=>u.toGeoJSON()),t);e.forEach(u=>{const p=u.getCoordinates(),y=L=>{const B={lng:L[0]+o.lng,lat:L[1]+o.lat};return[B.lng,B.lat]},T=L=>L.map(B=>y(B)),s=L=>L.map(B=>T(B));let M;u.type===ni.POINT?M=y(p):u.type===ni.LINE_STRING||u.type===ni.MULTI_POINT?M=p.map(y):u.type===ni.POLYGON||u.type===ni.MULTI_LINE_STRING?M=p.map(T):u.type===ni.MULTI_POLYGON&&(M=p.map(s)),u.incomingCoords(M)})}const $n={};$n.onSetup=function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(o=>this.getFeature(o)!==void 0)),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},$n.fireUpdate=function(){this.fire(ea.UPDATE,{action:O_.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})},$n.fireActionable=function(){const e=this.getSelected(),t=e.filter(y=>this.isInstanceOf("MultiFeature",y));let o=!1;if(e.length>1){o=!0;const y=e[0].type.replace("Multi","");e.forEach(T=>{T.type.replace("Multi","")!==y&&(o=!1)})}const u=t.length>0,p=e.length>0;this.setActionableState({combineFeatures:o,uncombineFeatures:u,trash:p})},$n.getUniqueIds=function(e){return e.length?e.map(o=>o.properties.id).filter(o=>o!==void 0).reduce((o,u)=>(o.add(u),o),new bl).values():[]},$n.stopExtendedInteractions=function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},$n.onStop=function(){Yl.enable(this)},$n.onMouseMove=function(e,t){return _S(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},$n.onMouseOut=function(e){return e.dragMoving?this.fireUpdate():!0},$n.onTap=$n.onClick=function(e,t){if(e1(t))return this.clickAnywhere(e,t);if(Qx(Fs.VERTEX)(t))return this.clickOnVertex(e,t);if(_S(t))return this.clickOnFeature(e,t)},$n.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(o=>this.doRender(o))),Yl.enable(this),this.stopExtendedInteractions(e)},$n.clickOnVertex=function(e,t){this.changeMode(_n.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:fo.MOVE})},$n.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},$n.clickOnFeature=function(e,t){Yl.disable(this),this.stopExtendedInteractions(e);const o=t1(t),u=this.getSelectedIds(),p=t.featureTarget.properties.id,y=this.isSelected(p);if(!o&&y&&this.getFeature(p).type!==ni.POINT)return this.changeMode(_n.DIRECT_SELECT,{featureId:p});y&&o?(this.deselect(p),this.updateUIClasses({mouse:fo.POINTER}),u.length===1&&Yl.enable(this)):!y&&o?(this.select(p),this.updateUIClasses({mouse:fo.MOVE})):!y&&!o&&(u.forEach(T=>this.doRender(T)),this.setSelected(p),this.updateUIClasses({mouse:fo.MOVE})),this.doRender(p)},$n.onMouseDown=function(e,t){if(e.initialDragPanState=this.map.dragPan.isEnabled(),Wd(t))return this.startOnActiveFeature
2819(e,t);if(this.drawConfig.boxSelect&&wL(t))return this.startBoxSelect(e,t)},$n.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=PS(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},$n.onTouchStart=function(e,t){if(Wd(t))return this.startOnActiveFeature(e,t)},$n.onDrag=function(e,t){if(e.canDragMove)return this.dragMove(e,t);if(this.drawConfig.boxSelect&&e.canBoxSelect)return this.whileBoxSelect(e,t)},$n.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:fo.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(Aa.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const o=PS(t.originalEvent,this.map.getContainer()),u=Math.min(e.boxSelectStartLocation.x,o.x),p=Math.max(e.boxSelectStartLocation.x,o.x),y=Math.min(e.boxSelectStartLocation.y,o.y),T=Math.max(e.boxSelectStartLocation.y,o.y),s=`translate(${u}px, ${y}px)`;e.boxSelectElement.style.transform=s,e.boxSelectElement.style.WebkitTransform=s,e.boxSelectElement.style.width=`${p-u}px`,e.boxSelectElement.style.height=`${T-y}px`},$n.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const o={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};DS(this.getSelected(),o),e.dragMoveLocation=t.lngLat},$n.onTouchEnd=$n.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const o=[e.boxSelectStartLocation,PS(t.originalEvent,this.map.getContainer())],u=this.featuresAt(null,o,"click"),p=this.getUniqueIds(u).filter(y=>!this.isSelected(y));p.length&&(this.select(p),p.forEach(y=>this.doRender(y)),this.updateUIClasses({mouse:fo.MOVE}))}this.stopExtendedInteractions(e)},$n.toDisplayFeatures=function(e,t,o){t.properties.active=this.isSelected(t.properties.id)?ns.ACTIVE:ns.INACTIVE,o(t),this.fireActionable(),!(t.properties.active!==ns.ACTIVE||t.geometry.type===ni.POINT)&&l1(t).forEach(o)},$n.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},$n.onCombineFeatures=function(){const e=this.getSelected();if(e.length===0||e.length<2)return;const t=[],o=[],u=e[0].type.replace("Multi","");for(let p=0;p<e.length;p++){const y=e[p];if(y.type.replace("Multi","")!==u)return;
2819y.type.includes("Multi")?y.getCoordinates().forEach(T=>{t.push(T)}):t.push(y.getCoordinates()),o.push(y.toGeoJSON())}if(o.length>1){const p=this.newFeature({type:ni.FEATURE,properties:o[0].properties,geometry:{type:`Multi${u}`,coordinates:t}});this.addFeature(p),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([p.id]),this.fire(ea.COMBINE_FEATURES,{createdFeatures:[p.toGeoJSON()],deletedFeatures:o})}this.fireActionable()},$n.onUncombineFeatures=function(){const e=this.getSelected();if(e.length===0)return;const t=[],o=[];for(let u=0;u<e.length;u++){const p=e[u];this.isInstanceOf("MultiFeature",p)&&(p.getFeatures().forEach(y=>{this.addFeature(y),y.properties=p.properties,t.push(y.toGeoJSON()),this.select([y.id])}),this.deleteFeature(p.id,{silent:!0}),o.push(p.toGeoJSON()))}t.length>1&&this.fire(ea.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:o}),this.fireActionable()};const JL=Qx(Fs.VERTEX),QL=Qx(Fs.MIDPOINT),Hn={};Hn.fireUpdate=function(){this.fire(ea.UPDATE,{action:O_.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})},Hn.fireActionable=function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},Hn.startDragging=function(e,t){e.initialDragPanState==null&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},Hn.stopDragging=function(e){e.canDragMove&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},Hn.onVertex=function(e,t){this.startDragging(e,t);const o=t.featureTarget.properties,u=e.selectedCoordPaths.indexOf(o.coord_path);!t1(t)&&u===-1?e.selectedCoordPaths=[o.coord_path]:t1(t)&&u===-1&&e.selectedCoordPaths.push(o.coord_path);const p=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(p)},Hn.onMidpoint=function(e,t){this.startDragging(e,t);const o=t.featureTarget.properties;e.feature.addCoordinate(o.coord_path,o.lng,o.lat),this.fireUpdate(),e.selectedCoordPaths=[o.coord_path]},Hn.pathsToCoordinates=function(e,t){return t.map(o=>({feature_id:e,coord_path:o}))},Hn.onFeature=function(e,t){e.selectedCoordPaths.length===0?this.startDragging(e,t):this.stopDragging(e)},Hn.dragFeature=function(e,t,o){DS(this.getSelected(),o),e.dragMoveLocation=t.lngLat},Hn.dragVertex=function(e,t,o){const u=e.selectedCoordPaths.map(T=>e.feature.getCoordinate(T)),p=u.map(T=>({type:ni.FEATURE,properties:{},geometry:{type:ni.POINT,coordinates:T}})),y=zS(p,o);for(let T=0;T<u.length;T++){const s=u[T];e.feature.updateCoordinate(e.selectedCoordPaths[T],s[0]+y.lng,s[1]+y.lat)}},Hn.clickNoTarget=function(){this.changeMode(_n.SIMPLE_SELECT)},Hn.clickInactive=function(){this.changeMode(_n.SIMPLE_SELECT)},Hn.clickActiveFeature=function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},Hn.onSetup=function(e){const t=e.featureId,o=this.getFeature(t);if(!o)throw new Error("You must provide a featureId to enter direct_select mode");if(o.type===ni.POINT)throw new TypeError("direct_select mode doesn't handle point features");const u={featureId:t,feature:o,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,u.selectedCoordPaths)),this.setSelected(t),Yl.disable(this),this.setActionableState({trash:!0}),u},Hn.onStop=function(){Yl.enable(this),this.clearSelectedCoordinates()},Hn.toDisplayFeatures=function(e,t,o){e.featureId===t.properties.id?(t.properties.active=ns.ACTIVE,o(t),l1(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(o)):(t.properties.active=ns.INACTIVE,o(t)),this.fireActionable(e)},Hn.onTrash=function(e){e.selectedCoordPaths.sort((t,o)=>o.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),e.feature.isValid()===!1&&(this.deleteFeature([e.featureId]),this.changeMode(_n.SIMPLE_SELECT,{}))},Hn.onMouseMove=function(e,t){const o=Wd(t),u=JL(t),p=QL(t),y=e.selectedCoordPaths.length===0;return o&&y?this.updateUIClasses({mouse:fo.MOVE}):u&&!y?this.updateUIClasses({mouse:fo.MOVE}):this.updateUIClasses({mouse:fo.NONE}),(u||o||p)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},Hn.onMouseOut=function(e){return e.dragMoving&&this.fireUpdate(),!0},Hn.onTouchStart=Hn.onMouseDown=function(e,t){if(JL(t))return this.onVertex(e,t);if(Wd(t))return this.onFeature(e,t);if(QL(t))return this.onMidpoint(e,t)},Hn.onDrag=function(e,t){if(e.canDragMove!==!0)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const o={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>
28190?this.dragVertex(e,t,o):this.dragFeature(e,t,o),e.dragMoveLocation=t.lngLat},Hn.onClick=function(e,t){if(e1(t))return this.clickNoTarget(e,t);if(Wd(t))return this.clickActiveFeature(e,t);if(gS(t))return this.clickInactive(e,t);this.stopDragging(e)},Hn.onTap=function(e,t){if(e1(t))return this.clickNoTarget(e,t);if(Wd(t))return this.clickActiveFeature(e,t);if(gS(t))return this.clickInactive(e,t)},Hn.onTouchEnd=Hn.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const Mc={};Mc.onSetup=function(){const e=this.newFeature({type:ni.FEATURE,properties:{},geometry:{type:ni.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:fo.ADD}),this.activateUIButton(Pa.POINT),this.setActionableState({trash:!0}),{point:e}},Mc.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT)},Mc.onTap=Mc.onClick=function(e,t){this.updateUIClasses({mouse:fo.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(ea.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.point.id]})},Mc.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},Mc.toDisplayFeatures=function(e,t,o){const u=t.properties.id===e.point.id;if(t.properties.active=u?ns.ACTIVE:ns.INACTIVE,!u)return o(t)},Mc.onTrash=Mc.stopDrawingAndRemove,Mc.onKeyUp=function(e,t){if(r1(t)||i1(t))return this.stopDrawingAndRemove(e,t)};function h1(e,t){return e.lngLat?e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]:!1}const Kl={};Kl.onSetup=function(){const e=this.newFeature({type:ni.FEATURE,properties:{},geometry:{type:ni.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Yl.disable(this),this.updateUIClasses({mouse:fo.ADD}),this.activateUIButton(Pa.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},Kl.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&h1(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:fo.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},Kl.clickOnVertex=function(e){return this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},Kl.onMouseMove=function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),F_(t)&&this.updateUIClasses({mouse:fo.POINTER})},Kl.onTap=Kl.onClick=function(e,t){return F_(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},Kl.onKeyUp=function(e,t){r1(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT)):i1(t)&&this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},Kl.onStop=function(e){this.updateUIClasses({mouse:fo.NONE}),Yl.enable(this),this.activateUIButton(),this.getFeature(e.polygon.id)!==void 0&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(ea.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT,{},{silent:!0})))},Kl.toDisplayFeatures=function(e,t,o){const u=t.properties.id===e.polygon.id;if(t.properties.active=u?ns.ACTIVE:ns.INACTIVE,!u)return o(t);if(t.geometry.coordinates.length===0)return;const p=t.geometry.coordinates[0].length;if(!(p<3)){if(t.properties.meta=Fs.FEATURE,o(Hp(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),p>3){const y=t.geometry.coordinates[0].length-3;o(Hp(e.polygon.id,t.geometry.coordinates[0][y],`0.${y}`,!1))}if(p<=4){const y=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(o({type:ni.FEATURE,properties:t.properties,geometry:{coordinates:y,type:ni.LINE_STRING}}),p===3)return}return o(t)}},Kl.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT)};const Jl={};Jl.onSetup=function(e){e=e||{};const t=e.featureId;let o,u,p="forward";if(t){if(o=this.getFeature(t),!o)throw new Error("Could not find a feature with the provided featureId");let y=e.from;if(y&&y.type==="Feature"&&y.geometry&&y.geometry.type==="Point"&&(y=y.geometry),y&&y.type==="Point"&&y.coordinates&&y.coordinates.length===2&&(y=y.coordinates),!y||!Array.isArray(y))throw new Error("Please use the `from` property to indicate which point to continue the line from");const T=o.coordinates.length-1;if(o.coordinates[T][0]===y[0]&&o.coordinates[T][1]===y[1])u=T+1,o.addCoordinate(u,...o.coordinates[T]);else if(o.coordinates[0][0]===y[0]&&o.coordinates[0][1]===y[1])p="backwards",u=0,o.addCoordinate(u,...o.coordinates[0]);else throw new Error("`from` should match the point at either the start or the end of the provided LineString")}else o=this.newFeature({type:ni.FEATURE,properties:{},geometry:{type:ni.LINE_STRING,coordinates:[]}}),u=0,this.addFeature(o);return this.clearSelectedFeatures(),Yl.disable(this),this.updateUIClasses({mouse:fo.ADD}),this.activateUIButton(Pa.LINE),this.setActionableState({trash:!0}),{line:o,currentVertexPosition:u,direction:p}},Jl.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&h1(t,e.line.coordinates[e.currentVertexPosition-1])||e.direction==="backwards"&&h1(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:fo.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.direction==="forward"?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},Jl.clickOnVertex=function(e){return this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.line.id]})},Jl.onMouseMove=function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),F_(t)&&this.updateUIClasses({mouse:fo.POINTER})},Jl.onTap=Jl.onClick=function(e,t){if(F_(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},Jl.onKeyUp=function(e,t){i1(t)?this.changeMode(_n.SIMPLE_SELECT,{featureIds:[e.line.id]}
2819):r1(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT))},Jl.onStop=function(e){Yl.enable(this),this.activateUIButton(),this.getFeature(e.line.id)!==void 0&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(ea.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT,{},{silent:!0})))},Jl.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(_n.SIMPLE_SELECT)},Jl.toDisplayFeatures=function(e,t,o){const u=t.properties.id===e.line.id;if(t.properties.active=u?ns.ACTIVE:ns.INACTIVE,!u)return o(t);t.geometry.coordinates.length<2||(t.properties.meta=Fs.FEATURE,o(Hp(e.line.id,t.geometry.coordinates[e.direction==="forward"?t.geometry.coordinates.length-2:1],`${e.direction==="forward"?t.geometry.coordinates.length-2:1}`,!1)),o(t))};const ez={simple_select:$n,direct_select:Hn,draw_point:Mc,draw_polygon:Kl,draw_line_string:Jl},BZ={defaultMode:_n.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:FL,modes:ez,controls:{},userProperties:!1,suppressAPIEvents:!0},VZ={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},UZ={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function tz(e,t){return e.map(o=>o.source?o:Object.assign({},o,{id:`${o.id}.${t}`,source:t==="hot"?xl.HOT:xl.COLD}))}function jZ(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),e.displayControlsDefault===!1?t.controls=Object.assign({},UZ,e.controls):t.controls=Object.assign({},VZ,e.controls),t=Object.assign({},BZ,t),t.styles=tz(t.styles,"cold").concat(tz(t.styles,"hot")),t}var GZ=function e(t,o){if(t===o)return!0;if(t&&o&&typeof t=="object"&&typeof o=="object"){if(t.constructor!==o.constructor)return!1;var u,p,y;if(Array.isArray(t)){if(u=t.length,u!=o.length)return!1;for(p=u;p--!==0;)if(!e(t[p],o[p]))return!1;return!0}if(t.constructor===RegExp)return t.source===o.source&&t.flags===o.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===o.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===o.toString();if(y=Object.keys(t),u=y.length,u!==Object.keys(o).length)return!1;for(p=u;p--!==0;)if(!Object.prototype.hasOwnProperty.call(o,y[p]))return!1;for(p=u;p--!==0;){var T=y[p];if(!e(t[T],o[T]))return!1}return!0}return t!==t&&o!==o};const rz=Ig(GZ);var $Z=qZ,HZ={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function qZ(e){if(!e||!e.type)return null;var t=HZ[e.type];if(!t)return null;if(t==="geometry")return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]};if(t==="feature")return{type:"FeatureCollection",features:[e]};if(t==="featurecollection")return e}const ZZ=Ig($Z);function iz(e,t){return e.length!==t.length?!1:JSON.stringify(e.map(o=>o).sort())===JSON.stringify(t.map(o=>o).sort())}const WZ={Polygon:Ja,LineString:Pc,Point:Th,MultiPolygon:ra,MultiLineString:ra,MultiPoint:ra};function XZ(e,t){t.modes=_n;const o=e.options.suppressAPIEvents!==void 0?!!e.options.suppressAPIEvents:!0;return t.getFeatureIdsAt=function(u){return $p.click({point:u},null,e).map(y=>y.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:ni.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(u=>e.store.get(u)).map(u=>u.toGeoJSON())}},t.getSelectedPoints=function(){return{type:ni.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(u=>({type:ni.FEATURE,properties:{},geometry:{type:ni.POINT,coordinates:u.coordinates}}))}},t.set=function(u){if(u.type===void 0||u.type!==ni.FEATURE_COLLECTION||!Array.isArray(u.features))throw new Error("Invalid FeatureCollection");const p=e.store.createRenderBatch();let y=e.store.getAllIds().slice();const T=t.add(u),s=new bl(T);return y=y.filter(M=>!s.has(M)),y.length&&t.delete(y),p(),T},t.add=function(u){const y=JSON.parse(JSON.stringify(ZZ(u))).features.map(T=>{if(T.id=T.id||IS(),T.geometry===null)throw new Error("Invalid geometry: null");if(e.store.get(T.id)===void 0||e.store.get(T.id).type!==T.geometry.type){const s=WZ[T.geometry.type];if(s===void 0)throw new Error(`Invalid geometry type: ${T.geometry.type}.`);const M=new s(e,T);e.store.add(M,{silent:o})}else{const s=e.store.get(T.id),M=s.properties;s.properties=T.properties,rz(M,T.properties)||e.store.featureChanged(s.id,{silent:o}),rz(s.getCoordinates(),T.geometry.coordinates)||s.incomingCoords(T.geometry.coordinates)}return T.id});return e.store.render(),y},t.get=function(u){const p=e.store.get(u);if(p)return p.toGeoJSON()},t.getAll=function(){return{type:ni.FEATURE_COLLECTION,features:e.store.getAll().map(u=>u.toGeoJSON())}},t.delete=function(u){return e.store.delete(u,{silent:o}),t.getMode()===_n.DIRECT_SELECT&&!e.store.getSelectedIds().length?e.events.changeMode(_n.SIMPLE_SELECT,void 0,{silent:o}):e.store.render(),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:o}),t.getMode()===_n.DIRECT_SELECT?e.events.changeMode(_n.SIMPLE_SELECT,void 0,{silent:o}):e.store.render(),t},t.changeMode=function(u,p={}){return u===_n.SIMPLE_SELECT&&t.getMode()===_n.SIMPLE_SELECT?(iz(p.featureIds||[],e.store.getSelectedIds())||
2819(e.store.setSelected(p.featureIds,{silent:o}),e.store.render()),t):(u===_n.DIRECT_SELECT&&t.getMode()===_n.DIRECT_SELECT&&p.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(u,p,{silent:o}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:o}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:o}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:o}),t},t.setFeatureProperty=function(u,p,y){return e.store.setFeatureProperty(u,p,y,{silent:o}),t},t}const YZ=Object.freeze(Object.defineProperty({__proto__:null,CommonSelectors:uZ,ModeHandler:CS,StringSet:bl,constrainFeatureMovement:zS,createMidPoint:ZL,createSupplementaryPoints:l1,createVertex:Hp,doubleClickZoom:Yl,euclideanDistance:TS,featuresAt:$p,getFeatureAtAndSetCursors:o1,isClick:ES,isEventAtCoordinates:h1,isTap:SS,mapEventToBoundingBox:RL,moveFeatures:DS,sortFeatures:kL,stringSetsAreEqual:iz,theme:FL,toDenseArray:N_},Symbol.toStringTag,{value:"Module"})),KZ=function(e,t){e=jZ(e);const o={options:e};t=XZ(o,t),o.api=t;const u=AZ(o);return t.onAdd=u.onAdd,t.onRemove=u.onRemove,t.types=Pa,t.options=e,t};function Xd(e){KZ(e,this)}Xd.modes=ez,Xd.constants=bL,Xd.lib=YZ;const JZ=(()=>{const e=new Set(["gl-draw-point-outer","gl-draw-point-stroke-active","gl-draw-point-point-stroke-inactive"]),t=new Set(["gl-draw-point-inner","gl-draw-point-active","gl-draw-point-inactive","gl-draw-point-static"]);return Xd.lib.theme.map(o=>o.type!=="circle"?o:e.has(o.id)?{...o,paint:{...o.paint,"circle-radius":["case",["==",["get","active"],"true"],10,8]}}:t.has(o.id)?{...o,paint:{...o.paint,"circle-radius":["case",["==",["get","active"],"true"],8,6]}}:o)})(),V_="parcel_select",ws="Parcels",qp="SelectedParcels",QZ={style:"mapbox://styles/mapbox/satellite-streets-v12",projection:"mercator",language:"de",center:[10.451526,51.165691],zoom:5,minZoom:4},OS="#FCD34D",Yd=12,eW=[{id:`${ws}_fill`,source:ws,"source-layer":ws,type:"fill",minzoom:Yd,paint:{"fill-color":OS,"fill-opacity":0}},{id:`${ws}_outline`,source:ws,"source-layer":ws,type:"line",minzoom:Yd,paint:{"line-color":"black","line-width":1}},{id:`${ws}_label`,source:ws,"source-layer":ws,type:"symbol",minzoom:Yd,layout:{"text-font":["DIN Offc Pro Medium","Arial Unicode MS Bold"],"text-size":12,"text-field":["get","name"]},paint:{"text-color":"black","text-halo-color":"white","text-halo-width":1}}],FS="BavarianParcelMap",tW={id:FS,source:FS,type:"raster",minzoom:15},rW=[{id:`${qp}_fill`,source:qp,type:"fill",paint:{"fill-color":OS,"fill-opacity":.3}},{id:`${qp}_outline`,source:qp,type:"line",paint:{"line-color":OS,"line-width":3}}];function iW({isInitialized:e,parcelZoomReached:t,parcelSourceLoading:o,showsParcels:u}){return e?t?o?"loading":u?"ready":"unavailable":"zoomed-out":"loading"}class nW extends sZ{constructor({showControls:o=!1,defaultDrawMode:u,...p}){super({...QZ,...p});de(this,"draw");de(this,"lastLabelZoom");const y={...Xd.modes.simple_select,onClick(){}};this.draw=new Xd({displayControlsDefault:o,controls:{polygon:o,point:o,line_string:!1,trash:o,combine_features:!1,uncombine_features:!1},modes:{...Xd.modes,[V_]:y},styles:JZ,defaultMode:u}),this.addControl(this.draw),this.changeState({drawMode:u}),this.on("draw.modechange",({mode:T})=>{setTimeout(()=>{this.changeState({drawMode:T})},200)}),this.on("load",()=>{this.addSource(ws,{id:ws,type:"vector",tiles:[`${window.CONFIG_API??window.location.origin}/api/mvt/${ws}/{z}/{x}/{y}`],promoteId:"code"}),this.addSource(FS,nZ),this.addSource(qp,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.once("styledata",()=>{const T=this.getDrawingLayer();this.addLayer(tW,T),eW.forEach(s=>this.addLayer(s,T)),rW.forEach(s=>this.addLayer(s,T)),this.once("idle",()=>{this.setupParcelsTracking(),this.changeState({isInitialized:!0})})})})}getDrawingLayer(){var o,u;return(u=(o=this.getStyle().layers)==null?void 0:o.find(p=>p.id.startsWith("gl-draw-")))==null?void 0:u.id}checkParcelsVisibility(){const o=`${ws}_fill`;if(!this.getLayer(o)||this.getLayoutProperty(o,"visibility")==="none"||this.getZoom()<Yd)return!1;const T=this.getCanvasContainer();return this.queryRenderedFeatures([[0,0],[T.clientWidth,T.clientHeight]],{layers:[o]}).length>0}getLabelZoom(){return this.getCanvasContainer().clientWidth<=768?Yd+1:Yd}
2819applyLabelZoom(){const o=this.getLabelZoom();o!==this.lastLabelZoom&&(this.setLayerZoomRange(`${ws}_label`,o,24),this.lastLabelZoom=o)}setupParcelsTracking(){const o=()=>{this.changeState({showsParcels:this.checkParcelsVisibility(),parcelZoomReached:this.getZoom()>=Yd,parcelSourceLoading:!this.isSourceLoaded(ws)})},u=()=>{o(),this.applyLabelZoom()};this.on("moveend",o),this.on("zoomend",o),this.on("resize",u),this.on("source.load",o),this.on("idle",o),o(),this.applyLabelZoom()}changeDrawMode(o){this.draw.changeMode(o),this.changeState({drawMode:o})}setSelectedParcels(o){const u=this.getSource(qp);u==null||u.setData({type:"FeatureCollection",features:o})}}function oW({drawMode:e,parcelPickState:t,hasSelection:o,onChangeDrawMode:u,onDelete:p,onZoomIn:y,onZoomOut:T,showZoomControls:s=!0,showsMarkerButton:M=!1,className:L=""}){const B=t==="ready",H=e===V_,$={loading:"Flurstück wählen","zoomed-out":"Flurstück (näher zoomen)",unavailable:"Flurstück (nicht verfügbar)",ready:"Flurstück wählen"}[t],te="btn btn-sm join-item font-normal pointer-events-auto",pe=`${te} disabled:bg-white disabled:text-gray-300 disabled:opacity-100`;return Ve.jsxs("div",{className:`flex flex-wrap gap-y-2 justify-center items-center ${L}`,children:[Ve.jsxs("div",{className:"join flex-wrap gap-y-2",children:[Ve.jsxs("button",{disabled:!B,type:"button",className:`${pe} ${H?"btn-primary":""}`,onClick:()=>u(V_),children:[t==="loading"?Ve.jsx("span",{className:"loading loading-spinner w-4 h-4"}):Ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"512",height:"512",className:"w-4 h-4",children:Ve.jsx("path",{fill:"currentColor",d:"M3,3H21V21H3V3M5,5V19H19V5H5Z"})}),$]}),Ve.jsxs("button",{type:"button",className:`${pe} ${e==="draw_polygon"?"btn-primary":""}`,onClick:()=>u("draw_polygon"),"data-testid":"map-draw-polygon-button",children:[Ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"512",height:"512",className:"w-4 h-4",children:Ve.jsx("path",{d:"m21,18c-.413,0-.807.084-1.165.235l-4.215-4.777c.241-.432.38-.929.38-1.458,0-.534-.141-1.035-.386-1.47l4.183-4.783c.369.162.776.253,1.203.253,1.654,0,3-1.346,3-3s-1.346-3-3-3c-1.304,0-2.415.836-2.828,2H5.828c-.413-1.164-1.524-2-2.828-2C1.346,0,0,1.346,0,3c0,1.304.836,2.415,2,2.828v12.344c-1.164.413-2,1.524-2,2.828,0,1.654,1.346,3,3,3,1.304,0,2.415-.836,2.828-2h12.344c.413,1.164,1.524,2,2.828,2,1.654,0,3-1.346,3-3s-1.346-3-3-3ZM5.828,4h12.344c.046.13.102.257.165.378l-4.228,4.835c-.343-.137-.717-.213-1.109-.213-1.654,0-3,1.346-3,3s1.346,3,3,3c.396,0,.774-.078,1.121-.218l4.236,4.801c-.072.133-.133.273-.185.417H5.828c-.302-.851-.977-1.526-1.828-1.828V5.828c.851-.302,1.526-.977,1.828-1.828Z"})}),"Fläche zeichnen"]}),M&&Ve.jsxs("button",{type:"button",className:`${pe} ${e==="draw_point"?"btn-primary":""}`,onClick:()=>u("draw_point"),children:[Ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",id:"Layer_1","data-name":"Layer 1",viewBox:"0 0 24 24",width:"512",height:"512",className:"w-4 h-4",children:[Ve.jsx("path",{d:"M12,0A10.011,10.011,0,0,0,2,10c0,5.282,8.4,12.533,9.354,13.343l.646.546.646-.546C13.6,22.533,22,15.282,22,10A10.011,10.011,0,0,0,12,0Zm0,15a5,5,0,1,1,5-5A5.006,5.006,0,0,1,12,15Z"}),Ve.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),"Marker setzen"]}),o&&Ve.jsxs("button",{type:"button","aria-label":"Löschen",className:`${te} gap-1`,onClick:p,children:[Ve.jsx("svg",{"aria-hidden":"true",width:"16",height:"16",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"fill-current",children:Ve.jsx("path",{d:"M17,4V2a2,2,0,0,0-2-2H9A2,2,0,0,0,7,2V4H2V6H4V21a3,3,0,0,0,3,3H17a3,3,0,0,0,3-3V6h2V4ZM11,17H9V11h2Zm4,0H13V11h2ZM15,4H9V2h6Z"})}),Ve.jsx("span",{className:"hidden sm:inline",children:"Löschen"})]})]}),s&&y&&T&&Ve.jsxs("span",{className:"join no-wrap ml-3",children:[Ve.jsx("button",{type:"button",className:"btn btn-sm join-item font-bold text-lg pointer-events-auto",onClick:y,children:"+"}),Ve.jsx("button",{type:"button",className:"btn btn-sm join-item font-bold text-lg pointer-events-auto",onClick:T,children:"–"})]})]})}
2819function nz(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function sW(e,t,o={}){var u=nz(e),p=nz(t),y=a1(p[1]-u[1]),T=a1(p[0]-u[0]),s=a1(u[1]),M=a1(p[1]),L=Math.pow(Math.sin(y/2),2)+Math.pow(Math.sin(T/2),2)*Math.cos(s)*Math.cos(M);return RZ(2*Math.atan2(Math.sqrt(L),Math.sqrt(1-L)),o.units)}function d1(e){return LZ(e,(t,o)=>t+aW(o),0)}function aW(e){let t=0,o;switch(e.type){case"Polygon":return oz(e.coordinates);case"MultiPolygon":for(o=0;o<e.coordinates.length;o++)t+=oz(e.coordinates[o]);return t;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function oz(e){let t=0;if(e&&e.length>0){t+=Math.abs(sz(e[0]));for(let o=1;o<e.length;o++)t-=Math.abs(sz(e[o]))}return t}var lW=ia*ia/2,NS=Math.PI/180;function sz(e){const t=e.length-1;if(t<=2)return 0;let o=0,u=0;for(;u<t;){const p=e[u],y=e[u+1===t?0:u+1],T=e[u+2>=t?(u+2)%t:u+2],s=p[0]*NS,M=y[1]*NS,L=T[0]*NS;o+=(L-s)*Math.sin(M),u++}return o*lW}function az(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const o=[1/0,1/0,-1/0,-1/0];return RS(e,u=>{o[0]>u[0]&&(o[0]=u[0]),o[1]>u[1]&&(o[1]=u[1]),o[2]<u[0]&&(o[2]=u[0]),o[3]<u[1]&&(o[3]=u[1])}),o}var cW=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,BS=Math.ceil,wl=Math.floor,Ma="[BigNumber Error] ",lz=Ma+"Number primitive has more than 15 significant digits: ",Ql=1e14,Ui=14,VS=9007199254740991,US=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Sh=1e7,os=1e9;function cz(e){var t,o,u,p=ie.prototype={constructor:ie,toString:null,valueOf:null},y=new ie(1),T=20,s=4,M=-7,L=21,B=-1e7,H=1e7,$=!1,te=1,xe=0,pe={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ne="0123456789abcdefghijklmnopqrstuvwxyz",_e=!0;function ie(K,ve){var Ae,Ye,Be,Fe,Je,ze,He,tt,Oe=this;if(!(Oe instanceof ie))return new ie(K,ve);if(ve==null){if(K&&K._isBigNumber===!0){Oe.s=K.s,!K.c||K.e>H?Oe.c=Oe.e=null:K.e<B?Oe.c=[Oe.e=0]:(Oe.e=K.e,Oe.c=K.c.slice());return}if((ze=typeof K=="number")&&K*0==0){if(Oe.s=1/K<0?(K=-K,-1):1,K===~~K){for(Fe=0,Je=K;Je>=10;Je/=10,Fe++);Fe>H?Oe.c=Oe.e=null:(Oe.e=Fe,Oe.c=[K]);return}tt=String(K)}else{if(!cW.test(tt=String(K)))return u(Oe,tt,ze);Oe.s=tt.charCodeAt(0)==45?(tt=tt.slice(1),-1):1}(Fe=tt.indexOf("."))>-1&&(tt=tt.replace(".","")),(Je=tt.search(/e/i))>0?(Fe<0&&(Fe=Je),Fe+=+tt.slice(Je+1),tt=tt.substring(0,Je)):Fe<0&&(Fe=tt.length)}else{if(xo(ve,2,Ne.length,"Base"),ve==10&&_e)return Oe=new ie(K),wt(Oe,T+Oe.e+1,s);if(tt=String(K),ze=typeof K=="number"){if(K*0!=0)return u(Oe,tt,ze,ve);if(Oe.s=1/K<0?(tt=tt.slice(1),-1):1,ie.DEBUG&&tt.replace(/^0\.0*|\./,"").length>15)throw Error(lz+K)}else Oe.s=tt.charCodeAt(0)===45?(tt=tt.slice(1),-1):1;for(Ae=Ne.slice(0,ve),Fe=Je=0,He=tt.length;Je<He;Je++)if(Ae.indexOf(Ye=tt.charAt(Je))<0){if(Ye=="."){if(Je>Fe){Fe=He;continue}}else if(!Be&&(tt==tt.toUpperCase()&&(tt=tt.toLowerCase())||tt==tt.toLowerCase()&&(tt=tt.toUpperCase()))){Be=!0,Je=-1,Fe=0;continue}return u(Oe,String(K),ze,ve)}ze=!1,tt=o(tt,ve,10,Oe.s),(Fe=tt.indexOf("."))>-1?tt=tt.replace(".",""):Fe=tt.length}for(Je=0;tt.charCodeAt(Je)===48;Je++);for(He=tt.length;tt.charCodeAt(--He)===48;);if(tt=tt.slice(Je,++He)){if(He-=Je,ze&&ie.DEBUG&&He>15&&(K>VS||K!==wl(K)))throw Error(lz+Oe.s*K);if((Fe=Fe-Je-1)>H)Oe.c=Oe.e=null;else if(Fe<B)Oe.c=[Oe.e=0];else{if(Oe.e=Fe,Oe.c=[],Je=(Fe+1)%Ui,Fe<0&&(Je+=Ui),Je<He){for(Je&&Oe.c.push(+tt.slice(0,Je)),He-=Ui;Je<He;)Oe.c.push(+tt.slice(Je,Je+=Ui));Je=Ui-(tt=tt.slice(Je)).length}else Je-=He;for(;Je--;tt+="0");Oe.c.push(+tt)}}else Oe.c=[Oe.e=0]}ie.clone=cz,ie.ROUND_UP=0,ie.ROUND_DOWN=1,ie.ROUND_CEIL=2,ie.ROUND_FLOOR=3,ie.ROUND_HALF_UP=4,ie.ROUND_HALF_DOWN=5,ie.ROUND_HALF_EVEN=6,ie.ROUND_HALF_CEIL=7,ie.ROUND_HALF_FLOOR=8,ie.EUCLID=9,ie.config=ie.set=function(K){var ve,Ae;if(K!=null)if(typeof K=="object"){if(K.hasOwnProperty(ve="DECIMAL_PLACES")&&(Ae=K[ve],xo(Ae,0,os,ve),T=Ae),K.hasOwnProperty(ve="ROUNDING_MODE")&&(Ae=K[ve],xo(Ae,0,8,ve),s=Ae),K.hasOwnProperty(ve="EXPONENTIAL_AT")&&(Ae=K[ve],Ae&&Ae.pop?(xo(Ae[0],-os,0,ve),xo(Ae[1],0,os,ve),M=Ae[0],L=Ae[1]):(xo(Ae,-os,os,ve),M=-(L=Ae<0?-Ae:Ae))),K.hasOwnProperty(ve="RANGE"))if(Ae=K[ve],Ae&&Ae.pop)xo(Ae[0],-os,-1,ve),xo(Ae[1],1,os,ve),B=Ae[0],H=Ae[1];else if(xo(Ae,-os,os,ve),Ae)B=-(H=Ae<0?-Ae:Ae);else throw Error(Ma+ve+" cannot be zero: "+Ae);if(K.hasOwnProperty(ve="CRYPTO"))if(Ae=K[ve],Ae===!!Ae)if(Ae)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))$=Ae;else throw $=!Ae,Error(Ma+"crypto unavailable");else $=Ae;else throw Error(Ma+ve+" not true or false: "+Ae);if(K.hasOwnProperty(ve="MODULO_MODE")&&(Ae=K[ve],xo(Ae,0,9,ve),te=Ae),K.hasOwnProperty(ve="POW_PRECISION")&&(Ae=K[ve],xo(Ae,0,os,ve),xe=Ae),K.hasOwnProperty(ve="FORMAT"))if(Ae=K[ve],typeof Ae=="object")pe=Ae;else throw Error(Ma+ve+" not an object: "+Ae);if(K.hasOwnProperty(ve="ALPHABET"))if(Ae=K[ve],typeof Ae=="string"&&!/^.?$|[+\-.\
vendor: 9,105 bytes, line 2819
2819s]|(.).*\1/.test(Ae))_e=Ae.slice(0,10)=="0123456789",Ne=Ae;else throw Error(Ma+ve+" invalid: "+Ae)}else throw Error(Ma+"Object expected: "+K);return{DECIMAL_PLACES:T,ROUNDING_MODE:s,EXPONENTIAL_AT:[M,L],RANGE:[B,H],CRYPTO:$,MODULO_MODE:te,POW_PRECISION:xe,FORMAT:pe,ALPHABET:Ne}},ie.isBigNumber=function(K){if(!K||K._isBigNumber!==!0)return!1;if(!ie.DEBUG)return!0;var ve,Ae,Ye=K.c,Be=K.e,Fe=K.s;e:if({}.toString.call(Ye)=="[object Array]"){if((Fe===1||Fe===-1)&&Be>=-os&&Be<=os&&Be===wl(Be)){if(Ye[0]===0){if(Be===0&&Ye.length===1)return!0;break e}if(ve=(Be+1)%Ui,ve<1&&(ve+=Ui),String(Ye[0]).length==ve){for(ve=0;ve<Ye.length;ve++)if(Ae=Ye[ve],Ae<0||Ae>=Ql||Ae!==wl(Ae))break e;if(Ae!==0)return!0}}}else if(Ye===null&&Be===null&&(Fe===null||Fe===1||Fe===-1))return!0;throw Error(Ma+"Invalid BigNumber: "+K)},ie.maximum=ie.max=function(){return ot(arguments,-1)},ie.minimum=ie.min=function(){return ot(arguments,1)},ie.random=function(){var K=9007199254740992,ve=Math.random()*K&2097151?function(){return wl(Math.random()*K)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Ae){var Ye,Be,Fe,Je,ze,He=0,tt=[],Oe=new ie(y);if(Ae==null?Ae=T:xo(Ae,0,os),Je=BS(Ae/Ui),$)if(crypto.getRandomValues){for(Ye=crypto.getRandomValues(new Uint32Array(Je*=2));He<Je;)ze=Ye[He]*131072+(Ye[He+1]>>>11),ze>=9e15?(Be=crypto.getRandomValues(new Uint32Array(2)),Ye[He]=Be[0],Ye[He+1]=Be[1]):(tt.push(ze%1e14),He+=2);He=Je/2}else if(crypto.randomBytes){for(Ye=crypto.randomBytes(Je*=7);He<Je;)ze=(Ye[He]&31)*281474976710656+Ye[He+1]*1099511627776+Ye[He+2]*4294967296+Ye[He+3]*16777216+(Ye[He+4]<<16)+(Ye[He+5]<<8)+Ye[He+6],ze>=9e15?crypto.randomBytes(7).copy(Ye,He):(tt.push(ze%1e14),He+=7);He=Je/7}else throw $=!1,Error(Ma+"crypto unavailable");if(!$)for(;He<Je;)ze=ve(),ze<9e15&&(tt[He++]=ze%1e14);for(Je=tt[--He],Ae%=Ui,Je&&Ae&&(ze=US[Ui-Ae],tt[He]=wl(Je/ze)*ze);tt[He]===0;tt.pop(),He--);if(He<0)tt=[Fe=0];else{for(Fe=-1;tt[0]===0;tt.splice(0,1),Fe-=Ui);for(He=1,ze=tt[0];ze>=10;ze/=10,He++);He<Ui&&(Fe-=Ui-He)}return Oe.e=Fe,Oe.c=tt,Oe}}(),ie.sum=function(){for(var K=1,ve=arguments,Ae=new ie(ve[0]);K<ve.length;)Ae=Ae.plus(ve[K++]);return Ae},o=function(){var K="0123456789";function ve(Ae,Ye,Be,Fe){for(var Je,ze=[0],He,tt=0,Oe=Ae.length;tt<Oe;){for(He=ze.length;He--;ze[He]*=Ye);for(ze[0]+=Fe.indexOf(Ae.charAt(tt++)),Je=0;Je<ze.length;Je++)ze[Je]>Be-1&&(ze[Je+1]==null&&(ze[Je+1]=0),ze[Je+1]+=ze[Je]/Be|0,ze[Je]%=Be)}return ze.reverse()}return function(Ae,Ye,Be,Fe,Je){var ze,He,tt,Oe,rt,Nt,jt,gr,li=Ae.indexOf("."),di=T,Wr=s;for(li>=0&&(Oe=xe,xe=0,Ae=Ae.replace(".",""),gr=new ie(Ye),Nt=gr.pow(Ae.length-li),xe=Oe,gr.c=ve(xu(El(Nt.c),Nt.e,"0"),10,Be,K),gr.e=gr.c.length),jt=ve(Ae,Ye,Be,Je?(ze=Ne,K):(ze=K,Ne)),tt=Oe=jt.length;jt[--Oe]==0;jt.pop());if(!jt[0])return ze.charAt(0);if(li<0?--tt:(Nt.c=jt,Nt.e=tt,Nt.s=Fe,Nt=t(Nt,gr,di,Wr,Be),jt=Nt.c,rt=Nt.r,tt=Nt.e),He=tt+di+1,li=jt[He],Oe=Be/2,rt=rt||He<0||jt[He+1]!=null,rt=Wr<4?(li!=null||rt)&&(Wr==0||Wr==(Nt.s<0?3:2)):li>Oe||li==Oe&&(Wr==4||rt||Wr==6&&jt[He-1]&1||Wr==(Nt.s<0?8:7)),He<1||!jt[0])Ae=rt?xu(ze.charAt(1),-di,ze.charAt(0)):ze.charAt(0);else{if(jt.length=He,rt)for(--Be;++jt[--He]>Be;)jt[He]=0,He||(++tt,jt=[1].concat(jt));for(Oe=jt.length;!jt[--Oe];);for(li=0,Ae="";li<=Oe;Ae+=ze.charAt(jt[li++]));Ae=xu(Ae,tt,ze.charAt(0))}return Ae}}(),t=function(){function K(Ye,Be,Fe){var Je,ze,He,tt,Oe=0,rt=Ye.length,Nt=Be%Sh,jt=Be/Sh|0;for(Ye=Ye.slice();rt--;)He=Ye[rt]%Sh,tt=Ye[rt]/Sh|0,Je=jt*He+tt*Nt,ze=Nt*He+Je%Sh*Sh+Oe,Oe=(ze/Fe|0)+(Je/Sh|0)+jt*tt,Ye[rt]=ze%Fe;return Oe&&(Ye=[Oe].concat(Ye)),Ye}function ve(Ye,Be,Fe,Je){var ze,He;if(Fe!=Je)He=Fe>Je?1:-1;else for(ze=He=0;ze<Fe;ze++)if(Ye[ze]!=Be[ze]){He=Ye[ze]>Be[ze]?1:-1;break}return He}function Ae(Ye,Be,Fe,Je){for(var ze=0;Fe--;)Ye[Fe]-=ze,ze=Ye[Fe]<Be[Fe]?1:0,Ye[Fe]=ze*Je+Ye[Fe]-Be[Fe];for(;!Ye[0]&&Ye.length>1;Ye.splice(0,1));}return function(Ye,Be,Fe,Je,ze){var He,tt,Oe,rt,Nt,jt,gr,li,di,Wr,fr,Ur,qi,zn,sn,ao,So,tn=Ye.s==Be.s?1:-1,Wi=Ye.c,Xr=Be.c;if(!Wi||!Wi[0]||!Xr||!Xr[0])return new ie(!Ye.s||!Be.s||(Wi?Xr&&Wi[0]==Xr[0]:!Xr)?NaN:Wi&&Wi[0]==0||!Xr?tn*0:tn/0);for(li=new ie(tn),di=li.c=[],tt=Ye.e-Be.e,tn=Fe+tt+1,ze||(ze=Ql,tt=Tl(Ye.e/Ui)-Tl(Be.e/Ui),tn=tn/Ui|0),Oe=0;Xr[Oe]==(Wi[Oe]||0);Oe++);if(Xr[Oe]>(Wi[Oe]||0)&&tt--,tn<0)di.push(1),rt=!0;else{for(zn=Wi.length,ao=Xr.length,Oe=0,tn+=2,Nt=wl(ze/(Xr[0]+1)),Nt>1&&(Xr=K(Xr,Nt,ze),Wi=K(Wi,Nt,ze),ao=Xr.length,zn=Wi.length),qi=ao,Wr=Wi.slice(0,ao),fr=Wr.length;fr<ao;Wr[fr++]=0);So=Xr.slice(),So=[0].concat(So),sn=Xr[0],Xr[1]>=ze/2&&sn++;do{if(Nt=0,He=ve(Xr,Wr,ao,fr),He<0){if(Ur=Wr[0],ao!=fr&&(Ur=Ur*ze+(Wr[1]||0)),Nt=wl(Ur/sn),Nt>1)for(Nt>=ze&&(Nt=ze-1),jt=K(Xr,Nt,ze),gr=jt.length,fr=Wr.length;ve(jt,Wr,gr,fr)==1;)Nt--,Ae(jt,ao<gr?So:Xr,gr,ze),gr=jt.length,He=1;else Nt==0&&(He=Nt=1),jt=Xr.slice(),gr=jt.length;if(gr<fr&&(jt=[0].concat(jt)),Ae(Wr,jt,fr,ze),fr=Wr.length,He==-1)for(;ve(Xr,Wr,ao,fr)<1;)Nt++,Ae(Wr,ao<fr?So:Xr,fr,ze),fr=Wr.length}else He===0&&(Nt++,Wr=[0]);di[Oe++]=Nt,Wr[0]?Wr[fr++]=Wi[qi]||0:(Wr=[Wi[qi]],fr=1)}while((qi++<zn||Wr[0]!=null)&&tn--);rt=Wr[0]!=null,di[0]||di.splice(0,1)}if(ze==Ql){for(Oe=1,tn=di[0];tn>=10;tn/=10,Oe++);wt(li,Fe+(li.e=Oe+tt*Ui-1)+1,Je,rt)}else li.e=tt,li.r=+rt;return li}}();function ke(K,ve,Ae,Ye){var Be,Fe,Je,ze,He;if(Ae==null?Ae=s:xo(Ae,0,8),!K.c)return K.toString();if(Be=K.c[0],Je=K.e,ve==null)He=El(K.c),He=Ye==1||Ye==2&&(Je<=M||Je>=L)?p1(He,Je):xu(He,Je,"0");else if(K=wt(new ie(K),ve,Ae),Fe=K.e,He=El(K.c),ze=He.length,Ye==1||Ye==2&&(ve<=Fe||Fe<=M)){for(;ze<ve;He+="0",ze++);He=p1(He,Fe)}else if(ve-=Je+(Ye===2&&Fe>Je),He=xu(He,Fe,"0"),Fe+1>ze){if(--ve>0)for(He+=".";ve--;He+="0");}else if(ve+=Fe-ze,ve>0)for(Fe+1==ze&&(He+=".");ve--;He+="0");return K.s<0&&Be?"-"+He:He}function ot(K,ve){for(var Ae,Ye,Be=1,Fe=new ie(K[0]);Be<K.length;Be++)Ye=new ie(K[Be]),(!Ye.s||(Ae=Kd(Fe,Ye))===ve||Ae===0&&Fe.s===ve)&&(Fe=Ye);return Fe}function et(K,ve,Ae){for(var Ye=1,Be=ve.length;!ve[--Be];ve.pop());for(Be=ve[0];Be>=10;Be/=10,Ye++);return(Ae=Ye+Ae*Ui-1)>H?K.c=K.e=null:Ae<B?K.c=[K.e=0]:(K.e=Ae,K.c=ve),K}u=function(){var K=/^(-?)0([xbo])(?=\w[\w.]*$)/i,ve=/^([^.]+)\.$/,Ae=/^\.([^.]+)$/,Ye=/^-?(Infinity|NaN)$/,Be=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(Fe,Je,ze,He){var tt,Oe=ze?Je:Je.replace(Be,"");if(Ye.test(Oe))Fe.s=isNaN(Oe)?null:Oe<0?-1:1;else{if(!ze&&(Oe=Oe.replace(K,function(rt,Nt,jt){return tt=(jt=jt.toLowerCase())=="x"?16:jt=="b"?2:8,!He||He==tt?Nt:rt}),He&&(tt=He,Oe=Oe.replace(ve,"$1").replace(Ae,"0.$1")),Je!=Oe))return new ie(Oe,tt);if(ie.DEBUG)throw Error(Ma+"Not a"+(He?" base "+He:"")+" number: "+Je);Fe.s=null}Fe.c=Fe.e=null}}();function wt(K,ve,Ae,Ye){var Be,Fe,Je,ze,He,tt,Oe,rt=K.c,Nt=US;if(rt){e:{for(Be=1,ze=rt[0];ze>=10;ze/=10,Be++);if(Fe=ve-Be,Fe<0)Fe+=Ui,Je=ve,He=rt[tt=0],Oe=wl(He/Nt[Be-Je-1]%10);else if(tt=BS((Fe+1)/Ui),tt>=rt.length)if(Ye){for(;rt.length<=tt;rt.push(0));He=Oe=0,Be=1,Fe%=Ui,Je=Fe-Ui+1}else break e;else{for(He=ze=rt[tt],Be=1;ze>=10;ze/=10,Be++);Fe%=Ui,Je=Fe-Ui+Be,Oe=Je<0?0:wl(He/Nt[Be-Je-1]%10)}if(Ye=Ye||ve<0||rt[tt+1]!=null||(Je<0?He:He%Nt[Be-Je-1]),Ye=Ae<4?(Oe||Ye)&&(Ae==0||Ae==(K.s<0?3:2)):Oe>5||Oe==5&&(Ae==4||Ye||Ae==6&&(Fe>0?Je>0?He/Nt[Be-Je]:0:rt[tt-1])%10&1||Ae==(K.s<0?8:7)),ve<1||!rt[0])return rt.length=0,Ye?(ve-=K.e+1,rt[0]=Nt[(Ui-ve%Ui)%Ui],K.e=-ve||0):rt[0]=K.e=0,K;if(Fe==0?(rt.length=tt,ze=1,tt--):(rt.length=tt+1,ze=Nt[Ui-Fe],rt[tt]=Je>0?wl(He/Nt[Be-Je]%Nt[Je])*ze:0),Ye)for(;;)if(tt==0){for(Fe=1,Je=rt[0];Je>=10;Je/=10,Fe++);for(Je=rt[0]+=ze,ze=1;Je>=10;Je/=10,ze++);Fe!=ze&&(K.e++,rt[0]==Ql&&(rt[0]=1));break}else{if(rt[tt]+=ze,rt[tt]!=Ql)break;rt[tt--]=0,ze=1}for(Fe=rt.length;rt[--Fe]===0;rt.pop());}K.e>H?K.c=K.e=null:K.e<B&&(K.c=[K.e=0])}return K}function It(K){var ve,Ae=K.e;return Ae===null?K.toString():(ve=El(K.c),ve=Ae<=M||Ae>=L?p1(ve,Ae):xu(ve,Ae,"0"),K.s<0?"-"+ve:ve)}return p.absoluteValue=p.abs=function(){var K=new ie(this);return K.s<0&&(K.s=1),K},p.comparedTo=function(K,ve){return Kd(this,new ie(K,ve))},p.decimalPlaces=p.dp=function(K,ve){var Ae,Ye,Be,Fe=this;if(K!=null)return xo(K,0,os),ve==null?ve=s:xo(ve,0,8),wt(new ie(Fe),K+Fe.e+1,ve);if(!(Ae=Fe.c))return null;if(Ye=((Be=Ae.length-1)-Tl(this.e/Ui))*Ui,Be=Ae[Be])for(;Be%10==0;Be/=10,Ye--);return Ye<0&&(Ye=0),Ye},p.dividedBy=p.div=function(K,ve){return t(this,new ie(K,ve),T,s)},p.dividedToIntegerBy=p.idiv=function(K,ve){return t(this,new ie(K,ve),0,1)},p.exponentiatedBy=p.pow=function(K,ve){var Ae,Ye,Be,Fe,Je,ze,He,tt,Oe,rt=this;if(K=new ie(K),K.c&&!K.isInteger())throw Error(Ma+"Exponent not an integer: "+It(K));if(ve!=null&&(ve=new ie(ve)),ze=K.e>14,!rt.c||!rt.c[0]||rt.c[0]==1&&!rt.e&&rt.c.length==1||!K.c||!K.c[0])return Oe=new ie(Math.pow(+It(rt),ze?K.s*(2-f1(K)):+It(K))),ve?Oe.mod(ve):Oe;if(He=K.s<0,ve){if(ve.c?!ve.c[0]:!ve.s)return new ie(NaN);Ye=!He&&rt.isInteger()&&ve.isInteger(),Ye&&(rt=rt.mod(ve))}else{if(K.e>9&&(rt.e>0||rt.e<-1||(rt.e==0?rt.c[0]>1||ze&&rt.c[1]>=24e7:rt.c[0]<8e13||ze&&rt.c[0]<=9999975e7)))return Fe=rt.s<0&&f1(K)?-0:0,rt.e>-1&&(Fe=1/Fe),new ie(He?1/Fe:Fe);xe&&(Fe=BS(xe/Ui+2))}for(ze?(Ae=new ie(.5),He&&(K.s=1),tt=f1(K)):(Be=Math.abs(+It(K)),tt=Be%2),Oe=ne
vendor: 15,392 bytes, line 2819
2819w ie(y);;){if(tt){if(Oe=Oe.times(rt),!Oe.c)break;Fe?Oe.c.length>Fe&&(Oe.c.length=Fe):Ye&&(Oe=Oe.mod(ve))}if(Be){if(Be=wl(Be/2),Be===0)break;tt=Be%2}else if(K=K.times(Ae),wt(K,K.e+1,1),K.e>14)tt=f1(K);else{if(Be=+It(K),Be===0)break;tt=Be%2}rt=rt.times(rt),Fe?rt.c&&rt.c.length>Fe&&(rt.c.length=Fe):Ye&&(rt=rt.mod(ve))}return Ye?Oe:(He&&(Oe=y.div(Oe)),ve?Oe.mod(ve):Fe?wt(Oe,xe,s,Je):Oe)},p.integerValue=function(K){var ve=new ie(this);return K==null?K=s:xo(K,0,8),wt(ve,ve.e+1,K)},p.isEqualTo=p.eq=function(K,ve){return Kd(this,new ie(K,ve))===0},p.isFinite=function(){return!!this.c},p.isGreaterThan=p.gt=function(K,ve){return Kd(this,new ie(K,ve))>0},p.isGreaterThanOrEqualTo=p.gte=function(K,ve){return(ve=Kd(this,new ie(K,ve)))===1||ve===0},p.isInteger=function(){return!!this.c&&Tl(this.e/Ui)>this.c.length-2},p.isLessThan=p.lt=function(K,ve){return Kd(this,new ie(K,ve))<0},p.isLessThanOrEqualTo=p.lte=function(K,ve){return(ve=Kd(this,new ie(K,ve)))===-1||ve===0},p.isNaN=function(){return!this.s},p.isNegative=function(){return this.s<0},p.isPositive=function(){return this.s>0},p.isZero=function(){return!!this.c&&this.c[0]==0},p.minus=function(K,ve){var Ae,Ye,Be,Fe,Je=this,ze=Je.s;if(K=new ie(K,ve),ve=K.s,!ze||!ve)return new ie(NaN);if(ze!=ve)return K.s=-ve,Je.plus(K);var He=Je.e/Ui,tt=K.e/Ui,Oe=Je.c,rt=K.c;if(!He||!tt){if(!Oe||!rt)return Oe?(K.s=-ve,K):new ie(rt?Je:NaN);if(!Oe[0]||!rt[0])return rt[0]?(K.s=-ve,K):new ie(Oe[0]?Je:s==3?-0:0)}if(He=Tl(He),tt=Tl(tt),Oe=Oe.slice(),ze=He-tt){for((Fe=ze<0)?(ze=-ze,Be=Oe):(tt=He,Be=rt),Be.reverse(),ve=ze;ve--;Be.push(0));Be.reverse()}else for(Ye=(Fe=(ze=Oe.length)<(ve=rt.length))?ze:ve,ze=ve=0;ve<Ye;ve++)if(Oe[ve]!=rt[ve]){Fe=Oe[ve]<rt[ve];break}if(Fe&&(Be=Oe,Oe=rt,rt=Be,K.s=-K.s),ve=(Ye=rt.length)-(Ae=Oe.length),ve>0)for(;ve--;Oe[Ae++]=0);for(ve=Ql-1;Ye>ze;){if(Oe[--Ye]<rt[Ye]){for(Ae=Ye;Ae&&!Oe[--Ae];Oe[Ae]=ve);--Oe[Ae],Oe[Ye]+=Ql}Oe[Ye]-=rt[Ye]}for(;Oe[0]==0;Oe.splice(0,1),--tt);return Oe[0]?et(K,Oe,tt):(K.s=s==3?-1:1,K.c=[K.e=0],K)},p.modulo=p.mod=function(K,ve){var Ae,Ye,Be=this;return K=new ie(K,ve),!Be.c||!K.s||K.c&&!K.c[0]?new ie(NaN):!K.c||Be.c&&!Be.c[0]?new ie(Be):(te==9?(Ye=K.s,K.s=1,Ae=t(Be,K,0,3),K.s=Ye,Ae.s*=Ye):Ae=t(Be,K,0,te),K=Be.minus(Ae.times(K)),!K.c[0]&&te==1&&(K.s=Be.s),K)},p.multipliedBy=p.times=function(K,ve){var Ae,Ye,Be,Fe,Je,ze,He,tt,Oe,rt,Nt,jt,gr,li,di,Wr=this,fr=Wr.c,Ur=(K=new ie(K,ve)).c;if(!fr||!Ur||!fr[0]||!Ur[0])return!Wr.s||!K.s||fr&&!fr[0]&&!Ur||Ur&&!Ur[0]&&!fr?K.c=K.e=K.s=null:(K.s*=Wr.s,!fr||!Ur?K.c=K.e=null:(K.c=[0],K.e=0)),K;for(Ye=Tl(Wr.e/Ui)+Tl(K.e/Ui),K.s*=Wr.s,He=fr.length,rt=Ur.length,He<rt&&(gr=fr,fr=Ur,Ur=gr,Be=He,He=rt,rt=Be),Be=He+rt,gr=[];Be--;gr.push(0));for(li=Ql,di=Sh,Be=rt;--Be>=0;){for(Ae=0,Nt=Ur[Be]%di,jt=Ur[Be]/di|0,Je=He,Fe=Be+Je;Fe>Be;)tt=fr[--Je]%di,Oe=fr[Je]/di|0,ze=jt*tt+Oe*Nt,tt=Nt*tt+ze%di*di+gr[Fe]+Ae,Ae=(tt/li|0)+(ze/di|0)+jt*Oe,gr[Fe--]=tt%li;gr[Fe]=Ae}return Ae?++Ye:gr.splice(0,1),et(K,gr,Ye)},p.negated=function(){var K=new ie(this);return K.s=-K.s||null,K},p.plus=function(K,ve){var Ae,Ye=this,Be=Ye.s;if(K=new ie(K,ve),ve=K.s,!Be||!ve)return new ie(NaN);if(Be!=ve)return K.s=-ve,Ye.minus(K);var Fe=Ye.e/Ui,Je=K.e/Ui,ze=Ye.c,He=K.c;if(!Fe||!Je){if(!ze||!He)return new ie(Be/0);if(!ze[0]||!He[0])return He[0]?K:new ie(ze[0]?Ye:Be*0)}if(Fe=Tl(Fe),Je=Tl(Je),ze=ze.slice(),Be=Fe-Je){for(Be>0?(Je=Fe,Ae=He):(Be=-Be,Ae=ze),Ae.reverse();Be--;Ae.push(0));Ae.reverse()}for(Be=ze.length,ve=He.length,Be-ve<0&&(Ae=He,He=ze,ze=Ae,ve=Be),Be=0;ve;)Be=(ze[--ve]=ze[ve]+He[ve]+Be)/Ql|0,ze[ve]=Ql===ze[ve]?0:ze[ve]%Ql;return Be&&(ze=[Be].concat(ze),++Je),et(K,ze,Je)},p.precision=p.sd=function(K,ve){var Ae,Ye,Be,Fe=this;if(K!=null&&K!==!!K)return xo(K,1,os),ve==null?ve=s:xo(ve,0,8),wt(new ie(Fe),K,ve);if(!(Ae=Fe.c))return null;if(Be=Ae.length-1,Ye=Be*Ui+1,Be=Ae[Be]){for(;Be%10==0;Be/=10,Ye--);for(Be=Ae[0];Be>=10;Be/=10,Ye++);}return K&&Fe.e+1>Ye&&(Ye=Fe.e+1),Ye},p.shiftedBy=function(K){return xo(K,-VS,VS),this.times("1e"+K)},p.squareRoot=p.sqrt=function(){var K,ve,Ae,Ye,Be,Fe=this,Je=Fe.c,ze=Fe.s,He=Fe.e,tt=T+4,Oe=new ie("0.5");if(ze!==1||!Je||!Je[0])return new ie(!ze||ze<0&&(!Je||Je[0])?NaN:Je?Fe:1/0);if(ze=Math.sqrt(+It(Fe)),ze==0||ze==1/0?(ve=El(Je),(ve.length+He)%2==0&&(ve+="0"),ze=Math.sqrt(+ve),He=Tl((He+1)/2)-(He<0||He%2),ze==1/0?ve="5e"+He:(ve=ze.toExponential(),ve=ve.slice(0,ve.indexOf("e")+1)+He),Ae=new ie(ve)):Ae=new ie(ze+""),Ae.c[0]){for(He=Ae.e,ze=He+tt,ze<3&&(ze=0);;)if(Be=Ae,Ae=Oe.times(Be.plus(t(Fe,Be,tt,1))),El(Be.c).slice(0,ze)===(ve=El(Ae.c)).slice(0,ze))if(Ae.e<He&&--ze,ve=ve.slice(ze-3,ze+1),ve=="9999"||!Ye&&ve=="4999"){if(!Ye&&(wt(Be,Be.e+T+2,0),Be.times(Be).eq(Fe))){Ae=Be;break}tt+=4,ze+=4,Ye=1}else{(!+ve||!+ve.slice(1)&&ve.charAt(0)=="5")&&(wt(Ae,Ae.e+T+2,1),K=!Ae.times(Ae).eq(Fe));break}}return wt(Ae,Ae.e+T+1,s,K)},p.toExponential=function(K,ve){return K!=null&&(xo(K,0,os),K++),ke(this,K,ve,1)},p.toFixed=function(K,ve){return K!=null&&(xo(K,0,os),K=K+this.e+1),ke(this,K,ve)},p.toFormat=function(K,ve,Ae){var Ye,Be=this;if(Ae==null)K!=null&&ve&&typeof ve=="object"?(Ae=ve,ve=null):K&&typeof K=="object"?(Ae=K,K=ve=null):Ae=pe;else if(typeof Ae!="object")throw Error(Ma+"Argument not an object: "+Ae);if(Ye=Be.toFixed(K,ve),Be.c){var Fe,Je=Ye.split("."),ze=+Ae.groupSize,He=+Ae.secondaryGroupSize,tt=Ae.groupSeparator||"",Oe=Je[0],rt=Je[1],Nt=Be.s<0,jt=Nt?Oe.slice(1):Oe,gr=jt.length;if(He&&(Fe=ze,ze=He,He=Fe,gr-=Fe),ze>0&&gr>0){for(Fe=gr%ze||ze,Oe=jt.substr(0,Fe);Fe<gr;Fe+=ze)Oe+=tt+jt.substr(Fe,ze);He>0&&(Oe+=tt+jt.slice(Fe)),Nt&&(Oe="-"+Oe)}Ye=rt?Oe+(Ae.decimalSeparator||"")+((He=+Ae.fractionGroupSize)?rt.replace(new RegExp("\\d{"+He+"}\\B","g"),"$&"+(Ae.fractionGroupSeparator||"")):rt):Oe}return(Ae.prefix||"")+Ye+(Ae.suffix||"")},p.toFraction=function(K){var ve,Ae,Ye,Be,Fe,Je,ze,He,tt,Oe,rt,Nt,jt=this,gr=jt.c;if(K!=null&&(ze=new ie(K),!ze.isInteger()&&(ze.c||ze.s!==1)||ze.lt(y)))throw Error(Ma+"Argument "+(ze.isInteger()?"out of range: ":"not an integer: ")+It(ze));if(!gr)return new ie(jt);for(ve=new ie(y),tt=Ae=new ie(y),Ye=He=new ie(y),Nt=El(gr),Fe=ve.e=Nt.length-jt.e-1,ve.c[0]=US[(Je=Fe%Ui)<0?Ui+Je:Je],K=!K||ze.comparedTo(ve)>0?Fe>0?ve:tt:ze,Je=H,H=1/0,ze=new ie(Nt),He.c[0]=0;Oe=t(ze,ve,0,1),Be=Ae.plus(Oe.times(Ye)),Be.comparedTo(K)!=1;)Ae=Ye,Ye=Be,tt=He.plus(Oe.times(Be=tt)),He=Be,ve=ze.minus(Oe.times(Be=ve)),ze=Be;return Be=t(K.minus(Ae),Ye,0,1),He=He.plus(Be.times(tt)),Ae=Ae.plus(Be.times(Ye)),He.s=tt.s=jt.s,Fe=Fe*2,rt=t(tt,Ye,Fe,s).minus(jt).abs().comparedTo(t(He,Ae,Fe,s).minus(jt).abs())<1?[tt,Ye]:[He,Ae],H=Je,rt},p.toNumber=function(){return+It(this)},p.toPrecision=function(K,ve){return K!=null&&xo(K,1,os),ke(this,K,ve,2)},p.toString=function(K){var ve,Ae=this,Ye=Ae.s,Be=Ae.e;return Be===null?Ye?(ve="Infinity",Ye<0&&(ve="-"+ve)):ve="NaN":(K==null?ve=Be<=M||Be>=L?p1(El(Ae.c),Be):xu(El(Ae.c),Be,"0"):K===10&&_e?(Ae=wt(new ie(Ae),T+Be+1,s),ve=xu(El(Ae.c),Ae.e,"0")):(xo(K,2,Ne.length,"Base"),ve=o(xu(El(Ae.c),Be,"0"),10,K,Ye,!0)),Ye<0&&Ae.c[0]&&(ve="-"+ve)),ve},p.valueOf=p.toJSON=function(){return It(this)},p._isBigNumber=!0,p[Symbol.toStringTag]="BigNumber",p[Symbol.for("nodejs.util.inspect.custom")]=p.valueOf,e!=null&&ie.set(e),ie}function Tl(e){var t=e|0;return e>0||e===t?t:t-1}function El(e){for(var t,o,u=1,p=e.length,y=e[0]+"";u<p;){for(t=e[u++]+"",o=Ui-t.length;o--;t="0"+t);y+=t}for(p=y.length;y.charCodeAt(--p)===48;);return y.slice(0,p+1||1)}function Kd(e,t){var o,u,p=e.c,y=t.c,T=e.s,s=t.s,M=e.e,L=t.e;if(!T||!s)return null;if(o=p&&!p[0],u=y&&!y[0],o||u)return o?u?0:-s:T;if(T!=s)return T;if(o=T<0,u=M==L,!p||!y)return u?0:!p^o?1:-1;if(!u)return M>L^o?1:-1;for(s=(M=p.length)<(L=y.length)?M:L,T=0;T<s;T++)if(p[T]!=y[T])return p[T]>y[T]^o?1:-1;return M==L?0:M>L^o?1:-1}function xo(e,t,o,u){if(e<t||e>o||e!==wl(e))throw Error(Ma+(u||"Argument")+(typeof e=="number"?e<t||e>o?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function f1(e){var t=e.c.length-1;return Tl(e.e/Ui)==t&&e.c[t]%2!=0}function p1(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function xu(e,t,o){var u,p;if(t<0){for(p=o+".";++t;p+=o);e=p+e}else if(u=e.length,++t>u){for(p=o,t-=u;--t;p+=o);e+=p}else t<u&&(e=e.slice(0,t)+"."+e.slice(t));return e}var kc=cz(),uW=class{constructor(e){de(this,"key");de(this,"left",null);de(this,"right",null);this.key=e}},U_=class extends uW{constructor(e){super(e)}},hW=class{constructor(){de(this,"size",0);de(this,"modificationCount",0);de(this,"splayCount",0)}splay(e){const t=this.root;if(t==null)return this.compare(e,e),-1;let o=null,u=null,p=null,y=null,T=t;const s=this.compare;let M;for(;;)if(M=s(T.key,e),M>0){let L=T.left;if(L==null||(M=s(L.key,e),M>0&&(T.left=L.right,L.right=T,T=L,L=T.left,L==null)))break;o==null?u=T:o.left=T,o=T,T=L}else if(M<0){let L=T.right;if(L==null||(M=s(L.key,e),M<0&&(T.right=L.left,L.left=T,T=L,L=T.right,L==null)))break;p==null?y=T:p.right=T,p=T,T=L}else break;return p!=null&&(p.right=T.left,T.left=y),o!=null&&(o.left=T.right,T.right=u),this.root!==T&&(this.root=T,this.splayCount++),M}splayMin(e){let t=e,o=t.left;for(;o!=null;){const u=o;t.left=u.right,u.right=t,t=u,o=t.left}return t}splayMax(e){let t=e,o=t.right;for(;o!=null;){const u=o;t.right=u.left,u.left=t,t=u,o=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let o=this.root;const u=o,p=o.left;if(this.size--,p==null)this.root=o.right;else{const y=o.right;o=this.splayMax(p),o.right=y,this.root=o}return this.modificationCount++,u}addNewRoot(e,t){this.size++,this.modificationCount++;const o=this.root;if(o==null){this.root=e;return}t<0?(e.left=o,e.right=o.right,o.right=null):(e.right=o,e.left=o.left,o.left=null),this.root=e}_first(){const e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){const e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},m1=class wv extends hW{constructor(o,u){super();de(this,"root",null);de(this,"compare");de(this,"validKey");de(this,g5,"[object Set]");this.compare=o??this.defaultCompare(),this.validKey=u??(p=>p!=null&&p!=null)}delete(o){return this.validKey(o)?this._delete(o)!=null:!1}deleteAll(o){for(const u of o)this.delete(u)}forEach(o){const u=this[Symbol.iterator]();let p;for(;p=u.next(),!p.done;)o(p.value,p.value,this)}add(o){const u=this.splay(o);return u!=0&&this.addNewRoot(new U_(o),u),this}addAndReturn(o){const u=this.splay(o);return u!=0&&this.addNewRoot(new U_(o),u),this.root.key}addAll(o){for(const u of o)this.add(u)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(o){if(o==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(o)<0)return this.root.key;let p=this.root.left;if(p==null)return null;let y=p.right;for(;y!=null;)p=y,y=p.right;return p.key}firstAfter(o){if(o==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(o)>0)return this.root.key;let p=this.root.right;if(p==null)return null;let y=p.left;for(;y!=null;)p=y,y=p.left;return p.key}retainAll(o){const u=new wv(this.compare,this.validKey),p=this.modificationCount;for(const y of o){if(p!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(y)&&this.splay(y)==0&&u.add(this.root.key)}u.size!=this.size&&(this.root=u.root,this.size=u.size,this.modificationCount++)}lookup(o){return!this.validKey(o)||this.splay(o)!=0?null:this.root.key}intersection(o){const u=new wv(this.compare,this.validKey);for(const p of this)o.has(p)&&u.add(p);return u}difference(o){const u=new wv(this.compare,this.validKey);for(const p of this)o.has(p)||u.add(p);return u}union(o){const u=this.clone();return u.addAll(o),u}clone(){const o=new wv(this.compare,this.validKey);return o.size=this.size,o.root=this.copyNode(this.root),o}copyNode(o){if(o==null)return null;function u(y,T){let s,M;do{if(s=y.left,M=y.right,s!=null){const L=new U_(s.key);T.left=L,u(s,L)}if(M!=null){const L=new U_(M.key);T.right=L,y=M,T=L}}while(M!=null)}const p=new U_(o.key);return u(o,p),p}toSet(){return this.clone()}entries(){return new fW(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(_5=Symbol.iterator,g5=Symbol.toStringTag,_5)](){return new dW(this.wrap())}},uz=class{constructor(e){de(this,"tree");de(this,"path",new Array);de(this,"modificationCount",null);de(this,"splayCount");this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let o=this.tree.getRoot();for(;o!=null;)this.path.push(o),o=o.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},dW=class extends uz{getValue(e){return e.key}},fW=class extends uz{getValue(e){return[e.key,e.key]}},hz=e=>()=>e,jS=e=>{const t=e?(o,u)=>u.minus(o).abs().isLessThanOrEqualTo(e):hz(!1);return(o,u)=>t(o,u)?0:o.comparedTo(u)};function pW(e){const t=e?(o,u,p,y,T)=>o.exponentiatedBy(2).isLessThanOrEqualTo(y.minus(u).exponentiatedBy(2).plus(T.minus(p).exponentiatedBy(2)).times(e)):hz(!1);return(o,u,p)=>{const y=o.x,T=o.y,s=p.x,M=p.y,L=T.minus(M).times(u.x.minus(s)).minus(y.minus(s).times(u.y.minus(M)));return t(L,y,T,s,M)?0:L.comparedTo(0)}}var mW=e=>e,gW=e=>{if(e){const t=new m1(jS(e)),o=new m1(jS(e)),u=(y,T)=>T.addAndReturn(y),p=y=>({x:u(y.x,t),y:u(y.y,o)});return p({x:new kc(0),y:new kc(0)}),p}return mW},GS=e=>({set:t=>{bu=GS(t)},reset:()=>GS(e),compare:jS(e),snap:gW(e),orient:pW(e)}),bu=GS(),j_=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),$S=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const o=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,u=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,p=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,y=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:o,y:p}
2819,ur:{x:u,y}}},g1=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),dz=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),_1=e=>dz(e,e).sqrt(),_W=(e,t,o)=>{const u={x:t.x.minus(e.x),y:t.y.minus(e.y)},p={x:o.x.minus(e.x),y:o.y.minus(e.y)};return g1(p,u).div(_1(p)).div(_1(u))},yW=(e,t,o)=>{const u={x:t.x.minus(e.x),y:t.y.minus(e.y)},p={x:o.x.minus(e.x),y:o.y.minus(e.y)};return dz(p,u).div(_1(p)).div(_1(u))},fz=(e,t,o)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(o.minus(e.y))),y:o},pz=(e,t,o)=>t.x.isZero()?null:{x:o,y:e.y.plus(t.y.div(t.x).times(o.minus(e.x)))},vW=(e,t,o,u)=>{if(t.x.isZero())return pz(o,u,e.x);if(u.x.isZero())return pz(e,t,o.x);if(t.y.isZero())return fz(o,u,e.y);if(u.y.isZero())return fz(e,t,o.y);const p=g1(t,u);if(p.isZero())return null;const y={x:o.x.minus(e.x),y:o.y.minus(e.y)},T=g1(y,t).div(p),s=g1(y,u).div(p),M=e.x.plus(s.times(t.x)),L=o.x.plus(T.times(u.x)),B=e.y.plus(s.times(t.y)),H=o.y.plus(T.times(u.y)),$=M.plus(L).div(2),te=B.plus(H).div(2);return{x:$,y:te}},Rc=class _G{constructor(t,o){de(this,"point");de(this,"isLeft");de(this,"segment");de(this,"otherSE");de(this,"consumedBy");t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=o}static compare(t,o){const u=_G.comparePoints(t.point,o.point);return u!==0?u:(t.point!==o.point&&t.link(o),t.isLeft!==o.isLeft?t.isLeft?1:-1:y1.compare(t.segment,o.segment))}static comparePoints(t,o){return t.x.isLessThan(o.x)?-1:t.x.isGreaterThan(o.x)?1:t.y.isLessThan(o.y)?-1:t.y.isGreaterThan(o.y)?1:0}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const o=t.point.events;for(let u=0,p=o.length;u<p;u++){const y=o[u];this.point.events.push(y),y.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let o=0;o<t;o++){const u=this.point.events[o];if(u.segment.consumedBy===void 0)for(let p=o+1;p<t;p++){const y=this.point.events[p];y.consumedBy===void 0&&u.otherSE.point.events===y.otherSE.point.events&&u.segment.consume(y.segment)}}}getAvailableLinkedEvents(){const t=[];for(let o=0,u=this.point.events.length;o<u;o++){const p=this.point.events[o];p!==this&&!p.segment.ringOut&&p.segment.isInResult()&&t.push(p)}return t}getLeftmostComparator(t){const o=new Map,u=p=>{const y=p.otherSE;o.set(p,{sine:_W(this.point,t.point,y.point),cosine:yW(this.point,t.point,y.point)})};return(p,y)=>{o.has(p)||u(p),o.has(y)||u(y);const{sine:T,cosine:s}=o.get(p),{sine:M,cosine:L}=o.get(y);return T.isGreaterThanOrEqualTo(0)&&M.isGreaterThanOrEqualTo(0)?s.isLessThan(L)?1:s.isGreaterThan(L)?-1:0:T.isLessThan(0)&&M.isLessThan(0)?s.isLessThan(L)?-1:s.isGreaterThan(L)?1:0:M.isLessThan(T)?-1:M.isGreaterThan(T)?1:0}}},xW=class h3{constructor(t){de(this,"events");de(this,"poly");de(this,"_isExteriorRing");de(this,"_enclosingRing");this.events=t;for(let o=0,u=t.length;o<u;o++)t[o].segment.ringOut=this;this.poly=null}static factory(t){const o=[];for(let u=0,p=t.length;u<p;u++){const y=t[u];
vendor: 14,371 bytes, line 2819
2819if(!y.isInResult()||y.ringOut)continue;let T=null,s=y.leftSE,M=y.rightSE;const L=[s],B=s.point,H=[];for(;T=s,s=M,L.push(s),s.point!==B;)for(;;){const $=s.getAvailableLinkedEvents();if($.length===0){const pe=L[0].point,Ne=L[L.length-1].point;throw new Error(`Unable to complete output ring starting at [${pe.x}, ${pe.y}]. Last matching segment found ends at [${Ne.x}, ${Ne.y}].`)}if($.length===1){M=$[0].otherSE;break}let te=null;for(let pe=0,Ne=H.length;pe<Ne;pe++)if(H[pe].point===s.point){te=pe;break}if(te!==null){const pe=H.splice(te)[0],Ne=L.splice(pe.index);Ne.unshift(Ne[0].otherSE),o.push(new h3(Ne.reverse()));continue}H.push({index:L.length,point:s.point});const xe=s.getLeftmostComparator(T);M=$.sort(xe)[0].otherSE;break}o.push(new h3(L))}return o}getGeom(){let t=this.events[0].point;const o=[t];for(let L=1,B=this.events.length-1;L<B;L++){const H=this.events[L].point,$=this.events[L+1].point;bu.orient(H,t,$)!==0&&(o.push(H),t=H)}if(o.length===1)return null;const u=o[0],p=o[1];bu.orient(u,t,p)===0&&o.shift(),o.push(o[0]);const y=this.isExteriorRing()?1:-1,T=this.isExteriorRing()?0:o.length-1,s=this.isExteriorRing()?o.length:-1,M=[];for(let L=T;L!=s;L+=y)M.push([o[L].x.toNumber(),o[L].y.toNumber()]);return M}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){var p,y;let t=this.events[0];for(let T=1,s=this.events.length;T<s;T++){const M=this.events[T];Rc.compare(t,M)>0&&(t=M)}let o=t.segment.prevInResult(),u=o?o.prevInResult():null;for(;;){if(!o)return null;if(!u)return o.ringOut;if(u.ringOut!==o.ringOut)return((p=u.ringOut)==null?void 0:p.enclosingRing())!==o.ringOut?o.ringOut:(y=o.ringOut)==null?void 0:y.enclosingRing();o=u.prevInResult(),u=o?o.prevInResult():null}}},mz=class{constructor(e){de(this,"exteriorRing");de(this,"interiorRings");this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(e===null)return null;const t=[e];for(let o=0,u=this.interiorRings.length;o<u;o++){const p=this.interiorRings[o].getGeom();p!==null&&t.push(p)}return t}},bW=class{constructor(e){de(this,"rings");de(this,"polys");this.rings=e,this.polys=this._composePolys(e)}getGeom(){const e=[];for(let t=0,o=this.polys.length;t<o;t++){const u=this.polys[t].getGeom();u!==null&&e.push(u)}return e}_composePolys(e){var o;const t=[];for(let u=0,p=e.length;u<p;u++){const y=e[u];if(!y.poly)if(y.isExteriorRing())t.push(new mz(y));else{const T=y.enclosingRing();T!=null&&T.poly||t.push(new mz(T)),(o=T==null?void 0:T.poly)==null||o.addInterior(y)}}return t}},wW=class{constructor(e,t=y1.compare){de(this,"queue");de(this,"tree");de(this,"segments");this.queue=e,this.tree=new m1(t),this.segments=[]}process(e){const t=e.segment,o=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),o;e.isLeft&&this.tree.add(t);let u=t,p=t;do u=this.tree.lastBefore(u);while(u!=null&&u.consumedBy!=null);do p=this.tree.firstAfter(p);while(p!=null&&p.consumedBy!=null);if(e.isLeft){let y=null;if(u){const s=u.getIntersection(t);if(s!==null&&(t.isAnEndpoint(s)||(y=s),!u.isAnEndpoint(s))){const M=this._splitSafely(u,s);for(let L=0,B=M.length;L<B;L++)o.push(M[L])}}let T=null;if(p){const s=p.getIntersection(t);if(s!==null&&(t.isAnEndpoint(s)||(T=s),!p.isAnEndpoint(s))){const M=this._splitSafely(p,s);for(let L=0,B=M.length;L<B;L++)o.push(M[L])}}if(y!==null||T!==null){let s=null;y===null?s=T:T===null?s=y:s=Rc.comparePoints(y,T)<=0?y:T,this.queue.delete(t.rightSE),o.push(t.rightSE);const M=t.split(s);for(let L=0,B=M.length;L<B;L++)o.push(M[L])}o.length>0?(this.tree.delete(t),o.push(e)):(this.segments.push(t),t.prev=u)}else{if(u&&p){const y=u.getIntersection(p);if(y!==null){if(!u.isAnEndpoint(y)){const T=this._splitSafely(u,y);for(let s=0,M=T.length;s<M;s++)o.push(T[s])}if(!p.isAnEndpoint(y)){const T=this._splitSafely(p,y);for(let s=0,M=T.length;s<M;s++)o.push(T[s])}}}this.tree.delete(t)}return o}_splitSafely(e,t){this.tree.delete(e);const o=e.rightSE;this.queue.delete(o);const u=e.split(t);return u.push(o),e.consumedBy===void 0&&this.tree.add(e),u}},TW=class{constructor(){de(this,"type");de(this,"numMultiPolys")}run(e,t,o){G_.type=e;const u=[new _z(t,!0)];for(let L=0,B=o.length;L<B;L++)u.push(new _z(o[L],!1));if(G_.numMultiPolys=u.length,G_.type==="difference"){const L=u[0];let B=1;for(;B<u.length;)$S(u[B].bbox,L.bbox)!==null?B++:u.splice(B,1)}if(G_.type==="intersection")for(let L=0,B=u.length;L<B;L++){const H=u[L];for(let $=L+1,te=u.length;$<te;$++)if($S(H.bbox,u[$].bbox)===null)return[]}const p=new m1(Rc.compare);for(let L=0,B=u.length;L<B;L++){const H=u[L].getSweepEvents();for(let $=0,te=H.length;$<te;$++)p.add(H[$])}const y=new wW(p);let T=null;for(p.size!=0&&(T=p.first(),p.delete(T));T;){const L=y.process(T);for(let B=0,H=L.length;B<H;B++){const $=L[B];$.consumedBy===void 0&&p.add($)}p.size!=0?(T=p.first(),p.delete(T)):T=null}bu.reset();const s=xW.factory(y.segments);return new bW(s).getGeom()}},G_=new TW,HS=G_,EW=0,y1=class g2{constructor(t,o,u,p){de(this,"id");de(this,"leftSE");de(this,"rightSE");de(this,"rings");de(this,"windings");de(this,"ringOut");de(this,"consumedBy");de(this,"prev");de(this,"_prevInResult");de(this,"_beforeState");de(this,"_afterState");de(this,"_isInResult");this.id=++EW,this.leftSE=t,t.segment=this,t.otherSE=o,this.rightSE=o,o.segment=this,o.otherSE=t,this.rings=u,this.windings=p}static compare(t,o){const u=t.leftSE.point.x,p=o.leftSE.point.x,y=t.rightSE.point.x,T=o.rightSE.point.x;if(T.isLessThan(u))return 1;if(y.isLessThan(p))return-1;const s=t.leftSE.point.y,M=o.leftSE.point.y,L=t.rightSE.point.y,B=o.rightSE.point.y;if(u.isLessThan(p)){if(M.isLessThan(s)&&M.isLessThan(L))return 1;if(M.isGreaterThan(s)&&M.isGreaterThan(L))return-1;const H=t.comparePoint(o.leftSE.point);if(H<0)return 1;if(H>0)return-1;const $=o.comparePoint(t.rightSE.point);return $!==0?$:-1}if(u.isGreaterThan(p)){if(s.isLessThan(M)&&s.isLessThan(B))return-1;if(s.isGreaterThan(M)&&s.isGreaterThan(B))return 1;const H=o.comparePoint(t.leftSE.point);if(H!==0)return H;const $=t.comparePoint(o.rightSE.point);return $<0?1:$>0?-1:1}if(s.isLessThan(M))return-1;if(s.isGreaterThan(M))return 1;if(y.isLessThan(T)){const H=o.comparePoint(t.rightSE.point);if(H!==0)return H}if(y.isGreaterThan(T)){const H=t.comparePoint(o.rightSE.point);if(H<0)return 1;if(H>0)return-1}if(!y.eq(T)){const H=L.minus(s),$=y.minus(u),te=B.minus(M),xe=T.minus(p);if(H.isGreaterThan($)&&te.isLessThan(xe))return 1;if(H.isLessThan($)&&te.isGreaterThan(xe))return-1}return y.isGreaterThan(T)?1:y.isLessThan(T)||L.isLessThan(B)?-1:L.isGreaterThan(B)?1:t.id<o.id?-1:t.id>o.id?1:0}static fromRing(t,o,u){let p,y,T;const s=Rc.comparePoints(t,o);if(s<0)p=t,y=o,T=1;else if(s>0)p=o,y=t,T=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const M=new Rc(p,!0),L=new Rc(y,!1);return new g2(M,L,[u],[T])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,o=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t.isLessThan(o)?t:o},ur:{x:this.rightSE.point.x,y:t.isGreaterThan(o)?t:o}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(t){return t.x.eq(this.leftSE.point.x)&&t.y.eq(this.leftSE.point.y)||t.x.eq(this.rightSE.point.x)&&t.y.eq(this.rightSE.point.y)}comparePoint(t){return bu.orient(this.leftSE.point,t,this.rightSE.point)}getIntersection(t){const o=this.bbox(),u=t.bbox(),p=$S(o,u);if(p===null)return null;const y=this.leftSE.point,T=this.rightSE.point,s=t.leftSE.point,M=t.rightSE.point,L=j_(o,s)&&this.comparePoint(s)===0,B=j_(u,y)&&t.comparePoint(y)===0,H=j_(o,M)&&this.comparePoint(M)===0,$=j_(u,T)&&t.comparePoint(T)===0;if(B&&L)return $&&!H?T:!$&&H?M:null;if(B)return H&&y.x.eq(M.x)&&y.y.eq(M.y)?null:y;if(L)return $&&T.x.eq(s.x)&&T.y.eq(s.y)?null:s;if($&&H)return null;if($)return T;if(H)return M;const te=vW(y,this.vector(),s,t.vector());return te===null||!j_(p,te)?null:bu.snap(te)}split(t){const o=[],u=t.events!==void 0,p=new Rc(t,!0),y=new Rc(t,!1),T=this.rightSE;this.replaceRightSE(y),o.push(y),o.push(p);const s=new g2(p,T,this.rings.slice(),this.windings.slice());return Rc.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),Rc.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),u&&(p.checkForConsuming(),y.checkForConsuming()),o}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let o=0,u=this.windings.length;o<u;o++)this.windings[o]*=-1}consume(t){let o=this,u=t;for(;o.consumedBy;)o=o.consumedBy;for(;u.consumedBy;)u=u.consumedBy;const p=g2.compare(o,u);if(p!==0){if(p>0){const y=o;o=u,u=y}if(o.prev===u){const y=o;o=u,u=y}for(let y=0,T=u.rings.length;y<T;y++){const s=u.rings[y],M=u.windings[y],L=o.rings.indexOf(s);L===-1?(o.rings.push(s),o.windings.push(M)):o.windings[L]+=M}u.rings=null,u.windings=null,u.consumedBy=o,u.leftSE.consumedBy=o.leftSE,u.rightSE.consumedBy=o.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const o=this._afterState.rings,u=this._afterState.windings,p=this._afterState.multiPolys;for(let s=0,M=this.rings.length;s<M;s++){const L=this.rings[s],B=this.windings[s],H=o.indexOf(L);H===-1?(o.push(L),u.push(B)):u[H]+=B}const y=[],T=[];for(let s=0,M=o.length;s<M;s++){if(u[s]===0)continue;const L=o[s],B=L.poly;if(T.indexOf(B)===-1)if(L.isExterior)y.push(B);else{T.indexOf(B)===-1&&T.push(B);const H=y.indexOf(L.poly);H!==-1&&y.splice(H,1)}}for(let s=0,M=y.length;s<M;s++){const L=y[s].multiPoly;p.indexOf(L)===-1&&p.push(L)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,o=this.afterState().multiPolys;switch(HS.type){case"union":{const u=t.length===0,p=o.length===0;this._isInResult=u!==p;break}case"intersection":{let u,p;t.length<o.length?(u=t.length,p=o.length):(u=o.length,p=t.length),this._isInResult=p===HS.numMultiPolys&&u<p;break}case"xor":{const u=Math.abs(t.length-o.length);this._isInResult=u%2===1;break}case"difference":{const u=p=>p.length===1&&p[0].isSubject;this._isInResult=u(t)!==u(o);break}}return this._isInResult}},gz=class{constructor(e,t,o){de(this,"poly");de(this,"isExterior");de(this,"segments");de(this,"bbox");if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=o,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const u=bu.snap({x:new kc(e[0][0]),y:new kc(e[0][1])});this.bbox={ll:{x:u.x,y:u.y},ur:{x:u.x,y:u.y}};let p=u;for(let y=1,T=e.length;y<T;y++){if(typeof e[y][0]!="number"||typeof e[y][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=bu.snap({x:new kc(e[y][0]),y:new kc(e[y][1])});s.x.eq(p.x)&&s.y.eq(p.y)||(this.segments.push(y1.fromRing(p,s,this)),s.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.x),s.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.y),s.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.x),s.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.y),p=s)}(!u.x.eq(p.x)||!u.y.eq(p.y))&&this.segments.push(y1.fromRing(p,u,this))}getSweepEvents(){const e=[];for(let t=0,o=this.segments.length;t<o;t++){const u=this.segments[t];e.push(u.leftSE),e.push(u.rightSE)}return e}},SW=class{constructor(e,t){de(this,"multiPoly");de(this,"exteriorRing");de(this,"interiorRings");de(this,"bbox");if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new gz(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let o=1,u=e.length;o<u;o++){const p=new gz(e[o],this,!1);p.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=p.bbox.ll.x),p.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=p.bbox.ll.y),p.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=p.bbox.ur.y),this.interiorRings.push(p)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,o=this.interiorRings.length;t<o;t++){const u=this.interiorRings[t].getSweepEvents();for(let p=0,y=u.length;p<y;p++)e.push(u[p])}return e}},_z=class{constructor(e,t){de(this,"isSubject");de(this,"polys");de(this,"bbox");if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new kc(Number.POSITIVE_INFINITY),y:new kc(Number.POSITIVE_INFINITY)},ur:{x:new kc(Number.NEGATIVE_INFINITY),y:new kc(Number.NEGATIVE_INFINITY)}};for(let o=0,u=e.length;o<u;o++){const p=new SW(e[o],this);p.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=p.bbox.ll.x),p.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=p.bbox.ll.y),p.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=p.bbox.ur.x),p.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=p.bbox.ur.y),this.polys.push(p)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,o=this.polys.length;t<o;t++){const u=this.polys[t].getSweepEvents();for(let p=0,y=u.length;p<y;p++)e.push(u[p])}return e}},CW=(e,...t)=>HS.run("union",e,t);bu.set;function IW(e,t={}){const o=[];if(BL(e,p=>{o.push(p.coordinates)}
2819),o.length<2)throw new Error("Must have at least 2 geometries");const u=CW(o[0],...o.slice(1));return u.length===0?null:u.length===1?MZ(u[0],t.properties):kZ(u,t.properties)}function AW(e,t,{padding:o=20,maxZoom:u=13}={}){if(!e)return;const p=MW(az(t));PW(e,p,{padding:o,maxZoom:u})}function PW(e,t,{padding:o=20,maxZoom:u=13}={}){e.fitBounds(new hS.LngLatBounds([t[0],t[1]],[t[2],t[3]]),{padding:o,maxZoom:u})}function MW(e,t=.001){const o=e[2]-e[0],u=e[3]-e[1];if(o<t||u<t){const p=[e[0]+o/2,e[1]+u/2];return[p[0]-t/2,p[1]-t/2,p[0]+t/2,p[1]+t/2]}return e}function yz(e){const t=mt.useRef(),[o,u]=mt.useState({});return mt.useEffect(()=>{const p=e();t.current=p,u(p.getState()),p.subscribe(()=>{u(p.getState())})},[]),[t.current,o]}const kW=1e3;function RW(e){const t=az(e),o=NL([t[0],t[1]]),u=NL([t[2],t[3]]);return sW(o,u)*kW}class vz{constructor(t){de(this,"geoDoc");de(this,"notifyStateChange");this.geoDoc=t??{type:"FeatureCollection",features:[]}}static verifyFeatureTypes(t){const o=["parcel","drawing","marker"],u=t.features.filter(p=>{var T;const y=(T=p.properties)==null?void 0:T.type;return!y||!o.includes(y)});if(u.length>0)throw new Error(`GeoDoc contains ${u.length} feature(s) with invalid or missing type properties. Valid types are: ${o.join(", ")}`);return t}getGeoDoc(){return this.geoDoc}setGeoDoc(t){var o;this.geoDoc=t,(o=this.notifyStateChange)==null||o.call(this)}isEmpty(){return!this.geoDoc||this.geoDoc.features.length===0}getDrawings(){return this.geoDoc?this.geoDoc.features.filter(t=>{var o,u;return((o=t.properties)==null?void 0:o.type)==="drawing"||((u=t.properties)==null?void 0:u.type)==="marker"}):[]}getParcels(){return this.geoDoc?this.geoDoc.features.filter(t=>{var o;return((o=t.properties)==null?void 0:o.type)==="parcel"}):[]}getParcelIds(){return this.getParcels().map(t=>{var o;return(o=t.properties)==null?void 0:o.id}).filter(t=>t!=null)}getAllPolygons(){return this.geoDoc?this.geoDoc.features.filter(t=>t.geometry.type==="Polygon"||t.geometry.type==="MultiPolygon"):[]}calculateArea(){const t=this.getAllPolygons();if(t.length===0)return 0;if(t.length===1)return d1(t[0]);const u=IW({type:"FeatureCollection",features:t});return u?d1(u):0}calculateDistance(){return!this.geoDoc||this.geoDoc.features.length===0?0:RW(this.geoDoc)}addParcel(t){var p;const o=(p=t.properties)==null?void 0:p.id;if(o&&this.hasParcel(o))return!1;const u=this.getParcels();return this.updateParcels([...u,t]),!0}updateOffers(t){const o=this.getParcels();this.combineOffersAndParcels(t,o)}setDrawings(t){const o=t.features.map(u=>{const p={polygon:"drawing",point:"marker"}[u.geometry.type.toLowerCase()];if(!p)throw new Error(`Invalid drawing geometry type: ${u.geometry.type}`);return{...u,properties:{...u.properties,type:p}}});this.updateOffers(o)}updateParcels(t){const o=this.getDrawings();this.combineOffersAndParcels(o,t)}combineOffersAndParcels(t,o){const u=[...t,...o];this.setGeoDoc({type:"FeatureCollection",features:u})}hasParcels(){return this.getParcels().length>0}getParcelGroup(){const t=this.getParcels(),o={};return t.forEach(u=>{const{cadastralDistrictName:p,parcelBlock:y}=u.properties;!p||!y||(o[p]||(o[p]={}),o[p][y]||(o[p][y]=[]),o[p][y].push(u.properties))}),o}hasParcel(t){return this.getParcels().some(u=>{var p;return((p=u.properties)==null?void 0:p.id)===t})}removeParcel(t){const u=this.getParcels().filter(p=>{var y;return((y=p.properties)==null?void 0:y.id)!==t});this.updateParcels(u)}subscribe(t){this.notifyStateChange=t}getState(){const t=this.calculateArea(),o=this.calculateDistance();return{geoDoc:this.geoDoc,area:t,distance:o,parcelGroup:this.getParcelGroup(),parcelIds:this.getParcelIds()}}}function qS(e){if(typeof window>"u")return;const t=window.dataLayer;Array.isArray(t)&&t.push(e)}function LW(e,t){var T,s;const o=e.geometry.type.toLowerCase(),u=(T=e.properties)==null?void 0:T.type,p=u==="parcel"||u==="marker"||u==="drawing"?u:o==="point"||o==="multipoint"?"marker":"drawing",y=String(e.id??((s=e.properties)==null?void 0:s.id)??`feat-${t}`);return{...e,properties:{...typeof e.properties=="object"&&e.properties?e.properties:{},type:p,id:y}}}function xz(e){if(e==null)return null;if(e.type==="FeatureCollection")return{type:"FeatureCollection",features:e.features.map((o,u)=>LW(o,u))};const t=e;return t.type==="Polygon"||t.type==="MultiPolygon"?{type:"FeatureCollection",features:[{type:"Feature",geometry:t,properties:{type:"drawing",id:"legacy-geom"}}]}:t.type==="Point"||t.type==="MultiPoint"?{type:"FeatureCollection",features:[{type:"Feature",geometry:t,properties:{type:"marker",id:"legacy-geom"}}]}:null}function zW({mapContainerRef:e,geoDocFieldPath:t,geomFieldPath:o,setValue:u,getValues:p,showControls:y,defaultDrawMode:T}){const s=mt.useRef(!1),[M,L]=mt.useState(!1),[B,H]=mt.useState(!1),$=mt.useRef(new Set),[te,xe]=mt.useState(null),[pe,{geoDoc:Ne,area:_e=0,distance:ie=0,parcelGroup:ke,parcelIds:ot}]=yz(()=>
2819new vz),[et,{showsParcels:wt=!1,parcelZoomReached:It=!1,parcelSourceLoading:K=!1,isInitialized:ve=!1,drawMode:Ae=T}]=yz(()=>new nW({container:e.current,showControls:y,defaultDrawMode:T}));mt.useEffect(()=>{if(!pe||!et)return;const Fe=()=>{L(!0),pe.setDrawings(et.draw.getAll())},Je=He=>{Fe();for(const tt of He.features){const Oe=tt.geometry.type;Oe==="Point"?qS({event:"map_draw_point"}):(Oe==="Polygon"||Oe==="MultiPolygon")&&qS({event:"map_draw_polygon"})}};et.on("draw.create",Je),et.on("draw.update",Fe),et.on("draw.delete",Fe);const ze=()=>{const He=et.draw.getSelected();xe(He!=null&&He.features.length?He:null)};return et.on("draw.selectionchange",ze),()=>{et.off("draw.create",Je),et.off("draw.update",Fe),et.off("draw.delete",Fe),et.off("draw.selectionchange",ze)}},[pe,et]),mt.useEffect(()=>{ve&&pe&&(et==null||et.setSelectedParcels(pe.getParcels()))},[ve,ot,et,pe]),mt.useEffect(()=>{M&&u(t,Ne,{shouldValidate:!0,shouldDirty:!0})},[Ne,M,t,u]),mt.useEffect(()=>{var tt,Oe;if(!pe||!et||s.current)return;const Fe=p(t),Je=p(o);let ze=null;if(Fe&&((tt=Fe.features)!=null&&tt.length))try{ze=vz.verifyFeatureTypes(Fe)}catch{ze=xz(Fe)}else Je&&(ze=xz(Je));if(!((Oe=ze==null?void 0:ze.features)!=null&&Oe.length)){s.current=!0;return}s.current=!0,AW(et,ze),pe.setGeoDoc(ze),et.draw.add({type:"FeatureCollection",features:pe.getDrawings()});const He=()=>{et.isStyleLoaded()&&et.setSelectedParcels(pe.getParcels())};return et.once("idle",He),()=>{et.off("idle",He)}},[pe,et]),mt.useEffect(()=>{if(!et||!pe)return;const Fe=async Je=>{if(Ae!==V_)return;const ze=et.queryRenderedFeatures(Je.point,{layers:[`${ws}_fill`,`${ws}_outline`]});if(!(ze!=null&&ze.length))return;let He=ze[0];if(ze.length>1){let rt=d1(He);for(const Nt of ze.slice(1)){const jt=d1(Nt);jt<rt&&(He=Nt,rt=jt)}}const Oe=He.properties.id;if(pe.hasParcel(Oe)){L(!0),pe.removeParcel(Oe);return}if(!$.current.has(Oe)){$.current.add(Oe),H(!0);try{const rt=window.CONFIG_API??window.location.origin,Nt=await fetch(`${rt}/api/ogc/collections/parcels/items/${Oe}`);if(!Nt.ok){console.error(`Failed to fetch parcel ${Oe}: ${Nt.status}`);return}const jt=await Nt.json();pe.addParcel({type:"Feature",geometry:jt.geometry,properties:{type:"parcel",...jt.properties,id:Oe}})&&(L(!0),qS({event:"map_select_parcel"}))}catch(rt){console.error(`Failed to fetch parcel geometry for ${Oe}`,rt)}finally{$.current.delete(Oe),H($.current.size>0)}}};return et.onClickOrTap(Fe)},[et,Ae,pe]);const Ye=mt.useCallback(()=>{if(!(et!=null&&et.draw)||!pe)return;const Fe=et.draw.getSelected();Fe.features.length>0&&(Fe.features.forEach(Je=>{et.draw.delete(Je.id)}),pe.setDrawings(et.draw.getAll()),xe(null),L(!0))},[et,pe]),Be=iW({isInitialized:ve,parcelZoomReached:It,parcelSourceLoading:K,showsParcels:wt});return{manager:pe,map:et,geoDoc:Ne,areaM2:_e,distanceM:ie,parcelGroup:ke,parcelIds:ot,parcelLoading:B,parcelPickState:Be,isInitialized:ve,drawMode:Ae,selectedFeatures:te,mapIsDirty:M,setMapIsDirty:L,deleteSelectedDrawings:Ye}}const DW="ha",bz="m2",v1=1e4;function OW(e){return(e/v1).toFixed(2)}function FW(e){return typeof e=="string"?parseFloat(e)*v1:e*v1}function ZS({currentStep:e}){const t=["Fläche und/oder Ökopunkte einzeichnen","Kontaktdaten erfassen","Zusätzliche Angaben"];return Ve.jsxs("div",{className:"mb-8 space-y-4",children:[Ve.jsxs("p",{className:"text-sm font-semibold uppercase tracking-[0.2em] text-primary",children:["Schritt ",e," von 3"]}),Ve.jsx("ul",{className:"steps w-full gap-3 text-sm font-medium","aria-label":"onboarding-stepper",children:t.map((o,u)=>{const p=u+1;return Ve.jsx("li",{"data-content":p,className:`step ${p<=e?"step-primary":""}`,"aria-current":p===e?"step":void 0,children:o},o)})})]})}hS.accessToken="pk.eyJ1IjoiZ3JlZW5hY2NvdW50IiwiYSI6ImNtMDZ0aG5qOTBwaWUyaXNiN2dqOHc2bnkifQ.uOs7BSk4kQZ7iA6ebq5GmA";const NW=100;function BW(){const e=$E(),{setValue:t,register:o,formState:u,getFieldState:p,getValues:y,watch:T,control:s}=XR(),M=mt.useRef(null),[L,B]=mt.useState(!1),[H,$]=mt.useState(!1);vq({name:"offers.0.geoDoc",control:s});const{errors:te,dirtyFields:xe}=u,{manager:pe,map:Ne,geoDoc:_e,areaM2:ie,distanceM:ke,parcelGroup:ot,parcelLoading:et,parcelPickState:wt,drawMode:It,selectedFeatures:K,mapIsDirty:ve,deleteSelectedDrawings:Ae}=zW({mapContainerRef:M,geoDocFieldPath:"offers.0.geoDoc",geomFieldPath:"offers.0.geom",setValue:t,getValues:y,defaultDrawMode:V_});mt.useEffect(()=>{var rt;(rt=_e==null?void 0:_e.features)!=null&&rt.length&&B(!0)},[_e]),mt.useEffect(()=>{if(!_e||!pe)return;const rt=pe.getAllPolygons().length>0,Nt=y("offers.0.area"),jt=Nt===""||Nt==null,gr=p("offers.0.area").isDirty;(!gr||jt)&&rt&&ie&&ie>0&&(t("offers.0.area",OW(ie),{shouldValidate:!0,shouldDirty:!1}),$(!1)),ve&&!rt&&!gr&&Nt&&t("offers.0.area","",{shouldValidate:!0,shouldDirty:!1})},[ie,_e,ve,pe]);const Ye=mt.useCallback(()=>{Ne!=null&&Ne.draw&&Ae()},[Ne,Ae]),Be=mt.useCallback(rt=>{rt.preventDefault();const Nt=y();e("/kontakt",{preventScrollReset:!0,state:{formData:Nt}}),window.scrollTo({top:0}),window.dataLayer.push({event:"offer_form_submit_step1"})},[e,y]),Fe=rt=>{const Nt=parseFloat(rt.target.value);$(Number.isFinite(Nt)&&Nt>NW)},Je=rt=>{rt&&rt.geometry&&(window.dataLayer.push({event:"map_search_location"}),B(!0),Ne==null||Ne.flyTo({center:rt.geometry.coordinates,zoom:13,essential:!0}))},ze=T("offers.0.area"),He=ze&&parseFloat(String(ze))>0,tt=[(ke??0)>1e3*10&&`Die Flächen sind sehr weit verteilt (~${(ke/1e3).toFixed()}km). Besser separat eintragen.`,p("offers.0.geoDoc").error&&"Die Flächenangabe ist ungültig."||p("offers.0").error&&!p("offers.0.area").error&&"Leider ist ein Fehler mit den angegebenen Daten aufgetreten."].filter(
2819Boolean),Oe=mt.useCallback(rt=>pe==null?void 0:pe.removeParcel(rt),[pe]);return Ve.jsxs(Ve.Fragment,{children:[Ve.jsx(ZS,{currentStep:1}),Ve.jsx("div",{className:"hero bg-base-200 mb-4",children:Ve.jsx("div",{className:"hero-content text-center",children:Ve.jsxs("div",{className:"w-full max-w-4xl py-6 md:py-3",children:[Ve.jsx("h2",{className:"text-xl font-bold",children:"Standort & Größe Ihrer Fläche"}),Ve.jsx("p",{className:"py-4 font-normal",children:"Die genaue Lage und Größe der Fläche sind die Basis für eine fundierte Standortanalyse."})]})})}),Ve.jsxs("div",{id:"offers-picker",className:"relative mt-4 md:mt-6",children:[Ve.jsx("div",{className:"absolute inset-0 z-10 -mx-8 pointer-events-none",children:Ve.jsx("div",{className:`py-6 px-[6vw] transition-transform ease-out duration-1000 ${L?"translate-y-0":"translate-y-[16vh]"}`,children:Ve.jsx("div",{className:"pointer-events-auto max-w-[480px] mx-auto drop-shadow-2xl",children:Ve.jsx(tZ,{onSelect:Je})})})}),Ve.jsxs("div",{className:"relative pointer-events-none -mx-8",children:[Ve.jsx("div",{ref:M,className:"h-[80vh] min-h-80 max-h-144 pointer-events-auto"}),ot&&!!Object.keys(ot).length&&Ve.jsx(iZ,{parcelGroup:ot,onRemoveParcel:Oe}),Ve.jsx("div",{className:`flex absolute bottom-10 left-0 right-0 justify-center gap-4 px-2 z-10 transition-opacity duration-1000 ${L?"opacity-100":"opacity-0"}`,children:Ve.jsx(oW,{className:"radius-leaf",drawMode:It,parcelPickState:wt,hasSelection:K!==null,onChangeDrawMode:rt=>Ne==null?void 0:Ne.changeDrawMode(rt),onDelete:Ye,onZoomIn:()=>Ne==null?void 0:Ne.zoomIn(),onZoomOut:()=>Ne==null?void 0:Ne.zoomOut()})})]}),Ve.jsxs("div",{className:`transition-opacity duration-1000 ${L?"opacity-100":"opacity-0"}`,children:[tt.length>0&&Ve.jsx("div",{className:"flex flex-col gap-2 py-4",children:tt.map((rt,Nt)=>Ve.jsx(_L,{type:"alert-error",show:!0,children:rt},Nt))}),Ve.jsx("div",{className:`overflow-hidden transition-all duration-500 ease-out ${It==="draw_polygon"?"opacity-100 max-h-40 scale-100":"opacity-0 max-h-0 scale-95"}`,children:Ve.jsxs("div",{className:"flex justify-center gap-2 py-4",children:[Ve.jsxs("div",{className:"text-sm text-gray-500",children:[Ve.jsx("strong",{children:"So funktioniert es:"}),Ve.jsxs("ol",{className:"list-disc ml-5",children:[Ve.jsx("li",{children:"Klicken Sie die Ecken Ihrer Fläche an oder"}),Ve.jsx("li",{children:"Schließen Sie den Umriss mit einem Klick auf den Startpunkt"}),Ve.jsx("li",{children:"Mehrere Flächen? Einfach nacheinander einzeichnen"})]})]}),Ve.jsx("img",{className:"w-32 h-16",src:"https://4f7e7ac7.fluvius-2n3.pages.dev/polygon-drawing.gif"})]})}),Ve.jsx("div",{className:"form-control w-full max-w-lg mx-auto my-4",children:Ve.jsxs("label",{htmlFor:"offer-area",className:"w-full",children:[Ve.jsx("span",{className:"label-text",children:"Fläche (in Hektar)"}),Ve.jsx("input",{type:"number",id:"offer-area",disabled:y("offers.0.geoDoc")===void 0||y("offers.0.geoDoc")===null,className:`input input-bordered w-full placeholder:text-sm ${p("offers.0.area").error?"input-error":""}`,"data-testid":"offer-area-input",step:"0.01",min:"0",...o("offers.0.area",{onChange:Fe})}),H&&Ve.jsxs("div",{className:"py-2 text-xs",children:[Ve.jsx("span",{className:"flex-1 text-error",children:"Versehentlich Quadratmeter statt Hektar eingegeben?"}),Ve.jsx("button",{type:"button","aria-label":"Hinweis schließen",className:"shrink-0 ml-1 text-gray-400 hover:text-gray-600",onClick:()=>$(!1),children:"✕"})]})]})})]}),Ve.jsx("div",{className:"form-control my-12 w-full max-w-lg mx-auto mb-4",children:Ve.jsxs("button",{className:"btn btn-primary w-full radius-leaf","data-testid":"onboarding-area-next-button",onClick:Be,disabled:et||tt.length>0||!!p("offers.0").error||!T("offers.0.geoDoc")||!He||Object.keys(xe).length===0,children:[et&&Ve.jsx("span",{className:"loading loading-spinner loading-sm"}),"Weiter zum zweiten Schritt"]})})]})]})}const WS="tag",VW=[{value:"arable",label:"Acker"},{value:"forrest",label:"Wald"},{value:"grassland",label:"Grünland"},{value:"other",label:"Sonstiges"}],UW=["arable","forrest","grassland","other"],jW=[{value:"forest_conversion",label:"Waldumbau"},{value:"forest_new",label:"Erstaufforstung"},{value:"grassland_extensification",label:"Grünlandextensivierung"},{value:"water_restoration",label:"Gewässerrenaturierung"},{value:"meadow_orchard",label:"Streuobstwiese"},{value:"hedges",label:"Hecken"},{value:"peatland_restoration",label:"Moorrenaturierung"},{value:"forest_compensation",label:"Ersatzaufforstung"},{value:"other",label:"Sonstiges"}],GW=["forest_conversion","forest_new","grassland_extensification","water_restoration","meadow_orchard","hedges","peatland_restoration","forest_compensation","other"],$W=[{value:"unapproved",label:"Nicht genehmigt"},{value:"approved",label:"Genehmigt"},{value:"implemented",label:"Genehmigt und umgesetzt"}],HW=["ecopoints","forest_compensation","biotope","species_protection"],qW=["soil_natural_functions","soil_archive_function","biotopes_open_land","biotopes_woody_plants","biotopes_forest","biotopes_flowing_water","biotopes_standing_water","landscape","biotope_value_compensation","forestry_requirements","climate_air"],ZW={"01":"SH","02":"HH","03":"NI","04":"HB","05":"NW","06":"HE","07":"RP","08":"BW","09":"BY",10:"SL",11:"BE",12:"BB",13:"MV",14:"SN",15:"ST",16:"TH"};new Map(Object.entries(ZW).map(([e,t])=>[t,e]));
2819const WW=["eur_ecopoints","eur_m2","eur_ha"],XW=["purchase","sale","deal_accepted","deal_rejected"],YW=["state_forestry","land_agency","authority","developer_company","private_owner","broker_market"];function KW({source:e}){var T,s,M,L,B,H,$,te,xe,pe,Ne,_e,ie,ke,ot,et,wt,It,K,ve,Ae,Ye,Be,Fe,Je;const{register:t,clearErrors:o,formState:{errors:u,isValid:p,isSubmitting:y}}=XR();return Ve.jsxs(Ve.Fragment,{children:[Ve.jsx(ZS,{currentStep:2}),Ve.jsxs("div",{className:"mx-auto max-w-3xl space-y-10",children:[Ve.jsx("div",{className:"hero mb-4",children:Ve.jsx("div",{className:"hero-content text-center",children:Ve.jsxs("div",{className:"w-full max-w-5xl py-4",children:[Ve.jsx("h2",{className:"text-xl font-bold",children:"Ihre Kontaktdaten"}),Ve.jsx("p",{className:"py-6 font-normal",children:"Ihre Kontaktdaten helfen uns, bei Rückfragen schnell auf Sie zuzukommen."})]})})}),Ve.jsxs("div",{className:"space-y-8",children:[Ve.jsxs("div",{className:"grid gap-6 md:grid-cols-12",children:[Ve.jsxs("div",{className:"form-control md:col-span-2",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text",children:"Anrede*"})}),Ve.jsxs("select",{className:`select select-bordered w-full ${(T=u.user)!=null&&T.salutation?"select-error":""}`,...t("user.salutation"),"data-testid":"salutation-select",children:[Ve.jsx("option",{value:""}),Ve.jsx("option",{value:"female",children:"Frau"}),Ve.jsx("option",{value:"male",children:"Herr"})]}),((s=u.user)==null?void 0:s.salutation)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(M=u.user)==null?void 0:M.salutation.message})})]}),Ve.jsxs("div",{className:"form-control md:col-span-4",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text",children:"Vorname"})}),Ve.jsx("input",{type:"text",className:`input input-bordered w-full ${(L=u.user)!=null&&L.givenName?"input-error":""}`,...t("user.givenName")}),((B=u.user)==null?void 0:B.givenName)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(H=u.user)==null?void 0:H.givenName.message})})]}),Ve.jsxs("div",{className:"form-control md:col-span-6",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text",children:"Nachname*"})}),Ve.jsx("input",{type:"text",className:`input input-bordered w-full ${($=u.user)!=null&&$.familyName?"input-error":""}`,...t("user.familyName"),"data-testid":"family-name-input"}),((te=u.user)==null?void 0:te.familyName)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(xe=u.user)==null?void 0:xe.familyName.message})})]})]}),Ve.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[Ve.jsxs("div",{className:"form-control",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text",children:"E-Mail-Adresse*"})}),Ve.jsx("input",{type:"email",className:`input input-bordered w-full ${(pe=u.user)!=null&&pe.email?"input-error":""}`,...t("user.email",{onChange:()=>o("root.submitFailure")}),"data-testid":"onboarding-email-input"}),((Ne=u.user)==null?void 0:Ne.email)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(_e=u.user)==null?void 0:_e.email.message})})]}),Ve.jsxs("div",{className:"form-control",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text",children:"Handynummer* (um Sie schneller zu erreichen)"})}),Ve.jsx("input",{type:"tel",className:`input input-bordered w-full ${(ie=u.user)!=null&&ie.mobile?"input-error":""}`,...t("user.mobile"),"data-testid":"onboarding-phone-input"}),((ke=u.user)==null?void 0:ke.mobile)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(ot=u.user)==null?void 0:ot.mobile.message})})]})]}),Ve.jsxs("div",{className:"form-control mb-3",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text",children:"Handelt es sich um Ihr eigenes Grundstück?*"})}),Ve.jsxs("select",{className:`select select-bordered w-full ${(wt=(et=u.offers)==null?void 0:et[0])!=null&&wt.ownership?"select-error":""}`,...t("offers.0.ownership"),"data-testid":"ownership-select",children:[Ve.jsx("option",{value:""}),Ve.jsx("option",{value:"owner",children:"Ja"}),Ve.jsx("option",{value:"not_owner",children:"Nein"})]}),((K=(It=u.offers)==null?void 0:It[0])==null?void 0:K.ownership)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(Ae=(ve=u.offers)==null?void 0:ve[0])==null?void 0:Ae.ownership.message})})]})]}),e!==WS&&Ve.jsxs("div",{className:"space-y-1",children:[Ve.jsxs("div",{className:"form-control",children:[Ve.jsxs("label",{className:"label cursor-pointer flex justify-start gap-2",children:[Ve.jsx("input",{type:"checkbox",className:`checkbox ${(Ye=u.user)!=null&&Ye.tosConsent?"checkbox-error":""}`,...t("user.tosConsent"),"data-testid":"agb-consent-checkbox"}),Ve.jsxs("span",{children:["Ich stimme den"," ",Ve.jsx("a",{href:"/rechtliches/agb",target:"_blank",className:"link link-primary",children:"AGB"})," ","zu.*"]})]}),((Be=u.user)==null?void 0:Be.tosConsent)&&Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text-alt text-error",children:(Fe=u.user)==null?void 0:Fe.tosConsent.message})})]}),Ve.jsxs("div",{className:"form-control",children:[Ve.jsxs("label",{className:"label cursor-pointer flex justify-start gap-2",children:[Ve.jsx("input",{type:"checkbox",className:"checkbox","data-testid":"agb-newsletter-checkbox",...t("user.newsletterConsent")}),Ve.jsx("span",{children:"Ich möchte den Newsletter sowie Neuigkeiten, Updates und Benachrichtigungen per E-Mail erhalten."})]}),Ve.jsx("input",{type:"hidden",value:`Ich möchte den Newsletter sowie Neuigkeiten, Updates und
2820                Benachrichtigungen per E-Mail erhalten.`,...t("user.newsletterConsentText")})]})]}),Ve.jsxs("p",{className:"mt-4",children:[Ve.jsx("strong",{children:"Wie funktioniert die Vermittlung?"}
2820)," Wir melden uns sobald es einen Interessenten gibt. Für sie entsteht in der Zwischenzeit kein Aufwand."]}),((Je=u.root)==null?void 0:Je.submitFailure)&&Ve.jsxs(_L,{show:!0,type:"alert-error",children:["Ein Fehler ist aufgetreten. Bitte nutzen Sie"," ",Ve.jsx("a",{href:"https://app.greenaccount.com/login/email",target:"_blank",rel:"noreferrer",className:"link link-primary",children:"app.greenaccount.com/login/email"}),", um eine Fläche anzulegen oder Ihre Daten zu verwalten."]}),Ve.jsx("div",{className:"flex justify-stretch py-2 w-full gap-4",children:Ve.jsx("button",{type:"submit",className:"btn btn-primary flex-1 radius-leaf",disabled:!p||y,"data-testid":"onboaring-berater-submit-button",children:y?"Einen Moment …":"Weiter zum dritten Schritt"})})]})]})}function JW(e,t){const o=mt.useRef(),u=mt.useRef(null),p=mt.useCallback(T=>{if(!o.current)return;(!T||T(u.current))&&(clearTimeout(o.current),o.current=void 0,u.current=null)},[]);return[mt.useCallback((...T)=>{o.current&&clearTimeout(o.current),u.current=T,o.current=setTimeout(()=>{e(...T),o.current=void 0,u.current=null},t)},[e,t]),p]}function QW(e,t){const[o]=JW(e,t);return o}function ec({children:e,label:t,wasSaved:o,info:u}){return Ve.jsxs("div",{className:"form-control",children:[Ve.jsx("label",{className:"label",children:Ve.jsx("span",{className:"label-text text-lg font-bold text-secondary",children:t})}),u&&Ve.jsx("p",{className:"text-gray-500 px-1 mb-2",children:u}),e,Ve.jsx("div",{className:`text-sm mt-1 text-right text-success transition-opacity duration-300 ${o?"opacity-100":"opacity-0"}`,children:"Feld gespeichert"})]})}function eX({source:e}){const{offerId:t}=cH(),[o,u]=mt.useState(!1),[p,y]=mt.useState(!1),[T,s]=mt.useState(""),M=QW(async(H,$)=>{if(t)try{const te=await fetch(`${window.CONFIG_API}/supply/offer/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${window.token}`},body:JSON.stringify({[H]:$})});te.ok?s(H):console.error("Failed to save field:",await te.text())}catch(te){console.error("Error saving field:",te)}},500),L=H=>{const{target:$}=H;let te;switch($.type){case"checkbox":te=$.checked;break;case"number":te=$.value===""?null:Number($.value);break;default:te=$.value}if($.name==="additionalPlotsArea"){const xe=typeof te=="number"?te:Number(te);te=Number.isFinite(xe)&&xe>=0?String(Math.round(FW(xe))):null}s(""),M($.name,te)},B=H=>{const{name:$}=H.target,te=Array.from(document.querySelectorAll(`input[name="${$}"]:checked`)).map(xe=>xe.value);s(""),M($,te)};return Ve.jsxs("div",{className:"max-w-lg mx-auto space-y-8",children:[Ve.jsx(ZS,{currentStep:3}),Ve.jsx("div",{className:"hero mb-4",children:Ve.jsx("div",{className:"hero-content text-center",children:Ve.jsxs("div",{className:"w-full max-w-5xl py-4",children:[Ve.jsx("h2",{className:"text-xl font-bold",children:"Angaben zu Ihrer Fläche"}),Ve.jsx("p",{className:"py-6 font-normal",children:"Genaue Angaben erhöhen die Chancen auf passende Anfragen."})]})})}),Ve.jsx(ec,{label:"Ausgangszustand der Fläche",wasSaved:T==="initialState",children:Ve.jsx("div",{className:"flex gap-4 flex-wrap",children:VW.map(({value:H,label:$})=>Ve.jsxs("label",{className:"label cursor-pointer justify-start flex-1 outline-solid outline-1 outline-primary rounded-lg p-4",children:[Ve.jsx("input",{type:"checkbox",className:"checkbox checkbox-primary mr-2","data-testid":`initial-state-${H}`,name:"initialState",value:H,onChange:B}),Ve.jsx("span",{className:"label-text",children:$})]},H))})}),Ve.jsx(ec,{label:"Beschreibung der Fläche",wasSaved:T==="description",children:Ve.jsx("textarea",{name:"description","data-testid":"description-textarea",className:"textarea textarea-bordered h-32",placeholder:"z.B. gut erschlossenes Flurstück am Waldrand",onChange:L})}),Ve.jsx(ec,{label:"Genehmigungsstatus",info:"Wurde Ihre Maßnahme bereits von der zuständigen Behörde (z. B. UNB – Untere Naturschutzbehörde) genehmigt?",wasSaved:T==="stage",children:Ve.jsx("div",{className:"flex flex-col gap-4",children:$W.map(({value:H,label:$})=>Ve.jsxs("label",{className:"label cursor-pointer justify-start flex-1 outline-solid outline-1 outline-primary rounded-lg p-4",children:[Ve.jsx("input",{type:"radio",className:"radio radio-primary mr-2",name:"stage",value:H,onChange:te=>{L(te),y(te.target.value==="approved"||te.target.value==="implemented")}}),Ve.jsx("span",{className:"label-text",children:$})]},H))})}),Ve.jsx(ec,{label:"Verfügbarkeit",wasSaved:T==="availability",children:Ve.jsxs("select",{name:"availability",className:"select select-bordered w-full",onCh
2820ange:L,children:[Ve.jsx("option",{value:"",children:"Bitte auswählen"}),Ve.jsx("option",{value:"2025-01-01",children:"Q1 2025"}),Ve.jsx("option",{value:"2025-04-01",children:"Q2 2025"}),Ve.jsx("option",{value:"2025-07-01",children:"Q3 2025"}),Ve.jsx("option",{value:"2025-10-01",children:"Q4 2025"}),Ve.jsx("option",{value:"2026-01-01",children:"Q1 2026"}),Ve.jsx("option",{value:"2026-04-01",children:"Q2 2026"}),Ve.jsx("option",{value:"2026-07-01",children:"Q3 2026"}),Ve.jsx("option",{value:"2026-10-01",children:"Q4 2026"}),Ve.jsx("option",{value:"2027-01-01",children:"2027"}),Ve.jsx("option",{value:"2028-01-01",children:"2028"}),Ve.jsx("option",{value:"2029-01-01",children:"2029"}),Ve.jsx("option",{value:"2030-01-01",children:"2030"})]})}),p&&Ve.jsxs(Ve.Fragment,{children:[Ve.jsx(ec,{label:"Ökopunkte vorhanden?",wasSaved:T==="hasEcopoints",children:Ve.jsxs("label",{className:"label cursor-pointer justify-start flex-1 outline-solid outline-1 outline-primary rounded-lg p-4",children:[Ve.jsx("input",{type:"checkbox",name:"hasEcopoints",className:"checkbox checkbox-primary mr-2",onChange:H=>{L(H),u(H.target.checked)}}),Ve.jsx("span",{className:"label-text",children:"Ja"})]})}),o&&Ve.jsxs(Ve.Fragment,{children:[Ve.jsx(ec,{label:"Noch verfügbare Ökopunkte",wasSaved:T==="ecopoints",info:"Bitte ganze Zahl ohne Komma eingeben.",children:Ve.jsx("input",{type:"number",step:"1",name:"ecopoints",placeholder:"Anzahl der Ökopunkte, falls schon bekannt","data-testid":"ecopoints-input",className:"input input-bordered w-full invalid:input-error",onChange:L})}),Ve.jsxs(ec,{label:"Preis pro Ökopunkt (Netto)",wasSaved:T==="price"||T==="isPricePrivate"||T==="priceNote",children:[Ve.jsxs("div",{className:"relative",children:[Ve.jsx("input",{type:"number",name:"price",placeholder:"Preis pro Ökopunkt",className:"input input-bordered w-full pr-12",step:"0.01",min:"0",onChange:L}),Ve.jsx("span",{className:"absolute right-4 top-1/2 -translate-y-1/2",children:"€"})]}),Ve.jsxs("label",{className:"label cursor-pointer justify-start flex-1 my-2",children:[Ve.jsx("input",{type:"checkbox",name:"isPricePrivate",className:"checkbox checkbox-sm mr-2",onChange:L}),Ve.jsx("span",{className:"label-text",children:"Preis verbergen"})]}),Ve.jsx("div",{className:"form-control w-full",children:Ve.jsx("input",{type:"text",name:"priceNote",placeholder:"Anmerkungen zum Preis",className:"input input-sm input-bordered w-full",onChange:L})})]}),Ve.jsx(ec,{label:"Ursprünglich erzeugte Ökopunkte",wasSaved:T==="initialEcopoints",info:"Bitte ganze Zahl ohne Komma eingeben.",children:Ve.jsx("input",{type:"number",step:"1",name:"initialEcopoints",placeholder:"Anzahl der ursprünglich erzeugten Ökopunkte",className:"input input-bordered w-full invalid:input-error",onChange:L})}),Ve.jsx(ec,{label:"Nach welchem Bewertungsverfahren?",wasSaved:T==="evaluationMethod",info:"Falls Sie das Bewertungsverfahren nicht kennen, geben Sie bitte einfach „Ich weiß nicht“ ein.",children:Ve.jsx("input",{type:"text",name:"evaluationMethod",placeholder:"z.B. BayKompV, Ökokonto, …",className:"input input-bordered w-full",onChange:L})})]})]}),Ve.jsx(ec,{label:"Art der Maßnahme",wasSaved:T==="measures",children:Ve.jsx("div",{className:"flex gap-4 flex-wrap",children:jW.map(({value:H,label:$})=>Ve.jsxs("label",{className:"label cursor-pointer justify-start flex-1 outline-solid outline-1 outline-primary rounded-lg p-4",children:[Ve.jsx("input",{type:"checkbox",className:"checkbox checkbox-primary mr-2",name:"measures",value:H,onChange:B}),Ve.jsx("span",{className:"label-text",children:$})]},H))})}),Ve.jsx(ec,{label:"Weitere Flächen auf Anfrage verfügbar?",info:"Bitte geben Sie an, wie viel Fläche Ihnen insgesamt zur Verfügung steht.",wasSaved:T==="additionalPlotsArea",children:Ve.jsxs("div",{className:"flex flex-row items-center",children:[Ve.jsx("label",{className:"flex-1 label cursor-pointer outline-solid outline-1 outline-primary rounded-lg p-0 gap-2",children:Ve.jsx("input",{type:"number",name:"additionalPlotsArea",placeholder:"z.B. 10",min:0,"data-testid":"additional-area-size-input",className:"input input-ghost w-full",onCh
vendor: 57,265 bytes, line 2820
2820ange:L})}),Ve.jsx("span",{className:"label-text ml-2",children:"ha"})]})}),Ve.jsx("div",{className:"text-center",children:Ve.jsx("a",{href:e===WS?"/tennet":"/",className:"btn btn-primary font-normal radius-leaf",children:"Eingabe speichern und zurück zur Startseite"})})]})}var En;(function(e){e.assertEqual=p=>p;function t(p){}e.assertIs=t;function o(p){throw new Error}e.assertNever=o,e.arrayToEnum=p=>{const y={};for(const T of p)y[T]=T;return y},e.getValidEnumValues=p=>{const y=e.objectKeys(p).filter(s=>typeof p[p[s]]!="number"),T={};for(const s of y)T[s]=p[s];return e.objectValues(T)},e.objectValues=p=>e.objectKeys(p).map(function(y){return p[y]}),e.objectKeys=typeof Object.keys=="function"?p=>Object.keys(p):p=>{const y=[];for(const T in p)Object.prototype.hasOwnProperty.call(p,T)&&y.push(T);return y},e.find=(p,y)=>{for(const T of p)if(y(T))return T},e.isInteger=typeof Number.isInteger=="function"?p=>Number.isInteger(p):p=>typeof p=="number"&&isFinite(p)&&Math.floor(p)===p;function u(p,y=" | "){return p.map(T=>typeof T=="string"?`'${T}'`:T).join(y)}e.joinValues=u,e.jsonStringifyReplacer=(p,y)=>typeof y=="bigint"?y.toString():y})(En||(En={}));var XS;(function(e){e.mergeShapes=(t,o)=>({...t,...o})})(XS||(XS={}));const Dr=En.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ch=e=>{switch(typeof e){case"undefined":return Dr.undefined;case"string":return Dr.string;case"number":return isNaN(e)?Dr.nan:Dr.number;case"boolean":return Dr.boolean;case"function":return Dr.function;case"bigint":return Dr.bigint;case"symbol":return Dr.symbol;case"object":return Array.isArray(e)?Dr.array:e===null?Dr.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Dr.promise:typeof Map<"u"&&e instanceof Map?Dr.map:typeof Set<"u"&&e instanceof Set?Dr.set:typeof Date<"u"&&e instanceof Date?Dr.date:Dr.object;default:return Dr.unknown}},yr=En.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),tX=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Qa extends Error{constructor(t){super(),this.issues=[],this.addIssue=u=>{this.issues=[...this.issues,u]},this.addIssues=(u=[])=>{this.issues=[...this.issues,...u]};const o=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,o):this.__proto__=o,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const o=t||function(y){return y.message},u={_errors:[]},p=y=>{for(const T of y.issues)if(T.code==="invalid_union")T.unionErrors.map(p);else if(T.code==="invalid_return_type")p(T.returnTypeError);else if(T.code==="invalid_arguments")p(T.argumentsError);else if(T.path.length===0)u._errors.push(o(T));else{let s=u,M=0;for(;M<T.path.length;){const L=T.path[M];M===T.path.length-1?(s[L]=s[L]||{_errors:[]},s[L]._errors.push(o(T))):s[L]=s[L]||{_errors:[]},s=s[L],M++}}};return p(this),u}static assert(t){if(!(t instanceof Qa))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,En.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=o=>o.message){const o={},u=[];for(const p of this.issues)p.path.length>0?(o[p.path[0]]=o[p.path[0]]||[],o[p.path[0]].push(t(p))):u.push(t(p));return{formErrors:u,fieldErrors:o}}get formErrors(){return this.flatten()}}Qa.create=e=>new Qa(e);const Zp=(e,t)=>{let o;switch(e.code){case yr.invalid_type:e.received===Dr.undefined?o="Required":o=`Expected ${e.expected}, received ${e.received}`;break;case yr.invalid_literal:o=`Invalid literal value, expected ${JSON.stringify(e.expected,En.jsonStringifyReplacer)}`;break;case yr.unrecognized_keys:o=`Unrecognized key(s) in object: ${En.joinValues(e.keys,", ")}`;break;case yr.invalid_union:o="Invalid input";break;case yr.invalid_union_discriminator:o=`Invalid discriminator value. Expected ${En.joinValues(e.options)}`;break;case yr.invalid_enum_value:o=`Invalid enum value. Expected ${En.joinValues(e.options)}, received '${e.received}'`;break;case yr.invalid_arguments:o="Invalid function arguments";break;case yr.invalid_return_type:o="Invalid function return type";break;case yr.invalid_date:o="Invalid date";break;case yr.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(o=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(o=`${o} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?o=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?o=`Invalid input: must end with "${e.validation.endsWith}"`:En.assertNever(e.validation):e.validation!=="regex"?o=`Invalid ${e.validation}`:o="Invalid";break;case yr.too_small:e.type==="array"?o=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?o=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?o=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?o=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:o="Invalid input";break;case yr.too_big:e.type==="array"?o=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?o=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?o=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?o=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?o=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:o="Invalid input";break;case yr.custom:o="Invalid input";break;case yr.invalid_intersection_types:o="Intersection results could not be merged";break;case yr.not_multiple_of:o=`Number must be a multiple of ${e.multipleOf}`;break;case yr.not_finite:o="Number must be finite";break;default:o=t.defaultError,En.assertNever(e)}return{message:o}};let wz=Zp;function rX(e){wz=e}function x1(){return wz}const b1=e=>{const{data:t,path:o,errorMaps:u,issueData:p}=e,y=[...o,...p.path||[]],T={...p,path:y};if(p.message!==void 0)return{...p,path:y,message:p.message};let s="";const M=u.filter(L=>!!L).slice().reverse();for(const L of M)s=L(T,{data:t,defaultError:s}).message;return{...p,path:y,message:s}},iX=[];function Lr(e,t){const o=x1(),u=b1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,o,o===Zp?void 0:Zp].filter(p=>!!p)});e.common.issues.push(u)}class Ns{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,o){const u=[];for(const p of o){if(p.status==="aborted")return Ii;p.status==="dirty"&&t.dirty(),u.push(p.value)}return{status:t.value,value:u}}static async mergeObjectAsync(t,o){const u=[];for(const p of o){const y=await p.key,T=await p.value;u.push({key:y,value:T})}return Ns.mergeObjectSync(t,u)}static mergeObjectSync(t,o){const u={};for(const p of o){const{key:y,value:T}=p;if(y.status==="aborted"||T.status==="aborted")return Ii;y.status==="dirty"&&t.dirty(),T.status==="dirty"&&t.dirty(),y.value!=="__proto__"&&(typeof T.value<"u"||p.alwaysSet)&&(u[y.value]=T.value)}return{status:t.value,value:u}}}const Ii=Object.freeze({status:"aborted"}),Wp=e=>({status:"dirty",value:e}),na=e=>({status:"valid",value:e}),YS=e=>e.status==="aborted",KS=e=>e.status==="dirty",$_=e=>e.status==="valid",H_=e=>typeof Promise<"u"&&e instanceof Promise;function w1(e,t,o,u){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Tz(e,t,o,u,p){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,o),o}typeof SuppressedError=="function"&&SuppressedError;var ii;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ii||(ii={}));var q_,Z_;class Lc{constructor(t,o,u,p){this._cachedPath=[],this.parent=t,this.data=o,this._path=u,this._key=p}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ez=(e,t)=>{if($_(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const o=new Qa(e.common.issues);return this._error=o,this._error}}};function Hi(e){if(!e)return{};const{errorMap:t,invalid_type_error:o,required_error:u,description:p}=e;if(t&&(o||u))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:p}:{errorMap:(T,s)=>{var M,L;const{message:B}=e;return T.code==="invalid_enum_value"?{message:B??s.defaultError}:typeof s.data>"u"?{message:(M=B??u)!==null&&M!==void 0?M:s.defaultError}:T.code!=="invalid_type"?{message:s.defaultError}:{message:(L=B??o)!==null&&L!==void 0?L:s.defaultError}},description:p}}class en{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Ch(t.data)}_getOrReturnCtx(t,o){return o||{common:t.parent.common,data:t.data,parsedType:Ch(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ns,ctx:{common:t.parent.common,data:t.data,parsedType:Ch(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const o=this._parse(t);if(H_(o))throw new Error("Synchronous parse encountered promise.");return o}_parseAsync(t){const o=this._parse(t);return Promise.resolve(o)}parse(t,o){const u=this.safeParse(t,o);if(u.success)return u.data;throw u.error}safeParse(t,o){var u;const p={common:{issues:[],async:(u=o==null?void 0:o.async)!==null&&u!==void 0?u:!1,contextualErrorMap:o==null?void 0:o.errorMap},path:(o==null?void 0:o.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ch(t)},y=this._parseSync({data:t,path:p.path,parent:p});return Ez(p,y)}async parseAsync(t,o){const u=await this.safeParseAsync(t,o);if(u.success)return u.data;throw u.error}async safeParseAsync(t,o){const u={common:{issues:[],contextualErrorMap:o==null?void 0:o.errorMap,async:!0},path:(o==null?void 0:o.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ch(t)},p=this._parse({data:t,path:u.path,parent:u}),y=await(H_(p)?p:Promise.resolve(p));return Ez(u,y)}refine(t,o){const u=p=>typeof o=="string"||typeof o>"u"?{message:o}:typeof o=="function"?o(p):o;return this._refinement((p,y)=>{const T=t(p),s=()=>y.addIssue({code:yr.custom,...u(p)});return typeof Promise<"u"&&T instanceof Promise?T.then(M=>M?!0:(s(),!1)):T?!0:(s(),!1)})}refinement(t,o){return this._refinement((u,p)=>t(u)?!0:(p.addIssue(typeof o=="function"?o(u,p):o),!1))}_refinement(t){return new ic({schema:this,typeName:wi.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Dc.create(this,this._def)}nullable(){return Mh.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rc.create(this,this._def)}promise(){return Jp.create(this,this._def)}or(t){return K_.create([this,t],this._def)}and(t){return J_.create(this,t,this._def)}transform(t){return new ic({...Hi(this._def),schema:this,typeName:wi.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const o=typeof t=="function"?t:()=>t;return new iy({...Hi(this._def),innerType:this,defaultValue:o,typeName:wi.ZodDefault})}brand(){return new eC({typeName:wi.ZodBranded,type:this,...Hi(this._def)})}catch(t){const o=typeof t=="function"?t:()=>t;return new ny({...Hi(this._def),innerType:this,catchValue:o,typeName:wi.ZodCatch})}describe(t){const o=this.constructor;return new o({...this._def,description:t})}pipe(t){return oy.create(this,t)}readonly(){return sy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nX=/^c[^\s-]{8,}$/i,oX=/^[0-9a-z]+$/,sX=/^[0-9A-HJKMNP-TV-Z]{26}$/,aX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,lX=/^[a-z0-9_-]{21}$/i,cX=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,uX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let JS;const dX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fX=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,pX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sz="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",mX=new RegExp(`^${Sz}$`);function Cz(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function gX(e){return new RegExp(`^${Cz(e)}$`)}function Iz(e){let t=`${Sz}T${Cz(e)}`;const o=[];return o.push(e.local?"Z?":"Z"),e.offset&&o.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${o.join("|")})`,new RegExp(`^${t}$`)}function _X(e,t){return!!((t==="v4"||!t)&&dX.test(e)||(t==="v6"||!t)&&fX.test(e))}class tc extends en{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Dr.string){const y=this._getOrReturnCtx(t);return Lr(y,{code:yr.invalid_type,expected:Dr.string,received:y.parsedType}),Ii}const u=new Ns;let p;for(const y of this._def.checks)if(y.kind==="min")t.data.length<y.value&&(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="max")t.data.length>y.value&&(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="length"){const T=t.data.length>y.value,s=t.data.length<y.value;(T||s)&&(p=this._getOrReturnCtx(t,p),T?Lr(p,{code:yr.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):s&&Lr(p,{code:yr.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),u.dirty())}else if(y.kind==="email")uX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"email",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="emoji")JS||(JS=new RegExp(hX,"u")),JS.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"emoji",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="uuid")aX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"uuid",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="nanoid")lX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"nanoid",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid")nX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"cuid",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid2")oX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"cuid2",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="ulid")sX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"ulid",code:yr.invalid_string,message:y.message}),u.dirty());else if(y.kind==="url")try{new URL(t.data)}catch{p=this._getOrReturnCtx(t,p),Lr(p,{validation:"url",code:yr.invalid_string,message:y.message}),u.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"regex",code:yr.invalid_string,message:y.message}),u.dirty())):y.kind==="trim"?t.data=t.data.trim():y.kind==="includes"?t.data.includes(y.value,y.position)||(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),u.dirty()):y.kind==="toLowerCase"?t.data=t.data.toLowerCase():y.kind==="toUpperCase"?t.data=t.data.toUpperCase():y.kind==="startsWith"?t.data.startsWith(y.value)||(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.invalid_string,validation:{startsWith:y.value},message:y.message}),u.dirty()):y.kind==="endsWith"?t.data.endsWith(y.value)||(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.invalid_string,validation:{endsWith:y.value},message:y.message}),u.dirty()):y.kind==="datetime"?Iz(y).test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.invalid_string,validation:"datetime",message:y.message}),u.dirty()):y.kind==="date"?mX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.invalid_string,validation:"date",message:y.message}),u.dirty()):y.kind==="time"?gX(y).test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.invalid_string,validation:"time",message:y.message}),u.dirty()):y.kind==="duration"?cX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"duration",code:yr.invalid_string,message:y.message}),u.dirty()):y.kind==="ip"?_X(t.data,y.version)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"ip",code:yr.invalid_string,message:y.message}),u.dirty()):y.kind==="base64"?pX.test(t.data)||(p=this._getOrReturnCtx(t,p),Lr(p,{validation:"base64",code:yr.invalid_string,message:y.message}),u.dirty()):En.assertNever(y);return{status:u.value,value:t.data}}_regex(t,o,u){return this.refinement(p=>t.test(p),{validation:o,code:yr.invalid_string,...ii.errToObj(u)})}_addCheck(t){return new tc({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ii.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ii.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ii.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ii.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ii.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ii.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ii.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ii.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ii.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ii.errToObj(t)})}datetime(t){var o,u;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(o=t==null?void 0:t.offset)!==null&&o!==void 0?o:!1,local:(u=t==null?void 0:t.local)!==null&&u!==void 0?u:!1,...ii.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ii.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ii.errToObj(t)})}regex(t,o){return this._addCheck({kind:"regex",regex:t,...ii.errToObj(o)})}includes(t,o){return this._addCheck({kind:"includes",value:t,position:o==null?void 0:o.position,...ii.errToObj(o==null?void 0:o.message)})}startsWith(t,o){return this._addCheck({kind:"startsWith",value:t,...ii.errToObj(o)})}endsWith(t,o){return this._addCheck({kind:"endsWith",value:t,...ii.errToObj(o)})}min(t,o){return this._addCheck({kind:"min",value:t,...ii.errToObj(o)})}max(t,o){return this._addCheck({kind:"max",value:t,...ii.errToObj(o)})}length(t,o){return this._addCheck({kind:"length",value:t,...ii.errToObj(o)})}nonempty(t){return this.min(1,ii.errToObj(t))}trim(){return new tc({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new tc({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new tc({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const o of this._def.checks)o.kind==="min"&&(t===null||o.value>t)&&(t=o.value);return t}get maxLength(){let t=null;for(const o of this._def.checks)o.kind==="max"&&(t===null||o.value<t)&&(t=o.value);return t}}tc.create=e=>{var t;return new tc({checks:[],typeName:wi.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Hi(e)})};function yX(e,t){const o=(e.toString().split(".")[1]||"").length,u=(t.toString().split(".")[1]||"").length,p=o>u?o:u,y=parseInt(e.toFixed(p).replace(".","")),T=parseInt(t.toFixed(p).replace(".",""));return y%T/Math.pow(10,p)}class Ih extends en{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Dr.number){const y=this._getOrReturnCtx(t);return Lr(y,{code:yr.invalid_type,expected:Dr.number,received:y.parsedType}),Ii}let u;const p=new Ns;for(const y of this._def.checks)y.kind==="int"?En.isInteger(t.data)||(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.invalid_type,expected:"integer",received:"float",message:y.message}),p.dirty()):y.kind==="min"?(y.inclusive?t.data<y.value:t.data<=y.value)&&(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),p.dirty()):y.kind==="max"?(y.inclusive?t.data>y.value:t.data>=y.value)&&(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),p.dirty()):y.kind==="multipleOf"?yX(t.data,y.value)!==0&&(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.not_multiple_of,multipleOf:y.value,message:y.message}),p.dirty()):y.kind==="finite"?Number.isFinite(t.data)||(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.not_finite,message:y.message}),p.dirty()):En.assertNever(y);return{status:p.value,value:t.data}}gte(t,o){return this.setLimit("min",t,!0,ii.toString(o))}gt(t,o){return this.setLimit("min",t,!1,ii.toString(o))}lte(t,o){return this.setLimit("max",t,!0,ii.toString(o))}lt(t,o){return this.setLimit("max",t,!1,ii.toString(o))}setLimit(t,o,u,p){return new Ih({...this._def,checks:[...this._def.checks,{kind:t,value:o,inclusive:u,message:ii.toString(p)}]})}_addCheck(t){return new Ih({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ii.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ii.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ii.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ii.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ii.toString(t)})}multipleOf(t,o){return this._addCheck({kind:"multipleOf",value:t,message:ii.toString(o)})}finite(t){return this._addCheck({kind:"finite",message:ii.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ii.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ii.toString(t)})}get minValue(){let t=null;for(const o of this._def.checks)o.kind==="min"&&(t===null||o.value>t)&&(t=o.value);return t}get maxValue(){let t=null;for(const o of this._def.checks)o.kind==="max"&&(t===null||o.value<t)&&(t=o.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&En.isInteger(t.value))}get isFinite(){let t=null,o=null;for(const u of this._def.checks){if(u.kind==="finite"||u.kind==="int"||u.kind==="multipleOf")return!0;u.kind==="min"?(o===null||u.value>o)&&(o=u.value):u.kind==="max"&&(t===null||u.value<t)&&(t=u.value)}return Number.isFinite(o)&&Number.isFinite(t)}}Ih.create=e=>new Ih({checks:[],typeName:wi.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Hi(e)});class Ah extends en{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Dr.bigint){const y=this._getOrReturnCtx(t);return Lr(y,{code:yr.invalid_type,expected:Dr.bigint,received:y.parsedType}),Ii}let u;const p=new Ns;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?t.data<y.value:t.data<=y.value)&&(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),p.dirty()):y.kind==="max"?(y.inclusive?t.data>y.value:t.data>=y.value)&&(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),p.dirty()):y.kind==="multipleOf"?t.data%y.value!==BigInt(0)&&(u=this._getOrReturnCtx(t,u),Lr(u,{code:yr.not_multiple_of,multipleOf:y.value,message:y.message}),p.dirty()):En.assertNever(y);return{status:p.value,value:t.data}}gte(t,o){return this.setLimit("min",t,!0,ii.toString(o))}gt(t,o){return this.setLimit("min",t,!1,ii.toString(o))}lte(t,o){return this.setLimit("max",t,!0,ii.toString(o))}lt(t,o){return this.setLimit("max",t,!1,ii.toString(o))}setLimit(t,o,u,p){return new Ah({...this._def,checks:[...this._def.checks,{kind:t,value:o,inclusive:u,message:ii.toString(p)}]})}_addCheck(t){return new Ah({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ii.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ii.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ii.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ii.toString(t)})}multipleOf(t,o){return this._addCheck({kind:"multipleOf",value:t,message:ii.toString(o)})}get minValue(){let t=null;for(const o of this._def.checks)o.kind==="min"&&(t===null||o.value>t)&&(t=o.value);return t}get maxValue(){let t=null;for(const o of this._def.checks)o.kind==="max"&&(t===null||o.value<t)&&(t=o.value);return t}}Ah.create=e=>{var t;return new Ah({checks:[],typeName:wi.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Hi(e)})};class W_ extends en{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Dr.boolean){const u=this._getOrReturnCtx(t);return Lr(u,{code:yr.invalid_type,expected:Dr.boolean,received:u.parsedType}),Ii}return na(t.data)}}W_.create=e=>new W_({typeName:wi.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Hi(e)});class Jd extends en{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Dr.date){const y=this._getOrReturnCtx(t);return Lr(y,{code:yr.invalid_type,expected:Dr.date,received:y.parsedType}),Ii}if(isNaN(t.data.getTime())){const y=this._getOrReturnCtx(t);return Lr(y,{code:yr.invalid_date}),Ii}const u=new Ns;let p;for(const y of this._def.checks)y.kind==="min"?t.data.getTime()<y.value&&(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),u.dirty()):y.kind==="max"?t.data.getTime()>y.value&&(p=this._getOrReturnCtx(t,p),Lr(p,{code:yr.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),u.dirty()):En.assertNever(y);return{status:u.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Jd({...this._def,checks:[...this._def.checks,t]})}min(t,o){return this._addCheck({kind:"min",value:t.getTime(),message:ii.toString(o)})}max(t,o){return this._addCheck({kind:"max",value:t.getTime(),message:ii.toString(o)})}get minDate(){let t=null;for(const o of this._def.checks)o.kind==="min"&&(t===null||o.value>t)&&(t=o.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const o of this._def.checks)o.kind==="max"&&(t===null||o.value<t)&&(t=o.value);return t!=null?new Date(t):null}}Jd.create=e=>new Jd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:wi.ZodDate,...Hi(e)});class T1 extends en{_parse(t){if(this._getType(t)!==Dr.symbol){const u=this._getOrReturnCtx(t);return Lr(u,{code:yr.invalid_type,expected:Dr.symbol,received:u.parsedType}),Ii}return na(t.data)}}T1.create=e=>new T1({typeName:wi.ZodSymbol,...Hi(e)});class X_ extends en{_parse(t){if(this._getType(t)!==Dr.undefined){const u=this._getOrReturnCtx(t);return Lr(u,{code:yr.invalid_type,expected:Dr.undefined,received:u.parsedType}),Ii}return na(t.data)}}X_.create=e=>new X_({typeName:wi.ZodUndefined,...Hi(e)});class Y_ extends en{_parse(t){if(this._getType(t)!==Dr.null){const u=this._getOrReturnCtx(t);return Lr(u,{code:yr.invalid_type,expected:Dr.null,received:u.parsedType}),Ii}return na(t.data)}}Y_.create=e=>new Y_({typeName:wi.ZodNull,...Hi(e)});class Xp extends en{constructor(){super(...arguments),this._any=!0}_parse(t){return na(t.data)}}Xp.create=e=>new Xp({typeName:wi.ZodAny,...Hi(e)});class Qd extends en{constructor(){super(...arguments),this._unknown=!0}_parse(t){return na(t.data)}}Qd.create=e=>new Qd({typeName:wi.ZodUnknown,...Hi(e)});class wu extends en{_parse(t){const o=this._getOrReturnCtx(t);return Lr(o,{code:yr.invalid_type,expected:Dr.never,received:o.parsedType}),Ii}}wu.create=e=>new wu({typeName:wi.ZodNever,...Hi(e)});class E1 extends en{_parse(t){if(this._getType(t)!==Dr.undefined){const u=this._getOrReturnCtx(t);return Lr(u,{code:yr.invalid_type,expected:Dr.void,received:u.parsedType}),Ii}return na(t.data)}}E1.create=e=>new E1({typeName:wi.ZodVoid,...Hi(e)});class rc extends en{_parse(t){const{ctx:o,status:u}=this._processInputParams(t),p=this._def;if(o.parsedType!==Dr.array)return Lr(o,{code:yr.invalid_type,expected:Dr.array,received:o.parsedType}),Ii;if(p.exactLength!==null){const T=o.data.length>p.exactLength.value,s=o.data.length<p.exactLength.value;(T||s)&&(Lr(o,{code:T?yr.too_big:yr.too_small,minimum:s?p.exactLength.value:void 0,maximum:T?p.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:p.exactLength.message}),u.dirty())}if(p.minLength!==null&&o.data.length<p.minLength.value&&(Lr(o,{code:yr.too_small,minimum:p.minLength.value,type:"array",inclusive:!0,exact:!1,message:p.minLength.message}),u.dirty()),p.maxLength!==null&&o.data.length>p.maxLength.value&&(Lr(o,{code:yr.too_big,maximum:p.maxLength.value,type:"array",inclusive:!0,exact:!1,message:p.maxLength.message}),u.dirty()),o.common.async)return Promise.all([...o.data].map((T,s)=>p.type._parseAsync(new Lc(o,T,o.path,s)))).then(T=>Ns.mergeArray(u,T));const y=[...o.data].map((T,s)=>p.type._parseSync(new Lc(o,T,o.path,s)));return Ns.mergeArray(u,y)}get element(){return this._def.type}min(t,o){return new rc({...this._def,minLength:{value:t,message:ii.toString(o)}})}max(t,o){return new rc({...this._def,maxLength:{value:t,message:ii.toString(o)}})}length(t,o){return new rc({...this._def,exactLength:{value:t,message:ii.toString(o)}})}nonempty(t){return this.min(1,t)}}rc.create=(e,t)=>new rc({type:e,minLength:null,maxLength:null,exactLength:null,typeName:wi.ZodArray,...Hi(t)});function Yp(e){if(e instanceof bo){const t={};for(const o in e.shape){const u=e.shape[o];t[o]=Dc.create(Yp(u))}return new bo({...e._def,shape:()=>t})}else return e instanceof rc?new rc({...e._def,type:Yp(e.element)}):e instanceof Dc?Dc.create(Yp(e.unwrap())):e instanceof Mh?Mh.create(Yp(e.unwrap())):e instanceof zc?zc.create(e.items.map(t=>Yp(t))):e}class bo extends en{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),o=En.objectKeys(t);return this._cached={shape:t,keys:o}}_parse(t){if(this._getType(t)!==Dr.object){const L=this._getOrReturnCtx(t);return Lr(L,{code:yr.invalid_type,expected:Dr.object,received:L.parsedType}),Ii}const{status:u,ctx:p}=this._processInputParams(t),{shape:y,keys:T}=this._getCached(),s=[];if(!(this._def.catchall instanceof wu&&this._def.unknownKeys==="strip"))for(const L in p.data)T.includes(L)||s.push(L);const M=[];for(const L of T){const B=y[L],H=p.data[L];M.push({key:{status:"valid",value:L},value:B._parse(new Lc(p,H,p.path,L)),alwaysSet:L in p.data})}if(this._def.catchall instanceof wu){const L=this._def.unknownKeys;if(L==="passthrough")for(const B of s)M.push({key:{status:"valid",value:B},value:{status:"valid",value:p.data[B]}});else if(L==="strict")s.length>0&&(Lr(p,{code:yr.unrecognized_keys,keys:s}),u.dirty());else if(L!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const L=this._def.catchall;for(const B of s){const H=p.data[B];M.push({key:{status:"valid",value:B},value:L._parse(new Lc(p,H,p.path,B)),alwaysSet:B in p.data})}}return p.common.async?Promise.resolve().then(async()=>{const L=[];for(const B of M){const H=await B.key,$=await B.value;L.push({key:H,value:$,alwaysSet:B.alwaysSet})}return L}).then(L=>Ns.mergeObjectSync(u,L)):Ns.mergeObjectSync(u,M)}get shape(){return this._def.shape()}strict(t){return ii.errToObj,new bo({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(o,u)=>{var p,y,T,s;const M=(T=(y=(p=this._def).errorMap)===null||y===void 0?void 0:y.call(p,o,u).message)!==null&&T!==void 0?T:u.defaultError;return o.code==="unrecognized_keys"?{message:(s=ii.errToObj(t).message)!==null&&s!==void 0?s:M}:{message:M}}}:{}})}strip(){return new bo({...this._def,unknownKeys:"strip"})}passthrough(){return new bo({...this._def,unknownKeys:"passthrough"})}extend(t){return new bo({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new bo({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:wi.ZodObject})}setKey(t,o){return this.augment({[t]:o})}catchall(t){return new bo({...this._def,catchall:t})}pick(t){const o={};return En.objectKeys(t).forEach(u=>{t[u]&&this.shape[u]&&(o[u]=this.shape[u])}),new bo({...this._def,shape:()=>o})}omit(t){const o={};return En.objectKeys(this.shape).forEach(u=>{t[u]||(o[u]=this.shape[u])}),new bo({...this._def,shape:()=>o})}deepPartial(){return Yp(this)}partial(t){const o={};return En.objectKeys(this.shape).forEach(u=>{const p=this.shape[u];t&&!t[u]?o[u]=p:o[u]=p.optional()}),new bo({...this._def,shape:()=>o})}required(t){const o={};return En.objectKeys(this.shape).forEach(u=>{if(t&&!t[u])o[u]=this.shape[u];else{let y=this.shape[u];for(;y instanceof Dc;)y=y._def.innerType;o[u]=y}}),new bo({...this._def,shape:()=>o})}keyof(){return Az(En.objectKeys(this.shape))}}bo.create=(e,t)=>new bo({shape:()=>e,unknownKeys:"strip",catchall:wu.create(),typeName:wi.ZodObject,...Hi(t)}),bo.strictCreate=(e,t)=>new bo({shape:()=>e,unknownKeys:"strict",catchall:wu.create(),typeName:wi.ZodObject,...Hi(t)}),bo.lazycreate=(e,t)=>new bo({shape:e,unknownKeys:"strip",catchall:wu.create(),typeName:wi.ZodObject,...Hi(t)});class K_ extends en{_parse(t){const{ctx:o}=this._processInputParams(t),u=this._def.options;function p(y){for(const s of y)if(s.result.status==="valid")return s.result;for(const s of y)if(s.result.status==="dirty")return o.common.issues.push(...s.ctx.common.issues),s.result;const T=y.map(s=>new Qa(s.ctx.common.issues));return Lr(o,{code:yr.invalid_union,unionErrors:T}),Ii}if(o.common.async)return Promise.all(u.map(async y=>{const T={...o,common:{...o.common,issues:[]},parent:null};return{result:await y._parseAsync({data:o.data,path:o.path,parent:T}),ctx:T}})).then(p);{let y;const T=[];for(const M of u){const L={...o,common:{...o.common,issues:[]},parent:null},B=M._parseSync({data:o.data,path:o.path,parent:L});if(B.status==="valid")return B;B.status==="dirty"&&!y&&(y={result:B,ctx:L}),L.common.issues.length&&T.push(L.common.issues)}if(y)return o.common.issues.push(...y.ctx.common.issues),y.result;const s=T.map(M=>new Qa(M));return Lr(o,{code:yr.invalid_union,unionErrors:s}),Ii}}get options(){return this._def.options}}K_.create=(e,t)=>new K_({options:e,typeName:wi.ZodUnion,...Hi(t)});const Tu=e=>e instanceof ey?Tu(e.schema):e instanceof ic?Tu(e.innerType()):e instanceof ty?[e.value]:e instanceof Ph?e.options:e instanceof ry?En.objectValues(e.enum):e instanceof iy?Tu(e._def.innerType):e instanceof X_?[void 0]:e instanceof Y_?[null]:e instanceof Dc?[void 0,...Tu(e.unwrap())]:e instanceof Mh?[null,...Tu(e.unwrap())]:e instanceof eC||e instanceof sy?Tu(e.unwrap()):e instanceof ny?Tu(e._def.innerType):[];class S1 extends en{_parse(t){const{ctx:o}=this._processInputParams(t);if(o.parsedType!==Dr.object)return Lr(o,{code:yr.invalid_type,expected:Dr.object,received:o.parsedType}),Ii;const u=this.discriminator,p=o.data[u],y=this.optionsMap.get(p);return y?o.common.async?y._parseAsync({data:o.data,path:o.path,parent:o}):y._parseSync({data:o.data,path:o.path,parent:o}):(Lr(o,{code:yr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[u]}),Ii)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,o,u){const p=new Map;for(const y of o){const T=Tu(y.shape[t]);if(!T.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of T){if(p.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);p.set(s,y)}}return new S1({typeName:wi.ZodDiscriminatedUnion,discriminator:t,options:o,optionsMap:p,...Hi(u)})}}function QS(e,t){const o=Ch(e),u=Ch(t);if(e===t)return{valid:!0,data:e};if(o===Dr.object&&u===Dr.object){const p=En.objectKeys(t),y=En.objectKeys(e).filter(s=>p.indexOf(s)!==-1),T={...e,...t};for(const s of y){const M=QS(e[s],t[s]);if(!M.valid)return{valid:!1};T[s]=M.data}return{valid:!0,data:T}}else if(o===Dr.array&&u===Dr.array){if(e.length!==t.length)return{valid:!1};const p=[];for(let y=0;y<e.length;y++){const T=e[y],s=t[y],M=QS(T,s);if(!M.valid)return{valid:!1};p.push(M.data)}return{valid:!0,data:p}}else return o===Dr.date&&u===Dr.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class J_ extends en{_parse(t){const{status:o,ctx:u}=this._processInputParams(t),p=(y,T)=>{if(YS(y)||YS(T))return Ii;const s=QS(y.value,T.value);return s.valid?((KS(y)||KS(T))&&o.dirty(),{status:o.value,value:s.data}):(Lr(u,{code:yr.invalid_intersection_types}),Ii)};return u.common.async?Promise.all([this._def.left._parseAsync({data:u.data,path:u.path,parent:u}),this._def.right._parseAsync({data:u.data,path:u.path,parent:u})]).then(([y,T])=>p(y,T)):p(this._def.left._parseSync({data:u.data,path:u.path,parent:u}),this._def.right._parseSync({data:u.data,path:u.path,parent:u}))}}J_.create=(e,t,o)=>new J_({left:e,right:t,typeName:wi.ZodIntersection,...Hi(o)});class zc extends en{_parse(t){const{status:o,ctx:u}=this._processInputParams(t);if(u.parsedType!==Dr.array)return Lr(u,{code:yr.invalid_type,expected:Dr.array,received:u.parsedType}),Ii;if(u.data.length<this._def.items.length)return Lr(u,{code:yr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ii;!this._def.rest&&u.data.length>this._def.items.length&&(Lr(u,{code:yr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o.dirty());const y=[...u.data].map((T,s)=>{const M=this._def.items[s]||this._def.rest;return M?M._parse(new Lc(u,T,u.path,s)):null}).filter(T=>!!T);return u.common.async?Promise.all(y).then(T=>Ns.mergeArray(o,T)):Ns.mergeArray(o,y)}get items(){return this._def.items}rest(t){return new zc({...this._def,rest:t})}}zc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zc({items:e,typeName:wi.ZodTuple,rest:null,...Hi(t)})};class Q_ extends en{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:o,ctx:u}=this._processInputParams(t);if(u.parsedType!==Dr.object)return Lr(u,{code:yr.invalid_type,expected:Dr.object,received:u.parsedType}),Ii;const p=[],y=this._def.keyType,T=this._def.valueType;for(const s in u.data)p.push({key:y._parse(new Lc(u,s,u.path,s)),value:T._parse(new Lc(u,u.data[s],u.path,s)),alwaysSet:s in u.data});return u.common.async?Ns.mergeObjectAsync(o,p):Ns.mergeObjectSync(o,p)}get element(){return this._def.valueType}static create(t,o,u){return o instanceof en?new Q_({keyType:t,valueType:o,typeName:wi.ZodRecord,...Hi(u)}):new Q_({keyType:tc.create(),valueType:t,typeName:wi.ZodRecord,...Hi(o)})}}class C1 extends en{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:o,ctx:u}=this._processInputParams(t);if(u.parsedType!==Dr.map)return Lr(u,{code:yr.invalid_type,expected:Dr.map,received:u.parsedType}),Ii;const p=this._def.keyType,y=this._def.valueType,T=[...u.data.entries()].map(([s,M],L)=>({key:p._parse(new Lc(u,s,u.path,[L,"key"])),value:y._parse(new Lc(u,M,u.path,[L,"value"]))}));if(u.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const M of T){const L=await M.key,B=await M.value;if(L.status==="aborted"||B.status==="aborted")return Ii;(L.status==="dirty"||B.status==="dirty")&&o.dirty(),s.set(L.value,B.value)}return{status:o.value,value:s}})}else{const s=new Map;for(const M of T){const L=M.key,B=M.value;if(L.status==="aborted"||B.status==="aborted")return Ii;(L.status==="dirty"||B.status==="dirty")&&o.dirty(),s.set(L.value,B.value)}return{status:o.value,value:s}}}}C1.create=(e,t,o)=>new C1({valueType:t,keyType:e,typeName:wi.ZodMap,...Hi(o)});class ef extends en{_parse(t){const{status:o,ctx:u}=this._processInputParams(t);if(u.parsedType!==Dr.set)return Lr(u,{code:yr.invalid_type,expected:Dr.set,received:u.parsedType}),Ii;const p=this._def;p.minSize!==null&&u.data.size<p.minSize.value&&(Lr(u,{code:yr.too_small,minimum:p.minSize.value,type:"set",inclusive:!0,exact:!1,message:p.minSize.message}),o.dirty()),p.maxSize!==null&&u.data.size>p.maxSize.value&&(Lr(u,{code:yr.too_big,maximum:p.maxSize.value,type:"set",inclusive:!0,exact:!1,message:p.maxSize.message}),o.dirty());const y=this._def.valueType;function T(M){const L=new Set;for(const B of M){if(B.status==="aborted")return Ii;B.status==="dirty"&&o.dirty(),L.add(B.value)}return{status:o.value,value:L}}const s=[...u.data.values()].map((M,L)=>y._parse(new Lc(u,M,u.path,L)));return u.common.async?Promise.all(s).then(M=>T(M)):T(s)}min(t,o){return new ef({...this._def,minSize:{value:t,message:ii.toString(o)}})}max(t,o){return new ef({...this._def,maxSize:{value:t,message:ii.toString(o)}})}size(t,o){return this.min(t,o).max(t,o)}nonempty(t){return this.min(1,t)}}ef.create=(e,t)=>new ef({valueType:e,minSize:null,maxSize:null,typeName:wi.ZodSet,...Hi(t)});class Kp extends en{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:o}=this._processInputParams(t);if(o.parsedType!==Dr.function)return Lr(o,{code:yr.invalid_type,expected:Dr.function,received:o.parsedType}),Ii;function u(s,M){return b1({data:s,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,x1(),Zp].filter(L=>!!L),issueData:{code:yr.invalid_arguments,argumentsError:M}})}function p(s,M){return b1({data:s,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,x1(),Zp].filter(L=>!!L),issueData:{code:yr.invalid_return_type,returnTypeError:M}})}const y={errorMap:o.common.contextualErrorMap},T=o.data;if(this._def.returns instanceof Jp){const s=this;return na(async function(...M){const L=new Qa([]),B=await s._def.args.parseAsync(M,y).catch(te=>{throw L.addIssue(u(M,te)),L}),H=await Reflect.apply(T,this,B);return await s._def.returns._def.type.parseAsync(H,y).catch(te=>{throw L.addIssue(p(H,te)),L})})}else{const s=this;return na(function(...M){const L=s._def.args.safeParse(M,y);if(!L.success)throw new Qa([u(M,L.error)]);const B=Reflect.apply(T,this,L.data),H=s._def.returns.safeParse(B,y);if(!H.success)throw new Qa([p(B,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Kp({...this._def,args:zc.create(t).rest(Qd.create())})}returns(t){return new Kp({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,o,u){return new Kp({args:t||zc.create([]).rest(Qd.create()),returns:o||Qd.create(),typeName:wi.ZodFunction,...Hi(u)})}}class ey extends en{get schema(){return this._def.getter()}_parse(t){const{ctx:o}=this._processInputParams(t);return this._def.getter()._parse({data:o.data,path:o.path,parent:o})}}ey.create=(e,t)=>new ey({getter:e,typeName:wi.ZodLazy,...Hi(t)});class ty extends en{_parse(t){if(t.data!==this._def.value){const o=this._getOrReturnCtx(t);return Lr(o,{received:o.data,code:yr.invalid_literal,expected:this._def.value}),Ii}return{status:"valid",value:t.data}}get value(){return this._def.value}}ty.create=(e,t)=>new ty({value:e,typeName:wi.ZodLiteral,...Hi(t)});function Az(e,t){return new Ph({values:e,typeName:wi.ZodEnum,...Hi(t)})}class Ph extends en{constructor(){super(...arguments),q_.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const o=this._getOrReturnCtx(t),u=this._def.values;return Lr(o,{expected:En.joinValues(u),received:o.parsedType,code:yr.invalid_type}),Ii}if(w1(this,q_)||Tz(this,q_,new Set(this._def.values)),!w1(this,q_).has(t.data)){const o=this._getOrReturnCtx(t),u=this._def.values;return Lr(o,{received:o.data,code:yr.invalid_enum_value,options:u}),Ii}return na(t.data)}get options(){return this._def.values}get enum(){const t={};for(const o of this._def.values)t[o]=o;return t}get Values(){const t={};for(const o of this._def.values)t[o]=o;return t}get Enum(){const t={};for(const o of this._def.values)t[o]=o;return t}extract(t,o=this._def){return Ph.create(t,{...this._def,...o})}exclude(t,o=this._def){return Ph.create(this.options.filter(u=>!t.includes(u)),{...this._def,...o})}}q_=new WeakMap,Ph.create=Az;class ry extends en{constructor(){super(...arguments),Z_.set(this,void 0)}_parse(t){const o=En.getValidEnumValues(this._def.values),u=this._getOrReturnCtx(t);if(u.parsedType!==Dr.string&&u.parsedType!==Dr.number){const p=En.objectValues(o);return Lr(u,{expected:En.joinValues(p),received:u.parsedType,code:yr.invalid_type}),Ii}if(w1(this,Z_)||Tz(this,Z_,new Set(En.getValidEnumValues(this._def.values))),!w1(this,Z_).has(t.data)){const p=En.objectValues(o);return Lr(u,{received:u.data,code:yr.invalid_enum_value,options:p}),Ii}return na(t.data)}get enum(){return this._def.values}}Z_=new WeakMap,ry.create=(e,t)=>new ry({values:e,typeName:wi.ZodNativeEnum,...Hi(t)});class Jp extends en{unwrap(){return this._def.type}_parse(t){const{ctx:o}=this._processInputParams(t);if(o.parsedType!==Dr.promise&&o.common.async===!1)return Lr(o,{code:yr.invalid_type,expected:Dr.promise,received:o.parsedType}),Ii;const u=o.parsedType===Dr.promise?o.data:Promise.resolve(o.data);return na(u.then(p=>this._def.type.parseAsync(p,{path:o.path,errorMap:o.common.contextualErrorMap})))}}Jp.create=(e,t)=>new Jp({type:e,typeName:wi.ZodPromise,...Hi(t)});class ic extends en{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:o,ctx:u}=this._processInputParams(t),p=this._def.effect||null,y={addIssue:T=>{Lr(u,T),T.fatal?o.abort():o.dirty()},get path(){return u.path}};if(y.addIssue=y.addIssue.bind(y),p.type==="preprocess"){const T=p.transform(u.data,y);if(u.common.async)return Promise.resolve(T).then(async s=>{if(o.value==="aborted")return Ii;const M=await this._def.schema._parseAsync({data:s,path:u.path,parent:u});return M.status==="aborted"?Ii:M.status==="dirty"||o.value==="dirty"?Wp(M.value):M});{if(o.value==="aborted")return Ii;const s=this._def.schema._parseSync({data:T,path:u.path,parent:u});return s.status==="aborted"?Ii:s.status==="dirty"||o.value==="dirty"?Wp(s.value):s}}if(p.type==="refinement"){const T=s=>{const M=p.refinement(s,y);if(u.common.async)return Promise.resolve(M);if(M instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(u.common.async===!1){const s=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});return s.status==="aborted"?Ii:(s.status==="dirty"&&o.dirty(),T(s.value),{status:o.value,value:s.value})}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(s=>s.status==="aborted"?Ii:(s.status==="dirty"&&o.dirty(),T(s.value).then(()=>({status:o.value,value:s.value}))))}if(p.type==="transform")if(u.common.async===!1){const T=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});if(!$_(T))return T;const s=p.transform(T.value,y);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:o.value,value:s}}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(T=>$_(T)?Promise.resolve(p.transform(T.value,y)).then(s=>({status:o.value,value:s})):T);En.assertNever(p)}}ic.create=(e,t,o)=>new ic({schema:e,typeName:wi.ZodEffects,effect:t,...Hi(o)}),ic.createWithPreprocess=(e,t,o)=>new ic({schema:t,effect:{type:"preprocess",transform:e},typeName:wi.ZodEffects,...Hi(o)});class Dc extends en{_parse(t){return this._getType(t)===Dr.undefined?na(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Dc.create=(e,t)=>new Dc({innerType:e,typeName:wi.ZodOptional,...Hi(t)});class Mh extends en{_parse(t){return this._getType(t)===Dr.null?na(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Mh.create=(e,t)=>new Mh({innerType:e,typeName:wi.ZodNullable,...Hi(t)});class iy extends en{_parse(t){const{ctx:o}=this._processInputParams(t);let u=o.data;return o.parsedType===Dr.undefined&&(u=this._def.defaultValue()),this._def.innerType._parse({data:u,path:o.path,parent:o})}removeDefault(){return this._def.innerType}}iy.create=(e,t)=>new iy({innerType:e,typeName:wi.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Hi(t)});class ny extends en{_parse(t){const{ctx:o}=this._processInputParams(t),u={...o,common:{...o.common,issues:[]}},p=this._def.innerType._parse({data:u.data,path:u.path,parent:{...u}});return H_(p)?p.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new Qa(u.common.issues)},input:u.data})})):{status:"valid",value:p.status==="valid"?p.value:this._def.catchValue({get error(){return new Qa(u.common.issues)},input:u.data})}}removeCatch(){return this._def.innerType}}ny.create=(e,t)=>new ny({innerType:e,typeName:wi.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Hi(t)});class I1 extends en{_parse(t){if(this._getType(t)!==Dr.nan){const u=this._getOrReturnCtx(t);return Lr(u,{code:yr.invalid_type,expected:Dr.nan,received:u.parsedType}),Ii}return{status:"valid",value:t.data}}}I1.create=e=>new I1({typeName:wi.ZodNaN,...Hi(e)});const vX=Symbol("zod_brand");class eC extends en{_parse(t){const{ctx:o}=this._processInputParams(t),u=o.data;return this._def.type._parse({data:u,path:o.path,parent:o})}unwrap(){return this._def.type}}class oy extends en{_parse(t){const{status:o,ctx:u}=this._processInputParams(t);if(u.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:u.data,path:u.path,parent:u});return y.status==="aborted"?Ii:y.status==="dirty"?(o.dirty(),Wp(y.value)):this._def.out._parseAsync({data:y.value,path:u.path,parent:u})})();{const p=this._def.in._parseSync({data:u.data,path:u.path,parent:u});return p.status==="aborted"?Ii:p.status==="dirty"?(o.dirty(),{status:"dirty",value:p.value}):this._def.out._parseSync({data:p.value,path:u.path,parent:u})}}static create(t,o){return new oy({in:t,out:o,typeName:wi.ZodPipeline})}}class sy extends en{_parse(t){const o=this._def.innerType._parse(t),u=p=>($_(p)&&(p.value=Object.freeze(p.value)),p);return H_(o)?o.then(p=>u(p)):u(o)}unwrap(){return this._def.innerType}}sy.create=(e,t)=>new sy({innerType:e,typeName:wi.ZodReadonly,...Hi(t)});function Pz(e,t={},o){return e?Xp.create().superRefine((u,p)=>{var y,T;if(!e(u)){const s=typeof t=="function"?t(u):typeof t=="string"?{message:t}:t,M=(T=(y=s.fatal)!==null&&y!==void 0?y:o)!==null&&T!==void 0?T:!0,L=typeof s=="string"?{message:s}:s;p.addIssue({code:"custom",...L,fatal:M})}}):Xp.create()}const xX={object:bo.lazycreate};var wi;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(wi||(wi={}));const bX=(e,t={message:`Input not instance of ${e.name}`})=>Pz(o=>o instanceof e,t),Mz=tc.create,kz=Ih.create,wX=I1.create,TX=Ah.create,Rz=W_.create,EX=Jd.create,SX=T1.create,CX=X_.create,IX=Y_.create,AX=Xp.create,PX=Qd.create,MX=wu.create,kX=E1.create,RX=rc.create,LX=bo.create,zX=bo.strictCreate,DX=K_.create,OX=S1.create,FX=J_.create,NX=zc.create,BX=Q_.create,VX=C1.create,UX=ef.create,jX=Kp.create,GX=ey.create,$X=ty.create,HX=Ph.create,qX=ry.create,ZX=Jp.create,Lz=ic.create,WX=Dc.create,XX=Mh.create,YX=ic.createWithPreprocess,KX=oy.create;var br=Object.freeze({__proto__:null,defaultErrorMap:Zp,setErrorMap:rX,getErrorMap:x1,makeIssue:b1,EMPTY_PATH:iX,addIssueToContext:Lr,ParseStatus:Ns,INVALID:Ii,DIRTY:Wp,OK:na,isAborted:YS,isDirty:KS,isValid:$_,isAsync:H_,get util(){return En},get objectUtil(){return XS},ZodParsedType:Dr,getParsedType:Ch,ZodType:en,datetimeRegex:Iz,ZodString:tc,ZodNumber:Ih,ZodBigInt:Ah,ZodBoolean:W_,ZodDate:Jd,ZodSymbol:T1,ZodUndefined:X_,ZodNull:Y_,ZodAny:Xp,ZodUnknown:Qd,ZodNever:wu,ZodVoid:E1,ZodArray:rc,ZodObject:bo,ZodUnion:K_,ZodDiscriminatedUnion:S1,ZodIntersection:J_,ZodTuple:zc,ZodRecord:Q_,ZodMap:C1,ZodSet:ef,ZodFunction:Kp,ZodLazy:ey,ZodLiteral:ty,ZodEnum:Ph,ZodNativeEnum:ry,ZodPromise:Jp,ZodEffects:ic,ZodTransformer:ic,ZodOptional:Dc,ZodNullable:Mh,ZodDefault:iy,ZodCatch:ny,ZodNaN:I1,BRA
2820ND:vX,ZodBranded:eC,ZodPipeline:oy,ZodReadonly:sy,custom:Pz,Schema:en,ZodSchema:en,late:xX,get ZodFirstPartyTypeKind(){return wi},coerce:{string:e=>tc.create({...e,coerce:!0}),number:e=>Ih.create({...e,coerce:!0}),boolean:e=>W_.create({...e,coerce:!0}),bigint:e=>Ah.create({...e,coerce:!0}),date:e=>Jd.create({...e,coerce:!0})},any:AX,array:RX,bigint:TX,boolean:Rz,date:EX,discriminatedUnion:OX,effect:Lz,enum:HX,function:jX,instanceof:bX,intersection:FX,lazy:GX,literal:$X,map:VX,nan:wX,nativeEnum:qX,never:MX,null:IX,nullable:XX,number:kz,object:LX,oboolean:()=>Rz().optional(),onumber:()=>kz().optional(),optional:WX,ostring:()=>Mz().optional(),pipeline:KX,preprocess:YX,promise:ZX,record:BX,set:UX,strictObject:zX,string:Mz,symbol:SX,transformer:Lz,tuple:NX,undefined:CX,union:DX,unknown:PX,void:kX,NEVER:Ii,ZodIssueCode:yr,quotelessJson:tX,ZodError:Qa});const zz=(e,t,o)=>{if(e&&"reportValidity"in e){const u=Nr(o,t);e.setCustomValidity(u&&u.message||""),e.reportValidity()}},Dz=(e,t)=>{for(const o in t.fields){const u=t.fields[o];u&&u.ref&&"reportValidity"in u.ref?zz(u.ref,o,e):u.refs&&u.refs.forEach(p=>zz(p,o,e))}},JX=(e,t)=>{t.shouldUseNativeValidation&&Dz(e,t);const o={};for(const u in e){const p=Nr(t.fields,u),y=Object.assign(e[u]||{},{ref:p&&p.ref});if(QX(t.names||Object.keys(e),u)){const T=Object.assign({},Nr(o,u));Gn(T,"root",y),Gn(o,u,T)}else Gn(o,u,y)}return o},QX=(e,t)=>e.some(o=>o.startsWith(t+"."));var eY=function(e,t){for(var o={};e.length;){var u=e[0],p=u.code,y=u.message,T=u.path.join(".");if(!o[T])if("unionErrors"in u){var s=u.unionErrors[0].errors[0];o[T]={message:s.message,type:s.code}}else o[T]={message:y,type:p};if("unionErrors"in u&&u.unionErrors.forEach(function(B){return B.errors.forEach(function(H){return e.push(H)})}),t){var M=o[T].types,L=M&&M[u.code];o[T]=YR(T,t,o,p,L?[].concat(L,u.message):u.message)}e.shift()}return o},tY=function(e,t,o){return o===void 0&&(o={}),function(u,p,y){try{return Promise.resolve(function(T,s){try{var M=Promise.resolve(e[o.mode==="sync"?"parse":"parseAsync"](u,t)).then(function(L){return y.shouldUseNativeValidation&&Dz({},y),{errors:{},values:o.raw?u:L}})}catch(L){return s(L)}return M&&M.then?M.then(void 0,s):M}(0,function(T){if(function(s){return Array.isArray(s==null?void 0:s.errors)}(T))return{values:{},errors:JX(eY(T.errors,!y.shouldUseNativeValidation&&y.criteriaMode==="all"),y)};throw T}))}catch(T){return Promise.reject(T)}}};const Ft=Symbol.for("drizzle:entityKind");function hr(e,t){if(!e||typeof e!="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,Ft))throw new Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let o=Object.getPrototypeOf(e).constructor;if(o)for(;o;){if(Ft in o&&o[Ft]===t[Ft])return!0;o=Object.getPrototypeOf(o)}return!1}y5=Ft;class ss{constructor(t,o){de(this,"name");de(this,"keyAsName");de(this,"primary");de(this,"notNull");de(this,"default");de(this,"defaultFn");de(this,"onUpdateFn");de(this,"hasDefault");de(this,"isUnique");de(this,"uniqueName");de(this,"uniqueType");de(this,"dataType");de(this,"columnType");de(this,"enumValues");de(this,"generated");de(this,"generatedIdentity");de(this,"config");this.table=t,this.config=o,this.name=o.name,this.keyAsName=o.keyAsName,this.notNull=o.notNull,this.default=o.default,this.defaultFn=o.defaultFn,this.onUpdateFn=o.onUpdateFn,this.hasDefault=o.hasDefault,this.primary=o.primaryKey,this.isUnique=o.isUnique,this.uniqueName=o.uniqueName,this.uniqueType=o.uniqueType,this.dataType=o.dataType,this.columnType=o.columnType,this.generated=o.generated,this.generatedIdentity=o.generatedIdentity}mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}de(ss,y5,"Column"),v5=Ft;class Oz{constructor(t,o,u){de(this,"config");de(this,"$default",this.$defaultFn);de(this,"$onUpdate",this.$onUpdateFn);this.config={name:t,keyAsName:t==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:o,columnType:u,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(t){return this.config.default=t,this.config.hasDefault=!0,this}$defaultFn(t){return this.config.defaultFn=t,this.config.hasDefault=!0,this}$onUpdateFn(t){return this.config.onUpdateFn=t,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(t){this.config.name===""&&(this.config.name=t)}}de(Oz,v5,"ColumnBuilder");const Oc=Symbol.for("drizzle:Name");x5=Ft;class Fz{constructor(t,o){de(this,"reference");de(this,"_onUpdate","no action");de(this,"_onDelete","no action");this.reference=()=>{const{name:u,columns:p,foreignColumns:y}=t();return{name:u,columns:p,foreignTable:y[0].table,foreignColumns:y}},o&&(this._onUpdate=o.onUpdate,this._onDelete=o.onDelete)}onUpdate(t){return this._onUpdate=t===void 0?"no action":t,this}onDelete(t){return this._onDelete=t===void 0?"no action":t,this}build(t){return new Nz(t,this)}}de(Fz,x5,"PgForeignKeyBuilder"),b5=Ft;class Nz{constructor(t,o){de(this,"reference");de(this,"onUpdate");de(this,"onDelete");this.table=t,this.reference=o.reference,this.onUpdate=o._onUpdate,this.onDelete=o._onDelete}getName(){const{name:t,columns:o,foreignColumns:u}=this.reference(),p=o.map(s=>s.name),y=u.map(s=>s.name),T=[this.table[Oc],...p,u[0].table[Oc],...y];return t??`${T.join("_")}_fk`}}de(Nz,b5,"PgForeignKey");function rY(e,...t){return e(...t)}function Bz(e){return new jz(e)}function Vz(e,t){return`${e[Oc]}_${t.join("_")}_unique`}w5=Ft;class Uz{constructor(t,o){de(this,"columns");de(this,"nullsNotDistinctConfig",!1);this.name=o,this.columns=t}nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(t){return new Gz(t,this.columns,this.nullsNotDistinctConfig,this.name)}}de(Uz,w5,"PgUniqueConstraintBuilder"),T5=Ft;class jz{constructor(t){de(this,"name");this.name=t}on(...t){return new Uz(t,this.name)}}de(jz,T5,"PgUniqueOnConstraintBuilder"),E5=Ft;class Gz{constructor(t,o,u,p){de(this,"columns");de(this,"name");de(this,"nullsNotDistinct",!1);
2820this.table=t,this.columns=o,this.name=p??Vz(this.table,this.columns.map(y=>y.name)),this.nullsNotDistinct=u}getName(){return this.name}}de(Gz,E5,"PgUniqueConstraint");function $z(e,t,o){for(let u=t;u<e.length;u++){const p=e[u];if(p==="\\"){u++;continue}if(p==='"')return[e.slice(t,u).replace(/\\/g,""),u+1];if(!o&&(p===","||p==="}"))return[e.slice(t,u).replace(/\\/g,""),u]}return[e.slice(t).replace(/\\/g,""),e.length]}function Hz(e,t=0){const o=[];let u=t,p=!1;for(;u<e.length;){const y=e[u];if(y===","){(p||u===t)&&o.push(""),p=!0,u++;continue}if(p=!1,y==="\\"){u+=2;continue}if(y==='"'){const[M,L]=$z(e,u+1,!0);o.push(M),u=L;continue}if(y==="}")return[o,u+1];if(y==="{"){const[M,L]=Hz(e,u+1);o.push(M),u=L;continue}const[T,s]=$z(e,u,!1);o.push(T),u=s}return[o,u]}function iY(e){const[t]=Hz(e,1);return t}function qz(e){return`{${e.map(t=>Array.isArray(t)?qz(t):typeof t=="string"?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}class hn extends(C5=Oz,S5=Ft,C5){constructor(){super(...arguments);de(this,"foreignKeyConfigs",[])}array(o){return new Wz(this.config.name,this,o)}references(o,u={}){return this.foreignKeyConfigs.push({ref:o,actions:u}),this}unique(o,u){return this.config.isUnique=!0,this.config.uniqueName=o,this.config.uniqueType=u==null?void 0:u.nulls,this}generatedAlwaysAs(o){return this.config.generated={as:o,type:"always",mode:"stored"},this}buildForeignKeys(o,u){return this.foreignKeyConfigs.map(({ref:p,actions:y})=>rY((T,s)=>{const M=new Fz(()=>{const L=T();return{columns:[o],foreignColumns:[L]}});return s.onUpdate&&M.onUpdate(s.onUpdate),s.onDelete&&M.onDelete(s.onDelete),M.build(u)},p,y))}buildExtraConfigColumn(o){return new Zz(o,this.config)}}de(hn,S5,"PgColumnBuilder");class Ti extends(A5=ss,I5=Ft,A5){constructor(t,o){o.uniqueName||(o.uniqueName=Vz(t,[o.name])),super(t,o),this.table=t}}de(Ti,I5,"PgColumn");class Zz extends(M5=Ti,P5=Ft,M5){constructor(){super(...arguments);de(this,"indexConfig",{order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass});de(this,"defaultConfig",{order:"asc",nulls:"last",opClass:void 0})}getSQLType(){return this.getSQLType()}asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(o){return this.indexConfig.opClass=o,this}}de(Zz,P5,"ExtraConfigColumn"),k5=Ft;class A1{constructor(t,o,u,p){de(this,"name");de(this,"keyAsName");de(this,"type");de(this,"indexConfig");this.name=t,this.keyAsName=o,this.type=u,this.indexConfig=p}}de(A1,k5,"IndexedColumn");class Wz extends(L5=hn,R5=Ft,L5){constructor(t,o,u){super(t,"array","PgArray"),this.config.baseBuilder=o,this.config.size=u}build(t){const o=this.config.baseBuilder.build(t);return new tC(t,this.config,o)}}de(Wz,R5,"PgArrayBuilder");const fb=class fb extends(D5=Ti,z5=Ft,D5){constructor(o,u,p,y){super(o,u);de(this,"size");this.baseColumn=p,this.range=y,this.size=u.size}getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(o){return typeof o=="string"&&(o=iY(o)),o.map(u=>this.baseColumn.mapFromDriverValue(u))}mapToDriverValue(o,u=!1){const p=o.map(y=>y===null?null:hr(this.baseColumn,fb)?this.baseColumn.mapToDriverValue(y,!0):this.baseColumn.mapToDriverValue(y));return u?p:qz(p)}};de(fb,z5,"PgArray");let tC=fb;class Xz extends(F5=hn,O5=Ft,F5){constructor(t,o){super(t,"string","PgEnumObjectColumn"),this.config.enum=o}build(t){return new Yz(t,this.config)}}de(Xz,O5,"PgEnumObjectColumnBuilder");class Yz extends(B5=Ti,N5=Ft,B5){constructor(o,u){super(o,u);de(this,"enum");de(this,"enumValues",this.config.enum.enumValues);this.enum=u.enum}getSQLType(){return this.enum.enumName}}de(Yz,N5,"PgEnumObjectColumn");const P1=Symbol.for("drizzle:isPgEnum");function nY(e){return!!e&&typeof e=="function"&&P1 in e&&e[P1]===!0}class Kz extends(U5=hn,V5=Ft,U5){constructor(t,o){super(t,"string","PgEnumColumn"),this.config.enum=o}build(t){return new Jz(t,this.config)}}de(Kz,V5,"PgEnumColumnBuilder");class Jz extends(G5=Ti,j5=Ft,G5){constructor(o,u){super(o,u);de(this,"enum",this.config.enum);de(this,"enumValues",this.config.enum.enumValues);this.enum=u.enum}getSQLType(){return this.enum.enumName}}de(Jz,j5,"PgEnumColumn");function oY(e,t,o){const u=Object.assign(p=>new Kz(p??"",u),{enumName:e,enumValues:t,schema:o,[P1]:!0});return u}function sY(e,t,o){const u=Object.assign(p=>new Xz(p??"",u),{enumName:e,enumValues:Object.values(t),schema:o,[P1]:!0});return u}$5=Ft;class oa{constructor(t,o,u,p=!1,y=[]){this._={brand:"Subquery",sql:t,selectedFields:o,alias:u,isWith:p,usedTables:y}}}de(oa,$5,"Subquery");class Qz extends(q5=oa,H5=Ft,q5){}de(Qz,H5,"WithSubquery");const rC={startActiveSpan(e,t){return t()}},as=Symbol.for("drizzle:ViewBaseConfig"),Qp=Symbol.for("drizzle:Schema"),eD=Symbol.for("drizzle:Columns"),tD=Symbol.for("drizzle:ExtraConfigColumns"),iC=Symbol.for("drizzle:OriginalName"),nC=Symbol.for("drizzle:BaseName"),M1=Symbol.for("drizzle:IsAlias"),rD=Symbol.for("drizzle:ExtraConfigBuilder"),aY=Symbol.for("drizzle:IsDrizzleTable");
2820rN=Ft,tN=Oc,eN=iC,Q5=Qp,J5=eD,K5=tD,Y5=nC,X5=M1,W5=aY,Z5=rD;class ui{constructor(t,o,u){de(this,tN);de(this,eN);de(this,Q5);de(this,J5);de(this,K5);de(this,Y5);de(this,X5,!1);de(this,W5,!0);de(this,Z5);this[Oc]=this[iC]=t,this[Qp]=o,this[nC]=u}}de(ui,rN,"Table"),de(ui,"Symbol",{Name:Oc,Schema:Qp,OriginalName:iC,Columns:eD,ExtraConfigColumns:tD,BaseName:nC,IsAlias:M1,ExtraConfigBuilder:rD});function k1(e){return e[Oc]}function oC(e){return`${e[Qp]??"public"}.${e[Oc]}`}function iD(e){return e!=null&&typeof e.getSQL=="function"}function lY(e){var o;const t={sql:"",params:[]};for(const u of e)t.sql+=u.sql,t.params.push(...u.params),(o=u.typings)!=null&&o.length&&(t.typings||(t.typings=[]),t.typings.push(...u.typings));return t}iN=Ft;class ls{constructor(t){de(this,"value");this.value=Array.isArray(t)?t:[t]}getSQL(){return new _i([this])}}de(ls,iN,"StringChunk"),nN=Ft;const ff=class ff{constructor(t){de(this,"decoder",nD);de(this,"shouldInlineParams",!1);de(this,"usedTables",[]);this.queryChunks=t;for(const o of t)if(hr(o,ui)){const u=o[ui.Symbol.Schema];this.usedTables.push(u===void 0?o[ui.Symbol.Name]:u+"."+o[ui.Symbol.Name])}}append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return rC.startActiveSpan("drizzle.buildSQL",o=>{const u=this.buildQueryFromSourceParams(this.queryChunks,t);return o==null||o.setAttributes({"drizzle.query.text":u.sql,"drizzle.query.params":JSON.stringify(u.params)}),u})}buildQueryFromSourceParams(t,o){const u=Object.assign({},o,{inlineParams:o.inlineParams||this.shouldInlineParams,paramStartIndex:o.paramStartIndex||{value:0}}),{casing:p,escapeName:y,escapeParam:T,prepareTyping:s,inlineParams:M,paramStartIndex:L}=u;return lY(t.map(B=>{var H;if(hr(B,ls))return{sql:B.value.join(""),params:[]};if(hr(B,R1))return{sql:y(B.value),params:[]};if(B===void 0)return{sql:"",params:[]};if(Array.isArray(B)){const $=[new ls("(")];for(const[te,xe]of B.entries())$.push(xe),te<B.length-1&&$.push(new ls(", "));return $.push(new ls(")")),this.buildQueryFromSourceParams($,u)}if(hr(B,ff))return this.buildQueryFromSourceParams(B.queryChunks,{...u,inlineParams:M||B.shouldInlineParams});if(hr(B,ui)){const $=B[ui.Symbol.Schema],te=B[ui.Symbol.Name];return{sql:$===void 0||B[M1]?y(te):y($)+"."+y(te),params:[]}}if(hr(B,ss)){const $=p.getColumnCasing(B);if(o.invokeSource==="indexes")return{sql:y($),params:[]};const te=B.table[ui.Symbol.Schema];return{sql:B.table[M1]||te===void 0?y(B.table[ui.Symbol.Name])+"."+y($):y(te)+"."+y(B.table[ui.Symbol.Name])+"."+y($),params:[]}}if(hr(B,kh)){const $=B[as].schema,te=B[as].name;return{sql:$===void 0||B[as].isAlias?y(te):y($)+"."+y(te),params:[]}}if(hr(B,em)){if(hr(B.value,ay))return{sql:T(L.value++,B),params:[B],typings:["none"]};const $=B.value===null?null:B.encoder.mapToDriverValue(B.value);if(hr($,ff))return this.buildQueryFromSourceParams([$],u);if(M)return{sql:this.mapInlineParam($,u),params:[]};let te=["none"];return s&&(te=[s(B.encoder)]),{sql:T(L.value++,$),params:[$],typings:te}}return hr(B,ay)?{sql:T(L.value++,B),params:[B],typings:["none"]}:hr(B,ff.Aliased)&&B.fieldAlias!==void 0?{sql:y(B.fieldAlias),params:[]}:hr(B,oa)?B._.isWith?{sql:y(B._.alias),params:[]}:this.buildQueryFromSourceParams([new ls("("),B._.sql,new ls(") "),new R1(B._.alias)],u):nY(B)?B.schema?{sql:y(B.schema)+"."+y(B.enumName),params:[]}:{sql:y(B.enumName),params:[]}:iD(B)?(H=B.shouldOmitSQLParens)!=null&&H.call(B)?this.buildQueryFromSourceParams([B.getSQL()],u):this.buildQueryFromSourceParams([new ls("("),B.getSQL(),new ls(")")],u):M?{sql:this.mapInlineParam(B,u),params:[]}:{sql:T(L.value++,B),params:[B],typings:["none"]}}))}mapInlineParam(t,{escapeString:o}){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="string")return o(t);if(typeof t=="object"){const u=t.toString();return o(u==="[object Object]"?JSON.stringify(t):u)}throw new Error("Unexpected param value: "+t)}getSQL(){return this}as(t){return t===void 0?this:new ff.Aliased(this,t)}mapWith(t){return this.decoder=typeof t=="function"?{mapFromDriverValue:t}:t,this}inlineParams(){return this.shouldInlineParams=!0,this}if(t){return t?this:void 0}};de(ff,nN,"SQL");let _i=ff;oN=Ft;class R1{constructor(t){de(this,"brand");this.value=t}getSQL(){return new _i([this])}}de(R1,oN,"Name");function cY(e){return typeof e=="object"&&e!==null&&"mapToDriverValue"in e&&typeof e.mapToDriverValue=="function"}const nD={mapFromDriverValue:e=>e},oD={mapToDriverValue:e=>e};({...nD,...oD},sN=Ft);class em{constructor(t,o=oD){de(this,"brand");this.value=t,this.encoder=o}getSQL(){return new _i([this])}}de(em,sN,"Param");function _t(e,...t){const o=[];(t.length>0||e.length>0&&e[0]!=="")&&o.push(new ls(e[0]));for(const[u,p]of t.entries())o.push(p,new ls(e[u+1]));return new _i(o)}(e=>{function t(){return new _i([])}e.empty=t;function o(M){return new _i(M)}e.fromList=o;function u(M){return new _i([new ls(M)])}e.raw=u;function p(M,L){const B=[];for(const[H,$]of M.entries())H>0&&L!==void 0&&B.push(L),B.push($);return new _i(B)}e.join=p;function y(M){return new R1(M)}e.identifier=y;function T(M){return new ay(M)}e.placeholder=T;function s(M,L){return new em(M,L)}e.param=s})(_t||(_t={})),(e=>{var o;o=Ft;const u=class u{constructor(y,T){de(this,"isSelectionField",!1);this.sql=y,this.fieldAlias=T}getSQL(){return this.sql}clone(){return new u(this.sql,this.fieldAlias)}};de(u,o,"SQL.Aliased");let t=u;e.Aliased=t})(_i||(_i={})),aN=Ft;class ay{constructor(t){this.name=t}getSQL(){return new _i([this])}}de(ay,aN,"Placeholder");const uY=Symbol.for("drizzle:IsDrizzleView");uN=Ft,cN=as,lN=uY;class kh{constructor({name:t,schema:o,selectedFields:u,query:p}){de(this,cN);de(this,lN,!0);
2820this[as]={name:t,originalName:t,schema:o,selectedFields:u,query:p,isExisting:!p,isAlias:!1}}getSQL(){return new _i([this])}}de(kh,uN,"View"),ss.prototype.getSQL=function(){return new _i([this])},ui.prototype.getSQL=function(){return new _i([this])},oa.prototype.getSQL=function(){return new _i([this])},hN=Ft;class ly{constructor(t){this.table=t}get(t,o){return o==="table"?this.table:t[o]}}de(ly,hN,"ColumnAliasProxyHandler"),dN=Ft;class L1{constructor(t,o){this.alias=t,this.replaceOriginalName=o}get(t,o){if(o===ui.Symbol.IsAlias)return!0;if(o===ui.Symbol.Name)return this.alias;if(this.replaceOriginalName&&o===ui.Symbol.OriginalName)return this.alias;if(o===as)return{...t[as],name:this.alias,isAlias:!0};if(o===ui.Symbol.Columns){const p=t[ui.Symbol.Columns];if(!p)return p;const y={};return Object.keys(p).map(T=>{y[T]=new Proxy(p[T],new ly(new Proxy(t,this)))}),y}const u=t[o];return hr(u,ss)?new Proxy(u,new ly(new Proxy(t,this))):u}}de(L1,dN,"TableAliasProxyHandler");function sC(e,t){return new Proxy(e,new L1(t,!1))}function Eu(e,t){return new Proxy(e,new ly(new Proxy(e.table,new L1(t,!1))))}function sD(e,t){return new _i.Aliased(z1(e.sql,t),e.fieldAlias)}function z1(e,t){return _t.join(e.queryChunks.map(o=>hr(o,ss)?Eu(o,t):hr(o,_i)?z1(o,t):hr(o,_i.Aliased)?sD(o,t):o))}class aD extends(pN=Error,fN=Ft,pN){constructor({message:t,cause:o}){super(t),this.name="DrizzleError",this.cause=o}}de(aD,fN,"DrizzleError"),gN=Ft,mN=Symbol.toStringTag;class lD{constructor(){de(this,mN,"QueryPromise")}catch(t){return this.then(void 0,t)}finally(t){return this.then(o=>(t==null||t(),o),o=>{throw t==null||t(),o})}then(t,o){return this.execute().then(t,o)}}de(lD,gN,"QueryPromise");function D1(e,t){return Object.entries(e).reduce((o,[u,p])=>{if(typeof u!="string")return o;const y=t?[...t,u]:[u];return hr(p,ss)||hr(p,_i)||hr(p,_i.Aliased)||hr(p,oa)?o.push({path:y,field:p}):hr(p,ui)?o.push(...D1(p[ui.Symbol.Columns],y)):o.push(...D1(p,y)),o},[])}function cD(e,t){const o=Object.keys(e),u=Object.keys(t);if(o.length!==u.length)return!1;for(const[p,y]of o.entries())if(y!==u[p])return!1;return!0}function hY(e,t){for(const o of t)for(const u of Object.getOwnPropertyNames(o.prototype))u!=="constructor"&&Object.defineProperty(e.prototype,u,Object.getOwnPropertyDescriptor(o.prototype,u)||Object.create(null))}function O1(e){return e[ui.Symbol.Columns]}function uD(e){return hr(e,oa)?e._.alias:hr(e,kh)?e[as].name:hr(e,_i)?void 0:e[ui.Symbol.IsAlias]?e[ui.Symbol.Name]:e[ui.Symbol.BaseName]}function cs(e,t){return{name:typeof e=="string"&&e.length>0?e:"",config:typeof e=="object"?e:t}}typeof TextDecoder>"u"||new TextDecoder;class cy extends(yN=hn,_N=Ft,yN){generatedAlwaysAsIdentity(t){if(t){const{name:o,...u}=t;this.config.generatedIdentity={type:"always",sequenceName:o,sequenceOptions:u}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(t){if(t){const{name:o,...u}=t;this.config.generatedIdentity={type:"byDefault",sequenceName:o,sequenceOptions:u}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}de(cy,_N,"PgIntColumnBaseBuilder");class hD extends(xN=cy,vN=Ft,xN){constructor(t){super(t,"number","PgBigInt53")}build(t){return new dD(t,this.config)}}de(hD,vN,"PgBigInt53Builder");class dD extends(wN=Ti,bN=Ft,wN){getSQLType(){return"bigint"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}}de(dD,bN,"PgBigInt53");class fD extends(EN=cy,TN=Ft,EN){constructor(t){super(t,"bigint","PgBigInt64")}build(t){return new pD(t,this.config)}}de(fD,TN,"PgBigInt64Builder");class pD extends(CN=Ti,SN=Ft,CN){getSQLType(){return"bigint"}mapFromDriverValue(t){return BigInt(t)}}de(pD,SN,"PgBigInt64");function tm(e,t){const{name:o,config:u}=cs(e,t);return u.mode==="number"?new hD(o):new fD(o)}class mD extends(AN=hn,IN=Ft,AN){constructor(t){super(t,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new gD(t,this.config)}}de(mD,IN,"PgBigSerial53Builder");class gD extends(MN=Ti,PN=Ft,MN){getSQLType(){return"bigserial"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}}
2820de(gD,PN,"PgBigSerial53");class _D extends(RN=hn,kN=Ft,RN){constructor(t){super(t,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(t){return new yD(t,this.config)}}de(_D,kN,"PgBigSerial64Builder");class yD extends(zN=Ti,LN=Ft,zN){getSQLType(){return"bigserial"}mapFromDriverValue(t){return BigInt(t)}}de(yD,LN,"PgBigSerial64");function dY(e,t){const{name:o,config:u}=cs(e,t);return u.mode==="number"?new mD(o):new _D(o)}class vD extends(ON=hn,DN=Ft,ON){constructor(t){super(t,"boolean","PgBoolean")}build(t){return new xD(t,this.config)}}de(vD,DN,"PgBooleanBuilder");class xD extends(NN=Ti,FN=Ft,NN){getSQLType(){return"boolean"}}de(xD,FN,"PgBoolean");function nc(e){return new vD(e??"")}class bD extends(VN=hn,BN=Ft,VN){constructor(t,o){super(t,"string","PgChar"),this.config.length=o.length,this.config.enumValues=o.enum}build(t){return new aC(t,this.config)}}de(bD,BN,"PgCharBuilder");class aC extends(jN=Ti,UN=Ft,jN){constructor(){super(...arguments);de(this,"length",this.config.length);de(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}de(aC,UN,"PgChar");function fY(e,t={}){const{name:o,config:u}=cs(e,t);return new bD(o,u)}class wD extends($N=hn,GN=Ft,$N){constructor(t){super(t,"string","PgCidr")}build(t){return new TD(t,this.config)}}de(wD,GN,"PgCidrBuilder");class TD extends(qN=Ti,HN=Ft,qN){getSQLType(){return"cidr"}}de(TD,HN,"PgCidr");function pY(e){return new wD(e??"")}class ED extends(WN=hn,ZN=Ft,WN){constructor(t,o,u){super(t,"custom","PgCustomColumn"),this.config.fieldConfig=o,this.config.customTypeParams=u}build(t){return new SD(t,this.config)}}de(ED,ZN,"PgCustomColumnBuilder");class SD extends(YN=Ti,XN=Ft,YN){constructor(o,u){super(o,u);de(this,"sqlName");de(this,"mapTo");de(this,"mapFrom");this.sqlName=u.customTypeParams.dataType(u.fieldConfig),this.mapTo=u.customTypeParams.toDriver,this.mapFrom=u.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(o){return typeof this.mapFrom=="function"?this.mapFrom(o):o}mapToDriverValue(o){return typeof this.mapTo=="function"?this.mapTo(o):o}}de(SD,XN,"PgCustomColumn");function F1(e){return(t,o)=>{const{name:u,config:p}=cs(t,o);return new ED(u,p,e)}}class rm extends(JN=hn,KN=Ft,JN){defaultNow(){return this.default(_t`now()`)}}de(rm,KN,"PgDateColumnBaseBuilder");class CD extends(e4=rm,QN=Ft,e4){constructor(t){super(t,"date","PgDate")}build(t){return new lC(t,this.config)}}de(CD,QN,"PgDateBuilder");class lC extends(r4=Ti,t4=Ft,r4){getSQLType(){return"date"}mapFromDriverValue(t){return typeof t=="string"?new Date(t):t}mapToDriverValue(t){return t.toISOString()}}de(lC,t4,"PgDate");class ID extends(n4=rm,i4=Ft,n4){constructor(t){super(t,"string","PgDateString")}build(t){return new cC(t,this.config)}}de(ID,i4,"PgDateStringBuilder");class cC extends(s4=Ti,o4=Ft,s4){getSQLType(){return"date"}mapFromDriverValue(t){return typeof t=="string"?t:t.toISOString().slice(0,-14)}}de(cC,o4,"PgDateString");function uy(e,t){const{name:o,config:u}=cs(e,t);return(u==null?void 0:u.mode)==="date"?new CD(o):new ID(o)}class AD extends(l4=hn,a4=Ft,l4){constructor(t){super(t,"number","PgDoublePrecision")}build(t){return new PD(t,this.config)}}de(AD,a4,"PgDoublePrecisionBuilder");class PD extends(u4=Ti,c4=Ft,u4){getSQLType(){return"double precision"}mapFromDriverValue(t){return typeof t=="string"?Number.parseFloat(t):t}}de(PD,c4,"PgDoublePrecision");function hy(e){return new AD(e??"")}class MD extends(d4=hn,h4=Ft,d4){constructor(t){super(t,"string","PgInet")}build(t){return new kD(t,this.config)}}de(MD,h4,"PgInetBuilder");class kD extends(p4=Ti,f4=Ft,p4){getSQLType(){return"inet"}}de(kD,f4,"PgInet");function mY(e){return new MD(e??"")}class RD extends(g4=cy,m4=Ft,g4){constructor(t){super(t,"number","PgInteger")}build(t){return new LD(t,this.config)}}de(RD,m4,"PgIntegerBuilder");class LD extends(y4=Ti,_4=Ft,y4){getSQLType(){return"integer"}mapFromDriverValue(t){return typeof t=="string"?Number.parseInt(t):t}}de(LD,_4,"PgInteger");function Bs(e){return new RD(e??"")}class zD extends(x4=hn,v4=Ft,x4){constructor(t,o){super(t,"string","PgInterval"),this.config.intervalConfig=o}build(t){return new DD(t,this.config)}}de(zD,v4,"PgIntervalBuilder");class DD extends(w4=Ti,b4=Ft,w4){constructor(){super(...arguments);de(this,"fields",this.config.intervalConfig.fields);de(this,"precision",this.config.intervalConfig.precision)}getSQLType(){const o=this.fields?` ${this.fields}`:"",u=this.precision?`(${this.precision})`:"";return`interval${o}${u}`}}de(DD,b4,"PgInterval");function gY(e,t={}){const{name:o,config:u}=cs(e,t);return new zD(o,u)}class OD extends(E4=hn,T4=Ft,E4){constructor(t){super(t,"json","PgJson")}build(t){return new uC(t,this.config)}}de(OD,T4,"PgJsonBuilder");class uC extends(C4=Ti,S4=Ft,C4){constructor(t,o){super(t,o)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}de(uC,S4,"PgJson");function FD(e){return new OD(e??"")}class ND extends(A4=hn,I4=Ft,A4){constructor(t){super(t,"json","PgJsonb")}build(t){return new hC(t,this.config)}}de(ND,I4,"PgJsonbBuilder");class hC extends(M4=Ti,P4=Ft,M4){constructor(t,o){super(t,o)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}de(hC,P4,"PgJsonb");function el(e){return new ND(e??"")}class BD extends(R4=hn,k4=Ft,R4){constructor(t){super(t,"array","PgLine")}build(t){return new VD(t,this.config)}}
2820de(BD,k4,"PgLineBuilder");class VD extends(z4=Ti,L4=Ft,z4){getSQLType(){return"line"}mapFromDriverValue(t){const[o,u,p]=t.slice(1,-1).split(",");return[Number.parseFloat(o),Number.parseFloat(u),Number.parseFloat(p)]}mapToDriverValue(t){return`{${t[0]},${t[1]},${t[2]}}`}}de(VD,L4,"PgLine");class UD extends(O4=hn,D4=Ft,O4){constructor(t){super(t,"json","PgLineABC")}build(t){return new jD(t,this.config)}}de(UD,D4,"PgLineABCBuilder");class jD extends(N4=Ti,F4=Ft,N4){getSQLType(){return"line"}mapFromDriverValue(t){const[o,u,p]=t.slice(1,-1).split(",");return{a:Number.parseFloat(o),b:Number.parseFloat(u),c:Number.parseFloat(p)}}mapToDriverValue(t){return`{${t.a},${t.b},${t.c}}`}}de(jD,F4,"PgLineABC");function _Y(e,t){const{name:o,config:u}=cs(e,t);return!(u!=null&&u.mode)||u.mode==="tuple"?new BD(o):new UD(o)}class GD extends(V4=hn,B4=Ft,V4){constructor(t){super(t,"string","PgMacaddr")}build(t){return new $D(t,this.config)}}de(GD,B4,"PgMacaddrBuilder");class $D extends(j4=Ti,U4=Ft,j4){getSQLType(){return"macaddr"}}de($D,U4,"PgMacaddr");function yY(e){return new GD(e??"")}class HD extends($4=hn,G4=Ft,$4){constructor(t){super(t,"string","PgMacaddr8")}build(t){return new qD(t,this.config)}}de(HD,G4,"PgMacaddr8Builder");class qD extends(q4=Ti,H4=Ft,q4){getSQLType(){return"macaddr8"}}de(qD,H4,"PgMacaddr8");function vY(e){return new HD(e??"")}class ZD extends(W4=hn,Z4=Ft,W4){constructor(t,o,u){super(t,"string","PgNumeric"),this.config.precision=o,this.config.scale=u}build(t){return new dC(t,this.config)}}de(ZD,Z4,"PgNumericBuilder");class dC extends(Y4=Ti,X4=Ft,Y4){constructor(o,u){super(o,u);de(this,"precision");de(this,"scale");this.precision=u.precision,this.scale=u.scale}mapFromDriverValue(o){return typeof o=="string"?o:String(o)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}de(dC,X4,"PgNumeric");class WD extends(J4=hn,K4=Ft,J4){constructor(t,o,u){super(t,"number","PgNumericNumber"),this.config.precision=o,this.config.scale=u}build(t){return new XD(t,this.config)}}de(WD,K4,"PgNumericNumberBuilder");class XD extends(eB=Ti,Q4=Ft,eB){constructor(o,u){super(o,u);de(this,"precision");de(this,"scale");de(this,"mapToDriverValue",String);this.precision=u.precision,this.scale=u.scale}mapFromDriverValue(o){return typeof o=="number"?o:Number(o)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}de(XD,Q4,"PgNumericNumber");class YD extends(rB=hn,tB=Ft,rB){constructor(t,o,u){super(t,"bigint","PgNumericBigInt"),this.config.precision=o,this.config.scale=u}build(t){return new KD(t,this.config)}}de(YD,tB,"PgNumericBigIntBuilder");class KD extends(nB=Ti,iB=Ft,nB){constructor(o,u){super(o,u);de(this,"precision");de(this,"scale");de(this,"mapFromDriverValue",BigInt);de(this,"mapToDriverValue",String);this.precision=u.precision,this.scale=u.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}de(KD,iB,"PgNumericBigInt");function fC(e,t){const{name:o,config:u}=cs(e,t),p=u==null?void 0:u.mode;return p==="number"?new WD(o,u==null?void 0:u.precision,u==null?void 0:u.scale):p==="bigint"?new YD(o,u==null?void 0:u.precision,u==null?void 0:u.scale):new ZD(o,u==null?void 0:u.precision,u==null?void 0:u.scale)}const Vs=fC;class JD extends(sB=hn,oB=Ft,sB){constructor(t){super(t,"array","PgPointTuple")}build(t){return new QD(t,this.config)}}de(JD,oB,"PgPointTupleBuilder");class QD extends(lB=Ti,aB=Ft,lB){getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){const[o,u]=t.slice(1,-1).split(",");return[Number.parseFloat(o),Number.parseFloat(u)]}return[t.x,t.y]}mapToDriverValue(t){return`(${t[0]},${t[1]})`}}de(QD,aB,"PgPointTuple");class eO extends(uB=hn,cB=Ft,uB){constructor(t){super(t,"json","PgPointObject")}build(t){return new tO(t,this.config)}}de(eO,cB,"PgPointObjectBuilder");class tO extends(dB=Ti,hB=Ft,dB){getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){const[o,u]=t.slice(1,-1).split(",");return{x:Number.parseFloat(o),y:Number.parseFloat(u)}}return t}mapToDriverValue(t){return`(${t.x},${t.y})`}}de(tO,hB,"PgPointObject");function xY(e,t){const{name:o,config:u}=cs(e,t);
2820return!(u!=null&&u.mode)||u.mode==="tuple"?new JD(o):new eO(o)}function bY(e){const t=[];for(let o=0;o<e.length;o+=2)t.push(Number.parseInt(e.slice(o,o+2),16));return new Uint8Array(t)}function rO(e,t){const o=new ArrayBuffer(8),u=new DataView(o);for(let p=0;p<8;p++)u.setUint8(p,e[t+p]);return u.getFloat64(0,!0)}function iO(e){const t=bY(e);let o=0;const u=t[o];o+=1;const p=new DataView(t.buffer),y=p.getUint32(o,u===1);if(o+=4,y&536870912&&(p.getUint32(o,u===1),o+=4),(y&65535)===1){const T=rO(t,o);o+=8;const s=rO(t,o);return o+=8,[T,s]}throw new Error("Unsupported geometry type")}class nO extends(pB=hn,fB=Ft,pB){constructor(t){super(t,"array","PgGeometry")}build(t){return new oO(t,this.config)}}de(nO,fB,"PgGeometryBuilder");class oO extends(gB=Ti,mB=Ft,gB){getSQLType(){return"geometry(point)"}mapFromDriverValue(t){return iO(t)}mapToDriverValue(t){return`point(${t[0]} ${t[1]})`}}de(oO,mB,"PgGeometry");class sO extends(yB=hn,_B=Ft,yB){constructor(t){super(t,"json","PgGeometryObject")}build(t){return new aO(t,this.config)}}de(sO,_B,"PgGeometryObjectBuilder");class aO extends(xB=Ti,vB=Ft,xB){getSQLType(){return"geometry(point)"}mapFromDriverValue(t){const o=iO(t);return{x:o[0],y:o[1]}}mapToDriverValue(t){return`point(${t.x} ${t.y})`}}de(aO,vB,"PgGeometryObject");function im(e,t){const{name:o,config:u}=cs(e,t);return!(u!=null&&u.mode)||u.mode==="tuple"?new nO(o):new sO(o)}class lO extends(wB=hn,bB=Ft,wB){constructor(t,o){super(t,"number","PgReal"),this.config.length=o}build(t){return new cO(t,this.config)}}de(lO,bB,"PgRealBuilder");class cO extends(EB=Ti,TB=Ft,EB){constructor(o,u){super(o,u);de(this,"mapFromDriverValue",o=>typeof o=="string"?Number.parseFloat(o):o)}getSQLType(){return"real"}}de(cO,TB,"PgReal");function wY(e){return new lO(e??"")}class uO extends(CB=hn,SB=Ft,CB){constructor(t){super(t,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new hO(t,this.config)}}de(uO,SB,"PgSerialBuilder");class hO extends(AB=Ti,IB=Ft,AB){getSQLType(){return"serial"}}de(hO,IB,"PgSerial");function Rh(e){return new uO(e??"")}class dO extends(MB=cy,PB=Ft,MB){constructor(t){super(t,"number","PgSmallInt")}build(t){return new fO(t,this.config)}}de(dO,PB,"PgSmallIntBuilder");class fO extends(RB=Ti,kB=Ft,RB){constructor(){super(...arguments);de(this,"mapFromDriverValue",o=>typeof o=="string"?Number(o):o)}getSQLType(){return"smallint"}}de(fO,kB,"PgSmallInt");function TY(e){return new dO(e??"")}class pO extends(zB=hn,LB=Ft,zB){constructor(t){super(t,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new mO(t,this.config)}}de(pO,LB,"PgSmallSerialBuilder");class mO extends(OB=Ti,DB=Ft,OB){getSQLType(){return"smallserial"}}de(mO,DB,"PgSmallSerial");function EY(e){return new pO(e??"")}class gO extends(NB=hn,FB=Ft,NB){constructor(t,o){super(t,"string","PgText"),this.config.enumValues=o.enum}build(t){return new _O(t,this.config)}}de(gO,FB,"PgTextBuilder");class _O extends(VB=Ti,BB=Ft,VB){constructor(){super(...arguments);de(this,"enumValues",this.config.enumValues)}getSQLType(){return"text"}}de(_O,BB,"PgText");function ut(e,t={}){const{name:o,config:u}=cs(e,t);return new gO(o,u)}class yO extends(jB=rm,UB=Ft,jB){constructor(t,o,u){super(t,"string","PgTime"),this.withTimezone=o,this.precision=u,this.config.withTimezone=o,this.config.precision=u}build(t){return new pC(t,this.config)}}de(yO,UB,"PgTimeBuilder");class pC extends($B=Ti,GB=Ft,$B){constructor(o,u){super(o,u);de(this,"withTimezone");de(this,"precision");this.withTimezone=u.withTimezone,this.precision=u.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}de(pC,GB,"PgTime");function SY(e,t={}){const{name:o,config:u}=cs(e,t);return new yO(o,u.withTimezone??!1,u.precision)}class vO extends(qB=rm,HB=Ft,qB){constructor(t,o,u){super(t,"date","PgTimestamp"),this.config.withTimezone=o,this.config.precision=u}build(t){return new mC(t,this.config)}}de(vO,HB,"PgTimestampBuilder");class mC extends(WB=Ti,ZB=Ft,WB){constructor(o,u){super(o,u);de(this,"withTimezone");de(this,"precision");de(this,"mapToDriverValue",o=>o.toISOString());this.withTimezone=u.withTimezone,this.precision=u.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}
2820${this.withTimezone?" with time zone":""}`}mapFromDriverValue(o){return typeof o=="string"?new Date(this.withTimezone?o:o+"+0000"):o}}de(mC,ZB,"PgTimestamp");class xO extends(YB=rm,XB=Ft,YB){constructor(t,o,u){super(t,"string","PgTimestampString"),this.config.withTimezone=o,this.config.precision=u}build(t){return new gC(t,this.config)}}de(xO,XB,"PgTimestampStringBuilder");class gC extends(JB=Ti,KB=Ft,JB){constructor(o,u){super(o,u);de(this,"withTimezone");de(this,"precision");this.withTimezone=u.withTimezone,this.precision=u.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(o){if(typeof o=="string")return o;const u=o.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone){const p=o.getTimezoneOffset(),y=p<=0?"+":"-";return`${u}${y}${Math.floor(Math.abs(p)/60).toString().padStart(2,"0")}`}return u}}de(gC,KB,"PgTimestampString");function Lh(e,t={}){const{name:o,config:u}=cs(e,t);return(u==null?void 0:u.mode)==="string"?new xO(o,u.withTimezone??!1,u.precision):new vO(o,(u==null?void 0:u.withTimezone)??!1,u==null?void 0:u.precision)}class bO extends(eV=hn,QB=Ft,eV){constructor(t){super(t,"string","PgUUID")}defaultRandom(){return this.default(_t`gen_random_uuid()`)}build(t){return new N1(t,this.config)}}de(bO,QB,"PgUUIDBuilder");class N1 extends(rV=Ti,tV=Ft,rV){getSQLType(){return"uuid"}}de(N1,tV,"PgUUID");function Xo(e){return new bO(e??"")}class wO extends(nV=hn,iV=Ft,nV){constructor(t,o){super(t,"string","PgVarchar"),this.config.length=o.length,this.config.enumValues=o.enum}build(t){return new _C(t,this.config)}}de(wO,iV,"PgVarcharBuilder");class _C extends(sV=Ti,oV=Ft,sV){constructor(){super(...arguments);de(this,"length",this.config.length);de(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}de(_C,oV,"PgVarchar");function yn(e,t={}){const{name:o,config:u}=cs(e,t);return new wO(o,u)}class TO extends(lV=hn,aV=Ft,lV){constructor(t,o){super(t,"string","PgBinaryVector"),this.config.dimensions=o.dimensions}build(t){return new EO(t,this.config)}}de(TO,aV,"PgBinaryVectorBuilder");class EO extends(uV=Ti,cV=Ft,uV){constructor(){super(...arguments);de(this,"dimensions",this.config.dimensions)}getSQLType(){return`bit(${this.dimensions})`}}de(EO,cV,"PgBinaryVector");function CY(e,t){const{name:o,config:u}=cs(e,t);return new TO(o,u)}class SO extends(dV=hn,hV=Ft,dV){constructor(t,o){super(t,"array","PgHalfVector"),this.config.dimensions=o.dimensions}build(t){return new CO(t,this.config)}}de(SO,hV,"PgHalfVectorBuilder");class CO extends(pV=Ti,fV=Ft,pV){constructor(){super(...arguments);de(this,"dimensions",this.config.dimensions)}getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(o){return JSON.stringify(o)}mapFromDriverValue(o){return o.slice(1,-1).split(",").map(u=>Number.parseFloat(u))}}de(CO,fV,"PgHalfVector");function IY(e,t){const{name:o,config:u}=cs(e,t);return new SO(o,u)}class IO extends(gV=hn,mV=Ft,gV){constructor(t,o){super(t,"string","PgSparseVector"),this.config.dimensions=o.dimensions}build(t){return new AO(t,this.config)}}de(IO,mV,"PgSparseVectorBuilder");class AO extends(yV=Ti,_V=Ft,yV){constructor(){super(...arguments);de(this,"dimensions",this.config.dimensions)}getSQLType(){return`sparsevec(${this.dimensions})`}}de(AO,_V,"PgSparseVector");function AY(e,t){const{name:o,config:u}=cs(e,t);return new IO(o,u)}class PO extends(xV=hn,vV=Ft,xV){constructor(t,o){super(t,"array","PgVector"),this.config.dimensions=o.dimensions}build(t){return new MO(t,this.config)}}de(PO,vV,"PgVectorBuilder");class MO extends(wV=Ti,bV=Ft,wV){constructor(){super(...arguments);de(this,"dimensions",this.config.dimensions)}getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(o){return JSON.stringify(o)}mapFromDriverValue(o){return o.slice(1,-1).split(",").map(u=>Number.parseFloat(u))}}de(MO,bV,"PgVector");function PY(e,t){const{name:o,config:u}=cs(e,t);return new PO(o,u)}function MY(){return{bigint:tm,bigserial:dY,boolean:nc,char:fY,cidr:pY,customType:F1,date:uy,doublePrecision:hy,inet:mY,integer:Bs,interval:gY,json:FD,jsonb:el,line:_Y,macaddr:yY,macaddr8:vY,numeric:fC,point:xY,geometry:im,real:wY,serial:Rh,smallint:TY,smallseri
2820al:EY,text:ut,time:SY,timestamp:Lh,uuid:Xo,varchar:yn,bit:CY,halfvec:IY,sparsevec:AY,vector:PY}}const yC=Symbol.for("drizzle:PgInlineForeignKeys"),kO=Symbol.for("drizzle:EnableRLS");class sa extends(AV=ui,IV=Ft,CV=yC,SV=kO,EV=ui.Symbol.ExtraConfigBuilder,TV=ui.Symbol.ExtraConfigColumns,AV){constructor(){super(...arguments);de(this,CV,[]);de(this,SV,!1);de(this,EV);de(this,TV,{})}}de(sa,IV,"PgTable"),de(sa,"Symbol",Object.assign({},ui.Symbol,{InlineForeignKeys:yC,EnableRLS:kO}));function RO(e,t,o,u,p=e){const y=new sa(e,u,p),T=typeof t=="function"?t(MY()):t,s=Object.fromEntries(Object.entries(T).map(([B,H])=>{const $=H;$.setName(B);const te=$.build(y);return y[yC].push(...$.buildForeignKeys(te,y)),[B,te]})),M=Object.fromEntries(Object.entries(T).map(([B,H])=>{const $=H;$.setName(B);const te=$.buildExtraConfigColumn(y);return[B,te]})),L=Object.assign(y,s);return L[ui.Symbol.Columns]=s,L[ui.Symbol.ExtraConfigColumns]=M,o&&(L[sa.Symbol.ExtraConfigBuilder]=o),Object.assign(L,{enableRLS:()=>(L[sa.Symbol.EnableRLS]=!0,L)})}const Us=(e,t,o)=>RO(e,t,o,void 0);function kY(...e){return e[0].columns?new vC(e[0].columns,e[0].name):new vC(e)}PV=Ft;class vC{constructor(t,o){de(this,"columns");de(this,"name");this.columns=t,this.name=o}build(t){return new LO(t,this.columns,this.name)}}de(vC,PV,"PgPrimaryKeyBuilder"),MV=Ft;class LO{constructor(t,o,u){de(this,"columns");de(this,"name");this.table=t,this.columns=o,this.name=u}getName(){return this.name??`${this.table[sa.Symbol.Name]}_${this.columns.map(t=>t.name).join("_")}_pk`}}de(LO,MV,"PgPrimaryKey");function ka(e,t){return cY(t)&&!iD(e)&&!hr(e,em)&&!hr(e,ay)&&!hr(e,ss)&&!hr(e,ui)&&!hr(e,kh)?new em(e,t):e}const zO=(e,t)=>_t`${e} = ${ka(t,e)}`,RY=(e,t)=>_t`${e} <> ${ka(t,e)}`;function xC(...e){const t=e.filter(o=>o!==void 0);if(t.length!==0)return t.length===1?new _i(t):new _i([new ls("("),_t.join(t,new ls(" and ")),new ls(")")])}function LY(...e){const t=e.filter(o=>o!==void 0);if(t.length!==0)return t.length===1?new _i(t):new _i([new ls("("),_t.join(t,new ls(" or ")),new ls(")")])}function zY(e){return _t`not ${e}`}const DY=(e,t)=>_t`${e} > ${ka(t,e)}`,OY=(e,t)=>_t`${e} >= ${ka(t,e)}`,FY=(e,t)=>_t`${e} < ${ka(t,e)}`,NY=(e,t)=>_t`${e} <= ${ka(t,e)}`;function BY(e,t){return Array.isArray(t)?t.length===0?_t`false`:_t`${e} in ${t.map(o=>ka(o,e))}`:_t`${e} in ${ka(t,e)}`}function VY(e,t){return Array.isArray(t)?t.length===0?_t`true`:_t`${e} not in ${t.map(o=>ka(o,e))}`:_t`${e} not in ${ka(t,e)}`}function UY(e){return _t`${e} is null`}function jY(e){return _t`${e} is not null`}function GY(e){return _t`exists ${e}`}function $Y(e){return _t`not exists ${e}`}function HY(e,t,o){return _t`${e} between ${ka(t,e)} and ${ka(o,e)}`}function qY(e,t,o){return _t`${e} not between ${ka(t,e)} and ${ka(o,e)}`}function ZY(e,t){return _t`${e} like ${t}`}function WY(e,t){return _t`${e} not like ${t}`}function XY(e,t){return _t`${e} ilike ${t}`}function YY(e,t){return _t`${e} not ilike ${t}`}function KY(e){return _t`${e} asc`}function JY(e){return _t`${e} desc`}kV=Ft;class bC{constructor(t,o,u){de(this,"referencedTableName");de(this,"fieldName");this.sourceTable=t,this.referencedTable=o,this.relationName=u,this.referencedTableName=o[ui.Symbol.Name]}}de(bC,kV,"Relation");const pb=class pb extends(LV=bC,RV=Ft,LV){constructor(t,o,u,p){super(t,o,u==null?void 0:u.relationName),this.config=u,this.isNullable=p}withFieldName(t){const o=new pb(this.sourceTable,this.referencedTable,this.config,this.isNullable);return o.fieldName=t,o}};de(pb,RV,"One");let dy=pb;const mb=class mb extends(DV=bC,zV=Ft,DV){constructor(t,o,u){super(t,o,u==null?void 0:u.relationName),this.config=u}withFieldName(t){const o=new mb(this.sourceTable,this.referencedTable,this.config);return o.fieldName=t,o}};de(mb,zV,"Many");let wC=mb;function QY(){return{and:xC,between:HY,eq:zO,exists:GY,gt:DY,gte:OY,ilike:XY,inArray:BY,isNull:UY,isNotNull:jY,like:ZY,lt:FY,lte:NY,ne:RY,not:zY,notBetween:qY,notExists:$Y,notLike:WY,notIlike:YY,notInArray:VY,or:LY,sql:_t}}function eK(){return{sql:_t,asc:KY,desc:JY}}function tK(e,t,o){if(hr(o,dy)&&o.config)return{fields:o.config.fields,references:o.config.references};const u=t[oC(o.referencedTable)];if(!u)throw new Error(`Table "${o.referencedTable[ui.Symbol.Name]}" not found in schema`);const p=e[u];if(!p)throw new Error(`Table "${u}" not found in schema`);const y=o.sourceTable,T=t[oC(y)];if(!T)throw new Error(`Table "${y[ui.Symbol.Name]}" not found in schema`);const s=[];for(const M of Object.values(p.relations))(o.relationName&&o!==M&&M.relationName===o.relationName||!o.relationName&&M.referencedTable===o.sourceTable)&&s.push(M);if(s.length>1)throw o.relationName?new Error(`There are multiple relations with 
2820name "${o.relationName}" in table "${u}"`):new Error(`There are multiple relations between "${u}" and "${o.sourceTable[ui.Symbol.Name]}". Please specify relation name`);if(s[0]&&hr(s[0],dy)&&s[0].config)return{fields:s[0].config.references,references:s[0].config.fields};throw new Error(`There is not enough information to infer relation "${T}.${o.fieldName}"`)}function rK(e,t){return`${e[Oc]}_${t.join("_")}_unique`}class B1 extends(FV=ss,OV=Ft,FV){constructor(t,o){o.uniqueName||(o.uniqueName=rK(t,[o.name])),super(t,o),this.table=t}}de(B1,OV,"MySqlColumn");class DO extends(BV=B1,NV=Ft,BV){constructor(){super(...arguments);de(this,"length",this.config.length);de(this,"enumValues",this.config.enum)}getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}de(DO,NV,"MySqlChar");class OO extends(UV=B1,VV=Ft,UV){constructor(){super(...arguments);de(this,"length",this.config.length)}mapFromDriverValue(o){if(typeof o=="string")return o;if(Buffer.isBuffer(o))return o.toString();const u=[];for(const p of o)u.pu
2820sh(p===49?"1":"0");return u.join("")}getSQLType(){return this.length===void 0?"varbinary":`varbinary(${this.length})`}}de(OO,VV,"MySqlVarBinary");class FO extends(GV=B1,jV=Ft,GV){constructor(){super(...arguments);de(this,"length",this.config.length);de(this,"enumValues",this.config.enum)}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}de(FO,jV,"MySqlVarChar"),$V=Ft;const gb=class gb{constructor(t){de(this,"config");this.config={...t}}get(t,o){if(o==="_")return{...t._,selectedFields:new Proxy(t._.selectedFields,this)};if(o===as)return{...t[as],selectedFields:new Proxy(t[as].selectedFields,this)};if(typeof o=="symbol")return t[o];const p=(hr(t,oa)?t._.selectedFields:hr(t,kh)?t[as].selectedFields:t)[o];if(hr(p,_i.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!p.isSelectionField)return p.sql;const y=p.clone();return y.isSelectionField=!0,y}if(hr(p,_i)){if(this.config.sqlBehavior==="sql")return p;throw new Error(`You tried to reference "${o}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return hr(p,ss)?this.config.alias?new Proxy(p,new ly(new Proxy(p.table,new L1(this.config.alias,this.config.replaceOriginalName??!1)))):p:typeof p!="object"||p===null?p:new Proxy(p,new gb(this.config))}};de(gb,$V,"SelectionProxyHandler");let js=gb;function iK(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(o=>o.toLowerCase()).join("_")}function nK(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((o,u,p)=>{const y=p===0?u.toLowerCase():`${u[0].toUpperCase()}${u.slice(1)}`;return o+y},"")}function oK(e){return e}HV=Ft;class NO{constructor(t){de(this,"cache",{});de(this,"cachedTables",{});de(this,"convert");this.convert=t==="snake_case"?iK:t==="camelCase"?nK:oK}getColumnCasing(t){if(!t.keyAsName)return t.name;const o=t.table[ui.Symbol.Schema]??"public",u=t.table[ui.Symbol.OriginalName],p=`${o}.${u}.${t.name}`;return this.cache[p]||this.cacheTable(t.table),this.cache[p]}cacheTable(t){const o=t[ui.Symbol.Schema]??"public",u=t[ui.Symbol.OriginalName],p=`${o}.${u}`;if(!this.cachedTables[p]){for(const y of Object.values(t[ui.Symbol.Columns])){const T=`${p}.${y.name}`;this.cache[T]=this.convert(y.name)}this.cachedTables[p]=!0}}clearCache(){this.cache={},this.cachedTables={}}}de(NO,HV,"CasingCache"),qV=Ft;class BO{getSelectedFields(){return this._.selectedFields}}de(BO,qV,"TypedQueryBuilder"),ZV=Ft;class TC{constructor(t,o){this.unique=t,this.name=o}on(...t){return new V1(t.map(o=>{if(hr(o,_i))return o;o=o;const u=new A1(o.name,!!o.keyAsName,o.columnType,o.indexConfig);return o.indexConfig=JSON.parse(JSON.stringify(o.defaultConfig)),u}),this.unique,!1,this.name)}onOnly(...t){return new V1(t.map(o=>{if(hr(o,_i))return o;o=o;const u=new A1(o.name,!!o.keyAsName,o.columnType,o.indexConfig);return o.indexConfig=o.defaultConfig,u}),this.unique,!0,this.name)}using(t,...o){return new V1(o.map(u=>{if(hr(u,_i))return u;u=u;const p=new A1(u.name,!!u.keyAsName,u.columnType,u.indexConfig);return u.indexConfig=JSON.parse(JSON.stringify(u.defaultConfig)),p}),this.unique,!0,this.name,t)}}de(TC,ZV,"PgIndexBuilderOn"),WV=Ft;class V1{constructor(t,o,u,p,y="btree"){de(this,"config");this.config={name:p,columns:t,unique:o,only:u,method:y}}concurrently(){return this.config.concurrently=!0,this}with(t){return this.config.with=t,this}where(t){return this.config.where=t,this}build(t){return new VO(this.config,t)}}de(V1,WV,"PgIndexBuilder"),XV=Ft;class VO{constructor(t,o){de(this,"config");this.config={...t,table:o}}}de(VO,XV,"PgIndex");function zh(e){return new TC(!1,e)}function EC(e){return new TC(!0,e)}const UO=Symbol.for("drizzle:PgViewConfig");class fy extends(KV=kh,YV=Ft,KV){}de(fy,YV,"PgViewBase"),JV=Ft;class U1{constructor(t){de(this,"casing");this.casing=new NO(t==null?void 0:t.casing)}async migrate(t,o,u){const p=typeof u=="string"?"__drizzle_migrations":u.migrationsTable??"__drizzle_migrations",y=typeof u=="string"?"drizzle":u.migrationsSchema??"drizzle",T=_t`
2821			CREATE TABLE IF NOT EXISTS ${_t.identifier(y)}.${_t.identifier(p)} (
2822				id SERIAL PRIMARY KEY,
2823				hash text NOT NULL,
2824				created_at bigint
2825			)
2826		`;await o.execute(_t`CREATE SCHEMA IF NOT EXISTS ${_t.identifier(y)}`),await o.execute(T);const M=(await o.all(_t`select id, hash, created_at from ${_t.identifier(y)}.${_t.identifier(p)} order by created_at desc limit 1`))[0];await o.transaction(async L=>{for await(const B of t)if(!M||Number(M.created_at)<B.folderMillis){for(const H of B.sql)await L.execute(_t.raw(H));await L.execute(_t`insert into ${_t.identifier(y)}.${_t.identifier(p)} ("hash", "created_at") values(${B.hash}, ${B.folderMillis})`)}})}escapeName(t){return`"${t.replace(/"/g,'""')}"`}escapeParam(t){return`$${t+1}`}escapeString(t){return`'${t.replace(/'/g,"''")}'`}buildWithCTE(t){if(!(t!=null&&t.length))return;const o=[_t`with `];for(const[u,p]of t.entries())o.push(_t`${_t.identifier(p._.alias)} as (${p._.sql})`),u<t.length-1&&o.push(_t`, `);return o.push(_t` `),_t.join(o)}buildDeleteQuery({table:t,where:o,returning:u,withList:p}){const y=this.buildWithCTE(p),T=u?_t` returning ${this.buildSelection(u,{isSingleTable:!0})}`:void 0,s=o?_t` where ${o}`:void 0;return _t`${y}delete from ${t}${s}${T}`}buildUpdateSet(t,o){const u=t[ui.Symbol.Columns],p=Object.keys(u).filter(T=>{var s;return o[T]!==void 0||((s=u[T])==null?void 0:s.onUpdateFn)!==void 0}),y=p.length;return _t.join(p.flatMap((T,s)=>{var $;const M=u[T],L=($=M.onUpdateFn)==null?void 0:$.call(M),B=o[T]??(hr(L,_i)?L:_t.param(L,M)),H=_t`${_t.identifier(this.casing.getColumnCasing(M))} = ${B}
2826`;return s<y-1?[H,_t.raw(", ")]:[H]}))}buildUpdateQuery({table:t,set:o,where:u,returning:p,withList:y,from:T,joins:s}){const M=this.buildWithCTE(y),L=t[sa.Symbol.Name],B=t[sa.Symbol.Schema],H=t[sa.Symbol.OriginalName],$=L===H?void 0:L,te=_t`${B?_t`${_t.identifier(B)}.`:void 0}${_t.identifier(H)}${$&&_t` ${_t.identifier($)}`}`,xe=this.buildUpdateSet(t,o),pe=T&&_t.join([_t.raw(" from "),this.buildFromTable(T)]),Ne=this.buildJoins(s),_e=p?_t` returning ${this.buildSelection(p,{isSingleTable:!T})}`:void 0,ie=u?_t` where ${u}`:void 0;return _t`${M}update ${te} set ${xe}${pe}${Ne}${ie}${_e}`}buildSelection(t,{isSingleTable:o=!1}={}){const u=t.length,p=t.flatMap(({field:y},T)=>{const s=[];if(hr(y,_i.Aliased)&&y.isSelectionField)s.push(_t.identifier(y.fieldAlias));else if(hr(y,_i.Aliased)||hr(y,_i)){const M=hr(y,_i.Aliased)?y.sql:y;o?s.push(new _i(M.queryChunks.map(L=>hr(L,Ti)?_t.identifier(this.casing.getColumnCasing(L)):L))):s.push(M),hr(y,_i.Aliased)&&s.push(_t` as ${_t.identifier(y.fieldAlias)}`)}else if(hr(y,ss))o?s.push(_t.identifier(this.casing.getColumnCasing(y))):s.push(y);else if(hr(y,oa)){const M=Object.entries(y._.selectedFields);if(M.length===1){const L=M[0][1],B=hr(L,_i)?L.decoder:hr(L,ss)?{mapFromDriverValue:H=>L.mapFromDriverValue(H)}:L.sql.decoder;B&&(y._.sql.decoder=B)}s.push(y)}return T<u-1&&s.push(_t`, `),s});return _t.join(p)}buildJoins(t){if(!t||t.length===0)return;const o=[];for(const[u,p]of t.entries()){u===0&&o.push(_t` `);const y=p.table,T=p.lateral?_t` lateral`:void 0,s=p.on?_t` on ${p.on}`:void 0;if(hr(y,sa)){const M=y[sa.Symbol.Name],L=y[sa.Symbol.Schema],B=y[sa.Symbol.OriginalName],H=M===B?void 0:p.alias;o.push(_t`${_t.raw(p.joinType)} join${T} ${L?_t`${_t.identifier(L)}.`:void 0}${_t.identifier(B)}${H&&_t` ${_t.identifier(H)}`}${s}`)}else if(hr(y,kh)){const M=y[as].name,L=y[as].schema,B=y[as].originalName,H=M===B?void 0:p.alias;o.push(_t`${_t.raw(p.joinType)} join${T} ${L?_t`${_t.identifier(L)}.`:void 0}${_t.identifier(B)}${H&&_t` ${_t.identifier(H)}`}${s}`)}else o.push(_t`${_t.raw(p.joinType)} join${T} ${y}${s}`);u<t.length-1&&o.push(_t` `)}return _t.join(o)}buildFromTable(t){if(hr(t,ui)&&t[ui.Symbol.IsAlias]){let o=_t`${_t.identifier(t[ui.Symbol.OriginalName])}`;return t[ui.Symbol.Schema]&&(o=_t`${_t.identifier(t[ui.Symbol.Schema])}.${o}`),_t`${o} ${_t.identifier(t[ui.Symbol.Name])}`}return t}buildSelectQuery({withList:t,fields:o,fieldsFlat:u,where:p,having:y,table:T,joins:s,orderBy:M,groupBy:L,limit:B,offset:H,lockingClause:$,distinct:te,setOperators:xe}){const pe=u??D1(o);for(const Je of pe)if(hr(Je.field,ss)&&k1(Je.field.table)!==(hr(T,oa)?T._.alias:hr(T,fy)?T[as].name:hr(T,_i)?void 0:k1(T))&&!(ze=>s==null?void 0:s.some(({alias:He})=>He===(ze[ui.Symbol.IsAlias]?k1(ze):ze[ui.Symbol.BaseName])))(Je.field.table)){const ze=k1(Je.field.table);throw new Error(`Your "${Je.path.join("->")}" field references a column "${ze}"."${Je.field.name}", but the table "${ze}" is not part of the query! Did you forget to join it?`)}const Ne=!s||s.length===0,_e=this.buildWithCTE(t);let ie;te&&(ie=te===!0?_t` distinct`:_t` distinct on (${_t.join(te.on,_t`, `)})`);const ke=this.buildSelection(pe,{isSingleTable:Ne}),ot=this.buildFromTable(T),et=this.buildJoins(s),wt=p?_t` where ${p}`:void 0,It=y?_t` having ${y}`:void 0;let K;M&&M.length>0&&(K=_t` order by ${_t.join(M,_t`, `)}`);let ve;L&&L.length>0&&(ve=_t` group by ${_t.join(L,_t`, `)}`);const Ae=typeof B=="object"||typeof B=="number"&&B>=0?_t` limit ${B}`:void 0,Ye=H?_t` offset ${H}`:void 0,Be=_t.empty();if($){const Je=_t` for ${_t.raw($.strength)}`;$.config.of&&Je.append(_t` of ${_t.join(Array.isArray($.config.of)?$.config.of:[$.config.of],_t`, `)}`),$.config.noWait?Je.append(_t` nowait`):$.config.skipLocked&&Je.append(_t` skip locked`),Be.append(Je)}const Fe=_t`${_e}select${ie} ${ke} from ${ot}${et}${wt}${ve}${It}${K}${Ae}${Ye}${Be}`;return xe.length>0?this.buildSetOperations(Fe,xe):Fe}buildSetOperations(t,o){const[u,...p]=o;if(!u)throw new Error("Cannot pass undefined values to any set operator");return p.length===0?this.buildSetOperationQuery({leftSelect:t,setOperator:u}
2826):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:t,setOperator:u}),p)}buildSetOperationQuery({leftSelect:t,setOperator:{type:o,isAll:u,rightSelect:p,limit:y,orderBy:T,offset:s}}){const M=_t`(${t.getSQL()}) `,L=_t`(${p.getSQL()})`;let B;if(T&&T.length>0){const xe=[];for(const pe of T)if(hr(pe,Ti))xe.push(_t.identifier(pe.name));else if(hr(pe,_i)){for(let Ne=0;Ne<pe.queryChunks.length;Ne++){const _e=pe.queryChunks[Ne];hr(_e,Ti)&&(pe.queryChunks[Ne]=_t.identifier(_e.name))}xe.push(_t`${pe}`)}else xe.push(_t`${pe}`);B=_t` order by ${_t.join(xe,_t`, `)} `}const H=typeof y=="object"||typeof y=="number"&&y>=0?_t` limit ${y}`:void 0,$=_t.raw(`${o} ${u?"all ":""}`),te=s?_t` offset ${s}`:void 0;return _t`${M}${$}${L}${B}${H}${te}`}buildInsertQuery({table:t,values:o,onConflict:u,returning:p,withList:y,select:T,overridingSystemValue_:s}){const M=[],L=t[ui.Symbol.Columns],B=Object.entries(L).filter(([_e,ie])=>!ie.shouldDisableInsert()),H=B.map(([,_e])=>_t.identifier(this.casing.getColumnCasing(_e)));if(T){const _e=o;hr(_e,_i)?M.push(_e):M.push(_e.getSQL())}else{const _e=o;M.push(_t.raw("values "));for(const[ie,ke]of _e.entries()){const ot=[];for(const[et,wt]of B){const It=ke[et];if(It===void 0||hr(It,em)&&It.value===void 0)if(wt.defaultFn!==void 0){const K=wt.defaultFn(),ve=hr(K,_i)?K:_t.param(K,wt);ot.push(ve)}else if(!wt.default&&wt.onUpdateFn!==void 0){const K=wt.onUpdateFn(),ve=hr(K,_i)?K:_t.param(K,wt);ot.push(ve)}else ot.push(_t`default`);else ot.push(It)}M.push(ot),ie<_e.length-1&&M.push(_t`, `)}}const $=this.buildWithCTE(y),te=_t.join(M),xe=p?_t` returning ${this.buildSelection(p,{isSingleTable:!0})}`:void 0,pe=u?_t` on conflict ${u}`:void 0,Ne=s===!0?_t`overriding system value `:void 0;return _t`${$}insert into ${t} ${H} ${Ne}${te}${pe}${xe}`}buildRefreshMaterializedViewQuery({view:t,concurrently:o,withNoData:u}){const p=o?_t` concurrently`:void 0,y=u?_t` with no data`:void 0;return _t`refresh materialized view${p} ${t}${y}`}prepareTyping(t){return hr(t,hC)||hr(t,uC)?"json":hr(t,dC)?"decimal":hr(t,pC)?"time":hr(t,mC)||hr(t,gC)?"timestamp":hr(t,lC)||hr(t,cC)?"date":hr(t,N1)?"uuid":"none"}sqlToQuery(t,o){return t.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:o})}buildRelationalQueryWithoutPK({fullSchema:t,schema:o,tableNamesMap:u,table:p,tableConfig:y,queryConfig:T,tableAlias:s,nestedQueryRelation:M,joinOn:L}){let B=[],H,$,te=[],xe;const pe=[];if(T===!0)B=Object.entries(y.columns).map(([ie,ke])=>({dbKey:ke.name,tsKey:ie,field:Eu(ke,s),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{const _e=Object.fromEntries(Object.entries(y.columns).map(([It,K])=>[It,Eu(K,s)]));if(T.where){const It=typeof T.where=="function"?T.where(_e,QY()):T.where;xe=It&&z1(It,s)}const ie=[];let ke=[];if(T.columns){let It=!1;for(const[K,ve]of Object.entries(T.columns))ve!==void 0&&K in y.columns&&(!It&&ve===!0&&(It=!0),ke.push(K));ke.length>0&&(ke=It?ke.filter(K=>{var ve;return((ve=T.columns)==null?void 0:ve[K])===!0}):Object.keys(y.columns).filter(K=>!ke.includes(K)))}else ke=Object.keys(y.columns);for(const It of ke){const K=y.columns[It];ie.push({tsKey:It,value:K})}let ot=[];T.with&&(ot=Object.entries(T.with).filter(It=>!!It[1]).map(([It,K])=>({tsKey:It,queryConfig:K,relation:y.relations[It]})));let et;if(T.extras){et=typeof T.extras=="function"?T.extras(_e,{sql:_t}):T.extras;for(const[It,K]of Object.entries(et))ie.push({tsKey:It,value:sD(K,s)})}for(const{tsKey:It,value:K}of ie)B.push({dbKey:hr(K,_i.Aliased)?K.fieldAlias:y.columns[It].name,tsKey:It,field:hr(K,ss)?Eu(K,s):K,relationTableTsKey:void 0,isJson:!1,selection:[]});let wt=typeof T.orderBy=="function"?T.orderBy(_e,eK()):T.orderBy??[];Array.isArray(wt)||(wt=[wt]),te=wt.map(It=>hr(It,ss)?Eu(It,s):z1(It,s)),H=T.limit,$=T.offset;for(const{tsKey:It,queryConfig:K,relation:ve}of ot){const Ae=tK(o,u,ve),Ye=oC(ve.referencedTable),Be=u[Ye],Fe=`${s}_${It}`,Je=xC(...Ae.fields.map((tt,Oe)=>zO(Eu(Ae.references[Oe],Fe),Eu(tt,s)))),ze=this.buildRelationalQueryWithoutPK({fullSchema:t,schema:o,tableNamesMap:u,table:t[Be],tableConfig:o[Be],queryConfig:hr(ve,dy)?K===!0?{limit:1}:{...K,limit:1}:K,tableAlias:Fe,joinOn:Je,nestedQueryRelation:ve}),He=_t`${_t.identifier(Fe)}.${_t.identifier("data")}`.as(It);pe.push({on:_t`true`,table:new oa(ze.sql,{},Fe),alias:Fe,joinType:"left",lateral:!0}),B.push({dbKey:It,tsKey:It,field:He,relationTableTsKey:Be,isJson:!0,selection:ze.selection})}}if(B.length===0)throw new aD({message:`No fields selected for table "${y.tsName}" ("${s}")`});let Ne;if(xe=xC(L,xe),M){let _e=_t`json_build_array(${_t.join(B.map(({field:ot,tsKey:et,isJson:wt})=>wt?_t`${_t.identifier(`${s}_${et}`)}.${_t.identifier("data")}
2826`:hr(ot,_i.Aliased)?ot.sql:ot),_t`, `)})`;hr(M,wC)&&(_e=_t`coalesce(json_agg(${_e}${te.length>0?_t` order by ${_t.join(te,_t`, `)}`:void 0}), '[]'::json)`);const ie=[{dbKey:"data",tsKey:"data",field:_e.as("data"),isJson:!0,relationTableTsKey:y.tsName,selection:B}];H!==void 0||$!==void 0||te.length>0?(Ne=this.buildSelectQuery({table:sC(p,s),fields:{},fieldsFlat:[{path:[],field:_t.raw("*")}],where:xe,limit:H,offset:$,orderBy:te,setOperators:[]}),xe=void 0,H=void 0,$=void 0,te=[]):Ne=sC(p,s),Ne=this.buildSelectQuery({table:hr(Ne,sa)?Ne:new oa(Ne,{},s),fields:{},fieldsFlat:ie.map(({field:ot})=>({path:[],field:hr(ot,ss)?Eu(ot,s):ot})),joins:pe,where:xe,limit:H,offset:$,orderBy:te,setOperators:[]})}else Ne=this.buildSelectQuery({table:sC(p,s),fields:{},fieldsFlat:B.map(({field:_e})=>({path:[],field:hr(_e,ss)?Eu(_e,s):_e})),joins:pe,where:xe,limit:H,offset:$,orderBy:te,setOperators:[]});return{tableTsKey:y.tsName,sql:Ne,selection:B}}}de(U1,JV,"PgDialect"),QV=Ft;class tf{constructor(t){de(this,"fields");de(this,"session");de(this,"dialect");de(this,"withList",[]);de(this,"distinct");de(this,"authToken");this.fields=t.fields,this.session=t.session,this.dialect=t.dialect,t.withList&&(this.withList=t.withList),this.distinct=t.distinct}setToken(t){return this.authToken=t,this}from(t){const o=!!this.fields,u=t;let p;return this.fields?p=this.fields:hr(u,oa)?p=Object.fromEntries(Object.keys(u._.selectedFields).map(y=>[y,u[y]])):hr(u,fy)?p=u[as].selectedFields:hr(u,_i)?p={}:p=O1(u),new SC({table:u,fields:p,isPartialSelect:o,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}de(tf,QV,"PgSelectBuilder");class jO extends(tU=BO,eU=Ft,tU){constructor({table:o,fields:u,isPartialSelect:p,session:y,dialect:T,withList:s,distinct:M}){super();de(this,"_");de(this,"config");de(this,"joinsNotNullableMap");de(this,"tableName");de(this,"isPartialSelect");de(this,"session");de(this,"dialect");de(this,"cacheConfig");de(this,"usedTables",new Set);de(this,"leftJoin",this.createJoin("left",!1));de(this,"leftJoinLateral",this.createJoin("left",!0));de(this,"rightJoin",this.createJoin("right",!1));de(this,"innerJoin",this.createJoin("inner",!1));de(this,"innerJoinLateral",this.createJoin("inner",!0));de(this,"fullJoin",this.createJoin("full",!1));de(this,"crossJoin",this.createJoin("cross",!1));de(this,"crossJoinLateral",this.createJoin("cross",!0));de(this,"union",this.createSetOperator("union",!1));de(this,"unionAll",this.createSetOperator("union",!0));de(this,"intersect",this.createSetOperator("intersect",!1));de(this,"intersectAll",this.createSetOperator("intersect",!0));de(this,"except",this.createSetOperator("except",!1));de(this,"exceptAll",this.createSetOperator("except",!0));this.config={withList:s,table:o,fields:{...u},distinct:M,setOperators:[]},this.isPartialSelect=p,this.session=y,this.dialect=T,this._={selectedFields:u,config:this.config},this.tableName=uD(o),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{};for(const L of $1(o))this.usedTables.add(L)}getUsedTables(){return[...this.usedTables]}createJoin(o,u){return(p,y)=>{var M;const T=this.tableName,s=uD(p);for(const L of $1(p))this.usedTables.add(L);if(typeof s=="string"&&((M=this.config.joins)!=null&&M.some(L=>L.alias===s)))throw new Error(`Alias "${s}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof T=="string"&&(this.config.fields={[T]:this.config.fields}),typeof s=="string"&&!hr(p,_i))){const L=hr(p,oa)?p._.selectedFields:hr(p,kh)?p[as].selectedFields:p[ui.Symbol.Columns];this.config.fields[s]=L}if(typeof y=="function"&&(y=y(new Proxy(this.config.fields,new js({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:y,table:p,joinType:o,alias:s,lateral
2826:u}),typeof s=="string")switch(o){case"left":{this.joinsNotNullableMap[s]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([L])=>[L,!1])),this.joinsNotNullableMap[s]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[s]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([L])=>[L,!1])),this.joinsNotNullableMap[s]=!1;break}}return this}}createSetOperator(o,u){return p=>{const y=typeof p=="function"?p(sK()):p;if(!cD(this.getSelectedFields(),y.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:o,isAll:u,rightSelect:y}),this}}addSetOperators(o){return this.config.setOperators.push(...o),this}where(o){return typeof o=="function"&&(o=o(new Proxy(this.config.fields,new js({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=o,this}having(o){return typeof o=="function"&&(o=o(new Proxy(this.config.fields,new js({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=o,this}groupBy(...o){if(typeof o[0]=="function"){const u=o[0](new Proxy(this.config.fields,new js({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(u)?u:[u]}else this.config.groupBy=o;return this}orderBy(...o){if(typeof o[0]=="function"){const u=o[0](new Proxy(this.config.fields,new js({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),p=Array.isArray(u)?u:[u];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=p:this.config.orderBy=p}else{const u=o;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=u:this.config.orderBy=u}return this}limit(o){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=o:this.config.limit=o,this}offset(o){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=o:this.config.offset=o,this}for(o,u={}){return this.config.lockingClause={strength:o,config:u},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){const{typings:o,...u}=this.dialect.sqlToQuery(this.getSQL());return u}as(o){const u=[];if(u.push(...$1(this.config.table)),this.config.joins)for(const p of this.config.joins)u.push(...$1(p.table));return new Proxy(new oa(this.getSQL(),this.config.fields,o,!1,[...new Set(u)]),new js({alias:o,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new js({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache(o){return this.cacheConfig=o===void 0?{config:{},enable:!0,autoInvalidate:!0}:o===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...o},this}}de(jO,eU,"PgSelectQueryBuilder");class SC extends(iU=jO,rU=Ft,iU){constructor(){super(...arguments);de(this,"authToken");de(this,"execute",o=>rC.startActiveSpan("drizzle.operation",()=>this._prepare().execute(o,this.authToken)))}_prepare(o){const{session:u,config:p,dialect:y,joinsNotNullableMap:T,authToken:s,cacheConfig:M,usedTables:L}=this;if(!u)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");const{fields:B}=p;return rC.startActiveSpan("drizzle.prepareQuery",()=>{const H=D1(B),$=u.prepareQuery(y.sqlToQuery(this.getSQL()),H,o,!0,void 0,{type:"select",tables:[...L]},M);return $.joinsNotNullableMap=T,$.setToken(s)})}prepare(o){return this._prepare(o)}setToken(o){return this.authToken=o,this}}de(SC,rU,"PgSelect"),hY(SC,[lD]);function nm(e,t){return(o,u,...p)=>{const y=[u,...p].map(T=>({type:e,isAll:t,rightSelect:T}));for(const T of y)if(!cD(o.getSelectedFields(),T.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return o.addSetOperators(y)}}const sK=()=>({union:aK,unionAll:lK,intersect:cK,intersectAll:uK,except:hK,exceptAll:dK}),aK=nm("union",!1),lK=nm("union",!0),cK=nm("intersect",!1),uK=nm("intersect",!0),hK=nm("except",!1),dK=nm("except",!0);nU=Ft;class CC{constructor(t){de(this,"dialect");de(this,"dialectConfig");de(this,"$with",(t,o)=>{const u=this;return{as:y=>(typeof y=="function"&&(y=y(u)),new Proxy(new Qz(y.getSQL(),o??("getSelectedFields"in y?y.getSelectedFields()??{}:{}),t,!0),new js({alias:t,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}});this.dialect=hr(t,U1)?t:void 0,this.dialectConfig=hr(t,U1)?void 0:t}with(...t){const o=this;function u(T){return new tf({fields:T??void 0,session:void 0,dialect:o.getDialect(),withList:t})}function p(T){return new tf({fields:T??void 0,session:void 0,dialect:o.getDialect(),distinct:!0})}function y(T,s){return new tf({fields:s??void 0,session:void 0,dialect:o.getDialect(),distinct:{on:T}})}return{select:u,selectDistinct:p,selectDistinctOn:y}}select(t){return new tf({fields:t??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(t){return new tf({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(t,o){return new tf({fields:o??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:t}})}getDialect(){return this.dialect||(this.dialect=new U1(this.dialectConfig)),this.dialect}}de(CC,nU,"PgQueryBuilder"),oU=Ft;class IC{constructor(t,o){de(this,"config",{});this.name=t,this.schema=o}with(t){return this.config.with=t,this}}de(IC,oU,"PgDefaultViewBuilderCore");class GO extends(aU=IC,sU=Ft,aU){as(t){typeof t=="function"&&(t=t(new CC));const o=new js({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),u=new Proxy(t.getSelectedFields(),o);return new Proxy(new j1({pgConfig:this.config,config:{name:this.name,schema:this.schema,selectedFields:u,query:t.getSQL().inlineParams()}}),o)}}
2826de(GO,sU,"PgViewBuilder");class $O extends(cU=IC,lU=Ft,cU){constructor(o,u,p){super(o,p);de(this,"columns");this.columns=O1(Us(o,u))}existing(){return new Proxy(new j1({pgConfig:void 0,config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:void 0}}),new js({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(o){return new Proxy(new j1({pgConfig:this.config,config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:o.inlineParams()}}),new js({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}}de($O,lU,"PgManualViewBuilder"),uU=Ft;class AC{constructor(t,o){de(this,"config",{});this.name=t,this.schema=o}using(t){return this.config.using=t,this}with(t){return this.config.with=t,this}tablespace(t){return this.config.tablespace=t,this}withNoData(){return this.config.withNoData=!0,this}}de(AC,uU,"PgMaterializedViewBuilderCore");class HO extends(dU=AC,hU=Ft,dU){as(t){typeof t=="function"&&(t=t(new CC));const o=new js({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),u=new Proxy(t.getSelectedFields(),o);return new Proxy(new G1({pgConfig:{with:this.config.with,using:this.config.using,tablespace:this.config.tablespace,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:u,query:t.getSQL().inlineParams()}}),o)}}de(HO,hU,"PgMaterializedViewBuilder");class qO extends(pU=AC,fU=Ft,pU){constructor(o,u,p){super(o,p);de(this,"columns");this.columns=O1(Us(o,u))}existing(){return new Proxy(new G1({pgConfig:{tablespace:this.config.tablespace,using:this.config.using,with:this.config.with,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:void 0}}),new js({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(o){return new Proxy(new G1({pgConfig:{tablespace:this.config.tablespace,using:this.config.using,with:this.config.with,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:o.inlineParams()}}),new js({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}}de(qO,fU,"PgManualMaterializedViewBuilder");class j1 extends(_U=fy,gU=Ft,mU=UO,_U){constructor({pgConfig:o,config:u}){super(u);de(this,mU);o&&(this[UO]={with:o.with})}}de(j1,gU,"PgView");const ZO=Symbol.for("drizzle:PgMaterializedViewConfig");class G1 extends(xU=fy,vU=Ft,yU=ZO,xU){constructor({pgConfig:o,config:u}){super(u);de(this,yU);this[ZO]={with:o==null?void 0:o.with,using:o==null?void 0:o.using,tablespace:o==null?void 0:o.tablespace,withNoData:o==null?void 0:o.withNoData}}}de(G1,vU,"PgMaterializedView");function fK(e,t,o){return t?new $O(e,t,o):new GO(e,o)}function pK(e,t,o){return t?new qO(e,t,o):new HO(e,o)}function $1(e){return hr(e,sa)?[e[Qp]?`${e[Qp]}.${e[ui.Symbol.BaseName]}`:e[ui.Symbol.BaseName]]:hr(e,oa)?e._.usedTables??[]:hr(e,_i)?e.usedTables??[]:[]}bU=Ft;class WO{constructor(t,o,u){this.seqName=t,this.seqOptions=o,this.schema=u}}de(WO,bU,"PgSequence");function mK(e,t,o){return new WO(e,t,o)}wU=Ft;class XO{constructor(t){de(this,"table",(t,o,u)=>RO(t,o,u,this.schemaName));de(this,"view",(t,o)=>fK(t,o,this.schemaName));de(this,"materializedView",(t,o)=>pK(t,o,this.schemaName));de(this,"sequence",(t,o)=>mK(t,o,this.schemaName));this.schemaName=t}enum(t,o){return Array.isArray(o)?oY(t,[...o],this.schemaName):sY(t,o,this.schemaName)}getSQL(){return new _i([_t.identifier(this.schemaName)])}shouldOmitSQLParens(){return!0}}de(XO,wU,"PgSchema");function YO(e){if(e==="public")throw new Error("You can't specify 'public' as schema name. Postgres is using public schema by default. If you want to use 'public' schema, just use pgTable() instead of creating a schema");return new XO(e)}function gK(e,t){return`${e[Oc]}_${t.join("_")}_unique`}class KO extends(EU=ss,TU=Ft,EU){constructor(t,o){o.uniqueName||(o.uniqueName=gK(t,[o.name])),super(t,o),this.table=t}}de(KO,TU,"SQLiteColumn");class JO extends(CU=KO,SU=Ft,CU){constructor(o,u){super(o,u);de(this,"enumValues",this.config.enumValues);de(this,"length",this.config.length)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}de(JO,SU,"SQLiteText");const _K=br.union([br.string(),br.number(),br.boolean(),br.null()]),PC=br.lazy(()=>br.union([_K,br.array(PC),br.record(PC)]));function Su(e,t){const o=O1(e),u=Object.entries(o);let p=Object.fromEntries(u.map(([y,T])=>[y,QO(T)]));t&&(p=Object.assign(p,Object.fromEntries(Object.entries(t).map(([y,T])=>[y,typeof T=="function"?T(p):T]))));for(const[y,T]of u)T.notNull?T.hasDefault&&(p[y]=p[y].optional()):p[y]=p[y].nullable().optional();return br.object(p)}function QO(e){let t;if(function(o){return"enumValues"in o&&Array.isArray(o.enumValues)&&o.enumValues.length>0}(e)&&(t=e.enumValues.length?br.enum(e.enumValues):br.string()),!t){if(hr(e,N1))t=br.string().uuid();else if(e.dataType==="custom")t=br.any();else if(e.dataType==="json")t=PC;else if(e.dataType==="array")t=br.array(QO(e.baseColumn));else if(e.dataType==="number")t=br.number();else if(e.dataType==="bigint")t=br.bigint();else if(e.dataType==="boolean")t=br.boolean();else if(e.dataType==="date")t=br.date();else if(e.dataType==="string"){let o=br.string();(hr(e,aC)||hr(e,_C)||hr(e,FO)||hr(e,OO)||hr(e,DO)||hr(e,JO))&&typeof e.length=="number"&&(o=o.max(e.length)),t=o}}return t||(t=br.any()),t}const yK={PROPERTYCHANGE:"propertychange"};function eF(e){for(const t in e)delete e[t]}function tF(e){let t;for(t in e)return!1;return!t}function py(e,t,o,u,p){if(p){const T=o;o=function(s){return e.removeEventListener(t,o),T.call(u??this,s)}}else u&&u!==e&&(o=o.bind(u));const y={target:e,type:t,listener:o};return e.addEventListener(t,o),y}function rF(e,t,o,u){return py(e,t,o,u,!0)}function H1(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),eF(e))}const MC={CHANGE:"change"};class vK{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function xK(e,t,o){let u,p;o=o||iF;let y=0,T=e.length,s=!1;for(;y<T;)u=y+(T-y>>1),p=+o(e[u],t),p<0?y=u+1:(T=u,s=!p);return s?y:~y}function iF(e,t){return e>t?1:e<t?-1:0}function Cu(e,t){const o=Array.isArray(t)?t:[t],u=o.length;for(let p=0;p<u;p++)e[e.length]=o[p]}function bK(e,t){const o=e.length;if(o!==t.length)return!1;for(let u=0;u<o;u++)if(e[u]!==t[u])return!1;return!0}function nF(){}function oF(e){let t,o,u;return function(){const p=Array.prototype.slice.call(arguments);return(!o||this!==u||!bK(p,o))&&(u=this,o=p,t=e.apply(this,arguments)),t}}
2826class sF{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class wK extends vK{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,o){if(!t||!o)return;const u=this.listeners_||(this.listeners_={}),p=u[t]||(u[t]=[]);p.includes(o)||p.push(o)}dispatchEvent(t){const o=typeof t=="string",u=o?t:t.type,p=this.listeners_&&this.listeners_[u];if(!p)return;const y=o?new sF(t):t;y.target||(y.target=this.eventTarget_||this);const T=this.dispatching_||(this.dispatching_={}),s=this.pendingRemovals_||(this.pendingRemovals_={});u in T||(T[u]=0,s[u]=0),++T[u];let M;for(let L=0,B=p.length;L<B;++L)if("handleEvent"in p[L]?M=p[L].handleEvent(y):M=p[L].call(this,y),M===!1||y.propagationStopped){M=!1;break}if(--T[u]===0){let L=s[u];for(delete s[u];L--;)this.removeEventListener(u,nF);delete T[u]}return M}disposeInternal(){this.listeners_&&eF(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,o){if(!this.listeners_)return;const u=this.listeners_[t];if(!u)return;const p=u.indexOf(o);p!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(u[p]=nF,++this.pendingRemovals_[t]):(u.splice(p,1),u.length===0&&delete this.listeners_[t]))}}class q1 extends wK{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(MC.CHANGE)}getRevision(){return this.revision_}onInternal(t,o){if(Array.isArray(t)){const u=t.length,p=new Array(u);for(let y=0;y<u;++y)p[y]=py(this,t[y],o);return p}return py(this,t,o)}onceInternal(t,o){let u;if(Array.isArray(t)){const p=t.length;u=new Array(p);for(let y=0;y<p;++y)u[y]=rF(this,t[y],o)}else u=rF(this,t,o);return o.ol_key=u,u}unInternal(t,o){const u=o.ol_key;if(u)TK(u);else if(Array.isArray(t))for(let p=0,y=t.length;p<y;++p)this.removeEventListener(t[p],o);else this.removeEventListener(t,o)}}q1.prototype.on,q1.prototype.once,q1.prototype.un;function TK(e){if(Array.isArray(e))for(let t=0,o=e.length;t<o;++t)H1(e[t]);else H1(e)}function qn(){throw new Error("Unimplemented abstract method.")}let EK=0;function SK(e){return e.ol_uid||(e.ol_uid=String(++EK))}class aF extends sF{constructor(t,o,u){super(t),this.key=o,this.oldValue=u}}class lF extends q1{constructor(t){super(),this.on,this.once,this.un,SK(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let o;return this.values_&&this.values_.hasOwnProperty(t)&&(o=this.values_[t]),o}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,o){let u;u=`change:${t}`,this.hasListener(u)&&this.dispatchEvent(new aF(u,t,o)),u=yK.PROPERTYCHANGE,this.hasListener(u)&&this.dispatchEvent(new aF(u,t,o))}addChangeListener(t,o){this.addEventListener(`change:${t}`,o)}removeChangeListener(t,o){this.removeEventListener(`change:${t}`,o)}set(t,o,u){const p=this.values_||(this.values_={});if(u)p[t]=o;else{const y=p[t];p[t]=o,y!==o&&this.notify(t,y)}}setProperties(t,o){for(const u in t)this.set(u,t[u],o)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,o){if(this.values_&&t in this.values_){const u=this.values_[t];delete this.values_[t],tF(this.values_)&&(this.values_=null),o||this.notify(t,u)}}}function CK(e,t){if(!e)throw new Error(t)}class om extends lF{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const o=t;this.setGeometry(o)}else{const o=t;this.setProperties(o)}}clone(){const t=new om,o=this.geometryName_;t.setGeometryName(o);const u=this.getPropertiesInternal();if(u){const y=this.getGeometry();for(const T in u)T===o&&y?t.set(T,y.clone()):t.set(T,u[T],!0)}const p=this.getStyle();return p&&t.setStyle(p),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(H1(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=py(t,MC.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?IK(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}function IK(e){if(typeof e=="function")return e;let t;return Array.isArray(e)?t=e:(CK(typeof e.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}const Ts={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function rf(e,t,o){let u,p;return t<e[0]?u=e[0]-t:e[2]<t?u=t-e[2]:u=0,o<e[1]?p=e[1]-o:e[3]<o?p=o-e[3]:p=0,u*u+p*p}function cF(e,t,o){return e[0]<=t&&t<=e[2]&&e[1]<=o&&o<=e[3]}function uF(e,t){const o=e[0],u=e[1],p=e[2],y=e[3],T=t[0],s=t[1];let M=Ts.UNKNOWN;return T<o?M=M|Ts.LEFT:T>p&&(M=M|Ts.RIGHT),s<u?M=M|Ts.BELOW:s>y&&(M=M|Ts.ABOVE),M===Ts.UNKNOWN&&(M=Ts.INTERSECTING),M}function kC(){return[1/0,1/0,-1/0,-1/0]}function hF(e,t,o,u,p){return p?(p[0]=e,p[1]=t,p[2]=o,p[3]=u,p):[e,t,o,u]}function RC(e){return hF(1/0,1/0,-1/0,-1/0,e)}function dF(e,t){const o=e[0],u=e[1];return hF(o,u,o,u,t)}function LC(e,t,o,u,p){const y=RC(p);return fF(y,e,t,o,u)}function AK(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function fF(e,t,o,u,p){for(;o<u;o+=p)PK(e,t[o],t[o+1]);return e}function PK(e,t,o){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],o),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],o)}function MK(e,t){let o;return o=t(kK(e)),o||(o=t(RK(e)),o)||(o=t(zK(e)),o)||(o=t(LK(e)),o)?o:!1}function kK(e){return[e[0],e[1]]}function RK(e){return[e[2],e[1]]}function Z1(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function W1(e){return e[3]-e[1]}function LK(e){return[e[0],e[3]]}function zK(e){return[e[2],e[3]]}function DK(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function OK(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function FK(e,t,o){let u=!1;const p=uF(e,t),y=uF(e,o);if(p===Ts.INTERSECTING||y===Ts.INTERSECTING)u=!0;else{const T=e[0],s=e[1],M=e[2],L=e[3],B=t[0],H=t[1],$=o[0],te=o[1],xe=(te-H)/($-B);let pe,Ne;y&Ts.ABOVE&&!(p&Ts.ABOVE)&&(pe=$-(te-L)/xe,u=pe>=T&&pe<=M),!u&&y&Ts.RIGHT&&!(p&Ts.RIGHT)&&(Ne=te-($-M)*xe,u=Ne>=s&&Ne<=L),!u&&y&Ts.BELOW&&!(p&Ts.BELOW)&&(pe=$-(te-s)/xe,u=pe>=T&&pe<=M),!u&&y&Ts.LEFT&&!(p&Ts.LEFT)&&(Ne=te-($-T)*xe,u=Ne>=s&&Ne<=L)}return u}function NK(e,t,o,u,p,y){const T=p-o,s=y-u;if(T!==0||s!==0){const M=((e-o)*T+(t-u)*s)/(T*T+s*s);M>1?(o=p,u=y):M>0&&(o+=T*M,u+=s*M)}return nf(e,t,o,u)}function nf(e,t,o,u){const p=o-e,y=u-t;return p*p+y*y}function pF(e){return e*180/Math.PI}function X1(e){return e*Math.PI/180}function zC(e,t,o){return e+o*(t-e)}function DC(e,t,o){if(e>=t&&e<o)return e;const u=o-t;return((e-t)%u+u)%u+t}const BK={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};
2826class OC{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||BK[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const my=6378137,sm=Math.PI*my,VK=[-sm,-sm,sm,sm],UK=[-180,-85,180,85],Y1=my*Math.log(Math.tan(Math.PI/2));class am extends OC{constructor(t){super({code:t,units:"m",extent:VK,global:!0,worldExtent:UK,getPointResolution:function(o,u){return o/Math.cosh(u[1]/my)}})}}const mF=[new am("EPSG:3857"),new am("EPSG:102100"),new am("EPSG:102113"),new am("EPSG:900913"),new am("http://www.opengis.net/def/crs/EPSG/0/3857"),new am("http://www.opengis.net/gml/srs/epsg.xml#3857")];function jK(e,t,o,u){const p=e.length;o=o>1?o:2,u=u??o,t===void 0&&(o>2?t=e.slice():t=new Array(p));for(let y=0;y<p;y+=u){t[y]=sm*e[y]/180;let T=my*Math.log(Math.tan(Math.PI*(+e[y+1]+90)/360));T>Y1?T=Y1:T<-Y1&&(T=-Y1),t[y+1]=T}return t}function GK(e,t,o,u){const p=e.length;o=o>1?o:2,u=u??o,t===void 0&&(o>2?t=e.slice():t=new Array(p));for(let y=0;y<p;y+=u)t[y]=180*e[y]/sm,t[y+1]=360*Math.atan(Math.exp(e[y+1]/my))/Math.PI-90;return t}const $K=6378137,gF=[-180,-90,180,90],HK=Math.PI*$K/180;class of extends OC{constructor(t,o){super({code:t,units:"degrees",extent:gF,axisOrientation:o,global:!0,metersPerUnit:HK,worldExtent:gF})}}const _F=[new of("CRS:84"),new of("EPSG:4326","neu"),new of("urn:ogc:def:crs:OGC:1.3:CRS84"),new of("urn:ogc:def:crs:OGC:2:84"),new of("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new of("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new of("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let FC={};function qK(e){return FC[e]||FC[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function ZK(e,t){FC[e]=t}let lm={};function gy(e,t,o){const u=e.getCode(),p=t.getCode();u in lm||(lm[u]={}),lm[u][p]=o}function NC(e,t){return e in lm&&t in lm[e]?lm[e][t]:null}const K1=.9996,Sl=.00669438,J1=Sl*Sl,Q1=J1*Sl,sf=Sl/(1-Sl),yF=Math.sqrt(1-Sl),cm=(1-yF)/(1+yF),vF=cm*cm,BC=vF*cm,VC=BC*cm,xF=VC*cm,bF=1-Sl/4-3*J1/64-5*Q1/256,WK=3*Sl/8+3*J1/32+45*Q1/1024,XK=15*J1/256+45*Q1/1024,YK=35*Q1/3072,KK=3/2*cm-27/32*BC+269/512*xF,JK=21/16*vF-55/32*VC,QK=151/96*BC-417/128*xF,eJ=1097/512*VC,eb=6378137;function tJ(e,t,o){const u=e-5e5,T=(o.north?t:t-1e7)/K1/(eb*bF),s=T+KK*Math.sin(2*T)+JK*Math.sin(4*T)+QK*Math.sin(6*T)+eJ*Math.sin(8*T),M=Math.sin(s),L=M*M,B=Math.cos(s),H=M/B,$=H*H,te=$*$,xe=1-Sl*L,pe=Math.sqrt(1-Sl*L),Ne=eb/pe,_e=(1-Sl)/xe,ie=sf*B**2,ke=ie*ie,ot=u/(Ne*K1),et=ot*ot,wt=et*ot,It=wt*ot,K=It*ot,ve=K*ot,Ae=s-H/_e*(et/2-It/24*(5+3*$+10*ie-4*ke-9*sf))+ve/720*(61+90*$+298*ie+45*te-252*sf-3*ke);let Ye=(ot-wt/6*(1+2*$+ie)+K/120*(5-2*ie+28*$-3*ke+8*sf+24*te))/B;return Ye=DC(Ye+X1(EF(o.number)),-Math.PI,Math.PI),[pF(Ye),pF(Ae)]}const wF=-80,TF=84,rJ=-180,iJ=180;function nJ(e,t,o){e=DC(e,rJ,iJ),t<wF?t=wF:t>TF&&(t=TF);const u=X1(t),p=Math.sin(u),y=Math.cos(u),T=p/y,s=T*T,M=s*s,L=X1(e),B=EF(o.number),H=X1(B),$=eb/Math.sqrt(1-Sl*p**2),te=sf*y**2,xe=y*DC(L-H,-Math.PI,Math.PI),pe=xe*xe,Ne=pe*xe,_e=Ne*xe,ie=_e*xe,ke=ie*xe,ot=eb*(bF*u-WK*Math.sin(2*u)+XK*Math.sin(4*u)-YK*Math.sin(6*u)),et=K1*$*(xe+Ne/6*(1-s+te)+ie/120*(5-18*s+M+72*te-58*sf))+5e5;let wt=K1*(ot+$*T*(pe/2+_e/24*(5-s+9*te+4*te**2)+ke/720*(61-58*s+M+600*te-330*sf)));return o.north||(wt+=1e7),[et,wt]}function EF(e){return(e-1)*6-180+3}const oJ=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function SF(e){let t=0;for(const p of oJ){const y=e.match(p);if(y){t=parseInt(y[1]);break}}if(!t)return null;let o=0,u=!1;return t>32700&&t<32761?o=t-32700:t>32600&&t<32661&&(u=!0,o=t-32600),o?{number:o,north:u}:null}function CF(e,t){return function(o,u,p,y){const T=o.length;p=p>1?p:2,y=y??p,u||(p>2?u=o.slice():u=new Array(T));for(let s=0;s<T;s+=y){const M=o[s],L=o[s+1],B=e(M,L,t);u[s]=B[0],u[s+1]=B[1]}return u}}function sJ(e){return SF(e)?new OC({code:e,units:"m"}):null}function aJ(e){const t=SF(e.getCode());return t?{forward:CF(nJ,t),inverse:CF(tJ,t)}:null}const lJ=[aJ],cJ=[sJ];function UC(e,t){if(t!==void 0){for(let o=0,u=e.length;o<u;++o)t[o]=e[o];t=t}else t=e.slice();return t}function jC(e){ZK(e.getCode(),e),gy(e,e,UC)}function uJ(e){e.forEach(jC)}function Ra(e){if(typeof e!="string")return e;const t=qK(e);if(t)return t;for(const o of cJ){const u=o(e);if(u)return u}return null}function IF(e){uJ(e),e.forEach(function(t){e.forEach(function(o){t!==o&&gy(t,o,UC)})})}function hJ(e,t,o,u){e.forEach(function(p){t.forEach(function(y){gy(p,y,o),gy(y,p,u)})})}function dJ(e,t){if(e===t)return!0;const o=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||AF(e,t)===UC)&&o}function AF(e,t){const o=e.getCode(),u=t.getCode();let p=NC(o,u);if(p)return p;let y=null,T=null;for(const M of lJ)y||(y=M(e)),T||(T=M(t));if(!y&&!T)return null;const s="EPSG:4326";if(T)if(y)p=GC(y.inverse,T.forward);else{const M=NC(o,s);M&&(p=GC(M,T.forward))}else{const M=NC(s,u);M&&(p=GC(y.inverse,M))}return p&&(jC(e),jC(t),gy(e,t,p)),p}function GC(e,t){return function(o,u,p,y){return u=e(o,u,p,y),t(u,u,p,y)}}function $C(e,t){const o=Ra(e),u=Ra(t);return AF(o,u)}function fJ(){IF(mF),IF(_F),hJ(_F,mF,jK,GK)}fJ(),new Array(6);function PF(){return[1,0,0,1,0,0]}function MF(e,t,o,u,p,y,T,s){const M=Math.sin(y),L=Math.cos(y);return e[0]=u*L,e[1]=p*M,e[2]=-u*M,e[3]=p*L,e[4]=T*u*L-s*u*M+t,e[5]=T*p*M+s*p*L+o,e}function kF(e,t,o,u,p,y,T){y=y||[],T=T||2;let s=0;for(let M=t;M<o;M+=u){const L=e[M],B=e[M+1];
2826y[s++]=p[0]*L+p[2]*B+p[4],y[s++]=p[1]*L+p[3]*B+p[5];for(let H=2;H<T;H++)y[s++]=e[M+H]}return y&&y.length!=s&&(y.length=s),y}function pJ(e,t,o,u,p,y,T){T=T||[];const s=Math.cos(p),M=Math.sin(p),L=y[0],B=y[1];let H=0;for(let $=t;$<o;$+=u){const te=e[$]-L,xe=e[$+1]-B;T[H++]=L+te*s-xe*M,T[H++]=B+te*M+xe*s;for(let pe=$+2;pe<$+u;++pe)T[H++]=e[pe]}return T&&T.length!=H&&(T.length=H),T}function mJ(e,t,o,u,p,y,T,s){s=s||[];const M=T[0],L=T[1];let B=0;for(let H=t;H<o;H+=u){const $=e[H]-M,te=e[H+1]-L;s[B++]=M+p*$,s[B++]=L+y*te;for(let xe=H+2;xe<H+u;++xe)s[B++]=e[xe]}return s&&s.length!=B&&(s.length=B),s}function gJ(e,t,o,u,p,y,T){T=T||[];let s=0;for(let M=t;M<o;M+=u){T[s++]=e[M]+p,T[s++]=e[M+1]+y;for(let L=M+2;L<M+u;++L)T[s++]=e[L]}return T&&T.length!=s&&(T.length=s),T}const RF=PF(),_J=[NaN,NaN];class LF extends lF{constructor(){super(),this.extent_=kC(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=oF((t,o,u)=>{if(!u)return this.getSimplifiedGeometry(o);const p=this.clone();return p.applyTransform(u),p.getSimplifiedGeometry(o)})}simplifyTransformed(t,o){return this.simplifyTransformedInternal(this.getRevision(),t,o)}clone(){return qn()}closestPointXY(t,o,u,p){return qn()}containsXY(t,o){return this.closestPointXY(t,o,_J,Number.MIN_VALUE)===0}getClosestPoint(t,o){return o=o||[NaN,NaN],this.closestPointXY(t[0],t[1],o,1/0),o}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return qn()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const o=this.computeExtent(this.extent_);(isNaN(o[0])||isNaN(o[1]))&&RC(o),this.extentRevision_=this.getRevision()}return OK(this.extent_,t)}rotate(t,o){qn()}scale(t,o,u){qn()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return qn()}getType(){return qn()}applyTransform(t){qn()}intersectsExtent(t){return qn()}translate(t,o){qn()}transform(t,o){const u=Ra(t),p=u.getUnits()=="tile-pixels"?function(y,T,s){const M=u.getExtent(),L=u.getWorldExtent(),B=W1(L)/W1(M);MF(RF,L[0],L[3],B,-B,0,0,0);const H=kF(y,0,y.length,s,RF,T),$=$C(u,o);return $?$(H,H,s):H}:$C(u,o);return this.applyTransform(p),this}}class Iu extends LF{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(H1),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let o=0,u=t.length;o<u;++o)this.changeEventsKeys_.push(py(t[o],MC.CHANGE,this.changed,this))}clone(){const t=new Iu(HC(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,o,u,p){if(p<rf(this.getExtent(),t,o))return p;const y=this.geometries_;for(let T=0,s=y.length;T<s;++T)p=y[T].closestPointXY(t,o,u,p);return p}containsXY(t,o){const u=this.geometries_;for(let p=0,y=u.length;p<y;++p)if(u[p].containsXY(t,o))return!0;return!1}computeExtent(t){RC(t);const o=this.geometries_;for(let u=0,p=o.length;u<p;++u)AK(t,o[u].getExtent());return t}getGeometries(){return HC(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const o=this.geometries_;for(let u=0,p=o.length;u<p;++u)o[u].getType()===this.getType()?t=t.concat(o[u].getGeometriesArrayRecursive()):t.push(o[u]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const o=[],u=this.geometries_;let p=!1;for(let y=0,T=u.length;y<T;++y){const s=u[y],M=s.getSimplifiedGeometry(t);o.push(M),M!==s&&(p=!0)}return p?new Iu(o):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const o=this.geometries_;for(let u=0,p=o.length;u<p;++u)if(o[u].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,o){const u=this.geometries_;for(let p=0,y=u.length;p<y;++p)u[p].rotate(t,o);this.changed()}scale(t,o,u){u||(u=Z1(this.getExtent()));const p=this.geometries_;for(let y=0,T=p.length;y<T;++y)p[y].scale(t,o,u);this.changed()}setGeometries(t){this.setGeometriesArray(HC(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const o=this.geometries_;for(let u=0,p=o.length;u<p;++u)o[u].applyTransform(t);this.changed()}translate(t,o){const u=this.geometries_;for(let p=0,y=u.length;p<y;++p)u[p].translate(t,o);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function HC(e){return e.map(t=>t.clone())}class Au extends LF{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return LC(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return qn()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const o=this.getSimplifiedGeometryInternal(t);return o.getFlatCoordinates().length<this.flatCoordinates.length?o:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,o){this.stride=zF(t),this.layout=t,this.flatCoordinates=o}setCoordinates(t,o){qn()}setLayout(t,o,u){let p;if(t)p=zF(t);else{for(let y=0;y<u;++y){if(o.length===0){this.layout="XY",this.stride=2;return}o=o[0]}p=o.length,t=af(p)}this.layout=t,this.stride=p}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,o){const u=this.getFlatCoordinates();if(u){const p=this.getStride();pJ(u,0,u.length,p,t,o,u),this.changed()}}scale(t,o,u){o===void 0&&(o=t),u||(u=Z1(this.getExtent()));const p=this.getFlatCoordinates();if(p){const y=this.getStride();mJ(p,0,p.length,y,t,o,u,p),this.changed()}}translate(t,o){const u=this.getFlatCoordinates();if(u){const p=this.getStride();gJ(u,0,u.length,p,t,o,u),this.changed()}}}function af(e){let t;return e==2?t="XY":e==3?t="XYZ":e==4&&(t="XYZM"),t}function zF(e){let t;return e=="XY"?t=2:e=="XYZ"||e=="XYM"?t=3:e=="XYZM"&&(t=4),t}function DF(e,t,o,u,p,y,T){const s=e[t],M=e[t+1],L=e[o]-s,B=e[o+1]-M;let H;if(L===0&&B===0)H=t;else{const $=((p-s)*L+(y-M)*B)/(L*L+B*B);if($>1)H=o;else if($>0){for(let te=0;te<u;++te)T[te]=zC(e[t+te],e[o+te],$);T.length=u;return}else H=t}for(let $=0;$<u;++$)T[$]=e[H+$];T.length=u}function qC(e,t,o,u,p){let y=e[t],T=e[t+1];for(t+=u;t<o;t+=u){const s=e[t],M=e[t+1],L=nf(y,T,s,M);L>p&&(p=L),y=s,T=M}return p}function ZC(e,t,o,u,p){for(let y=0,T=o.length;y<T;++y){const s=o[y];p=qC(e,t,s,u,p),t=s}return p}function yJ(e,t,o,u,p){for(let y=0,T=o.length;y<T;++y){const s=o[y];p=ZC(e,t,s,u,p),t=s[s.length-1]}return p}function WC(e,t,o,u,p,y,T,s,M,L,B){if(t==o)return L;let H,$;if(p===0){if($=nf(T,s,e[t],e[t+1]),$<L){for(H=0;H<u;++H)M[H]=e[t+H];return M.length=u,$}return L}B=B||[NaN,NaN];let te=t+u;for(;te<o;)if(DF(e,te-u,te,u,T,s,B),$=nf(T,s,B[0],B[1]),$<L){for(L=$,H=0;H<u;++H)M[H]=B[H];M.length=u,te+=u}else te+=u*Math.max((Math.sqrt($)-Math.sqrt(L))/p|0,1);if(y&&(DF(e,o-u,t,u,T,s,B),$=nf(T,s,B[0],B[1]),$<L)){for(L=$,H=0;H<u;++H)M[H]=B[H];M.length=u}return L}function XC(e,t,o,u,p,y,T,s,M,L,B){B=B||[NaN,NaN];for(let H=0,$=o.length;H<$;++H){const te=o[H];L=WC(e,t,te,u,p,y,T,s,M,L,B),t=te}return L}function vJ(e,t,o,u,p,y,T,s,M,L,B){B=B||[NaN,NaN];for(let H=0,$=o.length;H<$;++H){const te=o[H];L=XC(e,t,te,u,p,y,T,s,M,L,B),t=te[te.length-1]}return L}function xJ(e,t,o,u){for(let p=0,y=o.length;p<y;++p)e[t++]=o[p];return t}function tb(e,t,o,u){for(let p=0,y=o.length;p<y;++p){const T=o[p];for(let s=0;s<u;++s)e[t++]=T[s]}return t}function _y(e,t,o,u,p){p=p||[];let y=0;for(let T=0,s=o.length;T<s;++T){const M=tb(e,t,o[T],u);p[y++]=M,t=M}return p.length=y,p}function OF(e,t,o,u,p){p=p||[];let y=0;for(let T=0,s=o.length;T<s;++T){const M=_y(e,t,o[T],u,p[y]);M.length===0&&(M[0]=t),p[y++]=M,t=M[M.length-1]}return p.length=y,p}function rb(e,t,o,u,p){p=p!==void 0?p:[];let y=0;for(let T=t;T<o;T+=u)p[y++]=e.slice(T,T+u);return p.length=y,p}function YC(e,t,o,u,p){p=p!==void 0?p:[];let y=0;for(let T=0,s=o.length;T<s;++T){const M=o[T];p[y++]=rb(e,t,M,u,p[y]),t=M}return p.length=y,p}function bJ(e,t,o,u,p){p=p!==void 0?p:[];let y=0;for(let T=0,s=o.length;T<s;++T){const M=o[T];p[y++]=M.length===1&&M[0]===t?[]:YC(e,t,M,u,p[y]),t=M[M.length-1]}return p.length=y,p}function ib(e,t,o,u,p,y,T){let s,M;const L=(o-t)/u;if(L===1)s=t;else if(L===2)s=t,M=p;else if(L!==0){let B=e[t],H=e[t+1],$=0;const te=[0];for(let Ne=t+u;Ne<o;Ne+=u){const _e=e[Ne],ie=e[Ne+1];$+=Math.sqrt((_e-B)*(_e-B)+(ie-H)*(ie-H)),te.push($),B=_e,H=ie}const xe=p*$,pe=xK(te,xe);pe<0?(M=(xe-te[-pe-2])/(te[-pe-1]-te[-pe-2]),s=t+(-pe-2)*u):s=t+pe*u}T=T>1?T:2,y=y||new Array(T);for(let B=0;B<T;++B)y[B]=s===void 0?NaN:M===void 0?e[s+B]:zC(e[s+B],e[s+u+B],M);return y}function KC(e,t,o,u,p,y){if(o==t)return null;let T;if(p<e[t+u-1])return y?(T=e.slice(t,t+u),T[u-1]=p,T):null;if(e[o-1]<p)return y?(T=e.slice(o-u,o),T[u-1]=p,T):null;if(p==e[t+u-1])return e.slice(t,t+u);let s=t/u,M=o/u;for(;s<M;){const $=s+M>>1;p<e[($+1)*u-1]?M=$:s=$+1}const L=e[s*u-1];if(p==L)return e.slice((s-1)*u,(s-1)*u+u);
2826const B=e[(s+1)*u-1],H=(p-L)/(B-L);T=[];for(let $=0;$<u-1;++$)T.push(zC(e[(s-1)*u+$],e[s*u+$],H));return T.push(p),T}function wJ(e,t,o,u,p,y,T){if(T)return KC(e,t,o[o.length-1],u,p,y);let s;if(p<e[u-1])return y?(s=e.slice(0,u),s[u-1]=p,s):null;if(e[e.length-1]<p)return y?(s=e.slice(e.length-u),s[u-1]=p,s):null;for(let M=0,L=o.length;M<L;++M){const B=o[M];if(t!=B){if(p<e[t+u-1])return null;if(p<=e[B-1])return KC(e,t,B,u,p,!1);t=B}}return null}function TJ(e,t,o,u,p){return!MK(p,function(T){return!lf(e,t,o,u,T[0],T[1])})}function lf(e,t,o,u,p,y){let T=0,s=e[o-u],M=e[o-u+1];for(;t<o;t+=u){const L=e[t],B=e[t+1];M<=y?B>y&&(L-s)*(y-M)-(p-s)*(B-M)>0&&T++:B<=y&&(L-s)*(y-M)-(p-s)*(B-M)<0&&T--,s=L,M=B}return T!==0}function JC(e,t,o,u,p,y){if(o.length===0||!lf(e,t,o[0],u,p,y))return!1;for(let T=1,s=o.length;T<s;++T)if(lf(e,o[T-1],o[T],u,p,y))return!1;return!0}function EJ(e,t,o,u,p,y){if(o.length===0)return!1;for(let T=0,s=o.length;T<s;++T){const M=o[T];if(JC(e,t,M,u,p,y))return!0;t=M[M.length-1]}return!1}function FF(e,t,o,u,p){let y;for(t+=u;t<o;t+=u)if(y=p(e.slice(t-u,t),e.slice(t,t+u)),y)return y;return!1}function nb(e,t,o,u,p,y){return y=y??fF(kC(),e,t,o,u),DK(p,y)?y[0]>=p[0]&&y[2]<=p[2]||y[1]>=p[1]&&y[3]<=p[3]?!0:FF(e,t,o,u,function(T,s){return FK(p,T,s)}):!1}function SJ(e,t,o,u,p){for(let y=0,T=o.length;y<T;++y){if(nb(e,t,o[y],u,p))return!0;t=o[y]}return!1}function CJ(e,t,o,u,p){return!!(nb(e,t,o,u,p)||lf(e,t,o,u,p[0],p[1])||lf(e,t,o,u,p[0],p[3])||lf(e,t,o,u,p[2],p[1])||lf(e,t,o,u,p[2],p[3]))}function NF(e,t,o,u,p){if(!CJ(e,t,o[0],u,p))return!1;if(o.length===1)return!0;for(let y=1,T=o.length;y<T;++y)if(TJ(e,o[y-1],o[y],u,p)&&!nb(e,o[y-1],o[y],u,p))return!1;return!0}function IJ(e,t,o,u,p){for(let y=0,T=o.length;y<T;++y){const s=o[y];if(NF(e,t,s,u,p))return!0;t=s[s.length-1]}return!1}function BF(e,t,o,u){let p=e[t],y=e[t+1],T=0;for(let s=t+u;s<o;s+=u){const M=e[s],L=e[s+1];T+=Math.sqrt((M-p)*(M-p)+(L-y)*(L-y)),p=M,y=L}return T}function ob(e,t,o,u,p,y,T){const s=(o-t)/u;if(s<3){for(;t<o;t+=u)y[T++]=e[t],y[T++]=e[t+1];return T}const M=new Array(s);M[0]=1,M[s-1]=1;const L=[t,o-u];let B=0;for(;L.length>0;){const H=L.pop(),$=L.pop();let te=0;const xe=e[$],pe=e[$+1],Ne=e[H],_e=e[H+1];for(let ie=$+u;ie<H;ie+=u){const ke=e[ie],ot=e[ie+1],et=NK(ke,ot,xe,pe,Ne,_e);et>te&&(B=ie,te=et)}te>p&&(M[(B-t)/u]=1,$+u<B&&L.push($,B),B+u<H&&L.push(B,H))}for(let H=0;H<s;++H)M[H]&&(y[T++]=e[t+H*u],y[T++]=e[t+H*u+1]);return T}function VF(e,t,o,u,p,y,T,s){for(let M=0,L=o.length;M<L;++M){const B=o[M];T=ob(e,t,B,u,p,y,T),s.push(T),t=B}return T}function um(e,t){return t*Math.round(e/t)}function AJ(e,t,o,u,p,y,T){if(t==o)return T;let s=um(e[t],p),M=um(e[t+1],p);t+=u,y[T++]=s,y[T++]=M;let L,B;do if(L=um(e[t],p),B=um(e[t+1],p),t+=u,t==o)return y[T++]=L,y[T++]=B,T;while(L==s&&B==M);for(;t<o;){const H=um(e[t],p),$=um(e[t+1],p);if(t+=u,H==L&&$==B)continue;const te=L-s,xe=B-M,pe=H-s,Ne=$-M;if(te*Ne==xe*pe&&(te<0&&pe<te||te==pe||te>0&&pe>te)&&(xe<0&&Ne<xe||xe==Ne||xe>0&&Ne>xe)){L=H,B=$;continue}y[T++]=L,y[T++]=B,s=L,M=B,L=H,B=$}return y[T++]=L,y[T++]=B,T}function QC(e,t,o,u,p,y,T,s){for(let M=0,L=o.length;M<L;++M){const B=o[M];T=AJ(e,t,B,u,p,y,T),s.push(T),t=B}return T}function PJ(e,t,o,u,p,y,T,s){for(let M=0,L=o.length;M<L;++M){const B=o[M],H=[];T=QC(e,t,B,u,p,y,T,H),s.push(H),t=B[B.length-1]}return T}class cf extends Au{constructor(t,o){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,o!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(o,t):this.setCoordinates(t,o)}appendCoordinate(t){Cu(this.flatCoordinates,t),this.changed()}clone(){const t=new cf(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,o,u,p){return p<rf(this.getExtent(),t,o)?p:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qC(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),WC(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,o,u,p))}forEachSegment(t){return FF(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,o){return this.layout!="XYM"&&this.layout!="XYZM"?null:(o=o!==void 0?o:!1,KC(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,o))}getCoordinates(){return rb(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,o){return ib(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,o,this.stride)}getLength(){return BF(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const o=[];return o.length=ob(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,o,0),new cf(o,"XY")}getType(){return"LineString"}intersectsExtent(t){return nb(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,o){this.setLayout(o,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=tb(this.flatCoordinates,0,t,this.stride),this.changed()}}class yy extends Au{constructor(t,o,u){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,o);else if(o!==void 0&&u)this.setFlatCoordinates(o,t),this.ends_=u;else{const p=t,y=[],T=[];for(let M=0,L=p.length;M<L;++M){const B=p[M];Cu(y,B.getFlatCoordinates()),T.push(y.length)}const s=p.length===0?this.getLayout():p[0].getLayout();this.setFlatCoordinates(s,y),this.ends_=T}}appendLineString(t){Cu(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new yy(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,o,u,p){return p<rf(this.getExtent(),t,o)?p:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ZC(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),XC(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,o,u,p))}getCoordinateAtM(t,o,u){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(o=o!==void 0?o:!1,u=u!==void 0?u:!1,wJ(this.flatCoordinates,0,this.ends_,this.stride,t,o,u))}getCoordinates(){return YC(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new cf(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,o=this.ends_,u=this.layout,p=[];let y=0;for(let T=0,s=o.length;T<s;++T){const M=o[T],L=new cf(t.slice(y,M),u);p.push(L),y=M}return p}getLength(){const t=this.ends_;let o=0,u=0;for(let p=0,y=t.length;p<y;++p)u+=BF(this.flatCoordinates,o,t[p],this.stride),o=t[p];return u}getFlatMidpoints(){const t=[],o=this.flatCoordinates;let u=0;const p=this.ends_,y=this.stride;for(let T=0,s=p.length;T<s;++T){const M=p[T],L=ib(o,u,M,y,.5);Cu(t,L),u=M}return t}getSimplifiedGeometryInternal(t){const o=[],u=[];return o.length=VF(this.flatCoordinates,0,this.ends_,this.stride,t,o,0,u),new yy(o,"XY",u)}getType(){return"MultiLineString"}intersectsExtent(t){return SJ(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,o){this.setLayout(o,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const u=_y(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=u.length===0?0:u[u.length-1],this.changed()}}class uf extends Au{constructor(t,o){super(),this.setCoordinates(t,o)}clone(){const t=new uf(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,o,u,p){const y=this.flatCoordinates,T=nf(t,o,y[0],y[1]);if(T<p){const s=this.stride;for(let M=0;M<s;++M)u[M]=y[M];return u.length=s,T}return p}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return dF(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return cF(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,o){this.setLayout(o,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xJ(this.flatCoordinates,0,t,this.stride),this.changed()}}class vy extends Au{constructor(t,o){super(),o&&!Array.isArray(t[0])?this.setFlatCoordinates(o,t):this.setCoordinates(t,o)}appendPoint(t){Cu(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new vy(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,o,u,p){if(p<rf(this.getExtent(),t,o))return p;const y=this.flatCoordinates,T=this.stride;for(let s=0,M=y.length;s<M;s+=T){const L=nf(t,o,y[s],y[s+1]);
vendor: 12,707 bytes, line 2826
2826if(L<p){p=L;for(let B=0;B<T;++B)u[B]=y[s+B];u.length=T}}return p}getCoordinates(){return rb(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const o=this.flatCoordinates.length/this.stride;return t<0||o<=t?null:new uf(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,o=this.layout,u=this.stride,p=[];for(let y=0,T=t.length;y<T;y+=u){const s=new uf(t.slice(y,y+u),o);p.push(s)}return p}getType(){return"MultiPoint"}intersectsExtent(t){const o=this.flatCoordinates,u=this.stride;for(let p=0,y=o.length;p<y;p+=u){const T=o[p],s=o[p+1];if(cF(t,T,s))return!0}return!1}setCoordinates(t,o){this.setLayout(o,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=tb(this.flatCoordinates,0,t,this.stride),this.changed()}}function UF(e,t,o,u){let p=0;const y=e[o-u],T=e[o-u+1];let s=0,M=0;for(;t<o;t+=u){const L=e[t]-y,B=e[t+1]-T;p+=M*L-s*B,s=L,M=B}return p/2}function jF(e,t,o,u){let p=0;for(let y=0,T=o.length;y<T;++y){const s=o[y];p+=UF(e,t,s,u),t=s}return p}function MJ(e,t,o,u){let p=0;for(let y=0,T=o.length;y<T;++y){const s=o[y];p+=jF(e,t,s,u),t=s[s.length-1]}return p}class xy extends Au{constructor(t,o){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,o!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(o,t):this.setCoordinates(t,o)}clone(){return new xy(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,o,u,p){return p<rf(this.getExtent(),t,o)?p:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qC(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),WC(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,o,u,p))}getArea(){return UF(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return rb(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const o=[];return o.length=ob(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,o,0),new xy(o,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,o){this.setLayout(o,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=tb(this.flatCoordinates,0,t,this.stride),this.changed()}}function eI(e,t,o,u,p,y,T){let s,M,L,B,H,$,te;const xe=p[y+1],pe=[];for(let ie=0,ke=o.length;ie<ke;++ie){const ot=o[ie];for(B=e[ot-u],$=e[ot-u+1],s=t;s<ot;s+=u)H=e[s],te=e[s+1],(xe<=$&&te<=xe||$<=xe&&xe<=te)&&(L=(xe-$)/(te-$)*(H-B)+B,pe.push(L)),B=H,$=te}let Ne=NaN,_e=-1/0;for(pe.sort(iF),B=pe[0],s=1,M=pe.length;s<M;++s){H=pe[s];const ie=Math.abs(H-B);ie>_e&&(L=(B+H)/2,JC(e,t,o,u,L,xe)&&(Ne=L,_e=ie)),B=H}return isNaN(Ne)&&(Ne=p[y]),T?(T.push(Ne,xe,_e),T):[Ne,xe,_e]}function GF(e,t,o,u,p){let y=[];for(let T=0,s=o.length;T<s;++T){const M=o[T];y=eI(e,t,M,u,p,2*T,y),t=M[M.length-1]}return y}function kJ(e,t,o,u){for(;t<o-u;){for(let p=0;p<u;++p){const y=e[t+p];e[t+p]=e[o-u+p],e[o-u+p]=y}t+=u,o-=u}}function tI(e,t,o,u){let p=0,y=e[o-u],T=e[o-u+1];for(;t<o;t+=u){const s=e[t],M=e[t+1];p+=(s-y)*(M+T),y=s,T=M}return p===0?void 0:p>0}function rI(e,t,o,u,p){p=p!==void 0?p:!1;for(let y=0,T=o.length;y<T;++y){const s=o[y],M=tI(e,t,s,u);if(y===0){if(p&&M||!p&&!M)return!1}else if(p&&!M||!p&&M)return!1;t=s}return!0}function $F(e,t,o,u,p){for(let y=0,T=o.length;y<T;++y){const s=o[y];if(!rI(e,t,s,u,p))return!1;s.length&&(t=s[s.length-1])}return!0}function sb(e,t,o,u,p){p=p!==void 0?p:!1;for(let y=0,T=o.length;y<T;++y){const s=o[y],M=tI(e,t,s,u);(y===0?p&&M||!p&&!M:p&&!M||!p&&M)&&kJ(e,t,s,u),t=s}return t}function iI(e,t,o,u,p){for(let y=0,T=o.length;y<T;++y)t=sb(e,t,o[y],u,p);return t}function RJ(e,t){const o=[];let u=0,p=0,y;for(let T=0,s=t.length;T<s;++T){const M=t[T],L=tI(e,u,M,2);if(y===void 0&&(y=L),L===y)o.push(t.slice(p,T+1));else{if(o.length===0)continue;o[o.length-1].push(t[p])}p=T+1,u=M}return o}class hf extends Au{constructor(t,o,u){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,o!==void 0&&u?(this.setFlatCoordinates(o,t),this.ends_=u):this.setCoordinates(t,o)}appendLinearRing(t){this.flatCoordinates?Cu(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new hf(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,o,u,p){return p<rf(this.getExtent(),t,o)?p:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ZC(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),XC(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,o,u,p))}containsXY(t,o){return JC(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,o)}getArea(){return jF(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let o;return t!==void 0?(o=this.getOrientedFlatCoordinates().slice(),sb(o,0,this.ends_,this.stride,t)):o=this.flatCoordinates,YC(o,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Z1(this.getExtent());this.flatInteriorPoint_=eI(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new uf(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new xy(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,o=this.flatCoordinates,u=this.ends_,p=[];let y=0;for(let T=0,s=u.length;T<s;++T){const M=u[T],L=new xy(o.slice(y,M),t);p.push(L),y=M}return p}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;rI(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=sb(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const o=[],u=[];return o.length=QC(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),o,0,u),new hf(o,"XY",u)}getType(){return"Polygon"}intersectsExtent(t){return NF(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,o){this.setLayout(o,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const u=_y(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=u.length===0?0:u[u.length-1],this.changed()}}function HF(e,t,o,u){const p=[];let y=kC();for(let T=0,s=o.length;T<s;++T){const M=o[T];y=LC(e,t,M[0],u),p.push((y[0]+y[2])/2,(y[1]+y[3])/2),t=M[M.length-1]}return p}class by extends Au{constructor(t,o,u){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!u&&!Array.isArray(t[0])){const p=t,y=[],T=[];for(let s=0,M=p.length;s<M;++s){const L=p[s],B=y.length,H=L.getEnds();for(let $=0,te=H.length;$<te;++$)H[$]+=B;Cu(y,L.getFlatCoordinates()),T.push(H)}o=p.length===0?this.getLayout():p[0].getLayout(),t=y,u=T}o!==void 0&&u?(this.setFlatCoordinates(o,t),this.endss_=u):this.setCoordinates(t,o)}appendPolygon(t){let o;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),o=t.getEnds().slice(),this.endss_.push();else{const u=this.flatCoordinates.length;Cu(this.flatCoordinates,t.getFlatCoordinates()),o=t.getEnds().slice();for(let p=0,y=o.length;p<y;++p)o[p]+=u}this.endss_.push(o),this.changed()}clone(){const t=this.endss_.length,o=new Array(t);for(let p=0;p<t;++p)o[p]=this.endss_[p].slice();const u=new by(this.flatCoordinates.slice(),this.layout,o);return u.applyProperties(this),u}closestPointXY(t,o,u,p){return p<rf(this.getExtent(),t,o)?p:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(yJ(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),vJ(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,o,u,p))}containsXY(t,o){return EJ(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,o)}getArea(){return MJ(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let o;return t!==void 0?(o=this.getOrientedFlatCoordinates().slice(),iI(o,0,this.endss_,this.stride,t)):o=this.flatCoordinates,bJ(o,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=HF(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=GF(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new vy(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;$F(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=iI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const o=[],u=[];return o.length=PJ(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),o,0,u),new by(o,"XY",u)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let o;if(t===0)o=0;else{const y=this.endss_[t-1];o=y[y.length-1]}const u=this.endss_[t].slice(),p=u[u.length-1];if(o!==0)for(let y=0,T=u.length;y<T;++y)u[y]-=o;return new hf(this.flatCoordinates.slice(o,p),this.layout,u)}getPolygons(){const t=this.layout,o=this.flatCoordinates,u=this.endss_,p=[];let y=0;for(let T=0,s=u.length;T<s;++T){const M=u[T].slice(),L=M[M.length-1];if(y!==0)for(let H=0,$=M.length;H<$;++H)M[H]-=y;const B=new hf(o.slice(y,L),t,M);p.push(B),y=L}return p}getType(){return"MultiPolygon"}intersectsExtent(t){return IJ(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,o){this.setLayout(o,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const u=OF(this.flatCoordinates,0,t,this.stride,this.endss_);if(u.length===0)this.flatCoordinates.length=0;else{const p=u[u.length-1];this.flatCoordinates.length=p.length===0?0:p[p.length-1]}this.changed()}}const qF=PF();class df{constructor(t,o,u,p,y,T){this.styleFunction,this.extent_,this.id_=T,this.type_=t,this.flatCoordinates_=o,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=u||null,this.properties_=y,this.squaredTolerance_,this.stride_=p,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?dF(this.flatCoordinates_):LC(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Z1(this.getExtent());this.flatInteriorPoints_=eI(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=RJ(this.flatCoordinates_,this.ends_),o=HF(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=GF(this.flatCoordinates_,0,t,this.stride_,o)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ib(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let o=0;const u=this.ends_;for(let p=0,y=u.length;p<y;++p){const T=u[p],s=ib(t,o,T,this.stride_,.5);Cu(this.flatMidpoints_,s),o=T}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,o){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Ra(t);const o=t.getExtent(),u=t.getWorldExtent();if(o&&u){const p=W1(u)/W1(o);MF(qF,u[0],u[3],p,-p,0,0,0),kF(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,qF,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var t;
2826return new df(this.type_,this.flatCoordinates_.slice(),(t=this.ends_)==null?void 0:t.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=oF((t,o)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),o&&this.simplifiedGeometry_.applyTransform(o);const u=this.simplifiedGeometry_.getFlatCoordinates();let p;switch(this.type_){case"LineString":u.length=ob(u,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,u,0),p=[u.length];break;case"MultiLineString":p=[],u.length=VF(u,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,u,0,p);break;case"Polygon":p=[],u.length=QC(u,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),u,0,p);break}return p&&(this.simplifiedGeometry_=new df(this.type_,u,p,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}df.prototype.getFlatCoordinates=df.prototype.getOrientedFlatCoordinates;class ZF{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=om,this.supportedMediaTypes=null}getReadOptions(t,o){if(o){let u=o.dataProjection?Ra(o.dataProjection):this.readProjection(t);o.extent&&u&&u.getUnits()==="tile-pixels"&&(u=Ra(u),u.setWorldExtent(o.extent)),o={dataProjection:u,featureProjection:o.featureProjection}}return this.adaptOptions(o)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return qn()}readFeature(t,o){return qn()}readFeatures(t,o){return qn()}readGeometry(t,o){return qn()}readProjection(t){return qn()}writeFeature(t,o){return qn()}writeFeatures(t,o){return qn()}writeGeometry(t,o){return qn()}}function wy(e,t,o){const u=o?Ra(o.featureProjection):null,p=o?Ra(o.dataProjection):null;let y=e;if(u&&p&&!dJ(u,p)){t&&(y=e.clone());const T=t?u:p,s=t?p:u;T.getUnits()==="tile-pixels"?y.transform(T,s):y.applyTransform($C(T,s))}if(t&&o&&o.decimals!==void 0){const T=Math.pow(10,o.decimals),s=function(M){for(let L=0,B=M.length;L<B;++L)M[L]=Math.round(M[L]*T)/T;return M};y===e&&(y=e.clone()),y.applyTransform(s)}return y}const LJ={Point:uf,LineString:cf,Polygon:hf,MultiPoint:vy,MultiLineString:yy,MultiPolygon:by};function zJ(e,t,o){return Array.isArray(t[0])?($F(e,0,t,o)||(e=e.slice(),iI(e,0,t,o)),e):(rI(e,0,t,o)||(e=e.slice(),sb(e,0,t,o)),e)}function WF(e,t){var y;const o=e.geometry;if(!o)return[];if(Array.isArray(o))return o.map(T=>WF({...e,geometry:T})).flat();const u=o.type==="MultiPolygon"?"Polygon":o.type;if(u==="GeometryCollection"||u==="Circle")throw new Error("Unsupported geometry type: "+u);const p=o.layout.length;return wy(new df(u,u==="Polygon"?zJ(o.flatCoordinates,o.ends,p):o.flatCoordinates,(y=o.ends)==null?void 0:y.flat(),p,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function nI(e,t){if(!e)return null;if(Array.isArray(e)){const u=e.map(p=>nI(p,t));return new Iu(u)}const o=LJ[e.type];return wy(new o(e.flatCoordinates,e.layout||"XY",e.ends),!1,t)}const Fn={POINT:1,LINE_STRING:2,POLYGON:3,MULTI_POINT:4,MULTI_LINE_STRING:5,MULTI_POLYGON:6,GEOMETRY_COLLECTION:7,POLYHEDRAL_SURFACE:15,TIN:16,TRIANGLE:17};class XF{constructor(t){this.view_=t,this.pos_=0,this.initialized_=!1,this.isLittleEndian_=!1,this.hasZ_=!1,this.hasM_=!1,this.srid_=null,this.layout_="XY"}readUint8(){return this.view_.getUint8(this.pos_++)}readUint32(t){return this.view_.getUint32((this.pos_+=4)-4,t!==void 0?t:this.isLittleEndian_)}readDouble(t){return this.view_.getFloat64((this.pos_+=8)-8,t!==void 0?t:this.isLittleEndian_)}readPoint(){const t=[];return t.push(this.readDouble()),t.push(this.readDouble()),this.hasZ_&&t.push(this.readDouble()),this.hasM_&&t.push(this.readDouble()),t}readLineString(){const t=this.readUint32(),o=[];for(let u=0;u<t;u++)o.push(this.readPoint());return o}readPolygon(){const t=this.readUint32(),o=[];for(let u=0;u<t;u++)o.push(this.readLineString());return o}readWkbHeader(t){const u=this.readUint8()>0,p=this.readUint32(u),y=Math.floor((p&268435455)/1e3),T=!!(p&2147483648)||y===1||y===3,s=!!(p&1073741824)||y===2||y===3,M=!!(p&536870912),L=(p&268435455)%1e3,B=["XY",T?"Z":"",s?"M":""].join(""),H=M?this.readUint32(u):null;if(t!==void 0&&t!==L)throw new Error("Unexpected WKB geometry type "+L);if(this.initialized_){if(this.isLittleEndian_!==u)throw new Error("Inconsistent endian");if(this.layout_!==B)throw new Error("Inconsistent geometry layout");if(H&&this.srid_!==H)throw new Error("Inconsistent coordinate system (SRID)")}else this.isLittleEndian_=u,this.hasZ_=T,this.hasM_=s,this.layout_=B,this.srid_=H,this.initialized_=!0;return L}readWkbPayload(t){switch(t){case Fn.POINT:return this.readPoint();case Fn.LINE_STRING:return this.readLineString();case Fn.POLYGON:case Fn.TRIANGLE:return this.readPolygon();case Fn.MULTI_POINT:return this.readMultiPoint();case Fn.MULTI_LINE_STRING:return this.readMultiLineString();case Fn.MULTI_POLYGON:case Fn.POLYHEDRAL_SURFACE:case Fn.TIN:return this.readMultiPolygon();case Fn.GEOMETRY_COLLECTION:return this.readGeometryCollection();default:throw new Error("Unsupported WKB geometry type "+t+" is found")}}readWkbBlock(t){return this.readWkbPayload(this.readWkbHeader(t))}readWkbCollection(t,o){const u=this.readUint32(),p=[];for(let y=0;y<u;y++){const T=t.call(this,o);T&&p.push(T)}return p}readMultiPoint(){return this.readWkbCollection(this.readWkbBlock,Fn.POINT)}readMultiLineString(){return this.readWkbCollection(this.readWkbBlock,Fn.LINE_STRING)}readMultiPolygon(){return this.readWkbCollection(this.readWkbBlock,Fn.POLYGON)}readGeometryCollection(){return this.readWkbCollection(this.readGeometry)}readGeometry(){const t=this.readWkbHeader(),o=this.readWkbPayload(t);switch(t){case Fn.POINT:return new uf(o,this.layout_);case Fn.LINE_STRING:return new cf(o,this.layout_);case Fn.POLYGON:case Fn.TRIANGLE:return new hf(o,this.layout_);case Fn.MULTI_POINT:return new vy(o,this.layout_);case Fn.MULTI_LINE_STRING:return new yy(o,this.layout_);case Fn.MULTI_POLYGON:case Fn.POLYHEDRAL_SURFACE:case Fn.TIN:return new by(o,this.layout_);case Fn.GEOMETRY_COLLECTION:return new Iu(o);default:return null}}getSrid(){return this.srid_}}class DJ{constructor(t){t=t||{},this.layout_=t.layout,this.isLittleEndian_=t.littleEndian!==!1,this.isEWKB_=t.ewkb!==!1,this.writeQueue_=[],this.nodata_=Object.assign({X:0,Y:0,Z:0,M:0},t.nodata)}writeUint8(t){this.writeQueue_.push([1,t])}writeUint32(t){this.writeQueue_.push([4,t])}writeDouble(t){this.writeQueue_.push([8,t])}writePoint(t,o){const u=Object.assign.apply(null,o.split("").map((p,y)=>({[p]:t[y]})));for(const p of this.layout_)this.writeDouble(p in u?u[p]:this.nodata_[p])}writeLineString(t,o){this.writeUint32(t.length);for(let u=0;u<t.length;u++)this.writePoint(t[u],o)}writePolygon(t,o){this.writeUint32(t.length);for(let u=0;u<t.length;u++)this.writeLineString(t[u],o)}writeWkbHeader(t,o){t%=1e3,this.layout_.includes("Z")&&(t+=this.isEWKB_?2147483648:1e3),this.layout_.includes("M")&&(t+=this.isEWKB_?1073741824:2e3),this.isEWKB_&&Number.isInteger(o)&&(t|=536870912),this.writeUint8(this.isLittleEndian_?1:0),this.writeUint32(t),this.isEWKB_&&Number.isInteger(o)&&this.writeUint32(o)}writeMultiPoint(t,o){this.writeUint32(t.length);for(let u=0;u<t.length;u++)this.writeWkbHeader(1),this.writePoint(t[u],o)}writeMultiLineString(t,o){this.writeUint32(t.length);for(let u=0;u<t.length;u++)this.writeWkbHeader(2),this.writeLineString(t[u],o)}writeMultiPolygon(t,o){this.writeUint32(t.length);for(let u=0;u<t.length;u++)this.writeWkbHeader(3),this.writePolygon(t[u],o)}writeGeometryCollection(t){this.writeUint32(t.length);for(let o=0;o<t.length;o++)this.writeGeometry(t[o])}findMinimumLayout(t,o="XYZM"){const u=(p,y)=>p===y?p:p==="XYZM"?y:y==="XYZM"?p:"XY";if(t instanceof Au)return u(t.getLayout(),o);if(t instanceof Iu){const p=t.getGeometriesArray();for(let y=0;y<p.length&&o!=="XY";y++)o=this.findMinimumLayout(p[y],o)}return o}writeGeometry(t,o){const u={Point:Fn.POINT,LineString:Fn.LINE_STRING,Polygon:Fn.POLYGON,MultiPoint:Fn.MULTI_POINT,MultiLineString:Fn.MULTI_LINE_STRING,MultiPolygon:Fn.MULTI_POLYGON,GeometryCollection:Fn.GEOMETRY_COLLECTION},p=t.getType(),y=u[p];if(!y)throw new Error("GeometryType "+p+" is not supported");this.layout_||(this.layout_=this.findMinimumLayout(t)),this.writeWkbHeader(y,o),t instanceof Au?{Point:this.writePoint,
2826LineString:this.writeLineString,Polygon:this.writePolygon,MultiPoint:this.writeMultiPoint,MultiLineString:this.writeMultiLineString,MultiPolygon:this.writeMultiPolygon}[p].call(this,t.getCoordinates(),t.getLayout()):t instanceof Iu&&this.writeGeometryCollection(t.getGeometriesArray())}getBuffer(){const t=this.writeQueue_.reduce((y,T)=>y+T[0],0),o=new ArrayBuffer(t),u=new DataView(o);let p=0;return this.writeQueue_.forEach(y=>{switch(y[0]){case 1:u.setUint8(p,y[1]);break;case 4:u.setUint32(p,y[1],this.isLittleEndian_);break;case 8:u.setFloat64(p,y[1],this.isLittleEndian_);break}p+=y[0]}),o}}class YF extends ZF{constructor(t){super(),t=t||{},this.splitCollection=!!t.splitCollection,this.viewCache_=null,this.hex_=t.hex!==!1,this.littleEndian_=t.littleEndian!==!1,this.ewkb_=t.ewkb!==!1,this.layout_=t.geometryLayout,this.nodataZ_=t.nodataZ||0,this.nodataM_=t.nodataM||0,this.srid_=t.srid}getType(){return this.hex_?"text":"arraybuffer"}readFeature(t,o){return new om({geometry:this.readGeometry(t,o)})}readFeatures(t,o){let u=[];const p=this.readGeometry(t,o);return this.splitCollection&&p instanceof Iu?u=p.getGeometriesArray():u=[p],u.map(y=>new om({geometry:y}))}readGeometry(t,o){const u=KF(t);if(!u)return null;const y=new XF(u).readGeometry();return this.viewCache_=u,o=this.getReadOptions(t,o),this.viewCache_=null,wy(y,!1,o)}readProjection(t){const o=this.viewCache_||KF(t);if(!o)return;const u=new XF(o);return u.readWkbHeader(),u.getSrid()&&Ra("EPSG:"+u.getSrid())||void 0}writeFeature(t,o){return this.writeGeometry(t.getGeometry(),o)}writeFeatures(t,o){return this.writeGeometry(new Iu(t.map(u=>u.getGeometry())),o)}writeGeometry(t,o){o=this.adaptOptions(o);const u=new DJ({layout:this.layout_,littleEndian:this.littleEndian_,ewkb:this.ewkb_,nodata:{Z:this.nodataZ_,M:this.nodataM_}});let p=Number.isInteger(this.srid_)?Number(this.srid_):null;if(this.srid_!==!1&&!Number.isInteger(this.srid_)){const T=o.dataProjection&&Ra(o.dataProjection);if(T){const s=T.getCode();s.startsWith("EPSG:")&&(p=Number(s.substring(5)))}}u.writeGeometry(wy(t,!0,o),p);const y=u.getBuffer();return this.hex_?OJ(y):y}}function OJ(e){const t=new Uint8Array(e);return Array.from(t.values()).map(o=>(o<16?"0":"")+Number(o).toString(16).toUpperCase()).join("")}function FJ(e){const t=new Uint8Array(e.length/2);for(let o=0;o<e.length/2;o++)t[o]=parseInt(e.substr(o*2,2),16);return new DataView(t.buffer)}function KF(e){return typeof e=="string"?FJ(e):ArrayBuffer.isView(e)?e instanceof DataView?e:new DataView(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new DataView(e):null}class NJ extends ZF{constructor(){super()}getType(){return"json"}readFeature(t,o){return this.readFeatureFromObject(ab(t),this.getReadOptions(t,o))}readFeatures(t,o){return this.readFeaturesFromObject(ab(t),this.getReadOptions(t,o))}readFeatureFromObject(t,o){return qn()}readFeaturesFromObject(t,o){return qn()}readGeometry(t,o){return this.readGeometryFromObject(ab(t),this.getReadOptions(t,o))}readGeometryFromObject(t,o){return qn()}readProjection(t){return this.readProjectionFromObject(ab(t))}readProjectionFromObject(t){return qn()}writeFeature(t,o){return JSON.stringify(this.writeFeatureObject(t,o))}writeFeatureObject(t,o){return qn()}writeFeatures(t,o){return JSON.stringify(this.writeFeaturesObject(t,o))}writeFeaturesObject(t,o){return qn()}writeGeometry(t,o){return JSON.stringify(this.writeGeometryObject(t,o))}writeGeometryObject(t,o){return qn()}}function ab(e){if(typeof e=="string"){const t=JSON.parse(e);return t||null}return e!==null?e:null}class JF extends NJ{constructor(t){t=t||{},super(),this.dataProjection=Ra(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Ra(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,o){let u=null;t.type==="Feature"?u=t:u={type:"Feature",geometry:t,properties:null};const p=oI(u.geometry);if(this.featureClass===df)return WF({geometry:p,id:u.id,properties:u.properties},o);const y=new om;return this.geometryName_?y.setGeometryName(this.geometryName_):this.extractGeometryName_&&u.geometry_name&&y.setGeometryName(u.geometry_name),y.setGeometry(nI(p,o)),"id"in u&&y.setId(u.id),u.properties&&y.setProperties(u.properties,!0),y}readFeaturesFromObject(t,o){const u=t;let p=null;if(u.type==="FeatureCollection"){const y=t;p=[];const T=y.features;for(let s=0,M=T.length;s<M;++s){const L=this.readFeatureFromObject(T[s],o);L&&p.push(L)}}else p=[this.readFeatureFromObject(t,o)];return p.flat()}readGeometryFromObject(t,o){return BJ(t,o)}readProjectionFromObject(t){const o=t.crs;let u;if(o)if(o.type=="name")u=Ra(o.properties.name);else if(o.type==="EPSG")u=Ra("EPSG:"+o.properties.code);else throw new Error("Unknown SRS type");else u=this.dataProjection;return u}writeFeatureObject(t,o){o=this.adaptOptions(o);const u={type:"Feature",geometry:null,properties:null},p=t.getId();if(p!==void 0&&(u.id=p),!t.hasProperties())return u;const y=t.getProperties(),T=t.getGeometry();return T&&(u.geometry=sI(T,o),delete y[t.getGeometryName()]),tF(y)||(u.properties=y),u}writeFeaturesObject(t,o){o=this.adaptOptions(o);const u=[];for(let p=0,y=t.length;p<y;
2826++p)u.push(this.writeFeatureObject(t[p],o));return{type:"FeatureCollection",features:u}}writeGeometryObject(t,o){return sI(t,this.adaptOptions(o))}}function oI(e,t){if(!e)return null;let o;switch(e.type){case"Point":{o=UJ(e);break}case"LineString":{o=jJ(e);break}case"Polygon":{o=qJ(e);break}case"MultiPoint":{o=$J(e);break}case"MultiLineString":{o=GJ(e);break}case"MultiPolygon":{o=HJ(e);break}case"GeometryCollection":{o=VJ(e);break}default:throw new Error("Unsupported GeoJSON type: "+e.type)}return o}function BJ(e,t){const o=oI(e);return nI(o,t)}function VJ(e,t){return e.geometries.map(function(u){return oI(u)})}function UJ(e){const t=e.coordinates;return{type:"Point",flatCoordinates:t,layout:af(t.length)}}function jJ(e){var u;const t=e.coordinates,o=t.flat();return{type:"LineString",flatCoordinates:o,ends:[o.length],layout:af(((u=t[0])==null?void 0:u.length)||2)}}function GJ(e){var y,T;const t=e.coordinates,o=((T=(y=t[0])==null?void 0:y[0])==null?void 0:T.length)||2,u=[],p=_y(u,0,t,o);return{type:"MultiLineString",flatCoordinates:u,ends:p,layout:af(o)}}function $J(e){var o;const t=e.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:af(((o=t[0])==null?void 0:o.length)||2)}}function HJ(e){var y,T;const t=e.coordinates,o=[],u=((T=(y=t[0])==null?void 0:y[0])==null?void 0:T[0].length)||2,p=OF(o,0,t,u);return{type:"MultiPolygon",flatCoordinates:o,ends:p,layout:af(u)}}function qJ(e){var y,T;const t=e.coordinates,o=[],u=(T=(y=t[0])==null?void 0:y[0])==null?void 0:T.length,p=_y(o,0,t,u);return{type:"Polygon",flatCoordinates:o,ends:p,layout:af(u)}}function sI(e,t){e=wy(e,!0,t);const o=e.getType();let u;switch(o){case"Point":{u=JJ(e);break}case"LineString":{u=WJ(e);break}case"Polygon":{u=QJ(e,t);break}case"MultiPoint":{u=YJ(e);break}case"MultiLineString":{u=XJ(e);break}case"MultiPolygon":{u=KJ(e,t);break}case"GeometryCollection":{u=ZJ(e,t);break}case"Circle":{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return u}function ZJ(e,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:e.getGeometriesArray().map(function(u){return sI(u,t)})}}function WJ(e,t){return{type:"LineString",coordinates:e.getCoordinates()}}function XJ(e,t){return{type:"MultiLineString",coordinates:e.getCoordinates()}}function YJ(e,t){return{type:"MultiPoint",coordinates:e.getCoordinates()}}function KJ(e,t){let o;return t&&(o=t.rightHanded),{type:"MultiPolygon",coordinates:e.getCoordinates(o)}}function JJ(e,t){return{type:"Point",coordinates:e.getCoordinates()}}function QJ(e,t){let o;return t&&(o=t.rightHanded),{type:"Polygon",coordinates:e.getCoordinates(o)}}const hm=4326,eQ={type:"point",mode:"xy",srid:hm},aI={type:"multipolygon",mode:"xy",srid:hm};function QF(e){let t=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)t[o/2]=parseInt(e.substr(o,2),16);return t}const ko=(e,t="geometry")=>{const o={geography_multipolygon:`GEOGRAPHY(MULTIPOLYGON,${hm})`,geometry:`geometry(GEOMETRY, ${hm})`}[t];return F1({dataType(){return o},toDriver(u){if(typeof u=="string")throw new Error("Data is string, not (yet?) supported");return u.type==="FeatureCollection"?_t`
2827          ST_Collect(
2828            ARRAY(
2829              SELECT ST_GeomFromGeoJSON(elem->>'geometry')
2830              FROM jsonb_array_elements(${JSON.stringify(u)}::jsonb->'features') AS elem
2831            )
2832          )
2833        `:_t`ST_GeomFromGeoJSON(${JSON.stringify(u)})`},fromDriver(u){const p=new YF,y=new JF,T=p.readGeometry(QF(u));let s=y.writeGeometryObject(T);return s.type==="GeometryCollection"&&(s={type:"FeatureCollection",features:s.geometries.map(M=>({type:"Feature",geometry:M,properties:{}}))}),s}})(e,void 0)},tQ=F1({dataType(){return"box2d"}}),e5=e=>F1({dataType(){return`geometry(POINT, ${hm})`},toDriver(t){if(!t||typeof t.x!="number"||typeof t.y!="number")throw new Error("Invalid Point geometry");return _t`ST_SetSRID(ST_MakePoint(${t.x}, ${t.y}), ${hm})`},fromDriver(t){if(!t)throw new Error("Empty geometry value from DB");const u=new YF().readGeometry(QF(t)),[p,y]=u.getCoordinates();return{x:p,y}}})(e,void 0),lI={createdBy:Bs("created_by").notNull(),updatedBy:Bs("updated_by").notNull()},Dh={createdBy:Bs("created_by"),updatedBy:Bs("updated_by")},cI={sourceRef:ut("source_ref")},uI={createdVia:ut("created_via").$type()},t5={area:Vs("area"),ecopoints:Vs("ecopoints"),description:ut("description"),stage:ut("stage"),availability:uy("availability"),initialState:ut("initial_state").array(),postcode:ut("postcode"),notes:ut("notes"),visibility:ut("visibility"),source:ut("source"),hubspotUtk:ut("hubspot_utk"),pointSource:ut("point_source"),point:e5("point"),geom:ko("geom")},us=YO("serving"),Oh=YO("app");
2833Us("municipalities",{code:ut("code").notNull(),state_code:ut("state_code").notNull(),district_code:ut("district_code").notNull(),administration_code:ut("administration_code").notNull(),name:ut("name").notNull(),is_city:nc("is_city").notNull(),geom:ko("geom","geography_multipolygon").notNull()},e=>({geom_idx:zh("municipalities_geom_idx").using("gist",e.geom)})),Us("districts",{code:ut("code").notNull(),name:ut("name").notNull(),name_long:ut("name_long").notNull(),geom:im("geom",aI).notNull()}),Us("postcodes",{postcode:yn("postcode").notNull(),geom:im("geom").notNull(),point:im("point",eQ).notNull()},e=>({geom_idx:zh("postcodes_geom_idx").using("gist",e.geom)})),Us("compensation_areas",{name:ut("name").notNull(),state_code:ut("state_code").notNull(),sub_code:ut("sub_code").notNull(),is_original:nc("is_original").notNull(),geom:ko("geom","geography_multipolygon").notNull(),code:ut("code").notNull()},e=>({geom_idx:zh("compensation_areas_geom_idx").using("gist",e.geom)})),Us("ecoregions",{code:ut("code").notNull(),name:ut("name").notNull(),geom:ko("geom","geography_multipolygon").notNull()},e=>({geom_idx:zh("ecoregions_geom_idx").using("gist",e.geom)})),Us("states",{code:ut("code").notNull(),name:ut("name").notNull(),nameShort:ut("name_short").notNull(),geom:im("geom",aI).notNull()});const La={createdAt:Lh("created_at").notNull().defaultNow(),updatedAt:Lh("updated_at").notNull().defaultNow().$onUpdate(()=>new Date)},rQ=Us("notes",{id:Rh("note_id").primaryKey(),kind:yn("kind",{length:20}),organisation:yn("organisation"),website:yn("website",{length:2048}),name:yn("name").notNull(),email:yn("email"),phone:yn("phone",{length:50}),...t5,...lI,...La}),iQ=Us("projects",{id:Rh("project_id").primaryKey(),name:ut("name").notNull(),description:ut("description"),deadline:uy("deadline"),googleDriveUrl:ut("google_drive_url"),hubspotUrl:ut("hubspot_url"),planningAssessment:ut("environmental_planning_assessment"),...lI,...La});Us("project_offer_assignments",{projectId:Bs("project_id").notNull(),offerId:ut("offer_id").notNull(),...lI,...La},e=>({pk:kY({columns:[e.projectId,e.offerId]})}));const hI={...t5,offerIdPrevious:ut("offer_id_previous"),uid:ut("uid"),userId:Bs("user_id").notNull(),...La,initialStateNotes:ut("initial_state_notes"),initialEcopoints:Vs("initial_ecopoints"),hasEcopoints:nc("has_ecopoints"),evaluationMethod:ut("evaluation_method"),hasAdditionalPlots:nc("has_additional_plots"),additionalPlotsArea:Vs("additional_plots_area"),price:Vs("price"),priceNote:ut("price_note"),isPricePrivate:nc("is_price_private")},nQ=Us("offers_common",{id:Rh("offer_common_id").primaryKey(),...hI,parcelBlock:ut("parcel_block"),parcel:ut("parcel"),measures:ut("measures").array().$type(),geoDoc:el("geo_doc"),assessmentLinks:el("assessment_links").$type(),ownership:ut("ownership").$type(),lifecycleStatus:ut("lifecycle_status").notNull().default("active"),...Dh,...uI});us.materializedView("offers_all",{id:ut("offer_id").notNull(),...hI,price:Vs("price"),readiness:ut("readiness"),parcels:ut("parcels"),stage:ut("stage"),availability:uy("availability"),initialStateDesc:ut("initial_state_desc"),ecoregion:ut("ecoregion"),district:ut("district"),contactName:ut("contact_name"),contactEmail:ut("contact_email"),contactPhone:ut("contact_phone"),geom:ko("geom","geography_multipolygon").notNull(),partner:nc("partner"),searchText:ut("search_text"),measuresText:ut("measures_text"),measuresArray:ut("measures_array").array().$type(),initialStateArray:ut("initial_state_array").array().$type(),point:hI.point.notNull(),federalStateCode:ut("federal_state_code"),compensationAreaCode:ut("compensation_area_code"),areaCalc:ut("area_calculated"),ownership:ut("ownership").$type(),sourceGroup:ut("source_group"),lifecycleStatus:ut("lifecycle_status").notNull().default("active").$type(),areaWithinProtectedArea:Vs("area_within_protected_area"),protectedAreaDistanceToNature2000:Vs("shortest_distance_to_nature_2000_protected_areas"),protectedAreaDistanceToAdjacent:Vs("shortest_distance_to_adjacent_strictly_protected_areas"),isOfferWithinProtectedArea:nc("is_offer_within_protected_area"),protectedAreasDetails:el("protected_areas_details").$type()}).existing(),us.table("translations_biotope_type_de",{state:ut("federal_state"),localCode:ut("local_code"),localEcoPoints:yn("local_ecopoints"),globalCode:yn("global_code"),globalEcoPoints:Bs("global_ecopoints"),localCategory1:yn("local_category_1"),localCategory2:yn("local_category_2"),localCategory3:yn("local_category_3"),localCategory4:yn("local_category_4"),localCategory5:yn("local_category_5"),globalCategory1:ut("global_category_1"),globalCategory2:ut("global_category_2"),globalCategory3:ut("global_category_3"),globalCategory4:ut("global_category_4"),globalCategory5:ut("global_category_5")}),us.table("biotope_codes_de",{id:Xo("biotope_code_id"),evaluationMethodId:Xo("evaluation_method_id").notNull(),code:ut("co
2833de").notNull(),ecoPoints:fC("ecopoints"),category1:ut("category_1"),category2:ut("category_2"),category3:ut("category_3"),category4:ut("category_4"),category5:ut("category_5")});const r5=Us("users",{id:Rh("user_id").primaryKey(),hubspotId:ut("hubspot_id"),hubspotSync:Lh("hubspot_sync"),salutation:ut("salutation"),givenName:ut("given_name"),familyName:ut("family_name"),email:ut("email").unique().notNull(),mobile:ut("mobile"),uid:ut("uid"),source:ut("source"),settings:FD("settings"),organisationId:Xo("organisation_id").defaultRandom().notNull().unique(),tosConsent:Lh("consent_tos"),newsletterConsent:Lh("consent_newsletter"),...Dh,...uI,...La}),oQ=Us("development_outlines",{id:Rh("development_outline_id").primaryKey(),name:ut("name").notNull(),organisationName:ut("organisation_name"),category:ut("category").notNull(),geom:ko("geom").notNull(),...La});us.table("protected_areas_de",{id:hy("id"),name:yn("name"),category:ut("category"),federalState:yn("federal_state"),area:hy("area"),geom:ko("geom")}),us.table("parcels_de",{id:yn("cadastral_ref"),federalStateRef:yn("federal_state_ref"),cadastralDistrictRef:yn("cadastral_district_ref"),areaLegal:Vs("area_legal"),validFromLegal:uy("valid_from_legal"),parcelUnit:yn("parcel_unit"),parcelBlock:yn("parcel_block"),cadastralDistrictName:ut("cadastral_district_name"),geom:ko("geom")}),us.table("cadastral_districts_de",{cadastralDistrictRef:ut("cadastral_district_ref"),cadastralDistrictName:ut("cadastral_district_name"),federalStateRef:ut("federal_state_ref"),geom:ko("geom")}),us.table("peatlands_de",{peatlandKey:ut("peatland_key"),peatlandCategory:yn("peatland_category"),geom:ko("geom")}),us.table("vegetation_areas_de",{id:ut("id"),federalState:ut("federal_state"),vegetationType:ut("vegetation_type"),gaVegetationClass:ut("ga_vegetation_class"),geom:ko("geom")}),us.table("afforestation_areas_de",{id:ut("id"),status:ut("status"),areaM2:hy("area_m2"),geom:ko("geom")}),us.table("feldlerche_habitat_areas_de",{id:ut("id"),status:ut("status"),areaM2:hy("area_m2"),geom:ko("geom")}),us.table("soil_type_de",{id:ut("id").primaryKey(),federalState:ut("federal_state"),sourceId:ut("source_id"),soilGroupId:ut("soil_group_id"),soilTypeDescription:ut("soil_type_description"),soilMainGroup:ut("soil_main_group"),geom:ko("geom")}),us.table("administrative_places_de",{name:yn("name"),municipality:ut("municipality"),geom:im("geom",aI)}),us.table("locations_index",{locationId:ut("location_id").primaryKey(),displayName:ut("display_name"),locationType:ut("location_type"),geom:ko("geom"),centroid:e5("centroid")}),us.table("streets_de",{id:tm("id",{mode:"number"}),streetType:yn("street_type"),streetName:yn("street_name"),streetSurface:yn("street_surface"),streetSurfaceFirmnessGrade:yn("street_surface_firmness_grade"),geom:ko("geom"),legalAccessPermission:yn("legal_access_permission"),legalAccessMotorVehiclePermission:yn("legal_access_motor_vehicle_permission"),streetWidth:yn("street_width"),maxSpeed:yn("max_speed"),oneWay:yn("one_way"),numberOfLanes:yn("number_of_lanes"),bridge:yn("bridge"),tunnel:yn("tunnel")}),us.table("buildings",{id:ut("building_id").primaryKey(),osmId:tm("osm_building_id",{mode:"number"}),buildingType:ut("building_type"),buildingRealUsage:ut("building_real_usage"),buildingName:ut("building_name"),streetName:ut("street_name"),housenumber:ut("housenumber"),numberOfFloors:ut("number_of_floors"),openedDate:ut("opened_date"),buildingRealHeight:ut("building_real_height"),geom:ko("geom")}),us.table("power_towers",{id:ut("power_tower_id").primaryKey(),osmId:tm("osm_power_tower_id",{mode:"number"}),operatorName:ut("operator_name"),identifier:ut("identifier"),hasUndergroundConnection:ut("has_underground_connection"),materialType:ut("material_type"),structureType:ut("structure_type"),design:ut("design"),height:ut("height"),geom:ko("geom")}),us.table("power_lines",{id:ut("power_line_id").primaryKey(),osmId:tm("osm_power_line_id",{mode:"number"}),isFinished:nc("is_finished"),voltage:ut("voltage"),conductorsCnt:ut("conductors_cnt"),transitCircuitsCnt:ut("transit_circuits_cnt"),operatorName:ut("operator_name"),subConductorsCnt:ut("sub_conductors_cnt"),powerLineName:ut("power_line_name"),identifier:ut("identifier"),substationConnectionType:ut("substation_connection_type"),layerCnt:ut("layer_cnt"),frequency:ut("frequency"),isDisused:nc("is_disused"),lineManagement:ut("line_management"),geom:ko("geom")}),us.table("wind_generators",{id:ut("wind_generator_id").primaryKey(),osmId:tm("osm_wind_generator_id",{mode:"number"}),axisType:ut("axis_type"),generatorRole:ut("generator_role"),height:ut("height"),rotorDiameter:ut("rotor_diameter"),generatorName:ut("generator_name"),operatorName:ut("operator_name"),powerCapacity:ut("power_capacity"),methodType:ut("method_type"),rotorSweptArea:ut("rotor_swept_area"),identifier:ut("identifier"),manufacturerName:ut("manufacturer_name"),openedDate:ut("opened_date"),geom:ko("geom")});const sQ=Us("price_inputs",{id:Rh("price_id").primaryKey(),federalStateCode:ut("federal_state_code"),ecoregionCode:ut("ecoregion_code"),districtCode:ut("district_code"),compensationType:ut("compensation_type"),priceFixed:Vs("price_fixed"),priceMin:Vs("price_min").notNull(),priceMax:Vs("price_max"),priceUnit:ut("price_unit"),priceType:ut("price_type"),ecopoints:Vs("ecopoints"),measures:ut("measures").array().$type(),evaluationMethod:ut("evaluation_method"),source:ut("source"),note:ut("note"),...La});Us("edit_log",{id:Rh("edit_log_id").primaryKey(),entityType:ut("entity_type").notNull(),entityId:ut("entity_id").notNull(),field:ut("field").notNull(),oldValue:el("old_value"),newValue:el("new_value"),createdBy:Bs("created_by").notNull(),createdAt:Lh("created_at").notNull().defaultNow()},e=>({entity_idx:zh("edit_log_entity_idx").on(e.entityType,e.entityId)}));const i5=Oh.table("evaluation_methods",{id:Xo("id").primaryKey().defaultRandom(),name:ut("name").notNull(),fullName:ut("full_name"),category:ut("category").notNull().$type(),federalStateCode:ut("federal_state_code").$type(),...La}),dI=Oh.table("land_pools",{id:Xo("id").primaryKey().defaultRandom(),name:ut("name").notNull(),districtCode:ut("district_code"),organisationId:Xo("organisation_id").references(()=>r5.organisationId),externalNotes:ut("external_notes"),internalNotes:ut("internal_notes"),technicalNotes:ut("technical_notes"),legacyAttributes:el("legacy_attributes").$type(),sourceOfferIds:Bs("source_offer_ids").array(),...cI,...Dh,...uI,...L
2833a},e=>({source_ref_unique:EC("land_pools_source_ref_unique").on(e.sourceRef).where(_t`${e.sourceRef} IS NOT NULL`)})),n5=Oh.table("compensations",{id:Xo("id").primaryKey().defaultRandom(),landPoolId:Xo("land_pool_id").notNull().references(()=>dI.id),environmentalFactor:ut("environmental_factor").$type(),initialEcopoints:Bs("initial_ecopoints"),ecopoints:Bs("ecopoints"),price:Vs("price"),evaluationMethodId:Xo("evaluation_method_id").references(()=>i5.id),...cI,...Dh,...La},e=>({source_ref_unique:EC("compensations_source_ref_unique").on(e.sourceRef).where(_t`${e.sourceRef} IS NOT NULL`)})),o5=Oh.table("pool_geometries",{id:Xo("id").primaryKey().defaultRandom(),landPoolId:Xo("land_pool_id").notNull().references(()=>dI.id),geom:ko("geom").notNull(),initialType:ut("initial_type"),targetType:ut("target_type"),status:ut("status").$type(),calculatedAreaM2:Vs("calculated_area_m2"),technicalNotes:ut("technical_notes"),measure:ut("measure").$type(),...cI,sourceRefs:ut("source_refs").array(),...Dh,...La},e=>({geom_idx:zh("pool_geometries_geom_idx").using("gist",e.geom),land_pool_id_idx:zh("pool_geometries_land_pool_id_idx").on(e.landPoolId),source_ref_unique:EC("pool_geometries_source_ref_unique").on(e.sourceRef).where(_t`${e.sourceRef} IS NOT NULL`)}));Oh.table("compensation_geometries",{id:Xo("id").primaryKey().defaultRandom(),compensationId:Xo("compensation_id").notNull().references(()=>n5.id),poolGeometryId:Xo("pool_geometry_id").notNull().references(()=>o5.id),...Dh,...La},e=>({service_area_unique:Bz("compensation_geometries_unique").on(e.compensationId,e.poolGeometryId)}));const aQ=Oh.table("geometry_valuations",{id:Xo("id").primaryKey().defaultRandom(),poolGeometryId:Xo("pool_geometry_id").notNull().references(()=>o5.id),evaluationMethodId:Xo("evaluation_method_id").notNull().references(()=>i5.id),initialBiotopeCode:ut("initial_biotope_code"),targetBiotopeCode:ut("target_biotope_code"),...Dh,...La},e=>({area_method_unique:Bz("geometry_valuations_geometry_method_unique").on(e.poolGeometryId,e.evaluationMethodId)}));Oh.table("organisations",{id:Xo("id").primaryKey().defaultRandom(),name:ut("name").notNull(),hubspotCompanyId:ut("hubspot_company_id"),...Dh,...La}),Oh.table("catalog_layers",{code:ut("code").primaryKey(),kind:ut("kind"),protocol:ut("protocol"),name:ut("name"),url:ut("url"),crs:ut("crs"),bbox:tQ("bbox"),infoUrl:ut("info_url"),status:ut("status"),style:el("style"),roles:el("roles").$type(),enabled:nc("enabled"),relevanceRadius:Bs("relevance_radius"),zoomMin:Bs("zoom_min"),zoomMax:Bs("zoom_max"),filter:el("filter").$type(),listing:el("listing").$type(),data:el("data"),topicCode:ut("topic_code"),sourceCode:ut("source_code"),regionCode:ut("region_code"),layerCode:ut("layer_code"),parentCode:ut("parent_code"),sortOrder:Bs("sort_order").notNull().default(0),geojson:el("geojson"),registryPath:ut("registry_path"),labelField:ut("label_field"),updatedAt:Lh("updated_at",{withTimezone:!0}).notNull().defaultNow()},e=>({layer_source_idx:zh("catalog_layers_layer_source_idx").on(e.layerCode,e.sourceCode)}));const lQ=br.object({x:br.number(),y:br.number()}),fI=br.record(br.any()).refine(e=>{const t=new JF;try{return!!t.readFeatures(e).length}catch{}}
2833,{message:"GeoJSON is invalid"}),cQ=()=>br.coerce.boolean().transform(e=>e?new Date:void 0),lb=e=>br.union([e,br.string().transform((t,o)=>{try{return t===""?null:JSON.parse(t)}catch(u){return o.addIssue({code:br.ZodIssueCode.custom,message:`Invalid JSON string (${u==null?void 0:u.message})`}),br.NEVER}}).pipe(e)]),s5=e=>{const t=br.array(br.enum(e));return br.union([t,br.string().transform((o,u)=>{try{return t.parse(o.trim().split(/[ ,]+/g))}catch{return u.addIssue({code:br.ZodIssueCode.custom,message:"Invalid tags string"}),br.NEVER}})])},uQ=e=>e.refine(t=>!t||["MultiPoint","MultiPolygon"].includes(t.type)?!0:t.type==="FeatureCollection",{message:"Mixed geometry types are not allowed"}),pI=e=>e===""||e==null?void 0:e,cb=br.string().uuid(),hQ=Su(r5,{email:e=>e.email.trim().toLowerCase().email(),tosConsent:cQ}).pick({salutation:!0,givenName:!0,familyName:!0,email:!0,mobile:!0,tosConsent:!0}).required({email:!0}),a5=br.coerce.string().regex(/^\d+$/),dQ=br.coerce.string().regex(/^\d+$/),Ty=br.coerce.string().regex(/^\d+(\.\d{1,5})?$/),mI=br.coerce.string().regex(/^\d+([.,]\d+)?$/).transform(e=>e.replace(/,/,".")),l5=br.string().regex(/^\d+$/).min(5).max(5),c5=s5(UW),u5=s5(GW),fQ=lb(lQ).nullish(),h5=lb(fI),pQ=br.array(br.object({note:br.string().nullish(),url:br.string().url()})).nullish(),mQ=Su(nQ,{ecopoints:a5,initialEcopoints:dQ,price:Ty,area:mI,additionalPlotsArea:mI,postcode:l5,initialState:c5.nullish(),measures:u5.nullish()}).pick({area:!0,initialState:!0,lifecycleStatus:!0,availability:!0,stage:!0,description:!0,notes:!0,visibility:!0,postcode:!0,source:!0,ecopoints:!0,hasEcopoints:!0,initialEcopoints:!0,measures:!0,hasAdditionalPlots:!0,additionalPlotsArea:!0,price:!0,priceNote:!0,isPricePrivate:!0,evaluationMethod:!0,assessmentLinks:!0}).extend({geoDoc:lb(fI).nullish(),assessmentLinks:pQ,ownership:br.enum(["owner","not_owner","unknown"]).nullish()});br.coerce.number().int().positive(),Su(rQ,{ecopoints:a5.nullish(),area:mI.nullish(),postcode:l5.nullish(),initialState:c5.nullish(),email:e=>e.email.email()}).omit({createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0}).extend({point:fQ,geom:h5}),Su(oQ,{}).omit({createdAt:!0,updatedAt:!0}).extend({category:br.enum(["powerline","other"]),geom:h5}),Su(iQ,{}).omit({createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0}).pick({name:!0,description:!0,deadline:!0,hubspotUrl:!0,googleDriveUrl:!0,planningAssessment:!0}),Su(sQ,{compensationType:br.enum(HW).nullish(),priceUnit:br.enum(WW).nullish(),priceType:br.enum(XW).nullish(),priceFixed:br.preprocess(pI,Ty.optional()),priceMin:br.preprocess(pI,Ty.optional()),priceMax:br.preprocess(pI,Ty.optional()),measures:br.preprocess(e=>e===!1?void 0:e,u5.nullish()),source:br.enum(YW).nullish()}).omit({id:!0,createdAt:!0,updatedAt:!0}).extend({priceMode:br.enum(["fixed","range"]).default("fixed")}).superRefine((e,t)=>{const{federalStateCode:o,ecoregionCode:u,districtCode:p,priceMode:y,priceFixed:T,priceMin:s,priceMax:M}=e;o!=null||u!=null||p!=null||t.addIssue({code:br.ZodIssueCode.custom,message:"Mindestens eines der Felder Bundesland, Naturraum oder Landkreis ist erforderlich.",path:["federalStateCode"]});const B=T!=null,H=s!=null,$=M!=null;if(y==="fixed"&&(B||t.addIssue({code:br.ZodIssueCode.custom,message:"Fixpreis fehlt.",path:["priceFixed"]}),(H||$)&&t.addIssue({code:br.ZodIssueCode.custom,message:"Fixpreis darf nicht mit Preisbereich kombiniert werden.",path:["priceFixed"]})),y==="range"&&(H||t.addIssue({code:br.ZodIssueCode.custom,message:"Minimaler Preis fehlt.",path:["priceMin"]}),B&&t.addIssue({code:br.ZodIssueCode.custom,message:"Preisbereich darf nicht mit Fixpreis kombiniert werden.",path:["priceMin"]}),$&&!H&&t.addIssue({code:br.ZodIssueCode.custom,message:"Minimaler Preis ist erforderlich, wenn ein Maximum angegeben ist.",path:["priceMin"]})),y==="range"&&H&&$){const te=Number(s),xe=Number(M);if(!Number.isNaN(te)&&!Number.isNaN(xe)&&xe<te){const pe="Maximaler Preis muss größer oder gleich minimalem Preis sein.";t.addIssue({code:br.ZodIssueCode.custom,message:pe,path:["priceMin"]}),t.addIssue({code:br.ZodIssueCode.custom,message:pe,path:["priceMax"]}
2833)}}}).transform(e=>{const{priceMode:t,...o}=e;if(o.priceFixed!=null)return{...o,priceMin:o.priceFixed,priceMax:o.priceFixed};if(o.priceMin==null)throw new Error("Invariant violated: priceMin must exist");return o}),Su(dI).omit({id:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0,createdVia:!0,sourceRef:!0,sourceOfferIds:!0,legacyAttributes:!0}).extend({districtCode:br.string().trim().min(1),organisationId:br.string().uuid()});const ub=e=>e===""?null:e,d5=br.preprocess(ub,br.coerce.number().int().nonnegative().max(2e9).nullish());Su(n5,{landPoolId:cb,environmentalFactor:br.preprocess(ub,br.enum(qW).nullish()),evaluationMethodId:br.preprocess(ub,cb.nullish()),ecopoints:d5,initialEcopoints:d5,price:br.preprocess(ub,Ty.nullish())}).omit({id:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0}),Su(aQ,{poolGeometryId:cb,evaluationMethodId:cb,initialBiotopeCode:br.string().trim().min(1).nullish(),targetBiotopeCode:br.string().trim().min(1).nullish()}).omit({id:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0}
2833);const gQ=br.object({offers:br.array(mQ.pick({area:!0,source:!0,notes:!0}).extend({area:br.coerce.number().nullable(),geoDoc:uQ(lb(fI)).nullable(),areaUnit:br.enum([DW,bz]).nullish(),ownership:br.enum(["owner","not_owner"])}).required({geoDoc:!0})),user:hQ.extend({salutation:br.enum(["female","male"]).optional(),givenName:br.string().optional(),familyName:br.string().min(1,"Nachname ist erforderlich"),email:br.string().email("Gültige Email-Adresse erforderlich"),mobile:br.string().trim().min(1,"Handynummer ist erforderlich"),tosConsent:br.coerce.boolean().optional(),newsletterConsent:br.coerce.boolean().optional(),newsletterConsentText:br.string().optional()})}).refine(e=>e.user.tosConsent||e.offers[0].source===WS,{message:"Sie müssen den AGBs zustimmen",path:["user.tosConsent"]}).refine(e=>e.offers[0].ownership!==void 0,{message:"Handelt es sich um Ihr eigenes Grundstück?*",path:["offers","0","ownership"]});function _Q({children:e,source:t,note:o}){var M;const u=$E(),y=(M=Ic().state)==null?void 0:M.formData,T=zq({resolver:tY(gQ),mode:"onChange",defaultValues:y||{offers:[{source:t,...o?{notes:o}:{}}]}}),s=async L=>{var B;console.log("SUBMITTED",L);try{let H=(B=L.offers[0])==null?void 0:B.area;H&&(H&&typeof H=="string"&&(H=parseFloat(H)),L.offers[0].areaUnit!==bz&&(H=H*v1),L.offers[0].area=H),t&&(L.offers[0].source=t),o&&(L.offers[0].notes=o);const $=await fetch(`${window.CONFIG_API}/supply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)});if($.ok){const te=await $.json();u(`/details/${te.offers[0].id}`),window.scrollTo({top:0}),window.token=te.token,window.dataLayer.push({event:"offer_form_submit_step2"})}else console.error("Failed to submit form:",await $.text()),T.setError("root.submitFailure",{type:"submit"})}catch(H){console.error("Error submitting form:",H),T.setError("root.submitFailure",{type:"submit"})}};return Ve.jsx(xq,{...T,children:Ve.jsx("form",{onSubmit:T.handleSubmit(s),className:"h-full",children:e})})}const hb={"/":"/","/kontakt":"/kontakt","/details/:offerId":"/details/:offerId"};class yQ extends mt.Component{constructor(){super(...arguments);de(this,"state",{hasError:!1})}static getDerivedStateFromError(o){return{hasError:!0,error:o}}componentDidCatch(o,u){console.error("Uncaught error:",o,u)}render(){var o;return this.state.hasError?Ve.jsx("div",{className:"min-h-screen flex items-center justify-center",children:Ve.jsxs("div",{className:"text-center p-8",children:[Ve.jsx("h1",{className:"text-2xl font-bold text-red-600 mb-4",children:"Formular-Integration fehlgeschlagen"}),Ve.jsx("p",{className:"text-gray-600 mb-4",children:((o=this.state.error)==null?void 0:o.message)||"Ein unerwarteter Fehler ist aufgetreten"}),Ve.jsx("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-sm",onClick:()=>window.location.reload(),children:"Seite neu laden"})]})}):this.props.children}}const f5=new URLSearchParams(window.location.search),db=f5.get("source")||window.fluviusSource,p5=f5.get("note")||window.fluviusNote;console.log("onboarding params",{source:db,note:p5});const vQ=rq([{path:hb["/"],element:Ve.jsx(_Q,{source:db,note:p5,children:Ve.jsx(kH,{})}),children:[{path:hb["/"],element:Ve.jsx(BW,{})},{path:hb["/kontakt"],element:Ve.jsx(KW,{source:db})}]},{path:hb["/details/:offerId"],element:Ve.jsx(eX,{source:db})}],{basename:window.location.pathname.replace(/\/$/,"")});function xQ(){return Ve.jsx("div",{className:"container lg:max-w-(--breakpoint-lg) mx-auto p-8",children:Ve.jsx(yQ,{children:Ve.jsx(pq,{router:vQ})})})}const m5=new URL(location.href);window.CONFIG_TEST=m5.searchParams.has("test")||m5.origin!=="https://www.kompensationsmarkt.de",window.CONFIG_API=`https://mycelium${window.CONFIG_TEST?"-staging":""}.greenaccount.workers.dev`,window.CONFIG_TEST&&window.location.hostname==="localhost"&&(window.CONFIG_API="http://localhost:8787"),window.dataLayer=window.dataLayer||[],w2.createRoot(document.getElementById("root")).render(Ve.jsx(kn.StrictMode,{children:Ve.jsx(xQ,{})}))})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.