/*! For license information please see index.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.mapgl=t():e.mapgl=t()}(self,(()=>(()=>{var e={5618:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl-hover {\n    cursor: pointer;\n}\n\n.mapgl-dragging {\n    cursor: grabbing;\n}\n\n.mapgl-rotating {\n    cursor: move;\n}\n",""]);const a=s},3103:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_lxLX8k02JhUZQLnJt5Mm {\n    font-family: Helvetica, Arial, sans-serif !important;\n    font-size: 8px !important;\n    line-height: 8px !important;\n    text-align: right !important;\n    display: flex;\n    align-items: flex-start;\n    color: #6d7173 !important;\n}\n\n.mapgl_AsSWrna6OS9VEoYItIZV {\n    display: block;\n}\n\na.mapgl_N4E6A6Wp5fYeXBf2QGWt {\n    color: #6d7173 !important;\n    text-decoration: none !important;\n}\n\na.mapgl_N4E6A6Wp5fYeXBf2QGWt:hover {\n    color: #929292 !important;\n}\n",""]),s.locals={container:"mapgl_lxLX8k02JhUZQLnJt5Mm",text:"mapgl_AsSWrna6OS9VEoYItIZV",link:"mapgl_N4E6A6Wp5fYeXBf2QGWt"};const a=s},3274:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_SqprqBDt0m3ck8ImwnZ0 {\n    position: absolute;\n    pointer-events: none;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    left: 0;\n}\n\n.mapgl_zXpm2Oitx3qOyLXwyVKj {\n    position: absolute;\n    display: flex;\n    z-index: 50;\n    pointer-events: none;\n    width: 100%;\n    height: 100%;\n}\n\n.mapgl_zXpm2Oitx3qOyLXwyVKj > div > * {\n    pointer-events: auto;\n}\n\n.mapgl_r_oD6okoyw2O0sKMERju {\n    flex-direction: column;\n    align-items: flex-start;\n}\n\n.mapgl_FmkgHxvqVart7hWj1dIm {\n    flex-direction: row;\n    justify-content: center;\n    align-items: flex-start;\n}\n\n.mapgl_OS0i93oEEcYSyKRHurat {\n    flex-direction: column;\n    align-items: flex-end;\n}\n\n.mapgl_BIfihGR7X9awnUFk62BQ {\n    flex-direction: column;\n    justify-content: center;\n    align-items: flex-start;\n}\n\n.mapgl_vpFke4npOo1b8whqwKPv {\n    flex-direction: column;\n    justify-content: center;\n    align-items: flex-end;\n}\n\n.mapgl_gLybMsoqNs2Phzvi6hS5 {\n    flex-direction: column-reverse;\n    align-items: flex-start;\n}\n\n.mapgl_GbiZTwfDOnlyI6flVbL_ {\n    flex-direction: row;\n    justify-content: center;\n    align-items: flex-end;\n}\n\n.mapgl_YoIqRTD9ccmcm_A81adk {\n    flex-direction: column-reverse;\n    align-items: flex-end;\n}\n\n.mapgl_r_oD6okoyw2O0sKMERju > div + div,\n.mapgl_OS0i93oEEcYSyKRHurat > div + div,\n.mapgl_BIfihGR7X9awnUFk62BQ > div + div,\n.mapgl_vpFke4npOo1b8whqwKPv > div + div {\n    margin-top: 10px;\n}\n\n.mapgl_gLybMsoqNs2Phzvi6hS5 > div + div,\n.mapgl_YoIqRTD9ccmcm_A81adk > div + div {\n    margin-bottom: 10px;\n}\n\n.mapgl_FmkgHxvqVart7hWj1dIm > div + div,\n.mapgl_GbiZTwfDOnlyI6flVbL_ > div + div {\n    margin-left: 10px;\n}\n",""]),s.locals={controlPane:"mapgl_SqprqBDt0m3ck8ImwnZ0",container:"mapgl_zXpm2Oitx3qOyLXwyVKj",topLeft:"mapgl_r_oD6okoyw2O0sKMERju",topCenter:"mapgl_FmkgHxvqVart7hWj1dIm",topRight:"mapgl_OS0i93oEEcYSyKRHurat",centerLeft:"mapgl_BIfihGR7X9awnUFk62BQ",centerRight:"mapgl_vpFke4npOo1b8whqwKPv",bottomLeft:"mapgl_gLybMsoqNs2Phzvi6hS5",bottomCenter:"mapgl_GbiZTwfDOnlyI6flVbL_",bottomRight:"mapgl_YoIqRTD9ccmcm_A81adk"};const a=s},4306:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_T5RQQ2NOfnY3_e00os8n {\n    display: block !important;\n}\n\n.mapgl_T5RQQ2NOfnY3_e00os8n .mapgl_BhGb3GmPN9rfS36yYYbH {\n    height: 20px !important;\n    display: block !important;\n}\n",""]),s.locals={container:"mapgl_T5RQQ2NOfnY3_e00os8n",logos:"mapgl_BhGb3GmPN9rfS36yYYbH"};const a=s},1704:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_ByGR_EaTxrFwgYplL9Rn {\n    position: relative;\n}\n\n.mapgl_rV7SBEVklXHee7q0ro4A {\n    display: flex;\n    max-height: 40vh;\n    background: #ffffff;\n    width: 32px;\n    overflow: hidden;\n    border-radius: 4px;\n    box-shadow: 0 1px 3px 0 rgba(38, 38, 38, 0.5);\n}\n\n.mapgl_eTkkBoRhhRCs7jEwQ2Wb {\n    width: 100%;\n    overflow-x: hidden;\n    overflow-y: auto;\n    -moz-padding-end: 17px;\n    -webkit-padding-end: 17px;\n    -webkit-margin-end: -17px;\n}\n\n.mapgl_gnVYSnZbzDyDuJqZz3mJ {\n    display: flex;\n    flex-direction: column-reverse;\n}\n\n.mapgl_zsd_0yR5qXs0D4rXioaV {\n    all: revert;\n    padding: 0;\n    border: none;\n    background: #ffffff;\n    height: 32px;\n    width: 32px;\n    color: #262626;\n    cursor: pointer;\n    border-bottom: 1px solid #e6e6e6;\n    box-sizing: border-box;\n    flex-shrink: 0;\n}\n.mapgl_zsd_0yR5qXs0D4rXioaV:focus {\n    outline: 0;\n}\n.mapgl_zsd_0yR5qXs0D4rXioaV:first-child {\n    border-bottom: none;\n}\n.mapgl_zsd_0yR5qXs0D4rXioaV:hover {\n    color: rgba(38, 38, 38, 0.7);\n}\n.mapgl_zsd_0yR5qXs0D4rXioaV:active {\n    color: #028eff;\n}\n.mapgl_zsd_0yR5qXs0D4rXioaV:disabled {\n    background: #f2f2f2;\n    color: #929292;\n    fill: #929292;\n    cursor: default;\n}\n\n.mapgl_IpWyhNkbWQBqP479eDE2 {\n    font-size: 18px;\n    line-height: 32px;\n    font-weight: 400;\n    overflow-wrap: break-word;\n\n    position: relative;\n    text-align: center;\n    height: 100%;\n}\n\n.mapgl_IpWyhNkbWQBqP479eDE2 svg {\n    margin-top: 3px;\n}\n\n.mapgl_yUGrJifDT7VmwlUOKi8_:after {\n    content: '';\n    position: absolute;\n    top: 4px;\n    bottom: 4px;\n    width: 4px;\n    height: 4px;\n    border-radius: 50%;\n    background: #028eff;\n}\n",""]),s.locals={root:"mapgl_ByGR_EaTxrFwgYplL9Rn",container:"mapgl_rV7SBEVklXHee7q0ro4A",scroller:"mapgl_eTkkBoRhhRCs7jEwQ2Wb",content:"mapgl_gnVYSnZbzDyDuJqZz3mJ",control:"mapgl_zsd_0yR5qXs0D4rXioaV",label:"mapgl_IpWyhNkbWQBqP479eDE2",_hasResult:"mapgl_yUGrJifDT7VmwlUOKi8_"};const a=s},6032:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_y5CSWkmzFZelEK3XsNPI {\n    background: rgba(255, 255, 255, 0.68);\n    border-width: 0 1px 1px 1px;\n    border-color: #7a7a7a;\n    border-style: solid;\n    border-radius: 0;\n    min-width: 64px;\n    height: 16px;\n    overflow: hidden;\n    pointer-events: none !important;\n}\n\n.mapgl_jEDrEoj7PBYIc0hBFCRq {\n    min-width: 50px;\n    height: 12px;\n    margin-top: 2px;\n    margin-left: 6px;\n    font-family: Helvetica, Arial, sans-serif !important;\n    font-style: normal;\n    font-weight: 400;\n    font-size: 9px;\n    line-height: 12px;\n\n    color: #262626;\n}\n",""]),s.locals={root:"mapgl_y5CSWkmzFZelEK3XsNPI",label:"mapgl_jEDrEoj7PBYIc0hBFCRq"};const a=s},4928:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_XiKtyzV1PZ9N9z7NbBH0 {\n    background: #fff;\n    box-shadow: 0 1px 3px 0 rgba(38, 38, 38, 0.5);\n    border-radius: 4px;\n    width: 32px;\n    overflow: hidden;\n}\n\n.mapgl_TCECw1gCo4pPgxN8WlHv {\n    all: revert;\n    padding: 0;\n    outline: 0;\n    border: none;\n    cursor: pointer;\n    box-sizing: border-box;\n    font-size: 18px;\n    font-weight: 400;\n    width: 32px;\n    height: 32px;\n    color: #262626;\n    background: #fff;\n}\n\n.mapgl_aifLu_eH4oBoq5TCFEl1:hover {\n    opacity: 0.7;\n}\n\n.mapgl_AZeLf0JO9BdLfzixjszM {\n    background: #299400;\n    color: #fff;\n}\n.mapgl_g9fon0BTtGdnOX4Ce0gE {\n    background: #ffb81c;\n    color: #fff;\n}\n.mapgl_GDc542cVDcz8I8tKJtvz {\n    background: #fe5000;\n    color: #fff;\n}\n\n.mapgl_AZeLf0JO9BdLfzixjszM:hover,\n.mapgl_g9fon0BTtGdnOX4Ce0gE:hover,\n.mapgl_GDc542cVDcz8I8tKJtvz:hover {\n    color: rgba(38, 38, 38, 0.7);\n}\n",""]),s.locals={root:"mapgl_XiKtyzV1PZ9N9z7NbBH0",button:"mapgl_TCECw1gCo4pPgxN8WlHv",none:"mapgl_aifLu_eH4oBoq5TCFEl1",easy:"mapgl_AZeLf0JO9BdLfzixjszM",medium:"mapgl_g9fon0BTtGdnOX4Ce0gE",hard:"mapgl_GDc542cVDcz8I8tKJtvz"};const a=s},6438:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_RyvsmCnoVe7ui2MClLMS {\n    width: 32px;\n    box-shadow: 0 1px 3px 0 rgba(38, 38, 38, 0.5);\n    border-radius: 4px;\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    background: #fff;\n}\n\n.mapgl_Tdw0Vs7iQuaknNHHD21k {\n    all: revert;\n\n    padding: 0;\n    outline: 0;\n    border: none;\n    cursor: pointer;\n\n    background: #fff;\n    width: 32px;\n    height: 32px;\n    color: #262626;\n    box-sizing: border-box;\n}\n\n.mapgl_Tdw0Vs7iQuaknNHHD21k:hover {\n    opacity: 0.7;\n}\n\n.mapgl_Tdw0Vs7iQuaknNHHD21k:active {\n    color: #028eff;\n}\n\n.mapgl_Tdw0Vs7iQuaknNHHD21k:disabled {\n    background: #f2f2f2;\n    color: #929292;\n    cursor: default;\n}\n\n.mapgl_JwF7YmgOItTjpjwxORCk {\n    border-bottom: 1px solid #e6e6e6;\n}\n\n.mapgl_Tvr6BDuVyr8143cFJ4nJ {\n    border-bottom: none;\n}\n",""]),s.locals={root:"mapgl_RyvsmCnoVe7ui2MClLMS",button:"mapgl_Tdw0Vs7iQuaknNHHD21k",zoomIn:"mapgl_JwF7YmgOItTjpjwxORCk",zoomOut:"mapgl_Tvr6BDuVyr8143cFJ4nJ"};const a=s},438:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8276),o=i.n(n),r=i(5368),s=i.n(r)()(o());s.push([e.id,".mapgl_Zqe1f2Ik8_MdehkwZiwo {\n    pointer-events: none;\n    position: absolute;\n    top: 0px;\n    left: 0px;\n    width: 100%;\n    height: 100%;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    padding: 10px;\n    background-color: rgba(0, 0, 0, 0.2);\n    cursor: default;\n}\n\n.mapgl_RBLYLi7mJFgKIKMPLvv_ {\n    text-align: center;\n    font-size: 24px;\n    font-family: Helvetica, Arial, sans-serif;\n    font-weight: bold;\n    color: white;\n}\n",""]),s.locals={wrap:"mapgl_Zqe1f2Ik8_MdehkwZiwo",container:"mapgl_RBLYLi7mJFgKIKMPLvv_"};const a=s},3379:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n<t.length;n++)if(t[n].identifier===e){i=n;break}return i}function n(e,n){for(var r={},s=[],a=0;a<e.length;a++){var l=e[a],d=n.base?l[0]+n.base:l[0],c=r[d]||0,u="".concat(d," ").concat(c);r[d]=c+1;var h=i(u),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)t[h].references++,t[h].updater(m);else{var f=o(m,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}s.push(u)}return s}function o(e,t){var i=t.domAPI(t);i.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;i.update(e=t)}else i.remove()}}e.exports=function(e,o){var r=n(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<r.length;s++){var a=i(r[s]);t[a].references--}for(var l=n(e,o),d=0;d<r.length;d++){var c=i(r[d]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}r=l}}},569:e=>{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,i)=>{"use strict";e.exports=function(e){var t=i.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(i){!function(e,t,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var o=void 0!==i.layer;o&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,o&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var r=i.sourceMap;r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,i)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},3287:(e,t,i)=>{"use strict";i.d(t,{Ib:()=>n,WT:()=>o});const n=1e-6;let o="undefined"!=typeof Float64Array?Float64Array:Array;Math.random;Math.PI},351:(e,t,i)=>{"use strict";i.d(t,{Ue:()=>o,t8:()=>s,xO:()=>r});var n=i(3287);function o(){let e=new n.WT(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function r(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function s(e,t,i,n,o,r,s,a,l,d){return e[0]=t,e[1]=i,e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=a,e[7]=l,e[8]=d,e}},127:(e,t,i)=>{"use strict";i.d(t,{I6:()=>w,Iu:()=>h,Iw:()=>y,JG:()=>r,Jp:()=>u,M5:()=>b,U_:()=>c,Ue:()=>o,Us:()=>g,al:()=>s,bA:()=>m,dC:()=>S,jI:()=>p,lM:()=>f,p4:()=>d,t8:()=>a,uD:()=>_,wA:()=>M,xJ:()=>v,yR:()=>l,zB:()=>x});var n=i(3287);function o(){let e=new n.WT(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function r(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function s(e,t,i,o,r,s,a,l,d,c,u,h,m,f,_,p){let v=new n.WT(16);return v[0]=e,v[1]=t,v[2]=i,v[3]=o,v[4]=r,v[5]=s,v[6]=a,v[7]=l,v[8]=d,v[9]=c,v[10]=u,v[11]=h,v[12]=m,v[13]=f,v[14]=_,v[15]=p,v}function a(e,t,i,n,o,r,s,a,l,d,c,u,h,m,f,_,p){return e[0]=t,e[1]=i,e[2]=n,e[3]=o,e[4]=r,e[5]=s,e[6]=a,e[7]=l,e[8]=d,e[9]=c,e[10]=u,e[11]=h,e[12]=m,e[13]=f,e[14]=_,e[15]=p,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function d(e,t){if(e===t){let i=t[1],n=t[2],o=t[3],r=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=r,e[11]=t[14],e[12]=o,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function c(e,t){let i=t[0],n=t[1],o=t[2],r=t[3],s=t[4],a=t[5],l=t[6],d=t[7],c=t[8],u=t[9],h=t[10],m=t[11],f=t[12],_=t[13],p=t[14],v=t[15],g=i*a-n*s,y=i*l-o*s,b=i*d-r*s,x=n*l-o*a,w=n*d-r*a,S=o*d-r*l,M=c*_-u*f,I=c*p-h*f,T=c*v-m*f,E=u*p-h*_,P=u*v-m*_,A=h*v-m*p,L=g*A-y*P+b*E+x*T-w*I+S*M;return L?(L=1/L,e[0]=(a*A-l*P+d*E)*L,e[1]=(o*P-n*A-r*E)*L,e[2]=(_*S-p*w+v*x)*L,e[3]=(h*w-u*S-m*x)*L,e[4]=(l*T-s*A-d*I)*L,e[5]=(i*A-o*T+r*I)*L,e[6]=(p*b-f*S-v*y)*L,e[7]=(c*S-h*b+m*y)*L,e[8]=(s*P-a*T+d*M)*L,e[9]=(n*T-i*P-r*M)*L,e[10]=(f*w-_*b+v*g)*L,e[11]=(u*b-c*w-m*g)*L,e[12]=(a*I-s*E-l*M)*L,e[13]=(i*E-n*I+o*M)*L,e[14]=(_*y-f*x-p*g)*L,e[15]=(c*x-u*y+h*g)*L,e):null}function u(e,t,i){let n=t[0],o=t[1],r=t[2],s=t[3],a=t[4],l=t[5],d=t[6],c=t[7],u=t[8],h=t[9],m=t[10],f=t[11],_=t[12],p=t[13],v=t[14],g=t[15],y=i[0],b=i[1],x=i[2],w=i[3];return e[0]=y*n+b*a+x*u+w*_,e[1]=y*o+b*l+x*h+w*p,e[2]=y*r+b*d+x*m+w*v,e[3]=y*s+b*c+x*f+w*g,y=i[4],b=i[5],x=i[6],w=i[7],e[4]=y*n+b*a+x*u+w*_,e[5]=y*o+b*l+x*h+w*p,e[6]=y*r+b*d+x*m+w*v,e[7]=y*s+b*c+x*f+w*g,y=i[8],b=i[9],x=i[10],w=i[11],e[8]=y*n+b*a+x*u+w*_,e[9]=y*o+b*l+x*h+w*p,e[10]=y*r+b*d+x*m+w*v,e[11]=y*s+b*c+x*f+w*g,y=i[12],b=i[13],x=i[14],w=i[15],e[12]=y*n+b*a+x*u+w*_,e[13]=y*o+b*l+x*h+w*p,e[14]=y*r+b*d+x*m+w*v,e[15]=y*s+b*c+x*f+w*g,e}function h(e,t,i){let n,o,r,s,a,l,d,c,u,h,m,f,_=i[0],p=i[1],v=i[2];return t===e?(e[12]=t[0]*_+t[4]*p+t[8]*v+t[12],e[13]=t[1]*_+t[5]*p+t[9]*v+t[13],e[14]=t[2]*_+t[6]*p+t[10]*v+t[14],e[15]=t[3]*_+t[7]*p+t[11]*v+t[15]):(n=t[0],o=t[1],r=t[2],s=t[3],a=t[4],l=t[5],d=t[6],c=t[7],u=t[8],h=t[9],m=t[10],f=t[11],e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=a,e[5]=l,e[6]=d,e[7]=c,e[8]=u,e[9]=h,e[10]=m,e[11]=f,e[12]=n*_+a*p+u*v+t[12],e[13]=o*_+l*p+h*v+t[13],e[14]=r*_+d*p+m*v+t[14],e[15]=s*_+c*p+f*v+t[15]),e}function m(e,t,i){let n=i[0],o=i[1],r=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function f(e,t,i){let n=Math.sin(i),o=Math.cos(i),r=t[4],s=t[5],a=t[6],l=t[7],d=t[8],c=t[9],u=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=r*o+d*n,e[5]=s*o+c*n,e[6]=a*o+u*n,e[7]=l*o+h*n,e[8]=d*o-r*n,e[9]=c*o-s*n,e[10]=u*o-a*n,e[11]=h*o-l*n,e}function _(e,t,i){let n=Math.sin(i),o=Math.cos(i),r=t[0],s=t[1],a=t[2],l=t[3],d=t[8],c=t[9],u=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o-d*n,e[1]=s*o-c*n,e[2]=a*o-u*n,e[3]=l*o-h*n,e[8]=r*n+d*o,e[9]=s*n+c*o,e[10]=a*n+u*o,e[11]=l*n+h*o,e}function p(e,t,i){let n=Math.sin(i),o=Math.cos(i),r=t[0],s=t[1],a=t[2],l=t[3],d=t[4],c=t[5],u=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=r*o+d*n,e[1]=s*o+c*n,e[2]=a*o+u*n,e[3]=l*o+h*n,e[4]=d*o-r*n,e[5]=c*o-s*n,e[6]=u*o-a*n,e[7]=h*o-l*n,e}function v(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function g(e,t,i){let o,r,s,a=i[0],l=i[1],d=i[2],c=Math.sqrt(a*a+l*l+d*d);return Math.abs(c)<n.Ib?null:(c=1/c,a*=c,l*=c,d*=c,o=Math.sin(t),r=Math.cos(t),s=1-r,e[0]=a*a*s+r,e[1]=l*a*s+d*o,e[2]=d*a*s-l*o,e[3]=0,e[4]=a*l*s-d*o,e[5]=l*l*s+r,e[6]=d*l*s+a*o,e[7]=0,e[8]=a*d*s+l*o,e[9]=l*d*s-a*o,e[10]=d*d*s+r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function y(e,t,i,n){let o=t[0],r=t[1],s=t[2],a=t[3],l=o+o,d=r+r,c=s+s,u=o*l,h=o*d,m=o*c,f=r*d,_=r*c,p=s*c,v=a*l,g=a*d,y=a*c,b=n[0],x=n[1],w=n[2];return e[0]=(1-(f+p))*b,e[1]=(h+y)*b,e[2]=(m-g)*b,e[3]=0,e[4]=(h-y)*x,e[5]=(1-(u+p))*x,e[6]=(_+v)*x,e[7]=0,e[8]=(m+g)*w,e[9]=(_-v)*w,e[10]=(1-(u+f))*w,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function b(e,t,i,n,o,r,s){let a=1/(t-i),l=1/(n-o),d=1/(r-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*d,e[11]=0,e[12]=(t+i)*a,e[13]=(o+n)*l,e[14]=(s+r)*d,e[15]=1,e}function x(e,t,i,o){let r,s,a,l,d,c,u,h,m,f,_=t[0],p=t[1],v=t[2],g=o[0],y=o[1],b=o[2],x=i[0],w=i[1],S=i[2];return Math.abs(_-x)<n.Ib&&Math.abs(p-w)<n.Ib&&Math.abs(v-S)<n.Ib?mat4.identity(e):(u=_-x,h=p-w,m=v-S,f=1/Math.sqrt(u*u+h*h+m*m),u*=f,h*=f,m*=f,r=y*m-b*h,s=b*u-g*m,a=g*h-y*u,f=Math.sqrt(r*r+s*s+a*a),f?(f=1/f,r*=f,s*=f,a*=f):(r=0,s=0,a=0),l=h*a-m*s,d=m*r-u*a,c=u*s-h*r,f=Math.sqrt(l*l+d*d+c*c),f?(f=1/f,l*=f,d*=f,c*=f):(l=0,d=0,c=0),e[0]=r,e[1]=l,e[2]=u,e[3]=0,e[4]=s,e[5]=d,e[6]=h,e[7]=0,e[8]=a,e[9]=c,e[10]=m,e[11]=0,e[12]=-(r*_+s*p+a*v),e[13]=-(l*_+d*p+c*v),e[14]=-(u*_+h*p+m*v),e[15]=1,e)}function w(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}const S=u;function M(e,t,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}},7063:(e,t,i)=>{"use strict";i.d(t,{Ue:()=>a,ZA:()=>u,bz:()=>h,jI:()=>c,uD:()=>d,yR:()=>l});var n=i(3287),o=i(351),r=i(9450),s=i(1245);function a(){let e=new n.WT(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function l(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function d(e,t,i){i*=.5;let n=t[0],o=t[1],r=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l-r*a,e[1]=o*l+s*a,e[2]=r*l+n*a,e[3]=s*l-o*a,e}function c(e,t,i){i*=.5;let n=t[0],o=t[1],r=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l+o*a,e[1]=o*l-n*a,e[2]=r*l+s*a,e[3]=s*l-r*a,e}function u(e,t,i,n){let o,r,s,a,l,d=t[0],c=t[1],u=t[2],h=t[3],m=i[0],f=i[1],_=i[2],p=i[3];return r=d*m+c*f+u*_+h*p,r<0&&(r=-r,m=-m,f=-f,_=-_,p=-p),1-r>1e-6?(o=Math.acos(r),s=Math.sin(o),a=Math.sin((1-n)*o)/s,l=Math.sin(n*o)/s):(a=1-n,l=n),e[0]=a*d+l*m,e[1]=a*c+l*f,e[2]=a*u+l*_,e[3]=a*h+l*p,e}function h(e,t){let i,n=t[0]+t[4]+t[8];if(n>0)i=Math.sqrt(n+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{let n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);let o=(n+1)%3,r=(n+2)%3;i=Math.sqrt(t[3*n+n]-t[3*o+o]-t[3*r+r]+1),e[n]=.5*i,i=.5/i,e[3]=(t[3*o+r]-t[3*r+o])*i,e[o]=(t[3*o+n]+t[3*n+o])*i,e[r]=(t[3*r+n]+t[3*n+r])*i}return e}s.d9,s.al,s.JG,s.t8,s.IH,s.bA,s.AK,s.t7,s.kE,s.we;const m=s.Fv;s.I6,s.fS,function(){let e=r.Ue(),t=r.al(1,0,0),i=r.al(0,1,0)}(),function(){let e=a(),t=a()}(),function(){let e=o.Ue()}()},378:(e,t,i)=>{"use strict";i.d(t,{$X:()=>c,AK:()=>g,Fp:()=>h,Fv:()=>v,I6:()=>b,IH:()=>d,JG:()=>a,TE:()=>f,TK:()=>M,Ue:()=>o,VV:()=>u,Zh:()=>w,al:()=>s,bA:()=>m,d9:()=>r,fS:()=>x,kE:()=>_,lu:()=>S,t7:()=>y,t8:()=>l,we:()=>p});var n=i(3287);function o(){let e=new n.WT(2);return e[0]=0,e[1]=0,e}function r(e){let t=new n.WT(2);return t[0]=e[0],t[1]=e[1],t}function s(e,t){let i=new n.WT(2);return i[0]=e,i[1]=t,i}function a(e,t){return e[0]=t[0],e[1]=t[1],e}function l(e,t,i){return e[0]=t,e[1]=i,e}function d(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function c(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function u(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e}function h(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e}function m(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function f(e,t){var i=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(i*i+n*n)}function _(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function p(e){var t=e[0],i=e[1];return t*t+i*i}function v(e,t){var i=t[0],n=t[1],o=i*i+n*n;return o>0&&(o=1/Math.sqrt(o),e[0]=t[0]*o,e[1]=t[1]*o),e}function g(e,t){return e[0]*t[0]+e[1]*t[1]}function y(e,t,i,n){var o=t[0],r=t[1];return e[0]=o+n*(i[0]-o),e[1]=r+n*(i[1]-r),e}function b(e,t){return e[0]===t[0]&&e[1]===t[1]}function x(e,t){let i=e[0],o=e[1],r=t[0],s=t[1];return Math.abs(i-r)<=n.Ib*Math.max(1,Math.abs(i),Math.abs(r))&&Math.abs(o-s)<=n.Ib*Math.max(1,Math.abs(o),Math.abs(s))}const w=_,S=c,M=f;!function(){let e=o()}()},9450:(e,t,i)=>{"use strict";i.d(t,{AK:()=>p,Fv:()=>_,I6:()=>M,IH:()=>c,JG:()=>l,TE:()=>h,TK:()=>E,Ue:()=>o,VC:()=>b,Zh:()=>A,al:()=>a,bA:()=>u,d9:()=>r,fF:()=>y,fS:()=>I,jI:()=>S,kC:()=>v,kE:()=>s,lM:()=>x,lu:()=>T,nI:()=>P,t7:()=>g,t8:()=>d,tk:()=>f,uD:()=>w,we:()=>m});var n=i(3287);function o(){let e=new n.WT(3);return e[0]=0,e[1]=0,e[2]=0,e}function r(e){var t=new n.WT(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function s(e){let t=e[0],i=e[1],n=e[2];return Math.sqrt(t*t+i*i+n*n)}function a(e,t,i){let o=new n.WT(3);return o[0]=e,o[1]=t,o[2]=i,o}function l(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function d(e,t,i,n){return e[0]=t,e[1]=i,e[2]=n,e}function c(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function u(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function h(e,t){let i=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2];return Math.sqrt(i*i+n*n+o*o)}function m(e){let t=e[0],i=e[1],n=e[2];return t*t+i*i+n*n}function f(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function _(e,t){let i=t[0],n=t[1],o=t[2],r=i*i+n*n+o*o;return r>0&&(r=1/Math.sqrt(r),e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r),e}function p(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function v(e,t,i){let n=t[0],o=t[1],r=t[2],s=i[0],a=i[1],l=i[2];return e[0]=o*l-r*a,e[1]=r*s-n*l,e[2]=n*a-o*s,e}function g(e,t,i,n){let o=t[0],r=t[1],s=t[2];return e[0]=o+n*(i[0]-o),e[1]=r+n*(i[1]-r),e[2]=s+n*(i[2]-s),e}function y(e,t,i){let n=t[0],o=t[1],r=t[2],s=i[3]*n+i[7]*o+i[11]*r+i[15];return s=s||1,e[0]=(i[0]*n+i[4]*o+i[8]*r+i[12])/s,e[1]=(i[1]*n+i[5]*o+i[9]*r+i[13])/s,e[2]=(i[2]*n+i[6]*o+i[10]*r+i[14])/s,e}function b(e,t,i){let n=t[0],o=t[1],r=t[2],s=i[0],a=i[1],l=i[2],d=i[3],c=d*n+a*r-l*o,u=d*o+l*n-s*r,h=d*r+s*o-a*n,m=-s*n-a*o-l*r;return e[0]=c*d+m*-s+u*-l-h*-a,e[1]=u*d+m*-a+h*-s-c*-l,e[2]=h*d+m*-l+c*-a-u*-s,e}function x(e,t,i,n){let o=[],r=[];return o[0]=t[0]-i[0],o[1]=t[1]-i[1],o[2]=t[2]-i[2],r[0]=o[0],r[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),r[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),e[0]=r[0]+i[0],e[1]=r[1]+i[1],e[2]=r[2]+i[2],e}function w(e,t,i,n){let o=[],r=[];return o[0]=t[0]-i[0],o[1]=t[1]-i[1],o[2]=t[2]-i[2],r[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),r[1]=o[1],r[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),e[0]=r[0]+i[0],e[1]=r[1]+i[1],e[2]=r[2]+i[2],e}function S(e,t,i,n){let o=[],r=[];return o[0]=t[0]-i[0],o[1]=t[1]-i[1],o[2]=t[2]-i[2],r[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),r[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),r[2]=o[2],e[0]=r[0]+i[0],e[1]=r[1]+i[1],e[2]=r[2]+i[2],e}function M(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function I(e,t){let i=e[0],o=e[1],r=e[2],s=t[0],a=t[1],l=t[2];return Math.abs(i-s)<=n.Ib*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-a)<=n.Ib*Math.max(1,Math.abs(o),Math.abs(a))&&Math.abs(r-l)<=n.Ib*Math.max(1,Math.abs(r),Math.abs(l))}const T=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},E=h,P=function(e,t){let i=t[0]-e[0],n=t[1]-e[1],o=t[2]-e[2];return i*i+n*n+o*o},A=s;!function(){let e=o()}()},1245:(e,t,i)=>{"use strict";i.d(t,{AK:()=>f,Fv:()=>m,I6:()=>v,IH:()=>d,JG:()=>a,Ue:()=>o,al:()=>s,bA:()=>c,d9:()=>r,dC:()=>y,fF:()=>p,fS:()=>g,kE:()=>u,t7:()=>_,t8:()=>l,we:()=>h});var n=i(3287);function o(){let e=new n.WT(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function r(e){let t=new n.WT(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function s(e,t,i,o){let r=new n.WT(4);return r[0]=e,r[1]=t,r[2]=i,r[3]=o,r}function a(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(e,t,i,n,o){return e[0]=t,e[1]=i,e[2]=n,e[3]=o,e}function d(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function c(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function u(e){let t=e[0],i=e[1],n=e[2],o=e[3];return Math.sqrt(t*t+i*i+n*n+o*o)}function h(e){let t=e[0],i=e[1],n=e[2],o=e[3];return t*t+i*i+n*n+o*o}function m(e,t){let i=t[0],n=t[1],o=t[2],r=t[3],s=i*i+n*n+o*o+r*r;return s>0&&(s=1/Math.sqrt(s),e[0]=i*s,e[1]=n*s,e[2]=o*s,e[3]=r*s),e}function f(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function _(e,t,i,n){let o=t[0],r=t[1],s=t[2],a=t[3];return e[0]=o+n*(i[0]-o),e[1]=r+n*(i[1]-r),e[2]=s+n*(i[2]-s),e[3]=a+n*(i[3]-a),e}function p(e,t,i){let n=t[0],o=t[1],r=t[2],s=t[3];return e[0]=i[0]*n+i[4]*o+i[8]*r+i[12]*s,e[1]=i[1]*n+i[5]*o+i[9]*r+i[13]*s,e[2]=i[2]*n+i[6]*o+i[10]*r+i[14]*s,e[3]=i[3]*n+i[7]*o+i[11]*r+i[15]*s,e}function v(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function g(e,t){let i=e[0],o=e[1],r=e[2],s=e[3],a=t[0],l=t[1],d=t[2],c=t[3];return Math.abs(i-a)<=n.Ib*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(o-l)<=n.Ib*Math.max(1,Math.abs(o),Math.abs(l))&&Math.abs(r-d)<=n.Ib*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(s-c)<=n.Ib*Math.max(1,Math.abs(s),Math.abs(c))}const y=function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e};!function(){let e=o()}()},5620:(e,t,i)=>{"use strict";i.d(t,{c:()=>s});for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<n.length;r++)o[n.charCodeAt(r)]=r;var s=function(e){var t,i=new Uint8Array(e),o=i.length,r="";for(t=0;t<o;t+=3)r+=n[i[t]>>2],r+=n[(3&i[t])<<4|i[t+1]>>4],r+=n[(15&i[t+1])<<2|i[t+2]>>6],r+=n[63&i[t+2]];return o%3==2?r=r.substring(0,r.length-1)+"=":o%3==1&&(r=r.substring(0,r.length-2)+"=="),r}},6636:e=>{"use strict";var t=.1,i="function"==typeof Float32Array;function n(e,t){return 1-3*t+3*e}function o(e,t){return 3*t-6*e}function r(e){return 3*e}function s(e,t,i){return((n(t,i)*e+o(t,i))*e+r(t))*e}function a(e,t,i){return 3*n(t,i)*e*e+2*o(t,i)*e+r(t)}function l(e){return e}e.exports=function(e,n,o,r){if(!(0<=e&&e<=1&&0<=o&&o<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===n&&o===r)return l;for(var d=i?new Float32Array(11):new Array(11),c=0;c<11;++c)d[c]=s(c*t,e,o);function u(i){for(var n=0,r=1;10!==r&&d[r]<=i;++r)n+=t;--r;var l=n+(i-d[r])/(d[r+1]-d[r])*t,c=a(l,e,o);return c>=.001?function(e,t,i,n){for(var o=0;o<4;++o){var r=a(t,i,n);if(0===r)return t;t-=(s(t,i,n)-e)/r}return t}(i,l,e,o):0===c?l:function(e,t,i,n,o){var r,a,l=0;do{(r=s(a=t+(i-t)/2,n,o)-e)>0?i=a:t=a}while(Math.abs(r)>1e-7&&++l<10);return a}(i,n,n+t,e,o)}return function(e){return 0===e?0:1===e?1:s(u(e),n,r)}}},5368:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,o,r){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var d=0;d<e.length;d++){var c=[].concat(e[d]);n&&s[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},8276:e=>{"use strict";e.exports=function(e){return e[1]}},7084:e=>{"use strict";function t(e,t,n){n=n||2;var r,s,a,l,u,h,f,_=t&&t.length,p=_?t[0]*n:e.length,v=i(e,0,p,n,!0),g=[];if(!v||v.next===v.prev)return g;if(_&&(v=function(e,t,n,o){var r,s,a,l=[];for(r=0,s=t.length;r<s;r++)(a=i(e,t[r]*o,r<s-1?t[r+1]*o:e.length,o,!1))===a.next&&(a.steiner=!0),l.push(m(a));for(l.sort(d),r=0;r<l.length;r++)n=c(l[r],n);return n}(e,t,v,n)),e.length>80*n){r=a=e[0],s=l=e[1];for(var y=n;y<p;y+=n)(u=e[y])<r&&(r=u),(h=e[y+1])<s&&(s=h),u>a&&(a=u),h>l&&(l=h);f=0!==(f=Math.max(a-r,l-s))?32767/f:0}return o(v,g,n,r,s,f,0),g}function i(e,t,i,n,o){var r,s;if(o===T(e,t,i,n)>0)for(r=t;r<i;r+=n)s=S(r,e[r],e[r+1],s);else for(r=i-n;r>=t;r-=n)s=S(r,e[r],e[r+1],s);return s&&v(s,s.next)&&(M(s),s=s.next),s}function n(e,t){if(!e)return e;t||(t=e);var i,n=e;do{if(i=!1,n.steiner||!v(n,n.next)&&0!==p(n.prev,n,n.next))n=n.next;else{if(M(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function o(e,t,i,d,c,u,m){if(e){!m&&u&&function(e,t,i,n){var o=e;do{0===o.z&&(o.z=h(o.x,o.y,t,i,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,i,n,o,r,s,a,l,d=1;do{for(i=e,e=null,r=null,s=0;i;){for(s++,n=i,a=0,t=0;t<d&&(a++,n=n.nextZ);t++);for(l=d;a>0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(o=i,i=i.nextZ,a--):(o=n,n=n.nextZ,l--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;i=n}r.nextZ=null,d*=2}while(s>1)}(o)}(e,d,c,u);for(var f,_,p=e;e.prev!==e.next;)if(f=e.prev,_=e.next,u?s(e,d,c,u):r(e))t.push(f.i/i|0),t.push(e.i/i|0),t.push(_.i/i|0),M(e),e=_.next,p=_.next;else if((e=_)===p){m?1===m?o(e=a(n(e),t,i),t,i,d,c,u,2):2===m&&l(e,t,i,d,c,u):o(n(e),t,i,d,c,u,1);break}}}function r(e){var t=e.prev,i=e,n=e.next;if(p(t,i,n)>=0)return!1;for(var o=t.x,r=i.x,s=n.x,a=t.y,l=i.y,d=n.y,c=o<r?o<s?o:s:r<s?r:s,u=a<l?a<d?a:d:l<d?l:d,h=o>r?o>s?o:s:r>s?r:s,m=a>l?a>d?a:d:l>d?l:d,_=n.next;_!==t;){if(_.x>=c&&_.x<=h&&_.y>=u&&_.y<=m&&f(o,a,r,l,s,d,_.x,_.y)&&p(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function s(e,t,i,n){var o=e.prev,r=e,s=e.next;if(p(o,r,s)>=0)return!1;for(var a=o.x,l=r.x,d=s.x,c=o.y,u=r.y,m=s.y,_=a<l?a<d?a:d:l<d?l:d,v=c<u?c<m?c:m:u<m?u:m,g=a>l?a>d?a:d:l>d?l:d,y=c>u?c>m?c:m:u>m?u:m,b=h(_,v,t,i,n),x=h(g,y,t,i,n),w=e.prevZ,S=e.nextZ;w&&w.z>=b&&S&&S.z<=x;){if(w.x>=_&&w.x<=g&&w.y>=v&&w.y<=y&&w!==o&&w!==s&&f(a,c,l,u,d,m,w.x,w.y)&&p(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,S.x>=_&&S.x<=g&&S.y>=v&&S.y<=y&&S!==o&&S!==s&&f(a,c,l,u,d,m,S.x,S.y)&&p(S.prev,S,S.next)>=0)return!1;S=S.nextZ}for(;w&&w.z>=b;){if(w.x>=_&&w.x<=g&&w.y>=v&&w.y<=y&&w!==o&&w!==s&&f(a,c,l,u,d,m,w.x,w.y)&&p(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;S&&S.z<=x;){if(S.x>=_&&S.x<=g&&S.y>=v&&S.y<=y&&S!==o&&S!==s&&f(a,c,l,u,d,m,S.x,S.y)&&p(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function a(e,t,i){var o=e;do{var r=o.prev,s=o.next.next;!v(r,s)&&g(r,o,o.next,s)&&x(r,s)&&x(s,r)&&(t.push(r.i/i|0),t.push(o.i/i|0),t.push(s.i/i|0),M(o),M(o.next),o=e=s),o=o.next}while(o!==e);return n(o)}function l(e,t,i,r,s,a){var l=e;do{for(var d=l.next.next;d!==l.prev;){if(l.i!==d.i&&_(l,d)){var c=w(l,d);return l=n(l,l.next),c=n(c,c.next),o(l,t,i,r,s,a,0),void o(c,t,i,r,s,a,0)}d=d.next}l=l.next}while(l!==e)}function d(e,t){return e.x-t.x}function c(e,t){var i=function(e,t){var i,n=t,o=e.x,r=e.y,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var a=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=o&&a>s&&(s=a,i=n.x<n.next.x?n:n.next,a===o))return i}n=n.next}while(n!==t);if(!i)return null;var l,d=i,c=i.x,h=i.y,m=1/0;n=i;do{o>=n.x&&n.x>=c&&o!==n.x&&f(r<h?o:s,r,c,h,r<h?s:o,r,n.x,n.y)&&(l=Math.abs(r-n.y)/(o-n.x),x(n,e)&&(l<m||l===m&&(n.x>i.x||n.x===i.x&&u(i,n)))&&(i=n,m=l)),n=n.next}while(n!==d);return i}(e,t);if(!i)return t;var o=w(i,e);return n(o,o.next),n(i,i.next)}function u(e,t){return p(e.prev,e,t.prev)<0&&p(t.next,e,e.next)<0}function h(e,t,i,n,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function m(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function f(e,t,i,n,o,r,s,a){return(o-s)*(t-a)>=(e-s)*(r-a)&&(e-s)*(n-a)>=(i-s)*(t-a)&&(i-s)*(r-a)>=(o-s)*(n-a)}function _(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&g(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(x(e,t)&&x(t,e)&&function(e,t){var i=e,n=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&o<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(p(e.prev,e,t.prev)||p(e,t.prev,t))||v(e,t)&&p(e.prev,e,e.next)>0&&p(t.prev,t,t.next)>0)}function p(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function v(e,t){return e.x===t.x&&e.y===t.y}function g(e,t,i,n){var o=b(p(e,t,i)),r=b(p(e,t,n)),s=b(p(i,n,e)),a=b(p(i,n,t));return o!==r&&s!==a||(!(0!==o||!y(e,i,t))||(!(0!==r||!y(e,n,t))||(!(0!==s||!y(i,e,n))||!(0!==a||!y(i,t,n)))))}function y(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function b(e){return e>0?1:e<0?-1:0}function x(e,t){return p(e.prev,e,e.next)<0?p(e,t,e.next)>=0&&p(e,e.prev,t)>=0:p(e,t,e.prev)<0||p(e,e.next,t)<0}function w(e,t){var i=new I(e.i,e.x,e.y),n=new I(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,i.next=o,o.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function S(e,t,i,n){var o=new I(e,t,i);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function M(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function I(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,i,n){for(var o=0,r=t,s=i-n;r<i;r+=n)o+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return o}e.exports=t,e.exports.default=t,t.deviation=function(e,t,i,n){var o=t&&t.length,r=o?t[0]*i:e.length,s=Math.abs(T(e,0,r,i));if(o)for(var a=0,l=t.length;a<l;a++){var d=t[a]*i,c=a<l-1?t[a+1]*i:e.length;s-=Math.abs(T(e,d,c,i))}var u=0;for(a=0;a<n.length;a+=3){var h=n[a]*i,m=n[a+1]*i,f=n[a+2]*i;u+=Math.abs((e[h]-e[f])*(e[m+1]-e[h+1])-(e[h]-e[m])*(e[f+1]-e[h+1]))}return 0===s&&0===u?0:Math.abs((u-s)/s)},t.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},n=0,o=0;o<e.length;o++){for(var r=0;r<e[o].length;r++)for(var s=0;s<t;s++)i.vertices.push(e[o][r][s]);o>0&&(n+=e[o-1].length,i.holes.push(n))}return i}},9958:e=>{"use strict";var t,i,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(i){try{return t.call(null,e,0)}catch(i){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{i="function"==typeof clearTimeout?clearTimeout:r}catch(e){i=r}}();var a,l=[],d=!1,c=-1;function u(){d&&a&&(d=!1,a.length?l=a.concat(l):c=-1,l.length&&h())}function h(){if(!d){var e=s(u);d=!0;for(var t=l.length;t;){for(a=l,l=[];++c<t;)a&&a[c].run();c=-1,t=l.length}a=null,d=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===r||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function f(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];l.push(new m(e,t)),1!==l.length||d||s(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=f,n.addListener=f,n.once=f,n.off=f,n.removeListener=f,n.removeAllListeners=f,n.emit=f,n.prependListener=f,n.prependOnceListener=f,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},5398:function(e){"use strict";e.exports=function(){function e(e,i,o,r,s){t(e,i,o||0,r||e.length-1,s||n)}function t(e,n,o,r,s){for(;r>o;){if(r-o>600){var a=r-o+1,l=n-o+1,d=Math.log(a),c=.5*Math.exp(2*d/3),u=.5*Math.sqrt(d*c*(a-c)/a)*(l-a/2<0?-1:1);t(e,n,Math.max(o,Math.floor(n-l*c/a+u)),Math.min(r,Math.floor(n+(a-l)*c/a+u)),s)}var h=e[n],m=o,f=r;for(i(e,o,n),s(e[r],h)>0&&i(e,o,r);m<f;){for(i(e,m,f),m++,f--;s(e[m],h)<0;)m++;for(;s(e[f],h)>0;)f--}0===s(e[o],h)?i(e,o,f):i(e,++f,r),f<=n&&(o=f+1),n<=f&&(r=f-1)}}function i(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function n(e,t){return e<t?-1:e>t?1:0}return e}()},7123:(e,t,i)=>{"use strict";e.exports=o,e.exports.default=o;var n=i(5398);function o(e,t){if(!(this instanceof o))return new o(e,t);this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&this._initFormat(t),this.clear()}function r(e,t,i){if(!i)return t.indexOf(e);for(var n=0;n<t.length;n++)if(i(e,t[n]))return n;return-1}function s(e,t){a(e,0,e.children.length,t,e)}function a(e,t,i,n,o){o||(o=_(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(var r,s=t;s<i;s++)r=e.children[s],l(o,e.leaf?n(r):r);return o}function l(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function d(e,t){return e.minX-t.minX}function c(e,t){return e.minY-t.minY}function u(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function h(e){return e.maxX-e.minX+(e.maxY-e.minY)}function m(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function f(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function _(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function p(e,t,i,o,r){for(var s,a=[t,i];a.length;)(i=a.pop())-(t=a.pop())<=o||(s=t+Math.ceil((i-t)/o/2)*o,n(e,s,t,i,r),a.push(t,s,s,i))}o.prototype={all:function(){return this._all(this.data,[])},search:function(e){var t=this.data,i=[],n=this.toBBox;if(!f(e,t))return i;for(var o,r,s,a,l=[];t;){for(o=0,r=t.children.length;o<r;o++)s=t.children[o],f(e,a=t.leaf?n(s):s)&&(t.leaf?i.push(s):m(e,a)?this._all(s,i):l.push(s));t=l.pop()}return i},collides:function(e){var t=this.data,i=this.toBBox;if(!f(e,t))return!1;for(var n,o,r,s,a=[];t;){for(n=0,o=t.children.length;n<o;n++)if(r=t.children[n],f(e,s=t.leaf?i(r):r)){if(t.leaf||m(e,s))return!0;a.push(r)}t=a.pop()}return!1},load:function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0,i=e.length;t<i;t++)this.insert(e[t]);return this}var n=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var o=this.data;this.data=n,n=o}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},insert:function(e){return e&&this._insert(e,this.data.height-1),this},clear:function(){return this.data=_([]),this},remove:function(e,t){if(!e)return this;for(var i,n,o,s,a=this.data,l=this.toBBox(e),d=[],c=[];a||d.length;){if(a||(a=d.pop(),n=d[d.length-1],i=c.pop(),s=!0),a.leaf&&-1!==(o=r(e,a.children,t)))return a.children.splice(o,1),d.push(a),this._condense(d),this;s||a.leaf||!m(a,l)?n?(i++,a=n.children[i],s=!1):a=null:(d.push(a),c.push(i),i=0,n=a,a=a.children[0])}return this},toBBox:function(e){return e},compareMinX:d,compareMinY:c,toJSON:function(){return this.data},fromJSON:function(e){return this.data=e,this},_all:function(e,t){for(var i=[];e;)e.leaf?t.push.apply(t,e.children):i.push.apply(i,e.children),e=i.pop();return t},_build:function(e,t,i,n){var o,r=i-t+1,a=this._maxEntries;if(r<=a)return s(o=_(e.slice(t,i+1)),this.toBBox),o;n||(n=Math.ceil(Math.log(r)/Math.log(a)),a=Math.ceil(r/Math.pow(a,n-1))),(o=_([])).leaf=!1,o.height=n;var l,d,c,u,h=Math.ceil(r/a),m=h*Math.ceil(Math.sqrt(a));for(p(e,t,i,m,this.compareMinX),l=t;l<=i;l+=m)for(p(e,l,c=Math.min(l+m-1,i),h,this.compareMinY),d=l;d<=c;d+=h)u=Math.min(d+h-1,c),o.children.push(this._build(e,d,u,n-1));return s(o,this.toBBox),o},_chooseSubtree:function(e,t,i,n){for(var o,r,s,a,l,d,c,h,m,f;n.push(t),!t.leaf&&n.length-1!==i;){for(c=h=1/0,o=0,r=t.children.length;o<r;o++)l=u(s=t.children[o]),m=e,f=s,(d=(Math.max(f.maxX,m.maxX)-Math.min(f.minX,m.minX))*(Math.max(f.maxY,m.maxY)-Math.min(f.minY,m.minY))-l)<h?(h=d,c=l<c?l:c,a=s):d===h&&l<c&&(c=l,a=s);t=a||t.children[0]}return t},_insert:function(e,t,i){var n=this.toBBox,o=i?e:n(e),r=[],s=this._chooseSubtree(o,this.data,t,r);for(s.children.push(e),l(s,o);t>=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(o,r,t)},_split:function(e,t){var i=e[t],n=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,n);var r=this._chooseSplitIndex(i,o,n),a=_(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,s(i,this.toBBox),s(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(i,a)},_splitRoot:function(e,t){this.data=_([e,t]),this.data.height=e.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},_chooseSplitIndex:function(e,t,i){var n,o,r,s,l,d,c,h,m,f,_,p,v,g;for(d=c=1/0,n=t;n<=i-t;n++)o=a(e,0,n,this.toBBox),r=a(e,n,i,this.toBBox),m=o,f=r,_=void 0,p=void 0,v=void 0,g=void 0,_=Math.max(m.minX,f.minX),p=Math.max(m.minY,f.minY),v=Math.min(m.maxX,f.maxX),g=Math.min(m.maxY,f.maxY),s=Math.max(0,v-_)*Math.max(0,g-p),l=u(o)+u(r),s<d?(d=s,h=n,c=l<c?l:c):s===d&&l<c&&(c=l,h=n);return h},_chooseSplitAxis:function(e,t,i){var n=e.leaf?this.compareMinX:d,o=e.leaf?this.compareMinY:c;this._allDistMargin(e,t,i,n)<this._allDistMargin(e,t,i,o)&&e.children.sort(n)},_allDistMargin:function(e,t,i,n){e.children.sort(n);var o,r,s=this.toBBox,d=a(e,0,t,s),c=a(e,i-t,i,s),u=h(d)+h(c);for(o=t;o<i-t;o++)r=e.children[o],l(d,e.leaf?s(r):r),u+=h(d);for(o=i-t-1;o>=t;o--)r=e.children[o],l(c,e.leaf?s(r):r),u+=h(c);return u},_adjustParentBBoxes:function(e,t,i){for(var n=i;n>=0;n--)l(t[n],e)},_condense:function(e){for(var t,i=e.length-1;i>=0;i--)0===e[i].children.length?i>0?(t=e[i-1].children).splice(t.indexOf(e[i]),1):this.clear():s(e[i],this.toBBox)},_initFormat:function(e){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this.toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}},7731:(e,t,i)=>{"use strict";i.d(t,{_T:()=>n,mG:()=>o});function n(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]])}return i}function o(e,t,i,n){return new(i||(i=Promise))((function(o,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))}Object.create;Object.create},8346:e=>{"use strict";e.exports=function e(t,i){var n,o=0,r=0,s=i=i||0,a=t.length;do{if(s>=a||r>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],o+=r<28?(127&n)<<r:(127&n)*Math.pow(2,r),r+=7}while(n>=128);return e.bytes=s-i,o}},6072:e=>{"use strict";e.exports=function e(i,n,o){if(Number.MAX_SAFE_INTEGER&&i>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];var r=o=o||0;for(;i>=t;)n[o++]=255&i|128,i/=128;for(;-128&i;)n[o++]=255&i|128,i>>>=7;return n[o]=0|i,e.bytes=o-r+1,n};var t=Math.pow(2,31)},7811:(e,t,i)=>{"use strict";e.exports={encode:i(6072),decode:i(8346),encodingLength:i(835)}},835:e=>{"use strict";var t=Math.pow(2,7),i=Math.pow(2,14),n=Math.pow(2,21),o=Math.pow(2,28),r=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),l=Math.pow(2,56),d=Math.pow(2,63);e.exports=function(e){return e<t?1:e<i?2:e<n?3:e<o?4:e<r?5:e<s?6:e<a?7:e<l?8:e<d?9:10}},1239:(e,t,i)=>{"use strict";i.r(t),i.d(t,{API_VERSION:()=>wv,AnimationOptions:()=>S.AnimationOptions,Circle:()=>ev,CircleMarker:()=>iv,CircleMarkerOptions:()=>M.CircleMarkerOptions,CircleOptions:()=>M.CircleOptions,Control:()=>np,ControlOptions:()=>M.ControlOptions,ControlPosition:()=>M.ControlPosition,DefaultEventTargetData:()=>b.DefaultEventTargetData,DefaultSource:()=>Up,DynamicObjectEventTable:()=>b.DynamicObjectEventTable,DynamicObjectPointerEvent:()=>b.DynamicObjectPointerEvent,Easing:()=>S.Easing,EventTarget:()=>b.EventTarget,EventTargetData:()=>b.EventTargetData,FeatureState:()=>M.FeatureState,FeatureStateMap:()=>M.FeatureStateMap,FitBoundsOptions:()=>M.FitBoundsOptions,FloorControl:()=>Lp,FloorLevelChangeEvent:()=>b.FloorLevelChangeEvent,FloorPlanHideEvent:()=>b.FloorPlanHideEvent,FloorPlanShowEvent:()=>b.FloorPlanShowEvent,GeoJsonEventTargetData:()=>b.GeoJsonEventTargetData,GeoJsonSource:()=>hv,GeoJsonSourceOptions:()=>M.GeoJsonSourceOptions,GeoJsonViewportSource:()=>fv,GeoJsonViewportSourceOptions:()=>M.GeoJsonViewportSourceOptions,GltfModel:()=>cv,GltfModelOptions:()=>M.GltfModelOptions,GltfModelTransformationOptions:()=>M.GltfModelTransformationOptions,HtmlMarker:()=>Jp,HtmlMarkerOptions:()=>M.HtmlMarkerOptions,Label:()=>qp,LabelImage:()=>M.LabelImage,LabelOptions:()=>M.LabelOptions,LngLatBounds:()=>x.LngLatBounds,LngLatBoundsClass:()=>Ip,Map:()=>Vp,MapEvent:()=>b.MapEvent,MapEventTable:()=>b.MapEventTable,MapOptions:()=>M.MapOptions,MapPointerEvent:()=>b.MapPointerEvent,MapSupportOptions:()=>M.MapSupportOptions,Marker:()=>Xp,MarkerIconOptions:()=>M.MarkerIconOptions,MarkerLabelOptions:()=>M.MarkerLabelOptions,MarkerOptions:()=>M.MarkerOptions,Padding:()=>M.Padding,PointerEvent:()=>b.PointerEvent,Polygon:()=>sv,PolygonOptions:()=>M.PolygonOptions,Polyline:()=>ov,PolylineOptions:()=>M.PolylineOptions,Raster:()=>lv,RasterOptions:()=>M.RasterOptions,RasterSource:()=>M.RasterSource,RasterTileSource:()=>bv,RasterTileSourceOptions:()=>M.RasterTileSourceOptions,RotationAnimationOptions:()=>S.RotationAnimationOptions,ScaleControl:()=>Np,SourceAttributes:()=>M.SourceAttributes,StyleIconConfig:()=>w.StyleIconConfig,StyleLoadEvent:()=>b.StyleLoadEvent,StyleOptions:()=>w.StyleOptions,TrafficControl:()=>hp,TrafficScoreEvent:()=>b.TrafficScoreEvent,TrafficVisibilityEvent:()=>b.TrafficVisibilityEvent,ZenithSource:()=>xv,ZoomControl:()=>lp,_J:()=>y,isSupported:()=>_t,isTerrainSupported:()=>ut,notSupportedReason:()=>pt,terrainNotSupportedReason:()=>vt});var n={};i.r(n),i.d(n,{getMetersFromPixelsXY:()=>L.$X,getUrl:()=>P.Gr,hashToString:()=>A.GG});var o={};i.r(o),i.d(o,{Q:()=>Am});var r={};i.r(r),i.d(r,{a:()=>Bm});var s={};i.r(s),i.d(s,{e:()=>xf});var a={};i.r(a),i.d(a,{X:()=>z_});var l={};i.r(l),i.d(l,{S:()=>j_});var d={};i.r(d),i.d(d,{J:()=>G_});var c={};i.r(c),i.d(c,{U:()=>$_});var u={};i.r(u),i.d(u,{n:()=>q_});var h={};i.r(h),i.d(h,{P:()=>J_});var m={};i.r(m),i.d(m,{c:()=>Q_});var f={};i.r(f);var _={};i.r(_);var p={};i.r(p);var v={};i.r(v);var g={};i.r(g),i.d(g,{l:()=>ip});var y={};i.r(y),i.d(y,{BlendEquation:()=>bt.BlendEquation,BlendFunc:()=>bt.BlendFunc,BssHostAppParams:()=>s.BssHostAppParams,Circle:()=>g_,CircleMarker:()=>ie,CircleMarkerOptions:()=>p.CircleMarkerOptions,CircleOptions:()=>p.CircleOptions,CommPoiEvent:()=>f.CommPoiEvent,CullFaceMode:()=>bt.CullFaceMode,DashedPolyline:()=>__,DashedPolylineOptions:()=>p.DashedPolylineOptions,DataTileLayer:()=>ip,DataTileLayerOptions:()=>g.DataTileLayerOptions,DefaultSource:()=>Em,DepthFunc:()=>bt.DepthFunc,DraggablePointerEvent:()=>f.DraggablePointerEvent,DynamicObject:()=>k,DynamicObjectPointerEvent:()=>f.DynamicObjectPointerEvent,Entrance:()=>qu,EntranceOptions:()=>p.EntranceOptions,FirmsToFloorIndexMap:()=>v.FirmsToFloorIndexMap,FloorComplexHideEvent:()=>f.FloorComplexHideEvent,FloorComplexShowEvent:()=>f.FloorComplexShowEvent,FontName:()=>lu.FontName,GeoJsonSource:()=>j.gs,GeoJsonSourceOptions:()=>j.GeoJsonSourceOptions,GeoJsonTileSource:()=>j.Xm,GeoJsonTileSourceOptions:()=>j.GeoJsonTileSourceOptions,GeoJsonViewportSource:()=>j.T0,GltfModel:()=>Bm,GltfModelOptions:()=>r.GltfModelOptions,GltfModelTransformationOptions:()=>r.GltfModelTransformationOptions,HTMLMarkerShownEvent:()=>f.HTMLMarkerShownEvent,Heatmap:()=>z_,HeatmapOptions:()=>a.HeatmapOptions,HeatmapPalette:()=>a.HeatmapPalette,HeatmapPoint:()=>a.HeatmapPoint,HtmlMarker:()=>Vu,HtmlMarkerOptions:()=>p.HtmlMarkerOptions,IconTransformerParams:()=>m.IconTransformerParams,InteractionEvent:()=>f.InteractionEvent,InteractionTarget:()=>f.InteractionTarget,LabelsDebugOptions:()=>o.LabelsDebugOptions,LinePatternType:()=>Es.y,Map:()=>u_,MapClass:()=>u_,MapErrorEvent:()=>_.MapErrorEvent,MapEvent:()=>f.MapEvent,MapOptions:()=>s.MapOptions,MapPointerEvent:()=>f.MapPointerEvent,Marker:()=>G_,MarkerIconOptions:()=>d.MarkerIconOptions,MarkerLabelOptions:()=>d.MarkerLabelOptions,MarkerOptions:()=>d.MarkerOptions,OnlineMarker:()=>Q_,OnlineMarkerIcon:()=>m.OnlineMarkerIcon,OnlineMarkerOptions:()=>m.OnlineMarkerOptions,Padding:()=>s.Padding,PersonalPoi:()=>s.PersonalPoi,PointLabel:()=>j_,PointLabelOptions:()=>l.PointLabelOptions,Polygon:()=>v_,PolygonOptions:()=>p.PolygonOptions,Polyline:()=>f_,PolylineOptions:()=>p.PolylineOptions,Raster:()=>q_,RasterOptions:()=>u.RasterOptions,RasterTileSource:()=>J_,RasterTileSourceOptions:()=>h.RasterTileSourceOptions,Rect:()=>$_,RectOptions:()=>c.RectOptions,RulerChangeEvent:()=>f.RulerChangeEvent,SourceAttrs:()=>s.SourceAttrs,SourceMetatile:()=>lu.SourceMetatile,Stats:()=>s.Stats,TileCoords:()=>s.TileCoords,TileLoadEvent:()=>f.TileLoadEvent,TrafficScoreEvent:()=>f.TrafficScoreEvent,Viewport:()=>s.Viewport,ZenithSource:()=>V,ZenithSourceOptionsInternal:()=>U.ZenithSourceOptionsInternal,config:()=>T,linePatternFromString:()=>Es.R,mapglUtils:()=>n,utils:()=>E});var b={};i.r(b),i.d(b,{C:()=>pp});var x={};i.r(x),i.d(x,{S:()=>Ip});var w={};i.r(w);var S={};i.r(S);var M={};i.r(M);var I=i(7731),T=i(9218),E=i(3741),P=i(2435),A=i(7188),L=i(9073),C=i(3675),z=i(6874);class k extends C.c{constructor(e,t,i){var n;super(),this.interactive=null===(n=t.interactive)||void 0===n||n,this.uniqId=String((0,z.fD)()),this.parentObject=i,this.modules=e.modules,this.mapState=e.state,this.tileObjects=[],this.identifyIds=[]}update(){this.mapState.needReplicasUpdate&&this.tileObjects.forEach((e=>{e.needSync=!0}))}destroy(){const e=this.modules;this.tileObjects.forEach((t=>{t.clean(this.mapState),e.tileManager.removeObject(t)})),this.tileObjects=[],e.layers.removeLayer(this),e.renderer.addRerenderEvent()}getIdentifyData(){return this.identifyIds.map((e=>({dynamicObjectId:this.uniqId,metatileHash:-1,ids:e})))}isInteractive(){return this.interactive}}var O=i(378),R=i(4265),F=i(1274),B=i(7609),D=i(7966),j=i(5071),N=i(9600),U=i(2627),H=i(7619),G=i(6273);class V{constructor(e,t,i){var n,o,r,s,a,l;this.options=t,this.type="zenith",this.id=(0,N.Q)(),this.identifyAsDefaultSource=null===(n=t.identifyAsDefaultSource)||void 0===n||n,this.identifyAsDefaultSource&&!t.promoteId&&(t.promoteId="id"),this.sourceOptions=t,this.modelsAppearStrategy=null!==(o=t.modelsAppearStrategy)&&void 0!==o?o:G.jm,this.state=e.state,this.modules=e.modules,this.sourceCore=new U.nt(this.id,this.modules,this.options),this.tileLayer=new H.I(null!==(r=t.minZoom)&&void 0!==r?r:T.tiles.maxUniverseZoom+1,null!==(s=t.maxZoom)&&void 0!==s?s:T.tiles.maxRegionalZoom,null!==(a=t.minZoom)&&void 0!==a?a:T.tiles.maxUniverseZoom+1,null!==(l=t.maxDetailLevel)&&void 0!==l?l:T.tiles.maxDetailLevel,this.modules,this.state,this.sourceCore,this.options),this.modules.tileManager.addTileLayer(this.tileLayer),this.modules.sourceStorage.addSource(this),this.mapglApiSource=i}getObjectAttributes(e,t){return this.sourceCore.getObjectAttributes(e,t)}getId(){return this.id}getOptions(){return this.sourceOptions}getAttributes(){return this.sourceCore.getAttributes()}getZoomDirection(){return this.tileLayer.getZoomDirection()}setAttributes(e){this.sourceCore.setAttributes(e),this.tileLayer.redraw()}getUrl(e,t){return(0,P.Gr)(e,Object.assign({host:this.options.tileServer,tileSet:this.options.tileSet,protocol:this.options.tileProtocol,subdomain:this.options.subdomains[0]},t))}destroy(){this.modules.tileManager.removeTileLayer(this.tileLayer),this.tileLayer.destroy(),this.modules.sourceStorage.removeSource(this.id),this.sourceCore.destroy()}setFeatureStateMap(e){this.sourceCore.setFeatureStateMap(e),this.tileLayer.onFeatureStateMapChange()}isIdentifiedAsDefault(){return this.identifyAsDefaultSource}}var Z=i(6243),W=i(8585);function X(e,t){if(void 0===t)return;if(t.sourceId){const i=e.getSourceById(t.sourceId);if(!(null==i?void 0:i.isIdentifiedAsDefault()))return}const i={id:t.id,symbol:t.symbol};return"point"===t.symbol&&(i.isText=1===t.instanceId),t.sublayer&&(i.isCityCommercial=(0,B.wu)(t.sublayer),i.isPremiumCommercial=(0,B.CE)(t.sublayer),i.isCommercial=(0,B.Ty)(t.sublayer),i.isPersonal=(0,B.h3)(t.sublayer),("point"===t.symbol&&!i.isCommercial||"gltfModel"===t.symbol)&&(i.sysCode=t.objectClass)),t.center&&(i.center=W.H.toGeo(t.center)),"gltfModel"===t.symbol&&(i.sublayer=t.sublayer,i.isCommercial=!!t.sublayer&&(0,B.M7)(t.sublayer)),i}function K(e,t,i,n,o){const r=[0,0];if(o.camera.unproject(n,r,!0),t&&void 0!==t.dynamicObjectId){const s=e;let a=o.layers.getDynamicObjectLayers().find((e=>e.uniqId===t.dynamicObjectId));if((null==a?void 0:a.parentObject)&&(a=null==a?void 0:a.parentObject),!a)return;const l={lngLat:r,originalEvent:i,point:n,targetData:a};return void a.emit(s,l)}const s=X(o.sourceStorage,t),a=function(e,t){var i;if(void 0===t)return;if(t.sourceId){const n=e.getSourceById(t.sourceId);if(n)switch(n.type){case"geojson":if("internal"===n.subtype&&n instanceof j.gs||"viewport-internal"===n.subtype&&n instanceof j.T0)return{type:"geojson",id:t.id,feature:n.getFeatureById(t.id,t.tileKey),source:n};if("external"===n.subtype&&n instanceof j.Xm)return{type:"geojsonTile",getFeatureProperties:()=>void 0===t.tileKey?Promise.resolve():n.getObjectAttributes(t.id,t.tileKey),source:n};case"zenith":if(n instanceof V)return{type:"zenith",id:t.id,source:n,attributes:n.getObjectAttributes(null!==(i=t.tileKey)&&void 0!==i?i:"",t.id)}}}const n={type:"default",id:t.id};return t.floorId&&(n.floorId=t.floorId),n}(o.sourceStorage,t);if(("mousedown"===e||"click"===e)&&void 0!==t&&"point"===(null==s?void 0:s.symbol)&&void 0!==a){const e=(0,D.HB)(o,t,s)||{};void 0!==e&&(a.poiIcon=e)}if(t){const e=o.styleManager.getStyleLayer(t.styleId,t.layerId);e&&a&&(a.layerId=e.id)}const l={lngLat:r,originalEvent:i,point:n,target:s,targetData:a},d=e;o.map.emit(d,l)}class $ extends k{constructor(e,t,i){super(e,t),this.start=e=>{const{modules:t,container:i}=this,{camera:n}=t;if(0!==e.button)return;const o=(0,F.yK)(i,e.clientX,e.clientY);this.contains(o)&&(t.handler.block(),t.mouseMoveHandler.block(),this.dragStartCursorPoint=o,this.dragStartAnchorPoint=n.project(W.H.toGeo(this.getPosition())),document.addEventListener("mouseup",this.stop),document.addEventListener("mousemove",this.move),this.emitEvent("dragstart",e))},this.move=e=>{const{camera:t}=this.modules,{dragStartAnchorPoint:i,dragStartCursorPoint:n,container:o}=this;if(void 0===i||void 0===n)return;const r=(0,F.yK)(o,e.clientX,e.clientY),s=O.d9(i);O.IH(s,s,r),O.lu(s,s,n),this.setPosition(W.H.fromGeo(t.unproject(s))),this.emitEvent("drag",e)},this.stop=e=>{if(0!==e.button)return;this.dragStartCursorPoint=void 0,this.dragStartAnchorPoint=void 0,document.removeEventListener("mouseup",this.stop),document.removeEventListener("mousemove",this.move);const{modules:t}=this;t.handler.unblock(),t.mouseMoveHandler.unblock(),this.emitEvent("dragend",e),this.interactive&&t.identifier.resetCache()},this.container=e.modules.layout.mapContainer,i&&this.container.addEventListener("mousedown",this.start,!0)}destroy(){super.destroy(),this.container.removeEventListener("mousedown",this.start,!0),document.removeEventListener("mouseup",this.stop),document.removeEventListener("mousemove",this.move)}emitEvent(e,t){const i=this.getPosition(),n=W.H.toGeo(i),o=this.modules.camera.flat.project(i),r=this.modules.identifier.searchSync(o),s=void 0!==r&&void 0===r.dynamicObjectId?X(this.modules.sourceStorage,r):void 0;this.emit(e,{originalEvent:t,target:s,targetData:this,lngLat:n,point:o})}}var q=i(1436),Y=i(6392),J=i(3249),Q=i(4526),ee=i(871),te=i(2543);class ie extends ${constructor(e,t){var i,n;super(e,t,null!==(i=t.draggable)&&void 0!==i&&i),this.visible=!0,this.options=t;const o=W.H.fromGeo(this.options.coordinates);this.position={userValue:o,normalizedValue:(0,L.I0)(o)};const{dynamicStyle:r,collector:s,tileManager:a,identifier:l,layers:d}=this.modules;if(this.layer=(0,Q.qw)({type:"circle",id:`dynamic-circleMarker-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.color,strokeColor:this.options.borderColor,strokeColor2:this.options.border2Color,width:this.options.width,strokeWidth:this.options.borderWidth,strokeWidth2:this.options.border2Width}}),!this.layer)return;r.addLayer(this.layer,this.options.zIndex);const c=null!==(n=o[2])&&void 0!==n?n:0,u=(0,Y.IR)(this.position.normalizedValue),h=(0,J.FJ)({}),m={x:[0],y:[0],z:[c]},f=(0,Y.Bs)(u),_=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,h,A.wz,this.interactive?"0":"",f);(0,q.Eu)(this.layer,_),(0,q.XI)({collector:s,generator:ee.p.generate,args:[r.getStyle().id,this.layer,_,m]});const p=s.getAccumulatedData(),v=new R.W("dynamicObject",p.data,this.modules,this.mapState,u);a.addObject(v),this.tileObjects.push(v),this.interactive&&this.identifyIds.push(p.identifyIds),d.addLayer(this),s.reset(),this.modules.renderer.addRerenderEvent(),this.interactive&&l.resetCache()}remove(){this.layer&&this.modules.dynamicStyle.removeLayer(this.layer.innerId),this.interactive&&this.modules.identifier.resetCache(),super.destroy()}update(){if(this.mapState.globeMode){const{tileManager:e}=this.modules,t=this.modules.camera.ecef.canSee(this.options.coordinates);this.visible&&!t?this.tileObjects.forEach((t=>e.removeObject(t))):!this.visible&&t&&this.tileObjects.forEach((t=>e.addObject(t))),this.visible=t}}isOutOfMainReplica(){return!1}setPosition(e){const t=this.tileObjects[0];void 0!==t&&(this.position={userValue:e,normalizedValue:(0,L.I0)(e)},t.setTileCoords((0,Y.IR)(this.position.normalizedValue),this.mapState),this.modules.renderer.addRerenderEvent())}getPosition(){return this.position.userValue}contains(e){if(!this.layer)return!1;const{layer:t}=this,{camera:i}=this.modules,n=i.project(W.H.toGeo(this.position.normalizedValue)),o=(0,te.vn)(t.style.width,(0,te.jJ)(this.mapState.styleZoom,this.mapState.styleState,[]))/2+(0,te.vn)(t.style.strokeWidth,(0,te.jJ)(this.mapState.styleZoom,this.mapState.styleState,[]));return O.TK(n,e)<=o}}var ne=i(1684);function oe(e,t,i){const{top:n,right:o,bottom:r,left:s}=e.viewport,{clientWidth:a,clientHeight:l}=t;e.size=[Math.max(1,a-s-o),Math.max(1,l-n-r)],i.updateFrameBuffersSize()}function re(e,t){return function(e,t){return{top:Math.min(e.top,t[1]),bottom:Math.min(e.bottom,t[1]),left:Math.min(e.left,t[0]),right:Math.min(e.right,t[0])}}(function(e){return{top:Math.max(e.top,0),bottom:Math.max(e.bottom,0),left:Math.max(e.left,0),right:Math.max(e.right,0)}}(e),t)}function se(e,t){const{top:i,right:n,bottom:o,left:r}=e.padding;e.padding={top:i,right:n,bottom:o,left:r},t.addRerenderEvent(),t.updateFrameBuffersSize()}var ae=i(9450),le=i(8194);const de="inertia",ce=ne.sT.bind(null,de),ue=(e,t)=>{ne.Vx(de,{step:(e,i,n)=>{const{startPoint:o,startSpeed:r,startTime:s,direction:a}=n,l=ae.d9(a);ae.bA(l,l,i),ae.IH(l,l,o),e.loopWorld?le.se(e.maxBounds,l)||(he(t,e),le.Rk(l,e.maxBounds,l)):le.r3(e.maxBounds,l)||(he(t,e),le.Rk(l,e.maxBounds,l)),e.center=l,"zoom"===e.zoomTypePreserving?e.styleZoom=(0,L.X$)(e.zoom,l):e.zoom=(0,L.Z3)(e.styleZoom,l);const d=((e,t,i)=>e*Math.pow(1-(i-t)/T.inertia.duration,T.inertia.nonLinearity))(r,s,e.time);(0,L.ik)(d,e.zoom)<T.inertia.minSpeed&&he(t,e)}},e)},he=(e,t)=>{ne.sT(de,t),e.classList.remove("mapgl-inertia")},me="center",fe=(e,t,i={})=>{if(ne.sT(me,e),ce(e),(0,le.Rk)(t,e.maxBounds,t),!1===i.animate||0===i.duration)e.center=t,"zoom"===e.zoomTypePreserving?e.styleZoom=(0,L.X$)(e.zoom,t):e.zoom=(0,L.Z3)(e.styleZoom,t);else{const n=void 0!==i.easing?i.easing:"linear",o=void 0!==i.duration?i.duration:250;ne.BL(me,{easing:n},e,e.center,t,o,1)}},_e=ne.sT.bind(null,me),pe=ne.Vx.bind(null,me,{step:(e,t)=>{e.center=t,"zoom"===e.zoomTypePreserving?e.styleZoom=(0,L.X$)(e.zoom,t):e.zoom=(0,L.Z3)(e.styleZoom,t)}}),ve="rotation";function ge(e,t){return(e-=t)>=Math.PI?e=(e+Math.PI)%(2*Math.PI)-Math.PI:e<-Math.PI&&(e=Math.PI-(Math.PI-e)%(2*Math.PI)),e+=t}function ye(e,t,i={}){if(ne.sT(ve,e),!1===i.animate||0===i.duration)e.rotation=ge(t,0);else{const n=void 0===i.normalize||i.normalize;ne.BL(ve,{easing:i.easing||"linear"},e,e.rotation,n?ge(t,e.rotation):t,i.duration||250,1)}}const be=ne.sT.bind(null,ve),xe=ne.Vx.bind(null,ve,{step:(e,t)=>e.rotation=ge(t,0)});var we=i(6490);const Se="pitch";function Me(e,t,i={}){ne.sT(Se,e);const n=(0,we.uZ)(t,e.minPitch,e.maxPitch);!1===i.animate||0===i.duration?e.pitch=n:ne.BL(Se,{easing:i.easing||"linear"},e,e.pitch,n,i.duration||300,1)}const Ie=ne.sT.bind(null,Se),Te=ne.Vx.bind(null,Se,{step:(e,t)=>e.pitch=t}),Ee="zoom",Pe=(e,t,i={})=>{ne.sT(Ee,e);const n=(0,we.uZ)(t,e.minZoom,e.maxZoom);if(n!==e.zoom)if(!1===i.animate||0===i.duration)i.zoomPoint&&(ae.IH(e.center,e.center,(0,we.Kv)(e,i.zoomPoint,{zoom:n})),le.Rk(e.center,e.maxBounds,e.center)),e.zoom=n,e.styleZoom=(0,L.X$)(n,e.center);else{const t=i.useHeightForAnimation?(0,L.r9)(e.zoom,e.size):e.zoom,o=i.useHeightForAnimation?(0,L.r9)(n,e.size):n,r=void 0!==i.easing?i.easing:"easeOutCubic",s=void 0!==i.duration?i.duration:250;ne.BL(Ee,{easing:r},e,t,o,s,1,{zoomPoint:i.zoomPoint,useHeightForAnimation:!!i.useHeightForAnimation})}},Ae=ne.sT.bind(null,Ee),Le=ne.Vx.bind(null,Ee,{step:(e,t,i={})=>{const n=i&&i.useHeightForAnimation?(0,L.nn)(t,e.size):t;i&&i.zoomPoint&&(ae.IH(e.center,e.center,(0,we.Kv)(e,i.zoomPoint,{zoom:n})),le.Rk(e.center,e.maxBounds,e.center)),e.zoom=n,e.styleZoom=(0,L.X$)(n,e.center)}}),Ce=navigator.msPointerEnabled&&navigator.msMaxTouchPoints&&!window.PointerEvent,ze=window.PointerEvent&&navigator.pointerEnabled&&navigator.maxTouchPoints||Ce||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,ke=Ne("webkit"),Oe=Ne("chrome")||Ne("crios"),Re="ActiveXObject"in window,Fe=!Oe&&Ne("safari"),Be=(Ne("gecko")&&!ke&&window.opera,navigator.platform.toUpperCase().indexOf("MAC")>=0),De=Ne("windows"),je=Ne("firefox");function Ne(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var Ue=i(7628);function He(e){Ae(e),_e(e),be(e),Ie(e),ce(e)}class Ge{constructor(e,t){this.onWheelScroll=e=>{this.isBlocked||(e.preventDefault(),void 0===e.deltaMode&&void 0===e.deltaY||(this.state.userHasInteracted=!0,this.screenPoint=(0,F.yK)(this.container,e.clientX,e.clientY),e.ctrlKey?this.deltaAccumulator-=10*e.deltaY:1===e.deltaMode?this.deltaAccumulator-=20*e.deltaY:this.deltaAccumulator-=e.deltaY,this.eventCount+=1))},this.startZooming=()=>{const e=this.state;let t=this.getDelta();Be?t*=T.zoom.macWheelDeltaToZoomDelta:Number.isInteger(t)?t=(0,we.Xx)(t)*T.zoom.wheelZoomDelta:t*=T.zoom.notMacTrackpadDeltaToZoomDelta;const i=e.zoom+t,n=(0,we.uZ)(i,e.minZoom,e.maxZoom);n!==e.zoom&&(He(e),Pe(e,n,{duration:T.zoom.animDuration,animate:!Be,zoomPoint:e.keepCenterWhileUserZoomRotate?void 0:this.screenPoint}))},this.stop=()=>{this.state.userHasInteracted=!0,Ae(this.state)},this.state=e,this.container=t,Be||(this.startZooming=(0,Ue.P)(this.startZooming,T.zoom.throttleDelay)),this.deltaAccumulator=0,this.eventCount=0,this.screenPoint=[0,0],this.isBlocked=!1,this.container.addEventListener("wheel",this.onWheelScroll),this.container.addEventListener("mousedown",this.stop)}destroy(){this.container.removeEventListener("wheel",this.onWheelScroll),this.container.removeEventListener("mousedown",this.stop)}update(){0!==this.eventCount&&(this.startZooming(),this.state.rerenderEvents.push({type:"coreNeedRerender"}))}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}getDelta(){const e=this.deltaAccumulator/this.eventCount;return this.deltaAccumulator=0,this.eventCount=0,e}}var Ve=i(8124);class Ze{constructor(e,t){this.onMouseUp=e=>{this.isBlocked||1===e.which&&this.start()},this.onTouchEnd=e=>{this.isBlocked||0===e.touches.length&&this.start()},this.start=()=>{const e=this.state;e.userHasInteracted=!0;const t=this.getCurrentSpeed(e.time),i=ae.kE(t);if((0,L.ik)(i,e.zoom)<=T.inertia.minSpeed)return;const n=(0,L.h0)(T.inertia.maxSpeed,e.zoom),o=Math.min(i,n),r=this.calcDistanceByStartSpeed(o),s=ae.d9(e.center),a=ae.Ue();ae.Fv(a,t),((e,t,i,n,o)=>{ne.BL(de,{easing:"inertia"},e,0,o,T.inertia.duration,1,{startPoint:t,startSpeed:i,direction:n,startTime:e.time})})(e,s,o,a,r),this.container.classList.add("mapgl-inertia")},this.stop=()=>{ce(this.state),this.container.classList.remove("mapgl-inertia"),this.times=[],this.positions=[]},this.state=e,this.container=t,this.isBlocked=!1,this.container.addEventListener("mouseup",this.onMouseUp),this.container.addEventListener("mousedown",this.stop),ze&&(this.container.addEventListener("touchend",this.onTouchEnd),this.container.addEventListener("touchstart",this.stop)),this.zoomDiffer=new Ve.H([{path:"zoom",type:"number"}]),this.styleZoomDiffer=new Ve.H([{path:"styleZoom",type:"number"}]),this.centerDiffer=new Ve.H([{path:"center",type:"vec2"}]),this.times=[],this.positions=[]}destroy(){this.container.removeEventListener("mouseup",this.onMouseUp),this.container.removeEventListener("mousedown",this.stop),this.container.removeEventListener("touchend",this.onTouchEnd),this.container.removeEventListener("touchstart",this.stop)}update(){const e=this.state;this.centerDiffer.check(e)&&this.rememberTimeAndPosition(e);("zoom"===e.zoomTypePreserving?this.zoomDiffer.check(e):this.styleZoomDiffer.check(e))&&this.stop()}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}removeOldRecords(e){for(;e-this.times[0]>100&&this.times.length;)this.times.shift(),this.positions.shift()}rememberTimeAndPosition(e){const t=e.time;this.removeOldRecords(t),this.times.push(t),this.positions.push(ae.d9(e.center))}getCurrentSpeed(e){if(this.removeOldRecords(e),this.times.length<2)return ae.Ue();const t=ae.d9(this.positions[this.positions.length-1]);return ae.lu(t,t,this.positions[0]),ae.bA(t,t,1/(this.times[this.times.length-1]-this.times[0])),t}calcDistanceByStartSpeed(e){return e*T.inertia.duration/(T.inertia.nonLinearity+1)}}class We{constructor(e){this.emitMouseEvent=e=>{if(this.isBlocked)return;const t=(0,F.yK)(this.container,e.clientX,e.clientY);this.emitEvent(e,t)},this.emitTouchEvent=e=>{if(this.isBlocked)return;const t=(0,F.yK)(this.container,e.changedTouches[0].clientX,e.changedTouches[0].clientY);this.emitEvent(e,t)},this.container=e.layout.mapContainer,this.modules=e,this.isBlocked=!1,this.container.addEventListener("mouseup",this.emitMouseEvent),this.container.addEventListener("touchend",this.emitTouchEvent)}destroy(){this.container.removeEventListener("mouseup",this.emitMouseEvent),this.container.removeEventListener("touchend",this.emitTouchEvent)}update(){}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}emitEvent(e,t){if(!this.modules.layout.isActionWithCanvas(e))return;const i=e.type;this.modules.identifier.search(i,t).then((n=>{K(i,n,e,t,this.modules)}))}}class Xe{constructor(e,t,i){this.rotationDetected=!1,this.onGestureStart=e=>{this.isBlocked||(e.preventDefault(),this.startRotation=this.state.rotation,this.rotationDetected=!1,this.gestureRotation=0,this.isGestureStart=!0,this.startZoom=this.state.zoom,this.screenPoint=(0,F.yK)(this.container,e.clientX,e.clientY),this.state.userHasInteracted=!0,this.state.disableRotationByUserInteraction||this.container.classList.add("mapgl-rotating"),this.map.emit("interactionstart",{target:"zoom/rotation"}))},this.onGestureEnd=e=>{e.preventDefault(),this.isGestureStart&&(this.isGestureStart=!1,this.state.userHasInteracted=!0,this.container.classList.remove("mapgl-rotating"),this.map.emit("interactionend",{target:"zoom/rotation"}))},this.onGestureChange=e=>{if(e.preventDefault(),this.state.userHasInteracted=!0,e.scale>1?this.gestureZoom=e.scale-1:this.gestureZoom=-1/e.scale+1,this.state.disableRotationByUserInteraction)return;const t=(0,we.Id)(e.rotation);!this.rotationDetected&&Math.abs(t)>this.state.touchRotationThreshold&&(this.rotationDetected=!0,this.startRotation=this.state.rotation-t),this.rotationDetected&&(this.gestureRotation=t)},this.state=e,this.container=t,this.map=i,this.isBlocked=!1,this.isGestureStart=!1,this.gestureRotation=0,this.gestureZoom=0,this.screenPoint=[0,0],this.startRotation=0,this.startZoom=0,this.container.addEventListener("gesturestart",this.onGestureStart),this.container.addEventListener("gestureend",this.onGestureEnd),this.container.addEventListener("gesturechange",this.onGestureChange)}destroy(){this.container.removeEventListener("gesturestart",this.onGestureStart),this.container.removeEventListener("gestureend",this.onGestureEnd),this.container.removeEventListener("gesturechange",this.onGestureChange)}update(){if(0===this.gestureRotation&&0===this.gestureZoom)return;const e=this.state,t=this.startZoom+this.gestureZoom,i=this.startRotation+this.gestureRotation,n=ae.Ue(),o=e.keepCenterWhileUserZoomRotate?ae.Ue():(0,we.Kv)(e,this.screenPoint,{zoom:t,rotation:i});ae.IH(n,e.center,o),He(e),fe(e,n,{animate:!1}),Pe(e,t,{animate:!1}),e.disableRotationByUserInteraction||ye(e,i,{animate:!1}),this.gestureRotation=0,this.gestureZoom=0}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}}var Ke=i(3187);class $e extends C.c{constructor(e,t){super(),this.startRenderTime=0,this.catchNextUpdate=!1,this.durations=[],this.badDurations=[],this.countToCheck=75,this.slowFrameTime=100,this.mapState=e,this.mapModules=t,this.originalMapState={center:this.mapState.center.slice(),zoom:this.mapState.zoom,rotation:this.mapState.rotation,pitch:this.mapState.pitch}}update(){const{time:e,needRerender:t,rerenderEvents:i}=this.mapState,n=e-this.startRenderTime;this.catchNextUpdate&&(this.durations.push(n),n>=this.slowFrameTime&&this.badDurations.push(n),this.catchNextUpdate=!1),(t||i.length>0)&&(this.startRenderTime=e,this.catchNextUpdate=!0),this.durations.length>this.countToCheck&&this.check()}getFpsStats(){const e=this.durations.map((e=>1e3/e)),t=this.badDurations.map((e=>1e3/e)),i=(0,we.$I)(this.originalMapState.center,this.mapState.center)&&this.originalMapState.pitch===this.mapState.pitch&&this.originalMapState.rotation===this.mapState.rotation&&this.originalMapState.zoom===this.mapState.zoom;return{all:{min:e.length>0?Math.min(...e):0,max:e.length>0?Math.max(...e):0,avg:e.length>0?e.reduce(((e,t)=>e+t))/e.length:0,count:e.length},bad:{min:t.length>0?Math.min(...t):0,max:t.length>0?Math.max(...t):0,avg:t.length>0?t.reduce(((e,t)=>e+t))/t.length:0,count:t.length},isStatic:i}}getMemoryStats(){return(0,I.mG)(this,void 0,void 0,(function*(){return{cpu:yield this.getJsMemoryStats(),gpu:yield this.getGpuMemoryStats()}}))}check(){const e=function(e){e.sort(((e,t)=>e-t));const t=e[Math.floor(3*e.length/4)];return Math.round(1e3/t)}(this.durations);this.emit("fps",e),e<T.performanceCheck.fpsCaveat&&(this.mapState.performanceCaveatEmitted=!0,this.emit("performancecaveat")),this.durations=[],this.badDurations=[],this.countToCheck=Math.min(1e3,2*this.countToCheck)}getJsMemoryStats(){return(0,I.mG)(this,void 0,void 0,(function*(){const e=yield(0,Ke.e5)(this.mapModules);return Object.values(e).filter((e=>!!e.js)).map((e=>e.js)).reduce(((e,t)=>e+t["--sum"]),0)}))}getGpuMemoryStats(){return(0,I.mG)(this,void 0,void 0,(function*(){const e=yield(0,Ke.e5)(this.mapModules);return Object.values(e).filter((e=>!!e.gpu)).map((e=>e.gpu)).reduce(((e,t)=>e+t["--sum"]),0)}))}}var qe=i(9476);class Ye{constructor(){this.differ=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"rotation",type:"number"},{path:"pitch",type:"number"}]),this.debouncedSet=(0,qe.D)((e=>{ne.BL("stillness",{},e,e.stillness,1,400,1)}),100,!1),this.stillnessTickerUpdate=ne.Vx.bind(null,"stillness",{step:(e,t)=>{e.stillness=t}})}update(e){this.differ.check(e)&&(e.stillness=0,ne.sT("stillness",e),this.debouncedSet(e)),this.stillnessTickerUpdate(e)}}class Je{constructor(e){this.onTouchStart=()=>{this.isTouchStartEmitted=!0},this.onMouseOut=e=>{if(!this.prevGeo)return;const t=(0,F.yK)(this.container,e.clientX,e.clientY);K("mouseout",this.prevGeo,e,t,this.modules),this.prevGeo=void 0,this.skipIdentifyEvents=!0,this.modules.defaultSource.resetHoverId(),this.container.classList.remove("mapgl-hover")},this.onMouseMove=e=>{if(this.isTouchStartEmitted)return void(this.isTouchStartEmitted=!1);if(this.skipIdentifyEvents=!1,this.isBlocked)return;const t=(0,F.yK)(this.container,e.clientX,e.clientY);Promise.resolve().then((()=>this.modules.layout.isActionWithCanvas(e)?this.modules.identifier.search("mouseMove",t):void 0)).then((i=>{if(this.skipIdentifyEvents)return;const n=i&&this.prevGeo&&(i.id!==this.prevGeo.id||i.instanceId!==this.prevGeo.instanceId||i.dynamicObjectId!==this.prevGeo.dynamicObjectId||i.symbol!==this.prevGeo.symbol);!this.prevGeo||i&&!n||(K("mouseout",this.prevGeo,e,t,this.modules),this.prevGeo=void 0,this.container.classList.remove("mapgl-hover"),this.modules.defaultSource.resetHoverId()),!i||this.prevGeo&&!n||(this.prevGeo=i,this.container.classList.add("mapgl-hover"),K("mouseover",i,e,t,this.modules),this.modules.defaultSource.setHoverId(i.id)),K("mousemove",i,e,t,this.modules)}))},this.modules=e,this.isTouchStartEmitted=!1,this.skipIdentifyEvents=!1,this.isBlocked=!1,this.prevGeo=void 0,this.container=this.modules.layout.mapContainer,this.container.addEventListener("touchstart",this.onTouchStart),this.container.addEventListener("mousemove",this.onMouseMove),this.container.addEventListener("mouseout",this.onMouseOut)}destroy(){this.container.removeEventListener("touchstart",this.onTouchStart),this.container.removeEventListener("mousemove",this.onMouseMove),this.container.removeEventListener("mouseout",this.onMouseOut)}update(){}block(){this.isBlocked=!0}unblock(){this.isBlocked=!1}}const Qe=(e,t,i,n)=>{ne.sT("buildingHeight"+n,e),!1===i.animate||0===i.duration?(t.set(n,i.to),e.needLabeling=!0):ne.BL("buildingHeight"+n,{easing:i.easing},e,i.from,i.to,i.duration,1)};class et{constructor(e,t){this.state=e,this.modules=t,this.buildingHeights=new Map,this.minZoomBuildingHeight=1/0}getBuildingHeight(e){return e===-1/0?1:void 0!==e?(this.buildingHeights.has(e)||this.addBuildingHeightZoom(e),this.buildingHeights.get(e)||0):this.getDefaultBuildingHeight()}update(){this.buildingHeights.forEach(((e,t)=>{this.updateByZoom(t,e),this.isAnimating()&&((e,t,i)=>{ne.Vx.call(null,"buildingHeight"+i,{step:(e,n)=>t.set(i,n),complete:e=>e.needLabeling=!0},e)})(this.state,this.buildingHeights,t)}))}isAnimating(){return Array.from(this.buildingHeights.keys()).some((e=>void 0!==ne.U2("buildingHeight"+e,this.state)))}clearBuildingHeights(){this.buildingHeights.clear(),this.minZoomBuildingHeight=1/0}getDefaultBuildingHeight(){const e=this.minZoomBuildingHeight!==1/0?this.minZoomBuildingHeight:16;return this.state.styleZoom<e?0:1}updateByZoom(e,t){const i=this.state,n=ne.U2("buildingHeight"+e,i),o=void 0!==n?n.to:t;i.styleZoom>=e&&this.modules.tileManager.viewportTilesReady()&&1!==o?Qe(i,this.buildingHeights,{animate:!0,easing:T.buildingAnimation.easing,from:t,to:1,duration:T.buildingAnimation.duration*(1-t)},e):i.styleZoom<e&&0!==o&&Qe(i,this.buildingHeights,{animate:!1,to:0},e)}addBuildingHeightZoom(e){const t=e<this.state.styleZoom?0:1;this.buildingHeights.set(e,t),this.minZoomBuildingHeight>e&&(this.minZoomBuildingHeight=e)}}var tt=i(6311),it=i(127);class nt{constructor(e=null,t={}){this._src=null,this._glContext=null,this._texture=null,this._src=e,this.options=Object.assign({},nt.defaultOptions,t)}enable(e,t){return e.activeTexture(e.TEXTURE0+t),this._texture||this.prepare(e),e.bindTexture(e.TEXTURE_2D,this._texture),this}remove(){return this._texture&&this._glContext&&this._glContext.deleteTexture(this._texture),this._glContext=null,this._texture=null,this._src=null,this}getTexture(){return this._texture}subImage(e,t,i){var n;const o=this._glContext;if(!o)return console.warn("Texture is not prepared, cannot update sub-image"),this;o.bindTexture(o.TEXTURE_2D,this._texture),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,this.options.flipY),o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.options.premultiplyAlpha);const r=this._toGlParam(o,this.options.format),s=this._toGlParam(o,null!==(n=this.options.type)&&void 0!==n?n:nt.UnsignedByte);return null===r||null===s||o.texSubImage2D(o.TEXTURE_2D,0,t,i,r,s,e),this}prepare(e){var t,i,n;this._glContext=e,this._texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this._texture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,this.options.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.options.premultiplyAlpha);const o=this._toGlParam(e,this.options.format),r=this._toGlParam(e,null!==(t=this.options.type)&&void 0!==t?t:nt.UnsignedByte),s=this._toGlParam(e,this.options.wrapS),a=this._toGlParam(e,this.options.wrapT),l=this._toGlParam(e,null!==(i=this.options.magFilter)&&void 0!==i?i:nt.LinearFilter),d=this._toGlParam(e,null!==(n=this.options.minFilter)&&void 0!==n?n:nt.LinearMipMapLinearFilter),c=this.options.compareFunc?this._toGlParam(e,this.options.compareFunc):null;if(null!==o&&null!==r){const t=this.hookInternalFormat(o,r,e);ArrayBuffer.isView(this._src)||null===this._src?this.options.size&&e.texImage2D(e.TEXTURE_2D,0,t,this.options.size[0],this.options.size[1],0,o,r,this._src):this._src&&e.texImage2D(e.TEXTURE_2D,0,o,o,r,this._src)}return null!==s&&null!==a&&(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,a)),null!==l&&null!==d&&(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,l),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,d)),!c||e instanceof WebGLRenderingContext||e.texParameteri(e.TEXTURE_2D,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),this.options.generateMipmaps&&this.options.minFilter!==nt.NearestFilter&&this.options.minFilter!==nt.LinearFilter&&e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null),this}memSizeJs(){const e=this._src;return null===e?0:ArrayBuffer.isView(e)?e.byteLength:e instanceof ImageBitmap?e.height*e.width*4:(console.warn("[Stats] Untracked texture _src size"),0)}memSizeGPU(){var e,t,i,n;if(!this._texture)return 0;const o=(null!==(t=null===(e=this.options.size)||void 0===e?void 0:e[0])&&void 0!==t?t:0)*(null!==(n=null===(i=this.options.size)||void 0===i?void 0:i[1])&&void 0!==n?n:0)*4;return o>0?o:null!==this._src?this.memSizeJs():0}_toGlParam(e,t){return t===nt.ClampToEdgeWrapping?e.CLAMP_TO_EDGE:t===nt.Repeat?e.REPEAT:t===nt.MirroredRepeat?e.MIRRORED_REPEAT:t===nt.NearestFilter?e.NEAREST:t===nt.NearestMipMapNearestFilter?e.NEAREST_MIPMAP_NEAREST:t===nt.NearestMipMapLinearFilter?e.NEAREST_MIPMAP_LINEAR:t===nt.LinearFilter?e.LINEAR:t===nt.LinearMipMapNearestFilter?e.LINEAR_MIPMAP_NEAREST:t===nt.LinearMipMapLinearFilter?e.LINEAR_MIPMAP_LINEAR:t===nt.RgbaFormat?e.RGBA:t===nt.AlphaFormat?e.ALPHA:t===nt.RgbFormat?e.RGB:t===nt.DepthComponentFormat?e.DEPTH_COMPONENT:t===nt.UnsignedByte?e.UNSIGNED_BYTE:t===nt.UnsignedShort?e.UNSIGNED_SHORT:t===nt.Float?e.FLOAT:t===nt.UnsignedInt?e.UNSIGNED_INT:e instanceof WebGLRenderingContext?null:t===nt.RedFormat?e.RED:t===nt.CompareRefToTexture?e.COMPARE_REF_TO_TEXTURE:t===nt.CompareNone?e.NONE:t===nt.DepthComponentFormat32?e.DEPTH_COMPONENT32F:null}hookInternalFormat(e,t,i){return i instanceof WebGLRenderingContext?e:e===i.DEPTH_COMPONENT?i.DEPTH_COMPONENT24:t===i.FLOAT&&e===i.RGBA?i.RGBA32F:t===i.FLOAT&&e===i.RED?i.R32F:t!==i.FLOAT&&e===i.RED?i.R8:e}}function ot(e){if(void 0===e)return;const t=window.WebGLRenderingContext,i={[t.CLAMP_TO_EDGE]:nt.ClampToEdgeWrapping,[t.REPEAT]:nt.Repeat,[t.MIRRORED_REPEAT]:nt.MirroredRepeat,[t.NEAREST]:nt.NearestFilter,[t.NEAREST_MIPMAP_NEAREST]:nt.NearestMipMapNearestFilter,[t.NEAREST_MIPMAP_LINEAR]:nt.NearestMipMapLinearFilter,[t.LINEAR]:nt.LinearFilter,[t.LINEAR_MIPMAP_NEAREST]:nt.LinearMipMapNearestFilter,[t.LINEAR_MIPMAP_LINEAR]:nt.LinearMipMapLinearFilter,[t.RGBA]:nt.RgbaFormat,[t.ALPHA]:nt.AlphaFormat,[t.RGB]:nt.RgbFormat,[t.UNSIGNED_BYTE]:nt.UnsignedByte,[t.FLOAT]:nt.Float}[e];return void 0===i?(console.error(`Failed to translate texture parameter ${e}`),NaN):i}nt.ClampToEdgeWrapping=1,nt.Repeat=2,nt.MirroredRepeat=3,nt.NearestFilter=4,nt.NearestMipMapNearestFilter=5,nt.NearestMipMapLinearFilter=6,nt.LinearFilter=7,nt.LinearMipMapNearestFilter=8,nt.LinearMipMapLinearFilter=9,nt.DepthComponentFormat=10,nt.DepthComponentFormat32=11,nt.RgbaFormat=14,nt.AlphaFormat=15,nt.RgbFormat=16,nt.UnsignedByte=17,nt.Float=18,nt.UnsignedShort=19,nt.UnsignedInt=20,nt.RedFormat=21,nt.CompareNone=22,nt.CompareRefToTexture=23,nt.defaultOptions={magFilter:nt.LinearFilter,minFilter:nt.LinearMipMapLinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,format:nt.RgbaFormat,generateMipmaps:!0,flipY:!0,premultiplyAlpha:!0,type:nt.UnsignedByte};var rt=i(1375);class st{constructor(e={}){this._texture=null,this._glContext=null,this._frameBuffer=null,this._depthAttachment=null,this.options=Object.assign({},st.defaultOptions,e),this.options.hasColorOutput&&(this._texture=new nt(null,this.options))}bind(e,t){return this._frameBuffer||this._prepare(e),t?e.bindFramebuffer(t,this._frameBuffer):e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),this}unbind(e){return e.bindFramebuffer(e.FRAMEBUFFER,null),this}remove(){return this._unprepare(),this}setSize(e){return this.options.size=e,this._unprepare(),this}getTexture(){return this._texture}getDepthAttachment(){return this._depthAttachment}memSizeGPU(){const{_texture:e,_depthAttachment:t}=this;let i=0;if(this.options.depthTexture||this.options.useHighDepthPrecision)i=4;else switch(this.options.depthInternalFormat){case WebGLRenderingContext.DEPTH_STENCIL:i=1;break;case WebGLRenderingContext.DEPTH_COMPONENT16:i=2;break;default:this._glContext instanceof WebGLRenderingContext||!WebGL2RenderingContext.DEPTH_COMPONENT24||(i=3)}return{_texture:e?(0,Ke.dr)(e):{_texture:0},_depthAttachment:null===t?0:this.options.size[0]*this.options.size[1]*i}}_prepare(e){var t,i;if(this._glContext=e,!this._texture&&this.options.hasColorOutput&&(this._texture=new nt(null,this.options)),this._frameBuffer=e.createFramebuffer(),e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),this._texture&&(this._texture.prepare(e),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._texture.getTexture(),0)),this.options.depthTexture){const n=this._depthAttachment=new nt(null,{magFilter:null!==(t=this.options.magFilter)&&void 0!==t?t:nt.NearestFilter,minFilter:null!==(i=this.options.minFilter)&&void 0!==i?i:nt.NearestFilter,format:nt.DepthComponentFormat,size:this.options.size,premultiplyAlpha:!1,generateMipmaps:!1,type:nt.UnsignedInt,compareFunc:this.options.compareFunc});n.prepare(e),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,n.getTexture(),0)}else{const t=this.options.useHighDepthPrecision?e.DEPTH_STENCIL:this.options.depthInternalFormat,i=this.options.useHighDepthPrecision?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;this._depthAttachment=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this._depthAttachment),e.renderbufferStorage(e.RENDERBUFFER,t,this.options.size[0],this.options.size[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,this._depthAttachment)}this._checkComplete(e),e.bindRenderbuffer(e.RENDERBUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null)}_unprepare(){this._texture&&(this._texture.remove(),this._texture=null),this._glContext&&this._depthAttachment&&(this._depthAttachment instanceof nt?this._depthAttachment.remove():this._glContext.deleteRenderbuffer(this._depthAttachment),this._depthAttachment=null),this._glContext&&this._frameBuffer&&(this._glContext.deleteFramebuffer(this._frameBuffer),this._frameBuffer=null)}_checkComplete(e){if((0,rt.I0)()){const t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t===e.FRAMEBUFFER_COMPLETE)return;t===e.FRAMEBUFFER_UNSUPPORTED?console.log("Framebuffer is unsupported"):t===e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT?console.log("Framebuffer incomplete attachment"):t===e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS?console.log("Framebuffer incomplete dimensions"):t===e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT?console.log("Framebuffer incomplete missing attachment"):console.log(`Unexpected framebuffer status: ${t}`)}}}function at(e){const t=document.createElement("canvas"),i={antialias:!1,stencil:!0,failIfMajorPerformanceCaveat:e};return"WebGLRenderingContext"in window?t.getContext("webgl",i)||t.getContext("experimental-webgl",i):null}st.defaultOptions=Object.assign({},nt.defaultOptions,{size:[0,0],generateMipmaps:!1,depthTexture:!1,hasColorOutput:!0,useHighDepthPrecision:!1,depthInternalFormat:WebGLRenderingContext.DEPTH_COMPONENT16});const lt={};function dt(e){const t=String(e);return void 0===lt[t]&&(lt[t]=function(e){const t=at(e);if(!t)return{ok:!1,msg:"error on get context"};for(const e of["OES_element_index_uint","OES_standard_derivatives","OES_vertex_array_object"])if(!t.getExtension(e))return{ok:!1,msg:`${e} extension is not supported`};try{const e=new Uint8Array(4);t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,e)}catch(e){return{ok:!1,msg:"readPixels is not supported"}}let i;try{i=t.createShader(t.VERTEX_SHADER)}catch(e){return{ok:!1,msg:"browser block shader API"}}if(!i||t.isContextLost())return{ok:!1};return t.shaderSource(i,"void main() {}"),t.compileShader(i),{ok:!0===t.getShaderParameter(i,t.COMPILE_STATUS)}}(e)),lt[t]}let ct;function ut(){ct=void 0;const e=new Float32Array([-1,-1,1,-1,-1,1]),t=at(!1);if(!t)return ct="Failed to obtain WebGL context",!1;for(const e of["OES_element_index_uint","OES_standard_derivatives","OES_vertex_array_object","OES_texture_float","OES_texture_float_linear"])if(!t.getExtension(e))return ct=`Absent ${e} extension`,!1;const i=new st({size:[2,2]});i.bind(t);const n=new nt(new Float32Array([1,0,1,0]),{size:[2,2],format:nt.AlphaFormat,type:nt.Float,magFilter:nt.LinearFilter,minFilter:nt.LinearFilter}).prepare(t),o=t.createShader(t.VERTEX_SHADER),r=t.createShader(t.FRAGMENT_SHADER);if(!o||!r||t.isContextLost())return ct="Cannot create shaders",!1;t.shaderSource(o,"attribute vec2 pos;\n    void main () {\n        gl_Position = vec4(pos, 0, 1);\n    }"),t.compileShader(o),t.shaderSource(r,"precision mediump float;\n    uniform sampler2D tex;\n    void main () {\n        gl_FragColor = vec4(texture2D(tex, vec2(0.4, 0.4)).a, 0, 0, 0);\n    }"),t.compileShader(r);const s=t.createProgram();if(!s)return ct="Cannot compile shader program",!1;t.attachShader(s,o),t.attachShader(s,r),t.linkProgram(s),t.useProgram(s);const a=t.createBuffer();if(!a)return ct="Cannot create buffer",!1;t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW);const l=t.getAttribLocation(s,"pos");t.vertexAttribPointer(l,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(l),n.enable(t,0);const d=t.getUniformLocation(s,"tex");t.uniform1i(d,0),t.viewport(0,0,2,2),t.drawArrays(t.TRIANGLES,0,3);const c=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,c),i.unbind(t),255!==c[0]}let ht=null;function mt(){if(null!==ht)return ht;const e=at(!1);if(!e)return ht=!0,ht;const t=e.createShader(e.VERTEX_SHADER),i=e.createShader(e.FRAGMENT_SHADER);if(!t||!i||e.isContextLost())return ht=!0,ht;e.shaderSource(t,"\n    attribute vec2 pos;\n    varying float v1, v2, v3, v4, v5, v6, v7, v8, v9, v10;\n    void main () {\n        v1 = pos.x;\n        v2 = pos.y;\n        v3 = pos.x * 2.0;\n        v4 = pos.y * 2.0;\n        v5 = pos.x + pos.y;\n        v6 = pos.x - pos.y;\n        v7 = pos.x * pos.x;\n        v8 = pos.y * pos.y;\n        v9 = pos.x * pos.y;\n        v10 = (pos.x + pos.y) / 2.0;\n\n        gl_Position = vec4(pos, 0, 1);\n    }"),e.compileShader(t),e.shaderSource(i,"\n    precision mediump float;\n    varying float v1, v2, v3, v4, v5, v6, v7, v8, v9, v10;\n    void main () {\n        float result = v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10;\n        gl_FragColor = vec4(result / 10.0, 0, 0, 1); // усредняем результат\n    }"),e.compileShader(i);const n=e.createProgram();return n?(e.attachShader(n,t),e.attachShader(n,i),e.linkProgram(n),n&&e.getProgramParameter(n,e.LINK_STATUS)?(ht=!1,ht):(ht=!0,ht)):(ht=!0,ht)}function ft(e){return!(e instanceof WebGLRenderingContext)||!!e.getExtension("WEBGL_depth_texture")}function _t(e){return!pt(e)}function pt(e){if("undefined"==typeof window||"undefined"==typeof document)return"not a browser";if("function"!=typeof(null===(t=Function.prototype)||void 0===t?void 0:t.bind))return"insufficient Function support";var t;if(!("JSON"in window&&"parse"in JSON&&"stringify"in JSON))return"insufficient JSON support";if(!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;const e=new Blob([""],{type:"text/javascript"}),t=URL.createObjectURL(e);let i,n=null;try{n=new Worker(t),i=!0}catch(e){i=!1}n&&n.terminate();return URL.revokeObjectURL(t),i}())return"insufficient worker support";if(!ArrayBuffer.isView)return"insufficient ArrayBuffer support";if(!function(){const e=document.createElement("canvas");e.width=e.height=1;const t=e.getContext("2d");if(!t)return!1;const i=t.getImageData(0,0,1,1);return i&&i.width===e.width}())return"insufficient Canvas/getImageData support";const i=dt(e&&e.failIfMajorPerformanceCaveat||!1);return i.ok?Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.isArray?Boolean(Object.keys&&Object.assign&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.freeze)?function(){const e=document.createElement("div");return e&&"function"==typeof e.after}()?"documentMode"in document?"insufficient ECMAScript 6 support":void 0:"insufficient DOM support":"insufficient Object support":"insufficient Array support":"insufficient WebGL support"+(i.msg?`: ${i.msg}`:"")}function vt(){return ct}const gt=function(){const e=at(!1);if(!e)return!1;if(!De)return!0;const t=e.getExtension("WEBGL_debug_renderer_info");if(!t)return!1;const i=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):null;return!(!i||"string"!=typeof i)&&!i.toUpperCase().includes("INTEL")};var yt=i(8369),bt=i(5790);class xt{static depthFuncToWebGL(e,t){switch(t){case bt.X6.NEVER:return e.NEVER;case bt.X6.LESS:return e.LESS;case bt.X6.EQUAL:return e.EQUAL;case bt.X6.LEQUAL:return e.LEQUAL;case bt.X6.GREATER:return e.GREATER;case bt.X6.NOTEQUAL:return e.NOTEQUAL;case bt.X6.GEQUAL:return e.GEQUAL;case bt.X6.ALWAYS:return e.ALWAYS;default:throw new Error(`Неизвестная функция теста глубины: ${t}`)}}static cullFaceModeToWebGL(e,t){switch(t){case bt.V9.FRONT:return e.FRONT;case bt.V9.BACK:return e.BACK;case bt.V9.FRONT_AND_BACK:return e.FRONT_AND_BACK;default:throw new Error(`Неизвестный режим отбрасывания: ${t}`)}}static blendFuncToWebGL(e,t){switch(t){case bt.LA.ZERO:return e.ZERO;case bt.LA.ONE:return e.ONE;case bt.LA.SRC_COLOR:return e.SRC_COLOR;case bt.LA.ONE_MINUS_SRC_COLOR:return e.ONE_MINUS_SRC_COLOR;case bt.LA.SRC_ALPHA:return e.SRC_ALPHA;case bt.LA.ONE_MINUS_SRC_ALPHA:return e.ONE_MINUS_SRC_ALPHA;case bt.LA.DST_ALPHA:return e.DST_ALPHA;case bt.LA.ONE_MINUS_DST_ALPHA:return e.ONE_MINUS_DST_ALPHA;case bt.LA.DST_COLOR:return e.DST_COLOR;case bt.LA.ONE_MINUS_DST_COLOR:return e.ONE_MINUS_DST_COLOR;case bt.LA.SRC_ALPHA_SATURATE:return e.SRC_ALPHA_SATURATE;default:throw new Error(`Неизвестная функция смешивания: ${t}`)}}static blendEquationToWebGL(e,t){switch(t){case bt.m9.FUNC_ADD:return e.FUNC_ADD;case bt.m9.FUNC_SUBTRACT:return e.FUNC_SUBTRACT;case bt.m9.FUNC_REVERSE_SUBTRACT:return e.FUNC_REVERSE_SUBTRACT;case bt.m9.MIN:return bt.m9.MIN;case bt.m9.MAX:return bt.m9.MAX;default:throw new Error(`Неизвестное уравнение смешивания: ${t}`)}}static webGLToDepthFunc(e,t){switch(t){case e.NEVER:return bt.X6.NEVER;case e.LESS:return bt.X6.LESS;case e.EQUAL:return bt.X6.EQUAL;case e.LEQUAL:return bt.X6.LEQUAL;case e.GREATER:return bt.X6.GREATER;case e.NOTEQUAL:return bt.X6.NOTEQUAL;case e.GEQUAL:return bt.X6.GEQUAL;case e.ALWAYS:return bt.X6.ALWAYS;default:throw new Error(`Неизвестная WebGL константа функции глубины: ${t}`)}}static webGLToCullFaceMode(e,t){switch(t){case e.FRONT:return bt.V9.FRONT;case e.BACK:return bt.V9.BACK;case e.FRONT_AND_BACK:return bt.V9.FRONT_AND_BACK;default:throw new Error(`Неизвестная WebGL константа режима отбрасывания: ${t}`)}}}var wt=i(5220),St=i(9141);class Mt{constructor(e){this.location=null,this.name=e.name,this.type=e.type}getLocation(e,t){return this.location=e.getUniformLocation(t,this.name),this}bind(e,t){switch(this.type){case"1i":e.uniform1i(this.location,t);break;case"1f":e.uniform1f(this.location,t);break;case"2i":e.uniform2i(this.location,t[0],t[1]);break;case"2f":e.uniform2f(this.location,t[0],t[1]);break;case"3i":e.uniform3i(this.location,t[0],t[1],t[2]);break;case"3f":e.uniform3f(this.location,t[0],t[1],t[2]);break;case"4i":e.uniform4i(this.location,t[0],t[1],t[2],t[3]);break;case"4f":e.uniform4f(this.location,t[0],t[1],t[2],t[3]);break;case"1iv":e.uniform1iv(this.location,t);break;case"1fv":e.uniform1fv(this.location,t);break;case"2iv":e.uniform2iv(this.location,t);break;case"2fv":e.uniform2fv(this.location,t);break;case"3iv":e.uniform3iv(this.location,t);break;case"3fv":e.uniform3fv(this.location,t);break;case"4iv":e.uniform4iv(this.location,t);break;case"4fv":e.uniform4fv(this.location,t);break;case"mat2":e.uniformMatrix2fv(this.location,!1,t);break;case"mat3":e.uniformMatrix3fv(this.location,!1,t);break;case"mat4":e.uniformMatrix4fv(this.location,!1,t);break;default:throw new Error(`[WebGl] Unsupported uniform type: '${this.type}'`)}return this}isNonFloatType(){return this.type.includes("i")}}class It{constructor(e,t,i,n){this._gl=e,this.uniformBlocksNames=n,this.uniforms={},this.attributes={},this._webglProgram=null,this._linked=!1,this._located=!1,this._error=!1,this._uniformBlocksIndices={},this._uboBindings={},(t=t||{}).uniforms=t.uniforms||[],t.uniforms.forEach((e=>{this.uniforms[e.name]=new Mt(e)})),t.attributes=t.attributes||[],t.attributes.forEach((e=>{this.attributes[e.name]=new St.L(e)})),i=null!=i?i:wt.f,this._vertexShader=t.buildVertex(i),this._fragmentShader=t.buildFragment(i)}enable(){const e=this._gl;return this._error?this:(this.link(),this.locate(),this._error||e.useProgram(this._webglProgram),this)}bind(e,t){if(this._error)return this;if(e)for(const t in e)this.uniforms[t].bind(this._gl,e[t]);if(t)for(const e in t)this.attributes[e].bind(this._gl,t[e]);return this}disable(){if(this._error)return this;for(const e in this.attributes)this.attributes[e].disable(this._gl);return this}link(){if(this._linked||this._error)return this;const e=this._gl;try{if(this._webglProgram=e.createProgram(),!this._webglProgram)throw new Error("Failed to create shader program");const t=this._vertexShader.get(e),i=this._fragmentShader.get(e);t&&e.attachShader(this._webglProgram,t),i&&e.attachShader(this._webglProgram,i);for(const t in this.attributes)this.attributes[t].bindLocation(e,this._webglProgram);if(e.linkProgram(this._webglProgram),(0,rt.I0)()&&!e.getProgramParameter(this._webglProgram,e.LINK_STATUS))throw new Error(e.getProgramInfoLog(this._webglProgram)||"Couldn't get shader program Info Log");this._linked=!0}catch(e){throw this._error=!0,e}return this}locate(){if(this._located||this._error||!this._webglProgram)return this;const e=this._gl;for(const t in this.attributes)this.attributes[t].getLocation(e,this._webglProgram);for(const t in this.uniforms){this.uniforms[t].getLocation(e,this._webglProgram)}return this.locateUniformBlocks(this._webglProgram),this._located=!0,this}getUniformBlockIndex(e){return this._uniformBlocksIndices[e]}getUboBinding(e){return this._uboBindings[e]}getUniformBlockSize(e){if(this._gl instanceof WebGLRenderingContext)return null;const t=this._gl;let i=this._webglProgram;if(i||(this.link(),this.locate()),i=this._webglProgram,!i)return null;const n=this.getUniformBlockIndex(e);return void 0===n?null:t.getActiveUniformBlockParameter(i,n,t.UNIFORM_BLOCK_DATA_SIZE)}getUniformsIndicesOffsetsInBlock(e){if(this._gl instanceof WebGLRenderingContext)return null;const t=this._gl;let i=this._webglProgram;if(i||(this.link(),this.locate()),i=this._webglProgram,!i)return null;const n=t.getUniformIndices(i,e);if(!n)return console.error("Couldn't get UBO uniforms indices."),null;const o=n.filter((e=>e!==t.INVALID_INDEX)),r=t.getActiveUniforms(i,o,t.UNIFORM_OFFSET);if(null===r)return console.error("Couldn't get active UBO uniform offsets."),null;const s={};for(let i=0;i<e.length;++i){const a=n[i];if(a!==t.INVALID_INDEX){const t=o.indexOf(a);s[e[i]]=r[t]}}return s}locateUniformBlocks(e){const t=this._gl;if(t instanceof WebGLRenderingContext)return;if(!this.uniformBlocksNames)return;let i=0;for(const n of this.uniformBlocksNames){const o=t.getUniformBlockIndex(e,n);o!==t.INVALID_INDEX&&(this._uniformBlocksIndices[n]=o,this._uboBindings[n]=i,t.uniformBlockBinding(e,o,i++))}}}var Tt=i(7566);const Et=[1,1,1,1],Pt=ae.Ue(),At=ae.Ue(),Lt=it.Ue(),Ct=it.Ue(),zt=ae.Ue(),kt=ae.al(0,1,0),Ot=(e,t,i,n)=>{Zt(i,e,{u_float_rounding_factor:t.stillness},n)},Rt=(e,t,i,n)=>{Zt(i,e,{u_float_border_width_offset:1/window.devicePixelRatio},n)},Ft=(e,t,i,n)=>{const o=(G.Jv-.5)/2,{size:r}=t;Zt(i,e,{u_vec2_depth_test_half_point_size:[o/r[0],o/r[1]]},n)},Bt=(e,t,i,n)=>{if(!i.environmentManager.isFogEnabled())return;const o=i.styleManager.getStyle(t.handyStyleId);let r=Et,s=Et;if(o){const e=(0,te.jJ)(t.styleZoom,t.styleState,[]);r=(0,te.m2)((0,te.zn)(o.environment.style.skyColor,e)),s=(0,te.m2)((0,te.zn)(o.environment.style.fogColor,e))}const a=i.camera;Zt(i,e,{u_sky_color:t.globeMode?[0,0,0,0]:r,u_fog_color:t.globeMode?[0,0,0,0]:s,u_fog_distance:t.globeMode?0:a.fogDistance,u_fog_limits:i.environmentManager.fogLimits,u_fog_horizon_blend:i.environmentManager.fogHorizonBlend,u_fog_horizon_level:i.environmentManager.fogHorizonLevel},n)},Dt=(e,t,i,n)=>{Zt(i,e,{u_cam_pos:i.camera.position},n)},jt=(e,t,i,n)=>{i.shadowManager.texture&&Zt(i,e,{u_shadow_map_params:i.shadowManager.shadowMapParams,u_shadow_bias:i.shadowManager.bias,u_mat4_clip_to_shadow:i.shadowManager.clipToShadowMatrix},n)},Nt=(e,t,i,n)=>{Zt(i,e,{u_vec2_scale_limits:[0,G.ax]},n)},Ut=(e,t,i,n)=>{Zt(i,e,{u_mat4_view_transposed:i.camera.viewMatrixTranspose,u_mat4_proj_inverted:i.camera.projectionMatrixInverse},n)},Ht=(e,t,i,n)=>{const o=window.devicePixelRatio,r=i.camera.ecef.pixelRadius*o,{left:s,bottom:a,top:l,right:d}=t.padding,[c,u]=t.size,h=[c*o,u*o],m=[(s-d)*o/2,(a-l)*o/2],f=i.environmentManager.globHaloStops.map((e=>(r+e*o)/h[1])),_=i.styleManager.getStyle(t.handyStyleId);if(!_)return;const p=null==_?void 0:_.environment;if(!p)return;const v=(0,te.jJ)(t.styleZoom,t.styleState,[]),g=(0,te.zn)(p.style.fogColor,v),y=(0,te.zn)(_.background.color,v);Zt(i,e,{u_vec2_halo_viewport_size:h,u_vec2_halo_viewport_center_shift:m,u_vec4_halo_radius_stops:f,u_vec4_halo_color:(0,te.m2)(g),u_float_halo_exp_factor:i.environmentManager.globeHaloExpFactor,u_vec4_default_background_color:(0,te.m2)(y)},n)},Gt=(e,t,i,n)=>{const o=t.size,r=Math.max(o[0],o[1]),s=o[0]/r,a=o[1]/r;it.M5(Lt,-s/2,s/2,-a/2,a/2,.001,1);const l=Tt.H.toGeo(t.center),d=ae.t8(At,0,0,0),c=ae.t8(Pt,0,0,1);ae.lM(c,c,d,(0,we.Id)(l[1])),ae.uD(c,c,d,(0,we.Id)(l[0]));const u=it.zB(Ct,zt,c,kt);it.Jp(u,Lt,u);const h=i.styleManager.getStyle(t.handyStyleId);if(!h)return;const m=null==h?void 0:h.environment;if(!m)return;const f=(0,te.jJ)(t.styleZoom,t.styleState,[]),_=(0,te.vn)(m.style.starsIntensity,f);Zt(i,e,{u_float_pixelratio:window.devicePixelRatio,u_float_stars_intensity:_,u_mat4_stars:u},n)},Vt=(e,t,i,n)=>{const{size:o}=t,r=window.devicePixelRatio;Zt(i,e,{u_vec2_vpt_size:[o[0]*r,o[1]*r]},n)};function Zt(e,t,i,n){n?n.updateData(t,i):e.renderer.bindShaderProgram(t,i)}function Wt(...e){return(t,i,n,o)=>{e.forEach((e=>e(t,i,n,o)))}}const Xt=Wt(Ot,Rt,Ft,Bt,Dt,jt,Nt,Ut,Ht,Gt,Vt),Kt=Wt(Dt,Bt),$t=(e,t,i)=>{const{size:n}=t,o=window.devicePixelRatio;if(t.demMode){const t=i.renderer.getFramebuffer(i.demManager.getFlatFramebufferId());if(!t)return;i.renderer.bindShaderProgram(e,{u_vec2_vpt_size:[Math.trunc(t.renderTarget.options.size[0]),Math.trunc(t.renderTarget.options.size[1])]})}else i.renderer.bindShaderProgram(e,{u_vec2_vpt_size:[n[0]*o,n[1]*o]})},qt=(e,t,i)=>{const n=(0,L.EO)(t.zoom);i.renderer.bindShaderProgram(e,{u_vec3_projection_scale_style_scale_dpi:[n,n,G.$U*window.devicePixelRatio]})},Yt=(e,t,i)=>{const n=(0,L.EO)(t.styleZoom);i.renderer.bindShaderProgram(e,{u_vec3_projection_scale_style_scale_dpi:[n,n,G.$U*window.devicePixelRatio]})},Jt=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_float_height_factor:i.buildingHeightAnimator.getDefaultBuildingHeight()})},Qt=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_float_z_offset:0})},ei=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_float_z_offset:-1e-5})},ti=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_sr2d_texture:0})},ii=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_sr2d_texture1:1})},ni=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_vec4_border_color:[0,0,0,0]})},oi=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_vec4_space_color:[0,0,0,0]})},ri=(e,t,i)=>{const{renderer:n}=i,{labelingTextureBuffer:o,spriteLabelingTextureBuffer:r}=n;let s=t.isLabelingDepthTestDisabled;if(!s){const e=o.getDepthAttachment(),t=o.getTexture();e instanceof nt&&t?(i.renderer.enableTexture(t,Qc),i.renderer.enableTexture(e,eu)):s=!0}const a=r.getTexture();a&&(i.renderer.enableTexture(a,tu),i.renderer.bindShaderProgram(e,{u_color_text_sprite_labeling:tu})),i.renderer.bindShaderProgram(e,{u_bool_depth_test_disable:s}),s||i.renderer.bindShaderProgram(e,{u_color_tex_labeling:Qc,u_depth_tex_labeling:eu})};function si(...e){return(t,i,n)=>{e.forEach((e=>e(t,i,n)))}}var ai=i(314),li=i(9145);function di(...e){return(t,i,n,o,r)=>{e.forEach((e=>e(t,i,n,o,r)))}}const ci=(e,t,i,n,o)=>{let r=ai.OD.none,s=li.r[r],a=0;const l=mi(n,i,t);l&&(s=l.lightConfig,r=l.lightingMode,a=(r===ai.OD.none||o?0:1)+(!1!==n.receiveShadows&&0===s.shadowLightIndex?2:0)+(!1!==n.receiveShadows&&1===s.shadowLightIndex?4:0));const d=i.renderer.getUbo(r);if(d&&i.renderer.isUboSupported())return d.bind(e),void i.renderer.bindShaderProgram(e,{u_int_light_flags:a});i.renderer.bindShaderProgram(e,{u_int_light_flags:a,u_vec3_light_dir1_direction:s.dir1Direction,u_vec4_light_dir1_color:s.dir1ColorIntensity,u_vec3_light_dir2_direction:s.dir2Direction,u_vec4_light_dir2_color:s.dir2ColorIntensity,u_vec4_ambient_color:s.ambientColorIntensity})},ui=(e,t,i,n)=>{const o=(0,te.jJ)(t.styleZoom,t.styleState,[],!1),r=(0,te.vn)(n.style.nearCameraFade,o);i.renderer.bindShaderProgram(e,{u_sdtr_distance:r})},hi=(e,t,i,n)=>{const o=(0,te.jJ)(t.styleZoom,t.styleState,[],!1),r=n.style.showRatio,s=(0,te.FR)(r,o);i.renderer.bindShaderProgram(e,{u_float_show_ratio:s})};function mi(e,t,i){var n;const o=t.styleManager.getStyle(i.handyStyleId);if(!o||!o.light.lightingModesResolved)return null;let r=null!==(n=e.lightingMode)&&void 0!==n?n:o.light.defaultLightMode;"gltfModel"===e.type&&e.style.ignoreGlobalLighting&&(r=ai.OD.none);let s=o.light.lightingModesResolved[r];return s||(s=o.light.lightingModesResolved[o.light.defaultLightMode]),{lightingMode:r,lightConfig:s}}var fi=i(8451);class _i{constructor(e,t,i=null){this.isDirty=!1,this._vao=null,this._vaoExt=null,this._gl=null,this.attributesAliases={},this._attributes=t,this._shaderProgram=e,this.indicesBuffer=i}static merge(e){const t=e[0],i={},n={};for(const t of e)Object.assign(i,t._attributes),Object.assign(n,t.attributesAliases);const o=new _i(t._shaderProgram,i,t.indicesBuffer);return o.setAttributesAliases(n),o}copy(){const e=new _i(this._shaderProgram,Object.assign({},this._attributes),this.indicesBuffer);return e.setAttributesAliases(this.attributesAliases),e}bind(e){const t=e.extensions.OES_vertex_array_object,i=e.extensions.ANGLE_instanced_arrays;return this._bind(e.gl,t,i),this}unbind(){return this._glBindVertexArray(null),this}setAttribute(e,t){this._attributes[e]=t,this.remove()}remove(){return this._vao&&(this._glDeleteVertexArray(this._vao),this._vao=null),this}getElementsGLType(){return this.indicesBuffer?this.indicesBuffer.getGLType():null}getBuffer(e){return this._attributes[e]}rewriteData(e,t){this._attributes[e].replaceData(t),this.isDirty=!0}setAttributesAliases(e){Object.assign(this.attributesAliases,e),this.remove()}setAttributes(e,t){const i=this._shaderProgram.attributes,n=this._attributes;for(const o in i){const r=n[this.attributesAliases[o]||o];if(!r)continue;const s=i[o];if(!0!==s.index)for(let t=0;t<s.locationsCount;t++)e.enableVertexAttribArray(s.location+t);r.bind(s.location,void 0,t,s.locationsCount)}this.indicesBuffer&&this.indicesBuffer.bind()}_bind(e,t,i){this._vao?(this.isDirty&&this.updateDirtyBuffers(),this._glBindVertexArray(this._vao)):this._prepare(e,t,i)}_prepare(e,t,i){this._gl=e,t&&(this._vaoExt=t),this._vao=this._glCreateVertexArray(),this._glBindVertexArray(this._vao),this.setAttributes(e,i)}_glCreateVertexArray(){const e=this._gl,t=this._vaoExt;return e&&this._isWebGL2(e)?e.createVertexArray():t?t.createVertexArrayOES():null}_glBindVertexArray(e){const t=this._gl,i=this._vaoExt;t&&this._isWebGL2(t)?t.bindVertexArray(e):i?i.bindVertexArrayOES(e):t&&this._shaderProgram.bind(void 0,this._attributes)}_glDeleteVertexArray(e){const t=this._gl,i=this._vaoExt;t&&this._isWebGL2(t)?t.deleteVertexArray(e):i&&i.deleteVertexArrayOES(e)}_isWebGL2(e){return"undefined"!=typeof window&&"WebGL2RenderingContext"in window&&e instanceof WebGL2RenderingContext}updateDirtyBuffers(){const e=this._shaderProgram.attributes,t=this._attributes,i=this.attributesAliases;for(const n in e){const e=t[i[n]||n];(null==e?void 0:e.isDirty)&&e.commitData()}this.isDirty=!1}}var pi=i(6263),vi=i(749),gi=i(4922),yi=i(1678),bi=i(8965),xi=i(3642),wi=i(2097),Si=i(5970),Mi=i(6195),Ii=i(8009),Ti=i(3097),Ei=i(7965),Pi=i(7407);const Ai=(e,t)=>{const i=wi.a.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0});return new _i(t,{a_vec2_vertex:n})},Li=(e,t)=>{const i=wi.a.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_mix_factor:o})},Ci=(e,t)=>{const i=wi.a.sinks.shadow.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0});return new _i(t,{a_vec2_vertex:n})},zi=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:8,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:8,offset:4,normalized:!1});return new _i(t,{a_vec2_vertex:i,a_vec2_texcoord:n})},ki=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:8,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:8,offset:4,normalized:!0});return new _i(t,{a_vec2_vertex:i,a_vec4_identifier:n})},Oi=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:12,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:12,offset:4,normalized:!1});return new _i(t,{a_vec2_vertex:i,a_vec4_normals:n})},Ri=(e,t)=>{const i=Ii.z.sinks.solid3d.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:12,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_vec4_normals:o,a_float_height:r,a_float_abs_z:s})},Fi=(e,t)=>{const i=Ii.z.sinks.solid3d.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:16,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec4_normals:o,a_float_height:r,a_float_abs_z:s,a_vec4_identifier:a})},Bi=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:16,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:16,offset:4,normalized:!1}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Float,stride:16,offset:8,normalized:!1});return new _i(t,{a_vec2_vertex:i,a_vec4_normals:n,a_vec2_shift:o})},Di=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:12,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:12,offset:4,normalized:!1}),o=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:12,offset:8,normalized:!0});return new _i(t,{a_vec2_vertex:i,a_vec4_normals:n,a_vec4_identifier:o})},ji=(e,t)=>{const i=Ii.z.sinks.patterned.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:8}),s=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:12,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec2_widen:o,a_float_texture:r,a_vec4_identifier:s})},Ni=(e,t)=>{const i=Ii.z.sinks.patterned3d.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:8}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:16,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec2_widen:o,a_float_texture:r,a_float_height:s,a_vec4_identifier:a})},Ui=(e,t)=>{const i=28,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1}),l=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:20,normalized:!1}),d=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:24,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec2_texture_widen:r,a_vec2_widen:o,a_float_vertex_distance:s,a_float_component_distance:a,a_float_object_length:l,a_vec4_identifier:d})},Hi=(e,t)=>{const i=Ti.L.sinks.stroke3d.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1}),l=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:20,normalized:!1}),d=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:24,normalized:!1}),c=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:28,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec2_texture_widen:r,a_vec2_widen:o,a_float_vertex_distance:s,a_float_component_distance:a,a_float_object_length:l,a_float_height:d,a_vec4_identifier:c})},Gi=(e,t)=>{const i=36,n=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:i,offset:6,normalized:!0}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:20,normalized:!1}),l=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:28,normalized:!0}),d=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:32,normalized:!0});return new _i(t,{a_vec3_flat_position:n,a_vec3_ecef_position:o,a_vec2_check_offset:s,a_vec2_offset:r,a_vec2_texcoord:a,a_vec4_tex_identifier:l,a_vec4_sprite_identifier:d})},Vi=(e,t)=>{const i=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:36,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:36,offset:6,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:36,offset:12,normalized:!1}),r=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:36,offset:24,normalized:!0});return new _i(t,{a_vec3_flat_position:i,a_vec3_ecef_position:n,a_vec2_offset:o,a_vec4_identifier:r})},Zi=(e,t)=>{const i=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:28,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:28,offset:8,normalized:!1}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Float,stride:28,offset:12,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Float,stride:28,offset:20,normalized:!1});return new _i(t,{a_vec4_position:i,a_vec2_offset:o,a_vec2_texcoord:n,a_vec2_style_zoom_limits:r})},Wi=(e,t)=>{const i=bi.j.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:3,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Byte,stride:i,offset:11,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),l=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1}),d=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:12,normalized:!0}),c=new fi.K(e,{itemSize:1,dataType:yt.l.UnsignedByte,stride:i,offset:20,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec3_normal:r,a_float_gradient:s,a_vec2_dem_position:a,a_float_abs_z:l,a_vec4_identifier:d,a_float_is_pivot:c})},Xi=(e,t)=>{const i=bi.j.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:3,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Byte,stride:i,offset:11,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),l=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1}),d=new fi.K(e,{itemSize:1,dataType:yt.l.UnsignedByte,stride:i,offset:20,normalized:!1}),c=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:24,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec3_normal:r,a_float_gradient:s,a_vec2_dem_position:a,a_float_abs_z:l,a_vec4_identifier:c,a_float_is_pivot:d})},Ki=(e,t)=>{const i=bi.j.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1}),a=new fi.K(e,{itemSize:1,dataType:yt.l.UnsignedByte,stride:i,offset:20,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r,a_float_abs_z:s,a_float_is_pivot:a})},$i=(e,t)=>{const i=bi.j.sinks.inverse.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:8,normalized:!1}),a=new fi.K(e,{itemSize:1,dataType:yt.l.UnsignedByte,stride:i,offset:12,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r,a_float_abs_z:s,a_float_is_pivot:a})},qi=(e,t)=>{const i=bi.j.sinks.stroke.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:12,normalized:!1}),l=new fi.K(e,{itemSize:1,dataType:yt.l.UnsignedByte,stride:i,offset:16,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec4_direction_distance:r,a_vec2_dem_position:s,a_float_abs_z:a,a_float_is_pivot:l})},Yi=(e,t)=>{const i=Si.p.sinks.sideFill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r})},Ji=(e,t)=>{const i=Si.p.sinks.sideFill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:8,normalized:!0}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec4_identifier:r,a_vec2_dem_position:s})},Qi=(e,t)=>{const i=Si.p.sinks.sideFill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),s=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:16,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec4_identifier:s,a_vec2_dem_position:r})},en=(e,t)=>{const i=Si.p.sinks.sideFill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r})},tn=(e,t)=>{const i=Mi.Q.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:8,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r})},nn=(e,t)=>{const i=Mi.Q.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:8,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r})},on=(e,t)=>{const i=24,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:i,offset:10,normalized:!1}),a=new fi.K(e,{itemSize:3,dataType:yt.l.Byte,stride:i,offset:12,normalized:!1}),l=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),d=new fi.K(e,{itemSize:1,dataType:yt.l.Short,stride:i,offset:20,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_normal:r,a_vec2_normal_delta:s,a_vec3_direction:a,a_float_distance:d,a_vec2_dem_position:l})},rn=(e,t)=>{const i=40,n=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:i,offset:6,normalized:!0}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:20,normalized:!1}),l=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:24,normalized:!1}),d=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:32,normalized:!0});return new _i(t,{a_vec3_flat_position:n,a_vec3_ecef_position:o,a_vec2_offset:r,a_vec2_check_offset:s,a_vec2_texcoord:a,a_vec2_range:l,a_vec4_tex_identifier:d})},sn=(e,t)=>{const i=40,n=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:i,offset:6,normalized:!0}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:20,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:24,normalized:!1}),l=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:36,normalized:!0});return new _i(t,{a_vec3_flat_position:n,a_vec3_ecef_position:o,a_vec2_offset:r,a_vec2_texcoord:s,a_vec2_range:a,a_vec4_identifier:l})},an=(e,t)=>{const i=40,n=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:i,offset:6,normalized:!0}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:20,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:24,normalized:!1}),l=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:28,normalized:!0});return new _i(t,{a_vec3_flat_position:n,a_vec3_ecef_position:o,a_vec2_offset:r,a_vec2_texcoord:s,a_vec2_range:a,a_vec4_identifier:l})},ln=(e,t)=>{const i=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:16,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:16,offset:8,normalized:!1}),o=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:16,offset:12,normalized:!0});return new _i(t,{a_vec4_position:i,a_vec2_offset:n,a_vec4_identifier:o})},dn=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:12,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:12,offset:8,normalized:!1}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:12,offset:10,normalized:!1});return new _i(t,{a_vec2_position:i,a_vec2_direction:n,a_vec2_widen_direction:o})},cn=(e,t)=>{const i=yi.X.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_texcoord:r,a_vec2_dem_position:s})},un=(e,t)=>{const i=yi.X.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:12,normalized:!0}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec4_identifier:r,a_vec2_dem_position:s})},hn=(e,t)=>{const i=yi.X.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),s=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:20,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec4_identifier:s,a_vec2_dem_position:r})},mn=(e,t)=>{const i=yi.X.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_dem_position:r})},fn=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:8,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:8,offset:4,normalized:!1});return new _i(t,{a_vec2_vertex:i,a_vec4_direction_distance:n})},_n=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:16,offset:0,normalized:!0}),n=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:16,offset:4,normalized:!1}),o=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:16,offset:8,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:16,offset:12,normalized:!1});return new _i(t,{a_vec2_vertex:i,a_float_z:n,a_vec4_direction_distance:o,a_vec2_dem_position:r})},pn=(e,t)=>{const i=36,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:4,normalized:!0}),r=new fi.K(e,{itemSize:4,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),l=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:20,normalized:!1}),d=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:24,normalized:!1}),c=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:28,normalized:!1}),u=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:32,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec2_segment_end:o,a_vec4_texture_widen_arrow_widen:r,a_vec2_widen:s,a_vec2_direction:a,a_float_distance_from_start:l,a_float_object_length:d,a_float_type:c,a_vec4_identifier:u})},vn=(e,t)=>{const i=ee.p.sinks.fill.stride,n=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:i,offset:6,normalized:!0}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1});return new _i(t,{a_vec3_flat_position:n,a_vec3_ecef_position:o,a_vec2_widen:r})},gn=(e,t)=>{const i=ee.p.sinks.fill.stride,n=new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:i,offset:6,normalized:!0}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:12,normalized:!1}),s=new fi.K(e,{itemSize:4,dataType:yt.l.UnsignedByte,stride:i,offset:16,normalized:!0});return new _i(t,{a_vec3_flat_position:n,a_vec3_ecef_position:o,a_vec2_widen:r,a_vec4_identifier:s})},yn=(e,t)=>{const i=pi.h.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:4,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_vec2_texcoord:o})},bn=(e,t)=>{const i=vi.B.sinks.framebuffer.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:i,offset:8,normalized:!1});return new _i(t,{a_vec2_position:n,a_vec2_widen:r,a_float_weight:o})},xn=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.Float,stride:0,offset:0,normalized:!1});return new _i(t,{a_vec2_position:i})},wn=(e,t)=>{const i=new fi.K(e,{itemSize:3,dataType:yt.l.Float,stride:12,offset:0});return new _i(t,{a_vec3_position:i})},Sn=(e,t)=>new _i(t,{a_vec2_position:e}),Mn=(e,t)=>{const i=gi._.sinks.elevation.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:3,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_vec3_normal:o,a_float_height:r})},In=(e,t)=>{const i=gi._.sinks.flatBottom.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:i,offset:8,normalized:!0});return new _i(t,{a_vec2_vertex:n,a_vec2_centroid:o,a_vec2_extender:r})},Tn=(e,t)=>{const i=gi._.sinks.hillshade.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:4,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_vec2_texcoord:o})},En=e=>(t,i,n,o)=>{const r=Pi.m.sinks.instances.stride,s=new fi.K(t,{itemSize:2,dataType:yt.l.UnsignedShort,stride:r,offset:0,normalized:!0,instanceDivisor:1}),a=new fi.K(t,{itemSize:1,dataType:yt.l.Float,stride:r,offset:4,normalized:!1,instanceDivisor:1}),l=new fi.K(t,{itemSize:3,dataType:yt.l.Short,stride:r,offset:8,normalized:!0,instanceDivisor:1}),d=new fi.K(t,{itemSize:9,dataType:yt.l.Float,stride:r,offset:16,instanceDivisor:1}),c=new fi.K(t,{itemSize:4,dataType:yt.l.UnsignedByte,stride:r,offset:e?56:52,normalized:!0,instanceDivisor:1}),u=new fi.K(t,{itemSize:1,dataType:yt.l.Float,stride:r,offset:60,normalized:!1,instanceDivisor:1});return new _i(i,Object.assign({a_vec2_instance_position:s,a_float_instance_height:a,a_vec3_instance_ecef_position:l,a_mat3_instance_matrix:d,a_vec4_instance_localid:c,a_float_abs_z:u},o),n)},Pn=(e,t)=>{const i=xi._.sinks.fill.stride,n=new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:i,offset:0,normalized:!0}),o=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:4,normalized:!1}),r=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:8,normalized:!1}),s=new fi.K(e,{itemSize:3,dataType:yt.l.Byte,stride:i,offset:12,normalized:!1}),a=new fi.K(e,{itemSize:1,dataType:yt.l.Byte,stride:i,offset:15,normalized:!1}),l=new fi.K(e,{itemSize:2,dataType:yt.l.Short,stride:i,offset:16,normalized:!1}),d=new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:i,offset:16,normalized:!1}),c=new fi.K(e,{itemSize:1,dataType:yt.l.UnsignedByte,stride:i,offset:20,normalized:!1});return new _i(t,{a_vec2_vertex:n,a_float_z:o,a_vec2_extender:r,a_vec3_normal:s,a_float_gradient:a,a_vec2_dem_position:l,a_float_abs_z:d,a_float_is_pivot:c})},An=(e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.Byte,stride:0,offset:0,normalized:!1});return new _i(t,{a_vec2_vertex:i})},Ln=(e,t,i)=>{const n=Ei.D.sinks.fill.stride;return new _i(t,{a_vec3_ecef_position:new fi.K(e,{itemSize:3,dataType:yt.l.Short,stride:n,normalized:!0,offset:0}),a_vec3_flat_position:new fi.K(e,{itemSize:3,dataType:yt.l.UnsignedShort,stride:n,normalized:!0,offset:6}),a_vec2_texture:new fi.K(e,{itemSize:2,dataType:yt.l.UnsignedShort,stride:n,normalized:!0,offset:12})},i)};var Cn=i(878),zn=i(132);const kn=32,On=1/0;class Rn extends R.Y{constructor(e,t,i,n){var o,r;super("raster"),this.children=[],this.identifyChildren=[];const s=this;this.setTileCoords(e,t.map.state),null===(r=null===(o=t.renderer.symbolSettingsList.dem)||void 0===o?void 0:o[n])||void 0===r||r.forEach((e=>{const o={id:(0,z.fD)(),type:Cn.H.Tile,symbol:"dem",sink:n,tile:this,attributes:{layerId:zn.he,styleId:t.map.state.handyStyleId,tileData:[]},start:0,count:6144,attributesHash:"",layerSettings:e,vao:i[n],canRender:!0,renderingProperties:{flatTexture:null,hillshadeTexture:null,flatIdentifyTexture:null}};e.identify?s.identifyChildren.push(o):e.depthTest?s.depthTestChildren.push(o):e.shadow?s.shadowChildren.push(o):s.children.push(o)}))}setTileCoords(e,t){const i=e[2],n=e[3],o=(0,Y.aq)(i);this.coords=e,this.size=o,this.zoomLevel=i,this.detailLevel=n,this.mvpMatrices.clear(),this.demMatrices.clear(),this.flatMapTexMatrices.clear(),this.syncReplicas(t)}syncReplicas({visibleMapReplicas:e}){const t=Math.pow(2,this.coords[2]),i=this.size/kn;this.bounds.clear(),this.modelMatrices.clear(),e.forEach((e=>{const n=[this.coords[0]+e*t,this.coords[1],this.coords[2],this.coords[3]],o=(0,Y.Oy)(n);o[0]-=i,o[1]-=i,this.bounds.set(e,{min:[o[0],o[1]],max:[o[0]+this.size,o[1]+this.size]});const r=it.Ue();it.wA(r,o,ae.al(this.size+i,this.size+i,G._9)),this.modelMatrices.set(e,r)})),this.needSync=!1}}class Fn{constructor(e,t){var i;this.meshTiles=new Map,this.groundTiles=new Map,this.destroyed=!1,this.modules=e.modules,this.maxZoom=null!==(i=null==t?void 0:t.maxZoom)&&void 0!==i?i:On;const n=[];for(let e=0;e<kn;e++)for(let t=0;t<kn;t++)n.push(t,e,t+1,e,t,e+1),n.push(t,e+1,t+1,e,t+1,e+1);const o=G._H/kn;for(let e=0;e<n.length;e++)n[e]*=o;this.buffer=this.modules.renderer.createBuffer(new Uint16Array(n),{itemSize:2,dataType:yt.l.UnsignedShort,stride:0,offset:0,normalized:!0}),this.buffer.drawType=yt.l.StaticDraw,this.vaos={mesh:Sn(this.buffer,this.modules.renderer.getShaderProgram("demMesh")),ground:Sn(this.buffer,this.modules.renderer.getShaderProgram("demGround"))},this.update()}destroy(){this.destroyed||(this.meshTiles=new Map,this.groundTiles=new Map,Object.values(this.vaos).forEach((e=>{e.unbind(),e.remove()})),this.buffer.remove(),this.destroyed=!0)}setMaxZoom(e=Infinity){e!==this.maxZoom&&(this.maxZoom=e,this.update())}update(){if(this.destroyed)return;const e=this.modules.map.state;e.needReplicasUpdate&&(this.meshTiles.forEach((e=>{e.needSync=!0})),this.groundTiles.forEach((e=>{e.needSync=!0})));const t=Math.trunc(e.styleZoom),i=Math.min(t,Math.min(this.maxZoom,t)),n=(0,Y.b5)(this.modules.map.state,this.modules,i,0,i).reduce(((e,t)=>(e.set((0,Y.gx)(t),t),e)),new Map);this.meshTiles.forEach(((e,t)=>{n.has(t)||(this.meshTiles.delete(t),this.groundTiles.delete(t))})),n.forEach(((e,t)=>{this.meshTiles.has(t)||(this.meshTiles.set(t,new Rn(e,this.modules,this.vaos,"mesh")),this.groundTiles.set(t,new Rn(e,this.modules,this.vaos,"ground")))}))}updateStyleId(){this.meshTiles.forEach((e=>this.updateTileStyleId(e))),this.groundTiles.forEach((e=>this.updateTileStyleId(e)))}updateTileStyleId(e){e.children.forEach((e=>{e.attributes.styleId=this.modules.map.state.handyStyleId})),e.identifyChildren.forEach((e=>{e.attributes.styleId=this.modules.map.state.handyStyleId})),e.depthTestChildren.forEach((e=>{e.attributes.styleId=this.modules.map.state.handyStyleId})),e.shadowChildren.forEach((e=>{e.attributes.styleId=this.modules.map.state.handyStyleId}))}}var Bn=i(7123),Dn=i(2398),jn=i(267),Nn=i(1393);class Un{constructor(e,t,i){this.id=e,this.modules=t,this.options=i,this.type="dem",this.tree=Bn(),this.tileSize=Nn.d_,this.minElevation=0,this.revision=0,this.tileLoader=new Dn.U("arrayBuffer"),this.attributes={},this.tiles=new Map,this.textureIndices=new Map,this.url=e=>{const[t,i,n]=(0,Y._W)(e);return this.options.url(t,i,n)}}abortTileFetches(e){this.tileLoader.abortRequests(e.map(Y.gx))}deleteTiles(e){for(const t of e){const e=(0,Y.gx)(t);if(this.tiles.get(e)){const i=(0,Y.Sl)(t);this.tree.remove({minX:i.min[0],minY:i.min[1],maxX:i.max[0],maxY:i.max[1]},((t,i)=>e===i.key)),this.updateRevision()}this.tiles.delete(e);const i=this.textureIndices.get(e);void 0!==i&&this.modules.imageManager.deleteTexture(i),this.updateMinElevation()}}fetchTiles(e){return e.map((e=>this.fetchTile(e)))}generateTile(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){const e=[],i=[],n=(0,Y.gx)(t),o=this.tiles.get(n);if(!o)return Promise.resolve({results:e,transferable:i});const r=this.modules.map.state.handyStyleId,{collector:s}=this.modules,a=(0,Y.aq)(t[2]),l=o.bounds;this.tree.insert(Object.assign({key:n,minX:l.min[0],minY:l.min[1],maxX:l.max[0],maxY:l.max[1],cellSize:a/Nn.d_},o)),this.updateMinElevation();do{gi._.generateMeshElevation(s,o.mesh,r,zn.he)}while(s.isOverloaded());const d=s.getAccumulatedData();return e.push({regionId:0,metatileHash:-1,styleId:r,collectorOutput:d}),i.push(...d.transferable),Promise.resolve({results:e,transferable:i})}))}unpackRaw(e,t){const[i,n,o,r]=t,s=new Uint8Array(e),a=new Float32Array(Math.pow(this.tileSize,2));let l=1/0,d=-1/0;const c=this.tileSize;for(let e=0;e<c;e++){const t=W.H.toGeo((0,Y.Oy)([i,n+e*(1/Nn.d_),o,r])),u=W.H.scaleFactor(t[1]);for(let t=0;t<c;t++){const i=t+e*c,n=(s[i]+256*s[Math.pow(c,2)+i]-1e4)*u;l=Math.min(n,l),d=Math.max(n,d),a[i]=n}}const u=this.getMesh(a);return{data:a,mesh:u,tree:(0,Nn.Xp)(u.vertices,u.indices),minZ:l,maxZ:d,bounds:{min:(0,Y.Oy)(t),max:(0,Y.Oy)([i+1,n+1,o,r])}}}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e}getId(){return this.id}destroy(){const{imageManager:e}=this.modules;this.tileLoader.destroy(),this.tiles.clear(),this.tree.clear(),this.textureIndices.forEach((t=>e.deleteTexture(t))),this.textureIndices.clear()}getElevation(e){const t=this.getElevationTile(e);if(t)return(0,Nn.xr)(t,e)}getElevationTile(e){const t=(0,L.I0)(e);return this.tree.search({minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}).reduce(((e,t)=>!e||e.cellSize>t.cellSize?t:e),void 0)}getMinElevation(){return this.minElevation}updateMinElevation(){const e=this.modules.map.state;if(!e.demMode)return;const t=this.modules.camera.position[2],i=(0,jn.BS)(e.tilesBounds);if(void 0!==e.elevation){const n=e.elevation*L.C/t+1,o=Math.max(e.pitch/e.maxPitch*30,4);(0,le.bA)(i,Math.min(n,o))}const n=this.tree.search({minX:i.min[0],minY:i.min[1],maxX:i.max[0],maxY:i.max[1]});e.styleZoom-Go>1?this.minElevation=n.reduce(((e,t)=>{if(t.data){const n=(0,le.jV)(i,t.bounds);O.lu(n.min,n.min,t.bounds.min),O.lu(n.max,n.max,t.bounds.min),O.bA(n.min,n.min,1/t.cellSize),O.bA(n.max,n.max,1/t.cellSize);for(let i=Math.trunc(n.min[0]);i<n.max[0];i++)for(let o=Math.trunc(n.min[1]);o<n.max[1];o++){const n=i+(Nn.d_-1-o)*Nn.d_,r=t.data[n];e=void 0===e?r:Math.min(e,r)}}return e}),void 0):this.minElevation=n.reduce(((e,t)=>void 0===e?t.minZ:Math.min(e,t.minZ)),void 0)}getRevision(){return this.revision}fetchTile(e){const t=(0,Y.gx)(e),i=[{regionId:0,metatileHash:-1}];if(this.tiles.has(t))return Promise.resolve(i);const n=this.url(e);return this.tileLoader.fetch(e,(()=>n)).then((n=>(n.rejected||(this.tiles.set(t,n.data&&n.data.byteLength?this.unpackRaw(n.data,e):void 0),this.updateRevision()),i)),(()=>Promise.resolve(void 0)))}updateRevision(){this.revision++}getMesh(e){const t=this.tileSize,i=[],n=[];let o=0;for(let r=0;r<t;r++)for(let s=0;s<t;s++){const a=r*t+s;i[3*a+0]=s/(t-1)*G.Bq,i[3*a+1]=(1-r/(t-1))*G.Bq,i[3*a+2]=e[a],s<t-1&&r<t-1&&(n[o++]=a+1,n[o++]=a,n[o++]=a+t,n[o++]=a+1,n[o++]=a+t,n[o++]=a+t+1)}return{vertices:i,indices:n,normals:new Float32Array(t*t*3)}}}var Hn=i(7811),Gn=i.n(Hn);class Vn{constructor(e){const t=ArrayBuffer.isView(e)?e.buffer:e;this.buf=new Uint8Array(t),this.view=new DataView(t),this.pos=0}readBytes(e){const t=this.buf.subarray(this.pos,this.pos+e);return this.pos+=e,t}readUint16(){const e=this.view.getUint16(this.pos,!0);return this.pos+=2,e}readUint32(){const e=this.view.getUint32(this.pos,!0);return this.pos+=4,e}readInt32(){const e=this.view.getInt32(this.pos,!0);return this.pos+=4,e}readVarint(){var e;const t=Gn().decode(this.buf,this.pos);return this.pos+=null!==(e=Gn().decode.bytes)&&void 0!==e?e:0,t}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}}function Zn(e,t,i,n){let o=0;for(let r=0;r<i;r++){const i=e.readSVarint()+o;t.push(n?n(i):i),o=i}}function Wn(e){return e/L.C}var Xn=i(2447);function Kn(e){return e/100}class $n{constructor(e,t,i){this.id=e,this.modules=t,this.options=i,this.type="dem",this.tree=Bn(),this.minElevation=0,this.revision=0,this.tileLoader=new Dn.U("arrayBuffer"),this.attributes={},this.tiles=new Map,this.textureIndices=new Map,this.url=e=>{const[t,i,n]=(0,Y._W)(e);return this.options.url(t,i,n)}}abortTileFetches(e){this.tileLoader.abortRequests(e.map(Y.gx))}deleteTiles(e){for(const t of e){const e=(0,Y.gx)(t);if(this.tiles.get(e)){const i=(0,Y.Sl)(t);this.tree.remove({minX:i.min[0],minY:i.min[1],maxX:i.max[0],maxY:i.max[1]},((t,i)=>e===i.key)),this.updateRevision()}this.tiles.delete(e);const i=this.textureIndices.get(e);void 0!==i&&this.modules.imageManager.deleteTexture(i),this.updateMinElevation()}}fetchTiles(e){return e.map((e=>this.fetchTile(e)))}generateTile(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){const e=[],i=[],n=(0,Y.gx)(t),o=this.tiles.get(n);if(!o)return Promise.resolve({results:e,transferable:i});const r=this.modules.map.state.handyStyleId,{collector:s}=this.modules,a=(0,Y.aq)(t[2]),l=o.bounds;this.tree.insert(Object.assign({key:n,minX:l.min[0],minY:l.min[1],maxX:l.max[0],maxY:l.max[1],cellSize:a/Nn.d_},o)),this.updateMinElevation();do{gi._.generateMeshElevation(s,o.mesh,r,zn.he)}while(s.isOverloaded());const d=s.getAccumulatedData();return s.reset(),e.push({regionId:0,metatileHash:-1,styleId:r,collectorOutput:d}),i.push(...d.transferable),Promise.resolve({results:e,transferable:i})}))}tileDataToMesh(e,t){const[i,n,o,r]=t,s=(0,Nn.Xp)(e.vertices,e.indices);return{data:void 0,mesh:e,minZ:e.minZ,maxZ:e.maxZ,tree:s,bounds:{min:(0,Y.Oy)(t),max:(0,Y.Oy)([i+1,n+1,o,r])}}}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e}getId(){return this.id}destroy(){const{imageManager:e}=this.modules;this.tileLoader.destroy(),this.tiles.clear(),this.tree.clear(),this.textureIndices.forEach((t=>e.deleteTexture(t))),this.textureIndices.clear()}getElevation(e){const t=this.getElevationTile(e);if(t)return(0,Nn.xr)(t,e)}getElevationTile(e){const t=(0,L.I0)(e);return this.tree.search({minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}).reduce(((e,t)=>!e||e.cellSize>t.cellSize?t:e),void 0)}getMinElevation(){return this.minElevation}updateMinElevation(){const e=this.modules.map.state;if(!e.demMode)return;const t=this.modules.camera.position[2],i=(0,jn.BS)(e.tilesBounds);if(void 0!==e.elevation){const n=e.elevation*L.C/t+1,o=Math.max(e.pitch/e.maxPitch*30,4);(0,le.bA)(i,Math.min(n,o))}const n=this.tree.search({minX:i.min[0],minY:i.min[1],maxX:i.max[0],maxY:i.max[1]});e.styleZoom,this.minElevation=n.reduce(((e,t)=>void 0===e?t.minZ:Math.min(e,t.minZ)),void 0)}getRevision(){return this.revision}fetchTile(e){const t=(0,Y.gx)(e),i=[{regionId:0,metatileHash:-1}];if(this.tiles.has(t))return Promise.resolve(i);const n=this.url(e),o=(0,Y.Bs)(e);return this.tileLoader.fetch(e,(()=>n)).then((n=>(n.rejected||(this.tiles.set(t,n.data&&n.data.byteLength?this.tileDataToMesh(this.precomputeNormalsAndMinMaxZ(n.data,o),e):void 0),this.updateRevision()),i)),(()=>Promise.resolve(void 0)))}precomputeNormalsAndMinMaxZ(e,t){var i,n;if(0===e.byteLength)return{vertices:[],indices:[],normals:new Float32Array(0),maxZ:0,minZ:0};const o=777275726===new Uint32Array(e.slice(0,4))[0],{dataGroups:r,minZ:s,maxZ:a}=o?function(e){const t=new Vn(e);t.readUint32(),t.readUint16(),t.readUint16(),t.readUint16(),t.readUint16();const i=Wn(t.readInt32()),n=Wn(t.readInt32()),o=t.readUint32(),r=[];for(let e=0;e<o;e++){const e=t.readUint32(),i=new Uint16Array(2*e);for(let n=0;n<e;n++)i[2*n]=t.readUint16(),i[2*n+1]=t.readUint16();const n=[];Zn(t,n,e,Wn);const o=[];for(let t=0;t<e;t++)o.push(i[2*t]),o.push(i[2*t+1]),o.push(n[t]);const s=t.readUint32(),a=[];Zn(t,a,s);const l={vertices:o,indices:a},d=t.readUint32();if(d>0){const e=[];new Int8Array(t.readBytes(3*d)).forEach((t=>e.push(t/127))),l.normals=e}const c=t.readUint32();if(c>0){const e={};for(let i=0;i<c;i++){const i=t.readUint16(),n=t.readInt32();e[i]=n}l.attributes=e}r.push(l)}return{dataGroups:r,minZ:i,maxZ:n}}(e):function(e){const t=new Xn.Z(e),i=Kn(t.readFixed32()),n=Kn(t.readFixed32()),o=t.readFixed32(),r=t.readBytes(),s=new Uint16Array(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)),a=[];let l=0;for(let e=0;e<o;e++)a.push(s[2*e]),a.push(s[2*e+1]),a.push(Kn(t.readSVarint()));const d=[];l=0;const c=t.readFixed32();for(let e=0;e<c;e++){const e=t.readSVarint(),i=l+e;l+=e,d.push(i)}return{dataGroups:[{vertices:a,indices:d}],minZ:i,maxZ:n}}(e),{vertices:l,indices:d}=r[0],c=Array(),u=new Map,h=[[],[],[]],m=[],f=[],_=[];if(this.modules.map.state.disableFlatDemIrregularMeshNormals){const e=L.C*G.Bq/t.size;for(let t=0;t<d.length;t+=3){for(let i=0;i<3;i++){const n=d[t+i];h[i][0]=l[3*n],h[i][1]=l[3*n+1],h[i][2]=l[3*n+2]*e}ae.Fv(m,ae.kC(m,ae.lu(f,h[1],h[0]),ae.lu(_,h[2],h[0])));for(let e=0;e<3;e++){const i=d[t+e],n=l[3*i],o=l[3*i+1],r=l[3*i+2];u.has(n)||u.set(n,new Map),u.get(n).has(o)||u.get(n).set(o,new Map);let s=u.get(n).get(o).get(r);void 0===s?(s=[...m],u.get(n).get(o).set(r,s)):ae.IH(s,s,m)}}u.forEach((e=>e.forEach((e=>e.forEach((e=>ae.Fv(e,e)))))));for(let e=0;e<l.length/3;e++){const t=null===(n=null===(i=null==u?void 0:u.get(l[3*e]))||void 0===i?void 0:i.get(l[3*e+1]))||void 0===n?void 0:n.get(l[3*e+2]);t?(c.push(t[0]),c.push(t[1]),c.push(t[2])):(console.log("no normal"),c.push(0,0,0))}}return{vertices:l,indices:d,normals:new Float32Array(c),maxZ:a,minZ:s}}updateRevision(){this.revision++}}var qn=i(3698),Yn=i(1245),Jn=i(2539),Qn=i(4874);const eo=new Float64Array(16);class to{constructor(e,t,i){this.detailLevel=0,this.mvpMatrix=new Float64Array(16),this.texMatrix=new Float64Array(16),it.JG(this.mvpMatrix,e),it.Jp(this.texMatrix,L.LX,e),this.detailLevel=i,this.viewport=[[0,0,0,1],[1,0,0,1],[1,1,0,1],[0,1,0,1]],it.U_(eo,this.texMatrix),this.viewport.forEach((e=>{ae.fF(e,e,eo),e[0]-=t[0],e[1]-=t[1],e[2]-=t[2],e[2]>=0&&(e[2]=-1),ae.Fv(e,e);const i=-t[2]/e[2];e[0]=t[0]+e[0]*i,e[1]=t[1]+e[1]*i,e[2]=t[2]+e[2]*i}))}}class io{constructor(e){this.destroyed=!1,this.modules=e.modules,this.textures=[]}update(){if(this.destroyed)return;const{center:e,padding:t,rotation:i,size:n,viewport:o,extendedTilesBounds:r,zoom:s,cameraConfig:a,globeMode:l}=this.modules.map.state,d=(0,Jn.hS)(r[0],r[1]),c=(0,Jn.Oy)(r[2],d);this.textures=[];const u=(0,we.Id)(45),h=Math.min(this.modules.map.state.pitch,u),m=new Qn.V({pitch:h,center:e,padding:t,rotation:i,size:n,viewport:o,zoom:s,cameraConfig:a,globeMode:l,styleState:{}}),f=(0,we.uZ)(Math.pow(this.modules.map.state.pitch/u,3),0,1),[_,p]=this.modules.camera.position,v=Yn.fF([],[_,p,0,1],m.viewProjectionMatrix),g=Math.min(v[1]/v[3]+1,-.5);let y=Math.max(g,-1);if(it.wA(eo,[0,-y,0],[1/Zo[0],1/Zo[1],1]),it.Jp(eo,eo,m.viewProjectionMatrix),this.textures.push(new to(eo,m.position,0)),(0,Jn.Oy)(this.textures[0].viewport[2],d)>=c)return!0;if(g<y){const e=Math.max(Math.abs(g-y)/2,1);it.wA(eo,[0,2/e+1,0],[1/Zo[0],Zo[1]/e,1]),it.Jp(eo,eo,m.viewProjectionMatrix),this.textures.push(new to(eo,m.position,1))}y+=1;const b=Math.pow(n[1]/749,2);[1.4,3.2,12,31].some(((e,t)=>{e=(e-1)*f*b+1,it.wA(eo,[0,-(y*e+1),0],[1/Zo[0],e/Zo[1],1]),it.Jp(eo,eo,m.viewProjectionMatrix),y+=2/e;const i=this.textures.push(new to(eo,m.position,t));if((0,Jn.Oy)(this.textures[i-1].viewport[2],d)>=c)return!0}))}destroy(){this.textures=[]}}var no=i(6201);const oo={depthMask:!0,depthTest:!0,depthFunc:bt.X6.LESS,cullFace:!0,cullFaceMode:bt.V9.BACK,blend:!1,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ZERO},blendEquation:bt.m9.FUNC_ADD,colorMask:[!0,!0,!0,!0],polygonOffsetFill:!1,polygonOffset:{factor:1,units:2}},ro=e=>{if("function"==typeof e)return t=>{const i=e(t);return Object.assign({},oo,i)};const t=Object.assign({},oo,e);return()=>t},so=ro({}),ao=ro({blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),lo=ro({blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA},depthFunc:bt.X6.GREATER,depthMask:!1,cullFace:!1,polygonOffsetFill:!0,polygonOffset:{factor:1,units:2}}),co=ro({depthMask:!1,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),uo=ro({blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA},cullFace:!1}),ho=ro({depthMask:!1,depthTest:!1,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),mo=ro({depthMask:!1,depthTest:!1,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA},blendEquation:bt.m9.MAX}),fo=ro({depthMask:!1,depthTest:!1,blend:!0,blendFunc:{sfactor:bt.LA.SRC_ALPHA,dfactor:bt.LA.ONE}}),_o=ro({depthMask:!1,depthTest:!1,colorMask:[!0,!1,!1,!0]}),po=ro({depthMask:!1,depthTest:!1}),vo=ro({depthMask:!1,depthTest:!1}),go=ro({depthMask:!1}),yo=ro({colorMask:[!1,!1,!1,!1]}),bo=ro({colorMask:[!1,!1,!1,!1],depthFunc:bt.X6.ALWAYS}),xo=ro({blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),wo=ro({depthFunc:bt.X6.EQUAL,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),So=ro({depthMask:!1,depthTest:!1,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),Mo=ro({depthMask:!1,depthTest:!0,depthFunc:bt.X6.LEQUAL,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),Io=ro({depthMask:!1,depthTest:!0,depthFunc:bt.X6.GREATER,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),To=ro({polygonOffsetFill:!0,polygonOffset:{factor:1,units:2},blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),Eo=ro({cullFaceMode:bt.V9.BACK}),Po=ro({cullFace:!1}),Ao=ro({depthMask:!1,depthTest:!1,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE}}),Lo=ro({depthTest:!1,cullFace:!1}),Co=ro({depthTest:!1,depthMask:!1,blend:!0,blendFuncSeparate:{srcRgb:bt.LA.SRC_ALPHA,dstRgb:bt.LA.ONE_MINUS_SRC_ALPHA,srcAlpha:bt.LA.ONE,dstAlpha:bt.LA.ONE_MINUS_SRC_ALPHA}}),zo=ro({colorMask:[!0,!0,!0,!0],depthMask:!0}),ko=ro({colorMask:[!0,!0,!0,!0],depthMask:!1}),Oo=ro({depthMask:!0,depthTest:!0,depthFunc:bt.X6.LEQUAL,blend:!0,blendFunc:{sfactor:bt.LA.ONE,dfactor:bt.LA.ONE_MINUS_SRC_ALPHA}}),Ro=ro({depthMask:!0,depthTest:!0,depthFunc:bt.X6.LEQUAL,blend:!0,blendFunc:{sfactor:bt.LA.SRC_ALPHA_SATURATE,dfactor:bt.LA.ONE_MINUS_SRC_COLOR}}),Fo=ro({depthMask:!0,depthTest:!0}),Bo=ro((e=>e.map.getFeatureFlag("transparentBuildingsOff")?so(e):wo(e))),Do=(0,z.HW)(),jo=(0,z.HW)(),No=(0,z.HW)(),Uo=(0,z.HW)(),Ho=64,Go=12,Vo=15,Zo=[1.7,1],Wo=(0,Y.aq)(T.tiles.maxRegionalZoom),Xo={localhost:{tileServer:"localhost:8181",tileProtocol:"http",subdomains:[]},relief_test:{tileServer:"tileserver.web-staging.2gis.ru",tileProtocol:"https",subdomains:["0","1","2"]},relief_test2:{tileServer:"tileserver.web-staging.2gis.ru",tileProtocol:"https",subdomains:["0","1","2"]}},Ko=(e,t,i,n,o)=>{const r=(0,P.IG)(e.tileServer,{subdomain:e.subdomains[Math.abs(t+i)%e.subdomains.length]});return`${e.tileProtocol}://${r}/v2/ald?ts=${o}&x=${t}&y=${i}&z=${n}`},$o=ae.Ue(),qo=new Float64Array(16);class Yo{constructor(e){this.demTextureMatrix=new Float64Array(16),this.demCorrectedFbVpToDemTex=new Float32Array(16),this.demTexToCorrectedTex=new Float32Array(16),this.correctedTexToDemTex=new Float32Array(16),this.isDemCorrectionEnabled=!1,this.demCorrectedScale=1,this.demFbVpMatrix=new Float64Array(16),this.demCorrectedFbVpMatrix=new Float64Array(16),this.demFramebufferId=ai.ze,this.correctedDemFramebufferId=ai.ze,this.flatFramebufferId=ai.ze,this.identifyFlatFramebufferId=ai.ze,this.hillshadeRampTextureId=NaN,this.hillshadeFramebufferId=ai.ze,this.groundFramebufferId=ai.ze,this.isGroundBufferValid=!1,this.lastStyleId=NaN,this.tilesRevision=0,this.tileSet="dem",this.modules=e,this.enabled=!1,this.sources=[],this.sourcesRevision=[],this.tileLayers=[],this.terrainAnimationScaleCoef=.001,this.reliefTileType="vector",this.elevationSourceType="irregular",this.groundBuffer=new Float32Array,this.differ=new Ve.H([])}enable(){if(void 0===this.isTerrainSupported&&(this.isTerrainSupported=ut()),this.enabled||!this.isTerrainSupported)return;this.differ=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"demMode",type:"boolean"},{path:"elevation",type:"number"},{path:"minElevation",type:"number"}]),this.demFramebufferId=this.createDemFramebuffer(),this.correctedDemFramebufferId=this.createCorrectedDemFramebuffer(),this.hillshadeFramebufferId=this.createHillshadeFramebuffer(),this.flatFramebufferId=this.createFlatFramebuffer(),this.identifyFlatFramebufferId=this.createFlatIdentifyFramebuffer(),this.groundFramebufferId=this.createGroundFramebuffer(),this.fullscreenBuffer=this.modules.renderer.createBuffer(new Uint16Array([[0,0,0,0],[1,0,1,0],[0,1,0,1],[0,1,0,1],[1,0,1,0],[1,1,1,1]].reduce(((e,t)=>{const[i,n,o,r]=t;return e.push(i*G._H,n*G._H,(0,qn.Bb)(o),(0,qn.Bb)(r)),e}),[]))),this.hillshadeVao=Tn(this.fullscreenBuffer,this.modules.renderer.getShaderProgram("demHillshade"));const e=this.modules.renderer.getShaderProgram("demElevationCopy");this.copyDemVao=Tn(this.fullscreenBuffer,e),this.addDefaultSources(),this.modules.styleManager.setFramebufferId(this.modules.map.state.handyStyleId,zn.he,{elevation:ai.ze,hillshade:this.hillshadeFramebufferId,flatBottom:this.correctedDemFramebufferId,ground:this.groundFramebufferId,ground2:this.groundFramebufferId}),this.updateRampTextureId(),this.enabled=!0,this.startAnimationVerticalScale()}setAnimationTerrain(e){this.modules.demManager.disableAnimation=!e}getAnimationTerrainStatus(){return this.modules.demManager.disableAnimation}onTerrainStyleChange(){this.updateRampTextureId()}disable(){var e,t,i,n,o;this.enabled&&(null===(e=this.meshSource)||void 0===e||e.destroy(),this.meshSource=void 0,null===(t=this.flatMapSource)||void 0===t||t.destroy(),this.flatMapSource=void 0,this.tileLayers.forEach((e=>{this.modules.tileManager.removeTileLayer(e)})),this.tileLayers=[],this.sources.forEach((e=>{e.destroy()})),this.sources=[],this.sourcesRevision=[],this.hillshadeTile&&(this.modules.tileManager.removeObject(this.hillshadeTile),this.hillshadeTile=void 0),null===(i=this.hillshadeVao)||void 0===i||i.unbind(),null===(n=this.hillshadeVao)||void 0===n||n.remove(),null===(o=this.fullscreenBuffer)||void 0===o||o.remove(),this.modules.styleManager.removeLayer("demo_raster_layer"),this.modules.styleManager.setFramebufferId(this.modules.map.state.handyStyleId,zn.he,{elevation:ai.ze,hillshade:ai.ze,flatBottom:ai.ze,ground:ai.ze,ground2:ai.ze}),this.modules.renderer.removeFramebuffer(this.hillshadeFramebufferId),this.modules.renderer.removeFramebuffer(this.demFramebufferId),this.modules.renderer.removeFramebuffer(this.correctedDemFramebufferId),this.modules.renderer.removeFramebuffer(this.flatFramebufferId),this.modules.renderer.removeFramebuffer(this.groundFramebufferId),this.enabled=!1)}update(){var e,t,i,n;if(!this.enabled)return;const o=this.modules.map.state;this.lastStyleId!==o.handyStyleId&&(this.updateRampTextureId(),null===(e=this.meshSource)||void 0===e||e.updateStyleId(),null===(t=this.hillshadeTile)||void 0===t||t.children.forEach((e=>{e.attributes.styleId=o.handyStyleId})),this.modules.styleManager.setFramebufferId(this.modules.map.state.handyStyleId,zn.he,{elevation:ai.ze,hillshade:this.hillshadeFramebufferId,flatBottom:this.correctedDemFramebufferId,ground:this.groundFramebufferId,ground2:this.groundFramebufferId}),this.updateClearColor(),this.lastStyleId=o.handyStyleId);const r=this.updateTilesRevision(),s=this.differ.check(this.modules.map.state);(r||s)&&(this.isGroundBufferValid=!1),s&&(this.updateMinElevation(),null===(i=this.flatMapSource)||void 0===i||i.update(),null===(n=this.meshSource)||void 0===n||n.update(),this.updateDemFramebufferMatrix(),this.modules.renderer.addRerenderEvent()),this.disableAnimation||ne.Vx("changeScale",{step:(e,t)=>{1===t&&ne.sT("changeScale",o),this.terrainAnimationScaleCoef=t}},o)}isEnabled(){return this.enabled}getDemFramebufferId(){return this.demFramebufferId}getCorrectedDemFramebufferId(){return this.correctedDemFramebufferId}getFlatFramebufferId(){return this.flatFramebufferId}getIdentifyFlatFramebufferId(){return this.identifyFlatFramebufferId}getHillshadeFramebufferId(){return this.hillshadeFramebufferId}getHillshadeRampTextureId(){return this.hillshadeRampTextureId}getElevation(e){if(this.enabled)for(let t=this.sources.length-1;t>=0;t--){const i=this.sources[t].getElevation(e);if(void 0!==i)return i}}getLabelsDemKey(e){if(!this.enabled||0===e.length)return;let t,i;for(const i of e)if(t=i.labels.find((e=>e.type===no.R2.Point)),t)break;if(t){(0,Y.L7)($o,t.vertices,0,(0,Y.Bs)(t.tileCoords));for(let e=this.sources.length-1;e>=0;e--){const t=this.sources[e].getElevationTile($o);if(void 0!==t){i=t;break}}return i?i.key:void 0}}enrichWithElevation(e){var t;if(this.enabled)for(const i of e){let e=null;for(const n of i.labels)n.type===no.R2.Point&&(e||(e=(0,Y.Bs)(n.tileCoords)),(0,Y.L7)($o,n.vertices,0,e),n.demElevation=null!==(t=this.getElevation($o))&&void 0!==t?t:NaN)}}getMinElevation(){return this.sources.reduce(((e,t)=>{const i=t.getMinElevation();return void 0===i?e:void 0===e?i:Math.min(e,i)}),void 0)}updateMinElevation(){this.sources.forEach((e=>e.updateMinElevation()))}getMeshTiles(){return"raster"===this.reliefTileType?"regular"===this.elevationSourceType&&this.meshSource?Array.from(this.meshSource.meshTiles.values()):[]:this.tileLayers.reduce(((e,t)=>{const i=t.getDisplayedTileObjects();return e.push(...i),e}),[])}getGroundTiles(){return"raster"===this.reliefTileType&&"regular"===this.elevationSourceType&&this.meshSource?Array.from(this.meshSource.groundTiles.values()):[]}getReliefTileType(){return this.reliefTileType}getElevationSourceType(){return this.elevationSourceType}setReliefTileType(e){this.reliefTileType!==e&&(this.reliefTileType=e,this.enabled&&(this.dangerouslyDestroySourcesAndLayers(),"regular"===this.elevationSourceType?this.addRegularElevationSources():this.addIrregularElevationSources(),this.modules.renderer.addRerenderEvent()))}setElevationSourceType(e){this.elevationSourceType!==e&&(this.elevationSourceType=e,this.enabled&&(this.dangerouslyDestroySourcesAndLayers(),"regular"===this.elevationSourceType?this.addRegularElevationSources():this.addIrregularElevationSources(),this.modules.renderer.addRerenderEvent()))}getFlatMapTextures(){return this.flatMapSource?this.flatMapSource.textures.slice():[]}clearTextureBindings(){this.modules.renderer.disableTexture(0),this.modules.renderer.disableTexture(Do),this.modules.renderer.disableTexture(Uo),this.modules.renderer.disableTexture(jo),this.modules.renderer.disableTexture(No)}setMeshMaxZoom(e){var t;this.meshMaxZoom=e,null===(t=this.meshSource)||void 0===t||t.setMaxZoom(e)}getVerticalScale(){const e=this.modules.map.state,t=this.modules.styleManager.getStyle(e.handyStyleId);if(!t)return 0;const i=t.dem.style,n=(0,te.jJ)(e.styleZoom,e.styleState,[]);return this.disableAnimation?(0,te.vn)(i.verticalScale,n):(0,te.vn)(i.verticalScale,n)*this.terrainAnimationScaleCoef}startAnimationVerticalScale(){const e=this.modules.map.state;if(!this.modules.styleManager.getStyle(e.handyStyleId))return 0;ne.BL("changeScale",{easing:"linear"},e,.001,1,300,1)}getTilesRevision(){return this.tilesRevision}setTileSet(e){this.tileSet=e,this.enabled&&(this.disable(),this.enable())}getGroundPoint(e){if(!this.enabled)return;if(this.updateGround(),!this.isGroundBufferValid)return;const t=this.modules.renderer.getFramebuffer(this.groundFramebufferId);if(!t)return;const i=t.renderTarget.options.size,n=e[0]-this.modules.map.state.viewport.left,o=e[1]-this.modules.map.state.viewport.top;if(n<0||n>i[0]-1||o<0||o>i[1]-1)return;const r=4*((i[1]-o-1)*i[0]+n);if(0===this.groundBuffer[r+3])return;const[s,a]=W.H.toGeo([this.groundBuffer[r],this.groundBuffer[r+1]]);return[s,a,this.groundBuffer[r+2]]}dangerouslyDestroySourcesAndLayers(){this.sources.forEach((e=>e.destroy())),this.sources=[],this.sourcesRevision=[],this.tileLayers.forEach((e=>{this.modules.tileManager.removeTileLayer(e),e.destroy()})),this.tileLayers=[]}updateRampTextureId(){const e=this.modules.styleManager.getStyle(this.modules.map.state.handyStyleId);if(null==e?void 0:e.dem){const t=function(e,t,i){const n=(0,te.jJ)(e.styleZoom,e.styleState,[]),o=[],r=i-1;for(let e=0;e<i;e++){const i=e/r,s=256*(0,te.UP)(t,i,n);o.push(s)}return new nt(new Uint8Array(o),{size:[i,1],format:nt.AlphaFormat,magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping})}(this.modules.map.state,e.dem.style.shadingPalette,256);Number.isNaN(this.hillshadeRampTextureId)?this.hillshadeRampTextureId=this.modules.imageManager.addPreparedTexture(t):this.modules.imageManager.updatePreparedTexture(this.hillshadeRampTextureId,t)}}updateClearColor(){const e=this.modules.styleManager.getStyle(this.modules.map.state.handyStyleId);if(null==e?void 0:e.dem){const t=this.modules.renderer.getFramebuffer(this.flatFramebufferId);t&&(t.clearColor=(0,te.m2)(e.background.color))}}updateGround(){if(this.enabled&&!this.isGroundBufferValid){const e=this.modules.renderer.getFramebuffer(this.groundFramebufferId);if(!e)return;const t=e.renderTarget.options.size;this.validateGroundBufferSize(t),this.modules.renderer.bindRenderTarget(e.renderTarget),this.modules.renderer.readPixelsFloat(0,0,t[0],t[1],this.groundBuffer),this.modules.renderer.bindRenderTarget(null),this.isGroundBufferValid=!0}}addDefaultSources(){var e;if(!this.enabled){this.dangerouslyDestroySourcesAndLayers(),"irregular"===this.elevationSourceType?this.addIrregularElevationSources():this.addRegularElevationSources(),this.flatMapSource=new io(this.modules.map),this.meshSource=new Fn(this.modules.map,{maxZoom:this.meshMaxZoom});const t=this.hillshadeVao,i=null===(e=this.modules.renderer.symbolSettingsList.dem.hillshade)||void 0===e?void 0:e[0];if(t&&i){this.hillshadeTile=new R.W("raster",[],this.modules,this.modules.map.state);const e={id:(0,z.fD)(),type:Cn.H.Tile,symbol:"dem",sink:"hillshade",tile:this.hillshadeTile,attributes:{layerId:zn.he,styleId:this.modules.map.state.handyStyleId,tileData:[]},start:0,count:6,attributesHash:"",layerSettings:i,vao:t,canRender:!0,renderingProperties:{}};this.hillshadeTile.children.push(e),this.modules.tileManager.addObject(this.hillshadeTile)}}}addRegularElevationSources(){const e=this.modules.map.state,t=(t,i,n)=>Ko(e,t,i,n,"dem"===this.tileSet?"relief":this.tileSet),i="raster"===this.reliefTileType;i&&this.addElevationSource({url:t,minZoom:5,maxZoom:8,attributes:{}}),this.addElevationSource({url:t,minZoom:i?9:5,maxZoom:Go,attributes:{}})}addIrregularElevationSources(){this.addIrregularElevationSource({url:(e,t,i)=>{var n;const o=null!==(n=Xo[this.tileSet])&&void 0!==n?n:this.modules.map.state;return Ko(o,e,t,i,this.tileSet)},minZoom:5,maxZoom:Vo,attributes:{}})}updateTilesRevision(){let e=!1;return this.sources.forEach(((t,i)=>{const n=t.getRevision();n!==this.sourcesRevision[i]&&(this.sourcesRevision[i]=n,e=!0)})),e&&this.tilesRevision++,e}addElevationSource(e){const t=new Un((0,N.Q)(),this.modules,e);this.sources.push(t),this.sourcesRevision.push(t.getRevision());const{minZoom:i,maxZoom:n}=e,o=new H.I(i,n,i,n,this.modules,this.modules.map.state,t);this.modules.tileManager.addTileLayer(o),this.tileLayers.push(o)}addIrregularElevationSource(e){const t=new $n((0,N.Q)(),this.modules,e);this.sources.push(t),this.sourcesRevision.push(t.getRevision());const{minZoom:i,maxZoom:n}=e,o=new H.I(i,n,i,n,this.modules,this.modules.map.state,t);this.modules.tileManager.addTileLayer(o),this.tileLayers.push(o)}getDemTextureSize(){const e=this.modules.map.state.cameraConfig,t=this.modules.map.state.size[1]*e.viewportLimitRatio;return Math.min(Math.ceil(Math.hypot(t,t)/G.y4),Ho)}createGroundFramebuffer(){const e=this.modules.map.state.size,t=[0,0,0,0],i=new st({size:e,magFilter:nt.NearestFilter,minFilter:nt.NearestFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,flipY:!0,type:nt.Float});return this.modules.renderer.bindRenderTarget(i),this.modules.renderer.clearWithColor(t,!0),this.modules.renderer.bindRenderTarget(null),this.modules.renderer.addFramebuffer({clearColor:t,useDem:!0,clearDepth:!0,onResize:()=>{const e=this.modules.map.state.size;i.setSize(e),this.modules.renderer.bindRenderTarget(i),this.modules.renderer.clearWithColor(t,!0),this.modules.renderer.bindRenderTarget(null)},renderTarget:i,renderIndex:5,onRenderStart:()=>{this.clearTextureBindings()},onRenderEnd:()=>{}})}createDemFramebuffer(){let e=this.getDemTextureSize()*Ho;const t=new st({size:[e,e],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,flipY:!0,type:nt.Float,format:nt.RgbaFormat}),i=[0,0,0,0];return this.modules.renderer.bindRenderTarget(t),this.modules.renderer.clearWithColor(i),this.modules.renderer.bindRenderTarget(null),this.modules.renderer.addFramebuffer({clearColor:i,onResize:()=>{const n=this.getDemTextureSize()*Ho;n!==e&&(e=n,t.setSize([e,e]),this.modules.renderer.bindRenderTarget(t),this.modules.renderer.clearWithColor(i),this.modules.renderer.bindRenderTarget(null))},renderTarget:t,getViewProjectionMatrix:()=>this.demFbVpMatrix,renderIndex:0,onRenderStart:()=>{this.clearTextureBindings()},onRenderEnd:()=>{this.isDemCorrectionEnabled=!1}})}createCorrectedDemFramebuffer(){const e=this.modules.renderer;let t=this.getDemTextureSize()*Ho;const i=new st({size:[t,t],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,flipY:!0,type:nt.Float});return e.bindRenderTarget(i),e.clearWithColor([0,0,0,1]),e.bindRenderTarget(null),this.modules.renderer.addFramebuffer({onResize:()=>{const e=this.getDemTextureSize()*Ho;e!==t&&(t=e,i.setSize([t,t]),this.modules.renderer.bindRenderTarget(i),this.modules.renderer.clearWithColor([0,0,0,1]),this.modules.renderer.bindRenderTarget(null))},renderTarget:i,getViewProjectionMatrix:()=>this.demCorrectedFbVpMatrix,renderIndex:1,onRenderStart:()=>{var e;const t=null===(e=this.modules.renderer.getFramebuffer(this.demFramebufferId))||void 0===e?void 0:e.renderTarget.getTexture();if(!t||!this.copyDemVao)return;this.clearTextureBindings(),this.modules.renderer.bindRenderTarget(i),this.modules.renderer.setViewport(0,0,i.options.size[0],i.options.size[1]),this.modules.renderer.applyGpuState(_o);this.modules.renderer.enableTexture(t,0);const n=this.modules.renderer.getShaderProgram("demElevationCopy");this.modules.renderer.enableShaderProgram(n),this.modules.renderer.bindShaderProgram(n,{u_mat4_mvp:L.TD,u_sr2d_texture:0,u_mat4_dem_corrected:this.correctedTexToDemTex}),this.modules.renderer.bindVao(this.copyDemVao),this.modules.renderer.drawTriangles(0,6),this.modules.renderer.bindRenderTarget(null),this.isDemCorrectionEnabled=!0},useDem:!0})}createHillshadeFramebuffer(){let e=this.getDemTextureSize()*Ho;const t=new st({size:[e,e],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,format:nt.RgbFormat,flipY:!0});return this.modules.renderer.addFramebuffer({clearColor:[0,0,0,0],onResize:()=>{const i=this.getDemTextureSize()*Ho;i!==e&&(e=i,t.setSize([e,e]),this.modules.renderer.bindRenderTarget(t),this.modules.renderer.bindRenderTarget(null))},renderTarget:t,getViewProjectionMatrix:()=>this.demFbVpMatrix,renderIndex:2,onRenderStart:()=>{this.clearTextureBindings()},useDem:!0})}createFlatFramebuffer(){const e=this.modules.renderer.getPixelRatio(),t=this.modules.map.state.size,i=new st({size:[Math.trunc(t[0]*Zo[0]*e),Math.trunc(t[1]*Zo[1]*e)],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping});return this.modules.renderer.addFramebuffer({clearColor:this.modules.renderer.clearColor,onResize:()=>{const t=this.modules.map.state.size;i.setSize([Math.trunc(t[0]*Zo[0]*e),Math.trunc(t[1]*Zo[1]*e)]),this.modules.renderer.bindRenderTarget(i),this.modules.renderer.bindRenderTarget(null)},renderTarget:i,renderIndex:3,onRenderStart:()=>{this.modules.renderer.disableTexture(0)}})}createFlatIdentifyFramebuffer(){const e=this.modules.map.state.size,t=new st({size:[Math.trunc(e[0]*Zo[0]*T.identify.pixelDensity),Math.trunc(e[1]*Zo[1]*T.identify.pixelDensity)],magFilter:nt.NearestFilter,minFilter:nt.NearestFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping});return this.modules.renderer.addFramebuffer({clearColor:iu,onResize:()=>{const e=this.modules.map.state.size;t.setSize([Math.trunc(e[0]*Zo[0]*T.identify.pixelDensity),Math.trunc(e[1]*Zo[1]*T.identify.pixelDensity)]),this.modules.renderer.bindRenderTarget(t),this.modules.renderer.bindRenderTarget(null)},renderTarget:t,renderIndex:4,onRenderStart:()=>{this.modules.renderer.disableTexture(0)}})}updateDemFramebufferMatrix(){const e=this.modules.map.state,t=Math.trunc(e.styleZoom),i=Math.min(t,"raster"===this.getReliefTileType()?12:18),n=(0,Y.aq)(i),o=n*this.getDemTextureSize(),r=n/Ho,s=[Math.trunc(e.center[0]/r)*r+r/2,Math.trunc(e.center[1]/r)*r+r/2],a=[s[0]-o/2,s[1]-o/2,0],l=[];O.lu(l,this.modules.camera.position,e.center);const d=O.Zh(l);O.Fv(l,l);const c=Math.max(o/2-d-r-Wo/2,0),u=Math.min(c,(o/2-d-r)*Math.sin(e.pitch/e.maxPitch*(Math.PI/2)));u>0&&(O.bA(l,l,u),l[0]=Math.trunc(l[0]/r)*r,l[1]=Math.trunc(l[1]/r)*r,O.lu(a,a,l)),it.wA(qo,a,[o,o,G._9]),it.U_(this.demTextureMatrix,qo),it.Jp(this.demFbVpMatrix,L.TD,this.demTextureMatrix);const h=Math.min(t,18);this.demCorrectedScale=Math.pow(2,h-i);const m=(0,Y.aq)(h)*this.getDemTextureSize(),f=[s[0]-m/2,s[1]-m/2,0];it.wA(qo,f,[m,m,G._9]),it.U_(qo,qo),it.Jp(this.demCorrectedFbVpMatrix,L.TD,qo),it.xJ(qo,[1/this.demCorrectedScale,1/this.demCorrectedScale,1]),it.Jp(this.demCorrectedFbVpToDemTex,L.LX,qo),it.xJ(qo,[1/this.demCorrectedScale,1/this.demCorrectedScale,1]),it.Jp(qo,qo,L.TD),it.Jp(this.correctedTexToDemTex,L.LX,qo),it.xJ(qo,[this.demCorrectedScale,this.demCorrectedScale,1]),it.Jp(qo,qo,L.TD),it.Jp(this.demTexToCorrectedTex,L.LX,qo)}validateGroundBufferSize(e){const t=e[0]*e[1]*4;this.groundBuffer.length!==t&&(this.groundBuffer=new Float32Array(t))}}var Jo=i(309);const Qo=new Float32Array(16),er=(e,t,i,n)=>{(i=Ir(i,e,t)).length>0&&void 0===e.metrics.firstcontent&&(e.metrics.firstcontent=performance.now()-e.metrics.start),yr(i,n),e.globeMode&&e.globeReady?tr(e,t,i,n):ir(e,t,i,n)},tr=(e,t,i,n)=>{const o=[],{environmentManager:r}=t,s=t.styleManager.getStyle(e.handyStyleId);if(!s)return;if(!s.environment)return;const a=(0,te.jJ)(e.styleZoom,e.styleState,[]),l=(0,te.m2)((0,te.zn)(s.background.color,a));r.renderStars(),r.renderGlobeHaloBackground(),fr(i).forEach((i=>{i.globeTile?(n.useGlobeTile(i.globeTile),t.renderer.clearWithColor(l),i.children.forEach((e=>{if(e.type===Cn.H.Custom||!i.globeTile)return;const t=i.globeTile.coords,n=e.tile.coords,o=n[2]-t[2],r=Math.pow(2,o),s=(n[0]-t[0]*r)/r,a=(n[1]-t[1]*r)/r,l=1/r,d=1-l-2;it.wA(Qo,[2*s+d,2*a+d,0],[4*l,4*l,1]),e.tile.setMvpMatrix(Qo)})),_r(i.children,e,t).forEach((i=>nr(e,t,i,n))),n.useCanvas(),nr(e,t,i.globeTile.children,n)):_r(i.children,e,t).forEach((e=>o.push(e)))})),r.renderGlobeHalo(),o.forEach((i=>{nr(e,t,i,n)}))},ir=(e,t,i,n)=>{_r(i,e,t).forEach((i=>nr(e,t,i,n)))},nr=(e,t,i,n)=>{vr(t.styleManager,i,e,t).forEach((i=>{cr(t.styleManager,i[0])?or(e,t,i,n):rr(e,t,i,n)}))},or=(e,t,i,n)=>{const o=cr(t.styleManager,i[0]);if(!o)return;const r=(i,s)=>{s>=o.orderBy.length?rr(e,t,i,n):br(o.orderBy[s],i,e,t).forEach((e=>r(e,s+1)))};r(i,0)},rr=(e,t,i,n)=>{i.sort(((e,t)=>e.tile.zoomLevel-t.tile.zoomLevel)),pr(t.styleManager,i,e,t).forEach((i=>sr(e,t,i,n)))},sr=(e,t,i,n)=>{gr(i,e,t).forEach((i=>ar(e,t,i,n)))},ar=(e,t,i,n)=>{var o;const r=i[0],s=function(e,t){const i=e.getStyle(t.attributes.styleId);if(!i)return;return i.layersById[t.attributes.layerId]}(t.styleManager,r);if(!s||"hidden"===(null===(o=null==s?void 0:s.style)||void 0===o?void 0:o.visibility))return;const a=s.selectedIdx;void 0!==a&&i.sort(((e,t)=>{var i,n;return Number(null!==(i=e.attributes.tileData[a])&&void 0!==i?i:0)-Number(null!==(n=t.attributes.tileData[a])&&void 0!==n?n:0)})),r.type===Cn.H.Custom?(n.useCustomLayerState(s),t.styleManager.callCustomLayerRender(r.attributes.layerId)):xr(i,e,t).forEach((i=>lr(e,t,i,n,s)))},lr=(e,t,i,n,o)=>{n.useProgram(i[0],o),wr(i,e,t).forEach((i=>{dr(e,t,i,n,o)}))},dr=(e,t,i,n,o)=>{n.useState(i[0],o),Sr(i,e,t).forEach((i=>{n.drawSymbol(i,o,e,t)}))};function cr(e,t){const i=e.getStyle(t.attributes.styleId);if(!i)return;const n=i.layersById[t.attributes.layerId];if(!n)return;if(void 0===n.groupId)return;const o=i.groupsById[n.groupId];if(!o||"group"===o.type)return o;(0,Jo.cM)(`Expecting layer with type 'group' but got '${o.type}'`)}const ur=(e,t)=>Number(e)-Number(t),hr=e=>(t,i,n)=>{const o={};for(let r=0;r<t.length;r++){const s=t[r],a=e(s,i,n),l=o[a];void 0===l?o[a]=[s]:l.push(s)}const r=Object.keys(o);r.sort(ur);const s=[];for(let e=0;e<r.length;e++)s.push(o[r[e]]);return s},mr=e=>(t,i,n)=>{const o=new Map;for(let r=0;r<t.length;r++){const s=t[r],a=e(s,i,n);o.has(a)?o.get(a).push(s):o.set(a,[s])}return o},fr=e=>{const t=[],i={globeTile:null,children:[]},n=[];for(const i of e)i.type!==Cn.H.Custom&&("globe"===i.tile.purpose?n.push({globeTile:i.tile,children:[]}):t.push(i));for(const e of t)if(e.layerSettings.is3dMapAware)i.children.push(e);else for(const t of n)t.globeTile&&(0,Y.S3)(t.globeTile.coords,e.tile.coords)&&t.children.push(e);return n.push(i),n},_r=hr((e=>{const{styleId:t}=e.attributes;return t===J.jf?1:-t})),pr=(e,t,i,n)=>hr((t=>((e,t,i)=>{const n=e.getStyle(t);if(!n)return(0,Jo.cM)(`Cannot get style with id=${t} for renderIndex`),NaN;const o=n.layersById[i];return o?o.groupIndex||0:NaN})(e,t.attributes.styleId,t.attributes.layerId)))(t,i,n),vr=(e,t,i,n)=>hr((t=>((e,t,i)=>{const n=e.getStyle(t);if(!n)return(0,Jo.cM)(`Cannot get style with id=${t} for renderIndex`),NaN;const o=n.layersById[i];return o?o.renderIndex:NaN})(e,t.attributes.styleId,t.attributes.layerId)))(t,i,n),gr=hr((e=>e.type===Cn.H.Custom?0:e.layerSettings.subRenderIndex||0)),yr=(e,t)=>{const i=new Set;e.forEach((e=>{if(e.type===Cn.H.Custom)return;const n=e.layerSettings.programName;i.has(e.layerSettings.programName)||(i.add(n),t.setProgramBinder(e))}))},br=(e,t,i,n)=>hr(((t,i)=>{const n=(0,te.jJ)(i.styleZoom,i.styleState,t.attributes.tileData);return(0,te.vn)(e,n,0)}))(t,i,n),xr=mr((e=>{var t;return(null===(t=e.shaderDefinitions)||void 0===t?void 0:t.hash)?e.layerSettings.programName+"_"+e.shaderDefinitions.hash:e.layerSettings.programName})),wr=mr((e=>e.layerSettings.stateBinder)),Sr=mr((e=>e.sink+"_"+e.attributesHash+"_"+e.tile.readiness)),Mr=hr((e=>e.tile.zoomLevel));function Ir(e,t,i){for(const n of e)n.type!==Cn.H.Custom&&(n.canRender=Tr(n,i,t));return e.filter((e=>e.canRender))}function Tr(e,t,i){var n;if(!e.layerSettings.cullMethod)return!0;const o=t.styleManager.getStyleLayerForObject(e);return!(!o||"hidden"===(null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.visibility))&&!!e.layerSettings.cullMethod(e,t,i,o)}const Er=[0,0,0,0],Pr=(e,t,i,n,o,r)=>{const s={terrain3d:!!o,noEffects:!!r,drawSymbol:(e,t,i,n)=>{const o=e[0];if(o)if(!function(e){return"mapMesh"===e.symbol||"gltfModel"===e.symbol&&void 0!==e.attributes.meshTier}(o)||"overpass"!==t.type&&"tunnel"!==t.type&&"gltfModel"!==t.type||o.layerSettings.shadow)Ar(e,t,i,n,s);else{let r;"gltfModel"===t.type&&(r=Er),s.renderTierTexture(o,t,!1,r),s.useProgram(o,t),s.useState(o),Ar(e,t,i,n,s),i.hiddenImmersiveRoutesEnabled&&!o.layerSettings.identify&&"gltfModel"!==t.type&&(s.renderTierTexture(o,t,!0),s.useProgram(o,t),n.renderer.applyGpuState(lo,t),Ar(e,t,i,n,s))}},useProgram:(i,n)=>{const{layerBinder:s,programName:a,programBinder:l,commonBinder:d}=i.layerSettings,c=t.renderer.getShaderProgram(a,i.shaderDefinitions);t.renderer.enableShaderProgram(c),d&&!t.renderer.isUboSupported()&&d(c,e,t),null==l||l(c,e,t,o,r),null==s||s(c,e,t,n,r)},setProgramBinder:i=>{const n=i.layerSettings.programBinder,s=t.renderer.isUboSupported()?void 0:i.layerSettings.commonBinder;if(i.layerSettings.programBinder||s){const a=t.renderer.getShaderProgram(i.layerSettings.programName,i.shaderDefinitions);t.renderer.enableShaderProgram(a),null==s||s(a,e,t),null==n||n(a,e,t,o,r)}},useState:(e,i)=>{t.renderer.applyGpuState(e.layerSettings.stateBinder,i)},useCustomLayerState:e=>{t.renderer.applyGpuState(Lo,e)},useGlobeTile:i=>{const n=t.renderer.getGlobeRenderTarget((0,L.YG)(e.zoom,i));n&&t.renderer.setRenderTarget(n)},useCanvas:()=>{t.renderer.setRenderTarget(n)},renderTierTexture:(o,r,a,l)=>{const{viewport:d,size:c}=e,u=window.devicePixelRatio,h=!!o.layerSettings.identify,m=h?t.renderer.getMapMeshIdFramebufferId():t.renderer.getMapMeshFramebufferId(),f=t.renderer.getFramebuffer(m);if(!f)return;const _=Pr(e,t,void 0,n,!1,!0);if(t.renderer.disableTexture(0),t.renderer.bindRenderTarget(f.renderTarget),t.renderer.setViewport(0,0,f.renderTarget.options.size[0],f.renderTarget.options.size[1]),a){const e=h?iu:Er;t.renderer.clearWithColor(e,!0,-1)}else if(h)t.renderer.clearWithColor(iu,!0);else{const i=(0,te.jJ)(e.styleZoom,e.styleState,o.attributes.tileData),n=null!=l?l:(0,te.zn)(r.style.color,i).value;t.renderer.clearWithColor([n[0]/255,n[1]/255,n[2]/255,n[3]/255],!0)}const p=o.attributes.meshTier,v=null==i?void 0:i[p];if(v){v.tileObjects.forEach((e=>{var i,n;e.updateMvpMatrix(null!==(n=null===(i=f.getViewProjectionMatrix)||void 0===i?void 0:i.call(f))&&void 0!==n?n:t.camera.viewProjectionMatrix,void 0)}));const i=a?v.objects.filter((e=>{var i;if(e.type!==Cn.H.Custom){if(e.layerSettings.stateBinder(t).depthTest&&!e.layerSettings.isOverlappedObject)return!0;const n=t.styleManager.getStyleLayer(e.attributes.styleId,e.attributes.layerId);if(n)return!0===(null===(i=n.gpuState)||void 0===i?void 0:i.depthTest)}return!1})):v.objects,n=Ir(i,e,t);ir(e,t,n,_),v.tileObjects.forEach((e=>e.updateMvpMatrix(t.camera.viewProjectionMatrix))),yr(v.objects,s)}n?(t.renderer.bindRenderTarget(n),t.renderer.setViewport(0,0,n.options.size[0],n.options.size[1])):(t.renderer.bindRenderTarget(null),t.renderer.setViewport(d.left*u,d.bottom*u,c[0]*u,c[1]*u))},copy:(n,o,r)=>Pr(e,t,i,n,o,r)};return s},Ar=(e,t,i,n,o)=>{const r=e[0],s=r.layerSettings,a=n.renderer.getShaderProgram(s.programName,r.shaderDefinitions);s.objectBinder(a,i,n,r,t,o.terrain3d),r.layerSettings.zoomBinder?Mr(e,i,n).forEach((e=>{var s,l;a&&(null===(l=(s=r.layerSettings).zoomBinder)||void 0===l||l.call(s,a,i,n,e[0],t,o.terrain3d)),e.forEach((e=>Lr(e,n,a,i,o,t)))})):e.forEach((e=>Lr(e,n,a,i,o,t)))},Lr=(e,t,i,n,o,r)=>{var s;const{renderer:a}=t,l=e.tile;for(const d of l.modelMatrices.keys()){l.renderModelMatrix=l.modelMatrices.get(d),l.renderMvpMatrix=l.mvpMatrices.get(d),l.renderDemMatrix=l.demMatrices.get(d),l.renderFlatMapTexMatrix=l.flatMapTexMatrices.get(d);if(!e.layerSettings.tileBinder(i,n,t,e,r,o))continue;a.bindVao(e.vao);const{start:c,count:u,instanceCount:h}=e,m=null!==(s=e.drawMode)&&void 0!==s?s:G.Fg,f=e.vao.getElementsGLType();if(null!==f?h?a.drawInstancedElements(m,u,f,c,h):a.drawElements(m,u,f,c):h?a.drawInstancedArrays(m,c,u,h):a.drawArrays(m,c,u),n.collectStats){n.stats.drawCount++,n.stats.vertexCount+=(null!=h?h:1)*u,n.stats.drawCountBySymbol[e.symbol]?n.stats.drawCountBySymbol[e.symbol]++:n.stats.drawCountBySymbol[e.symbol]=1;const t=a.triangleCountByDrawMode(m,u);n.stats.triangleCount+=(null!=h?h:1)*t}}};const Cr=ae.Ue(),zr=ae.Ue(),kr=it.Ue(),Or=ae.Ue(),Rr=ae.al(0,0,1),Fr=ae.Ue(),Br=[1,1,1,1],Dr=(0,z.HW)();class jr{constructor(e,t){this.clipToShadowMatrix=new Float32Array(16),this.baseBias=T.defaultShadowsSettings.bias,this.bias=0,this.shadowMapParams=new Float32Array([T.defaultShadowsSettings.textureSize[0],T.defaultShadowsSettings.textureSize[1],T.defaultShadowsSettings.shadowRadius,1]),this.volumeMultiplier=2.5,this.volumeMinSize=25e3,this.discreteVolume=!1,this.volumeSizeStep=Math.pow(2,15),this.adaptiveVerticalSize=!0,this.debugDraw=!1,this.shadowMatrix=new Float64Array(16),this.orthoMath=new Float64Array(16),this.renderTarget=null,this.copyProgram=null,this.debugVao=null,this.debugSize=400,this.shadowLightDir=null,this.modules=t,this.mapState=e}get texture(){if(!this.renderTarget)return null;const e=this.renderTarget.getDepthAttachment();return e instanceof nt?e:this.renderTarget.getTexture()}setShadowResolution(e,t){this.shadowMapParams[0]=e,this.shadowMapParams[1]=t,this.renderTarget&&this.renderTarget.setSize([e,t])}update(){if(mt())return;this.shadowLightDir=null;const{handyStyleId:e}=this.mapState,t=this.modules.styleManager.getStyle(e),i=this.modules.map.state.demMode;if(!t||!t.light.lightingModesResolved||i)return void(this.renderTarget&&this.renderTarget.remove());const n=t.light.lightingModesResolved;for(const e in n){const t=n[e];if(0===t.shadowLightIndex){this.shadowLightDir=t.dir1Direction,this.shadowMapParams[2]=t.shadowRadius;break}if(1===t.shadowLightIndex){this.shadowLightDir=t.dir2Direction,this.shadowMapParams[2]=t.shadowRadius;break}}const o=this.shadowLightDir&&!this.modules.map.getFeatureFlag("shadowsOff");if(o?this.renderTarget||(this.renderTarget=this.createRenderTarget()):this.renderTarget&&this.renderTarget.remove(),!o||!this.shadowLightDir||!this.renderTarget)return;if(this.modules.renderCacheManager.hasReadyCache())return;const r=this.modules.map.state.center,s=this.modules.camera.position[2];let a=Math.max(this.volumeMultiplier*s);this.discreteVolume&&(a-=a%this.volumeSizeStep),a=Math.max(a,this.volumeMinSize);let l=this.baseBias;this.modules.renderer.isShadowSamplerSupported()&&(l*=.5),this.shadowMapParams[3]=l/a,this.bias=5e-8*l*Math.sqrt(a),this.bias=Math.min(this.bias,.01);let d=1;if(this.adaptiveVerticalSize){const e=Math.abs(ae.AK(this.shadowLightDir,Rr));d=Math.max(e,.3)}const c=a,u=d*a,h=3*a;it.M5(this.orthoMath,-c,c,-u,u,-h,h);const m=ae.al(this.shadowLightDir[1],-this.shadowLightDir[0],0);ae.Fv(m,m),ae.kC(Or,m,this.shadowLightDir);const f=kr;it.zB(f,Fr,this.shadowLightDir,Or);const _=ae.fF(Cr,r,f),p=2*c/this.shadowMapParams[0],v=2*u/this.shadowMapParams[1],g=ae.al(_[0]-_[0]%p,_[1]-_[1]%v,_[2]),y=it.U_(f,f),b=ae.fF(zr,g,null!=y?y:it.yR(kr)),x=ae.IH(Cr,b,this.shadowLightDir);it.zB(this.shadowMatrix,b,x,Or),it.Jp(this.shadowMatrix,this.orthoMath,this.shadowMatrix);const w=this.modules.camera.viewProjectionMatrixInverse;it.Jp(this.clipToShadowMatrix,this.shadowMatrix,w)}drawShadowMap(e){if(!this.shadowLightDir||!this.renderTarget)return;if(this.modules.renderCacheManager.hasReadyCache())return;const t=this.modules.map.state.demMode,i=Pr(this.mapState,this.modules,void 0,this.renderTarget,t),n=new Set,o=[];for(const t of e)for(const e of t.shadowChildren){const i=this.modules.styleManager.getStyleLayerForObject(e);if(!i||!1===i.castShadows)continue;const r=mi(i,this.modules,this.mapState);r&&-1!==r.lightConfig.shadowLightIndex&&(o.push(e),n.add(t))}const r=t?this.modules.demManager.demTextureMatrix:void 0;n.forEach((e=>{e.updateMvpMatrix(this.shadowMatrix,r)})),this.modules.renderer.bindRenderTarget(this.renderTarget),this.modules.renderer.applyGpuState(zo),this.modules.renderer.clearWithColor(Br,!0),this.modules.renderer.setViewport(0,0,this.renderTarget.options.size[0],this.renderTarget.options.size[1]),er(this.mapState,this.modules,o,i),this.modules.renderer.bindRenderTarget(null)}drawDebugFbIfNeeded(){if(!this.debugDraw)return this.copyProgram&&(this.copyProgram=null),void(this.debugVao&&(this.debugVao.remove(),this.debugVao=null));if(!this.texture)return;if(!(this.copyProgram&&this.debugVao||(this.copyProgram||(this.copyProgram=this.createDebugProgram()),this.debugVao))){const e=this.modules.renderer.createBuffer(new Uint8Array([-1,-1,1,-1,1,1,-1,1]));this.debugVao=An(e,this.copyProgram)}const e=this.mapState.viewport,t=this.modules.renderer.getViewportSize(),i=this.debugSize;this.modules.renderer.bindRenderTarget(null),this.modules.renderer.setViewport(t[0]+e.left-i,e.bottom,i,i),this.modules.renderer.applyGpuState(vo),this.modules.renderer.enableShaderProgram(this.copyProgram),this.modules.renderer.bindShaderProgram(this.copyProgram,{u_texture:1}),this.modules.renderer.enableTexture(this.texture,1),this.modules.renderer.bindVao(this.debugVao),this.modules.renderer.drawTrianglesFan(0,4)}getMemoryFootprint(){var e,t;const i={renderTarget:null!==(t=null===(e=this.renderTarget)||void 0===e?void 0:e.memSizeGPU())&&void 0!==t?t:0};return{gpu:Object.assign(Object.assign({},i),{"--sum":(0,Ke.QE)(i)})}}createRenderTarget(){const e=[this.shadowMapParams[0],this.shadowMapParams[1]];return this.modules.renderer.isDepthTextureSupported()?new st({size:e,magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,depthTexture:!0,hasColorOutput:!1,compareFunc:nt.CompareRefToTexture}):new st({size:e,magFilter:nt.NearestFilter,minFilter:nt.NearestFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,flipY:!1,type:nt.UnsignedByte,useHighDepthPrecision:!0})}createDebugProgram(){const e=[];this.modules.renderer.isDepthTextureSupported()&&e.push({type:"IS_DEPTH_TEXTURE"});const t=wt.e.createShaderDefinitions(e);return this.modules.renderer.getShaderProgram("copy",t)}}var Nr,Ur,Hr=i(173);class Gr{constructor(e,t,i){this.output=e,this.input=t,this.modules=i,this.enabled=!0}}class Vr extends Gr{constructor(e,t,i,n){super(e,t,i),this.name=Nr.TAA,this.jitter=[0,0],this.numMixedFrames=0,this.samples=16,this.vao=null,this.buffer=n,this.jitterSequence=this.generateJitterSequence(this.samples)}onBeforeRender(e){if(this.jitter[0]=0,this.jitter[1]=0,e.aaMode!==Ur.TAA||e.globeMode||!this.canRender())return this.enabled=!1,void(this.numMixedFrames=0);if(this.numMixedFrames>=this.samples)return;this.modules.renderer.addRerenderEvent(),this.enabled=!0;const t=window.devicePixelRatio,i=e.size,n=this.jitterSequence[this.numMixedFrames];this.jitter[0]=n[0]/Math.ceil(i[0]*t),this.jitter[1]=n[1]/Math.ceil(i[1]*t)}render(){var e;const t=1/(this.numMixedFrames+1),i=this.modules.renderer.getShaderProgram("taa");this.vao||(this.vao=An(this.buffer,i)),this.modules.renderer.bindRenderTarget(this.output),this.modules.renderer.bindVao(this.vao);const n=null===(e=this.input)||void 0===e?void 0:e.getTexture();n&&this.modules.renderer.enableTexture(n,0),this.modules.renderer.enableShaderProgram(i),this.modules.renderer.bindShaderProgram(i,{u_texture:0,u_float_mix_coef:t}),this.modules.renderer.drawTrianglesFan(0,4),this.numMixedFrames++}onAfterRender(){}resize(e){this.output.setSize(e),this.numMixedFrames=0}isReady(e){return!(!(null==e?void 0:e.ignoreLayerAnimation)||!this.modules.map.core.hasActiveLayerAnimation())||this.numMixedFrames>=this.samples}canRender(){return!this.modules.renderer.isNeedRerender()}generateJitterSequence(e){const t=[],i=(0,Hr.R4)(e),n=i.base2,o=i.base3;t.push([0,0]);for(let e=0;e<n.length;++e)t.push([2*n[e]-1,2*o[e]-1]);return t}}class Zr extends Gr{constructor(e,t,i,n){super(e,t,i),this.name=Nr.FXAA,this.vao=null,this.buffer=n}onBeforeRender(e){this.enabled=e.aaMode===Ur.FXAA&&e.stillness>0}render(){var e;const t=null===(e=this.input)||void 0===e?void 0:e.getTexture();if(!t)throw new Error("FXAA: input texture is not available");this.modules.renderer.enableTexture(t,0);const i=this.modules.renderer.getShaderProgram("fxaa");if(this.vao||(this.vao=An(this.buffer,i)),this.modules.renderer.bindRenderTarget(this.output),this.modules.renderer.bindVao(this.vao),this.modules.renderer.enableShaderProgram(i),this.modules.renderer.bindShaderProgram(i,{u_texture:0}),!this.modules.renderer.isUboSupported()){const e=this.modules.map.state;Vt(i,e,this.modules)}this.modules.renderer.drawTrianglesFan(0,4)}onAfterRender(){}resize(e){this.output.setSize(e)}isReady(){return!0}}!function(e){e.TAA="TAA",e.FXAA="FXAA"}(Nr||(Nr={})),function(e){e[e.TAA=0]="TAA",e[e.FXAA=1]="FXAA"}(Ur||(Ur={}));class Wr{constructor(e,t){this.renderGraph=[],this.effectsByType={},this.copyColorVao=null,this.copyColorDepthVao=null,this.copyColorProgram=null,this.copyColorDepthProgram=null,this.state=e,this.modules=t,this.renderTargetSize=this.modules.renderer.getViewportSize();const i=t.renderer.webglContextState.MAX_TEXTURE_SIZE;if(Math.max(...this.renderTargetSize)>i)return void(0,Jo.cM)(`Disabling post-effects as viewport size ${this.renderTargetSize[0]}x${this.renderTargetSize[1]} exceeds hardware limits of ${i}x${i}`);const n=this.modules.renderer.createBuffer(new Uint8Array([-1,-1,1,-1,1,1,-1,1]));this.copyColorProgram=this.modules.renderer.getShaderProgram("copy"),this.copyColorDepthProgram=this.modules.renderer.getShaderProgram("copy",wt.e.createShaderDefinitions([{type:"COPY_DEPTH",value:"1"}])),this.copyColorVao=An(n,this.copyColorProgram),this.copyColorDepthVao=An(n,this.copyColorDepthProgram);const o=this.createRenderTarget(this.renderTargetSize,{useHighDepthPrecision:!0});this.mainFrameBufferWrapper={renderTarget:o,onResize:()=>{},clearColor:(0,te.m2)(e.defaultBackgroundColor),clearDepth:!0};const r=e.aaMode===Ur.TAA,s=e.aaMode===Ur.FXAA,a=r?Vr:s?Zr:null;if(a){const e=new a(this.createRenderTarget(this.renderTargetSize),o,t,n);this.effectsByType[r?Nr.TAA:Nr.FXAA]=e,this.renderGraph.push(e)}}update(){this.renderGraph.forEach((e=>e.onBeforeRender(this.state)))}render(){this.modules.renderer.applyGpuState(Co),this.renderGraph.forEach((e=>e.render()));const e=this.renderGraph[this.renderGraph.length-1].output;this.copyRenderTargetToCanvas(e),this.renderGraph.forEach((e=>e.onAfterRender(this.state)))}invalidateSize(){this.mainFrameBufferWrapper&&(this.renderTargetSize=this.modules.renderer.getViewportSize(),this.mainFrameBufferWrapper.renderTarget.setSize(this.renderTargetSize),this.renderGraph.forEach((e=>e.resize(this.renderTargetSize))))}getEffectByName(e){return this.effectsByType[e]}setClearColor(e){this.mainFrameBufferWrapper&&(this.mainFrameBufferWrapper.clearColor=(0,te.m2)(e))}hasActiveEffects(){if(!this.modules.postEffectsManager.mainFrameBufferWrapper)return!1;for(const e of this.renderGraph)if(e.enabled)return!0;return!1}isReady(e=!1){for(const t of this.renderGraph)if(!t.isReady({ignoreLayerAnimation:e}))return!1;return!0}getMemoryFootprint(){var e,t;const i={mainFrameBufferWrapper:{renderTarget:null!==(t=null===(e=this.mainFrameBufferWrapper)||void 0===e?void 0:e.renderTarget.memSizeGPU())&&void 0!==t?t:0}};return{gpu:Object.assign(Object.assign({},i),{"--sum":(0,Ke.QE)(i)})}}copyRenderTargetToCanvas(e,t=!1,i=!0){if(!(this.copyColorVao&&this.copyColorProgram&&this.copyColorDepthVao&&this.copyColorDepthProgram))return void(0,Jo.cM)("PostEffectsManager: copyRenderTargetToCanvas called without vao or copyProgram");const{viewport:n}=this.state,o=window.devicePixelRatio,r=this.modules.renderer.getViewportSize();this.modules.renderer.bindRenderTarget(null),this.modules.renderer.setViewport(n.left*o,n.bottom*o,r[0],r[1]),i&&this.modules.renderer.clear(!1);const s=t?this.copyColorDepthProgram:this.copyColorProgram,a=t?this.copyColorDepthVao:this.copyColorVao;this.modules.renderer.bindVao(a);const l=e.getTexture();if(l&&this.modules.renderer.enableTexture(l,0),this.modules.renderer.enableShaderProgram(s),this.modules.renderer.bindShaderProgram(s,{u_texture:0}),t){const t=e.getDepthAttachment();t instanceof nt&&(this.modules.renderer.enableTexture(t,1),this.modules.renderer.bindShaderProgram(s,{u_depth:1}))}this.modules.renderer.drawTrianglesFan(0,4),this.modules.renderer.disableTexture(0),this.modules.renderer.disableTexture(1)}createRenderTarget(e,t){return new st(Object.assign({minFilter:nt.NearestFilter,magFilter:nt.NearestFilter,size:e},t))}}const Xr=[0,0];function Kr(...e){return(t,i,n,o,r)=>{e.forEach((e=>e(t,i,n,o,r)))}}const $r=(e,t,i,n)=>{var o,r,s;if(!n)return void Yr(e,t,i);const a=null===(o=i.renderer.getFramebuffer(i.demManager.getDemFramebufferId()))||void 0===o?void 0:o.renderTarget.getTexture(),l=null===(r=i.renderer.getFramebuffer(i.demManager.getCorrectedDemFramebufferId()))||void 0===r?void 0:r.renderTarget.getTexture(),d=i.imageManager.getTexture(i.demManager.getHillshadeRampTextureId()),c=null==a?void 0:a.options.size,u=i.styleManager.getStyle(t.handyStyleId);if(!(a&&l&&d&&u&&c))return void Yr(e,t,i);const h=(0,te.jJ)(t.styleZoom,t.styleState,[],!1),m=(0,te.vn)(u.dem.style.shadingIntensity,h),f=i.demManager.getElevationSourceType(),_=L.A5/(Math.pow(2,Math.min(Math.trunc(t.styleZoom),"regular"===f?Go:Vo))*Ho);i.renderer.enableTexture(a,Do),i.renderer.enableTexture(d,No),i.renderer.enableTexture(l,Uo);const p=i.demManager.demCorrectedScale;i.renderer.bindShaderProgram(e,{u_float_dem_resolution:c[0],u_float_dem_cell_size:_,u_float_dem_shading_intensity:m,u_tex_dem:Do,u_tex_corrected_dem:Uo,u_tex_hillshade_ramp:No,u_float_corrected_interval:i.demManager.isDemCorrectionEnabled&&1!==p?.5/p:0,u_mat4_dem_corrected:i.demManager.demTexToCorrectedTex,u_float_map_center_elevation:null!==(s=t.elevation)&&void 0!==s?s:0})},qr=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_float_dem_shading_intensity:0})},Yr=(e,t,i)=>{i.renderer.bindShaderProgram(e,{u_float_dem_scale:0})},Jr=$r,Qr=Kr(ti,Jt),es=qt,ts=Kr(Yt,Jt,ti,ri,$r),is=Kr(Yt,Jt,((e,t,i)=>{i.renderer.bindShaderProgram(e,{u_float_identify_opacity:t.iconIdentifyOpacity})}),$r),ns=Kr(ti,Jt,ri,$r),os=qt,rs=(e,t,i,n,o)=>{const r=i.postEffectsManager.getEffectByName(Nr.TAA),s=!o&&(null==r?void 0:r.jitter)?r.jitter:Xr;i.renderer.bindShaderProgram(e,{u_vec2_camera_jitter:s})},ss=(e,t,i)=>{const n=i.shadowManager.texture;n&&(i.renderer.enableTexture(n,Dr),i.renderer.bindShaderProgram(e,{u_texture_shadow:Dr}))},as=(e,t,i)=>{if(!i.benchmark)return;const n=it.Ue(),o=i.benchmark.getScale();i.renderer.bindShaderProgram(e,{u_mat4_mvp:it.bA(n,n,o),u_vec3_transform:ae.al(0,0,0)})},ls=Kr($r,rs,ss),ds=Kr(rs,ss),cs=Kr($r,rs,ss),us=qt,hs=Kr($r,rs,ss),ms=Kr(rs,ss),fs=Kr($r,rs,ss),_s=Kr($r,ss),ps=Kr($r,rs,ss),vs=Kr(qt,ni,oi),gs=Kr(qt,ni,oi,ss),ys=Kr($r,gs),bs=Kr($r,vs),xs=ss,ws=Kr($r,rs,ss),Ss=Kr(rs,ss),Ms=Kr(rs,ss),Is=Kr($r,Ms);var Ts=i(7840),Es=i(3024),Ps=i(5589);const As=e=>{e&&Object.entries(e).forEach((([t,i])=>{void 0===i&&delete e[t]}))},Ls=e=>{var t;As(e),"group"===e.type?(As(e.commonDefaults),As(null===(t=e.commonDefaults)||void 0===t?void 0:t.style),As(e.layerTypeDefaults),e.layerTypeDefaults&&Object.values(e.layerTypeDefaults).forEach((e=>{As(e),As(null==e?void 0:e.style)}))):"custom"!==e.type&&As(e.style)},Cs=(e,t=!1)=>{t||console.warn("assertUnreachable: ",e)},zs=new Float32Array(2),ks=new Float32Array(2),Os=[0,0],Rs=[0,0,0,0],Fs=.01,Bs=(e,t,{renderer:i})=>{i.bindShaderProgram(e,{u_float_opacity:1})},Ds=(e,t,{renderer:i},n,o)=>{const r=pa(t,n),s=(0,te.vn)(o.style.textureOpacity,r);i.bindShaderProgram(e,{u_float_texture_opacity:n.tile.readiness*s})},js=(e,t,{renderer:i},n)=>{if(!n.renderingProperties.color)return;const o=(0,te.m2)(n.renderingProperties.color);Yn.bA(o,o,n.tile.readiness),i.bindShaderProgram(e,{u_vec4_color:o})},Ns=(e,t,{renderer:i},n)=>{var o;if(!n.renderingProperties.mixColor)return;if(t.demMode)return;const{color2:r,factor:s}=n.renderingProperties.mixColor,a=(0,te.m2)(r);switch(Yn.bA(a,a,n.tile.readiness),s.type){case"readFromTarget":{const t=null===(o=i.getDrawTargetFramebuffer(s.name))||void 0===o?void 0:o.renderTarget.getTexture();if(!t)return;i.enableTexture(t,2),i.bindShaderProgram(e,{u_vec4_color2:a,u_sr2d_read_from_target_texture:2});break}case"vertexAttribute":i.bindShaderProgram(e,{u_vec4_color2:a});break;default:{const{type:e}=s;Cs(e)}}},Us=(e,t,{renderer:i},n)=>{i.bindShaderProgram(e,{u_mat4_gradient:n.renderingProperties.mat4_gradient})},Hs=(e,t,{renderer:i},n,o)=>{const r=(0,te.m2)((0,te.zn)(o.style.strokeColor,pa(t,n)));Yn.bA(r,r,n.tile.readiness),i.bindShaderProgram(e,{u_vec4_border_color:r})},Gs=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.widthResolved||0;i.bindShaderProgram(e,{u_float_width:o*window.devicePixelRatio})},Vs=(e,t,{renderer:i},n,o)=>{i.bindShaderProgram(e,{u_float_shift:(0,te.vn)(o.style.shift,pa(t,n))*window.devicePixelRatio})},Zs=(e,t,{renderer:i},n,o)=>{const r=n.renderingProperties.opacityResolved||0,s=(0,te.jJ)(t.styleZoom,t.styleState,n.attributes.tileData,!1),a=o.style.iconOpacity,l=(0,te.vn)(a,s);s.isBehind=!0;const d="light"===t.styleState.graphicsPreset?1:(0,te.vn)(a,s);i.bindShaderProgram(e,{u_vec2_opacity:[r*l,r*d]})},Ws=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.opacityResolved||0;i.bindShaderProgram(e,{u_float_opacity:o})},Xs=(e,t,{renderer:i},n,o)=>{const r=(0,te.vn)(o.style.iconRotation,pa(t,n));i.bindShaderProgram(e,{u_vec2_rotation:[Math.cos(r),Math.sin(r)]})},Ks=(e,t,{renderer:i},n,o)=>{const r=(0,te.vn)(o.style.opacity,pa(t,n));i.bindShaderProgram(e,{u_float_opacity:n.tile.readiness*r})},$s=(e,t,{renderer:i},n,o)=>{const r=(0,te.vn)(o.style.opacity,pa(t,n));i.bindShaderProgram(e,{u_float_opacity:r})},qs=(e,t,{assetManager:i,renderer:n},o)=>{const r=i.textures[o.attributes.atlasIndex];n.enableTexture(r,0)},Ys=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.fontTexture;o&&i.enableTexture(o,0)},Js=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.texture;o&&i.enableTexture(o,0)},Qs=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.rampTexture;o&&(i.enableTexture(o,1),i.bindShaderProgram(e,{u_sr2d_ramp_texture:1}))},ea=(e,t,{renderer:i},n,o)=>{const{tile:r}=n,s=(0,te.zn)(o.style.gapColor,pa(t,n));if(!s)return;const a=(0,te.m2)((0,te.zn)(s,pa(t,n)));Yn.bA(a,a,r.readiness),i.bindShaderProgram(e,{u_vec4_space_color:a})},ta=(e,t,{renderer:i},n,o)=>{const{styleZoom:r}=t,s=pa(t,n),{tile:a}=n,l=(0,te.m2)((0,te.zn)(o.style.color,s));Yn.bA(l,l,a.readiness),s.styleZoom=Math.floor(r);const d=Math.pow(2,(0,we.vO)(r)),c=(0,te.vn)(o.style.dashLength,s)*d,u=(0,te.vn)(o.style.gapLength,s)*d;i.bindShaderProgram(e,{u_vec4_dash_color:l,u_vec2_scaler_params:[0,G.ax],u_float_dash_length:(0,L.Qn)(c,a.size),u_float_dash2_length:(0,L.Qn)(c,a.size),u_float_space_length:(0,L.Qn)(u,a.size)})},ia=Yn.Ue(),na=(e,t,{renderer:i},n,o)=>{const r=pa(t,n),{tile:s}=n,{pattern:a,width:l}=n.renderingProperties;if(!a||!l)return;const d=(0,te.m2)((0,te.zn)(o.style.color,r));switch(Yn.bA(d,d,s.readiness),a[0]){case Es.y.Chess:{const e=a[1];ia[0]=e,ia[1]=.5,ia[2]=.25,ia[3]=-.25;break}case Es.y.DoubleDash:{const e=a[1];ia[0]=e,ia[1]=a[2]/l,ia[2]=.5*a[3]/e,ia[3]=.5*a[4]/e,ia[2]>=.5-Number.EPSILON&&(ia[2]=.6),ia[3]>=.5-Number.EPSILON&&(ia[3]=.6);break}case Es.y.Stripe:{const e=a[1]+a[2];ia[0]=e,ia[1]=.55,ia[2]=.5*a[1]/e,ia[3]=.5*a[1]/e,ia[2]>=.5-Number.EPSILON&&(ia[2]=.6),ia[3]>=.5-Number.EPSILON&&(ia[3]=.6);break}case Es.y.Circle:{const e=a[1]+a[2];ia[0]=e,ia[1]=.5*a[1]/e;break}case Es.y.Triangles:{const e=a[1]+a[2];ia[0]=e,ia[1]=a[1]/e,ia[2]="right"===String(a[3])?-1:1;break}case Es.y.Chevron:{const e=a[1]+a[2];ia[0]=e,ia[1]=a[1]/e,ia[2]=a[3]/e,ia[3]=a[4]/l;break}}i.bindShaderProgram(e,{u_vec4_color:d,u_int_pattern_type:a[0],u_vec4_pattern_params:ia})},oa=(e,t,{renderer:i},n,o)=>{const r=pa(t,n),s=(0,te.vn)(o.style.tipWidth,r),a=(0,te.vn)(o.style.tipHeight,r),l=s;zs[0]=-l,zs[1]=-0,O.Fv(zs,zs),ks[0]=s,ks[1]=a,O.Fv(ks,ks);const d=(0,te.vn)(o.style.roundingRadius,r);i.bindShaderProgram(e,{u_vec2_wing_normal:zs,u_vec2_tip_normal:ks,u_float_tip_height_multiplier:a,u_float_wing_height_multiplier:0,u_float_wing_width_multiplier:l,u_float_size_factor:(0,L.Qn)(G.gt,n.tile.size)/2,u_float_tip_radius_zpt:d,u_float_wing_radius_zpt:d,u_float_tail_radius_zpt:d})},ra=(e,t,{renderer:i},n,o)=>{const r=pa(t,n),s=(0,te.vn)(o.style.lineLength,r),a=(0,te.vn)(o.style.lineWidth,r);i.bindShaderProgram(e,{u_float_length:s,u_float_width:a,u_float_border_width:0})},sa=(e,t,{renderer:i},n,o)=>{const r=pa(t,n),{tile:s,attributes:a}=n,l=a.isLongArrow,d=n.tile.dynamicObject;let c=0,u=1;d&&(l?u=d.growPosition:c=d.bouncePosition);let h=0;const m=o.style.animation.type;"appearance"!==m&&"repeat"!==m||(h=(0,te.vn)(o.style.animation.tipMovementAmplitude,r));const f=(0,te.vn)(o.style.roundingRadius,r);i.bindShaderProgram(e,{u_float_width_zpt:(0,te.vn)(o.style.lineWidth,r),u_float_border_width_zpt:(0,te.vn)(o.style.strokeWidth,r),u_float_tip_movement_amplitude:(0,L.Qn)(h,s.size),u_float_vertex_shift:c,u_float_relative_end_position:u,u_float_tip_radius_zpt:f,u_float_wing_radius_zpt:f,u_float_tail_radius_zpt:f})},aa=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.modelTexture;o&&i.enableTexture(o,0)},la=(e,t,{renderer:i},n)=>{var o,r;return i.bindShaderProgram(e,{u_int_gltf_dem_pos:n.attributes.demPosition,u_vec2_anchor:null!==(o=n.attributes.centroid)&&void 0!==o?o:Os,u_vec4_axis:null!==(r=n.attributes.axis)&&void 0!==r?r:Rs}),!0},da=(e,t,{assetManager:i,renderer:n},o)=>{const{styleId:r}=o.attributes,{renderingProperties:s}=o,{resolvedColorTexture:a,resolvedAoTexture:l,resolvedPbrTexture:d,resolvedMetallic:c,resolvedRoughness:u}=s,{modelId:h}=s,m=i.getModel(null!=h?h:NaN,r);if(!m)return;const f={},_=void 0!==a&&m.textures[a];_&&(n.enableTexture(_,0),f.u_sr2d_texture_0=0);const p=void 0!==l&&m.textures[l];p&&(n.enableTexture(p,1),f.u_ao_texture=1);const v=void 0!==d&&m.textures[d];v?(n.enableTexture(v,z.NR),f.u_pbr_texture=z.NR):(f.u_float_metallic=c,f.u_float_roughness=u),n.bindShaderProgram(e,f)},ca=(e,t,i,n,o)=>{const{renderer:r}=i,s=r.getGlobeRenderTarget((0,L.YG)(t.zoom,n.tile)).getTexture();return!!s&&(r.enableTexture(s,ou),r.bindShaderProgram(e,{u_sr2d_flatmap_texture:ou}),!0)},ua=(e,t,{renderer:i},n,o)=>{let r=n.renderingProperties.resolvedHeightFactor||0;r=Fs+.99*r,i.bindShaderProgram(e,{u_float_height_factor:r})},ha=(e,t,{renderer:i},n,o)=>{i.bindShaderProgram(e,{u_int_extention_to_relief_needed:n.attributes.extToReliefNeeded?1:0})},ma=(e,t,{modelLayer:i,renderer:n},o,r)=>{if(void 0===o.attributes.id)return;const s=i.getOpacity(o.attributes.id,r.minzoom),a=1===i.getBuildingHeight(o.attributes.id)?1:s;n.bindShaderProgram(e,{u_float_height_factor:a})},fa=(e,t,{renderer:i},n,o)=>{const r=pa(t,n),s=(0,te.vn)(o.style.height,r);i.bindShaderProgram(e,{u_float_height_factor:(0,Y.VW)(s)})},_a=(e,t,i,n,o)=>{const{floorManager:r,buildingHeightAnimator:s,modelsScene:a,modelLayer:l,renderer:d}=i;if("polygonExtrusion"===n.symbol&&n.attributes.floorId&&n.attributes.isFloorStack)return void d.bindShaderProgram(e,{u_float_height_factor:r.getFloorStackObjectHeight(n.attributes.floorId)});let c=s.getBuildingHeight(o.minzoom);c=Fs+.99*c;const u=a.objectIdToKey(n.id);u&&l.setBuildingHeight(u,c),d.bindShaderProgram(e,{u_float_height_factor:c})};function pa(e,t){return(0,te.jJ)(e.styleZoom,e.styleState,t.attributes.tileData,!1,t.tile.dynamicObject)}const va=(e,t,{renderer:i},n)=>{const{tile:o}=n,r=n.renderingProperties.widthResolved||0;i.bindShaderProgram(e,{u_float_width:(0,L.Qn)(r,o.size)/2*G.gt,u_float_width_offset:(0,L.Qn)(G.gt/window.devicePixelRatio,o.size)/2})},ga=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.resolvedRadius;i.bindShaderProgram(e,{u_float_radius:o*window.devicePixelRatio})},ya=(e,t,{renderer:i},n,o)=>{const r=(0,te.vn)(o.style.intensity,pa(t,n));i.bindShaderProgram(e,{u_float_intensity:r})},ba=(e,t,{renderer:i},n,o)=>{const r=pa(t,n);let s=(0,te.vn)(o.style.textFontSize,r);if("point"===n.symbol){const e=n.attributes.labelIndex;e===Ts.bR.Second&&o.style.textFontSize2?s=(0,te.vn)(o.style.textFontSize2,r):e===Ts.bR.Icon&&o.style.iconTextFontSize&&(s=(0,te.vn)(o.style.iconTextFontSize,r))}i.bindShaderProgram(e,{u_float_scale:s*window.devicePixelRatio/T.fonts.baseSize})},xa=(e,t,{renderer:i},n,o)=>{const r=(0,te.jJ)(t.styleZoom,t.styleState,n.attributes.tileData,Boolean(n.layerSettings.isOverlappedObject)),{textFontSize:s,textColor:a,textHaloWidth:l,textHaloColor:d}=o.style,c=(0,te.vn)(s,r)/T.fonts.baseSize,u=c*window.devicePixelRatio,h=T.fonts.gamma/u,m=n.layerSettings.uniformSet,f="fontHalo"===m?(6-(0,te.vn)(l,r)/c)/8:.75;let _;_="fontHalo"===m?(0,te.m2)((0,te.zn)(d,r)):(0,te.m2)((0,te.zn)(a,r)),i.bindShaderProgram(e,{u_float_buffer:f,u_float_gamma:h,u_vec4_color:_})},wa=(e,t,{renderer:i},n,o)=>{const{layerSettings:r}=n,{uniformSet:s}=r,a=n.attributes.labelIndex,l=o.style;let{textFontSize:d,textHaloWidth:c,textColor:u,textHaloColor:h}=l;switch(a){case Ts.bR.Icon:d=l.iconTextFontSize,c=l.iconTextHaloWidth,u=l.iconTextColor,h=l.iconTextHaloColor;break;case Ts.bR.Second:d=l.textFontSize2,c=l.textHaloWidth2,u=l.textColor2,h=l.textHaloColor2}Sa(e,i,t,n,d,u,c,h,a,s)},Sa=(e,t,i,n,o,r,s,a,l,d)=>{const c=(0,te.jJ)(i.styleZoom,i.styleState,n.attributes.tileData,!1,n.tile.dynamicObject),u=(0,te.vn)(o,c)/T.fonts.baseSize,h=u*window.devicePixelRatio,m=T.fonts.gamma/h,f="fontHalo"===d?(6-(0,te.vn)(s,c)/u)/8:.75;let _,p;"fontHalo"===d?(_=(0,te.m2)((0,te.zn)(a,c)),c.isBehind=!0,p=(0,te.m2)((0,te.zn)(a,c))):(_=(0,te.m2)((0,te.zn)(r,c)),c.isBehind=!0,p=(0,te.m2)((0,te.zn)(r,c))),t.bindShaderProgram(e,{u_float_buffer:f,u_float_gamma:m,u_vec4_color:_,u_vec4_hidden_color:p,u_float_label_index:l})},Ma=(e,t,{renderer:i},n)=>{const{attributes:o}=n,{offsetX:r,offsetY:s}=o,a=window.devicePixelRatio;i.bindShaderProgram(e,{u_vec2_offset:[r*a,s*a]})},Ia=(e,t,{renderer:i})=>{i.bindShaderProgram(e,{u_float_style_zoom:t.styleZoom})},Ta=(e,t,{renderer:i},n)=>{const{tile:o}=n,{zoom:r}=t,s=G.y4*Math.pow(2,r-o.zoomLevel)*window.devicePixelRatio;i.bindShaderProgram(e,{u_float_tile_to_pixel_ratio:G.gt/s})},Ea=(e,t,{renderer:i},n,o)=>{const{tile:r}=n,{zoom:s,styleZoom:a}=t,l=o.style.lengthUnits===ai.vR.Meters,d=(0,Y.iq)((0,Y.Bs)(r.coords),[G.Bq/2,G.Bq/2]),c=G.gt/(G.y4*Math.pow(2,s-r.zoomLevel)*window.devicePixelRatio),u=l?a:Math.floor(a),h=G.y4*Math.pow(2,u-r.zoomLevel)*window.devicePixelRatio/(G.gt*d);i.bindShaderProgram(e,{u_vec2_scales:[h,c]})},Pa=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.flatTexture;o&&i.enableTexture(o,0),i.bindShaderProgram(e,{u_flat_tex:0})},Aa=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.flatIdentifyTexture;o&&i.enableTexture(o,0),i.bindShaderProgram(e,{u_flat_tex:0})},La=(e,t,{renderer:i},n)=>{const o=n.renderingProperties.hillshadeTexture;o&&(i.enableTexture(o,jo),i.bindShaderProgram(e,{u_hillshade_tex:jo}))},Ca=(e,t,{renderer:i,map:n})=>{const o="regular"===n.modules.demManager.getElevationSourceType()?1:Number(!n.state.disableFlatDemIrregularMeshNormals);return i.bindShaderProgram(e,{u_use_flat_dem_mesh_normals:o}),!0},za=(e,t,i,n)=>{const{renderer:o,demManager:r}=i,s=n.renderingProperties.demTexture;s&&(o.enableTexture(s,0),o.bindShaderProgram(e,{u_tex_dem:0,u_mat4_dem_corrected:r.demCorrectedFbVpToDemTex}))},ka=(e,t,{renderer:i},n,o)=>{let r=!0;t.globeMode||(r=Boolean((0,te.vn)(o.style.elevation,pa(t,n)))),i.bindShaderProgram(e,{u_bool_skip_height_factor:r})},Oa=(e,t,{buildingHeightAnimator:i,renderer:n},o,r)=>{let s=i.getBuildingHeight(r.minzoom);s=Fs+.99*s,n.bindShaderProgram(e,{u_float_height_factor:s})},Ra=(e,t,{renderer:i},n)=>{i.bindShaderProgram(e,{u_int_abs_z:n.attributes.absZ?1:0})},Fa=(e,t,{renderer:i})=>{i.bindShaderProgram(e,{u_int_abs_z:!1})},Ba=(e,t,{renderer:i},n)=>{i.bindShaderProgram(e,{u_float_tile_size:(0,Y.aq)(n.tile.zoomLevel)})},Da=(e,t,{renderer:i},n)=>{i.bindShaderProgram(e,{u_int_depth_test:n.layerSettings.depthTest?1:0,u_vec4_depth_test_color:Ps.V$})},ja=(e,t,{renderer:i},n,o,r)=>{i.bindShaderProgram(e,{u_float_dem_scale:r?t.elevationScale:0})},Na=(e,t,{renderer:i},n)=>{if(!n.attributes.meshTier)return;const o=n.layerSettings.identify?i.getMapMeshIdFramebufferId():i.getMapMeshFramebufferId(),r=i.getFramebuffer(o),s=null==r?void 0:r.renderTarget.getTexture(),a=null==r?void 0:r.scale;s&&(i.enableTexture(s,z.lx),i.bindShaderProgram(e,{u_sampler_map_tex:z.lx,u_vec2_tex_scale:a,u_float_tex_shift_scale:1-Math.cos(t.pitch)}))},Ua=(e,t,{renderer:i},n)=>{i.bindShaderProgram(e,{u_int_identify:n.layerSettings.identify||n.layerSettings.depthTest?1:0})},Ha=(e,t,{renderer:i},n)=>{i.bindShaderProgram(e,{u_float_scale:n.meta.scale,u_vec3_transform:n.meta.transform})};function Ga(...e){return(t,i,n,o,r,s)=>{e.forEach((e=>e(t,i,n,o,r,s)))}}const Va=(e,t,{renderer:i},n)=>(i.bindShaderProgram(e,{u_bool_is_3d_line:"line"===n.symbol&&"solid3d"===n.sink||"line"===n.symbol&&"patterned3d"===n.sink||"dashedLine"===n.symbol&&"stroke3d"===n.sink}),!0),Za=(e,t,{floorManager:i,renderer:n},o)=>{o.attributes.floorId&&o.tile.renderModelMatrix?"polygonExtrusion"===o.symbol&&o.attributes.isFloorStack?n.bindShaderProgram(e,{u_float_floor_elevation:i.getFloorStackObjectElevation(o.attributes.floorId)/o.tile.renderModelMatrix[10]}):n.bindShaderProgram(e,{u_float_floor_elevation:i.getFloorObjectElevation(o.attributes.floorId)/o.tile.renderModelMatrix[10]}):n.bindShaderProgram(e,{u_float_floor_elevation:0})},Wa=(e,t,{renderer:i})=>{i.bindShaderProgram(e,{u_float_floor_elevation:0})},Xa=(e,t,i,n)=>{i.renderer.bindShaderProgram(e,{u_int_is_roof:"polygonExtrusion"===n.symbol&&"topFill"===n.sink?1:0})},Ka=(e,t,i,n)=>{if("isFloorStack"in n.attributes&&n.attributes.isFloorStack){const t=i.floorManager.getFloorsStackObjectOffsets(n.attributes.floorId);i.renderer.bindShaderProgram(e,{u_vec2_floor_level:[t.current,t.total]})}else i.renderer.bindShaderProgram(e,{u_vec2_floor_level:[0,1]})};var $a=i(412),qa=i(7464),Ya=i(1359);const Ja="LIGHT_MODEL",Qa="MIX_COLOR_MODE",el=wt.e.createShaderDefinitions([{type:Qa,value:"1"}]),tl=wt.e.createShaderDefinitions([{type:Qa,value:"2"}]),il={type:"color",value:[0,0,0]};function nl(e,t){return(0,te.jJ)(e.styleZoom,e.styleState,t.attributes.tileData,!1,t.tile.dynamicObject)}const ol=(e,t,i,n)=>{switch(e.attributes.side){case bi.z.top:if(!n.style.strokeColor)return!1;break;case bi.z.side:if(!n.style.sideColor)return!1;break;case bi.z.bottom:if(!n.style.bottomColor)return!1;break;default:return!1}return!0},rl=(e,t)=>{const i=t.assetManager.textures[e.attributes.atlasIndex];return!!i&&(e.renderingProperties.atlasTexture=i,!0)},sl=(e,t)=>{const i=t.imageManager.getTexture(e.attributes.textureIndex);return!!i&&(e.renderingProperties.texture=i,!0)},al=(e,t)=>{const{range:i,fontIndex:n,styleId:o}=e.attributes,r=t.styleManager.getStyle(o);if(!r)return!1;const s=r.fonts[n],a=t.assetManager.getFontTextureByName(s,i);return!!a&&(e.renderingProperties.fontTexture=a,!0)},ll=(e,t)=>{const i=e.layerSettings.identify?t.renderer.getMapMeshIdFramebufferId():t.renderer.getMapMeshFramebufferId(),n=t.renderer.getFramebuffer(i),o=null==n?void 0:n.renderTarget.getTexture(),r=null==n?void 0:n.scale;return!(!o||!r)},dl=(e,{imageManager:t})=>{const i=t.getTexture(e.attributes.rampTextureIndex);return!!i&&(e.renderingProperties.rampTexture=i,!0)},cl=(e,t)=>{var i;const n=t.demManager.getDemFramebufferId(),o=null===(i=t.renderer.getFramebuffer(n))||void 0===i?void 0:i.renderTarget.getTexture();return!!o&&(e.renderingProperties.demTexture=o,!0)},ul=(e,{demManager:t,renderer:i,map:n})=>{var o;if(!n.state.demMode)return!1;const r=t.getHillshadeFramebufferId(),s=null===(o=i.getFramebuffer(r))||void 0===o?void 0:o.renderTarget.getTexture();return!!s&&(e.renderingProperties.hillshadeTexture=s,!0)},hl=(e,{demManager:t,renderer:i,map:n})=>{if(!n.state.demMode)return!1;const o=t.getFlatFramebufferId(),r=i.getFramebuffer(o);if(!r)return!1;const s=r.renderTarget.getTexture();return!!s&&(e.renderingProperties.flatTexture=s,!0)},ml=(e,{demManager:t,renderer:i,map:n})=>{if(!n.state.demMode)return!1;const o=t.getIdentifyFlatFramebufferId(),r=i.getFramebuffer(o);if(!r)return!1;const s=r.renderTarget.getTexture();return!!s&&(e.renderingProperties.flatIdentifyTexture=s,!0)},fl=(e,{modelsScene:t})=>{const i=t.getModelOpacity(e);return e.renderingProperties.resolvedOpacity=i,0!==i},_l=(e,{modelsScene:t})=>{const i=t.getModelHeightFactor(e);return e.renderingProperties.resolvedHeightFactor=i,0!==i},pl=(e,t,i,n)=>{const o=nl(i,e),r=(0,te.vn)(n.style.width,o);if(0===r)return!1;const s=(0,te.FR)(n.style.pattern,o);return!(!s||s[0]===Es.y.None)&&(e.renderingProperties.width=r,e.renderingProperties.pattern=s,!0)},vl=(e,t,i)=>0!==sd(i,e.attributes.animDirection),gl=(e,t,i,n)=>{const o=nl(i,e);return(0,te.vn)(n.style.iconOpacity,o)*sd(i,e.attributes.animDirection)!=0},yl=(e,t)=>!t.map.getFeatureFlag("transparentBuildingsOff"),bl=(e,t,i,n)=>wl(e.tile,i,n),xl=(e,t,i)=>{var n,o,r,s,a,l;if((null===(n=e.meta)||void 0===n?void 0:n.planId)&&(!i.styleState._activeFloorIds||!i.styleState._activeFloorIds.includes(e.meta.planId)))return!1;if((null===(r=null===(o=e.meta)||void 0===o?void 0:o.linkedIds)||void 0===r?void 0:r.length)&&!(null===(s=e.meta)||void 0===s?void 0:s.planId)&&t.floorManager.hasDisplayedFloorBuilding(e.meta.linkedIds))return!1;const d=null===(a=e.meta)||void 0===a?void 0:a.buildingId;return!d||!(null===(l=e.tile.ids)||void 0===l?void 0:l.isHidden(d))},wl=(e,t,i)=>{const{purpose:n,detailLevel:o}=e,{styleZoom:r}=t;switch(n){case"zenith":case"traffic":case"geojson":const e=o<function(e){switch(e){case"zenith":return T.tiles.maxDetailLevel;case"traffic":return T.traffic.maxDetailLevel;case"geojson":return j.rR}}(n)?(0,we.uZ)(r,o,o+.99999):r;return i.minzoom<=e&&e<i.maxzoom;case"dynamicObject":return i.minzoom<=r&&r<=i.maxzoom;default:return i.minzoom<=r&&r<i.maxzoom}},Sl=(e,t,i)=>{var n;const{styleZoom:o}=i,{tile:r}=e;if("zenith"!==r.purpose)return!0;if(o>T.tiles.maxUniverseZoom)return!0;let s=T.tiles.maxUniverseZoom;if(r.sourceId){const e=t.sourceStorage.getSourceById(r.sourceId);s="zenith"===(null==e?void 0:e.type)&&null!==(n=e.getOptions().strokeMinZoom)&&void 0!==n?n:T.tiles.maxUniverseZoom}return o>s},Ml=(e,t,i,n)=>{const{styleZoom:o}=i;return o>=n.minzoom&&o<n.maxzoom},Il=(e,t)=>void 0===e.attributes.id||!t.modelLayer.isHidden(e.attributes.id),Tl=(e,t,i,n)=>{const o=nl(i,e);return(0,te.vn)(n.style.iconWidth,o)>0},El=(e,t,i,n)=>{const{layerSettings:o}=e,{uniformSet:r}=o,s=e.attributes.labelIndex,a=n.style;if("fontHalo"===r){let{textHaloColor:e}=a;switch(s){case Ts.bR.Icon:e=a.iconTextHaloColor;break;case Ts.bR.Second:e=a.textHaloColor2}if(!e)return!1}return!0},Pl=(e,t,i,n)=>!("fontHalo"===e.layerSettings.uniformSet&&!n.style.textHaloColor),Al=(e,t,i,n)=>{var o,r,s,a,l,d;const c=nl(i,e),u=n.style;if("point"===e.symbol){switch(e.attributes.labelIndex){case Ts.bR.Second:return(null!==(r=(0,te.vn)(null!==(o=u.textHaloWidth2)&&void 0!==o?o:null,c))&&void 0!==r?r:0)>0&&!!u.textHaloColor2;case Ts.bR.Icon:return(null!==(a=(0,te.vn)(null!==(s=u.iconTextHaloWidth)&&void 0!==s?s:null,c))&&void 0!==a?a:0)>0&&!!u.iconTextHaloColor;case Ts.bR.First:}}return(null!==(d=(0,te.vn)(null!==(l=u.textHaloWidth)&&void 0!==l?l:null,c))&&void 0!==d?d:0)>0&&!!u.textHaloColor},Ll=(e,{modelLayer:t})=>{const{texture:i,id:n}=e.attributes;if(void 0===n)return!1;const o=t.getTexture(n,i);return!!o&&(e.renderingProperties.modelTexture=o,!0)},Cl=(e,t,i,n)=>{const o=(0,te.vn)(n.style.width,nl(i,e));return e.renderingProperties.widthResolved=o,0!==o},zl=(e,t,i,n)=>{const o=nl(i,e),r=(0,te.vn)(n.style.strokeWidth,o);return e.renderingProperties.widthResolved=r,0!==r},kl=(e,t,i,n)=>{const o=nl(i,e),r=(0,te.vn)(n.style.strokeWidth,o);if(0===r)return!1;const s=(0,te.vn)(n.style.width,o);return e.renderingProperties.widthResolved=s+2*r,!0},Ol=(e,t,i,n)=>{const o=nl(i,e),r=(0,te.vn)(n.style.strokeWidth2,o);if(0===r)return!1;const s=(0,te.vn)(n.style.width,o),a=(0,te.vn)(n.style.strokeWidth,o);return e.renderingProperties.widthResolved=s+2*a+2*r,!0},Rl=(e,t,i,n)=>{const o=nl(i,e),r=(0,te.vn)(n.style.width,o)+2*(0,te.vn)(n.style.strokeWidth,o)+2*(0,te.vn)(n.style.strokeWidth2,o);return e.renderingProperties.widthResolved=r,0!==r},Fl=(e,t,i)=>{const n=sd(i,e.attributes.animDirection);return e.renderingProperties.opacityResolved=n,0!==n},Bl=(e,t,i,n)=>(e.renderingProperties.resolvedRadius=(0,te.vn)(n.style.radius,nl(i,e)),e.renderingProperties.resolvedRadius>0),Dl=(e,t,i,n)=>{var o;let r;switch(e.renderingProperties.mat4_gradient||(e.renderingProperties.mat4_gradient=new Float32Array(16)),e.attributes.side){case bi.z.top:r=null!==(o=n.style.topColor)&&void 0!==o?o:n.style.color;break;case bi.z.side:r=n.style.sideColor;break;case bi.z.bottom:r=n.style.bottomColor}const s=nl(i,e),a=(0,te.FR)(r,s);return e.renderingProperties.mat4_gradient[0]=0,(0,$a.gC)(a)?ld(e,a):(0,$a.RY)(a)&&ad(a,e.tile.readiness,e.renderingProperties.mat4_gradient),!0},jl=(e,t,i,n)=>{if(e.renderingProperties.mat4_gradient||(e.renderingProperties.mat4_gradient=new Float32Array(16)),!e.renderingProperties.color)return!1;const o=(0,te.qv)(n.style.sideColor,nl(i,e));return o?(Yn.JG(e.renderingProperties.color.value,o.values[0].value),ad(o,e.tile.readiness,e.renderingProperties.mat4_gradient),0!==e.renderingProperties.color.value[3]):(e.renderingProperties.mat4_gradient[0]=0,!0)},Nl=(e,t,i,n)=>{const o=e.renderingProperties.color;if(!o)return!1;e.renderingProperties.mat4_gradient||(e.renderingProperties.mat4_gradient=new Float32Array(16));const r=nl(i,e),s=(0,te.zn)(n.style.sideColor,r).value,a=Yn.fS(o.value,s),l=a?n.style.sideColor:n.style.sideStrokeColor,d=(0,te.qv)(l,nl(i,e));return d?(Yn.JG(o.value,d.values[0].value),ad(d,e.tile.readiness,e.renderingProperties.mat4_gradient)):e.renderingProperties.mat4_gradient[0]=0,a&&(o.value[3]*=i.stillness),0!==o.value[3]},Ul=(e,t)=>!("hiddenByFloorComplexId"in e.attributes)||!e.attributes.hiddenByFloorComplexId||!t.floorManager.hasDisplayedFloorBuilding([e.attributes.hiddenByFloorComplexId]),Hl=(e,t)=>!e.attributes.floorId||("polygonExtrusion"===e.symbol&&e.attributes.isFloorStack?t.floorManager.isVisibleFloorStackObject(e.attributes.floorId):t.floorManager.isVisibleFloorObject(e.attributes.floorId)),Gl=e=>{const t=e.renderingProperties.color;return t?Yn.t8(t.value,0,0,0,12.75):e.renderingProperties.color=(0,qa.lK)([0,0,0,12.75]),!0},Vl=(e,t,i,n)=>{const o=(0,te.jJ)(i.styleZoom,i.styleState,e.attributes.tileData,Boolean(e.layerSettings.isOverlappedObject));return ld(e,(0,te.zn)(n.style.color,o)),0!==e.renderingProperties.color.value[3]},Zl=(e,t,i,n)=>(ld(e,(0,te.zn)(n.style.topColor,nl(i,e))),0!==e.renderingProperties.color.value[3]),Wl=(e,t,i,n)=>(ld(e,(0,te.zn)(n.style.sideColor,nl(i,e))),0!==e.renderingProperties.color.value[3]),Xl=(e,t,i,n)=>(ld(e,(0,te.zn)(n.style.strokeColor,nl(i,e))),0!==e.renderingProperties.color.value[3]),Kl=(e,t,i,n)=>{switch(e.attributes.side){case bi.z.top:ld(e,(0,te.zn)(n.style.strokeColor,nl(i,e)));break;case bi.z.side:ld(e,(0,te.zn)(n.style.sideColor,nl(i,e)));break;case bi.z.bottom:ld(e,(0,te.zn)(n.style.bottomColor,nl(i,e)));break;default:ld(e,il)}return 0!==e.renderingProperties.color.value[3]},$l=(e,t,i,n)=>(ld(e,(0,te.zn)(n.style.strokeColor2,nl(i,e))),0!==e.renderingProperties.color.value[3]),ql=(e,t,i,n)=>{if(void 0===e.attributes.id)return!1;const o=e.renderingProperties.color;return!!o&&(o.value[3]*=t.modelLayer.getOpacity(e.attributes.id,n.minzoom),0!==o.value[3])},Yl=(e,t,i,n)=>{const o=e.renderingProperties.color;if(!o)return!1;const r=nl(i,e),s=(0,te.zn)(n.style.strokeColor,r).value,a=(0,te.vn)(n.style.strokeWidth,r);return Yn.fS(o.value,s)&&1===o.value[3]&&a<=1&&(o.value[3]*=i.stillness),0!==o.value[3]},Jl=(e,t,i,n)=>{const o=e.renderingProperties.color;if(!o)return!1;const r=nl(i,e),s=(0,te.zn)(n.style.topColor,r).value,a=(0,te.vn)(n.style.strokeWidth,r);return Yn.fS(o.value,s)&&1===o.value[3]&&a<=1&&(o.value[3]*=i.stillness),0!==o.value[3]},Ql=(e,t,i,n)=>(ld(e,(0,te.zn)(n.style.sideStrokeColor,nl(i,e))),0!==e.renderingProperties.color.value[3]),ed=(e,t,i,n)=>{const o=(0,te.zn)(n.style.color,nl(i,e),!0);if(ld(e,(0,$a.Cj)(o)?o.color1:o),!i.demMode&&(0,$a.Cj)(o)&&("readFromTarget"!==o.factor.type||t.renderer.doesDrawTargetFramebufferExist(o.factor.name))){if(function(e,t){e.renderingProperties.mixColor=t}(e,o),0===e.renderingProperties.color.value[3]&&0===e.renderingProperties.mixColor.color2.value[3])return!1;const{factor:{type:t}}=e.renderingProperties.mixColor;switch(t){case"readFromTarget":e.shaderDefinitions=el;break;case"vertexAttribute":e.shaderDefinitions=tl;break;default:Cs(t)}return!0}return 0!==e.renderingProperties.color.value[3]},td=(e,t)=>{const i=null==e?void 0:e.attributes.parentId;if(!i)return!0;const{floorManager:n}=t;if(n.hasDisplayedFloorBuilding([i])&&e.attributes.floorId)return!0;const o=null==e?void 0:e.tile.ids;return!(null==o?void 0:o.isHidden(i,Ya.Rv.PolygonExtrusion))},id=rd(bl,td,Ul,((e,t)=>{if(!e.bboxWorld)return!0;if(e.tile.dynamicObject)return!0;if(e.renderingProperties.animationStack&&e.renderingProperties.animationStack.length>0)return!0;if(t.environmentManager.isAABBInFog(e.bboxWorld))return!1;const i=t.camera.getViewportVertices();return(0,jn.M4)(i,e.bboxWorld)}),Hl,xl,fl,_l,((e,t,i,n)=>{ld(e,(0,te.zn)(n.style.color,nl(i,e)));const{color:o,resolvedOpacity:r}=e.renderingProperties;return Yn.dC(o.value,o.value,e.attributes.colorFactor),o.value[3]*=null!=r?r:0,0!==o.value[3]})),nd=rd(bl,td,Ul,xl,fl,_l),od=rd(((e,t,i,n)=>{var o,r;const{renderingProperties:s}=e,{resolvedUvIndex:a}=s,{colorTextureUvIndex:l}=n.style;if(void 0!==l&&a!==l){(null!==(r=null===(o=e.meta)||void 0===o?void 0:o.availableTextureCoords)&&void 0!==r?r:[])[l]&&e.vao.setAttributesAliases({texcoord_color:`texcoord_${l}`}),s.resolvedUvIndex=l}return!0}),((e,t,i,n)=>{var o,r;const{styleId:s,colorTexture:a,aoTexture:l,pbrTexture:d,meshTier:c}=e.attributes,{renderingProperties:u}=e,{modelId:h}=u,m=t.assetManager.getModel(null!=h?h:NaN,s);return!!m&&(void 0!==a&&m.textures[a]&&(u.resolvedColorTexture=a),void 0!==l&&m.textures[l]&&(u.resolvedAoTexture=l),void 0!==d&&m.textures[d]?u.resolvedPbrTexture=d:(u.resolvedMetallic=null!==(o=e.attributes.metallic)&&void 0!==o?o:n.style.metallic,u.resolvedRoughness=null!==(r=e.attributes.roughness)&&void 0!==r?r:n.style.roughness),!(!u.resolvedColorTexture&&!u.color)&&(!c||ll(e,t)))}));function rd(...e){return(t,i,n,o)=>{for(const r of e)if(!r(t,i,n,o))return!1;return!0}}function sd(e,t){return t===q.jh.none?1:t===q.jh.fadeIn?e.labelingOpacity:1-e.labelingOpacity}function ad(e,t,i){if(e.steps.length){i[0]=(0,we.uZ)(e.values.length,0,3);for(let n=0;n<i[0];n++){const o=e.values[n],r=(0,te.m2)(o);Yn.bA(r,r,t),i[n+1]=e.steps[n];const s=4*(n+1);i[s]=r[0],i[s+1]=r[1],i[s+2]=r[2],i[s+3]=r[3]}}else i[0]=0}function ld(e,t){e.renderingProperties.color||(e.renderingProperties.color=(0,qa.lK)([255,255,255,255])),Yn.JG(e.renderingProperties.color.value,t.value)}var dd=i(4693);function cd(e,t,i){const n=document.createElement("img");return n.width=t,n.height=i,new Promise((t=>{n.onload=()=>t(n),n.src=e}))}function ud(e){let t;try{t={url:`data:image/svg+xml;base64,${btoa(e)}`}}catch(i){const n=URL.createObjectURL(new Blob([e],{type:"image/svg+xml"}));t={url:n,revokeURL:()=>URL.revokeObjectURL(n)}}return t}function hd(e,t="image/png"){const i=new Blob([e],{type:t}),n=URL.createObjectURL(i),o=document.createElement("img");return new Promise((t=>{o.onload=()=>{URL.revokeObjectURL(n),t(o)},0===e.byteLength?o.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=":o.src=n}))}function md(e,t){if(t[0]===e.width&&t[1]===e.height)return e;const i=document.createElement("canvas"),n=i.getContext("2d");return i.width=t[0],i.height=t[1],n.shadowColor="transparent",n.shadowBlur=0,n.drawImage(e,0,0,t[0],t[1]),i}var fd=i(7063);function _d(e,t,i,n,o){const r=Array();o&&t.forEach((e=>{var t,r;const s=n[e.outputBufferView],a=Math.ceil(null!==(t=o.get(e.actionId))&&void 0!==t?t:-1),l=Math.floor(null!==(r=o.get(e.actionId))&&void 0!==r?r:-1),d=(o.get(e.actionId)||1)%1,c=Math.round(o.get(e.actionId)||-1);if(s&&o.size>0&&l>=0&&a>=0&&c>=0){const t=new Float32Array(Cd(s),e.outputBufferOffset,e.outputBufferLength);if("VEC4"===e.outputType)if("STEP"===e.interpolation)i[e.targetMatIndex[0]][e.targetMatIndex[1]]=pd(t,c,4);else fd.ZA(i[e.targetMatIndex[0]][e.targetMatIndex[1]],pd(t,l,4),pd(t,a,4),d);else if("VEC3"===e.outputType)if("STEP"===e.interpolation)i[e.targetMatIndex[0]][e.targetMatIndex[1]]=pd(t,c,3);else ae.t7(i[e.targetMatIndex[0]][e.targetMatIndex[1]],pd(t,l,3),pd(t,a,3),d)}}));for(let e=0;e<i.length;e++){const t=i[e];if(3===t.length){const e=it.Ue();it.Iw(e,t[1],t[0],t[2]),r.push(e)}else r.push(t)}!function(e=[],t){if(0===t.length)return Array.from(xd);it.JG(e,t[0]);for(let i=1;i<t.length;i++)it.dC(e,e,t[i])}(e,r)}function pd(e,t,i){if(3!==i&&4!==i)return console.warn("Invalid animation transform size"),[];const n=[];for(let o=0;o<i;o++)n.push(e[t*i+o]);return n}function vd(e,t,i,n,o){e.animations.forEach(((r,s)=>{r.channels.forEach(((a,l)=>{if(a.target.node===i){const i=r.samplers[a.sampler],d=r.name||"default",c=e.accessors[i.input];if(void 0===c.bufferView)return;if(void 0===e.bufferViews[c.bufferView])return;gd(t,e,c.bufferView,c.componentType);const u=e.accessors[i.output];if(void 0===u.bufferView)return;const h=e.bufferViews[u.bufferView];if(void 0===h)return;gd(t,e,u.bufferView,u.componentType),"LINEAR"!==(i.interpolation||"LINEAR")&&"STEP"!==(i.interpolation||"LINEAR")&&console.warn(`Unsupported interpolation type "${i.interpolation}" in animation "${d}". Fall back to LINEAR interpolation.`);const m=function(e){let t=0,i="VEC3";const n=4;switch(e){case"translation":t=0;break;case"rotation":t=1,i="VEC4";break;case"scale":t=2;break;case"weights":t=3}return{targetindex:t,outputType:i,bufferStride:n}}(a.target.path);n.push({min:c.min,max:c.max,frameCount:c.count,keyFrameType:"SCALAR",interpolation:i.interpolation||"LINEAR",outputType:m.outputType,outputBufferView:u.bufferView,outputBufferOffset:h.byteOffset||0,outputBufferLength:h.byteLength/m.bufferStride,targetMatIndex:[o.length-1,m.targetindex],actionId:`${r.name}_${s}_${l}`,animationIndex:s,animationName:d})}}))}))}function gd(e,t,i,n){const o=t.bufferViews[i];if(void 0===o)return;if(!e.buffers[i]){const n=t.buffers[o.buffer].buffer;if(!n)return;e.buffers[i]=Cd(n)}const r=e.buffers[i];return r instanceof yt.l?void 0:r}function yd(e,t){for(let i=e.length-1;i>=0;i--){const n=e[i];if(t(n,i,e))return n}}const bd=new Set(["position","texcoord_0","texcoord_1","texcoord_2","texcoord_3","normal","tangent"]),xd=Array.from(it.Ue()),wd={pbrMetallicRoughness:{baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1},emissiveFactor:[0,0,0],alphaMode:"OPAQUE",alphaCutoff:.5,doubleSided:!1};function Sd(e){return Md(e,wd),e}function Md(e,t){for(const i in t)void 0===e[i]?e[i]=t[i]:"object"==typeof e[i]&&Md(e[i],t[i])}var Id;!function(e){e[e.Pending=1]="Pending",e[e.Loaded=2]="Loaded",e[e.Failed=3]="Failed"}(Id||(Id={}));function Td(e,t,i,n,o){return Ed(e,i.scenes[i.scene].nodes,i,[],[],t,n,o),e}function Ed(e,t,i,n,o,r,s,a){var l,d,c,u,h,m;if(!t)return;const f=r.symbolSettingsList.gltfModel.instances;if(f&&0!==f.length)for(const f of t){const t=[...n],_=[...o],p=i.nodes[f];if(p.matrix&&t.push(p.matrix),p.translation&&p.rotation&&p.scale){const n=[];n.push(p.translation,p.rotation,p.scale),t.push(n),vd(i,e,f,_,t)}if(void 0!==p.mesh){const n=i.meshes[p.mesh];let o=(0,we.Kn)(p.extras)&&"flat"===p.extras.dem?dd.m.flat:dd.m.default;const s=new Float32Array(16);let f,v;if(_d(s,_,t,e.buffers),p.children){const e=[];for(const t of p.children){const n=i.nodes[t];zd(n)&&e.push(n)}if(e.length){const t=e[0];if("centroid"===t.extras.dem)o=dd.m.centroid,f=[t.translation[0],t.translation[2]];else if("axis"===t.extras.dem){o=dd.m.axis;const i=yd(e,(e=>"axis"===e.extras.dem));v=[t.translation[0],t.translation[2],(null!=i?i:t).translation[0],(null!=i?i:t).translation[2]]}}}for(const g of n.primitives){const n=[],y={};let b,x,w,S=0;for(const t in g.attributes){const o=/TEXCOORD_(\d+)/.exec(t);o&&(n[parseInt(o[1],10)]=!0);const s=t.toLowerCase();if(!bd.has(s)){0;continue}const a=g.attributes[t],c=i.accessors[a];if(void 0===c.bufferView)continue;const u=i.bufferViews[c.bufferView];if(void 0===u)continue;const h=Ad(r,e,i,c.bufferView,c.componentType);if(h){if("position"===s&&(b=c.min,x=c.max),h.purpose="gltfMesh",y[t.toLowerCase()]=new fi.K(h,{itemSize:Ld(c.type),dataType:(0,yt.m)(c.componentType),stride:null!==(l=u.byteStride)&&void 0!==l?l:0,offset:null!==(d=c.byteOffset)&&void 0!==d?d:0,normalized:!!c.normalized}),!f&&"position"===t.toLowerCase()){const e=c.min,t=c.max;e&&t&&(f=[(t[0]+e[0])/2,(t[2]+e[2])/2])}0===S&&(S=c.count)}}if(b||(b=[0,0,0]),x||(x=[0,0,0]),void 0!==g.indices){const t=i.accessors[g.indices];if(void 0===t.bufferView)continue;if(w=Ad(r,e,i,t.bufferView,t.componentType,!0),!w)continue;w.purpose="gltfIndices",S=t.count}const M=Sd(void 0!==g.material?i.materials[g.material]:{}),I={},T={localMatrix:s,animationStack:_,transformStack:t,availableTextureCoords:n,attributesAliases:I,colorFactor:[...M.pbrMetallicRoughness.baseColorFactor],colorTexture:NaN,aoTexture:NaN,pbrTexture:NaN,centroid:f,axis:v,demPosition:o},E=[],P=M.pbrMetallicRoughness.baseColorTexture;P&&(E.push({type:"COLOR_TEXTURE"}),I.texcoord_color=`texcoord_${null!==(c=P.texCoord)&&void 0!==c?c:0}`,Pd(e,i,P),T.colorTexture=P.index);const A=M.pbrMetallicRoughness.metallicRoughnessTexture;if(A){E.push({type:"PBR_TEXTURE"}),Pd(e,i,A),T.pbrTexture=A.index;const t="number"==typeof A.texCoord?A.texCoord:0;I.texcoord_pbr=`texcoord_${t}`,n[t]=!1}else T.roughness=null!==(u=M.pbrMetallicRoughness.roughnessFactor)&&void 0!==u?u:1,T.metallic=null!==(h=M.pbrMetallicRoughness.metallicFactor)&&void 0!==h?h:1;Number.isNaN(a.style.roughness)||E.push({type:"METALLIC_ROUGHNESS_DEBUG"}),void 0!==(null===(m=p.extras)||void 0===m?void 0:m.tier)&&(T.meshTier=p.extras.tier,E.push({type:"MAP_MESH_TEXTURE"})),"pbr"===a.style.lightingModel?E.push({type:Ja,value:"2"}):E.push({type:Ja,value:"1"});const L=M.occlusionTexture;if(L){E.push({type:"AO_TEXTURE"}),Pd(e,i,L),T.aoTexture=L.index;const t="number"==typeof L.texCoord?L.texCoord:0;I.texcoord_ao=`texcoord_${t}`,n[t]=!1}e.objects.push({start:0,count:S,attributes:T,drawMode:g.mode,accessors:y,elementsBuffer:w,shaderDefinitions:E,bbox:{min:b,max:x}})}}p.children&&Ed(e,p.children,i,t,_,r,s,a)}}function Pd(e,t,i){var n;const o=null!==(n=i.index)&&void 0!==n?n:0,r=t.textures[o];if(!r||void 0===r.source||void 0===r.sampler)return;const s=t.images[r.source],a=t.samplers[r.sampler];if(!a||!s)return;const l={flipY:!1};a.magFilter&&(l.magFilter=ot(a.magFilter)),a.minFilter&&(l.minFilter=ot(a.minFilter)),a.wrapS&&(l.wrapS=ot(a.wrapS)),a.wrapT&&(l.wrapT=ot(a.wrapT)),void 0!==i.texCoord&&(l.texcoord=i.texCoord),s.image||!s.bufferView?e.textures[o]=new nt(s.image,l):function(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){if(!t.bufferView)return!1;const i=e.bufferViews[t.bufferView];if(void 0===i)return!1;const n=e.buffers[i.buffer].buffer;return!!n&&hd(new Uint8Array(n,i.byteOffset,i.byteLength),t.mimeType)}))}(t,s).then((t=>{t&&(s.image=t,e.textures[o]=new nt(s.image,l))}))}function Ad(e,t,i,n,o,r=!1){const s=i.bufferViews[n];if(void 0===s)return;if(!t.buffers[n]){const a=i.buffers[s.buffer].buffer;if(!a)return;const l=new DataView(Cd(a),s.byteOffset,s.byteLength),d=e.createBuffer(l,{dataType:(0,yt.m)(o)},r);t.buffers[n]=d}const a=t.buffers[n];return a instanceof ArrayBuffer?void 0:a}function Ld(e){switch(e[0]){case"S":return 1;case"V":return Number(e[3]);case"M":return Math.pow(Number(e[3]),2)}return console.error(`Failed to determine channels count from accessor type = ${e}`),0}function Cd(e){return e instanceof ArrayBuffer?e:e.buffer}function zd(e){return void 0===e.mesh&&(0,we.Kn)(e.extras)&&("centroid"===e.extras.dem||"axis"===e.extras.dem)}var kd=i(9090);const Od=ae.Zh([1,1,1]),Rd=ae.Ue(),Fd=ae.Ue(),Bd=it.Ue();function Dd(e,t){it.U_(e,t);const i=it.Ue();i[12]+=e[12],i[13]+=e[13],it.dC(e,e,i)}function jd(e){return"gltfModel"===e.symbol&&"instances"===e.sink}function Nd(e,t,i,n,o){var r;const s=e.modelMatrices.get(0);if(!s)return;const a=[i[0]/G._H,i[1]/G._H,i[2]/G._H],l=[i[3]/G._H,i[4]/G._H,i[5]/G._H],d={min:[0,0,0],max:[0,0,0]};if(ae.fF(d.min,a,s),ae.fF(d.max,l,s),o)if(n.tMatrix3x3){const e=function(e,t,i){const n=it.t8(Bd,t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1);i&&it.dC(n,n,i);const o=ae.t7(Rd,e.min,e.max,.5),r=ae.bA(Fd,ae.lu(Fd,e.max,e.min),.5),s=ae.fF(Rd,o,n),a=ae.al(Math.abs(n[0])*r[0]+Math.abs(n[4])*r[1]+Math.abs(n[8])*r[2],Math.abs(n[1])*r[0]+Math.abs(n[5])*r[1]+Math.abs(n[9])*r[2],Math.abs(n[2])*r[0]+Math.abs(n[6])*r[1]+Math.abs(n[10])*r[2]),l=ae.lu(ae.Ue(),s,a),d=ae.IH(ae.Ue(),s,a);return{min:l,max:d}}(o,n.tMatrix3x3,t);ae.IH(d.min,d.min,e.min),ae.IH(d.max,d.max,e.max)}else{let e=Math.max(ae.Zh(o.max),ae.Zh(o.min));if(t){const i=Rd,n=Fd;(0,kd.bt)(t,i,n);e*=ae.Zh(i)/Od,e+=ae.Zh(n)}e*=null!==(r=n.maxDiag)&&void 0!==r?r:1,ae.t8(Rd,-e,-e,-e),ae.IH(d.min,d.min,Rd),ae.t8(Rd,e,e,e),ae.IH(d.max,d.max,Rd)}return d}var Ud=i(6757);class Hd{constructor(e){this.modules=e,this.queue=new Map}enqueue(e,t){this.queue.set(t.id,{batch:e,tile:t,state:void 0})}update(){const{renderer:e,tileManager:t}=this.modules;for(const i of t.getTileObjects()){const t=this.queue.get(i.id);if(!t)continue;const{batch:n}=t,{symbol:o,sink:r}=n,s=(0,Ud.r)(e,o,r);if(!s){console.error(`Cannot happen! Symbol ${o} does not have sink ${r}!`);continue}const a=s[0].instanceBinder;if(!a){console.error("Cannot happen! No instanceBinder for batch inside instanceLinker queue.");continue}const l=a(this.modules,n,i,t.state);l?t.state=l:this.queue.delete(i.id)}}}function Gd(e,t,i,n,o,r,s,a,l,d,c,u){const h=(0,q.vP)(r,s),m=(0,Ud.r)(t,r,s),{accessors:f,elementsBuffer:_,count:p,drawMode:v,bbox:g}=n,y=wt.e.createShaderDefinitions(n.shaderDefinitions);c.linkId=i;for(const i of m){const n=i.uniformSet||"fill",m=JSON.stringify(Object.values(l))+"_"+n+"_"+o.detailLevel,b=t.getShaderProgram(i.programName,y),x=a.buffer;if(!x){console.error(`Expected existing buffer while linking instance, but ${x} found.`);continue}const w=i.vaoCreator(x,b,_,f);c.attributesAliases&&w.setAttributesAliases(c.attributesAliases);const S={id:(0,z.fD)(),type:Cn.H.Tile,layerSettings:i,start:0,count:p,attributes:l,shaderDefinitions:y,renderingProperties:d,meta:c,attributesHash:m,vao:w,drawMode:v,tile:o,bbox:g,bboxWorld:u,symbol:r,sink:s,canRender:!0,instanceCount:(a.rangeEnd-a.rangeStart)/h};o.push(S),e.push(S)}e.length&&t.addRerenderEvent({type:"instanceLink"})}function Vd(e,t,i){!function(e,t){e.children=e.children.filter(t),e.identifyChildren=e.identifyChildren.filter(t),e.depthTestChildren=e.depthTestChildren.filter(t),e.labelTestChildren=e.labelTestChildren.filter(t),e.shadowChildren=e.shadowChildren.filter(t)}(t,(t=>{var n;const o=(null===(n=t.meta)||void 0===n?void 0:n.linkId)===i;return o&&e.push(t),!o}))}const Zd={min:[0,0,0],max:[0,0,0]},Wd=(e,t,i,n)=>{const{assetManager:o,modelsScene:r,renderer:s}=e;if(n||(n={}),i.destroyed){const e=[];for(const t in n){const o=n[+t];Number.isNaN(o.linkId)||Vd(e,i,o.linkId)}for(const t of e)r.removeSceneObject(t.id);return}const a=[];for(let e=0;e<t.generatedObjects.length;e++){const l=t.generatedObjects[e],d=Pi.m.sinks.instances.unpackObjectAttributes(l.attributes),{extents:c}=l;n[e]||(n[e]={modelId:NaN,linkId:NaN});const u=n[e];let h;const m=!!u.referenceBbox;u.referenceBbox?h=u.referenceBbox:(h=Zd,h.min[0]=c[0]/G._H,h.min[1]=c[1]/G._H,h.min[2]=c[2]/G._H,h.max[0]=c[3]/G._H,h.max[1]=c[4]/G._H,h.max[2]=c[5]/G._H);const{styleId:f}=d,_=u.modelId;r.updateModelId(u,d,h,i,m);const p=u.modelId;if(void 0===p||Number.isNaN(p))continue;if(_===p)continue;const v=o.getModel(p,f);if(!v)continue;if(v.status!==Id.Loaded||0===v.objects.length)continue;const g=u.linkId;if(!Number.isNaN(g)){const e=[];Vd(e,i,g);for(const t of e)r.removeSceneObject(t.id)}const y=(0,z.fD)();u.linkId=y;for(const e of v.objects){const n=i.modelMatrices.get(0),o=new Float32Array(16);Dd(o,n);const{attributesAliases:r,availableTextureCoords:h,colorTexture:m,colorFactor:f,aoTexture:_,pbrTexture:v,metallic:g,roughness:b,meshTier:x,animationStack:w,transformStack:S,localMatrix:M,demPosition:I,axis:T,centroid:E}=e.attributes,P=Nd(i,M,c,l,e.bbox);!u.referenceBbox&&P&&(u.referenceBbox=P),Gd(a,s,y,e,i,t.symbol,t.sink,l,Object.assign({colorTexture:m,colorFactor:f,aoTexture:_,pbrTexture:v,metallic:g,roughness:b,meshTier:x,demPosition:I,axis:T,centroid:E},d),{modelId:p,animationStack:w,transformStack:S,localMatrix:new Float32Array(null!=M?M:[]),transformMatrix:o},Object.assign(Object.assign({},l.meta),{attributesAliases:r,availableTextureCoords:h}),P)}}return a.forEach((e=>{r.addSceneObject(e)})),n};var Xd=i(7486),Kd=i(5549);const $d=new Float32Array(16);let qd,Yd;function Jd(...e){return(t,i,n,o,r,s)=>{for(const a of e){if(!a(t,i,n,o,r,s))return!1}return!0}}const Qd=(e,t,i,n)=>(i.renderer.bindShaderProgram(e,{u_mat4_mvp:n.tile.renderMvpMatrix}),!0),ec=(e,t,i,n)=>{const{camera:o,styleManager:r,renderer:s}=i,a=r.getStyle(t.handyStyleId);if(!(null==a?void 0:a.environment))return!1;return!!n.tile.renderModelMatrix&&(s.bindShaderProgram(e,{u_mat4_flat_mvp:n.tile.renderMvpMatrix,u_mat4_ecef_mvp:o.ecefMvpMatrix,u_float_crossfade:o.globeRatio}),!0)},tc=(e,t,i,n)=>(i.renderer.bindShaderProgram(e,{u_mat4_flat_map_mvp:n.tile.renderFlatMapTexMatrix}),!0),ic=(e,t,i,n)=>!!n.tile.renderModelMatrix&&(it.JG($d,n.tile.renderModelMatrix),i.renderer.bindShaderProgram(e,{u_mat4_model:$d}),!0),nc=(e,t,i,n)=>(i.renderer.bindShaderProgram(e,{u_int_abs_z:n.attributes.absZ?1:0}),!0),oc=(e,t,{renderer:i},n,o,r)=>{if(r.terrain3d){if(!n.tile.renderModelMatrix)return!1;i.bindShaderProgram(e,{u_mat4_dem_mvp:n.tile.renderDemMatrix,u_float_vertical_scale:1/n.tile.renderModelMatrix[10]})}return!0};function rc(e,t){return(0,te.jJ)(e.styleZoom,e.styleState,t.attributes.tileData)}const sc=(e,t,i,n,o)=>{var r;qd=void 0;const s=rc(t,n),a=(0,te.Q9)(o.style.textureImage,s);let l=!1;"polygon"===o.type&&(l=o.style.lengthUnits===ai.vR.Meters);const d=i.styleManager.getStyle(n.attributes.styleId);if(!d)return!0;const c=null===(r=d.rasterSets.byKey[(0,qa.FD)(a)])||void 0===r?void 0:r.rasters;if(!c)return!0;const u=(0,te.FR)(o.style.textureSize,s);let[h,m]=Array.isArray(u)?u:[u,u];if(l&&(h*=(0,Kd.N5)(h,h),m*=(0,Kd.N5)(m,m)),h<=0||m<=0)return!0;const f=(0,Xd.Bl)(c,h*window.devicePixelRatio,!0);return void 0===f||(qd=c[f]),!0},ac=(e,t,i,n,o)=>{var r;Yd=void 0;const s=rc(t,n),a=(0,te.Q9)(o.style.normalMapTextureImage,s),l=o.style.normalMapTextureLengthUnits===ai.vR.Meters,d=i.styleManager.getStyle(n.attributes.styleId);if(!d)return!0;const c=null===(r=d.rasterSets.byKey[(0,qa.FD)(a)])||void 0===r?void 0:r.rasters;if(!c)return!0;const u=(0,te.FR)(o.style.normalMapTextureSize,s);let[h,m]=Array.isArray(u)?u:[u,u];if(l&&(h*=(0,Kd.N5)(h,h),m*=(0,Kd.N5)(m,m)),h<=0||m<=0)return!0;const f=(0,Xd.Bl)(c,h*window.devicePixelRatio,!0);return void 0===f||(Yd=c[f]),!0},lc=(e,t,{assetManager:i,renderer:n},o,r)=>{if(!qd)return n.bindShaderProgram(e,{u_int_is_textured:0}),!0;let s,a,l,d;const{tile:c}=o,{zoom:u}=t,h=i.textures[qd.atlasIndex];let m,f=!1;if(!h)return n.bindShaderProgram(e,{u_int_is_textured:0}),!0;if("polygon"===r.type&&(f=r.style.lengthUnits===ai.vR.Meters),n.enableTexture(h,0),f){const e=rc(t,o),i=(0,te.FR)(r.style.textureSize,e),[n,u]=Array.isArray(i)?i:[i,i],h=W.H.toGeo((0,Y.Oy)(c.coords)),m=W.H.scaleFactor(h[1]),f=(0,Y.aq)(c.zoomLevel)/L.C/m;l=f/n,d=f/u,s=c.coords[0]*l%1,a=c.coords[1]*d%1}else m=G.y4*Math.pow(2,Math.round(u)-c.zoomLevel)*window.devicePixelRatio,s=c.coords[0]*m%qd.w/qd.w,a=c.coords[1]*m%qd.h/qd.h,l=m/qd.w,d=m/qd.h;return n.bindShaderProgram(e,{u_int_is_textured:1,u_float_texture_params:[s,a,l,d],u_float_sprite_texture_coords:[(qd.x+.5)/T.atlasSize[0],(qd.y+qd.h-1)/T.atlasSize[1],(qd.x+qd.w-1)/T.atlasSize[0],(qd.y+.5)/T.atlasSize[1]]}),!0},dc=(e,t,i,n,o)=>{var r;const{assetManager:s,styleManager:a,renderer:l}=i;if(!Yd)return l.bindShaderProgram(e,{u_int_is_normal_map_textured:0}),!0;let d,c,u,h;const{tile:m}=n,{zoom:f}=t,_=s.textures[Yd.atlasIndex],p=o.style.normalMapTextureLengthUnits===ai.vR.Meters;if(!_)return l.bindShaderProgram(e,{u_int_is_normal_map_textured:0}),!0;let v;if(l.enableTexture(_,1),p){const e=rc(t,n),i=(0,te.FR)(o.style.normalMapTextureSize,e),[r,s]=Array.isArray(i)?i:[i,i],a=W.H.toGeo((0,Y.Oy)(m.coords)),l=W.H.scaleFactor(a[1]),f=(0,Y.aq)(m.zoomLevel)/L.C/l;u=f/r,h=f/s,d=m.coords[0]*u%1,c=m.coords[1]*h%1}else v=G.y4*Math.pow(2,Math.round(f)-m.zoomLevel)*window.devicePixelRatio,d=m.coords[0]*v%Yd.w/Yd.w,c=m.coords[1]*v%Yd.h/Yd.h,u=v/Yd.w,h=v/Yd.h;const g=null===(r=a.getStyle(n.attributes.styleId))||void 0===r?void 0:r.rasterSets.byIndex[Yd.rasterSetIndex];return g&&g.isReady?(l.bindShaderProgram(e,{u_int_is_normal_map_textured:1,u_vec4_normal_map_texture_params:[d,c,u,h],u_vec4_normal_map_sprite_texture_coords:[(Yd.x+.5)/T.atlasSize[0],(Yd.y+Yd.h-1)/T.atlasSize[1],(Yd.x+Yd.w-1)/T.atlasSize[0],(Yd.y+.5)/T.atlasSize[1]]}),!0):(l.bindShaderProgram(e,{u_int_is_normal_map_textured:0}),!0)},cc=(e,t,{renderer:i},n,o)=>{if(!Yd)return!0;const r=rc(t,n),s=(0,te.FR)(o.style.metallic,r),a=(0,te.FR)(o.style.roughness,r);return i.bindShaderProgram(e,{u_float_metallic:s,u_float_roughness:a}),!0},uc=(e,t,i,n)=>{if(!qd)return i.renderer.bindShaderProgram(e,{u_int_is_textured:0}),!0;const{tile:o}=n,{zoom:r}=t,s=i.assetManager.textures[qd.atlasIndex];if(!s)return i.renderer.bindShaderProgram(e,{u_int_is_textured:0}),!0;i.renderer.enableTexture(s,0);const a=G.y4*Math.pow(2,Math.round(r)-o.zoomLevel)*window.devicePixelRatio;return i.renderer.bindShaderProgram(e,{u_int_is_textured:1,u_float_texture_vertical_scale:qd.h*o.size/a}),!0},hc=(e,t,{styleManager:i,assetManager:n,renderer:o},r,s)=>{var a;const l=rc(t,r),d=(0,te.Q9)(s.style.iconImage,l),c=i.getStyle(r.attributes.styleId);if(!c)return!1;const u=null===(a=c.rasterSets.byKey[(0,qa.FD)(d)])||void 0===a?void 0:a.rasters;if(!u)return!1;const h=(0,te.vn)(s.style.width,l),m=(0,te.vn)(s.style.height,l),f=(0,Kd.N5)(h,m),_=h*f;if(_<=0||m*f<=0)return!1;const p=(0,Xd.Bl)(u,_*window.devicePixelRatio,!0);if(void 0===p)return!1;const v=u[p],g=n.textures[v.atlasIndex];return!!g&&(o.enableTexture(g,0),o.bindShaderProgram(e,{u_float_sprite_texture_coords:[(v.x+.5)/T.atlasSize[0],(v.y+v.h-1)/T.atlasSize[1],(v.x+v.w-1)/T.atlasSize[0],(v.y+.5)/T.atlasSize[1]]}),!0)},mc=new Float32Array(16);it.xJ(mc,[1/G.sX,1/G.sX,1/G.sX]);const fc=(e,t,{animationManager:i,assetManager:n,renderer:o},r,s)=>{const{styleId:a}=r.attributes,{localMatrix:l,transformMatrix:d,modelId:c}=r.renderingProperties;if(void 0===c)return!1;const u=n.getModel(c,a);return void 0!==u&&(i.animateGltfObject(r,s,u),o.bindShaderProgram(e,{u_mat4_localmatrix:l,u_mat4_instance:t.globeMode?mc:d}),!0)},_c=(e,t,{renderer:i},n)=>!!n.tile.renderModelMatrix&&(it.JG($d,n.tile.renderModelMatrix),i.bindShaderProgram(e,{u_mat4_model:$d}),!0),pc=(e,t,{animationManager:i,renderer:n},o,r)=>{if(!Yd)return!0;let s=[0,0,0,0],a=0;const[l,d]=i.animatePolygonNormalMapTexture(o,r);return s=d,a=l?1:0,n.bindShaderProgram(e,{u_vec4_normal_map_animated_offsets:s,u_int_normal_map_is_animated:a}),!0},vc=(e,t,i)=>!i.shadowManager.texture;class gc{constructor(e){this.gl=e,this.ext=e.getExtension("EXT_disjoint_timer_query"),this.queries=[]}addTimer(){if(!this.ext)return;const e=this.ext.createQueryEXT();this.queries.push(e),this.ext.beginQueryEXT(this.ext.TIME_ELAPSED_EXT,e)}stopTimer(){this.ext&&this.queries.length&&this.ext.endQueryEXT(this.ext.TIME_ELAPSED_EXT)}tryToGetFirstTimerValue(){if(!this.ext)return;const e=this.queries[0];if(!e)return;const t=this.ext,i=t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT),n=this.gl.getParameter(t.GPU_DISJOINT_EXT);if(!i||n)return;const o=t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT);return t.deleteQueryEXT(e),this.queries.shift(),Number(o)}}const yc="\nvec4 apply_opacity(const vec4 color, const float opacity)\n{\nreturn color * opacity;\n}\n",bc="#ifndef UBO\nuniform highp vec3 u_cam_pos;\n#endif\n",xc="#define MIX_COLOR_MODE_READ_FROM_TARGET 1\n#define MIX_COLOR_MODE_VERTEX_ATTRIBUTE 2\n",wc="#ifndef SIGNED_DISTANCE_FUNCTIONS_FSH\n#define SIGNED_DISTANCE_FUNCTIONS_FSH\nfloat sdf_intersect(const float distance1, const float distance2)\n{\n    return max(distance1, distance2);\n}\nfloat sdf_merge(const float distance1, const float distance2)\n{\n    return min(distance1, distance2);\n}\nfloat sdf_difference(const float distance1, const float distance2)\n{\n    return max(distance1, -distance2);\n}\nfloat sdf_half_plane(const vec2 coords, const vec2 normal)\n{\n    return dot(coords, normal);\n}\nfloat sdf_circle(const vec2 coords, const float radius)\n{\n    return length(coords) - radius;\n}\nfloat sdf_half_planes_cut(const vec2 coords, const vec2 normal1, const vec2 normal2, const vec2 cut_point, const mat2 derivatives)\n{\n    vec2 cut_normal1 = vec2(normal1.y, -normal1.x);\n    float cut1 = sdf_half_plane(coords - cut_point, cut_normal1) /\n        max(abs(dot(derivatives[0], cut_normal1)), abs(dot(derivatives[1], cut_normal1)));\n    vec2 cut_normal2 = vec2(normal2.y, -normal2.x);\n    float cut2 = sdf_half_plane(coords - cut_point, cut_normal2) /\n        max(abs(dot(derivatives[0], cut_normal2)), abs(dot(derivatives[1], cut_normal2)));\n    return sdf_merge(cut1, cut2);\n}\nfloat sdf_box( in vec2 p, in vec2 b )\n{\n    vec2 d = abs(p)-b;\n    return length(max(d,0.0)) + min(max(d.x,d.y),0.0);\n}\nfloat sdf_triangle(in vec2 p, in float width) {\n    return abs(p.x) - (p.y + .5) * width * .5;\n}\nfloat dot2(in vec2 p) {\n    return dot(p, p);\n}\nfloat sdf_chevron(in vec2 p, float width, float skew, float rounding)\n{\n    p.x = abs(p.x);\n    if (p.y + p.x > 1.0) {\n        return sqrt(dot2(p - vec2(0.25, 0.75))) - sqrt(2.0)/4.0;\n    }\n    return sqrt(min(dot2(p - vec2(0.00, 1.00)),\n                    dot2(p - 0.5 * max(p.x + p.y, 0.0)))) * sign(p.x - p.y);\n}\n#endif\n",Sc={affine_step:"\nfloat affine_step(const float edge0, const float edge1, const float x)\n{\n    return clamp((x - edge0) / (edge1 - edge0), 0., 1.);\n}\n",apply_opacity:yc,arrow_functions:"struct ArrowDistanceParameters\n{\n    vec2 wing_normal;\n    vec2 tip_normal;\n    vec2 mirrored_wing_normal;\n    vec2 mirrored_tip_normal;\n    float width;\n    float full_length;\n    float arrow_height;\n    float tip_radius;\n    vec2 tip_circle_center;\n    float wing_radius;\n    vec2 wing_circle_center;\n    float border_width;\n};\nArrowDistanceParameters calculate_arrow_distance_parameters(\n    const vec2 wing_normal,\n    const vec2 tip_normal,\n    const float width_zpt,\n    const float length_zpt,\n    const float tip_height_multiplier,\n    const float wing_height_multiplier,\n    const float tip_radius_zpt,\n    const float wing_radius_zpt,\n    const float border_width_zpt,\n    const vec2 tip_circle_center,\n    const vec2 wing_circle_center)\n{\n    vec2 mirrored_wing_normal = vec2(wing_normal.x, -wing_normal.y);\n    vec2 mirrored_tip_normal = vec2(tip_normal.x, -tip_normal.y);\n    float width = 0.5 * width_zpt;\n    float length = 0.5 * length_zpt;\n    float arrow_height = width_zpt * (tip_height_multiplier - wing_height_multiplier);\n    return ArrowDistanceParameters(\n        wing_normal,\n        tip_normal,\n        mirrored_wing_normal,\n        mirrored_tip_normal,\n        width,\n        length,\n        arrow_height,\n        tip_radius_zpt,\n        tip_circle_center,\n        wing_radius_zpt,\n        wing_circle_center,\n        border_width_zpt);\n}\nstruct ArrowDistances\n{\n    float top_tip_cut;\n    float bottom_tip_cut;\n    float line;\n    float bottom_left_wing;\n    float bottom_right_wing;\n    float top_left_wing;\n    float top_right_wing;\n    float tip_circle;\n    float tip_circle_cut;\n    float left_wing_circle;\n    float left_wing_circle_cut;\n    float right_wing_circle;\n    float right_wing_circle_cut;\n};\nArrowDistances calculate_arrow_distances(\n    const ArrowDistanceParameters arrow_parameters,\n    const vec2 texcoord,\n    const float offset,\n    const mat2 derivatives)\n{\n    float derivatives_x_multiplier = 1. / max(abs(derivatives[0].x), abs(derivatives[1].x));\n    float dt = ( texcoord.x - arrow_parameters.full_length - offset) * derivatives_x_multiplier;\n    float d0 = (-texcoord.x - arrow_parameters.full_length - offset) * derivatives_x_multiplier;\n    float d1 = (abs(texcoord.y) - arrow_parameters.width - offset) / max(abs(derivatives[0].y), abs(derivatives[1].y));\n    float d2 = (dot(texcoord - vec2(arrow_parameters.full_length - arrow_parameters.arrow_height, 0.), arrow_parameters.wing_normal) - offset) / max(abs(dot(derivatives[0], arrow_parameters.wing_normal)), abs(dot(derivatives[1], arrow_parameters.wing_normal)));\n    float d3 = (dot(texcoord - vec2(arrow_parameters.full_length - arrow_parameters.arrow_height, 0.), arrow_parameters.mirrored_wing_normal) - offset) / max(abs(dot(derivatives[0], arrow_parameters.mirrored_wing_normal)), abs(dot(derivatives[1], arrow_parameters.mirrored_wing_normal)));\n    float d4 = (dot(texcoord - vec2(arrow_parameters.full_length, 0.), arrow_parameters.tip_normal) - offset) / max(abs(dot(derivatives[0], arrow_parameters.tip_normal)), abs(dot(derivatives[1], arrow_parameters.tip_normal)));\n    float d5 = (dot(texcoord - vec2(arrow_parameters.full_length, 0.), arrow_parameters.mirrored_tip_normal) - offset) / max(abs(dot(derivatives[0], arrow_parameters.mirrored_tip_normal)), abs(dot(derivatives[1], arrow_parameters.mirrored_tip_normal)));\n    \n    float tip_circle_cut = sdf_half_planes_cut(\n        texcoord,\n        arrow_parameters.tip_normal,\n        -arrow_parameters.mirrored_tip_normal,\n        arrow_parameters.tip_circle_center,\n        derivatives);\n    float tip_circle = sdf_circle(\n        texcoord - arrow_parameters.tip_circle_center,\n        arrow_parameters.tip_radius + offset - arrow_parameters.border_width);\n    vec2 tip_circle_normal = normalize(texcoord - arrow_parameters.tip_circle_center);\n    tip_circle = tip_circle / max(abs(dot(derivatives[0], tip_circle_normal)), abs(dot(derivatives[1], tip_circle_normal)));\n    \n    vec2 right_wing_circle_center = vec2(arrow_parameters.wing_circle_center.x, -arrow_parameters.wing_circle_center.y);\n    vec2 left_wing_circle_normal = normalize(texcoord - arrow_parameters.wing_circle_center);\n    vec2 right_wing_circle_normal = normalize(texcoord - right_wing_circle_center);\n    float left_wing_circle = sdf_circle(texcoord - arrow_parameters.wing_circle_center,\n        arrow_parameters.wing_radius + offset - arrow_parameters.border_width);\n        left_wing_circle = left_wing_circle / max(abs(dot(derivatives[0], left_wing_circle_normal)), abs(dot(derivatives[1], left_wing_circle_normal)));\n    float right_wing_circle = sdf_circle(texcoord - right_wing_circle_center,\n        arrow_parameters.wing_radius + offset - arrow_parameters.border_width);\n        right_wing_circle = right_wing_circle / max(abs(dot(derivatives[0], right_wing_circle_normal)), abs(dot(derivatives[1], right_wing_circle_normal)));\n    float left_wing_circle_cut = sdf_half_planes_cut(\n        texcoord,\n        -arrow_parameters.tip_normal,\n        arrow_parameters.wing_normal,\n        arrow_parameters.wing_circle_center,\n        derivatives);\n    float right_wing_circle_cut = sdf_half_planes_cut(\n        texcoord,\n        arrow_parameters.mirrored_tip_normal,\n        -arrow_parameters.mirrored_wing_normal,\n        right_wing_circle_center,\n        derivatives);\n    return ArrowDistances(\n        dt,\n        d0,\n        d1,\n        d2,\n        d3,\n        d4,\n        d5,\n        tip_circle,\n        tip_circle_cut,\n        left_wing_circle,\n        left_wing_circle_cut,\n        right_wing_circle,\n        right_wing_circle_cut);\n}\n",bit_mask:"\n#ifdef WEBGL2\n#define UNPACK_BOOL1(packedValue) ((packedValue & 0x1) != 0)\n#define UNPACK_BOOL2(packedValue) ((packedValue & 0x2) != 0)\n#define UNPACK_BOOL3(packedValue) ((packedValue & 0x4) != 0)\n#else\n#define UNPACK_BOOL1(packedValue) (int(mod(float(packedValue), 2.0)) == 1)\n#define UNPACK_BOOL2(packedValue) (int(mod(float(packedValue) / 2.0, 2.0)) == 1)\n#define UNPACK_BOOL3(packedValue) (int(mod(float(packedValue) / 4.0, 2.0)) == 1)\n#endif\n",cam_pos:bc,circle_functions:"\nconst float g_distance_precision_limit = 1e-4;\nstruct CircleDistance\n{\n    float distance;\n    float width;\n};\nCircleDistance circle_color_distance(\n    const mat2 derivatives,\n    const vec2 circle,\n    const float circle_width)\n{\n    float circle_length = length(circle);\n    float distance = circle_length - circle_width;\n    \n    \n    \n    vec2 circle_dx = derivatives[0];\n    vec2 circle_dy = derivatives[1];\n    \n    float distance_dx = dot(circle, circle_dx);\n    float distance_dy = dot(circle, circle_dy);\n    \n    float derivative_denominator = circle_length;\n    float width = max(abs(distance_dx), abs(distance_dy));\n    return CircleDistance(\n        distance * derivative_denominator,\n        width);\n}\nvec4 distance_to_color(\n    const float fill_distance,\n    const float border_distance,\n    const vec4 fill_color,\n    const vec4 border_color)\n{\n    float fill_factor = affine_step(-1., 0., fill_distance);\n    float border_factor = affine_step(0., 1., border_distance);\n    return\n        mix(mix(fill_color, border_color, fill_factor), vec4(.0), border_factor);\n}\nvec4 distance_to_color(\n    const CircleDistance circle_distance,\n    const vec4 fill_color)\n{\n    \n    \n    float fill_factor = circle_distance.distance < g_distance_precision_limit\n        ? 0.\n        : affine_step(0., circle_distance.width, circle_distance.distance);\n    return mix(fill_color, vec4(0.), fill_factor);\n}\n",dem:"\n#ifndef VARYINGS_LIMIT_9\n    varying vec2 v_vec2_dem_tex_pos;\n    varying float v_float_dem_invalid;\n#endif\nint check_dem_invalid() {\n    #ifndef VARYINGS_LIMIT_9\n    if (v_float_dem_invalid != 0. || v_vec2_dem_tex_pos.x < 0. || v_vec2_dem_tex_pos.x > 1. || v_vec2_dem_tex_pos.y < 0. || v_vec2_dem_tex_pos.y > 1.) {\n        return 1;\n    }\n    #endif\n    return 0;\n}\n",enable_standard_derivatives:"#ifdef WEBGL1\n#extension GL_OES_standard_derivatives: enable\n#endif\n",fog:"\n#define LINEAR 0\n#define EXP 1\n#define FOG_EQUATION (LINEAR)\n#define EPSILON (0.0001)\n#ifndef UBO\n# ifdef FOG\nuniform vec4 u_fog_color;\nuniform vec2 u_fog_limits;\nuniform float u_fog_horizon_blend;\nuniform float u_fog_horizon_level;\n# endif\n#endif \n#if defined(FOG) || defined(SKY)\n# ifndef UBO\nuniform vec4 u_sky_color;\n# endif\nvarying vec3 v_fog_pos;\n#endif\n#ifdef FOG\nfloat fog_horizon_blending(vec3 camera_dir, float blend) {\n    blend = EPSILON + blend;\n    float t = max(camera_dir.z / blend, 0.0);\n    \n    return exp(-3.0 * t * t);\n}\nfloat fog_exponential(float t) {\n    const float decay = 6.0;\n    float falloff = 1.0 - min(1.0, exp(-decay * t));\n    \n    falloff *= falloff * falloff;\n    \n    return min(1.0, 1.00747 * falloff);\n}\nfloat fog_depth(float depth) {\n    float start = u_fog_limits.x;\n    float end = u_fog_limits.y;\n    float range = end - start;\n    float fac = (depth - start) / range;\n#if (FOG_EQUATION == LINEAR)\n    \n    fac = clamp(fac, 0.0, 1.0);\n#elif (FOG_EQUATION == EXP)\n    fac = fog_exponential(fac);\n#endif\n    return fac;\n}\nfloat calc_depth_fog() {\n    float depth = length(v_fog_pos);\n    float fac = fog_depth(depth);\n    return fac;\n}\nvec3 calc_fog_color() {\n    float depth = length(v_fog_pos);\n    vec3 dir = v_fog_pos / depth;\n    \n    dir.z -= u_fog_horizon_level;\n    float fog_blend = fog_horizon_blending(dir, u_fog_horizon_blend);\n    if (u_sky_color.a <= 0.01) {\n        return u_fog_color.rgb / u_fog_color.a;\n    } else {\n        \n        return mix(u_sky_color.rgb / u_sky_color.a, u_fog_color.rgb / u_fog_color.a, min(fog_blend + (1.0 - u_sky_color.a), 1.0));\n    }\n}\n#endif \nvec4 apply_fog(vec4 color) {\n#ifdef FOG\n    if (u_fog_color.a <= 0.01) {\n        return color;\n    }\n    float alpha = EPSILON + color.a;\n    float fac = calc_depth_fog();\n    vec3 fog_color = calc_fog_color();\n    color.rgb /= alpha;\n    color.rgb = mix(color.rgb, fog_color, fac * u_fog_color.a);\n    color.rgb *= alpha;\n#endif\n    return color;\n}\nvec4 apply_fog_alpha(vec4 color) {\n#ifdef FOG\n    if (u_fog_color.a <= 0.01) {\n        return color;\n    }\n    color *= 1.0 - calc_depth_fog();\n#endif\n    return color;\n}\nvec4 apply_fog_sky(vec4 color) {\n#ifdef FOG\n    float alpha = EPSILON + color.a;\n    float depth = length(v_fog_pos);\n    vec3 dir = v_fog_pos / depth;\n    \n    dir.z -= u_fog_horizon_level;\n    float fac = fog_horizon_blending(dir, u_fog_horizon_blend);\n    color.rgb /= alpha;\n    color.rgb = mix(color.rgb, u_fog_color.rgb, fac * u_fog_color.a);\n    color.rgb *= alpha;\n#endif\n    return color;\n}",fragment_normal:"#define FRAGMENT_NORMAL\nvec3 calc_fragment_normal(vec3 vertex) {\n    vec3 dx = dFdx(vertex);\n    vec3 dy = dFdy(vertex);\n    return normalize(cross(dx, dy));\n}",highp_float:"precision highp float;\n",light:"#ifdef UBO\nuniform LightSettings\n{\n    vec3 u_vec3_light_dir1_direction;\n    vec4 u_vec4_light_dir1_color;\n    vec3 u_vec3_light_dir2_direction;\n    vec4 u_vec4_light_dir2_color;\n    vec4 u_vec4_ambient_color;\n};\n#else\nuniform vec3 u_vec3_light_dir1_direction;\nuniform vec4 u_vec4_light_dir1_color;\nuniform vec3 u_vec3_light_dir2_direction;\nuniform vec4 u_vec4_light_dir2_color;\nuniform vec4 u_vec4_ambient_color;\n#endif\nuniform int u_int_light_flags;\nvec4 light_factor(vec3 normal) {\n    bool use_light = UNPACK_BOOL1(u_int_light_flags);\n    if (!use_light) { \n        return vec4(1.);\n    }\n    float light_1_factor = max(dot(normal, -u_vec3_light_dir1_direction), 0.0);\n    float light_2_factor = max(dot(normal, -u_vec3_light_dir2_direction), 0.0);\n    if (UNPACK_BOOL2(u_int_light_flags)) {\n        light_1_factor *= compute_shadow_factor();\n    } else if (UNPACK_BOOL3(u_int_light_flags)) {\n        light_2_factor *= compute_shadow_factor();\n    }\n    vec3 direct_light_contrib = u_vec4_light_dir1_color[3] * light_1_factor * u_vec4_light_dir1_color.rgb;\n    vec3 shading_light_contrib = u_vec4_light_dir2_color[3] * light_2_factor * u_vec4_light_dir2_color.rgb;\n    return vec4(u_vec4_ambient_color[3] * u_vec4_ambient_color.rgb + direct_light_contrib + shading_light_contrib, 1.0);\n}\nfloat light_factor_dem(vec3 normal) {\n    bool use_light = UNPACK_BOOL1(u_int_light_flags);\n    if (!use_light) { \n        return 1.;\n    }\n    float light_1_factor = dot(normal, -u_vec3_light_dir1_direction);\n    \n    \n    \n    \n    return light_1_factor;\n}\nvec4 light_factor(vec3 normal, vec3 pos_world) {\n    \n    if (dot(u_cam_pos - pos_world, normal) < 0.) {\n        normal *= vec3(-1.);\n    }\n    return light_factor(normal);\n}\nvec4 light_factor_surface() {\n    bool use_light = UNPACK_BOOL1(u_int_light_flags);\n    if (!use_light) {\n        return vec4(1.);\n    }\n    vec3 normal = vec3(0., 0., 1.);\n    float light_1_factor = max(dot(normal, -u_vec3_light_dir1_direction), 0.0);\n    float light_2_factor = max(dot(normal, -u_vec3_light_dir2_direction), 0.0);\n    if (UNPACK_BOOL2(u_int_light_flags)) {\n        light_1_factor *= compute_shadow_factor();\n    } else if (UNPACK_BOOL3(u_int_light_flags)) {\n        light_2_factor *= compute_shadow_factor();\n    }\n     return vec4(u_vec4_ambient_color[3] * u_vec4_ambient_color.rgb\n         + u_vec4_light_dir1_color[3] * light_1_factor * u_vec4_light_dir1_color.rgb\n         + u_vec4_light_dir2_color[3] * light_2_factor * u_vec4_light_dir2_color.rgb, 1.0);\n}\n",light_pbr:"\n#define LIGHT_MODEL_PBR 2\n#ifdef LIGHT_MODEL\n#if LIGHT_MODEL == LIGHT_MODEL_PBR\n    const float PI = 3.14159265359;\n    \n    float D(float alpha, vec3 N, vec3 H) {\n        float numerator = alpha * alpha;\n        float NdotH = max(dot(N, H), 0.);\n        float denominator = PI * pow(\n            NdotH * NdotH * (alpha * alpha - 1.) + 1.,\n            2.\n        );\n        return numerator / max(denominator, 0.000001);\n    }\n    \n    float G1(float alpha, vec3 N, vec3 X) {\n        float numerator = max(dot(N, X), 0.);\n        float k = alpha / 2.;\n        float denominator = max(dot(N, X), 0.) * (1. - k) + k;\n        return numerator / max(denominator, 0.000001);\n    }\n    \n    float G(float alpha, vec3 N, vec3 V, vec3 L) {\n        return G1(alpha, N, V) * G1(alpha, N, L);\n    }\n    \n    vec3 F(vec3 F0, vec3 V, vec3 H) {\n        return F0 + (vec3(1.) - F0) * pow(1. - max(dot(V, H), 0.), 5.);\n    }\n    vec3 color_pbr(vec3 fragment_normal, vec3 fragment_pos_world, vec3 albedo, float roughness, float metallic) {\n        float alpha = roughness * roughness;\n        vec3 F0 = vec3(0.04);\n        F0 = mix(F0, vec3(1.), metallic);\n        \n        vec3 emitted_light = u_vec4_ambient_color.rgb * u_vec4_ambient_color[3];\n        vec3 N = fragment_normal;\n        \n        vec3 V = normalize(u_cam_pos - fragment_pos_world);\n        \n        vec3 L = -u_vec3_light_dir1_direction;\n        \n        vec3 H = normalize(V + L);\n        float shadow_factor = compute_shadow_factor();\n        vec3 Ks = F(F0, V, H);\n        vec3 Kd = (vec3(1.0) - Ks) * (1. - metallic);\n        vec3 lambert = albedo / PI;\n        vec3 cookTorranceNumerator = D(alpha, N, H) * G(alpha, N, V, L) * Ks;\n        float cookTorranceDenominator = 4.0 * max(dot(V, N), 0.) * max(dot(L, N), 0.);\n        cookTorranceDenominator = max(cookTorranceDenominator, 0.000001);\n        vec3 cookTorrance = cookTorranceNumerator / cookTorranceDenominator;\n        vec3 BRDF = Kd * lambert + cookTorrance;\n        vec3 outgoingLight = BRDF * u_vec4_light_dir1_color.rgb * u_vec4_light_dir1_color[3] * max(dot(L, N), 0.);\n        vec3 ambient = u_vec4_ambient_color.rgb * u_vec4_ambient_color[3] * albedo;\n        return ambient + outgoingLight * shadow_factor;\n    }\n#endif\n#endif\n",light_phong:"#define LIGHT_MODEL_PHONG 1\n#ifdef LIGHT_MODEL\n#if LIGHT_MODEL == LIGHT_MODEL_PHONG\nconst float g_specular_power_max = 32.0;\nconst float g_specular_power_min = 2.0;\nvec2 pbr_to_gloss(vec3 material_attributes)\n{\n    float weight = material_attributes.x;\n    float roughness = material_attributes.y;\n    float metallic = material_attributes.z;\n    \n    \n    float specular_strength = weight * metallic;\n    float specular_power = roughness * (g_specular_power_min - g_specular_power_max) + g_specular_power_max;\n    return vec2(specular_strength, specular_power);\n}\nvec3 color_phong(vec3 fragment_normal, highp vec3 fragment_pos_world, vec3 albedo, float roughness, float metallic) {\n    vec2 specular_values = pbr_to_gloss(vec3(1., roughness, metallic));\n    float specular_strength = specular_values.x;\n    float specular_power = specular_values.y;\n    \n    float shadow_factor = compute_shadow_factor();\n    \n    vec3 ambient = u_vec4_ambient_color.rgb * u_vec4_ambient_color[3];\n    \n    float diff = max(dot(fragment_normal, -u_vec3_light_dir1_direction), 0.0);\n    vec3 diffuse = u_vec4_light_dir1_color.rgb * u_vec4_light_dir1_color[3] * diff * shadow_factor;\n    \n    \n    vec3 view_dir = normalize(u_cam_pos - fragment_pos_world);\n    \n    vec3 reflect_dir = reflect(u_vec3_light_dir1_direction, fragment_normal);\n    float spec = pow(max(dot(view_dir, reflect_dir), 0.0), specular_power);\n    vec3 specular = u_vec4_light_dir1_color.rgb * u_vec4_light_dir1_color[3] * spec * specular_strength * shadow_factor;\n    return albedo * (ambient + diffuse) + specular;\n}\n#endif\n#endif\n",lowp_float:"precision lowp float;\n",mediump_float:"precision mediump float;\n",mix_color_defs:xc,pack_depth:"vec4 pack_float_to_vec4(float depth)\n{\n    const vec4 bit_shift = vec4(255.0 * 255.0 * 255.0, 255.0 * 255.0, 255.0, 1.0);\n    const vec4 bit_mask = vec4(0.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n    vec4 res = fract(depth * bit_shift);\n    res -= res.xxyz * bit_mask;\n    return res;\n}\nfloat unpack_float_from_vec4(vec4 color)\n{\n    const vec4 bit_shift = vec4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);\n    return dot(color, bit_shift);\n}",prelude:"#ifdef WEBGL2\n#define varying in\n#define attribute in\n#define texture2D texture\n#define gl_FragColor fragColor\nout vec4 gl_FragColor;\n#endif\n#ifdef UBO\nuniform CommonSettings\n{\n    mediump float u_float_rounding_factor;\n    mediump float u_float_border_width_offset;\n    mediump vec2 u_vec2_scale_limits;\n    mediump vec2 u_vec2_depth_test_half_point_size;\n    mediump vec2 u_vec2_vpt_size;\n    \n    mediump vec4 u_fog_color;\n    mediump vec2 u_fog_limits;\n    mediump float u_fog_horizon_blend;\n    mediump float u_fog_horizon_level;\n    mediump float u_fog_distance;\n    mediump vec4 u_sky_color;\n    highp vec3 u_cam_pos; \n    \n    \n    \n    \n    \n    \n    mediump vec4 u_shadow_map_params; \n    highp mat4 u_mat4_clip_to_shadow;\n    mediump float u_shadow_bias;\n    mediump mat4 u_mat4_view_transposed;\n    mediump mat4 u_mat4_proj_inverted;\n    \n    mediump vec2 u_vec2_halo_viewport_size;\n    mediump vec2 u_vec2_halo_viewport_center_shift;\n    mediump vec4 u_vec4_halo_radius_stops;\n    mediump vec4 u_vec4_halo_color;\n    mediump float u_float_halo_exp_factor;\n    mediump vec4 u_vec4_default_background_color;\n    \n    mediump mat4 u_mat4_stars;\n    mediump float u_float_pixelratio;\n    mediump float u_float_stars_intensity;\n};\n#endif\n",require_frag_depth:"#ifdef HAS_FRAG_DEPTH_EXT\n#extension GL_EXT_frag_depth : require\n#endif\n",screendoor_transparency:"uniform float u_sdtr_distance;\n#ifdef SCREENDOOR\nvarying vec3 v_clipspace_pos;\n#endif\nfloat interleaved_gradient_noise()\n{\n    const vec3 m = vec3(0.06711056, 0.00583715, 52.9829189);\n    return fract(m.z * fract(dot(gl_FragCoord.xy, m.xy)));\n}\nvoid apply_screendoor() {\n    #ifdef SCREENDOOR\n    if (u_sdtr_distance == 0.) {\n        return;\n    }\n    float factor = smoothstep(0., u_sdtr_distance, v_clipspace_pos.z);\n    float patternValue = interleaved_gradient_noise();\n    float shaped = factor - patternValue;\n    if (shaped <= 0.) {\n        discard;\n    }\n    #endif\n    return;\n}\n",shadow:"#ifdef RENDER_SHADOWS\n# if defined(WEBGL2) && defined(DEPTH_TEXTURE_SHADOW)\nuniform mediump sampler2DShadow u_texture_shadow;\n# else\nuniform sampler2D u_texture_shadow;\n# endif\n# ifndef UBO\nuniform mediump vec4 u_shadow_map_params;\n# endif \nvarying float v_depth_metric;\nvarying vec4 v_pos_from_light;\nfloat get_shadow(vec3 coords) {\n# if defined(WEBGL2) && defined(DEPTH_TEXTURE_SHADOW)\n    \n    return texture2D( u_texture_shadow, coords );\n# else\n# ifdef DEPTH_TEXTURE_SHADOW\n    \n    float shadow_depth = texture2D(u_texture_shadow, coords.xy, 0.).r;\n# else\n    \n    \n    float shadow_depth = unpack_float_from_vec4(texture2D(u_texture_shadow, coords.xy, 0.));\n# endif\n    float depth_diff = v_depth_metric - shadow_depth;\n    if (depth_diff <= 0.) {\n        return 1.0;\n    }\n    return 0.0;\n# endif\n}\nfloat sample_shadow_texture(vec3 shadow_coord) {\n    vec2 shadow_map_size = u_shadow_map_params.xy;\n    float radius = u_shadow_map_params.z;\n    vec2 texelSize = vec2( 1.0 ) / shadow_map_size;\n    float dx0 = - texelSize.x * radius;\n    float dy0 = - texelSize.y * radius;\n    float dx1 = + texelSize.x * radius;\n    float dy1 = + texelSize.y * radius;\n    float dx2 = dx0 / 2.0;\n    float dy2 = dy0 / 2.0;\n    float dx3 = dx1 / 2.0;\n    float dy3 = dy1 / 2.0;\n    \n    \n    return (\n        get_shadow( shadow_coord + vec3( dx0, dy0, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( 0.0, dy0, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx1, dy0, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx2, dy2, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( 0.0, dy2, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx3, dy2, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx0, 0.0, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx2, 0.0, 0.0 ) ) +\n        get_shadow( shadow_coord) +\n        get_shadow( shadow_coord + vec3( dx3, 0.0, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx1, 0.0, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx2, dy3, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( 0.0, dy3, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx3, dy3, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx0, dy1, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( 0.0, dy1, 0.0 ) ) +\n        get_shadow( shadow_coord + vec3( dx1, dy1, 0.0 ) )\n    ) * ( 1.0 / 17.0 );\n}\nfloat compute_shadow_factor()\n{\n    vec4 light_pos = v_pos_from_light;\n# ifdef FRAGMENT_NORMAL\n    \n    \n    float normal_bias = u_shadow_map_params[3];\n    vec3 norm_from_light = calc_fragment_normal(light_pos.xyz);\n    light_pos.xyz -= normal_bias * norm_from_light;\n# endif\n    vec3 clip_space = light_pos.xyz / light_pos.w;\n    \n    float clip_factor = smoothstep(0.5, 1.0, length(clip_space));\n    if (clip_factor >= 1.0) {\n        return 1.0;\n    }\n# if defined(DEPTH_TEXTURE_SHADOW) && defined(WEBGL2)\n    vec3 lightPovPositionInTexture = 0.5 * light_pos.xyz + 0.5;\n    float shadow_factor = sample_shadow_texture(lightPovPositionInTexture);\n# else\n    vec3 uv = 0.5 * clip_space + vec3(0.5);\n    float shadow_factor = sample_shadow_texture(uv);\n# endif\n    \n    shadow_factor = mix(shadow_factor, 1.0, clip_factor);\n    return shadow_factor;\n}\n#else  \nfloat compute_shadow_factor()\n{\n    return 1.0;\n}\n#endif ",signed_distance_functions:wc},Mc={arrow_line:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <affine_step>\n#include <signed_distance_functions>\n#include <arrow_functions>\n#include <circle_functions>\n#include <fog>\nuniform float u_float_tip_height_multiplier;\nuniform float u_float_wing_height_multiplier;\nuniform float u_float_wing_width_multiplier;\nvarying vec2 v_vec2_line_type_arrow_tail;\nvarying vec4 v_vec4_arrow_width_length_border_outer;\nvarying vec4 v_vec4_texcoord_arrow_line;\nvarying vec4 v_vec4_distance_vertex_hiding;\n#ifdef ENTRANCE_ARROWS_ROUNDING\nvarying vec3 v_vec3_radius_tip_wing_tail;\n#endif\nvarying vec4 v_vec4_circle_center_tip_wing;\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_border_color;\nconst float g_type_arrow = 1.;\nconst float g_type_start_border = 2.;\nbool lookalike(const float a, const float b)\n{\n    return abs(a - b) < 1e-4;\n}\nfloat filter_border(const float start, const float value)\n{\n    return step(start, value) * 2. - 1.;\n}\nfloat arrow_distance(\n    const ArrowDistanceParameters arrow_parameters,\n    const vec2 texcoord,\n    const float offset,\n    const mat2 derivatives,\n    const float line_distance,\n    const float line_distance_no_offset,\n    \n    \n    const float border_width,\n    const vec2 wing_normal)\n{\n    ArrowDistances ad = calculate_arrow_distances(arrow_parameters, texcoord, offset, derivatives);\n    float derivatives_x_multiplier = 1. / max(abs(derivatives[0].x), abs(derivatives[1].x));\n    \n    \n    float intersection_point = arrow_parameters.full_length - arrow_parameters.arrow_height\n        - arrow_parameters.width * wing_normal.y / wing_normal.x;\n    float tail_arrow_intersection = filter_border(-1., (texcoord.x - intersection_point) * derivatives_x_multiplier);\n    \n    float top_wings;\n    float bottom_wings;\n    #ifdef ENTRANCE_ARROWS_ROUNDING\n    top_wings = sdf_intersect(sdf_intersect(ad.top_left_wing, ad.top_right_wing), ad.tip_circle_cut);\n    top_wings = sdf_merge(top_wings, ad.tip_circle);\n    top_wings = sdf_intersect(top_wings, ad.top_tip_cut);\n    float wings_circles = sdf_merge(ad.left_wing_circle, ad.right_wing_circle);\n    float wings_radius_cut = sdf_intersect(ad.left_wing_circle_cut, ad.right_wing_circle_cut);\n    bottom_wings = sdf_merge(ad.bottom_left_wing, ad.bottom_right_wing);\n    bottom_wings = sdf_intersect(bottom_wings, wings_radius_cut);\n    bottom_wings = sdf_merge(bottom_wings, wings_circles);\n    #else\n    top_wings = sdf_intersect(ad.top_left_wing, ad.top_right_wing);\n    bottom_wings = sdf_merge(ad.bottom_left_wing, ad.bottom_right_wing);\n    #endif\n    float line_without_offset = filter_border(0., line_distance_no_offset);\n    float bottom_wings_with_tail = sdf_merge(bottom_wings, line_without_offset);\n    float wings_with_tail = sdf_intersect(bottom_wings_with_tail, top_wings);\n    \n    float tail_hide_part = v_vec2_line_type_arrow_tail.y;\n    float tail_hide_mask = (-texcoord.x - tail_hide_part) * derivatives_x_multiplier;\n    float clipped_tail = sdf_intersect(tail_hide_mask, sdf_intersect(line_distance, top_wings));\n    return (v_vec4_distance_vertex_hiding.x < v_vec4_distance_vertex_hiding.y)\n        ? sdf_intersect(-sdf_intersect(tail_arrow_intersection, line_without_offset), wings_with_tail)\n        : sdf_merge(clipped_tail, sdf_intersect(-sdf_intersect(tail_arrow_intersection, line_without_offset), wings_with_tail));\n}\nvec4 distance_to_arrow_line_color(\n    const float fill_distance,\n    const float border_distance)\n{\n    return distance_to_color(fill_distance, border_distance, v_vec4_color, v_vec4_border_color);\n}\nvec4 arrow_color(\n    const vec2 texcoord,\n    const ArrowDistanceParameters arrow_parameters,\n    const float line_fill_distance,\n    const float line_border_distance,\n    const vec2 wing_normal)\n{\n    mat2 derivatives = mat2(dFdx(texcoord), dFdy(texcoord));\n    \n    float border_clipping = (abs(texcoord.y) - v_vec4_arrow_width_length_border_outer.w) / max(abs(derivatives[0].y), abs(derivatives[1].y));\n    float border_width = v_vec4_arrow_width_length_border_outer.z;\n    float arrow_border_distance = arrow_distance(\n        arrow_parameters,\n        texcoord,\n        v_vec4_arrow_width_length_border_outer.z,\n        derivatives,\n        line_border_distance,\n        line_fill_distance,\n        border_width,\n        wing_normal);\n    float border_factor = max(border_clipping, affine_step(0., 1., arrow_border_distance));\n    return distance_to_arrow_line_color(\n        arrow_distance(arrow_parameters, texcoord, 0., derivatives, line_fill_distance, line_fill_distance, border_width, wing_normal),\n        border_factor);\n}\nfloat line_start_distance(\n    const vec2 texcoord,\n    const float offset,\n    const mat2 derivatives,\n    const float line_distance,\n    const float half_width,\n    const float border_width,\n    const float tail_radius)\n{\n    float derivatives_x_multiplier = 1. / max(abs(derivatives[0].x), abs(derivatives[1].x));\n    \n    float tail_hide_part = v_vec2_line_type_arrow_tail.y;\n    float d0 = (-texcoord.x - offset) * derivatives_x_multiplier;\n    float dh = (texcoord.x - tail_hide_part) * derivatives_x_multiplier;\n    float rect = max(d0, max(line_distance, dh));\n    \n    float radius_offset = tail_radius - border_width;\n    float circle_radius = radius_offset + offset;\n    vec2 left_circle_center = vec2(radius_offset, half_width - radius_offset);\n    vec2 right_circle_center = vec2(radius_offset, -half_width + radius_offset);\n    vec2 left_circle_normal = normalize(texcoord - left_circle_center);\n    vec2 right_circle_normal = normalize(texcoord - right_circle_center);\n    float cut_x = (-texcoord.x + radius_offset) * derivatives_x_multiplier;\n    float cut_y = (abs(texcoord.y) - half_width + radius_offset) / max(abs(derivatives[0].y), abs(derivatives[1].y));\n    float circles_cut = min(cut_x, cut_y);\n    float left_circle = length(texcoord - left_circle_center) - circle_radius;\n    left_circle = left_circle / max(abs(dot(derivatives[0], left_circle_normal)), abs(dot(derivatives[1], left_circle_normal)));\n    float right_circle = length(texcoord - right_circle_center) - circle_radius;\n    right_circle = right_circle / max(abs(dot(derivatives[0], right_circle_normal)), abs(dot(derivatives[1], right_circle_normal)));\n    float circles = min(left_circle, right_circle);\n    rect = min(max(rect, circles_cut), circles);\n    return rect;\n}\nvec4 line_color(\n    const float line_fill_distance,\n    const float line_border_distance,\n    const float line_half_width,\n    const float border_width,\n    const float tail_radius)\n{\n    float type = v_vec2_line_type_arrow_tail.x;\n    float fill_distance = line_fill_distance;\n    float border_distance = line_border_distance;\n    if (lookalike(type, g_type_start_border))\n    {\n        vec2 texcoord = v_vec4_texcoord_arrow_line.xy;\n        mat2 derivatives = mat2(dFdx(texcoord), dFdy(texcoord));\n        fill_distance = line_start_distance(\n            texcoord, 0.,\n            derivatives,\n            line_fill_distance,\n            line_half_width,\n            border_width,\n            tail_radius);\n        border_distance = line_start_distance(\n            texcoord,\n            v_vec4_arrow_width_length_border_outer.z,\n            derivatives,\n            line_border_distance,\n            line_half_width,\n            border_width,\n            tail_radius);\n    }\n    return distance_to_arrow_line_color(fill_distance, border_distance);\n}\nvec4 arrow_line_color()\n{\n    if (lookalike(min(v_vec4_distance_vertex_hiding.y, 1.), 1.)\n        || lookalike(v_vec4_distance_vertex_hiding.w, 1.)\n        || !lookalike(v_vec2_line_type_arrow_tail.x, g_type_arrow) && (v_vec4_distance_vertex_hiding.x < v_vec4_distance_vertex_hiding.y || v_vec4_distance_vertex_hiding.x > v_vec4_distance_vertex_hiding.z))\n    {\n        discard;\n    }\n    vec2 wing_normal = -normalize(vec2(u_float_wing_width_multiplier, u_float_wing_height_multiplier));\n    vec2 tip_normal = normalize(vec2(u_float_wing_width_multiplier, u_float_tip_height_multiplier));\n    float tip_radius;\n    float wing_radius;\n    float tail_radius;\n    #ifdef ENTRANCE_ARROWS_ROUNDING\n    tip_radius = v_vec3_radius_tip_wing_tail.x;\n    wing_radius = v_vec3_radius_tip_wing_tail.y;\n    tail_radius = v_vec3_radius_tip_wing_tail.z;\n    #else\n    tip_radius = 0.;\n    wing_radius = 0.;\n    tail_radius = 0.;\n    #endif\n    ArrowDistanceParameters arrow_parameters = calculate_arrow_distance_parameters(\n        wing_normal,\n        tip_normal,\n        v_vec4_arrow_width_length_border_outer.x,\n        v_vec4_arrow_width_length_border_outer.y,\n        u_float_tip_height_multiplier,\n        u_float_wing_height_multiplier,\n        tip_radius,\n        wing_radius,\n        v_vec4_arrow_width_length_border_outer.z,\n        v_vec4_circle_center_tip_wing.xy,\n        v_vec4_circle_center_tip_wing.zw);\n    float line_width = arrow_parameters.width;\n    float line_border = v_vec4_arrow_width_length_border_outer.z;\n    \n    vec2 line_texcoord = v_vec4_texcoord_arrow_line.zw;\n    mat2 line_derivatives = mat2(dFdx(line_texcoord), dFdy(line_texcoord));\n    CircleDistance circle_fill_distance = circle_color_distance(line_derivatives, line_texcoord, line_width);\n    CircleDistance circle_border_distance = circle_color_distance(line_derivatives, line_texcoord, line_width + line_border);\n    float line_fill_distance = affine_step(-1., 0., circle_fill_distance.distance / circle_fill_distance.width) - 1.;\n    float line_border_distance = affine_step(0., circle_border_distance.width, circle_border_distance.distance);\n    return lookalike(v_vec2_line_type_arrow_tail.x, g_type_arrow)\n        ? arrow_color(v_vec4_texcoord_arrow_line.xy, arrow_parameters, line_fill_distance, line_border_distance, wing_normal)\n        : line_color(line_fill_distance, line_border_distance, line_width, line_border, tail_radius);\n}\nvoid main()\n{\n    vec4 color = arrow_line_color();\n    gl_FragColor = apply_fog(color);\n}\n",arrow_line_identify:"#include <highp_float>\n#include <prelude>\nvarying vec2 v_vec2_line_type_arrow_tail;\nvarying vec4 v_vec4_distance_vertex_hiding;\nvarying vec4 v_vec4_identifier;\nconst float g_type_arrow = 1.;\nbool lookalike(const float a, const float b)\n{\n    return abs(a - b) < 1e-5;\n}\nvoid main()\n{\n    if (lookalike(min(v_vec4_distance_vertex_hiding.y, 1.), 1.)\n        || lookalike(v_vec4_distance_vertex_hiding.w, 1.)\n        || !lookalike(v_vec2_line_type_arrow_tail.x, g_type_arrow) && (v_vec4_distance_vertex_hiding.x < v_vec4_distance_vertex_hiding.y || v_vec4_distance_vertex_hiding.x > v_vec4_distance_vertex_hiding.z))\n    {\n        discard;\n    }\n    gl_FragColor = v_vec4_identifier;\n}\n",circle_marker:"#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <affine_step>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\nuniform vec4 u_vec4_color;\nvarying vec2 v_vec2_circle;\nvarying float v_float_width;\nvoid main() {\n    float center_distance = dot(v_vec2_circle, v_vec2_circle);\n    vec4 light = light_factor_surface();\n    vec4 color = u_vec4_color * affine_step(1.0, 1.0 - 4.0 / v_float_width, center_distance) * light;\n    gl_FragColor = apply_fog_alpha(color);\n}\n",color:"#include <lowp_float>\n#include <prelude>\n#include <fog>\nvarying vec4 v_vec4_color;\nvoid main()\n{\n    gl_FragColor = apply_fog(v_vec4_color);\n}\n",color_identify:"#include <lowp_float>\n#include <prelude>\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    gl_FragColor = v_vec4_identifier;\n}\n",color_with_z_fade:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <screendoor_transparency>\n#include <fragment_normal>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_rotated_scaled_vertex;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    apply_screendoor();\n    vec3 normal = calc_fragment_normal(v_vec4_rotated_scaled_vertex.xyz);\n    vec4 light = light_factor(normal);\n    vec4 color = v_vec4_color * light;\n    gl_FragColor = apply_fog(color);\n# ifndef BLEND\n    \n    gl_FragColor /= gl_FragColor.a;\n# endif\n}\n",copy:"#ifdef COPY_DEPTH\n#include <require_frag_depth>\n#endif\n#include <mediump_float>\n#include <prelude>\n#if defined(IS_DEPTH_TEXTURE) && defined(WEBGL2)\nuniform mediump sampler2DShadow u_texture;\n#else\nuniform sampler2D u_texture;\n#endif\n#ifdef COPY_DEPTH\nuniform sampler2D u_depth;\n#endif\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n#if defined(IS_DEPTH_TEXTURE) && defined(WEBGL2)\n    gl_FragColor = vec4(vec3(texture2D(u_texture, vec3(v_vec2_texcoord, 1.0))), 1.0);\n#else\n    gl_FragColor = texture2D(u_texture, v_vec2_texcoord);\n#endif\n#ifdef COPY_DEPTH\n    float depthR = texture2D(u_depth, v_vec2_texcoord).r;\n# ifdef WEBGL1\n#  ifdef HAS_FRAG_DEPTH_EXT\n     gl_FragDepthEXT = depthR;\n#  else \n     discard;\n#  endif \n# else \n     gl_FragDepth = depthR;\n# endif \n#endif \n}\n",dem_elevation:"#include <mediump_float>\n#include <prelude>\nvarying float v_float_height;\nvoid main()\n{\n  gl_FragColor = vec4(v_float_height, 0., 0., 1.);\n}\n",dem_elevation_copy:"#include <mediump_float>\n#include <prelude>\nuniform sampler2D u_sr2d_texture;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n  gl_FragColor = texture2D(u_sr2d_texture, v_vec2_texcoord);\n}\n",dem_flat_bottom:"#include <mediump_float>\n#include <prelude>\nvarying vec4 v_vec4_color;\nvoid main()\n{\n    gl_FragColor = v_vec4_color;\n}\n",dem_ground:"#include <mediump_float>\n#include <prelude>\n#include <dem>\nvarying vec4 v_vec4_coords;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\ndiscard;\n}\n    gl_FragColor = v_vec4_coords;\n}\n",dem_ground2:"#include <mediump_float>\n#include <prelude>\nvarying vec4 v_vec4_coords;\nvoid main()\n{\n    gl_FragColor = v_vec4_coords;\n}\n",dem_mesh:"#include <enable_standard_derivatives>\n#include <mediump_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\nuniform sampler2D u_flat_tex;\nuniform sampler2D u_hillshade_tex;\nuniform sampler2D u_tex_hillshade_ramp;\nuniform float u_float_dem_shading_intensity;\nvarying vec4 v_vec4_texcoord;\nvarying vec2 hs_tex_pos;\nvoid main()\n{\n    \n    if (v_vec4_texcoord.z > 0.) {\n        discard;\n    }\n    vec4 vec4_texcoord = v_vec4_texcoord / v_vec4_texcoord.w;\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n     \n    if (vec4_texcoord.x < 0. || vec4_texcoord.x > 1. || vec4_texcoord.y < 0. || vec4_texcoord.y > 1.) {\n        discard;\n    } else {\n        vec4 flatMapColor = texture2D(u_flat_tex, vec4_texcoord.xy);\n        \n        if (u_float_dem_shading_intensity > 0.) {\n            \n            vec3 normal = texture2D(u_hillshade_tex, hs_tex_pos).rgb * 2. - vec3(1.);\n            \n            float light_raw = light_factor_dem(normal);\n            float dir1_intensity = u_vec4_light_dir1_color[3];\n            float amb_intensity = u_vec4_ambient_color[3];\n            float total_intensity = dir1_intensity + amb_intensity;\n            \n            \n            float amb_intensity_shifted = u_vec4_ambient_color[3];\n            float dir_intensity_shifted = dir1_intensity;\n            \n            float horizonatal_surface_light_dir_dot = light_factor_dem(vec3(0, 0, 1));\n            float horizonatal_surface_light_intensity = amb_intensity + dir1_intensity * horizonatal_surface_light_dir_dot;\n            if (u_float_dem_shading_intensity > 0.5) { \n                amb_intensity_shifted = mix(amb_intensity, 0., (u_float_dem_shading_intensity - 0.5) / 0.5);\n                dir_intensity_shifted = (horizonatal_surface_light_intensity - amb_intensity_shifted) / horizonatal_surface_light_dir_dot;\n            } else if (u_float_dem_shading_intensity < 0.5) { \n                dir_intensity_shifted = mix(0., dir1_intensity, u_float_dem_shading_intensity / 0.5);\n                amb_intensity_shifted = horizonatal_surface_light_intensity - dir_intensity_shifted * horizonatal_surface_light_dir_dot;\n            } \n            \n            float tex_coord = clamp(dir_intensity_shifted * light_raw * 0.5 + 0.5, 0., 0.99);\n            \n            float dir_light_factor = 2. * (texture2D(u_tex_hillshade_ramp, vec2(tex_coord, 0.5)).a - 0.5);\n            vec3 light_color = amb_intensity_shifted * u_vec4_ambient_color.rgb + dir_light_factor * u_vec4_light_dir1_color.rgb;\n            \n            gl_FragColor.rgb = light_color * flatMapColor.rgb;\n            \n            \n            gl_FragColor.a = flatMapColor.a;\n        } else {\n            gl_FragColor = flatMapColor * light_factor_surface();\n        }\n        gl_FragColor = apply_fog(gl_FragColor);\n    }\n}\n",dem_mesh2:"#include <enable_standard_derivatives>\n#include <mediump_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <fragment_normal>\nuniform sampler2D u_flat_tex;\nuniform sampler2D u_hillshade_tex;\nuniform sampler2D u_tex_hillshade_ramp;\nuniform mediump float u_use_flat_dem_mesh_normals;\nuniform int u_int_depth_test;\nuniform vec4 u_vec4_depth_test_color;\nvarying vec4 v_vec4_texcoord;\nvarying vec3 v_vec3_position;\nvarying vec3 v_vec3_normal;\nvoid main() {\n    if (u_int_depth_test == 1) {\n        gl_FragColor = u_vec4_depth_test_color;\n        return;\n    }\n    vec4 vec4_texcoord = v_vec4_texcoord / v_vec4_texcoord.w;\n    if(vec4_texcoord.x < 0. || vec4_texcoord.x > 1. || vec4_texcoord.y < 0. || vec4_texcoord.y > 1.) {\n        discard;\n    }\n    vec4 flatMapColor = texture2D(u_flat_tex, vec4_texcoord.xy);\n    vec3 normal = u_use_flat_dem_mesh_normals == 1.0 ? calc_fragment_normal(v_vec3_position) : v_vec3_normal;\n    vec4 lf = light_factor(normal);\n    gl_FragColor = vec4(lf.rgb * flatMapColor.rgb, flatMapColor.a);\n    \n    \n}\n",dem_normal:"#include <lowp_float>\n#include <prelude>\nuniform sampler2D u_tex_dem;\nuniform float u_float_dem_resolution;\nuniform float u_float_dem_cell_size;\nuniform float u_float_dem_scale;\nconst float M_PI = 3.1415926535897932384626433832795;\nvarying vec2 v_vec2_texcoord;\nmat3 get_kernel(vec2 pos, float step, float defval) {\n    mat3 kernel;\n    for (int x = 0; x < 3; x++) {\n        vec3 col;\n        for (int y = 0; y < 3; y++) {\n            vec4 val = texture2D(u_tex_dem, vec2(pos.x + float(x - 1) * step, pos.y + float(y - 1) * step));\n            col[y] = val.r;\n            if (val.a < 1.) {\n                col[y] = defval;\n            }\n        }\n        kernel[x] = col;\n    }\n    return kernel;\n}\nfloat calc_aspect(mat3 kernel) {\n    float dzdx = ((kernel[2].z + 2.0 * kernel[2].y + kernel[2].x) - (kernel[0].z + 2.0 * kernel[0].y + kernel[0].x)) / 8.;\n    float dzdy = ((kernel[0].x + 2.0 * kernel[1].x + kernel[2].x) - (kernel[0].z + 2.0 * kernel[1].z + kernel[2].z)) / 8.;\n    \n    if (dzdx == 0. && dzdy == 0.) {\n        return 0.;\n    }\n    \n    return atan(-dzdx, dzdy);\n}\nfloat calc_slope(mat3 kernel, float cell_size) {\n    float dzdx = ((kernel[2].z + 2. * kernel[2].y + kernel[2].x) - (kernel[0].z + 2. * kernel[0].y + kernel[0].x)) / (8. * cell_size);\n    float dzdy = ((kernel[0].x + 2. * kernel[1].x + kernel[2].x) - (kernel[0].z + 2. * kernel[1].z + kernel[2].z)) / (8. * cell_size);\n    float rise_run = sqrt(dzdx * dzdx + dzdy * dzdy);\n    return atan(rise_run);\n}\nvec3 dem_normal(const vec2 tex_pos)\n{\n    \n    float tex_step = 1. / u_float_dem_resolution;\n    \n    if (u_float_dem_scale == 0.) {\n        return vec3(0.);\n    }\n    \n    vec4 e = texture2D(u_tex_dem, tex_pos);\n    if (e.a < 1.) {\n        \n        return vec3(0.);\n    }\n    mat3 kernel = get_kernel(tex_pos.xy, tex_step, e.r);\n    \n    float aspect = calc_aspect(kernel);\n    \n    \n    float slope = calc_slope(kernel, u_float_dem_cell_size);\n    \n    slope = M_PI * 0.5 - slope; \n    aspect = aspect - M_PI * 0.5; \n    float cosSlope = cos(slope);\n    vec3 normal = normalize(vec3(cosSlope * cos(aspect), -1. * cosSlope * sin(aspect), sin(slope)));\n    \n    return normal * 0.5 + vec3(0.5);\n}\nvoid main() {\n    gl_FragColor = vec4(dem_normal(v_vec2_texcoord), 1);\n}\n",depth_clear:"#include <require_frag_depth>\n#include <highp_float>\nvoid main()\n{\n    \n    \n    \n    #ifdef WEBGL1\n    #ifdef HAS_FRAG_DEPTH_EXT\n    gl_FragDepthEXT = 1.0;\n    #else \n    discard;\n    #endif \n    #else \n    gl_FragDepth = 1.0;\n    #endif \n}\n",globe:"#include <mediump_float>\n#include <prelude>\nuniform sampler2D u_sr2d_flatmap_texture;\nvarying vec2 v_vec2_texture;\nvoid main() {\n    gl_FragColor = texture2D(u_sr2d_flatmap_texture, v_vec2_texture);\n}\n",globe_halo:"#include <mediump_float>\n#include <prelude>\n#ifndef UBO\nuniform mediump vec4 u_vec4_halo_color;\nuniform mediump vec2 u_vec2_halo_viewport_size;\nuniform mediump vec2 u_vec2_halo_viewport_center_shift;\nuniform mediump vec4 u_vec4_halo_radius_stops;\nuniform mediump float u_float_halo_exp_factor;\n#endif\nvarying vec2 v_vec2_uv;\nvoid main() {\n    float dist = length(v_vec2_uv);\n    float halo_alpha = u_vec4_halo_color.a;\n    vec4 halo_color = vec4(u_vec4_halo_color.rgb, 0.);\n    vec4 empty_color = vec4(0.0);\n    vec4 white_color1 = vec4(1., 1., 1., halo_alpha);\n    vec4 white_color2 = vec4(white_color1.rgb, halo_alpha * 0.9);\n    float r0 = u_vec4_halo_radius_stops[0];\n    float r1 = u_vec4_halo_radius_stops[1];\n    float r2 = u_vec4_halo_radius_stops[2];\n    float r3 = u_vec4_halo_radius_stops[3];\n    float t0 = max(0.0, (dist - r1) / (r3 - r1));\n    float t0e = 1.0 - exp(u_float_halo_exp_factor * t0);\n    \n    vec4 color = mix(white_color2, halo_color, t0e);\n    \n    color = mix(white_color1, color, smoothstep(r1, r2, dist));\n    \n    color = mix(empty_color, color, smoothstep(r0, r1, dist));\n    gl_FragColor = color;\n}\n",globe_halo_background:"#include <mediump_float>\n#include <prelude>\n#ifndef UBO\nuniform mediump vec4 u_vec4_default_background_color;\nuniform mediump vec4 u_vec4_halo_radius_stops;\n#endif\nvarying vec2 v_vec2_uv;\nvoid main() {\n    float dist = length(v_vec2_uv);\n    float r1 = u_vec4_halo_radius_stops[1];\n    if(dist > r1) {\n        discard;\n    }\n    gl_FragColor = u_vec4_default_background_color;\n}\n",gltf_model:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <screendoor_transparency>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <light_pbr>\n#include <light_phong>\n#include <dem>\nuniform vec4 u_vec4_color;\n#ifdef MAP_MESH_TEXTURE\nuniform sampler2D u_sampler_map_tex;\n#endif\n#ifdef COLOR_TEXTURE\nuniform sampler2D u_sr2d_texture_0;\n#endif\n#ifdef AO_TEXTURE\nuniform sampler2D u_ao_texture;\n#endif\n#ifdef PBR_TEXTURE\nuniform sampler2D u_pbr_texture;\n#endif\n#ifdef LIGHT_MODEL\n#if  (LIGHT_MODEL == LIGHT_MODEL_PBR || LIGHT_MODEL == LIGHT_MODEL_PHONG)\nuniform float u_float_metallic;\nuniform float u_float_roughness;\n#endif\n#endif\nvarying vec3 v_vec3_normal;\nvarying vec3 v_vec3_fragment_pos_world;\n#ifdef MAP_MESH_TEXTURE\nuniform vec2 u_vec2_tex_scale;\nuniform float u_float_tex_shift_scale;\nvarying vec4 v_tex_coord;\n#endif\n#ifdef COLOR_TEXTURE\nvarying vec2 v_vec2_texcoord_color;\n#endif\n#ifdef AO_TEXTURE\nvarying vec2 v_vec2_texcoord_ao;\n#endif\n#ifdef PBR_TEXTURE\nvarying vec2 v_vec2_texcoord_pbr;\n#endif\nvarying float v_float_opacity;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    apply_screendoor();\n    vec4 color = u_vec4_color;\n    #ifdef COLOR_TEXTURE\n        color *= texture2D(u_sr2d_texture_0, v_vec2_texcoord_color);\n    #endif\n    #ifdef MAP_MESH_TEXTURE\n        \n        vec2 coord = v_tex_coord.xy / v_tex_coord.w;\n        \n        coord = coord / u_vec2_tex_scale;\n        \n        coord.y += u_float_tex_shift_scale / u_vec2_tex_scale.y;\n        \n        coord = (coord / 2.) + vec2(0.5, 0.5);\n        vec4 texture_color = texture2D(u_sampler_map_tex, coord);\n        \n        color.rgb = mix(color.rgb, texture_color.rgb, texture_color.a);\n    #endif\n    #ifdef AO_TEXTURE\n        \n        \n        vec4 ao_tex_color = texture2D(u_ao_texture, v_vec2_texcoord_ao);\n        color *= ao_tex_color;\n    #endif\n    vec3 fragment_normal = normalize(v_vec3_normal);\n    color *= v_float_opacity;\n    bool use_light = UNPACK_BOOL1(u_int_light_flags);\n    if (!use_light) {\n        gl_FragColor = apply_fog(color);\n        return;\n    }\n    #ifdef LIGHT_MODEL\n        float metallic = max(u_float_metallic, 0.1);\n        float roughness = max(u_float_roughness, 0.1);\n        #ifndef METALLIC_ROUGHNESS_DEBUG\n            #ifdef PBR_TEXTURE\n                vec4 pbr_tex_color = texture2D(u_pbr_texture, v_vec2_texcoord_pbr);\n                roughness = max(pbr_tex_color.g, 0.1);\n                metallic = max(pbr_tex_color.b, 0.1);\n            #endif\n        #endif\n        #if (LIGHT_MODEL == LIGHT_MODEL_PBR)\n            color.rgb = color_pbr(fragment_normal, v_vec3_fragment_pos_world, color.rgb, roughness, metallic);\n        #elif (LIGHT_MODEL == LIGHT_MODEL_PHONG)\n            color.rgb = color_phong(fragment_normal, v_vec3_fragment_pos_world, color.rgb, roughness, metallic);\n        #endif\n    #endif\n    gl_FragColor = apply_fog(color);\n}\n",gradient_with_z_fade:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <screendoor_transparency>\n#include <fragment_normal>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nvarying mat4 v_mat4_gradient;\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_rotated_scaled_vertex;\nuniform vec2 u_vec2_floor_level;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    apply_screendoor();\n    vec4 color = v_vec4_color;\n    if (v_mat4_gradient[0][0] != 0.) {\n        float height_gradient = v_vec4_rotated_scaled_vertex.w;\n        float gradient_position = (float(u_vec2_floor_level.x) + height_gradient) / float(u_vec2_floor_level.y);\n        color = mix(v_mat4_gradient[1], v_mat4_gradient[2], smoothstep(v_mat4_gradient[0][1], v_mat4_gradient[0][2], gradient_position));\n    }\n    vec3 normal = calc_fragment_normal(v_vec4_rotated_scaled_vertex.xyz);\n    color *= light_factor(normal);\n    gl_FragColor = apply_fog(color);\n# ifndef BLEND\n    \n    gl_FragColor /= gl_FragColor.a;\n# endif\n}\n",heatmap:"#include <mediump_float>\n#include <prelude>\n#include <fog>\nuniform highp float u_float_intensity;\nvarying float v_float_weight;\nvarying vec2 v_vec2_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n    float d = -0.5 * 3.0 * 3.0 * dot(v_vec2_extrude, v_vec2_extrude);\n    float val = v_float_weight * u_float_intensity * GAUSS_COEF * exp(d);\n    float fog_alpha = apply_fog_alpha(vec4(1)).r;\n    gl_FragColor = vec4(val, fog_alpha, 1.0, 1.0);\n}\n",heatmap_texture:"#include <mediump_float>\n#include <prelude>\n#include <cam_pos>\nuniform sampler2D u_sr2d_texture;\nuniform sampler2D u_sr2d_ramp_texture;\nuniform float u_float_opacity;\nvarying vec2 v_vec2_position;\nvoid main() {\n    vec2 color_and_alpha = texture2D(u_sr2d_texture, v_vec2_position).rg;\n    vec4 color = texture2D(u_sr2d_ramp_texture, vec2(color_and_alpha.r, 0.5));\n    gl_FragColor = color * u_float_opacity;\n    \n    \n    #ifdef FOG\n        gl_FragColor *= color_and_alpha.g;\n    #endif\n}\n",label:"#include <mediump_float>\n#include <prelude>\n#include <apply_opacity>\n#include <fog>\n#include <dem>\nuniform sampler2D u_sr2d_texture;\nuniform float u_float_buffer;\nuniform float u_float_gamma;\nuniform vec4 u_vec4_color;\nuniform vec4 u_vec4_hidden_color;\nuniform float u_float_opacity;\nuniform sampler2D u_color_text_sprite_labeling;\nuniform float u_float_label_index;\nvarying vec2 v_vec2_texcoord;\nvarying float v_float_behind_factor;\nvarying vec4 v_vec4_text_identifier;\nvarying vec2 v_vec2_labeling_texcoord;\nconst float F16_EPSILON = 0.0009765625;\nvoid main() {\n    if (check_dem_invalid() != 0) {\ndiscard;\n}\n    float dist = texture2D(u_sr2d_texture, v_vec2_texcoord).a;\n    float alpha = smoothstep(\n        u_float_buffer - u_float_gamma,\n        u_float_buffer + u_float_gamma,\n        dist\n    );\n    vec4 color = mix(u_vec4_hidden_color, u_vec4_color, v_float_behind_factor);\n    color = apply_fog_alpha(color);\n    vec4 clearColor = vec4(1, 1, 1, 1);\n    vec4 text_sprite_color = texture2D(u_color_text_sprite_labeling, v_vec2_labeling_texcoord);\n    bvec4 clearColorDiff = bvec4(\n        abs(text_sprite_color.r - clearColor.r) > F16_EPSILON,\n        abs(text_sprite_color.g - clearColor.g) > F16_EPSILON,\n        abs(text_sprite_color.b - clearColor.b) > F16_EPSILON,\n        abs(text_sprite_color.a - clearColor.a) > F16_EPSILON\n    );\n    bvec4 identifierDiff = bvec4(\n        abs(text_sprite_color.r - v_vec4_text_identifier.r) > F16_EPSILON,\n        abs(text_sprite_color.g - v_vec4_text_identifier.g) > F16_EPSILON,\n        abs(text_sprite_color.b - v_vec4_text_identifier.b) > F16_EPSILON,\n        abs(text_sprite_color.a - v_vec4_text_identifier.a) > F16_EPSILON\n    );\n    if (u_float_label_index < F16_EPSILON && any(identifierDiff)  && any(clearColorDiff) ) {\n        discard;\n    }\n    gl_FragColor = apply_opacity(color * alpha, u_float_opacity);\n}\n",label_directional:"#include <highp_float>\n#include <prelude>\n#include <apply_opacity>\n#include <fog>\nuniform sampler2D u_sr2d_texture;\nuniform float u_float_buffer;\nuniform float u_float_gamma;\nuniform vec4 u_vec4_color;\nuniform float u_float_opacity;\nvarying vec2 v_vec2_texcoord;\nvoid main() {\n    float dist = texture2D(u_sr2d_texture, v_vec2_texcoord).a;\n    float alpha = smoothstep(\n        u_float_buffer - u_float_gamma,\n        u_float_buffer + u_float_gamma,\n        dist\n    );\n    vec4 color = apply_fog_alpha(u_vec4_color);\n    gl_FragColor = apply_opacity(color * alpha, u_float_opacity);\n}\n",line:"#include <mediump_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nvarying vec4 v_vec4_color;\nvarying mat4 v_mat4_gradient;\nvarying vec3 v_vec3_normal;\nvarying vec2 v_vec2_height_gradient;\nuniform mat4 u_mat4_gradient;\nvoid main()\n{ \n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    vec4 color = v_vec4_color;\n    if (u_mat4_gradient[0][0] != 0.) {\n        color = mix(v_mat4_gradient[1], v_mat4_gradient[2], smoothstep(v_mat4_gradient[0][1], v_mat4_gradient[0][2], v_vec2_height_gradient[0]));\n    }\n    color *= (1. - abs(v_vec2_height_gradient[1] * gl_FragCoord.w));\n    gl_FragColor = apply_fog(color * light_factor(v_vec3_normal));\n}\n",main_shadow:"#include <highp_float>\n#include <prelude>\n#include <pack_depth>\n#include <dem>\nvarying float v_depth_metric;\nvoid main()\n{\nif (check_dem_invalid() != 0) {\ndiscard;\n}\n#ifdef DEPTH_TEXTURE_SHADOW\nreturn;\n#endif\ngl_FragColor = pack_float_to_vec4(v_depth_metric);\n}",map_mesh:"#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <screendoor_transparency>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nuniform sampler2D u_sampler_map_tex;\nuniform vec2 u_vec2_tex_scale;\nuniform float u_float_tex_shift_scale;\nuniform mediump float u_float_light_intensity;\nuniform int u_int_identify;\nvarying vec4 v_tex_coord;\nvarying vec4 v_vec4_normal_gradient;\nvoid main()\n{\nif (check_dem_invalid() != 0) {\n        discard;\n    }\nvec2 coord = v_tex_coord.xy / v_tex_coord.w;\ncoord = coord / u_vec2_tex_scale;\ncoord.y += u_float_tex_shift_scale / u_vec2_tex_scale.y;\ncoord = (coord / 2.) + vec2(0.5, 0.5);\nif (coord.x < 0. || coord.x > 1. || coord.y < 0. || coord.y > 1.) {\ngl_FragColor = vec4(0, 0, 0, 0);\n} else {\ngl_FragColor = texture2D(u_sampler_map_tex, coord);\nif (u_int_identify == 0) {\napply_screendoor();\ngl_FragColor.rgb *= 1. - u_float_light_intensity * smoothstep(0.85, 1., abs(v_vec4_normal_gradient.w));\ngl_FragColor *= light_factor(v_vec4_normal_gradient.xyz);\ngl_FragColor = apply_fog(gl_FragColor);\n}\n}\n}\n",mesh:"#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <apply_opacity>\n#include <fog>\n#include <screendoor_transparency>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nuniform sampler2D u_sr2d_texture;\nuniform float u_float_texture_opacity;\nuniform vec4 u_float_sprite_texture_coords;\nuniform lowp int u_int_is_textured;\nuniform mediump vec4 u_vec4_color;\nuniform mediump mat4 u_mat4_gradient;\nuniform mediump float u_float_opacity;\nuniform mediump int u_int_identify;\nvarying vec4 v_vec4_color;\nvarying mat4 v_mat4_gradient;\nvarying vec2 v_vec2_tex_coord;\nvarying vec4 v_vec4_normal_gradient;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{   \n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    if (u_int_identify != 0) {\n        gl_FragColor = v_vec4_identifier;\n    } else {\n        apply_screendoor();\n        vec4 light = light_factor(v_vec4_normal_gradient.xyz);\n        if (u_int_is_textured != 0)  {\n            vec2 spritecoord = mix(u_float_sprite_texture_coords.xy, u_float_sprite_texture_coords.zw, fract(v_vec2_tex_coord));\n            vec4 color = texture2D(u_sr2d_texture, spritecoord);\n            vec4 texcolor = apply_opacity(color, u_float_texture_opacity);\n            gl_FragColor = texcolor + v_vec4_color * (1. - texcolor.a);\n        } else if (u_mat4_gradient[0][0] != 0.) {\n    gl_FragColor = mix(v_mat4_gradient[1], v_mat4_gradient[2], smoothstep(v_mat4_gradient[0][1], v_mat4_gradient[0][2], v_vec4_normal_gradient.w));\n        } else {\n            gl_FragColor = v_vec4_color;\n        }\n        gl_FragColor = apply_fog(gl_FragColor * light);\n    }\n}\n",metric_point:"#include <mediump_float>\n#include <prelude>\n#include <cam_pos>\n#include <apply_opacity>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\nuniform vec4 u_vec4_color;\nuniform sampler2D u_sr2d_texture;\nuniform vec4 u_float_sprite_texture_coords;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    vec2 spritecoord = mix(u_float_sprite_texture_coords.xy, u_float_sprite_texture_coords.zw, v_vec2_texcoord);\n    vec4 color = texture2D(u_sr2d_texture, spritecoord) * u_vec4_color;\n    gl_FragColor = apply_fog(color * light_factor_surface());\n}\n",one_way_line:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <affine_step>\n#include <apply_opacity>\n#include <signed_distance_functions>\n#include <arrow_functions>\n#include <fog>\n#ifndef UBO\nuniform mediump vec2 u_vec2_vpt_size;\n#endif\nuniform vec2 u_vec2_wing_normal;\nuniform vec2 u_vec2_tip_normal;\nuniform mediump float u_float_width;\nuniform mediump float u_float_length;\nuniform float u_float_tip_height_multiplier;\nuniform float u_float_wing_height_multiplier;\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_border_color;\nvarying vec2 v_vec2_texcoord;\nvarying float v_float_border_width;\nvarying float v_float_zpt_to_texcoord_factor;\nvarying float v_float_outer_width;\nvarying float v_float_opacity;\nfloat one_way_line_distance(const ArrowDistances ad)\n{\n    return max(max(max(ad.top_tip_cut, ad.bottom_tip_cut), max(ad.top_left_wing, ad.top_right_wing)), min(ad.line, min(ad.bottom_left_wing, ad.bottom_right_wing)));\n}\nvoid main()\n{\n    mat2 derivatives = mat2(dFdx(v_vec2_texcoord), dFdy(v_vec2_texcoord));\n    ArrowDistanceParameters arrow_parameters = calculate_arrow_distance_parameters(\n        u_vec2_wing_normal,\n        u_vec2_tip_normal,\n        u_float_width * v_float_zpt_to_texcoord_factor,\n        u_float_length * v_float_zpt_to_texcoord_factor,\n        u_float_tip_height_multiplier,\n        u_float_wing_height_multiplier,\n        0.,\n        0.,\n        0.,\n        vec2(0., 0.),\n        vec2(0., 0.));\n    \n    float border_clipping = (abs(v_vec2_texcoord.y) - v_float_outer_width) / max(abs(derivatives[0].y), abs(derivatives[1].y));\n    float fill_factor = affine_step(-1., 0., one_way_line_distance(calculate_arrow_distances(arrow_parameters, v_vec2_texcoord, 0., derivatives)));\n    float border_factor = max(border_clipping, affine_step(0., 1., one_way_line_distance(calculate_arrow_distances(arrow_parameters, v_vec2_texcoord, v_float_border_width, derivatives))));\n    gl_FragColor = apply_opacity(mix(mix(v_vec4_color, v_vec4_border_color, fill_factor), vec4(0.), border_factor), v_float_opacity);\n}\n",patterned_line:"#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <affine_step>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <signed_distance_functions>\nuniform int u_int_pattern_type;\nvarying vec4 v_vec4_color;\nvarying vec2 v_vec2_uv;\nvarying float v_float_width;\nvarying vec4 v_vec4_pattern_parameters;\nvoid main()\n{\n    float pattern_length = v_vec4_pattern_parameters.x;\n    float full_width = v_float_width + 1.;\n    \n    float smooth_base = max(15., max(v_float_width, pattern_length));\n    float smooth_scale = (smooth_base + 1.) / smooth_base;\n    float smooth_factor = smooth_scale - 1.;\n    \n    vec2 sdf_pos = vec2(mod(v_vec2_uv.x, 1.) - 0.5, v_vec2_uv.y * smooth_scale);\nfloat sdf = 1.;\n    \n    if (u_int_pattern_type < 4) {\n        \n        float width = v_vec4_pattern_parameters.y;\n        float left  = v_vec4_pattern_parameters.z;\n        float right = v_vec4_pattern_parameters.w;\n        \n        \n        vec2 offset;\n        if (right < 0.) {\n            offset = vec2(.25, .5);\n        } else {\n            offset = vec2(.0, .5);\n        }\n        \n        if (width > EPSILON) {\n            float leftSdf = 1.;\n            if (left > EPSILON) {\n                leftSdf = sdf_box(sdf_pos + offset, vec2(left, width));\n            }\n            float rightSdf = 1.;\n            if (abs(right) > EPSILON) {\n                rightSdf = sdf_box(sdf_pos - offset, vec2(abs(right), width));\n            }\n            sdf = min(leftSdf, rightSdf);\n        }\n    } else if (u_int_pattern_type == 5) {\n        \n        float radius = v_vec4_pattern_parameters.y;\n        \n        if (radius > EPSILON) {\n            sdf = sdf_circle(sdf_pos, radius);\n        }\n    } else if (u_int_pattern_type == 4) {\n        \n        float width = v_vec4_pattern_parameters.y;\n        float orientation = v_vec4_pattern_parameters.z;\n        \n        if (width > EPSILON) {\n            sdf = sdf_triangle(sdf_pos * vec2(1., orientation), width);\n        }\n    } else if (u_int_pattern_type == 6) {\n        \n        sdf = sdf_chevron(sdf_pos.yx, 0., 0., 0.);\n    }\n    \n    sdf = max(sdf, abs(sdf_pos.y) - 0.5);\n    \n    vec4 color = mix(\n        v_vec4_color,\n        vec4(0.),\n        affine_step(-smooth_factor, smooth_factor, sdf)\n    );\n    color *= light_factor_surface();\n    gl_FragColor = apply_fog(color);\n}\n",pointsprite:"#include <mediump_float>\n#include <prelude>\n#include <apply_opacity>\n#include <fog>\n#include <dem>\nuniform sampler2D u_sr2d_texture;\nuniform vec2 u_vec2_opacity;\nvarying vec2 v_vec2_texcoord;\nvarying float v_float_behind_factor;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    vec4 color = texture2D(u_sr2d_texture, v_vec2_texcoord);\n    float opacity = mix(u_vec2_opacity[1], u_vec2_opacity[0], v_float_behind_factor);\n    color = apply_fog_alpha(color);\n    gl_FragColor = apply_opacity(color, opacity);\n}\n",pointsprite_identify:"#include <mediump_float>\n#include <prelude>\n#include <dem>\nuniform sampler2D u_sr2d_texture;\nuniform float u_float_identify_opacity;\nvarying vec2 v_vec2_texcoord;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    vec4 color = texture2D(u_sr2d_texture, v_vec2_texcoord);\n    \n    \n    if (color.a < u_float_identify_opacity) {\n        discard;\n    } else {\n        gl_FragColor = v_vec4_identifier;\n    }\n}\n",rect:"#include <lowp_float>\n#include <prelude>\n#include <fog>\nuniform vec4 u_vec4_color;\nvoid main()\n{\n    gl_FragColor = u_vec4_color;\n}\n",rect_with_texture:"#include <mediump_float>\n#include <prelude>\n#include <apply_opacity>\n#include <fog>\nuniform sampler2D u_sr2d_texture;\nuniform float u_float_opacity;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    vec4 color = texture2D(u_sr2d_texture, v_vec2_texcoord);\n    color = apply_fog_alpha(color);\n    gl_FragColor = apply_opacity(color, u_float_opacity);\n}\n",road:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <affine_step>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\nuniform vec4 u_vec4_color;\nvarying vec2 v_vec2_normal;\nvarying float v_float_half_width;\nvoid main()\n{\n    \n    float opacity = 1.0 - affine_step(\n        v_float_half_width - length(fwidth(v_vec2_normal)),\n        v_float_half_width,\n        length(v_vec2_normal)\n    );\n    vec4 color = light_factor_surface() * u_vec4_color;\n    color = apply_fog(color);\n    gl_FragColor = color * opacity;\n}\n",road_identify:"#include <enable_standard_derivatives>\n#include <lowp_float>\n#include <prelude>\nvarying vec4 v_vec4_identifier;\nvarying vec2 v_vec2_normal;\nvarying float v_float_half_width;\nvoid main()\n{\n    if (dot(v_vec2_normal, v_vec2_normal) > v_float_half_width * v_float_half_width) {\n        discard;\n    }\n    gl_FragColor = v_vec4_identifier;\n}\n",simple_line_2d:"#include <lowp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\nuniform vec4 u_vec4_color;\nvarying float v_float_distance;\nvarying float v_float_distance_offset;\nvoid main()\n{\n    vec4 light = light_factor_surface();\n    vec4 color = u_vec4_color * clamp(\n        1. + v_float_distance_offset - abs(v_float_distance * gl_FragCoord.w),\n        0.,\n        1.) * light;\n    gl_FragColor = apply_fog(color);\n}\n",simple_line_3d:"#include <lowp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nuniform vec4 u_vec4_color;\nvarying float v_float_distance;\nvarying float v_float_distance_offset;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    vec4 light = light_factor_surface();\n    vec4 color = u_vec4_color * clamp(\n        1. + v_float_distance_offset - abs(v_float_distance * gl_FragCoord.w),\n        0.,\n        1.) * light;\n    gl_FragColor = apply_fog(color);\n}\n",simple_mesh:"#include <highp_float>\n#include <prelude>\n#include <enable_standard_derivatives>\nvarying vec3 v_position;\nvoid main() {\n    vec3 dx = dFdx(v_position);\n    vec3 dy = dFdy(v_position);\n    vec3 normal = normalize(cross(dx, dy));\n    vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0));\n    float diffuse = max(dot(normal, lightDir), 0.0);\n    \n    gl_FragColor = vec4(normal * (0.2 + 0.8 * diffuse), 1.0);\n}\n",sky:"#include <mediump_float>\n#include <prelude>\n#include <fog>\n#define SKY_ALPHA_HORIZON_BLEND (6.0)\n#define DEFAULT_SKY_COLOR (vec4(0.0))\nvec4 add_sky_alpha_blend(vec4 color) {\n#ifdef SKY\n    \n    float depth = length(v_fog_pos);\n    vec3 dir = v_fog_pos / depth;\n    float alpha_dir = dir.z + 0.15; \n    float alpha = clamp(1.0 + SKY_ALPHA_HORIZON_BLEND * alpha_dir, 0.0, 1.0);\n    color *= alpha;\n#endif\n    return color;\n}\nvoid main() {\n#ifdef SKY\n    vec4 color = add_sky_alpha_blend(u_sky_color);\n#else\n    vec4 color = DEFAULT_SKY_COLOR;\n#endif\n    gl_FragColor = apply_fog_sky(color);\n}\n",stars:"#include <mediump_float>\n#include <prelude>\nvarying mediump float v_intensity;\nvoid main() {\n    gl_FragColor = vec4(v_intensity);\n}\n",striped_line:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <affine_step>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\nvarying vec4 v_vec4_dash_color;\nvarying vec4 v_vec4_space_color;\nvarying vec4 v_vec4_border_color;\nvarying vec2 v_vec2_circle;\nvarying float v_float_width;\nvarying vec2 v_vec2_line_params;\nvec4 distance_func_smooth(in vec4 main_color, in vec4 border_color, in vec2 circle)\n{\n    float circle_length = length(circle);\n    float distance = circle_length - v_float_width;\n    mat2 derivatives = mat2(dFdx(v_vec2_circle), dFdy(v_vec2_circle));\n    \n    \n    \n    vec2 circle_dx = derivatives[0];\n    vec2 circle_dy = derivatives[1];\n    \n    float distance_dx = dot(v_vec2_circle, circle_dx);\n    float distance_dy = dot(v_vec2_circle, circle_dy);\n    \n    float derivative_denominator = circle_length;\n    float width = max(abs(distance_dx), abs(distance_dy));\n    vec4 from_main_to_border = mix(\n        main_color,\n        border_color,\n        affine_step(-width, 0., distance * derivative_denominator));\n    vec4 from_color_to_fade = mix(\n        from_main_to_border,\n        vec4(0.),\n        affine_step(0., +width, distance * derivative_denominator));\n    return from_color_to_fade;\n}\nfloat calculate_segment_color_factor(in float distance_in_parts, in float threshold)\n{\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    float color_factor = abs(fract(distance_in_parts + 0.5 - 0.5 * threshold) - 0.5);\n    \n    float parts_affine_step_width = fwidth(distance_in_parts);\n    \n    float smoothed_color_factor = affine_step(\n        0.5 * threshold - 0.5 * parts_affine_step_width,\n        0.5 * threshold + 0.5 * parts_affine_step_width,\n        color_factor);\n    return smoothed_color_factor;\n}\nvoid main()\n{\n    vec4 current_segment_color = mix(\n        v_vec4_dash_color,\n        v_vec4_space_color,\n        calculate_segment_color_factor(\n            v_vec2_line_params[1],\n            v_vec2_line_params[0]));\n    \n    vec4 final_border_color = (1.0 - v_vec4_border_color.a) * current_segment_color + v_vec4_border_color;\n    vec4 color = distance_func_smooth(current_segment_color, final_border_color, v_vec2_circle);\n    vec4 light = light_factor_surface();\n    gl_FragColor = apply_fog(light * color);\n}\n",textured_color:"#include <mediump_float>\n#include <prelude>\n#include <cam_pos>\n#include <apply_opacity>\n#include <fog>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#define LIGHT_MODEL LIGHT_MODEL_PHONG\n#include <light_phong>\n#include <mix_color_defs>\nuniform sampler2D u_sr2d_texture;\nuniform float u_float_texture_opacity;\nuniform vec4 u_float_texture_params;\nuniform vec4 u_float_sprite_texture_coords;\nuniform int u_int_is_textured;\nuniform int u_int_is_normal_map_textured; \nuniform sampler2D u_sr2d_texture1;\nuniform vec4 u_vec4_normal_map_texture_params;\nuniform vec4 u_vec4_normal_map_sprite_texture_coords;\nuniform vec4 u_vec4_normal_map_animated_offsets;\nuniform int u_int_normal_map_is_animated;\nuniform float u_float_metallic;\nuniform float u_float_roughness;\nvarying vec4 v_vec4_color;\nvarying highp vec2 v_vec2_texcoord;\nvarying highp vec3 v_vec3_fragment_pos_world;\n#ifdef MIX_COLOR_MODE\nvarying vec4 v_vec4_color2;\n# if MIX_COLOR_MODE == MIX_COLOR_MODE_READ_FROM_TARGET\nvarying vec4 v_vec4_pos;\nuniform sampler2D u_sr2d_read_from_target_texture;\n# elif MIX_COLOR_MODE == MIX_COLOR_MODE_VERTEX_ATTRIBUTE\nvarying float v_float_mix_color_factor;\n# endif\n#endif\nvoid main() {\n#ifdef MIX_COLOR_MODE\n    float mix_color_factor = 0.;\n# if MIX_COLOR_MODE == MIX_COLOR_MODE_READ_FROM_TARGET\n    vec3 clip_space = v_vec4_pos.xyz / v_vec4_pos.w;\n    vec3 uv = 0.5 * clip_space + vec3(0.5);\n    \n    \n    \n    mix_color_factor = texture2D(u_sr2d_read_from_target_texture, uv.xy).r;\n# elif MIX_COLOR_MODE == MIX_COLOR_MODE_VERTEX_ATTRIBUTE\n    mix_color_factor = v_float_mix_color_factor;\n# endif\n#endif\n    bool use_normal_map = u_int_is_normal_map_textured == 1;\n    vec3 normal;\n    \n    if(use_normal_map) {\n        vec2 texcoord1 = fract(v_vec2_texcoord * u_vec4_normal_map_texture_params.zw + u_vec4_normal_map_texture_params.xy + u_vec4_normal_map_animated_offsets.xy);\n        vec2 spritecoord1 = mix(u_vec4_normal_map_sprite_texture_coords.xy, u_vec4_normal_map_sprite_texture_coords.zw, texcoord1);\n        vec4 texcolor1 = texture2D(u_sr2d_texture1, spritecoord1);\n        \n        if(u_int_normal_map_is_animated == 1) {\n            vec2 texcoord2 = fract(v_vec2_texcoord * u_vec4_normal_map_texture_params.zw + u_vec4_normal_map_texture_params.xy + u_vec4_normal_map_animated_offsets.zw);\n            vec2 spritecoord2 = mix(u_vec4_normal_map_sprite_texture_coords.xy, u_vec4_normal_map_sprite_texture_coords.zw, texcoord2);\n            vec4 texcolor2 = texture2D(u_sr2d_texture1, spritecoord2);\n            normal = normalize((texcolor1.xyz * 2.0 - 1.0) + (texcolor2.xyz * 2.0 - 1.0));\n        } else {\n            normal = normalize((texcolor1.xyz * 2.0 - 1.0));\n        }\n    }\n    \n    vec4 color = v_vec4_color;\n    \n    if(u_int_is_textured == 1) {\n        vec2 texcoord = fract(v_vec2_texcoord * u_float_texture_params.zw + u_float_texture_params.xy);\n        vec2 spritecoord = mix(u_float_sprite_texture_coords.xy, u_float_sprite_texture_coords.zw, texcoord);\n        vec4 texcolor = apply_opacity(texture2D(u_sr2d_texture, spritecoord), u_float_texture_opacity);\n        color = texcolor + color * (1. - texcolor.a);\n    }\n#ifdef MIX_COLOR_MODE\n    \n    color = mix(color, v_vec4_color2, mix_color_factor);\n#endif\n    \n    if(use_normal_map) {\n        color.rgb = color_phong(normal, v_vec3_fragment_pos_world, color.rgb, u_float_roughness, u_float_metallic);\n    } else {\n        color = color * light_factor_surface();\n    }\n    gl_FragColor = apply_fog(color);\n}\n",zbm_model:"#include <enable_standard_derivatives>\n#include <highp_float>\n#include <prelude>\n#include <cam_pos>\n#include <fog>\n#include <screendoor_transparency>\n#include <fragment_normal>\n#include <bit_mask>\n#include <pack_depth>\n#include <shadow>\n#include <light>\n#include <dem>\nuniform sampler2D u_sr2d_texture;\nuniform vec4 u_vec4_color;\nvarying vec3 v_vec3_rotated_scaled_vertex;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    if (check_dem_invalid() != 0) {\n        discard;\n    }\n    apply_screendoor();\n    vec3 normal = calc_fragment_normal(v_vec3_rotated_scaled_vertex);\n    vec4 light = light_factor(normal);\n    vec4 color = texture2D(u_sr2d_texture, v_vec2_texcoord) * u_vec4_color * light;\n    gl_FragColor = apply_fog(color);\n}\n",taa:"#include <mediump_float>\n#include <prelude>\nuniform sampler2D u_texture;\nuniform float u_float_mix_coef;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    vec4 texColor = texture2D(u_texture, v_vec2_texcoord);\n    gl_FragColor = vec4(texColor.rgb, texColor.a * u_float_mix_coef);\n}\n",fxaa:"#include <mediump_float>\n#include <prelude>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform sampler2D u_texture;\nvarying vec2 v_vec2_texcoord;\n#ifndef FXAA_REDUCE_MIN\n    #define FXAA_REDUCE_MIN   (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n    #define FXAA_REDUCE_MUL   (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n    #define FXAA_SPAN_MAX     8.0\n#endif\nvoid texcoords(vec2 fragCoord, vec2 resolution,\n            out vec2 v_rgbNW, out vec2 v_rgbNE,\n            out vec2 v_rgbSW, out vec2 v_rgbSE,\n            out vec2 v_rgbM) {\n    vec2 inverseVP = 1.0 / resolution.xy;\n    v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n    v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n    v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n    v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n    v_rgbM = vec2(fragCoord * inverseVP);\n}\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 resolution,\n            vec2 v_rgbNW, vec2 v_rgbNE,\n            vec2 v_rgbSW, vec2 v_rgbSE,\n            vec2 v_rgbM) {\n    vec4 color;\n    mediump vec2 inverseVP = vec2(1.0 / resolution.x, 1.0 / resolution.y);\n    vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n    vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n    vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n    vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n    vec4 texColor = texture2D(tex, v_rgbM);\n    vec3 rgbM  = texColor.xyz;\n    vec3 luma = vec3(0.299, 0.587, 0.114);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n    mediump vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n                          (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n              max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n              dir * rcpDirMin)) * inverseVP;\n    vec3 rgbA = 0.5 * (\n        texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n        texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n    vec3 rgbB = rgbA * 0.5 + 0.25 * (\n        texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n        texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n    float lumaB = dot(rgbB, luma);\n    if ((lumaB < lumaMin) || (lumaB > lumaMax))\n        color = vec4(rgbA, texColor.a);\n    else\n        color = vec4(rgbB, texColor.a);\n    return color;\n}\nvoid main()\n{\n    mediump vec2 v_rgbNW;\n    mediump vec2 v_rgbNE;\n    mediump vec2 v_rgbSW;\n    mediump vec2 v_rgbSE;\n    mediump vec2 v_rgbM;\n    vec2 fragCoord = v_vec2_texcoord * u_vec2_vpt_size;\n    texcoords(fragCoord, u_vec2_vpt_size, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n    gl_FragColor = fxaa(u_texture, fragCoord, u_vec2_vpt_size, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n"},Ic={apply_height_factor:"vec4 apply_height_factor(in vec3 vertex, const float height_factor)\n{\n    vertex.z *= height_factor;\n    return vec4(vertex, 1.0);\n}\n",apply_opacity:yc,arrow_functions:"\nvec2 multiply_complex(const vec2 lhs, const vec2 rhs)\n{\n    return vec2(lhs.x * rhs.x - lhs.y * rhs.y, lhs.x * rhs.y + lhs.y * rhs.x);\n}\nstruct ArrowParameters\n{\n    float zpt_to_texcoord_factor;\n    float final_size;\n    float outer_width;\n    vec2 widen_size;\n    vec2 wing_normal;\n    vec2 tip_normal;\n};\nArrowParameters calculate_arrow_parameters(\n    const float calculation_scale,\n    const float width_zpt,\n    const float border_width_zpt,\n    const float segment_length_zpt,\n    const float wing_width_multiplier,\n    const float wing_height_multiplier,\n    const float tip_height_multiplier,\n    const float size_factor)\n{\n    float quad_width = 2.0 * border_width_zpt + 2.0 * wing_width_multiplier * width_zpt;\n    float quad_height = 2.0 * border_width_zpt + segment_length_zpt;\n    float max_quad_dimension = max(quad_width, quad_height);\n    float zpt_to_texcoord_factor = 2.0 / max_quad_dimension;\n    float final_size = calculation_scale * size_factor * max_quad_dimension;\n    vec2 widen_size = 0.5 * vec2(quad_height, quad_width) * zpt_to_texcoord_factor;\n    float outer_width = (width_zpt * wing_width_multiplier + border_width_zpt) * zpt_to_texcoord_factor;\n    vec2 wing_normal = -normalize(vec2(wing_width_multiplier, wing_height_multiplier));\n    vec2 tip_normal = normalize(vec2(wing_width_multiplier, tip_height_multiplier));\n    return ArrowParameters(\n        zpt_to_texcoord_factor,\n        final_size,\n        outer_width,\n        widen_size,\n        wing_normal,\n        tip_normal);\n}\nstruct VertexShiftParameters\n{\n    vec4 clip_space_vertex;\n    float limited_factor;\n};\nVertexShiftParameters calculate_vertex_shift_parameters(\n    const mat4 mvp,\n    const vec2 vpt_size,\n    const vec2 vertex,\n    const vec2 widen,\n    const float shift_pixels)\n{\n    vec2 widen_perp = vec2(-widen.y, widen.x);\n    \n    vec4 clip_space_widen = mvp * vec4(widen, 0., 0.);\n    vec4 clip_space_widen_perp = mvp * vec4(widen_perp, 0., 0.);\n    vec2 half_viewport = vpt_size / 2.;\n    \n    vec4 clip_space_vertex = mvp * vec4(vertex, 0.0, 1.0) + clip_space_widen;\n    \n    float limited_factor = calculate_multiplication_factor(\n        half_viewport,\n        clip_space_widen,\n        clip_space_widen_perp,\n        clip_space_vertex,\n        shift_pixels);\n    return VertexShiftParameters(\n        clip_space_vertex + clip_space_widen * limited_factor,\n        limited_factor);\n}\n",calculate_scale:"struct Scale\n{\n    float projection;\n    float style;\n    float style_clamped;\n    float calculation;\n};\nScale calculate_scale(const vec3 projection_scale_style_scale_dpi, const vec2 scale_limits)\n{\n    float style_scale_clamped = clamp(projection_scale_style_scale_dpi.y, scale_limits.x, scale_limits.y);\n    float scale_ratio = projection_scale_style_scale_dpi.x / projection_scale_style_scale_dpi.y;\n    float calculation_scale = style_scale_clamped * scale_ratio;\n    return Scale(\n        projection_scale_style_scale_dpi.x,\n        projection_scale_style_scale_dpi.y,\n        style_scale_clamped,\n        calculation_scale);\n}\nconst float g_min_scale_factor = 1e-2;\nconst float g_max_scale_factor = 1e2;\nconst float g_base_scale_numerator = 1e2;\nfloat normalize_scale_to_tile(const float scale, const float tile_size)\n{\n    return clamp(\n        (scale - g_min_scale_factor) / (tile_size - g_min_scale_factor),\n        g_min_scale_factor,\n        g_max_scale_factor);\n}\n",cam_pos:bc,clipspace_pos:"\n#ifdef SCREENDOOR\nvarying vec3 v_clipspace_pos;\n#endif\nvoid save_clipspace_pos () {\n    #ifdef SCREENDOOR\n    v_clipspace_pos = gl_Position.xyz;\n    #endif\n}\n",dem:"\nuniform sampler2D u_tex_dem;\nuniform sampler2D u_tex_corrected_dem;\nuniform float u_float_corrected_interval;\nuniform mat4 u_mat4_dem_corrected;\nuniform mat4 u_mat4_dem_mvp;\nuniform float u_float_dem_scale;\nuniform float u_float_map_center_elevation;\nuniform float u_float_vertical_scale;\nconst float UNPACK_CENTROID = 8. / 65535.;\nconst float MAP_POINTS_IN_METER = 107.17318796639701;\n#ifndef VARYINGS_LIMIT_9\n    \n    varying vec2 v_vec2_dem_tex_pos;\n    \n    varying float v_float_dem_invalid;\n#endif\nvoid reset_dem_varyings() {\n    #ifndef VARYINGS_LIMIT_9\n    v_vec2_dem_tex_pos = vec2(0, 0);\n    v_float_dem_invalid = 0.;\n    #endif\n}\nfloat dem_height_direct_meters(vec2 tex_pos) {\n    \n    if (u_float_dem_scale == 0.) {\n        reset_dem_varyings();\n        return 0.;\n    }\n    #ifndef VARYINGS_LIMIT_9\n    v_vec2_dem_tex_pos = tex_pos;\n    v_float_dem_invalid = 0.;\n    #endif\n    vec4 elevation;\n    \n    if (u_float_corrected_interval == 0.) {\n        elevation = texture2D(u_tex_dem, tex_pos);\n    }\n    else {\n        vec2 test_tex_pos = abs(tex_pos - vec2(0.5, 0.5));\n        if (test_tex_pos.x < u_float_corrected_interval && test_tex_pos.y < u_float_corrected_interval) {\n            elevation = texture2D(u_tex_corrected_dem, (u_mat4_dem_corrected * vec4(tex_pos, 0, 1)).xy);\n        } else {\n            elevation = texture2D(u_tex_dem, tex_pos);\n        }\n    }\n    \n    if (elevation.a < 1.) {\n        #ifndef VARYINGS_LIMIT_9\n        v_float_dem_invalid = 1.;\n        #endif\n        \n        return 0.;\n    } else {\n        return elevation.r;\n    }\n}\nfloat meters_to_tile_height(float height) {\n    return (height - u_float_map_center_elevation) * MAP_POINTS_IN_METER * u_float_vertical_scale * u_float_dem_scale;\n}\nfloat dem_height_direct(vec2 tex_pos) {\n    float height = dem_height_direct_meters(tex_pos);\n    return meters_to_tile_height(height);\n}\n \nfloat dem_height(const vec2 coords) {\n    \n    if (u_float_dem_scale == 0.) {\n        reset_dem_varyings();\n        return 0.;\n    }\n    vec4 tex_pos = u_mat4_dem_mvp * vec4(coords, 0.0, 1.0);\n    return dem_height_direct(tex_pos.xy);\n}\nfloat abs_height(float height) {\n    return (height - u_float_map_center_elevation * MAP_POINTS_IN_METER) * u_float_dem_scale * u_float_vertical_scale;\n}\nvec2 unpack_dem_position(const vec2 pos) {\n    return pos * UNPACK_CENTROID;\n}\n",depth_test:"#ifndef UBO\nuniform vec2 u_vec2_depth_test_half_point_size;\n#endif\nuniform bool u_bool_depth_test_disable;\nuniform sampler2D u_color_tex_labeling;\nuniform sampler2D u_depth_tex_labeling;\nfloat color_test(const vec2 pos, const vec4 color)\n{\n    vec2 halfPointSize = u_vec2_depth_test_half_point_size;\n    float result = 0.;\n    \n    if (texture2D(u_color_tex_labeling, (vec2(pos.x - halfPointSize.x, pos.y + halfPointSize.y) + 1.) / 2.) == color) {\n        result++;\n    }\n    if (texture2D(u_color_tex_labeling, (pos + halfPointSize + 1.) / 2.) == color) {\n        result++;\n    }\n    if (texture2D(u_color_tex_labeling, (pos - halfPointSize + 1.) / 2.) == color) {\n        result++;\n    }\n    if (texture2D(u_color_tex_labeling, (vec2(pos.x + halfPointSize.x, pos.y - halfPointSize.y) + 1.) / 2.) == color) {\n        result++;\n    }\n    \n    return step(3., result);\n}\nfloat depth_test(const vec2 pos, const float depth, const vec4 color)\n{\n    if (u_bool_depth_test_disable == true) {\n        return 1.;\n    }\n    float colorCheck = color_test(pos, color);\n    if (colorCheck == 1.) {\n        return 1.;\n    }\n    float d = (depth + 1.) / 2.;\n    float delta = 0.001;\n    float texDepth = texture2D(u_depth_tex_labeling, (pos + 1.) / 2.).r;\n    if (d <= texDepth) {\n        return 1.;\n    }\n    if (d - texDepth > delta) {\n        return 0.;\n    }\n    return 1. - (d - texDepth) / delta;\n}\n",ecef_mvp_mat:"uniform mat4 u_mat4_flat_mvp;\nuniform mat4 u_mat4_ecef_mvp;\nuniform float u_float_crossfade;\nconst float ECEF_CF_E = 2e-16;\nconst float ECEF_WORLD = 4294967296.;\nvec4 get_clipspace(const vec3 fpos) {\n    return u_mat4_flat_mvp * vec4(fpos, 1.);\n}\nvec4 get_clipspace(const vec3 fpos, const vec3 epos) {\n    if (u_float_crossfade < ECEF_CF_E) {\n        return u_mat4_flat_mvp * vec4(fpos, 1.);\n    } else if (u_float_crossfade > (1. - ECEF_CF_E)) {\n        return u_mat4_ecef_mvp * vec4(epos * ECEF_WORLD, 1.);\n    }\n    vec4 fclip = u_mat4_flat_mvp * vec4(fpos, 1.);\n    vec4 eclip = u_mat4_ecef_mvp * vec4(epos * ECEF_WORLD, 1.);\n    return mix(fclip, eclip, u_float_crossfade);\n}\nvec4 get_clipspace(const vec3 fpos, const vec3 epos, const float elevation) {\n    float R = ECEF_WORLD + elevation;\n    if (u_float_crossfade < ECEF_CF_E) {\n        return u_mat4_flat_mvp * vec4(fpos, 1.);\n    } else if (u_float_crossfade > (1. - ECEF_CF_E)) {\n        return u_mat4_ecef_mvp * vec4(epos * R, 1.);\n    }\n    vec4 fclip = u_mat4_flat_mvp * vec4(fpos, 1.);\n    vec4 eclip = u_mat4_ecef_mvp * vec4(epos * R, 1.);\n    return mix(fclip, eclip, u_float_crossfade);\n}\n",fog:"#ifndef UBO\n# ifdef FOG\nuniform float u_fog_distance;\n# endif\n# ifdef SKY\nuniform mat4 u_mat4_view_transposed;\nuniform mat4 u_mat4_proj_inverted;\n# endif\n#endif \n#if defined(FOG) || defined(SKY)\nvarying vec3 v_fog_pos;\n#endif\nvoid calc_fog_pos(vec3 world_pos) {\n#ifdef FOG\n    v_fog_pos = (world_pos - u_cam_pos) / u_fog_distance;\n#endif\n}\nvoid calc_fog_pos_sky(vec4 pos) {\n#ifdef SKY\n    v_fog_pos = mat3(u_mat4_view_transposed) * (u_mat4_proj_inverted * pos).xyz;\n#endif\n}",jitter:"#ifdef TAA\nuniform vec2 u_vec2_camera_jitter;\nvoid apply_vertex_jitter(inout vec4 clipPos) {\n    clipPos.xy += clipPos.w * u_vec2_camera_jitter;\n}\n#endif",line_width:"float calculate_final_width(\n    const Scale scale,\n    const float width,\n    const float width_offset)\n{\n    \n    float final_width = max(0., scale.calculation * width - scale.projection * width_offset);\n    return final_width;\n}\n",mix_color_defs:xc,mvp_mat:"uniform mat4 u_mat4_mvp;\n",packed_attributes:"\nvec2 normalize_s08(vec2 value)\n{\n    return value * (1. / 127.);\n}\nvec3 normalize_s08(vec3 value)\n{\n    return value * (1. / 127.);\n}\nfloat normalize_s16(float value)\n{\n    return value * (1. / 32767.);\n}\nvec2 normalize_s16(vec2 value)\n{\n    return value * (1. / 32767.);\n}\nvec3 normalize_s16(vec3 value)\n{\n    return value * (1. / 32767.);\n}\nvec2 unpack_widen(vec2 widen_packed)\n{\n    \n    return normalize_s08(widen_packed) * sqrt(2.);\n}\nvec2 unpack_texcoord(vec2 texcoord)\n{\n    return texcoord * (1. / 32768.);\n}\nvec2 unpack_model_texcoord(vec2 texcoord)\n{\n    const float min_value = -3.0;\n    const float max_value = 5.0;\n    return texcoord * (max_value - min_value) / 65536.0 + min_value;\n}\n",pixel_offset:"\nconst float g_min_denominator = 1e-7;\nconst float g_max_factor = 10000.;\nfloat calculate_multiplication_factor(\n    vec2 half_viewport,\n    \n    vec4 clip_space_widen,\n    vec4 clip_space_widen_perp,\n    \n    vec4 clip_space_vertex,\n    float shift_pixels)\n{\n    float limited_factor = 0.;\n    {\n        \n        vec2 screen_space_widen = (clip_space_widen.xy * clip_space_vertex.w - clip_space_vertex.xy * clip_space_widen.w) * half_viewport;\n        vec2 screen_space_widen_perp = (clip_space_widen_perp.xy * clip_space_vertex.w - clip_space_vertex.xy * clip_space_widen_perp.w) * half_viewport;\n        \n        vec2 perp = vec2(screen_space_widen_perp.y, -screen_space_widen_perp.x);\n        \n        float perp_length = length(perp);\n        vec4 v = clip_space_vertex;\n        vec4 n = clip_space_widen;\n        float denominator = dot(perp, screen_space_widen) / shift_pixels - n.w * v.w * perp_length;\n        if (abs(denominator) > g_min_denominator)\n        {\n            float factor = v.w * v.w * perp_length / denominator;\n            \n            \n            \n            \n            \n            \n            \n            \n            \n            if (factor != factor){\n                return limited_factor;\n            }\n            limited_factor = sign(factor) * min(g_max_factor, abs(factor));\n        }\n    }\n    return limited_factor;\n}\n",pos_world:"uniform mat4 u_mat4_model;\nvec3 calc_pos_world(vec4 pos) {\n    \n    \n    \n    return (u_mat4_model * pos).xyz;\n}\nvec3 calc_pos_world(vec3 pos) {\n    return calc_pos_world(vec4(pos, 1.0));\n}\nvec3 calc_pos_world(vec2 pos) {\n    return calc_pos_world(vec4(pos, 0.0, 1.0));\n}",precision_constants:"\nconst float g_circle_scale_precision_factor = 1e8;\n",prelude:"#ifdef WEBGL2\n#define varying out\n#define attribute in\n#define texture2D texture\n#endif\n#ifdef UBO\nuniform CommonSettings\n{\n    mediump float u_float_rounding_factor;\n    mediump float u_float_border_width_offset;\n    mediump vec2 u_vec2_scale_limits;\n    mediump vec2 u_vec2_depth_test_half_point_size;\n    mediump vec2 u_vec2_vpt_size;\n    \n    mediump vec4 u_fog_color;\n    mediump vec2 u_fog_limits;\n    mediump float u_fog_horizon_blend;\n    mediump float u_fog_horizon_level;\n    mediump float u_fog_distance;\n    mediump vec4 u_sky_color;\n    highp vec3 u_cam_pos;\n    \n    \n    \n    \n    \n    \n    mediump vec4 u_shadow_map_params;\n    highp mat4 u_mat4_clip_to_shadow;\n    mediump float u_shadow_bias;\n    mediump mat4 u_mat4_view_transposed;\n    mediump mat4 u_mat4_proj_inverted;\n    \n    mediump vec2 u_vec2_halo_viewport_size;\n    mediump vec2 u_vec2_halo_viewport_center_shift;\n    mediump vec4 u_vec4_halo_radius_stops;\n    mediump vec4 u_vec4_halo_color;\n    mediump float u_float_halo_exp_factor;\n    mediump vec4 u_vec4_default_background_color;\n    \n    mediump mat4 u_mat4_stars;\n    mediump float u_float_pixelratio;\n    mediump float u_float_stars_intensity;\n};\n#endif\n",raster_functions:"\nfloat unpack_scale(float value)\n{\n    return exp(abs(value) / 256.) * sign(value);\n}\nfloat unpack_positive_value(float value)\n{\n    return exp(value / 256.);\n}\nvec2 make_position(const vec2 position, const float w, const vec2 inv_half_size, const float rounding_factor)\n{\n    vec2 non_rounded_position = (position + w) / (w * inv_half_size);\n    vec2 rounded_position = floor(non_rounded_position + 0.5);\n    vec2 rounding_delta = rounded_position - non_rounded_position;\n    vec2 pixel_coord = non_rounded_position + rounding_factor * rounding_delta - 0.5;\n    return (pixel_coord * inv_half_size) * w - w;\n}\nvec2 overlay_transform(const vec2 position, const vec2 inv_half_size)\n{\n    \n    \n    return position * inv_half_size;\n}\nfloat clipw(const float w, const vec2 range, const float scale)\n{\n    return w * (step(unpack_scale(range.x), scale) - step(unpack_positive_value(range.y), scale));\n}\nvec2 rescale(const vec2 corner, const vec2 rescale, const vec2 scale_range, const float style_scale)\n{\n    \n    \n    if (scale_range.x < 0.)\n    {\n        float default_scale_denominator = unpack_positive_value(rescale.x);\n        float rescale_coeff = unpack_positive_value(rescale.y);\n        float min_scale = unpack_positive_value(-scale_range.x);\n        float stretch_exponent = floor(0.5 + log2(\n            max(1., 1. + rescale_coeff * (1. / max(min_scale, style_scale) - default_scale_denominator))));\n        return corner.xy * exp2(stretch_exponent);\n    }\n    return corner;\n}\n",round_position:"\nvec4 round_position(const vec4 position, const vec2 half_viewport)\n{\n    if (\n        position.w < 0.\n        || position.x < -position.w\n        || position.x > position.w\n        || position.y < -position.w\n        || position.y > position.w\n        || position.z < -position.w\n        || position.z > position.w)\n    {\n        return position;\n    }\n    else\n    {\n        \n        return vec4(\n            sign(position.xy) * floor(abs(position.xy) * half_viewport / position.w + .5)\n                * position.w / half_viewport,\n            position.zw);\n    }\n}\n",shadow:"#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_from_light;\nvarying float v_depth_metric;\n#ifndef UBO\nuniform mat4 u_mat4_clip_to_shadow;\nuniform mediump vec4 u_shadow_map_params;\nuniform mediump float u_shadow_bias;\n#endif\nvoid compute_shadow_vertex(vec4 clip_pos)\n{\n    v_pos_from_light = u_mat4_clip_to_shadow * clip_pos;\n    v_pos_from_light.z -= u_shadow_bias;\n    v_depth_metric = 0.5 * v_pos_from_light.z + 0.5;\n}\nvoid compute_shadow_vertex(vec4 clip_pos, vec3 normal, mat4 mvp_mat)\n{\n    \n    float normal_bias = u_shadow_map_params[3];\n    vec3 norm_from_light = (u_mat4_clip_to_shadow * mvp_mat * vec4(normal, 0.0)).xyz;\n    v_pos_from_light = u_mat4_clip_to_shadow * clip_pos;\n    v_pos_from_light.xyz += normal_bias * normalize(norm_from_light);\n    v_pos_from_light.z -= u_shadow_bias;\n    v_depth_metric = 0.5 * v_pos_from_light.z + 0.5;\n}\n#else \nvoid compute_shadow_vertex(vec4 clip_pos) { }\nvoid compute_shadow_vertex(vec4 clip_pos, vec3 normal, mat4 mvp_mat) { }\n#endif ",signed_distance_functions:wc,striped_line_functions:"struct PolylineDistance\n{\n    \n    float vertex_distance_from_start;\n    \n    float segment_distance_from_start;\n    \n    float total_length;\n};\nstruct StripedLineInParams\n{\n    float dash_length;\n    float space_length;\n    float dash2_length;\n    float line_width;\n};\nstruct StripedLineOutParams\n{\n    \n    float part_color_swap_threshold;\n    float distance_in_parts;\n};\nvoid calculate_line_params(in PolylineDistance polyline_distance, in StripedLineInParams striped_line_params, out StripedLineOutParams line_params)\n{\n    \n    float requested_part_length =\n        striped_line_params.dash_length\n        + striped_line_params.space_length;\n    \n    float space2_length = requested_part_length - striped_line_params.dash2_length;\n    \n    float part_count = max(\n        floor(polyline_distance.total_length / requested_part_length + 0.5),\n        1.0);\n    \n    float part_length = polyline_distance.total_length / part_count;\n    \n    float dash_length = (part_length / requested_part_length) * striped_line_params.dash2_length;\n    float part_color_swap_threshold = dash_length / part_length;\n    \n    \n    float segment_start = fract((polyline_distance.segment_distance_from_start + 0.5 * dash_length) / part_length);\n    float vertex_normalized_distance = segment_start + polyline_distance.vertex_distance_from_start / part_length;\n    line_params = StripedLineOutParams(\n        part_color_swap_threshold,\n        vertex_normalized_distance);\n}\n"},Tc={arrow_line_entrance:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pixel_offset>\n#include <signed_distance_functions>\n#include <arrow_functions>\n#include <calculate_scale>\n#include <apply_opacity>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#ifndef UBO\nuniform float u_float_border_width_offset;\nuniform vec2 u_vec2_scale_limits;\nuniform mediump vec2 u_vec2_vpt_size;\n#endif\nuniform vec4 u_vec4_color;\nuniform vec4 u_vec4_border_color;\nuniform vec3 u_vec3_projection_scale_style_scale_dpi;\nuniform float u_float_width_zpt;\nuniform float u_float_wing_height_multiplier;\nuniform float u_float_wing_width_multiplier;\nuniform float u_float_border_width_zpt;\nuniform float u_float_size_factor;\nuniform float u_float_tip_height_multiplier;\nuniform float u_float_relative_end_position;\nuniform float u_float_tip_movement_amplitude;\nuniform float u_float_vertex_shift; \nuniform float u_float_opacity;\nuniform float u_float_tip_radius_zpt;\nuniform float u_float_wing_radius_zpt;\nuniform float u_float_tail_radius_zpt;\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_segment_end;\nattribute vec4 a_vec4_texture_widen_arrow_widen;\nattribute vec2 a_vec2_widen;\nattribute vec2 a_vec2_direction; \nattribute float a_float_distance_from_start;\nattribute float a_float_object_length;\nattribute float a_float_type;\nattribute vec4 a_vec4_identifier; \nvarying vec2 v_vec2_line_type_arrow_tail;\nvarying vec4 v_vec4_arrow_width_length_border_outer;\nvarying vec4 v_vec4_texcoord_arrow_line;\nvarying vec4 v_vec4_distance_vertex_hiding;\nvarying vec4 v_vec4_identifier;\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_border_color;\n#ifdef ENTRANCE_ARROWS_ROUNDING\nvarying vec3 v_vec3_radius_tip_wing_tail;\n#endif\nvarying vec4 v_vec4_circle_center_tip_wing;\nconst float g_w_factor = 1e-7;\nconst float g_type_line = 0.;\nconst float g_type_arrow = 1.;\nconst float g_type_start_border = 2.;\nconst float g_type_line_ending = 3.;\nconst float g_type_line_cut = 4.;\nconst float g_shift_pixels = 2.;\nconst float g_line_overlapping_part = .2;\nstruct ArrowLineViewParameters\n{\n    float vertex_type;\n    float width_zpt;\n    float border_width_zpt;\n    float border_width_offset;\n    float tip_radius_zpt;\n    float wing_radius_zpt;\n    float tail_radius_zpt;\n    float arrow_segment_length_zpt;\n    float tip_height_multiplier;\n    float wing_height_multiplier;\n    float wing_width_multiplier;\n    float size_factor;\n    vec2 vertex_position;\n    vec2 vertex_widen;\n    vec2 line_texture_widen;\n    vec2 arrow_texture_widen;\n    vec2 segment_direction;\n    float segment_length;\n    float distance_to_end;\n};\nstruct DistanceShiftParameters\n{\n    float shift;\n    bool invisible;\n};\nvec2 perp(const vec2 vector)\n{\n    return vec2(-vector.y, vector.x);\n}\nvec2 vertex_shift(const Scale scale)\n{\n    return u_float_vertex_shift * u_float_tip_movement_amplitude * normalize_s08(a_vec2_direction) * scale.calculation;\n}\nvec2 arrow_shift(const ArrowLineViewParameters view)\n{\n    \n    \n    \n    return view.segment_direction * view.distance_to_end;\n}\nfloat erase_length_end()\n{\n    return clamp(u_float_relative_end_position, 0., 1.) * a_float_object_length;\n}\nvoid set_texcoord_varyings(const vec2 arrow_texcoord, const vec2 line_texcoord)\n{\n    v_vec4_texcoord_arrow_line = vec4(arrow_texcoord, line_texcoord);\n}\nvoid set_arrow_varyings(\n    const float arrow_width,\n    const float arrow_length,\n    const float arrow_border,\n    const float arrow_outer_width,\n    const float arrow_tail_hide_part,\n    const float arrow_tip_radius,\n    const float arrow_wing_radius,\n    const float tail_radius,\n    const vec2 tip_circle_center,\n    const vec2 wing_circle_center)\n{\n    v_vec4_arrow_width_length_border_outer = vec4(\n        arrow_width,\n        arrow_length,\n        arrow_border,\n        arrow_outer_width);\n    v_vec2_line_type_arrow_tail = vec2(\n        a_float_type,\n        arrow_tail_hide_part);\n    #ifdef ENTRANCE_ARROWS_ROUNDING\n    v_vec3_radius_tip_wing_tail = vec3(\n        arrow_tip_radius,\n        arrow_wing_radius,\n        tail_radius);\n    #endif\n    v_vec4_circle_center_tip_wing = vec4(tip_circle_center.xy, wing_circle_center.xy);\n}\nDistanceShiftParameters calculate_entrance_arrow_distances(\n    const ArrowLineViewParameters view,\n    const float signed_distance_shift,\n    const float arrow_final_size,\n    const float entrance_arrow_distance_shift)\n{\n    DistanceShiftParameters line_distance_parameters = DistanceShiftParameters(\n        signed_distance_shift + entrance_arrow_distance_shift,\n        false);\n    if (a_float_type == g_type_arrow)\n    {\n        \n        \n        bool outside_of_current_segment = view.distance_to_end > view.segment_length + entrance_arrow_distance_shift;\n        \n        bool inside_end_hide = a_float_distance_from_start + entrance_arrow_distance_shift > erase_length_end();\n        return DistanceShiftParameters(\n            \n            line_distance_parameters.shift + view.distance_to_end,\n            outside_of_current_segment || inside_end_hide\n        );\n    }\n    else\n    {\n        return line_distance_parameters;\n    }\n}\nvoid set_distance_varyings(\n    const ArrowLineViewParameters view,\n    const float arrow_final_size,\n    const float signed_shift_distance)\n{\n    float entrance_arrow_distance_shift = arrow_final_size * (2. - g_line_overlapping_part);\n    DistanceShiftParameters distance_shift_parameters = calculate_entrance_arrow_distances(\n        view,\n        signed_shift_distance,\n        arrow_final_size,\n        entrance_arrow_distance_shift);\n    v_vec4_distance_vertex_hiding =\n        vec4(\n            a_float_distance_from_start + distance_shift_parameters.shift,\n            0.,\n            erase_length_end(),\n            distance_shift_parameters.invisible\n                ? a_float_object_length\n                : 0.\n        ) / a_float_object_length;\n}\nArrowLineViewParameters decode_arrow_line_view_parameters()\n{\n    float width_zpt = u_float_width_zpt;\n    float border_width_zpt = u_float_border_width_zpt;\n    float arrow_segment_length_zpt = width_zpt * u_float_tip_height_multiplier + border_width_zpt;\n    float vertex_type = a_float_type;\n    \n    vec2 segment_direction = (vertex_type == g_type_line_ending || vertex_type == g_type_line_cut)\n        ? normalize(a_vec2_vertex - a_vec2_segment_end)\n        : normalize(a_vec2_segment_end - a_vec2_vertex);\n    float segment_length = length(a_vec2_segment_end - a_vec2_vertex);\n    float distance_to_end = erase_length_end() - a_float_distance_from_start;\n    return ArrowLineViewParameters(\n        vertex_type,\n        width_zpt,\n        border_width_zpt,\n        u_float_border_width_offset,\n        u_float_tip_radius_zpt,\n        u_float_wing_radius_zpt,\n        u_float_tail_radius_zpt,\n        arrow_segment_length_zpt,\n        u_float_tip_height_multiplier,\n        u_float_wing_height_multiplier,\n        u_float_wing_width_multiplier,\n        u_float_size_factor,\n        a_vec2_vertex,\n        unpack_widen(a_vec2_widen),\n        unpack_widen(a_vec4_texture_widen_arrow_widen.xy),\n        unpack_widen(a_vec4_texture_widen_arrow_widen.zw),\n        segment_direction,\n        segment_length,\n        distance_to_end);\n}\nvec4 process_arrow_line_vertex(const Scale scale, const mat4 mvp, const vec2 vpt_size)\n{\n    ArrowLineViewParameters view = decode_arrow_line_view_parameters();\n    \n    ArrowParameters arrow_parameters = calculate_arrow_parameters(\n        scale.calculation,\n        view.width_zpt,\n        view.border_width_zpt,\n        view.arrow_segment_length_zpt,\n        view.wing_width_multiplier,\n        view.wing_height_multiplier,\n        view.tip_height_multiplier,\n        view.size_factor);\n    vec2 vertex_widen = view.vertex_widen;\n    vec2 texture_widen_with_sign = view.line_texture_widen;\n    \n    \n    float shift_sign = sign(dot(vertex_widen, texture_widen_with_sign));\n    vec2 line_texture_widen = shift_sign * texture_widen_with_sign;\n    \n    float line_final_size = (view.width_zpt + 2. * view.border_width_zpt) * view.size_factor * scale.calculation;\n    float final_size = (view.vertex_type == g_type_arrow)\n        ? arrow_parameters.final_size\n        : line_final_size;\n    \n    \n    \n    \n    vec2 line_texture_widen_perp = perp(line_texture_widen);\n    float shift_distance = abs(dot(vertex_widen, line_texture_widen_perp)) * final_size;\n    vec2 shift_direction = line_texture_widen_perp * sign(dot(vertex_widen, line_texture_widen_perp));\n    vec2 line_vertex_shift = vertex_widen * final_size - shift_direction * max(0., shift_distance - .5 * view.segment_length);\n    \n    vec2 arrow_vertex_widen = vertex_widen * arrow_parameters.final_size;\n    vec2 scene_vertex_shift = (view.vertex_type == g_type_arrow)\n        ? arrow_vertex_widen\n        : line_vertex_shift;\n    vec2 arrow_position_shift = (view.vertex_type == g_type_arrow)\n        ? arrow_shift(view)\n        : vec2(0.);\n    \n    float shift_pixels = g_shift_pixels * sqrt(2.);\n    VertexShiftParameters line_shift_parameters = calculate_vertex_shift_parameters(\n        mvp,\n        vpt_size,\n        view.vertex_position + (vertex_shift(scale) + arrow_position_shift),\n        scene_vertex_shift,\n        shift_pixels);\n    float arrow_line_texcoord_scale = line_final_size / arrow_parameters.final_size;\n    float line_texcoord_scale = (view.vertex_type != g_type_arrow)\n        ? arrow_line_texcoord_scale\n        : 1.;\n    vec2 line_texcoord = line_texture_widen * (1. + line_shift_parameters.limited_factor) * line_texcoord_scale;\n    \n    float arrow_texcoord_scale = (view.vertex_type == g_type_start_border)\n        ? arrow_line_texcoord_scale\n        : 1.;\n    vec2 arrow_texcoord = view.arrow_texture_widen * (1. + line_shift_parameters.limited_factor) * arrow_texcoord_scale;\n    set_texcoord_varyings(arrow_texcoord, line_texcoord);\n    float arrow_width = view.width_zpt * arrow_parameters.zpt_to_texcoord_factor;\n    float arrow_length = view.arrow_segment_length_zpt * arrow_parameters.zpt_to_texcoord_factor;\n    float arrow_tip_radius = view.tip_radius_zpt * arrow_parameters.zpt_to_texcoord_factor;\n    float arrow_wing_radius = view.wing_radius_zpt * arrow_parameters.zpt_to_texcoord_factor;\n    float tail_radius = view.tail_radius_zpt * arrow_parameters.zpt_to_texcoord_factor;\n    \n    float texcoord_border_width = view.border_width_zpt * arrow_parameters.zpt_to_texcoord_factor;\n    float border_width_texcoord_offset = view.border_width_offset * arrow_parameters.zpt_to_texcoord_factor;\n    float arrow_border = max(0., texcoord_border_width - scale.style / scale.style_clamped * border_width_texcoord_offset);\n    \n    float tail_shift_direction = (view.vertex_type == g_type_line_ending || view.vertex_type == g_type_start_border) ? 1. : -1.;\n    float tail_hide_shift = dot(arrow_vertex_widen, tail_shift_direction * view.segment_direction);\n    float arrow_tail_hide_part = (view.distance_to_end - tail_hide_shift) * arrow_parameters.zpt_to_texcoord_factor / view.size_factor;\n    \n    \n    float half_length = arrow_length / 2.;\n    float arrow_height = arrow_width * (view.tip_height_multiplier - view.wing_height_multiplier);\n    float A1 = arrow_parameters.tip_normal.x;\n    float B1 = arrow_parameters.tip_normal.y;\n    float C1 = -half_length * A1 - arrow_border + arrow_wing_radius;\n    float A2 = arrow_parameters.wing_normal.x;\n    float B2 = arrow_parameters.wing_normal.y;\n    float C2 = (arrow_height - half_length) * A2 - arrow_border + arrow_wing_radius;\n    float denominator = A1 * B2 - A2 * B1;\n    float wing_circle_center_x = (C2 * B1 - C1 * B2) / denominator;\n    float wing_circle_center_y = (A2 * C1 - A1 * C2) / denominator;\n    vec2 wing_circle_center = vec2(wing_circle_center_x, wing_circle_center_y);\n    vec2 tip_circle_center = vec2(half_length - (arrow_tip_radius - arrow_border) / arrow_parameters.tip_normal.x, 0.);\n    set_arrow_varyings(\n        arrow_width,\n        arrow_length,\n        arrow_border,\n        arrow_parameters.outer_width,\n        arrow_tail_hide_part,\n        arrow_tip_radius,\n        arrow_wing_radius,\n        tail_radius,\n        tip_circle_center,\n        wing_circle_center);\n    set_distance_varyings(\n        view,\n        arrow_parameters.final_size,\n        shift_sign * shift_distance);\n    \n    \n    return line_shift_parameters.clip_space_vertex / final_size;\n}\nvoid main()\n{\n    v_vec4_identifier = a_vec4_identifier; \n    Scale scale = calculate_scale(u_vec3_projection_scale_style_scale_dpi, u_vec2_scale_limits);\n    vec4 processed_vertex = process_arrow_line_vertex(scale, u_mat4_mvp, u_vec2_vpt_size);\n    gl_Position = processed_vertex * g_w_factor;\n    v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n    v_vec4_border_color = apply_opacity(u_vec4_border_color, u_float_opacity);\n    \n    vec3 pos_world = calc_pos_world(a_vec2_vertex);\n    calc_fog_pos(pos_world);\n}\n",building_shadow:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <apply_height_factor>\nuniform float u_float_height_factor;\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_visibility;\nvarying float v_depth_metric;\nvoid main()\n{\n    \n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    \n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    \n    if (a_float_z == 0.) {\n        float posHeight = dem_height(a_vec2_vertex);\n        if (height > posHeight) {\n            height = posHeight;\n        }\n    }\n    height += u_float_floor_elevation;\n    vec4 vertex_hf = apply_height_factor(vec3(a_vec2_vertex, a_float_z), u_float_height_factor);\n    vertex_hf.z += height;\n    \n    vertex_hf.z = max(vertex_hf.z, height);\n    gl_Position = u_mat4_mvp * vertex_hf;\n    v_depth_metric = (gl_Position.z + 1.0) / 2.0;\n}",circle_marker:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\nattribute vec3 a_vec3_flat_position;\nattribute vec3 a_vec3_ecef_position;\nattribute vec2 a_vec2_widen;\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform float u_float_width;\nvarying vec2 v_vec2_circle;\nvarying float v_float_width;\nvoid main() {\n    vec4 pos = get_clipspace(a_vec3_flat_position, a_vec3_ecef_position);\n    vec4 ndc_position = pos / pos.w;\n    ndc_position.xy += a_vec2_widen * u_float_width / u_vec2_vpt_size;\n    gl_Position = ndc_position;\n    v_vec2_circle = a_vec2_widen;\n    v_float_width = u_float_width;\n    vec3 pos_world = calc_pos_world(a_vec3_flat_position);\n    calc_fog_pos(pos_world);\n}\n",circle_marker_identify:"#include <prelude>\n#include <ecef_mvp_mat>\nattribute vec3 a_vec3_flat_position;\nattribute vec3 a_vec3_ecef_position;\nattribute vec2 a_vec2_widen;\nattribute vec4 a_vec4_identifier;\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform float u_float_width;\nvarying vec2 v_vec2_circle;\nvarying vec4 v_vec4_identifier;\nvoid main() {\n    v_vec2_circle = a_vec2_widen;\n    v_vec4_identifier = a_vec4_identifier;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier)\n    {\n        vec4 pos = get_clipspace(a_vec3_flat_position, a_vec3_ecef_position);\n        vec4 ndc_position = pos / pos.w;\n        ndc_position.xy += a_vec2_widen * u_float_width / u_vec2_vpt_size;\n        gl_Position = ndc_position;\n    }\n    else\n    {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n}\n",color:"#include <prelude>\n#include <mvp_mat>\n#include <apply_opacity>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\n#include <mix_color_defs>\nuniform vec4 u_vec4_color;\nuniform float u_float_opacity;\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_visibility;\nvarying vec4 v_vec4_color;\nvarying vec2 v_vec2_texcoord;\n#ifdef MIX_COLOR_MODE\nuniform vec4 u_vec4_color2;\nvarying vec4 v_vec4_color2;\n# if MIX_COLOR_MODE == MIX_COLOR_MODE_READ_FROM_TARGET\nvarying vec4 v_vec4_pos;\n# elif MIX_COLOR_MODE == MIX_COLOR_MODE_VERTEX_ATTRIBUTE\nvarying float v_float_mix_color_factor;\nattribute float a_float_mix_factor;\n# endif\n#endif\nvarying vec3 v_vec3_fragment_pos_world;\nvoid main()\n{\n#ifdef MIX_COLOR_MODE\n# if MIX_COLOR_MODE == MIX_COLOR_MODE_READ_FROM_TARGET\n    v_vec4_pos = vec4(0, 0, 0, 1);\n# elif MIX_COLOR_MODE == MIX_COLOR_MODE_VERTEX_ATTRIBUTE\n    v_float_mix_color_factor = a_float_mix_factor;\n# endif\n#endif\n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 0, 1);\n        return;\n    }\n    v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n#ifdef MIX_COLOR_MODE\n    v_vec4_color2 = apply_opacity(u_vec4_color2, u_float_opacity);\n#endif\n    vec4 vertex = vec4(a_vec2_vertex, u_float_floor_elevation, 1.0);\n    gl_Position = u_mat4_mvp * vertex;\n    vec3 pos_world = calc_pos_world(vertex.xyz);\n    calc_fog_pos(pos_world);\n    \n    \n    \n    \n    \n    \n    \n    v_vec2_texcoord = fract(abs((a_vec2_vertex - 0.25) * 2.));\n    v_vec3_fragment_pos_world = pos_world;\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    compute_shadow_vertex(gl_Position, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n#ifdef MIX_COLOR_MODE\n# if MIX_COLOR_MODE == MIX_COLOR_MODE_READ_FROM_TARGET\n    v_vec4_pos = gl_Position;\n# endif\n#endif\n}\n",color_identify:"#include <prelude>\n#include <mvp_mat>\n#include <round_position>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute vec4 a_vec4_identifier;\nattribute float a_float_visibility;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    v_vec4_identifier = a_vec4_identifier;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier && a_float_visibility != 0.0)\n    {\n        gl_Position = round_position(u_mat4_mvp * vec4(a_vec2_vertex, u_float_floor_elevation, 1.), .5 * u_vec2_vpt_size);\n    }\n    else\n    {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n}\n",dem_elevation:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\nattribute vec2 a_vec2_vertex;\nattribute float a_float_height;\nvarying float v_float_height;\nvoid main()\n{\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, 0.0, 1.0);\n    v_float_height = a_float_height;\n}\n",dem_elevation_copy:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\nuniform mat4 u_mat4_dem_corrected;\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_texcoord;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, 0.0, 1.0);\n    v_vec2_texcoord = (u_mat4_dem_corrected * vec4(unpack_texcoord(a_vec2_texcoord), 0, 1)).xy;\n}\n",dem_flat_bottom:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_centroid;\nattribute vec2 a_vec2_extender;\nvarying vec4 v_vec4_color;\nvoid main()\n{\n    vec4 tex_pos = u_mat4_dem_corrected * u_mat4_mvp * vec4(unpack_dem_position(a_vec2_centroid), 0.0, 1.0);\n    v_vec4_color = texture2D(u_tex_dem, tex_pos.xy);\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex + a_vec2_extender * 1./64., 0.0, 1.0);\n}\n",dem_ground:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\nuniform mat4 u_mat4_model;\nattribute vec2 a_vec2_position;\nvarying vec4 v_vec4_coords;\nvoid main()\n{\n    vec4 tex_pos = u_mat4_dem_mvp * vec4(a_vec2_position, 0.0, 1.0);\n    float height = dem_height_direct_meters(tex_pos.xy / tex_pos.w);\n    float tile_height = meters_to_tile_height(height);\n    gl_Position = u_mat4_mvp * vec4(a_vec2_position, tile_height, 1.0);\n    v_vec4_coords = u_mat4_model * vec4(a_vec2_position, 0, 1.0);\n    \n    v_vec4_coords[2] = height;\n}\n",dem_ground2:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\nuniform mat4 u_mat4_model;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_height;\nvarying vec4 v_vec4_coords;\nvoid main()\n{\n    float tile_height = meters_to_tile_height(a_float_height);\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, tile_height, 1.0);\n    v_vec4_coords = u_mat4_model * vec4(a_vec2_vertex, 0, 1.0);\n    \n    v_vec4_coords[2] = a_float_height;\n}\n",dem_mesh:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\n#include <jitter>\nuniform mat4 u_mat4_flat_map_mvp;\nattribute vec2 a_vec2_position;\nvarying vec4 v_vec4_texcoord;\nvarying vec2 hs_tex_pos;\nvoid main()\n{\n    vec4 coords = u_mat4_mvp * vec4(a_vec2_position, 0.0, 1.0);\n    vec4 tex_pos = u_mat4_dem_mvp * vec4(a_vec2_position, 0.0, 1.0);\n    float height = dem_height_direct(tex_pos.xy / tex_pos.w);\n    gl_Position = u_mat4_mvp * vec4(a_vec2_position, height, 1.0);\n    vec4 flat_coord = u_mat4_flat_map_mvp * vec4(a_vec2_position, 0.0, 1.0);\n    v_vec4_texcoord = vec4(flat_coord.xy, 0., flat_coord.w);\n    hs_tex_pos = tex_pos.xy;\n    vec3 pos_world = calc_pos_world(vec4(a_vec2_position, height, 1.0));\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    compute_shadow_vertex(gl_Position, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n}\n",dem_mesh2:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\n#include <jitter>\nuniform mat4 u_mat4_flat_map_mvp;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_height;\nattribute vec3 a_vec3_normal;\nvarying vec4 v_vec4_texcoord;\nvarying vec3 v_vec3_position;\nvarying vec3 v_vec3_normal;\nuniform mediump float u_use_flat_dem_mesh_normals;\nvoid main() {\n    \n    \n    v_vec3_normal = a_vec3_normal;\n    float height_tile = meters_to_tile_height(a_float_height);\n    vec4 tex_pos = u_mat4_dem_mvp * vec4(a_vec2_vertex, 0.0, 1.0);\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, height_tile, 1.0);\n    vec4 flat_coord = u_mat4_flat_map_mvp * vec4(a_vec2_vertex, 0., 1.0);\n    v_vec4_texcoord = vec4(flat_coord.xy, 1., flat_coord.w);\n    vec3 pos_world = calc_pos_world(vec4(a_vec2_vertex, height_tile, 1.0));\n    \n    \n    mat3 rotation_scale_mat = mat3(u_mat4_model);\n    v_vec3_position = rotation_scale_mat * vec3(a_vec2_vertex, height_tile);\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    compute_shadow_vertex(gl_Position, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n}\n",dem_normal:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_texcoord;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    gl_Position = vec4((a_vec2_vertex * 2. - vec2(1, 1)), 0.0, 1.0);\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n}\n",diffuse:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <apply_opacity>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <clipspace_pos>\n#include <jitter>\n#include <shadow>\nuniform vec4 u_vec4_color;\nuniform mat4 u_mat4_gradient;\nuniform float u_float_height_factor;\nuniform float u_float_opacity;\nuniform float u_float_floor_elevation;\nuniform int u_int_is_roof;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_visibility;\nvarying vec4 v_vec4_color;\nvarying mat4 v_mat4_gradient;\nvarying vec4 v_vec4_rotated_scaled_vertex;\nconst float g_wall_offset_isometric = .001;\nconst float g_wall_offset_perspective = 8.;\nvoid main()\n{\n    \n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    \n    if (a_float_z == 0.) {\n        float posHeight = dem_height(a_vec2_vertex);\n        if (height > posHeight) {\n            height = posHeight;\n        }\n    }\n    height += u_float_floor_elevation;\n    vec3 vertex = vec3(a_vec2_vertex, a_float_z);\n    vec4 vertex_hf = apply_height_factor(vertex, u_float_height_factor);\n    vertex_hf.z += height;\n    \n    vertex_hf.z = max(vertex_hf.z, height);\n    vec4 clip_pos = u_mat4_mvp * vertex_hf;\n    gl_Position = clip_pos;\n    if (u_int_is_roof == 0)\n    {\n        \n        if ((u_mat4_mvp[0][3] == 0.) && (u_mat4_mvp[1][3] == 0.) && (u_mat4_mvp[2][3] == 0.))\n        {\n            gl_Position.z += g_wall_offset_isometric;\n        }\n        else\n        {\n            \n            \n            \n            if (height == 0.) {\n                gl_Position.z += g_wall_offset_perspective;\n            } else {\n                gl_Position.z += g_wall_offset_isometric;\n            }\n        }\n    }\n    vec3 pos_world = calc_pos_world(vertex_hf);\n    calc_fog_pos(pos_world);\n    save_clipspace_pos();\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    \n    mat3 rotation_scale_mat = mat3(u_mat4_model);\n    v_vec4_rotated_scaled_vertex.xyz = rotation_scale_mat * vertex;\n    v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n    if (u_mat4_gradient[0][0] !=0.)\n    {\n        \n        if (a_float_z > 0.0)\n        {\n            v_vec4_rotated_scaled_vertex.w = 1.;\n        } else {\n            v_vec4_rotated_scaled_vertex.w = 0.;\n        }\n        v_mat4_gradient = u_mat4_gradient;\n        for (int i = 1; i <= 2; i++) {\n            v_mat4_gradient[i] = apply_opacity(v_mat4_gradient[i], u_float_opacity);\n        }\n    }\n    \n    compute_shadow_vertex(clip_pos);\n}\n",diffuse_identify:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <round_position>\n#include <apply_height_factor>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform float u_float_height_factor;\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec4 a_vec4_identifier;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_visibility;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    \n    \n    \n    if (a_float_visibility == 0.0 || a_vec4_identifier == vec4(1., 1., 1., 1.)) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    \n    if (a_float_z == 0.) {\n        float posHeight = dem_height(a_vec2_vertex);\n        if (height > posHeight) {\n            height = posHeight;\n        }\n    }\n    height += u_float_floor_elevation;\n    v_vec4_identifier = a_vec4_identifier;\n    vec4 vertex_hf = apply_height_factor(vec3(a_vec2_vertex, a_float_z), u_float_height_factor);\n    vertex_hf.z += height;\n    \n    vertex_hf.z = max(vertex_hf.z, height);\n    gl_Position = round_position(\n        u_mat4_mvp * vertex_hf,\n        .5 * u_vec2_vpt_size);\n}\n",globe:"#include <prelude>\n#include <ecef_mvp_mat>\nattribute vec3 a_vec3_ecef_position;\nattribute vec3 a_vec3_flat_position;\nattribute vec2 a_vec2_texture;\nuniform vec4 u_vec4_extent;\nvarying vec2 v_vec2_texture;\nvoid main()\n{\n    v_vec2_texture = a_vec2_texture;\n    vec4 pos = get_clipspace(a_vec3_flat_position, a_vec3_ecef_position);\n    gl_Position = pos;\n}",globe_halo:"#include <prelude>\n#ifndef UBO\nuniform mediump vec2 u_vec2_halo_viewport_size;\nuniform mediump vec2 u_vec2_halo_viewport_center_shift;\nuniform mediump vec4 u_vec4_halo_radius_stops;\nuniform mediump float u_float_halo_exp_factor;\n#endif\nattribute vec2 a_vec2_vertex;\nvarying vec2 v_vec2_uv;\nvoid main() {\n    \n    \n    \n    \n    \n    \n    \n    float globe_halo_padding_factor = log(0.005) / u_float_halo_exp_factor;\n    \n    vec4 pixel_radius_stops = u_vec4_halo_radius_stops * u_vec2_halo_viewport_size.y;\n    \n    \n    \n    \n    float maxR = pixel_radius_stops[1] + (pixel_radius_stops[3] - pixel_radius_stops[1]) * globe_halo_padding_factor;\n    \n    float scale = maxR / u_vec2_halo_viewport_size.y;\n    v_vec2_uv = a_vec2_vertex * scale;\n    vec2 center = u_vec2_halo_viewport_size / 2.0 + u_vec2_halo_viewport_center_shift;\n    vec2 p = center - a_vec2_vertex * maxR;\n    vec2 p_result = 2.0 * (p - 0.5 * u_vec2_halo_viewport_size) / u_vec2_halo_viewport_size;\n    gl_Position = vec4(p_result, 0.0, 1.0);\n}\n",gltf_model:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <clipspace_pos>\n#include <jitter>\n#include <shadow>\n#define EPSILON (0.0001)\n#define DEM_POS_INSTANCE 0\n#define DEM_POS_FLAT 1\n#define DEM_POS_AXIS 2\n#define DEM_POS_CENTROID 3\nuniform mat4 u_mat4_instance;\nuniform vec2 u_vec2_anchor;\nuniform vec4 u_vec4_axis;\nuniform int u_int_gltf_dem_pos;\nuniform mat4 u_mat4_localmatrix;\nuniform float u_float_height_factor;\nuniform float u_float_show_ratio;\nuniform mediump int u_int_identify;\nuniform float u_float_floor_elevation;\nuniform int u_int_abs_z;\nuniform int u_int_extention_to_relief_needed;\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_tangent;\nattribute vec2 a_vec2_instance_position;\nattribute float a_float_instance_height;\n#ifndef MALI_GPU\nattribute vec3 a_vec3_instance_ecef_position;\nattribute float a_float_abs_z;\n#endif\nattribute mat3 a_mat3_instance_matrix;\nattribute vec4 a_vec4_instance_localid;\n#ifdef COLOR_TEXTURE\nattribute vec2 texcoord_color;\n#endif\n#ifdef AO_TEXTURE\nattribute vec2 texcoord_ao;\n#endif\n#ifdef PBR_TEXTURE\nattribute vec2 texcoord_pbr;\n#endif\nvarying vec4 v_vec4_identifier;\nvarying vec3 v_vec3_normal;\nvarying vec3 v_vec3_fragment_pos_world;\n#ifdef MAP_MESH_TEXTURE\nvarying vec4 v_tex_coord;\n#endif\n#ifdef COLOR_TEXTURE\nvarying vec2 v_vec2_texcoord_color;\n#endif\n#ifdef AO_TEXTURE\nvarying vec2 v_vec2_texcoord_ao;\n#endif\n#ifdef PBR_TEXTURE\nvarying vec2 v_vec2_texcoord_pbr;\n#endif\nvarying float v_float_opacity;\nvoid calc_texcoords(mat4 instance_matrix, float height) {\n    #ifdef MAP_MESH_TEXTURE\n    \n    vec4 vertexTier = instance_matrix * vec4(a_position, 1.);\n    vertexTier *= u_mat4_instance;\n    vertexTier.z *= u_float_height_factor;\n    vertexTier.xyz *= v_float_opacity;\n    vec4 vflatTier = vec4(a_vec2_instance_position,a_float_instance_height, 1.);\n    vflatTier.z += height;\n    vflatTier.xyz += vertexTier.xyz;\n    v_tex_coord = u_mat4_flat_mvp * vec4(vflatTier.xy, 0, 1.0);\n    #endif\n    #if defined(COLOR_TEXTURE)\n    v_vec2_texcoord_color = texcoord_color;\n    #endif\n    #ifdef AO_TEXTURE\n    v_vec2_texcoord_ao = texcoord_ao;\n    #endif\n    #ifdef PBR_TEXTURE\n    v_vec2_texcoord_pbr = texcoord_pbr;\n    #endif\n}\nfloat interleaved_gradient_noise(vec3 coords)\n{\n    const vec3 m = vec3(0.06711056, 0.00583715, 52.9829189);\n    return fract(m.z * fract(dot(coords.xy, m.xy)));\n}\nconst float FADE_AMMOUNT = 0.12;\nvoid main()\n{\n    if (u_int_identify != 0 && a_vec4_instance_localid == vec4(1., 1., 1., 1.)) {\n        gl_Position = vec4(0, 0, 0, 0);\n        return;\n    }\n    mat4 instance_matrix = mat4(\n        vec4(a_mat3_instance_matrix[0], 0),\n        vec4(a_mat3_instance_matrix[1], 0),\n        vec4(a_mat3_instance_matrix[2], 0),\n        vec4(0, 0, 0, 1)\n    );\n    float height = 0.;\n    \n    if (u_int_gltf_dem_pos == DEM_POS_CENTROID) {\n        vec4 center = (instance_matrix * u_mat4_localmatrix) * vec4(u_vec2_anchor.x, 0, u_vec2_anchor.y, 1);\n        center *= u_mat4_instance;\n        center.xy += a_vec2_instance_position;\n        height = dem_height(center.xy);\n    } else if (u_int_gltf_dem_pos == DEM_POS_AXIS)  {\n        vec2 a = a_position.xz - u_vec4_axis.xy;\n        vec2 b = u_vec4_axis.zw - u_vec4_axis.xy;\n        float b_length = length(b);\n        a /= b_length;\n        b /= b_length;\n        float coef = clamp(dot(a, b), 0., 1.);\n        vec4 axis_start = (instance_matrix * u_mat4_localmatrix) * vec4(u_vec4_axis.x, 0, u_vec4_axis.y, 1);\n        axis_start *= u_mat4_instance;\n        axis_start.xy += a_vec2_instance_position;\n        float height_start = dem_height(axis_start.xy);\n        vec4 axis_end = (instance_matrix * u_mat4_localmatrix) * vec4(u_vec4_axis.z, 0, u_vec4_axis.w, 1);\n        axis_end *= u_mat4_instance;\n        axis_end.xy += a_vec2_instance_position;\n        float height_end = dem_height(axis_end.xy);\n        height = mix(height_start, height_end, coef);\n    } else if (u_int_gltf_dem_pos == DEM_POS_FLAT) {\n        vec4 pos = (instance_matrix * u_mat4_localmatrix) * vec4(a_position, 1);\n        pos *= u_mat4_instance;\n        pos.xy += a_vec2_instance_position;\n        height = dem_height(pos.xy);\n    } else {\n#ifdef MALI_GPU \n        \n        \n        height = dem_height(a_vec2_instance_position); \n#else\n        if (u_int_abs_z == 0) {\n            height = dem_height(a_vec2_instance_position);\n        } else {\n            height = abs_height(a_float_abs_z);\n        }\n#endif\n    }\n    height += u_float_floor_elevation;\n    vec3 instance_position = vec3(a_vec2_instance_position, a_float_instance_height);\n    if (u_float_show_ratio < 1.0) {\n        vec3 instance_wp = a_mat3_instance_matrix * instance_position;\n        float noise = interleaved_gradient_noise(instance_wp);\n        if (noise > u_float_show_ratio) {\n            gl_Position = vec4(0,0,0,0);\n            return;\n        }\n        v_float_opacity = clamp(u_float_show_ratio - noise, 0., FADE_AMMOUNT) / FADE_AMMOUNT;\n    } else {\n        v_float_opacity = 1.;\n    }\n    v_vec4_identifier = a_vec4_instance_localid;\n    vec4 vertex = (instance_matrix * u_mat4_localmatrix) * vec4(a_position, 1.);\n    vertex *= u_mat4_instance;\n    vertex.xyz *= v_float_opacity;\n    vertex.z *= u_float_height_factor;\n#ifndef MALI_GPU\n    \n    if (u_int_abs_z == 1 && u_int_extention_to_relief_needed == 1 && vertex.z < EPSILON) {\n        float relief_height = dem_height(a_vec2_instance_position);\n        vertex.z -= abs_height(a_float_abs_z) - relief_height;\n    }\n#endif\n    vec4 vflat = vec4(instance_position, 1.);\n    vflat.z += height;\n    vflat.xyz += vertex.xyz;\n    vec3 pos_world = calc_pos_world(vflat);\n    calc_fog_pos(pos_world);\n#ifdef MALI_GPU\n    \n    \n    \n    gl_Position = get_clipspace(vflat.xyz);\n#else\n    vec4 vecef = vec4(a_vec3_instance_ecef_position, 1.);\n    vecef.xyz += vertex.xyz;\n    gl_Position = get_clipspace(vflat.xyz, vecef.xyz, a_float_abs_z);\n#endif\n    calc_texcoords(instance_matrix, height);\n    \n    v_vec3_normal = ((instance_matrix * u_mat4_localmatrix) * vec4(a_normal, 0)).xyz;\n    v_vec3_fragment_pos_world = pos_world;\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    save_clipspace_pos();\n    compute_shadow_vertex(gl_Position, v_vec3_normal, u_mat4_flat_mvp);\n}\n",gltf_shadow:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#define EPSILON (0.0001)\nuniform mat4 u_mat4_instance;\nuniform mat4 u_mat4_localmatrix;\nuniform float u_float_height_factor;\nuniform float u_float_show_ratio;\nuniform int u_int_abs_z;\nuniform int u_int_extention_to_relief_needed;\nattribute vec3 a_position;\nattribute vec2 a_vec2_instance_position;\nattribute float a_float_instance_height;\n#ifndef MALI_GPU\nattribute vec3 a_vec3_instance_ecef_position;\nattribute float a_float_abs_z;\n#endif\nattribute mat3 a_mat3_instance_matrix;\nvarying float v_depth_metric;\nconst float FADE_AMMOUNT = 0.12;\nfloat interleaved_gradient_noise(vec3 coords)\n{\n    const vec3 m = vec3(0.06711056, 0.00583715, 52.9829189);\n    return fract(m.z * fract(dot(coords.xy, m.xy)));\n}\nvoid main()\n{\n    float height = 0.;\n#ifdef MALI_GPU\n    height = dem_height(a_vec2_instance_position);\n#else\n    if (u_int_abs_z == 0) {\n        height = dem_height(a_vec2_instance_position);\n    } else {\n        height = abs_height(a_float_abs_z);\n    }\n#endif\n    vec3 instance_position = vec3(a_vec2_instance_position, a_float_instance_height);\n    float opacity = 1.0;\n    if (u_float_show_ratio < 1.0) {\n        vec3 instance_wp = a_mat3_instance_matrix * instance_position;\n        float noise = interleaved_gradient_noise(instance_wp);\n        if (noise > u_float_show_ratio) {\n            gl_Position = vec4(0,0,0,0);\n            return;\n        }\n        opacity = clamp(u_float_show_ratio - noise, 0., FADE_AMMOUNT) / FADE_AMMOUNT;\n    }\n    mat4 instance_matrix = mat4(\n        vec4(a_mat3_instance_matrix[0], 0),\n        vec4(a_mat3_instance_matrix[1], 0),\n        vec4(a_mat3_instance_matrix[2], 0),\n        vec4(0, 0, 0, 1)\n    );\n    vec4 vertex = (instance_matrix * u_mat4_localmatrix) * vec4(a_position, 1);\n    vertex *= u_mat4_instance;\n    vertex.xyz *= opacity;\n    vertex.z *= u_float_height_factor;\n#ifndef MALI_GPU\n    \n    if (u_int_abs_z == 1 && u_int_extention_to_relief_needed == 1 && vertex.z < EPSILON) {\n        float relief_height = dem_height(a_vec2_instance_position);\n        vertex.z -= abs_height(a_float_abs_z) - relief_height;\n    }\n#endif\n    vec4 vflat = vec4(instance_position, 1.);\n    vflat.z += height;\n    vflat.xyz += vertex.xyz;\n#ifdef MALI_GPU\n    \n    \n    \n    gl_Position = get_clipspace(vflat.xyz);\n#else\n    vec4 vecef = vec4(a_vec3_instance_ecef_position, 1.);\n    vecef.xyz += vertex.xyz;\n    gl_Position = get_clipspace(vflat.xyz, vecef.xyz, a_float_abs_z);\n#endif\n    v_depth_metric = (gl_Position.z + 1.0) / 2.0;\n}\n",heatmap:"#include <prelude>\n#include <mvp_mat>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec2 a_vec2_position;\nattribute vec2 a_vec2_widen;\nattribute float a_float_weight;\nvarying vec2 v_vec2_extrude;\nvarying float v_float_weight;\nuniform float u_float_radius;\nuniform float u_float_intensity;\nuniform float u_float_tile_to_pixel_ratio;\nconst highp float ZERO = 1.0 / 255.0 / 16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n    float S = sqrt(-2.0 * log(ZERO / a_float_weight / u_float_intensity / GAUSS_COEF)) / 3.0;\n    v_vec2_extrude = S * a_vec2_widen;\n    v_float_weight = a_float_weight;\n    vec2 pos = a_vec2_position + a_vec2_widen * u_float_radius * u_float_tile_to_pixel_ratio;\n    calc_fog_pos(calc_pos_world(pos));\n    gl_Position = u_mat4_mvp * vec4(pos, 0.0, 1.0);\n}\n",heatmap_texture:"#include <prelude>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec2 a_vec2_position;\nvarying vec2 v_vec2_position;\nvoid main() {\n    gl_Position = vec4(a_vec2_position, 0.0, 1.0);\n    v_vec2_position = clamp(a_vec2_position, vec2(0,0), vec2(1,1));\n}\n",label_directional:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec4 a_vec4_position;\nattribute vec2 a_vec2_offset;\nattribute vec2 a_vec2_texcoord;\nattribute vec2 a_vec2_style_zoom_limits;\nuniform float u_float_style_zoom;\nuniform float u_float_scale;\nuniform float u_float_tile_to_pixel_ratio;\nvarying vec2 v_vec2_texcoord;\nfloat clipw(const float w, const vec2 range, const float zoom) {\n    return w * (step(range.x, zoom) - step(range.y, zoom));\n}\nvoid main() {\n    vec4 newPosition = a_vec4_position;\n    newPosition.xy += a_vec2_offset * u_float_scale * u_float_tile_to_pixel_ratio;\n    vec3 pos_world = calc_pos_world(newPosition);\n    calc_fog_pos(pos_world);\n    newPosition = u_mat4_mvp * newPosition;\n    gl_Position = vec4(newPosition.xyz, clipw(newPosition.w, a_vec2_style_zoom_limits, u_float_style_zoom));\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n}\n",label_fixed_anchor:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <depth_test>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec3 a_vec3_flat_position;\nattribute vec3 a_vec3_ecef_position;\nattribute vec2 a_vec2_offset;\nattribute vec2 a_vec2_texcoord;\nattribute vec2 a_vec2_check_offset;\nattribute vec4 a_vec4_tex_identifier;\nattribute vec4 a_vec4_sprite_identifier;\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform vec2 u_vec2_offset;\nuniform float u_float_scale;\nuniform float u_float_height_factor;\nuniform bool u_bool_skip_height_factor;\nuniform float u_float_floor_elevation;\nvarying vec2 v_vec2_texcoord;\nvarying vec2 v_vec2_labeling_texcoord;\nvarying float v_float_behind_factor;\nvarying vec4 v_vec4_text_identifier;\nvoid main() {\n    float height = dem_height(a_vec3_flat_position.xy);\n    height += u_float_floor_elevation;\n    vec4 pos;\n    \n    \n    \n    if (u_bool_skip_height_factor == true) {\n        pos = vec4(a_vec3_flat_position, 1.0);\n    } else {\n        pos = apply_height_factor(a_vec3_flat_position, u_float_height_factor);\n    }\n    pos.z += height;\n    vec3 pos_world = calc_pos_world(a_vec3_flat_position);\n    calc_fog_pos(pos_world);\n    pos = get_clipspace(pos.xyz, a_vec3_ecef_position);\n    pos.xyz = pos.xyz / pos.w;\n    pos.w = 1.0;\n    v_float_behind_factor = depth_test(pos.xy + a_vec2_check_offset / u_vec2_vpt_size, pos.z, a_vec4_tex_identifier);\n    pos.xy += (a_vec2_offset * u_float_scale + u_vec2_offset) / u_vec2_vpt_size * 2.0;\n    gl_Position = pos;\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n    v_vec4_text_identifier = a_vec4_sprite_identifier;\n    v_vec2_labeling_texcoord = (pos.xy + 1.) / 2.;\n}\n",label_fixed_anchor_identify:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <dem>\nattribute vec3 a_vec3_flat_position;\nattribute vec3 a_vec3_ecef_position;\nattribute vec2 a_vec2_offset;\nattribute vec4 a_vec4_identifier;\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform vec2 u_vec2_offset;\nuniform float u_float_scale;\nuniform float u_float_floor_elevation;\nvarying vec4 v_vec4_identifier;\nvoid main() {\n    float height = dem_height(a_vec3_flat_position.xy);\n    height += u_float_floor_elevation;\n    v_vec4_identifier = a_vec4_identifier;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier)\n    {\n        vec4 pos = get_clipspace(a_vec3_flat_position, a_vec3_ecef_position);\n        pos.xyz = pos.xyz / pos.w;\n        pos.w = 1.0;\n        pos.xy += (a_vec2_offset * u_float_scale + u_vec2_offset) / u_vec2_vpt_size * 2.0;\n        gl_Position = pos;\n    }\n    else\n    {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n}\n",line:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <apply_opacity>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform vec4 u_vec4_color;\nuniform float u_float_height_factor;\nuniform float u_float_opacity;\nuniform mediump mat4 u_mat4_gradient;\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_normal;\nattribute vec2 a_vec2_normal_delta;\nattribute vec3 a_vec3_direction;\nattribute float a_float_distance;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_visibility;\nvarying vec4 v_vec4_color;\nvarying mat4 v_mat4_gradient;\nvarying vec3 v_vec3_normal;\nvarying vec2 v_vec2_height_gradient;\nconst float g_shift_pixels = 1.;\nconst float g_min_denominator = 1e-4;\nconst float g_w_factor = 1e-6;\nvec2 multiply_complex(vec2 lhs, vec2 rhs)\n{\n    return vec2(lhs.x * rhs.x - lhs.y * rhs.y, lhs.x * rhs.y + lhs.y * rhs.x);\n}\nvoid main()\n{\n    \n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    \n    if (a_float_z == 0.) {\n        float posHeight = dem_height(a_vec2_vertex);\n        if (height > posHeight) {\n            height = posHeight;\n        }\n    }\n    height += u_float_floor_elevation;\n    vec2 half_viewport = u_vec2_vpt_size / vec2(2.);\n    \n    if (a_float_z > 0.0)\n    {\n        v_vec2_height_gradient[0] = 1.;\n    } else {\n        v_vec2_height_gradient[0] = 0.;\n    }\n    vec4 clip_space_direction = u_mat4_mvp * vec4(normalize_s08(vec3(a_vec3_direction.xy, a_vec3_direction.z + height)), 0.);\n    vec4 vertex_hf = apply_height_factor(vec3(a_vec2_vertex, a_float_z), u_float_height_factor);\n    vertex_hf.z += height;\n    \n    vertex_hf.z = max(vertex_hf.z, height);\n    vec4 clip_space_vertex = u_mat4_mvp * vertex_hf;\n    vec2 screen_space_direction = (clip_space_direction.xy * clip_space_vertex.w - clip_space_vertex.xy * clip_space_direction.w) * half_viewport;\n    vec2 screen_space_perp = vec2(-screen_space_direction.y, screen_space_direction.x);\n    float denominator = max(g_min_denominator, length(screen_space_perp));\n    vec2 bevel_normal = normalize_s08(a_vec2_normal);\n    vec2 normal_delta = normalize_s08(a_vec2_normal_delta);\n    vec4 clip_space_bevel_normal = u_mat4_mvp * vec4(bevel_normal, 0., 0.);\n    vec2 screen_space_bevel_normal = (clip_space_bevel_normal.xy * clip_space_vertex.w - clip_space_vertex.xy * clip_space_bevel_normal.w) * half_viewport;\n    float bevel_denominator = max(g_min_denominator, length(screen_space_bevel_normal));\n    \n    float normal_factor = -dot(screen_space_bevel_normal, screen_space_perp) / denominator / bevel_denominator;\n    vec2 wall_normal = multiply_complex(bevel_normal, vec2(normal_delta.x, sign(normal_factor) * normal_delta.y));\n    gl_Position = g_w_factor * (clip_space_vertex + vec4(screen_space_perp / half_viewport, 0., 0.) * g_shift_pixels * a_float_distance / denominator * clip_space_vertex.w);\n    vec3 pos_world = calc_pos_world(vertex_hf);\n    v_vec4_color = u_vec4_color;\n    v_vec3_normal = vec3(wall_normal, 0.0);\n    if (u_mat4_gradient[0][0] !=0.)\n    {\n        v_mat4_gradient = u_mat4_gradient;\n        for (int i = 1; i <= 2; i++) {\n            v_mat4_gradient[i] = apply_opacity(v_mat4_gradient[i], u_float_opacity);\n        }\n    }\n    v_vec2_height_gradient.y = a_float_distance * gl_Position.w;\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    \n    compute_shadow_vertex(clip_space_vertex);\n}\n",line3d:"#include <prelude>\n#include <mvp_mat>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\n#include <dem>\nattribute vec2 a_vec2_vertex;\nattribute vec4 a_vec4_normals;\nattribute float a_float_height;\nattribute float a_float_abs_z;\nuniform float u_float_width;\nuniform float u_float_tile_to_pixel_ratio;\nuniform int u_int_abs_z;\nvarying vec2 v_vec2_normal;\nvarying float v_float_half_width;\nconst float g_w_factor = 1e-6;\nconst float normal_unpack_multiplier = 0.011135539861205473;\nvoid main()\n{\n    float height = 0.;\n    if (u_int_abs_z == 0) {\n        height = dem_height(a_vec2_vertex);\n    } else {\n        height = abs_height(a_float_abs_z);\n    }\n    \n    float half_width = 0.5 * (u_float_width + 1.0);\n    \n    vec4 normals = a_vec4_normals * normal_unpack_multiplier * half_width;\n    vec2 extender = normals.xy;\n    vec2 normal = normals.zw;\n    \n    vec4 shifted_vertex = vec4(\n        a_vec2_vertex + extender * u_float_tile_to_pixel_ratio,\n        height + a_float_height / (65535. * 32.),\n        1.0\n    );\n    vec4 clip_pos = u_mat4_mvp * shifted_vertex;\n    gl_Position = g_w_factor * clip_pos;\n    v_vec2_normal = normal;\n    v_float_half_width = half_width;\n    vec3 pos_world = calc_pos_world(shifted_vertex);\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    compute_shadow_vertex(clip_pos, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n}\n",line3d_identify:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\nattribute vec2 a_vec2_vertex;\nattribute vec4 a_vec4_normals;\nattribute float a_float_height;\nattribute float a_float_abs_z;\nattribute vec4 a_vec4_identifier;\nuniform float u_float_width;\nuniform float u_float_tile_to_pixel_ratio;\nuniform int u_int_abs_z;\nvarying vec2 v_vec2_normal;\nvarying vec4 v_vec4_identifier;\nvarying float v_float_half_width;\nconst float g_w_factor = 1e-6;\nconst float normal_unpack_multiplier = 0.011135539861205473;\nvoid main()\n{\n    float height = 0.;\n    if (u_int_abs_z == 0) {\n        height = dem_height(a_vec2_vertex);\n    } else {\n        height = abs_height(a_float_abs_z);\n    }\n    \n    float half_width = 0.5 * (u_float_width + 1.0);\n    \n    vec4 normals = a_vec4_normals * normal_unpack_multiplier * half_width;\n    vec2 extender = normals.xy;\n    vec2 normal = normals.zw;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier) {\n        \n        vec4 shifted_vertex = vec4(\n            a_vec2_vertex + extender * u_float_tile_to_pixel_ratio,\n            height + a_float_height / (65535. * 32.),\n            1.0\n        );\n        gl_Position = g_w_factor * u_mat4_mvp * shifted_vertex;\n    } else {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n    v_vec2_normal = normal;\n    v_vec4_identifier = a_vec4_identifier;\n    v_float_half_width = half_width;\n}\n",map_mesh:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\n#include <clipspace_pos>\n#include <jitter>\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_extender;\nattribute vec3 a_vec3_normal;\nattribute float a_float_gradient;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_abs_z;\nattribute float a_float_is_pivot;\nuniform float u_float_tile_size;\nuniform float u_float_height_factor;\nuniform int u_int_abs_z;\nvarying vec4 v_tex_coord;\nvarying vec4 v_vec4_normal_gradient;\nvoid main()\n{\n#ifndef VARYINGS_LIMIT_9\n    v_float_dem_invalid = 0.;\n#endif\n    float height = 0.;\n    if (u_int_abs_z == 0) {\n        height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    } else {\n        if (a_float_is_pivot == 1.) {\n            height = dem_height(a_vec2_vertex);\n        } else {\n            height = abs_height(a_float_abs_z);\n        }\n    }\n    \n    vec3 vec3_vertex = vec3(a_vec2_vertex, a_float_z / (65535. * 32.));\n    v_tex_coord = u_mat4_mvp * vec4(vec3_vertex.xy, 0, 1.0);\n    v_vec4_normal_gradient.xyz = normalize_s08(a_vec3_normal);\n    v_vec4_normal_gradient.w = a_float_gradient;\n    vec4 pos = vec4(vec3_vertex.xy, vec3_vertex.z * u_float_height_factor + height, 1.0);\n    vec3 world_pos = calc_pos_world(pos);\n    calc_fog_pos(world_pos);\n    gl_Position = u_mat4_mvp * pos;\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    save_clipspace_pos();\n    compute_shadow_vertex(gl_Position, v_vec4_normal_gradient.xyz, u_mat4_mvp);\n}\n",mesh:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <apply_opacity>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\n#include <clipspace_pos>\n#include <jitter>\nuniform mediump vec4 u_vec4_color;\nuniform mediump mat4 u_mat4_gradient;\nuniform float u_float_height_factor;\nuniform int u_int_abs_z;\nuniform lowp int u_int_is_textured;\nuniform mediump float u_float_opacity;\nuniform vec4 u_float_texture_params;\nuniform float u_float_texture_vertical_scale;\nuniform mediump int u_int_identify;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec3 a_vec3_normal;\nattribute float a_float_gradient;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_abs_z;\nattribute vec4 a_vec4_identifier;\nattribute float a_float_visibility;\nattribute float a_float_is_pivot;\nvarying vec4 v_vec4_color;\nvarying mat4 v_mat4_gradient;\nvarying vec2 v_vec2_tex_coord;\nvarying vec4 v_vec4_normal_gradient;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    if (u_int_identify != 0 && a_vec4_identifier == vec4(1., 1., 1., 1.)) {\n        gl_Position = vec4(0, 0, 0, 0);\n        return;\n    }\n    float height = 0.;\n    if (u_int_abs_z == 0) {\n        height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    } else {\n        if (a_float_is_pivot == 1.) {\n            height = dem_height(a_vec2_vertex);\n        } else {\n            height = abs_height(a_float_abs_z);\n        }\n    }\n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    v_vec4_identifier = a_vec4_identifier;\n    \n    vec4 vec4_pos = apply_height_factor(vec3(a_vec2_vertex.xy, a_float_z / (65535. * 32.)), u_float_height_factor);\n    vec4_pos.z += height;\n    vec3 pos_world = calc_pos_world(vec4_pos);\n    calc_fog_pos(pos_world);\n    gl_Position = u_mat4_mvp * vec4_pos;\n    vec3 vec3_normal = normalize(a_vec3_normal);\n    v_vec4_normal_gradient.xyz = vec3_normal;\n    v_vec4_normal_gradient.w = a_float_gradient / 127.; \n    if (u_int_is_textured != 0) {\n        \n        vec2 vec2_vertex = a_vec2_vertex * 2. - 0.5;\n        \n        \n        vec3 tex_coord = abs(vec3(\n            vec2_vertex * u_float_texture_params.zw + u_float_texture_params.xy,\n            a_float_z / u_float_texture_vertical_scale\n        ));\n        \n        if (vec3_normal.x == 0. && vec3_normal.y == 0.) {\n            v_vec2_tex_coord = tex_coord.xy;\n        } else {\n            float scale = abs(vec3_normal.z);\n            tex_coord.z /= sqrt(1.0 - vec3_normal.z * vec3_normal.z);;\n            if (abs(vec3_normal).y > abs(vec3_normal).x) {\n                v_vec2_tex_coord = tex_coord.xz;\n            } else {\n                v_vec2_tex_coord = tex_coord.yz;\n            }\n        }\n        v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n    }\n    \n    else if (u_mat4_gradient[0][0] != 0.)\n    {\n        v_mat4_gradient = u_mat4_gradient;\n        for (int i = 1; i <= 2; i++) {\n            v_mat4_gradient[i] = apply_opacity(v_mat4_gradient[i], u_float_opacity);\n        }\n    } else {\n        v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n    }\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    save_clipspace_pos();\n    compute_shadow_vertex(gl_Position, vec3_normal, u_mat4_mvp);\n}\n",mesh_shadow:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <apply_height_factor>\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_abs_z;\nattribute float a_float_visibility;\nattribute float a_float_is_pivot;\nuniform float u_float_height_factor;\nuniform int u_int_abs_z;\nvarying float v_depth_metric;\nvoid main()\n{\n    float height = 0.;\n    if (u_int_abs_z == 0) {\n        height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    } else {\n        if (a_float_is_pivot == 1.) {\n            height = dem_height(a_vec2_vertex);\n        } else {\n            height = abs_height(a_float_abs_z);\n        }\n    }\n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    \n    vec4 vec4_pos = apply_height_factor(vec3(a_vec2_vertex.xy, a_float_z / (65535. * 32.)), u_float_height_factor);\n    vec4_pos.z += height;\n    gl_Position = u_mat4_mvp * vec4_pos;\n    v_depth_metric = 0.5 * gl_Position.z + 0.5;\n}",metric_point:"#include <prelude>\n#include <mvp_mat>\n#include <apply_opacity>\n#include <packed_attributes>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_texcoord;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, u_float_floor_elevation, 1.0);\n    vec3 pos_world = calc_pos_world(a_vec2_vertex);\n    calc_fog_pos(pos_world);\n    compute_shadow_vertex(gl_Position, vec3(0,0,1), u_mat4_mvp);\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n}\n",one_way_line:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pixel_offset>\n#include <signed_distance_functions>\n#include <arrow_functions>\n#include <apply_opacity>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#ifndef UBO\nuniform float u_float_border_width_offset;\nuniform vec2 u_vec2_scale_limits;\nuniform mediump vec2 u_vec2_vpt_size;\n#endif\nuniform vec4 u_vec4_color;\nuniform vec4 u_vec4_border_color;\nuniform vec3 u_vec3_projection_scale_style_scale_dpi;\nuniform float u_float_border_width;\nuniform float u_float_size_factor;\nuniform mediump float u_float_width;\nuniform mediump float u_float_length;\nuniform float u_float_wing_width_multiplier;\nuniform float u_float_wing_height_multiplier;\nuniform float u_float_tip_height_multiplier;\nuniform float u_float_opacity;\nattribute vec2 a_vec2_position;\nattribute vec2 a_vec2_direction;\nattribute vec2 a_vec2_widen_direction;\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_border_color;\nvarying vec2 v_vec2_texcoord;\nvarying float v_float_border_width;\nvarying float v_float_zpt_to_texcoord_factor;\nvarying float v_float_outer_width;\nvarying float v_float_opacity;\nconst float g_shift_pixels = 2.;\nconst float g_w_factor = 1e-7;\nvoid main()\n{\n    float style_scale_clamped = clamp(u_vec3_projection_scale_style_scale_dpi.y, u_vec2_scale_limits.x, u_vec2_scale_limits.y);\n    float scale_ratio = u_vec3_projection_scale_style_scale_dpi.x / u_vec3_projection_scale_style_scale_dpi.y;\n    float calculation_scale = style_scale_clamped * scale_ratio;\n    ArrowParameters arrow_parameters = calculate_arrow_parameters(\n        calculation_scale,\n        u_float_width,\n        u_float_border_width,\n        u_float_length,\n        u_float_wing_width_multiplier,\n        u_float_wing_height_multiplier,\n        u_float_tip_height_multiplier,\n        u_float_size_factor);\n    v_float_zpt_to_texcoord_factor = arrow_parameters.zpt_to_texcoord_factor;\n    v_float_outer_width = arrow_parameters.outer_width;\n    vec2 direction = normalize_s08(a_vec2_direction);\n    vec2 untransformed_widen = a_vec2_widen_direction * arrow_parameters.widen_size;\n    vec2 widen = multiply_complex(untransformed_widen * arrow_parameters.final_size, direction);\n    \n    float shift_pixels = g_shift_pixels * sqrt(2.) / min(abs(untransformed_widen.x), abs(untransformed_widen.y));\n    VertexShiftParameters shift_parameters = calculate_vertex_shift_parameters(\n        u_mat4_mvp,\n        u_vec2_vpt_size,\n        a_vec2_position,\n        widen,\n        shift_pixels);\n    \n    \n    gl_Position = shift_parameters.clip_space_vertex / arrow_parameters.final_size * g_w_factor;\n    v_vec2_texcoord = untransformed_widen * (1. + shift_parameters.limited_factor);\n    \n    float border_width = u_float_border_width * v_float_zpt_to_texcoord_factor;\n    float border_width_offset = u_float_border_width_offset * v_float_zpt_to_texcoord_factor;\n    v_float_border_width = max(0., border_width - u_vec3_projection_scale_style_scale_dpi.y / style_scale_clamped * border_width_offset);\n    v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n    v_vec4_border_color = apply_opacity(u_vec4_border_color, u_float_opacity);\n    v_float_opacity = u_float_opacity;\n    vec3 pos_world = calc_pos_world(a_vec2_position);\n    calc_fog_pos(pos_world);\n}\n",patterned_line:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pixel_offset>\n#include <calculate_scale>\n#include <line_width>\n#include <apply_opacity>\n#include <precision_constants>\n#include <striped_line_functions>\n#include <pos_world>\n#include <cam_pos>\n#include <shadow>\n#include <fog>\n#include <jitter>\n#include <dem>\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_widen;\nattribute float a_float_texture;\nattribute float a_float_height;\nuniform vec2 u_vec2_scales;\nuniform float u_float_width;\nuniform vec4 u_vec4_color;\nuniform float u_float_opacity;\nuniform vec4 u_vec4_pattern_params;\nuniform bool u_bool_is_3d_line;\nvarying vec2 v_vec2_uv;\nvarying float v_float_period;\nvarying float v_float_width;\nvarying vec4 v_vec4_color;\nvarying vec4 v_vec4_pattern_parameters;\nconst float g_w_factor = 1e-6;\nvoid main() {\n    float height = 0.;\n    if (u_bool_is_3d_line == true) {\n        height = dem_height(a_vec2_vertex);\n    }\n    if (u_bool_is_3d_line == true) {\n        height += a_float_height / (65535. * 32.);\n    }\n    \n    v_float_width = u_float_width;\n    v_vec4_color = apply_opacity(u_vec4_color, u_float_opacity);\n    v_vec2_uv = vec2(abs(a_float_texture), sign(a_float_texture) / 2.);\n    v_vec2_uv.x *= u_vec2_scales.x / u_vec4_pattern_params.x;\n    v_vec4_pattern_parameters = u_vec4_pattern_params;\n    \n    float full_width = u_float_width + 1.;\n    \n    vec2 widen = unpack_widen(a_vec2_widen);\n    vec2 extender = widen * full_width * 0.5;\n    \n    \n    vec2 shift = vec2(0.);\n    vec4 shifted_vertex = vec4(a_vec2_vertex + (shift + extender) * u_vec2_scales.y, height, 1.0);\n    vec3 pos_world = calc_pos_world(shifted_vertex); \n    calc_fog_pos(pos_world);\n    gl_Position = u_mat4_mvp * shifted_vertex;\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    compute_shadow_vertex(gl_Position, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n    gl_Position *= g_w_factor;\n}\n",point_anchor:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\nattribute vec4 a_vec4_position;\nattribute vec2 a_vec2_offset;\nattribute vec4 a_vec4_identifier;\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform vec2 u_vec2_offset;\nuniform float u_float_floor_elevation;\nvarying vec4 v_vec4_identifier;\nvoid main() {\n    float height = dem_height(a_vec4_position.xy);\n    height += u_float_floor_elevation;\n    vec4 ndcPosition = u_mat4_mvp * vec4(a_vec4_position.xy, a_vec4_position.z + height, a_vec4_position.w);\n    ndcPosition.xyz = ndcPosition.xyz / ndcPosition.w;\n    ndcPosition.w = 1.0;\n    ndcPosition.xy += (a_vec2_offset + u_vec2_offset) / u_vec2_vpt_size * 2.0;\n    gl_Position = ndcPosition;\n    v_vec4_identifier = a_vec4_identifier;\n}\n",pointsprite:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <raster_functions>\n#include <depth_test>\n#ifndef UBO\nuniform float u_float_rounding_factor;\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform vec3 u_vec3_projection_scale_style_scale_dpi;\nuniform float u_float_height_factor;\nuniform vec2 u_vec2_rotation; \nuniform bool u_bool_skip_height_factor;\nuniform float u_float_floor_elevation;\nattribute vec3 a_vec3_flat_position;\nattribute vec3 a_vec3_ecef_position;\nattribute vec2 a_vec2_offset;\nattribute vec2 a_vec2_check_offset;\nattribute vec2 a_vec2_texcoord;\nattribute vec2 a_vec2_range;\nattribute vec2 a_vec2_rescale;\nattribute vec4 a_vec4_tex_identifier;\nvarying vec2 v_vec2_texcoord;\nvarying float v_float_behind_factor;\nvoid main()\n{\n    float height = dem_height(a_vec3_flat_position.xy);\n    height += u_float_floor_elevation;\n    mat2 rotation_matrix = mat2(\n        u_vec2_rotation.x, -u_vec2_rotation.y,\n        u_vec2_rotation.y, u_vec2_rotation.x\n    );\n    vec2 inv_half_size = 2.0 / u_vec2_vpt_size;\n    vec4 anchor;\n    \n    \n    \n    if (u_bool_skip_height_factor == true) {\n        anchor = vec4(a_vec3_flat_position, 1.0);\n    } else {\n        anchor = apply_height_factor(a_vec3_flat_position, u_float_height_factor);\n    }\n    anchor.z += height;\n    vec3 pos_world = calc_pos_world(anchor);\n    calc_fog_pos(pos_world);\n    anchor = get_clipspace(anchor.xyz, a_vec3_ecef_position);\n    vec2 offset = rescale(rotation_matrix * a_vec2_offset, a_vec2_rescale, a_vec2_range, u_vec3_projection_scale_style_scale_dpi.y);\n    vec2 pos_2d = anchor.xy + overlay_transform(offset, inv_half_size) * anchor.w;\n    vec2 corner = make_position(pos_2d, anchor.w, inv_half_size, u_float_rounding_factor);\n    v_float_behind_factor = depth_test(anchor.xy / anchor.w + a_vec2_check_offset / u_vec2_vpt_size, anchor.z / anchor.w, a_vec4_tex_identifier);\n    gl_Position = vec4(corner, anchor.z, clipw(anchor.w, a_vec2_range, u_vec3_projection_scale_style_scale_dpi.y));\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n}\n",pointsprite_identify:"#include <prelude>\n#include <ecef_mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <raster_functions>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform vec3 u_vec3_projection_scale_style_scale_dpi;\nuniform float u_float_height_factor;\nuniform vec2 u_vec2_rotation; \nuniform bool u_bool_skip_height_factor;\nuniform float u_float_floor_elevation;\nattribute vec3 a_vec3_flat_position;\nattribute vec3 a_vec3_ecef_position;\nattribute vec2 a_vec2_offset;\nattribute vec2 a_vec2_texcoord;\nattribute vec2 a_vec2_range;\nattribute vec2 a_vec2_rescale;\nattribute vec4 a_vec4_identifier;\nvarying vec2 v_vec2_texcoord;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier)\n    {\n        float height = dem_height(a_vec3_flat_position.xy);\n        height += u_float_floor_elevation;\n        mat2 rotation_matrix = mat2(\n            u_vec2_rotation.x, -u_vec2_rotation.y,\n            u_vec2_rotation.y, u_vec2_rotation.x\n        );\n        vec2 inv_half_size = 2.0 / u_vec2_vpt_size;\n        vec4 anchor;\n        \n        \n        \n        if (u_bool_skip_height_factor == true) {\n            anchor = vec4(a_vec3_flat_position, 1.0);\n        } else {\n            anchor = apply_height_factor(a_vec3_flat_position, u_float_height_factor);\n        }\n        anchor.z += height;\n        anchor = get_clipspace(anchor.xyz, a_vec3_ecef_position);\n        vec2 offset = rescale(rotation_matrix * a_vec2_offset, a_vec2_rescale, a_vec2_range, u_vec3_projection_scale_style_scale_dpi.y);\n        vec2 pos_2d = anchor.xy + overlay_transform(offset, inv_half_size) * anchor.w;\n        vec2 corner = make_position(pos_2d, anchor.w, inv_half_size, 1.0);\n        gl_Position = vec4(corner, anchor.z, clipw(anchor.w, a_vec2_range, u_vec3_projection_scale_style_scale_dpi.y));\n    }\n    else\n    {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n    v_vec4_identifier = a_vec4_identifier;\n}\n",posteffect:"#include <prelude>\nattribute vec2 a_vec2_vertex;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    gl_Position = vec4(a_vec2_vertex, 0.0, 1.0);\n    v_vec2_texcoord = 0.5 * a_vec2_vertex + 0.5;\n}\n",rect:"#include <prelude>\n#include <mvp_mat>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec2 a_vec2_vertex;\nvoid main()\n{\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, 0.0, 1.0);\n}\n",rect_with_texture:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <apply_opacity>\n#include <raster_functions>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_texcoord;\nvarying vec2 v_vec2_texcoord;\nvoid main()\n{\n    gl_Position = u_mat4_mvp * vec4(a_vec2_vertex, 0.0, 1.0);\n    calc_fog_pos(calc_pos_world(a_vec2_vertex));\n    v_vec2_texcoord = unpack_texcoord(a_vec2_texcoord);\n}\n",road:"#include <prelude>\n#include <mvp_mat>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\nattribute vec2 a_vec2_vertex;\nattribute vec4 a_vec4_normals;\nattribute vec2 a_vec2_shift;\nuniform float u_float_width;\nuniform float u_float_tile_to_pixel_ratio;\nuniform float u_float_shift;\nvarying vec2 v_vec2_normal;\nvarying float v_float_half_width;\nconst float g_w_factor = 1e-6;\nconst float normal_unpack_multiplier = 0.011135539861205473;\nvoid main()\n{\n    \n    float half_width = 0.5 * (u_float_width + 1.0);\n    \n    vec4 normals = a_vec4_normals * normal_unpack_multiplier * half_width;\n    vec2 extender = normals.xy;\n    vec2 normal = normals.zw;\n    vec2 shift = a_vec2_shift * u_float_shift;\n    \n    vec4 shifted_vertex = vec4(a_vec2_vertex + (shift + extender) * u_float_tile_to_pixel_ratio, 0.0, 1.0);\n    vec4 clip_pos = u_mat4_mvp * shifted_vertex;\n    gl_Position = g_w_factor * clip_pos;\n    v_vec2_normal = normal;\n    v_float_half_width = half_width;\n    vec3 pos_world = calc_pos_world(shifted_vertex);\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    compute_shadow_vertex(clip_pos, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n}\n",road_identify:"#include <prelude>\n#include <mvp_mat>\nattribute vec2 a_vec2_vertex;\nattribute vec4 a_vec4_normals;\nattribute vec4 a_vec4_identifier;\nuniform float u_float_width;\nuniform float u_float_tile_to_pixel_ratio;\nvarying vec2 v_vec2_normal;\nvarying vec4 v_vec4_identifier;\nvarying float v_float_half_width;\nconst float g_w_factor = 1e-6;\nconst float normal_unpack_multiplier = 0.011135539861205473;\nvoid main()\n{\n    \n    float half_width = 0.5 * (u_float_width + 1.0);\n    \n    vec4 normals = a_vec4_normals * normal_unpack_multiplier * half_width;\n    vec2 extender = normals.xy;\n    vec2 normal = normals.zw;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier) {\n        \n        vec4 shifted_vertex = vec4(a_vec2_vertex + extender * u_float_tile_to_pixel_ratio, 0.0, 1.0);\n        gl_Position = g_w_factor * u_mat4_mvp * shifted_vertex;\n    } else {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n    v_vec2_normal = normal;\n    v_vec4_identifier = a_vec4_identifier;\n    v_float_half_width = half_width;\n}\n",simple_line_2d:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform float u_float_width;\nuniform float u_float_z_offset;\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute vec4 a_vec4_direction_distance;\nattribute float a_float_visibility;\nvarying float v_float_distance;\nvarying float v_float_distance_offset;\nconst float g_smooth_width = 1.;\nconst float g_min_denominator = 1e-4;\nconst float g_w_factor = 1e-6;\nvoid main()\n{\n    \n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    float shift_pixels = 0.5 * max(u_float_width - 1., 0.);\n    float shift_pixels_added = shift_pixels + g_smooth_width;\n    vec3 direction = a_vec4_direction_distance.xyz;\n    float distance = a_vec4_direction_distance.w;\n    vec2 half_viewport = u_vec2_vpt_size / vec2(2.);\n    \n    \n    vec4 clip_space_direction = normalize(u_mat4_mvp * vec4(normalize_s08(direction), 0.));\n    \n    vec4 vertex = vec4(a_vec2_vertex, u_float_floor_elevation, 1.0);\n    vec4 clip_space_vertex = u_mat4_mvp * vertex;\n    vec2 screen_space_direction =\n        (clip_space_direction.xy * clip_space_vertex.w - clip_space_vertex.xy * clip_space_direction.w) * half_viewport;\n    vec2 screen_space_perp = vec2(-screen_space_direction.y, screen_space_direction.x);\n    float denominator = max(g_min_denominator, length(screen_space_perp));\n    gl_Position = g_w_factor * (clip_space_vertex + vec4(screen_space_perp / half_viewport, 0., 0.)\n        * distance * shift_pixels_added / denominator * clip_space_vertex.w);\n    gl_Position.z += u_float_z_offset;\n    v_float_distance = shift_pixels_added * distance * gl_Position.w;\n    v_float_distance_offset = shift_pixels;\n    vec3 pos_world = calc_pos_world(vertex.xyz);\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    \n    compute_shadow_vertex(clip_space_vertex);\n}\n",simple_line_3d:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nuniform float u_float_width;\nuniform float u_float_height_factor;\nuniform int u_int_abs_z;\nuniform float u_float_z_offset;\nuniform float u_float_floor_elevation;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec4 a_vec4_direction_distance;\nattribute vec2 a_vec2_dem_position;\nattribute float a_float_abs_z;\nattribute float a_float_is_pivot;\nattribute float a_float_visibility;\nvarying float v_float_distance;\nvarying float v_float_distance_offset;\nconst float g_smooth_width = 1.;\nconst float g_min_denominator = 1e-4;\nconst float g_w_factor = 1e-6;\nvoid main()\n{\n    float height = 0.;\n    if (u_int_abs_z == 0) {\n        height = dem_height(unpack_dem_position(a_vec2_dem_position));\n        \n        if (a_float_z == 0.) {\n            float posHeight = dem_height(a_vec2_vertex);\n            if (height > posHeight) {\n                height = posHeight;\n            }\n        }\n    } else {\n        if (a_float_is_pivot == 1.) {\n            height = dem_height(a_vec2_vertex);\n        } else {\n            height = abs_height(a_float_abs_z);\n        }\n    }\n    \n    if (a_float_visibility == 0.0) {\n        gl_Position = vec4(0, 0, 1, 1);\n        return;\n    }\n    height += u_float_floor_elevation;\n    float shift_pixels = 0.5 * max(u_float_width - 1., 0.);\n    float shift_pixels_added = shift_pixels + g_smooth_width;\n    vec3 direction = a_vec4_direction_distance.xyz;\n    float distance = a_vec4_direction_distance.w;\n    vec2 half_viewport = u_vec2_vpt_size / vec2(2.);\n    \n    \n    vec4 clip_space_direction = normalize(u_mat4_mvp * vec4(normalize_s08(direction), 0.));\n    \n    vec4 vertex_hf = apply_height_factor(vec3(a_vec2_vertex, a_float_z), u_float_height_factor);\n    vertex_hf.z += height;\n    vec4 clip_space_vertex = u_mat4_mvp * vertex_hf;\n    vec2 screen_space_direction =\n        (clip_space_direction.xy * clip_space_vertex.w - clip_space_vertex.xy * clip_space_direction.w) * half_viewport;\n    vec2 screen_space_perp = vec2(-screen_space_direction.y, screen_space_direction.x);\n    float denominator = max(g_min_denominator, length(screen_space_perp));\n    gl_Position = g_w_factor * (clip_space_vertex + vec4(screen_space_perp / half_viewport, 0., 0.)\n        * distance * shift_pixels_added / denominator * clip_space_vertex.w);\n    gl_Position.z += u_float_z_offset;\n    v_float_distance = shift_pixels_added * distance * gl_Position.w;\n    v_float_distance_offset = shift_pixels;\n    vec3 pos_world = calc_pos_world(vertex_hf.xyz);\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    \n    compute_shadow_vertex(clip_space_vertex);\n}\n",simple_mesh:"#include <prelude>\n#include <mvp_mat>\nuniform float u_float_scale;\nuniform vec3 u_vec3_transform;\nattribute vec3 a_vec3_position;\nvarying vec3 v_position;\nvoid main() {\n    vec3 scaled_transformed = u_vec3_transform + a_vec3_position * u_float_scale;\n    v_position = scaled_transformed;\n    gl_Position = u_mat4_mvp * vec4(scaled_transformed, 1.0);\n}\n",sky:"#include <prelude>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\nattribute vec2 a_vec2_vertex;\nvoid main()\n{\n    gl_Position = vec4(a_vec2_vertex, 1.0, 1.0);\n    calc_fog_pos_sky(gl_Position);\n}\n",stars:"#include <prelude>\nattribute vec3 a_vec3_position;\nattribute float a_fade_opacity;\n#ifndef UBO\nuniform mat4 u_mat4_stars;\nuniform float u_float_stars_intensity;\nuniform float u_float_pixelratio;\n#endif\nvarying mediump float v_intensity;\nvoid main() {\n    v_intensity = a_fade_opacity * u_float_stars_intensity;\n    gl_PointSize = u_float_pixelratio;\n    gl_Position = u_mat4_stars * vec4(a_vec3_position, 1.0);\n}\n",striped_line:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pixel_offset>\n#include <calculate_scale>\n#include <line_width>\n#include <apply_opacity>\n#include <precision_constants>\n#include <striped_line_functions>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <jitter>\n#include <shadow>\n#include <dem>\n#ifndef UBO\nuniform mediump vec2 u_vec2_vpt_size;\n#endif\nuniform vec4 u_vec4_dash_color;\nuniform vec4 u_vec4_space_color;\nuniform vec4 u_vec4_border_color;\nuniform vec3 u_vec3_projection_scale_style_scale_dpi;\nuniform float u_float_width;\nuniform float u_float_width_offset;\nuniform vec2 u_vec2_scaler_params;\nuniform float u_float_dash_length;\nuniform float u_float_space_length;\nuniform float u_float_dash2_length;\nuniform float u_float_opacity;\nuniform bool u_bool_is_3d_line;\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_texture_widen;\nattribute vec2 a_vec2_widen;\nattribute float a_float_vertex_distance;\nattribute float a_float_component_distance;\nattribute float a_float_object_length;\nattribute float a_float_height;\nvarying vec4 v_vec4_dash_color;\nvarying vec4 v_vec4_space_color;\nvarying vec4 v_vec4_border_color;\nvarying vec2 v_vec2_circle;\nvarying float v_float_width;\nvarying vec2 v_vec2_line_params;\nconst float g_shift_pixels = 2.;\nconst float g_w_factor = 1e-7;\nPolylineDistance decode_line_distance()\n{\n    return PolylineDistance(\n        a_float_vertex_distance,\n        a_float_component_distance,\n        a_float_object_length);\n}\nStripedLineInParams decode_line_params(const Scale scale)\n{\n    float width = calculate_final_width(scale, u_float_width, u_float_width_offset);\n    float dash_length  = scale.calculation * u_float_dash_length;\n    float space_length = scale.calculation * u_float_space_length;\n    float dash2_length = scale.calculation * u_float_dash2_length;\n    return StripedLineInParams(\n        dash_length,\n        space_length,\n        dash2_length,\n        width);\n}\nvoid main()\n{\n    float height = 0.;\n    if (u_bool_is_3d_line == true) {\n        height = dem_height(a_vec2_vertex);\n    }\n    if (u_bool_is_3d_line == true) {\n        height += a_float_height / (65535. * 32.);\n    }\n    Scale scale = calculate_scale(u_vec3_projection_scale_style_scale_dpi, u_vec2_scaler_params);\n    StripedLineInParams params = decode_line_params(scale);\n    vec2 widen = unpack_widen(a_vec2_widen);\n    vec2 widen_perp = vec2(-widen.y, widen.x);\n    \n    vec4 clip_space_widen = u_mat4_mvp * vec4(widen, 0., 0.);\n    vec4 clip_space_widen_perp = u_mat4_mvp * vec4(widen_perp, 0., 0.);\n    \n    vec4 clip_space_vertex = u_mat4_mvp * vec4(a_vec2_vertex, height, 1.0) + clip_space_widen * params.line_width;\n    vec2 half_viewport = 0.5 * u_vec2_vpt_size;\n    \n    float limited_factor = calculate_multiplication_factor(\n        half_viewport,\n        clip_space_widen,\n        clip_space_widen_perp,\n        clip_space_vertex,\n        g_shift_pixels);\n    PolylineDistance distance_decoded = decode_line_distance();\n    StripedLineOutParams output_params;\n    calculate_line_params(distance_decoded, params, output_params);\n    \n    \n    vec2 texture_widen_with_shift_sign = unpack_widen(a_vec2_texture_widen);\n    float shift_sign = sign(dot(widen, texture_widen_with_shift_sign));\n    vec2 texture_widen = shift_sign * texture_widen_with_shift_sign;\n    vec2 texture_widen_perp = vec2(-texture_widen.y, texture_widen.x);\n    float distance_shift = shift_sign * abs(dot(widen, texture_widen_perp)) * params.line_width;\n    float circle_factor = g_circle_scale_precision_factor / scale.calculation;\n    v_vec2_circle = texture_widen * (params.line_width + limited_factor) * circle_factor;\n    v_float_width = params.line_width * circle_factor;\n    v_vec2_line_params[0] = output_params.part_color_swap_threshold;\n    v_vec2_line_params[1] = output_params.distance_in_parts;\n    v_vec4_dash_color = apply_opacity(u_vec4_dash_color, u_float_opacity);\n    v_vec4_space_color = apply_opacity(u_vec4_space_color, u_float_opacity);\n    v_vec4_border_color = apply_opacity(u_vec4_border_color, u_float_opacity);\n    gl_Position = clip_space_vertex + clip_space_widen * limited_factor;\n    vec3 pos_world = calc_pos_world(a_vec2_vertex);\n    calc_fog_pos(pos_world);\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    gl_Position *= g_w_factor;\n    compute_shadow_vertex(clip_space_vertex, vec3(0.0, 0.0, 1.0), u_mat4_mvp);\n}\n",striped_line_identify:"#include <prelude>\n#include <mvp_mat>\n#include <packed_attributes>\n#include <pixel_offset>\n#include <calculate_scale>\n#include <line_width>\n#include <apply_opacity>\n#include <precision_constants>\n#include <striped_line_functions>\n#include <dem>\n#ifndef UBO\nuniform mediump vec2 u_vec2_vpt_size;\n#endif\nuniform vec4 u_vec4_dash_color;\nuniform vec4 u_vec4_space_color;\nuniform vec4 u_vec4_border_color;\nuniform vec3 u_vec3_projection_scale_style_scale_dpi;\nuniform float u_float_width;\nuniform float u_float_width_offset;\nuniform vec2 u_vec2_scaler_params;\nuniform float u_float_dash_length;\nuniform float u_float_space_length;\nuniform float u_float_dash2_length;\nuniform float u_float_opacity;\nuniform bool u_bool_is_3d_line;\nattribute vec2 a_vec2_vertex;\nattribute vec2 a_vec2_texture_widen;\nattribute vec2 a_vec2_widen;\nattribute float a_float_vertex_distance;\nattribute float a_float_component_distance;\nattribute float a_float_object_length;\nattribute vec4 a_vec4_identifier;\nattribute float a_float_height;\nvarying vec4 v_vec4_identifier;\nconst float g_shift_pixels = 2.;\nconst float g_w_factor = 1e-7;\nPolylineDistance decode_line_distance()\n{\n    return PolylineDistance(\n        a_float_vertex_distance,\n        a_float_component_distance,\n        a_float_object_length);\n}\nStripedLineInParams decode_line_params(const Scale scale)\n{\n    float width = calculate_final_width(scale, u_float_width, u_float_width_offset);\n    float dash_length  = scale.calculation * u_float_dash_length;\n    float space_length = scale.calculation * u_float_space_length;\n    float dash2_length = scale.calculation * u_float_dash2_length;\n    return StripedLineInParams(\n        dash_length,\n        space_length,\n        dash2_length,\n        width);\n}\nvoid main()\n{\n    float height = 0.;\n    if (u_bool_is_3d_line == true) {\n        height = dem_height(a_vec2_vertex);\n    }\n    if (u_bool_is_3d_line == true) {\n        height += a_float_height / (65535. * 32.);\n    }\n    Scale scale = calculate_scale(u_vec3_projection_scale_style_scale_dpi, u_vec2_scaler_params);\n    StripedLineInParams params = decode_line_params(scale);\n    vec2 widen = unpack_widen(a_vec2_widen);\n    vec2 widen_perp = vec2(-widen.y, widen.x);\n    \n    vec4 clip_space_widen = u_mat4_mvp * vec4(widen, 0., 0.);\n    vec4 clip_space_widen_perp = u_mat4_mvp * vec4(widen_perp, 0., 0.);\n    \n    vec4 clip_space_vertex = u_mat4_mvp * vec4(a_vec2_vertex, height, 1.0) + clip_space_widen * params.line_width;\n    vec2 half_viewport = 0.5 * u_vec2_vpt_size;\n    \n    float limited_factor = calculate_multiplication_factor(\n        half_viewport,\n        clip_space_widen,\n        clip_space_widen_perp,\n        clip_space_vertex,\n        g_shift_pixels);\n    PolylineDistance distance_decoded = decode_line_distance();\n    StripedLineOutParams output_params;\n    calculate_line_params(distance_decoded, params, output_params);\n    v_vec4_identifier = a_vec4_identifier;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier)\n    {\n        gl_Position = (clip_space_vertex + clip_space_widen * limited_factor) * g_w_factor;\n    }\n    else\n    {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n}\n",zbm_model:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <packed_attributes>\n#include <apply_height_factor>\n#include <pos_world>\n#include <cam_pos>\n#include <fog>\n#include <clipspace_pos>\n#include <jitter>\n#include <shadow>\nuniform float u_float_height_factor;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_texcoord;\nattribute vec2 a_vec2_dem_position;\nvarying vec2 v_vec2_texcoord;\nvarying vec3 v_vec3_rotated_scaled_vertex;\nvoid main()\n{\n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    v_vec2_texcoord = unpack_model_texcoord(a_vec2_texcoord);\n    vec3 vertex = vec3(a_vec2_vertex, a_float_z);\n    vec4 vh = apply_height_factor(vertex, u_float_height_factor);\n    vh.z += height;\n    vec3 pos_world = calc_pos_world(vh);\n    calc_fog_pos(pos_world);\n    gl_Position = u_mat4_mvp * vh;\n    \n    \n    mat3 rotation_scale_mat = mat3(u_mat4_model);\n    v_vec3_rotated_scaled_vertex = rotation_scale_mat * vertex;\n    save_clipspace_pos();\n#ifdef TAA\n    apply_vertex_jitter(gl_Position);\n#endif\n    \n    compute_shadow_vertex(gl_Position);\n}\n",zbm_model_identify:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <round_position>\n#ifndef UBO\nuniform vec2 u_vec2_vpt_size;\n#endif\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec4 a_vec4_identifier;\nattribute vec2 a_vec2_dem_position;\nvarying vec4 v_vec4_identifier;\nvoid main()\n{\n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    v_vec4_identifier = a_vec4_identifier;\n    if (vec4(1., 1., 1., 1.) != a_vec4_identifier)\n    {\n        gl_Position = round_position(u_mat4_mvp * vec4(a_vec2_vertex, a_float_z + height, 1.), .5 * u_vec2_vpt_size);\n    }\n    else\n    {\n        gl_Position = vec4(1., 1., 1., 1.);\n    }\n}\n",zbm_shadow:"#include <prelude>\n#include <mvp_mat>\n#include <dem>\n#include <apply_height_factor>\nuniform float u_float_height_factor;\nattribute vec2 a_vec2_vertex;\nattribute float a_float_z;\nattribute vec2 a_vec2_dem_position;\nvarying float v_depth_metric;\nvoid main()\n{\n    float height = dem_height(unpack_dem_position(a_vec2_dem_position));\n    vec4 vh = apply_height_factor(vec3(a_vec2_vertex, a_float_z), u_float_height_factor);\n    vh.z += height;\n    gl_Position = u_mat4_mvp * vh;\n    v_depth_metric = (gl_Position.z + 1.0) / 2.0;\n}\n"},Ec=/^\s*#include\s+<(.+)>.*$/gim,Pc=(e,t)=>(i,n)=>{const o=n.trim(),r="vertex"===e?Ic[o]:Sc[o];if(!r)throw new Error(`Cannot resolve "include <${o}>" in ${e} shader "${t}"`);return r+"\n"};function Ac(e,t){return[("vertex"===e?Tc[t]:Mc[t]).replace(Ec,Pc(e,t))]}function Lc(e){const t=2===ru.webglVersion?["#version 300 es"]:[],i=wt.e.createShaderDefinitions([{type:`WEBGL${ru.webglVersion}`,value:""},{type:"VERTEX",value:""}]);return n=>new wt.e("vertex",t.concat(Ac("vertex",e)),i,n)}function Cc(e){const t=2===ru.webglVersion?["#version 300 es"]:[],i=wt.e.createShaderDefinitions([{type:`WEBGL${ru.webglVersion}`,value:""},{type:"FRAGMENT",value:""}]);return n=>new wt.e("fragment",t.concat(Ac("fragment",e)),i,n)}const zc={name:"u_mat4_mvp",type:"mat4"},kc=[{name:"u_mat4_flat_mvp",type:"mat4"},{name:"u_mat4_ecef_mvp",type:"mat4"},{name:"u_float_crossfade",type:"1f"}],Oc={name:"u_mat4_model",type:"mat4"},Rc=[{name:"u_vec2_anchor",type:"2f"},{name:"u_vec4_axis",type:"4f"},{name:"u_int_gltf_dem_pos",type:"1i"}],Fc=[{name:"u_tex_dem",type:"1i"},{name:"u_tex_corrected_dem",type:"1i"},{name:"u_float_corrected_interval",type:"1f"},{name:"u_mat4_dem_corrected",type:"mat4"},{name:"u_tex_hillshade_ramp",type:"1i"},{name:"u_mat4_dem_mvp",type:"mat4"},{name:"u_float_dem_scale",type:"1f"},{name:"u_float_vertical_scale",type:"1f"},{name:"u_float_dem_resolution",type:"1f"},{name:"u_float_dem_cell_size",type:"1f"},{name:"u_float_dem_shading_intensity",type:"1f"},{name:"u_float_map_center_elevation",type:"1f"}],Bc=[{name:"u_int_abs_z",type:"1i"}],Dc=[{name:"u_cam_pos",type:"3f"}],jc=[{name:"u_int_light_flags",type:"1i"},{name:"u_vec4_ambient_color",type:"4fv"},{name:"u_vec3_light_dir1_direction",type:"3fv"},{name:"u_vec4_light_dir1_color",type:"4fv"},{name:"u_vec3_light_dir2_direction",type:"3fv"},{name:"u_vec4_light_dir2_color",type:"4fv"}],Nc=[{name:"u_texture_shadow",type:"1i"},{name:"u_mat4_clip_to_shadow",type:"mat4"},{name:"u_shadow_map_params",type:"4f"},{name:"u_shadow_bias",type:"1f"}],Uc=[{name:"u_fog_color",type:"4f"},{name:"u_sky_color",type:"4f"},{name:"u_fog_limits",type:"2f"},{name:"u_fog_horizon_blend",type:"1f"},{name:"u_fog_horizon_level",type:"1f"},{name:"u_mat4_model",type:"mat4"},{name:"u_fog_distance",type:"1f"},{name:"u_mat4_proj_inverted",type:"mat4"},{name:"u_mat4_view_transposed",type:"mat4"}],Hc=[{name:"u_vec2_camera_jitter",type:"2f"}];var Gc=i(9865);class Vc{constructor(e){this.params=e,this._uniformsMap={},this._buffer=null,this._data=null,this._gl=e.gl}bind(e){const t=this._gl,i=e.getUboBinding(this.params.blockName);void 0!==i&&(this._buffer||this.prepare(e),t.bindBufferBase(t.UNIFORM_BUFFER,i,this._buffer))}updateData(e,t){this._buffer||this.prepare(e);const i=this._data;for(const n in t){const o=t[n],r=this._uniformsMap[n]/4,s=e.uniforms[n];if((null==s?void 0:s.isNonFloatType())&&(0,Jo.cM)(`[UBO Warn]: Currenty only float uniform types are supported. Uniform "${n}" has unsupported type`),(0,Gc.f)(o)||(0,qa.nS)(o))for(let e=0;e<o.length;++e)i[r+e]=o[e];else i[r]=o}}commitData(){if(!this._data)return;const e=this._gl;e.bindBuffer(e.UNIFORM_BUFFER,this._buffer),e.bufferData(e.UNIFORM_BUFFER,this._data,e.DYNAMIC_DRAW),e.bindBuffer(e.UNIFORM_BUFFER,null)}cleanup(){this._buffer&&this._gl.deleteBuffer(this._buffer)}prepare(e){const t=this._gl;this._buffer=t.createBuffer();const i=e.getUniformBlockSize(this.params.blockName);if(null===i)return void console.error("Failed to initialize UBO. Invalid UBO block is provided.");this._data=new Float32Array(new ArrayBuffer(i));const n=e.getUniformsIndicesOffsetsInBlock(this.params.uniformNames);n?this._uniformsMap=n:console.error("Failed to initialize UBO. Couldn't retrieve uniforms information.")}}const Zc=["CommonSettings","LightSettings"],Wc={CommonSettings:["u_float_rounding_factor","u_float_border_width_offset","u_vec2_scale_limits","u_vec2_depth_test_half_point_size","u_vec2_vpt_size","u_sky_color","u_fog_color","u_fog_distance","u_fog_limits","u_fog_horizon_blend","u_fog_horizon_level","u_cam_pos","u_shadow_map_params","u_shadow_bias","u_mat4_clip_to_shadow","u_mat4_view_transposed","u_mat4_proj_inverted","u_vec2_halo_viewport_size","u_vec2_halo_viewport_center_shift","u_vec4_halo_radius_stops","u_vec4_halo_color","u_float_halo_exp_factor","u_vec4_default_background_color","u_float_pixelratio","u_mat4_stars","u_float_stars_intensity"],LightSettings:["u_vec4_ambient_color","u_vec3_light_dir1_direction","u_vec4_light_dir1_color","u_vec3_light_dir2_direction","u_vec4_light_dir2_color"]};var Xc;!function(e){e[e.CACHED=0]="CACHED",e[e.RENDER_UNDER_CACHE=1]="RENDER_UNDER_CACHE",e[e.RENDER_OVER_CACHE=2]="RENDER_OVER_CACHE"}(Xc||(Xc={}));const Kc=1/0,$c=-1/0,qc="renderCacheManager",Yc=[0,0,0,0];class Jc{constructor(e,t){this.prevFrameAnimationLayerOverCacheIndex=void 0,this.prevFrameAnimationLayerUnderCacheIndex=void 0,this.cacheObjectsCount=0,this.animationLayersOverCacheMinIndex=Kc,this.animationLayersUnderCacheMaxIndex=$c,this.state=e,this.modules=t,this.cacheFramebufferId=void 0,this.isReadyCache=!1,this.isLowZoom=this.state.zoom<6,this.cacheDisabled=this.state.disableRenderingCache,this.animationLayersUniqueIds=new Set,this.debugMode=!1,this.debugSkipRenderToCanvas=!1,this.cachedLayersMap=new Map}isLayerAnimated(e,t){const i=this.getUniqueRenderIndex(e,t);return!!this.animationLayersUniqueIds.has(i)}isLayerInCache(e,t){if(!this.isReadyCache)return!1;const i=this.cachedLayersMap.get(e);return!!i&&i.has(t)}frameEnd(){}initInDebugMode(){this.debugMode=!0}setDebugSkipRenderToCanvas(e){this.debugSkipRenderToCanvas=e}frameStart(){this.cachedLayersMap=new Map,this.cacheObjectsCount=0,this.isLowZoom=this.state.zoom<6,this.isReadyCache=!1;let e=!1;this.cacheDisabled||(this.animationLayersUniqueIds.clear(),void 0===this.cacheFramebufferId&&(this.cacheFramebufferId=this.createCacheFramebuffer()),this.animationLayersOverCacheMinIndex=Kc,this.animationLayersUnderCacheMaxIndex=$c,this.state.rerenderEvents.forEach((t=>{if("layerAnimationTicker"===t.type){const e=this.getUniqueRenderIndex(t.styleId,t.layerId,t.underCache);this.animationLayersUniqueIds.add(e),t.underCache?this.animationLayersUnderCacheMaxIndex=Math.max(this.animationLayersUnderCacheMaxIndex,e):this.animationLayersOverCacheMinIndex=Math.min(this.animationLayersOverCacheMinIndex,e)}else e=!0})),this.isReadyCache=!0,this.animationLayersOverCacheMinIndex===this.prevFrameAnimationLayerOverCacheIndex&&this.animationLayersUnderCacheMaxIndex===this.prevFrameAnimationLayerUnderCacheIndex||(this.isReadyCache=!1),(this.state.needRerender||e)&&(this.prevFrameAnimationLayerOverCacheIndex=void 0,this.prevFrameAnimationLayerUnderCacheIndex=void 0,this.isReadyCache=!1))}tryToCacheObjects(e,t,i,n){if(this.cacheDisabled)return Xc.RENDER_UNDER_CACHE;if(void 0===this.cacheFramebufferId||this.animationLayersOverCacheMinIndex===Kc&&this.animationLayersUnderCacheMaxIndex===$c||this.isLowZoom)return Xc.RENDER_UNDER_CACHE;if(this.animationLayersUnderCacheMaxIndex>=this.animationLayersOverCacheMinIndex)return Xc.RENDER_UNDER_CACHE;if(n&&this.modules.renderer.hasAnimatedFlatObjectInDemMode&&t.layerSettings.forceRenderUnderCacheInDemMode)return Xc.RENDER_UNDER_CACHE;const o=this.getUniqueRenderIndex(t.attributes.styleId,t.attributes.layerId);return o>=this.animationLayersOverCacheMinIndex?Xc.RENDER_OVER_CACHE:o<=this.animationLayersUnderCacheMaxIndex?Xc.RENDER_UNDER_CACHE:(e[this.cacheFramebufferId]||(e[this.cacheFramebufferId]={framebuffer:this.modules.renderer.getFramebuffer(this.cacheFramebufferId),objects:[],tileObjects:new Set}),this.isReadyCache||(e[this.cacheFramebufferId].objects.push(t),e[this.cacheFramebufferId].tileObjects.add(i)),this.cacheObjectsCount++,this.markLayerInCache(t.attributes.styleId,t.attributes.layerId),n&&this.modules.renderer.hasAnimatedFlatObjectInDemMode&&t.layerSettings.forcePrerenderUnderCacheInDemMode?Xc.RENDER_UNDER_CACHE:Xc.CACHED)}hasReadyCache(){return this.isReadyCache&&!this.cacheDisabled}hasCachedObjects(){return!!this.cacheObjectsCount}render(){var e;if(this.cacheDisabled)return!1;if(void 0===this.cacheFramebufferId||0===this.cacheObjectsCount||this.isLowZoom)return;this.prevFrameAnimationLayerOverCacheIndex=this.animationLayersOverCacheMinIndex,this.prevFrameAnimationLayerUnderCacheIndex=this.animationLayersUnderCacheMaxIndex;const t=null===(e=this.modules.renderer.getFramebuffer(this.cacheFramebufferId))||void 0===e?void 0:e.renderTarget;t&&!this.debugSkipRenderToCanvas&&(this.modules.renderer.storeGpuState(qc),this.debugMode?this.modules.renderer.applyGpuState(Ro,void 0,!1):this.modules.renderer.applyGpuState(Oo,void 0,!1),this.modules.postEffectsManager.copyRenderTargetToCanvas(t,!0,!1),this.modules.renderer.restoreGpuState(qc))}destroy(){this.cacheFramebufferId=void 0}markLayerInCache(e,t){let i=this.cachedLayersMap.get(e);i||(i=new Set,this.cachedLayersMap.set(e,i)),i.add(t)}getUniqueRenderIndex(e,t,i){const n=this.modules.styleManager.getStyleLayer(e,t);if(!n)return i?$c:Kc;return-e*this.modules.styleManager.getMaxLayersCount()+n.renderIndex}createCacheFramebuffer(){if(!this.modules.renderer.fragDepthSupported())return console.warn("Render cache disabled - Fragment Depth write not supported"),void(this.cacheDisabled=!0);const e=this.modules.renderer.getViewportSize(),t=this.modules.renderer.webglContextState.MAX_TEXTURE_SIZE;if(Math.max(...e)>t)return(0,Jo.cM)(`Render cache disabled as viewport size ${e[0]}x${e[1]} exceeds hardware limits of ${t}x${t}`),void(this.cacheDisabled=!0);const i=nt.NearestFilter,n=this.modules.renderer.getViewportSize(),o=new st({size:[n[0],n[1]],magFilter:i,minFilter:i,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,depthTexture:!0,format:nt.RgbaFormat});return this.modules.renderer.addFramebuffer({onResize:()=>{const e=this.modules.renderer.getViewportSize();o.setSize([e[0],e[1]])},renderTarget:o,onRenderStart:()=>{if(this.isReadyCache||void 0===this.cacheFramebufferId)return;const e=this.modules.renderer.getFramebuffer(this.cacheFramebufferId);e&&(this.modules.renderer.bindRenderTarget(e.renderTarget),this.modules.renderer.storeGpuState(qc),this.modules.renderer.applyGpuState(Fo,void 0,!1),this.modules.renderer.clearWithColor(Yc,!0),this.modules.renderer.bindRenderTarget(null),this.modules.renderer.restoreGpuState(qc))},onRenderEnd:()=>{},isCacheFramebuffer:!0,useDem:!0,renderIndex:Kc})}}const Qc=(0,z.HW)(),eu=(0,z.HW)(),tu=(0,z.HW)(),iu=[1,1,1,1],nu=new Float64Array(16),ou=(0,z.HW)();class ru extends class{constructor(e){if(this.webGlExtensions={},this._canvasElement=null,this._size=[1,1],this._storedStates={},"canvas"in(e=e||{})){this._canvasElement="string"==typeof e.canvas?document.getElementById(e.canvas):e.canvas;const t={antialias:void 0===e.antialias||e.antialias,stencil:void 0!==e.stencil&&e.stencil,failIfMajorPerformanceCaveat:void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,preserveDrawingBuffer:void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer};this._gl=2===e.version?this._canvasElement.getContext("webgl2",t):this._canvasElement.getContext("webgl",t)||this._canvasElement.getContext("experimental-webgl",t)}else this._gl=e.gl;this._pixelRatio=e.pixelRatio||1,this.clearColor=e.clearColor||[1,1,1,1],this.webGlExtensions={}}setPixelRatio(e){return this._pixelRatio=e,this}getPixelRatio(){return this._pixelRatio}setSize(e,t){return this._size=[e*this._pixelRatio,t*this._pixelRatio],this._canvasElement&&(this._canvasElement.width=this._size[0],this._canvasElement.height=this._size[1],this._canvasElement.style.width=`${e}px`,this._canvasElement.style.height=`${t}px`),this.setViewport(),this}setViewport(e=0,t=0,i,n){return void 0!==i&&void 0!==n?this._gl.viewport(e,t,i,n):this._gl.viewport(e,t,this._size[0],this._size[1]),this}getSize(){return this._size}addExtension(e){return this.webGlExtensions[e]=this._gl.getExtension(e),this}prepareTexture(e){return e.prepare(this._gl),this}bindVao(e){return e.bind({gl:this._gl,extensions:this.webGlExtensions}),this}enableTexture(e,t){return e.enable(this._gl,t),this}disableTexture(e){const t=this._gl;return t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,null),this}isDepthTextureSupported(){return ft(this._gl)}isShadowSamplerSupported(){return!(this._gl instanceof WebGLRenderingContext)&&this.isDepthTextureSupported()}isContextLost(){return this._gl.isContextLost()}storeGpuState(e){const t=this._gl;this._storedStates[e]={depthmask:t.getParameter(t.DEPTH_WRITEMASK),depthTest:t.getParameter(t.DEPTH_TEST),depthFunc:t.getParameter(t.DEPTH_FUNC),clearDepth:t.getParameter(t.DEPTH_CLEAR_VALUE)}}restoreGpuState(e){const t=this._storedStates[e];if(t){const e=this._gl;e.depthMask(t.depthmask),t.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),e.depthFunc(t.depthFunc),e.clearDepth(t.clearDepth)}}drawPoints(e,t){this._gl.drawArrays(this._gl.POINTS,e,t)}drawTriangles(e,t){this._gl.drawArrays(this._gl.TRIANGLES,e,t)}drawTrianglesFan(e,t){this._gl.drawArrays(this._gl.TRIANGLE_FAN,e,t)}drawArrays(e,t,i){this._gl.drawArrays(e,t,i)}drawElements(e,t,i,n){this._gl.drawElements(e,t,i,n)}drawInstancedElements(e,t,i,n,o){const r=this._gl,s=this.webGlExtensions.ANGLE_instanced_arrays;if(r instanceof WebGLRenderingContext){if(!s)return;s.drawElementsInstancedANGLE(e,t,i,n,o)}else r.drawElementsInstanced(e,t,i,n,o)}drawInstancedArrays(e,t,i,n){const o=this._gl,r=this.webGlExtensions.ANGLE_instanced_arrays;if(o instanceof WebGLRenderingContext){if(!r)return;r.drawArraysInstancedANGLE(e,t,i,n)}else o.drawArraysInstanced(e,t,i,n)}triangleCountByDrawMode(e,t){const i=this._gl;switch(e){case i.TRIANGLES:return t/3;case i.TRIANGLE_FAN:case i.TRIANGLE_STRIP:return t-2;default:return 0}}createBuffer(e,t,i,n){return new yt.l(this._gl,e,t,i,n)}applyState(e,t){var i,n,o,r,s,a,l,d,c,u,h,m,f,_,p,v,g,y;const b=this._gl;if(b.depthMask(null!==(i=null==t?void 0:t.depthMask)&&void 0!==i?i:e.depthMask),(null!==(n=null==t?void 0:t.depthTest)&&void 0!==n?n:e.depthTest)?(b.enable(b.DEPTH_TEST),this.setDepthFunc(null!==(o=null==t?void 0:t.depthFunc)&&void 0!==o?o:e.depthFunc)):b.disable(b.DEPTH_TEST),(null!==(r=null==t?void 0:t.cullFace)&&void 0!==r?r:e.cullFace)?(b.enable(b.CULL_FACE),this.setCullFaceMode(null!==(s=null==t?void 0:t.cullFaceMode)&&void 0!==s?s:e.cullFaceMode)):b.disable(b.CULL_FACE),null!==(a=null==t?void 0:t.blend)&&void 0!==a?a:e.blend){b.enable(b.BLEND),this.setBlendEquation(null!==(l=null==t?void 0:t.blendEquation)&&void 0!==l?l:e.blendEquation);const i=null!==(d=null==t?void 0:t.blendFuncSeparate)&&void 0!==d?d:e.blendFuncSeparate;i?this.setBlendFuncSeparate(i.srcRgb,i.dstRgb,i.srcAlpha,i.dstAlpha):this.setBlendFunc(null!==(u=null===(c=null==t?void 0:t.blendFunc)||void 0===c?void 0:c.sfactor)&&void 0!==u?u:e.blendFunc.sfactor,null!==(m=null===(h=null==t?void 0:t.blendFunc)||void 0===h?void 0:h.dfactor)&&void 0!==m?m:e.blendFunc.dfactor)}else b.disable(b.BLEND);const x=null!==(f=null==t?void 0:t.colorMask)&&void 0!==f?f:e.colorMask;b.colorMask(x[0],x[1],x[2],x[3]),(null!==(_=null==t?void 0:t.polygonOffsetFill)&&void 0!==_?_:e.polygonOffsetFill)?(b.enable(b.POLYGON_OFFSET_FILL),b.polygonOffset(null!==(v=null===(p=null==t?void 0:t.polygonOffset)||void 0===p?void 0:p.factor)&&void 0!==v?v:e.polygonOffset.factor,null!==(y=null===(g=null==t?void 0:t.polygonOffset)||void 0===g?void 0:g.units)&&void 0!==y?y:e.polygonOffset.units)):b.disable(b.POLYGON_OFFSET_FILL)}setDepthFunc(e){const t=xt.depthFuncToWebGL(this._gl,e);this._gl.depthFunc(t)}setCullFaceMode(e){const t=xt.cullFaceModeToWebGL(this._gl,e);this._gl.cullFace(t)}setBlendFunc(e,t){const i=xt.blendFuncToWebGL(this._gl,e),n=xt.blendFuncToWebGL(this._gl,t);this._gl.blendFunc(i,n)}setBlendFuncSeparate(e,t,i,n){const o=xt.blendFuncToWebGL(this._gl,e),r=xt.blendFuncToWebGL(this._gl,t),s=xt.blendFuncToWebGL(this._gl,i),a=xt.blendFuncToWebGL(this._gl,n);this._gl.blendFuncSeparate(o,r,s,a)}setBlendEquation(e){const t=xt.blendEquationToWebGL(this._gl,e);this._gl.blendEquation(t)}setBlendEquationSeparate(e,t){const i=xt.blendEquationToWebGL(this._gl,e),n=xt.blendEquationToWebGL(this._gl,t);this._gl.blendEquationSeparate(i,n)}setDepthMask(e){this._gl.depthMask(e)}}{constructor(e,t){const i=t.layout.canvas,n=e.webglVersion,o={antialias:!1,stencil:2!==n,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:e.preserveDrawingBuffer};let r=null;if(n&&2!==n||(r=i.getContext("webgl2",o),ru.webglVersion=2),null!==r&&1!==n||(r=i.getContext("webgl",o)||i.getContext("experimental-webgl",o),ru.webglVersion=1,e.disableRenderingCache=!0),null===r||!(r instanceof WebGLRenderingContext||r instanceof WebGL2RenderingContext))throw new Error("Failed to obtain WebGL context");super({gl:r,clearColor:(0,te.m2)(e.defaultBackgroundColor)}),this.commonShaderDefines=wt.f,this.hasAnimatedFlatObjectInDemMode=!1,this.destroyed=!1,this.framebuffers=[],this.globeRenderTargets=[],this.lastRenderedFramebuffers=[],this.mapMeshMvpMatrix=new Float64Array(16),this.drawTargetsFramebufferIds=new Map,this.ubosMap={},this.lastAppliedGpuState={state:null},this.applyGpuState=(e,t,i=!0)=>{const n=e(this.modules),o=this.lastAppliedGpuState,r=null==t?void 0:t.gpuState;o.state===n&&o.layerState===(null==t?void 0:t.gpuState)||(this.applyState(n,r),i&&(o.state=n,o.layerState=null==t?void 0:t.gpuState))},this.trackContextLost=e=>{this.destroyed||(e.preventDefault(),this.modules.map.emit("error",{type:"webglcontextlost"}),this.modules.map.destroy())},this.state=e,this.modules=t;const s=r.getExtension("WEBGL_debug_renderer_info");this.webglContextState={MAX_TEXTURE_SIZE:r.getParameter(r.MAX_TEXTURE_SIZE),MAX_VIEWPORT_DIMS:r.getParameter(r.MAX_VIEWPORT_DIMS),MAX_UNIFORM_BUFFER_BINDINGS:r instanceof WebGLRenderingContext?0:r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS),MAX_COMBINED_UNIFORM_BLOCKS:r instanceof WebGLRenderingContext?0:r.getParameter(r.MAX_COMBINED_UNIFORM_BLOCKS),RENDERER:s?r.getParameter(s.UNMASKED_RENDERER_WEBGL):r.getParameter(r.RENDERER),VENDOR:s?r.getParameter(s.UNMASKED_VENDOR_WEBGL):r.getParameter(r.VENDOR)},this.identifyBuffer=new st({minFilter:nt.NearestFilter,magFilter:nt.NearestFilter}),this.labelingTextureBuffer=new st({size:this.getViewportSize(),magFilter:nt.NearestFilter,minFilter:nt.NearestFilter,depthTexture:!0}),this.spriteLabelingTextureBuffer=new st({size:this.getViewportSize(),magFilter:nt.NearestFilter,minFilter:nt.NearestFilter,depthTexture:!1}),this.shaderProgramOptions={simpleMesh:{buildFragment:Cc("simple_mesh"),buildVertex:Lc("simple_mesh"),attributes:[{name:"a_vec3_position",location:0},{name:"a_vec3_normal",location:1}],uniforms:[zc,{name:"u_float_scale",type:"1f"},{name:"u_vec3_transform",type:"3fv"}]},diffuse:{buildVertex:Lc("diffuse"),buildFragment:Cc("color_with_z_fade"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_sdtr_distance",type:"1f"},{name:"u_float_floor_elevation",type:"1f"},{name:"u_int_is_roof",type:"1i"},...Dc,...jc,...Nc,...Fc,...Uc,...Hc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_dem_position",location:2},{name:"a_float_visibility",location:3}]},gradientDiffuse:{buildVertex:Lc("diffuse"),buildFragment:Cc("gradient_with_z_fade"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_mat4_gradient",type:"mat4"},{name:"u_sdtr_distance",type:"1f"},{name:"u_float_floor_elevation",type:"1f"},{name:"u_vec2_floor_level",type:"2fv"},{name:"u_int_is_roof",type:"1i"},...Dc,...jc,...Nc,...Fc,...Uc,...Hc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_dem_position",location:2},{name:"a_float_visibility",location:3}]},labelLine:{buildVertex:Lc("label_directional"),buildFragment:Cc("label_directional"),uniforms:[zc,Oc,{name:"u_float_tile_to_pixel_ratio",type:"1f"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_buffer",type:"1f"},{name:"u_float_gamma",type:"1f"},{name:"u_float_scale",type:"1f"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_style_zoom",type:"1f"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_opacity",type:"1f"},...Dc,...Uc],attributes:[{name:"a_vec4_position",location:0},{name:"a_vec2_offset",location:1},{name:"a_vec2_texcoord",location:2},{name:"a_vec2_style_zoom_limits",location:3}]},labelPoint:{buildVertex:Lc("label_fixed_anchor"),buildFragment:Cc("label"),uniforms:[...kc,Oc,{name:"u_vec2_vpt_size",type:"2f"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_buffer",type:"1f"},{name:"u_float_gamma",type:"1f"},{name:"u_float_scale",type:"1f"},{name:"u_vec4_color",type:"4fv"},{name:"u_vec4_hidden_color",type:"4fv"},{name:"u_float_label_index",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_vec2_offset",type:"2f"},{name:"u_float_height_factor",type:"1f"},{name:"u_depth_tex_labeling",type:"1i"},{name:"u_color_tex_labeling",type:"1i"},{name:"u_color_text_sprite_labeling",type:"1i"},{name:"u_vec2_depth_test_half_point_size",type:"2f"},{name:"u_bool_skip_height_factor",type:"1i"},{name:"u_bool_depth_test_disable",type:"1i"},{name:"u_float_floor_elevation",type:"1f"},...Dc,...Fc,...Uc],attributes:[{name:"a_vec3_flat_position",location:0},{name:"a_vec3_ecef_position",location:1},{name:"a_vec2_offset",location:2},{name:"a_vec2_texcoord",location:3},{name:"a_vec2_check_offset",location:4},{name:"a_vec4_tex_identifier",location:5},{name:"a_vec4_sprite_identifier",location:6}]},labelPointIdentify:{buildVertex:Lc("label_fixed_anchor_identify"),buildFragment:Cc("color_identify"),uniforms:[...kc,{name:"u_vec2_vpt_size",type:"2f"},{name:"u_float_scale",type:"1f"},{name:"u_vec2_offset",type:"2f"},{name:"u_float_floor_elevation",type:"1f"},...Fc],attributes:[{name:"a_vec3_flat_position",location:0},{name:"a_vec3_ecef_position",location:1},{name:"a_vec2_offset",location:2},{name:"a_vec4_identifier",location:3}]},line:{buildVertex:Lc("line"),buildFragment:Cc("line"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_mat4_gradient",type:"mat4"},{name:"u_float_floor_elevation",type:"1f"},...Dc,...jc,...Nc,...Fc,...Uc,...Hc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_normal",location:2},{name:"a_vec2_normal_delta",location:3},{name:"a_vec3_direction",location:4},{name:"a_float_distance",location:5},{name:"a_vec2_dem_position",location:6},{name:"a_float_visibility",location:7}]},pointSprite:{buildVertex:Lc("pointsprite"),buildFragment:Cc("pointsprite"),uniforms:[...kc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_rounding_factor",type:"1f"},{name:"u_float_height_factor",type:"1f"},{name:"u_vec2_opacity",type:"2f"},{name:"u_vec2_rotation",type:"2fv"},{name:"u_depth_tex_labeling",type:"1i"},{name:"u_color_tex_labeling",type:"1i"},{name:"u_color_text_sprite_labeling",type:"1i"},{name:"u_vec2_depth_test_half_point_size",type:"2f"},{name:"u_bool_skip_height_factor",type:"1i"},{name:"u_bool_depth_test_disable",type:"1i"},{name:"u_float_floor_elevation",type:"1f"},...Dc,...Fc,...Uc],attributes:[{name:"a_vec3_flat_position",location:0},{name:"a_vec3_ecef_position",location:1},{name:"a_vec2_offset",location:2},{name:"a_vec2_check_offset",location:3},{name:"a_vec2_texcoord",location:4},{name:"a_vec2_range",location:5},{name:"a_vec2_rescale",location:6},{name:"a_vec4_tex_identifier",location:7}]},pointSpriteIdentify:{buildVertex:Lc("pointsprite_identify"),buildFragment:Cc("pointsprite_identify"),uniforms:[...kc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_height_factor",type:"1f"},{name:"u_vec2_rotation",type:"2fv"},{name:"u_bool_skip_height_factor",type:"1i"},{name:"u_float_floor_elevation",type:"1f"},{name:"u_float_identify_opacity",type:"1f"},...Fc],attributes:[{name:"a_vec3_flat_position",location:0},{name:"a_vec3_ecef_position",location:1},{name:"a_vec2_offset",location:2},{name:"a_vec2_texcoord",location:3},{name:"a_vec2_range",location:4},{name:"a_vec2_rescale",location:5},{name:"a_vec4_identifier",location:6}]},pointDepthTest:{buildVertex:Lc("point_anchor"),buildFragment:Cc("color_identify"),uniforms:[zc,{name:"u_vec2_vpt_size",type:"2f"},{name:"u_vec2_offset",type:"2f"},{name:"u_float_floor_elevation",type:"1f"},...Fc],attributes:[{name:"a_vec4_position",location:0},{name:"a_vec2_offset",location:1},{name:"a_vec4_identifier",location:2}]},stripedLine:{buildVertex:Lc("striped_line"),buildFragment:Cc("striped_line"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec2_scaler_params",type:"2fv"},{name:"u_float_dash_length",type:"1f"},{name:"u_float_space_length",type:"1f"},{name:"u_float_dash2_length",type:"1f"},{name:"u_vec4_dash_color",type:"4fv"},{name:"u_vec4_space_color",type:"4fv"},{name:"u_vec4_border_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_width_offset",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_bool_is_3d_line",type:"1i"},...Dc,...Uc,...Hc,...jc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texture_widen",location:1},{name:"a_vec2_widen",location:2},{name:"a_float_vertex_distance",location:3},{name:"a_float_component_distance",location:4},{name:"a_float_object_length",location:5},{name:"a_vec4_identifier",location:6}]},stripedLine3D:{buildVertex:Lc("striped_line"),buildFragment:Cc("striped_line"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec2_scaler_params",type:"2fv"},{name:"u_float_dash_length",type:"1f"},{name:"u_float_space_length",type:"1f"},{name:"u_float_dash2_length",type:"1f"},{name:"u_vec4_dash_color",type:"4fv"},{name:"u_vec4_space_color",type:"4fv"},{name:"u_vec4_border_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_width_offset",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_bool_is_3d_line",type:"1i"},...Fc,...Dc,...Uc,...Hc,...jc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texture_widen",location:1},{name:"a_vec2_widen",location:2},{name:"a_float_vertex_distance",location:3},{name:"a_float_component_distance",location:4},{name:"a_float_object_length",location:5},{name:"a_vec4_identifier",location:6},{name:"a_float_height",location:7}]},patternedLine:{buildVertex:Lc("patterned_line"),buildFragment:Cc("patterned_line"),uniforms:[zc,{name:"u_vec2_scales",type:"2fv"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_int_pattern_type",type:"1i"},{name:"u_vec4_pattern_params",type:"4fv"},{name:"u_bool_is_3d_line",type:"1i"},Oc,...Dc,...Uc,...Hc,...jc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_widen",location:1},{name:"a_float_texture",location:2},{name:"a_vec4_identifier",location:3}]},patternedLine3D:{buildVertex:Lc("patterned_line"),buildFragment:Cc("patterned_line"),uniforms:[zc,{name:"u_vec2_scales",type:"2fv"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_int_pattern_type",type:"1i"},{name:"u_vec4_pattern_params",type:"4fv"},{name:"u_bool_is_3d_line",type:"1i"},Oc,...Fc,...Dc,...Uc,...Hc,...jc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_widen",location:1},{name:"a_float_texture",location:2},{name:"a_vec4_identifier",location:3},{name:"a_float_height",location:4}]},stripedLineIdentify:{buildVertex:Lc("striped_line_identify"),buildFragment:Cc("color_identify"),uniforms:[zc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec2_scaler_params",type:"2fv"},{name:"u_float_dash_length",type:"1f"},{name:"u_float_space_length",type:"1f"},{name:"u_float_dash2_length",type:"1f"},{name:"u_vec4_dash_color",type:"4fv"},{name:"u_vec4_space_color",type:"4fv"},{name:"u_vec4_border_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_width_offset",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_bool_is_3d_line",type:"1i"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texture_widen",location:1},{name:"a_vec2_widen",location:2},{name:"a_float_vertex_distance",location:3},{name:"a_float_component_distance",location:4},{name:"a_float_object_length",location:5},{name:"a_vec4_identifier",location:6}]},stripedLine3DIdentify:{buildVertex:Lc("striped_line_identify"),buildFragment:Cc("color_identify"),uniforms:[zc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec2_scaler_params",type:"2fv"},{name:"u_float_dash_length",type:"1f"},{name:"u_float_space_length",type:"1f"},{name:"u_float_dash2_length",type:"1f"},{name:"u_vec4_dash_color",type:"4fv"},{name:"u_vec4_space_color",type:"4fv"},{name:"u_vec4_border_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_width_offset",type:"1f"},{name:"u_float_opacity",type:"1f"},{name:"u_bool_is_3d_line",type:"1i"},...Fc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texture_widen",location:1},{name:"a_vec2_widen",location:2},{name:"a_float_vertex_distance",location:3},{name:"a_float_component_distance",location:4},{name:"a_float_object_length",location:5},{name:"a_vec4_identifier",location:6},{name:"a_float_height",location:7}]},vtxColor:{buildVertex:Lc("color"),buildFragment:Cc("textured_color"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_float_opacity",type:"1f"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_texture_opacity",type:"1f"},{name:"u_float_texture_params",type:"4fv"},{name:"u_float_sprite_texture_coords",type:"4fv"},{name:"u_int_is_textured",type:"1i"},{name:"u_float_floor_elevation",type:"1f"},{name:"u_int_is_normal_map_textured",type:"1i"},{name:"u_sr2d_texture1",type:"1i"},{name:"u_vec4_normal_map_texture_params",type:"4fv"},{name:"u_vec4_normal_map_sprite_texture_coords",type:"4fv"},{name:"u_int_normal_map_is_animated",type:"1i"},{name:"u_vec4_normal_map_animated_offsets",type:"4fv"},{name:"u_float_metallic",type:"1f"},{name:"u_float_roughness",type:"1f"},{name:"u_vec4_color2",type:"4fv"},{name:"u_sr2d_read_from_target_texture",type:"1i"},...Dc,...jc,...Nc,...Uc,...Hc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_visibility",location:1},{name:"a_float_mix_factor",location:2}]},vtxColorIdentify:{buildVertex:Lc("color_identify"),buildFragment:Cc("color_identify"),uniforms:[zc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_float_floor_elevation",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec4_identifier",location:1},{name:"a_float_visibility",location:2}]},metricPoint:{buildVertex:Lc("metric_point"),buildFragment:Cc("metric_point"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_sprite_texture_coords",type:"4fv"},{name:"u_float_floor_elevation",type:"1f"},...Dc,...Uc,...jc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texcoord",location:1}]},zbmModelIdentify:{buildVertex:Lc("zbm_model_identify"),buildFragment:Cc("color_identify"),uniforms:[zc,{name:"u_vec2_vpt_size",type:"2fv"},...Fc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec4_identifier",location:2},{name:"a_vec2_dem_position",location:3}]},buildingIdentify:{buildVertex:Lc("diffuse_identify"),buildFragment:Cc("color_identify"),uniforms:[zc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_floor_elevation",type:"1f"},...Fc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec4_identifier",location:2},{name:"a_vec2_dem_position",location:3},{name:"a_float_visibility",location:4}]},oneWayLine:{buildVertex:Lc("one_way_line"),buildFragment:Cc("one_way_line"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2f"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec4_color",type:"4f"},{name:"u_vec4_border_color",type:"4f"},{name:"u_vec2_wing_normal",type:"2f"},{name:"u_vec2_tip_normal",type:"2f"},{name:"u_float_width",type:"1f"},{name:"u_float_length",type:"1f"},{name:"u_float_tip_radius_zpt",type:"1f"},{name:"u_float_wing_radius_zpt",type:"1f"},{name:"u_float_tail_radius_zpt",type:"1f"},{name:"u_float_border_width",type:"1f"},{name:"u_float_border_width_offset",type:"1f"},{name:"u_float_size_factor",type:"1f"},{name:"u_vec2_scale_limits",type:"2fv"},{name:"u_float_tip_height_multiplier",type:"1f"},{name:"u_float_wing_height_multiplier",type:"1f"},{name:"u_float_wing_width_multiplier",type:"1f"},{name:"u_float_opacity",type:"1f"},...Dc,...Uc,...Hc],attributes:[{name:"a_vec2_position",location:0},{name:"a_vec2_direction",location:1},{name:"a_vec2_widen_direction",location:2}]},zbmModel:{buildVertex:Lc("zbm_model"),buildFragment:Cc("zbm_model"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_height_factor",type:"1f"},{name:"u_sdtr_distance",type:"1f"},...Dc,...Fc,...Uc,...Hc,...jc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_texcoord",location:2},{name:"a_vec2_dem_position",location:3}]},zbmShadow:{buildVertex:Lc("zbm_shadow"),buildFragment:Cc("main_shadow"),uniforms:[zc,{name:"u_float_height_factor",type:"1f"},...Fc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_dem_position",location:2}]},gltfModel:{buildVertex:Lc("gltf_model"),buildFragment:Cc("gltf_model"),uniforms:[...kc,Oc,{name:"u_mat4_instance",type:"mat4"},{name:"u_mat4_localmatrix",type:"mat4"},{name:"u_vec4_color",type:"4fv"},{name:"u_sr2d_texture_0",type:"1i"},{name:"u_ao_texture",type:"1i"},{name:"u_pbr_texture",type:"1i"},{name:"u_float_identify",type:"1f"},{name:"u_sdtr_distance",type:"1f"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_show_ratio",type:"1f"},{name:"u_float_metallic",type:"1f"},{name:"u_float_roughness",type:"1f"},{name:"u_sampler_map_tex",type:"1i"},{name:"u_vec2_tex_scale",type:"2f"},{name:"u_float_tex_shift_scale",type:"1f"},{name:"u_float_floor_elevation",type:"1f"},{name:"u_int_extention_to_relief_needed",type:"1i"},...Dc,...Hc,...Uc,...Fc,...jc,...Nc,...Bc,...Rc],attributes:[{name:"position",location:0},{name:"normal",location:1},{name:"tangent",location:2},{name:"a_vec2_instance_position",location:3},{name:"a_vec3_instance_ecef_position",location:4},{name:"a_mat3_instance_matrix",location:5,locationsCount:3},{name:"a_vec4_instance_localid",location:8},{name:"texcoord_color",location:9},{name:"texcoord_ao",location:10},{name:"texcoord_pbr",location:11},{name:"a_float_abs_z",location:12},{name:"a_float_instance_height",location:13}]},gltfModelIdentify:{buildVertex:Lc("gltf_model"),buildFragment:Cc("color_identify"),uniforms:[...kc,Oc,{name:"u_mat4_instance",type:"mat4"},{name:"u_mat4_localmatrix",type:"mat4"},{name:"u_vec4_color",type:"4fv"},{name:"u_sr2d_texture_0",type:"1i"},{name:"u_float_identify",type:"1f"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_show_ratio",type:"1f"},{name:"u_int_identify",type:"1i"},{name:"u_float_floor_elevation",type:"1f"},{name:"u_int_extention_to_relief_needed",type:"1i"},...Dc,...Uc,...Fc,...Bc,...Rc],attributes:[{name:"position",location:0},{name:"normal",location:1},{name:"tangent",location:2},{name:"a_vec2_instance_position",location:3},{name:"a_vec3_instance_ecef_position",location:4},{name:"a_mat3_instance_matrix",location:5,locationsCount:3},{name:"a_vec4_instance_localid",location:8},{name:"a_float_abs_z",location:12},{name:"a_float_instance_height",location:13},{name:"texcoord_color",location:9},{name:"texcoord_ao",location:10},{name:"texcoord_pbr",location:11}]},gltfModelShadow:{buildVertex:Lc("gltf_shadow"),buildFragment:Cc("main_shadow"),uniforms:[...kc,{name:"u_mat4_instance",type:"mat4"},{name:"u_mat4_localmatrix",type:"mat4"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_show_ratio",type:"1f"},{name:"u_int_extention_to_relief_needed",type:"1i"},...Fc,...Bc,...Rc],attributes:[{name:"position",location:0},{name:"a_vec2_instance_position",location:3},{name:"a_vec3_instance_ecef_position",location:4},{name:"a_mat3_instance_matrix",location:5,locationsCount:3},{name:"a_float_abs_z",location:12},{name:"a_float_instance_height",location:13}]},simpleLine2d:{buildVertex:Lc("simple_line_2d"),buildFragment:Cc("simple_line_2d"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_z_offset",type:"1f"},{name:"u_float_floor_elevation",type:"1f"},...Dc,...Hc,...jc,...Uc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec4_direction_distance",location:1},{name:"a_float_visibility",location:2}]},simpleLine3d:{buildVertex:Lc("simple_line_3d"),buildFragment:Cc("simple_line_3d"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_height_factor",type:"1f"},{name:"u_float_z_offset",type:"1f"},{name:"u_float_floor_elevation",type:"1f"},...Dc,...Hc,...jc,...Uc,...Nc,...Fc,...Bc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec4_direction_distance",location:2},{name:"a_vec2_dem_position",location:3},{name:"a_float_abs_z",location:4},{name:"a_float_is_pivot",location:5},{name:"a_float_visibility",location:6}]},road:{buildVertex:Lc("road"),buildFragment:Cc("road"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_tile_to_pixel_ratio",type:"1f"},{name:"u_float_shift",type:"1f"},...Dc,...jc,...Uc,...Hc,...Nc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec4_normals",location:1},{name:"a_vec2_shift",location:2}]},roadIdentify:{buildVertex:Lc("road_identify"),buildFragment:Cc("road_identify"),uniforms:[zc,{name:"u_float_width",type:"1f"},{name:"u_float_tile_to_pixel_ratio",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec4_normals",location:1},{name:"a_vec4_identifier",location:2}]},line3D:{buildVertex:Lc("line3d"),buildFragment:Cc("road"),uniforms:[zc,Oc,{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},{name:"u_float_tile_to_pixel_ratio",type:"1f"},...Fc,...Dc,...jc,...Uc,...Hc,...Nc,...Bc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec4_normals",location:1},{name:"a_float_height",location:2},{name:"a_float_abs_z",location:3}]},line3DIdentify:{buildVertex:Lc("line3d_identify"),buildFragment:Cc("road_identify"),uniforms:[zc,{name:"u_float_width",type:"1f"},{name:"u_float_tile_to_pixel_ratio",type:"1f"},...Fc,...Bc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec4_normals",location:1},{name:"a_float_height",location:2},{name:"a_float_abs_z",location:3},{name:"a_vec4_identifier",location:4}]},entrance:{buildVertex:Lc("arrow_line_entrance"),buildFragment:Cc("arrow_line"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2f"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec2_scale_limits",type:"2fv"},{name:"u_vec4_color",type:"4f"},{name:"u_vec4_border_color",type:"4f"},{name:"u_vec2_wing_normal",type:"2f"},{name:"u_vec2_tip_normal",type:"2f"},{name:"u_float_width_zpt",type:"1f"},{name:"u_float_tip_radius_zpt",type:"1f"},{name:"u_float_wing_radius_zpt",type:"1f"},{name:"u_float_tail_radius_zpt",type:"1f"},{name:"u_float_tip_height_multiplier",type:"1f"},{name:"u_float_wing_width_multiplier",type:"1f"},{name:"u_float_wing_height_multiplier",type:"1f"},{name:"u_float_border_width_zpt",type:"1f"},{name:"u_float_size_factor",type:"1f"},{name:"u_float_border_width_offset",type:"1f"},{name:"u_float_total_line_length",type:"1f"},{name:"u_float_relative_end_position",type:"1f"},{name:"u_float_vertex_shift",type:"1f"},{name:"u_float_tip_movement_amplitude",type:"1f"},{name:"u_vec2_bounce_direction",type:"2f"},{name:"u_float_opacity",type:"1f"},...Dc,...Uc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_segment_end",location:1},{name:"a_vec4_texture_widen_arrow_widen",location:2},{name:"a_vec2_widen",location:3},{name:"a_vec2_direction",location:4},{name:"a_float_distance_from_start",location:5},{name:"a_float_object_length",location:6},{name:"a_float_type",location:7},{name:"a_vec4_identifier",location:8}]},entranceIdentify:{buildVertex:Lc("arrow_line_entrance"),buildFragment:Cc("arrow_line_identify"),uniforms:[zc,Oc,{name:"u_vec2_vpt_size",type:"2f"},{name:"u_vec3_projection_scale_style_scale_dpi",type:"3fv"},{name:"u_vec2_scale_limits",type:"2fv"},{name:"u_vec4_color",type:"4f"},{name:"u_vec4_border_color",type:"4f"},{name:"u_vec2_wing_normal",type:"2f"},{name:"u_vec2_tip_normal",type:"2f"},{name:"u_float_width_zpt",type:"1f"},{name:"u_float_tip_radius_zpt",type:"1f"},{name:"u_float_wing_radius_zpt",type:"1f"},{name:"u_float_tail_radius_zpt",type:"1f"},{name:"u_float_tip_height_multiplier",type:"1f"},{name:"u_float_wing_width_multiplier",type:"1f"},{name:"u_float_wing_height_multiplier",type:"1f"},{name:"u_float_border_width_zpt",type:"1f"},{name:"u_float_size_factor",type:"1f"},{name:"u_float_border_width_offset",type:"1f"},{name:"u_float_total_line_length",type:"1f"},{name:"u_float_relative_end_position",type:"1f"},{name:"u_float_vertex_shift",type:"1f"},{name:"u_float_tip_movement_amplitude",type:"1f"},{name:"u_vec2_bounce_direction",type:"2f"},{name:"u_float_opacity",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_segment_end",location:1},{name:"a_vec4_texture_widen_arrow_widen",location:2},{name:"a_vec2_widen",location:3},{name:"a_vec2_direction",location:4},{name:"a_float_distance_from_start",location:5},{name:"a_float_object_length",location:6},{name:"a_float_type",location:7},{name:"a_vec4_identifier",location:8}]},circleMarker:{buildVertex:Lc("circle_marker"),buildFragment:Cc("circle_marker"),uniforms:[...kc,Oc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_width",type:"1f"},...Dc,...Uc,...jc,...Nc],attributes:[{name:"a_vec3_flat_position",location:0},{name:"a_vec3_ecef_position",location:1},{name:"a_vec2_widen",location:2}]},rect:{buildVertex:Lc("rect"),buildFragment:Cc("rect"),uniforms:[zc,{name:"u_vec4_color",type:"4fv"}],attributes:[{name:"a_vec2_vertex",location:0}]},rectWithTexture:{buildVertex:Lc("rect_with_texture"),buildFragment:Cc("rect_with_texture"),uniforms:[zc,Oc,{name:"u_sr2d_texture",type:"1i"},{name:"u_float_opacity",type:"1f"},...Uc,...Dc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texcoord",location:1}]},circleMarkerIdentify:{buildVertex:Lc("circle_marker_identify"),buildFragment:Cc("color_identify"),uniforms:[...kc,{name:"u_vec2_vpt_size",type:"2fv"},{name:"u_float_width",type:"1f"}],attributes:[{name:"a_vec3_flat_position",location:0},{name:"a_vec3_ecef_position",location:1},{name:"a_vec2_widen",location:2},{name:"a_vec4_identifier",location:3}]},heatmap:{buildVertex:Lc("heatmap"),buildFragment:Cc("heatmap"),uniforms:[zc,Oc,...Dc,{name:"u_float_radius",type:"1f"},{name:"u_float_intensity",type:"1f"},{name:"u_float_tile_to_pixel_ratio",type:"1f"},...Uc],attributes:[{name:"a_vec2_position",location:0},{name:"a_vec2_widen",location:1},{name:"a_float_weight",location:2}]},heatmapTexture:{buildVertex:Lc("heatmap_texture"),buildFragment:Cc("heatmap_texture"),uniforms:[Oc,{name:"u_sr2d_texture",type:"1i"},{name:"u_sr2d_ramp_texture",type:"1i"},{name:"u_float_opacity",type:"1f"},...Dc,...Uc],attributes:[{name:"a_vec2_position",location:0}]},demMesh:{buildVertex:Lc("dem_mesh"),buildFragment:Cc("dem_mesh"),uniforms:[zc,Oc,{name:"u_mat4_flat_map_mvp",type:"mat4"},{name:"u_flat_tex",type:"1i"},{name:"u_hillshade_tex",type:"1i"},...Dc,...Fc,...Uc,...Hc,...jc,...Nc],attributes:[{name:"a_vec2_position",location:0}]},demGround:{buildVertex:Lc("dem_ground"),buildFragment:Cc("dem_ground"),uniforms:[zc,Oc,...Fc],attributes:[{name:"a_vec2_position",location:0}]},demMesh2:{buildVertex:Lc("dem_mesh2"),buildFragment:Cc("dem_mesh2"),uniforms:[zc,Oc,{name:"u_mat4_flat_map_mvp",type:"mat4"},{name:"u_flat_tex",type:"1i"},{name:"u_hillshade_tex",type:"1i"},...Dc,...Fc,...Uc,...Hc,...jc,...Nc,{name:"u_use_flat_dem_mesh_normals",type:"1f"},{name:"u_int_depth_test",type:"1i"},{name:"u_vec4_depth_test_color",type:"4fv"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec3_normal",location:1},{name:"a_float_height",location:2}]},demGround2:{buildVertex:Lc("dem_ground2"),buildFragment:Cc("dem_ground2"),uniforms:[zc,Oc,...Fc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_height",location:1}]},demElevationCopy:{buildVertex:Lc("dem_elevation_copy"),buildFragment:Cc("dem_elevation_copy"),uniforms:[zc,{name:"u_sr2d_texture",type:"1i"},{name:"u_mat4_dem_corrected",type:"mat4"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texcoord",location:1}]},demElevation:{buildVertex:Lc("dem_elevation"),buildFragment:Cc("dem_elevation"),uniforms:[zc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_height",location:1}]},demHillshade:{buildVertex:Lc("dem_normal"),buildFragment:Cc("dem_normal"),uniforms:[...Fc,...jc,...Nc,zc,{name:"u_sr2d_texture",type:"1i"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_texcoord",location:1}]},demFlatBottom:{buildVertex:Lc("dem_flat_bottom"),buildFragment:Cc("dem_flat_bottom"),uniforms:[zc,...Fc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_vec2_centroid",location:1},{name:"a_vec2_extender",location:2}]},mesh:{buildVertex:Lc("mesh"),buildFragment:Cc("mesh"),uniforms:[zc,Oc,...Dc,...Fc,...Bc,...jc,...Nc,...Uc,...Hc,{name:"u_float_opacity",type:"1f"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_height_factor",type:"1f"},{name:"u_sdtr_distance",type:"1f"},{name:"u_mat4_gradient",type:"mat4"},{name:"u_int_identify",type:"1i"},{name:"u_sr2d_texture",type:"1i"},{name:"u_float_texture_opacity",type:"1f"},{name:"u_float_texture_params",type:"4fv"},{name:"u_float_sprite_texture_coords",type:"4fv"},{name:"u_int_is_textured",type:"1i"},{name:"u_float_texture_vertical_scale",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec3_normal",location:2},{name:"a_float_gradient",location:3},{name:"a_vec2_dem_position",location:4},{name:"a_float_abs_z",location:5},{name:"a_vec4_identifier",location:6},{name:"a_float_visibility",location:7},{name:"a_float_is_pivot",location:8}]},meshDepthClear:{buildVertex:Lc("mesh"),buildFragment:Cc("depth_clear"),uniforms:[zc,Oc,...Dc,...Fc,...Bc,...jc,...Nc,...Uc,...Hc,{name:"u_float_opacity",type:"1f"},{name:"u_vec4_color",type:"4fv"},{name:"u_float_height_factor",type:"1f"},{name:"u_sdtr_distance",type:"1f"},{name:"u_mat4_gradient",type:"mat4"},{name:"u_int_identify",type:"1i"},{name:"u_float_texture_params",type:"4fv"},{name:"u_int_is_textured",type:"1i"},{name:"u_float_texture_vertical_scale",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec3_normal",location:2},{name:"a_float_gradient",location:3},{name:"a_vec2_dem_position",location:4},{name:"a_float_abs_z",location:5},{name:"a_vec4_identifier",location:6},{name:"a_float_visibility",location:7},{name:"a_float_is_pivot",location:8}]},mapMesh:{buildVertex:Lc("map_mesh"),buildFragment:Cc("map_mesh"),uniforms:[zc,Oc,...Dc,...Fc,...jc,...Nc,...Bc,...Uc,...Hc,{name:"u_float_tile_size",type:"1f"},{name:"u_sampler_map_tex",type:"1i"},{name:"u_vec2_tex_scale",type:"2f"},{name:"u_float_tex_shift_scale",type:"1f"},{name:"u_float_height_factor",type:"1f"},{name:"u_sdtr_distance",type:"1f"},{name:"u_int_identify",type:"1i"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_extender",location:2},{name:"a_vec3_normal",location:3},{name:"a_float_gradient",location:4},{name:"a_vec2_dem_position",location:5},{name:"a_float_abs_z",location:6},{name:"a_float_is_pivot",location:7}]},sky:{buildVertex:Lc("sky"),buildFragment:Cc("sky"),uniforms:[Oc,...Dc,...Uc,{name:"u_sky_color",type:"4f"}],attributes:[{name:"a_vec2_vertex",location:0}]},taa:{buildVertex:Lc("posteffect"),buildFragment:Cc("taa"),uniforms:[{name:"u_texture",type:"1i"},{name:"u_float_mix_coef",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0}]},fxaa:{buildVertex:Lc("posteffect"),buildFragment:Cc("fxaa"),uniforms:[{name:"u_texture",type:"1i"},{name:"u_vec2_vpt_size",type:"2f"}],attributes:[{name:"a_vec2_vertex",location:0}]},copy:{buildVertex:Lc("posteffect"),buildFragment:Cc("copy"),uniforms:[{name:"u_texture",type:"1i"},{name:"u_depth",type:"1i"}],attributes:[{name:"a_vec2_vertex",location:0}]},buildingShadow:{buildVertex:Lc("building_shadow"),buildFragment:Cc("main_shadow"),uniforms:[...Fc,zc,{name:"u_float_height_factor",type:"1f"},{name:"u_float_floor_elevation",type:"1f"}],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_dem_position",location:2},{name:"a_float_visibility",location:3}]},meshShadow:{buildVertex:Lc("mesh_shadow"),buildFragment:Cc("main_shadow"),uniforms:[zc,{name:"u_float_height_factor",type:"1f"},...Fc,...Bc],attributes:[{name:"a_vec2_vertex",location:0},{name:"a_float_z",location:1},{name:"a_vec2_dem_position",location:2},{name:"a_float_abs_z",location:3},{name:"a_float_visibility",location:4},{name:"a_float_is_pivot",location:5}]},globe:{buildVertex:Lc("globe"),buildFragment:Cc("globe"),uniforms:[...kc,{name:"u_sr2d_flatmap_texture",type:"1i"},{name:"u_vec4_extent",type:"4f"}],attributes:[{name:"a_vec3_ecef_position",location:0},{name:"a_vec3_flat_position",location:1},{name:"a_vec2_texture",location:2}]},globeHalo:{buildVertex:Lc("globe_halo"),buildFragment:Cc("globe_halo"),uniforms:[{name:"u_vec2_halo_viewport_size",type:"2f"},{name:"u_vec2_halo_viewport_center_shift",type:"2f"},{name:"u_vec4_halo_radius_stops",type:"4f"},{name:"u_vec4_halo_color",type:"4f"},{name:"u_float_halo_exp_factor",type:"1f"},{name:"u_vec4_default_background_color",type:"4f"}],attributes:[{name:"a_vec2_vertex",location:0}]},stars:{buildVertex:Lc("stars"),buildFragment:Cc("stars"),uniforms:[{name:"u_mat4_stars",type:"mat4"},{name:"u_float_pixelratio",type:"1f"},{name:"u_float_stars_intensity",type:"1f"}],attributes:[{name:"a_vec3_position",location:0},{name:"a_fade_opacity",location:1}]},globeHaloBackground:{buildVertex:Lc("globe_halo"),buildFragment:Cc("globe_halo_background"),uniforms:[{name:"u_vec2_halo_viewport_size",type:"2f"},{name:"u_vec2_halo_viewport_center_shift",type:"2f"},{name:"u_vec4_halo_radius_stops",type:"4f"},{name:"u_vec4_halo_color",type:"4f"},{name:"u_float_halo_exp_factor",type:"1f"},{name:"u_vec4_default_background_color",type:"4f"}],attributes:[{name:"a_vec2_vertex",location:0}]}},this.shaderPrograms={},t.map.once("idle",(()=>function(e,t){if(window.requestIdleCallback)for(const i in t){const t=i;window.requestIdleCallback((()=>{if(e.isContextLost())return;const i=e.getShaderProgram(t);i.link(),setTimeout((()=>{window.requestIdleCallback((()=>{e.isContextLost()||i.locate()}))}),2e3)}))}}(this,this.shaderProgramOptions))),this.symbolSettingsList={line:{solid:[{programName:"road",vaoCreator:Oi,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,jt),programBinder:Ss,objectBinder:Ga(Vs,js,Gs),layerBinder:ci,zoomBinder:Ta,tileBinder:Jd(ic,Qd),cullMethod:rd(bl,Ul,Cl,ed)},{identify:!0,programName:"roadIdentify",vaoCreator:Di,stateBinder:vo,needsVisibilityBuffer:!1,objectBinder:Ga(Gs),zoomBinder:Ta,tileBinder:Qd,cullMethod:rd(bl,Ul,Cl)}],patterned:[{programName:"patternedLine",vaoCreator:ji,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,jt),programBinder:Ms,layerBinder:ci,objectBinder:Ga(na,Gs,Bs,Va),zoomBinder:Ea,tileBinder:Jd(ic,Qd),cullMethod:rd(bl,Ul,Cl,pl)}],solid3d:[{programName:"line3D",vaoCreator:Ri,stateBinder:ao,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,jt),programBinder:ls,objectBinder:Ga(js,Gs,Ra,ja),layerBinder:ci,zoomBinder:Ta,tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Cl,ed),is3dMapAware:!0},{identify:!0,programName:"line3DIdentify",vaoCreator:Fi,stateBinder:so,needsVisibilityBuffer:!1,programBinder:$r,objectBinder:Ga(Gs,Ra,ja),zoomBinder:Ta,tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Cl),is3dMapAware:!0}],patterned3d:[{programName:"patternedLine3D",vaoCreator:Ni,stateBinder:ao,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,jt),programBinder:Is,layerBinder:ci,objectBinder:Ga(na,Gs,Bs,Va,ja),zoomBinder:Ea,tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Cl,pl),is3dMapAware:!0}]},polygon:{fill:[{programName:"vtxColor",vaoCreator:Ai,stateBinder:ho,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ms,layerBinder:di(ci,ti,ii),objectBinder:Ga(js,Ns,Bs,Ds,Za),tileBinder:Jd(sc,lc,ac,dc,Qd,ic,pc,cc),cullMethod:rd(bl,Hl,Ul,ed)},{identify:!0,programName:"vtxColorIdentify",vaoCreator:ki,stateBinder:vo,needsVisibilityBuffer:!0,programBinder:$t,objectBinder:Ga(Za),tileBinder:Qd,cullMethod:rd(bl,Hl,Ul)}],fillWithMixFactor:[{programName:"vtxColor",vaoCreator:Li,stateBinder:mo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ms,layerBinder:di(ci,ti,ii),objectBinder:Ga(js,Ns,Bs,Ds,Za),tileBinder:Jd(sc,lc,ac,dc,Qd,ic,pc,cc),cullMethod:rd(bl,Hl,Ul,ed)}],stroke:[{programName:"simpleLine2d",vaoCreator:fn,stateBinder:ho,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ds,layerBinder:di($t,Qt,ci),objectBinder:Ga(js,Gs,Za),tileBinder:Jd(ic,Qd),cullMethod:rd(Sl,bl,Hl,Ul,zl,Xl,Yl),subRenderIndex:1}],shadow:[{programName:"vtxColor",vaoCreator:Ci,stateBinder:ho,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt),programBinder:rs,layerBinder:ti,objectBinder:Ga(js,Bs,Za),tileBinder:Jd(vc,sc,lc,Qd,ic),cullMethod:rd(bl,Hl,Ul,Gl)}]},metricPoint:{fill:[{programName:"metricPoint",vaoCreator:zi,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,jt,Bt),programBinder:ss,layerBinder:di(ci,ti),objectBinder:Ga(js,Za),tileBinder:Jd(hc,Qd,ic),cullMethod:rd(bl,Hl,ed)}]},mesh:{fill:[{programName:"mesh",vaoCreator:Wi,stateBinder:xo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,layerBinder:di(ci,ui),objectBinder:Ga(js,Us,Bs,Oa,ja,Ra,Ua,Ds),tileBinder:Jd(sc,lc,uc,ic,Qd,oc),cullMethod:rd(bl,Dl),subRenderIndex:1,is3dMapAware:!0},{identify:!0,programName:"mesh",vaoCreator:Wi,stateBinder:so,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,objectBinder:Ga(Oa,ja,Ra,Ua),tileBinder:Jd(Qd,oc),cullMethod:bl,subRenderIndex:1,is3dMapAware:!0},{depthTest:!0,programName:"mesh",vaoCreator:Xi,stateBinder:so,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,objectBinder:Ga(Oa,ja,Ra,Ua),tileBinder:Jd(Qd,oc),cullMethod:bl,subRenderIndex:1,is3dMapAware:!0},{programName:"meshShadow",shadow:!0,vaoCreator:Ki,stateBinder:Po,needsVisibilityBuffer:!0,programBinder:$r,objectBinder:Ga(Oa,ja,Ra),tileBinder:Jd(Qd,oc),cullMethod:bl,is3dMapAware:!0}],inverse:[{programName:"mesh",vaoCreator:$i,stateBinder:yo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,objectBinder:Ga(Oa,ja,Ua),tileBinder:Jd(Qd,oc),subRenderIndex:-1,is3dMapAware:!0},{identify:!0,programName:"mesh",vaoCreator:$i,stateBinder:yo,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,objectBinder:Ga(Oa,ja,Ua),tileBinder:Jd(Qd,oc),subRenderIndex:-1,is3dMapAware:!0},{programName:"meshShadow",shadow:!0,vaoCreator:$i,stateBinder:Po,needsVisibilityBuffer:!0,programBinder:$r,objectBinder:Ga(Oa,ja,Ra),tileBinder:Jd(Qd,oc),cullMethod:bl,is3dMapAware:!0}],depthClear:[{programName:"meshDepthClear",vaoCreator:$i,stateBinder:bo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,objectBinder:Ga(Oa,ja,Ua,Ra),tileBinder:Jd(Qd,oc),subRenderIndex:-2,is3dMapAware:!0,forceRenderUnderCacheInDemMode:!0}],stroke:[{programName:"simpleLine3d",vaoCreator:qi,stateBinder:co,needsVisibilityBuffer:!0,commonBinder:Wt(Vt,Dt,Bt,jt),programBinder:cs,layerBinder:di(Qt,ci),objectBinder:Ga(js,Gs,Oa,Wa,ja,Ra),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,zl,ol,Kl,Yl),subRenderIndex:2,is3dMapAware:!0}]},polygonExtrusion:{sideFill:[{programName:"diffuse",vaoCreator:Yi,stateBinder:yo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ps,tileBinder:Jd(ic,Qd,oc),layerBinder:di(ci,ui),objectBinder:Ga(js,_a,Bs,ja,Za,Xa),cullMethod:rd(yl,bl,Hl,Wl,Ul),is3dMapAware:!0},{programName:"gradientDiffuse",vaoCreator:Yi,stateBinder:Bo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ps,layerBinder:di(ci,ui),objectBinder:Ga(js,Us,_a,Bs,ja,Za,Ka,Xa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,Wl,jl),is3dMapAware:!0},{identify:!0,programName:"buildingIdentify",vaoCreator:Ji,stateBinder:so,needsVisibilityBuffer:!0,commonBinder:Vt,programBinder:Jr,objectBinder:Ga(_a,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0},{depthTest:!0,programName:"buildingIdentify",vaoCreator:Qi,stateBinder:so,needsVisibilityBuffer:!0,commonBinder:Vt,programBinder:Jr,objectBinder:Ga(_a,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0},{programName:"buildingShadow",shadow:!0,vaoCreator:en,stateBinder:Eo,needsVisibilityBuffer:!0,programBinder:$r,objectBinder:Ga(_a,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0}],topFill:[{programName:"diffuse",vaoCreator:Yi,stateBinder:yo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ps,layerBinder:ci,objectBinder:Ga(js,_a,Bs,ja,Za,Xa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(yl,bl,Hl,Ul,Zl),is3dMapAware:!0},{programName:"diffuse",vaoCreator:Yi,stateBinder:Bo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ps,layerBinder:di(ci,ui),objectBinder:Ga(js,_a,Bs,ja,Za,Xa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,Zl),subRenderIndex:1,is3dMapAware:!0},{identify:!0,programName:"buildingIdentify",vaoCreator:Ji,stateBinder:so,needsVisibilityBuffer:!0,commonBinder:Vt,programBinder:Jr,objectBinder:Ga(_a,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0},{depthTest:!0,programName:"buildingIdentify",vaoCreator:Qi,stateBinder:so,needsVisibilityBuffer:!0,commonBinder:Vt,programBinder:Jr,objectBinder:Ga(_a,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0},{programName:"buildingShadow",shadow:!0,vaoCreator:en,stateBinder:Eo,needsVisibilityBuffer:!0,programBinder:$r,objectBinder:Ga(_a,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0}],sideStroke:[{programName:"line",vaoCreator:on,stateBinder:co,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,jt,Bt,Vt),programBinder:_s,layerBinder:ci,objectBinder:Ga(js,Us,_a,Bs,ja,Za),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,Ql,Nl),subRenderIndex:3,is3dMapAware:!0}],topStroke:[{programName:"simpleLine3d",vaoCreator:_n,stateBinder:co,needsVisibilityBuffer:!0,commonBinder:Wt(Vt,Dt,Bt,jt),programBinder:cs,layerBinder:di(ci,ei),objectBinder:Ga(js,Gs,_a,ja,Za,Fa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,zl,Xl,Jl),subRenderIndex:4,is3dMapAware:!0}]},labelLine:{raster:[{programName:"labelLine",vaoCreator:Zi,stateBinder:Mo,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt),programBinder:Qr,objectBinder:Ga(Ws,Ys,ba,xa,Ia),tileBinder:Jd(Qd,ic),zoomBinder:Ta,cullMethod:rd(Hl,Fl,Ml,al,Pl,Al),uniformSet:"fontHalo"},{programName:"labelLine",vaoCreator:Zi,stateBinder:Io,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt),programBinder:Qr,objectBinder:Ga(Ws,Ys,ba,xa,Ia),tileBinder:Jd(Qd,ic),zoomBinder:Ta,cullMethod:rd(Hl,Fl,Al,Ml,al,Pl),uniformSet:"fontHalo",isOverlappedObject:!0},{programName:"labelLine",vaoCreator:Zi,stateBinder:Mo,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt),programBinder:Qr,objectBinder:Ga(Ws,Ys,ba,xa,Ia),zoomBinder:Ta,tileBinder:Jd(Qd,ic),cullMethod:rd(Hl,Fl,Ml,al,Pl),uniformSet:"fontFill",subRenderIndex:1},{programName:"labelLine",vaoCreator:Zi,stateBinder:Io,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt),programBinder:Qr,objectBinder:Ga(Ws,Ys,ba,xa,Ia),zoomBinder:Ta,tileBinder:Jd(Qd,ic),cullMethod:rd(Hl,Fl,Ml,al,Pl),uniformSet:"fontFill",subRenderIndex:1,isOverlappedObject:!0}]},dashedLine:{stroke:[{programName:"stripedLine",vaoCreator:Ui,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(jt,Dt,Bt,Vt),programBinder:gs,layerBinder:ci,objectBinder:Ga(ta,va,ea,Bs,Va),tileBinder:Jd(ic,Qd),cullMethod:rd(bl,Cl,Ul)},{identify:!0,programName:"stripedLineIdentify",vaoCreator:Ui,stateBinder:go,needsVisibilityBuffer:!1,commonBinder:Vt,programBinder:vs,objectBinder:Ga(ta,va,Bs,ea,Va),tileBinder:Qd,cullMethod:rd(bl,Cl,Ul)}],stroke3d:[{programName:"stripedLine3D",vaoCreator:Hi,stateBinder:ao,needsVisibilityBuffer:!1,commonBinder:Wt(jt,Dt,Bt),programBinder:ys,layerBinder:ci,objectBinder:Ga(ta,va,ea,Bs,Va,ja),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Cl),is3dMapAware:!0},{identify:!0,programName:"stripedLine3DIdentify",vaoCreator:Hi,stateBinder:so,needsVisibilityBuffer:!1,programBinder:bs,objectBinder:Ga(ta,va,Bs,ea,Va,ja),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Cl),is3dMapAware:!0}]},oneWayLine:{raster:[{programName:"oneWayLine",vaoCreator:dn,stateBinder:Mo,needsVisibilityBuffer:!1,commonBinder:Wt(Nt,Rt,Vt),programBinder:es,objectBinder:Ga(Ws,js,oa,ra),tileBinder:Qd,cullMethod:rd(Fl,Ml,Vl)},{programName:"oneWayLine",vaoCreator:dn,stateBinder:Io,commonBinder:Wt(Nt,Rt,Vt),programBinder:es,needsVisibilityBuffer:!1,objectBinder:Ga(Ws,js,oa,ra),tileBinder:Qd,cullMethod:rd(Fl,Ml,Vl),isOverlappedObject:!0}]},point:{raster:[{programName:"pointSprite",vaoCreator:rn,stateBinder:So,needsVisibilityBuffer:!1,commonBinder:si(Dt,Bt,Ot,Ft,Vt),programBinder:ts,layerBinder:ti,objectBinder:Ga(Zs,qs,Xs,ka,ja,Za),cullMethod:rd(Ml,Hl,Tl,rl,Fl),tileBinder:Jd(ec,ic,oc),is3dMapAware:!0,forcePrerenderUnderCacheInDemMode:!0},{identify:!0,programName:"pointSpriteIdentify",vaoCreator:an,stateBinder:vo,needsVisibilityBuffer:!1,commonBinder:Vt,programBinder:is,objectBinder:Ga(qs,Xs,ka,ja,Za),tileBinder:Jd(ec,oc),cullMethod:rd(Ml,Hl,Tl,rl,gl),is3dMapAware:!0},{labelTest:!0,programName:"pointSpriteIdentify",vaoCreator:sn,stateBinder:vo,needsVisibilityBuffer:!1,commonBinder:Vt,programBinder:is,objectBinder:Ga(qs,Xs,ka,ja,Za),tileBinder:Jd(ec,oc),cullMethod:rd(Ml,Hl,Tl,rl,gl),is3dMapAware:!0}],text:[{programName:"labelPoint",vaoCreator:Gi,stateBinder:So,needsVisibilityBuffer:!1,commonBinder:si(Dt,Bt,Ft,Vt),programBinder:ns,objectBinder:Ga(Ws,Ys,ba,wa,Ma,ka,ja,Za),tileBinder:Jd(ec,ic,oc),cullMethod:rd(Ml,Hl,Fl,al,El,Al),uniformSet:"fontHalo",subRenderIndex:1,is3dMapAware:!0,forcePrerenderUnderCacheInDemMode:!0},{programName:"labelPoint",vaoCreator:Gi,stateBinder:So,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,Ft,Vt),programBinder:ns,objectBinder:Ga(Ws,Ys,ba,wa,Ma,ka,ja,Za),tileBinder:Jd(ec,ic,oc),cullMethod:rd(Ml,Hl,Fl,al,El),uniformSet:"fontFill",subRenderIndex:2,is3dMapAware:!0,forcePrerenderUnderCacheInDemMode:!0},{identify:!0,programName:"labelPointIdentify",vaoCreator:Vi,stateBinder:vo,needsVisibilityBuffer:!1,commonBinder:Vt,programBinder:Kr($r),objectBinder:Ga(ba,Ma,ja,Za),tileBinder:Jd(ec,oc),cullMethod:rd(Ml,Hl,vl),subRenderIndex:1,is3dMapAware:!0}],labelingTexture:[{depthTest:!0,programName:"pointDepthTest",vaoCreator:ln,stateBinder:go,needsVisibilityBuffer:!1,commonBinder:Vt,programBinder:$r,objectBinder:Ga(Ma,ja,Za),tileBinder:Jd(Qd,oc),cullMethod:rd(Ml,Hl),is3dMapAware:!0}]},buildingModel:{fill:[{programName:"zbmModel",vaoCreator:cn,stateBinder:To,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,Bt,jt),programBinder:ws,layerBinder:di(ci,ti,ui),objectBinder:Ga(js,ma,aa,ja),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(Il,bl,Ll,ed,ql),subRenderIndex:2,is3dMapAware:!0},{programName:"zbmModelIdentify",vaoCreator:un,stateBinder:so,needsVisibilityBuffer:!1,commonBinder:Vt,objectBinder:Ga(ja),tileBinder:Jd(Qd,oc),cullMethod:bl,subRenderIndex:2,identify:!0,is3dMapAware:!0},{programName:"zbmModelIdentify",vaoCreator:hn,stateBinder:so,needsVisibilityBuffer:!1,commonBinder:Vt,objectBinder:Ga(ja),tileBinder:Jd(Qd,oc),cullMethod:bl,depthTest:!0,is3dMapAware:!0},{programName:"zbmShadow",vaoCreator:mn,stateBinder:Eo,needsVisibilityBuffer:!1,programBinder:$r,objectBinder:Ga(ma,ja),tileBinder:Jd(Qd,oc),cullMethod:bl,shadow:!0,is3dMapAware:!0}],stroke:[{programName:"simpleLine3d",vaoCreator:_n,stateBinder:co,needsVisibilityBuffer:!0,commonBinder:Wt(Vt,Dt,Bt,jt),programBinder:cs,layerBinder:di(ci,Qt),objectBinder:Ga(js,Gs,ma,Wa,ja,Fa),tileBinder:Jd(Qd,ic,oc),cullMethod:rd(bl,Il,zl,Xl,ql),subRenderIndex:5,is3dMapAware:!0}]},shiftedLine:{solid:[{programName:"road",commonBinder:Wt(Dt,Bt,jt),programBinder:Kr(rs,ss),vaoCreator:Bi,stateBinder:ho,needsVisibilityBuffer:!1,layerBinder:ci,objectBinder:Ga(js,Gs,Vs),tileBinder:Jd(ic,Qd),zoomBinder:Ta,cullMethod:rd(bl,Cl,ed)}]},circle:{fill:[{programName:"circleMarker",vaoCreator:vn,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,jt,Bt,Vt),programBinder:xs,layerBinder:ci,objectBinder:Ga(js,Gs),cullMethod:rd(bl,Cl,ed),tileBinder:Jd(ec,ic),subRenderIndex:2,is3dMapAware:!0},{programName:"circleMarker",vaoCreator:vn,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,jt,Bt,Vt),programBinder:xs,layerBinder:ci,objectBinder:Ga(js,Gs),cullMethod:rd(bl,kl,Xl),tileBinder:Jd(ec,ic),subRenderIndex:1,is3dMapAware:!0},{programName:"circleMarker",vaoCreator:vn,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Dt,jt,Bt,Vt),programBinder:xs,layerBinder:ci,objectBinder:Ga(js,Gs),cullMethod:rd(bl,Ol,$l),tileBinder:Jd(ec,ic),is3dMapAware:!0},{identify:!0,programName:"circleMarkerIdentify",vaoCreator:gn,stateBinder:vo,needsVisibilityBuffer:!1,commonBinder:Vt,objectBinder:Ga(Gs),cullMethod:rd(bl,Rl),tileBinder:Jd(ec),is3dMapAware:!0}]},arrow:{stroke:[{programName:"entrance",vaoCreator:pn,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:Wt(Nt,Rt,Dt,Bt,Vt),programBinder:us,objectBinder:Ga(js,oa,Hs,sa,Bs),tileBinder:Jd(Qd,ic),cullMethod:rd(bl,ed)},{identify:!0,programName:"entranceIdentify",vaoCreator:pn,stateBinder:vo,needsVisibilityBuffer:!1,commonBinder:Wt(Nt,Rt,Vt),programBinder:os,objectBinder:Ga(oa,sa,Bs),tileBinder:Qd,cullMethod:bl}]},lineExtrusion:{fill:[{programName:"gradientDiffuse",vaoCreator:tn,stateBinder:uo,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,Bt,jt),programBinder:ps,layerBinder:di(ci,ui),objectBinder:Ga(fa,js,Us,Bs,ja,Wa,Ka,Xa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,Wl,jl),subRenderIndex:9,is3dMapAware:!0},{programName:"buildingShadow",shadow:!0,vaoCreator:nn,stateBinder:Po,needsVisibilityBuffer:!0,programBinder:$r,objectBinder:Ga(fa,ja,Wa),tileBinder:Jd(Qd,oc),cullMethod:rd(bl,Hl,Ul),is3dMapAware:!0}],sideStroke:[{programName:"line",vaoCreator:on,stateBinder:co,needsVisibilityBuffer:!0,commonBinder:Wt(Dt,jt,Bt,Vt),programBinder:_s,layerBinder:ci,objectBinder:Ga(fa,js,Us,Bs,ja,Wa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,Ql,Nl),subRenderIndex:10,is3dMapAware:!0}],topStroke:[{programName:"simpleLine3d",vaoCreator:_n,stateBinder:co,needsVisibilityBuffer:!0,commonBinder:Wt(Vt,Dt,Bt,jt),programBinder:cs,layerBinder:di(ci,Qt),objectBinder:Ga(fa,js,Gs,ja,Wa,Fa),tileBinder:Jd(ic,Qd,oc),cullMethod:rd(bl,Hl,Ul,zl,Xl),subRenderIndex:11,is3dMapAware:!0}]},gltfModel:{instances:[{programName:"gltfModel",vaoCreator:En(!1),instanceBinder:Wd,commonBinder:Wt(Dt,Bt,jt),programBinder:hs,layerBinder:di(ci,ui,hi),stateBinder:To,needsVisibilityBuffer:!1,objectBinder:Ga(js,da,Na,la,ja,ua,Za,ha),tileBinder:Jd(ec,fc,_c,oc,nc),cullMethod:rd(id,od),is3dMapAware:!0},{identify:!0,programName:"gltfModelIdentify",instanceBinder:Wd,vaoCreator:En(!1),stateBinder:so,needsVisibilityBuffer:!1,layerBinder:hi,commonBinder:si(Dt,Bt),programBinder:$r,objectBinder:Ga(ja,ua,Ua,Za,ha),tileBinder:Jd(ec,fc,oc,nc),cullMethod:id,is3dMapAware:!0},{depthTest:!0,programName:"gltfModelIdentify",instanceBinder:Wd,vaoCreator:En(!0),stateBinder:so,needsVisibilityBuffer:!1,commonBinder:si(Dt,Bt),programBinder:$r,layerBinder:hi,objectBinder:Ga(ja,ua,Za,ha),tileBinder:Jd(ec,fc,oc,nc),cullMethod:id,is3dMapAware:!0},{shadow:!0,programName:"gltfModelShadow",instanceBinder:Wd,vaoCreator:En(!1),stateBinder:Eo,needsVisibilityBuffer:!1,programBinder:$r,layerBinder:hi,objectBinder:Ga(ja,ua,ha),tileBinder:Jd(ec,fc,oc,nc),cullMethod:nd,is3dMapAware:!0}]},raster:{fill:[{programName:"rectWithTexture",vaoCreator:yn,stateBinder:ho,needsVisibilityBuffer:!1,commonBinder:si(Dt,Bt),layerBinder:ti,objectBinder:Ga(Js,Ks),tileBinder:Jd(Qd,ic),cullMethod:rd(sl,bl)}]},heatmap:{framebuffer:[{programName:"heatmap",vaoCreator:bn,stateBinder:Ao,needsVisibilityBuffer:!1,commonBinder:Kt,objectBinder:Ga(ga,ya),zoomBinder:Ta,tileBinder:Jd(Qd,ic),cullMethod:rd(bl,Bl)}],fill:[{programName:"heatmapTexture",vaoCreator:xn,stateBinder:ho,needsVisibilityBuffer:!1,layerBinder:ti,objectBinder:Ga(Js,Qs,$s),tileBinder:ic,cullMethod:rd(bl,sl,dl),subRenderIndex:1}]},dem:{mesh:[{programName:"demMesh",vaoCreator:Sn,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,layerBinder:ci,stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(ja,Pa,La),tileBinder:Jd(Qd,ic,tc,oc),cullMethod:rd(ul,hl),is3dMapAware:!0},{identify:!0,programName:"demMesh",vaoCreator:Sn,programBinder:Kr($r,qr),stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(Aa,ja),tileBinder:Jd(Qd,tc,oc),cullMethod:ml,is3dMapAware:!0}],ground:[{programName:"demGround",vaoCreator:Sn,programBinder:$r,tileBinder:Jd(Qd,ic,oc),stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(ja)}],elevation:[{programName:"demElevation",vaoCreator:Mn,stateBinder:po,needsVisibilityBuffer:!1,tileBinder:Qd,objectBinder:Ga()}],mesh2:[{programName:"demMesh2",vaoCreator:Mn,commonBinder:Wt(Dt,Bt,jt),programBinder:fs,layerBinder:ci,stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(Da,Pa,La,ja,Ca),tileBinder:Jd(Qd,ic,tc,oc),cullMethod:rd(ul,hl)},{identify:!0,programName:"demMesh2",vaoCreator:Mn,programBinder:Kr($r,qr),stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(Da,Aa,ja),tileBinder:Jd(Qd,tc,oc),cullMethod:ml},{depthTest:!0,programName:"demMesh2",vaoCreator:Mn,programBinder:Kr($r,qr),layerBinder:ci,stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(Da,ja),tileBinder:Jd(Qd,oc)}],ground2:[{programName:"demGround2",vaoCreator:Sn,programBinder:$r,tileBinder:Jd(Qd,ic,oc),stateBinder:so,needsVisibilityBuffer:!1,objectBinder:Ga(ja)}],hillshade:[{programName:"demHillshade",vaoCreator:Tn,stateBinder:vo,needsVisibilityBuffer:!1,programBinder:$r,objectBinder:Ga(ja),tileBinder:Jd(Qd,oc)}],flatBottom:[{programName:"demFlatBottom",vaoCreator:In,stateBinder:_o,needsVisibilityBuffer:!1,objectBinder:Ga(za,ja),tileBinder:Jd(Qd,oc),cullMethod:cl}]},mapMesh:{fill:[{programName:"mapMesh",vaoCreator:Pn,stateBinder:xo,needsVisibilityBuffer:!1,zoomBinder:Ga(Ba),commonBinder:Wt(Dt,Bt,jt),programBinder:fs,layerBinder:di(ci,ui),objectBinder:Ga(Na,Oa,ja,Ra,Ua),tileBinder:Jd(ic,Qd,oc),cullMethod:ll,subRenderIndex:Number.MAX_SAFE_INTEGER,is3dMapAware:!0},{identify:!0,programName:"mapMesh",vaoCreator:Pn,stateBinder:so,needsVisibilityBuffer:!1,zoomBinder:Ga(Ba),commonBinder:Wt(Dt,Bt,jt),programBinder:fs,layerBinder:di(ci,ui),objectBinder:Ga(Na,Oa,ja,Ra,Ua),tileBinder:Jd(Qd,oc),cullMethod:ll,subRenderIndex:Number.MAX_SAFE_INTEGER,is3dMapAware:!0},{depthTest:!0,programName:"mapMesh",vaoCreator:Pn,stateBinder:so,needsVisibilityBuffer:!1,zoomBinder:Ga(Ba),commonBinder:Wt(Dt,Bt,jt),programBinder:fs,layerBinder:di(ci,ui),objectBinder:Ga(Oa,ja,Ra,Ua),tileBinder:Jd(Qd,oc),subRenderIndex:Number.MAX_SAFE_INTEGER,is3dMapAware:!0},{programName:"meshShadow",shadow:!0,vaoCreator:Ki,stateBinder:Po,needsVisibilityBuffer:!1,programBinder:$r,objectBinder:Ga(Oa,ja,Ra),tileBinder:Jd(Qd,oc),is3dMapAware:!0}]},globe:{fill:[{programName:"globe",vaoCreator:Ln,stateBinder:so,objectBinder:Ga(ca),tileBinder:ec,needsVisibilityBuffer:!1,is3dMapAware:!0},{identify:!0,programName:"globe",vaoCreator:Ln,stateBinder:so,objectBinder:Ga(ca),tileBinder:ec,needsVisibilityBuffer:!1,is3dMapAware:!0}]}},this.addExtension("OES_vertex_array_object").addExtension("OES_element_index_uint").addExtension("OES_standard_derivatives").addExtension("OES_texture_float").addExtension("OES_texture_float_linear").addExtension("ANGLE_instanced_arrays").addExtension("WEBGL_depth_texture").addExtension("EXT_frag_depth").addExtension("EXT_blend_minmax"),2===ru.webglVersion&&this.addExtension("EXT_color_buffer_float"),this.setPixelRatio(window.devicePixelRatio).setSize(t.layout.mapContainer.clientWidth,t.layout.mapContainer.clientHeight),e.collectStats&&(this.timers=new gc(this._gl)),t.layout.canvas.addEventListener("webglcontextlost",this.trackContextLost)}get isDestroyed(){return this.destroyed}getViewportSize(e=1){const t=this.getPixelRatio();return this.state.size.map((i=>Math.floor(i*t/e)))}setClearColor(e){const t=(0,te.m2)(e);if(!(0,we.vZ)(t,this.clearColor))return this.clearColor=t,this.addRerenderEvent(),this}setSize(e,t){return this.modules.layout.setCanvasSize(e,t),this.updateFrameBuffersSize(),this}updateFrameBuffersSize(){var e;this.framebuffers.forEach((e=>{e&&e.onResize()}));const t=this.getPixelRatio(),i=this.state.size.map((e=>Math.ceil(e*t)));null===(e=this.modules.postEffectsManager)||void 0===e||e.invalidateSize(),this.identifyBuffer.setSize(i.map((e=>Math.ceil(e*T.identify.pixelDensity)))),this.labelingTextureBuffer.setSize(i),this.spriteLabelingTextureBuffer.setSize(i)}clear(e=!0){return this.clearWithColor(this.clearColor,e),this}addRerenderEvent(e){this.state.rerenderEvents.push(e||{type:"coreNeedRerender"})}isNeedRerender(e=!1){return this.state.needRerender||(e?this.state.rerenderEvents.filter((e=>"layerAnimationTicker"!==e.type)):this.state.rerenderEvents).length>0}clearWithColor(e,t=!0,i=1){const n=this._gl,o=!0===t?n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT:n.COLOR_BUFFER_BIT,r=t?zo:ko;this.applyGpuState(r),n.clearDepth(i),n.clearColor(e[0],e[1],e[2],e[3]),n.clear(o)}getGlobeRenderTarget(e){if(e=(0,we.uZ)(Math.trunc(e),1,4),!this.globeRenderTargets[e]){const t=this._gl,i=(0,we.uZ)(self.devicePixelRatio,1,2),n=Math.min(this.webglContextState.MAX_TEXTURE_SIZE,G.on*e*i),o=new st({size:[n,n],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping});this.addFramebuffer({clearColor:[0,0,0,0],renderTarget:o,renderIndex:0,onResize:()=>{},onRenderStart:()=>{t.activeTexture(t.TEXTURE0+ou),t.bindTexture(t.TEXTURE_2D,null)}}),this.globeRenderTargets[e]=o}return this.globeRenderTargets[e]}renderTileObjects(e){this.state.collectStats&&this.timers&&this.timers.addTimer();let t=!1,i=!1;const n=this.getRenderObjectsByGroups(e,!1);if(this.lastRenderedFramebuffers.forEach((e=>{n.groups.some((t=>t.framebuffer===e))||this.clearFramebuffer(e)})),this.lastRenderedFramebuffers=[],n.groups.forEach((e=>{var o,r,s,a;const{objects:l,tileObjects:d,isUnderCache:c}=e;let{framebuffer:u}=e;const h=this.modules.map.state.demMode&&(void 0===u||!0===u.useDem),m=!u,f=(null==u?void 0:u.isCacheFramebuffer)&&!this.modules.renderCacheManager.hasReadyCache(),_=!u&&this.modules.postEffectsManager.hasActiveEffects();_&&(u=this.modules.postEffectsManager.mainFrameBufferWrapper);const p=Pr(this.state,this.modules,n.tiers,null==u?void 0:u.renderTarget,h);if(u)null===(o=u.onRenderStart)||void 0===o||o.call(u),this.lastRenderedFramebuffers.push(u),u.renderTarget.bind(this._gl),this._gl.viewport(0,0,u.renderTarget.options.size[0],u.renderTarget.options.size[1]),u.clearColor&&(!_||_&&c)&&this.clearWithColor(u.clearColor,!!u.clearDepth);else{const{size:e,viewport:t}=this.state,i=window.devicePixelRatio;this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,null),this._gl.viewport(t.left*i,t.bottom*i,e[0]*i,e[1]*i),m&&c&&this.clear(!0)}if(m||f){(m&&c||h&&f)&&this.modules.environmentManager.renderSky();const e=h&&m&&(!this.modules.renderCacheManager.hasCachedObjects()||this.hasAnimatedFlatObjectInDemMode)&&!t,o=h&&f&&this.modules.renderCacheManager.hasCachedObjects()&&!this.hasAnimatedFlatObjectInDemMode&&!i;n.flatObjectsGroup&&(e||o)&&(o&&(i=!0),e&&(t=!0),this.renderDemMesh(p,n.flatObjectsGroup,!1,u))}if(l.length){const e=null!==(s=null===(r=null==u?void 0:u.getViewProjectionMatrix)||void 0===r?void 0:r.call(u))&&void 0!==s?s:this.modules.camera.viewProjectionMatrix,t=h?this.modules.demManager.demTextureMatrix:void 0;d.forEach((i=>{i.updateMvpMatrix(e,t)})),er(this.state,this.modules,l,p)}m&&c&&this.modules.renderCacheManager.render(),null==u||u.renderTarget.unbind(this._gl),null===(a=null==u?void 0:u.onRenderEnd)||void 0===a||a.call(u),_&&!c&&this.modules.postEffectsManager.render()})),this.state.collectStats&&this.timers){this.timers.stopTimer();const e=this.timers.tryToGetFirstTimerValue();e&&this.modules.map.emit("gpuRenderTime",e)}return this}renderElevation(e){var t,i,n,o;if(!this.state.demMode)return;const r=[];if(e.forEach((e=>{e.children.forEach((e=>{"dem"===e.symbol&&"elevation"===e.sink&&r.push(e)}))})),!r.length)return;const s=this.modules.demManager.getDemFramebufferId();if(s===ai.ze)return;const a=this.getFramebuffer(s);if(!a)return;const l=Pr(this.state,this.modules,void 0,a.renderTarget);null===(t=a.onRenderStart)||void 0===t||t.call(a),a.renderTarget.bind(this._gl),this._gl.viewport(0,0,a.renderTarget.options.size[0],a.renderTarget.options.size[1]),a.clearColor&&this.clearWithColor(a.clearColor,!!a.clearDepth);const d=null!==(n=null===(i=a.getViewProjectionMatrix)||void 0===i?void 0:i.call(a))&&void 0!==n?n:this.modules.camera.viewProjectionMatrix;e.forEach((e=>{e.updateMvpMatrix(d)})),er(this.state,this.modules,r,l),a.renderTarget.unbind(this._gl),null===(o=a.onRenderEnd)||void 0===o||o.call(a)}renderSpriteLabelingTexture(e){if(this.modules.renderCacheManager.hasReadyCache())return;const t=this._gl,i=[],n=Pr(this.state,this.modules,void 0,this.spriteLabelingTextureBuffer,this.modules.map.state.demMode),o=e.filter((e=>e.labelTestChildren[0]));o.forEach((e=>{e.updateMvpMatrix(this.modules.camera.viewProjectionMatrix,this.modules.demManager.demTextureMatrix)})),o.forEach((e=>{e.labelTestChildren.forEach((e=>{!0===e.attributes.labelTest&&i.push(e)}))})),this.spriteLabelingTextureBuffer.bind(t),this.clearWithColor([1,1,1,1]),t.viewport(0,0,this.spriteLabelingTextureBuffer.options.size[0],this.spriteLabelingTextureBuffer.options.size[1]),er(this.state,this.modules,i,n),this.spriteLabelingTextureBuffer.unbind(t)}renderLabelingTexture(e){if(this.modules.renderCacheManager.hasReadyCache())return;if(this.state.isLabelingDepthTestDisabled=!0,this.state.styleZoom<16||0===this.state.pitch||this.state.disableHidingPois)return;const t=this._gl,i=[],n=Pr(this.state,this.modules,void 0,this.labelingTextureBuffer,this.modules.map.state.demMode),o=e.filter((e=>e.depthTestChildren[0]));o.forEach((e=>{e.updateMvpMatrix(this.modules.camera.viewProjectionMatrix,this.modules.demManager.demTextureMatrix)})),o.forEach((e=>{e.depthTestChildren.forEach((e=>{const t=this.modules.styleManager.getStyleLayer(e.attributes.styleId,e.attributes.layerId);(t&&"gltfModel"!==t.type||!(null==t?void 0:t.style.preventObjectsHiding))&&i.push(e)}))})),this.state.isLabelingDepthTestDisabled=!1,this.labelingTextureBuffer.bind(t),this.clearWithColor(Ps.KJ),t.viewport(0,0,this.labelingTextureBuffer.options.size[0],this.labelingTextureBuffer.options.size[1]),er(this.state,this.modules,i,n),this.labelingTextureBuffer.unbind(t)}renderIdentify(e){const t=this._gl,i=this.getRenderObjectsByGroups(e,!0);i.groups.forEach((({objects:e,tileObjects:n,framebuffer:o,isUnderCache:r})=>{var s,a,l;const d=this.modules.map.state.demMode&&(void 0===o||!0===o.useDem),c=o?o.renderTarget:this.identifyBuffer,u=Pr(this.state,this.modules,i.tiers,c,d);if(c.bind(t),(c!==this.identifyBuffer||r)&&this.clearIdentify(),d&&i.flatObjectsGroup&&this.renderDemMesh(u,i.flatObjectsGroup,!0),c.bind(t),t.viewport(0,0,c.options.size[0],c.options.size[1]),e.length){const t=null!==(a=null===(s=null==o?void 0:o.getViewProjectionMatrix)||void 0===s?void 0:s.call(o))&&void 0!==a?a:this.modules.camera.viewProjectionMatrix,i=d?this.modules.demManager.demTextureMatrix:void 0;n.forEach((e=>{e.updateMvpMatrix(t,i)})),er(this.state,this.modules,e,u)}c.unbind(t),null==o||o.renderTarget.unbind(this._gl),null===(l=null==o?void 0:o.onRenderEnd)||void 0===l||l.call(o)}))}waitForGpuCommandsToFinish(){this.readPixelsFloat(0,0,1,1,null)}readPixelsFloat(e,t,i,n,o){const r=this._gl;r.readPixels(e,t,i,n,r.RGBA,r.FLOAT,o)}readIdentifyPixels(){const e=this._gl,t=this.identifyBuffer.options.size,i=new Uint8Array(t[0]*t[1]*4);return this.identifyBuffer.bind(e),e.readPixels(0,0,t[0],t[1],e.RGBA,e.UNSIGNED_BYTE,i),this.identifyBuffer.unbind(e),i}getRenderingContext(){return this._gl}getShaderProgram(e,t){var i,n;let o=this.shaderPrograms[e];o||(o={},this.shaderPrograms[e]=o);let r=o[this.commonShaderDefines.hash];r||(r={},o[this.commonShaderDefines.hash]=r);const s=null!==(i=null==t?void 0:t.hash)&&void 0!==i?i:"",a=null!==(n=null==t?void 0:t.defines)&&void 0!==n?n:[];let l=r[s];return l||(l=new It(this._gl,this.shaderProgramOptions[e],wt.e.createShaderDefinitions([...this.commonShaderDefines.defines,...a]),Zc),r[s]=l),l}enableShaderProgram(e){e.enable()}bindShaderProgram(e,t,i){e.bind(t,i)}destroy(){if(this.destroyed)return;this.lastRenderedFramebuffers=[],this.framebuffers.forEach((e=>{null==e||e.renderTarget.remove()})),this.modules.layout.canvas.removeEventListener("webglcontextlost",this.trackContextLost);const e=this._gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.modules.layout.destroy(),this.mapMeshFramebufferId=void 0,this.mapMeshIdFramebufferId=void 0,this.destroyed=!0}addFramebuffer(e){return this.framebuffers.push(e),this.framebuffers.length-1}getFramebuffer(e){if(e!==ai.ze)return this.framebuffers[e]}removeFramebuffer(e){var t;null===(t=this.framebuffers[e])||void 0===t||t.renderTarget.remove(),this.framebuffers[e]=void 0}setRenderTarget(e){this.currentTarget=e;const t=this._gl;if(e)e.bind(t),t.viewport(0,0,e.options.size[0],e.options.size[1]);else{t.bindFramebuffer(t.FRAMEBUFFER,null);const{size:e,viewport:i}=this.state,n=window.devicePixelRatio;t.viewport(i.left*n,i.bottom*n,e[0]*n,e[1]*n)}}getRenderTarget(){return this.currentTarget}getDrawTargetFramebuffer(e){const t=this.drawTargetsFramebufferIds.get(e);if(void 0!==t)return this.getFramebuffer(t)}doesDrawTargetFramebufferExist(e){return this.drawTargetsFramebufferIds.has(e)}getDrawTargetFramebufferId(e){let t=this.drawTargetsFramebufferIds.get(e);if(void 0!==t)return t;const i={renderTarget:new st({size:this.getViewportSize(),magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,depthTexture:!0,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,generateMipmaps:!1,format:2===this.state.webglVersion?nt.RedFormat:nt.RgbFormat}),clearColor:[0,0,0,0],clearDepth:!0,onResize:()=>{i.renderTarget.setSize(this.getViewportSize())},renderIndex:-1/0,useDem:!1};return t=this.modules.renderer.addFramebuffer(i),this.drawTargetsFramebufferIds.set(e,t),t}renderDemMesh(e,t,i=!1,n){const{framebuffer:o,tiles:r}=t;if(!o)return;let s=this.modules.demManager.getFlatMapTextures();if(i&&(s=s.filter((e=>0===e.detailLevel))),!s.length)return;const a=this.modules.demManager.getMeshTiles();if(!a.length)return;const l=a[0],d=(i?l.identifyChildren:l.children).filter((({sink:e})=>"mesh"===e||"mesh2"===e))[0];if(!d)return void 0;const c=this.state.handyStyleId,u=this.modules.styleManager.getStyleLayer(c,zn.he);if(!u||jd(d))return;const{size:h,viewport:m}=this.state,f=window.devicePixelRatio,{commonBinder:_,programBinder:p,layerBinder:v,programName:g}=d.layerSettings,y=this.getShaderProgram(g),b=[];r.forEach(((e,t)=>{b.push({objects:e,tile:t})}));const x=e.copy(o.renderTarget,!1,!0);s.forEach((t=>{var r,s;const l=b.filter((e=>su(t.viewport,e.tile.bounds.values()))).reduce(((e,i)=>(i.tile.updateMvpMatrix(t.mvpMatrix,this.modules.demManager.demTextureMatrix),e.concat(i.objects))),[]);if(null===(r=o.onRenderStart)||void 0===r||r.call(o),o.renderTarget.bind(this._gl),this._gl.viewport(0,0,o.renderTarget.options.size[0],o.renderTarget.options.size[1]),o.clearColor&&this.clearWithColor(o.clearColor,!1),er(this.state,this.modules,l,x),o.renderTarget.unbind(this._gl),null===(s=o.onRenderEnd)||void 0===s||s.call(o),i){this.identifyBuffer.bind(this._gl);const e=this.identifyBuffer.options.size;this._gl.viewport(0,0,e[0],e[1])}else n?(this._gl.viewport(0,0,n.renderTarget.options.size[0],n.renderTarget.options.size[1]),n.renderTarget.bind(this._gl)):this._gl.viewport(m.left*f,m.bottom*f,h[0]*f,h[1]*f);this.enableShaderProgram(y),this._gl instanceof WebGLRenderingContext&&(null==_||_(y,this.state,this.modules)),null==p||p(y,this.state,this.modules,!0),null==v||v(y,this.state,this.modules,u),e.useState(d,u),a.forEach((n=>{if(n instanceof Rn&&n.needSync&&n.syncReplicas(this.state),su(t.viewport,n.bounds.values())){n.updateMvpMatrix(this.modules.camera.viewProjectionMatrix,this.modules.demManager.demTextureMatrix,t.texMatrix);const o=(i?n.identifyChildren:n.children).filter((({sink:e})=>"mesh"===e||"mesh2"===e));Ir(o,this.state,this.modules),e.drawSymbol(o,u,this.state,this.modules)}})),i&&this.identifyBuffer.unbind(this._gl)}))}getMapMeshFramebufferId(){return void 0===this.mapMeshFramebufferId&&(this.mapMeshFramebufferId=this.createMapMeshFramebuffer()),this.mapMeshFramebufferId}getMapMeshIdFramebufferId(){return void 0===this.mapMeshIdFramebufferId&&(this.mapMeshIdFramebufferId=this.createMapMeshFramebuffer(!0)),this.mapMeshIdFramebufferId}prerenderUpdate(){const e=this.rebuildExternalShaderDefinitions();this.updateUbos(e)}getRenderObjectsByGroups(e,t){const{demManager:i,map:n}=this.modules,{demMode:o}=n.state,r={},s={framebuffer:void 0,objects:[],tileObjects:new Set},a={framebuffer:void 0,objects:[],tileObjects:new Set,isUnderCache:!0},l={};let d;if(o){const e=t?i.getIdentifyFlatFramebufferId():i.getFlatFramebufferId(),n=this.getFramebuffer(e);n&&(d={framebuffer:n,tiles:new Map})}this.hasAnimatedFlatObjectInDemMode=!t&&o&&e.some((e=>e.children.some((e=>!e.layerSettings.is3dMapAware&&this.modules.renderCacheManager.isLayerAnimated(e.attributes.styleId,e.attributes.layerId))))),e.forEach((e=>{(t?e.identifyChildren:e.children).forEach((i=>{var n;const c=this.modules.demManager.getReliefTileType();if("raster"===c&&"ground2"===i.sink||"vector"===c&&"ground"===i.sink)return;if("mesh2"===i.sink)return;const{ids:u,defaultId:h}=this.modules.styleManager.getFramebufferId(i.attributes.styleId,i.attributes.layerId),m=u?u[i.sink]:h;if(m!==ai.ze)if(void 0!==m)r[m]||(r[m]={framebuffer:this.getFramebuffer(m),objects:[],tileObjects:new Set}),r[m].objects.push(i),r[m].tileObjects.add(e);else{const c=i.attributes.tiers;if(this.state.immersiveLevel.tiers&&c){let t=!1;if(c.forEach((n=>{n?(l[n]||(l[n]={objects:[],tileObjects:new Set}),l[n].objects.push(i),l[n].tileObjects.add(e)):t=!0})),!t)return}if(o&&!i.layerSettings.is3dMapAware)(null==d?void 0:d.tiles.has(e))?null===(n=null==d?void 0:d.tiles.get(e))||void 0===n||n.push(i):null==d||d.tiles.set(e,[i]),this.hasAnimatedFlatObjectInDemMode||this.modules.renderCacheManager.markLayerInCache(i.attributes.styleId,i.attributes.layerId);else if(t)a.objects.push(i),a.tileObjects.add(e);else{const t=this.modules.renderCacheManager.tryToCacheObjects(r,i,e,o);if(t===Xc.CACHED)return;t===Xc.RENDER_OVER_CACHE?(s.objects.push(i),s.tileObjects.add(e)):(a.objects.push(i),a.tileObjects.add(e))}}}))}));const c=Object.values(r).filter((e=>!!e.framebuffer));if(c.sort(((e,t)=>{var i,n,o,r;return(null!==(n=null===(i=e.framebuffer)||void 0===i?void 0:i.renderIndex)&&void 0!==n?n:0)-(null!==(r=null===(o=t.framebuffer)||void 0===o?void 0:o.renderIndex)&&void 0!==r?r:0)})),c.push(a),!t){c.findIndex((e=>{var t;return null===(t=e.framebuffer)||void 0===t?void 0:t.isCacheFramebuffer}))>=0?s.objects.push(...this.modules.styleManager.getCustomSceneObjects()):a.objects.push(...this.modules.styleManager.getCustomSceneObjects())}return c.push(s),{flatObjectsGroup:d,groups:c,tiers:l}}getUbo(e){return this.ubosMap[e]}getMemoryFootprint(){const e={framebuffers:this.framebuffers.filter((e=>void 0!==e)).map((e=>e.renderTarget.memSizeGPU())),identifyBuffer:this.identifyBuffer.memSizeGPU(),labelingTextureBuffer:this.labelingTextureBuffer.memSizeGPU()};return{gpu:Object.assign(Object.assign({},e),{"--sum":(0,Ke.QE)(e)})}}bindRenderTarget(e){const t=this._gl;e?e.bind(t):t.bindFramebuffer(t.FRAMEBUFFER,null)}isUboSupported(){return!(this._gl instanceof WebGLRenderingContext)}isWebgl2Context(){return!(this._gl instanceof WebGLRenderingContext)}fragDepthSupported(){return this.isWebgl2Context()||Boolean(this.modules.renderer.webGlExtensions.EXT_frag_depth)}updateUbos(e=!1){var t;const i=this._gl;if(i instanceof WebGLRenderingContext)return;e&&this.cleanupUbos(i);const n=this.getShaderProgram("diffuse");n.link(),n.locate();let o=this.ubosMap.CommonSettings;o&&!e||(o=new Vc({gl:i,blockName:"CommonSettings",uniformNames:Wc.CommonSettings}),this.ubosMap.CommonSettings=o,o.bind(n)),Xt(n,this.state,this.modules,o),o.commitData();const r=this.modules.map.state,s=!isNaN(r.handyStyleId)&&this.modules.styleManager.getStyle(r.handyStyleId)||void 0,a=null!==(t=null==s?void 0:s.light.lightingModesResolved)&&void 0!==t?t:li.r;for(const t in a){let o=this.ubosMap[t];o&&!e||(o=new Vc({gl:i,blockName:"LightSettings",uniformNames:Wc.LightSettings}));const r=a[t];o.updateData(n,{u_vec3_light_dir1_direction:r.dir1Direction,u_vec4_light_dir1_color:r.dir1ColorIntensity,u_vec3_light_dir2_direction:r.dir2Direction,u_vec4_light_dir2_color:r.dir2ColorIntensity,u_vec4_ambient_color:r.ambientColorIntensity}),this.ubosMap[t]=o,o.commitData()}}cleanupUbos(e){for(const e in this.ubosMap)this.ubosMap[e].cleanup();this.ubosMap={};for(let t=0;t<this.webglContextState.MAX_UNIFORM_BUFFER_BINDINGS;t++)e.bindBufferBase(e.UNIFORM_BUFFER,t,null)}rebuildExternalShaderDefinitions(){const e=this.prepareExternalShaderDefinitions();return this.commonShaderDefines.hash!==e.hash&&(this.commonShaderDefines=e,!0)}clearIdentify(){const e=this._gl;e.depthMask(!0),e.clearColor(iu[0],iu[1],iu[2],iu[3]),e.clearDepth(1),e.clearStencil(0),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)}clearFramebuffer(e){e.clearColor&&(e.renderTarget.bind(this._gl),this._gl.viewport(0,0,e.renderTarget.options.size[0],e.renderTarget.options.size[1]),this.clearWithColor(e.clearColor,!1),e.renderTarget.unbind(this._gl))}createMapMeshFramebuffer(e){const t=this.getRenderingContext(),i=e?nt.NearestFilter:nt.LinearFilter,{scale:n,size:o}=this.calculateMapMeshParams(e),r=new st({size:o,magFilter:i,minFilter:i,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping}),s={getViewProjectionMatrix:()=>{var t;const i=1-Math.cos(this.modules.map.state.pitch),n=null!==(t=s.scale)&&void 0!==t?t:this.calculateMapMeshParams(e).scale;return it.wA(nu,[0,i/n[1],0],[1/n[0],1/n[1],1]),it.Jp(this.mapMeshMvpMatrix,nu,this.modules.camera.viewProjectionMatrix),this.mapMeshMvpMatrix},onResize:()=>{const i=this.calculateMapMeshParams(e);s.scale=i.scale,r.setSize(i.size),r.bind(t),r.unbind(t)},renderTarget:r,scale:n};return this.addFramebuffer(s)}calculateMapMeshParams(e){const t=e?T.identify.pixelDensity:1,i=window.devicePixelRatio,n=O.bA([],this.modules.map.state.size,i),o=Math.min(1.3,Math.min(this.webglContextState.MAX_TEXTURE_SIZE,this.webglContextState.MAX_VIEWPORT_DIMS[0])/n[0]),r=Math.min(2,Math.min(this.webglContextState.MAX_TEXTURE_SIZE,this.webglContextState.MAX_VIEWPORT_DIMS[1])/n[1]);return{scale:[o,r],size:[Math.trunc(n[0]*t*o),Math.trunc(n[1]*t*r)]}}prepareExternalShaderDefinitions(){const e=[];return this.webGlExtensions.EXT_frag_depth&&e.push({type:"HAS_FRAG_DEPTH_EXT"}),this.modules.environmentManager.isFogEnabled()&&e.push({type:"FOG"}),this.modules.environmentManager.isSkyEnabled()&&e.push({type:"SKY"}),this.modules.shadowManager.texture&&e.push({type:"RENDER_SHADOWS"}),this.state.aaMode===Ur.FXAA?e.push({type:Nr.FXAA}):this.state.aaMode===Ur.TAA&&e.push({type:Nr.TAA}),ft(this._gl)&&e.push({type:"DEPTH_TEXTURE_SHADOW"}),this.webglContextState.MAX_UNIFORM_BUFFER_BINDINGS>0&&e.push({type:"UBO"}),this.state.isDeprecatedSystem?e.push({type:"VARYINGS_LIMIT_9"}):(e.push({type:"SCREENDOOR"}),e.push({type:"ENTRANCE_ARROWS_ROUNDING"})),this.webglContextState.RENDERER.toLowerCase().includes("mali")&&this.webglContextState.VENDOR.toLowerCase().includes("arm")&&e.push({type:"MALI_GPU"}),wt.e.createShaderDefinitions(e)}}function su(e,t){for(const i of t)if((0,jn.M4)(e,i))return!0;return!1}ru.webglVersion=NaN;class au{constructor(e,t){this.idScopes={},this.isIdle=()=>0===this.searchQueue.size,this.state=e,this.modules=t,this.identifyData=[],this.needsUpdate=!1,this.forceUpdate=!1,this.searchQueue=new Map,this.stateDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"}]),this.debouncedFillCache=(0,qe.D)((()=>{this.needsUpdate=!0}),T.identify.cacheDebounceTime),this.throttledFillCache=(0,Ue.P)((()=>{this.needsUpdate=!0}),T.identify.cacheThrottleTime)}getMemoryFootprint(){var e,t;const i={colorBuffer:null!==(t=null===(e=this.colorBuffer)||void 0===e?void 0:e.byteLength)&&void 0!==t?t:0};return{js:Object.assign(Object.assign({},i),{"--sum":(0,Ke.QE)(i)})}}resetCache(){this.colorBuffer=void 0,this.debouncedFillCache()}search(e,t,i=!1){return void 0===this.colorBuffer&&i&&(this.needsUpdate=!0),this.forceUpdate=i,new Promise((i=>{this.searchQueue.set(e,{point:t,resolve:i})}))}searchSync(e){return this.searchHigherPriority(e)}update(){this.stateDiffer.check(this.state)&&(this.resetCache(),this.searchQueue.size>0&&this.searchQueue.clear()),this.needsUpdate&&(this.forceUpdate||this.modules.dynamicStyle.hasDynamicObjects||this.modules.tileManager.isIdle()&&this.modules.labeler.isIdle()&&this.modules.layers.entranceAnimationFinished()&&this.modules.modelLayer.isIdle()&&!this.modules.buildingHeightAnimator.isAnimating()&&this.modules.assetManager.isIdle())&&(this.fillCache(),this.needsUpdate=!1,this.forceUpdate=!1),void 0!==this.colorBuffer&&this.searchQueue.size>0&&(this.searchQueue.forEach((e=>{e.resolve(this.searchHigherPriority(e.point))})),this.searchQueue.clear())}getIdScope(e){return this.idScopes[e]||(this.idScopes[e]=new Ya.Q0(this)),this.idScopes[e]}searchHigherPriority(e){const{viewport:t}=this.state,i=O.al(e[0]-t.left,e[1]-t.top),n=this.state.identifyPickDistance*window.devicePixelRatio;let o,r=1/0,s=!1;const a=O.Ue();for(a[0]=i[0]-n;a[0]<i[0]+n;a[0]++)for(a[1]=i[1]-n;a[1]<i[1]+n;a[1]++){const e=this.searchPointInCache(a);if(!e)continue;const t=void 0!==e.dynamicObjectId;if(t&&(e.phase=this.modules.dynamicStyle.getRenderIndexById(e.layerId)),s&&!t)continue;const n=O.TE(i,a);(!o||!s&&t||e.phase>o.phase||e.phase===o.phase&&n<r)&&(o=e,r=n,t&&(s=!0))}return o}searchPointInCache(e){if(void 0===this.colorBuffer)return;const t=T.identify.pixelDensity*window.devicePixelRatio,i=this.modules.renderer.identifyBuffer.options.size,n=this.state.size;if(e[0]<0||e[0]>n[0]-1||e[1]<0||e[1]>n[1]-1)return;const o=Math.floor(e[0]*t),r=4*((i[1]-1-Math.floor(e[1]*t))*i[0]+o),s=(this.colorBuffer[r+3]<<24|this.colorBuffer[r+2]<<16|this.colorBuffer[r+1]<<8|this.colorBuffer[r])>>>0;return this.indexToIdentifierResponse(s)}fillCache(){const e=this.modules.tileManager.getTileObjects();this.modules.renderer.renderIdentify(e),this.colorBuffer=this.modules.renderer.readIdentifyPixels();const t=this.state.metrics;void 0===t.interactive&&(t.interactive=performance.now()-t.start),this.identifyData=this.modules.tileManager.getDisplayedIdentifyData(),this.modules.modelLayer.getDisplayedIdentifyData().forEach((e=>this.identifyData.push(e)));const i=this.modules.personalPoiManager.getIdentifyDataChunk();void 0!==i&&this.identifyData.push(i),this.modules.layers.getDynamicObjectLayers().forEach((e=>{e.getIdentifyData().forEach((e=>this.identifyData.push(e)))}))}indexToIdentifierResponse(e){var t,i,n;for(let o=0;o<this.identifyData.length;o++){const r=this.identifyData[o],{dynamicObjectId:s,ids:a,metatileHash:l,sourceId:d,tileKey:c}=r,{startIndex:u,endIndex:h,idBuffer:m,floorIdBuffer:f,phaseBuffer:_,sublayerBuffer:p,styleIdBuffer:v,layerIdBuffer:g,instanceIdBuffer:y,objectClassBuffer:b,centerBuffer:x,strings:w}=a;if(e<u||e>h)continue;const S=e-u,M=m[S],I=new Uint32Array(p)[S],T=new Uint8Array(y)[S],E=new Uint32Array(b)[S];let P,A="";const L=f[S],C=this.modules.assetManager.getMetatile(l);if(C){(null===(t=C.reverseDictionaries.db_sublayer)||void 0===t?void 0:t[I])&&(P=C.reverseDictionaries.db_sublayer[I]);const o=w[e];A=void 0!==o?o.objectClass:null!==(n=null===(i=null==C?void 0:C.reverseDictionaries.db_object_class)||void 0===i?void 0:i[E])&&void 0!==n?n:""}const z=new Uint16Array(v)[S],k=new Uint32Array(g)[S],O=this.modules.styleManager.getStyleLayer(z,k);if(!O||"custom"===O.type)return;const R=new Int32Array(x,S*Int32Array.BYTES_PER_ELEMENT*2,2);return{id:M,styleId:z,layerId:k,floorId:L,phase:new Float32Array(_)[S],dynamicObjectId:s,sourceId:d,tileKey:c,sublayer:P,symbol:O.type,instanceId:T,objectClass:A,center:R[0]!==G.Cd||R[1]!==G.Cd?[R[0],R[1]]:void 0}}}}var lu=i(6479),du=i(3487),cu=i(4576),uu=i(1284);function hu(e){const t=new uu.x;let i;for(const n of e.layers)void 0!==n.groupId&&i&&n.groupId===i.groupId?n.renderIndex=i.renderIndex:n.renderIndex=t.getIndex(),i=n;for(const t in e.groupsById){const i=e.groupsById[t];i&&(i.layers[0]&&(i.renderIndex=i.layers[0].renderIndex))}}var mu=i(199);function fu(e,t,i){const{map:{state:n},collector:o,imageManager:r,renderer:s,tileManager:a}=i;let l;try{l=function(e,t,i){const n=(0,te.jJ)(e.styleZoom,e.styleState,[]),o=t.style.color,r=[];if(s=o.argument,"object"!=typeof s||"heatmap-density"!==s.type)throw new Error(`Heatmap color must be interpolate expression with 'heatmap-density' argument in layer ${t.id}`);var s;const a=i-1;for(let e=0;e<i;e++){const t=e/a,i=(0,te.o4)(o,t,n);r.push(...i.value)}return new nt(new Uint8Array(r),{size:[i,1]})}(n,e,256)}catch(e){return void console.error(e)}const d=r.addPreparedTexture(l),{downscale:c}=e.style,{size:u}=n,h=new st({size:[Math.ceil(u[0]*window.devicePixelRatio/c),Math.ceil(u[1]*window.devicePixelRatio/c)],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping}),m=h.getTexture();if(!m)return void console.error("Can't init HeatMap Layer. Missing FrameBuffer texture");const f=r.addPreparedTexture(m),_=s.addFramebuffer({renderTarget:h,clearColor:[0,0,0,0],onResize:()=>{h.setSize([Math.ceil(n.size[0]*window.devicePixelRatio/c),Math.ceil(n.size[1]*window.devicePixelRatio/c)]),s.bindRenderTarget(h),s.bindRenderTarget(null);const e=h.getTexture();e&&r.updatePreparedTexture(f,e)}});(0,q.XI)({collector:o,generator:vi.B.generateTexture,args:[t,e,f,d]});const p=o.getAccumulatedData(),v=new R.W("dynamicObject",p.data,i,n);return a.addObject(v),o.reset(),e.framebufferId={framebuffer:_},e=>{a.removeObject(v),v.clean(e),r.deleteTexture(f),r.deleteTexture(d),s.removeFramebuffer(_)}}const _u={type:"color",value:[0,0,0,0]};class pu{constructor(e){this.modules=e,this.customLayers=new Map,this.maxCountStyleLayers=1e4,this.styleIndex=1,this.handyStylesMap=new Map,this.waitingStyleRequests=new Map,this.onRemoveLayerHooks=new Map}createStyle(e,t,i){const{state:n}=this.modules.map;if(!Number.isNaN(n.handyStyleId)){const e=this.getStyle(n.handyStyleId);e&&(e.layers.forEach((e=>{const t=this.onRemoveLayerHooks.get(e.innerId);t&&t(n)})),this.onRemoveLayerHooks.clear())}const o=this.styleIndex++;o-li.A>0&&this.handyStylesMap.delete(o-li.A);const r=(0,Q.Cp)(e,o,i);(0,D.As)(r,t),this.handyStylesMap.set(r.id,r),this.setMaxLayersCount(r.layers.length);const s=this.waitingStyleRequests.get(o);return s&&s.resolve(r),this.modules.workers.syncStyle(r),r.layers.forEach((e=>this.initHandyLayer(o,e))),r}hasLayer(e){const t=this.getStyle(this.modules.map.state.handyStyleId);return void 0!==(null==t?void 0:t.layerIdToInnerId[e])}addLayer(e,t){const i=this.getStyle(this.modules.map.state.handyStyleId);if(!i)return void console.error('Cannot add layer before map style was completely set. Please use "styleload" event.');const n=(0,Q.ys)(e);n&&(!function(e,t,i){var n;if(void 0===e.id)throw new Error("The layer id must be set.");if(t.layerIdToInnerId[e.id])throw new Error(`The layer with id «${e.id}» already exists in the map style.`);let o=-1;if(i){const r=Object.values(t.groupsById).find((e=>e&&e.id===i));if(r)o=t.layers.findIndex((e=>e.groupId===r.innerId));else{o=t.layers.findIndex((e=>e.id===i));const r=null===(n=t.layers[o])||void 0===n?void 0:n.groupId;if(void 0!==r&&"group"===e.type)throw new Error(`Group layer with id «${e.id}» can't be added before layer with id «${i}» in group with innerId «${r}». Layer groups doesn't support nesting.`)}}else o=t.layers.length;if(-1===o)throw new Error(`The layer with beforeId «${i}» doesn't exist in the map style.`);let r=[];if("group"!==e.type){r=[e];const i=o!==t.layers.length?t.layers[o]:void 0;if(i&&void 0!==i.groupId){const n=t.groupsById[i.groupId];if(!n)return void(0,Jo.cM)(`Для слоя с id «${i.id}» находящегося в группе с groupId «${i.groupId}» отсутствует группа id в стиле c id «${t.id}»`);const o=n.layers.findIndex((e=>e.id===i.id));if(-1===o)return void(0,Jo.cM)(`Слой с id «${i.id}» и groupId «${i.groupId}» отсутствует группе в стиле c id «${t.id}»`);e.groupId=n.innerId,n.layers.splice(o,0,e),n.layers.forEach(((e,t)=>e.groupIndex=t))}}else t.groupsById[e.innerId]=e,t.layerIdToInnerId[e.id]=e.innerId,r=e.layers;t.revision++,t.layers.splice(o,0,...r),r.forEach((e=>{if(t.layersById[e.innerId]=e,t.layerIdToInnerId[e.id]=e.innerId,"point"===e.type||"polygon"===e.type||"metricPoint"===e.type||"embankment"===e.type||"polygon3d"===e.type){const i=Math.max(0,...Object.keys(t.rasterSets.byIndex).map((e=>Number(e)))),n=new uu.x(i+1);(0,Q.z8)(e,n,t.icons).forEach((e=>{t.rasterSets.byKey[e.key]||(t.rasterSets.byIndex[e.index]=e,t.rasterSets.byKey[e.key]=e)}))}})),hu(t)}(n,i,t),this.setMaxLayersCount(i.layers.length),"custom"===e.type&&"custom"===n.type?this.initCustomLayer(i.id,n,e.render,e.onRemove,e.onAdd):this.initHandyLayer(i.id,n),this.modules.workers.syncStyle(i))}setTerrainStyle(e){const t=this.getStyle(this.modules.map.state.handyStyleId);t&&(t.dem=(0,Q.vR)(e),this.modules.demManager.onTerrainStyleChange(),this.modules.renderer.addRerenderEvent())}addIcon(e,t){const i=this.getStyle(this.modules.map.state.handyStyleId);if(!i)return console.error('Cannot add icons before map style was completely set. Please use "styleload" event.'),!1;const n=i.layers.filter((t=>("point"===t.type||"metricPoint"===t.type)&&void 0!==t.style.iconImage&&(0,te.EG)(t.style.iconImage).some((t=>t===e)))),o=i.layers.filter((t=>("polygon"===t.type||"embankment"===t.type||"polygon3d"===t.type)&&Boolean(t.style.textureImage)&&(0,te.EG)(t.style.textureImage).some((t=>t===e))));if(Boolean(i.icons[e]))return console.error(`The icon with the name ${e} already exists.`),!1;const r=Math.max(0,...Object.keys(i.rasterSets.byIndex).map((e=>Number(e)))),s=new uu.x(r+1);return i.icons[e]=t,[...n,...o].forEach((t=>{(0,Q.Jn)(t).forEach((({imageType:t,anchor:n})=>{const o=(0,Q.Wy)(e,t,s,n,i.icons);i.rasterSets.byIndex[o.index]=o,i.rasterSets.byKey[o.key]=o}))})),i.revision++,this.modules.workers.syncStyle(i),!0}removeIcon(e){const t=this.getStyle(this.modules.map.state.handyStyleId);if(!t)return console.error('Cannot remove icons before map style was completely set. Please use "styleload" event.'),!1;delete t.icons[e];let i=!1;return t.layers.filter((e=>"point"===e.type&&Boolean(e.style.iconImage)||"polygon"===e.type&&Boolean(e.style.textureImage)||"metricPoint"===e.type&&Boolean(e.style.iconImage)||"embankment"===e.type&&Boolean(e.style.textureImage)||"polygon3d"===e.type&&Boolean(e.style.textureImage))).forEach((n=>{(0,Q.Jn)(n).forEach((({image:n,imageType:o,anchor:r})=>{(0,te.EG)(n).forEach((n=>{if(n===e){const e="icon"===o?(0,qa.PR)(n,r[0],r[1]):(0,qa.FD)(n),s=t.rasterSets.byKey[e];s&&(this.modules.assetManager.removeRasterSet(s,t.id),i=!0)}}))}))})),!!i&&(t.revision++,this.modules.workers.syncStyle(t),!0)}addModel(e,t){const i=this.getStyle(this.modules.map.state.handyStyleId);if(!i)return console.error('Cannot add models before map style was completely set. Please use "styleload" event.'),!1;return void 0!==i.modelIndex[e]?(console.error(`The model with the name ${e} already exists.`),!1):(i.models.push(t),i.modelIndex[e]=i.models.length-1,i.revision++,this.modules.workers.syncStyle(i),!0)}removeLayer(e){const t=this.getStyle(this.modules.map.state.handyStyleId);t?mu.T.some((t=>t.id===e))||(!function(e,t,i){const n=t.layerIdToInnerId[e];if(void 0===n)return;t.revision++;let o=[];const r=t.groupsById[n];if(r){if(o=r.layers,delete t.groupsById[n],delete t.layerIdToInnerId[r.id],0===o.length)return}else{const i=t.layersById[n];if(!i)return void(0,Jo.cM)(`Слой с id «${e}» есть в списке идентификаторов слоев стиля, но при этом отсутствует в стиле c id «${t.id}»`);if(void 0!==i.groupId&&void 0!==i.groupIndex){const e=t.groupsById[i.groupId];e&&(e.layers.splice(i.groupIndex,1),e.layers.forEach(((e,t)=>e.groupIndex=t)))}o=[i]}const s=t.layers.findIndex((e=>e.id===o[0].id));-1!==s&&(o.forEach((e=>{const{styleManager:n,map:{state:o}}=i,r=n.getRemoveLayerHook(e.innerId);r&&(r(o),n.clearRemoveLayerHook(e.innerId)),delete t.layersById[e.innerId],delete t.layerIdToInnerId[e.id]})),t.layers.splice(s,o.length),hu(t))}(e,t,this.modules),this.modules.workers.syncStyle(t)):console.error('Cannot remove layer before map style was completely set. Please use "styleload" event.')}showLayers(e){const t=this.getStyle(this.modules.map.state.handyStyleId);t?this.setLayerVisibility("visible",e,t):console.error('Cannot hide layer or group before map style was completely set. Please use "styleload" event.')}hideLayers(e){const t=this.getStyle(this.modules.map.state.handyStyleId);t?this.setLayerVisibility("hidden",e,t):console.error('Cannot hide layer or group before map style was completely set. Please use "styleload" event.')}setDynamicStyle(e){this.handyStylesMap.set(J.jf,e),this.modules.workers.syncStyle(e)}getStyle(e){return this.handyStylesMap.get(e)}getStyleLayer(e,t){var i;return null===(i=this.handyStylesMap.get(e))||void 0===i?void 0:i.layersById[t]}getStyleRevision(e){var t;return(null===(t=this.getStyle(e))||void 0===t?void 0:t.revision)||0}setFramebufferId(e,t,i){var n;const o=null===(n=this.handyStylesMap.get(e))||void 0===n?void 0:n.layersById[t];o&&(o.framebufferId=i)}getFramebufferId(e,t){var i;const n=null===(i=this.handyStylesMap.get(e))||void 0===i?void 0:i.layersById[t];return(null==n?void 0:n.drawToTarget)?{ids:void 0,defaultId:this.modules.map.state.demMode?ai.ze:this.modules.renderer.getDrawTargetFramebufferId(n.drawToTarget)}:{ids:null==n?void 0:n.framebufferId,defaultId:void 0}}waitForStyle(e){const t=this.handyStylesMap.get(e);if(t)return Promise.resolve(t);const i=this.waitingStyleRequests.get(e);if(i)return i.promise;const n={resolve:void 0,promise:void 0};return n.promise=new Promise((e=>{n.resolve=e})),this.waitingStyleRequests.set(e,n),n.promise}addRemoveLayerHook(e,t){this.onRemoveLayerHooks.set(e,t)}getRemoveLayerHook(e){return this.onRemoveLayerHooks.get(e)}clearRemoveLayerHook(e){this.onRemoveLayerHooks.delete(e)}callCustomLayerRender(e){const t=this.customLayers.get(e);t&&t.renderFunction(this.modules.renderer.getRenderingContext())}getCustomSceneObjects(){const e=[];return this.customLayers.forEach((t=>e.push(t.sceneObject))),e}getMaxLayersCount(){return this.maxCountStyleLayers}getStyleLayerForObject(e){const t=this.getStyle(e.attributes.styleId);return t?t.layersById[e.attributes.layerId]:null}getFeatureFlag(e,t){const i=this.getStyle(this.modules.map.state.handyStyleId);if(!i)return!1;return!0===i.graphicsPresets[t][e]}getClearColor(){const{map:e,camera:t}=this.modules,{state:i}=e,n=this.handyStylesMap.get(null==i?void 0:i.handyStyleId);if(!n)return i.defaultBackgroundColor;const o=(0,te.jJ)(i.styleZoom,i.styleState,[]),r=(0,te.zn)(n.environment.style.skyColor,o),s=i.globeMode?t.globeRatio:0;return Yn.t7(_u.value,n.background.color.value,r.value,s),_u}update(){const e=this.getStyle(this.modules.map.state.handyStyleId);e&&(e.light.lightingModesResolved=(0,te.Oh)(e.light.lightingModes,(0,te.jJ)(this.modules.map.state.styleZoom,this.modules.map.state.styleState,[],!1)))}setLayerVisibility(e,t,i){const{id:n,type:o}=t;if(n&&i.layersById){const t=i.layerIdToInnerId[n];if(t){const n=i.layersById[t];if(n)n.style&&(n.style.visibility=e);else{const n=i.groupsById[t];null==n||n.layers.forEach((t=>{t&&t.style&&(t.style.visibility=e)}))}}}o&&i.layers.forEach((t=>{t.type===o&&(t.style.visibility=e)}))}initHandyLayer(e,t){let i;switch(t.type){case"group":return void t.layers.forEach((t=>this.initHandyLayer(e,t)));case"heatmap":i=fu(t,e,this.modules)}i&&this.modules.styleManager.addRemoveLayerHook(t.innerId,i)}setMaxLayersCount(e){this.maxCountStyleLayers<e&&(this.maxCountStyleLayers=e)}initCustomLayer(e,t,i,n,o){const r={sceneObject:{type:Cn.H.Custom,attributes:{styleId:e,layerId:t.innerId,tileData:[]},tile:{zoomLevel:0},layerSettings:{},canRender:!0},layer:t,renderFunction:i};null==o||o(),this.customLayers.set(t.innerId,r),this.modules.styleManager.addRemoveLayerHook(t.innerId,(()=>{null==n||n(),this.customLayers.delete(t.innerId)}))}}var vu=i(4619);class gu{constructor(){this.events={}}on(e,t){let i=this.events[e];return i||(i=this.events[e]=[]),i.push(t),this}once(e,t){const i=n=>{this.off(e,i),t.call(this,n)};return this.on(e,i),this}off(e,t){const i=this.events[e];if(!i)return this;const n=i.indexOf(t);return-1!==n&&i.splice(n,1),this}emit(e,t){const i=this.events[e];if(!i)return this;const n=i.slice();for(let e=0;e<n.length;e++)n[e].call(this,t);return this}}class yu extends gu{constructor(e,t){super(),this.loadFont=(e,t)=>{let i=this.requestFontRanges.get(e,t);return i||(i=this.createLoadFontRequest(e,t),this.requestFontRanges.set(e,t,i)),i},this.invalidateUsedGltfModels=(0,Ue.P)((()=>{var e;const t=new Set;if(this.modules.renderer.isDestroyed)return;const i=this.modules.tileManager.getTileObjects();for(const e of i)for(const i of e.children){if(!jd(i))continue;const{styleId:e,layerId:n,modelIndices:o}=i.attributes,r=this.modules.styleManager.getStyleLayer(e,n);if(!r||"gltfModel"!==r.type)continue;const s=this.modules.modelsScene.getCurrentLayerModelId(i.attributes,i.tile);o.forEach((i=>{const n=this.getModel(i,e);if(n)t.add(n);else if(s===i){const t=this.dataModelIdToUrl[i];t?this.loadModel(t,i,e,!1,r):this.loadModelByIndex(i,e,r)}}))}const n=this.modules.tileManager.getCachedMods();for(const i of n)null===(e=i.objects)||void 0===e||e.forEach((e=>{for(const i of e.children){if(!jd(i))continue;const{styleId:e,layerId:n,modelIndices:o}=i.attributes,r=this.modules.styleManager.getStyleLayer(e,n);if(!r||"gltfModel"!==r.type)return;o.forEach((e=>{const n=this.getModel(e,i.attributes.styleId);n&&t.add(n)}))}}));for(const e in this.models){const i=this.models[e];i.preserve||t.has(i)||i.status!==Id.Loaded||this.removeModel(e)}}),T.workerResetInterval),this.state=e,this.modules=t,this.modelsWorker=new this.modules.workers.models.ModelsSource,this.requestedMetatiles=new Set,this.metatiles={},this.loadedRasters={},this.failedRasters={},this.requestedRasters={},this.requestedSvgs={},this.disableIconCache=e.disableIconCache,this.textures=[],this.fontGlyphs={},this.fontTextures=new du.c,this.requestFontRanges=new du.c,this.pendingFontRanges=0,this.loadedFontRanges=0,this.models={},this.dataModelIdToUrl={},this.visibleBuildingIds=new Set,this.metatileLoader=(e,t,i)=>{const n=(0,A.GG)(t);fetch(e).then((e=>{if(!e.ok)throw new Error(`Failed to load metatile "${n}"`);return e.json()})).then((e=>this.setMetatile(t,i,e))).catch((e=>console.error(e)))};const{fnRegistry:i}=this.modules.workers;i.set("addNewRasterSets",((e,t)=>{const i=this.modules.styleManager.getStyle(e);if(!i)return void console.error(`Not found style ${e} in AssetManager#addNewRasterSets`);const{rasterSets:n}=i;t.forEach((e=>{n.byIndex[e.index]=e,n.byKey[e.key]=e}))})),i.set("loadFont",this.loadFont),this.setPreparedMetatile(-1,A.nF),this.setPreparedMetatile(G.L2,(0,vu.X4)())}getMemoryFootprint(){const e={textures:this.textures.map(Ke.Y5),fontTextures:this.fontTextures.reduce(((e,t)=>(e.push((0,Ke.Y5)(t)),e)),[]),fontGlyphs:Object.values(this.fontGlyphs).reduce(((e,t)=>Object.values(t).reduce(((e,t)=>{var i,n;return e.push({bitmap:null!==(n=null===(i=t.bitmap)||void 0===i?void 0:i.byteLength)&&void 0!==n?n:0}),e}),e)),[]),models:Object.values(this.models).map(Ke.CL).filter((e=>e.buffers.length>0||e.textures.length>0))},t={textures:this.textures.map(Ke.dr),fontTextures:this.fontTextures.reduce(((e,t)=>(e.push((0,Ke.dr)(t)),e)),[]),models:Object.values(this.models).map(Ke.aW).filter((e=>e.buffers.length>0||e.textures.length>0))};return{js:Object.assign(Object.assign({},e),{"--sum":(0,Ke.QE)(e)}),gpu:Object.assign(Object.assign({},t),{"--sum":(0,Ke.QE)(t)})}}fillDataModelUrlMap(e){for(const t in e)this.dataModelIdToUrl[e[t]]=t}getDataModelUrlById(e){return this.dataModelIdToUrl[e]}loadMetatile(e,t,i){this.requestedMetatiles.has(t)||(this.requestedMetatiles.add(t),this.metatileLoader(e,t,i))}setMetatile(e,t,i){(0,U.lG)(i),i.tileProps=i.tileProps.map(U.dx);const n=(0,A.ev)(i);this.setPreparedMetatile(e,n),void 0===this.projectMetatileMetadata&&(this.projectMetatileMetadata={regionId:t,metatileHash:e})}setPreparedMetatile(e,t){this.metatiles[e]=t,this.modules.workers.parser.setMetatile(e,t)}prepareRasters(e,t,i){var n,o,r;const s=this.modules.styleManager.getStyle(e);if(!s)return void console.error(`Not found style ${e} in AssetManager#prepareRasters`);const{rasterSets:a}=s,l=t.length/7;for(let e=0;e<l;e++){const l=t[7*e],d=t[7*e+1],c=t[7*e+6],u=t[7*e+2],h=t[7*e+3],m=t[7*e+4],f=t[7*e+5],_=a.byIndex[l];if(_.isSvg){const e={rasterIndex:d,rasterSetIndex:l,x:u,y:h,w:m,h:f,anchorX:_.anchorX,anchorY:_.anchorY,atlasIndex:c,isPacked:!0};_.rasters[d]=e,null===(o=null===(n=this.requestedSvgs[s.id])||void 0===n?void 0:n[l])||void 0===o||o.then((t=>{const i=this.textures[e.atlasIndex],{url:n,revokeURL:o}=ud(t);cd(n,e.w,e.h).then((t=>{i.subImage(t,e.x,e.y),this.modules.renderer.addRerenderEvent(),o&&o()}))}))}else{const e=null!==(r=_.rasters[d])&&void 0!==r?r:{rasterIndex:d,rasterSetIndex:l,x:u,y:h,w:m,h:f,anchorX:0,anchorY:0,atlasIndex:c,isPacked:!0};_.rasters[d]=e,e.x=u,e.y=h,e.atlasIndex=c,e.isPacked=!0}void 0===this.textures[c]&&(this.textures[c]=new nt(void 0,{size:T.atlasSize,flipY:!1,premultiplyAlpha:!je,magFilter:nt.LinearFilter,minFilter:nt.LinearFilter}),this.modules.renderer.prepareTexture(this.textures[c]));const p=this.textures[c],v=i&&i[e];void 0===v||(p.subImage(v,u,h),this.modules.renderer.addRerenderEvent())}this.modules.workers.labeling.updatePackingInfo(e,t)}loadRasters(e){const t=e.length/3;for(let i=0;i<t;i++){const t=e[3*i],n=e[3*i+1],o=e[3*i+2],r=n<<16|o,s=this.modules.styleManager.getStyle(t);if(!s){console.error(`Not found style ${t} in AssetManager#loadRasters`);continue}if(this.loadedRasters[t]||(this.loadedRasters[t]=new Set,this.failedRasters[t]=new Set,this.requestedRasters[t]=new Set),this.requestedRasters[t].has(r))continue;const{rasterSets:a}=s,l=a.byIndex[n];!1!==l.rasters[o].isPacked?(this.requestedRasters[t].add(r),l.isSvg?this.loadSvg(r,s,n):this.loadPng(r,s,n,o)):console.error(`Try to load not packed raster ${l.key}`)}}removeRasterSet(e,t){const{key:i,index:n,rasters:o}=e;delete this.requestedSvgs[t][n],o.forEach((({rasterSetIndex:e,rasterIndex:i})=>{var n,o,r;const s=e<<16|i;null===(n=this.loadedRasters[t])||void 0===n||n.delete(s),null===(o=this.failedRasters[t])||void 0===o||o.delete(s),null===(r=this.requestedRasters[t])||void 0===r||r.delete(s)})),e.rasters.length=0;const r=this.modules.styleManager.getStyle(t);r&&(delete r.rasterSets.byIndex[n],delete r.rasterSets.byKey[i])}getMetatile(e){return this.metatiles[e]}getProjectMetadata(){return this.projectMetatileMetadata}getFontGlyphs(e){return this.fontGlyphs[e]||{}}getFontTextureByName(e,t){return this.fontTextures.get(e,t)}isIdle(){let e=0,t=0;for(const i in this.requestedRasters)e+=this.requestedRasters[i].size,t+=this.loadedRasters[i].size+this.failedRasters[i].size;return e===t&&this.pendingFontRanges===this.loadedFontRanges&&this.allModelsLoaded()}dangerouslySetMetatiles(e){this.metatiles=e}dangerouslySetRasters(e,t){this.loadedRasters=e,this.failedRasters=t}loadModelByIndex(e,t,i){const n=this.getModelUniqueKey(e,t);if(void 0!==this.models[n])return;const o=this.modules.styleManager.getStyle(t);if(void 0===o)return void(0,Jo.$z)({layer:"prepare",message:"Style not found. Can't determine url"});const r=o.models[e];if(void 0===r)return void(0,Jo.$z)({layer:"prepare",message:`Model with index "${e}" is missing in the style.`});const s=(0,D.gA)(r.url,o);this.fetchModel(s,e,n,!1,i)}loadModel(e,t,i,n,o,r){const s=this.getModelUniqueKey(t,i);void 0===this.models[s]?this.fetchModel(e,t,s,n,o,r):null==r||r()}getModel(e,t){return this.models[this.getModelUniqueKey(e,t)]}allModelsLoaded(){for(const e in this.models)if(this.models[e].status===Id.Pending)return!1;return!0}isModelLoaded(e,t){const i=this.models[this.getModelUniqueKey(e,t)];return i&&i.status===Id.Loaded}removeModel(e){const t=this.models[e];t&&(t.objects.forEach((e=>{e.elementsBuffer&&e.elementsBuffer.remove()})),t.objects=[],t.buffers.forEach((e=>{e instanceof yt.l&&e.remove()})),t.buffers=[],t.textures.forEach((e=>e.remove())),t.textures=[],delete this.models[e])}fetchModel(e,t,i,n,o,r){const{renderer:s}=this.modules,a=this.models[i]=function(e){return{buffers:[],objects:[],textures:[],status:Id.Pending,preserve:e}}(n);this.modelsWorker.loadModel(e,this.state.dracoDecoderUrl).then((e=>{if("ok"===e.type){if(a.status=Id.Loaded,!e.result)return;Td(a,s,e.result,t,o),this.emit("modelloaded",t),this.modules.renderer.addRerenderEvent(),null==r||r()}else(0,Jo.$z)(e),a.status=Id.Failed}))}getModelUniqueKey(e,t){return e>=0?`${t},${e}`:String(e)}createLoadFontRequest(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){this.pendingFontRanges+=1;const i=Number.isNaN(this.state.handyStyleId)?1:this.state.handyStyleId;try{const n=yield this.modules.styleManager.waitForStyle(i),o=yield fetch((0,D.fb)(e,t,n)).then((e=>{if(!e.ok)throw new Error;return e})).catch((()=>(console.error(`Could not load font ${e} for range ${t} fallback to the default font ${G.Uo}`),fetch((0,D.fb)(G.Uo,t,n)).then((e=>{if(!e.ok)throw new Error(`Could not load default font ${G.Uo} for range ${t}`);return e}))))).then((e=>e.arrayBuffer())),r=(0,cu.Xq)(o);return this.prepareFontAtlas(e,t,r),this.modules.workers.labeling.appendFont(e,r.glyphData),this.loadedFontRanges+=1,this.modules.workers.labeling.markFontAsLoaded(e,t)}catch(i){return console.error(i),this.loadedFontRanges+=1,this.modules.workers.labeling.markFontAsLoaded(e,t)}}))}prepareFontAtlas(e,t,i){const{bitmap:n,width:o,height:r,glyphData:s}=i;this.fontGlyphs[e]||(this.fontGlyphs[e]={});for(const t in s)this.fontGlyphs[e][t]=s[t];const a=new nt(new Uint8Array(n),{size:[o,r],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,format:nt.AlphaFormat,premultiplyAlpha:!1,flipY:!1});this.fontTextures.set(e,t,a),this.state.needLabeling=!0}loadPng(e,t,i,n){const{rasterSets:o}=t,r=o.byIndex[i],s=r.rasters[n],a=this.textures[s.atlasIndex];let l="";if(r.type===lu.f.Unique){const e=r.id;l=r.url?(0,D.U0)(r.url,s.w,s.h):(0,P.Gr)("dynamicPoi",{host:this.state.tileServer,tileSet:this.state.tileSet,protocol:this.state.tileProtocol,subdomain:(0,P.Sy)(this.state.subdomains,e),id:e,width:s.w.toString(),height:s.h.toString(),regionId:String(r.regionId)})}else if(r.type===lu.f.Static){const i=t.icons[r.name];if(!i)return console.error(`There is no appropriate icon config in the style for raster set: "${r.name}"`),void this.failedRasters[t.id].add(e);l=(0,D.bX)(i.url,t,(0,P.Sy)(this.state.subdomains,r.name))}this.modules.workers.parser.prepareAtlas(l).then((i=>(0,I.mG)(this,void 0,void 0,(function*(){if(i){if(i.isBitmap){if(i.data[0].width===s.w&&i.data[0].height===s.h||r.type!==lu.f.Static)a.subImage(i.data[0],s.x,s.y);else{if(s.w<=0||s.h<=0)return;const e=document.createElement("canvas");e.width=s.w,e.height=s.h;e.getContext("2d").drawImage(i.data[0],0,0,e.width,e.height),a.subImage(e,s.x,s.y)}this.modules.renderer.addRerenderEvent()}else hd(i.data[0]).then((e=>{a.subImage(e,s.x,s.y),this.modules.renderer.addRerenderEvent()}));this.loadedRasters[t.id].add(e),r.isReady=!0}else this.failedRasters[t.id].add(e)}))))}loadSvg(e,t,i){const n=t.rasterSets.byIndex[i];if(!t.iconBaseUrl)return console.error(`Attempt to load svg without existing style for raster set: "${n.name}"`),void this.failedRasters[t.id].add(e);const o=t.icons[n.name];if(!o)return console.error(`There is no appropriate icon config in the style for raster set: "${n.name}"`),void this.failedRasters[t.id].add(e);const r=(0,D.bX)(o.url,t,(0,P.Sy)(this.state.subdomains,n.name));this.requestedSvgs[t.id]||(this.requestedSvgs[t.id]={});let s=this.requestedSvgs[t.id][i];s&&!this.disableIconCache||(s=this.requestedSvgs[t.id][i]=fetch(r,{cache:this.disableIconCache?"no-cache":"default"}).then((e=>{if(!e.ok)throw new Error("Not 2xx response");return e.text()}))),s.then((i=>{const{url:o,revokeURL:r}=ud(i),s=[];for(const e of n.rasters){if(e.w<=0||e.h<=0)continue;const t=this.textures[e.atlasIndex],i=cd(o,e.w,e.h);i.then((i=>{t.subImage(i,e.x,e.y),i.remove(),this.modules.renderer.addRerenderEvent()})),s.push(i)}r&&Promise.all(s).then(r),this.loadedRasters[t.id].add(e),n.isReady=!0})).catch((i=>{console.error(`Can't load an SVG for the "${n.name}" raster set. Error: `,i),this.failedRasters[t.id].add(e)}))}}var bu=i(3429);class xu{constructor(e,t,i,n,o,r,s,a){this.modules=e,this.mapState=t,this.cache=i,this.maxStyleZoom=-1/0,this.minStyleZoom=1/0,this.ready=!1,this.useful=!1,this.status="initial",this.model=n,this.key=o,this.selectedIds=r,this.styleId=s,this.styleRevision=a,this.modelRevision=n.revision,this.objects=[]}update(){switch(this.status){case"initial":this.useful&&(this.loadModel(),this.status="generating");break;case"generating":if(this.useful&&this.processResponse&&this.model.texturesLoaded){const{objects:{data:e}}=this.processResponse;this.objects=function(e,t){var i,n,o;const r=new Su(e,t),s=[],a=wu(null!==(o=null!==(n=null!==(i=r.children[0])&&void 0!==i?i:r.identifyChildren[0])&&void 0!==n?n:r.depthTestChildren[0])&&void 0!==o?o:r.shadowChildren[0]);a&&["children","identifyChildren","depthTestChildren","shadowChildren"].forEach((e=>{var i;const n=null!==(i=r.modelMatrices.get(0))&&void 0!==i?i:it.Ue();it.JG(n,a),r.modelMatrices.set(0,n);let o=r[e].length;for(;o--;){const i=r[e][o],a=wu(i);if(!a)continue;if(it.I6(n,a))continue;let l=s.find((e=>{const t=e.modelMatrices.get(0);return!!t&&it.I6(t,a)}));l||(l=new Su([],t),l.modelMatrices.set(0,it.JG(it.Ue(),a)),s.push(l)),l[e].push(i),i.tile=l,r[e].splice(o,1)}}));return[r,...s]}(e,this.modules),this.updateMinAndMaxStyleZoom(this.objects),this.status="generated",this.ready=!0,this.cache.add(this.key,this)}}}getIdentifyIds(){var e;return null===(e=this.processResponse)||void 0===e?void 0:e.objects.identifyIds}remove(){"generated"===this.status&&this.cache.remove(this.key),this.status="initial",this.objects.length&&(this.objects.forEach((e=>e.clean(this.mapState))),this.objects=[]),this.ready=!1}canBeRemoved(){return"initial"===this.status}loadModel(){const{model:{regionId:e,metatileHash:t,id:i,sourceModel:{fileName:n,matrix:o,offset:r}}}=this,s={url:(0,P.Gr)("model",{host:this.mapState.tileServer,tileSet:this.mapState.tileSet,protocol:this.mapState.tileProtocol,subdomain:(0,P.Sy)(this.mapState.subdomains,n),regionId:e.toString(),name:n}),id:i,regionId:e,metatileHash:t,selected:this.selectedIds.some((e=>e===i)),pixelRatio:window.devicePixelRatio,styleState:this.mapState.styleState,styleId:this.mapState.handyStyleId,offset:r,matrix:o};this.modules.defaultSource.generateModel(s).then((e=>{this.model.prepareTextures(e.textures),this.processResponse=e}))}updateMinAndMaxStyleZoom(e){this.minStyleZoom=Math.min(...e.map((e=>Math.min(...e.children.map((e=>{var t;const i=this.modules.styleManager.getStyleLayer(e.attributes.styleId,e.attributes.layerId);return"dem"===(null==i?void 0:i.type)?1/0:null!==(t=null==i?void 0:i.minzoom)&&void 0!==t?t:-1/0})))))),this.maxStyleZoom=Math.max(...e.map((e=>Math.max(...e.children.map((e=>{var t;const i=this.modules.styleManager.getStyleLayer(e.attributes.styleId,e.attributes.layerId);return"dem"===(null==i?void 0:i.type)?-1/0:null!==(t=null==i?void 0:i.maxzoom)&&void 0!==t?t:1/0}))))))}}function wu(e){if(e&&"matrix"in e.attributes)return e.attributes.matrix}class Su extends R.Y{constructor(e,t){super("model");const{identifier:i}=t;(0,Ud.l)(t,e,this,i.getIdScope(Ya.JQ)),this.size=(0,Y.aq)(this.coords[2]),this.zoomLevel=this.coords[2],this.detailLevel=this.coords[3]}setTileCoords(e,t){}syncReplicas(e){}}class Mu{constructor(e,t,i,n,o,r){var s;this.modules=e,this.mapState=t,this.cache=i,this.regionId=n,this.metatileHash=o,this.sourceModel=r,this.revision=0,this.texturesLoaded=!1,this.textures=[],this.readiness=0,this.id=r.id,this.attributes=null!==(s=r.attributes)&&void 0!==s?s:{},this.readinessTickerName=`model-readiness-${this.id}`,this.ids=e.identifier.getIdScope(Ya.JQ)}update(){var e,t;(null===(e=this.currentMod)||void 0===e?void 0:e.useful)&&this.currentMod.update(),(null===(t=this.newMod)||void 0===t?void 0:t.useful)&&this.newMod.update(),ne.Vx(this.readinessTickerName,{step:(e,t)=>this.readiness=t},this.mapState)}isAnimating(){return ne.rS(this.readinessTickerName,this.mapState)}commitMod(){this.newMod&&this.newMod.ready&&(this.currentMod=this.newMod,this.newMod=void 0)}setUsefulMod(){const e=this.mapState.handyStyleId,t=this.modules.styleManager.getStyleRevision(e),i=this.ids.getSelected().filter((e=>e===this.id));if(this.currentMod||this.newMod){if(this.currentMod){if((0,we.vZ)(this.currentMod.selectedIds,i)&&this.currentMod.styleId===e&&this.currentMod.styleRevision===t&&this.currentMod.modelRevision===this.revision)return this.currentMod.useful=!0,void(this.newMod=void 0)}if(this.newMod){(0,we.vZ)(this.newMod.selectedIds,i)&&this.newMod.styleId===e&&this.newMod.styleRevision===t&&this.newMod.modelRevision===this.revision?this.newMod.useful=!0:this.createNewMod(i,e,t,this.revision)}else this.createNewMod(i,e,t,this.revision)}else this.createNewMod(i,e,t,this.revision)}getUsefulMod(){return this.currentMod&&this.currentMod.useful?this.currentMod:this.newMod&&this.newMod.useful?this.newMod:void 0}getCurrentMod(){return this.currentMod}setAllModsNeedless(){this.currentMod&&(this.currentMod.useful=!1),this.newMod&&(this.newMod.useful=!1)}getOpacity(e){return this.readiness*this.modules.buildingHeightAnimator.getBuildingHeight(e)}getTexture(e){return this.textures[e]}prepareTextures(e){this.texturesLoaded||(e.isBitmap?(this.textures=e.data.map((e=>new nt(e,{flipY:!1}))),this.texturesLoaded=!0,this.startReadinessTicker()):Promise.all(e.data.map((e=>hd(e)))).then((e=>{this.textures=e.map((e=>new nt(e,{flipY:!1}))),this.texturesLoaded=!0,this.startReadinessTicker()})))}clean(){this.canBeCleaned()&&(this.texturesLoaded&&(this.textures.forEach((e=>e.remove())),this.textures=[],this.texturesLoaded=!1),this.stopReadinessTicker())}canBeCleaned(){return(!this.currentMod||this.currentMod.canBeRemoved())&&(!this.newMod||this.newMod.canBeRemoved())}createNewMod(e,t,i,n){const o=function(e,t,i,n,o){return`model=${e}_sId=${i}_sRev=${n}_mRev=${o}_sel=${t.join("|")}`}(this.id,e,t,i,n),r=this.cache.get(o);r?(this.newMod=r,this.newMod.useful=!0):this.newMod=new xu(this.modules,this.mapState,this.cache,this,o,e,t,i)}startReadinessTicker(){this.readiness=0,ne.BL(this.readinessTickerName,{easing:T.buildingAnimation.easing},this.mapState,0,1,T.buildingAnimation.duration,1)}stopReadinessTicker(){this.readiness=0,ne.sT(this.readinessTickerName,this.mapState)}}class Iu{constructor(e,t){this.mapState=e,this.modules=t,this.buildingsHeight=new Map,this.models=new Map,this.displayedMods=new Map,this.viewportModels=[],this.requestedModelsInfo=new Set,this.loadedModelsInfo=new Set,this.isStyleUpdateInProgress=!1,this.hiddenBuildingIds=new Set,this.cache=new bu.L(T.modelCacheSize,((e,t)=>t.remove())),this.ids=t.identifier.getIdScope(Ya.JQ)}onFeatureStateMapChange(){this.models.forEach((e=>{e.revision++}))}update(){this.findViewportModels(),this.mapState.styleZoom>T.loadModelsInfoStyleZoom&&this.modules.tileManager.getViewportTiles().forEach((e=>{"zenith"===e.type&&e.serverMetadata&&e.serverMetadata.forEach((t=>{const i=this.modules.sourceStorage.getSourceById(e.sourceId);if(void 0!==i&&"getUrl"in i){const e=i.getUrl("modelInfo",{regionId:t.regionId.toString()});this.loadModelsInfo(e,t.regionId,t.metatileHash)}else{const e=(0,P.Gr)("modelInfo",{host:this.mapState.tileServer,tileSet:this.mapState.tileSet,protocol:this.mapState.tileProtocol,subdomain:this.mapState.subdomains[0],regionId:t.regionId.toString()});this.loadModelsInfo(e,t.regionId,t.metatileHash)}}))})),this.models.forEach((e=>e.setAllModsNeedless())),this.viewportModels.forEach((e=>e.setUsefulMod())),this.models.forEach((e=>e.update())),this.isStyleUpdateInProgress||this.models.forEach((e=>e.commitMod())),this.updateScene(),this.cleanUnnessasaryModels(),this.updateObjectsVisibility()}activateStyleUpdating(){this.isStyleUpdateInProgress=!0}finishStyleUpdating(){this.isStyleUpdateInProgress=!1}redraw(){this.cache.reset(),this.cleanUnnessasaryModels()}isModelsInfoLoaded(e){return this.loadedModelsInfo.has(e)}getTexture(e,t){var i;return null===(i=this.models.get(e))||void 0===i?void 0:i.getTexture(t)}getDisplayedIdentifyData(){const e=[];return this.viewportModels.forEach((t=>{const i=t.getUsefulMod();if(!i)return;const n=i.getIdentifyIds();n&&e.push({metatileHash:t.metatileHash,ids:n})})),e}getOpacity(e,t){var i;return(null===(i=this.models.get(e))||void 0===i?void 0:i.getOpacity(t))||0}hasModel(e){return this.models.has(e)}setBuildingHeight(e,t){this.buildingsHeight.set(e,t)}getBuildingHeight(e){return this.buildingsHeight.get(e)||0}isHidden(e){return this.ids.isHidden(e)}getVisibleModelData(e){const t=this.models.get(e);if(!t)return;const i=t.getCurrentMod();if(!i||!i.ready)return;const n=Math.max(t.sourceModel.minZoom,i.minStyleZoom),o=Math.min(t.sourceModel.maxZoom,i.maxStyleZoom),{styleZoom:r}=this.mapState;return r<n||r>=o?void 0:{minStyleZoom:n,maxStyleZoom:o,opacity:this.getOpacity(e,n)}}isIdle(){return this.viewportModelsReady()&&!this.viewportModels.some((e=>e.isAnimating()))}viewportModelsReady(){return this.viewportModels.every((e=>{const t=e.getUsefulMod();return t&&t.ready}))}setHiddenBuildingIds(e){e.forEach((e=>{this.hiddenBuildingIds.add(e)}))}unsetHiddenBuildingIds(e){e.forEach((e=>{this.hiddenBuildingIds.delete(e)}))}findViewportModels(){const{styleZoom:e}=this.mapState;this.viewportModels=[],this.models.forEach((t=>{const{bound:i,minZoom:n,maxZoom:o}=t.sourceModel;if(e<n||e>=o)return;const r=this.mapState.styleState._activeFloorIds,s=t.attributes.db_hidden_by_plan_id;if(s&&r.includes(s))return;if(this.modules.floorManager.hasDisplayedFloorBuilding([t.id]))return;if(!!!this.modules.assetManager.getMetatile(t.metatileHash))return;if(this.hiddenBuildingIds.has(t.id))return;(0,jn.M4)(this.mapState.extendedTilesBounds,i)&&this.viewportModels.push(t)}))}updateScene(){let e=!1;const t=new Map;this.viewportModels.forEach((e=>{const i=e.getCurrentMod();i&&i.ready&&t.set(i.key,i)})),this.displayedMods.forEach(((i,n)=>{t.has(n)||(i.objects.length&&i.objects.forEach((e=>this.modules.tileManager.removeObject(e))),e=!0)})),t.forEach(((t,i)=>{this.displayedMods.has(i)||(t.objects.length&&t.objects.forEach((e=>this.modules.tileManager.addObject(e))),e=!0),this.cache.get(i)})),e&&(this.displayedMods=t,this.modules.renderer.addRerenderEvent(),this.modules.identifier.resetCache())}cleanUnnessasaryModels(){const e=new Set(this.cache.getData().map((e=>e.model)));this.models.forEach((t=>{e.has(t)||t.clean()}))}loadModelsInfo(e,t,i){this.requestedModelsInfo.has(t)||(this.requestedModelsInfo.add(t),fetch(e).then((e=>{if(!e.ok)throw new Error(`Failed to load models info for region ${t}`);return e.json()})).then((n=>{n.forEach((n=>{if(!n.fileName)return void console.error(`ZBM source "fileName" is empty. Failed to load model by url: ${e}`);const o=new Mu(this.modules,this.mapState,this.cache,t,i,n);this.models.set(o.id,o)})),this.loadedModelsInfo.add(t)})).catch((e=>{this.loadedModelsInfo.add(t),console.error(e)})))}updateObjectsVisibility(){const e=this.ids;this.models.forEach((t=>{var i;const n=(null===(i=this.getVisibleModelData(t.id))||void 0===i?void 0:i.opacity)||0,o=e.isHidden(t.id,Ya.Rv.PolygonExtrusion);n>=.5&&!o?e.hide([t.id],Ya.Rv.PolygonExtrusion):n<.5&&o&&e.show([t.id])}))}}var Tu=i(2153);class Eu{constructor(e){this.modules=e,this.isIdle=()=>!this.isGenerating,this.modCache=new Map,this.isGenerating=!1,this.currentPois=[],this.currentIdSet=new Set,this.currentTrafficState=!1,this.currentSelectedIds=[],this.currentModKey=Pu(this.currentTrafficState,this.currentSelectedIds),this.ids=e.identifier.getIdScope(Ya.JQ)}setPersonalPoi(e){this.currentPois=e;const t=new Set;for(const i of e)t.add(i.id);this.currentIdSet=t,this.modCache.clear(),this.displayedModKey=void 0}redraw(){this.modCache.clear(),this.displayedModKey=void 0}getIdentifyDataChunk(){return this.identifyDataChunk}update(){if(void 0===this.regionMetadata&&(this.regionMetadata=this.modules.assetManager.getProjectMetadata()),void 0===this.regionMetadata)return;this.updateModKey();const e=this.currentModKey,t=this.modCache.get(e);void 0!==t||this.isGenerating||this.generate(e,this.currentPois,this.regionMetadata),void 0!==t&&e!==this.displayedModKey&&this.show(e,t,this.regionMetadata)}generate(e,t,i){const{regionId:n,metatileHash:o}=i,r=this.modules.map.state;this.isGenerating=!0,this.modules.workers.parser.generatePersonalPoi(t,n,o,window.devicePixelRatio,this.ids.getSelected(),r.handyStyleId,r.styleState,this.modules.defaultSource.getId()).then((t=>{if(void 0===t)return void(this.isGenerating=!1);const{collectorOutput:i,styleId:n}=t,{packedRasters:o,rastersToLoad:r}=i;void 0!==o&&this.modules.assetManager.prepareRasters(n,o),this.modules.assetManager.loadRasters(r),this.modCache.set(e,t),this.isGenerating=!1}))}show(e,t,i){const{metatileHash:n}=i,{collectorOutput:{labels:o,identifyIds:r},styleId:s}=t;this.modules.labeler.removeLabels("ppoi"),o.length&&this.modules.labeler.addLabels("ppoi",Tu.AL.PersonalPoi,[{metatileHash:n,labels:o,styleId:s}]),this.identifyDataChunk={metatileHash:n,ids:r},this.modules.identifier.resetCache(),this.displayedModKey=e}updateModKey(){const e=this.ids.getSelected().filter((e=>this.currentIdSet.has(e))),t=this.modules.trafficTileLayer.isEnabled();(0,we.vZ)(this.currentSelectedIds,e)&&this.currentTrafficState===t||(this.currentTrafficState=t,this.currentSelectedIds=e,this.currentModKey=Pu(t,e))}}function Pu(e,t){return`ppoi_${e}_${t.join("|")}`}const Au=function(){var e=ENTRY_MODULE,t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,i),o.exports}i.m=e,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("[object Object]"===Object.prototype.toString.call(self))return self;try{return this||new Function("return this")()}catch(e){if("[object Object]"===Object.prototype.toString.call(window))return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=i(ENTRY_MODULE);return n.default||n};Au.toString();var Lu="[\\.|\\-|\\+|\\w|/|@]+",Cu="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function zu(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function ku(e,t,n){var o={};o[n]=[];var r=t.toString(),s=r.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||r.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!s)return o;for(var a,l=s[1],d=new RegExp("(\\\\n|\\W)"+zu(l)+Cu,"g");a=d.exec(r);)"dll-reference"!==a[3]&&o[n].push(a[3]);for(d=new RegExp("\\("+zu(l)+'\\("(dll-reference\\s('+Lu+'))"\\)\\)'+Cu,"g");a=d.exec(r);)e[a[2]]||(o[n].push(a[1]),e[a[2]]=i(a[1]).m),o[a[2]]=o[a[2]]||[],o[a[2]].push(a[4]);for(var c,u=Object.keys(o),h=0;h<u.length;h++)for(var m=0;m<o[u[h]].length;m++)c=o[u[h]][m],isNaN(1*c)||(o[u[h]][m]=1*o[u[h]][m]);return o}function Ou(e){return Object.keys(e).reduce(((t,i)=>t||e[i].length>0),!1)}function Ru(e,t,i,n){let o=e[n].map((e=>`"${e}": ${t[n][e].toString()}`)).join(","),r=Au.toString().split("ENTRY_MODULE");return`${r[0]}{${o}}${r[1]}"${i}"${r[2]}`}function Fu(e,t){t=t||{};var n={main:i.m},o=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},n={main:[]},o={main:{}};Ou(i);)for(var r=Object.keys(i),s=0;s<r.length;s++){var a=r[s],l=i[a].pop();if(o[a]=o[a]||{},!o[a][l]&&e[a][l]){o[a][l]=!0,n[a]=n[a]||[],n[a].push(l);for(var d=ku(e,e[a][l],a),c=Object.keys(d),u=0;u<c.length;u++)i[c[u]]=i[c[u]]||[],i[c[u]]=i[c[u]].concat(d[c[u]])}}return n}(n,e),r="";Object.keys(o).filter((e=>"main"!==e)).forEach((e=>{for(var t=0;o[e][t];)t++;o[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",r+=`var ${e} = (${Ru(o,n,t,modules)})();\n`})),r+=`(${Ru(o,n,e,"main")})();`;var s=new window.Blob([r],{type:"text/javascript"});if(t.bare)return s;var a=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(s),l=new window.Worker(a);return l.objectURL=a,l}var Bu=i(7256),Du=i(4500),ju=i(6892),Nu=i(4411),Uu=i(2176),Hu=i(8894);class Gu{constructor(){this.connector=new Bu.H,this.fnRegistry=new Du.J(this.connector),this.classRegistry=new Nu.Z(this.fnRegistry),this.parserWorker=Fu(2354),this.connector.addWorker(ju.P.Parser,this.parserWorker),this.labelingWorker=Fu(4824),this.connector.addWorker(ju.P.Labeling,this.labelingWorker),this.modelsWorker=Fu(6100),this.connector.addWorker(ju.P.Models,this.modelsWorker),this.parser=function(e,t){return{setMetatile:e.get(ju.P.Parser,"setMetatile"),getMemoryFootprint:e.get(ju.P.Parser,"getMemoryFootprint"),prepareAtlas:e.get(ju.P.Parser,"prepareAtlas"),packRasters:e.get(ju.P.Parser,"packRasters"),fetchTrafficTile:e.get(ju.P.Parser,"fetchTrafficTile"),deleteTrafficTile:e.get(ju.P.Parser,"deleteTrafficTile"),abortTrafficTileRequest:e.get(ju.P.Parser,"abortTrafficTileRequest"),generateTrafficTile:e.get(ju.P.Parser,"generateTrafficTile"),generatePersonalPoi:e.get(ju.P.Parser,"generatePersonalPoi"),syncStyle:e.get(ju.P.Parser,"syncStyle"),GeoJsonSource:t.set("GeoJsonSource",Uu.T,void 0,["fetchTiles"]).get(ju.P.Parser),ZenithSource:t.set("ZenithWorker",Z.Z,void 0,["fetchTiles"]).get(ju.P.Parser)}}(this.fnRegistry,this.classRegistry),this.labeling=function(e){return{setCommercialPoiRandomSeed:e.get(ju.P.Labeling,"setComPoiRandomSeed"),getMemoryFootprint:e.get(ju.P.Labeling,"getMemoryFootprint"),appendFont:e.get(ju.P.Labeling,"appendFont"),markFontAsLoaded:e.get(ju.P.Labeling,"markFontAsLoaded"),addNewRasterSets:e.get(ju.P.Labeling,"addNewRasterSets"),updatePackingInfo:e.get(ju.P.Labeling,"updatePackingInfo"),syncStyle:e.get(ju.P.Labeling,"syncStyle"),loadRtlPlugin:e.get(ju.P.Labeling,"loadRtlPlugin"),markRtlPluginLoaded:e.get(ju.P.Labeling,"markRtlPluginLoaded")}}(this.fnRegistry),this.models=function(e){return{ModelsSource:e.set("ModelsWorker",Hu.q).get(ju.P.Models)}}(this.classRegistry)}syncStyle(e){this.parser.syncStyle(e),this.labeling.syncStyle(e)}destroy(){this.parserWorker.terminate(),this.labelingWorker.terminate(),this.modelsWorker.terminate()}}class Vu extends C.c{constructor(e,t){super(),this.fogFactorBreakpoint=.4,this.demElevation=0,this.demTilesRevision=NaN,this.options=(0,we.kn)(t,Vu.options),this.uniqId=String((0,z.fD)()),this.labelKey=`html-${this.uniqId}`,this.modules=e.modules;const i=this.options.floorId?this.modules.floorManager.getFloorObjectElevation(this.options.floorId,!0):0,n=W.H.fromGeo(this.options.coordinates);n[2]+=i,this.position={userValue:n,normalizedValue:(0,L.I0)(n)},this.screenPoint=[0,0],this.html=function(e){const t=document.createElement("div");t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.zIndex=String(e.zIndex),e.interactive||(t.style.pointerEvents="none");e.animate&&(t.style.opacity="0",t.style.transition=`opacity ${e.duration}ms`,t.style.willChange="opacity");const i=document.createElement("div");"string"==typeof e.html?i.innerHTML=e.html:i.append(e.html);return t.append(i),t}(this.options),this.isHidden=!0,this.targetOpacity=0,this.modules.layers.addLayer(this),this.mapState=e.state,this.rounder=!this.options.disableRounding?Zu:Wu;let{offset:o}=this.options;const{labeling:r}=this.options;"none"!==r.type&&(void 0!==r.offset&&(o=r.offset),this.modules.labeler.addLabelBox(this.labelKey,{id:this.uniqId,width:r.width,height:r.height,position:this.position.normalizedValue,offset:o,labelingGroup:this.getLabelingGroup(),parentPoiId:"pinnedToPoi"===r.type?r.poiId:void 0}))}destroy(){this.removeHtml(),this.modules.labeler.removeLabels(this.labelKey),this.modules.layers.removeLayer(this)}update(){const e=this.checkZoom(),t=this.checkFog(),i=!this.isInvolvedInLabeling()||this.modules.labeler.isLabelBoxSurvived(this.uniqId);e&&t&&i?this.show():this.hide(),this.updatePosition()}setZIndex(e){this.options.zIndex=e,this.html.style.zIndex=String(e)}setContent(e){this.options.html=e,this.html.innerHTML="";const t=document.createElement("div");"string"==typeof e?t.innerHTML=e:t.append(e),this.html.append(t)}setLabelingSize(e,t){"none"!==this.options.labeling.type&&(this.options.labeling.width=e,this.options.labeling.height=t,this.updateLabelBox())}setPosition(e){const t=W.H.fromGeo(e);this.position={userValue:t,normalizedValue:(0,L.I0)(t)},this.updateLabelBox()}setOffset(e){this.options.offset=[e[0],e[1]],this.updateLabelBox()}setMinZoom(e){this.options.minZoom=e}setMaxZoom(e){this.options.maxZoom=e}getZIndex(){return this.options.zIndex}getOffset(){return this.options.offset}getPosition(){return W.H.toGeo(this.position.userValue)}getHtmlElement(){return this.html.firstChild}dangerouslyGetRootElement(){return this.html}isShown(){return!this.isHidden}show(){if(this.isHidden&&(this.isHidden=!1,this.appendHtml(),this.emit("shown",{id:this.uniqId.toString(),point:[this.screenPoint[0],this.screenPoint[1]],object:this}),this.options.animate)){if(this.showAnimationTimer)return;this.hideAnimationTimer&&(clearTimeout(this.hideAnimationTimer),this.hideAnimationTimer=void 0),1!==this.targetOpacity&&(this.showAnimationTimer=window.setTimeout((()=>{this.setHtmlOpacity(1),this.showAnimationTimer=void 0}),0))}}hide(){if(!this.isHidden)if(this.isHidden=!0,this.options.animate){if(this.hideAnimationTimer)return;this.showAnimationTimer&&(clearTimeout(this.showAnimationTimer),this.showAnimationTimer=void 0),this.setHtmlOpacity(0),this.hideAnimationTimer=window.setTimeout((()=>{this.removeHtml(),this.hideAnimationTimer=void 0}),this.options.duration)}else this.removeHtml()}setHtmlOpacity(e){this.html.style.opacity=String(e),this.targetOpacity=e}removeHtml(){this.html.remove(),this.screenPoint=[0,0]}appendHtml(){this.getMarkerContainer().appendChild(this.html)}getMarkerContainer(){return this.options.preventMapInteractions?this.modules.layout.htmlContainerOutMap:this.modules.layout.htmlContainerInMap}nearCenterScreenPosition(){var e,t;const i=this.modules.demManager,n=this.mapState;let o=0;if(n.demMode){const r=i.getTilesRevision();this.demTilesRevision!==r&&(this.demElevation=null!==(e=i.getElevation(this.position.normalizedValue))&&void 0!==e?e:0,this.demTilesRevision=r),o=(this.demElevation-(null!==(t=n.elevation)&&void 0!==t?t:0))*n.elevationScale}const r=this.mapState.visibleMapReplicas.map((e=>{const t=[this.position.normalizedValue[0]+G.sX*e,this.position.normalizedValue[1],this.position.normalizedValue[2]+o*L.C];W.H.toGeo(t,t);return this.modules.camera.project(t,!0)})),s=r.map((e=>Math.abs(this.mapState.size[0]/2-(isNaN(e[0])?-1/0:e[0]))));return r[s.findIndex((e=>e===Math.min(...s)))]}updatePosition(){const e=this.nearCenterScreenPosition();this.html.hidden=Number.isNaN(e[0]),this.rounder(e,e[0]+this.options.offset[0],e[1]+this.options.offset[1],this.mapState.stillness),this.mapState.globeMode&&(this.html.hidden=!this.modules.camera.ecef.canSee(this.getPosition())),O.fS(this.screenPoint,e)||(this.html.style.transform=`translate3d(${e[0]}px, ${e[1]}px, 0px)`,this.screenPoint=e)}updateLabelBox(){if("none"===this.options.labeling.type)return;const{labeling:{width:e,height:t},offset:i}=this.options;this.modules.labeler.removeLabels(this.labelKey),this.modules.labeler.addLabelBox(this.labelKey,{id:this.uniqId,width:e,height:t,position:this.position.normalizedValue,offset:i,labelingGroup:this.getLabelingGroup(),parentPoiId:"pinnedToPoi"===this.options.labeling.type?this.options.labeling.poiId:void 0})}getLabelingGroup(){return this.isInvolvedInLabeling()?"markerText":"htmlLabel"}checkZoom(){const{zoom:e}=this.mapState,{minZoom:t,maxZoom:i}=this.options;return e>=t&&e<i}checkFog(){if(!this.modules.environmentManager.isFogEnabled())return!0;if(this.mapState.globeMode)return!0;const{fogLimits:e}=this.modules.environmentManager,{fogDistance:t,position:i}=this.modules.camera,n=(this.position.normalizedValue[0]-i[0])/t,o=(this.position.normalizedValue[1]-i[1])/t,r=Math.sqrt(Math.pow(n,2)+Math.pow(o,2)),s=e[1]-e[0];return(0,we.uZ)((r-e[0])/s,0,1)<this.fogFactorBreakpoint}isInvolvedInLabeling(){return"full"===this.options.labeling.type||"pinnedToPoi"===this.options.labeling.type}}Vu.options={coordinates:[0,0],html:"",offset:[0,0],animate:!0,duration:500,labeling:{type:"none"},interactive:!0,preventMapInteractions:!1,zIndex:0,minZoom:-1/0,maxZoom:1/0,disableRounding:!1,floorId:""};const Zu=(e,t,i,n)=>{const o=Math.round(t)-t,r=Math.round(i)-i;e[0]=t+n*o,e[1]=i+n*r},Wu=(e,t,i)=>{e[0]=t,e[1]=i};var Xu=i(4389);const Ku=T.entranceAnimation.iterationCount,$u=ae.Ue();class qu extends k{constructor(e,t){var i,n,o,r,s,a,l,d,c,u,h,m;super(e,{interactive:!1}),this.options=t,this.vectors=this.options.coordinates.map((e=>e.map((e=>W.H.fromGeo(e))))),this.bouncePosition=0,this.growPosition=1;const{tileManager:f,dynamicStyle:_,collector:p,layers:v}=this.modules,g=null===(i=this.options.animate)||void 0===i||i;let y;if(g&&!this.mapState.disableLayerAnimation){const e=null!==(n=this.options.iterationCount)&&void 0!==n?n:Ku;e>1?y={type:"repeat",tipMovementAmplitude:this.options.tipMovementAmplitude||6,iterationCount:e}:1===e&&(y={type:"appearance",tipMovementAmplitude:this.options.tipMovementAmplitude||6})}const b=(0,Q.qw)({type:"arrow",id:`dynamic-entrance-${this.uniqId}`,minzoom:null!==(o=this.options.minZoom)&&void 0!==o?o:17.1,maxzoom:this.options.maxZoom,style:{color:null!==(r=this.options.color)&&void 0!==r?r:"#0085a0",strokeColor:null!==(s=this.options.borderColor)&&void 0!==s?s:"#ffffff",lineWidth:null!==(a=this.options.width)&&void 0!==a?a:4,strokeWidth:null!==(l=this.options.borderWidth)&&void 0!==l?l:1,tipWidth:null!==(d=this.options.wingWidthMultiplier)&&void 0!==d?d:1.5,tipHeight:null!==(c=this.options.tipHeightMultiplier)&&void 0!==c?c:2.8,roundingRadius:null!==(u=this.options.roundingRadius)&&void 0!==u?u:2,animation:y}});if(!b)return;_.addLayer(b,this.options.zIndex),this.layerId=b.innerId;const x=this.getTileInfo(),w=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,[],A.wz);(0,q.Eu)(b,w);for(let e=0;e<this.vectors.length;e++){const t=this.vectors[e],i=this.getVertices(t,x);w.id=String(e),(0,q.XI)({collector:p,generator:Xu.l.generate,args:[_.getStyle().id,b,w,i]})}const S=p.getAccumulatedData(),M=new R.W("dynamicObject",S.data,this.modules,this.mapState,x.coords,this);this.tileObjects.push(M),f.addObject(M),this.identifyIds.push(S.identifyIds),g&&!this.mapState.disableLayerAnimation?(this.bounceTickerId=`entrance-bounce-${this.uniqId}`,this.growTickerId=`entrance-grow-${this.uniqId}`,this.bounceTickerUpdate=ne.Vx.bind(null,this.bounceTickerId,{step:(e,t)=>this.bouncePosition=t,complete:()=>{this.bounceTickerUpdate=void 0}},this.mapState),this.growTickerUpdate=ne.Vx.bind(null,this.growTickerId,{step:(e,t)=>this.growPosition=t,complete:()=>{this.growTickerUpdate=void 0}},this.mapState),ne.BL(this.bounceTickerId,{easing:T.entranceAnimation.bounceType},this.mapState,-1,0,T.entranceAnimation.bounceTime,null!==(h=this.options.iterationCount)&&void 0!==h?h:Ku,{layerId:this.layerId,styleId:_.getStyle().id}),ne.BL(this.growTickerId,{easing:T.entranceAnimation.growType},this.mapState,0,1,T.entranceAnimation.growTime,null!==(m=this.options.iterationCount)&&void 0!==m?m:Ku,{layerId:this.layerId,styleId:_.getStyle().id})):(this.bouncePosition=0,this.growPosition=1),v.addLayer(this),p.reset(),this.modules.renderer.addRerenderEvent()}update(){super.update(),this.stopTickersOnGlobalAnimationDisabling(),this.bounceTickerUpdate&&this.bounceTickerUpdate(),this.growTickerUpdate&&this.growTickerUpdate()}isOutOfMainReplica(){return!1}entranceAnimationInProgress(){return void 0!==this.bounceTickerUpdate||void 0!==this.growTickerUpdate}remove(){this.destroy()}destroy(){this.bounceTickerUpdate=void 0,this.growTickerUpdate=void 0,this.bounceTickerId&&ne.sT(this.bounceTickerId,this.mapState),this.growTickerId&&ne.sT(this.growTickerId,this.mapState),void 0!==this.layerId&&this.modules.dynamicStyle.removeLayer(this.layerId),super.destroy()}getTileInfo(){const e=le.Ue();for(let t=0;t<this.vectors.length;t++){const i=this.vectors[t];for(let t=0;t<i.length;t++)le.aM(e,i[t])}return(0,Y.Bs)((0,Y.x7)(e))}getVertices(e,t){const i=[],n=[];for(let o=0;o<e.length;o++)(0,Y.a2)($u,e[o],t),i[o]=$u[0],n[o]=$u[1];return{x:i,y:n}}stopTickersOnGlobalAnimationDisabling(){this.mapState.disableLayerAnimation&&(this.bounceTickerId&&(this.bounceTickerUpdate=void 0,ne.sT(this.bounceTickerId,this.mapState)),this.growTickerId&&(this.growTickerUpdate=void 0,ne.sT(this.growTickerId,this.mapState)))}}class Yu{constructor(e){this.layers=[],this.renderer=e.renderer}addLayer(e){this.layers.push(e),this.renderer.addRerenderEvent()}removeLayer(e){const t=this.layers.indexOf(e);-1!==t&&(this.layers.splice(t,1),this.renderer.addRerenderEvent())}getLayers(){return this.layers}getDynamicObjectLayers(){return this.layers.filter((e=>e instanceof k))}getHtmlMarkers(){return this.layers.filter((e=>e instanceof Vu))}entranceAnimationFinished(){return this.layers.every((e=>!(e instanceof qu)||!e.entranceAnimationInProgress()))}}const Ju=()=>"",Qu=[.5,.5];class eh{constructor(e){this.loadingCounter=0,this.isIdle=()=>0===this.loadingCounter,this.modules=e,this.cache={}}getRasterSet(e,t,i,n){return(0,I.mG)(this,void 0,void 0,(function*(){const o=this.getKey(e,i,n),r=this.getFromCache(o,t);if(r)return r;const s=yield this.loadIcon(e,t,i,n);return s&&this.storeInCache(s,o,t),s}))}clear(){this.cache={}}decreaseLoadingCounter(){this.loadingCounter=Math.max(this.loadingCounter-1,0)}loadIcon(e,t,i,n){return(0,I.mG)(this,void 0,void 0,(function*(){const{dynamicStyle:o,workers:r,assetManager:s}=this.modules;let a=e;this.loadingCounter++,t&&(a=yield this.loadImageForTransformer(e).then((e=>t(e))).catch((()=>e)));const l=yield this.loadImage(a);return l?Promise.resolve().then((()=>{i=void 0!==i?i:[l.width,l.height];const e=void 0!==n?[n[0]/i[0],n[1]/i[1]]:Qu,t=[i[0]*window.devicePixelRatio,i[1]*window.devicePixelRatio],s=(0,Xd.W8)([{w:t[0],h:t[1],x:0,y:0,atlasIndex:0,isPacked:!1,anchorX:e[0],anchorY:e[1]}]);o.appendRasterSet(s),r.labeling.addNewRasterSets(o.getStyle().id,[s]);const a=new Uint16Array(3);return a[0]=t[0],a[1]=t[1],a[2]=s.index,r.parser.packRasters(a).then((e=>({packedRasters:e.packedRasters,rasterSet:s,scaledSize:t})))})).then((e=>{const{packedRasters:t,rasterSet:i,scaledSize:n}=e;return void 0!==t&&s.prepareRasters(o.getStyle().id,t,[md(l,n)]),this.decreaseLoadingCounter(),i})):(this.decreaseLoadingCounter(),Promise.resolve(void 0))}))}getFromCache(e,t){const i=this.cache[e];if(i)return i.get(t||Ju)}storeInCache(e,t,i){this.cache[t]||(this.cache[t]=new Map),this.cache[t].set(i||Ju,e)}getKey(e,t,i){return`${e}_${void 0!==t?`${t[0]},${t[1]}`:""}_${void 0!==i?`${i[0]},${i[1]}`:""}`}loadImage(e){return new Promise((t=>{const i=new Image;i.crossOrigin="Anonymous",i.src=e,i.onload=()=>t(i),i.onerror=()=>t(void 0)}))}loadImageForTransformer(e){return-1===e.indexOf(".svg")?new Promise((t=>{const i=new Image;i.crossOrigin="Anonymous",i.src=e,i.onload=()=>{t({type:"raster",source:i})},i.onerror=()=>{t({type:"unknown"})}})):new Promise((t=>{const i=new XMLHttpRequest;i.open("GET",e,!0),i.onload=function(){200===i.status&&0!==i.response.byteLength?t({type:"vector",source:i.response}):t({type:"unknown"})},i.onerror=function(){t({type:"unknown"})},i.send()}))}}const th={trafficOn:!1,parkingOn:!1,navigatorOn:!1,immersiveRoadsOn:!1,floorStackOn:!1,terrainEnabled:!1,graphicsPreset:mt()?"light":"immersive",_activeFloorIds:[],_activeFloorBuildingIds:[],_activeFloorIsMetro:!1,_floorHeight:3.5,_customUserTimeOffset:0};let ih=!1;function nh(e,t){return e=Object.assign({},e),!0===(null==t?void 0:t.immersiveRoadsOff)?(ih=!0,e.immersiveRoadsOn=!1):ih&&(e.immersiveRoadsOn=ih,ih=!1),e.graphicsPreset&&"light"!==e.graphicsPreset&&mt()&&(console.warn(`"${String(e.graphicsPreset)}" graphicsPreset is not supported in deprecated system. Using "light" instead.`),e.graphicsPreset="light"),Object.assign(Object.assign({},th),e)}function oh(e,t,i){return nh(Object.assign(Object.assign(Object.assign({},e),t),{_activeFloorIds:e._activeFloorIds,_activeFloorBuildingIds:e._activeFloorBuildingIds,_activeFloorIsMetro:e._activeFloorIsMetro,_floorHeight:e._floorHeight}),i)}function rh(e,t=[],i=[],n=!1){return Object.assign(Object.assign({},e),{_activeFloorIds:t,_activeFloorBuildingIds:i,_activeFloorIsMetro:n})}var sh=i(8278);const ah=["default","metro"],lh="floorStackTicker",dh=500,ch=500,uh=3,hh=1.5;class mh{constructor(e,t){this.state=e,this.modules=t,this.repository={descriptors:{default:new Map,metro:new Map},requestedFloors:new Set,failedRequestedFloors:new Set,floorIdsToObjectIds:new Map},this.stateDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"}]),this.stack={readiness:0,offsets:new Map,maxOffset:1},this.viewport={index:{metro:Bn(),default:Bn()},metro:{in:null,current:null,out:null},default:{in:null,current:null,out:null}},this.displayedComplex=null,this.needUpdate=!1,this.allowedFloors=new Set,this.hiddenObjectIds=new Set,this.ids={default:t.identifier.getIdScope(Ya.JQ),floor:t.identifier.getIdScope(Ya.PY)};const i=(0,Ue.P)(this._update.bind(this),60);this.prevStyleState=this.state.styleState,this.update=()=>{this.updateReadiness();const e=this.needUpdate||this.stateDiffer.check(this.state);e&&i(),(e||this.prevStyleState!==this.state.styleState)&&(this.updateStyleState(),this.prevStyleState=this.state.styleState),e&&this.updateHiddenIds()}}get maxFloorOffset(){var e;const t=null!==(e=this.state.styleState._floorHeight)&&void 0!==e?e:0;return Math.floor(T.floors.maxStackHeight/t)}get floorHeight(){var e;const t=null!==(e=this.state.styleState._floorHeight)&&void 0!==e?e:0,i=W.H.toGeo(this.state.center);return(0,L.a4)(i,t)}get isMetroEnabled(){return this.state.allowMetro&&this.state.styleZoom>=T.floors.displayStyleZoom.metro}get isDefaultEnabled(){return this.state.styleZoom>=T.floors.displayStyleZoom.default}get isEnabled(){return this.state.floorsEnabled&&(this.isDefaultEnabled||this.isMetroEnabled)}get isStackEnabled(){return this.state.styleState.floorStackOn&&this.floorHeight>0}get hiddenBuildingIds(){if(!this.displayedComplex||"building"===this.displayedComplex.mode||void 0===this.activeFloorIdx)return[];const e=this.displayedComplex.floors[this.activeFloorIdx];if(!e)return[];const t=[];if(e.id&&t.push(this.displayedComplex.id),!e.linked_floors_ids)return t;const i=this.repository.descriptors.default.has(this.displayedComplex.id)?"default":"metro";return this.displayedComplex.buildings.filter((t=>{const n=this.repository.descriptors[i].get(t);return e.linked_floors_ids.some((e=>null==n?void 0:n.floorIds.includes(e)))})).forEach((e=>t.push(e))),t}getActiveFloorHiddenIds(){const e=this.ids.default.getRelatedChildrenIds(this.hiddenObjectIds);return Array.from(this.hiddenObjectIds).concat(e)}prepareFloors(e,t,i,n){"zenith"===n&&i.forEach(((i,n)=>{let o=this.repository.floorIdsToObjectIds.get(n);void 0===o&&(o=new Set,this.repository.floorIdsToObjectIds.set(n,o));for(const e of i)o.add(e);this.loadFloor(n,e,t)}))}changeFloorNumber(e,t){var i;const n=this.viewport.default.current,o=this.viewport.metro.current,r=n||o;if(r&&(r.id===e||r.buildings.includes(e)))if(this.needUpdate=!0,"metro"===t){if(!o)return;o.mode="metro",this.displayedComplex&&this.modules.map.emit("floorcomplexhide",{id:this.displayedComplex.id}),this.displayedComplex=o,this.setFloorIdx(o.defaultFloor),this.modules.map.emit("floorcomplexshow",{id:o.id,mode:"metro",currentFloor:o.defaultFloor,floorNames:o.floors.map((e=>e.name)),firmsToFloorIndexMap:o.firmsToFloorIndexMap})}else if("building"===t)o&&(o.mode="floor"),r.mode="building",this.displayedComplex=null,this.modules.map.emit("floorcomplexhide",{id:e});else{if(t<0||t>=r.floors.length)return;this.setFloorIdx(t),r.selectedFloorIdx=t,o&&"metro"===o.mode&&(o.mode="floor",this.modules.map.emit("floorcomplexhide",{id:o.id})),this.displayedComplex===r||(null===(i=this.displayedComplex)||void 0===i?void 0:i.buildings.includes(r.id))||this.modules.map.emit("floorcomplexshow",{id:r.id,mode:"floor",currentFloor:t,floorNames:r.floors.map((({name:e})=>e)),firmsToFloorIndexMap:r.firmsToFloorIndexMap}),this.displayedComplex=r,r.mode="floor",this.modules.map.emit("floorcomplexlevelchange",{id:e,floorIndex:t,floorName:r.floors[t].name})}}hasDisplayedFloorBuilding(e){if(!this.displayedComplex||"building"===this.displayedComplex.mode)return!1;for(const t of this.hiddenBuildingIds){const i=this.repository.floorIdsToObjectIds.get(t);if(i&&(Array.isArray(e)&&e.some((e=>i.has(e)))||"string"==typeof e&&i.has(e)))return!0}return!1}floorsReady(){return Array.from(this.repository.requestedFloors).every((e=>this.repository.failedRequestedFloors.has(e)||this.repository.descriptors.default.has(e)||this.repository.descriptors.metro.has(e)))}setAllowedFloorIds(e){this.allowedFloors=new Set(null!=e?e:[]),this.needUpdate=!0}isVisibleFloorObject(e){return!!this.displayedComplex&&this.state.styleState._activeFloorIds.includes(e)}isVisibleFloorStackObject(e){if(!this.isStackEnabled)return!1;if(!this.displayedComplex||void 0===this.activeFloorIdx)return!1;let t=!1;for(const i of this.hiddenBuildingIds){if(t)break;t=this.repository.descriptors.default.get(i).floors.some((t=>t.id===e))}if(!t)return!1;const i=this.activeFloorIdx-this.displayedComplex.defaultFloor,n=this.stack.offsets.get(e);return n<this.maxFloorOffset&&i>0&&n>=0&&n<i}getFloorObjectElevation(e,t){if(!this.isStackEnabled||!this.stack.offsets.has(e))return 0;const i=this.stack.offsets.get(e),n=this.floorHeight*i;if(i<=0)return 0;if(i>this.maxFloorOffset)return this.floorHeight*this.maxFloorOffset;if(t)return n;return(0,we.t7)((i-1)/i,1,this.stack.readiness)*n}getFloorStackObjectElevation(e){return this.stack.offsets.has(e)?this.stack.offsets.get(e)*this.floorHeight:0}getFloorsStackObjectOffsets(e){return this.stack.offsets.has(e)?{current:this.stack.offsets.get(e),total:this.stack.maxOffset}:{current:0,total:1}}getPlanLevels(){return this.isStackEnabled?Object.fromEntries(this.stack.offsets):{}}getFloorStackObjectHeight(e){if(!this.isStackEnabled)return 1;return this.displayedComplex.floors.findIndex((t=>{var i;return t.id===e||(null===(i=t.linked_floors_ids)||void 0===i?void 0:i.includes(e))}))<this.activeFloorIdx-1?1:this.stack.readiness}_update(){this.updateViewport();const e=Boolean(this.viewport.default.out&&this.viewport.default.in&&this.viewport.default.in.buildings.includes(this.viewport.default.out.id));this.viewport.default.out?e||this.modules.map.emit("floorcomplexout",{id:this.viewport.default.out.id}):this.viewport.metro.out&&this.modules.map.emit("floorcomplexout",{id:this.viewport.metro.out.id}),this.displayedComplex&&(e||!this.viewport.default.out||this.displayedComplex!==this.viewport.default.out&&!this.displayedComplex.buildings.includes(this.viewport.default.out.id)||"floor"!==this.displayedComplex.mode?this.displayedComplex===this.viewport.metro.out&&"metro"===this.displayedComplex.mode&&(this.modules.map.emit("floorcomplexhide",{id:this.displayedComplex.id}),this.displayedComplex=null):(this.modules.map.emit("floorcomplexhide",{id:this.displayedComplex.id}),this.displayedComplex=null));let t=null;const i=this.viewport.default.in||this.viewport.default.current,n=this.viewport.metro.in||this.viewport.metro.current,o=!e&&this.viewport.default.in||this.viewport.metro.in||this.viewport.default.out&&this.viewport.metro.current;if(i&&(t={id:i.id,mode:"floor"===i.mode?"floor":"building",currentFloor:i.selectedFloorIdx,floorNames:i.floors.map((e=>e.name)),firmsToFloorIndexMap:i.firmsToFloorIndexMap},this.viewport.metro.current&&("metro"===this.viewport.metro.current.mode&&(t.mode="metro"),t.metro={id:this.viewport.metro.current.id,floorNames:this.viewport.metro.current.floors.map((e=>e.name))})),n){if(t){t.metro={id:n.id,floorNames:n.floors.map((e=>e.name))};for(const e in n.firmsToFloorIndexMap)t.firmsToFloorIndexMap[e]=n.firmsToFloorIndexMap[e];"metro"===n.mode&&(t.mode="metro")}else t={id:n.id,mode:"building",currentFloor:n.defaultFloor,floorNames:[],firmsToFloorIndexMap:n.firmsToFloorIndexMap,metro:{id:n.id,floorNames:n.floors.map((e=>e.name))}};"metro"===n.mode&&(t.mode="metro")}t&&o&&this.modules.map.emit("floorcomplexin",t),this.displayFloorComplex(),this.needUpdate=!1}loadFloor(e,t,i){if(this.repository.requestedFloors.has(e))return;const n=(0,P.Gr)("floorMeta",{protocol:this.state.tileProtocol,tileSet:this.state.tileSet,host:this.state.tileServer,subdomain:this.state.subdomains[0],regionId:t.toString(10),floorComplexId:e});this.repository.requestedFloors.add(e),fetch(n).then((e=>{if(!1===e.ok)throw new Error(e.statusText);return e.json()})).then((n=>{var o;let r=n.default_floor_idx,s="default";"is_metro"in n&&n.is_metro&&(r=n.default_metro_floor_idx,s="metro");const a=n.floors.reduce(((e,t,i)=>(t.id&&(e[t.id]=i),e)),{}),l={id:e,regionId:t,metatileHash:i,center:n.center,bound:n.bound,defaultFloor:r,selectedFloorIdx:r,mode:"floor",floors:n.floors,floorIds:n.floors.map((e=>e.id)).filter(Boolean),buildings:n.linked_buildings_ids?n.linked_buildings_ids.concat(e):[e],firmsToFloorIndexMap:Object.entries(null!==(o=n.firm_id_to_floor_id)&&void 0!==o?o:{}).reduce(((e,[t,i])=>(e[t]=a[i],e)),{})};this.repository.descriptors[s].set(e,l),this.viewport.index[s].insert({complex:l,minX:l.bound.min[0],minY:l.bound.min[1],maxX:l.bound.max[0],maxY:l.bound.max[1]}),this.needUpdate=!0})).catch((()=>{this.repository.failedRequestedFloors.add(e)}))}updateStackState(){if(this.stack.offsets.clear(),!this.displayedComplex)return;let e=1;this.displayedComplex.floors.forEach(((t,i)=>{var n;const o=i-this.displayedComplex.defaultFloor;t.id&&this.stack.offsets.set(t.id,o),o>e&&(e=o),null===(n=t.linked_floors_ids)||void 0===n||n.forEach((e=>{this.stack.offsets.set(e,o)}))})),this.stack.maxOffset=e}updateStyleState(){var e;const{styleState:t}=this.state;if(!this.displayedComplex)return void((Array.isArray(t._activeFloorIds)&&t._activeFloorIds.length>0||Array.isArray(t._activeFloorBuildingIds)&&t._activeFloorBuildingIds.length>0)&&(this.state.styleState=rh(t,[],[],!1)));const i=new Set,n=new Set,o=new Set(this.state.styleState._activeFloorIds),r=new Set(this.state.styleState._activeFloorBuildingIds),s=!0===t._activeFloorIsMetro,a=this.displayedComplex;if(!a||void 0===this.activeFloorIdx||"building"===a.mode)return;const l=a.floors[this.activeFloorIdx];l&&(l.id&&i.add(l.id),null===(e=l.linked_floors_ids)||void 0===e||e.forEach((e=>{i.add(e)})),this.hiddenBuildingIds.forEach((e=>n.add(e))),(fh(o,i)||fh(r,n)||s!==("metro"===this.displayedComplex.mode))&&(this.state.styleState=rh(t,Array.from(i),Array.from(n),"metro"===this.displayedComplex.mode)))}updateHiddenIds(){if(!this.displayedComplex)return void this.markHiddenObjectsForUpdate();const e=new Set;this.hiddenBuildingIds.forEach((t=>{const i=this.repository.floorIdsToObjectIds.get(t);i&&i.forEach((t=>e.add(t)))})),this.markHiddenObjectsForUpdate(e)}markHiddenObjectsForUpdate(e){if(e){const t=this.ids.default.getHidden(Ya.Rv.PolygonExtrusion),i=(0,sh.$X)(e,t),n=(0,sh.$X)(this.hiddenObjectIds,e);this.ids.default.hide(Array.from(i),Ya.Rv.PolygonExtrusion);const o=this.ids.floor.getHidden(),r=(0,sh.jV)(i,o);this.ids.default.hide(Array.from(r),Ya.Rv.All),this.ids.default.show(Array.from(n)),this.hiddenObjectIds=new Set(e)}else this.ids.default.show(Array.from(this.hiddenObjectIds)),this.hiddenObjectIds.clear()}updateReadiness(){ne.Vx(lh,{step:(e,t)=>this.stack.readiness=t},this.state)}setFloorIdx(e){this.prevActiveFloorIdx=this.activeFloorIdx,this.activeFloorIdx=e,!Number.isNaN(e)&&this.isStackEnabled&&void 0!==this.prevActiveFloorIdx&&this.activeFloorIdx>this.prevActiveFloorIdx?(this.stack.readiness=0,ne.BL(lh,{easing:"easeOutQuint"},this.state,0,1,500,1)):(this.stack.readiness=1,ne.sT(lh,this.state))}updateViewport(){if(!this.isEnabled)return this.viewport.default={in:null,current:null,out:this.viewport.default.current},void(this.viewport.metro={in:null,current:null,out:this.viewport.metro.current});const e={default:null,metro:null},{center:t,zoom:i,rotation:n,size:o,viewport:r,padding:s,cameraConfig:a,globeMode:l}=this.state,d=new Qn.V({center:t,zoom:i,rotation:n,size:[Math.floor(o[0]*(1-T.floors.viewportPadding)),Math.floor(o[1]*(1-T.floors.viewportPadding))],styleState:{},pitch:0,viewport:r,padding:s,cameraConfig:a,globeMode:l}),c=d.getViewportVertices().map((e=>[e[0],e[1]])),u=function(e){let t=e[0][0],i=e[0][1],n=t,o=i;for(let r=1;r<e.length;r++){const[s,a]=e[r];s<t?t=s:s>n&&(n=s),a<i?i=a:a>o&&(o=a)}return{minX:t,minY:i,maxX:n,maxY:o}}(c),h=[[0,0],[0,0],[0,0],[0,0]];ah.forEach((t=>{if("default"===t&&!this.isDefaultEnabled||"metro"===t&&!this.isMetroEnabled)return;const i=this.viewport.index[t].search(u);let n,o;for(const e of i){if(this.allowedFloors.size>0&&!this.allowedFloors.has(e.complex.id))continue;const t=e.complex.bound;if(_h(d.position,t)){if(n){const i=ph(t);i<n.complexArea&&(n.complex=e.complex,n.complexArea=i)}else n={complex:e.complex,complexArea:ph(t)};continue}h[0][0]=t.min[0],h[0][1]=t.min[1],h[1][0]=t.max[0],h[1][1]=t.min[1],h[2][0]=t.max[0],h[2][1]=t.max[1],h[3][0]=t.min[0],h[3][1]=t.max[1];const i=vh(h,c);if(i.length<3)continue;const r=gh({complex:e.complex,cameraPosition:d.position,intersectionPolygon:i});o?o.score<r&&(o.complex=e.complex,o.score=r):o={complex:e.complex,score:r}}n?e[t]=n.complex:o&&(e[t]=o.complex)})),ah.forEach((t=>{const i=this.viewport[t].current,n=e[t];this.viewport[t].out=i!==n?i:null,this.viewport[t].in=n!==i?n:null,this.viewport[t].current=n}))}displayFloorComplex(){var e;const t=this.viewport.default.current,i=this.viewport.metro.current;if(i&&"metro"===i.mode){if(i===this.displayedComplex)return;this.displayedComplex=i,this.setFloorIdx(i.defaultFloor),this.modules.map.emit("floorcomplexshow",{id:i.id,mode:"metro",currentFloor:i.defaultFloor,floorNames:i.floors.map((e=>e.name)),firmsToFloorIndexMap:i.firmsToFloorIndexMap})}else if(t&&"floor"===t.mode){if(t===this.displayedComplex||(null===(e=this.displayedComplex)||void 0===e?void 0:e.buildings.includes(t.id)))return;this.displayedComplex=t,this.updateStackState(),this.setFloorIdx(this.displayedComplex.selectedFloorIdx),this.modules.map.emit("floorcomplexshow",{id:t.id,mode:"floor",currentFloor:t.selectedFloorIdx,floorNames:t.floors.map((e=>e.name)),firmsToFloorIndexMap:t.firmsToFloorIndexMap})}}}function fh(e,t){if(e.size!==t.size)return!0;for(const i of e)if(!t.has(i))return!0;return!1}function _h(e,t){return e[0]>=t.min[0]&&e[0]<=t.max[0]&&e[1]>=t.min[1]&&e[1]<=t.max[1]}function ph(e){return(e.max[0]-e.min[0])*(e.max[1]-e.min[1])}function vh(e,t){let i=e;for(let e=0;e<t.length;e++){const r=t[e],s=t[(e+1)%t.length],a=i;i=[];for(let e=0;e<a.length;e++){const t=a[e],l=a[(e+1)%a.length];n(l,r,s)?(n(t,r,s)||i.push(o(t,l,r,s)),i.push(l)):n(t,r,s)&&i.push(o(t,l,r,s))}}return i;function n(e,t,i){return(i[0]-t[0])*(e[1]-t[1])>(i[1]-t[1])*(e[0]-t[0])}function o(e,t,i,n){const o=t[1]-e[1],r=e[0]-t[0],s=o*e[0]+r*e[1],a=n[1]-i[1],l=i[0]-n[0],d=a*i[0]+l*i[1],c=o*l-a*r;return 0===c?t:[(l*s-r*d)/c,(o*d-a*s)/c]}}function gh(e){const t=Math.sqrt(Math.pow(e.complex.center[0]-e.cameraPosition[0],2)+Math.pow(e.complex.center[1]-e.cameraPosition[1],2)),i=t/(dh*L.C),n=Math.max(0,1-i),o=t<ch*L.C?hh:1,r=function(e){let t=0;for(let i=0,n=e.length-1;i<e.length;n=i++)t+=(e[n][0]+e[i][0])*(e[n][1]-e[i][1]);return Math.abs(t/2)}(e.intersectionPolygon)*o*(1+n*uh);return r}class yh{constructor(e,t){this.state=e,this.modules=t,this.tileLayers=[],this.objects=[],this.viewportDiffer=new Ve.H([{path:"center",type:"vec3"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"},{path:"globeMode",type:"boolean"},{path:"elevation",type:"number"},{path:"minElevation",type:"number"},{path:"handyStyleId",type:"string"}])}getMemoryFootprint(e=(()=>!0)){const t={tileLayers:this.tileLayers.filter(e).map((e=>({[e.getSourceType()]:e.memSizeJs()}))),objects:this.objects.filter((e=>"dynamicObject"===e.purpose)).map((e=>({[e.purpose]:(0,Ke.X5)(e)})))},i={tileLayers:this.tileLayers.filter(e).map((e=>({[e.getSourceType()]:e.memSizeGpu()}))),objects:this.objects.filter((e=>"dynamicObject"===e.purpose)).map((e=>({[e.purpose]:(0,Ke.Hh)(e)})))};return{js:Object.assign(Object.assign({},t),{"--sum":(0,Ke.QE)(t)}),gpu:Object.assign(Object.assign({},i),{"--sum":(0,Ke.QE)(i)})}}addTileLayer(e){-1===this.tileLayers.indexOf(e)&&(this.tileLayers.push(e),e.redraw(),this.modules.identifier.resetCache(),this.state.needLabeling=!0,this.modules.renderer.addRerenderEvent())}removeTileLayer(e){(0,we.VJ)(this.tileLayers,e)&&(e.resetHoverId(),this.modules.identifier.resetCache(),this.state.needLabeling=!0,this.modules.renderer.addRerenderEvent())}redraw(){this.modules.labeler.clearPreviousLabels();for(const e of this.tileLayers)e.resetHoverId(),e.redraw();this.modules.renderer.addRerenderEvent()}activateStyleUpdating(){this.tileLayers.forEach((e=>e.activateStyleUpdating()))}finishStyleUpdating(){this.tileLayers.forEach((e=>e.finishStyleUpdating()))}getViewportTiles(){const e=[];for(const t of this.tileLayers)e.push(...t.getViewportTiles());return e}viewportTilesReady(){return this.tileLayers.every((e=>e.viewportTilesReady()))}displayedTilesAnimationFinished(){return this.tileLayers.every((e=>e.displayedTilesAnimationFinished()))}getDisplayedIdentifyData(){const e=[];for(const t of this.tileLayers)e.push(...t.getDisplayedIdentifyData());return e}getLabelingData(){return this.tileLayers.map((e=>e.getLabelingData()))}isIdle(){return this.viewportTilesReady()&&this.displayedTilesAnimationFinished()}update(){const e=this.state;this.viewportDiffer.check(e)&&(this.tileLayers.forEach((e=>e.updateViewport())),this.modules.map.emit("viewportchange"));for(const e of this.tileLayers)e.update();if(this.updateTickers(),e.collectStats){this.state.stats.tileCount=0;for(const e of this.tileLayers)this.state.stats.tileCount+=e.getTileCount();this.state.stats.globeTileCount=this.objects.filter((e=>"globe"===e.purpose)).length,this.state.stats.dynamicTileCount=this.objects.filter((e=>"dynamicObject"===e.purpose||"floor"===e.purpose)).length}}getTileObjects(){return this.objects}addObject(e,t){if(-1===this.objects.indexOf(e)){if(this.objects.push(e),t)return;this.modules.renderer.addRerenderEvent()}}removeObject(e,t){if((0,we.VJ)(this.objects,e)){if(t)return;this.modules.renderer.addRerenderEvent()}}getCachedMods(){const e=[];for(const t of this.tileLayers){const i=t.gridState.tileModsCache.getData();for(const t of i)e.push(t)}return e}destroy(){for(const e of this.tileLayers)e.destroy();this.objects.forEach((e=>e.clean(this.state)))}updateTickers(){this.objects.forEach((e=>e.updateTicker(this.state)))}}const bh=ne.Vx.bind(null,"labelingOpacity",{step:(e,t)=>e.labelingOpacity=t});class xh{constructor(e,t){this.state=e,this.modules=t,this.labelTileRevision=0,this.viewportDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"}]),this.useThrottleUpdate=!0,this.isLabelingInProgress=!1,this.skipHysteresisInNextLabeling=!1,this.alwaysActiveLabelKeys=[],this.survivedLabelBoxes=new Set,this.prevSurvivedCommPoiIds=new Set,this.demKeys={},this.labelTiles=[],this.worker=(e=>({appendLabels:e.get(ju.P.Labeling,"appendLabels"),appendLabelBox:e.get(ju.P.Labeling,"appendLabelBox"),removeLabels:e.get(ju.P.Labeling,"removeLabels"),processLabels:e.get(ju.P.Labeling,"processLabels"),clearPreviousLabels:e.get(ju.P.Labeling,"clearPreviousLabels")}))(this.modules.workers.fnRegistry),this.setLabelingInterval(T.labeling.interval)}disableThrottleUpdateOnce(){this.useThrottleUpdate=!1}update(){bh(this.state),this.state.needReplicasUpdate&&this.labelTiles.forEach((e=>{e.needSync=!0})),!this.viewportDiffer.check(this.state)&&!this.state.needLabeling||this.isLabelingInProgress||(this.state.needLabeling=!1,this.isLabelingInProgress=!0,this.useThrottleUpdate?this.throttledUpdateLabeling():(this.useThrottleUpdate=!0,this.generateLabelingTile()))}isIdle(){return void 0===this.state.tickers.labelingOpacity&&!this.isLabelingInProgress&&!this.state.needLabeling}setLabelingInterval(e){this.throttledUpdateLabeling=(0,Ue.P)((()=>{this.generateLabelingTile()}),e)}addLabels(e,t,i){this.worker.appendLabels(e,t,i,this.state.styleState,this.state.styleZoom),this.enrichWithElevation(i,e),this.alwaysActiveLabelKeys.push(e),this.state.needLabeling=!0}addTileLabels(e,t,i){this.worker.appendLabels(e,t,i,this.state.styleState,this.state.styleZoom),this.enrichWithElevation(i,e),this.state.needLabeling=!0}addLabelBox(e,t){this.worker.appendLabelBox(e,t),this.state.needLabeling=!0}removeLabels(e){this.worker.removeLabels(e);const t=this.alwaysActiveLabelKeys.indexOf(e);-1!==t&&this.alwaysActiveLabelKeys.splice(t,1),this.state.needLabeling=!0}isLabelBoxSurvived(e){return this.survivedLabelBoxes.has(e)}clearPreviousLabels(){this.worker.clearPreviousLabels()}resetHysteresis(){this.skipHysteresisInNextLabeling=!0,this.state.needLabeling=!0}getLabelingRevision(){return this.labelTileRevision}getMemoryFootprint(){const e={labelTiles:this.labelTiles.map((e=>({[e.purpose]:(0,Ke.Hh)(e)})))};return{gpu:Object.assign(Object.assign({},e),{"--sum":(0,Ke.QE)(e)})}}generateLabelingTile(){const e=(0,Y.x7)((0,jn.BS)(this.state.tilesBounds),T.labeling.tileMultiplier);let t=[{coords:e,center:this.state.center,tilesBounds:this.state.tilesBounds}];if(!this.state.globeMode)if(e[2]<0)t=[{coords:[0,0,0,0],center:[0,0,0],tilesBounds:[[-G.ed,-G.ed,0],[G.ed,-G.ed,0],[G.ed,G.ed,0],[-G.ed,G.ed,0]]}];else{const i=(0,Y.Sl)(e),n=Math.pow(2,e[2]),o=i.min[0]<-G.ed,r=i.max[0]>G.ed;if(o||r){const i=[...e];i[0]+=o?n:-n;const r=[...this.state.center];r[0]+=o?G.sX:-G.sX;const{min:s,max:a}=(0,Y.Sl)(i);t.push({coords:i,center:r,tilesBounds:[[s[0],s[1],0],[a[0],s[1],0],[a[0],a[1],0],[s[0],a[1],0]]})}}const i=this.modules.tileManager.getLabelingData(),n=t.map((({coords:e,center:t,tilesBounds:i})=>({center:t,elevation:this.state.elevation,zoom:this.state.zoom,styleZoom:this.state.styleZoom,rotation:this.state.rotation,size:this.state.size,pitch:this.state.pitch,viewport:this.state.viewport,padding:this.state.padding,globeMode:this.state.globeMode,styleState:this.state.styleState,buildingHeight:this.modules.buildingHeightAnimator.getDefaultBuildingHeight(),tilesBounds:i,debugLabels:this.modules.labelsDebug.isEnabled(),disableSurvivedPoiPrevalence:this.state.disableSurvivedPoiPrevalence,tileInfo:(0,Y.Bs)(e),cameraConfig:this.state.cameraConfig}))),o=function(e,t){const{config:i,ascSortedZoomNumbers:n}=t;if(0===n.length)return{city:T.labeling.commercialMargins.city};if(e<n[0])return{city:i[n[0]]};if(e>=n[n.length-1])return{city:i[n[n.length-1]]};for(let t=1;t<n.length;t++)if(e<n[t])return{city:i[n[t-1]]};return{city:T.labeling.commercialMargins.city}}(this.state.styleZoom,this.state.cityCommPoiLabeling);this.worker.processLabels(i,this.alwaysActiveLabelKeys,n,window.devicePixelRatio,this.modules.floorManager.getActiveFloorHiddenIds(),Object.assign(Object.assign({},T.labeling.commercialMargins),o),this.skipHysteresisInNextLabeling,this.modules.floorManager.getPlanLevels()).then((i=>{this.survivedLabelBoxes.clear(),this.labelTiles.forEach((e=>{this.modules.tileManager.removeObject(e),e.clean(this.state)})),this.labelTiles.length=0;const n=[];i.forEach(((e,i)=>{e.survivedLabelBoxIds.forEach((e=>this.survivedLabelBoxes.add(e))),n.push(...e.survivedCommPois),this.modules.assetManager.loadRasters(e.collectorOutput.rastersToLoad);const o=new R.W("labeling",e.collectorOutput.data,this.modules,this.state,t[i].coords,void 0,void 0);this.labelTiles.push(o),this.modules.tileManager.addObject(o)})),this.processSurvivedCommPoiIds(n),this.labelTileRevision++;const o=this.state.metrics;void 0===o.firstlabeling&&i.some((({collectorOutput:e})=>e.data.length>0))&&(o.firstlabeling=performance.now()-o.start);const{animationTime:r,animationType:s,interval:a}=T.labeling;var l,d,c,u,h;l=this.state,d=s,c=0,u=1,h=Math.min(r,a),ne.BL("labelingOpacity",{easing:d},l,c,u,h,1),this.modules.renderer.addRerenderEvent(),i[0].labels&&e[2]>=0&&this.modules.labelsDebug.drawLabels(i[0].labels),this.isLabelingInProgress=!1})),this.skipHysteresisInNextLabeling=!1}processSurvivedCommPoiIds(e){if(0===e.length)return void this.prevSurvivedCommPoiIds.clear();const t=e.filter((e=>!this.prevSurvivedCommPoiIds.has(e.id)));0!==t.length&&this.modules.map.emit("commpoishow",{commPois:t}),this.prevSurvivedCommPoiIds=new Set(e.map((e=>e.id)))}enrichWithElevation(e,t){const{demManager:i,map:n}=this.modules;if(n.state.demMode){const n=this.demKeys[t],o=i.getLabelsDemKey(e);if(void 0===o||o===n)return;i.enrichWithElevation(e),this.demKeys[t]=o}}}const wh=10,Sh=7,Mh=3,Ih=2,Th=0,Eh=4,Ph=2,Ah="#ffffff",Lh="#667799",Ch="#ffffff",zh=5,kh=4,Oh=2,Rh=1,Fh="#667799",Bh="#ffffff",Dh="#00000026",jh="#66779966",Nh=13,Uh={start:{en:"Start",ru:"Старт"},addPoint:{en:"Add point",ru:"Добавить точку"},meter:{en:"m",ru:"м"},kilometer:{en:"km",ru:"км"}};function Hh(e,t,i){if(t)return Uh.start[i]||Uh.start.en;if(e<1e3)return`${e} ${Uh.meter[i]||Uh.meter.en}`;return`${(e/1e3).toFixed(1)} ${Uh.kilometer[i]||Uh.kilometer.en}`}function Gh(e,t){return`\n        <div style="font-size: ${t}px;\n            color: #667799;\n            user-select: none;\n            font-family: SuisseIntl, Helvetica, Arial, sans-serif;\n            text-shadow: 1px 0px 1px #fff, -1px 0px 1px #fff, 0px 1px 1px #fff, 0px -1px 1px #fff;\n            white-space: nowrap;\n            cursor: pointer;\n        ">\n            ${e}\n        </div>\n    `}function Vh(e,t){return`\n        <div style="text-shadow: 1px 0px 1px #fff, -1px 0px 1px #fff, 0px 1px 1px #fff, 0px -1px 1px #fff;\n            user-select: none;\n            color: #667799;\n            font-family: SuisseIntl, Helvetica, Arial, sans-serif;\n            font-size: 13px;\n            margin: -12px 0 0 12px; /** отступы от точки наведения */\n            white-space: nowrap;\n            cursor: pointer;\n        ">\n            ${e}\n            <br>\n            ${function(e){return Uh.addPoint[e]||Uh.addPoint.en}(t)}\n        </div>\n    `}function Zh(e,t,i,n){return new ie(n,{coordinates:e,interactive:i,draggable:i,width:t?Sh:Th,borderWidth:t?Mh:Eh,border2Width:t?Ih:Ph,color:Ah,borderColor:Lh,border2Color:Ch,zIndex:wh})}function Wh(e,t,i){return new f_(i,{coordinates:e,zIndex:zh,zIndex2:zh-1,zIndex3:zh-2,width:kh,width2:t?0:kh+2*Oh,width3:t?0:kh+2*(Oh+Rh),color:t?jh:Fh,color2:Bh,color3:Dh,interactive:!t})}const Xh="PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjIiIGhlaWdodD0iMjIiPjxkZWZzPjxwYXRoIGlkPSJBIiBkPSJNMTIgMTAuNTg2bDMuNzkzLTMuNzkzIDEuNDE0IDEuNDE0TDEzLjQxNCAxMmwzLjc5MyAzLjc5My0xLjQxNCAxLjQxNEwxMiAxMy40MTRsLTMuNzkzIDMuNzkzLTEuNDE0LTEuNDE0TDEwLjU4NiAxMiA2Ljc5MyA4LjIwN2wxLjQxNC0xLjQxNEwxMiAxMC41ODZ6Ii8+PC9kZWZzPjxnIGZpbGwtcnVsZT0iZXZlbm9kZCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEgLTEpIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMC41IiBmaWxsPSIjZmZmIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1vcGFjaXR5PSIuMTUiLz48bWFzayBpZD0iQiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjQSIvPjwvbWFzaz48dXNlIGZpbGw9IiMwMDAiIGZpbGwtcnVsZT0ibm9uemVybyIgeGxpbms6aHJlZj0iI0EiLz48ZyBmaWxsPSIjMjYyNjI2IiBtYXNrPSJ1cmwoI0IpIj48cGF0aCBkPSJNMCAwaDI0djI0SDB6Ii8+PC9nPjwvZz48L3N2Zz4=";class Kh extends C.c{constructor(e,t,i,n){super(),this.markerOrLabelMouseover=()=>{this.markerOrLabelHovered||(this.markerOrLabelHovered=!0,void 0===this.hoverTimer&&this.emit("mouseover"))},this.markerOrLabelMouseout=()=>{this.markerOrLabelHovered&&(this.markerOrLabelHovered=!1,this.hoverTimer=window.setTimeout((()=>{this.markerOrLabelHovered||(this.emit("mouseout"),this.hoverTimer=void 0)}),100))},this.onClick=()=>this.emit("click"),this.labelText=Hh(n,i,e.state.lang),this.point=t,this.distance=n,this.label=function(e,t,i,n){const o=Gh(i,Nh),r=function(e,t){return.55*t*e.length}(i,Nh);return new Vu(n,{coordinates:e,html:o,offset:[((t?Sh:Th)+2*(t?Mh:Eh)+2*(t?Ih:Ph))/2+2,-Nh/2-2],labeling:{type:"full",width:r,height:Nh},animate:!1,zIndex:zh+1})}(t,i,this.labelText,e),this.marker=Zh(t,i,!0,e),this.markerOrLabelHovered=!1;const o=this.label.dangerouslyGetRootElement();o.addEventListener("mouseover",this.markerOrLabelMouseover),o.addEventListener("mouseout",this.markerOrLabelMouseout),o.addEventListener("click",this.onClick),this.marker.on("mouseover",(()=>this.markerOrLabelMouseover())),this.marker.on("mouseout",(()=>this.markerOrLabelMouseout())),this.marker.on("dragstart",(e=>{const{lngLat:t,originalEvent:i,point:n,target:o}=e;this.emit("dragstart",{lngLat:t,originalEvent:i,point:n,targetData:this,target:o})})),this.marker.on("dragend",(e=>{const{lngLat:t,originalEvent:i,point:n,target:o}=e;this.emit("dragend",{lngLat:t,originalEvent:i,point:n,targetData:this,target:o})}))}getDistance(){return this.distance}getPoint(){return this.point}getMarkerUniqId(){return this.marker.uniqId}getLabelUniqId(){return this.label.uniqId}setPoint(e){this.point=e}remove(){this.marker.destroy();const e=this.label.dangerouslyGetRootElement();e.removeEventListener("mouseover",this.markerOrLabelMouseover),e.removeEventListener("mouseout",this.markerOrLabelMouseout),e.removeEventListener("click",this.onClick),this.label.destroy()}activateHover(){this.label.setContent(`\n        <img style="\n            user-select: none;\n            width: 24px;\n            height: 24px;\n            margin-top: -4px;\n            cursor: pointer;\n        " src="data:image/svg+xml;base64,${Xh}" alt="close">\n    `)}deactivateHover(){this.label.setContent(Gh(this.labelText,Nh))}}class $h{constructor(e,t){this.onDocumentMouseMove=e=>{this.mousePos=(0,F.yK)(this.modules.layout.rootContainer,e.clientX,e.clientY),this.needsUpdate=!0},this.modules=t,this.state=e,this.joints=[],this.enabled=!1,this.needsUpdate=!1,this.hidePreviewLine=!1,this.hideMouseElem=!1,this.mousePos=[0,0],document.addEventListener("mousemove",this.onDocumentMouseMove),this.langDiffer=new Ve.H([{path:"lang",type:"string"}])}destroy(){document.removeEventListener("mousemove",this.onDocumentMouseMove)}enable(){this.enabled||(this.enabled=!0,this.state.identifyPickDistance=2*T.identify.pickDistance,this.popup=new Vu(this.modules.map,{coordinates:[0,0],html:"",interactive:!1,animate:!1,zIndex:1}))}disable(){this.enabled=!1,this.reset(),void 0!==this.mouseElem&&(this.mouseElem.destroy(),this.mouseElem=void 0),this.state.identifyPickDistance=T.identify.pickDistance,this.popup&&(this.popup.destroy(),this.popup=void 0)}update(){this.enabled&&(this.langDiffer.check(this.state)&&this.recalculate(),this.needsUpdate&&(this.needsUpdate=!1,this.drawMousePoint(),this.drawPreviewLine()))}setPoints(e){this.reset(),e.forEach((e=>this.addPointToEnd(e))),this.drawPolyline(),this.sendRulerChangeEvent(!1)}handleClick(e,t){const i=this.getJointByUniqId(t&&t.dynamicObjectId);if(i){const e=this.getJointIndexByReferer(i);void 0!==e&&(i.remove(),this.joints.splice(e,1),this.recalculate(),this.hidePreviewLine=!1,this.hideMouseElem=!1),this.popup&&this.popup.setContent("")}else if(t&&this.polyline&&this.polyline.uniqId===t.dynamicObjectId){const t=this.polyline.snapPoint(e),i=this.getJointIndexByDistance(t.distance),n=this.createJoint(t.point,!1,t.distance);this.joints.splice(i,0,n),this.hidePreviewLine=!0,this.hideMouseElem=!0,this.drawPolyline(),this.sendRulerChangeEvent(!0),this.popup&&this.popup.setContent("")}else{const t=this.modules.camera.unproject(e);this.addPointToEnd(t),this.drawPolyline(),this.sendRulerChangeEvent(!0)}}recalculate(){const e=[];this.joints.forEach(((t,i)=>{t.remove();const n=0===i;let o=0;if(!n){const n=e[i-1];o=n.getDistance()+(0,L.vn)(n.getPoint(),t.getPoint())}const r=this.createJoint(t.getPoint(),n,o);e.push(r)})),this.joints=e,this.drawPolyline(),this.sendRulerChangeEvent(!0)}sendRulerChangeEvent(e){this.modules.map.emit("rulerchange",{points:this.getPoints(),isUser:e})}getJointByUniqId(e){if(void 0!==e)for(const t of this.joints)if(e===t.getMarkerUniqId()||e===t.getLabelUniqId())return t}getJointIndexByDistance(e){let t=0;for(const i of this.joints){if(e<i.getDistance())break;t++}return t}getJointIndexByReferer(e){let t=0;for(const i of this.joints){if(i===e)return t;t++}}getPoints(){return this.joints.map((e=>e.getPoint()))}reset(){this.joints.forEach((e=>e.remove())),this.joints=[],void 0!==this.polyline&&(this.polyline.remove(),this.polyline=void 0),void 0!==this.previewLine&&(this.previewLine.remove(),this.previewLine=void 0),this.hidePreviewLine=!1,this.hideMouseElem=!1,this.popup&&this.popup.setContent("")}createJoint(e,t,i){const n=new Kh(this.modules.map,e,t,i);return n.on("mouseover",(()=>{void 0===this.draggableJointIndex&&(this.requestUpdate(!0,!0),n.activateHover())})),n.on("mouseout",(()=>{void 0===this.draggableJointIndex&&(this.requestUpdate(!1,!0),n.deactivateHover())})),n.on("dragstart",(()=>{this.requestUpdate(!1,!0),this.draggableJointIndex=this.getJointIndexByReferer(n)})),n.on("dragend",(e=>{this.requestUpdate(!1,!0),this.draggableJointIndex=void 0,n.setPoint(e.lngLat),this.recalculate()})),n.on("click",(()=>{const e=this.getJointIndexByReferer(n);void 0!==e&&(n.remove(),this.joints.splice(e,1),this.recalculate(),this.hidePreviewLine=!1,this.hideMouseElem=!1),this.popup&&this.popup.setContent("")})),n}addPointToEnd(e){let t=!0,i=0;if(this.joints.length>0){t=!1;const n=this.joints[this.joints.length-1];i=n.getDistance()+(0,L.vn)(n.getPoint(),e)}const n=this.createJoint(e,t,i);this.joints.push(n)}drawPolyline(){void 0!==this.polyline&&(this.polyline.remove(),this.polyline=void 0);const e=this.getPoints();if(e.length<2)return;const t=Wh(e,!1,this.modules.map);t.on("mousemove",(e=>{if(void 0===this.draggableJointIndex){if(this.popup){const i=t.snapPoint(e.point),n=Hh(i.distance,!1,this.state.lang);this.popup.setPosition(i.point),this.popup.setContent(Vh(n,this.state.lang)),this.snapPoint=i.point}this.requestUpdate(!0,!1)}})),t.on("mouseout",(()=>{void 0===this.draggableJointIndex&&(this.popup&&this.popup.setContent(""),this.requestUpdate(!1,!0))})),this.polyline=t}requestUpdate(e,t){this.hidePreviewLine=e,this.hideMouseElem=t,this.needsUpdate=!0}getPreviewPoints(){const e=this.getPoints();if(this.hidePreviewLine||e.length<1)return[];const t=this.draggableJointIndex,i=this.modules.camera.unproject(this.mousePos);if(void 0===t||1===e.length)return[];if(t===this.joints.length-1)return[e[e.length-2],i];if(0===t)return[e[1],i];const n=this.joints[t-1],o=this.joints[t+1];return[n.getPoint(),i,o.getPoint()]}drawPreviewLine(){void 0!==this.previewLine&&(this.previewLine.remove(),this.previewLine=void 0);const e=this.getPreviewPoints();e.length<1||(this.previewLine=Wh(e,!0,this.modules.map))}drawMousePoint(){void 0!==this.mouseElem&&(this.mouseElem.destroy(),this.mouseElem=void 0),this.hideMouseElem||void 0===this.snapPoint||(this.mouseElem=Zh(this.snapPoint,!0,!1,this.modules.map))}}class qh{constructor(e,t,i){this.type=e,this.handler=i,this.mouseDownPoint=t,this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionstart",{target:"pitch/rotation"})}processAction(e){switch(e.type){case"mousemove":return this.processMouseMoveAction(e);case"mouseup":return this.processMouseUpAction(e);case"keyup":return this.processKeyUpAction(e);default:return this}}processMouseMoveAction(e){const t=(0,F.yK)(this.handler.container,e.clientX,e.clientY);return new Yh(this.type,this.mouseDownPoint,t,this.handler)}processMouseUpAction(e){switch(this.type){case"keyPrimary":if(0===e.button&&(e.ctrlKey||e.metaKey))return this.returnToInitialState();break;case"secondary":if(2===e.button){const t=(0,F.yK)(this.handler.container,e.clientX,e.clientY);return this.handler.modules.identifier.search("contextmenu",t,!0).then((i=>{K("contextmenu",i,e,t,this.handler.modules)})),this.returnToInitialState()}break;case"auxiliary":if(1===e.button)return this.returnToInitialState()}return this}processKeyUpAction(e){return"keyPrimary"!==this.type||"Control"!==e.key&&"Meta"!==e.key?this:(this.handler.modules.map.emit("interactionend",{target:"pitch/rotation"}),new Jh(this.mouseDownPoint,this.handler))}returnToInitialState(){return this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionend",{target:"pitch/rotation"}),new sm(this.handler)}}class Yh{constructor(e,t,i,n){this.type=e,this.mouseDownPoint=t,this.mouseMovePoint=i,this.handler=n,this.handler.mapState.userHasInteracted=!0,this.handler.mapState.disablePitchByUserInteraction&&this.handler.mapState.disableRotationByUserInteraction||this.handler.container.classList.add("mapgl-rotating"),this.update(this.handler.mapState)}processAction(e){switch(e.type){case"mousemove":return this.processMouseMoveAction(e);case"mouseleave":return this.returnToInitialState();case"mouseup":return this.processMouseUpAction(e);case"keyup":return this.processKeyUpAction(e);default:return this}}update(e){0===this.mouseDownPoint[0]&&0===this.mouseDownPoint[1]&&(this.mouseDownPoint=this.mouseMovePoint);const t=(0,we.Te)(e.size,this.mouseDownPoint),i=(0,we.Te)(e.size,this.mouseMovePoint),n=(t[0]-i[0])*T.zoom.mouseRotateDelta,o=(i[1]-t[1])*T.zoom.mousePitchDelta;He(e),e.disableRotationByUserInteraction||ye(e,e.rotation+n,{animate:!1}),e.disablePitchByUserInteraction||Me(e,(0,we.uZ)(e.pitch+o,e.minPitch,e.maxPitch),{animate:!1}),this.mouseDownPoint=this.mouseMovePoint,this.handler.modules.renderer.addRerenderEvent()}processMouseMoveAction(e){return this.mouseMovePoint=(0,F.yK)(this.handler.container,e.clientX,e.clientY),this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState),this}processMouseUpAction(e){switch(this.type){case"keyPrimary":if(0===e.button&&(e.ctrlKey||e.metaKey))return this.returnToInitialState();break;case"secondary":if(2===e.button)return this.returnToInitialState();break;case"auxiliary":if(1===e.button)return this.returnToInitialState()}return this}processKeyUpAction(e){return"keyPrimary"!==this.type||"Control"!==e.key&&"Meta"!==e.key?this:(this.handler.container.classList.remove("mapgl-rotating"),this.handler.modules.map.emit("interactionend",{target:"pitch/rotation"}),new Jh(this.mouseMovePoint,this.handler))}returnToInitialState(){return this.handler.mapState.userHasInteracted=!0,this.handler.container.classList.remove("mapgl-rotating"),this.handler.modules.map.emit("interactionend",{target:"pitch/rotation"}),new sm(this.handler)}}class Jh{constructor(e,t){this.handler=t,this.toInitialOnMouseUp=!1,this.mouseDownPoint=e,this.dragStartPoint=e,this.isTimerStarted=void 0!==this.handler.dblClickTimer,this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionstart",{target:"center"}),this.isTimerStarted&&(window.clearTimeout(this.handler.dblClickTimer),this.handler.dblClickTimer=void 0)}processAction(e){switch(e.type){case"mousedown":return this.toInitialOnMouseUp=!0,this;case"mouseup":return this.processMouseUpAction(e);case"mousemove":return this.processMouseMoveAction(e);case"click":return this.processMouseClickAction(e);case"keydown":return this.processKeyDownAction(e);default:return this}}processMouseUpAction(e){return 0!==e.button||!this.toInitialOnMouseUp&&this.handler.modules.layout.isActionWithCanvas(e)?this:(this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionend",{target:"center"}),new sm(this.handler))}processMouseMoveAction(e){const t=(0,F.yK)(this.handler.container,e.clientX,e.clientY);return this.handler.mapState.disableDragging?(this.mouseDownPoint=t,this.dragStartPoint=t,this.toInitialOnMouseUp=!0,this):O.TE(this.mouseDownPoint,t)<T.events.dragThreshold?(this.dragStartPoint=t,this):new Qh(t,this.dragStartPoint,this.handler)}processMouseClickAction(e){if(!this.handler.modules.layout.isActionWithCanvas(e))return this;if(this.isTimerStarted){if(this.handler.mapState.zoom<this.handler.mapState.maxZoom){const t=this.handler.mapState,i=Math.min(t.zoom+1,t.maxZoom),n=(0,F.yK)(this.handler.container,e.clientX,e.clientY);He(t),Pe(t,i,{duration:T.zoom.animDuration,zoomPoint:t.keepCenterWhileUserZoomRotate?void 0:n}),this.handler.modules.renderer.addRerenderEvent()}}else{const t=(0,F.yK)(this.handler.container,e.clientX,e.clientY);this.handler.modules.identifier.search("mouseClick",t,!0).then((i=>{const n=this.handler.modules.ruler;n.enabled?n.handleClick(t,i):this.handler.dblClickTimer||(this.handler.dblClickTimer=window.setTimeout((()=>{K("click",i,e,t,this.handler.modules),this.handler.dblClickTimer=void 0}),T.events.doubleClickTime))}))}return this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionend",{target:"center"}),new sm(this.handler)}processKeyDownAction(e){return"Control"===e.key||"Meta"===e.key?(this.handler.modules.map.emit("interactionend",{target:"center"}),new qh("keyPrimary",this.mouseDownPoint,this.handler)):this}}class Qh{constructor(e,t,i){this.mouseMovePoint=e,this.dragStartPoint=t,this.handler=i,this.handler.container.classList.add("mapgl-dragging"),this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState)}processAction(e){switch(e.type){case"mousemove":return this.processMouseMoveAction(e);case"mouseup":return this.processMouseUpAction(e);case"keydown":return this.processKeyDownAction(e);default:return this}}update(e){const t=this.handler.modules.camera,i=t.flat.unproject(this.dragStartPoint),n=t.flat.unproject(this.mouseMovePoint);if(e.globeMode){const o=(0,L.OD)(t.globeRatio,W.H.toGeo(e.center));ae.bA(i,i,o),ae.bA(n,n,o)}const o=ae.d9(e.center);ae.IH(o,o,i),ae.lu(o,o,n),He(e),fe(e,o,{animate:!1}),this.dragStartPoint=this.mouseMovePoint,this.handler.modules.renderer.addRerenderEvent()}processMouseMoveAction(e){return this.mouseMovePoint=(0,F.yK)(this.handler.container,e.clientX,e.clientY),this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState),this}processMouseUpAction(e){return 0===e.button?this.returnToInitialState():this}processKeyDownAction(e){return"Control"===e.key||"Meta"===e.key?(this.handler.container.classList.remove("mapgl-dragging"),this.handler.modules.map.emit("interactionend",{target:"center"}),new qh("keyPrimary",this.mouseMovePoint,this.handler)):this}returnToInitialState(){return this.handler.container.classList.remove("mapgl-dragging"),this.handler.modules.map.emit("interactionend",{target:"center"}),this.handler.mapState.userHasInteracted=!0,new sm(this.handler)}}class em{constructor(e,t,i){this.handler=i,this.touchStartPoints=t,this.touchMovePoints=e,this.handler.mapState.userHasInteracted=!0,this.handler.mapState.disablePitchByUserInteraction||this.handler.container.classList.add("mapgl-rotating"),this.update(this.handler.mapState)}processAction(e){switch(e.type){case"touchstart":return this.processTouchStartAction(e);case"touchmove":return this.processTouchMoveAction(e);case"touchend":return this.processTouchEndAction(e);default:return this}}processTouchStartAction(e){return this.handler.container.classList.remove("mapgl-rotating"),this.handler.modules.map.emit("interactionend",{target:"pitch/zoom/rotation"}),new nm(e,this.handler,!1)}processTouchMoveAction(e){return e.preventDefault(),this.touchMovePoints=(0,F.KK)(e.touches,this.handler.container),this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState),this}processTouchEndAction(e){return this.handler.container.classList.remove("mapgl-rotating"),this.handler.modules.map.emit("interactionend",{target:"pitch/zoom/rotation"}),0===e.touches.length?(this.handler.mapState.userHasInteracted=!0,new sm(this.handler)):new nm(e,this.handler,!1)}}class tm extends em{constructor(e,t,i){super(e,t,i),this.startPxAngle=0,this.rotationDetected=!1,t.length>1&&(this.startPxAngle=(0,kd.Hl)(t[0],t[1]))}update(e){if(this.touchStartPoints.length<2||this.touchMovePoints.length<2)return;const t=(0,kd.L$)(this.touchMovePoints[0],this.touchMovePoints[1]),i=O.TK(this.touchMovePoints[0],this.touchMovePoints[1])/O.TK(this.touchStartPoints[0],this.touchStartPoints[1]),n=e.zoom+Math.log(i)/Math.log(2)*T.zoom.mobilePinchDelta;let o=0,r=0;if(!this.rotationDetected){const e=(0,kd.Hl)(this.touchMovePoints[0],this.touchMovePoints[1]);r=Math.abs(this.startPxAngle-e),r>Math.PI&&(r=2*Math.PI-r),r>=this.handler.mapState.touchRotationThreshold&&(this.rotationDetected=!0)}if(this.rotationDetected){const e=this.handler.modules.camera.flat.unproject(this.touchStartPoints[0]),t=this.handler.modules.camera.flat.unproject(this.touchStartPoints[1]),i=this.handler.modules.camera.flat.unproject(this.touchMovePoints[0]),n=this.handler.modules.camera.flat.unproject(this.touchMovePoints[1]);if(e&&t&&i&&n){o=(0,kd.Hl)(e,t)-(0,kd.Hl)(i,n)}}const s=e.rotation+o,a=e.center;e.keepCenterWhileUserZoomRotate||ae.IH(a,e.center,(0,we.Kv)(e,t,{zoom:n,rotation:s})),He(e),fe(e,a,{animate:!1}),Pe(e,n,{animate:!1}),this.handler.mapState.disableRotationByUserInteraction||ye(e,s,{animate:!1}),this.touchStartPoints=this.touchMovePoints,this.handler.modules.renderer.addRerenderEvent()}}class im extends em{constructor(e,t,i){super(e,t,i)}update(e){const t=this.touchStartPoints.map((t=>(0,we.Te)(e.size,t))),i=this.touchMovePoints.map((t=>(0,we.Te)(e.size,t))),n=(0,kd.L$)(t[0],t[1]),o=((0,kd.L$)(i[0],i[1])[1]-n[1])*T.zoom.mousePitchDelta;He(e),Me(e,(0,we.uZ)(e.pitch+o,e.minPitch,e.maxPitch),{animate:!1}),this.touchStartPoints=this.touchMovePoints,this.handler.modules.renderer.addRerenderEvent()}}class nm{constructor(e,t,i){this.handler=t,this.needClickOnTouchEnd=i,this.toZoomRotate=!1,this.touchStartPoints=(0,F.KK)(e.touches,this.handler.container),this.handler.mapState.userHasInteracted=!0,this.isTimerStarted=void 0!==this.handler.dblClickTimer,(0,F.N2)(e)?this.startedInteractionTarget="pitch/zoom/rotation":this.isTimerStarted?(this.startedInteractionTarget="zoom/rotation",window.clearTimeout(this.handler.dblClickTimer),this.handler.dblClickTimer=void 0):this.startedInteractionTarget="center",this.handler.modules.map.emit("interactionstart",{target:this.startedInteractionTarget})}processAction(e){switch(e.type){case"touchstart":return this.processTouchStartAction(e);case"touchmove":return this.processTouchMoveAction(e);case"touchend":return this.processTouchEndAction(e);default:return this}}getStartedInteractionTarget(){return this.startedInteractionTarget}processTouchStartAction(e){return e.preventDefault(),1===this.touchStartPoints.length&&(this.needClickOnTouchEnd=!1,this.handler.modules.map.emit("interactionend",{target:"center"}),this.startedInteractionTarget="pitch/zoom/rotation",this.handler.modules.map.emit("interactionstart",{target:this.startedInteractionTarget}),this.handler.mapState.userHasInteracted=!0),this.touchStartPoints=(0,F.KK)(e.touches,this.handler.container),this}processTouchMoveAction(e){e.preventDefault();const t=(0,F.KK)(e.touches,this.handler.container);if(!(0,F.N2)(e))return O.TE(this.touchStartPoints[0],t[0])<T.events.dragThreshold?(this.touchStartPoints=t,this):this.isTimerStarted?new rm(t[0],this.touchStartPoints[0],this.handler):this.handler.mapState.disableDragging?(this.touchStartPoints=t,this.needClickOnTouchEnd=!1,this):new om(t[0],this.touchStartPoints[0],this.handler);if(this.touchStartPoints.length<2)return this.processTouchStartAction(e);const i=O.Ue(),n=O.Ue();O.lu(i,t[0],this.touchStartPoints[0]),O.lu(n,t[1],this.touchStartPoints[1]);const o=O.AK(i,n);if(o>0){if(this.handler.mapState.enableTwoFingerDragging&&2===this.touchStartPoints.length)return O.TE(this.touchStartPoints[0],t[0])<T.events.dragThreshold?(this.touchStartPoints=t,this):new om(t[0],this.touchStartPoints[0],this.handler);const e=O.TE(this.touchStartPoints[0],t[0]),i=O.TE(this.touchStartPoints[1],t[1]);return e<T.events.pitchThreshold||i<T.events.pitchThreshold?(this.touchStartPoints=t,this):this.handler.mapState.disablePitchByUserInteraction?this:new im(t,this.touchStartPoints,this.handler)}if(o<0)return new tm(t,this.touchStartPoints,this.handler);return(0,kd.se)(i)||(0,kd.se)(n)?this.pitchWaitingTimer?this:this.toZoomRotate?(this.toZoomRotate=!1,new tm(t,this.touchStartPoints,this.handler)):(this.pitchWaitingTimer=window.setTimeout((()=>{this.toZoomRotate=!0,this.pitchWaitingTimer=void 0}),T.events.pitchWaitingTime),this):new tm(t,this.touchStartPoints,this.handler)}processTouchEndAction(e){return e.cancelable&&e.preventDefault(),0===e.touches.length?1===e.changedTouches.length&&this.needClickOnTouchEnd?this.processTouchClickAction(this.touchStartPoints[0],e):(this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionend",{target:e.changedTouches.length>1?"pitch/zoom/rotation":"center"}),new sm(this.handler)):((0,F.N2)(e)||(this.handler.modules.map.emit("interactionend",{target:"pitch/zoom/rotation"}),this.startedInteractionTarget="center",this.handler.modules.map.emit("interactionstart",{target:this.startedInteractionTarget}),this.handler.mapState.userHasInteracted=!0),this.touchStartPoints=(0,F.KK)(e.touches,this.handler.container),this)}processTouchClickAction(e,t){if(this.isTimerStarted){if(this.handler.mapState.zoom<this.handler.mapState.maxZoom){const t=this.handler.mapState,i=Math.min(t.zoom+1,t.maxZoom),n=t.keepCenterWhileUserZoomRotate?void 0:e;He(t),Pe(t,i,{duration:T.zoom.animDuration,zoomPoint:n}),this.handler.modules.renderer.addRerenderEvent()}}else if(this.handler.modules.layout.isActionWithCanvas(t))this.handler.modules.identifier.search("mouseClick",e,!0).then((i=>{const n=this.handler.modules.ruler;n.enabled?n.handleClick(e,i):this.handler.dblClickTimer||(this.handler.dblClickTimer=window.setTimeout((()=>{K("click",i,t,e,this.handler.modules),this.handler.dblClickTimer=void 0}),T.events.doubleClickTime))}));else{const e=t.changedTouches[0];t.target&&e&&t.target.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}))}return this.handler.mapState.userHasInteracted=!0,this.handler.modules.map.emit("interactionend",{target:"center"}),new sm(this.handler)}}class om{constructor(e,t,i){this.handler=i,this.touchMovePoint=e,this.touchStartPoint=t,this.handler.mapState.userHasInteracted=!0,this.handler.container.classList.add("mapgl-dragging"),this.update(this.handler.mapState)}processAction(e){switch(e.type){case"touchstart":return this.processTouchStartAction(e);case"touchmove":return this.processTouchMoveAction(e);case"touchend":return this.processTouchEndAction();default:return this}}update(e){const t=this.handler.modules.camera,i=t.flat.unproject(this.touchStartPoint),n=t.flat.unproject(this.touchMovePoint);if(e.globeMode){const o=(0,L.OD)(t.globeRatio,W.H.toGeo(e.center));ae.bA(i,i,o),ae.bA(n,n,o)}const o=ae.d9(e.center);ae.IH(o,o,i),ae.lu(o,o,n),He(e),fe(e,o,{animate:!1}),this.touchStartPoint=this.touchMovePoint,this.handler.modules.renderer.addRerenderEvent()}processTouchStartAction(e){return this.handler.container.classList.remove("mapgl-dragging"),this.handler.modules.map.emit("interactionend",{target:"center"}),new nm(e,this.handler,!1)}processTouchMoveAction(e){e.preventDefault();const t=(0,F.KK)(e.touches,this.handler.container);return this.touchMovePoint=t[0],this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState),this}processTouchEndAction(){return this.handler.container.classList.remove("mapgl-dragging"),this.handler.modules.map.emit("interactionend",{target:"center"}),this.handler.mapState.userHasInteracted=!0,new sm(this.handler)}}class rm{constructor(e,t,i){this.handler=i,this.mapHeight=i.mapState.size[1],this.startZoom=i.mapState.zoom,this.touchMovePointY=e[1],this.touchStartPoint=t,this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState)}processAction(e){switch(e.type){case"touchstart":return this.processTouchStartAction(e);case"touchmove":return this.processTouchMoveAction(e);case"touchend":return this.processTouchEndAction();default:return this}}update(e){const t=this.touchMovePointY-this.touchStartPoint[1];if(0===t)return;const i=t/this.mapHeight,n=(0,we.uZ)(this.startZoom+i*T.zoom.mobileTapDelta,e.minZoom,e.maxZoom),o=e.center;e.keepCenterWhileUserZoomRotate||ae.IH(o,e.center,(0,we.Kv)(e,this.touchStartPoint,{zoom:n})),He(e),fe(e,o,{animate:!1}),Pe(e,n,{animate:!1}),this.handler.modules.renderer.addRerenderEvent()}processTouchStartAction(e){return this.handler.modules.map.emit("interactionend",{target:"zoom/rotation"}),new nm(e,this.handler,!1)}processTouchMoveAction(e){e.preventDefault();const t=(0,F.KK)(e.touches,this.handler.container);return this.touchMovePointY=t[0][1],this.handler.mapState.userHasInteracted=!0,this.update(this.handler.mapState),this}processTouchEndAction(){return this.handler.modules.map.emit("interactionend",{target:"zoom/rotation"}),this.handler.mapState.userHasInteracted=!0,new sm(this.handler)}}class sm{constructor(e){this.handler=e}processAction(e){switch(e.type){case"mousedown":return this.processMouseDownAction(e);case"touchstart":return this.processTouchStartAction(e);default:return this}}processMouseDownAction(e){const t=(0,F.yK)(this.handler.container,e.clientX,e.clientY);switch(e.button){case 0:if(e.ctrlKey||e.metaKey)return new qh("keyPrimary",t,this.handler);if(this.handler.modules.layout.isActionWithCanvas(e)){K("mousedown",this.handler.modules.identifier.searchSync(t),e,t,this.handler.modules)}return new Jh(t,this.handler);case 1:return new qh("auxiliary",t,this.handler);case 2:return new qh("secondary",t,this.handler);default:return this}}processTouchStartAction(e){if(e.preventDefault(),!e.touches)return this;if(this.handler.modules.layout.isActionWithCanvas(e)){const t=(0,F.yK)(this.handler.container,e.changedTouches[0].clientX,e.changedTouches[0].clientY);K("touchstart",this.handler.modules.identifier.searchSync(t),e,t,this.handler.modules)}return new nm(e,this.handler,1===e.touches.length)}}class am{processAction(){return this}}class lm{constructor(e,t){this.preventDefault=e=>{e.preventDefault()},this.onMouseMove=e=>{this.dblClickTimer&&(this.dblClickTimer=void 0),this.switchState(e)},this.onTouchStart=e=>{this.modules.layout.isActionWithMap(e)&&this.switchState(e)},this.switchState=e=>{this.state;const t=this.state.processAction(e);this.state instanceof am||(this.state=t)},this.state=new sm(this),this.mapState=e,this.modules=t,this.container=t.layout.mapContainer,document.addEventListener("mouseup",this.switchState),document.addEventListener("keydown",this.switchState),document.addEventListener("keyup",this.switchState),document.addEventListener("mouseleave",this.switchState),document.addEventListener("mousemove",this.onMouseMove),this.container.addEventListener("click",this.switchState),this.container.addEventListener("mousedown",this.switchState),this.container.addEventListener("mouseout",this.switchState),document.addEventListener("touchstart",this.onTouchStart),document.addEventListener("touchend",this.switchState),document.addEventListener("touchmove",this.switchState),this.container.addEventListener("dragstart",this.preventDefault),this.container.addEventListener("drag",this.preventDefault),this.container.addEventListener("dragend",this.preventDefault),this.container.addEventListener("contextmenu",this.preventDefault),this.container.addEventListener("touchmove",this.preventDefault)}destroy(){document.removeEventListener("mouseup",this.switchState),document.removeEventListener("keydown",this.switchState),document.removeEventListener("keyup",this.switchState),document.removeEventListener("mouseleave",this.switchState),document.removeEventListener("mousemove",this.onMouseMove),this.container.removeEventListener("click",this.switchState),this.container.removeEventListener("mousedown",this.switchState),this.container.removeEventListener("mouseout",this.switchState),document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchend",this.switchState),document.removeEventListener("touchmove",this.switchState),this.container.removeEventListener("dragstart",this.preventDefault),this.container.removeEventListener("drag",this.preventDefault),this.container.removeEventListener("dragend",this.preventDefault),this.container.removeEventListener("contextmenu",this.preventDefault),this.container.removeEventListener("touchmove",this.preventDefault)}block(){if(this.state instanceof am)return;const{map:e}=this.modules;switch(this.container.classList.remove("mapgl-dragging"),this.container.classList.remove("mapgl-rotating"),this.state.constructor){case Jh:case Qh:case om:e.emit("interactionend",{target:"center"});break;case qh:case Yh:e.emit("interactionend",{target:"pitch/rotation"});break;case rm:e.emit("interactionend",{target:"zoom/rotation"});break;case tm:case im:e.emit("interactionend",{target:"pitch/zoom/rotation"});break;case nm:{const t=this.state.getStartedInteractionTarget();e.emit("interactionend",{target:t});break}}this.state=new am}unblock(){this.state instanceof sm||this.state instanceof am&&(this.state=new sm(this))}}var dm=i(9311),cm=i(4288),um=i(4635),hm=i(9833),mm=i(1683),fm=i(1285);const _m=new Set([G.$Q]);class pm extends Error{constructor(e,t){super(e),this.name="TrafficFetchMetaError",this.noRetry=t}}class vm{constructor(e,t){this.mapState=e,this.modules=t,this.fetchMetaRetryAttempt=null,this.justEnabled=this.mapState.trafficOn,this.isMetaLoading=!1,this.lastUpdateTime=-1/0,this.regionIds=new Set,this.id=(0,z.fD)();const i=t.identifier.getIdScope(Ya.JQ);this.gridState=(0,um.y7)("traffic",0,this.id,e.trafficMinZoom,e.trafficMaxZoom,e.trafficMinZoom,e.trafficMaxDetailLevel,t,e,i),this.viewportDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"demMode",type:"boolean"}])}show(){this.mapState.trafficOn||(this.mapState.trafficOn=!0,this.justEnabled=!0,this.modules.map.patchStyleState({trafficOn:!0}),this.modules.map.emit("trafficshow"))}hide(){this.mapState.trafficOn&&((0,um.d1)(this.gridState),this.mapState.trafficOn=!1,this.justEnabled=!1,this.modules.map.patchStyleState({trafficOn:!1}),this.modules.map.emit("traffichide"))}isEnabled(){return this.mapState.trafficOn}destroy(){(0,um.d1)(this.gridState)}redraw(){this.mapState.trafficOn&&((0,um.d1)(this.gridState),(0,dm.o)(this.gridState,this.mapState,this.modules))}activateStyleUpdating(){this.mapState.trafficOn&&(0,fm.I2)(this.gridState,this.mapState.handyStyleId,this.modules.styleManager.getStyleRevision(this.mapState.handyStyleId),this.modules.map.core.getIsFirstStyleUpdate())}finishStyleUpdating(){this.mapState.trafficOn&&(0,fm.cA)(this.gridState)}update(){if(!this.mapState.trafficOn)return;let e=!1;if((0,we.TH)(this.regionIds,this.mapState.shownRegionIds)||(this.regionIds=new Set(this.mapState.shownRegionIds),e=!0),Date.now()-this.lastUpdateTime>T.traffic.updateInterval&&(e=!0,this.fetchMetaRetryAttempt=null),null!==this.fetchMetaRetryAttempt&&this.fetchMetaRetryAttempt<T.traffic.fetchMetaRetryDelays.length&&Date.now()-this.lastUpdateTime>T.traffic.fetchMetaRetryDelays[this.fetchMetaRetryAttempt]&&(this.fetchMetaRetryAttempt++,e=!0),e&&this.fetchMeta(),void 0===this.timestamp)return;(this.viewportDiffer.check(this.mapState)||this.justEnabled)&&(this.justEnabled=!1,(0,dm.o)(this.gridState,this.mapState,this.modules),this.modules.renderer.addRerenderEvent());const t=Object.assign({},this.gridState.displayedMods);(0,cm.r)(this.gridState,this.mapState,this.modules),this.fetch((0,um.w1)(this.gridState),this.timestamp),this.abortFetch((0,um.lH)(this.gridState)),this.generate((0,um.e)(this.gridState)),this.clearTiles((0,um.HM)(this.gridState)),(0,um.aq)(this.modules,this.mapState,this.gridState,t)}viewportTilesReady(){return(0,um.ej)(this.gridState.tiles,this.gridState.viewportTiles)}getMemoryFootprint(){const e=this.gridState,t={gridState:{displayedMods:Object.keys(e.displayedMods).map((t=>(0,Ke.gt)(e.displayedMods[t]))),tileModsCache:e.tileModsCache.keys().filter((t=>!e.displayedMods[t])).map((t=>(0,Ke.gt)(e.tileModsCache.get(t))))}},i={gridState:{displayedMods:Object.keys(e.displayedMods).map((t=>(0,Ke.LO)(e.displayedMods[t]))),tileModsCache:e.tileModsCache.keys().filter((t=>!e.displayedMods[t])).map((t=>(0,Ke.LO)(e.tileModsCache.get(t))))}};return{js:Object.assign(Object.assign({},t),{"--sum":(0,Ke.QE)(t)}),gpu:Object.assign(Object.assign({},t),{"--sum":(0,Ke.QE)(i)})}}fetch(e,t){e.sort(((e,t)=>(0,Y.qu)(this.mapState.center,e,t))).forEach((e=>function(e,t,i,n,o){if(!n.size)return;t.workers.parser.fetchTrafficTile({coords:e.coords,tileServer:i.trafficServer,tileProtocol:i.trafficProtocol||i.tileProtocol,regionIds:Array.from(n),timestamp:o}).then((()=>{e.status===hm.z3.Loading&&(e.serverMetadata=[{regionId:0,metatileHash:-2}])}))}(e,this.modules,this.mapState,this.regionIds,t)))}abortFetch(e){e.forEach((e=>{this.modules.workers.parser.abortTrafficTileRequest(e.key)}))}generate(e){e.sort(((e,t)=>(0,Y.qu)(this.mapState.center,e,t))).forEach((e=>{const t=(0,hm._v)(e);t&&this.modules.workers.parser.generateTrafficTile({styleId:this.mapState.handyStyleId,coords:e.coords,pixelRatio:window.devicePixelRatio,styleState:this.mapState.styleState,sourceId:this.modules.defaultSource.getId()}).then((e=>{e?Array.isArray(e.results)&&(0,mm.aK)(t,e.results):(0,Jo.wm)("traffic")}))}))}clearTiles(e){for(const t of e)this.modules.workers.parser.deleteTrafficTile(t.key),delete this.gridState.tiles[t.key]}fetchMeta(){if(this.isMetaLoading||!this.regionIds.size)return;if((0,we.TH)(this.regionIds,_m))return console.warn("Traffic metadata request skip: only Universe"),void(this.lastUpdateTime=Date.now());this.isMetaLoading=!0;const e=this.mapState,t=(0,P.XK)(T.traffic.timestampUrl,{host:e.trafficServer,protocol:e.trafficProtocol||e.tileProtocol,regions:Array.from(this.regionIds).join(",")});fetch(t).then((e=>{if(e.ok)return e.json();throw new pm(`Request traffic timestamp error with status ${e.status}`,!1)})).then((e=>{var t,i;if(!e.length||void 0===(null===(t=e[0])||void 0===t?void 0:t.time)||void 0===(null===(i=e[0])||void 0===i?void 0:i.score))throw new pm(`Bad traffic timestamp and score response ${e.toString()}`,!0);let n=0;e.forEach((e=>n+=e.score)),n=Math.round(n/e.length),this.modules.map.emit("trafficscore",{score:n}),this.timestamp=e[0].time,this.isMetaLoading=!1,this.lastUpdateTime=Date.now(),this.fetchMetaRetryAttempt=null,this.redraw()})).catch((e=>{var t;e instanceof pm&&e.noRetry?this.fetchMetaRetryAttempt=null:this.fetchMetaRetryAttempt=null!==(t=this.fetchMetaRetryAttempt)&&void 0!==t?t:0,this.lastUpdateTime=Date.now(),this.isMetaLoading=!1,console.error(e)}))}}class gm{constructor(e){this.externalContainer=e,this.rootContainer=document.createElement("div"),this.rootContainer.style.position="relative",this.rootContainer.style.height="100%",this.rootContainer.style.width="100%",this.rootContainer.style.overflow="hidden",this.externalContainer.appendChild(this.rootContainer),this.mapContainer=document.createElement("div"),this.mapContainer.style.position="relative",this.mapContainer.style.height="100%",this.mapContainer.style.width="100%",this.mapContainer.style.touchAction="none",this.mapContainer.style.webkitUserSelect="none",this.mapContainer.style.userSelect="none",this.rootContainer.appendChild(this.mapContainer),this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.mapContainer.appendChild(this.canvas),this.htmlContainerInMap=document.createElement("div"),this.htmlContainerInMap.style.position="absolute",this.htmlContainerInMap.style.left="0",this.htmlContainerInMap.style.top="0",this.htmlContainerInMap.style.width="100%",this.htmlContainerInMap.style.height="0",this.htmlContainerInMap.style.webkitUserSelect="auto",this.htmlContainerInMap.style.userSelect="auto",this.mapContainer.appendChild(this.htmlContainerInMap),this.htmlContainerOutMap=document.createElement("div"),this.htmlContainerOutMap.style.position="absolute",this.htmlContainerOutMap.style.left="0",this.htmlContainerOutMap.style.top="0",this.htmlContainerOutMap.style.width="100%",this.htmlContainerOutMap.style.height="0",this.mapContainer.after(this.htmlContainerOutMap)}setCanvasSize(e,t){const i=window.devicePixelRatio;return this.canvas.width=e*i,this.canvas.height=t*i,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this}destroy(){for(;this.externalContainer.lastChild;)this.externalContainer.removeChild(this.externalContainer.lastChild)}isActionWithCanvas(e){return e.target===this.canvas}isActionWithMap(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent)return this.isTargetInMap(e.target);return Array.from(e.touches).map((e=>e.target)).some((e=>this.isTargetInMap(e)))}isTargetInMap(e){return!!(e&&e instanceof Node)&&this.mapContainer.contains(e)}}class ym{constructor(e){this.loadingCounter=0,this.isIdle=()=>0===this.loadingCounter,this.modules=e,this.textureKeys=[],this.texturesMap=new Map}addTexture(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){this.loadingCounter++;const i=yield hd(e);return this.storeTexture(i,t)}))}addPreparedTexture(e){const t=`prepared-${(0,z.fD)()}`;return this.textureKeys.push(t),this.texturesMap.set(t,e),this.textureKeys.length-1}updatePreparedTexture(e,t){this.deleteTexture(e),this.texturesMap.set(this.textureKeys[e],t)}loadTexture(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){this.loadingCounter++;const i=yield this.loadImage(e);if(i)return this.storeTexture(i,t);this.decreaseLoadingCounter()}))}getTexture(e){return this.texturesMap.get(this.textureKeys[e])}destroy(){this.textureKeys=[],this.texturesMap.clear()}deleteTexture(e){var t;const i=this.textureKeys[e];return null===(t=this.texturesMap.get(i))||void 0===t||t.remove(),this.texturesMap.delete(i)}getMemoryFootprint(){const e={texturesMap:Array.from(this.texturesMap.values()).map(Ke.Y5)},t={texturesMap:Array.from(this.texturesMap.values()).map(Ke.dr)};return{js:Object.assign(Object.assign({},e),{"--sum":(0,Ke.QE)(e)}),gpu:Object.assign(Object.assign({},t),{"--sum":(0,Ke.QE)(t)})}}decreaseLoadingCounter(){this.loadingCounter=Math.max(this.loadingCounter-1,0)}storeTexture(e,t){var i,n;const o=null==t?void 0:t.size,r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:window.devicePixelRatio,s=null!==(n=null==t?void 0:t.imagePadding)&&void 0!==n?n:1;this.decreaseLoadingCounter();const a=function(e,t){const i=void 0!==t?`_${t[0]},${t[1]}`:"";return`${e}${i}`}(e.getAttribute("src")||e.currentSrc,o),l=this.textureKeys.indexOf(a);if(l>-1&&this.texturesMap.has(a))return l;const d=(o?[o[0],o[1]]:[e.width,e.height]).map((e=>e*r)),c=md(e,d);e.remove();const u=d.map((e=>e+2*s));if(!(null==t?void 0:t.skipAtlasSizeChecking)&&(u[0]>T.atlasSize[0]||u[1]>T.atlasSize[1]))throw new Error(`Image texture dimensions ${u} are larger than the maximum possible ${T.atlasSize}`);const h=new nt(void 0,{size:u,flipY:!1,magFilter:nt.LinearFilter,minFilter:nt.LinearFilter});return this.modules.renderer.prepareTexture(h),h.subImage(c,s,s),c.remove(),this.texturesMap.set(a,h),this.textureKeys.push(a),this.modules.renderer.addRerenderEvent(),this.textureKeys.length-1}loadImage(e){return(0,I.mG)(this,void 0,void 0,(function*(){return new Promise((t=>{const i=new Image;i.crossOrigin="Anonymous",i.src=e,i.onload=()=>t(i),i.onerror=()=>t(void 0)}))}))}}var bm=i(6849);const xm=[0];class wm{constructor(e){this.isLoading=!1,this.attempts=0,this.getKeyInfo=()=>(0,I.mG)(this,void 0,void 0,(function*(){return yield this.request})),this.isIdle=()=>!this.isLoading;const{tileKey:t,keyUrl:i}=e;if(t!==T.tiles.tileKey&&bm.ns){const e=(0,P.IG)(i,{keyID:t});this.isLoading=!0;const n=()=>(0,I.mG)(this,void 0,void 0,(function*(){return xm.length>=this.attempts?(this.attempts&&(yield new Promise((e=>{this.lastTimeout=window.setTimeout(e,1e3*xm[this.attempts])})),this.clearLastTimeout()),this.attempts++,fetch(e).then((e=>e.ok?e.json():n()),n)):(console.error("Could not load tile key info. A style layers with commercial POI will be added to applied styles."),Promise.resolve(void 0))}));this.request=n().then((e=>{if(this.isLoading=!1,!e||!e.result||200!==e.meta.code)return{showCommPoi:true,hideCopyright:false,urbi:false,error:!0};const{showCommPoi:t,hideCopyright:i,urbi:n}=e.result.service.properties.public;return{showCommPoi:!!(0,we.Rw)(t)||!!t,hideCopyright:!(0,we.Rw)(i)&&!!i,urbi:!(0,we.Rw)(n)&&!!n}}))}else this.request=Promise.resolve({showCommPoi:!1,urbi:!1,hideCopyright:!0})}destroy(){this.clearLastTimeout()}clearLastTimeout(){void 0!==this.lastTimeout&&(clearTimeout(this.lastTimeout),this.lastTimeout=void 0)}}class Sm{constructor(){this.sources=[],this.viewportSources=[]}addSource(e){this.sources.push(e),"geojson"===e.type&&"viewport-internal"===e.subtype&&e instanceof j.T0&&this.viewportSources.push(e)}removeSource(e){this.sources=this.sources.filter((t=>t.getId()!==e)),this.viewportSources=this.viewportSources.filter((t=>t.getId()!==e))}getSourceById(e){return this.sources.find((t=>t.getId()===e))}updateViewportSources(){this.viewportSources.forEach((e=>e.update()))}}var Mm=i(7231);class Im{constructor(e){this.modules=e,this.id=(0,N.Q)(),this.type="globe"}destroy(){}update(){}fetchTiles(e){return e.map((()=>Promise.resolve([])))}generateTile(e,t,i){const n=(0,Y.Bs)(t),o=this.modules.collector,r=this.modules.styleManager.getStyle(i);if(!r||!r.environment)return Promise.resolve({results:[]});(0,q.XI)({collector:o,generator:Ei.D.sinks.fill.generate,args:[r,r.environment,n]});const s=o.getAccumulatedData();return Promise.resolve({results:[{styleId:i,metatileHash:-1,regionId:-1,collectorOutput:s}]})}abortTileFetches(){}deleteTiles(){}setAttributes(){}getAttributes(){return{}}}const Tm="gltfModels";class Em{constructor(e,t){var i,n;this.modules=t,this.type="default",this.id=(0,N.Q)(),this.state=e,this.options={tileServer:e.tileServer,tileSet:e.tileSet,tileProtocol:e.tileProtocol,tileKey:e.tileKey,subdomains:e.subdomains,appId:e.appId,defaultLang:e.tileServerDefaultLang,sessionId:null!==(i=e.tileSessionId)&&void 0!==i?i:e.sessionId,isDefaultSource:!0,modelsPath:e.defaultSourceModelsRootUrl,promoteId:"id",idScope:Ya.JQ,identifyAsDefaultSource:!0},this.modelsAppearStrategy=null!==(n=e.defaultSourceModelsAppearStrategy)&&void 0!==n?n:G.jm,this.zenithSource=new U.nt(this.id,this.modules,this.options),this.universeTileLayer=new H.I(0,T.tiles.maxUniverseZoom,0,T.tiles.maxUniverseZoom,this.modules,e,this.zenithSource,{requestOddTiles:e.mobileSdkMode}),this.universeTileLayer.getLabelingData=()=>{const e=H.I.prototype.getLabelingData.call(this.universeTileLayer);return this.regionalTileLayer.isBlank()||(e.labelsKeys=[]),e},this.modules.tileManager.addTileLayer(this.universeTileLayer),this.regionalTileLayer=new H.I(T.tiles.maxUniverseZoom+1,T.tiles.maxRegionalZoom,T.tiles.maxUniverseZoom+1,T.tiles.maxDetailLevel,this.modules,e,this.zenithSource,{requestOddTiles:e.mobileSdkMode}),this.modules.tileManager.addTileLayer(this.regionalTileLayer),this.commercialPoiSource=new Mm.n(this.id,this.modules,{url:(0,P.Nt)("commercialPoi",{host:e.tileServer,tileSet:e.commercialTileSet,protocol:T.tiles.protocol,lang:e.lang}),flipY:!0,identifyAsDefaultSource:!0,promoteId:"db_id"}),this.commercialPoiTileLayer=new H.I(T.commercialPoi.minZoom,T.commercialPoi.maxZoom,T.commercialPoi.minZoom,j.rR,this.modules,e,this.commercialPoiSource,{viewportPadding:G.bQ}),this.modules.tileManager.addTileLayer(this.commercialPoiTileLayer),this.createModelsSource(),this.modules.sourceStorage.addSource(this)}destroyModelsSource(){this.modelsSource&&(this.modelsSource=null,this.modelsTileLayer&&this.modules.tileManager.removeTileLayer(this.modelsTileLayer))}createModelsSource(){var e;this.modelsSource||(this.modelsSource=new Mm.n(this.id,this.modules,{minZoom:T.models.minZoom,maxZoom:T.models.maxZoom,url:(0,P.Nt)({url:this.state.modelsTilesUrl},{host:this.state.tileServer,tileSet:this.state.modelsTileSet,protocol:T.tiles.protocol,lang:this.state.lang}),ignoreMissingTiles:!0,identifyAsDefaultSource:!0,promoteId:"building_id",modelsPath:null!==(e=this.state.defaultSourceModelsRootUrl)&&void 0!==e?e:(0,P.Nt)("gltfModel",{host:this.state.tileServer,tileSet:this.state.tileSet,protocol:T.tiles.protocol,lang:this.state.lang}),flipY:!0,attributes:{sourceName:Tm}}),this.modelsTileLayer=new H.I(T.models.minZoom,T.models.maxZoom,T.models.minZoom,T.tiles.maxDetailLevel,this.modules,this.state,this.modelsSource,{viewportPadding:G.bQ}),this.modules.tileManager.addTileLayer(this.modelsTileLayer))}getMemoryFootprint(){const e=Object.assign({regionalTileLayer:this.regionalTileLayer.memSizeJs(),universeTileLayer:this.universeTileLayer.memSizeJs(),modelsTileLayer:this.modelsTileLayer?this.modelsTileLayer.memSizeJs():{}},this.commercialPoiTileLayer&&{commercialPoiTileLayer:this.commercialPoiTileLayer.memSizeJs()}),t=Object.assign({regionalTileLayer:this.regionalTileLayer.memSizeGpu(),universeTileLayer:this.universeTileLayer.memSizeGpu(),modelsTileLayer:this.modelsTileLayer?this.modelsTileLayer.memSizeGpu():{}},this.commercialPoiTileLayer&&{commercialPoiTileLayer:this.commercialPoiTileLayer.memSizeGpu()});return{js:Object.assign(Object.assign({},e),{"--sum":(0,Ke.QE)(e)}),gpu:Object.assign(Object.assign({},t),{"--sum":(0,Ke.QE)(t)})}}destroy(){var e,t;this.modules.tileManager.removeTileLayer(this.universeTileLayer),this.universeTileLayer.destroy(),this.modules.tileManager.removeTileLayer(this.regionalTileLayer),this.regionalTileLayer.destroy(),this.zenithSource.destroy(),this.commercialPoiTileLayer&&(this.modules.tileManager.removeTileLayer(this.commercialPoiTileLayer),this.commercialPoiTileLayer.destroy()),null===(e=this.commercialPoiSource)||void 0===e||e.destroy(),this.modelsTileLayer&&(this.modules.tileManager.removeTileLayer(this.modelsTileLayer),this.modelsTileLayer.destroy()),null===(t=this.modelsSource)||void 0===t||t.destroy(),this.modules.sourceStorage.removeSource(this.id),this.removeGlobeSource()}setAttributes(e){var t,i,n;this.zenithSource.setAttributes(Object.assign(Object.assign({},e),A.so)),this.universeTileLayer.redraw(),this.regionalTileLayer.redraw(),null===(t=this.commercialPoiSource)||void 0===t||t.setAttributes(e),null===(i=this.commercialPoiTileLayer)||void 0===i||i.redraw(),null===(n=this.modelsSource)||void 0===n||n.setAttributes(Object.assign(Object.assign({},e),{sourceName:Tm})),this.modelsTileLayer&&this.modelsTileLayer.redraw()}getAttributes(){return this.zenithSource.getAttributes()}getId(){return this.id}getZoomDirection(){return this.regionalTileLayer.getZoomDirection()}setHoverId(e){this.regionalTileLayer.setHoverId(e)}setDisabledRegionsId(e){this.regionalTileLayer.disabledRegions=e,this.universeTileLayer.disabledRegions=e}resetHoverId(){this.regionalTileLayer.resetHoverId()}setFeatureStateMap(e){var t,i;this.zenithSource.setFeatureStateMap(e),null===(t=this.modelsSource)||void 0===t||t.setFeatureStateMap(e),this.universeTileLayer.onFeatureStateMapChange(),this.regionalTileLayer.onFeatureStateMapChange(),null===(i=this.modelsTileLayer)||void 0===i||i.onFeatureStateMapChange(),this.modules.modelLayer.onFeatureStateMapChange()}generateHoverTile(e,t,i,n,o,r,s,a){return this.zenithSource.generateTile(e,t,i,n,o,r,s,a)}generateModel(e){return this.zenithSource.generateModel(e)}isIdentifiedAsDefault(){return!0}setDataType(e){this.options.dt===e||this.options.dt&&e&&(0,we.$I)(this.options.dt,e)||(this.options.dt=e,this.regionalTileLayer.redraw())}getDataType(){return this.options.dt}setDataFilter(e){var t;this.zenithSource.setDataFilter(e),null===(t=this.modelsSource)||void 0===t||t.setDataFilter(e)}hasLayer(e){return this.modelsTileLayer===e||this.regionalTileLayer===e||this.universeTileLayer===e||this.commercialPoiTileLayer===e}addGlobeSource(){const{modules:e}=this,t=e.map.state;e.styleManager.getStyleLayer(t.handyStyleId,zn.d6)&&(this.globeSource=new Im(this.modules),this.globeTileLayer=new H.I(t.minZoom,T.globeConfig.globeMaxZoom,t.minZoom,T.globeConfig.globeMaxZoom,e,e.map.state,this.globeSource),e.tileManager.addTileLayer(this.globeTileLayer))}removeGlobeSource(){this.globeSource&&(this.globeSource.destroy(),this.globeSource=void 0),this.globeTileLayer&&(this.modules.tileManager.removeTileLayer(this.globeTileLayer),this.globeTileLayer.destroy(),this.globeTileLayer=void 0)}isGlobeTilesReady(){return!!this.globeTileLayer&&(this.globeTileLayer.viewportTilesReady()&&!this.globeTileLayer.isEmpty())}}const Pm={dead:!0,alive:!0,unused:!0,commercialDead:!1,commercialAlive:!1};class Am{constructor(e,t){this.mapState=e,this.modules=t,this.options={},this.viewportDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"}]),this.sizeDiffer=new Ve.H([{path:"size",type:"vec2"}])}update(){this.isEnabled()&&(this.sizeDiffer.check(this.mapState)&&this.updateSize(),this.viewportDiffer.check(this.mapState)&&this.clear())}isEnabled(){return!!this.canvas}show(e=Pm){this.options=e;Object.values(e).every((e=>!1===e))?this.hide():(this.createCanvas(),this.mapState.needLabeling=!0)}hide(){this.canvas&&(this.modules.layout.mapContainer.removeChild(this.canvas),this.ctx=void 0,this.canvas=void 0)}drawLabels(e){if(!this.canvas||!this.ctx)return;const t=this.ctx,i=this.options,n={[Tu.m3.Dead]:"#ff0000",[Tu.m3.Alive]:"#30763c",[Tu.m3.Unused]:"#aaa",[Tu.m3.CommercialAlive]:"#3a9f22",[Tu.m3.CommercialDead]:"#ff0000"},o=new Int32Array(e),r={[Tu.m3.Dead]:[],[Tu.m3.Alive]:[],[Tu.m3.Unused]:[],[Tu.m3.CommercialAlive]:[],[Tu.m3.CommercialDead]:[]};for(let e=0;e<o.length;e+=5){const t=o[e+4];r[t].push({x:o[e],y:o[e+1],width:o[e+2],height:o[e+3]})}this.clear();const s=window.devicePixelRatio,a=e=>{t.strokeStyle=n[e],r[e].forEach((e=>t.strokeRect(e.x*s+.5,e.y*s+.5,e.width*s,e.height*s)))};t.setLineDash([]),i.unused&&a(Tu.m3.Unused),i.dead&&a(Tu.m3.Dead),i.alive&&a(Tu.m3.Alive),t.setLineDash([6]),i.commercialDead&&a(Tu.m3.CommercialDead),i.commercialAlive&&a(Tu.m3.CommercialAlive)}clear(){if(this.canvas&&this.ctx){const{clientWidth:e,clientHeight:t}=this.canvas;this.ctx.clearRect(0,0,e*window.devicePixelRatio,t*window.devicePixelRatio)}}createCanvas(){this.canvas||(this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.left="0",this.canvas.style.top="0",this.canvas.style.pointerEvents="none",this.modules.layout.mapContainer.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")||void 0,this.updateSize())}updateSize(){if(!this.canvas)return;const{clientWidth:e,clientHeight:t}=this.modules.layout.rootContainer;this.canvas.width=e*window.devicePixelRatio,this.canvas.height=t*window.devicePixelRatio,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px"}}const Lm=ae.Ue();class Cm{constructor(e){this.globHaloStops=[-2.5,0,1.5,13],this.globeHaloExpFactor=-1,this.fogLimits=new Float32Array([3.7,4.5]),this.fogHorizonBlend=.12,this.fogHorizonLevel=-.07,this.squaredDistMaxFog=0,this.lastStyleId=NaN,this.starsCount=2e4,this.starsGenerationCtx={randomSeed:12345},this.starsUpdateNeeded=!0,this.modules=e;const t=this.modules.renderer.getShaderProgram("sky"),i=this.modules.renderer.createBuffer(new Float32Array([-1,-1,1,-1,1,1,-1,1]));this.vao=((e,t)=>{const i=new fi.K(e,{itemSize:2,dataType:yt.l.Float,stride:0,offset:0,normalized:!1});return new _i(t,{a_vec2_vertex:i})})(i,t)}update(){this.updateFog();const e=this.modules.map.state;isNaN(e.handyStyleId)||this.lastStyleId!==e.handyStyleId&&(this.updateSky(),this.updateStars(),this.lastStyleId=e.handyStyleId)}setParameters(e){const t=this.modules.map.state;void 0!==e.min&&(this.fogLimits[0]=e.min),void 0!==e.max&&(this.fogLimits[1]=e.max),void 0!==e.horizonBlend&&(this.fogHorizonBlend=e.horizonBlend),void 0!==e.horizonLevel&&(this.fogHorizonLevel=e.horizonLevel);const i=this.modules.styleManager.getStyleLayer(t.handyStyleId,zn.d6);i&&(void 0!==e.fogColor&&(i.style.fogColor=(0,qa.nS)(e.fogColor)?(0,qa.lK)(e.fogColor):e.fogColor),void 0!==e.skyColor&&(i.style.skyColor=(0,qa.nS)(e.skyColor)?(0,qa.lK)(e.skyColor):e.skyColor),this.modules.renderer.addRerenderEvent())}renderSky(){if(!this.isSkyEnabled())return;this.modules.renderer.applyGpuState(ho);const e=this.modules.renderer.getShaderProgram("sky");this.modules.renderer.enableShaderProgram(e),this.modules.renderer.isUboSupported()||(Ut(e,this.modules.map.state,this.modules),Dt(e,this.modules.map.state,this.modules),Bt(e,this.modules.map.state,this.modules)),this.modules.renderer.bindVao(this.vao),this.modules.renderer.drawTrianglesFan(0,4)}renderStars(){if(!this.starsVao)return;this.modules.renderer.applyGpuState(ho);const e=this.modules.renderer.getShaderProgram("stars");this.modules.renderer.enableShaderProgram(e),this.modules.renderer.isUboSupported()||Gt(e,this.modules.map.state,this.modules),this.modules.renderer.bindVao(this.starsVao),this.modules.renderer.drawPoints(0,this.starsCount)}renderGlobeHaloBackground(){this.modules.renderer.applyGpuState(ho);const e=this.modules.renderer.getShaderProgram("globeHaloBackground");this.modules.renderer.enableShaderProgram(e),this.modules.renderer.isUboSupported()||Ht(e,this.modules.map.state,this.modules),this.modules.renderer.bindVao(this.vao),this.modules.renderer.drawTrianglesFan(0,4)}renderGlobeHalo(){this.modules.renderer.applyGpuState(fo);const e=this.modules.renderer.getShaderProgram("globeHalo");this.modules.renderer.enableShaderProgram(e),this.modules.renderer.isUboSupported()||Ht(e,this.modules.map.state,this.modules),this.modules.renderer.bindVao(this.vao),this.modules.renderer.drawTrianglesFan(0,4)}isFogEnabled(){var e,t;if(this.modules.map.getFeatureFlag("fogOff"))return!1;if(!(null===(e=this.envStyleLayer)||void 0===e?void 0:e.style.fogColor))return!1;const{styleZoom:i,styleState:n}=this.modules.map.state,o=(0,te.jJ)(i,n,[]),r=(0,te.zn)(null===(t=this.envStyleLayer)||void 0===t?void 0:t.style.fogColor,o);return r&&0!==r.value[3]}isSkyEnabled(){var e,t;if(this.modules.map.getFeatureFlag("skyOff"))return!1;if(!(null===(e=this.envStyleLayer)||void 0===e?void 0:e.style.skyColor))return!1;const{styleZoom:i,styleState:n}=this.modules.map.state,o=(0,te.jJ)(i,n,[]),r=(0,te.zn)(null===(t=this.envStyleLayer)||void 0===t?void 0:t.style.skyColor,o);return r&&0!==r.value[3]}isPointInFog(e){const t=this.modules.camera;return ae.nI(e,t.position)>this.squaredDistMaxFog}isAABBInFog(e){if(!this.modules.environmentManager.isFogEnabled())return!1;const t=this.modules.camera,i=(0,kd.BY)(t.position,e.min,e.max,Lm);return this.isPointInFog(i)}updateSky(){const e=this.modules.styleManager.getStyleLayer(this.modules.map.state.handyStyleId,zn.d6);this.envStyleLayer=e}updateStars(){if(!this.starsUpdateNeeded)return;this.starsUpdateNeeded=!1;const e=(0,Hr._u)(this.starsGenerationCtx,this.starsCount),t=new Float32Array(4*e.length);for(let i=0;i<e.length;++i){const n=e[i],o=(0,Hr.ff)(this.starsGenerationCtx,0,1);t[4*i]=n[0],t[4*i+1]=n[1],t[4*i+2]=n[2],t[4*i+3]=o}const i=this.modules.renderer.createBuffer(t),n=this.modules.renderer.getShaderProgram("stars");this.starsVao=((e,t)=>new _i(t,{a_vec3_position:new fi.K(e,{itemSize:3,dataType:yt.l.Float,stride:16,offset:0,normalized:!0}),a_fade_opacity:new fi.K(e,{itemSize:1,dataType:yt.l.Float,stride:16,offset:12,normalized:!1})}))(i,n)}updateFog(){const e=this.modules.camera;this.squaredDistMaxFog=Math.pow(e.fogDistance*this.fogLimits[1],2)}}class zm{constructor(e,t){this.mapState=e,this.mapModules=t,this.state={}}add(e,t=0,i=1,n=T.buildingAnimation.easing,o=T.buildingAnimation.duration){this.state[e]||(this.state[e]={tickerConfig:{start:t,end:i,duration:o,easing:n},tickerKey:"",readiness:t===i?1:0})}has(e){return Boolean(this.state[e])}remove(e){this.state[e]&&delete this.state[e];const t=this.buildTickerKey(e);ne.rS(t,this.mapState)&&ne.sT(t,this.mapState)}getReadiness(e){var t;return null===(t=this.state[e])||void 0===t?void 0:t.readiness}isAnimating(e){if(!e){for(const e in this.state)if(void 0!==ne.U2(this.state[e].tickerKey,this.mapState))return!0;return!1}return!!this.state[e]&&void 0!==ne.U2(this.state[e].tickerKey,this.mapState)}update(){const e=[];for(const t in this.state){const i=this.state[t];if(this.mapModules.tileManager.viewportTilesReady()){const n=i.readiness,{start:o,end:r,duration:s,easing:a}=i.tickerConfig;if(i.tickerKey)ne.Vx(i.tickerKey,{step:(e,t)=>{i.readiness=t}},this.mapState);else{const e=this.buildTickerKey(t);i.tickerKey=e,ne.BL(e,{easing:a},this.mapState,o,r,s,1)}1===i.readiness&&1!==n&&e.push(t)}}return e}buildTickerKey(e){return`gltf-${e}`}}const km="#ffffffff",Om=(0,Y.aq)(15)/L.C,Rm=G.Bq/2,Fm=["coordinates","rotation","scale","offset"];class Bm extends k{constructor(e,t){var i,n,o,r,s,a,l,d,c,u;super(e,{interactive:null!==(i=t.interactive)&&void 0!==i&&i}),this.map=e,this.needRerender=()=>this.isVisible()&&(0,Y.Ny)((0,Y.IR)(this.position.normalizedValue),this.mapState.tilesBounds,this.modules,G.bQ),this.hovered=!1,this.selected=!1,this.status=t.hideOnInit?"hidden":"visible",this.interactiveOcclusion=null===(n=t.interactiveOcclusion)||void 0===n||n,this.throttledIdentifierUpdate=null!==(o=t.throttledIdentifierUpdate)&&void 0!==o&&o,this.disableAnimation=t.disableAnimation,this.linkedIds=t.linkedIds,this.planId=t.planId,this.tickerNames=new Map;const h=W.H.fromGeo(t.coordinates);this.position={userValue:h,normalizedValue:(0,L.I0)(h)};const{dynamicStyle:m,collector:f,tileManager:_,layers:p,assetManager:v}=this.modules,{ignoreGlobalLighting:g,colorTextureUvIndex:y,nearCameraFade:b,showRatio:x,playAnimation:w}=t,S=Um(null!==(r=t.rotation)&&void 0!==r?r:0),M=null!==(s=t.scale)&&void 0!==s?s:1,I=Hm(null!==(a=t.offset)&&void 0!==a?a:0,t.coordinates[1]);if(this.appliedTransformations={scale:M,rotation:S,offset:I},this.layer=(0,Q.qw)({type:"model",id:`dynamic-gltf-model-${this.uniqId}`,style:{modelSrc:["get","model_src"],rotation:Array.isArray(S)?["literal",S]:S,scale:Array.isArray(M)?["literal",M]:M,offset:Array.isArray(I)?["literal",I]:I,linkedIds:["get","linkedIds"],ignoreGlobalLighting:g,colorTextureUvIndex:y,nearCameraFade:b,showRatio:x,playAnimation:w,color:["match",["objectAttr","hovered"],[!0],(null===(l=t.hover)||void 0===l?void 0:l.color)||km,["match",["objectAttr","selected"],[!0],(null===(d=t.select)||void 0===d?void 0:d.color)||km,t.color||km]]},minzoom:t.minZoom,maxzoom:t.maxZoom,interactive:this.interactive,interactiveOcclusion:this.interactiveOcclusion}),!this.layer)return;(null===(c=t.hover)||void 0===c?void 0:c.color)&&(this.on("mouseover",this.switchToHoveredColor),this.on("mouseout",this.switchToNormalColor)),m.addLayer(this.layer,t.zIndex);const T=(0,Y.z6)(this.position.normalizedValue,15),E=(0,J.FJ)({model_src:t.modelSrc,linkedIds:t.linkedIds,db_plan_id:t.planId}),P=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,E,A.wz,t.interactive?"0":"");(0,q.Eu)(this.layer,P),(0,q.XI)({collector:f,generator:Pi.m.generateInstances,args:[m.getStyle(),this.layer,P,{x:[Rm],y:[Rm],z:[null!==(u=this.position.userValue[2])&&void 0!==u?u:0]},(0,Y.Bs)(T),NaN]});const C=f.getAccumulatedData(),z=new R.W("dynamicObject",C.data,this.modules,this.mapState,T,this);v.fillDataModelUrlMap(C.dataModelsUrls),this.modelId=C.dataModelsUrls[t.modelSrc],void 0!==this.modelId&&(v.loadModel(t.modelSrc,this.modelId,J.jf,!0,this.layer,(()=>{"visible"===this.status&&(_.addObject(z),this.modules.renderer.addRerenderEvent(),this.linkedIds&&this.map.hideBuildingsById(this.linkedIds),this.updateIdentifier()),setTimeout((()=>this.emit("modelloaded")),0)})),this.tileObjects.push(z),t.interactive&&this.identifyIds.push(C.identifyIds),p.addLayer(this),f.reset(),"visible"===this.status&&this.hideLinkedObjects())}update(){if(super.update(),!this.tickerNames.size)return;const e=[],t={};this.tickerNames.forEach(((i,n)=>{ne.Vx(i,{step:(e,i)=>{t[n]=i},complete:()=>{e.push(n)}},this.mapState)})),void 0===t.coordinates&&void 0===t.rotation&&void 0===t.scale&&void 0===t.offset||this.applyTransformations(t.coordinates,t.rotation,t.scale,t.offset),e.forEach((e=>{this.tickerNames.delete(e)})),this.interactive&&this.needRerender()&&(this.throttledIdentifierUpdate?1===this.mapState.stillness&&this.modules.identifier.throttledFillCache():this.tickerNames.size||this.modules.identifier.debouncedFillCache())}setState({hovered:e,selected:t}){void 0!==e&&e!==this.hovered&&(this.hovered=e,this.modules.renderer.addRerenderEvent()),void 0!==t&&t!==this.selected&&(this.selected=t,this.modules.renderer.addRerenderEvent())}isAnimationDisabled(){return this.disableAnimation}getLinkedIds(){return this.linkedIds}isVisible(){return"visible"===this.status}hide(){"visible"===this.status&&(this.status="hidden",this.tileObjects.forEach((e=>{this.modules.tileManager.removeObject(e)})),this.showHiddenBuildings(),this.showLinkedObjects(),this.mapState.shouldIsIdleWaitForUpdates=!0,this.modules.renderer.addRerenderEvent(),this.updateIdentifier())}isOutOfMainReplica(){return!1}show(){"hidden"===this.status&&(this.status="visible",this.tileObjects.forEach((e=>{this.modules.tileManager.addObject(e)})),this.linkedIds&&this.map.hideBuildingsById(this.linkedIds),this.hideLinkedObjects(),this.mapState.shouldIsIdleWaitForUpdates=!0,this.modules.renderer.addRerenderEvent(),this.updateIdentifier())}destroy(e){if("destroyed"!==this.status){if(this.stopTransformation(),this.status="destroyed",void 0!==this.modelId){this.modules.layers.getDynamicObjectLayers().filter((e=>e instanceof Bm&&e!==this)).some((e=>e.modelId===this.modelId))||e||this.modules.assetManager.removeModel(String(this.modelId))}this.updateIdentifier(),this.layer&&this.modules.dynamicStyle.removeLayer(this.layer.innerId),this.showHiddenBuildings(),this.off("mouseover",this.switchToHoveredColor),this.off("mouseout",this.switchToNormalColor),this.showLinkedObjects(),super.destroy()}}transform(e){var t,i;if("destroyed"===this.status||!this.layer)return;this.stopTransformation();const n={};e.forEach((e=>{const t=function(e){if("coordinates"in e)return"coordinates";if("rotation"in e)return"rotation";if("scale"in e)return"scale";if("offset"in e)return"offset"}(e);if(!t)return;const{duration:i=0,easing:o="linear"}=e;n[t]={value:e[t],duration:i,easing:o}}));const o={};for(const e in n){if(!Gm(e))continue;if(void 0===n[e])continue;let r;if(r="coordinates"===e?W.H.fromGeo(n[e].value):"offset"===e?Hm(n[e].value,null!==(i=null===(t=n.coordinates)||void 0===t?void 0:t.value[1])&&void 0!==i?i:W.H.toGeo(this.position.userValue)[1]):n[e].value,!n[e].duration){o[e]=r;continue}const s=`dynamicGltfModel-${e}-${this.uniqId}`;let a,l;if("coordinates"===e)a=this.position.userValue,l=r;else{const t=[0,0,0];(0,we.FR)(this.appliedTransformations[e],t),a=t;const i=[0,0,0];(0,we.FR)(r,i),l=i}ne.BL(s,{easing:n[e].easing,renderAfterUpdate:this.needRerender},this.mapState,a,l,n[e].duration,1,{layerId:this.layer.innerId,styleId:J.jf}),this.tickerNames.set(e,s)}void 0===o.coordinates&&void 0===o.rotation&&void 0===o.scale&&void 0===o.offset||(this.applyTransformations(o.coordinates,o.rotation,o.scale,o.offset),this.modules.renderer.addRerenderEvent(),this.updateIdentifier())}stopTransformation(){this.tickerNames.forEach((e=>{ne.sT(e,this.mapState)})),this.tickerNames.clear()}getCoordinates(){return W.H.toGeo(this.position.userValue)}getScale(){const e=[0,0,0];return(0,we.FR)(this.appliedTransformations.scale,e),e}getRotation(){const e=[0,0,0];return(0,we.FR)(this.appliedTransformations.rotation,e),e}getOffset(){const e=[0,0,0];return(0,we.FR)(this.appliedTransformations.offset,e),e}applyTransformations(e,t,i,n){var o,r,s;const a=this.tileObjects[0];if(!a)return;const l=a.buffers[0];if(l){if(e&&(this.position={userValue:e,normalizedValue:(0,L.I0)(e)},a.setTileCoords((0,Y.z6)(this.position.normalizedValue,15),this.mapState)),void 0!==t||void 0!==i){const e=Um(null!=t?t:this.appliedTransformations.rotation),n=null!=i?i:this.appliedTransformations.scale;this.appliedTransformations.rotation=e,this.appliedTransformations.scale=n}if(void 0!==n){const e=null!=n?n:this.appliedTransformations.offset;this.appliedTransformations.offset=e}(0,we.FR)(this.appliedTransformations.offset,Nm),(0,we.FR)(this.appliedTransformations.scale,Dm),(0,we.FR)(this.appliedTransformations.rotation,jm),Pi.m.patchBuffer(l,0,(0,Y.Bs)(a.coords),[Rm,Rm,null!==(o=this.position.userValue[2])&&void 0!==o?o:0],Nm,Dm,jm,(null!==(s=null===(r=this.layer)||void 0===r?void 0:r.minzoom)&&void 0!==s?s:0)<T.globeConfig.globeMaxZoom)}}switchToHoveredColor(){this.hovered=!0,this.modules.renderer.addRerenderEvent()}switchToNormalColor(){this.hovered=!1,this.modules.renderer.addRerenderEvent()}updateIdentifier(){this.interactive&&this.modules.identifier.resetCache()}showLinkedObjects(){const e=this.planId?Ya.PY:Ya.eS;if(this.linkedIds){this.modules.identifier.getIdScope(e).show(this.linkedIds)}}hideLinkedObjects(){const e=this.planId?Ya.PY:Ya.eS;if(this.linkedIds){this.modules.identifier.getIdScope(e).hide(this.linkedIds)}}showHiddenBuildings(){if(!this.linkedIds)return;const e=this.modules.layers.getDynamicObjectLayers().filter((e=>e instanceof Bm&&e!==this&&e.isVisible()));this.linkedIds.forEach((t=>{const i=e.every((e=>{var i;return!(null===(i=e.getLinkedIds())||void 0===i?void 0:i.includes(t))}));i&&this.map.showHiddenBuildingsById([t])}))}}const Dm=[0,0,0],jm=[0,0,0],Nm=[0,0,0];function Um(e){return Array.isArray(e)?e.map((e=>e%360)):e%360}function Hm(e,t){const i=Om/W.H.scaleFactor(t),n=["x","y"].filter(((t,n)=>{const o=Array.isArray(e)?e[n]:e;return o<-i||o>i}));return n.length&&console.warn(`\n            The offset is too big along ${n.map((e=>`${e}-axis`)).join(" and ")} at the current latitude.\n            Please, use more accurate coordinates to place the model.\n        `),Array.isArray(e)?[e[0]%i,e[1]%i,e[2]]:[e%i,e%i,e]}function Gm(e){return Fm.includes(e)}var Vm=i(462);const Zm=[0,0,0],Wm=[0,0,0],Xm=[0,0,0];class Km{constructor(e,t){this.sceneObjects=new Map,this.sceneObjectsVisibilityMap=new Map,this.viewportDiffer=new Ve.H([{path:"center",type:"vec3"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"},{path:"elevation",type:"number"},{path:"minElevation",type:"number"}]),this.mapState=e,this.mapModules=t,this.modelsAnimator=new zm(e,t),this.modelInfo={},this.buildingIds=new Set,this.objectIdToLayerModelKey={},this.linkedIdToObjectId={},this.layerModelKeyBySourceTile=new Map,this.disabled=!1}addLayerModelToSourceTileMap(e){const t=$m(e.attributes),i=qm(e.attributes.styleId,e.attributes.sourceId,e.tile.coords),n=this.layerModelKeyBySourceTile.get(i);n?n.add(t):this.layerModelKeyBySourceTile.set(i,new Set([t]))}clearSourceTileMapByTiles(e,t){t.map((t=>qm(this.mapState.handyStyleId,e,t.coords))).forEach((e=>this.layerModelKeyBySourceTile.delete(e)))}clearSourceTileMapBySource(e){Array.from(this.layerModelKeyBySourceTile).map((e=>e[0])).filter((t=>t.split("_")[1]===String(e))).forEach((e=>this.layerModelKeyBySourceTile.delete(e)))}getCurrentLayerModelId(e,t){var i;const n=$m(e);return null===(i=this.modelInfo[n])||void 0===i?void 0:i.modelIds[t.id]}getModelOpacity(e){var t;if(void 0===e)return 0;const i=$m(e.attributes);return i&&null!==(t=this.modelsAnimator.getReadiness(i))&&void 0!==t?t:0}getModelHeightFactor(e){var t;if(!e)return 1;const i=$m(e.attributes);return null!==(t=this.modelsAnimator.getReadiness(i))&&void 0!==t?t:1}isAnimating(e){if(!e)return this.modelsAnimator.isAnimating();const t=this.linkedIdToLayerModelKey(e);return!!t&&this.modelsAnimator.isAnimating(t)}objectIdToKey(e){return this.objectIdToLayerModelKey[e]}update(){this.syncStateWithSceneObjects();this.modelsAnimator.update().length&&this.addNewSceneObjectsToVisibilityMap(),this.viewportDiffer.check(this.mapState)&&this.checkSceneObjectsVisibilityMap(),this.updateObjectsVisibility()}addSceneObject(e){const t=$m(e.attributes);let i=this.modelInfo[t];i?this.objectIdToLayerModelKey[e.id]||this.indexateObject(t,e,i):i=this.addLayerModel(e,t),i&&(i.modelIds[e.tile.id]=e.renderingProperties.modelId,this.sceneObjects.set(e.id,e),this.addLayerModelToSourceTileMap(e))}removeSceneObject(e){this.sceneObjects.delete(e)}allObjectsHaveCurrentModelId(e,t,i){var n;const o=qm(i,e,t),r=this.layerModelKeyBySourceTile.get(o);if(!r)return!0;for(const e of r){const t=null===(n=this.modelInfo[e])||void 0===n?void 0:n.modelIds;if(!t)return!1;for(const e in t)if(void 0===t[e])return!1}return!0}finishStyleUpdating(){Array.from(this.layerModelKeyBySourceTile).map((e=>e[0])).filter((e=>e.split("_")[0]!==String(this.mapState.handyStyleId))).forEach((e=>this.layerModelKeyBySourceTile.delete(e)))}updateModelId(e,t,i,n,o){const{assetManager:r,sourceStorage:s,styleManager:a,camera:l}=this.mapModules,d=this.mapState;e.modelId=void 0;const{styleId:c,layerId:u,sourceId:h,modelIndices:m,modelStepValues:f,modelStepSource:_}=t;if(!m.length)return;let p;switch(_){case dd.N.None:p=0;break;case dd.N.Zoom:p=Ym(f,d.styleZoom);break;case dd.N.Distance:p=function(e,t,i,n,o){const r=e.modelMatrices.get(0);if(!r)return-1;let s=t.min,a=t.max;o||(s=ae.fF(Wm,s,r),a=ae.fF(Xm,a,r));const l=(0,kd.BY)(i,s,a,Zm),d=W.H.toGeo(l),c=W.H.scaleFactor(d[1]),u=ae.TK(i,l)/L.C/c;return Ym(n,u)}(n,i,l.position,f,o);break;default:return}if(-1===p)return;const v=m[p];if(void 0===v)return;const g=r.getModel(v,c);if(g)switch(g.status){case Id.Loaded:return void(e.modelId=v);case Id.Failed:return void(e.modelId=NaN)}else{const e=a.getStyleLayer(c,u),t=r.getDataModelUrlById(v);e&&!this.disabled&&(void 0===t?r.loadModelByIndex(v,c,e):t.length&&r.loadModel(t,v,c,!1,e))}if(1===m.length)return;const y=s.getSourceById(h);y&&(_===dd.N.Zoom?e.modelId=this.getModelIdByZoom(y,t,n,p):_===dd.N.Distance&&(e.modelId=this.getModelIdByDistance(t,n)))}getModelIdByDistance(e,t){return this.getCurrentModelId(e,t)}getModelIdByZoom(e,t,i,n){const{styleId:o,modelIndices:r}=t,s=e.getZoomDirection();if(s===Vm.Y.Stationary)return this.getCurrentModelId(t,i);const a=r.slice(0,n).reverse(),l=r.slice(n+1),d=s===Vm.Y.ZoomingIn?a.concat(l):l.concat(a);for(let e=0;e<d.length;e++){const t=this.mapModules.assetManager.getModel(d[e],o);if(t&&t.status===Id.Loaded)return d[e];if((null==t?void 0:t.status)===Id.Failed)return NaN}}getCurrentModelId(e,t){const i=this.getCurrentLayerModelId(e,t);if(!i)return;const n=this.mapModules.assetManager.getModel(i,e.styleId);return n&&n.status===Id.Loaded?i:(null==n?void 0:n.status)===Id.Failed?NaN:void 0}syncStateWithSceneObjects(){const e=new Set;if(this.disabled=this.mapModules.map.getFeatureFlag("modelsOff"),this.disabled){this.mapModules.defaultSource.destroyModelsSource();for(const e in this.modelInfo){const t=this.modelInfo[e];this.removeLayerModel(e,t)}return}for(const t of this.sceneObjects.values()){const i=$m(t.attributes),n=this.modelInfo[i],o=this.mapState.disableModelsGrowthAnimation||t.tile.dynamicObject instanceof Bm&&t.tile.dynamicObject.isAnimationDisabled();if(e.add(i),!n||this.modelsAnimator.has(i)||this.disabled||(this.mapModules.defaultSource.createModelsSource(),this.startAnimation(i,n,o)),this.modelInfo[i])this.objectIdToLayerModelKey[t.id]||this.indexateObject(i,t,n);else{const e=!0;this.addLayerModel(t,i,e)}}const t=this.mapState.styleZoom;for(const i in this.modelInfo){const n=this.modelInfo[i];e.has(i)?(t<n.layer.minzoom||t>=n.layer.maxzoom)&&this.removeLayerModel(i,n):this.removeLayerModel(i,n)}}addLayerModel(e,t,i=!1){var n,o;const r=this.mapModules.styleManager.getStyleLayer(e.attributes.styleId,e.attributes.layerId);if(!r)return;if(i){const e=this.mapState.styleZoom;if(e<r.minzoom||e>=r.maxzoom)return}const s={layer:r,ids:e.tile.ids,linkedIds:[],ownerIds:new Set,modelIds:{}};return s.buildingId=(null===(n=e.meta)||void 0===n?void 0:n.buildingId)||"",(null===(o=e.meta)||void 0===o?void 0:o.planId)&&(s.planId=e.meta.planId),this.indexateObject(t,e,s),this.modelInfo[t]=s,s}startAnimation(e,t,i){var n;if(i)return void this.modelsAnimator.add(e,1,1);const o=null!==(n=t.layer.minzoom)&&void 0!==n?n:NaN;t.linkedIds.length>0&&this.mapModules.buildingHeightAnimator.getBuildingHeight(o)>.5?this.modelsAnimator.add(e,.5,1):this.modelsAnimator.add(e)}maybeEmitModelEvent(e,t,i){const n=!t.onKeyRemove&&!!i&&(0,jn.M4)(i,{min:e.mapPoint,max:e.mapPoint}),o=e.visible;n!==o&&(e.visible=n,this.emitEvent(n&&!o?"modelshow":"modelhide",e))}addNewSceneObjectsToVisibilityMap(){var e,t,i,n;const o=this.mapModules.camera.getViewportVertices(.1);for(const r of this.sceneObjects.values())if((null===(e=r.attributes)||void 0===e?void 0:e.emitShowHideEvents)&&(null===(t=r.meta)||void 0===t?void 0:t.buildingId)&&r.attributes.lngLat){const e=$m(r.attributes),t={visible:!1,mapPoint:W.H.fromGeo(r.attributes.lngLat),buildingId:(null===(i=r.meta)||void 0===i?void 0:i.buildingId)||"",sublayer:(null===(n=r.meta)||void 0===n?void 0:n.sublayer)||"",key:e};let s=this.sceneObjectsVisibilityMap.get(e);s||(s=new Map,this.sceneObjectsVisibilityMap.set(e,s)),s.get(r.meta.buildingId)||(s.set(r.meta.buildingId,t),this.maybeEmitModelEvent(t,{onKeyShow:!0},o))}}checkSceneObjectsVisibilityMap(){const e=this.mapModules.camera.getViewportVertices(.1);this.sceneObjectsVisibilityMap.forEach((t=>t.forEach((t=>this.maybeEmitModelEvent(t,{},e)))))}indexateObject(e,t,i){var n,o,r;this.objectIdToLayerModelKey[t.id]=e,i.ownerIds.add(t.id),i.buildingId=(null===(n=t.meta)||void 0===n?void 0:n.buildingId)||"",i.buildingId&&this.buildingIds.add(i.buildingId);const s=null!==(r=null===(o=t.meta)||void 0===o?void 0:o.linkedIds)&&void 0!==r?r:[];if(i.linkedIds.push(...s),"c3d"!==t.tile.purpose)for(const e of s)this.linkedIdToObjectId[e]=t.id}removeLayerModel(e,t){var i;null===(i=t.ids)||void 0===i||i.show(t.linkedIds);for(const e of t.ownerIds)delete this.objectIdToLayerModelKey[e];t.buildingId&&this.buildingIds.delete(t.buildingId),this.modelsAnimator.remove(e);const n=this.sceneObjectsVisibilityMap.get(e);n&&(n.forEach((e=>this.maybeEmitModelEvent(e,{onKeyRemove:!0}))),this.sceneObjectsVisibilityMap.delete(e)),delete this.modelInfo[e]}linkedIdToLayerModelKey(e){const t=this.linkedIdToObjectId[e];if(!t)return null;const i=this.objectIdToLayerModelKey[t];return i||null}emitEvent(e,t){const{buildingId:i,sublayer:n}=t;if(!n)return void console.warn(`No sublayer for model ${t.key}`);if(!i)return void console.warn(`No buildingId for model ${t.key}`);const o=(0,B.M7)(n);this.mapModules.map.emit(e,{sublayer:n,id:i,isCommercial:o})}updateObjectsVisibility(){var e;const t=this.mapModules.identifier.getIdScope(Ya.eS),i=this.mapModules.identifier.getIdScope(Ya.JQ);t.getHidden().forEach((e=>{i.hide([e],Ya.Rv.All)}));for(const t in this.modelInfo){const i=this.modelInfo[t],n=i.ids;if(!n)continue;const o=null!==(e=this.modelsAnimator.getReadiness(t))&&void 0!==e?e:0;for(const e of i.linkedIds){if(n.isHidden(e))continue;const t=void 0!==i.planId?Ya.Rv.FloorPolygons:Ya.Rv.PolygonExtrusion,r=n.isHidden(e,t);o>.5&&!r?n.hide([e],t):o<.5&&r&&n.show([e])}}}}function $m(e){const{layerId:t,modelIndices:i}=e;return`${t}${i}`}function qm(e,t,i){return`${e}_${t}_${JSON.stringify(i)}`}function Ym(e,t){let i=0;for(;i<e.length&&!(t<e[i]);)i++;return i-1}var Jm=i(6636),Qm=i(291);const ef=Jm(.42,0,1,1),tf=(e,t,i,n)=>t+i*ef(e/n),nf=Jm(0,0,.58,1),of=(e,t,i,n)=>t+i*nf(e/n),rf=Jm(.42,0,.58,1),sf=(e,t,i,n)=>t+i*rf(e/n);function af(e){switch(e[0]){case"cubic-bezier":{const t=Jm(e[1],e[2],e[3],e[4]);return(e,i,n,o)=>i+n*t(e/o)}case"exponential":{const t=e[1];return(e,i,n,o)=>{const r=i,s=i+n,a=e/o,l=(Math.pow(t,a)-1)/(Math.pow(t,1)-1);return(1-l)*r+l*s}}case"ease":return Qm.ease;case"ease-in":return tf;case"ease-out":return of;case"ease-in-out":return sf;case"linear":return Qm.linear;default:return Cs(e,!0),console.warn("Invalid texture animation easing:",e),console.warn('Fallback to "linear".'),Qm.linear}}var lf;!function(e){e[e.WAITING_FOR_START=0]="WAITING_FOR_START",e[e.SPEED_UP=1]="SPEED_UP",e[e.FULL_SPEED=2]="FULL_SPEED",e[e.SLOW_DOWN=3]="SLOW_DOWN",e[e.FINISHED=4]="FINISHED"}(lf||(lf={}));class df{constructor(e,t){this.rerenderEvents=[],this.prevObjects=new Map,this.currentObjects=new Map,this.doubleSampledTextureAnimationStateMap=new Map,this.mapState=e,this.modules=t}frameEnd(){this.rerenderEvents.forEach((e=>this.modules.renderer.addRerenderEvent(e))),this.clearUnusedAnimationState(),this.doubleSampledTextureAnimationStateCleanup()}frameStart(){this.rerenderEvents=[]}clearAllTickers(){for(const e of this.currentObjects.keys())ne.sT(e,this.mapState);this.clearUnusedAnimationState(),this.prevObjects=new Map,this.currentObjects=new Map}update(){const e=Date.now()+ +(this.mapState.styleState._customUserTimeOffset||0);[...this.prevObjects.values()].some((t=>t.timeToUpdate&&t.timeToUpdate<e))&&this.refresh()}animateGltfObject(e,t,i){const{localMatrix:n,animationStack:o,transformStack:r}=e.renderingProperties;if(!(void 0!==t.style.playAnimation&&(null==o?void 0:o.length)&&n&&o&&r))return;const s=this.updateAnimationKeyframes(e,t);_d(n,o,r,i.buffers,s)}animatePolygonNormalMapTexture(e,t){var i;if(!t.style.normalMapTextureAnimation)return[!1,[0,0,0,0]];let n=1;const o=t.innerId,r=e.attributes.styleId,s=`${r}_${o}`,a=Date.now(),[[l,d],[c,u],[h,m],f,_,p,v,g]=this.resolveDoubleSampledTextureAnimationOptions(t),y=[h,m,0,0];if(this.mapState.disableLayerAnimation)return[!1,y];const b=null!==(i=this.doubleSampledTextureAnimationStateMap.get(s))&&void 0!==i?i:{lastKnownOffsets:y,animationStage:lf.WAITING_FOR_START,previousTimestamp:a,updatedOnThisFrame:!0,styleId:r,layerId:o},{lastKnownOffsets:x,previousTimestamp:w,animationStage:S}=b;let M=S;const I=(a-w)/1e3;switch(S){case lf.WAITING_FOR_START:{let e=!1;const i=(0,te.jJ)(this.mapState.styleZoom,this.mapState.styleState,[]),n=(0,te.Q9)(t.style.normalMapTextureImage,i),o=this.modules.styleManager.getStyle(r);if(o){const t=o.rasterSets.byKey[(0,qa.FD)(n)];t&&t.isReady&&(e=!0)}e&&(_?(ne.BL(`${s}_animationSpeedUp`,{easing:af(p),forceFinalValue:!0,renderAfterUpdate:!1},this.mapState,0,1,_,1),M=lf.SPEED_UP):(f!==1/0&&ne.BL(`${s}_animationFullSpeed`,{forceFinalValue:!0,renderAfterUpdate:!1},this.mapState,1,1,f,1),M=lf.FULL_SPEED));break}case lf.SPEED_UP:ne.Vx(`${s}_animationSpeedUp`,{keepFinished:!0,step:(e,t,i,o)=>{o?(n=1,ne.sT(`${s}_animationSpeedUp`,this.mapState),f!==1/0&&ne.BL(`${s}_animationFullSpeed`,{forceFinalValue:!0,renderAfterUpdate:!1},this.mapState,1,1,f,1),M=lf.FULL_SPEED):n=t}},this.mapState);break;case lf.FULL_SPEED:f===1/0||ne.Vx(`${s}_animationFullSpeed`,{keepFinished:!0,step:(e,t,i,n)=>{n&&(ne.sT(`${s}_animationFullSpeed`,this.mapState),v?(ne.BL(`${s}_animationSlowDown`,{easing:af(g),forceFinalValue:!0,renderAfterUpdate:!1},this.mapState,1,0,v,1),M=lf.SLOW_DOWN):M=lf.FINISHED)}},this.mapState);break;case lf.SLOW_DOWN:ne.Vx(`${s}_animationSlowDown`,{keepFinished:!0,step:(e,t,i,o)=>{o?(n=0,ne.sT(`${s}_animationSlowDown`,this.mapState),M=lf.FINISHED):n=t}},this.mapState);break;case lf.FINISHED:n=0}const T=[x[0]+l*n*I,x[1]+d*n*I,x[2]+c*n*I,x[3]+u*n*I].map((e=>e%1));return this.doubleSampledTextureAnimationStateMap.set(`${r}_${o}`,{animationStage:M,lastKnownOffsets:T,previousTimestamp:a,updatedOnThisFrame:!0,styleId:r,layerId:o}),M!==lf.FINISHED&&this.rerenderEvents.push({type:"layerAnimationTicker",layerId:o,styleId:r,underCache:!0}),[!0,T]}doubleSampledTextureAnimationStateCleanup(){for(const[e,t]of this.doubleSampledTextureAnimationStateMap)if(t.updatedOnThisFrame)t.updatedOnThisFrame=!1,this.doubleSampledTextureAnimationStateMap.set(e,t);else{if(this.modules.renderCacheManager.isLayerInCache(t.styleId,t.layerId))return;this.doubleSampledTextureAnimationStateMap.delete(e),ne.sT(`${e}_animationSpeedUp`,this.mapState),ne.sT(`${e}_animationFullSpeed`,this.mapState),ne.sT(`${e}_animationSlowDown`,this.mapState)}}resolveDoubleSampledTextureAnimationOptions(e){var t,i,n,o,r,s,a,l,d,c,u;const h=(0,te.jJ)(this.mapState.styleZoom,this.mapState.styleState,[]),m=(0,te.Bj)(e.style.normalMapTextureAnimation,h);return[[null!==(t=m[1])&&void 0!==t?t:0,null!==(i=m[2])&&void 0!==i?i:0],[null!==(n=m[3])&&void 0!==n?n:0,null!==(o=m[4])&&void 0!==o?o:0],[null!==(r=m[5])&&void 0!==r?r:0,null!==(s=m[6])&&void 0!==s?s:0],null!==(a=m[7])&&void 0!==a?a:1/0,null!==(l=m[8])&&void 0!==l?l:0,null!==(d=m[9])&&void 0!==d?d:["linear"],null!==(c=m[10])&&void 0!==c?c:0,null!==(u=m[11])&&void 0!==u?u:["linear"]]}clearUnusedAnimationState(){for(const e of this.prevObjects.keys())if(!this.currentObjects.has(e)){const t=this.prevObjects.get(e);t&&this.modules.renderCacheManager.isLayerInCache(t.styleId,t.layerId)?this.currentObjects.set(e,t):ne.sT(e,this.mapState)}this.prevObjects=new Map(this.currentObjects),this.currentObjects=new Map}refresh(){this.modules.renderer.addRerenderEvent()}updateAnimationKeyframes(e,t){if(this.mapState.disableLayerAnimation)return;const{animationStack:i}=e.renderingProperties;if(!i)return;const n=new Map;if(e.layerSettings.depthTest||e.layerSettings.shadow)return;const o=`${e.attributesHash}`,r=this.applyAnimationState(o,t,e);for(const o of i){const i=r.animationStateID,s=ne.U2(i,this.mapState);if(this.isNeedAnimation(o,r)){if(!s&&r.currentCount>0){const e=r.animationDuration||(o.max?o.max[0]:0),t=r.startOffset||0;let n=r.startOffset?o.frameCount/(o.frameCount*e/t):0,s=e*(1e3/r.playSpeed)-t*(1e3/r.playSpeed);r.elapsedTime&&(n=1-r.elapsedTime,s=e*(1e3/r.playSpeed)*r.elapsedTime),ne.BL(i,{easing:"linear",forceFinalValue:!0,renderAfterUpdate:!1},this.mapState,n,1,s,1)}ne.Vx(i,{keepFinished:!0,step:(i,s,a,l)=>{const d=(o.frameCount-1)*s;n.set(o.actionId,d),l||this.rerender(e,t,r)},complete:n=>{r.currentCount>0&&r.currentCount--,r.currentCount>0&&(ne.sT(i,this.mapState),this.rerender(e,t,r))}},this.mapState),this.currentObjects.set(i,r)}}return n}initObjectAnimationState(e,t,i){var n,o;const r=this.resolveGltfAnimationOptions(e,t),s="object"!=typeof r[0]||Array.isArray(r[0])||"schedule-detailed-result"!==r[0].type?r[0]:r[0].value,a="object"!=typeof r[0]||Array.isArray(r[0])||"schedule-detailed-result"!==r[0].type?void 0:r[0].currentStepElapsed/1e3,l=null!==(n=r[2])&&void 0!==n?n:1/0,d=l,c=r[1]||1,u=r[4]||void 0,h=r[3]||a||void 0;return{repeatCount:l,playSpeed:c,animationIndex:"number"==typeof s?s:void 0,animationName:"string"==typeof s?s:void 0,currentCount:d,animations:"object"==typeof s&&Array.isArray(s)?s:void 0,animationDuration:u,startOffset:h,tickerByStep:!(!h||!u),animationStateID:(null===(o=r[5])||void 0===o?void 0:o.toString())||i,timeToUpdate:r[6],layerId:e.innerId,styleId:t.attributes.styleId}}resolveGltfAnimationOptions(e,t){if("gltfModel"!==e.type)return{type:"animation-options"};const i=(0,te.jJ)(this.mapState.styleZoom,this.mapState.styleState,t.attributes.tileData);let n;i.callBackFn=e=>{n=e};const o=(0,te.M8)(e.style.playAnimation,i);return void 0===o[6]&&n&&(o[6]=n),o}isNeedAnimation(e,t){return void 0!==t.animationIndex&&e.animationIndex===t.animationIndex||void 0!==t.animationName&&e.animationName===t.animationName||void 0!==t.animations&&t.animations.includes(e.animationIndex)||void 0!==t.animations&&t.animations.includes(e.animationName)}applyAnimationState(e,t,i){const n=this.initObjectAnimationState(t,i,e),o=this.prevObjects.get(n.animationStateID);return o?(!o||(null==o?void 0:o.animationIndex)===n.animationIndex&&(null==o?void 0:o.animationName)===n.animationName?n.repeatCount===o.repeatCount&&(n.currentCount=o.currentCount):(ne.Vx(n.animationStateID,{keepFinished:!0,step:(e,t)=>{o.elapsedTime?(o.elapsedTime>0||o.elapsedTime<1)&&(n.elapsedTime=o.elapsedTime):(o.elapsedTime=t,n.elapsedTime=t)}},this.mapState),ne.sT(n.animationStateID,this.mapState)),n):n}rerender(e,t,i){0===i.repeatCount||i.tickerByStep||(this.rerenderEvents.push({type:"layerAnimationTicker",layerId:t.innerId,styleId:e.attributes.styleId}),this.modules.identifier.throttledFillCache())}}var cf=i(9958);const uf=.1,hf={id:"simple-mesh",type:"simpleMesh",innerId:J.fe,filter:!1,minzoom:0,maxzoom:20,precomputes:[],renderIndex:0,style:{}},mf=1e4,ff=150,_f=7,pf=[18,34],vf="__MAPGL_BENCH_TIME";class gf{constructor(e,t){this.state=e,this.modules=t,this.buffer=null,this.sceneObjects=[],this.timeout=1/0,this.scale=ae.al(1,1,1),this.startTs=0,this.de=Pr(this.state,this.modules),this.framebufferId=this.createFramebuffer(),this.modules.dynamicStyle.addLayer(hf)}run(e=mf,t=ff,i=_f,n=1e3){return(0,I.mG)(this,void 0,void 0,(function*(){if(cf.env.TEST)return{status:"done",tier:"light"===window.benchmarkResultPreset?0:"normal"===window.benchmarkResultPreset?1:2,measurements:{mean:0,median:0,min:0,max:0},preparation:{generationTime:0,objectsTime:0}};const o=this.getCachedResult();if(o)return o;this.timeout=n,this.startTs=performance.now();try{return yield this._run(e,t,t*i,i)}catch(e){return{status:"error"}}}))}getScale(){return this.scale}destroy(){this.modules.renderer.removeFramebuffer(this.framebufferId),this.buffer=null,this.sceneObjects=[],this.modules.dynamicStyle.removeLayer(J.fe)}getCachedResult(){try{const e="v1.66.0",t=localStorage.getItem(vf);if(t){const i=t.split(":");if(e===i[0]){const e=i.slice(1).join(":").split(",").map((e=>parseFloat(e))).filter((e=>!Number.isNaN(e)));if(e.length>=5){const t=e.reduce(((e,t)=>e+t),0)/e.length;return{status:"cached",tier:this.selectTier(t)}}}}}catch(e){}return null}selectTier(e){const t=pf.findIndex((t=>e<=t));return t>-1?pf.length-t:0}saveResult(e){try{const t="v1.66.0",i=localStorage.getItem(vf);if(i){const n=i.split(":");if(t!==n[0])localStorage.setItem(vf,`${t}:${e.toPrecision(4)}`);else{const i=n.slice(1).join(":").split(",").map((e=>parseFloat(e))).filter((e=>!Number.isNaN(e)));i.push(e),localStorage.setItem(vf,`${t}:${i.map((e=>e.toPrecision(4))).join(",")}`)}}else localStorage.setItem(vf,`${t}:${e.toPrecision(4)}`)}catch(e){}}_run(e,t,i,n){return(0,I.mG)(this,void 0,void 0,(function*(){const o=this.modules.renderer.getFramebuffer(this.framebufferId);if(!o)throw new Error("Failed to create framebuffer for benchmark.");this.modules.renderer.bindRenderTarget(o.renderTarget),this.modules.renderer.setViewport(0,0,this.modules.renderer.getViewportSize()[0],this.modules.renderer.getViewportSize()[1]);const r=this.prepareData(e,i),s=yield this.measureRendering(n,t);if(this.modules.renderer.bindRenderTarget(null),s.length<3)return{status:"timeout"};const a=this.processResults(s),l=Math.min(a.mean,a.median);this.saveResult(l);const d=this.selectTier(l);return{status:s.length<n?"part-done":"done",tier:d,measurements:a,preparation:r}}))}prepareData(e,t){const i=performance.now();this.buffer=this.generateSphere(e);const n=performance.now(),o=performance.now();this.sceneObjects=this.createSceneObjects(t);return{generationTime:n-i,objectsTime:performance.now()-o}}measureRendering(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){return new Promise((i=>{const n=[];let o=0,r=0;const s=()=>{const a=performance.now();a-this.startTs>this.timeout?i(n):(this.modules.renderer.clear(!0),this.scale[0]+=.5-Math.random(),ir(this.state,this.modules,this.sceneObjects.slice(r,r+t),this.de),this.modules.renderer.waitForGpuCommandsToFinish(),n.push(performance.now()-a),o++,r+=t,o<e?Promise.resolve().then(s):i(n))};setTimeout((()=>{s()}),0)}))}))}processResults(e){const t=e.slice();t.sort(((e,t)=>e-t));const i=t.slice(0,t.length-.2*t.length);return{median:i[Math.floor(i.length/2)],mean:i.reduce(((e,t)=>e+t),0)/i.length,min:i[0],max:i[i.length-1]}}generateSphere(e){const t=Math.floor(Math.sqrt(e/2)),i=2*t,n=new Float32Array(3*(t*i*2)*3);let o=0;const r=Math.PI/t,s=2*Math.PI/i,a=new Float32Array(3),l=new Float32Array(3),d=new Float32Array(3),c=new Float32Array(3);for(let e=0;e<t;e++){const t=e*r,u=(e+1)*r,h=Math.sin(t),m=Math.cos(t),f=Math.sin(u),_=Math.cos(u);for(let e=0;e<i;e++){const t=e*s,i=(e+1)*s,r=Math.sin(t),u=Math.cos(t),p=Math.sin(i),v=Math.cos(i);a[0]=uf*h*u,a[1]=uf*m,a[2]=uf*h*r,l[0]=uf*h*v,l[1]=uf*m,l[2]=uf*h*p,d[0]=uf*f*u,d[1]=uf*_,d[2]=uf*f*r,c[0]=uf*f*v,c[1]=uf*_,c[2]=uf*f*p,n.set(a,o),n.set(d,o+3),n.set(l,o+6),n.set(d,o+9),n.set(c,o+12),n.set(l,o+15),o+=18}}return n.buffer}createFramebuffer(){const e=new st({size:this.modules.renderer.getViewportSize(),magFilter:nt.NearestFilter,minFilter:nt.NearestFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping,type:nt.Float,flipY:!0});return this.modules.renderer.addFramebuffer({clearColor:[0,0,0,0],renderTarget:e,onResize:()=>{}})}createSceneObjects(e){const t={programName:"simpleMesh",vaoCreator:wn,stateBinder:()=>oo,programBinder:as,tileBinder:()=>!0,objectBinder:Ha,needsVisibilityBuffer:!1},i=[],n=wn(this.modules.renderer.createBuffer(this.buffer),this.modules.renderer.getShaderProgram("simpleMesh")),o=new R.W("zenith",[],this.modules,this.state),r={layerId:J.fe,styleId:J.jf,tileData:[]};for(let s=0;s<e;s++){const a=0==(s/20&1)?1-(1+s%10)/10:(1+s%10)/10,l=ae.al(s%20/10-1,1-2*Math.floor(s/20)/(e/20),0);i.push({id:(0,z.fD)(),type:Cn.H.Tile,start:0,count:this.buffer.byteLength/12,attributesHash:`benchmark-${s}`,vao:n,drawMode:G.Fg,tile:o,symbol:"simpleMesh",sink:"fill",layerSettings:t,canRender:!0,attributes:r,meta:{scale:a,transform:l},renderingProperties:{}})}return i}}class yf{constructor(e,t,i){this.benchmark=null,this.map=i,this.camera=new Qn.V(e),this.layout=new gm(t),this.collector=new tt.P("main"),this.workers=new Gu,this.identifier=new au(e,this),this.styleManager=new pu(this),this.assetManager=new yu(e,this),this.imageManager=new ym(this),this.floorManager=new mh(e,this),this.personalPoiManager=new Eu(this),this.buildingHeightAnimator=new et(e,this),this.modelsScene=new Km(e,this),this.renderer=new ru(e,this),this.layers=new Yu(this),this.sourceStorage=new Sm,this.tileManager=new yh(e,this),this.modelLayer=new Iu(e,this),this.dynamicStyle=new J.hX,this.imageCache=new eh(this),this.labeler=new xh(e,this),this.ruler=new $h(e,this),this.trafficTileLayer=new vm(e,this),this.handler=new lm(e,this),this.mouseMoveHandler=new Je(this),this.tileKeyInfo=new wm(e),this.demManager=new Yo(this),this.environmentManager=new Cm(this),this.defaultSource=new Em(e,this),this.labelsDebug=new Am(e,this),this.postEffectsManager=new Wr(e,this),this.renderCacheManager=new Jc(e,this),this.animationManager=new df(e,this),this.shadowManager=new jr(e,this),this.instanceLinker=new Hd(this),"auto"===e.graphicsPresetMode&&(this.benchmark=new gf(e,this))}destroy(){this.demManager.disable(),this.imageManager.destroy(),this.trafficTileLayer.destroy(),this.tileManager.destroy(),this.workers.destroy(),this.renderer.destroy(),this.handler.destroy(),this.mouseMoveHandler.destroy(),this.ruler.destroy(),this.labelsDebug.hide(),this.renderCacheManager.destroy(),this.tileKeyInfo.destroy(),this.layout.destroy()}}class bf{constructor(e,t={},i){var n,o,r,s,a,l,d,c,u,h,m,f,_,p,v,g,y;this.requestedFrame=requestAnimationFrame((()=>{})),this.isStyleUpdateInProgress=!1,this.isFirstStyleUpdate=!0,this.lastResizeTime=-1/0,this.replicasDiffer=new Ve.H([{path:"visibleMapReplicas",type:"replicas"}]),this.graphicsPresetDiffer=new Ve.H([{path:"graphicsPreset",type:"string"}]),this.lastDpr=window.devicePixelRatio,this.renderLoop=e=>{if(this.modules.renderer.isDestroyed)return;this.requestedFrame=requestAnimationFrame(this.renderLoop),this.updateImmersiveLevel();const t=window.devicePixelRatio;t!==this.lastDpr?(this.lastDpr=t,this.state.dpiChanged=!0,this.modules.map.invalidateSize(),this.modules.imageCache.clear()):this.state.dpiChanged=!1,this.modules.map.emit("framestart");const i=this.state;i.time=Date.now(),this.processMetrics(),this.state.enableTrackResize&&this.autoResize(e),this.modules.mouseMoveHandler.update(),this.handlers.forEach((e=>e.update())),Le(i),pe(i),xe(i),Te(i),this.stillnessUpdater.update(i),ue(i,this.modules.layout.rootContainer),((e,t,i)=>{ne.Vx("viewport",{step:(e,n)=>{e.viewport={top:n[0],right:n[1],bottom:n[2],left:n[3]},oe(e,t,i)}},e)})(i,this.modules.layout.rootContainer,this.modules.renderer),((e,t)=>{ne.Vx("padding",{step:(e,i)=>{e.padding={top:i[0],right:i[1],bottom:i[2],left:i[3]},se(e,t)}},e)})(i,this.modules.renderer);const n="vector"===this.modules.demManager.getReliefTileType()&&i.styleZoom<5;if(i.demMode=this.checkDemEnabled()&&i.elevationScale>0&&!n,this.checkGlobeEnabled(),this.modules.camera.update(),this.updateElevation(),this.updateTilesBounds(),this.replicasDiffer.check(i)&&(i.needReplicasUpdate=!0),this.modules.demManager.update(),this.modules.environmentManager.update(),this.modules.labelsDebug.update(),this.modules.trafficTileLayer.update(),this.modules.layers.getLayers().forEach((e=>{void 0!==e.update&&e.update()})),this.modules.tileManager.update(),this.modules.instanceLinker.update(),this.modules.sourceStorage.updateViewportSources(),this.modules.floorManager.update(),this.modules.modelLayer.update(),this.modules.personalPoiManager.update(),this.modules.ruler.update(),this.modules.dynamicStyle.update(),this.modules.styleManager.update(),this.modules.buildingHeightAnimator.update(),this.modules.modelsScene.update(),this.modules.shadowManager.update(),this.modules.animationManager.update(),this.modules.map.emit("update"),this.modules.labeler.update(),this.performanceChecker.update(),this.modules.identifier.update(),this.modules.postEffectsManager.update(),i.loopWorld&&!this.modules.renderer.isNeedRerender()&&(0,L.kC)(i.center),(T.render.alwaysRerender||this.modules.renderer.isNeedRerender())&&i.collectStats&&(i.stats.drawCount=0,i.stats.vertexCount=0,i.stats.triangleCount=0,i.stats.drawCountBySymbol={}),T.render.alwaysRerender||this.modules.renderer.isNeedRerender()){let e=this.modules.tileManager.getTileObjects();i.demMode&&(e=e.concat(this.modules.demManager.getGroundTiles())),this.modules.renderer.prerenderUpdate(),void 0===i.metrics.firstdraw&&(i.metrics.firstdraw=performance.now()-i.metrics.start),e.forEach((e=>{e.needSync&&e.syncReplicas(this.state)})),this.modules.renderCacheManager.frameStart(),this.modules.animationManager.frameStart(),this.modules.renderer.renderElevation(e),this.modules.shadowManager.drawShadowMap(e),this.modules.renderer.renderLabelingTexture(e),this.modules.renderer.renderSpriteLabelingTexture(e),this.modules.renderer.renderTileObjects(e),this.modules.shadowManager.drawDebugFbIfNeeded(),i.needRerender=!1,this.state.rerenderEvents=new Array,this.modules.animationManager.frameEnd(),this.modules.renderCacheManager.frameEnd(),i.collectStats&&(this.modules.map.emit("stats",i.stats),i.metricsSent||(i.metrics.vertexCount=i.stats.vertexCount,i.metrics.triangleCount=i.stats.triangleCount,i.metrics.drawCount=i.stats.drawCount))}this.finishStyleUpdatingCheck(),this.modules.map.update(),this.modules.assetManager.invalidateUsedGltfModels(),i.needReplicasUpdate=!1,i.shouldIsReadyWaitForUpdates=!1,i.shouldIsIdleWaitForUpdates=!1,this.modules.map.emit("frameend"),this.modules.styleManager.getStyle(this.modules.map.state.handyStyleId)&&this.state.graphicsPresetMode&&this.graphicsPresetDiffer.check(this.state.styleState)&&this.modules.map.emit("graphicspresetchange")};const b=Object.assign(Object.assign({},bf.options),t),x=Object.assign(Object.assign({},bf.options.padding),b.padding),w=Object.assign(Object.assign({},bf.options.viewport),b.viewport),S=b.maxBounds?le.X3(b.maxBounds):b.loopWorld?L._L:L.Vv,M=W.H.fromGeo(b.center);(0,L.kC)(M),le.Rk(M,S,M);const I=b.graphicsPreset&&"auto"!==b.graphicsPreset?Object.assign(Object.assign({},b.styleState),{graphicsPreset:b.graphicsPreset}):b.styleState,E=this.state={time:Date.now(),center:M,zoom:void 0!==b.styleZoom?(0,L.Z3)(b.styleZoom,M):b.zoom,rotation:(0,we.Id)(b.rotation),pitch:(0,we.Id)(b.pitch),styleZoom:void 0!==b.styleZoom?b.styleZoom:(0,L.X$)(b.zoom,M),zoomTypePreserving:void 0!==b.styleZoom?"styleZoom":"zoom",minZoom:b.minZoom,maxZoom:b.maxZoom,maxBounds:S,loopWorld:null!==(n=b.loopWorld)&&void 0!==n&&n,touchRotationThreshold:(0,we.Id)(b.touchRotationThreshold),minPitch:(0,we.Id)(b.minPitch),maxPitch:(0,we.Id)(b.maxPitch),lowZoomMaxPitch:b.lowZoomMaxPitch?(0,we.Id)(b.lowZoomMaxPitch):null,size:[Math.max(1,e.clientWidth-w.left-w.right),Math.max(1,e.clientHeight-w.top-w.bottom)],tickers:{},stillness:1,needRerender:!0,needLabeling:!1,needReplicasUpdate:!1,userHasInteracted:!1,dpiChanged:!1,viewport:w,padding:x,labelingOpacity:0,tileServer:b.tileServer,styleServer:b.styleServer||T.styles.url,fontUrl:b.fontUrl||T.fonts.defaultUrl,modelUrl:b.modelUrl||bm.LP,iconUrl:b.iconUrl||T.icons.defaultUrl,keyUrl:b.keyUrl||bm.ns,tileSet:b.tileSet,tileProtocol:b.tileProtocol,commercialTileSet:b.commercialTileSet,modelsTileSet:null!==(o=b.modelsTileSet)&&void 0!==o?o:T.models.tileSet,modelsTilesUrl:null!==(r=b.modelsTilesUrl)&&void 0!==r?r:T.urls.models,defaultSourceModelsRootUrl:b.defaultSourceModelsRootUrl,defaultSourceModelsAppearStrategy:b.defaultSourceModelsAppearStrategy,subdomains:b.subdomains.split(""),floorsEnabled:b.floorsEnabled,collectStats:b.collectStats,stats:{tileCount:0,dynamicTileCount:0,globeTileCount:0,drawCount:0,vertexCount:0,triangleCount:0,drawCountBySymbol:{},foundVisibleTilesCount:0},trafficOn:!!b.trafficOn,trafficServer:b.trafficServer,trafficProtocol:b.trafficProtocol,identifyPickDistance:T.identify.pickDistance,lang:b.lang,tileServerDefaultLang:b.tileServerDefaultLang,tileKey:b.key,appId:b.appId,disableHoverStyles:b.disableHoverStyles,keepCenterWhileUserZoomRotate:!!b.keepCenterWhileUserZoomRotate,disableRotationByUserInteraction:!!b.disableRotationByUserInteraction,disablePitchByUserInteraction:!!b.disablePitchByUserInteraction,disableDragging:!!b.disableDragging,enableTwoFingerDragging:!!b.enableTwoFingerDragging,performanceCaveatEmitted:!1,sessionId:b.sessionId,tileSessionId:b.tileSessionId,shownRegionIds:new Set,preserveDrawingBuffer:!!b.preserveDrawingBuffer,defaultBackgroundColor:(0,$a.MV)(b.defaultBackgroundColor),handyStyleId:NaN,styleId:"",styleState:nh(I),disableIconCache:b.disableIconCache,disableRenderingCache:b.disableRenderingCache,rtlPlugin:{scenario:null!==(s=b.useRtlTextPlugin)&&void 0!==s?s:"depends-on-language",loadFailed:!1,url:null!==(a=b.rtlPluginUrl)&&void 0!==a?a:bm.k0,hash:null!==(l=b.rtlPluginHash)&&void 0!==l?l:bm.aT},mobileSdkMode:b.mobileSdkMode,dracoDecoderUrl:null!==(d=null==b?void 0:b.dracoDecoderUrl)&&void 0!==d?d:bm.rQ,demMode:!1,globeMode:!1,globeReady:!1,visibleMapReplicas:[0],tilesBounds:[[0,0],[0,0],[0,0],[0,0]],extendedTilesBounds:[[0,0],[0,0],[0,0],[0,0]],elevation:void 0,elevationScale:0,minElevation:void 0,skipElevationAnimation:b.skipElevationAnimation,metrics:{start:performance.now(),fail:!1,vertexCount:0,triangleCount:0,drawCount:0},metricsSent:!1,shouldIsReadyWaitForUpdates:!1,shouldIsIdleWaitForUpdates:!1,commercialPoiRandomSeed:b.commercialPoiRandomSeed,disableSurvivedPoiPrevalence:Boolean(b.disableSurvivedPoiPrevalence),webglVersion:b.webglVersion,enableTrackResize:!!b.enableTrackResize,autoResizeInterval:T.render.autoResizeInterval,showDefaultTileBounds:!!b.showDefaultTileBounds,immersiveLevel:{tiers:!1},pitchHightLimitation:void 0===b.pitchHightLimitation?(0,we.Id)(90):(0,we.Id)(b.pitchHightLimitation),isLabelingDepthTestDisabled:!1,iconIdentifyOpacity:null!==(c=b.iconIdentifyOpacity)&&void 0!==c?c:.3,disableHidingPois:null!==(u=b.disableHidingPois)&&void 0!==u&&u,aaMode:!1===b.disableAntiAliasing?Ur.TAA:void 0,rerenderEvents:new Array,cameraConfig:Object.assign({},T.defaultCameraConfig),cityCommPoiLabeling:{config:b.cityCommPoiLabelingConfig,ascSortedZoomNumbers:(P=b.cityCommPoiLabelingConfig,P?Object.keys(P).map(Number).sort(((e,t)=>e-t)):[])},trafficMinZoom:null!==(h=b.trafficMinZoom)&&void 0!==h?h:T.traffic.minZoom,trafficMaxZoom:null!==(m=b.trafficMaxZoom)&&void 0!==m?m:T.traffic.maxZoom,trafficMaxDetailLevel:null!==(f=b.trafficMaxDetailLevel)&&void 0!==f?f:T.traffic.maxDetailLevel,bssHostAppParams:b.bssHostAppParams,disableStyleFallback:!!b.disableStyleFallback,disableFlatDemIrregularMeshNormals:null!==(_=b.disableFlatDemIrregularMeshNormals)&&void 0!==_&&_,hiddenImmersiveRoutesEnabled:gt(),modelShowHideEventsSublayers:new Set(null!==(p=b.modelShowHideEventsSublayers)&&void 0!==p?p:[]),graphicsPresetMode:b.graphicsPreset,shouldEmitGraphicsPresetChangeEvent:!1,isDeprecatedSystem:mt(),disableModelsGrowthAnimation:null!==(v=b.disableModelsGrowthAnimation)&&void 0!==v&&v,disableLayerAnimation:null!==(g=b.disableLayerAnimation)&&void 0!==g&&g,allowMetro:null!==(y=b.allowMetro)&&void 0!==y&&y};var P;b.cameraConfig&&Object.assign(E.cameraConfig,b.cameraConfig),this.modules=new yf(E,e,i),"number"==typeof E.commercialPoiRandomSeed&&this.modules.workers.labeling.setCommercialPoiRandomSeed(E.commercialPoiRandomSeed),this.modules.styleManager.setDynamicStyle(this.modules.dynamicStyle.getStyle()),this.handlers=[new Ze(E,this.modules.layout.mapContainer),new We(this.modules)],b.disableZoomOnScroll||this.handlers.push(new Ge(E,this.modules.layout.mapContainer)),Fe&&Be&&this.handlers.push(new Xe(E,e,i)),this.performanceChecker=new $e(E,this.modules),this.stillnessUpdater=new Ye,this.measurePerformance("auto"===b.graphicsPreset).then((()=>{this.requestedFrame=requestAnimationFrame(this.renderLoop)}))}destroy(){cancelAnimationFrame(this.requestedFrame),this.modules.destroy(),this.handlers.forEach((e=>e.destroy()))}isIdle(){return!this.modules.renderer.isNeedRerender()&&!this.state.shouldIsIdleWaitForUpdates&&this.modules.tileManager.isIdle()&&this.modules.assetManager.isIdle()&&this.modules.trafficTileLayer.viewportTilesReady()&&this.modules.layers.entranceAnimationFinished()&&this.modules.modelLayer.isIdle()&&!this.modules.buildingHeightAnimator.isAnimating()&&!this.modules.modelsScene.isAnimating()&&this.modules.labeler.isIdle()}isReady(){return this.isIdle()&&this.modules.floorManager.floorsReady()&&this.modules.identifier.isIdle()&&this.modules.imageManager.isIdle()&&this.modules.imageCache.isIdle()&&this.modules.personalPoiManager.isIdle()&&this.modules.tileKeyInfo.isIdle()&&this.modules.postEffectsManager.isReady()&&!this.state.shouldIsReadyWaitForUpdates}isReadyForMetrics(){return!this.modules.renderer.isNeedRerender(!0)&&!this.state.shouldIsIdleWaitForUpdates&&this.modules.tileManager.isIdle()&&this.modules.assetManager.isIdle()&&this.modules.trafficTileLayer.viewportTilesReady()&&this.modules.modelLayer.isIdle()&&!this.modules.buildingHeightAnimator.isAnimating()&&!this.modules.modelsScene.isAnimating()&&this.modules.labeler.isIdle()&&this.modules.floorManager.floorsReady()&&this.modules.identifier.isIdle()&&this.modules.imageManager.isIdle()&&this.modules.imageCache.isIdle()&&this.modules.personalPoiManager.isIdle()&&this.modules.tileKeyInfo.isIdle()&&this.modules.postEffectsManager.isReady(!0)&&!this.state.shouldIsReadyWaitForUpdates}hasActiveLayerAnimation(){return this.state.rerenderEvents.some((e=>"layerAnimationTicker"===e.type))||!this.modules.layers.entranceAnimationFinished()}redrawMap(){this.modules.tileManager.redraw(),this.modules.trafficTileLayer.redraw(),this.modules.modelLayer.redraw(),this.modules.personalPoiManager.redraw()}activateStyleUpdating(){this.modules.tileManager.activateStyleUpdating(),this.modules.modelLayer.activateStyleUpdating(),this.modules.trafficTileLayer.activateStyleUpdating(),this.isStyleUpdateInProgress=!0}getIsFirstStyleUpdate(){return this.isFirstStyleUpdate}measurePerformance(e){return(0,I.mG)(this,void 0,void 0,(function*(){if(!e)return;performance.now();const t=yield this.modules.benchmark.run();switch(this.modules.benchmark.destroy(),this.modules.benchmark=null,t.status){case"error":this.state.metrics.graphicsPreset="error";break;case"timeout":this.state.metrics.graphicsPreset="timeout",this.modules.map.patchStyleState({graphicsPreset:"light"});break;case"part-done":case"done":case"cached":{const e=t.tier>0?t.tier>1?"immersive":"normal":"light";this.state.metrics.graphicsPreset="part-done"===t.status?"timeout":e,"cached"!==t.status&&(this.state.metrics.benchRenderTime=Math.round(t.measurements.mean),this.state.metrics.benchGenTime=Math.round(t.preparation.generationTime)),this.modules.map.patchStyleState({graphicsPreset:e});break}}}))}processMetrics(){const e=this.state;if(e.metricsSent)return;if("auto"===e.graphicsPresetMode&&!e.metrics.graphicsPreset)return;const t=e.metrics,i=performance.now()-t.start>T.metricsTimeout;(void 0!==t.interactive&&void 0!==t.init&&void 0!==t.firstlabeling&&void 0!==t.ready&&void 0!==t.firstcontent&&void 0!==t.firstdraw||i)&&(t.fail=i,this.modules.map.emit("metrics",t),e.metricsSent=!0)}finishStyleUpdatingCheck(){this.isStyleUpdateInProgress&&this.modules.tileManager.viewportTilesReady()&&this.modules.trafficTileLayer.viewportTilesReady()&&this.modules.modelLayer.viewportModelsReady()&&(this.modules.tileManager.finishStyleUpdating(),this.modules.trafficTileLayer.finishStyleUpdating(),this.modules.modelLayer.finishStyleUpdating(),this.modules.modelsScene.finishStyleUpdating(),this.modules.personalPoiManager.redraw(),this.updateBackgroundColor(),this.isStyleUpdateInProgress=!1,this.isFirstStyleUpdate=!1,this.modules.renderer.addRerenderEvent(),this.state.needLabeling=!0)}updateBackgroundColor(){const{renderer:e,postEffectsManager:t,styleManager:i}=this.modules,n=i.getClearColor();void 0!==n&&(e.setClearColor(n),t.setClearColor(n))}checkDemEnabled(){return!0!==this.state.styleState.terrainEnabled||this.state.globeMode?this.modules.demManager.isEnabled()&&this.modules.demManager.disable():this.modules.demManager.isEnabled()||this.modules.demManager.enable(),this.modules.demManager.isEnabled()}checkGlobeEnabled(){const{styleState:e,styleZoom:t,globeMode:i,handyStyleId:n}=this.state,{defaultSource:o,map:r}=this.modules,s=i;if(!this.modules.styleManager.getStyleLayer(n,zn.d6))return void(this.state.globeMode=!1);const{globeMaxZoom:a}=T.globeConfig,l=!s&&t<a||s&&t<a+.2,d=!0===e.globeEnabled&&l&&!r.getFeatureFlag("globeOff");!s&&d&&(this.modules.defaultSource.addGlobeSource(),this.state.globeReady=!1),s&&!d&&(this.modules.defaultSource.removeGlobeSource(),this.state.globeReady=!1),d&&o.isGlobeTilesReady()&&(this.state.globeReady=!0),this.state.globeMode=d,(d||s&&!d)&&this.updateBackgroundColor()}updateImmersiveLevel(){const e=!!this.state.styleState.immersiveRoadsOn;this.state.immersiveLevel.tiers=e&&this.state.styleZoom>=T.DEFAULT_MIN_TIERS_STYLE_ZOOM}updateTilesBounds(){const{size:e,zoom:t}=this.state,[i,n,o,r]=this.modules.camera.getViewportVertices(),s=(0,Jn.hS)(i,n);let a=(0,Jn.Oy)(o,s);const l=this.state.cameraConfig;let d=(0,L.h0)(e[1],t)*l.viewportLimitRatio;if(d<l.minTrapezeHeight&&(d=l.minTrapezeHeight),a>d){const e=d/a;ae.t7(o,n,o,e),ae.t7(r,i,r,e),a=d}if(ae.JG(this.state.tilesBounds[0],i),ae.JG(this.state.tilesBounds[1],n),ae.JG(this.state.tilesBounds[2],o),ae.JG(this.state.tilesBounds[3],r),this.state.visibleMapReplicas=this.state.loopWorld||this.state.globeMode?(0,Y.tW)(this.state.tilesBounds,this.state.globeMode):[0],this.state.demMode){const e=(0,Jn.iE)(this.modules.camera.position,s);if(e<0){const t=(a+Math.abs(e))/a;ae.t7(i,r,i,t),ae.t7(n,o,n,t)}if(void 0!==this.state.elevation&&!Number.isNaN(this.state.elevation)){const e=this.modules.camera.position[2],t=void 0===this.state.minElevation||Number.isNaN(this.state.minElevation)?this.state.elevation:this.state.minElevation,s=Math.max(this.state.elevation-t,0)*L.C/e+1,a=(s-1)*Math.max(1-this.state.pitch/this.state.maxPitch,.1)+1,l=Math.max(this.state.pitch/this.state.maxPitch*30,4);ae.t7(i,this.modules.camera.position,i,Math.min(a,l)),ae.t7(n,this.modules.camera.position,n,Math.min(a,l)),ae.t7(r,this.modules.camera.position,r,Math.min(s,l)),ae.t7(o,this.modules.camera.position,o,Math.min(s,l))}}this.state.extendedTilesBounds[0]=i,this.state.extendedTilesBounds[1]=n,this.state.extendedTilesBounds[2]=o,this.state.extendedTilesBounds[3]=r}updateElevation(){if(this.state.elevationScale=this.modules.demManager.getVerticalScale(),!this.state.demMode)return void(void 0!==this.state.elevation&&(this.modules.renderer.addRerenderEvent(),this.state.elevation=void 0));const e=this.modules.demManager.getElevation(this.state.center);if(void 0!==e)if(void 0===this.state.elevation||this.state.skipElevationAnimation)this.state.elevation=e;else{const t=.1*(e-this.state.elevation);Math.abs(t)<.3?this.state.elevation=e:this.state.elevation+=t;const i=this.modules.demManager.getElevation(this.modules.camera.position);if(void 0!==i){const e=this.state.elevationScale,t=i*e,n=this.modules.camera.position[2]/L.C,o=Math.min(30,.2*n),r=this.state.elevation*e+n-o;t>r&&(this.state.elevation+=(t-r)/e)}}const t=this.modules.demManager.getMinElevation();void 0!==t&&(this.state.minElevation=t)}autoResize(e){if(e-this.lastResizeTime>=this.state.autoResizeInterval){const t=this.modules.layout.canvas,{clientWidth:i,clientHeight:n}=this.modules.layout.rootContainer,o=window.devicePixelRatio;t.width===Math.floor(i*o)&&t.height===Math.floor(n*o)||(this.lastResizeTime=e,this.modules.map.invalidateSize())}}}bf.options={center:[0,0],zoom:0,minZoom:T.MAP_DEFAULTS.minZoom,maxZoom:T.MAP_DEFAULTS.maxZoom,rotation:0,touchRotationThreshold:10,pitch:0,minPitch:0,maxPitch:45,lowZoomMaxPitch:45,viewport:{top:0,right:0,bottom:0,left:0},padding:{top:0,right:0,bottom:0,left:0},tileServer:T.tiles.server,tileSet:T.tiles.tileSet,tileProtocol:T.tiles.protocol,commercialTileSet:T.commercialPoi.tileSet,key:T.tiles.tileKey,subdomains:T.tiles.subdomains,floorsEnabled:T.floors.enabled,trafficProtocol:T.traffic.protocol,trafficServer:T.traffic.host,collectStats:!1,style:"",styleState:Object.assign({},th),styleOptions:{rootUrl:"",iconsPath:"",fontsPath:"",stylePath:"",modelsPath:""},lang:T.defaultLang,appId:T.tiles.appId,disableHoverStyles:!1,disableZoomOnScroll:!1,disableDragging:!1,enableTwoFingerDragging:!1,disableRotationByUserInteraction:!1,disablePitchByUserInteraction:!1,defaultBackgroundColor:"#f6f2de",disableIconCache:!1,disableRenderingCache:!1,mobileSdkMode:!1,skipElevationAnimation:!1,enableTrackResize:!1,showDefaultTileBounds:!1,immersiveOn:!1,pitchHightLimitation:90,trafficOn:!1,trafficMinZoom:T.traffic.minZoom,trafficMaxZoom:T.traffic.maxZoom,trafficMaxDetailLevel:T.traffic.maxDetailLevel,disableStyleFallback:!1,disableFlatDemIrregularMeshNormals:!1,modelShowHideEventsSublayers:[],styleServer:"",fontUrl:"",modelUrl:"",iconUrl:"",keyUrl:"",disableLayerAnimation:!1};const xf=["disableDragging","enableTrackResize","loopWorld","disableHidingPois","enableTwoFingerDragging"];var wf=i(3379),Sf=i.n(wf),Mf=i(7795),If=i.n(Mf),Tf=i(569),Ef=i.n(Tf),Pf=i(3565),Af=i.n(Pf),Lf=i(9216),Cf=i.n(Lf),zf=i(4589),kf=i.n(zf),Of=i(5618),Rf={};Rf.styleTagTransform=kf(),Rf.setAttributes=Af(),Rf.insert=Ef().bind(null,"head"),Rf.domAPI=If(),Rf.insertStyleElement=Cf();Sf()(Of.Z,Rf);Of.Z&&Of.Z.locals&&Of.Z.locals;var Ff=i(7636),Bf=i(9981),Df=i(1e3),jf=i(297);const Nf=2,Uf=20,Hf="https://tile{subdomain}-sdk.maps.2gis.com/api/v3/ald",Gf=()=>{let e,t="";for(let i=0;i<32;i++)e=16*Math.random()|0,i>4&&i<21&&!(i%4)&&(t+="-"),t+=(12===i?4:16===i?3&e|8:e).toString(16);return t};var Vf=i(7999);const Zf=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,Wf=/CrOS/,Xf=/android|ipad|playbook|silk/i,Kf=()=>{const e="undefined"!=typeof navigator?navigator.userAgent:"";if(!e)return!1;const t=Zf.test(e)&&!Wf.test(e),i=Xf.test(e),n=navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari");return t||i||n},$f=5e3;class qf{constructor(e,t){var i;this.queue=[],this.commPoiMsgOrderNumber=0,this.utcOffset=function(){const e=(new Date).getTimezoneOffset(),t=e>0?"-":"+",i=`${Math.floor(Math.abs(e)/60)}`,n=""+Math.abs(e)%60;return t+(i.length>1?i:"0"+i)+":"+(n.length>1?n:"0"+n)}(),this.unsentMessages=[],this.isMetricsFailed=!1,this.webglStatsValues=[],this.onCommPoiShowEvent=({commPois:e})=>{const t=Date.now(),{tileKey:i,sessionId:n}=this.map.state;for(const o of e){const e=Yf(o,t,this.commPoiMsgOrderNumber++,i,this.utcOffset,n);e&&this.queue.push(e)}this.timer||(this.timer=window.setTimeout(this.sendMessages,$f))},this.onContextLostEvent=()=>(0,I.mG)(this,void 0,void 0,(function*(){const e=Date.now(),t=yield this.createMetricMessage(e,{start:0,fail:!0,contextLost:!0},{cpu:0,gpu:0});this.queue.push(t),this.timer||(this.timer=window.setTimeout(this.sendMessages,$f))})),this.onMetricsEvent=e=>(0,I.mG)(this,void 0,void 0,(function*(){this.isMetricsFailed&&(e.fail=!0);const t=Date.now(),i=yield this.getMetricsMessage(e,t);this.queue.push(i),this.timer||(this.timer=window.setTimeout(this.sendMessages,$f))})),this.onSendFail=e=>{this.unsentMessages.push(...e),this.timer||(this.timer=window.setTimeout(this.sendMessages,$f))},this.sendMessages=()=>{this.timer=void 0;const e=[...this.unsentMessages,...this.queue];this.queue=[],this.unsentMessages=[],e.length&&fetch(this.bssUrl,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}).then((t=>{t.ok||this.onSendFail(e)}),(()=>this.onSendFail(e)))},this.markMetricsAsFailed=()=>{this.isMetricsFailed=!0},this.map=e,this.bssUrl=null!==(i=t.bssUrl)&&void 0!==i?i:"https://s1.bss.2gis.com/bss/3",this.webglStatsValues=function(e){const t=[2,e instanceof WebGLRenderingContext?1:2,e.getParameter(e.ALIASED_LINE_WIDTH_RANGE),e.getParameter(e.ALIASED_POINT_SIZE_RANGE),e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),e.getParameter(e.MAX_RENDERBUFFER_SIZE),e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),e.getParameter(e.MAX_TEXTURE_SIZE),e.getParameter(e.MAX_VARYING_VECTORS),e.getParameter(e.MAX_VERTEX_ATTRIBS),e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),e.getParameter(e.MAX_VIEWPORT_DIMS),e.getParameter(e.PACK_ALIGNMENT),e.getParameter(e.SUBPIXEL_BITS),e.getParameter(e.UNPACK_ALIGNMENT),e.getParameter(e.VIEWPORT),e.getParameter(e.SHADING_LANGUAGE_VERSION),e.getParameter(e.VENDOR),e.getParameter(e.RENDERER)];e instanceof WebGLRenderingContext?t.push(...new Array(28).fill(-1)):t.push(e.getParameter(e.MAX_3D_TEXTURE_SIZE),e.getParameter(e.MAX_ARRAY_TEXTURE_LAYERS),e.getParameter(e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL),e.getParameter(e.MAX_COLOR_ATTACHMENTS),e.getParameter(e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS),e.getParameter(e.MAX_COMBINED_UNIFORM_BLOCKS),e.getParameter(e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS),e.getParameter(e.MAX_DRAW_BUFFERS),e.getParameter(e.MAX_ELEMENT_INDEX),e.getParameter(e.MAX_ELEMENTS_INDICES),e.getParameter(e.MAX_ELEMENTS_VERTICES),e.getParameter(e.MAX_FRAGMENT_INPUT_COMPONENTS),e.getParameter(e.MAX_FRAGMENT_UNIFORM_BLOCKS),e.getParameter(e.MAX_FRAGMENT_UNIFORM_COMPONENTS),e.getParameter(e.MAX_PROGRAM_TEXEL_OFFSET),e.getParameter(e.MAX_SAMPLES),e.getParameter(e.MAX_SERVER_WAIT_TIMEOUT),e.getParameter(e.MAX_TEXTURE_LOD_BIAS),e.getParameter(e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS),e.getParameter(e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS),e.getParameter(e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS),e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS),e.getParameter(e.MAX_VARYING_COMPONENTS),e.getParameter(e.MAX_VERTEX_OUTPUT_COMPONENTS),e.getParameter(e.MAX_VERTEX_UNIFORM_BLOCKS),e.getParameter(e.MAX_VERTEX_UNIFORM_COMPONENTS),e.getParameter(e.MIN_PROGRAM_TEXEL_OFFSET));const i=e.getExtension("WEBGL_debug_renderer_info");i?t.push(e.getParameter(i.UNMASKED_VENDOR_WEBGL),e.getParameter(i.UNMASKED_RENDERER_WEBGL)):t.push("Unsupported","Unsupported");const n=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT),o=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT),r=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);return r&&o&&n?(t.push(`[${n.rangeMin},${n.rangeMax}](${n.precision})`),t.push(`[${o.rangeMin},${o.rangeMax}](${o.precision})`),t.push(`[${r.rangeMin},${r.rangeMax}](${r.precision})`)):t.push(new Array(3).fill("Unsupported")),t.push(window.devicePixelRatio),t}(this.map.getWebGLContext()),t.disableBssStatisticsForCommPoi||e.on("commpoishow",this.onCommPoiShowEvent),e.on("metrics",this.onMetricsEvent),this.map.on("error",(e=>{"webglcontextlost"===e.type&&this.onContextLostEvent()})),window.addEventListener("blur",this.markMetricsAsFailed,{once:!0}),window.addEventListener("focus",this.markMetricsAsFailed,{once:!0}),document.addEventListener("visibilitychange",this.markMetricsAsFailed,{once:!0}),document.hasFocus()&&!document.hidden||this.markMetricsAsFailed()}destroy(){clearTimeout(this.timer),this.queue=[],this.timer=void 0,this.map.off("commpoishow",this.onCommPoiShowEvent),window.removeEventListener("blur",this.markMetricsAsFailed),window.removeEventListener("focus",this.markMetricsAsFailed),document.removeEventListener("visibilitychange",this.markMetricsAsFailed)}getDefaultStats(){return(0,I.mG)(this,void 0,void 0,(function*(){return{webglStats:function(e){const t={};for(const[i,n]of Object.entries(e))(0,Gc.f)(n)?t[i]=Array.from(n):t[i]=n;return t}(function(e){var t,i;const n={1:["stateSetVersion","webGlVersion","ALIASED_LINE_WIDTH_RANGE","ALIASED_POINT_SIZE_RANGE","COMPRESSED_TEXTURE_FORMATS","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_RENDERBUFFER_SIZE","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS","MAX_VIEWPORT_DIMS","PACK_ALIGNMENT","SUBPIXEL_BITS","UNPACK_ALIGNMENT","VIEWPORT","SHADING_LANGUAGE_VERSION","VENDOR","RENDERER","MAX_3D_TEXTURE_SIZE","MAX_ARRAY_TEXTURE_LAYERS","MAX_CLIENT_WAIT_TIMEOUT_WEBGL","MAX_COLOR_ATTACHMENTS","MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS","MAX_COMBINED_UNIFORM_BLOCKS","MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS","MAX_DRAW_BUFFERS","MAX_ELEMENT_INDEX","MAX_ELEMENTS_INDICES","MAX_ELEMENTS_VERTICES","MAX_FRAGMENT_INPUT_COMPONENTS","MAX_FRAGMENT_UNIFORM_BLOCKS","MAX_FRAGMENT_UNIFORM_COMPONENTS","MAX_PROGRAM_TEXEL_OFFSET","MAX_SAMPLES","MAX_SERVER_WAIT_TIMEOUT","MAX_TEXTURE_LOD_BIAS","MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS","MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS","MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS","MAX_UNIFORM_BLOCK_SIZE","MAX_UNIFORM_BUFFER_BINDINGS","MAX_VARYING_COMPONENTS","MAX_VERTEX_OUTPUT_COMPONENTS","MAX_VERTEX_UNIFORM_BLOCKS","MAX_VERTEX_UNIFORM_COMPONENTS","MIN_PROGRAM_TEXEL_OFFSET"]};n[2]=[...n[1],"UNMASKED_VENDOR_WEBGL","UNMASKED_RENDERER_WEBGL","precisionLow","precisionMedium","precisionHigh","devicePixelRatio"];const o=null!==(t=n[e[0]])&&void 0!==t?t:{},r={};for(let t=0;t<e.length;t++)r[null!==(i=o[t])&&void 0!==i?i:t]=e[t];return r}(this.webglStatsValues)),fps:this.map.performanceChecker.getFpsStats(),center:Array.from(this.map.state.center),zoom:this.map.state.zoom,rotation:this.map.state.rotation,pitch:this.map.state.pitch,webGpuSupported:yield(0,I.mG)(void 0,void 0,void 0,(function*(){if(!navigator)return!1;try{const e=navigator.gpu;if("function"!=typeof(null==e?void 0:e.requestAdapter))return!1;if(!(yield e.requestAdapter({powerPreference:"high-performance"})))return!1;if(!document.createElement("canvas").getContext("webgpu",{}))return!1}catch(e){return!1}return!0}))}}))}createMetricMessage(e,t,i){return(0,I.mG)(this,void 0,void 0,(function*(){const n=yield this.getDefaultStats();return{type:411,eventType:"mapglCounter",eventId:Gf(),timestamp:e,payload:{mapGlMapMetrics:Object.assign(Object.assign(Object.assign({},t),n),{memory:i}),mapGlHostAppParams:Jf(this.map.state.bssHostAppParams)},common:{formatVersion:3,appVersion:(0,Vf.io)(wv||"v1",64),product:44,deviceType:Kf()?"mobile":"desktop",key:this.map.state.tileKey,styleId:this.map.state.styleId}}}))}getMetricsMessage(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){const i=yield this.map.performanceChecker.getMemoryStats(),n=yield this.createMetricMessage(t,e,i);return n.payload.mapGlMapMetrics.fail&&!n.payload.mapGlMapMetrics.fps.isStatic&&void 0!==e.firstcontent&&(n.payload.mapGlMapMetrics.fail=!1),n}))}}function Yf(e,t,i,n,o,r){const s={adsHighlight:!0,entity:{id:e.id,type:"branch"}};void 0!==e.adsPriority&&(s.adsPriority=e.adsPriority);const a={type:302,eventType:"view",eventId:Gf(),eventOrdinal:i,uiElement:{name:"POI",ownerName:"map"},timestamp:t,utcOffset:o,payload:{POI:s},common:{formatVersion:3,appVersion:(0,Vf.io)(wv||"v1",16),product:44,apikey:n}};return r&&(a.common.sessionId=r),n&&n!==G.vd?a:null}function Jf(e){if(e){const t=Object.assign({},e);return"userId"in t&&"string"!=typeof t.userId&&delete t.userId,"sessionId"in t&&"string"!=typeof t.sessionId&&delete t.sessionId,"product"in t&&"number"!=typeof t.product&&delete t.product,t}return e}const Qf=e=>"number"==typeof e&&!isNaN(e)&&e!==Number.NEGATIVE_INFINITY&&e!==Number.POSITIVE_INFINITY;var e_;!function(e){e[e.IgnoreCall=0]="IgnoreCall",e[e.UseDefault=1]="UseDefault"}(e_||(e_={}));const t_={[e_.IgnoreCall]:"Method call will be ignored.",[e_.UseDefault]:"Method call will use default value."};const i_=new class{constructor(e){this.options=e}isValidGeoPoint(e,t){return this.processValidationResult(e,function(e){return Array.isArray(e)&&Qf(e[0])&&Qf(e[1])}(e),"Invalid GeoPoint",t)}processValidationResult(e,t,i,n){return!t&&this.options.reportToConsole&&console.warn(`${i}: ${JSON.stringify(e)}\n${t_[n]}`),t}}({reportToConsole:!0}),n_=["immersiveRoadsOff","shadowsOff","fogOff","skyOff","modelsOff","globeOff","transparentBuildingsOff","AALinesOff"],o_="Style preprocessing:";function r_(e,t){var i,n,o;const r=new Set;performance.now();(null==t?void 0:t.parentStyleId)&&console.warn(`${o_} Parent style with id=${e.parentStyleId} have parent with id=${t.parentStyleId}. Recursive inheritance is not supported.`);const s=null!=t?t:e;if(s.layers=null!==(i=s.layers)&&void 0!==i?i:[],t){const t=function(e){const t=new Map,i=e=>{null==e||e.forEach((n=>{const o={layers:e,layer:n};t.set(n.id,o),"group"===n.type&&i(n.layers)}))};return i(e.layers),t}(s),i=null!==(n=e.layersInserts)&&void 0!==n?n:[];i.length&&i.forEach((({layer:e,beforeId:i})=>{var n;if(i){const n=t.get(i);if(n){const{layers:t,layer:i}=n,o=t.findIndex((e=>i===e));t.splice(o,0,e),"custom"!==e.type&&"group"!==e.type&&r.add(e)}else console.warn(`${o_} Child style tries to insert layer with beforeId=${i}. There is no layer with such id in the parent style. Layer insertion ignored.`)}else null===(n=s.layers)||void 0===n||n.push(e)}));const a=Object.keys(null!==(o=e.layersPatches)&&void 0!==o?o:{}).reduce(((e,i)=>(t.has(i)||e.push(i),e)),[]);a.length&&console.warn(`${o_} Child style tries to patch layers with ids which do not exist in parent style: ${a.join("; ")}`)}const a=(e,t,i,n,o)=>{var r;if(t)for(let s=0;s<t.length;s++){const l=t[s];if("custom"===l.type)continue;let d=null===(r=null==i?void 0:i.layersPatches)||void 0===r?void 0:r[l.id];d&&(null==d?void 0:d.type)!==l.type&&(console.warn(`${o_} Layer patch ignored due type mismatch. Target layer with id=${l.id} has type=${l.type}, but the patch has type=${d.type}.`),d=void 0),Ls(l),d&&Ls(d),"group"===l.type?(a(e,l.layers,i,l,d),t[s]=Object.assign(Object.assign({},l),d),delete t[s].commonDefaults,delete t[s].layerTypeDefaults):t[s]=s_(e,l,n,o,l.type===(null==d?void 0:d.type)?d:void 0)}};return a(r,s.layers,t?e:void 0),t&&(["background","models","icons","labelingGroups","light","graphicsPresets","terrain","environment"].forEach((t=>{(s[t]&&Object.values(s[t]).length||e[t]&&Object.values(e[t]).length)&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))})),s.name=e.name),["models","icons"].forEach((e=>{s[e]&&Object.keys(s[e]).forEach((t=>{null===s[e][t]&&delete s[e][t]}))})),s}function s_(e,t,i,n,o){var r,s,a,l,d,c,u,h;const m=Object.assign({},null==i?void 0:i.commonDefaults),f=Object.assign({},null==n?void 0:n.commonDefaults);switch(t.type){case"heatmap":case"overpass":case"tunnel":delete m.interactive,delete f.interactive,delete m.ignoreTier,delete f.ignoreTier;break;case"embankment":case"polygon3d":case"buildingModel":case"model":case"lineExtrusion":case"polygonExtrusion":case"point":delete m.ignoreTier,delete f.ignoreTier;break;case"arrow":case"dashedLine":case"labelLine":case"line":case"metricPoint":case"oneWayLine":case"polygon":case"raster":case"shiftedLine":break;default:Cs(t)}return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},m),null===(r=null==i?void 0:i.layerTypeDefaults)||void 0===r?void 0:r[t.type]),t),f),null===(s=null==n?void 0:n.layerTypeDefaults)||void 0===s?void 0:s[t.type]),e.has(t)?t:void 0),o),{style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(a=null==i?void 0:i.commonDefaults)||void 0===a?void 0:a.style),null===(d=null===(l=null==i?void 0:i.layerTypeDefaults)||void 0===l?void 0:l[t.type])||void 0===d?void 0:d.style),t.style),null===(c=null==n?void 0:n.commonDefaults)||void 0===c?void 0:c.style),null===(h=null===(u=null==n?void 0:n.layerTypeDefaults)||void 0===u?void 0:u[t.type])||void 0===h?void 0:h.style),e.has(t)?t.style:void 0),null==o?void 0:o.style)})}var a_;function l_(e,t,i){return(0,I.mG)(this,void 0,void 0,(function*(){let n;try{const o=(0,we.kn)(i||{},{rootUrl:T.styles.url,stylePath:T.styles.path,iconsPath:T.icons.defaultUrl,fontsPath:T.fonts.defaultUrl,modelsPath:bm.LP}),r=yield function(e,t,i){return(0,I.mG)(this,void 0,void 0,(function*(){const n=new URL((0,P.XK)(e,{id:t}));n.searchParams.append("key",i);const o=yield fetch(n.toString());if(404===o.status)return void console.warn(`No access to style with id «${t}».`);if(!o.ok)return;const r=yield o.json();return r&&r.result?{loadedId:t,style:r.result}:void 0}))}((0,D.z)(o),e,t);if(!r)throw new Error;n=r.style}catch(e){throw new Error(a_.FETCH_PARENT_STYLE_ERROR)}return n}))}!function(e){e.FETCH_PARENT_STYLE_ERROR="FETCH_PARENT_STYLE_ERROR",e.STYLE_FINALIZATION_ERROR="STYLE_FINALIZATION_ERROR"}(a_||(a_={}));const d_=["zoom","rotation","pitch","center"],c_=["static","immersive_roads"];class u_ extends C.c{constructor(e,t){var i;super();const n=this.core=new bf(e,t,this);this.state=n.state,this.modules=n.modules,this.performanceChecker=n.performanceChecker,this.values={isMoveChanging:!1,isIdle:!1},d_.forEach((e=>{this.cloneFromStateToValues(e,`${e}1`),this.cloneFromStateToValues(e,`${e}2`),this.cloneFromStateToValues(e,`${e}End1`),this.cloneFromStateToValues(e,`${e}End2`),this.values[`${e}EndTime`]=0,this.values[`is${e}Changing`]=!1})),this.cloneFromStateToValues("size","size"),this.performanceChecker.on("performancecaveat",(()=>{this.emit("performancecaveat")}));this.setStyle(null!==(i=null==t?void 0:t.style)&&void 0!==i?i:G.iC,null==t?void 0:t.styleOptions).catch((e=>{if(e instanceof Error)throw e})),this.setLang(this.state.lang),!t||t.disableBssStatistics||Df.X||(this._bssDispatcher=new qf(this,{disableBssStatisticsForCommPoi:!!t.disableBssStatisticsForCommPoi,bssUrl:t.bssUrl})),this.state.metrics.init=performance.now()-this.state.metrics.start,this.updateDataToggle()}setCenter(e,t){if(!i_.isValidGeoPoint(e,e_.IgnoreCall))return this;this.state.userHasInteracted=!1;let i=W.H.fromGeo(e);return this.state.loopWorld||(i=(0,L.I0)(i)),fe(this.state,i,t),this}setZoom(e,t){return(0,we.Kh)(e,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)?(this.state.zoomTypePreserving="zoom",this.state.userHasInteracted=!1,Pe(this.state,e,t),this.state.shouldIsReadyWaitForUpdates=!0,this):this}setStyleZoom(e,t){if(!(0,we.Kh)(e,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER))return this;const i=(0,L.Z3)(e,this.state.center);return this.state.zoomTypePreserving="styleZoom",this.state.userHasInteracted=!1,Pe(this.state,i,t),this}setMinZoom(e,t){return this.state.minZoom=e,this.setZoom(this.state.zoom,t),this}setMaxZoom(e,t){return this.state.maxZoom=e,this.setZoom(this.state.zoom,t),this}setRotation(e,t){return(0,we.Kh)(e,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)?(this.state.userHasInteracted=!1,ye(this.state,(0,we.Id)(e),t),this):this}setPitch(e,t){return(0,we.Kh)(e,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)?(this.state.userHasInteracted=!1,Me(this.state,(0,we.Id)(e),t),this):this}setAnimationTerrain(e){this.modules.demManager.setAnimationTerrain(e)}getAnimationTerrainStatus(){return this.modules.demManager.getAnimationTerrainStatus()}setMinPitch(e,t){return this.state.minPitch=(0,we.Id)(e),this.setPitch((0,we.ZY)(this.state.pitch),t),this}setMaxPitch(e,t){return this.state.maxPitch=(0,we.Id)(e),this.setPitch((0,we.ZY)(this.state.pitch),t),this}setLowZoomMaxPitch(e,t){return this.state.lowZoomMaxPitch=(0,we.Id)(e),this.setPitch((0,we.ZY)(this.state.pitch),t),this}setViewport(e,t){return this.state.userHasInteracted=!1,((e,t,i,n,o={})=>{const r=Object.assign({top:0,right:0,bottom:0,left:0},n);if(!1===o.animate||0===o.duration)e.viewport=r,oe(e,t,i);else{const t=e.viewport,i=void 0!==o.easing?o.easing:"easeOutCubic",n=void 0!==o.duration?o.duration:300;ne.BL("viewport",{easing:i},e,[t.top,t.right,t.bottom,t.left],[r.top,r.right,r.bottom,r.left],n,1)}})(this.state,this.modules.layout.rootContainer,this.modules.renderer,e,t),this}setMaxBounds(e){return this.state.maxBounds=(0,le.X3)(e),this}setPadding(e,t){var i,n,o,r;const s={top:null!==(i=e.top)&&void 0!==i?i:0,left:null!==(n=e.left)&&void 0!==n?n:0,right:null!==(o=e.right)&&void 0!==o?o:0,bottom:null!==(r=e.bottom)&&void 0!==r?r:0};return this.state.userHasInteracted=!1,((e,t,i,n={})=>{const o=re(i,e.size);if(!1===n.animate||0===n.duration)e.padding=o,se(e,t);else{const t=e.padding,i=void 0!==n.easing?n.easing:"easeOutCubic",r=void 0!==n.duration?n.duration:300;ne.BL("padding",{easing:i},e,[t.top,t.right,t.bottom,t.left],[o.top,o.right,o.bottom,o.left],r,1)}})(this.state,this.modules.renderer,s,t),this}setTime(e){this.patchStyleState({_customUserTimeOffset:e?e-this.state.time:0}),this.modules.animationManager.clearAllTickers(),this.modules.renderer.addRerenderEvent()}getTime(e){return e?this.state.time-6e4*(new Date).getTimezoneOffset()+ +(this.state.styleState._customUserTimeOffset||0):this.state.time+ +(this.state.styleState._customUserTimeOffset||0)}getPadding(){return this.state.padding}getCenter(){const e=(0,L.I0)(this.state.center);return W.H.toGeo(e).slice(0,2)}getZoom(){return this.state.zoom}getStyleZoom(){return this.state.styleZoom}getMinZoom(){return this.state.minZoom}getMaxZoom(){return this.state.maxZoom}getRotation(){return(0,we.ZY)(this.state.rotation)}getPitch(){return(0,we.ZY)(this.state.pitch)}getViewport(){return this.state.viewport}getSize(){return[this.state.size[0],this.state.size[1]]}getBounds(e){let t=this.modules.camera;if(null==e?void 0:e.skipPadding)t=new Qn.V(Object.assign(Object.assign({},this.state),{padding:{left:0,right:0,top:0,bottom:0}}));else if(null==e?void 0:e.sizeExtension){const i=e.sizeExtension,[n,o]=this.state.size,r=[n+i,o+i];t=new Qn.V(Object.assign(Object.assign({},this.state),{size:r}))}t.update();const i=(0,jn.BS)(t.getViewportVertices());return{southWest:W.H.toGeo(i.min),northEast:W.H.toGeo(i.max)}}getDefaultSource(){return this.modules.defaultSource}hideBuildingsById(e,t=Ya.JQ){if(!e.length)return;const{identifier:i}=this.modules;i.getIdScope(t).hide(e),this.modules.renderer.addRerenderEvent({type:"triggerRerender"})}showHiddenBuildingsById(e,t=Ya.JQ){if(!e.length)return;const{identifier:i}=this.modules;i.getIdScope(t).show(e),this.modules.renderer.addRerenderEvent({type:"triggerRerender"})}getWebGLContext(){return this.modules.renderer.getRenderingContext()}getCanvas(){return this.modules.layout.canvas}enableRuler(){this.modules.ruler.enable()}setRulerPoints(e){this.modules.ruler.enabled||this.modules.ruler.enable(),this.modules.ruler.setPoints(e)}disableRuler(){this.modules.ruler.disable()}showTraffic(){this.modules.trafficTileLayer.show()}hideTraffic(){this.modules.trafficTileLayer.hide()}isTrafficOn(){return this.modules.trafficTileLayer.isEnabled()}setPersonalPoi(e){this.modules.personalPoiManager.setPersonalPoi(e)}setSelectedIds(e=[],t=Ya.JQ){const{identifier:i}=this.modules,n=i.getIdScope(t);return null==n||n.select(e),this.modules.identifier.debouncedFillCache(),this}project(e){return this.modules.camera.project(e)}unproject(e){return this.modules.camera.unproject(e)}getCameraProjectionMatrix(){return this.modules.camera.projectionMatrix}getCameraViewMatrix(){return this.modules.camera.viewMatrix}getCameraViewProjectionMatrix(){return this.modules.camera.viewProjectionMatrix}invalidateSize(){this.state.userHasInteracted=!1;const e=window.devicePixelRatio,{viewport:t}=this.state,{clientWidth:i,clientHeight:n}=this.modules.layout.rootContainer;return this.state.size=[Math.max(1,i-t.left-t.right),Math.max(1,n-t.top-t.bottom)],this.modules.renderer.setPixelRatio(e),this.modules.renderer.setSize(i,n),this.modules.renderer.addRerenderEvent(),this}destroy(){var e;this.core.destroy(),null===(e=this._bssDispatcher)||void 0===e||e.destroy()}refresh(){return this.modules.renderer.addRerenderEvent(),this.state.needLabeling=!0,this.modules.identifier.resetCache(),this}changeFloorNumber(e,t){return this.modules.floorManager.changeFloorNumber(e,t),this.state.shouldIsReadyWaitForUpdates=!0,this}hasLayer(e){return this.modules.styleManager.hasLayer(e)}addLayer(e,t){return"custom"===e.type&&(this.state.aaMode=void 0),this.modules.styleManager.addLayer(e,t),this.core.activateStyleUpdating(),this}removeLayer(e){return this.modules.styleManager.removeLayer(e),this.core.activateStyleUpdating(),this}hideLayers(e){const{id:t,type:i}=e,n=e=>(this.modules.styleManager.hideLayers(e),this.modules.renderer.addRerenderEvent(),this);if((0,Bf.z)(i)&&(0,Bf.IB)(i)){const e=(0,Bf.xE)(i);if(e)return n({type:e})}else if(t)return n({id:t});return console.warn(`[#hideLayers] The layer with type "${i}" can't be hidden.`),this}showLayers(e){const{id:t,type:i}=e,n=e=>(this.modules.styleManager.showLayers(e),this.modules.renderer.addRerenderEvent(),this);if((0,Bf.z)(i)&&(0,Bf.IB)(i)){const e=(0,Bf.xE)(i);if(e)return n({type:e})}else if(t)return n({id:t});return console.warn(`[#showLayers] The layer with type "${i}" can't be shown.`),this}setStyle(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){let i,n=!1,o=!1;try{return"string"==typeof e?(0,Bf.aU)(e)?(n=!this.core.state.disableStyleFallback&&Number.isNaN(this.state.handyStyleId)&&e!==G.iC,i=yield this.setCustomStyleById(e,t)):i=yield this.setCustomStyleFromUrl(e,t):(yield this.setCustomStyleDirectly(e,t),i=e),o=!0,this.emit("styleload",{style:i}),i}catch(t){if(o)throw t;if(t instanceof Error&&this.emit("error",{type:"styleloaderror",style:e}),n&&!this.currentPendingStyle)return this.setStyle(G.iC);throw t}}))}addIcon(e,t){if(!e)return console.error("The icon name is empty."),this;return this.modules.styleManager.addIcon(e,t)&&this.core.activateStyleUpdating(),this}removeIcon(e){if(!e)return this;return this.modules.styleManager.removeIcon(e)&&this.core.activateStyleUpdating(),this}addModel(e,t){if(!e)return console.error("The model name is empty."),this;return this.modules.styleManager.addModel(e,t)&&this.core.activateStyleUpdating(),this}waitForGpuToFinishDrawing(){return this.modules.renderer.readIdentifyPixels(),this}setLang(e){const t=(0,jf.Iw)(this.state.rtlPlugin.scenario,e);this.state.rtlPlugin.loadFailed&&t||(this.state.lang=e,this.state.rtlPlugin.loadFailed||(0,jf.w7)(this.state.rtlPlugin,this.modules,e).catch((e=>{throw this.state.rtlPlugin.loadFailed=!0,this.setLang(T.defaultLang),e})),this.modules.tileManager.redraw())}showLabelsDebug(e){this.modules.labelsDebug.show(e)}hideLabelsDebug(){this.modules.labelsDebug.hide()}getContainer(){return this.modules.layout.mapContainer}getExternalContainer(){return this.modules.layout.externalContainer}fitBounds({northEast:e,southWest:t},i){const n=Object.assign({top:0,left:0,right:0,bottom:0},(null==i?void 0:i.padding)?i.padding:{}),o=this.getViewport(),r=this.getPadding(),s=(null==i?void 0:i.skipMapPadding)?n:(l=n,{top:(a=r).top+l.top,bottom:a.bottom+l.bottom,left:a.left+l.left,right:a.right+l.right});var a,l;const d=this.getSize(),c=(null==i?void 0:i.considerRotation)?this.getRotation():0;if(d[0]-s.left-s.right<=0||d[1]-s.top-s.bottom<=0)return console.warn("Map cannot fit within canvas with the given bounds and padding."),this;(null==i?void 0:i.considerRotation)||ye(this.state,c,{animate:!1});const u=(0,Ff.g)([[t[0],e[1]],e,[e[0],t[1]],t],c,[d[0]-s.left-s.right,d[1]-s.top-s.bottom]);if(!u)return console.warn("Map cannot fit within canvas with the given bounds and padding."),this;const h=[(d[0]-s.left-s.right)/2+s.left+o.left,(d[1]-s.top-s.bottom)/2+s.top+o.top];let m;m=void 0!==(null==i?void 0:i.maxZoom)?Math.min(u.zoom,null==i?void 0:i.maxZoom):u.zoom,m=(0,we.uZ)(m,this.state.minZoom,this.state.maxZoom);const f=new Qn.V({zoom:m,rotation:this.state.rotation,size:this.state.size,padding:this.state.padding,viewport:this.state.viewport,pitch:0,center:u.center,cameraConfig:this.state.cameraConfig,globeMode:this.state.globeMode,styleState:this.state.styleState}).flat.unproject(h),_=[0,0];O.lu(_,u.center,f);const p=[0,0,0];O.IH(p,u.center,_);const v=(null==i?void 0:i.animation)?i.animation:{};v.easing||(v.easing="easeOutCubic");const g=Object.assign(Object.assign({},v),{animateHeight:!0});return fe(this.state,p,v),Pe(this.state,m,g),Me(this.state,0,v),this}update(){const e=this.state,{time:t,userHasInteracted:i}=e,n=this.values,o={};d_.forEach((i=>{let r=e[i];"zoom"===i&&"styleZoom"===e.zoomTypePreserving&&(r=e.styleZoom),o[`${i}start`]=!n[`is${i}Changing`]&&!this.areEqual(r,n[`${i}1`])&&this.areEqual(n[`${i}1`],n[`${i}2`]),o[`${i}start`]&&(n[`is${i}Changing`]=!0),n[`is${i}Changing`]&&(o[i]=!this.areEqual(r,n[`${i}1`]),t-n[`${i}EndTime`]>150&&(o[`${i}end`]=this.areEqual(r,n[`${i}End1`])&&!this.areEqual(n[`${i}End1`],n[`${i}End2`]),o[`${i}end`]&&(n[`is${i}Changing`]=!1),this.copyFromValuesToValues(`${i}End2`,`${i}End1`),this.copyFromStateToValues(r,`${i}End1`),n[`${i}EndTime`]=t)),this.copyFromValuesToValues(`${i}2`,`${i}1`),this.copyFromStateToValues(r,`${i}1`)})),o.resize=!this.areEqual(e.size,n.size),this.copyFromStateToValues(e.size,"size"),o.movestart=(o.zoomstart||o.rotationstart||o.centerstart||o.pitchstart)&&!n.isMoveChanging,o.movestart&&(n.isMoveChanging=!0),o.move=n.iszoomChanging||n.isrotationChanging||n.iscenterChanging||n.ispitchChanging,o.moveend=(o.zoomend||o.rotationend||o.centerend||o.pitchend)&&!o.move,o.moveend&&(n.isMoveChanging=!1);const r=n.isIdle,s=n.isReady;n.isIdle=this.isIdle(),n.isReady=this.isReady(),o.idle=!r&&n.isIdle,o.ready=!s&&n.isReady,void 0===e.metrics.ready&&this.isReadyForMetrics()&&(e.metrics.ready=performance.now()-e.metrics.start);for(const e in o){const t=e;o[t]&&this.emit(t,{isUser:i})}}isIdle(){return!this.values.isMoveChanging&&!this.currentPendingStyle&&this.core.isIdle()}isReady(){return!this.values.isMoveChanging&&!this.currentPendingStyle&&this.core.isReady()}isReadyForMetrics(){return!this.values.isMoveChanging&&!this.currentPendingStyle&&this.core.isReadyForMetrics()}setAutoHoverMode(e){this.modules.defaultSource.resetHoverId(),this.state.disableHoverStyles=!e}setStyleState(e){const{_customUserTimeOffset:t}=this.state.styleState;if(this.state.graphicsPresetMode){const t=mt()?"light":e.graphicsPreset;this.state.styleState=nh(e,this.getGraphicsPresetFeatures(t))}else this.state.styleState=nh(e);(()=>{this.state.styleState._customUserTimeOffset=t})(),this.updateDataToggle(),this.modules.renderer.addRerenderEvent()}getStyleState(){return Object.assign({},this.state.styleState)}patchStyleState(e){if(this.state.graphicsPresetMode){const t=mt()?"light":e.graphicsPreset;this.state.styleState=oh(this.state.styleState,e,this.getGraphicsPresetFeatures(t))}else this.state.styleState=oh(this.state.styleState,e);this.updateDataToggle(),this.modules.renderer.addRerenderEvent()}setOption(e,t){if(-1!==xf.indexOf(e)){switch(e){case"loopWorld":{if(this.state.loopWorld===t)return;const e=t?L._L:L.Vv,i=this.state.maxBounds;(O.I6(i.min,L._L.min)&&O.I6(i.max,L._L.max)||O.I6(i.min,L.Vv.min)&&O.I6(i.max,L.Vv.max))&&(this.state.maxBounds=e),this.modules.renderer.addRerenderEvent();break}case"disableHidingPois":if(this.state.disableHidingPois===t)return;this.modules.renderer.addRerenderEvent()}this.state[e]=t}else console.error(`Can't change the "${e}" option.`)}getOption(e){if(-1!==xf.indexOf(e))return this.state[e];console.error(`Can't get the value of the "${e}" option.`)}getGroundPoint(e){return this.modules.demManager.getGroundPoint(e)}setAllowedFloorIds(e){this.modules.floorManager.setAllowedFloorIds(e)}getMapRenderStat(){var e,t,i;this.modules.renderer.addRerenderEvent();const{drawCount:n,vertexCount:o,triangleCount:r}=this.state.stats,s=598044/(this.state.size[0]*this.state.size[1]/window.devicePixelRatio),a=[{level:0,draws:[0,500],vertcles:[0,1e6],triangles:[0,333e3]},{level:1,draws:[501,1e3],vertcles:[1000001,2e6],triangles:[3330001,666e3]},{level:2,draws:[1001,1500],vertcles:[2000001,3e6],triangles:[666001,999e3]},{level:3,draws:[1501,2500],vertcles:[3000001,6e6],triangles:[999001,2e6]},{level:4,draws:[2501,3500],vertcles:[6000001,12e6],triangles:[2000001,4e6]},{level:5,draws:[3501,1/0],vertcles:[12000001,1/0],triangles:[4000001,1/0]}],l=n*s,d=o*s,c=r*s,u=(null===(e=a.find((e=>e.draws[0]<=l&&e.draws[1]>=l)))||void 0===e?void 0:e.level)||0,h=(null===(t=a.find((e=>e.vertcles[0]<=d&&e.vertcles[1]>=d)))||void 0===t?void 0:t.level)||0;return{drawCount:n,vertexCount:o,drawsLevel:u,vertexLevel:h,triangleCount:r,triangleLevel:(null===(i=a.find((e=>e.triangles[0]<=c&&e.triangles[1]>=c)))||void 0===i?void 0:i.level)||0,level:Math.ceil((u+h)/2)}}getDataToggle(){return this.modules.defaultSource.getDataType()}setLightingStyle(e){const t=this.modules.styleManager.getStyle(this.state.handyStyleId);t&&(t.light=(0,Q.XG)(e,t.dem),t.light.lightingModesResolved={},this.state.needRerender=!0)}getFeatureFlag(e,t){return!!this.modules&&(!!(t=null!=t?t:this.core.state.styleState.graphicsPreset)&&this.modules.styleManager.getFeatureFlag(e,t))}getCurrentGraphicsPreset(){if(!this.state.graphicsPresetMode)throw new Error("You can get current graphics preset only when graphicsPresetMode is set.");return{name:this.state.styleState.graphicsPreset,preset:this.getGraphicsPresetFeatures()}}getGraphicsPresetFeatures(e){return n_.reduce(((t,i)=>(t[i]=this.getFeatureFlag(i,e),t)),{})}setCustomStyleById(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){this.currentPendingStyle=e;const{iconUrl:i,styleServer:n,fontUrl:o,modelUrl:r}=this.state,s=(0,we.kn)(t||{},{rootUrl:n,stylePath:T.styles.path,iconsPath:i,fontsPath:o,modelsPath:r}),a=yield this.fetchStyleById((0,D.z)(s),e);if(this.currentPendingStyle!==e)return Promise.reject(`Cancel setting the style «${e}», there is a newer style was set`);if(!a)throw this.currentPendingStyle=void 0,new Error(`There is no correct style with id «${e}»`);const{style:l,loadedId:d}=a;return yield this.setCustomStyle(l,s),d}))}setCustomStyleFromUrl(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){this.currentPendingStyle=e;const i=(0,we.kn)(t||{},{rootUrl:e,iconsPath:"",fontsPath:"",stylePath:"style.json",modelsPath:""}),n=yield function(e){return fetch(e).then((e=>{if(e.ok)return e.json()}))}((0,D.z)(i));if(e!==this.currentPendingStyle)return Promise.reject(`Cancel setting the style «${e}», there is a newer style was set`);if(!n)throw this.currentPendingStyle=void 0,new Error(`There are no correct styles by url «${e}»`);return yield this.setCustomStyle(n,i),e}))}setCustomStyleDirectly(e,t){const i=window.location.protocol,n=window.location.host,o=(0,we.kn)(t||{},{rootUrl:`${i}//${n}`,stylePath:"",iconsPath:"",fontsPath:"",modelsPath:""});this.currentPendingStyle=`__${Date.now()}__${performance.now()}__`;const r=e?JSON.parse(JSON.stringify(e)):e;return this.setCustomStyle(r,o)}setCustomStyle(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){if(!e)throw new Error("Can't set empty style");const i=this.currentPendingStyle||"";this.currentPendingStyle=void 0;const n=yield function(e,t,i){return(0,I.mG)(this,void 0,void 0,(function*(){let n;return e.parentStyleId&&(n=yield l_(e.parentStyleId,t,i)),r_(e,n)}))}(e,this.state.tileKey,t);if(void 0!==this.currentPendingStyle)return;const{showCommPoi:o}=yield this.modules.tileKeyInfo.getKeyInfo(),r=this.modules.styleManager.createStyle(n,t,o);this.state.handyStyleId=r.id,this.state.styleId=i,this.patchStyleState({}),this.core.activateStyleUpdating()}))}copyFromStateToValues(e,t){h_(e)?O.JG(this.values[t],e):this.values[t]=e}cloneFromStateToValues(e,t){const i=this.state[e];h_(i)?this.values[t]=O.d9(i):this.values[t]=i}copyFromValuesToValues(e,t){const i=this.values[t];h_(i)?O.JG(this.values[e],i):this.values[e]=i}areEqual(e,t){return h_(e)&&h_(t)?O.I6(e,t):e===t}fetchStyleById(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){const i=new URL((0,P.XK)(e,{id:t}));i.searchParams.append("key",this.state.tileKey);const n=yield fetch(i.toString());if(404===n.status)return void console.warn(`No access to style with id «${t}».`);if(!n.ok)return;const o=yield n.json();return o&&o.result?{loadedId:t,style:o.result}:void 0}))}updateDataToggle(){this.modules.defaultSource.setDataType(this.state.styleState.immersiveRoadsOn?c_:void 0)}}function h_(e){return void 0!==e.length}var m_=i(8450);class f_ extends k{constructor(e,t){var i,n,o,r,s,a,l,d,c,u,h,m,f;super(e,t),this.length=1,this.isGeometryOutOfMainReplica=!1,this.removed=!1,this.options=t;const{dynamicStyle:_,layers:p}=this.modules;this.dynamicStyleId=_.getStyle().id,this.geoPoints=this.options.coordinates.filter(((e,t,i)=>0===t||!ae.I6(i[t],i[t-1]))),this.points=this.geoPoints.map((e=>W.H.fromGeo(e))),this.isGeometryOutOfMainReplica=this.points.some((e=>e[0]>G.ed||e[0]<-G.ed));let v=0;this.distances=[],this.distances.push(v);for(let e=1;e<this.geoPoints.length;e++)v+=(0,L.vn)(this.geoPoints[e-1],this.geoPoints[e]),this.distances.push(v);if(this.stateDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"}]),this.debouncedGenerate=(0,qe.D)((()=>{this.generate()}),200),this.tileAttrs=(0,J.FJ)({beginningIsCut:0,endingIsCut:0,db_tiers:t.tiers}),0!==this.options.width){this.rawStyleLayer={type:"line",id:`dynamic-polyline-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:null!==(i=this.options.color)&&void 0!==i?i:"#3388ff",width:null!==(n=this.options.width)&&void 0!==n?n:3},gpuState:"3d"!==this.options.renderingMode?this.options.gpuState:{depthTest:!0}};const e=(0,Q.qw)(this.rawStyleLayer);if(e&&(this.styleLayerId=e.innerId,_.addLayer(e,null!==(o=this.options.zIndex)&&void 0!==o?o:0)),"3d"===this.options.renderingMode&&this.options.hiddenPartColor){this.rawHiddenStyleLayer={type:"line",id:`dynamic-polyline-hidden-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.hiddenPartColor,width:null!==(r=this.options.width)&&void 0!==r?r:3},gpuState:{depthTest:!0,depthMask:!1,cullFace:!1,depthFunc:bt.X6.GREATER}};const e=(0,Q.qw)(this.rawHiddenStyleLayer);e&&(this.styleHiddenLayerId=e.innerId,_.addLayer(e,null!==(s=this.options.zIndex)&&void 0!==s?s:0))}}if(this.options.width2){this.rawStyleLayer2={type:"line",id:`dynamic-polyline2-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:null!==(a=this.options.color2)&&void 0!==a?a:"#00000000",width:null!==(l=this.options.width2)&&void 0!==l?l:0},gpuState:"3d"!==this.options.renderingMode?this.options.gpuState:{depthTest:!0}};const e=(0,Q.qw)(this.rawStyleLayer2);e&&(this.styleLayer2Id=e.innerId,_.addLayer(e,null!==(d=this.options.zIndex2)&&void 0!==d?d:-1))}if(this.options.width3){this.rawStyleLayer3={type:"line",id:`dynamic-polyline3-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:null!==(c=this.options.color3)&&void 0!==c?c:"#00000000",width:null!==(u=this.options.width3)&&void 0!==u?u:0},gpuState:"3d"!==this.options.renderingMode?this.options.gpuState:{depthTest:!0}};const e=(0,Q.qw)(this.rawStyleLayer3);e&&(this.styleLayer3Id=e.innerId,_.addLayer(e,null!==(h=this.options.zIndex3)&&void 0!==h?h:-2))}if(void 0!==this.styleLayerId||void 0!==this.styleLayer2Id||void 0!==this.styleLayer3Id){if(t.showAnimation&&!1!==t.showAnimation.animate&&this.points.length>1){this.animationTickerName=`polyline-${this.uniqId}`;const e=null!==(f=null!==(m=this.styleLayer3Id)&&void 0!==m?m:this.styleLayer2Id)&&void 0!==f?f:this.styleLayerId;e&&this.startShowTicker(this.animationTickerName,e)}p.addLayer(this),this.generate()}}update(){this.removed||(super.update(),this.stateDiffer.check(this.mapState)&&this.debouncedGenerate(),this.animationTickerName&&this.updateShowTicker(this.animationTickerName))}isOutOfMainReplica(){return this.isGeometryOutOfMainReplica}snapPoint(e){function t([e,t],i=0){return[i+(e+G.ed)/G.sX,(t+G.ed)/G.sX]}function i([e,t]){return[e*G.sX-G.ed,t*G.sX-G.ed]}const n=this.mapState.visibleMapReplicas,o=this.points.map((e=>t(e)));let r=1/0,s=o[0],a=0;for(const l of n){const n=t(this.modules.camera.flat.unproject(e),l);for(let e=0;e<o.length-1;e++){const t=o[e],l=o[e+1],d=(0,Jn.Z4)(n,t,l),c=d[0]-n[0],u=d[1]-n[1],h=c*c+u*u;h<r&&(r=h,s=i(d),a=e)}}const l=W.H.toGeo(s);return{point:l,distance:this.distances[a]+(0,L.vn)(l,this.geoPoints[a])}}setStyle(e){this.setSubLayerStyle(this.styleLayerId,this.rawStyleLayer,e.color),this.setSubLayerStyle(this.styleLayer2Id,this.rawStyleLayer2,e.color2),this.setSubLayerStyle(this.styleLayer3Id,this.rawStyleLayer3,e.color3),this.setSubLayerStyle(this.styleHiddenLayerId,this.rawHiddenStyleLayer,e.hiddenPartColor)}remove(){this.removed||(this.removed=!0,this.animationTickerName&&(ne.sT(this.animationTickerName,this.mapState),this.animationTickerName=void 0),this.interactive&&this.modules.identifier.resetCache(),void 0!==this.styleLayerId&&this.modules.dynamicStyle.removeLayer(this.styleLayerId),void 0!==this.styleHiddenLayerId&&this.modules.dynamicStyle.removeLayer(this.styleHiddenLayerId),void 0!==this.styleLayer2Id&&this.modules.dynamicStyle.removeLayer(this.styleLayer2Id),void 0!==this.styleLayer3Id&&this.modules.dynamicStyle.removeLayer(this.styleLayer3Id),super.destroy())}startShowTicker(e,t){var i,n,o;const r=void 0!==(null===(i=this.options.showAnimation)||void 0===i?void 0:i.easing)?this.options.showAnimation.easing:"linear",s=void 0!==(null===(n=this.options.showAnimation)||void 0===n?void 0:n.duration)?this.options.showAnimation.duration:250;ne.BL(e,{easing:r,animationGroup:null===(o=this.options.showAnimation)||void 0===o?void 0:o.animationGroup},this.mapState,0,1,s,1,{layerId:t,styleId:this.dynamicStyleId}),this.length=0}setSubLayerStyle(e,t,i){if(void 0!==e&&i&&t&&i!==t.style.color){const{dynamicStyle:n}=this.modules;t.style.color=i;const o=(0,Q.qw)(t);o&&(n.updateLayerStyle(e,o),this.modules.renderer.addRerenderEvent())}}updateShowTicker(e){ne.Vx(e,{step:(e,t)=>{var i,n,o,r;const s=(0,we.sB)((null===(n=null===(i=this.options.showAnimation)||void 0===i?void 0:i.durationRange)||void 0===n?void 0:n.start)||0,(null===(r=null===(o=this.options.showAnimation)||void 0===o?void 0:o.durationRange)||void 0===r?void 0:r.end)||1,t);s!==this.length&&(this.length=s,this.generate())}},this.mapState)}generate(){if(this.points.length<2||this.removed)return;const e=!!this.animationTickerName,{dynamicStyle:t,collector:i,tileManager:n,identifier:o,map:r}=this.modules,{tileProps:s}=A.nF,a=Math.min(Math.floor(r.getZoom()),15),l=(0,Y.aq)(a),d=(0,Jn.z_)(this.points,this.distances,this.length),c=(0,Jn.Jh)(d,l),u=ae.Ue(),h=le.Ue();this.tileObjects.forEach((t=>{t.clean(this.mapState),n.removeObject(t,e)})),this.tileObjects=[];for(let o=0;o<c.length;o++){const r=c[o];le.mc(h);for(let e=0;e<r.length;e++)le.aM(h,r[e]);le.be(u,h);const l=(0,Y.z6)(u,a),d=Math.pow(2,l[2]),m=[...this.mapState.visibleMapReplicas];if(this.isOutOfMainReplica()){const e=m[0],t=m[m.length-1];m.push(e-1,t+1)}if(!m.map((e=>[l[0]+e*d,l[1],l[2],l[3]])).some((e=>this.mapState.globeMode?(0,Y.Tc)(this.mapState,this.modules.camera,e):(0,Y.Ny)(e,this.mapState.tilesBounds,this.modules))))continue;if(this.options.displayTileBounds){const o=t.getStyle().layers.find((e=>"debug-tile-bounds"===e.id));(0,rt.cX)(i,o,this.mapState.styleState);const r=i.getAccumulatedData(),s=new R.W("dynamicObject",r.data,this.modules,this.mapState,l);this.tileObjects.push(s),n.addObject(s,e)}const f=(0,Y.Bs)(l),_=[],p=[];for(let e=0;e<r.length;e++)(0,Y.a2)(u,r[e],f),_[e]=u[0],p[e]=u[1];this.tileAttrs[s.beginningIsCut]=0,this.tileAttrs[s.endingIsCut]=0,0!==o&&(this.tileAttrs[s.beginningIsCut]=1),o+1!==c.length&&(this.tileAttrs[s.endingIsCut]=1);const v=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,this.tileAttrs,A.wz,this.interactive?"0":"");if(void 0!==this.styleLayerId){const e=t.getStyle().layersById[this.styleLayerId];(0,m_.ot)(e)&&((0,q.Eu)(e,v),(0,q.XI)({collector:i,generator:Ii.z.generate,args:[t.getStyle().id,e,v,f,{x:_,y:p}]}))}if(void 0!==this.styleHiddenLayerId){const e=t.getStyle().layersById[this.styleHiddenLayerId];(0,m_.ot)(e)&&((0,q.Eu)(e,v),(0,q.XI)({collector:i,generator:Ii.z.generate,args:[t.getStyle().id,e,v,f,{x:_,y:p}]}))}if(void 0!==this.styleLayer2Id){const e=t.getStyle().layersById[this.styleLayer2Id];(0,m_.ot)(e)&&((0,q.Eu)(e,v),(0,q.XI)({collector:i,generator:Ii.z.generate,args:[t.getStyle().id,e,v,f,{x:_,y:p}]}))}if(void 0!==this.styleLayer3Id){const e=t.getStyle().layersById[this.styleLayer3Id];(0,m_.ot)(e)&&((0,q.Eu)(e,v),(0,q.XI)({collector:i,generator:Ii.z.generate,args:[t.getStyle().id,e,v,f,{x:_,y:p}]}))}const g=i.getAccumulatedData(),y=new R.W("dynamicObject",g.data,this.modules,this.mapState,f.coords,this);n.addObject(y,e),this.tileObjects.push(y),this.interactive&&this.identifyIds.push(g.identifyIds)}this.interactive&&o.resetCache(),i.reset(),e||this.modules.renderer.addRerenderEvent()}}class __ extends k{constructor(e,t){var i,n,o,r,s,a,l,d,c,u,h;super(e,t),this.isGeometryOutOfMainReplica=!1,this.length=1,this.dynamicStyleId=this.modules.dynamicStyle.getStyle().id,this.removed=!1,this.options=t,this.points=this.options.coordinates.map((e=>W.H.fromGeo(e))),this.isGeometryOutOfMainReplica=this.points.some((e=>e[0]>G.ed||e[0]<-G.ed)),this.distances=[],this.stateDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"}]),this.debouncedGenerate=(0,qe.D)((()=>{this.generate()}),200),this.tileAttrs=(0,J.FJ)({previousPointX:0,previousPointY:0,nextPointX:0,nextPointY:0,beginningIsCut:0,endingIsCut:0,componentDistanceStart:0,objectLength:0,db_tiers:t.tiers});const{layers:m}=this.modules;if(m.addLayer(this),this.dashLayerRaw={type:"dashedLine",id:`dynamic-dashed-polyline-dash-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.dashColor||"#2480ff",dashLength:null!==(i=this.options.dashLength)&&void 0!==i?i:6,gapColor:this.options.gapColor||"#ffffff00",gapLength:null!==(n=this.options.gapLength)&&void 0!==n?n:20,width:null!==(o=this.options.width)&&void 0!==o?o:8},gpuState:"3d"!==this.options.renderingMode?this.options.gpuState:{depthTest:!0}},this.baseLayerRaw={type:"line",id:`dynamic-dashed-polyline-base-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.dash2Color||"#ffffff",width:null!==(s=null===(r=this.options)||void 0===r?void 0:r.width2)&&void 0!==s?s:12},gpuState:"3d"!==this.options.renderingMode?this.options.gpuState:{depthTest:!0}},this.dashLayer=(0,Q.qw)(this.dashLayerRaw),this.baseLayer=(0,Q.qw)(this.baseLayerRaw),"3d"===t.renderingMode&&t.hiddenPartDashColor&&(this.hiddenDashLayerRaw={type:"dashedLine",id:`dynamic-hidden-dashed-polyline-dash-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:t.hiddenPartDashColor,dashLength:null!==(a=this.options.dashLength)&&void 0!==a?a:6,gapColor:this.options.hiddenPartGapColor,gapLength:null!==(l=this.options.gapLength)&&void 0!==l?l:20,width:null!==(d=this.options.width)&&void 0!==d?d:8},gpuState:{depthTest:!0,depthMask:!1,cullFace:!1,depthFunc:bt.X6.GREATER}},this.hiddenDashLayer=(0,Q.qw)(this.hiddenDashLayerRaw),this.options.hiddenPartDash2Color&&(this.hiddenBaseLayerRaw={type:"line",id:`dynamic-hidden-dashed-polyline-base-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.hiddenPartDash2Color,width:null!==(u=null===(c=this.options)||void 0===c?void 0:c.width2)&&void 0!==u?u:12},gpuState:{depthTest:!0,depthMask:!1,cullFace:!1,depthFunc:bt.X6.GREATER}},this.hiddenBaseLayer=(0,Q.qw)(this.hiddenBaseLayerRaw))),t.showAnimation&&!1!==t.showAnimation.animate&&this.points.length>1){let e=0;this.distances.push(e);for(let t=1;t<this.options.coordinates.length;t++)e+=(0,L.vn)(this.options.coordinates[t-1],this.options.coordinates[t]),this.distances.push(e);this.animationTickerName=`dashedLine-${this.uniqId}`;const t=null===(h=this.baseLayer)||void 0===h?void 0:h.innerId;t&&this.startShowTicker(this.animationTickerName,t)}this.generate()}update(){this.removed||(super.update(),this.stateDiffer.check(this.mapState)&&this.debouncedGenerate(),this.animationTickerName&&this.updateShowTicker(this.animationTickerName))}isOutOfMainReplica(){return this.isGeometryOutOfMainReplica}setStyle(e){const{dashColor:t,dash2Color:i,gapColor:n,hiddenPartDashColor:o,hiddenPartGapColor:r,hiddenPartDash2Color:s}=e,{dynamicStyle:a}=this.modules;if(this.dashLayer){void 0!==t&&(this.dashLayerRaw.style.color=t),void 0!==n&&(this.dashLayerRaw.style.gapColor=n);const e=(0,Q.qw)(this.dashLayerRaw);e&&a.updateLayerStyle(this.dashLayer.innerId,e)}if(this.baseLayer){void 0!==i&&(this.baseLayerRaw.style.color=i);const e=(0,Q.qw)(this.baseLayerRaw);e&&a.updateLayerStyle(this.baseLayer.innerId,e)}if(this.hiddenDashLayer&&this.hiddenDashLayerRaw){void 0!==o&&(this.hiddenDashLayerRaw.style.color=o),void 0!==n&&(this.hiddenDashLayerRaw.style.gapColor=r);const e=(0,Q.qw)(this.hiddenDashLayerRaw);e&&a.updateLayerStyle(this.hiddenDashLayer.innerId,e)}if(this.hiddenBaseLayer&&this.hiddenBaseLayerRaw){void 0!==s&&(this.hiddenBaseLayerRaw.style.color=s);const e=(0,Q.qw)(this.hiddenBaseLayerRaw);e&&a.updateLayerStyle(this.hiddenBaseLayer.innerId,e)}this.modules.renderer.addRerenderEvent()}remove(){this.removed||(this.removed=!0,this.animationTickerName&&(ne.sT(this.animationTickerName,this.mapState),this.animationTickerName=void 0),this.interactive&&this.modules.identifier.resetCache(),this.baseLayer&&this.modules.dynamicStyle.removeLayer(this.baseLayer.innerId),this.dashLayer&&this.modules.dynamicStyle.removeLayer(this.dashLayer.innerId),this.hiddenBaseLayer&&this.modules.dynamicStyle.removeLayer(this.hiddenBaseLayer.innerId),this.hiddenDashLayer&&this.modules.dynamicStyle.removeLayer(this.hiddenDashLayer.innerId),super.destroy())}updateShowTicker(e){ne.Vx(e,{step:(e,t)=>{var i,n,o,r;const s=(0,we.sB)((null===(n=null===(i=this.options.showAnimation)||void 0===i?void 0:i.durationRange)||void 0===n?void 0:n.start)||0,(null===(r=null===(o=this.options.showAnimation)||void 0===o?void 0:o.durationRange)||void 0===r?void 0:r.end)||1,t);s!==this.length&&(this.length=s,this.generate())}},this.mapState)}startShowTicker(e,t){var i,n,o;const r=void 0!==(null===(i=this.options.showAnimation)||void 0===i?void 0:i.easing)?this.options.showAnimation.easing:"linear",s=void 0!==(null===(n=this.options.showAnimation)||void 0===n?void 0:n.duration)?this.options.showAnimation.duration:250;ne.BL(e,{easing:r,animationGroup:null===(o=this.options.showAnimation)||void 0===o?void 0:o.animationGroup},this.mapState,0,1,s,1,{layerId:t,styleId:this.dynamicStyleId}),this.length=0}generate(){if(this.points.length<2||this.removed)return;const e=!!this.animationTickerName,{dynamicStyle:t,collector:i,tileManager:n,map:o,identifier:r}=this.modules,{tileProps:s}=A.nF,a=Math.min(Math.floor(o.getZoom()),12),l=(0,Y.aq)(a),d=(0,Jn.z_)(this.points,this.distances,this.length),c=(0,Jn.Jh)(d,l),u=ae.Ue(),h=le.Ue();this.tileObjects.forEach((t=>{t.clean(this.mapState),n.removeObject(t,e)})),this.tileObjects=[];const m=[];let f=0;for(const e of c){le.mc(h);for(let t=0;t<e.length;t++)le.aM(h,e[t]);le.be(u,h);const t=(0,Y.z6)(u,a),i=(0,Y.Bs)(t),n=[],o=[];let r=0;for(let t=0;t<e.length;t++)if((0,Y.a2)(u,e[t],i),n[t]=u[0],o[t]=u[1],0!==t){const e=n[t]-n[t-1],i=o[t]-o[t-1];r+=Math.sqrt(e*e+i*i)}f+=r,m.push({vertices:{x:n,y:o},tileInfo:i,distance:r})}let _=0;const p=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,this.tileAttrs,A.wz,this.interactive?"0":"");m.forEach(((o,r)=>{var a,l,d,h;const{tileInfo:v,distance:g,vertices:y}=o;if(this.tileAttrs[s.beginningIsCut]=0,this.tileAttrs[s.endingIsCut]=0,this.tileAttrs[s.previousPointX]=0,this.tileAttrs[s.previousPointY]=0,this.tileAttrs[s.nextPointX]=0,this.tileAttrs[s.nextPointY]=0,this.tileAttrs[s.componentDistanceStart]=_,_+=g,this.tileAttrs[s.objectLength]=f,0!==r){const e=c[r-1],t=e[e.length-2];(0,Y.a2)(u,t,v),this.tileAttrs[s.beginningIsCut]=1,this.tileAttrs[s.previousPointX]=u[0],this.tileAttrs[s.previousPointY]=u[1]}if(r!==m.length-1){const e=c[r+1][1];(0,Y.a2)(u,e,v),this.tileAttrs[s.endingIsCut]=1,this.tileAttrs[s.nextPointX]=u[0],this.tileAttrs[s.nextPointY]=u[1]}const b=Math.pow(2,v.coords[2]),x=[...this.mapState.visibleMapReplicas];if(this.isOutOfMainReplica()){const e=x[0],t=x[x.length-1];x.push(e-1,t+1)}if(x.map((e=>[v.coords[0]+e*b,v.coords[1],v.coords[2],v.coords[3]])).every((e=>!(0,Y.Ny)(e,this.mapState.tilesBounds,this.modules))))return;this.dashLayer&&(t.addLayer(this.dashLayer,null!==(a=this.options.zIndex)&&void 0!==a?a:0),(0,q.Eu)(this.dashLayer,p),(0,q.XI)({collector:i,generator:Ti.L.generate,args:[this.dynamicStyleId,this.dashLayer,p,v,y]})),this.baseLayer&&(t.addLayer(this.baseLayer,null!==(l=this.options.zIndex2)&&void 0!==l?l:-1),(0,q.Eu)(this.baseLayer,p),(0,q.XI)({collector:i,generator:Ii.z.generate,args:[this.dynamicStyleId,this.baseLayer,p,v,y]})),this.hiddenDashLayer&&(t.addLayer(this.hiddenDashLayer,null!==(d=this.options.zIndex)&&void 0!==d?d:0),(0,q.Eu)(this.hiddenDashLayer,p),(0,q.XI)({collector:i,generator:Ti.L.generate,args:[this.dynamicStyleId,this.hiddenDashLayer,p,v,y]})),this.hiddenBaseLayer&&(t.addLayer(this.hiddenBaseLayer,null!==(h=this.options.zIndex2)&&void 0!==h?h:-1),(0,q.Eu)(this.hiddenBaseLayer,p),(0,q.XI)({collector:i,generator:Ii.z.generate,args:[this.dynamicStyleId,this.hiddenBaseLayer,p,v,y]}));const w=i.getAccumulatedData(),S=new R.W("dynamicObject",w.data,this.modules,this.mapState,v.coords,this);n.addObject(S,e),this.tileObjects.push(S),this.interactive&&this.identifyIds.push(w.identifyIds)})),this.interactive&&r.resetCache(),i.reset(),e||this.modules.renderer.addRerenderEvent()}}var p_=i(7084);class v_ extends k{constructor(e,t){super(e,t),this.isGeometryOutOfMainReplica=!1,this.options=t;const i=this.options.coordinates.map((e=>{const t=e.map((e=>W.H.fromGeo(e)));if(t.length>1){const e=t[0],i=t[t.length-1];e[0]===i[0]&&e[1]===i[1]||t.push(e)}return t}));let n=[];const o=[],{dynamicStyle:r,collector:s,tileManager:a,identifier:l,layers:d}=this.modules;i.forEach((e=>{n.length&&o.push(n.length),n=n.concat(e)})),this.isGeometryOutOfMainReplica=n.some((e=>e[0]>G.ed||e[0]<-G.ed));const c=(0,Q.qw)({type:"polygon",id:`dynamic-polygon-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.color||"#3388ff33"}});if(!c)return;r.addLayer(c,this.options.zIndex),this.fillLayerId=c.innerId;const u=(0,J.FJ)({beginningIsCut:0,endingIsCut:0,db_tiers:t.tiers}),h=le.Ue();for(let e=0;e<n.length;e++)le.aM(h,n[e]);const m=(0,Y.x7)(h),f=(0,Y.Bs)(m),_=[];for(let e=0;e<n.length;e++)_.push(n[e][0]),_.push(n[e][1]);const p=p_(_,o),v=ae.Ue(),g=[],y=[],b=[],x=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,u,A.wz,this.interactive?"0":"");(0,q.Eu)(c,x);for(let e=0;e<p.length;e+=3){for(let t=0;t<3;t++)(0,Y.a2)(v,n[p[e+t]],f),g[t]=v[0],y[t]=v[1],b[t]=0;(0,q.XI)({collector:s,generator:wi.a.generate,args:[r.getStyle().id,c,x,{x:g,y,cut:b},(0,Bf.o1)(window.devicePixelRatio),r.getStyle().rasterSets]})}if(0!==this.options.strokeWidth){const e=(0,Q.qw)({type:"line",id:`dynamic-polygon-stroke-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.strokeColor||"#3388ff",width:this.options.strokeWidth||3}});e&&(r.addLayer(e,this.options.zIndex),this.borderLayerId=e.innerId,(0,q.Eu)(e,x),i.forEach((t=>{const i=[],n=[];t.forEach(((e,t)=>{(0,Y.a2)(v,e,f),i[t]=v[0],n[t]=v[1]})),(0,q.XI)({collector:s,generator:Ii.z.generate,args:[r.getStyle().id,e,x,f,{x:i,y:n}]})})))}const w=s.getAccumulatedData(),S=new R.W("dynamicObject",w.data,this.modules,this.mapState,f.coords,this);a.addObject(S),this.tileObjects.push(S),this.interactive&&this.identifyIds.push(w.identifyIds),d.addLayer(this),s.reset(),this.modules.renderer.addRerenderEvent(),this.interactive&&l.resetCache()}isOutOfMainReplica(){return this.isGeometryOutOfMainReplica}remove(){this.interactive&&this.modules.identifier.resetCache(),this.fillLayerId&&this.modules.dynamicStyle.removeLayer(this.fillLayerId),this.borderLayerId&&this.modules.dynamicStyle.removeLayer(this.borderLayerId),super.destroy()}}class g_ extends k{constructor(e,t){var i,n,o,r;if(super(e,t),this.isGeometryOutOfMainReplica=!1,this.options=t,t.segments&&t.segments<=0)return;const{dynamicStyle:s,collector:a,tileManager:l,identifier:d,layers:c}=this.modules,u=function(e,t,i){const n=[];if(i>0){n.push(ae.al(e[0]+t,e[1],e[2]));const o=Math.PI/Math.ceil(i/2);for(let i=o;i<Math.PI;i+=o){const o=t*Math.cos(i),r=t*Math.sin(i);n.push(ae.al(e[0]+o,e[1]+r,e[2]),ae.al(e[0]+o,e[1]-r,e[2]))}n.push(ae.al(e[0]-t,e[1],e[2]))}return n}(W.H.fromGeo(this.options.coordinates),(0,L.a4)(this.options.coordinates,this.options.radius),null!==(i=this.options.segments)&&void 0!==i?i:150);this.isGeometryOutOfMainReplica=u.some((e=>e[0]>G.ed||e[0]<-G.ed));const h=(0,Q.qw)({type:"polygon",id:`dynamic-circle-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:null!==(n=this.options.color)&&void 0!==n?n:"#3388ff33",strokeWidth:null!==(o=this.options.borderWidth)&&void 0!==o?o:1,strokeColor:null!==(r=this.options.borderColor)&&void 0!==r?r:"#3388ff"}});if(!h)return;s.addLayer(h,this.options.zIndex),this.layerId=h.innerId;const m=(0,J.FJ)({db_tiers:t.tiers}),f=le.Ue();for(let e=0;e<u.length;e++)le.aM(f,u[e]);const _=(0,Y.x7)(f),p=(0,Y.Bs)(_),v=[],g=[],y=[],b=ae.Ue(),x=0!==this.options.borderWidth?1:0;for(let e=0;e<u.length;e++)(0,Y.a2)(b,u[e],p),v[e]=b[0],g[e]=b[1],y[e]=x;const w=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,m,A.wz,this.interactive?"0":"");(0,q.Eu)(h,w),(0,q.XI)({collector:a,generator:wi.a.generate,args:[s.getStyle().id,h,w,{x:v,y:g,cut:y},(0,Bf.o1)(window.devicePixelRatio)]});const S=a.getAccumulatedData(),M=new R.W("dynamicObject",S.data,this.modules,this.mapState,p.coords,this);l.addObject(M),this.tileObjects.push(M),this.interactive&&this.identifyIds.push(S.identifyIds),c.addLayer(this),a.reset(),this.modules.renderer.addRerenderEvent(),this.interactive&&d.resetCache()}remove(){this.interactive&&this.modules.identifier.resetCache(),this.layerId&&this.modules.dynamicStyle.removeLayer(this.layerId),super.destroy()}isOutOfMainReplica(){return this.isGeometryOutOfMainReplica}}function y_(e,t,i,n,o,r){if(o-n<=i)return;const s=n+o>>1;b_(e,t,s,n,o,r%2),y_(e,t,i,n,s-1,r+1),y_(e,t,i,s+1,o,r+1)}function b_(e,t,i,n,o,r){for(;o>n;){if(o-n>600){const s=o-n+1,a=i-n+1,l=Math.log(s),d=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*d*(s-d)/s)*(a-s/2<0?-1:1);b_(e,t,i,Math.max(n,Math.floor(i-a*d/s+c)),Math.min(o,Math.floor(i+(s-a)*d/s+c)),r)}const s=t[2*i+r];let a=n,l=o;for(x_(e,t,n,i),t[2*o+r]>s&&x_(e,t,n,o);a<l;){for(x_(e,t,a,l),a++,l--;t[2*a+r]<s;)a++;for(;t[2*l+r]>s;)l--}t[2*n+r]===s?x_(e,t,n,l):(l++,x_(e,t,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function x_(e,t,i,n){w_(e,i,n),w_(t,2*i,2*n),w_(t,2*i+1,2*n+1)}function w_(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function S_(e,t,i,n){const o=e-i,r=t-n;return o*o+r*r}const M_=e=>e[0],I_=e=>e[1];class T_{constructor(e,t=M_,i=I_,n=64,o=Float64Array){this.nodeSize=n,this.points=e;const r=e.length<65536?Uint16Array:Uint32Array,s=this.ids=new r(e.length),a=this.coords=new o(2*e.length);for(let n=0;n<e.length;n++)s[n]=n,a[2*n]=t(e[n]),a[2*n+1]=i(e[n]);y_(s,a,n,0,s.length-1,0)}range(e,t,i,n){return function(e,t,i,n,o,r,s){const a=[0,e.length-1,0],l=[];let d,c;for(;a.length;){const u=a.pop(),h=a.pop(),m=a.pop();if(h-m<=s){for(let s=m;s<=h;s++)d=t[2*s],c=t[2*s+1],d>=i&&d<=o&&c>=n&&c<=r&&l.push(e[s]);continue}const f=Math.floor((m+h)/2);d=t[2*f],c=t[2*f+1],d>=i&&d<=o&&c>=n&&c<=r&&l.push(e[f]);const _=(u+1)%2;(0===u?i<=d:n<=c)&&(a.push(m),a.push(f-1),a.push(_)),(0===u?o>=d:r>=c)&&(a.push(f+1),a.push(h),a.push(_))}return l}(this.ids,this.coords,e,t,i,n,this.nodeSize)}within(e,t,i){return function(e,t,i,n,o,r){const s=[0,e.length-1,0],a=[],l=o*o;for(;s.length;){const d=s.pop(),c=s.pop(),u=s.pop();if(c-u<=r){for(let o=u;o<=c;o++)S_(t[2*o],t[2*o+1],i,n)<=l&&a.push(e[o]);continue}const h=Math.floor((u+c)/2),m=t[2*h],f=t[2*h+1];S_(m,f,i,n)<=l&&a.push(e[h]);const _=(d+1)%2;(0===d?i-o<=m:n-o<=f)&&(s.push(u),s.push(h-1),s.push(_)),(0===d?i+o>=m:n+o>=f)&&(s.push(h+1),s.push(c),s.push(_))}return a}(this.ids,this.coords,e,t,i,this.nodeSize)}}function E_(e,t,i){const n=[],o=[],r=[],s=ae.Ue();return t.forEach((({mapCoords:e,weight:t})=>{!function(e,t,i){e[0]=(t[0]-i.offset[0])*G._H/i.size,e[1]=(t[1]-i.offset[1])*G._H/i.size}(s,e,i);const a=s[0],l=s[1];for(let e=0;e<6;e++)n.push(a,l),r.push(t);o.push(-1,-1,1,-1,-1,1,-1,1,1,-1,1,1)})),{vertices:e.createBuffer(new Uint16Array(n),{itemSize:2,dataType:yt.l.UnsignedShort,stride:0,offset:0,normalized:!0}),widens:e.createBuffer(new Int8Array(o),{itemSize:2,dataType:yt.l.Byte,stride:0,offset:0,normalized:!1}),weights:e.createBuffer(new Float32Array(r),{itemSize:1,dataType:yt.l.Float,stride:0,offset:0,normalized:!1})}}function P_(e){const t=new Error("The palette is not valid. The heatmap won't be rendered."),i=Object.getOwnPropertyNames(e);if(0===i.length)throw t;const n=i.map((e=>Number(e)));if(n.some((e=>Number.isNaN(e)||e<0||e>1)))throw t;const o={};n.forEach((i=>{if("string"!=typeof e[i])throw t;o[i]=(0,$a.MV)(e[i])}));const r=Math.min(...n),s=Math.max(...n);return r>0&&(o[0]=o[r]),s<1&&(o[1]=o[s]),o}function A_(e,t){const i=Object.keys(e).map((e=>Number(e))).sort(((e,t)=>e-t));let n=0;const o=[],r=t-1;for(let s=0;s<t;s++){const t=s/r;t>i[n+1]&&n++;const a=i[n],l=i[n+1],d=(t-a)/(l-a);for(let t=0;t<4;t++)o[4*s+t]=L_(e[a].value[t],e[l].value[t],d)}return o.map((e=>Math.round(e)))}function L_(e,t,i){return e*(1-i)+t*i}const C_={0:"rgba(89, 0, 89, 0)",.25:"rgba(0, 0, 89, 0.78)",.5:"rgba(0, 198, 68, 1)",.7:"rgba(198, 186, 0, 1)",.8:"rgba(249, 152, 0, 1)",1:"rgba(200, 0, 0, 1)"};class z_ extends k{constructor(e,t={}){super(e,{interactive:!1}),this.offscreenTextureIndex=-1,this.fillBuffers=e=>{if(!this.tree)return;const t=(0,jn.BS)(this.mapState.tilesBounds),i=(0,Y.x7)(t);if(this.tileCoords&&(n=i,o=this.tileCoords,n.every(((e,t)=>e===o[t]))))return;var n,o;this.resetBuffers(),this.tileCoords=i;const r=(0,Y.aq)(i[2]),s=(0,Y.Oy)(i);it.wA(this.matrix,s,ae.al(r,r,G._9));const a=this.tree.range(s[0],s[1],s[0]+r,s[1]+r).map((e=>this.points[e])),l=(0,Y.Bs)(i);this.buffers=E_(this.modules.renderer,a,l),this.vertexCount=6*a.length,this.vao=new _i(e,{a_vec2_position:this.buffers.vertices,a_vec2_widen:this.buffers.widens,a_float_weight:this.buffers.weights})},this.resizeFrameBuffer=()=>{this.frameBuffer.setSize([Math.ceil(this.mapState.size[0]*window.devicePixelRatio/this.downscale),Math.ceil(this.mapState.size[1]*window.devicePixelRatio/this.downscale)]),this.modules.renderer.bindRenderTarget(this.frameBuffer),this.modules.renderer.bindRenderTarget(null);const e=this.frameBuffer.getTexture();e?this.modules.imageManager.updatePreparedTexture(this.offscreenTextureIndex,e):(0,Jo.cM)("Can't update a non-prepared texture"),this.heatmapNeedRerender=!0,this.modules.renderer.addRerenderEvent()};const{downscale:i,palette:n,points:o,minZoom:r,maxZoom:s,zIndex:a,pointRadius:l,intensity:d,opacity:c}=t;this.rampTextureIndex=this.modules.imageManager.addPreparedTexture(function(e,t){const i=A_(P_(e),t);return new nt(new Uint8Array(i),{size:[t,1]})}(null!=n?n:C_,256)),this.downscale=null!=i?i:1,this.frameBuffer=new st({size:[Math.ceil(this.mapState.size[0]*window.devicePixelRatio/this.downscale),Math.ceil(this.mapState.size[1]*window.devicePixelRatio/this.downscale)],magFilter:nt.LinearFilter,minFilter:nt.LinearFilter,wrapS:nt.ClampToEdgeWrapping,wrapT:nt.ClampToEdgeWrapping});const u=this.frameBuffer.getTexture();u?this.offscreenTextureIndex=this.modules.imageManager.addPreparedTexture(u):(0,Jo.cM)("Can't add a non-prepared texture."),this.points=[],this.vertexCount=0,this.isDestroyed=!1,this.heatmapNeedRerender=!1,this.matrix=it.Ue(),this.mvpMatrix=it.Ue(),this.viewDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"}]),this.sizeDiffer=new Ve.H([{path:"size",type:"vec2"}]),this.throttledFillBuffer=(0,Ue.P)(this.fillBuffers,50);const h=(0,Q.qw)({type:"heatmap",id:`dynamic-heatmap-${this.uniqId}`,minzoom:r,maxzoom:s,style:{opacity:null!=c?c:.5,intensity:null!=d?d:3,radius:null!=l?l:10}});if(!h)throw new Error("There is no correct style layer for heatmap");this.layer=h,this.modules.dynamicStyle.addLayer(h,a),o&&this.setPoints(o)}isOutOfMainReplica(){return!1}setPoints(e){if(!this.isDestroyed){if(this.points=e.map((({coordinates:e,weight:t})=>({mapCoords:W.H.fromGeo(e),weight:null!=t?t:1}))),this.tree=new T_(this.points,(e=>e.mapCoords[0]),(e=>e.mapCoords[1])),this.tileCoords=void 0,!this.tileObjects.length){const{layers:e,collector:t,dynamicStyle:i,tileManager:n}=this.modules;(0,q.XI)({collector:t,generator:vi.B.generateTexture,args:[i.getStyle().id,this.layer,this.offscreenTextureIndex,this.rampTextureIndex]});const o=t.getAccumulatedData(),r=new R.W("dynamicObject",o.data,this.modules,this.mapState);n.addObject(r),this.tileObjects.push(r),e.addLayer(this),t.reset()}this.modules.renderer.addRerenderEvent(),this.heatmapNeedRerender=!0}}update(){super.update();const e=this.modules.renderer.getShaderProgram("heatmap",this.modules.renderer.commonShaderDefines);if(this.sizeDiffer.check(this.mapState)&&this.resizeFrameBuffer(),!this.heatmapNeedRerender&&!this.viewDiffer.check(this.mapState)&&!this.modules.renderer.isNeedRerender())return;if(!this.tree)return;const{zoom:t,styleZoom:i,styleState:n}=this.mapState;if(this.throttledFillBuffer(e),!(this.vao&&this.buffers&&this.tree&&this.tileCoords))return;const o=(0,te.jJ)(i,n,[]),r=(0,te.vn)(this.layer.style.radius,o),s=(0,te.vn)(this.layer.style.intensity,o),a=G.y4*Math.pow(2,t-this.tileCoords[2])*window.devicePixelRatio;this.modules.renderer.enableShaderProgram(e),this.modules.renderer.isUboSupported()||Kt(e,this.mapState,this.modules),this.modules.renderer.bindShaderProgram(e,{u_mat4_mvp:it.dC(this.mvpMatrix,this.modules.camera.viewProjectionMatrix,this.matrix),u_mat4_model:this.matrix,u_float_radius:r*window.devicePixelRatio,u_float_intensity:s,u_float_tile_to_pixel_ratio:1/a}),this.modules.renderer.bindVao(this.vao),this.modules.renderer.setViewport(0,0,Math.ceil(this.mapState.size[0]*window.devicePixelRatio/this.downscale),Math.ceil(this.mapState.size[1]*window.devicePixelRatio/this.downscale)),this.modules.renderer.bindRenderTarget(this.frameBuffer),this.modules.renderer.clearWithColor([0,0,0,0],!1),this.modules.renderer.applyGpuState(Ao),this.modules.renderer.drawTriangles(0,this.vertexCount),this.modules.renderer.bindRenderTarget(null),this.heatmapNeedRerender=!1}destroy(){if(this.isDestroyed)return;super.destroy(),this.points=[],this.tree=void 0,this.isDestroyed=!0,this.resetBuffers(),this.layer&&this.modules.dynamicStyle.removeLayer(this.layer.innerId),this.frameBuffer.remove();const{imageManager:e}=this.modules;e.deleteTexture(this.offscreenTextureIndex),e.deleteTexture(this.rampTextureIndex)}resetBuffers(){this.buffers&&(Object.values(this.buffers).forEach((e=>e.remove())),this.buffers=void 0),this.vao&&(this.vao.remove(),this.vao=void 0)}}var k_=i(9808),O_=i(4333),R_=i(9884);const F_=[0,0],B_=[0,0,0,0];var D_;!function(e){e[e.initial=0]="initial",e[e.hidden=1]="hidden",e[e.fadeIn=2]="fadeIn",e[e.visible=3]="visible",e[e.fadeOut=4]="fadeOut"}(D_||(D_={}));class j_ extends k{constructor(e,t,i){var n,o,r,s,a,l,d,c,u,h,m,f,_;super(e,{interactive:null!==(n=t.interactive)&&void 0!==n&&n},i),this.hovered=!1,this.lastLabelingRevision=-1,this.status="visible",this.labelingStatus=D_.initial,this.options=t,this.labelKey=`point-label-${this.uniqId}`;const p=null!==(o=t.font)&&void 0!==o?o:G.Uo,v=null!==(r=t.fontSize)&&void 0!==r?r:T.fonts.baseSize,g=null!==(s=t.letterSpacing)&&void 0!==s?s:0,y=null!==(a=t.lineHeight)&&void 0!==a?a:T.fonts.baseLineHeight,b=[null!==(d=null===(l=this.options.offset)||void 0===l?void 0:l[0])&&void 0!==d?d:F_[0],null!==(u=null===(c=this.options.offset)||void 0===c?void 0:c[1])&&void 0!==u?u:F_[1]],x=(0,Q.qw)({type:"point",id:`dynamic-pointLabel-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,interactive:this.interactive,style:{textFont:p,textFontSize:v,textColor:null!==(h=t.color)&&void 0!==h?h:"#000000",textHaloWidth:null!==(m=t.haloRadius)&&void 0!==m?m:0,textHaloColor:null!==(f=t.haloColor)&&void 0!==f?f:"#ffffff",textLetterSpacing:g,textLineHeight:y,textOffset:b,allowElevation:!0}}),w=W.H.fromGeo(this.options.coordinates);if(this.position={userValue:w,normalizedValue:(0,L.I0)(w)},!x)return;const{dynamicStyle:S,collector:M,assetManager:I,styleManager:E,tileManager:P,layers:C,defaultSource:z}=this.modules,k=null!==(_=this.options.zIndex)&&void 0!==_?_:0;S.addLayer(x,k);const O=(0,J.FJ)({db_label:this.options.text}),F=(0,Y.IR)(this.position.normalizedValue),B=(0,te.Yi)(this.mapState.styleState,A.i4,A.nF.tileProps,O,A.wz,this.interactive?"0":"");(0,q.Eu)(x,B),(0,q.XI)({collector:M,generator:O_.p,args:[S.getStyle(),x,B,A.nF,R_.h,F,z.getId(),{x:[0],y:[0]},(0,Bf.o1)(window.devicePixelRatio)]});const D=M.getAccumulatedData();if(!D.labels.length)return;const j=[{metatileHash:-1,labels:D.labels,styleId:S.getStyle().id}],N=(0,k_.v)(j,Tu.AL.DynamicObject,E,this.mapState.styleState,this.mapState.styleZoom);if(1!==N.length)return;const U=N[0];jf.GY.then((()=>{var e;U.label=null!==(e=(0,jf.iY)(U.label))&&void 0!==e?e:"",U.updateRanges()})).then((()=>Promise.all(U.ranges.map((e=>I.loadFont(p,e)))))).then((()=>{if("destroyed"===this.status)return;U.textMetrics=(0,cu.JA)(U.label,g,I.getFontGlyphs(p));const e=function(e){return[e&&void 0!==e[0]?(0,we.uZ)(e[0],0,1):.5,e&&void 0!==e[1]?(0,we.uZ)(e[1],0,1):.5]}(t.anchor),i=v/T.fonts.baseSize,n=v*y*U.textMetrics.lines.length,o=i*U.textMetrics.maxWidth,r=[-o*(e[0]-.5),-n*(e[1]-.5)],[s,a]=b,l=[s+r[0],a+r[1]],d=W.H.toGeo(this.position.userValue),c=W._.fromGeo(d);(0,q.XI)({collector:M,generator:Ts.qp,args:[U,"",1,U.textMetrics,[0,0,0],c,0,l,x,S.getStyle().fontNameToIndex[p],window.devicePixelRatio]});const u=M.getAccumulatedData(),h=new R.W("dynamicObject",u.data,this.modules,this.mapState,(0,Y.IR)(this.position.normalizedValue),this);N_(h,this.position.userValue[2]),C.addLayer(this),this.tileObjects.push(h),this.interactive&&(this.identifyIds.push(D.identifyIds),this.modules.identifier.resetCache()),M.reset(),this.options.labeling&&"none"!==this.options.labeling.type?(this.labelBox={id:this.uniqId,width:o,height:n,position:this.position.normalizedValue,offset:[l[0]-e[0]*o,l[1]-e[1]*n],labelingGroup:"pointLabel"},this.addLabelToLabeler(),this.update()):"visible"===this.status&&P.addObject(h),this.modules.renderer.addRerenderEvent(),this.initImageIfNeed(U,o,n,b,r)}))}hide(){"visible"===this.status&&(this.status="hidden",this.removeLabelFromLabeler(),this.removeTilesFromMap(),this.labelingStatus=D_.hidden)}show(){"hidden"===this.status&&(this.status="visible",this.labelBox||this.addTilesToMap(),this.labelingStatus=D_.initial,this.addLabelToLabeler(),this.update())}isOutOfMainReplica(){return!1}remove(){"destroyed"!==this.status&&(this.interactive&&this.modules.identifier.resetCache(),this.removeLabelFromLabeler(),super.destroy(),this.status="destroyed")}setCoordinates(e){if("destroyed"===this.status)return;const t=W.H.fromGeo(e);this.position={userValue:t,normalizedValue:(0,L.I0)(t)},this.tileObjects.forEach((e=>{e.setTileCoords((0,Y.IR)(this.position.normalizedValue),this.mapState),N_(e,this.position.userValue[2])})),this.labelBox&&(this.labelBox.position=this.position.normalizedValue,this.addLabelToLabeler()),0!==this.tileObjects.length&&"visible"===this.status&&this.modules.renderer.addRerenderEvent()}getCoordinates(){return W.H.toGeo(this.position.userValue)}update(){if("destroyed"===this.status)return;if(super.update(),"visible"!==this.status||!this.labelBox||this.lastLabelingRevision===this.modules.labeler.getLabelingRevision())return;this.lastLabelingRevision=this.modules.labeler.getLabelingRevision();const e=this.modules.labeler.isLabelBoxSurvived(this.uniqId),t=this.labelingStatus;let i=q.jh.none;switch(this.labelingStatus){case D_.initial:e?(this.addTilesToMap(),i=q.jh.none,this.labelingStatus=D_.visible):this.labelingStatus=D_.hidden;break;case D_.hidden:e&&(this.addTilesToMap(),i=q.jh.fadeIn,this.labelingStatus=D_.fadeIn);break;case D_.fadeIn:e?this.labelingStatus=D_.visible:(this.labelingStatus=D_.fadeOut,i=q.jh.fadeOut);break;case D_.visible:e||(i=q.jh.fadeOut,this.labelingStatus=D_.fadeOut);break;case D_.fadeOut:e?(i=q.jh.fadeIn,this.labelingStatus=D_.fadeIn):(this.removeTilesFromMap(),this.labelingStatus=D_.hidden)}t!==this.labelingStatus&&this.labelingStatus!==D_.hidden&&this.tileObjects.forEach((e=>e.children.forEach((e=>{e.attributes.animDirection=i}))))}initImageIfNeed(e,t,i,n,o){var r,s;return(0,I.mG)(this,void 0,void 0,(function*(){if(!this.options.image)return;const{imageCache:a,dynamicStyle:l,collector:d,tileManager:c}=this.modules,u=window.devicePixelRatio,h=yield a.getRasterSet(this.options.image.url,void 0,this.options.image.size,[0,0]);if(!h||"destroyed"===this.status)return;const m=h.rasters[0];l.appendRasterSet(h,(0,qa.PR)(this.options.image.url,0,0));const[f,_,p,v]=this.options.image.padding||B_,g=(t+v+_)*u,y=(i+f+p)*u,b=((_-v)/2+n[0]+o[0])*u,x=((p-f)/2+n[1]+o[1])*u,w=null===(r=this.options.image.stretchX)||void 0===r?void 0:r.map((([e,t])=>[e*u,t*u])),S=null===(s=this.options.image.stretchY)||void 0===s?void 0:s.map((([e,t])=>[e*u,t*u])),M=W.H.toGeo(this.position.userValue),I=W._.fromGeo(M);(0,q.XI)({collector:d,generator:Ts.GN,args:[e,"",[0,0,0],I,0,m,g,y,b,x,window.devicePixelRatio,w,S]});const T=d.getAccumulatedData();d.reset();const E=new R.W("dynamicObject",T.data,this.modules,this.mapState,(0,Y.IR)(this.position.normalizedValue));N_(E,this.position.userValue[2]),this.tileObjects.push(E),"hidden"===this.status||this.labelBox||c.addObject(E),this.labelBox&&(this.labelBox.height=i+f+p,this.labelBox.width=t+v+_,this.labelBox.offset[0]-=v,this.labelBox.offset[1]-=f,this.addLabelToLabeler(),this.labelingStatus!==D_.hidden&&this.labelingStatus!==D_.initial&&(c.addObject(E),this.mapState.needRerender=!0),this.lastLabelingRevision=-1)}))}addTilesToMap(){this.tileObjects.forEach((e=>{this.modules.tileManager.addObject(e)}))}removeTilesFromMap(){this.tileObjects.forEach((e=>{this.modules.tileManager.removeObject(e)}))}addLabelToLabeler(){this.removeLabelFromLabeler(),this.labelBox&&(this.modules.labeler.addLabelBox(this.labelKey,this.labelBox),this.lastLabelingRevision=-1)}removeLabelFromLabeler(){this.labelBox&&this.modules.labeler.removeLabels(this.labelKey)}}function N_(e,t){e.modelMatrices.forEach((e=>{e[14]=t}))}const U_=[.5,.5],H_=[0,18];class G_ extends ${constructor(e,t){super(e,t,t.draggable),this.visible=!0,this.map=e,this.options=t;const{coordinates:i,size:n,zIndex:o,minZoom:r,maxZoom:s,hoverIcon:a,hoverSize:l,hoverAnchor:d,label:c,rotation:u,opacity:h,hoverOpacity:m}=t;this.status="normal";const f=W.H.fromGeo(i);this.position={userValue:f,normalizedValue:(0,L.I0)(f)},this.rotation=(0,we.Id)(null!=u?u:0),this.zIndex=void 0!==o?o:0,this.minZoom=null!=r?r:-1/0,this.maxZoom=null!=s?s:1/0;const _=void 0!==t.icon?t.icon:T.defaultMarkerIcon,p=void 0!==t.icon?t.anchor:T.defaultMarkerAnchor;this.on("mouseover",this.switchToHoveredStyle),this.on("mouseout",this.switchToNormalStyle),this.modules.layers.addLayer(this),this.setIconInternal({icon:_,anchor:p,size:n,opacity:h}).then((()=>{void 0!==a&&this.setHoverIconInternal({icon:a,anchor:d,size:l,opacity:m})})),this.setLabel(c)}destroy(){var e;"destroyed"!==this.status&&(this.status="destroyed",null===(e=this.label)||void 0===e||e.remove(),this.interactive&&this.modules.identifier.resetCache(),this.off("mouseover",this.switchToHoveredStyle),this.off("mouseout",this.switchToNormalStyle),super.destroy())}update(){if(this.mapState.dpiChanged){const{icon:e,hoverIcon:t}=this.options;e&&this.setIconInternal(Object.assign({icon:e},this.options)),e&&t&&this.setHoverIconInternal(Object.assign({icon:e,hoverIcon:t},this.options))}if(this.mapState.globeMode){const{tileManager:e}=this.modules,t=this.modules.camera.ecef.canSee(this.options.coordinates);this.visible&&!t?this.tileObjects.forEach((t=>e.removeObject(t))):!this.visible&&t&&this.tileObjects.forEach((t=>e.addObject(t))),this.visible=t}}isOutOfMainReplica(){return!1}setRotation(e){if("destroyed"===this.status)return;const t=(0,we.Id)(e);t!==this.rotation&&(this.rotation=t,this.normalStateData&&(this.normalStateData.styleLayer.style.iconRotation=this.rotation,this.modules.renderer.addRerenderEvent()),this.hoverStateData&&(this.hoverStateData.styleLayer.style.iconRotation=this.rotation,this.modules.renderer.addRerenderEvent()))}getRotation(){return(0,we.ZY)(this.rotation)}setIcon(e){"destroyed"!==this.status&&(V_({icon:this.options.icon,anchor:this.options.anchor,size:this.options.size,opacity:this.options.opacity},e)||(this.options.icon=e.icon,this.options.anchor=e.anchor,this.options.size=e.size,this.options.opacity=e.opacity,this.setIconInternal(e)))}setHoverIcon(e){if("destroyed"!==this.status)return e?void(V_({icon:this.options.hoverIcon,anchor:this.options.hoverAnchor,size:this.options.hoverSize,opacity:this.options.hoverOpacity},e)||(this.options.hoverIcon=e.icon,this.options.hoverAnchor=e.anchor,this.options.hoverSize=e.size,this.options.hoverOpacity=e.opacity,this.setHoverIconInternal(e))):("hover"===this.status&&this.switchToNormalStyle(),void(this.hoverStateData&&((0,we.VJ)(this.tileObjects,this.hoverStateData.tileObject),(0,we.VJ)(this.identifyIds,this.hoverStateData.identifyIds),this.hoverStateData.tileObject.clean(this.mapState),this.hoverStateData=void 0)))}setLabel(e){var t,i,n,o,r;"destroyed"!==this.status&&(null===(t=this.label)||void 0===t||t.remove(),e&&(this.label=new j_(this.map,Object.assign(Object.assign({coordinates:this.getCoordinates()},e),{minZoom:Math.max(null!==(i=e.minZoom)&&void 0!==i?i:this.minZoom,this.minZoom),maxZoom:Math.min(null!==(n=e.maxZoom)&&void 0!==n?n:this.maxZoom,this.maxZoom),fontSize:null!==(o=e.fontSize)&&void 0!==o?o:18,anchor:e.anchor||U_,offset:e.offset||H_,zIndex:null!==(r=e.zIndex)&&void 0!==r?r:this.zIndex+1e-5,interactive:this.interactive}),this)))}setCoordinates(e){var t;this.setPosition(W.H.fromGeo(e)),null===(t=this.label)||void 0===t||t.setCoordinates(e)}getCoordinates(){return W.H.toGeo(this.getPosition())}show(){var e;"hidden"===this.status&&(null===(e=this.label)||void 0===e||e.show(),this.normalStateData&&(this.modules.tileManager.addObject(this.normalStateData.tileObject),this.modules.renderer.addRerenderEvent(),this.interactive&&this.modules.identifier.resetCache()),this.status="normal")}hide(){var e,t,i;if("destroyed"===this.status||"hidden"===this.status)return;null===(e=this.label)||void 0===e||e.hide();const n="normal"===this.status?null===(t=this.normalStateData)||void 0===t?void 0:t.tileObject:null===(i=this.hoverStateData)||void 0===i?void 0:i.tileObject;n&&(this.modules.tileManager.removeObject(n),this.modules.renderer.addRerenderEvent(),this.interactive&&this.modules.identifier.resetCache()),this.status="hidden"}setPosition(e){this.position={userValue:e,normalizedValue:(0,L.I0)(e)},this.tileObjects.length&&(this.tileObjects.forEach((e=>{e.setTileCoords((0,Y.IR)(this.position.normalizedValue),this.mapState)})),"hidden"!==this.status&&(this.modules.renderer.addRerenderEvent(),this.interactive&&this.modules.identifier.resetCache()))}getPosition(){return this.position.userValue}contains(e){if(!this.normalStateData)return!1;const{hoverStateData:t,normalStateData:i}=this,n=void 0!==t?t.size:i.size,o=void 0!==t?t.anchor:i.anchor,r=this.modules.camera.flat.project(this.position.normalizedValue),s=r[0]-n[0]*o[0],a=r[0]+n[0]*(1-o[0]),l=r[1]-n[1]*o[1],d=r[1]+n[1]*(1-o[1]);return e[0]>s&&e[0]<a&&e[1]>l&&e[1]<d}switchToHoveredStyle(){if("normal"===this.status&&this.hoverStateData&&this.normalStateData){const{tileManager:e}=this.modules;e.removeObject(this.normalStateData.tileObject),e.addObject(this.hoverStateData.tileObject),this.status="hover",this.modules.renderer.addRerenderEvent()}this.label&&(this.label.hovered=!0,this.modules.renderer.addRerenderEvent())}switchToNormalStyle(){if("hover"===this.status&&this.normalStateData&&this.hoverStateData){const{tileManager:e}=this.modules;e.removeObject(this.hoverStateData.tileObject),e.addObject(this.normalStateData.tileObject),this.status="normal",this.modules.renderer.addRerenderEvent()}this.label&&(this.label.hovered=!1,this.modules.renderer.addRerenderEvent())}getMarkerStateData(e,{icon:t,anchor:i,size:n,opacity:o}){const{zIndex:r,position:s}=this,{collector:a,dynamicStyle:l,styleManager:d,defaultSource:c}=this.modules,u=(0,J.FJ)({dpi:96*window.devicePixelRatio}),h=(0,Y.IR)(s.normalizedValue),m="number"==typeof this.position.userValue[2]?this.position.userValue[2]:0,f=(0,Q.qw)({type:"point",id:`dynamic-marker-${this.uniqId}`,minzoom:this.minZoom,maxzoom:this.maxZoom,style:{iconImage:t,iconAnchor:i,iconRotation:this.rotation,iconOpacity:o,elevation:m}});if(!f)throw new Error(`Marker with icon ${t} was created with null style layer`);const _=(0,qa.pV)(f.style.iconAnchor);l.addLayer(f,r),l.appendRasterSet(e,(0,qa.PR)(t,_[0],_[1]));const p=(0,te.Yi)(this.mapState.styleState,A.i4,A.nF.tileProps,u,A.wz,this.interactive?"0":"");(0,q.Eu)(f,p),(0,q.XI)({collector:a,generator:O_.p,args:[l.getStyle(),f,p,A.nF,R_.h,h,c.getId(),{x:[0],y:[0]},(0,Bf.o1)(window.devicePixelRatio)]});const{identifyIds:v,labels:g}=a.getAccumulatedData();if(!g.length)throw new Error(`Marker with icon ${t} was created with empty labels`);const y=[{metatileHash:-1,labels:g,styleId:l.getStyle().id}],b=(0,k_.v)(y,Tu.AL.DynamicObject,d,this.mapState.styleState,this.mapState.styleZoom);if(1!==b.length)throw new Error(`Marker with icon ${t} has empty unpacked labels`);const x=b[0],w=W.H.toGeo(this.position.userValue),S=W._.fromGeo(w);(0,Ts.vg)(a,x,"",[0,0,m],S,0,e.rasters[0],window.devicePixelRatio);const{data:M}=a.getAccumulatedData();a.reset();return{styleLayer:f,tileObject:new R.W("dynamicObject",M,this.modules,this.mapState,h,this),identifyIds:v,icon:t,anchor:[e.rasters[0].anchorX,e.rasters[0].anchorY],size:n||[e.rasters[0].w/window.devicePixelRatio,e.rasters[0].h/window.devicePixelRatio]}}setIconInternal(e){return(0,I.mG)(this,void 0,void 0,(function*(){return this.modules.imageCache.getRasterSet(e.icon,void 0,e.size,e.anchor).then((t=>{if("destroyed"===this.status||!t)return;const i=this.normalStateData,n=this.getMarkerStateData(t,e);"normal"===this.status&&(i&&this.modules.tileManager.removeObject(i.tileObject),this.modules.tileManager.addObject(n.tileObject),this.modules.renderer.addRerenderEvent(),this.interactive&&this.modules.identifier.resetCache()),i&&((0,we.VJ)(this.tileObjects,i.tileObject),(0,we.VJ)(this.identifyIds,i.identifyIds),i.tileObject.clean(this.mapState)),this.tileObjects.push(n.tileObject),this.interactive&&this.identifyIds.push(n.identifyIds),this.normalStateData=n}))}))}setHoverIconInternal(e){return(0,I.mG)(this,void 0,void 0,(function*(){return this.modules.imageCache.getRasterSet(e.icon,void 0,e.size,e.anchor).then((t=>{if("destroyed"===this.status||!t)return;const i=this.hoverStateData,n=this.getMarkerStateData(t,e);"hover"===this.status&&(i&&this.modules.tileManager.removeObject(i.tileObject),this.modules.tileManager.addObject(n.tileObject),this.modules.renderer.addRerenderEvent(),this.interactive&&this.modules.identifier.resetCache()),i&&((0,we.VJ)(this.tileObjects,i.tileObject),(0,we.VJ)(this.identifyIds,i.identifyIds),i.tileObject.clean(this.mapState)),this.tileObjects.push(n.tileObject),this.interactive&&this.identifyIds.push(n.identifyIds),this.hoverStateData=n}))}))}}function V_(e,t){var i,n,o,r,s,a,l,d,c,u;return e.icon===t.icon&&((null===(i=e.anchor)||void 0===i?void 0:i[0])===(null===(n=t.anchor)||void 0===n?void 0:n[0])&&(null===(o=e.anchor)||void 0===o?void 0:o[1])===(null===(r=t.anchor)||void 0===r?void 0:r[1])&&((null===(s=e.size)||void 0===s?void 0:s[0])===(null===(a=t.size)||void 0===a?void 0:a[0])&&(null===(l=e.size)||void 0===l?void 0:l[1])===(null===(d=t.size)||void 0===d?void 0:d[1])&&(null===(c=e.opacity)||void 0===c?void 0:c.toString())===(null===(u=t.opacity)||void 0===u?void 0:u.toString())))}var Z_=i(5600),W_=i(2702);const X_=(0,Z_.D)({symbol:"polygon",sinks:{fill:{stride:8,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.localID=new Uint32Array(t,4)},packObjectAttributes:(e,t,i)=>(0,W_.v)([e,t.innerId],t,i),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})}},generate(e,t,i,n,o){const r=o.x,s=o.y,a=e.idIndexer.getIndex(n,t,i),l=(0,te.FR)(i.ignoreTier,n)?null:n.tileAttrs[n.tileProps.db_tiers],d=e.getBucket(i.type,"fill",wi.a.sinks.fill.packObjectAttributes(t,i,l,"","",n),wi.a.sinks.fill.binder);let c=d.elements.offset;!function(e,t,i,n,o,r,s,a){const l=e.buffer,d=e.offset;l[d]=t+i,l[d+1]=t+n,l[d+2]=t+o,l[d+3]=t+r,l[d+4]=t+s,l[d+5]=t+a,e.offset=d+6}(d.indices,c,0,1,2,2,1,3),K_(d,c++,r[0],s[0],a),K_(d,c++,r[1],s[1],a),K_(d,c++,r[2],s[2],a),K_(d,c++,r[3],s[3],a),d.elements.offset=c}});function K_(e,t,i,n,o){const r=4*t;e.views.position[r]=G.jO+i,e.views.position[r+1]=G.jO+n;const s=2*t;e.views.localID[s]=o}class $_ extends k{constructor(e,t){super(e,t),this.isGeometryOutOfMainReplica=!1;const{dynamicStyle:i,collector:n,tileManager:o,identifier:r,layers:s}=this.modules;this.options=t,this.points=[];const a=(0,Q.qw)({type:"polygon",id:`dynamic-polygon-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{color:this.options.color||"#0085a0"}});if(!a)return;i.addLayer(a,this.options.zIndex),this.layerId=a.innerId;const l=(0,J.FJ)({db_tiers:t.tiers});this.points=function(e,t,i){const n=t/2,o=i/2,r=e[0],s=e[1],a=e[2];return[[r-n,s-o,a],[r+n,s-o,a],[r-n,s+o,a],[r+n,s+o,a]]}(W.H.fromGeo(this.options.center),(0,L.a4)(this.options.center,this.options.width),(0,L.a4)(this.options.center,this.options.height)),this.isGeometryOutOfMainReplica=this.points.some((e=>e[0]>G.ed||e[0]<-G.ed));const d=le.Ue();for(let e=0;e<this.points.length;e++)le.aM(d,this.points[e]);const c=(0,Y.x7)(d),u=(0,Y.Bs)(c),h=[],m=[],f=ae.Ue();for(let e=0;e<this.points.length;e++)(0,Y.a2)(f,this.points[e],u),h[e]=f[0],m[e]=f[1];const _=(0,te.Yi)(this.mapState.styleState,A.i4,A.Dz,l,A.wz,this.options.interactive?"0":"");(0,q.XI)({collector:n,generator:X_.generate,args:[i.getStyle().id,a,_,{x:h,y:m}]});const p=n.getAccumulatedData(),v=new R.W("dynamicObject",p.data,this.modules,this.mapState,c,this);o.addObject(v),this.tileObjects.push(v),this.options.interactive&&this.identifyIds.push(p.identifyIds),s.addLayer(this),n.reset(),this.modules.renderer.addRerenderEvent(),this.options.interactive&&r.resetCache()}destroy(){void 0!==this.layerId&&this.modules.dynamicStyle.removeLayer(this.layerId),this.options.interactive&&this.modules&&this.modules.identifier.resetCache(),super.destroy()}isOutOfMainReplica(){return this.isGeometryOutOfMainReplica}}class q_ extends k{constructor(e,t){super(e,{interactive:!1}),this.isGeometryOutOfMainReplica=!1;const{dynamicStyle:i}=this.modules;this.options=Object.assign(Object.assign({},t),{image:{url:t.image.url}}),this.points=[],this.styleLayer=(0,Q.qw)({type:"raster",id:`dynamic-raster-${this.uniqId}`,minzoom:this.options.minZoom,maxzoom:this.options.maxZoom,style:{opacity:this.options.opacity}}),this.styleLayer&&(i.addLayer(this.styleLayer,this.options.zIndex),this.layerId=this.styleLayer.innerId,this.modules.imageManager.loadTexture(this.options.image.url,{skipAtlasSizeChecking:!0}).then((e=>{this.textureIndex=e,this.generate()})))}destroy(){void 0!==this.layerId&&this.modules.dynamicStyle.removeLayer(this.layerId),super.destroy()}updateImage(e){const{url:t,bounds:i}=e;if(!t&&!i)return Promise.resolve();t&&(this.options.image.url=t),i&&(this.options.bounds=i);return(t?this.modules.imageManager.loadTexture(t,{skipAtlasSizeChecking:!0}):Promise.resolve(this.textureIndex)).then((e=>{this.textureIndex=e,this.clean(),this.generate()}))}isOutOfMainReplica(){return this.isGeometryOutOfMainReplica}generate(){var e;if(!this.styleLayer||void 0===this.textureIndex)return;const{collector:t,dynamicStyle:i,tileManager:n,layers:o}=this.modules;this.points=function(e){const{min:t,max:i}=le.X3(e);return[t,[i[0],t[1]],[t[0],i[1]],i]}(this.options.bounds),this.isGeometryOutOfMainReplica=this.points.some((e=>e[0]>G.ed||e[0]<-G.ed));const r=le.Ue();for(let e=0;e<this.points.length;e++)le.aM(r,this.points[e]);const s=(0,Y.x7)(r),a=(0,Y.Bs)(s),l=[],d=[],c=ae.Ue();for(let e=0;e<this.points.length;e++)(0,Y.a2)(c,this.points[e],a),l[e]=c[0],d[e]=c[1];const u=(0,te.Yi)(this.mapState.styleState,{},A.Dz,[],A.wz);(0,q.XI)({collector:t,generator:pi.h.generate,args:[{x:l,y:d},i.getStyle().id,u,this.styleLayer,this.textureIndex,null!==(e=this.options.tiers)&&void 0!==e?e:null]});const h=t.getAccumulatedData(),m=new R.W("dynamicObject",h.data,this.modules,this.mapState,s,this);n.addObject(m),this.tileObjects.push(m),o.addLayer(this),t.reset(),this.modules.renderer.addRerenderEvent()}clean(){const e=this.tileObjects[0];e&&(e.clean(this.mapState),this.modules.tileManager.removeObject(e),this.modules.layers.removeLayer(this),this.tileObjects=[])}}class Y_{constructor(e,t,i){this.id=e,this.modules=t,this.options=i,this.type="raster",this.textureIndices={},this.tileLoader=new Dn.U("arrayBuffer"),this.attributes={},this.tiles=new Map,this.sourceAttrs=i.attributes||{},this.url=e=>{const[t,i,n]=(0,Y._W)(e),{min:o,max:r}=(0,Y.Sl)(e),s={southWest:[o[0],o[1]].map((e=>e/G.gL)),northEast:[r[0],r[1]].map((e=>e/G.gL))};return this.options.url(t,i,n,s)}}deleteTextures(){for(const e in this.textureIndices)this.modules.imageManager.deleteTexture(this.textureIndices[e]);this.textureIndices={}}abortTileFetches(e){this.tileLoader.abortRequests(e.map(Y.gx))}deleteTiles(e){for(const t of e){const e=(0,Y.gx)(t),i=this.textureIndices[e];isNaN(i)||this.modules.imageManager.deleteTexture(i),this.tiles.delete(e)}}fetchTiles(e){return e.map((e=>this.fetchTile(e)))}fetchTile(e){const t=(0,Y.gx)(e),i=this.url(e);return this.tileLoader.fetch(e,(()=>i)).then((n=>{if(n.error){const t=this.modules.sourceStorage.getSourceById(this.id);"raster"===(null==t?void 0:t.type)&&this.modules.map.emit("error",{type:"rasterTileLoadError",tileCoords:(0,Y._W)(e),tileUrl:i,source:t,responseMessage:n.error.message,responseStatus:n.error.status})}n.rejected||this.tiles.set(t,n.data);return[{regionId:0,metatileHash:-1}]}))}generateTile(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){const i=[],n=[],o=this.modules.styleManager.getStyle(e.handyStyleId),r=(0,Y.gx)(t),s=this.tiles.get(r);if(!s||!o)return Promise.resolve({results:i,transferable:n});const a=yield this.modules.imageManager.addTexture(s,{imagePadding:0,size:[G.y4,G.y4]});if(void 0===a)return Promise.resolve({results:i,transferable:n});this.textureIndices[r]=a;const l=[],d=[],c=ae.Ue(),u=function(e,t){const i=e[0],n=e[1],o=e[2];return[[i,n,o],[i+t,n,o],[i,n+t,o],[i+t,n+t,o]]}((0,Y.Oy)(t),(0,Y.aq)(t[2])),h=(0,Y.Bs)(t);for(let e=0;e<u.length;e++)(0,Y.a2)(c,u[e],h),l[e]=c[0],d[e]=c[1];const m=(0,te.Yi)(e.styleState,this.sourceAttrs,A.Dz,[],A.wz);o.layers.filter((e=>"raster"===e.type&&(0,te.FR)(e.filter,m))).forEach((e=>{(0,q.Eu)(e,m),(0,q.XI)({collector:this.modules.collector,generator:pi.h.generate,args:[{x:l,y:d},o.id,m,e,a,null]})}));const f=this.modules.collector.getAccumulatedData();return i.push({regionId:0,metatileHash:0,styleId:o.id,collectorOutput:f}),n.push(...f.transferable),this.modules.collector.reset(),Promise.resolve({results:i,transferable:n})}))}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e}destroy(){this.tileLoader.destroy()}}class J_{constructor(e,t,i){var n,o;this.type="raster",this.id=(0,N.Q)(),this.modules=e.modules,this.source=new Y_(this.id,this.modules,t);const r=null!==(n=t.minZoom)&&void 0!==n?n:T.MAP_DEFAULTS.minZoom,s=null!==(o=t.maxZoom)&&void 0!==o?o:T.MAP_DEFAULTS.maxZoom;this.layer=new H.I(r,s,r,s,this.modules,e.state,this.source),this.modules.tileManager.addTileLayer(this.layer),this.modules.sourceStorage.addSource(this),this.mapglApiSource=i}destroy(){this.source.deleteTextures(),this.modules.tileManager.removeTileLayer(this.layer),this.modules.sourceStorage.removeSource(this.getId()),this.layer.destroy()}getAttributes(){return this.source.getAttributes()}getZoomDirection(){return this.layer.getZoomDirection()}getId(){return this.source.id}setAttributes(e){this.source.setAttributes(e),this.layer.redraw()}isIdentifiedAsDefault(){return!1}}class Q_ extends k{constructor(e,t){var i;super(e,t),this.options=t,this.visible=!0;const n=W.H.fromGeo(t.coordinates);this.position={userValue:n,normalizedValue:(0,L.I0)(n)},this.zIndex=null!==(i=t.zIndex)&&void 0!==i?i:0,this.isDestroyed=!1,this.labelKey=`onlineMarker-${this.uniqId}`;const o=this.options.floorId?e.modules.floorManager.getFloorObjectElevation(this.options.floorId,!0):0,r=t.elevation?t.elevation*W.H.scaleFactor(t.coordinates[1])*L.C:0;this.elevation=r+o,this.actualIcon=t.icon,this.setIcon(t.icon)}destroy(){this.isDestroyed=!0,this.modules.identifier.resetCache(),this.modules.labeler.removeLabels(this.labelKey),super.destroy()}isOutOfMainReplica(){return!1}setIcon(e){this.actualIcon=e;const{url:t,transformer:i,size:n,anchor:o}=e;this.modules.imageCache.getRasterSet(t,i,n,o).then((i=>{if(this.isDestroyed||!i||this.actualIcon!==e)return;this.removeIcon();const r=(0,Q.qw)({type:"point",id:`dynamic-onlineMarker-${this.uniqId}`,minzoom:-1/0,maxzoom:1/0,style:{iconImage:t,iconAnchor:o}}),s=(0,J.FJ)({}),{collector:a,dynamicStyle:l,styleManager:d,defaultSource:c}=this.modules,u=this.zIndex;if(!r)return;const h=(0,qa.pV)(r.style.iconAnchor);l.addLayer(r,u),l.appendRasterSet(i,(0,qa.PR)(t,h[0],h[1]));const m=(0,Y.IR)(this.position.normalizedValue),f=(0,te.Yi)(this.mapState.styleState,A.i4,A.nF.tileProps,s,A.wz,this.interactive?"0":"");(0,q.Eu)(r,f),(0,q.XI)({collector:a,generator:O_.p,args:[l.getStyle(),r,f,A.nF,R_.h,m,c.getId(),{x:[0],y:[0]},(0,Bf.o1)(window.devicePixelRatio)]});const _=a.getAccumulatedData(),{identifyIds:p,labels:v}=_;if(!v.length)return;const g=[{metatileHash:-1,labels:v,styleId:l.getStyle().id}],y=(0,k_.v)(g,Tu.AL.DynamicObject,d,this.mapState.styleState,this.mapState.styleZoom);if(1!==y.length)return;const b=y[0],x=W.H.toGeo(this.position.userValue),w=W._.fromGeo(x);(0,Ts.vg)(a,b,"",[0,0,this.elevation],w,0,i.rasters[0],window.devicePixelRatio);const S=a.getAccumulatedData();a.reset();const M=new R.W("dynamicObject",S.data,this.modules,this.mapState,(0,Y.IR)(this.position.normalizedValue),this);this.tileObjects.push(M),this.identifyIds=[p],this.modules.tileManager.addObject(M),this.modules.layers.addLayer(this),this.modules.identifier.debouncedFillCache(),this.modules.labeler.removeLabels(this.labelKey),this.modules.labeler.addLabelBox(this.labelKey,{id:this.uniqId,width:n[0],height:n[1],position:this.position.normalizedValue,offset:[-o[0],-o[1]],labelingGroup:"marker"}),this.modules.renderer.addRerenderEvent()}))}update(){if(this.mapState.globeMode){const{tileManager:e}=this.modules,t=this.modules.camera.ecef.canSee(this.options.coordinates);this.visible&&!t?this.tileObjects.forEach((t=>e.removeObject(t))):!this.visible&&t&&this.tileObjects.forEach((t=>e.addObject(t))),this.visible=t}}removeIcon(){const e=this.tileObjects[0];e&&(e.clean(this.mapState),this.modules.tileManager.removeObject(e),this.tileObjects=[])}}function ep(e){return{type:"data",key:(0,Y.gx)(e),coords:e,zoomLevel:e[2],detailLevel:e[3],needFetch:!1,needAbortFetch:!1,status:hm.z3.Initial}}function tp(e,t,i,n,o){return function(e,t,i,n,o,r){return{type:e,maxDetailLevel:r,minDetailLevel:o,maxZoomLevel:n,minZoomLevel:i,zoomLevel:Math.floor(t),tiles:{},viewportTiles:[]}}("data",e,t,i,n,o)}class ip extends C.c{constructor(e,t,i){super(),this.prevZoomLevel=0,this.mapState=e,this.modules=t,this.config=i,this.gridState=tp(e.styleZoom,i.minZoom,i.maxZoom,i.minZoom,i.maxZoom),this.viewportDiffer=new Ve.H([{path:"center",type:"vec2"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"demMode",type:"boolean"}]),this.dataTileLoader=new Dn.U("json"),this.modules.layers.addLayer(this)}destroy(){var e;(e=this.gridState).tiles={},e.viewportTiles=[],this.modules.layers.removeLayer(this)}update(){let e=!0;if(this.viewportDiffer.check(this.mapState)){const t=Math.floor(this.mapState.styleZoom);t!==this.prevZoomLevel&&(e=!1),this.prevZoomLevel=t,this.gridState.zoomLevel=t,function(e,t,i,n){if(e.zoomLevel<e.minZoomLevel)return void(e.viewportTiles=[]);const o=(0,we.uZ)(e.zoomLevel,e.minZoomLevel,e.maxZoomLevel),r=(0,we.uZ)(e.zoomLevel,e.minDetailLevel,e.maxDetailLevel);e.viewportTiles=(0,Y.b5)(t,i,o,e.minZoomLevel,r).map(Y.gx);for(let t=0;t<e.viewportTiles.length;t++){const i=e.viewportTiles[t];let o=e.tiles[i];o||(o=e.tiles[i]=n((0,Y.cL)(i)))}}(this.gridState,this.mapState,this.modules,ep),this.emit("tilesSetChanged",{tileIds:this.gridState.viewportTiles})}for(const e in this.gridState.tiles)this.gridState.viewportTiles.includes(e)?this.gridState.tiles[e].status===hm.z3.Initial&&(this.gridState.tiles[e].needFetch=!0,this.gridState.tiles[e].status=hm.z3.Loading):this.gridState.tiles[e].status===hm.z3.Loading&&(this.gridState.tiles[e].needAbortFetch=!0);e&&(this.fetch(function(e){const t=[];for(const i in e.tiles){const n=e.tiles[i];n.needFetch&&(n.needFetch=!1,t.push(n))}return t}(this.gridState)),this.abortFetch(function(e){const t=[];for(const i in e.tiles){const n=e.tiles[i];n.needAbortFetch&&(n.needAbortFetch=!1,t.push(n))}return t}(this.gridState)),this.clearTiles(function(e,t){const i=new Set(e.viewportTiles),n=[];for(const o in e.tiles){const r=e.tiles[o],s=!t||t(r);!i.has(o)&&s&&n.push(r)}return n}(this.gridState)))}fetch(e){e.sort(((e,t)=>(0,Y.qu)(this.mapState.center,e,t))).forEach((e=>this.fetchTile(e)))}abortFetch(e){const t=e.map((e=>e.key));this.dataTileLoader.abortRequests(t)}clearTiles(e){for(const t of e)delete this.gridState.tiles[t.key],this.emit("dataTileCleared",{tileId:t.key})}fetchTile(e){const{tsURLTemplate:t}=this.config;this.dataTileLoader.fetch(e.coords,t).then((t=>{t.rejected||this.emit("dataTileLoaded",{tileId:e.key,data:t.data})}))}}class np{constructor(e,t,i){var n;this._wrap=document.createElement("div"),this._wrap.style.userSelect="none","string"==typeof t?this._wrap.innerHTML=t:this._wrap.appendChild(t),this._position=null!==(n=null==i?void 0:i.position)&&void 0!==n?n:"topRight",this._controlPane=e._controlPane,this._container=this._controlPane.getContainerByPosition(this._position),this._container.append(this._wrap)}destroy(){this._wrap.remove()}getPosition(){return this._position}setPosition(e){this._container.removeChild(this._wrap),this._container=this._controlPane.getContainerByPosition(e),this._container.append(this._wrap),this._position=e}getContainer(){return this._wrap}}var op=i(6438),rp={};rp.styleTagTransform=kf(),rp.setAttributes=Af(),rp.insert=Ef().bind(null,"head"),rp.domAPI=If(),rp.insertStyleElement=Cf();Sf()(op.Z,rp);const sp=op.Z&&op.Z.locals?op.Z.locals:void 0,ap=`\n    <div class="${sp.root}">\n        <button type="button" class="${sp.button} ${sp.zoomIn}">\n            <svg\n                xmlns="http://www.w3.org/2000/svg"\n                viewBox="0 0 32 32"\n                width="32"\n                height="32"\n                fill="currentColor"\n            >\n                <path d="M24 15h-7V8h-2v7H8v2h7v7h2v-7h7v-2z"></path>\n            </svg>\n        </button>\n        <button type="button" class="${sp.button} ${sp.zoomOut}">\n            <svg\n                xmlns="http://www.w3.org/2000/svg"\n                viewBox="0 0 32 32"\n                fill="currentColor"\n                width="32"\n                height="32"\n            >\n                <path d="M8 15h16v2H8z"></path>\n            </svg>\n        </button>\n    </div>\n`;class lp extends np{constructor(e,t){super(e,ap,t),this._zoomIn=e=>{e.preventDefault(),this._map.setZoom(this._map.getZoom()+1,{duration:400})},this._zoomOut=e=>{e.preventDefault(),this._map.setZoom(this._map.getZoom()-1,{duration:400})},this._checkZoom=()=>{const e=this._map.getZoom();e<=this._map.getMinZoom()?this._zoomOutButton.disabled=!0:this._zoomOutButton.disabled=!1,e>=this._map.getMaxZoom()?this._zoomInButton.disabled=!0:this._zoomInButton.disabled=!1},this._map=e,this._zoomInButton=this._wrap.querySelector(`.${sp.zoomIn}`),this._zoomOutButton=this._wrap.querySelector(`.${sp.zoomOut}`),this._zoomInButton.addEventListener("click",this._zoomIn),this._zoomOutButton.addEventListener("click",this._zoomOut),this._map.on("zoom",this._checkZoom)}destroy(){this._map.off("zoom",this._checkZoom),this._zoomInButton.removeEventListener("click",this._zoomIn),this._zoomOutButton.removeEventListener("click",this._zoomOut),super.destroy()}}var dp=i(4928),cp={};cp.styleTagTransform=kf(),cp.setAttributes=Af(),cp.insert=Ef().bind(null,"head"),cp.domAPI=If(),cp.insertStyleElement=Cf();Sf()(dp.Z,cp);const up=dp.Z&&dp.Z.locals?dp.Z.locals:void 0;class hp extends np{constructor(e,t){super(e,"",t),this._onClick=e=>{e.preventDefault(),this._map.isTrafficOn()?this._map.hideTraffic():this._map.showTraffic()},this._map=e,this._render(),e.on("trafficscore",(({score:e})=>{this._score=e,this._render()})),e.on("trafficshow",(()=>{this._render()})),e.on("traffichide",(()=>{this._render()}))}_render(){const e=this._map.isTrafficOn()?function(e){if(void 0===e)return"";if(e>6)return up.hard;if(e>3)return up.medium;return up.easy}(this._score):up.none,t=`\n            <div class="${up.root}">\n                <button type="button" class="${up.button} ${e}">\n                    ${this._map.isTrafficOn()&&void 0!==this._score?this._score:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="14" viewBox="0 0 20 14" style="margin-top: 4px">\n    <path d="M 18,5 C 18,4 17,1 15,1 H 12 10 C 8,1 7,4 7,5 H 5 v 2 h 1 v 4 c 0,0.6 0,1 1,1 v 2 h 2 v -2 h 7 v 2 h 2 v -2 c 1,0 1,-0.4 1,-1 V 7 h 1 V 5 H 18 z M 10,3 h 2 3 c 2,0 2,1 2,3 H 8 C 8,4 8,3 10,3 z M 9,10 H 8 C 7.4,10 7,9.6 7,9 7,8.4 7.4,8 8,8 h 1 c 0.6,0 1,0.4 1,1 0,0.6 -0.4,1 -1,1 z m 8,0 H 16 C 15.4,10 15,9.6 15,9 15,8.4 15.4,8 16,8 h 1 c 0.6,0 1,0.4 1,1 0,0.6 -0.4,1 -1,1 z M 4,4 H 6 V 3 H 4 C 1,3 1,6 1,7 H 0 v 1 h 1 v 4 H 3 V 11 H 5 V 7 H 2 C 2,6 2,4 4,4 z M 3,9 4,10 H 2 V 9 h 1 z" fill="#616161" fill-rule="evenodd"/>\n    <g fill="#fff">\n        <path d="m 16,8 h 1 c 0.4,0 0.7,0.2 0.8,0.5 C 17.9,8.4 18,8.2 18,8 18,7.4 17.6,7 17,7 h -1 c -0.6,0 -1,0.4 -1,1 0,0.2 0.1,0.4 0.2,0.5 C 15.3,8.2 15.6,8 16,8 z"/>\n        <path d="M 8,8 H 9 C 9.4,8 9.7,8.2 9.8,8.5 9.9,8.4 10,8.2 10,8 10,7.4 9.6,7 9,7 H 8 C 7.4,7 7,7.4 7,8 7,8.2 7.1,8.4 7.2,8.5 7.3,8.2 7.6,8 8,8 z"/>\n        <path d="M 6,3 H 4 C 4,3 4,3 4,3 2,3 2,5 2,6 H 2 C 2.1,5 2.5,4 4,4 H 5 6 V 3 z"/>\n        <path d="M0 7H1V8H0z"/>\n        <path d="M 15,2 H 12 10 C 8,2 8,3 8,5 H 8 C 8,3.7 8.3,3 10,3 h 2 3 c 1.7,0 1.9,0.7 2,2 h 0 C 17,3 17,2 15,2 z"/>\n        <path d="M3 9L4 9 3 8 2 8 2 9 2 9 2 9 3 9z"/>\n        <path d="M 7,11 C 6,11 6,10.6 6,10 v 1 c 0,0.6 0,1 1,1 v -1 z"/>\n        <path d="m 18,11 v 1 c 1,0 1,-0.4 1,-1 v -1 c 0,0.6 0,1 -1,1 z"/>\n        <path d="M19 6H20V7H19z"/>\n        <path d="M3 11L1 11 1 12 3 12 3 11 5 11 5 7 5 7 5 10 3 10z"/>\n        <path d="M16 13H18V14H16z"/>\n        <path d="M5 6H6V7H5z"/>\n        <path d="M9 13L7 13 7 14 9 14 9 12 16 12 16 11 9 11z"/>\n    </g>\n    <g fill="#444">\n        <path d="M 2,6 C 2,6.4 2,6.7 2,7 H 5 V 6 H 2 z"/>\n        <path d="M2 9L2 10 4 10 3 9z"/>\n        <path d="M 4,3 H 6 V 2 H 4 C 1,2 1,5 1,6 H 0 V 7 H 1 C 1,6 1,3 4,3 z"/>\n        <path d="M 18,4 C 18,3 17,0 15,0 H 12 10 C 8,0 7,3 7,4 H 6 5 V 5 H 7 C 7,4 8,1 10,1 h 2 3 c 2,0 3,3 3,4 h 2 V 4 h -2 z"/>\n        <path d="M 8,10 H 9 C 9.6,10 10,9.6 10,9 10,8.8 9.9,8.6 9.8,8.5 9.7,8.8 9.4,9 9,9 H 8 C 7.6,9 7.3,8.8 7.2,8.5 7.1,8.6 7,8.8 7,9 c 0,0.6 0.4,1 1,1 z"/>\n        <path d="M 17,6 C 17,5.6 17,5.3 17,5 H 8 c 0,0.3 0,0.6 0,1 h 9 z"/>\n        <path d="M 17.8,8.5 C 17.7,8.8 17.4,9 17,9 H 16 C 15.6,9 15.3,8.8 15.2,8.5 15.1,8.6 15,8.8 15,9 c 0,0.6 0.4,1 1,1 h 1 c 0.6,0 1,-0.4 1,-1 0,-0.2 -0.1,-0.4 -0.2,-0.5 z"/>\n    </g>\n</svg>\n'}\n                </button>\n            </div>\n        `;this._wrap.innerHTML=t;this._wrap.querySelector(`.${up.button}`).addEventListener("click",this._onClick)}}var mp=i(4306),fp={};fp.styleTagTransform=kf(),fp.setAttributes=Af(),fp.insert=Ef().bind(null,"head"),fp.domAPI=If(),fp.insertStyleElement=Cf();Sf()(mp.Z,fp);const _p=mp.Z&&mp.Z.locals?mp.Z.locals:void 0;var pp;!function(e){e.osm="osm",e.api="api",e.license="license"}(pp||(pp={}));const vp=e=>`\n    <div class=${_p.container}>\n        <div class=${_p.logos}>\n            ${"2gis"===e?'<a href="https://dev.2gis.ru/link_api_map" target="_blank" style="height: 20px;">\n    <svg width="40" height="20" viewBox="0 0 40 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n        <path d="M2.00011 8.72731C1.98229 5.72738 4.05025 4 6.80779 4C9.47674 4 11.2797 5.58179 11.2797 8.05437C11.2797 10.1091 10.0602 11.2546 7.99196 12.2727C7.21431 12.6547 6.34807 13.1818 5.46454 13.4544H11.3681V16H2.00011V12.66C3.85604 12.0235 4.88111 11.3271 6.59576 10.4728C7.90363 9.81815 8.71666 9.23633 8.71666 8.1819C8.71666 7.16358 7.97439 6.36366 6.80779 6.36366C5.27006 6.36366 4.52753 7.52729 4.56292 8.72731H2.00011Z" fill="#6E7173"/>\n        <path d="M23.6348 9.63643V10.5453C23.6348 13.5455 21.6552 16 18.067 16C14.6202 16 12.2518 13.4727 12.2518 9.99986C12.2518 6.52731 14.5497 4 18.1554 4C21.2487 4 23.1751 5.8363 23.6348 7.99991H21.0717C20.6301 6.96353 19.534 6.36366 18.2261 6.36366C15.9813 6.36366 14.7263 8.14523 14.7263 9.99986C14.7263 11.8545 15.9991 13.6363 18.2086 13.6363C19.5872 13.6363 20.736 12.9456 21.0896 11.8181H17.7313V9.63643H23.6348Z" fill="#6E7173"/>\n        <path d="M27.4528 16H24.9783V4H27.4528V16Z" fill="#6E7173"/>\n        <path d="M38.4292 7.63648H35.8662C35.6185 6.85461 34.947 6.18167 33.4446 6.18167C32.1543 6.18167 31.5004 6.69096 31.5004 7.41809C31.5004 8.30915 32.7375 8.56366 34.293 8.83623L34.361 8.84818C36.4076 9.20779 38.5 9.57545 38.5 12.2727C38.5 14.8 36.4672 16 33.7274 16C31.1998 16 28.9373 14.4727 28.6899 12.1818H31.2527C31.5712 13.1273 32.5079 13.8181 33.8512 13.8181C35.1415 13.8181 35.8662 13.3818 35.8662 12.5455C35.8662 11.514 34.3606 11.2653 32.8555 11.0167C32.8221 11.0112 32.7887 11.0056 32.7553 11.0001C31.1468 10.7273 28.8844 9.9818 28.8844 7.54535C28.8844 5.34534 30.7581 4 33.5332 4C36.2727 4 38.164 5.41814 38.4292 7.63648Z" fill="#6E7173"/>\n    </svg>\n</a>':'<a href="https://dev.urbi.ae" target="_blank" style="height: 20px; line-height: 20px;">\n    <svg style="width: auto; height: 16px;" width="29" height="12" viewBox="0 0 29 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n        <path fill-rule="evenodd" clip-rule="evenodd" d="M5 4V8.0625C5 9.13823 4.64701 9.5 3.75 9.5C3.00479 9.5 2.5 9.15185 2.5 8.0625V4H0V8.5C0 10.6515 1.45917 12 3.75 12C6.19263 12 7.5 10.6515 7.5 8.5V4H5ZM18.5 9.5V2H16V11.9993L20.5 12C23.013 12.0276 24.5 10.4576 24.5 8C24.5 5.4872 23.2711 4 20.5 4H19.5V6.5H20.5C21.6954 6.5 22 6.9645 22 8C22 9.06311 21.3422 9.51381 20.5 9.5H18.5ZM13 4C12.1529 4 11.7541 4.19542 11.5 5L11 4H9.01412V12H11.5V7.75C11.5 6.87606 12.1106 6.5 13 6.5H15V4H13ZM28.25 12V4H25.75V12H28.25ZM27 3C27.9508 3 28.75 2.32569 28.75 1.5C28.75 0.674312 27.9508 0 27 0C26.0492 0 25.25 0.674312 25.25 1.5C25.25 2.32569 26.0492 3 27 3Z" fill="#6E7173"/>\n    </svg>\n</a>'}\n        </div>\n    </div>\n`,gp={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{coordinates:[[[31.287134399571926,46.13828663057069],[32.75238568004798,45.79865765372267],[33.58288063506086,46.01903186613521],[33.61486347995313,46.2235364272577],[33.78934942202696,46.198543888421256],[35.00827602994491,45.75534495217423],[35.2288647404554,45.79620376974098],[35.17718890419883,45.90635851081622],[35.435536217844785,46.10280090340363],[35.79210757517962,46.37361688082296],[36.11428232078944,46.29643073207143],[36.55169983042855,46.510726153023995],[36.8324385653631,46.4588228565425],[37.14524285843429,46.69589191473136],[37.39260951621397,46.689280151379506],[37.627431059848774,46.82264082535376],[38.1229012131082,46.84212508154449],[38.33448922300602,46.97422615512966],[38.224662200013626,47.230888527366346],[38.32912700579817,47.25438400708447],[38.34419757143178,47.312784332059664],[38.21546574161874,47.30909993831261],[38.254518753011865,47.36826000208279],[38.31067651491526,47.38482171052604],[38.321606223663025,47.571364572295465],[38.3617938178036,47.57882910808604],[38.36170197978049,47.618956233608515],[38.45674637734251,47.62208601169297],[38.46107375227305,47.64691148544472],[38.63803321177437,47.647842642655746],[38.672098728783254,47.68762314810277],[38.775725461608346,47.68709376851825],[38.8049944923477,47.813690288503295],[38.834920351813224,47.8196727375917],[38.84241614380997,47.85748354545768],[39.07247756595089,47.86497172354581],[39.10052537670751,47.840884138531834],[39.38214421832214,47.86795888702861],[39.40746330974267,47.8256169720315],[39.482844878880115,47.85023053453213],[39.53382832770623,47.81883936134608],[39.73848854131376,47.82763637975813],[39.79371699101341,47.869042802541685],[39.83078252402845,47.99974474342423],[39.77863815152742,48.03277123184873],[39.88321233741743,48.03971572761765],[39.870917803736376,48.113006872810985],[39.93505319594328,48.18105768715421],[39.94606694701065,48.22361687262517],[40.01236868994266,48.22433847068592],[40.03218509167988,48.26056076274611],[39.984065212024376,48.320002192647365],[39.922439044370975,48.29188408842856],[39.851945001258656,48.331239182362935],[39.94636538164761,48.35223341528243],[39.941853222859265,48.388067879458134],[39.899783141900656,48.45166958120498],[39.85004077188802,48.47107700658495],[39.85404334598155,48.49815859245703],[39.871488094298144,48.507759719913],[39.83989084312387,48.58511601134842],[39.690955803936305,48.59154349398949],[39.668972082370914,48.61595180677952],[39.71340429381095,48.65723964838148],[39.72739208280473,48.68576344104625],[39.720852030234056,48.70453377084817],[39.71060957078353,48.71895533887451],[39.72773821117514,48.727349762777976],[39.742522688889096,48.74565876284592],[39.73675984758131,48.75923566351821],[39.75294236354742,48.76535707528038],[39.77230712573868,48.765131537231696],[39.78708527484656,48.792695126714506],[39.79951920927968,48.83846452038483],[39.97324551864918,48.788853683331496],[40.0854569051011,48.87270686936236],[40.054991236497585,48.91511705296017],[40.01572101314082,48.91564488817568],[39.985747700540486,48.87433169550951],[39.92581794882187,48.895346707874324],[39.85691072202724,48.89266055501065],[39.84380033698696,48.90643237682923],[39.77980530005851,48.92505561008153],[39.76769275004051,48.96624269122293],[39.75249250304927,48.988397421631134],[39.72953342924575,48.98364479695306],[39.6963475099607,49.006204908207565],[39.67412801512273,48.99350840477692],[39.688776866237845,49.04629763624743],[39.77599141224027,49.03984390969006],[39.80998946255809,49.05657174933967],[39.94020528746006,49.054672146531885],[39.94517686594733,49.08306814321608],[40.03354656530658,49.17940433543734],[40.08179564952226,49.187957220033326],[40.127812302222935,49.23339833688371],[40.21735722846822,49.24434936924021],[40.23083631365782,49.264375707391025],[40.184193609561845,49.28357807698788],[40.20554425700146,49.348627711592286],[40.0352506597566,49.460305560239135],[40.042265513048875,49.52110947883719],[40.17301947712943,49.570462036839785],[40.135367644468886,49.619991840168154],[39.930446598607006,49.58753811881613],[39.89326483911972,49.561338740411344],[39.80152397436578,49.5648154530997],[39.747824755329106,49.601752391386356],[39.65652368638126,49.620013992728445],[39.59591913143757,49.727977277611615],[39.43167355486196,49.76704897880802],[39.38482981859343,49.7428519723461],[39.28679269123114,49.7589376228415],[39.23167115889703,49.80067773683314],[39.23126430925569,49.83799228995301],[39.184177982005934,49.89212328019818],[38.939466721594385,49.8129411626972],[38.67999394500015,49.99954348208959],[38.498971405582154,49.969630683120045],[38.36122588838947,50.008962505581735],[38.33064743770436,50.10587365547255],[38.179344250662524,50.08108187117696],[38.17324129258458,49.96421343242167],[38.0243275352658,49.9126740335152],[38.00390141376576,49.80621204332192],[37.9339784494789,49.72626072303203],[37.997665462537555,49.705679809807805],[37.98195913415958,49.63338227733652],[37.87841001479606,49.55639540561637],[37.8726905583969,49.314558240834856],[37.83487442598039,49.211403426079585],[37.568531160033984,49.23978324969454],[37.49068171343487,49.18083483226363],[37.467253126665184,49.08118016596504],[37.29258016280227,48.98322524059054],[37.27222555931064,48.936467375391885],[36.983084082742096,48.80186787172613],[36.72382254183347,48.816637155788754],[36.863697512625095,48.16812695432242],[36.85276964213293,48.06101666035238],[36.63699950073965,48.1120861847823],[36.55643334225425,48.079707051057994],[36.5326892781749,47.85663993329777],[36.15757828505022,47.87029971236788],[36.007257866960344,48.150801757163464],[35.84084530869785,48.072372143164614],[35.69001200739808,48.14916424481041],[34.84251652180234,48.13828093857032],[34.93636037372508,47.54124693653375],[34.561002995692604,47.57138977148597],[33.975870854429644,47.468842659893966],[33.94579238047862,47.53020932511487],[33.65802349898351,47.49630012349715],[33.57945696368617,47.61817363276853],[33.07047295330287,47.579949515419315],[33.106438567586736,47.23712252316682],[32.87965855893614,47.10939623564883],[32.94045936300873,47.00638816222238],[32.531962255274834,46.887846448242044],[32.23541823078415,46.84566846340053],[31.99589893588245,46.69298741295057],[31.792169481175108,46.355938076969124],[31.231245271853055,46.42046225841926],[31.287134399571926,46.13828663057069]]],type:"Polygon"}}]};class yp extends np{constructor(e,t){super(e,vp(t.copyrightType),t),this._copyrightType="2gis",this._isHidden=!1,this._onViewportchange=()=>{this._throttledVisibleCopyright()},this._onClick=e=>{if(e.target&&((t=e.target)&&"href"in t&&"dataset"in t)){const t=e.target.dataset.type;(function(e){return void 0!==e&&e in pp})(t)&&this._map.emit("copyrightclick",{type:t,href:e.target.href,originalEvent:e})}var t},this._copyrightType=t.copyrightType,this._map=e,this._map._impl.on("viewportchange",this._onViewportchange),this._map._impl.on("idle",this._onViewportchange),!1===t.interactive&&(this._wrap.style.pointerEvents="none"),this._excludeAreaSource=new j.gs(this._map._impl,{data:gp}),this._excludeAreaSource.layer.updateViewport=()=>{(0,dm.o)(this._excludeAreaSource.layer.gridState,Object.assign(Object.assign({},this._map._impl.state),{styleZoom:this._map._impl.state.styleZoom+1}),this._map._impl.modules)};this._wrap.querySelector(`.${_p.container}`).addEventListener("click",this._onClick),this._throttledVisibleCopyright=(0,Ue.P)((()=>{this.update()}),200)}destroy(){this._map._impl.off("viewportchange",this._onViewportchange),this._map._impl.off("idle",this._onViewportchange);this._wrap.querySelector(`.${_p.container}`).removeEventListener("click",this._onClick),super.destroy()}update(){let e=!1;if(this._map.getZoom()>6.9){let t=0;const i=this._excludeAreaSource.layer.gridState.viewportTiles;for(const e of i){const i=this._excludeAreaSource.sourceCore.idToIndex[e];i&&(t+=Object.keys(i).length)}e=t>.4*i.size}e&&!this._isHidden&&(this._isHidden=!0,super.getContainer().innerHTML=""),!e&&this._isHidden&&(this._isHidden=!1,super.getContainer().innerHTML=vp(this._copyrightType))}}var bp=i(438),xp={};xp.styleTagTransform=kf(),xp.setAttributes=Af(),xp.insert=Ef().bind(null,"head"),xp.domAPI=If(),xp.insertStyleElement=Cf();Sf()(bp.Z,xp);const wp=bp.Z&&bp.Z.locals?bp.Z.locals:void 0;const Sp=` <div class=${wp.container}>Your MapGL key is invalid. Please contact api@2gis.com to get MapGL key.</div> `;class Mp extends class{constructor(e,t){this.rootContainer=e._impl.modules.layout.rootContainer,this.content=t,this.isShown=!1}display(){this.isShown||(this.wrap||(this.wrap=this.initWrap()),this.rootContainer.appendChild(this.wrap),this.isShown=!0)}hide(){this.isShown&&(this.wrap&&this.rootContainer.removeChild(this.wrap),this.isShown=!1)}isDisplayed(){return this.isShown}}{constructor(e){super(e,Sp),e._impl.on("error",(e=>{"invalidtilekey"===e.type&&(this.isDisplayed()||this.display())}))}initWrap(){const e=document.createElement("div");return e.classList.add(`${wp.wrap}`),e.innerHTML=this.content,e}}class Ip{constructor(e){this.northEast=e.northEast,this.southWest=e.southWest}extend(e){return this.southWest=[Math.min(this.southWest[0],e[0]),Math.min(this.southWest[1],e[1])],this.northEast=[Math.max(this.northEast[0],e[0]),Math.max(this.northEast[1],e[1])],this}getCenter(){return[(this.southWest[0]+this.northEast[0])/2,(this.southWest[1]+this.northEast[1])/2]}containsPoint(e){const[t,i]=e,n=t>=this.southWest[0]&&t<=this.northEast[0],o=i>=this.southWest[1]&&i<=this.northEast[1];return n&&o}containsBounds(e){const{southWest:t,northEast:i}=e,n=this.containsPoint(t),o=this.containsPoint(i);return n&&o}intersects(e){const{southWest:t,northEast:i}=e,n=this.getPointRelatedLocation(t),o=this.getPointRelatedLocation(i),r=+n.N+ +o.N,s=+n.S+ +o.S,a=+n.W+ +o.W,l=+n.E+ +o.E;return 2!==r&&2!==s&&2!==a&&2!==l}getPointRelatedLocation(e){return{S:e[1]<this.southWest[1],N:e[1]>this.northEast[1],W:e[0]<this.southWest[0],E:e[0]>this.northEast[0]}}}var Tp=i(1704),Ep={};Ep.styleTagTransform=kf(),Ep.setAttributes=Af(),Ep.insert=Ef().bind(null,"head"),Ep.domAPI=If(),Ep.insertStyleElement=Cf();Sf()(Tp.Z,Ep);const Pp=Tp.Z&&Tp.Z.locals?Tp.Z.locals:void 0,Ap=`\n    <div class="${Pp.root}">\n        <div class="${Pp.container}">\n            <div class="${Pp.scroller}">\n                <div class="${Pp.content}" />\n            </div>\n        </div>\n    </div>\n`;class Lp extends np{constructor(e,t){super(e,Ap,t),this._removeButtonsEventListeners=()=>{this._content&&this._content.childNodes.forEach((e=>{if(this._handlers.has(e)){const t=this._handlers.get(e);void 0!==t&&e.removeEventListener("click",t)}}))},this._showControl=e=>{const{currentFloor:t,id:i,floorNames:n,metro:o,mode:r}=e;this._floor={mode:r,currentFloorLevelIndex:t,floorPlanId:i,floorNames:n,metro:o},this._root.style.display="block",this._renderControl()},this._hideControl=()=>{this._map._impl.state.floorsEnabled&&(this._removeButtonsEventListeners(),this._floor=void 0,this._root.style.display="none")},this._onLevelChange=e=>{this._switchCurrentFloorLevel(e.floorLevelIndex)},this._controlHandler=e=>t=>{t.preventDefault(),this._switchCurrentFloorLevel(e),this._floor&&this._map._impl.changeFloorNumber(this._floor.floorPlanId,e)},this._map=e,this._root=this._wrap.querySelector(`.${Pp.root}`),this._content=this._wrap.querySelector(`.${Pp.content}`),this._handlers=new WeakMap,this._root.style.display="none",this._map._impl.on("floorcomplexin",this._showControl),this._map._impl.on("floorcomplexout",this._hideControl),this._map.on("floorlevelchange",this._onLevelChange)}destroy(){this._map._impl.off("floorcomplexin",this._showControl),this._map._impl.off("floorcomplexout",this._hideControl),this._map.off("floorlevelchange",this._onLevelChange),this._removeButtonsEventListeners(),super.destroy()}_renderControl(){var e;if(!this._floor)return;let t;if(this._content.innerHTML="",this._floor.metro){const e=document.createElement("button");e.className=`${Pp.control} ${Pp.hideFloorsButton}`,e.innerHTML='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20px" height="20px" viewBox="337.5 232.3 125 85.9" xml:space="preserve">\n<polygon fill="#FF0013" points="453.9,306.2 424.7,232.3 400,275.5 375.4,232.3 346.1,306.2 337.5,306.2 337.5,317.4 381.7,317.4 381.7,306.2 375.1,306.2 381.5,287.8 400,318.2 418.5,287.8 424.9,306.2 418.3,306.2 418.3,317.4 462.5,317.4 462.5,306.2 "/>\n</svg>',e.name="metro",e.type="button";const i=this._controlHandler("metro");e.addEventListener("click",i),this._handlers.set(e,i),this._content.append(e),"metro"===this._floor.mode&&(e.disabled=!0,t=e)}this._floor.floorNames.forEach(((e,i)=>{const n=document.createElement("button");n.className=Pp.control,n.innerHTML=`<div class="${Pp.label}">${e}</div>`,n.name=i.toLocaleString(),n.type="button",this._floor&&"floor"===this._floor.mode&&this._floor.currentFloorLevelIndex===i&&(n.disabled=!0,t=n);const o=this._controlHandler(i);n.addEventListener("click",o),this._handlers.set(n,o),this._content.append(n)}));const i=document.createElement("button");i.className=`${Pp.control} ${Pp.hideFloorsButton}`,i.innerHTML=`<div class="${Pp.label}"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1142 14.1859L23.2303 9.29482L18.0571 1.2998L5.55708 5.01563L5.56217 5.04408L0.599976 10.0063L1.95007 11.3564L5.59996 7.70647L6.39699 6.90943L7.09339 7.79575L12.1142 14.1859ZM21.8071 12.1061L15.1198 15.0485L12.8071 16.1326V22.6321L21.8071 18.4131V12.1061ZM6.21714 9.91771L3.21617 12.9187V18.8564L5.50707 19.9405V14.9136L8.00707 15.9136V21.1236L10.8071 22.4487V15.7594L6.21714 9.91771Z" fill="#0059D6"/>\n</svg></div>`,i.name="building",i.type="button",this._floor&&"building"===this._floor.mode&&(i.disabled=!0,t=i);const n=this._controlHandler("building");if(i.addEventListener("click",n),this._handlers.set(i,n),this._content.append(i),t&&t.offsetTop){const i=null===(e=t.parentElement)||void 0===e?void 0:e.parentElement;i&&(i.scrollTop=t.offsetTop)}}_switchCurrentFloorLevel(e){if(!this._floor)return;const t="floor"===this._floor.mode?this._floor.currentFloorLevelIndex:"building"===this._floor.mode?"building":"metro",i=this._wrap.querySelector(`.${Pp.control}[name="${t}"]`);i&&(i.disabled=!1);const n=this._wrap.querySelector(`.${Pp.control}[name="${e}"]`);n&&(n.disabled=!0),"number"==typeof e?(this._floor.mode="floor",this._floor.currentFloorLevelIndex=e):this._floor.mode=e}}var Cp=i(3274),zp={};zp.styleTagTransform=kf(),zp.setAttributes=Af(),zp.insert=Ef().bind(null,"head"),zp.domAPI=If(),zp.insertStyleElement=Cf();Sf()(Cp.Z,zp);const kp=Cp.Z&&Cp.Z.locals?Cp.Z.locals:void 0;class Op{constructor(e,t){this.wrap=document.createElement("div"),this.wrap.className=kp.controlPane,this.containers={};const{rootContainer:i}=e._impl.modules.layout;i.appendChild(this.wrap),this.padding={top:10,right:10,bottom:10,left:10},this.setPadding(t.padding||{})}setPadding(e){Object.keys(this.padding).forEach((t=>{var i;const n=t;this.padding[n]=null!==(i=e[n])&&void 0!==i?i:10,this.wrap.style[`margin${n.replace(/^\w/,(e=>e.toUpperCase()))}`]=`${this.padding[n]}px`}))}getPadding(){return Object.assign({},this.padding)}destroy(){this.wrap.remove()}getContainerByPosition(e){let t=this.containers[e];return t||(t=this.containers[e]=this._initControlContainer(e)),t}_initControlContainer(e){const t=document.createElement("div");return t.classList.add(kp.container,kp[e]),this.wrap.appendChild(t),t}}var Rp=i(6032),Fp={};Fp.styleTagTransform=kf(),Fp.setAttributes=Af(),Fp.insert=Ef().bind(null,"head"),Fp.domAPI=If(),Fp.insertStyleElement=Cf();Sf()(Rp.Z,Fp);const Bp=Rp.Z&&Rp.Z.locals?Rp.Z.locals:void 0,Dp={en:"m",ru:"м"},jp={en:"km",ru:"км"};class Np extends np{constructor(e,t){super(e,"",t),this._render=()=>{const{state:e}=this._map._impl,t=!!e.styleState.globeEnabled&&e.zoom<T.globeConfig.globeMaxZoom;if(this._wrap.hidden=t,t)return;const i=this._wrap.getBoundingClientRect(),n=this._calcSize([i.x,i.y],i.width||66,0),o=`\n            <div class="${Bp.root}">\n                <div class="${Bp.label}">\n                    ${function(e,t){if(e<1e3)return`${e} ${Dp[t]||Dp.en}`;return`${(e/1e3).toFixed(1)} ${jp[t]||jp.en}`}(n,this._map.getLanguage())}\n                </div>\n            </div>\n        `;this._wrap.innerHTML=o},this._map=e,this._render(),e.on("zoom",this._render),e.on("pitch",this._render),e.on("changeLanguage",this._render),e.on("move",this._render),e.on("resize",this._render)}destroy(){this._map.off("zoom",this._render),this._map.off("pitch",this._render),this._map.off("changeLanguage",this._render),this._map.off("move",this._render),this._map.off("resize",this._render),super.destroy()}_calcSize(e,t,i){return L.$X(this._map.getCenter(),this._map.getZoom(),this._map.getRotation(),this._map.getSize(),this._map.getPitch(),e,void 0,this._map.getPadding(),t,i)}}class Up{constructor(e){this._impl=e._impl.getDefaultSource()}setFeatureStateMap(e){this._impl.setFeatureStateMap(e)}}function Hp(e,t){const i=Object.assign({},e);for(const e in t){const n=e;void 0===i[n]&&(i[n]=t[n])}return i}const Gp={center:[0,0],zoom:0,minZoom:Nf,maxZoom:Uf,rotation:0,touchRotationThreshold:10,pitch:0,minPitch:0,maxPitch:45,lowZoomMaxPitch:45,viewport:{top:0,right:0,bottom:0,left:0},padding:{top:0,right:0,bottom:0,left:0},style:"",lang:"en",iconIdentifyOpacity:.3,disableHidingPois:!1,disableHoverStyles:!1,disableZoomOnScroll:!1,disableDragging:!1,enableTwoFingerDragging:!1,disableRotationByUserInteraction:!1,disablePitchByUserInteraction:!1,defaultBackgroundColor:"#f6f2de",disableIconCache:!1,mobileSdkMode:!1,skipElevationAnimation:!1,enableTrackResize:!1,showDefaultTileBounds:!1,immersiveOn:!1,pitchHightLimitation:90,loopWorld:!1,cityCommPoiLabelingConfig:T.cityCommPoiLabelingConfig,disableRenderingCache:!1,disableStyleFallback:!1,fontUrl:"",modelUrl:"",iconUrl:"",keyUrl:"",disableModelsGrowthAnimation:!1,disableLayerAnimation:!1,trafficOn:!1,allowMetro:!1};class Vp extends gu{constructor(e,t){var i;let n;if(super(),"string"==typeof e){const t=document.getElementById(e);if(!t)throw new Error(`Could not found html element with id: ${e}`);n=t}else n=e;const o=Object.assign({},t.styleOptions),r=Hp(this._validateOptions(t),Gp),s=Object.assign(Object.assign({},r),{disableHoverStyles:null===(i=t.disableHoverStyles)||void 0===i||i,tileServer:t.tileServer||"tile{subdomain}-sdk.maps.2gis.com",style:t.style||G.iC,styleOptions:o,styleState:t.styleState,sessionId:Gf(),tileSessionId:t.tileSessionId});this._impl=new u_(n,s),this._impl.on("idle",(e=>this._emitMapEvent("idle",e))).on("ready",(e=>this._emitMapEvent("ready",e))).on("resize",(e=>this._emitMapEvent("resize",e))).on("move",(e=>this._emitMapEvent("move",e))).on("movestart",(e=>this._emitMapEvent("movestart",e))).on("moveend",(e=>this._emitMapEvent("moveend",e))).on("center",(e=>this._emitMapEvent("center",e))).on("centerstart",(e=>this._emitMapEvent("centerstart",e))).on("centerend",(e=>this._emitMapEvent("centerend",e))).on("zoom",(e=>this._emitMapEvent("zoom",e))).on("zoomstart",(e=>this._emitMapEvent("zoomstart",e))).on("zoomend",(e=>this._emitMapEvent("zoomend",e))).on("rotation",(e=>this._emitMapEvent("rotation",e))).on("rotationstart",(e=>this._emitMapEvent("rotationstart",e))).on("rotationend",(e=>this._emitMapEvent("rotationend",e))).on("pitch",(e=>this._emitMapEvent("pitch",e))).on("pitchstart",(e=>this._emitMapEvent("pitchstart",e))).on("pitchend",(e=>this._emitMapEvent("pitchend",e))).on("trafficshow",(()=>this.emit("trafficshow"))).on("traffichide",(()=>this.emit("traffichide"))).on("floorcomplexshow",(({id:e,currentFloor:t,floorNames:i})=>this.emit("floorplanshow",{floorPlanId:e,currentFloorLevelIndex:t,floorLevels:i.map(((e,t)=>({floorLevelIndex:t,floorLevelName:e})))}))).on("floorcomplexhide",(e=>this.emit("floorplanhide",{floorPlanId:e.id}))).on("floorcomplexlevelchange",(e=>this.emit("floorlevelchange",{floorLevelName:e.floorName,floorLevelIndex:e.floorIndex,floorPlanId:e.id}))).on("floorsactivegroupchange",(e=>this.emit("floorsactivegroupchange",e))).on("modelshow",(e=>this.emit("modelshow",e))).on("modelhide",(e=>this.emit("modelhide",e))),this._impl.on("click",(e=>this._emitMapPointerEvent("click",e))).on("dblclick",(e=>this._emitMapPointerEvent("dblclick",e))).on("contextmenu",(e=>this._emitMapPointerEvent("contextmenu",e))).on("mousemove",(e=>this._emitMapPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitMapPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitMapPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitMapPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitMapPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitMapPointerEvent("touchstart",e))).on("touchend",(e=>this._emitMapPointerEvent("touchend",e))),this._impl.on("error",(e=>this._emitMapErrorEvent("error",e))),this._impl.on("trafficscore",(({score:e})=>this.emit("trafficscore",{score:e}))),this._impl.on("styleload",(({style:e})=>this.emit("styleload",{style:e}))),this._impl.on("graphicspresetchange",(()=>this.emit("graphicspresetchange",this._impl.getCurrentGraphicsPreset()))),this._controlPane=new Op(this,{padding:t.controlsLayoutPadding}),this._initControls(t),new Mp(this),this._defaultSource=new Up(this)}setCenter(e,t){return this._impl.setCenter(e,t),this}getCenter(){return this._impl.getCenter()}setZoom(e,t){return this._impl.setZoom(e,t),this}getZoom(){return this._impl.getZoom()}getStyleZoom(){return this._impl.getStyleZoom()}setStyleZoom(e,t){return this._impl.setStyleZoom(e,t),this}setRotation(e,t){return this._impl.setRotation(e,t),this}getRotation(){return this._impl.getRotation()}setPitch(e,t){return this._impl.setPitch(e,t),this}getPitch(){return this._impl.getPitch()}setMinZoom(e,t){return this._impl.setMinZoom(e,t),this}getMinZoom(){return this._impl.getMinZoom()}getMaxZoom(){return this._impl.getMaxZoom()}setMaxZoom(e,t){return this._impl.setMaxZoom(e,t),this}setMinPitch(e,t){return this._impl.setMinPitch(e,t),this}setMaxPitch(e,t){return this._impl.setMaxPitch(e,t),this}setLowZoomMaxPitch(e,t){return this._impl.setLowZoomMaxPitch(e,t),this}getSize(){return this._impl.getSize()}isIdle(){return this._impl.isIdle()}getBounds(e){return new Ip(this._impl.getBounds(e))}project(e){return this._impl.project(e)}unproject(e){return this._impl.unproject(e)}getProjectionMatrix(){return this._impl.getCameraViewProjectionMatrix().slice()}getProjectionMatrixForGltfPlugin(){return this._impl.getCameraProjectionMatrix().slice()}getWebGLContext(){return this._impl.getWebGLContext()}getCanvas(){return this._impl.getCanvas()}getContainer(){return this._impl.getExternalContainer()}invalidateSize(){return this._impl.invalidateSize(),this}showTraffic(){return this._impl.showTraffic(),this}hideTraffic(){return this._impl.hideTraffic(),this}isTrafficOn(){return this._impl.isTrafficOn()}setSelectedObjects(e=[],t){return this._impl.setSelectedIds(e,t),this}setStyleById(e){return(0,I.mG)(this,void 0,void 0,(function*(){return this._impl.setStyle(e)}))}setStyleFromUrl(e,t){return(0,I.mG)(this,void 0,void 0,(function*(){return this._impl.setStyle(e,t)}))}setLanguage(e){return this._impl.setLang(e),this.emit("changeLanguage",{lang:e}),this}getLanguage(){return this._impl.state.lang}setFloorPlanLevel(e,t){this._impl.changeFloorNumber(e,t)}setMaxBounds(e){return this._impl.setMaxBounds(e),this}getPadding(){return this._impl.getPadding()}getDefaultSource(){return this._defaultSource}setPadding(e,t){return this._impl.setPadding(e,t),this}setStyle(e,t){return this._impl.setStyle(e,t)}hasLayer(e){return this._impl.hasLayer(e)}addLayer(e,t){return this._impl.addLayer(e,t),this}addIcon(e,t){return this._impl.addIcon(e,t),this}removeIcon(e){return this._impl.removeIcon(e),this}getMapRenderStat(){return this._impl.getMapRenderStat()}addModel(e,t){return this._impl.addModel(e,t),this}removeLayer(e){return this._impl.removeLayer(e),this}setAutoHoverMode(e){return this._impl.setAutoHoverMode(e),this}fitBounds(e,t){return this._impl.fitBounds(e,t),this}setStyleState(e){return this._impl.setStyleState(e),this}setTime(e){this._impl.setTime(e)}getTime(e){return this._impl.getTime(e)}getStyleState(){return this._impl.getStyleState()}setStyleOptions(e){return this._impl.patchStyleState({trafficOn:e.traffic}),this}setOption(e,t){return this._impl.setOption(e,t),this}getOption(e){return this._impl.getOption(e)}patchStyleState(e){return this._impl.patchStyleState(e),this}destroy(){this._controlPane.destroy(),this._impl.destroy(),this.emit("destroy")}triggerRerender(){this._impl.modules.renderer.addRerenderEvent({type:"triggerRerender"})}setControlsLayoutPadding(e){this._controlPane.setPadding(e)}getControlsLayoutPadding(){return this._controlPane.getPadding()}setHiddenObjects(e){this._impl.hideBuildingsById(e)}setEnvironmentParams(e){this._impl.modules.environmentManager.setParameters(e)}unsetHiddenObjects(e){this._impl.showHiddenBuildingsById(e)}showLabelsDebug(e){this._impl.showLabelsDebug(e)}hideLabelsDebug(){this._impl.hideLabelsDebug()}getGroundPoint(e){return this._impl.getGroundPoint(e)}setAllowedFloorIds(e){this._impl.setAllowedFloorIds(e)}setLightingStyle(e){this._impl.setLightingStyle(e)}hideLayers(e){return this._impl.hideLayers(e),this}showLayers(e){return this._impl.showLayers(e),this}getGraphicsPreset(){return this._impl.getCurrentGraphicsPreset().preset}blockInteraction(){this._impl.modules.handler.block(),this._impl.core.handlers.forEach((e=>{e.block()})),this._impl.modules.mouseMoveHandler.block()}unblockInteraction(){this._impl.modules.handler.unblock(),this._impl.core.handlers.forEach((e=>{e.unblock()})),this._impl.modules.mouseMoveHandler.unblock()}_emitMapEvent(e,t){this.emit(e,{isUser:t.isUser})}_emitMapErrorEvent(e,t){switch(t.type){case"rasterTileLoadError":{const{tileCoords:i,tileUrl:n,source:o,responseMessage:r,responseStatus:s}=t;if("raster"===(null==o?void 0:o.type)){const a=o.mapglApiSource;this.emit(e,{type:t.type,responseMessage:r,responseStatus:s,tileUrl:n,tileCoords:[i[0],i[1],i[2]],source:a})}break}case"webglcontextlost":case"invalidtilekey":this.emit(e,{type:t.type});break;case"styleloaderror":this.emit("styleloaderror",{style:t.style}),this.emit(e,{type:t.type,style:t.style});break;default:Cs(t)}}_emitMapPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o,target:r,targetData:s}=t;let a,l;if(void 0!==s)switch(s.type){case"geojson":a={type:s.type,source:s.source.mapglApiSource,feature:s.feature,id:s.id,layerId:s.layerId};break;case"zenith":a={type:s.type,id:s.id,source:s.source.mapglApiSource,attributes:s.attributes,layerId:s.layerId};break;case"default":{a={type:s.type,id:s.id,layerId:s.layerId};const{floorId:e}=s;e&&(a.floorId=e);break}}void 0!==r&&(l={id:r.id},r.center&&(l.center=r.center)),this.emit(e,{originalEvent:i,lngLat:n,point:o,target:l,targetData:a})}_initControls(e){if(!1!==e.copyright&&this._impl.modules.tileKeyInfo.getKeyInfo().then((t=>{t.error||t.hideCopyright||new yp(this,{position:"string"==typeof e.copyright?e.copyright:"bottomRight",interactive:e.interactiveCopyright,copyrightType:t.urbi?"Urbi":"2gis"})})),!1!==e.zoomControl){const t="string"==typeof e.zoomControl?e.zoomControl:"topRight";new lp(this,{position:t})}if(e.trafficControl){const t="string"==typeof e.trafficControl?e.trafficControl:"topRight";new hp(this,{position:t})}if(e.scaleControl){const t="string"==typeof e.scaleControl?e.scaleControl:"bottomLeft";new Np(this,{position:t})}if(e.floorControl){const t="string"==typeof e.floorControl?e.floorControl:"topRight";new Lp(this,{position:t})}}_validateOptions(e){return"object"==typeof(e=Object.assign({},e))&&"center"in e&&(i_.isValidGeoPoint(e.center,e_.UseDefault)||(e.center=void 0)),e}}const Zp={minZoom:-1/0,maxZoom:1/0,anchor:[.5,.5],offset:[0,18],relativeAnchor:[.5,.5],zIndex:0,lineHeight:1.2,letterSpacing:0,haloRadius:0,fontSize:18,color:"#000000",haloColor:"#ffffff"},Wp={minZoom:-1/0,maxZoom:1/0,zIndex:0,icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzBweCIgaGVpZ2h0PSI0OHB4IiB2aWV3Qm94PSIwIDAgMzAgNDgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA1MS4yICg1NzUxOSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+PHRpdGxlPlBhZ2UgMSBDb3B5PC90aXRsZT48ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz48ZGVmcz48bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjUwJSIgeDI9IjUwJSIgeTI9IjAlIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+PHN0b3Agc3RvcC1jb2xvcj0iIzFCODlFRSIgb2Zmc2V0PSIwJSI+PC9zdG9wPjxzdG9wIHN0b3AtY29sb3I9IiMzMTk4RUMiIG9mZnNldD0iMTAwJSI+PC9zdG9wPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGlkPSJSZWNvdmVyeS0wMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTgzOS4wMDAwMDAsIC00MjUuMDAwMDAwKSI+PGcgaWQ9IlBhZ2UtMS1Db3B5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4MzkuMDAwMDAwLCA0MjUuMDAwMDAwKSI+PGVsbGlwc2UgaWQ9Ik92YWwtMyIgZmlsbD0iIzAwMDAwMCIgb3BhY2l0eT0iMC4wMzYzODA1OTciIGN4PSIxNSIgY3k9IjQ1LjUiIHJ4PSIzIiByeT0iMS41Ij48L2VsbGlwc2U+PGVsbGlwc2UgaWQ9Ik92YWwtMy1Db3B5IiBmaWxsPSIjMDAwMDAwIiBvcGFjaXR5PSIwLjAzNjM4MDU5NyIgY3g9IjE1IiBjeT0iNDUuNSIgcng9IjQuNSIgcnk9IjIuNSI+PC9lbGxpcHNlPjxwYXRoIGQ9Ik0xNSw0NS44ODM2MzUzIEwxNS44ODIzNTI5LDQ1Ljg4MzYzNTMgQzE1Ljg4MjM1MjksMjkuMjE3NzUyOSAyMC43NzY3NjQ3LDIzLjc5NzQ1ODggMjcuOTg3MzUyOSwyMy43OTc0NTg4IEwyOC4zMjk3MDU5LDIzLjc5NzQ1ODggQzI5LjA3Nzk0MTIsMjEuNTkwNjk0MSAzMCwxNy45OTE1NzY1IDMwLDE1LjAwMDQgQzMwLDcuMTQzOTI5NDEgMjMuNzY3OTQxMiwwLjAwMDQgMTUsMC4wMDA0IEM2LjIzMjA1ODgyLDAuMDAwNCAwLDcuMTQzOTI5NDEgMCwxNS4wMDA0IEMwLDE3Ljk5MTU3NjUgMC45MjIwNTg4MjQsMjEuNTkwNjk0MSAxLjY3MDI5NDEyLDIzLjc5NzQ1ODggTDIuMDEyNjQ3MDYsMjMuNzk3NDU4OCBDOS4yMjQxMTc2NSwyMy43OTc0NTg4IDE0LjExNzY0NzEsMjkuMjE3NzUyOSAxNC4xMTc2NDcxLDQ1Ljg4MzYzNTMgTDE1LDQ1Ljg4MzYzNTMgWiIgaWQ9IkZpbGwtMSIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSI+PC9wYXRoPjwvZz48L2c+PC9nPjwvc3ZnPg==",interactive:!0,hoverSize:[15,43],rotation:0,userData:void 0,opacity:1,hoverOpacity:1};class Xp extends gu{constructor(e,t){super(),t.icon||(t.anchor=[15,46]);const i=Hp(t,Wp);this.userData=i.userData,this.rootOptions={zIndex:i.zIndex,minZoom:i.minZoom,maxZoom:i.maxZoom},this._impl=new G_(e._impl,{coordinates:i.coordinates,icon:i.icon,zIndex:i.zIndex,minZoom:i.minZoom,maxZoom:i.maxZoom,interactive:i.interactive,opacity:i.opacity,hoverOpacity:i.hoverOpacity,label:Kp(this.rootOptions,t.label),anchor:t.anchor,size:t.size,rotation:t.rotation,hoverIcon:t.hoverIcon,hoverSize:t.hoverSize,hoverAnchor:t.hoverAnchor}),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}setIcon({icon:e,anchor:t,size:i,opacity:n}){return this._impl.setIcon({icon:e,anchor:t,size:i,opacity:n}),this}setHoverIcon(e){const t=e?{icon:e.icon,anchor:e.anchor,size:e.size,opacity:e.opacity}:void 0;return this._impl.setHoverIcon(t),this}setRotation(e){return this._impl.setRotation(e),this}getRotation(){return this._impl.getRotation()}setLabel(e){return this._impl.setLabel(Kp(this.rootOptions,e)),this}setCoordinates(e){return this._impl.setCoordinates(e),this}getCoordinates(){return this._impl.getCoordinates()}show(){return this._impl.show(),this}hide(){return this._impl.hide(),this}destroy(){this._impl.destroy()}_emitPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o}=t;this.emit(e,{originalEvent:i,lngLat:n,point:o,targetData:this})}}function Kp(e,t){var i,n,o;if(!t)return;t.minZoom=Math.max(null!==(i=t.minZoom)&&void 0!==i?i:e.minZoom,e.minZoom),t.maxZoom=Math.min(null!==(n=t.maxZoom)&&void 0!==n?n:e.maxZoom,e.maxZoom),t.zIndex=null!==(o=t.zIndex)&&void 0!==o?o:e.zIndex+1e-5;const r=Hp(t,Zp);return void 0===t.offset&&void 0!==t.anchor&&(r.offset=t.anchor.map((e=>-e))),{text:r.text,image:t.image,minZoom:r.minZoom,maxZoom:r.maxZoom,color:r.color,fontSize:r.fontSize,haloRadius:r.haloRadius,haloColor:r.haloColor,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,zIndex:r.zIndex,offset:r.offset,anchor:r.relativeAnchor,font:"Noto_Sans"}}const $p={anchor:[0,0],offset:[0,0],fontSize:24,color:"#000000",haloColor:"#ffffff",haloRadius:0,minZoom:-1/0,maxZoom:1/0,zIndex:0,letterSpacing:0,lineHeight:1.2,relativeAnchor:[.5,.5],userData:void 0,interactive:!1};class qp extends gu{constructor(e,t){super(),this.userData=t.userData;const i=Hp(t,$p);void 0===t.offset&&void 0!==t.anchor&&(i.offset=t.anchor.map((e=>-e))),this._impl=new j_(e._impl,{coordinates:i.coordinates,text:i.text,minZoom:i.minZoom,maxZoom:i.maxZoom,color:i.color,fontSize:i.fontSize,haloRadius:i.haloRadius,haloColor:i.haloColor,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,zIndex:i.zIndex,offset:i.offset,anchor:i.relativeAnchor,labeling:t.labeling,image:t.image,font:"Noto_Sans",interactive:i.interactive}),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}destroy(){this._impl.remove()}show(){return this._impl.show(),this}hide(){return this._impl.hide(),this}setCoordinates(e){return this._impl.setCoordinates(e),this}getCoordinates(){return this._impl.getCoordinates()}_emitPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o}=t;this.emit(e,{originalEvent:i,lngLat:n,point:o,targetData:this})}}const Yp={minZoom:-1/0,maxZoom:1/0,zIndex:0,anchor:[-0,-0],preventMapInteractions:!0,userData:void 0,interactive:!0,disableRounding:!1,labeling:{type:"none"},floorId:""};class Jp{constructor(e,t){this.userData=t.userData;const i=Hp(t,Yp);this._impl=new Vu(e._impl,{coordinates:i.coordinates,html:i.html,offset:[-i.anchor[0],-i.anchor[1]],minZoom:i.minZoom,maxZoom:i.maxZoom,zIndex:i.zIndex,preventMapInteractions:i.preventMapInteractions,interactive:i.interactive,animate:false,disableRounding:i.disableRounding,labeling:i.labeling,floorId:i.floorId})}destroy(){this._impl.destroy()}setCoordinates(e){return this._impl.setPosition(e),this}setAnchor(e){return this._impl.setOffset([-e[0],-e[1]]),this}setContent(e){return this._impl.setContent(e),this}setZIndex(e){return this._impl.setZIndex(e),this}getCoordinates(){return this._impl.getPosition()}getAnchor(){const e=this._impl.getOffset();return[-e[0],-e[1]]}getContent(){return this._impl.getHtmlElement()}getZIndex(){return this._impl.getZIndex()}}const Qp={zIndex:0,minZoom:-1/0,maxZoom:1/0,color:"#3388ff33",strokeColor:"#3388ff",strokeWidth:1,interactive:!0,userData:void 0};class ev extends gu{constructor(e,t){super(),this.userData=t.userData;const i=Hp(t,Qp),n={coordinates:i.coordinates,radius:i.radius,minZoom:i.minZoom,maxZoom:i.maxZoom,interactive:i.interactive,color:i.color,zIndex:i.zIndex,borderWidth:i.strokeWidth,borderColor:i.strokeColor,segments:150,tiers:t.tiers};this._impl=new g_(e._impl,n),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}destroy(){this._impl.remove()}_emitPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o}=t;this.emit(e,{originalEvent:i,lngLat:n,point:o,targetData:this})}}const tv={interactive:!0,maxZoom:1/0,minZoom:-1/0,color:"#ffffff",radius:20,diameter:NaN,zIndex:0,strokeWidth:3,stroke2Width:0,strokeColor:"#3388ff",stroke2Color:"#00000000",userData:void 0};class iv extends gu{constructor(e,t){super(),this.userData=t.userData,this.options=Hp(t,tv);const i={coordinates:this.options.coordinates,interactive:this.options.interactive,maxZoom:this.options.maxZoom,minZoom:this.options.minZoom,color:this.options.color,width:Number.isNaN(this.options.diameter)?this.options.radius:this.options.diameter,zIndex:this.options.zIndex,borderWidth:this.options.strokeWidth,borderColor:this.options.strokeColor,border2Width:this.options.stroke2Width,border2Color:this.options.stroke2Color,draggable:!1};this._impl=new ie(e._impl,i),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}destroy(){this._impl.remove()}_emitPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o}=t;this.emit(e,{originalEvent:i,lngLat:n,point:o,targetData:this})}}const nv={interactive:!0,maxZoom:1/0,minZoom:-1/0,width:3,width2:0,width3:0,color:"#3388ff",color2:"#00000000",color3:"#00000000",zIndex:0,zIndex2:-1,zIndex3:-2,dashLength:0,gapLength:0,gapColor:"#ffffff00",userData:void 0,renderingMode:"2d"};class ov extends gu{constructor(e,t){super(),this.userData=t.userData;const i=Hp(t,nv);if(t.dashLength){const n={coordinates:i.coordinates,interactive:i.interactive,maxZoom:i.maxZoom,minZoom:i.minZoom,width:i.width,width2:i.width2,dashColor:i.color,dash2Color:i.color,gapColor:i.gapColor,dashLength:i.dashLength,dash2Length:0,zIndex:i.zIndex,zIndex2:i.zIndex2,gapLength:0===i.gapLength?i.dashLength:i.gapLength,displayTileBounds:!1,showAnimation:{animate:!1},renderingMode:i.renderingMode,hiddenPartDashColor:t.hiddenPartColor,hiddenPartDash2Color:t.hiddenPartColor,hiddenPartGapColor:t.hiddenPartGapColor,gpuState:t.gpuState,tiers:t.tiers};this._impl=new __(e._impl,n),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}else{const n={coordinates:i.coordinates,interactive:i.interactive,maxZoom:i.maxZoom,minZoom:i.minZoom,width:i.width,width2:i.width2,width3:i.width3,color:i.color,color2:i.color2,color3:i.color3,zIndex:i.zIndex,zIndex2:i.zIndex2,zIndex3:i.zIndex3,displayTileBounds:!1,showAnimation:{animate:!1},gpuState:t.gpuState,renderingMode:i.renderingMode,hiddenPartColor:t.hiddenPartColor,tiers:t.tiers};this._impl=new f_(e._impl,n),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}}destroy(){this._impl.remove()}_emitPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o}=t;this.emit(e,{originalEvent:i,lngLat:n,point:o,targetData:this})}}const rv={interactive:!0,maxZoom:1/0,minZoom:-1/0,color:"#3388ff33",zIndex:0,strokeWidth:3,strokeColor:"#3388ff",userData:void 0};class sv extends gu{constructor(e,t){super(),this.userData=t.userData;const i=Hp(t,rv),n={coordinates:i.coordinates,interactive:i.interactive,maxZoom:i.maxZoom,minZoom:i.minZoom,color:i.color,zIndex:i.zIndex,strokeWidth:i.strokeWidth,strokeColor:i.strokeColor,tiers:t.tiers};this._impl=new v_(e._impl,n),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e)))}destroy(){this._impl.remove()}_emitPointerEvent(e,t){const{originalEvent:i,lngLat:n,point:o}=t;this.emit(e,{originalEvent:i,lngLat:n,point:o,targetData:this})}}const av={minZoom:-1/0,maxZoom:1/0,zIndex:0,opacity:1};class lv{constructor(e,t){const i=Hp(t,av),n={bounds:i.bounds,image:{url:i.image.url},minZoom:i.minZoom,maxZoom:i.maxZoom,zIndex:i.zIndex,opacity:i.opacity,tiers:t.tiers};this._impl=new q_(e._impl,n)}updateImage(e){return(0,I.mG)(this,void 0,void 0,(function*(){yield this._impl.updateImage(e)}))}destroy(){this._impl.destroy()}}const dv={scale:1,rotation:0,offset:0,linkedIds:[],interactive:!1,interactiveOcclusion:!0,minZoom:-1/0,maxZoom:1/0,zIndex:0,hideOnInit:!1,ignoreGlobalLighting:!1,colorTextureUvIndex:0,nearCameraFade:2500,showRatio:1,userData:void 0,planId:"",disableAnimation:!1,hover:{},select:{},color:"#ffffffff",playAnimation:-1};class cv extends gu{constructor(e,t){super(),this.userData=t.userData;const i=Hp(t,dv),n={coordinates:i.coordinates,modelSrc:i.modelSrc,scale:i.scale,rotation:i.rotation,offset:i.offset,linkedIds:i.linkedIds,planId:i.planId,interactive:i.interactive,interactiveOcclusion:i.interactiveOcclusion,minZoom:i.minZoom,maxZoom:i.maxZoom,zIndex:i.zIndex,hideOnInit:i.hideOnInit,ignoreGlobalLighting:i.ignoreGlobalLighting,colorTextureUvIndex:i.colorTextureUvIndex,nearCameraFade:i.nearCameraFade,showRatio:i.showRatio,disableAnimation:i.disableAnimation,hover:i.hover,select:i.select,color:i.color,playAnimation:i.playAnimation,throttledIdentifierUpdate:i.throttledIdentifierUpdate};this._impl=new Bm(e._impl,n),this._impl.on("click",(e=>this._emitPointerEvent("click",e))).on("dblclick",(e=>this._emitPointerEvent("dblclick",e))).on("mousemove",(e=>this._emitPointerEvent("mousemove",e))).on("mouseover",(e=>this._emitPointerEvent("mouseover",e))).on("mouseout",(e=>this._emitPointerEvent("mouseout",e))).on("mousedown",(e=>this._emitPointerEvent("mousedown",e))).on("mouseup",(e=>this._emitPointerEvent("mouseup",e))).on("touchstart",(e=>this._emitPointerEvent("touchstart",e))).on("touchend",(e=>this._emitPointerEvent("touchend",e))).on("modelloaded",(()=>this._emitPointerEvent("modelloaded")))}destroy(e){this._impl.destroy(e)}hide(){this._impl.hide()}show(){this._impl.show()}transform(e){this._impl.transform(e)}stopTransformation(){this._impl.stopTransformation()}getCoordinates(){return this._impl.getCoordinates()}getScale(){return this._impl.getScale()}getRotation(){return this._impl.getRotation()}getOffset(){return this._impl.getOffset()}setState(e){this._impl.setState(e)}_emitPointerEvent(e,t){this.emit(e,t?{originalEvent:t.originalEvent,lngLat:t.lngLat,point:t.point,targetData:this}:void 0)}}const uv={attributes:{},maxZoom:17,dimensions:2,modelsPath:"",modelsAppearStrategy:"byModel",promoteId:"",idScope:"default",tolerance:3};class hv{constructor(e,t){this.options=Hp(t,uv),this._impl=new j.gs(e._impl,this.options,this),this._isDestroyed=!1}destroy(){this._isDestroyed=!0,this._impl.destroy()}setAttributes(e){return this._isDestroyed||this._impl.setAttributes(e),this}getAttributes(){return this._isDestroyed?{}:this._impl.getAttributes()}setData(e){return(0,I.mG)(this,void 0,void 0,(function*(){this._isDestroyed||(yield this._impl.setData(e))}))}}const mv=Object.assign(Object.assign({},uv),{viewportPadding:0});class fv{constructor(e,t){this.options=Hp(t,mv);const i=Object.assign(Object.assign({},this.options),{data:j.pl});this._impl=new j.T0(e._impl,i,this),this._impl.setDataFn(t.data),this._impl.setViewportPadding(this.options.viewportPadding)}destroy(){this._impl.destroy()}setAttributes(e){return this._impl.setAttributes(e),this}getAttributes(){return this._impl.getAttributes()}setData(e){return(0,I.mG)(this,void 0,void 0,(function*(){return this._impl.setDataFn(e)}))}setViewportPadding(e){return this._impl.setViewportPadding(e),this}}var _v=i(3103),pv={};pv.styleTagTransform=kf(),pv.setAttributes=Af(),pv.insert=Ef().bind(null,"head"),pv.domAPI=If(),pv.insertStyleElement=Cf();Sf()(_v.Z,pv);const vv=_v.Z&&_v.Z.locals?_v.Z.locals:void 0;class gv extends np{constructor(e,t){super(e,(e=>`\n    <div class=${vv.container}>\n        <div class=${vv.text}>${e}</div>\n    </div>\n`)(t),{position:"bottomLeft"})}}const yv={attributes:{},attribution:"",minZoom:Nf,maxZoom:Uf};class bv{constructor(e,t){this.options=Hp(t,yv),this._impl=new J_(e._impl,this.options,this),this._attribution=new gv(e,this.options.attribution)}destroy(){this._impl.destroy(),this._attribution.destroy()}setAttributes(e){return this._impl.setAttributes(e),this}getAttributes(){return this._impl.getAttributes()}}class xv{constructor(e,t){this.options=t;const i=this.prepareOptions(this.options,e);this._impl=new V(e._impl,i,this)}destroy(){this._impl.destroy()}setAttributes(e){return this._impl.setAttributes(e),this}getAttributes(){return this._impl.getAttributes()}setFeatureStateMap(e){this._impl.setFeatureStateMap(e)}prepareOptions(e,t){var i,n,o,r,s,a,l,d,c,u;const h={tileServer:null!==(i=e.tileServer)&&void 0!==i?i:"",tileSet:null!==(n=e.tileSet)&&void 0!==n?n:"",tileProtocol:null!==(o=e.tileProtocol)&&void 0!==o?o:"",tileKey:null!==(r=e.tileKey)&&void 0!==r?r:"",subdomains:null!==(s=e.subdomains)&&void 0!==s?s:e.layerId?["0,1,2,3"]:[""],appId:null!==(a=e.appId)&&void 0!==a?a:t._impl.state.appId,tileTemplateUrl:e.tileTemplateUrl,metatileTemplateUrl:e.metatileTemplateUrl,defaultLang:e.defaultLang,sessionId:e.sessionId,sourceAttributes:e.sourceAttributes,modelsPath:e.modelsPath,disableTilesAnimation:e.disableTilesAnimation,promoteAttributes:e.promoteAttributes,promoteId:e.promoteId,idScope:e.idScope,modelsAppearStrategy:e.modelsAppearStrategy,minZoom:null!==(l=e.minZoom)&&void 0!==l?l:9,maxZoom:null!==(d=e.maxZoom)&&void 0!==d?d:15,maxDetailLevel:null!==(c=e.maxGenerateZoom)&&void 0!==c?c:17,strokeMinZoom:null!==(u=e.strokeMinZoom)&&void 0!==u?u:8};return e.layerId&&(h.tileTemplateUrl||(h.tileTemplateUrl=`${Hf}?ts=userdata&x={x}&y={y}&z={z}&layer=${e.layerId}`),h.metatileTemplateUrl||(h.metatileTemplateUrl=`${Hf}/file/{hash}?ts=userdata&layer=${e.layerId}`)),h}}xv.tileTemplateUrl="{protocol}://{host}/v2/ald?ts={tileSet}&x={x}&y={y}&z={z}&lang={lang}",xv.metatileTemplateUrl="{protocol}://{host}/v2/ald/file/{hash}.json?ts={tileSet}",setTimeout((()=>{const e=Array.from(document.querySelectorAll("script")).find((e=>e.src.match("https://mapgl.2gis.com/api/js")));if(!e)return;const t=function(e){const t=e.split("?")[1];if(!t)return;const i=t.split("&").map((e=>e.split("="))).find((e=>"callback"===e[0]));return i?i[1]:void 0}(e.src);if(t){if("function"!=typeof window[t])throw new Error(`Not found callback function with name "${t}"`);window[t]()}}),0);i(2205);const wv="v1.66.0"},9218:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_MIN_TIERS_STYLE_ZOOM:()=>K,MAP_DEFAULTS:()=>a,atlasSize:()=>m,buildingAnimation:()=>S,cityCommPoiLabelingConfig:()=>E,commercialCitySublayers:()=>j,commercialModelSublayers:()=>H,commercialPoi:()=>d,commercialPremiumSublayers:()=>N,commercialSublayers:()=>U,defaultCameraConfig:()=>z,defaultLang:()=>A,defaultMarkerAnchor:()=>X,defaultMarkerIcon:()=>W,defaultShadowsSettings:()=>$,entranceAnimation:()=>M,events:()=>y,floors:()=>F,fonts:()=>p,globeConfig:()=>k,houseHover:()=>x,icons:()=>v,identify:()=>I,inertia:()=>C,labeling:()=>T,landmarkPoiSublayers:()=>V,landmarkRasterSizes:()=>Z,loadModelsInfoStyleZoom:()=>h,maxZoomForDynamicNear:()=>R,metricsTimeout:()=>D,minCalculationScreenHeight:()=>O,modelCacheSize:()=>u,models:()=>c,performanceCheck:()=>B,personalSublayers:()=>G,render:()=>P,styles:()=>g,tileAnimation:()=>w,tiles:()=>l,traffic:()=>_,urls:()=>f,workerResetInterval:()=>b,zoom:()=>L});var n=i(1e3),o=i(6849),r=i(6273),s=i(9958);const a={minZoom:2,maxZoom:20},l={protocol:n.X?"%TILES_PROTOCOL%":"https",server:o.X,subdomains:"0123",tileSet:n.X?"%TILESET%":"vector_a",tileKey:r.vd,appId:"empty",cacheRatio:2,maxUniverseZoom:8,maxRegionalZoom:15,maxDetailLevel:17},d={minZoom:10,maxZoom:14,tileSet:"com_poi_web",rasterSizes:[96,84,72,60,48,36,24]},c={minZoom:15,maxZoom:15,tileSet:n.X?"%MODELS_TILESET%":"vector_immersive"},u=100,h=13.5,m=[2048,2048],f={tiles:"{protocol}://{host}/vt?r={request}&ts={tileSet}&key={tileKey}&appId={appId}&lang={lang}&default_lang={defaultLang}&s={sessionId}&dt={dt}",metatile:"{protocol}://{host}/metafiles/{hash}/metatile.json?ts={tileSet}",modelInfo:s.env.TEST?`${location.origin}/assets/models/zbm/{regionId}.json`:"{protocol}://{host}/metafiles/{regionId}/models.json?ts={tileSet}",model:s.env.TEST?`${location.origin}/assets/models/zbm/{name}`:"{protocol}://{host}/metafiles/{regionId}/{name}?ts={tileSet}",gltfModel:"{protocol}://{host}/metafiles/{modelSrc}?ts={tileSet}",convertData:"{protocol}://{host}/metafiles/{hash}/convert.json?ts={tileSet}",dynamicPoi:"{protocol}://{host}/metafiles/{regionId}/poi/{id}_{width}_{height}.png?ts={tileSet}",models:"{protocol}://{host}/v2/ald?ts={tileSet}&x={x}&y={y}&z={z}",commercialPoi:"{protocol}://{host}/v2/ald?ts={tileSet}&x={x}&y={y}&z={z}&lang={lang}",floorMeta:"{protocol}://{host}/metafiles/{regionId}/{floorComplexId}.json?ts={tileSet}"},_={protocol:n.X?"%TRAFFIC_PROTOCOL%":"https",host:o._A,url:"{protocol}://{host}/tiles?tls={tiles}&reg={regions}&tm={time}&fmt=json&z={z}",timestampUrl:"{protocol}://{host}/meta?reg={regions}&time&score",updateInterval:12e4,minZoom:10,maxZoom:16,maxDetailLevel:17,fetchMetaRetryDelays:[2,5,25].map((e=>1e3*e))},p={defaultUrl:o.hs,gamma:.08,baseSize:24,baseLineHeight:1.2,bomCharCode:65279},v={defaultUrl:o.R_},g={url:o.k1,path:"styles/{id}"},y={doubleClickTime:185,dragThreshold:2,pitchWaitingTime:200,pitchThreshold:7},b=1e3,x={inAnimationTime:180,inAnimationType:"linear",outAnimationTime:800,outAnimationType:"linear"},w={time:300,type:"linear"},S={minStyleZoom:16,duration:500,easing:"easeOutQuint"},M={bounceType:"easeOutElastic",bounceTime:1200,growType:"easeInOutQuad",growTime:1200,stagger:0,iterationCount:1/0},I={pixelDensity:.5,sceneOpacity:0,cacheDebounceTime:400,cacheThrottleTime:300,pickDistance:3},T={interval:220,animationTime:200,animationType:"linear",tileMultiplier:1.5,axisAngleToleranceDeg:45,axisCheckDistancePx:13,commercialMargins:{default:{topBottom:60,leftRight:60},city:{topBottom:500,leftRight:500}},lineLabelsHidePitchDeg:40,maxLabelLength:30},E={0:T.commercialMargins.city,11:{topBottom:250,leftRight:250},12:{topBottom:170,leftRight:170}},P={alwaysRerender:!1,autoResizeInterval:50},A="en",L={macWheelDeltaToZoomDelta:.0018,notMacTrackpadDeltaToZoomDelta:.0054,wheelZoomDelta:.65,animDuration:400,throttleDelay:100,mouseRotateDelta:2.5,mousePitchDelta:2.5,mobilePinchDelta:1,mobileTapDelta:10},C={duration:1300,maxSpeed:8,minSpeed:.02,nonLinearity:5},z={fov:60*Math.PI/180,useDynamicNearFar:!1,near:1e3,far:Math.pow(2,34),viewportLimitRatio:2.1,minTrapezeHeight:262144,perspectiveDistanceLimitRatio:10,minFogDistance:2e4,pitchInterStartZoom:17,pitchInterEndZoom:19},k={globeMaxZoom:8,globeInterStartZoom:7,globeInterEndZoom:16},O=1e3,R=16,F={enabled:!0,displayStyleZoom:{default:18,metro:16},detailLevel:16,wallMinBrightness:.8265,wallMaxBrightness:.95,viewportPadding:.2,maxStackHeight:40},B={fpsCaveat:10},D=3e4,j=["Commercial_poi_city"],N=["Commercial_poi_premium"],U=["Commercial_poi_default","Commercial_poi_custom","Commercial_poi_navi",...j,...N],H=["Commercial_model"],G=["s_personal_poi"],V=["Landmark_poi","Landmark_point"],Z=[105,84,63,42,21],W="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzBweCIgaGVpZ2h0PSI0OHB4IiB2aWV3Qm94PSIwIDAgMzAgNDgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA1MS4yICg1NzUxOSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+PHRpdGxlPlBhZ2UgMSBDb3B5PC90aXRsZT48ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz48ZGVmcz48bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjUwJSIgeDI9IjUwJSIgeTI9IjAlIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+PHN0b3Agc3RvcC1jb2xvcj0iIzFCODlFRSIgb2Zmc2V0PSIwJSI+PC9zdG9wPjxzdG9wIHN0b3AtY29sb3I9IiMzMTk4RUMiIG9mZnNldD0iMTAwJSI+PC9zdG9wPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGlkPSJSZWNvdmVyeS0wMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTgzOS4wMDAwMDAsIC00MjUuMDAwMDAwKSI+PGcgaWQ9IlBhZ2UtMS1Db3B5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4MzkuMDAwMDAwLCA0MjUuMDAwMDAwKSI+PGVsbGlwc2UgaWQ9Ik92YWwtMyIgZmlsbD0iIzAwMDAwMCIgb3BhY2l0eT0iMC4wMzYzODA1OTciIGN4PSIxNSIgY3k9IjQ1LjUiIHJ4PSIzIiByeT0iMS41Ij48L2VsbGlwc2U+PGVsbGlwc2UgaWQ9Ik92YWwtMy1Db3B5IiBmaWxsPSIjMDAwMDAwIiBvcGFjaXR5PSIwLjAzNjM4MDU5NyIgY3g9IjE1IiBjeT0iNDUuNSIgcng9IjQuNSIgcnk9IjIuNSI+PC9lbGxpcHNlPjxwYXRoIGQ9Ik0xNSw0NS44ODM2MzUzIEwxNS44ODIzNTI5LDQ1Ljg4MzYzNTMgQzE1Ljg4MjM1MjksMjkuMjE3NzUyOSAyMC43NzY3NjQ3LDIzLjc5NzQ1ODggMjcuOTg3MzUyOSwyMy43OTc0NTg4IEwyOC4zMjk3MDU5LDIzLjc5NzQ1ODggQzI5LjA3Nzk0MTIsMjEuNTkwNjk0MSAzMCwxNy45OTE1NzY1IDMwLDE1LjAwMDQgQzMwLDcuMTQzOTI5NDEgMjMuNzY3OTQxMiwwLjAwMDQgMTUsMC4wMDA0IEM2LjIzMjA1ODgyLDAuMDAwNCAwLDcuMTQzOTI5NDEgMCwxNS4wMDA0IEMwLDE3Ljk5MTU3NjUgMC45MjIwNTg4MjQsMjEuNTkwNjk0MSAxLjY3MDI5NDEyLDIzLjc5NzQ1ODggTDIuMDEyNjQ3MDYsMjMuNzk3NDU4OCBDOS4yMjQxMTc2NSwyMy43OTc0NTg4IDE0LjExNzY0NzEsMjkuMjE3NzUyOSAxNC4xMTc2NDcxLDQ1Ljg4MzYzNTMgTDE1LDQ1Ljg4MzYzNTMgWiIgaWQ9IkZpbGwtMSIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSI+PC9wYXRoPjwvZz48L2c+PC9nPjwvc3ZnPg==",X=[15,46],K=16,$={bias:100,textureSize:[2048,2048],shadowRadius:3}},1e3:(e,t,i)=>{"use strict";i.d(t,{X:()=>n});const n=!1},6849:(e,t,i)=>{"use strict";i.d(t,{LP:()=>l,R_:()=>a,X:()=>o,_A:()=>r,aT:()=>h,hs:()=>d,k0:()=>u,k1:()=>s,ns:()=>c,rQ:()=>m});var n=i(1e3);const o=n.X?"%TILESERVER%":"tile{subdomain}.maps.2gis.com",r=n.X?"%TRAFFICSERVER%":"jam.api.2gis.com",s=n.X?"%STYLESERVER%":"https://styles.api.2gis.com",a="https://disk.2gis.com/styles/assets/icons",l="https://disk.2gis.com/styles/assets/models",d="https://mapgl.2gis.com/api/fonts",c=n.X?"%KEYSERVER%":"https://keys.api.2gis.com/public/v1/keys/{keyID}/services/mapgl-js-api",u=n.X?"%RTLPLUGIN%":"https://mapgl.2gis.com/api/js/plugins/rtl-v1.1.1.js",h=n.X?"%RTLPLUGINHASH%":"sha512-IyuCqmcNBfZyrExDMisGi0Xhp4PXupx6AMp4cjpKcAzJo+kSmOtRTLbL1xZsfxnsIqci9Q0piqY+kcwl1hCPyw==",m=n.X?"%DRACOPLUGIN%":"https://mapgl.2gis.com/api/js/plugins/draco_decoder_gltf.js"},6273:(e,t,i)=>{"use strict";i.d(t,{$Q:()=>L,$U:()=>m,Bq:()=>l,CW:()=>x,Cd:()=>S,Fg:()=>T,Fv:()=>g,Gt:()=>_,Jv:()=>E,L2:()=>w,LF:()=>h,Rw:()=>p,Uo:()=>b,_9:()=>a,_H:()=>d,ax:()=>f,bQ:()=>P,ed:()=>r,gL:()=>s,gt:()=>c,iC:()=>M,jO:()=>u,jm:()=>A,on:()=>C,p7:()=>y,sX:()=>o,uC:()=>I,vL:()=>v,vd:()=>z,y4:()=>n});const n=256,o=Math.pow(2,32),r=o/2,s=r/20037508.34,a=Math.pow(2,20),l=Math.pow(2,15),d=Math.pow(2,16)-1,c=l/d,u=16383,h=2.54,m=96,f=o/(n/m*h),_=.7071067811865475,p=4294967295,v=1175494351e-47,g=3402823466e29,y=["Arial","Helvetica","HelveticaNeueCyr","Open_Sans","Open_Sans_Semibold","Open_Sans_Italic","Segoe_UI","PT_Sans_Caption","PT_Sans","Verdana","Verdana_bold","Noto_Sans","Noto_Sans_Semibold","Noto_Sans_Italic","SuisseIntl_Bold"],b="Noto_Sans",x=.5,w=-4,S=2147483647,M="c080bb6a-8134-4993-93a1-5b4d8c36a59b",I=5,T=4,E=40,P=65e3,A="byModel",L=65536,C=512,z="empty"},3249:(e,t,i)=>{"use strict";i.d(t,{FJ:()=>p,fe:()=>u,hX:()=>v,jf:()=>c});var n=i(6479),o=i(7188),r=i(6273),s=i(7464),a=i(4526),l=i(8450),d=i(412);const c=0,u=1,h={type:n.f.Loaded,index:-1,key:(0,s.PR)("",.5,.5),isSvg:!1,name:"",fileName:"",rasters:[]},m=["default","marker","markerText","htmlLabel"],f={default:0,marker:1,markerText:2,htmlLabel:3,pointLabel:4},_={default:{default:!0,marker:!1,markerText:!0,htmlLabel:!0,pointLabel:!1},marker:{default:!1,marker:!1,markerText:!0,htmlLabel:!1,pointLabel:!1},markerText:{default:!0,marker:!0,markerText:!0,htmlLabel:!1,pointLabel:!1},htmlLabel:{default:!0,marker:!1,markerText:!1,htmlLabel:!1,pointLabel:!1},pointLabel:{default:!1,marker:!1,markerText:!1,htmlLabel:!1,pointLabel:!0}};function p(e){const t=[],i=Object.keys(o.Dz).length;for(let e=0;e<i;e++)t[e]=NaN;for(const i in e){if(void 0===o.Dz[i])throw new Error(`No such tile prop '${i}'`);t[o.Dz[i]]=e[i]}return t}class v{constructor(){this.needRenderIndexRebuild=!1,this.style={id:c,revision:0,background:{color:(0,d.MV)("#f6f2de")},light:{defaultLightMode:"global",lightingModes:{}},layers:[],layersById:{},layerIdToInnerId:{},groupsById:{},iconBaseUrl:"",fontUrlTemplate:"",modelsBaseUrl:"",rasterSets:{byIndex:{},byKey:{}},labelingGroups:{indexToGroup:m,groupToIndex:f,table:_},fonts:r.p7,fontNameToIndex:(0,l.PU)(r.p7),icons:{},models:[],modelIndex:{},dem:(0,a.vR)({}),environment:(0,a.kZ)({}),graphicsPresets:{light:{},normal:{},immersive:{}},targets:{}},this.zIndexById={};const e=(0,a.qw)({type:"line",id:"debug-tile-bounds",minzoom:-1/0,maxzoom:1/0,style:{color:"#ff0000",width:1}});e&&this.addLayer(e,0)}get hasDynamicObjects(){return this.style.layers.length>1}getRenderIndexById(e){var t;return(null===(t=this.style.layersById[e])||void 0===t?void 0:t.renderIndex)||0}getStyle(){return this.style}appendRasterSet(e,t){this.style.rasterSets.byIndex[e.index]=e,void 0!==t&&(this.style.rasterSets.byKey[t]=e)}removeRasterSet(e){this.style.rasterSets.byIndex[e]=h}getLabelingGroupIndex(e){const{groupToIndex:t}=this.style.labelingGroups;return void 0!==t[e]?t[e]:t.default}addLayer(e,t){this.style.layersById[e.innerId]||(this.style.layers.push(e),this.style.layersById[e.innerId]=e,void 0!==t&&(this.zIndexById[e.innerId]=t),this.needRenderIndexRebuild=!0)}removeLayer(e){const t=this.style.layersById[e];if(!t)return;const i=this.style.layers.indexOf(t);-1!==i&&this.style.layers.splice(i,1),delete this.style.layersById[e],delete this.zIndexById[e]}updateLayerStyle(e,{style:t,precomputes:i}){const n=this.style.layersById[e];n&&(n.style=t,n.precomputes=i)}update(){this.needRenderIndexRebuild&&(this.rebuildRenderIndex(),this.needRenderIndexRebuild=!1)}rebuildRenderIndex(){this.style.layers.sort(((e,t)=>{var i,n;return(null!==(i=this.zIndexById[e.innerId])&&void 0!==i?i:0)-(null!==(n=this.zIndexById[t.innerId])&&void 0!==n?n:0)}));for(let e=0;e<this.style.layers.length;e++)this.style.layers[e].renderIndex=e}}},7293:(e,t,i)=>{"use strict";i.d(t,{u:()=>o});var n=i(314);function o(e,t){const i=t.precomputes;return e.map(((e,t)=>{const o=i[t];return o&&o.usage===n.Zx.Uniform?e:null}))}},412:(e,t,i)=>{"use strict";i.d(t,{Cj:()=>a,MV:()=>d,RY:()=>l,gC:()=>s,iL:()=>r});var n=i(7464);const o=(0,n.lK)([0,0,0,0]);function r(e){return"string"==typeof e&&/(#(?:[0-9a-f]{2}){2,4}|#[0-9a-f]{3}|(?:rgba?|hsla?)\((?:\d+%?(?:,|\s)+){2,3}[\s\/]*[\d\.]+%?\))/i.test(e)}function s(e){return!!e&&"object"==typeof e&&"color"===e.type}function a(e){return!!e&&"object"==typeof e&&"mix-color"===e.type}function l(e){return!!e&&"object"==typeof e&&"gradient-color"===e.type}function d(e){const t=e.toLowerCase();let i=o;switch(t[0]){case"#":i=function(e){if(!new RegExp(`^#[a-f0-9]{${e.length-1}}$`).test(e)||![4,5,7,9].includes(e.length))return o;const t=function(e){if(e.length<7)return e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(5===e.length?e[4]+e[4]:"ff");if(7===e.length)return e+"ff";return e}(e),i=parseInt(t[1]+t[2],16),r=parseInt(t[3]+t[4],16),s=parseInt(t[5]+t[6],16),a=parseInt(t[7]+t[8],16);return(0,n.lK)([i,r,s,a])}(t);break;case"h":i=function(e){const t=c(e);t[0]/=360,t[1]/=100,t[2]/=100;const[i,o,r]=function(e,t,i){if(0===t)return[255*i,255*i,255*i];const n=i<.5?i*(1+t):i+t-i*t,o=2*i-n;return[255*u(o,n,e+1/3),255*u(o,n,e),255*u(o,n,e-1/3)]}(t[0],t[1],t[2]),s=void 0!==t[3]?255*t[3]:255;return(0,n.lK)([Math.round(i),Math.round(o),Math.round(r),Math.round(s)])}(t);break;case"r":i=function(e){const[t,i,o,r]=c(e),s=void 0!==r?255*r:255;return(0,n.lK)([Math.round(t),Math.round(i),Math.round(o),Math.round(s)])}(t)}return i}function c(e){return e.split("(")[1].split(")")[0].split(",").map((e=>parseFloat(e)))}function u(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}},4526:(e,t,i)=>{"use strict";i.d(t,{Jn:()=>O,vR:()=>D,kZ:()=>j,c$:()=>I,ys:()=>C,XG:()=>N,Wy:()=>k,z8:()=>z,Cp:()=>L,qw:()=>B});var n=i(3024),o=i(412),r=i(3754),s=i(7464),a=i(314),l=i(1284),d=i(6273),c=i(6479),u=i(2543);function h(e){const t=function(e){const t=(e.groups||[]).concat(r.YW.groups).reduce(((e,t)=>(e.includes(t)||e.push(t),e)),[]),i=(e.overlay||[]).concat(r.YW.overlay).concat(t.reduce(((e,t)=>(t===r.T_||t===r.R_||t===r.n3||e.push([t,r.R_]),e)),[])).reduce(((e,i)=>{const n=[];for(const e of i)t.includes(e)&&n.push(e);return n.length>1&&e.push(n),1===i.length&&1===n.length&&e.push(n),e}),[]);return{groups:t,overlay:i,intersect:r.YW.intersect}}(e),{groups:i,table:n}=function(e){const{groups:t,overlay:i,intersect:n}=e,o=t.reduce(((e,t,i)=>(e[t]=i,e)),{}),r=[];for(let e=0;e<t.length;e++){const e=[];for(let i=0;i<t.length;i++)e.push(!0);r.push(e)}for(let e=0;e<i.length;e++){const t=i[e];for(let e=0;e<t.length;e++)for(let i=e+1;i<t.length;i++){const n=o[t[e]],s=o[t[i]];r[n][s]=!1,r[s][n]=!1}}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<t.length;e++)for(let i=e+1;i<t.length;i++){const n=o[t[e]],s=o[t[i]];r[n][s]=!0,r[s][n]=!0}}return{groups:t,table:r}}(t),o={};for(let e=0;e<n.length;e++){const t=n[e],r=i[e];o[r]={};for(let s=0;s<t.length;s++){const t=i[s];o[r][t]=n[e][s]}}const s=i.reduce(((e,t,i)=>(e[t]=i,e)),{});return{indexToGroup:i,groupToIndex:s,table:o}}var m=i(8450),f=i(2627),_=i(132),p=i(199);function v(e){const t={};let i=0;for(const n in e)t[n]=i,i+=1;return t}let g=Number.MIN_SAFE_INTEGER;function y(){return g++}const b=y(),x=y();var w=i(5790);const S="__JAKARTA__DEM__LIGHTING__";class M extends Error{constructor(e){super(`Unknown expression type '${e[0]}' in '${JSON.stringify(e)}'`),this.name="UnknownExpressionTypeError",Object.setPrototypeOf(this,new.target.prototype)}}function I(e,t,i=a.Zx.Uniform){if((0,s.aH)(e))return(0,o.iL)(e)?(0,o.MV)(e):e;switch(e[0]){case"coalesce":return function(e,t,i){return{type:"coalesce",array:e.slice(1).map((e=>{try{return I(e,t,i)}catch(e){return console.debug(`Unknown expression in coalesce: ${e}`),null}}))}}(e,t,i);case"all":return function(e,t,i){return{type:"all",array:e.slice(1).map((e=>I(e,t,i)))}}(e,t,i);case"any":return function(e,t,i){return{type:"any",array:e.slice(1).map((e=>I(e,t,i)))}}(e,t,i);case"match":return function(e,t,i){const n={type:"match",input:I(e[1],t,i),cases:[],defaultOutput:I(e[e.length-1],t,i)},o=e.slice(2,-1);for(let e=0;e<o.length;e+=2){const r=o[e].reduce(((e,n)=>{"boolean"==typeof n&&e.push(Number(n));const o=I(n,t,i);return(0,s.HW)(o)?e.push(o):console.warn("MatchExpression supports only simple types: string, number, boolean or null",n),e}),[]),a={values:new Set(r),output:I(o[e+1],t,i)};n.cases.push(a)}return n}(e,t,i);case"in":return function(e,t,i){const n=I(e[1],t,i),o=e[2][0];if("get"!==o&&"global"!==o&&"sourceAttr"!==o&&"literal"!==o)throw new Error("InExpression supports only the get, global, source attr and literal expressions as a second argument");const r=I(e[2],t,i);return{type:"in",item:n,collection:r}}(e,t,i);case"interpolate":return P(e,t,i);case"step":return function(e,t,i){const n={type:"step",steps:[],value:I(e[1],t,i)},o={key:0,value:I(e[2],t,i)};n.steps.push(o);const r=e.slice(3);for(let e=0;e<r.length;e+=2){const o={key:r[e],value:I(r[e+1],t,i)};n.steps.push(o)}return n}(e,t,i);case"featureState":case"get":case"sourceAttr":return A(e,t,i);case"objectAttr":return{type:"objectAttr",property:e[1]};case"global":return{type:"global",property:e[1]};case"zoom":return{type:"zoom"};case"distance":return{type:"distance"};case"local-time":return{type:"local-time",offset:I(e[1]||0,t,i)};case"utc-time":return{type:"utc-time",offset:I(e[1]||0,t,i)};case"time":return function(e,t,i){return{type:"time",timeSource:I(e[1],t,i),format:e[2]}}(e,t,i);case"schedule":return function(e,t,i){return{type:"schedule",time:I(e[1],t,i),steps:I(e[2],t,i),detailResult:e[3]}}(e,t,i);case"height":return{type:"height"};case"heatmap-density":return{type:"heatmap-density"};case"shading-intensity":return{type:"shading-intensity"};case"to-boolean":case"to-color":case"!":case"log10":case"mappoints-to-meters":case"meters-to-pixels":return function(e,t,i){return{type:e[0],value:I(e[1],t,i)}}(e,t,i);case"uint64":return I(e[1],t,i);case"==":case"!=":case"<":case"<=":case">":case">=":return function(e,t,i){const n=I(e[1],t,i),o=I(e[2],t,i);return{type:e[0],leftValue:n,rightValue:o}}(e,t,i);case"+":return function(e,t,i){return{type:"+",array:e.slice(1).map((e=>I(e,t,i)))}}(e,t,i);case"*":return function(e,t,i){return{type:"*",array:e.slice(1).map((e=>I(e,t,i)))}}(e,t,i);case"^":return function(e,t,i){const n=I(e[1],t,i),o=I(e[2],t,i);return{type:"^",base:n,exponent:o}}(e,t,i);case"random":return function(e,t,i){const n=I(e[1],t,i),o=I(e[2],t,i);return{type:"random",start:n,end:o}}(e,t,i);case"literal":return Array.isArray(e[1])?function(e,t,i){return{type:"literalArray",array:e[1].map((e=>I(e,t,i)))}}(e,t,i):"object"==typeof e[1]&&null!==e[1]?{type:"literalObject",object:{type:"object",value:e[1]}}:e[1];case"isBehindObjects":return{type:"isBehindObjects"};case"geometry-modifier":const o=[];return e.slice(1).forEach((e=>{const t=function(e){if(void 0===e||!Array.isArray(e))return;if("line-to-zigzag"===e[0])return{type:"zigzag-modifier",step:e[1],width:e[2],stopLines:Number(e[3])}}(e);t&&o.push(t)})),{type:"geometry-modifier",modifiers:o};case"pattern":return{type:"line-pattern",patternType:(0,n.R)(e[1]),parameters:e.slice(2).map((e=>I(e,t,i)))};case"precompute":{if(!t)throw new M(e);const n=t.precomputes.length;return t.precomputes.push({expr:I(e[1],void 0,i),usage:i}),{type:"precompute",precomputeIndex:n}}case"gltf-animation":return function(e,t,i){const n={type:"gltf-animation",options:[]},o=e.slice(1);for(let e=0;e<o.length;e++)n.options.push(I(o[e],t,i));return n}(e,t,i);case"texture-animation":return function(e,t,i){const n={type:"texture-animation",options:[]},o=e.slice(1);for(let e=0;e<o.length;e++)n.options.push(I(o[e],t,i));return n}(e,t,i);case"easing":return function(e){const t={type:"easing",options:["linear"]},i=e.slice(1),n=i.slice(1);try{switch(i[0]){case"cubic-bezier":if(4!==n.length||n.some((e=>"number"!=typeof e)))throw new Error;t.options=[i[0],...n];break;case"exponential":if(1!==n.length||"number"!=typeof n[0]||1===n[0]||n[0]<=0)throw new Error;t.options=[i[0],n[0]];break;case"ease":case"ease-in":case"ease-out":case"ease-in-out":case"linear":t.options[0]=i[0];break;default:throw new Error}}catch(t){console.warn("Invalid texture animation easing expression:",e),console.warn('Fallback to ["easing", "linear"].')}return t}(e);case"mix":return function(e,t,i){const n=e.slice(1);return{type:"mix",value1:I(n[0],t,i),value2:I(n[1],t,i),factor:I(n[2],t,i)}}(e,t,i);case"readFromTarget":return{type:"readFromTarget",name:e[1]};case"vertexAttribute":return{type:"vertexAttribute"};default:throw new M(e)}}function T(e,t,i=a.Zx.Uniform){return(0,s.nS)(e)||Array.isArray(e)&&0===e.length?e:I(e,t,i)}function E(e,t,i){return void 0===e?e:I(e,t,i)}function P(e,t,i){const n={type:"interpolate",base:1,argument:I(e[2],t,i),steps:[]};"exponential"===e[1][0]&&void 0!==e[1][1]&&(n.base=e[1][1]);const o=e.slice(3);for(let e=0;e<o.length;e+=2){const r={key:I(o[e],t,i),value:I(o[e+1],t,i)};n.steps.push(r)}return n}function A(e,t,i){var n;const o=e[0],r=(0,f.qS)(e[1]),s={type:o,property:r};if(i!==a.Zx.Generator&&t){const e=null!==(n=t.precomputes.length)&&void 0!==n?n:NaN;return t.precomputes.push({expr:s,usage:i}),"selected"===r&&"selectedIdx"in t&&(t.selectedIdx=e),{type:"precompute",precomputeIndex:e}}return s}function L(e,t,i){var n,s,a,c,u,f,g,y;const b=D(null!==(n=e.terrain)&&void 0!==n?n:{}),x=j(null!==(s=e.environment)&&void 0!==s?s:{}),w=N(e.light,b),S=function(e){return(0,r.T3)(e)}(e.graphicsPresets),M={id:t,revision:0,background:{color:(0,o.MV)(null!==(c=null===(a=e.background)||void 0===a?void 0:a.color)&&void 0!==c?c:r._4)},light:w,layers:[],layersById:{[_.he]:b,[_.d6]:x},layerIdToInnerId:{},groupsById:{},iconBaseUrl:"",fontUrlTemplate:"",modelsBaseUrl:"",fonts:d.p7,fontNameToIndex:(0,m.PU)(d.p7),rasterSets:{byIndex:{},byKey:{}},icons:e.icons||{},models:Object.values(null!==(u=e.models)&&void 0!==u?u:{}),modelIndex:v(e.models||{}),labelingGroups:h(null!==(f=e.labelingGroups)&&void 0!==f?f:{}),dem:b,graphicsPresets:S,environment:x,targets:{_TMP_SHORELINE_GRADIENT:{channels:{r:!0},title:"Градиент береговой линии"}}},I=new l.x;let T=null!==(g=e.layers)&&void 0!==g?g:[];i&&(T=function(e,t){let i=0;function n(e,t){"custom"!==e.type&&(0,m.Kx)(e.filter)&&(i=t)}return e.forEach(((e,t)=>{"group"===e.type?e.layers.forEach((e=>n(e,t))):n(e,t)})),t.forEach((e=>{"point"===e.type&&(e.style.iconPriority=Number.MAX_SAFE_INTEGER)})),[...e.slice(0,i+1),...t,...e.slice(i+1)]}(null!==(y=e.layers)&&void 0!==y?y:[],p.T));for(const e of T){const t=C(e);if(!t)continue;"group"===t.type&&(M.groupsById[t.innerId]=t,M.layerIdToInnerId[t.id]=t.innerId);("group"===t.type?t.layers:[t]).forEach((e=>{var t;const i=null!==(t=e.lightingMode)&&void 0!==t?t:w.defaultLightMode;if(w.lightingModes[i]||console.warn(`Не найден режим освещения ${i} для слоя ${e.type}. Будет использован режим освещения по умолчанию.`),M.layers.push(e),M.layersById[e.innerId]=e,M.layerIdToInnerId[e.id]=e.innerId,"point"===e.type||"polygon"===e.type||"metricPoint"===e.type||"embankment"===e.type||"polygon3d"===e.type){z(e,I,M.icons).forEach((e=>{M.rasterSets.byKey[e.key]||(M.rasterSets.byIndex[e.index]=e,M.rasterSets.byKey[e.key]=e)}))}}))}return M}function C(e){return"group"===e.type?function(e){var t,i;const n={id:e.id,innerId:(0,_.Uv)(),renderIndex:R.getIndex(),type:e.type,layers:[],orderBy:[],precomputes:[]};return n.orderBy=null!==(i=null===(t=e.orderBy)||void 0===t?void 0:t.map((e=>A(e,n,a.Zx.Uniform))))&&void 0!==i?i:[],e.layers.forEach(((e,t)=>{const i=B(e,n);i&&(i.groupId=n.innerId,i.groupIndex=t,i.renderIndex=n.renderIndex,n.layers.push(i))})),n}(e):B(e)}function z(e,t,i){const n=[];return O(e).forEach((({image:e,imageType:o,anchor:r})=>{e&&(0,u.EG)(e).forEach((e=>{"string"==typeof e&&e.length&&n.push(k(e,o,t,r,i))}))})),n}function k(e,t,i,n,o){const r="icon"===t?(0,s.PR)(e,n[0],n[1]):(0,s.FD)(e);return{type:c.f.Static,index:i.getUniqueIndex(r),key:r,isSvg:(0,m.HU)(o[e]),name:e,fileName:e,anchorX:n[0],anchorY:n[1],rasters:[]}}function O(e){if("point"===e.type){const t=(0,s.pV)(e.style.iconAnchor);return[{image:e.style.iconImage,imageType:"icon",anchor:t}]}if("metricPoint"===e.type)return[{image:e.style.iconImage,imageType:"texture",anchor:[0,0]}];const t=[{image:e.style.textureImage,imageType:"texture",anchor:[0,0]}];return"polygon"===e.type&&t.push({image:e.style.normalMapTextureImage,imageType:"texture",anchor:[0,0]}),t}const R=new l.x;function F(e,t){return"appearance"===e.type?{type:e.type,tipMovementAmplitude:I(e.tipMovementAmplitude,t)}:"repeat"===e.type?{type:e.type,tipMovementAmplitude:I(e.tipMovementAmplitude,t),iterationCount:e.iterationCount}:e}function B(e,t){var i,n,o,l,d,c,u,h,m,f,p,v,g,y,b,x,S,P,A,L,C,z,k,O,B,D;if("custom"===e.type)return{type:"custom",id:e.id,innerId:(0,_.Uv)(),renderIndex:R.getIndex(),filter:!1,minzoom:-1/0,maxzoom:1/0,precomputes:[],style:{}};if(!e.style||"none"===e.style.visibility)return;let j;try{const M={id:e.id,innerId:(0,_.Uv)(),renderIndex:R.getIndex(),filter:I(e.filter||!1,void 0),minzoom:U(e.minzoom,-1/0),maxzoom:U(e.maxzoom,1/0),precomputes:t?t.precomputes.slice(0):[],gpuState:e.gpuState,lightingMode:e.lightingMode,castShadows:null===(i=e.castShadows)||void 0===i||i,receiveShadows:null===(n=e.receiveShadows)||void 0===n||n,drawToTarget:e.drawToTarget};switch(e.type){case"line":{const t=(0,r.q0)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(o=e.interactive)||void 0===o||o,ignoreTier:I(null!==(l=e.ignoreTier)&&void 0!==l&&l,M),style:{visibility:W(t.visibility),color:I(t.color,M),width:I(t.width,M),shift:I(t.shift,M),pattern:I(t.pattern,M),startCap:I(t.startCap,M),endCap:I(t.endCap,M),geometryModifier:I(t.geometryModifier,M),withHeight:t.withHeight,lengthUnits:H(e.style.pattern)}});break}case"lineExtrusion":{const t=(0,r.l7)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,style:{visibility:W(t.visibility),sideColor:I(t.sideColor,M),strokeWidth:I(t.strokeWidth,M),strokeColor:I(t.strokeColor,M),sideStrokeColor:I(t.sideStrokeColor,M),height:I(t.height,M),nearCameraFade:I(t.nearCameraFade,M)}});break}case"polygon":{const t=(0,r.IJ)(e.style),i=V(t.textureSize)?Z(t.textureSize):t.textureSize,n=V(t.normalMapTextureSize)?Z(t.normalMapTextureSize):t.normalMapTextureSize;"_TMP_SHORELINE_GRADIENT"===M.drawToTarget&&(t.strokeWidth=0,t.strokeColor="#00000000",t.color=["mix","#000000","#FF0000",["vertexAttribute"]]),j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(d=e.interactive)||void 0===d||d,ignoreTier:I(null!==(c=e.ignoreTier)&&void 0!==c&&c,M),style:{visibility:W(t.visibility),color:I(t.color,M),textureImage:I(t.textureImage,M),textureSize:T(i,M),textureOpacity:I(t.textureOpacity,M),strokeColor:I(t.strokeColor,M),strokeWidth:I(t.strokeWidth,M),lengthUnits:G(t.textureSize),metallic:I(t.metallic,M),roughness:I(t.roughness,M),normalMapTextureImage:I(t.normalMapTextureImage,M),normalMapTextureSize:T(n,M),normalMapTextureAnimation:I(t.normalMapTextureAnimation,M),normalMapTextureLengthUnits:G(t.normalMapTextureSize)}});break}case"polygon3d":case"embankment":{const t=(0,r.Qi)(e.style),i="polygon3d"===e.type?{depthFunc:w.X6.LEQUAL}:{};j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(u=e.interactive)||void 0===u||u,style:{visibility:W(t.visibility),color:I(t.color,M),textureImage:I(t.textureImage,M),textureSize:T(t.textureSize,M),textureOpacity:I(t.textureOpacity,M),strokeColor:I(t.strokeColor,M),strokeWidth:I(t.strokeWidth,M),nearCameraFade:I(t.nearCameraFade,M),elevation:I(t.elevation,M)},gpuState:Object.assign(Object.assign({},i),M.gpuState)}),"polygon3d"===e.type&&(j.interactiveOcclusion=null===(h=e.interactiveOcclusion)||void 0===h||h);break}case"metricPoint":{const t=(0,r.IN)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(m=e.interactive)||void 0===m||m,ignoreTier:I(null!==(f=e.ignoreTier)&&void 0!==f&&f,M),style:{visibility:W(t.visibility),iconImage:I(t.iconImage,M),color:I(t.color,M),rotation:I(t.rotation,M),width:I(t.width,M),height:I(t.height,M)}});break}case"polygonExtrusion":{const t=(0,r.bN)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(p=e.interactive)||void 0===p||p,style:{visibility:W(t.visibility),topColor:I(t.topColor,M),sideColor:I(t.sideColor,M),strokeColor:I(t.strokeColor,M),strokeWidth:I(t.strokeWidth,M),sideStrokeColor:I(t.sideStrokeColor,M),height:I(t.height,M,a.Zx.Generator),nearCameraFade:I(t.nearCameraFade,M)}});break}case"dashedLine":{const t=(0,r.N5)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(v=e.interactive)||void 0===v||v,ignoreTier:I(null!==(g=e.ignoreTier)&&void 0!==g&&g,M),style:{visibility:W(t.visibility),color:I(t.color,M),gapColor:I(t.gapColor,M),width:I(t.width,M),shift:I(t.shift,M),gapLength:I(t.gapLength,M),dashLength:I(t.dashLength,M),geometryModifier:I(t.geometryModifier,M),withHeight:t.withHeight}});break}case"shiftedLine":{const t=(0,r.sd)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(y=e.interactive)||void 0===y||y,ignoreTier:I(null!==(b=e.ignoreTier)&&void 0!==b&&b,M),style:{visibility:W(t.visibility),color:I(t.color,M),width:I(t.width,M),shift:I(t.shift,M)}});break}case"oneWayLine":{const t=(0,r.zn)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,ignoreTier:I(null!==(x=e.ignoreTier)&&void 0!==x&&x,M),interactive:null!==(S=e.interactive)&&void 0!==S&&S,style:{visibility:W(t.visibility),color:I(t.color,M),lineWidth:I(t.lineWidth,M),lineLength:I(t.lineLength,M),tipWidth:t.tipWidth,tipHeight:t.tipHeight,roundingRadius:I(t.roundingRadius,M),priority:t.priority,duplicationSpacing:I(t.duplicationSpacing,M),endingOffsets:t.endingOffsets,labelingGroup:t.labelingGroup}});break}case"buildingModel":{const t=(0,r._0)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(P=e.interactive)||void 0===P||P,style:{visibility:W(t.visibility),color:I(t.color,M),strokeColor:I(t.strokeColor,M),strokeWidth:I(t.strokeWidth,M),nearCameraFade:I(t.nearCameraFade,M)}});break}case"labelLine":{const t=(0,r.Ym)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null!==(A=e.interactive)&&void 0!==A&&A,ignoreTier:I(null!==(L=e.ignoreTier)&&void 0!==L&&L,M),style:{visibility:W(t.visibility),textField:I(t.textField,M,a.Zx.Labeling),textFont:t.textFont,textColor:I(t.textColor,M),textFontSize:I(t.textFontSize,M),textLetterSpacing:t.textLetterSpacing,textHaloColor:I(t.textHaloColor,M),textHaloWidth:t.textHaloWidth,textPriority:I(t.textPriority,M),textLabelingSideMargin:t.textLabelingSideMargin,textDuplicationSpacing:I(t.textDuplicationSpacing,M),labelingGroup:t.labelingGroup,lineEndingOffsets:t.lineEndingOffsets}});break}case"point":{const t=(0,r.TI)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(C=e.interactive)||void 0===C||C,style:{visibility:W(t.visibility),allowOverlap:t.allowOverlap,allowElevation:t.allowElevation,elevation:I(t.elevation,M),iconImage:I(t.iconImage,M),iconAnchor:T(t.iconAnchor,M),iconOffset:T(t.iconOffset,M),iconWidth:I(t.iconWidth,M),iconTextField:I(t.iconTextField,M,a.Zx.Labeling),iconTextFont:E(t.iconTextFont,M),iconTextAnchor:T(t.iconTextAnchor,M),iconTextOffset:T(t.iconTextOffset,M),iconTextColor:I(t.iconTextColor,M),iconTextFontSize:I(t.iconTextFontSize,M),iconTextLineHeight:t.iconTextLineHeight,iconTextLetterSpacing:t.iconTextLetterSpacing,iconTextPadding:T(t.iconTextPadding,M),iconTextHaloWidth:(0,s.mH)((0,s.Wx)(t.iconTextHaloWidth)),iconTextHaloColor:I(t.iconTextHaloColor,M),iconOpacity:I(t.iconOpacity,M),iconPriority:I(t.iconPriority,M),iconLabelingMargin:t.iconLabelingMargin,iconLabelingGroup:t.iconLabelingGroup,iconRotation:I(t.iconRotation,M),textField:I((0,s.Wx)(t.textField),M,a.Zx.Labeling),textFont:I((0,s.Wx)(t.textFont),M),textColor:I((0,s.Wx)(t.textColor),M),textFontSize:I((0,s.Wx)(t.textFontSize),M),textLineHeight:(0,s.mH)((0,s.Wx)(t.textLineHeight),1.2),textLetterSpacing:(0,s.mH)((0,s.Wx)(t.textLetterSpacing)),textField2:E((0,s._e)(t.textField),M,a.Zx.Labeling),textFont2:E((0,s._e)(t.textFont),M),textColor2:E((0,s._e)(t.textColor),M)||I((0,s.Wx)(t.textColor),M),textFontSize2:E((0,s._e)(t.textFontSize),M)||I((0,s.Wx)(t.textFontSize),M),textMaxLengthPerLine:t.textMaxLengthPerLine,textPlacement:I(t.textPlacement,M),textPriority:I(t.textPriority,M),textOffset:I((0,s.Wx)(t.textOffset),M),textOffset2:E((0,s._e)(t.textOffset),M),textHaloColor:I((0,s.Wx)(t.textHaloColor),M),textHaloColor2:E((0,s._e)(t.textHaloColor),M)||I((0,s.Wx)(t.textHaloColor),M),textHaloWidth:(0,s.mH)((0,s.Wx)(t.textHaloWidth)),textHaloWidth2:(0,s.mH)((0,s._e)(t.textHaloWidth)||(0,s.Wx)(t.textHaloWidth)),textLabelingMargin:(0,s.Wx)(t.textLabelingMargin),textLabelingMargin2:(0,s._e)(t.textLabelingMargin)||(0,s.Wx)(t.textLabelingMargin),textLabelingGroup:(0,s.Wx)(t.textLabelingGroup),textLabelingGroup2:(0,s._e)(t.textLabelingGroup)||(0,s.Wx)(t.textLabelingGroup),duplicationSpacing:I(t.duplicationSpacing,M),endingOffsets:t.endingOffsets}});break}case"arrow":{const t=(0,r.z4)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:!1,ignoreTier:I(null!==(z=e.ignoreTier)&&void 0!==z&&z,M),style:{visibility:W(t.visibility),color:I(t.color,M),strokeColor:I(t.strokeColor,M),lineWidth:I(t.lineWidth,M),strokeWidth:I(t.strokeWidth,M),tipWidth:I(t.tipWidth,M),tipHeight:I(t.tipHeight,M),roundingRadius:I(t.roundingRadius,M),animation:F(t.animation,M)}});break}case"raster":{const t=(0,r.tC)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,ignoreTier:I(null!==(k=e.ignoreTier)&&void 0!==k&&k,M),style:{visibility:W(t.visibility),opacity:I(t.opacity,M)}});break}case"circle":{const t=(0,r.th)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,interactive:null===(O=e.interactive)||void 0===O||O,style:{visibility:W(t.visibility),color:I(t.color,M),strokeColor:I(t.strokeColor,M),strokeColor2:I(t.strokeColor2,M),width:I(t.width,M),strokeWidth:I(t.strokeWidth,M),strokeWidth2:I(t.strokeWidth2,M)}});break}case"heatmap":{const t=(0,r.Mk)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,style:{visibility:W(t.visibility),color:I(t.color,M),radius:I(t.radius,M),opacity:I(t.opacity,M),intensity:I(t.intensity,M),weight:I(t.weight,M),downscale:t.downscale},framebufferId:{framebuffer:a.ze}});break}case"model":{const t=(0,r.M3)(e.style);j=Object.assign(Object.assign({},M),{interactive:null===(B=e.interactive)||void 0===B||B,interactiveOcclusion:null===(D=e.interactiveOcclusion)||void 0===D||D,type:"gltfModel",style:{visibility:W(t.visibility),modelSrc:I(t.modelSrc,M),offset:I(t.offset,M,a.Zx.Generator),scale:I(t.scale,M,a.Zx.Generator),rotation:I(t.rotation,M,a.Zx.Generator),color:I(t.color,M),linkedIds:I(t.linkedIds,M),colorTextureUvIndex:t.colorTextureUvIndex,roughness:t.roughness,metallic:t.metallic,preventObjectsHiding:t.preventObjectsHiding,nearCameraFade:I(t.nearCameraFade,M),ignoreGlobalLighting:t.ignoreGlobalLighting,showRatio:I(t.showRatio,M),lightingModel:t.lightingModel,playAnimation:I(t.playAnimation,M)}});break}case"overpass":{const t=(0,r.Jb)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,style:{visibility:W(t.visibility),debug:t.debug,sideColor:I(t.sideColor,M),bottomColor:I(t.bottomColor,M),topColor:I(t.borderTopColor,M),strokeColor:I(t.strokeColor,M),strokeWidth:I(t.strokeWidth,M),thickness:I(t.thickness,M),borderHeight:I(t.borderHeight,M),borderWidth:I(t.borderWidth,M),color:I(t.color,M),nearCameraFade:I(t.nearCameraFade,M),tunnelHeight:I(t.tunnelHeight,M)}});break}case"tunnel":{const t=(0,r.Ug)(e.style);j=Object.assign(Object.assign({},M),{type:e.type,style:{visibility:W(t.visibility),sideColor:I(t.sideColor,M),bottomColor:I(t.bottomColor,M),topColor:I(t.topColor,M),strokeColor:I(t.strokeColor,M),strokeWidth:I(t.strokeWidth,M),color:I(t.color,M),nearCameraFade:I(t.nearCameraFade,M)}});break}}}catch(t){if(t instanceof M)return void console.warn(`Problem with layer #${e.id}: ${t}`);throw t}return j}function D(e){const t=(0,r.sy)(e),i={id:"dem",type:"dem",innerId:_.he,filter:!0,precomputes:[],minzoom:-1/0,maxzoom:1/0,renderIndex:b,style:{},framebufferId:{elevation:a.ze,hillshade:a.ze,flatBottom:a.ze},lightingMode:S};return i.style={visibility:"visible",lightingDirection:void 0!==t.lightingDirection?I(t.lightingDirection,i):null,shadingIntensity:I(t.shadingIntensity,i),shadingPalette:P(t.shadingPalette,i),verticalScale:I(t.verticalScale,i)},i}function j(e){const t=(0,r.p8)(e),i={id:"sky",type:"custom",innerId:_.d6,filter:!0,precomputes:[],minzoom:-1/0,maxzoom:1/0,renderIndex:x,style:{}};return i.style={visibility:"visible",skyColor:I(t.skyColor,i),fogColor:I(t.fogColor,i),starsIntensity:I(t.starsIntensity,i)},i}function N(e,t){var i,n;const o=(0,r.x6)(e),s={},a={ambientColor:{type:"color",value:[255,255,255,255]},ambientIntensity:0,dir1Color:{type:"color",value:[255,255,255,255]},dir1Altitude:0,dir1Azimuth:0,dir1Intensity:0,dir2Color:{type:"color",value:[255,255,255,255]},dir2Altitude:0,dir2Azimuth:0,dir2Intensity:0,shadowRadius:null===(i=o.shadows)||void 0===i?void 0:i.radius};for(const e in o.lightingModes){const i={ambientColor:{type:"color",value:[255,255,255,255]},ambientIntensity:0,dir1Color:{type:"color",value:[255,255,255,255]},dir1Altitude:0,dir1Azimuth:0,dir1Intensity:0,dir2Color:{type:"color",value:[255,255,255,255]},dir2Altitude:0,dir2Azimuth:0,dir2Intensity:0,shadowRadius:null===(n=o.shadows)||void 0===n?void 0:n.radius},r=o.lightingModes[e].map((e=>o.sources[e])).filter(Boolean),l=o.shadows?o.sources[o.shadows.source]:void 0;let d=0;r.forEach((n=>{n.color||(n.color="#FFFFFF"),"ambient"===n.type?(i.ambientColor=I(n.color,void 0),i.ambientIntensity=I(n.intensity,void 0),e===o.defaultLightingMode&&(a.ambientColor=i.ambientColor,a.ambientIntensity=i.ambientIntensity)):"directional"===n.type&&(n===l&&(i.shadowLightIndex=d),0===d?(d++,i.dir1Color=I(n.color,void 0),i.dir1Altitude=I(n.altitude,void 0),i.dir1Azimuth=I(n.azimuth,void 0),i.dir1Intensity=I(n.intensity,void 0),e===o.defaultLightingMode&&(a.dir1Color=i.dir1Color,a.dir1Intensity=i.dir1Intensity,a.dir1Azimuth=null===t.style.lightingDirection?i.dir1Azimuth:t.style.lightingDirection,a.dir1Intensity=I(n.intensity,void 0),a.dir1Altitude=i.dir1Altitude)):1===d&&(d++,i.dir2Color=I(n.color,void 0),i.dir2Altitude=I(n.altitude,void 0),i.dir2Azimuth=I(n.azimuth,void 0),i.dir2Intensity=I(n.intensity,void 0)))})),s[e]=i}return s[S]=a,{defaultLightMode:o.defaultLightingMode,lightingModes:s}}function U(e,t){return"number"!=typeof e||Number.isNaN(e)?t:e}function H(e){return e&&V(e[2])?a.vR.Meters:a.vR.Pixels}function G(e){return V(e)?a.vR.Meters:a.vR.Pixels}function V(e,t=!1){return Array.isArray(e)&&("meters-to-pixels"===e[0]||"literal"===e[0]&&!t&&Array.isArray(e[1])&&e[1].some((e=>V(e,!0))))}function Z(e){if(Array.isArray(e))if("meters-to-pixels"===e[0]){if("number"==typeof e[1]&&!Number.isNaN(e[1]))return e[1]}else if("literal"===e[0]&&Array.isArray(e[1])){const[t,i]=e[1];if([t,i].every((e=>Array.isArray(e)&&"meters-to-pixels"===e[0]&&"number"==typeof e[1]&&!Number.isNaN(e[1]))))return[t[1],i[1]]}return console.warn(`Can't extract meter-to-pixels values from expression ${JSON.stringify(e)}. Size set to 0.`),0}function W(e){return"none"===e?"hidden":e}},3754:(e,t,i)=>{"use strict";i.d(t,{IJ:()=>l,IN:()=>c,Jb:()=>T,M3:()=>I,Mk:()=>S,N5:()=>v,Qi:()=>d,R_:()=>C,T3:()=>L,TI:()=>b,T_:()=>k,Ug:()=>E,YW:()=>O,Ym:()=>_,_0:()=>m,_4:()=>R,bN:()=>u,l7:()=>f,n3:()=>z,p8:()=>P,q0:()=>h,sd:()=>g,sy:()=>M,tC:()=>w,th:()=>y,uj:()=>s,x6:()=>A,z4:()=>x,zn:()=>p});var n=i(6490),o=i(314),r=i(7464);const s="bottomCenter";function a(e,t){for(const i in t)void 0!==t[i]&&(e[i]=t[i])}function l(e){const t={color:"#000000",textureImage:"",textureSize:16,textureOpacity:1,strokeColor:"#00000000",strokeWidth:1,visibility:"visible",metallic:1,roughness:0,normalMapTextureImage:"",normalMapTextureSize:16,normalMapTextureAnimation:null};if(a(t,e),void 0!==e.strokeColor||Boolean(t.textureImage)||(t.strokeColor=t.color),!Array.isArray(t.textureSize)||"step"===t.textureSize[0]||"literal"===t.textureSize[0])return t;if(t.textureSize.length){if(!(0,r.nS)(t.textureSize))return t;1===t.textureSize.length&&(t.textureSize=t.textureSize[0])}else t.textureSize=16;return t}function d(e){const t={color:"#000000",textureImage:"",textureSize:16,textureOpacity:1,strokeColor:"#00000000",strokeWidth:1,nearCameraFade:2500,visibility:"visible",elevation:0};if(a(t,e),void 0!==e.strokeColor||Boolean(t.textureImage)||(t.strokeColor=t.color),!Array.isArray(t.textureSize)||"step"===t.textureSize[0]||"literal"===t.textureSize[0])return t;if(t.textureSize.length){if(!(0,r.nS)(t.textureSize))return t;1===t.textureSize.length&&(t.textureSize=t.textureSize[0])}else t.textureSize=16;return t}function c(e){const t={iconImage:"",color:"#FFFFFF",rotation:0,width:1,visibility:"visible"};return a(t,e),void 0===e.height&&(t.height=t.width),t}function u(e){const t={topColor:"#000000",strokeColor:"#000000",strokeWidth:1,sideColor:"#000000",sideStrokeColor:"#000000",height:["mappoints-to-meters",["get","db_height"]],nearCameraFade:2500,visibility:"visible"};return a(t,e),void 0===e.strokeColor&&(t.strokeColor=t.topColor),void 0===e.sideColor&&(t.sideColor=t.topColor),void 0===e.sideStrokeColor&&(t.sideStrokeColor=t.sideColor),t}function h(e){const t={color:"#000000",width:1,shift:0,geometryModifier:["geometry-modifier"],pattern:["pattern","none"],startCap:"round",endCap:"round",withHeight:!1,visibility:"visible"};return a(t,e),t}function m(e){const t={color:"#000000",strokeColor:"#000000",strokeWidth:1,nearCameraFade:2500,visibility:"visible"};return a(t,e),void 0===e.strokeColor&&(t.strokeColor=t.color),t}function f(e){const t={sideColor:"#000000",strokeColor:"#000000",strokeWidth:1,sideStrokeColor:"#000000",height:0,visibility:"visible",nearCameraFade:2500};return a(t,e),void 0===e.strokeColor&&(t.strokeColor=t.sideColor),void 0===e.sideStrokeColor&&(t.sideStrokeColor=t.sideColor),t}function _(e){const t={textField:["get","db_label"],textFont:"Noto_Sans",textColor:"#000000",textFontSize:16,textLetterSpacing:0,textHaloColor:"rgba(0, 0, 0, 0)",textHaloWidth:0,textPriority:0,textLabelingSideMargin:0,textDuplicationSpacing:0,lineEndingOffsets:0,visibility:"visible",labelingGroup:k};return a(t,e),t}function p(e){const t={color:"#000000",lineWidth:2,lineLength:10,tipWidth:1.5,tipHeight:2,roundingRadius:0,priority:0,duplicationSpacing:0,endingOffsets:0,visibility:"visible",labelingGroup:k};return a(t,e),t}function v(e){const t={color:"#000000",gapColor:"#00000000",width:1,shift:0,gapLength:1,dashLength:1,geometryModifier:["geometry-modifier"],withHeight:!1,visibility:"visible"};return a(t,e),t}function g(e){const t={color:"#000000",width:1,shift:0,visibility:"visible"};return a(t,e),t}function y(e){const t={color:"#ffffff",strokeColor:"#3388ff",strokeColor2:"#00000000",width:20,strokeWidth:3,strokeWidth2:0,visibility:"visible"};return a(t,e),t}function b(e){const t={allowOverlap:!1,allowElevation:!1,elevation:NaN,iconOpacity:1,iconImage:"",iconAnchor:[.5,.5],iconOffset:[0,0],iconWidth:16,iconTextField:["get","db_label2"],iconTextFont:"",iconTextAnchor:[.5,.5],iconTextOffset:[0,0],iconTextColor:"#000000",iconTextFontSize:16,iconTextLineHeight:1.2,iconTextLetterSpacing:0,iconTextPadding:[0,0,0,0],iconTextHaloWidth:0,iconTextHaloColor:"rgba(0, 0, 0, 0)",iconPriority:0,iconRotation:0,iconLabelingGroup:k,iconLabelingMargin:{topBottom:0,leftRight:0},textField:[["get","db_label"],["get","db_label2"]],textFont:"",textColor:"#000000",textFontSize:16,textLineHeight:1.2,textLetterSpacing:0,textPlacement:s,textOffset:0,textHaloColor:"rgba(0, 0, 0, 0)",textHaloWidth:0,textLabelingMargin:{topBottom:0,leftRight:0},textPriority:0,textMaxLengthPerLine:30,visibility:"visible",textLabelingGroup:k,duplicationSpacing:100,endingOffsets:0};return a(t,e),t}function x(e){const t={color:"#000000",strokeColor:"#000000",lineWidth:1,strokeWidth:0,tipWidth:1,tipHeight:1,roundingRadius:3,animation:{type:"appearance",tipMovementAmplitude:0},visibility:"visible"};return void 0===e.strokeColor&&(t.strokeColor=t.color),a(t,e),t}function w(e){const t={opacity:1,visibility:"visible"};return a(t,e),t}function S(e){return(0,n.kn)(e,{color:["interpolate",["linear"],["heatmap-density"],0,"rgba(53, 136, 253, 0)",.2,"rgba(53, 136, 253, 0.2)",.4,"rgb(255, 201, 77)",.6,"rgb(255, 202, 20)",.75,"rgb(245, 0, 7)",1,"rgb(255, 0, 0)"],radius:30,opacity:1,intensity:1,weight:1,downscale:1,visibility:"visible"})}function M(e){return(0,n.kn)(e,{shadingIntensity:["interpolate",["linear"],["zoom"],12,0,14.5,.7],verticalScale:1,shadingPalette:["interpolate",["linear"],["shading-intensity"],0,0,1,1],lightingDirection:322})}function I(e){const t={modelSrc:"",offset:0,scale:1,rotation:0,color:"#fff",linkedIds:"",visibility:"visible",colorTextureUvIndex:0,nearCameraFade:2500,ignoreGlobalLighting:!1,showRatio:1,metallic:NaN,roughness:NaN,preventObjectsHiding:!1,lightingModel:"phong",playAnimation:-1};return(0,n.kn)(e,t)}function T(e){const t={visibility:"visible",sideColor:"#000000",borderTopColor:"#000000",bottomColor:"#000000",strokeColor:"#000000",strokeWidth:1,debug:!1,thickness:1,borderHeight:0,borderWidth:.3,color:"#000000",nearCameraFade:0,tunnelHeight:5};return a(t,e),void 0===e.borderTopColor&&(t.borderTopColor=t.color),void 0===e.strokeColor&&(t.strokeColor=t.color),void 0===e.sideColor&&(t.sideColor=t.color),void 0===e.bottomColor&&(t.bottomColor=t.color),t}function E(e){const t={visibility:"visible",sideColor:"#000000",topColor:"#000000",bottomColor:"#000000",strokeColor:"#000000",strokeWidth:1,color:"#ffffff",nearCameraFade:0};return a(t,e),t}function P(e){return(0,n.kn)(e,{skyColor:"#6EC0FF00",fogColor:"#FAFDFF00",starsIntensity:1})}function A(e){const t={sources:{sun:{type:"directional",altitude:50,azimuth:230,color:"#FFFFFF",intensity:.2},atmosphere:{type:"ambient",color:"#FFFFFF",intensity:.85}},lightingModes:{[o.OD.global]:["sun","atmosphere"]},defaultLightingMode:"global"},i=(0,n.kn)(null!=e?e:{},t);return i.lightingModes[o.OD.none]=[],i}function L(e){const t=(0,n.kn)(null!=e?e:{},{light:{},normal:{},immersive:{}});return t.light.transparentBuildingsOff=!0,t.light.AALinesOff=!0,t}const C="__overlapped",z="__commercial",k="default",O={groups:[k,C,z],overlay:[[k,C]],intersect:[[]]},R="#F5F2E0"},7464:(e,t,i)=>{"use strict";i.d(t,{FD:()=>g,HW:()=>m,PR:()=>v,Uo:()=>p,Uu:()=>l,Wx:()=>b,YI:()=>o,_e:()=>x,aH:()=>r,bd:()=>M,lK:()=>_,mH:()=>S,nS:()=>c,pV:()=>w,vB:()=>f,zV:()=>y,zv:()=>u});const n=new Set(["bottomCenter","bottomRight","bottomLeft","topCenter","topRight","topLeft","rightBottom","rightCenter","rightTop","leftBottom","leftCenter","leftTop","centerCenter"]);function o(e){return n.has(e)}function r(e){return"number"==typeof e||"boolean"==typeof e||"string"==typeof e||null===e}function s(e){if(Array.isArray(e)){const t=e;if(!t.length)return!1;if({zoom:!0,height:!0,coalesce:!0,"heatmap-density":!0,"shading-intensity":!0,objectAttr:!0,step:!0,interpolate:!0,all:!0,get:!0,sourceAttr:!0,featureState:!0,global:!0,match:!0,in:!0,any:!0,"!":!0,"==":!0,"!=":!0,">=":!0,">":!0,"<=":!0,"<":!0,"to-boolean":!0,"to-color":!0,"+":!0,"*":!0,"^":!0,log10:!0,random:!0,literal:!0,isBehindObjects:!0,"mappoints-to-meters":!0,"meters-to-pixels":!0,uint64:!0,"geometry-modifier":!0,pattern:!0,precompute:!0,"gltf-animation":!0,distance:!0,time:!0,"local-time":!0,"utc-time":!0,"texture-animation":!0,easing:!0,schedule:!0,mix:!0,readFromTarget:!0,vertexAttribute:!0}[t[0]])return!0}return!1}function a(e){return s(e)&&"literal"===e[0]}function l(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e&&void 0!==e.type&&"color"!==e.type}function d(e,t){return!!Array.isArray(e)&&(e.length>0&&e.every((e=>typeof e===t)))}function c(e){return d(e,"number")}function u(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e&&"object"===e.type}function h(e){const t=typeof e;return null===e||"string"===t||"number"===t||"boolean"===t||function(e){return d(e,"string")}(e)||c(e)}function m(e){return h(e)||function(e){return!Array.isArray(e)&&"object"==typeof e&&null!==e&&"color"===e.type}(e)||u(e)}function f(e){return l(e)&&"get"===e.type}function _(e){return{type:"color",value:e}}function p(e){return{type:"mix-color",color1:e.value1,color2:e.value2,factor:e.factor}}function v(e,t,i){return`${e}_${t}_${i}`}function g(e){return`texture-${e}`}function y(e,t){return e+"-"+t}function b(e){return a(e)&&Array.isArray(e[1])?e[1][0]:Array.isArray(e)?s(e)?e:e[0]:e}function x(e){return a(e)&&Array.isArray(e[1])?e[1][1]:Array.isArray(e)&&!s(e)&&void 0!==e[1]?e[1]:void 0}function w(e){if("number"==typeof e)return e;if(c(e))return e;if("literalArray"===e.type&&c(e.array))return e.array;throw new Error("Unsupported simple literal expression. Can't resolve.")}function S(e,t=0){const i=Number(e);return isNaN(i)?t:i}function M(e){return!!e&&"object"==typeof e&&"mix-options"===e.type}},1284:(e,t,i)=>{"use strict";i.d(t,{x:()=>n});class n{constructor(e=0){this.index=e,this.keysMap={}}getIndex(){const e=this.index;return this.index+=1,e}getUniqueIndex(e){return void 0===this.keysMap[e]&&(this.keysMap[e]=this.index,this.index+=1),this.keysMap[e]}getIndexedKeys(){return this.keysMap}}},132:(e,t,i)=>{"use strict";i.d(t,{Uv:()=>o,d6:()=>s,he:()=>r});let n=0;function o(){return n++}const r=o(),s=o()},2543:(e,t,i)=>{"use strict";i.d(t,{Bj:()=>x,EG:()=>F,FR:()=>v,M8:()=>b,Oh:()=>B,Q9:()=>E,UP:()=>S,Yi:()=>z,bs:()=>C,jJ:()=>L,m2:()=>R,o4:()=>A,qv:()=>I,uA:()=>P,vn:()=>T,zn:()=>M});var n=i(9450),o=i(7063),r=i(412),s=i(7464),a=i(309),l=i(9073),d=i(6392),c=i(173),u=i(3754),h=i(6490),m=i(6273),f=i(8585);const _=null,p=[0,0,0];function v(e,t){var i;if(!(0,s.Uu)(e))return e;if(t.allowedExpressions&&!t.allowedExpressions.has(e.type))return(0,a.cM)(`Expression of type ${e.type} is not allowed here`),_;switch(e.type){case"schedule":return function(e,t){var i,n;const o=1440,r=6e4,s=(e,t)=>{const i=Date.now()+ +(t.styleState._customUserTimeOffset||0);return 6e4*Math.floor(i/6e4)+e*r},a=e.detailResult||!1,l=e=>{if("binder"===t.type&&t.callBackFn){const i=s(e,t);t.callBackFn(i)}};let d=v(e.steps,t);"string"==typeof d&&(d=JSON.parse(d));const c=new Array,u=new Array;if(Array.isArray(d)){c.push({key:0,value:d[0]});for(let e=1;e<d.length;e+=3){const t={key:Math.trunc(d[e]/o)*o,value:d[0]};u.push(t);const i={key:d[e],value:d[e+2]};c.push(i);const n={key:d[e+1],value:d[0]};c.push(n)}}for(const e of u)c.find((t=>t.key===e.key))||c.push(e);c.sort(((e,t)=>e.key<t.key?-1:1));const h=Number(v(e.time,t)),m=new Date(h),f=60*m.getHours()+m.getMinutes()+1440*(m.getDay()||7),_=k({steps:c},f%o,t)-1,p=k({steps:c},f,t)-1;if(c[p]&&Math.trunc(c[p]&&c[p].key/o)===Math.trunc(f/o)){const e=Math.min(((null===(i=c[p+1])||void 0===i?void 0:i.key)||11519)-f,1439-f%1440);l(e);const n=v(c[p].value,t)||NaN;return a?{type:"schedule-detailed-result",value:n,nextStepStartsAt:s(e,t),currentStepElapsed:(f-c[p].key)*r}:n}if(c[_]){const e=Math.min((null===(n=c[_+1])||void 0===n?void 0:n.key)||1439,1439)-f%1440;l(e);const i=v(c[_].value,t)||NaN;return a?{type:"schedule-detailed-result",value:i,nextStepStartsAt:s(e,t),currentStepElapsed:(f%1440-c[_].key)*r}:i}return a?{type:"schedule-detailed-result",value:NaN,nextStepStartsAt:NaN,currentStepElapsed:NaN}:NaN}(e,t);case"time":return function(e,t){const i=i=>{const n=v(e.timeSource,t),o=new Date(+(n||0));if("day-minutes-720"===i){return 60*(o.getHours()%12||0)+o.getMinutes()}return o.getTime()};if("binder"===t.type){if(t.callBackFn){const e=Date.now()+ +(t.styleState._customUserTimeOffset||0),i=6e4*Math.floor(e/6e4)+6e4;t.callBackFn(i)}return Array.isArray(e.format)?e.format.map((e=>i(e))):i(e.format)}return i("timestamp")}(e,t);case"objectAttr":return function(e,t){if("binder"===t.type&&t.dynamicObject)return t.dynamicObject[e.property]||null;return null}(e,t);case"coalesce":return y(e,t);case"all":return function(e,t){return e.array.every((e=>!0===v(e,t)))}(e,t);case"any":return function(e,t){return e.array.some((e=>!0===v(e,t)))}(e,t);case"featureState":return function(e,t){var i;if("generator"===t.type){const n=null!==(i=t.featureAttrs[t.tileProps[e.property]])&&void 0!==i?i:null;return Number.isNaN(n)?null:n}throw new Error("Feature state expression can be resolved only in generator context")}(e,t);case"get":return w(e,t);case"global":return function(e,t){const i=t.styleState[e.property];if(null==i)return null;if("object"==typeof i&&!Array.isArray(i))return{type:"object",value:i};return i}(e,t);case"sourceAttr":return function(e,t){var i;if("generator"===t.type)return null!==(i=t.sourceAttrs[e.property])&&void 0!==i?i:null;return null}(e,t);case"in":return function(e,t){const i=v(e.item,t),n=v(e.collection,t);if(null===n)return!1;if("object"!=typeof n)return(0,a.cM)(`InExpression second argument resolved to non-object/non-array value: ${n}`),null;if(Array.isArray(n))return n.some((e=>e===i));if((0,s.zv)(n))return Object.prototype.hasOwnProperty.call(n.value,i);return(0,a.cM)(`InExpression second argument resolved incorrectly: ${n}`),null}(e,t);case"interpolate":return function(e,t){if(0===e.steps.length)return(0,a.cM)("Interpolate expression contains 0 steps, cannot interpolate"),_;const i=v(e.steps[0].value,t),n=v(e.argument,t);if("number"!=typeof n)return(0,a.cM)(`Interpolate value resolved to non-number value: ${n} ${e.argument}`),0;if((0,r.gC)(i)){if((0,s.Uu)(e.argument)&&"height"===e.argument.type){const i={type:"gradient-color",values:[],steps:[]};return e.steps.forEach((e=>{const n=T(e.key,t),o=v(e.value,t);(0,r.gC)(o)&&!Number.isNaN(n)&&(i.values.push({type:"color",value:o.value}),i.steps.push(n))})),2!==i.steps.length?((0,a.cM)("Gradient expression must resolve 2 steps"),_):i}return A(e,n,t)}return S(e,n,t)}(e,t);case"match":return function(e,t){var i;const n=v(e.input,t),o=e.cases.find((e=>e.values.has(n)));return v(null!==(i=null==o?void 0:o.output)&&void 0!==i?i:e.defaultOutput,t)}(e,t);case"step":return function(e,t){const i=Number(v(e.value,t)),n=k(e,i,t)-1;return v(e.steps[n].value,t)}(e,t);case"to-boolean":return function(e,t){return Boolean(v(e.value,t))}(e,t);case"to-color":return function(e,t){const i=v(e.value,t);if((0,r.iL)(i))return(0,r.MV)(i);if((0,r.gC)(i))return i;return console.warn(`Can't resolve expression. Must be color, but got ${i}`),(0,s.lK)([0,0,0,0])}(e,t);case"mappoints-to-meters":return function(e,t){if("generator"!==t.type||!t.tileInfo)throw new Error("Выражение `mappoints-to-meters` можно резолвить только в контексте генератора");return v(e.value,t)/(l.C*(0,d.iq)(t.tileInfo,[0,0]))}(e,t);case"meters-to-pixels":return function(e,t){let i,n=T(e.value,t)*m.y4/l.A5;if("generator"===t.type){if(!t.tileInfo)return null;i=t.tileInfo.coords[3],n*=(0,d.iq)(t.tileInfo,[0,0])}else i=t.styleZoom;return n*Math.pow(2,i+1)}(e,t);case"!":return function(e,t){return!v(e.value,t)}(e,t);case"==":case"!=":return function(e,t){const i=v(e.leftValue,t),n=v(e.rightValue,t);switch(e.type){case"==":return i===n;case"!=":return i!==n}}(e,t);case">":case"<":case">=":case"<=":return function(e,t){const i=v(e.leftValue,t);if(null===i)return null;const n=v(e.rightValue,t);if(null===n)return null;switch(e.type){case"<":return i<n;case">":return i>n;case"<=":return i<=n;case">=":return i>=n}}(e,t);case"zoom":return"binder"===t.type||"labeling"===t.type?t.styleZoom:"generator"===t.type&&t.tileInfo?t.tileInfo.coords[3]:((0,a.cM)(`Zoom expression cannot be used in ${t.type} context`),_);case"distance":if("binder"===t.type){const e=f.H.toGeo(t.objectCenter),i=f.H.scaleFactor(e[1])*l.C;return n.TK(t.objectCenter,t.cameraCenter)/i}return(0,a.cM)(`Distance expression can't be resolved in the ${t.type} context`),_;case"height":return 1;case"+":return function(e,t){const i=e.array.map((e=>v(e,t)));if(!(0,s.nS)(i))return(0,a.cM)(`Resolve AdditionExpression: arguments are not resolved as an array of numbers: ${i}`),null;return i.reduce(((e,t)=>e+t),0)}(e,t);case"*":return function(e,t){const i=e.array.map((e=>v(e,t)));if(!(0,s.nS)(i))return(0,a.cM)(`Resolve MultiplicationExpression: arguments are not resolved as an array of numbers: ${i}`),null;return i.reduce(((e,t)=>e*t),1)}(e,t);case"^":return function(e,t){const i=v(e.base,t);if("number"!=typeof i)return(0,a.cM)(`Resolve PowExpression: base resolved as non-number value: ${i}`),null;const n=v(e.exponent,t);if("number"!=typeof n)return(0,a.cM)(`Resolve PowExpression: exponent resolved as non-number value: ${n}`),null;return Math.pow(i,n)}(e,t);case"log10":return function(e,t){const i=v(e.value,t);if("number"!=typeof i)return(0,a.cM)(`Resolve Log10Expression: value resolved as non-number value: ${i}`),null;return Math.log10(i)}(e,t);case"random":return function(e,t){const i=v(e.start,t);if("number"!=typeof i)return(0,a.cM)(`Resolve RandomizationExpression: start resolved as non-number value: ${i}`),null;const n=v(e.end,t);if("number"!=typeof n)return(0,a.cM)(`Resolve RandomizationExpression: end resolved as non-number value: ${n}`),null;if(n<i)return(0,a.cM)("Resolve RandomizationExpression: end cannot be less than start."),null;return(0,c.ff)(t,i,n)}(e,t);case"literalArray":return function(e,t){return e.array.map((e=>v(e,t)))}(e,t);case"literalObject":return{type:"object",value:e.object};case"isBehindObjects":return"binder"===t.type?t.isBehind:((0,a.cM)(`isBehindObjects expression cannot be used in ${t.type} context`),_);case"geometry-modifier":return e.modifiers;case"line-pattern":return[e.patternType,...e.parameters.map((e=>v(e,t)))];case"precompute":return null!==(i=t.tileData[e.precomputeIndex])&&void 0!==i?i:null;case"gltf-animation":return b(e,t);case"local-time":case"utc-time":return g(e,t);case"texture-animation":return x(e,t);case"easing":return e.options;case"mix":return function(e,t){return{type:"mix-options",value1:v(e.value1,t),value2:v(e.value2,t),factor:e.factor}}(e,t);default:return(0,a.cM)(`Not supported expression type <<${e.type}>> in ${JSON.stringify(e)}`),_}}function g(e,t){const i=Date.now()+ +(t.styleState._customUserTimeOffset||0);if("local-time"===e.type){return i+(e.offset?6e4*+(v(e.offset,t)||0):0)}if("utc-time"===e.type){const n=e.offset?6e4*+(v(e.offset,t)||0):0;return i+6e4*(new Date).getTimezoneOffset()+n}return i}function y(e,t){for(const i of e.array){const e=v(i,t);if(null!==e)return e}return null}function b(e,t){const i={type:"animation-options"};return e.options?e.options.forEach(((e,n)=>i[n]=v(e,t))):(0,s.Uu)(e)||(i[0]=e),i}function x(e,t){const i={type:"texture-animation-options"};return e.options?e.options.forEach(((e,n)=>i[n]=v(e,t))):(0,s.Uu)(e)||(i[0]=e),i}function w(e,t){var i;if("generator"===t.type){let n=null!==(i=t.tileAttrs[t.tileProps[e.property]])&&void 0!==i?i:null;return"object"!=typeof n||null===n||Array.isArray(n)||(n={type:"object",value:n}),Number.isNaN(n)?null:n}throw new Error("Get expression can be resolved only in generator context")}function S(e,t,i){const n=k(e,t,i);if(0===n)return Number(v(e.steps[0].value,i));if(n===e.steps.length)return function(e,t,i){const n=e.steps[e.steps.length-1],o=e.base;if(1===o)return T(n.value,t);return T(n.value,t)*Math.pow(o,i-T(n.key,t))}(e,i,t);const o=Number(v(e.steps[n-1].value,i));if("labeling"===i.type&&i.interpolateExpressionAsStep)return o;const r=O(e,t,n,i);return(1-r)*o+r*Number(v(e.steps[n].value,i))}function M(e,t,i=!1){const n=v(e,t);return(0,r.gC)(n)?n:(0,r.RY)(n)?n.values[1]:(0,s.bd)(n)?(0,r.gC)(n.value1)&&(0,r.gC)(n.value2)?i?(0,s.Uo)(n):(console.warn("Mixing color is not supported here."),(0,s.lK)([0,0,0,0])):(console.warn(`Mix values cannot be converted to colors in ${JSON.stringify(n)}`),(0,s.lK)([0,0,0,0])):(console.warn(`Can't resolve expression. Must be color, but got ${n}`),(0,s.lK)([0,0,0,0]))}function I(e,t){const i=v(e,t);return(0,r.RY)(i)?i:null}function T(e,t,i=NaN){const n=v(e,t);return"number"==typeof n?n:i}function E(e,t,i=""){const n=v(e,t);return"string"==typeof n?n:i}function P(e,t,i=u.uj){const n=v(e,t);return(0,s.YI)(n)?n:i}function A(e,t,i){const n=k(e,t,i);if(0===n)return M(e.steps[0].value,i);if(n===e.steps.length)return M(e.steps[e.steps.length-1].value,i);const o=O(e,t,n,i),r=M(e.steps[n-1].value,i).value,a=M(e.steps[n].value,i).value;return(0,s.lK)([r[0]*(1-o)+a[0]*o,r[1]*(1-o)+a[1]*o,r[2]*(1-o)+a[2]*o,r[3]*(1-o)+a[3]*o])}function L(e,t,i,n=!1,o,r,s){return{type:"binder",styleZoom:e,styleState:t,tileData:i,randomSeed:0,isBehind:n,dynamicObject:o,cameraCenter:null!=r?r:p,objectCenter:null!=s?s:p}}function C(e,t,i,n){return{type:"labeling",styleZoom:e,styleState:t,interpolateExpressionAsStep:i,randomSeed:0,tileData:n}}function z(e,t,i,n,o,r,s){return{type:"generator",styleState:e,tileProps:i,tileAttrs:n,id:r,tileData:[],featureAttrs:o,sourceAttrs:t,randomSeed:0,tileInfo:s}}function k(e,t,i){let n=0;for(;n<e.steps.length&&!(t<T(e.steps[n].key,i));)n++;return n}function O(e,t,i,n){const o=e.base,r=T(e.steps[i].key,n)-T(e.steps[i-1].key,n),s=t-T(e.steps[i-1].key,n);return 1===o?s/r:(Math.pow(o,s)-1)/(Math.pow(o,r)-1)}function R(e){const[t,i,n,o]=e.value;return[((t*o+127)/255>>>0)/255,((i*o+127)/255>>>0)/255,((n*o+127)/255>>>0)/255,o/255]}function F(e,t,i,n=!1){const o=[];return N(o,e,t,i),n?o:Array.from(new Set(o))}function B(e,t){const i={};return Object.keys(e).forEach((n=>{i[n]=function(e,t){var i,n;const o={ambientColorIntensity:new Float32Array(M(e.ambientColor,t).value.map((e=>e/255))),dir1ColorIntensity:new Float32Array(M(e.dir1Color,t).value.map((e=>e/255))),dir1Direction:j(v(e.dir1Altitude,t),v(e.dir1Azimuth,t)),dir2ColorIntensity:new Float32Array(M(e.dir2Color,t).value.map((e=>e/255))),dir2Direction:j(v(e.dir2Altitude,t),v(e.dir2Azimuth,t)),shadowLightIndex:null!==(i=e.shadowLightIndex)&&void 0!==i?i:-1,shadowRadius:null!==(n=e.shadowRadius)&&void 0!==n?n:1};return o.ambientColorIntensity[3]=v(e.ambientIntensity,t),o.dir1ColorIntensity[3]=v(e.dir1Intensity,t),o.dir2ColorIntensity[3]=v(e.dir2Intensity,t),o}(e[n],t)})),i}const D=o.Ue();function j(e,t){const i=new Float32Array(3);return n.t8(i,1,0,0),o.yR(D),o.jI(D,D,-(0,h.Id)(t-90)),o.uD(D,D,-(0,h.Id)(e)),n.VC(i,i,D),n.Fv(i,i),n.tk(i,i),i}function N(e,t,i,n){if((0,s.Uu)(t))switch(t.type){case"all":return function(e,t,i,n){t.array.forEach((t=>N(e,t,i,n)))}(e,t,i,n);case"match":return function(e,t,i,n){N(e,t.defaultOutput),t.cases.forEach((t=>N(e,t.output,i,n)))}(e,t,i,n);case"step":case"interpolate":return function(e,t,i,n){t.steps.forEach((t=>N(e,t.value,i,n)))}(e,t,i,n);case"coalesce":{if(!i)return void console.error("There is no context to resolve the expression. The value from data will not be added to the result.");const n=y(t,i);return void e.push(n)}case"precompute":if(n){return void N(e,n.precomputes[t.precomputeIndex].expr,i,n)}break;case"get":{if(!i)return void console.error("There is no context to resolve the expression. The value from data will not be added to the result.");const n=w(t,i);return void e.push(n)}}else e.push(t)}},314:(e,t,i)=>{"use strict";var n;i.d(t,{OD:()=>r,Zx:()=>n,vR:()=>s,ze:()=>o}),function(e){e[e.Uniform=1]="Uniform",e[e.Labeling=2]="Labeling",e[e.Generator=3]="Generator"}(n||(n={}));const o=-1;var r,s;!function(e){e.global="global",e.none="none"}(r||(r={})),function(e){e[e.Pixels=0]="Pixels",e[e.Meters=1]="Meters"}(s||(s={}))},8450:(e,t,i)=>{"use strict";i.d(t,{BL:()=>u,HU:()=>c,Kx:()=>d,PU:()=>l,nc:()=>s,ot:()=>a});var n=i(2543),o=i(6490);const r=/\.png$/i;function s(e){return!!e&&"polygon"===e.type}function a(e){return!!e&&"line"===e.type}function l(e){return e.reduce(((e,t,i)=>(e[t]=i,e)),{})}function d(e){if(void 0===e||"boolean"==typeof e)return Boolean(e);const t=JSON.stringify(e);return Boolean(t.match(/\["get","(db_)?sublayer"]/))}function c(e){return!(null==e?void 0:e.url.match(r))}function u(e,t){return(0,o.vZ)((0,n.FR)(e.style.sideColor,t),(0,n.FR)(e.style.sideStrokeColor,t))}},3741:(e,t,i)=>{"use strict";i.r(t),i.d(t,{geoLineDistance:()=>o.XV,geoToMapDistance:()=>o.a4,getCenterZoomByPoints:()=>d,getMetersFromPixels:()=>_,getMousePositionInContainer:()=>c.yK,projectGeoToMap:()=>u,projectGeoToScreen:()=>m,projectMapToGeo:()=>h,projectMapToScreen:()=>p,projectScreenToGeo:()=>f});var n=i(6490),o=i(9073),r=i(9218),s=i(4874),a=i(8585),l=i(7636);function d(e,t,i){const n=(0,l.g)(e,t,i);if(n)return{zoom:n.zoom,center:a.H.toGeo(n.center)}}var c=i(1274);const u=a.H.fromGeo,h=a.H.toGeo;function m(e,t,i,o,l,d,c={top:0,right:0,bottom:0,left:0},u={top:0,right:0,bottom:0,left:0},h=!1){return new s.V({center:a.H.fromGeo(e),zoom:t,rotation:(0,n.Id)(i),size:o,pitch:(0,n.Id)(l),viewport:c,padding:u,cameraConfig:r.defaultCameraConfig,globeMode:h,styleState:{}}).project(d)}function f(e,t,i,o,l,d,c={top:0,right:0,bottom:0,left:0},u={top:0,right:0,bottom:0,left:0},h=!1){return new s.V({center:a.H.fromGeo(e),zoom:t,rotation:(0,n.Id)(i),size:o,pitch:(0,n.Id)(l),viewport:c,padding:u,cameraConfig:r.defaultCameraConfig,globeMode:h,styleState:{}}).unproject(d)}function _(e,t,i,n,r,s,a={top:0,right:0,bottom:0,left:0},l={top:0,right:0,bottom:0,left:0},d){return(0,o.$X)(e,t,i,n,r,s,a,l,d,d)}function p(e,t){return new s.V(e).project(a.H.toGeo(t))}},5790:(e,t,i)=>{"use strict";i.d(t,{LA:()=>r,V9:()=>o,X6:()=>n,m9:()=>s});const n={NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519},o={FRONT:1028,BACK:1029,FRONT_AND_BACK:1032},r={ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776},s={FUNC_ADD:32774,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,MIN:32775,MAX:32776}},4874:(e,t,i)=>{"use strict";i.d(t,{V:()=>h});var n=i(9450),o=i(127),r=i(6490),s=i(9073),a=i(9218),l=i(8585);const d=[0,0,1],c=n.Ue(),u=[0,0,0];class h{constructor(e){this.state=e,this.position=[0,0,0],this.projectionMatrix=[],this.viewMatrix=[],this.viewMatrixTranspose=[],this.projectionMatrixInverse=[],this.viewProjectionMatrix=[],this.viewProjectionMatrixInverse=[],this.globeMatrix=[],this.ecefMvpMatrix=new Float32Array(16),this.flat2ecef=0,this.fogDistance=0,this.correctedPitch=0,this.correctedRotation=0,this.horizonPixelOffset=0,this.prevZoom=0,this.horizonPixelOffset=0,this.flat=new l.H(e,this),this.ecef=new l._(e,this),this.update()}get globeRatio(){return this.flat2ecef}setState(e){this.state=e,this.flat.setState(e),this.ecef.setState(e),this.update()}update(){const{globeMaxZoom:e}=a.globeConfig;this.flat2ecef=this.state.globeMode?(0,r.uZ)(e-this.state.zoom,0,1):0,this.limitPitchRotation(),this.updatePosition(),this.updateViewMatrix(),this.updateProjectionMatrices(),this.state.pitch=this.correctedPitch,this.state.rotation=this.correctedRotation,this.flat.update(),this.ecef.update(),o.Jp(this.viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),o.U_(this.viewProjectionMatrixInverse,this.viewProjectionMatrix),o.U_(this.projectionMatrixInverse,this.projectionMatrix),o.p4(this.viewMatrixTranspose,this.viewMatrix),this.state.globeMode&&this.updateGlobeMatrix(),o.dC(this.ecefMvpMatrix,this.viewProjectionMatrix,this.globeMatrix),this.updateHorizonPixelOffset(),this.updateFogDistance()}project(e,t=!1,i=[NaN,NaN]){if(this.flat2ecef<Number.EPSILON)return this.flat.project(l.H.fromGeo(e),t,i);if(this.flat2ecef>1-Number.EPSILON)return this.ecef.project(l._.fromGeo(e),t,i);{const o=this.flat.project(l.H.fromGeo(e),t),r=this.ecef.project(l._.fromGeo(e),t);return Array.from(n.t7(i,o,r,this.flat2ecef))}}unproject(e,t=[0,0],i=!1){if(this.flat2ecef<Number.EPSILON){const i=[0,0,0];return this.flat.unproject(e,i),l.H.toGeo(i,t),t}if(this.flat2ecef>1-Number.EPSILON){const i=[0,0,0];return this.ecef.unproject(e,!1,i),l._.toGeo(i,t),t}{const o=[0,0,0],r=[0,0,0];return this.flat.unproject(e,o),l.H.toGeo(o,o),this.ecef.unproject(e,!1,r),l._.toGeo(r,r),i?((0,s.xX)(this,e,r,o,t,2),t[2]=0,t):(n.t7(t,o,r,this.flat2ecef),t[2]=0,t)}}getViewportVertices(e){const{size:t,viewport:i}=this.state;let n={top:0,right:0,bottom:0,left:0};if(void 0!==e){const i=t[0]*e,o=t[1]*e;n={top:i,right:o,bottom:i,left:o}}return[this.flat.unproject([i.left+n.left,t[1]+i.top-n.bottom,0]),this.flat.unproject([t[0]+i.left-n.right,t[1]+i.top-n.bottom,0]),this.flat.unproject([t[0]+i.left-n.right,i.top+n.top,0]),this.flat.unproject([i.left+n.left,i.top+n.top,0])]}getHorizonPixelOffset(){return this.horizonPixelOffset}updatePosition(){const{center:e,zoom:t,size:i}=this.state,n=(0,s.r9)(t,i);this.prevZoom=t;const o=Math.max(n*Math.sin(this.correctedPitch),1);this.position[0]=e[0]+Math.sin(this.correctedRotation)*o,this.position[1]=e[1]-Math.cos(this.correctedRotation)*o,this.position[2]=n*Math.cos(this.correctedPitch)}limitPitchRotation(){const e=this.state,{zoom:t,pitch:i,rotation:n,cameraConfig:o,styleState:s,lowZoomMaxPitch:l,maxPitch:d}=e,{pitchInterStartZoom:c,pitchInterEndZoom:u}=o,{globeInterEndZoom:h,globeMaxZoom:m}=a.globeConfig;if(this.correctedPitch=i,this.correctedRotation=n,t<u){const e=Math.max(0,t-c)/(u-c);this.correctedPitch=Math.min(i,(0,r.t7)(null!=l?l:90,null!=d?d:90,e))}if(s.globeEnabled&&t<h){const e=Math.max(0,t-m)/(h-m);if(this.correctedPitch=Math.min(this.correctedPitch,(0,r.t7)(0,null!=d?d:90,e)),t<=m)this.correctedRotation=0;else if(t!==this.prevZoom){const e=0-n,i=(this.prevZoom-t)/(t-m);i>0&&(this.correctedRotation+=e*i%360)}}}updateProjectionMatrices(){const e=this.state.cameraConfig,t=e.fov;e.useDynamicNearFar||this.state.globeMode?this.updateNearFarState():this.restoreFixedNearFar();const{near:i,far:n}=e,{size:r,view:s}=this.correctViewAndSize(),a=r[0]/r[1];let l=i*Math.tan(t/2),d=2*l,c=a*d,u=-c/2;u+=s.x*c/r[0],l-=s.y*d/r[1],c*=s.width/r[0],d*=s.height/r[1];const h=u+c,m=l-d,f=this.projectionMatrix;f[0]=2*i/(h-u),f[5]=2*i/(l-m),f[8]=(h+u)/(h-u),f[9]=(l+m)/(l-m),f[10]=-(n+i)/(n-i),f[11]=-1,f[14]=-2*n*i/(n-i),f[1]=f[2]=f[3]=f[4]=f[6]=f[7]=f[12]=f[13]=f[15]=0,o.U_(this.projectionMatrixInverse,this.projectionMatrix)}updateNearFarState(){const{zoom:e,cameraConfig:t}=this.state,i=this.position;if(e>a.maxZoomForDynamicNear)t.near=a.defaultCameraConfig.near;else{const n=.25*i[2],o=Math.min(16-e,1);t.near=n*o+a.defaultCameraConfig.near*(1-o)}const n=Math.pow(1-Math.min(e,20.5)/21,2);t.far=a.defaultCameraConfig.far*n}restoreFixedNearFar(){const{cameraConfig:e}=this.state;e.near=a.defaultCameraConfig.near,e.far=a.defaultCameraConfig.far}correctViewAndSize(){const{size:e,padding:t}=this.state,i=Math.max(0,t.top-t.bottom)*Math.tan(this.correctedPitch),n=(0,s.pc)(e[1])+i,o={x:(t.right-t.left)/2,y:(t.bottom-t.top)/2,width:e[0],height:e[1]};o.y+=(n-e[1])/2;return{view:o,size:[e[0],n]}}updateFogDistance(){const{center:e}=this.state,t=this.state.cameraConfig,i=n.TK(this.position,e);this.fogDistance=Math.max(t.minFogDistance,i)}updateViewMatrix(){o.zB(this.viewMatrix,this.position,this.state.center,d)}updateGlobeMatrix(){const e=this.globeMatrix,t=[0,0,0];o.yR(e);const i=l.H.toGeo(this.state.center);n.t8(t,this.state.center[0],this.state.center[1],-this.state.center[2]-s.vF*s.C),o.Iu(this.globeMatrix,e,t),o.lM(e,e,(0,r.Id)(i[1])),o.uD(e,e,-(0,r.Id)(i[0]))}updateHorizonPixelOffset(){const{viewport:e,size:t,zoom:i}=this.state,o=this.flat.unproject([e.left,t[1]+e.top,0]),a=this.flat.unproject([e.left+t[0]/2,t[1]+e.top,0]),l=this.flat.unproject([t[0]+e.left,t[1]+e.top,0]);n.lu(u,l,o),n.jI(u,u,c,(0,r.Id)(90)),n.Fv(u,u);const d=(0,s.h0)(t[1]*this.state.cameraConfig.perspectiveDistanceLimitRatio,i);n.bA(u,u,d),n.IH(u,a,u),this.flat.project(u,!1,u),this.horizonPixelOffset=Math.max(0,Math.ceil(u[1]))}}},1359:(e,t,i)=>{"use strict";i.d(t,{JQ:()=>o,eS:()=>s,PY:()=>r,Rv:()=>a,Q0:()=>l});var n=i(8278);const o="default",r="floor",s="dynamicModel";var a;!function(e){e[e.PolygonExtrusion=1]="PolygonExtrusion",e[e.FloorPolygons=2]="FloorPolygons",e[e.All=3]="All"}(a||(a={}));class l{constructor(e){this.identifier=e,this.tileLayers=[],this.selected=[],this.hidden=new Map,this.parentChildrenMap=new Map,this.childParentMap=new Map,this.parentChildrenMapByTile=new Map,this.selectedIdsByApi=[]}registerTileLayer(e){this.tileLayers.push(e)}unregisterTileLayer(e){this.tileLayers=this.tileLayers.filter((t=>t!==e))}select(e){this.selectedIdsByApi=e.slice(),this.selected=this.getIdsToSelect(e),this.selected.sort();for(const e of this.tileLayers)e.setSelectedIds(this.selected);this.identifier.debouncedFillCache()}getSelected(){return this.selected}show(e){for(const t of e)this.hidden.delete(t);this.triggerIdUpdate(e)}hide(e,t=a.All){for(const i of e)this.hidden.set(i,t);this.triggerIdUpdate(e)}isHidden(e,t=a.All){var i;return(null!==(i=this.hidden.get(e))&&void 0!==i?i:0)>=t}getHidden(e=a.All){const t=new Set;return this.hidden.forEach(((i,n)=>{i>=e&&t.add(n)})),t}triggerIdUpdate(e){if(0!==e.length)for(const t of this.tileLayers)t.pushIdsToUpdate(e)}getRelatedChildrenIds(e){const t=new Set;return e.forEach((e=>{const i=this.parentChildrenMap.get(e);(null==i?void 0:i.size)&&i.forEach(t.add,t)})),Array.from(t)}removeParentChildrenData(e){let t=!1;e.forEach((e=>{const i=this.parentChildrenMapByTile.delete(e);!t&&i&&(t=!0)})),t&&this.rebuildMaps()}updateParentChildrenData(e,t){this.updateTileParentChildrenData(e,t)&&(this.addParentChildrenData(t),this.select(this.selectedIdsByApi))}addParentChildrenData(e){e&&e.size&&e.forEach(((e,t)=>{const i=this.parentChildrenMap.get(t);i?e.forEach((e=>{i.add(e),this.childParentMap.set(e,t)})):(this.parentChildrenMap.set(t,new Set(e)),e.forEach((e=>{this.childParentMap.set(e,t)})))}))}rebuildMaps(){this.parentChildrenMap.clear(),this.childParentMap.clear(),this.parentChildrenMapByTile.forEach((e=>this.addParentChildrenData(e)))}updateTileParentChildrenData(e,t){const i=this.parentChildrenMapByTile.get(e);return!function(e,t){if(!e||!t)return e===t;if(e.size!==t.size)return!1;for(const[i,o]of e){if(!t.has(i))return!1;if(!(0,n.Xy)(o,t.get(i)))return!1}return!0}(i,t)&&(i&&i.forEach(((e,t)=>{const i=this.parentChildrenMap.get(t);e.forEach((e=>{null==i||i.delete(e),this.childParentMap.delete(e)}))})),this.parentChildrenMapByTile.delete(e),t&&this.parentChildrenMapByTile.set(e,t),!0)}getIdsToSelect(e){const t=new Set(e);return e.forEach((e=>{if(this.parentChildrenMap.has(e)){const i=this.parentChildrenMap.get(e);(null==i?void 0:i.size)&&i.forEach(t.add,t)}})),Array.from(t)}}},8585:(e,t,i)=>{"use strict";i.d(t,{_:()=>h,H:()=>d.H});var n=i(378),o=i(9450),r=i(1245),s=i(127),a=i(9073),l=i(6490),d=i(7566);const c=r.Ue();function u(e){return[e[2],e[0],e[1]]}class h{constructor(e,t){this.state=e,this.camera=t,this.position=[0,0,0],this.ivpMatrix=[],this.cachedVisibleArc=new l.nw((()=>{const e=(0,a.r9)(this.state.zoom,this.state.size)/a.C;return Math.acos(a.vF/(a.vF+e))}),(()=>[this.state.zoom])),this.cachedPixelRadius=new l.nw((()=>{const e=d.H.toGeo(this.state.center),t=(0,a.es)(e,0,this.visibleArc),i=this.project(h.fromGeo(t));return i[0]-=this.state.viewport.left+this.state.size[0]/2+(this.state.padding.left-this.state.padding.right)/2,i[1]-=this.state.viewport.top+this.state.size[1]/2+(this.state.padding.top-this.state.padding.bottom)/2,n.Zh(i)}),(()=>[this.state.zoom,this.state.cameraConfig.fov,this.state.size[0],this.state.size[1],this.state.padding.bottom,this.state.padding.top,this.state.padding.left,this.state.padding.right,this.camera.globeMatrix[0]])),this.update()}get visibleArc(){return this.cachedVisibleArc.value}get pixelRadius(){return this.cachedPixelRadius.value}static fromGeo(e,t=[NaN,NaN,NaN]){const i=(0,l.Id)(e[0]),n=(0,l.Id)(e[1]),o=Math.cos(i),r=Math.sin(i),s=Math.cos(n),d=Math.sin(n),c=a.vF*a.C;return t[0]=r*s*c,t[1]=d*c,t[2]=o*s*c,t}static toGeo(e,t=[NaN,NaN]){const i=e[0],n=e[1],o=e[2],r=Math.sqrt(i*i+n*n+o*o),s=Math.asin(o/r),a=Math.atan2(n,i);return t[0]=(0,l.ZY)(a),t[1]=(0,l.ZY)(s),t}update(){const{state:e}=this,t=d.H.toGeo(e.center),i=(0,a.r9)(e.zoom,e.size)+a.vF*a.C,n=(0,l.Id)(t[0]),o=(0,l.Id)(t[1]),r=Math.cos(n),c=Math.sin(n),h=Math.cos(o),m=Math.sin(o);this.position=[c*h*i,m*i,r*h*i];s.zB(this.ivpMatrix,u(this.position),[0,0,0],[0,0,1]),s.dC(this.ivpMatrix,this.camera.projectionMatrix,this.ivpMatrix),s.U_(this.ivpMatrix,this.ivpMatrix)}project(e,t=!1,i=[NaN,NaN]){const{size:n,viewport:o}=this.state,s=r.Ue();c[0]=e[0],c[1]=e[1],c[2]=e[2],c[3]=1,r.fF(c,c,this.camera.globeMatrix),r.fF(s,c,this.camera.viewProjectionMatrix);const[a,l,d,u]=s,h=2*u;if(t&&(d>h||d<-h||a>h||a<-h||l>h||l<-h))return i[0]=NaN,i[1]=NaN,i;const m=n[0]/2,f=n[1]/2;return i[0]=m+o.left+a*m/u,i[1]=f+o.top-l*f/u,i}unproject(e,t,i=[NaN,NaN,NaN]){const{size:r,viewport:s}=this.state,l=[(e[0]-s.left)/r[0]*2-1,-(Math.max(0,e[1])-s.top)/r[1]*2+1,0],c=u(this.position),m=[0,0,0,1];o.fF(m,l,this.ivpMatrix);const f=o.Fv([],o.lu([],m,c)),_=o.tk([],c),p=o.AK(_,f),v=o.we(_)-Math.pow(p,2),g=Math.pow(a.vF*a.C,2);if(v>g){if(t)return h.fromGeo(d.H.toGeo(this.state.center));const{left:o,bottom:a,top:l,right:c}=this.state.padding,u=e[0]-s.left-r[0]/2-(o-c)/2,m=e[1]-s.top-r[1]/2-(l-a)/2,f=n.bA([],n.Fv([],[u,m]),this.pixelRadius-1);return f[0]=f[0]+s.left+r[0]/2+(o-c)/2,f[1]=f[1]+s.top+r[1]/2+(l-a)/2,this.unproject(f,!0,i)}const y=Math.sqrt(g-v),b=p-y,x=p+y,w=Math.min(b,x);return i[0]=c[0]+f[0]*w,i[1]=c[1]+f[1]*w,i[2]=c[2]+f[2]*w,i}setState(e){this.state=e}canSee(e){const t=d.H.toGeo(this.state.center);return(0,a.iw)(t,e)<this.visibleArc}}},7566:(e,t,i)=>{"use strict";i.d(t,{H:()=>d});var n=i(9450),o=i(1245),r=i(9073),s=i(6490),a=i(6273);const l=o.Ue();class d{constructor(e,t){this.state=e,this.camera=t,this.position=[0,0,0]}static fromGeo(e,t=[0,0]){var i;const n=a.sX/2,o=Math.sin((0,s.Id)(e[1])),l=e[0]*a.sX/360,c=Math.log((1+o)/(1-o))*a.sX/(4*Math.PI);let u=0;if(e.length>2){const t=d.scaleFactor(e[1]);u=(null!==(i=e[2])&&void 0!==i?i:0)*r.C*t}return t[0]=l,t[1]=(0,s.uZ)(c,-n,n),t[2]=u,t}static toGeo(e,t=[0,0]){t[0]=360*e[0]/a.sX;const i=-2*Math.PI/a.sX;if(t[1]=90-2*(0,s.ZY)(Math.atan(Math.exp(e[1]*i))),e[2]){const i=d.scaleFactor(t[1]);t[2]=e[2]/r.C/i}return t}static scaleFactor(e){return 1/Math.cos((0,s.Id)(e))}update(){const{center:e,rotation:t,zoom:i,pitch:n,size:o}=this.state,s=(0,r.r9)(i,o),a=Math.max(s*Math.sin(n),1);this.position[0]=e[0]+Math.sin(t)*a,this.position[1]=e[1]-Math.cos(t)*a,this.position[2]=s*Math.cos(n)}project(e,t=!1,i=[NaN,NaN]){const{size:n,viewport:r}=this.state;l[0]=e[0],l[1]=e[1],l[2]=e[2],l[3]=1,o.fF(l,l,this.camera.viewProjectionMatrix);const[s,a,d,c]=l,u=2*c;if(t&&(d>u||d<-u||s>u||s<-u||a>u||a<-u))return i;const h=n[0]/2,m=n[1]/2;return i[0]=h+r.left+s*h/c,i[1]=m+r.top-a*m/c,i}unproject(e,t=[0,0,0]){const{size:i,viewport:o}=this.state;t[0]=(e[0]-o.left)/i[0]*2-1,t[1]=-(Math.max(this.camera.horizonPixelOffset,e[1])-o.top)/i[1]*2+1,t[2]=0,n.fF(t,t,this.camera.viewProjectionMatrixInverse),t[0]-=this.position[0],t[1]-=this.position[1],t[2]-=this.position[2],n.Fv(t,t);const r=-this.position[2]/t[2];return t[0]=this.position[0]+t[0]*r,t[1]=this.position[1]+t[1]*r,t[2]=this.position[2]+t[2]*r,t}setState(e){this.state=e}}},6907:(e,t,i)=>{"use strict";i.d(t,{M:()=>C});var n=i(7731);function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r={read:function(e,t,i,n,o){var r,s,a=8*o-n-1,l=(1<<a)-1,d=l>>1,c=-7,u=i?o-1:0,h=i?-1:1,m=e[t+u];for(u+=h,r=m&(1<<-c)-1,m>>=-c,c+=a;c>0;r=256*r+e[t+u],u+=h,c-=8);for(s=r&(1<<-c)-1,r>>=-c,c+=n;c>0;s=256*s+e[t+u],u+=h,c-=8);if(0===r)r=1-d;else{if(r===l)return s?NaN:1/0*(m?-1:1);s+=Math.pow(2,n),r-=d}return(m?-1:1)*s*Math.pow(2,r-n)},write:function(e,t,i,n,o,r){var s,a,l,d=8*r-o-1,c=(1<<d)-1,u=c>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:r-1,f=n?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+u>=1?h/l:h*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[i+m]=255&a,m+=f,a/=256,o-=8);for(s=s<<o|a,d+=o;d>0;e[i+m]=255&s,m+=f,s/=256,d-=8);e[i+m-f]|=128*_}},s=l,a=r;function l(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}l.Varint=0,l.Fixed64=1,l.Bytes=2,l.Fixed32=5;var d=4294967296,c=1/d,u=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function h(e){return e.type===l.Bytes?e.readVarint()+e.pos:e.pos+1}function m(e,t,i){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(var o=i.pos-1;o>=e;o--)i.buf[o+n]=i.buf[o]}function f(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function _(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function p(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function v(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function g(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function y(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function b(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function x(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function w(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function S(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function M(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function I(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}l.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),o=n>>3,r=this.pos;this.type=7&n,e(o,t,this),this.pos===r&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=S(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=I(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=S(this.buf,this.pos)+S(this.buf,this.pos+4)*d;return this.pos+=8,e},readSFixed64:function(){var e=S(this.buf,this.pos)+I(this.buf,this.pos+4)*d;return this.pos+=8,e},readFloat:function(){var e=a.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=a.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,n=this.buf;return t=127&(i=n[this.pos++]),i<128||(t|=(127&(i=n[this.pos++]))<<7,i<128)||(t|=(127&(i=n[this.pos++]))<<14,i<128)||(t|=(127&(i=n[this.pos++]))<<21,i<128)?t:function(e,t,i){var n,o,r=i.buf;if(o=r[i.pos++],n=(112&o)>>4,o<128||(o=r[i.pos++],n|=(127&o)<<3,o<128)||(o=r[i.pos++],n|=(127&o)<<10,o<128)||(o=r[i.pos++],n|=(127&o)<<17,o<128)||(o=r[i.pos++],n|=(127&o)<<24,o<128)||(o=r[i.pos++],n|=(1&o)<<31,o<128))return function(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=n[this.pos]))<<28,e,this)},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&u?function(e,t,i){return u.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var n="",o=t;o<i;){var r,s,a,l=e[o],d=null,c=l>239?4:l>223?3:l>191?2:1;if(o+c>i)break;1===c?l<128&&(d=l):2===c?128==(192&(r=e[o+1]))&&((d=(31&l)<<6|63&r)<=127&&(d=null)):3===c?(r=e[o+1],s=e[o+2],128==(192&r)&&128==(192&s)&&(((d=(15&l)<<12|(63&r)<<6|63&s)<=2047||d>=55296&&d<=57343)&&(d=null))):4===c&&(r=e[o+1],s=e[o+2],a=e[o+3],128==(192&r)&&128==(192&s)&&128==(192&a)&&(((d=(15&l)<<18|(63&r)<<12|(63&s)<<6|63&a)<=65535||d>=1114112)&&(d=null))),null===d?(d=65533,c=1):d>65535&&(d-=65536,n+=String.fromCharCode(d>>>10&1023|55296),d=56320|1023&d),n+=String.fromCharCode(d),o+=c}return n}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==l.Bytes)return e.push(this.readVarint(t));var i=h(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==l.Bytes)return e.push(this.readSVarint());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==l.Bytes)return e.push(this.readBoolean());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==l.Bytes)return e.push(this.readFloat());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==l.Bytes)return e.push(this.readDouble());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==l.Bytes)return e.push(this.readFixed32());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==l.Bytes)return e.push(this.readSFixed32());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==l.Bytes)return e.push(this.readFixed64());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==l.Bytes)return e.push(this.readSFixed64());var t=h(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===l.Varint)for(;this.buf[this.pos++]>127;);else if(t===l.Bytes)this.pos=this.readVarint()+this.pos;else if(t===l.Fixed32)this.pos+=4;else{if(t!==l.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),M(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),M(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),M(this.buf,-1&e,this.pos),M(this.buf,Math.floor(e*c),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),M(this.buf,-1&e,this.pos),M(this.buf,Math.floor(e*c),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,n;if(e>=0?(i=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var n,o,r=0;r<t.length;r++){if((n=t.charCodeAt(r))>55295&&n<57344){if(!o){n>56319||r+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):o=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(e[i++]=239,e[i++]=191,e[i++]=189,o=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&m(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),a.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),a.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var n=this.pos-i;n>=128&&m(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,i){this.writeTag(e,l.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,_,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,g,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,v,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,y,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,b,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,x,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,w,t)},writeBytesField:function(e,t){this.writeTag(e,l.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,l.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,l.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,l.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,l.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,l.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,l.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,l.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,l.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,l.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};const T=o(s);const E={1:({pbf:e})=>e.readBoolean(),2:({pbf:e})=>e.readDouble(),3:({pbf:e})=>e.readString(),5:e=>{const{pbf:t}=e,i=t.readVarint(),n=new Array(i);for(let o=0;o<i;o++)n[o]=P(e,t.readVarint());return n},4:e=>{const{pbf:t}=e,i=t.readVarint(),n={};for(let r=0;r<i;r++){var o=t.readVarint();n[e.keys[o>>3]]=P(e,7&o)}return n},6:e=>null};function P(e,t){const i=e.pbf;if(i.pos<i.length){const i=E[t];if(!i)throw new Error(`Type ${t} is not supported`);return i(e)}}function A(e){const t=e.readVarint(),i=[];for(let n=0;n<t;n++){const t=e.readString(),n=e.readVarint();i.push({key:t,type:n})}return i}var L=i(1777);function C(e){const t=new L.r;if(e instanceof ArrayBuffer){const i=function(e,t){if(!e||!e.byteLength||e.byteLength<4)throw new Error("Bad array or insufficient array length.");const i=new T(e),n=i.readFixed32(),o=n>>24&255;if(o>1)throw new Error(`Version ${o} is not supported`);const r=n>>16&255,s=(null==t?void 0:t.method)??r;if(1===r&&1!==s)throw new Error("Packed with PackMethod.Generic cannot be unpacked with anything than UnpackMethod.Generic");switch(s){case 1:const t=i.readFixed32();if(t>=e.byteLength)return;const n=i.pos;i.pos=t;const o=i.readVarint(),r=new Array(o);for(let e=0;e<o;e++)r[e]=i.readString();i.pos=n;const a=i.readVarint();return P({keys:r,pbf:i},a);case 2:{const e={keys:[],pbf:i},t=i.readFixed32(),n=A(i),o={};for(const{key:i,type:r}of n){const n=E[r],s=[];for(let i=0;i<t;i++)s.push(n(e));o[i]=s}return o}case 3:{const e={keys:[],pbf:i},t=i.readFixed32(),n=A(i),o=new Array(t);for(let e=0;e<t;e++)o[e]={};for(const{key:i,type:r}of n){const n=E[r];for(let r=0;r<t;r++)o[r][i]=n(e)}return o}default:throw new Error(`Method ${s} is not supported`)}}(e);if(Array.isArray(i))for(let e of i){const{id:i}=e,o=(0,n._T)(e,["id"]);t.set(i,o)}else for(const e in i)t.set(e,i[e])}else for(const i in e)t.set(i,e[i]);return t}},1393:(e,t,i)=>{"use strict";i.d(t,{d_:()=>m,xr:()=>p,Xp:()=>f,lG:()=>b});var n=i(9450),o=i(378),r=i(3287);var s=i(7123),a=i(6392);i(8585);const l=n.Ue(),d=n.Ue(),c=o.Ue(),u=o.Ue(),h=function(){let e=new r.WT(4);return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}(),m=64;function f(e,t){const i=s();for(let n=0;n<t.length;n+=3){const o=t[n],r=t[n+1],s=t[n+2],a=_(e,o),l=_(e,r),d=_(e,s),c=[a,l,d];i.insert({minX:Math.min(a[0],l[0],d[0]),minY:Math.min(a[1],l[1],d[1]),maxX:Math.max(a[0],l[0],d[0]),maxY:Math.max(a[1],l[1],d[1]),data:c})}return i}function _(e,t){return[e[3*t],e[3*t+1],e[3*t+2]]}function p(e,t){const i=n.t8(l,t[0],t[1],0),o=(0,a.cL)(e.key),r=(0,a.Bs)(o),s=new Uint16Array(3);(0,a.a2)(s,i,r);const d=e.tree.search({minX:s[0],maxX:s[0],minY:s[1],maxY:s[1]});for(const e of d){const[t,i,n]=e.data,o=v(t,i,n,s,l);if(!o)continue;return t[2]*o[0]+i[2]*o[1]+n[2]*o[2]}}function v(e,t,i,o,r){const s=g(e,t,i);if(0===s){if(e[0]===t[0]&&t[0]===i[0]&&e[1]===t[1]&&t[1]===i[1])return e[0]===o[0]&&e[1]===o[1]?(r[0]=1,r[1]=0,r[2]=0,r):null;let s=null;if(y(e,t,o)){const i=b(e,t,o);s=n.t7(l,e,t,i),r[0]=1-i,r[1]=i,r[2]=0}if(y(t,i,o)){const e=b(t,i,o),a=n.t7(d,t,i,e);(!s||a[2]>s[2])&&(r[0]=0,r[1]=1-e,r[2]=e,s||(s=l),n.JG(s,a))}if(y(i,e,o)){const t=b(i,e,o),a=n.t7(d,i,e,t);(!s||a[2]>s[2])&&(r[0]=t,r[1]=0,r[2]=1-t,s||(s=l),n.JG(s,a))}if(s)return r}const a=g(o,t,i)/s,c=g(o,i,e)/s,u=1-a-c;return a<0||c<0||u<0||a>1||c>1||u>1?null:(r[0]=a,r[1]=c,r[2]=u,r)}function g(e,t,i){var n,o,r,s,a,l;return n=h,o=t[0]-e[0],r=i[0]-e[0],s=t[1]-e[1],a=i[1]-e[1],n[0]=o,n[1]=r,n[2]=s,n[3]=a,(l=h)[0]*l[3]-l[2]*l[1]}function y(e,t,i){const n=(t[0]-e[0])*(i[1]-e[1])-(t[1]-e[1])*(i[0]-e[0]);if(Math.abs(n)>1e-8)return!1;return(i[0]-e[0])*(i[0]-t[0])+(i[1]-e[1])*(i[1]-t[1])<=0}function b(e,t,i){const n=o.lu(c,t,e),r=o.lu(u,i,e);return o.AK(r,n)/o.we(n)}},7231:(e,t,i)=>{"use strict";i.d(t,{n:()=>a});var n=i(7731),o=i(6392),r=i(314),s=i(4526);class a{constructor(e,t,i){this.id=e,this.modules=t,this.options=i,this.type="geojson",this.idToIndex={},this.worker=new this.modules.workers.parser.GeoJsonSource(this.options,this.id),this.attributes=i.attributes||{},this.dataFilter=i.dataFilter}fetchTiles(e){return this.worker.fetchTiles(e).map((e=>e.catch((()=>Promise.resolve())).then((()=>[{regionId:0,metatileHash:-2}]))))}generateTile(e,t,i,r,s){return(0,n.mG)(this,void 0,void 0,(function*(){const n=this.options.modelsPath,a=yield this.worker.generateTile(e.styleState,t,i,r,s,n,this.dataFilter,e.modelShowHideEventsSublayers);return Array.isArray(a.results)?(a.results[0]&&a.results[0].idToIndex&&(this.idToIndex[(0,o.gx)(t)]=a.results[0].idToIndex),a):{results:[],transferable:[]}}))}getObjectAttributes(e,t){return Promise.resolve(this.worker.getObjectAttributes(e,t))}abortTileFetches(e){this.worker.abortTileFetches(e)}deleteTiles(e){for(const t of e)delete this.idToIndex[(0,o.gx)(t)];this.worker.deleteTiles(e)}setAttributes(e){this.worker.setSourceAttrs(e),this.attributes=e}getAttributes(){return this.attributes}destroy(){this.idToIndex={},this.worker.destroy()}setFeatureStateMap(e){this.worker.setFeatureStateMap(e)}setData(e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.idToIndex={},this.options=this.options="string"==typeof e?Object.assign(Object.assign({},this.options),{url:e}):Object.assign(Object.assign({},this.options),{data:e}),yield this.worker.setData(e)}))}getComponentIndex(e,t){var i;return t?null===(i=this.idToIndex[t])||void 0===i?void 0:i[e]:(console.warn("Нет tileKey при идентификации объекта из GeoJsonSource. Пытаемся получить index из id по-старому."),Number.isNaN(+e)?void 0:+e%Math.pow(2,32))}setDataFilter(e){this.dataFilter=e?(0,s.c$)(e,{precomputes:[]},r.Zx.Generator):void 0}}},4619:(e,t,i)=>{"use strict";i.d(t,{Sj:()=>s,X4:()=>d,Y0:()=>r,fZ:()=>l});var n=i(7188);const o={point:{point:!0,heatmap:!0,gltfModel:!0,metricPoint:!0},polygon:{polygon:!0,polygonExtrusion:!0,mesh:!0,embankment:!0,polygon3d:!0,overpass:!0},line:{line:!0,lineExtrusion:!0,labelLine:!0,dashedLine:!0,oneWayLine:!0,metricPoint:!0,overpass:!0}};function r(e,t){return!!o[e][t]}function s(e){const t=e.vertices.x,i=e.vertices.y;let n=0;for(let e=0;e<t.length-1;e++)n+=Math.hypot(t[e]-t[e+1],i[e]-i[e+1]);return n}function a(e,t){const i=new Set(t[0].map(((i,n)=>t[0][n]===e[0]&&e[1]===t[1][n]?n:-1)));return Array.from(i)}function l(e,t){const i=a([e[0][0],e[1][0]],t),n=a([e[0][1],e[1][1]],t),o=a([e[0][2],e[1][2]],t);i.forEach((t=>n.forEach((i=>o.forEach((n=>{!function(e,t,i,n){t>=0&&i>=0&&1===Math.abs(t-i)&&(e[2][0]=1),i>=0&&n>=0&&1===Math.abs(i-n)&&(e[2][1]=1),t>=0&&n>=0&&1===Math.abs(t-n)&&(e[2][2]=1)}(e,t,i,n)}))))))}function d(){return(0,n.KP)(["id","db_label","db_label2","selected","hovered","componentDistanceStart","componentDistanceEnd","objectLength","beginningIsCut","endingIsCut","db_geometry_type","db_plan_id"],["GEOJSON_METATILE_UNKNOWN_SUBLAYER","Commercial_poi_default","Commercial_poi_city","Commercial_poi_premium","Commercial_model","Immersive_model","Immersive_model_multipart","Animated_immersive_model"])}},5071:(e,t,i)=>{"use strict";i.d(t,{T0:()=>v,Xm:()=>p,f7:()=>u,gs:()=>_,pl:()=>f,rR:()=>h});var n=i(7731),o=i(7619),r=i(7231),s=i(9218),a=i(9600),l=i(6273),d=i(8124),c=i(9476);const u=15,h=17;class m{constructor(e,t,i){var n,d,c;this.type="geojson",this.isCustomPromoteId=!1,this.id=(0,a.Q)(),this.modelsAppearStrategy=null!==(n=t.modelsAppearStrategy)&&void 0!==n?n:l.jm,this.modules=e.modules,this.mapglApiSource=i,this.identifiedAsDefault=!!t.identifyAsDefaultSource,t.promoteId&&(this.isCustomPromoteId=!0),this.identifiedAsDefault&&!t.promoteId&&(t.promoteId="db_id"),"generateId"in t&&t.promoteId&&(t.generateId=!1),this.sourceCore=new r.n(this.id,this.modules,t);const m=null!==(d=t.minZoom)&&void 0!==d?d:s.MAP_DEFAULTS.minZoom,f=Math.min(null!==(c=t.maxZoom)&&void 0!==c?c:u,h);this.layer=new o.I(m,f,m,h,this.modules,e.state,this.sourceCore,t),this.modules.tileManager.addTileLayer(this.layer)}destroy(){this.modules.tileManager.removeTileLayer(this.layer),this.layer.destroy(),this.modules.sourceStorage.removeSource(this.getId()),this.sourceCore.destroy()}setAttributes(e){this.sourceCore.setAttributes(e),this.layer.redraw(),this.modules.identifier.resetCache()}getAttributes(){return this.sourceCore.getAttributes()}getZoomDirection(){return this.layer.getZoomDirection()}getId(){return this.sourceCore.id}isIdentifiedAsDefault(){return this.identifiedAsDefault}}const f={type:"FeatureCollection",features:[]};class _ extends m{constructor(e,t,i){t.generateId=!0,super(e,t,i),this.subtype="internal",this.data=t.data,this instanceof _&&this.modules.sourceStorage.addSource(this)}getFeatureById(e,t){if("FeatureCollection"===this.data.type){let i;const n=this.sourceCore.getComponentIndex(e,t);return void 0===n?(this.isCustomPromoteId&&(i=this.data.features.find((t=>t.id===e))),i):this.data.features[n]}return this.data}destroy(){super.destroy(),this.data=f}setData(e){return(0,n.mG)(this,void 0,void 0,(function*(){(yield this.sourceCore.setData(e))&&(this.data=e,this.layer.onSourceDataChange(),this.modules.identifier.resetCache())}))}setDataFilter(e){this.sourceCore.setDataFilter(e)}}class p extends m{constructor(e,t,i){super(e,t,i),this.subtype="external",t.preventInteractions&&(t.promoteId=void 0),this.modules.sourceStorage.addSource(this)}getObjectAttributes(e,t){return this.sourceCore.getObjectAttributes(e,t)}setDataUrl(e){return(0,n.mG)(this,void 0,void 0,(function*(){(yield this.sourceCore.setData(e))&&(this.layer.onSourceDataChange(),this.modules.identifier.resetCache())}))}}class v extends _{constructor(e,t,i){super(e,t,i),this.subtype="viewport-internal",this.destroyed=!1,this.viewportDiffer=new d.H([{path:"center",type:"vec3"},{path:"zoom",type:"number"},{path:"size",type:"vec2"},{path:"rotation",type:"number"},{path:"pitch",type:"number"},{path:"padding",type:"padding"},{path:"demMode",type:"boolean"},{path:"elevation",type:"number"},{path:"minElevation",type:"number"}]),this._map=e,this.viewportPadding=t.viewportPadding,this.modules.sourceStorage.addSource(this)}setDataFn(e){return(0,n.mG)(this,void 0,void 0,(function*(){this.setViewportHandler(e)}))}setViewportPadding(e){this.viewportPadding=e,this.viewportHandler&&this.viewportHandler()}update(){this.viewportDiffer.check(this._map.state)&&this.viewportHandler&&this.viewportHandler()}destroy(){this.destroyed=!0,this.viewportHandler&&(this.viewportHandler.cancel(),this.viewportHandler=void 0),super.destroy()}setViewportHandler(e){if(!e)return this.setData(f),void(this.viewportHandler=void 0);this.viewportHandler=(0,c.D)((()=>(0,n.mG)(this,void 0,void 0,(function*(){const t=this._map.getBounds({sizeExtension:this.viewportPadding}),i=t.southWest,n=t.northEast,o=[i[0],i[1],n[0],n[1]],r=e(o);let s=f;try{const e=yield fetch(r);e.ok||console.error(`Failed to fetch a tile by url "${r}", status: ${e.status}`);const t=e.headers.get("content-type");t&&t.includes("application/json")||console.error(`Failed to fetch a tile by url "${r}", expected the "application/json" data but got "${t}"`),s=yield e.json()}catch(e){console.error(`Failed to fetch a tile by url "${r}", message: ${e.message}`)}this.destroyed||this.setData(s)}))),500),this.viewportHandler()}}},2176:(e,t,i)=>{"use strict";i.d(t,{T:()=>me});var n=i(1436),o=i(6392),r=i(7188),s=i(9981),a=i(4619),l=i(5071);function d(e,t,i,n,o=2){const r=o+2;let s=n;const a=i-t>>1;let l,u=i-t;const h=e[t],m=e[t+1],f=e[i],_=e[i+1];for(let n=t+r;n<i;n+=r){const t=c(e[n],e[n+1],h,m,f,_);if(t>s)l=n,s=t;else if(t===s){const e=Math.abs(n-a);e<u&&(l=n,u=e)}}s>n&&(l-t>r&&d(e,t,l,n,o),e[l+2]=s,i-l>r&&d(e,l,i,n,o))}function c(e,t,i,n,o,r){let s=o-i,a=r-n;if(0!==s||0!==a){const l=((e-i)*s+(t-n)*a)/(s*s+a*a);l>1?(i=o,n=r):l>0&&(i+=s*l,n+=a*l)}return s=e-i,a=t-n,s*s+a*a}function u(e,t,i,n,o,r=4){const s={id:null==e?null:e,index:o,type:t,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)h(s,i,r);else if("Polygon"===t)h(s,i[0],r);else if("MultiLineString"===t)for(const e of i)h(s,e,r);else if("MultiPolygon"===t)for(const e of i)h(s,e[0],r);return s}function h(e,t,i=4){for(let n=0;n<t.length;n+=i)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function m(e,t,i,n){if(!t.geometry)return;const o=t.geometry.coordinates,r=t.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let a=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===r)f(o,a,i.dimensions);else if("MultiPoint"===r)for(const e of o)f(e,a,i.dimensions);else if("LineString"===r)_(o,a,s,!1,i.dimensions);else if("MultiLineString"===r){if(i.lineMetrics){for(const r of o)a=[],_(r,a,s,!1,i.dimensions),e.push(u(l,"LineString",a,t.properties,n,i.dimensions+2));return}p(o,a,s,!1,i.dimensions)}else if("Polygon"===r)p(o,a,s,!0,i.dimensions);else{if("MultiPolygon"!==r){if("GeometryCollection"===r){for(const o of t.geometry.geometries)m(e,{id:l,geometry:o,properties:t.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of o){const t=[];p(e,t,s,!0,i.dimensions),a.push(t)}}e.push(u(l,r,a,t.properties,n,i.dimensions+2))}function f(e,t,i=2){t.push(v(e[0]),g(e[1]),0,1);for(let n=2;n<i;n++)t.push(e[n])}function _(e,t,i,n,o=2){let r,s,a=0;for(let i=0;i<e.length;i++){const l=v(e[i][0]),d=g(e[i][1]);t.push(l,d,0,1);for(let n=2;n<o;n++)t.push(e[i][n]);i>0&&(a+=n?(r*d-l*s)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(d-s,2))),r=l,s=d}const l=t.length-(o+2);t[2]=1,d(t,0,l,i,o),t[l+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function p(e,t,i,n,o=2){for(let r=0;r<e.length;r++){const s=[];_(e[r],s,i,n,o),t.push(s)}}function v(e){return e/360+.5}function g(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function y(e,t,i,n,o,r,s,a){const l=(void 0===a.dimensions?2:a.dimensions)+2;if(n/=t,r>=(i/=t)&&s<n)return e;if(s<i||r>=n)return null;const d=[];for(const t of e){const e=t.geometry;let r=t.type;const s=0===o?t.minX:t.minY,c=0===o?t.maxX:t.maxY;if(s>=i&&c<n){d.push(t);continue}if(c<i||s>=n)continue;let h=[];if("Point"===r||"MultiPoint"===r)b(e,h,i,n,o,l);else if("LineString"===r)x(e,h,i,n,o,!1,a.lineMetrics,l);else if("MultiLineString"===r)S(e,h,i,n,o,!1,l);else if("Polygon"===r)S(e,h,i,n,o,!0,l);else if("MultiPolygon"===r)for(const t of e){const e=[];S(t,e,i,n,o,!0,l),e.length&&h.push(e)}if(h.length){if(a.lineMetrics&&"LineString"===r){for(const e of h)d.push(u(t.id,r,e,t.tags,t.index,l));continue}"LineString"!==r&&"MultiLineString"!==r||(1===h.length?(r="LineString",h=h[0]):r="MultiLineString"),"Point"!==r&&"MultiPoint"!==r||(r=h.length===l?"Point":"MultiPoint"),d.push(u(t.id,r,h,t.tags,t.index,l))}}return d.length?d:null}function b(e,t,i,n,o,r=4){for(let s=0;s<e.length;s+=r){const a=e[s+o];if(a>=i&&a<=n){M(t,e[s],e[s+1],e[s+2]);for(let i=3;i<r;i++)t.push(e[s+i])}}}function x(e,t,i,n,o,r,s,a=4){let l=w(e);const d=0===o?I:T;let c,u,h=e.start;for(let m=0;m<e.length-a;m+=a){const f=e[m],_=e[m+1],p=e[m+2],v=e[m+a],g=e[m+a+1],y=0===o?f:_,b=0===o?v:g;let x=!1;if(s&&(c=Math.sqrt(Math.pow(f-v,2)+Math.pow(_-g,2))),y<i){if(b>i){u=d(l,f,_,v,g,i),l.push(0);for(let t=4;t<a;t++){const i=e[m+t];l.push((e[m+a+t]-i)*u+i)}s&&(l.start=h+c*u)}}else if(y>n){if(b<n){u=d(l,f,_,v,g,n),l.push(0);for(let t=4;t<a;t++){const i=e[m+t];l.push((e[m+a+t]-i)*u+i)}s&&(l.start=h+c*u)}}else{M(l,f,_,p);for(let t=3;t<a;t++)l.push(e[m+t])}if(b<i&&y>=i){u=d(l,f,_,v,g,i),l.push(0);for(let t=4;t<a;t++){const i=e[m+t];l.push((e[m+a+t]-i)*u+i)}x=!0}if(b>n&&y<=n){u=d(l,f,_,v,g,n),l.push(0);for(let t=4;t<a;t++){const i=e[m+t];l.push((e[m+a+t]-i)*u+i)}x=!0}!r&&x&&(s&&(l.end=h+c*u),t.push(l),l=w(e)),s&&(h+=c)}let m=e.length-a;const f=e[m],_=e[m+1],p=e[m+2],v=0===o?f:_;if(v>=i&&v<=n){M(l,f,_,p);for(let t=3;t<a;t++)l.push(e[m+t])}if(m=l.length-a,r&&m>=3&&(l[m]!==l[0]||l[m+1]!==l[1])){M(l,l[0],l[1],l[2]);for(let e=3;e<a;e++)l.push(l[e])}l.length&&t.push(l)}function w(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function S(e,t,i,n,o,r,s){for(const a of e)x(a,t,i,n,o,r,!1,s)}function M(e,t,i,n){e.push(t,i,n)}function I(e,t,i,n,o,r){const s=(r-t)/(n-t);return M(e,r,i+(o-i)*s,1),s}function T(e,t,i,n,o,r){const s=(r-i)/(o-i);return M(e,t+(n-t)*s,r,1),s}function E(e,t,i=4){const n=[];for(let o=0;o<e.length;o++){const r=e[o],s=r.type;let a;if("Point"===s||"MultiPoint"===s||"LineString"===s)a=P(r.geometry,t,i);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const e of r.geometry)a.push(P(e,t,i))}else if("MultiPolygon"===s){a=[];for(const e of r.geometry){const n=[];for(const o of e)n.push(P(o,t,i));a.push(n)}}n.push(u(r.id,s,a,r.tags,r.index,i))}return n}function P(e,t,i=4){const n=[];n.size=e.size,void 0!==e.start&&(n.start=e.start,n.end=e.end);for(let o=0;o<e.length;o+=i){n.push(e[o]+t,e[o+1],e[o+2],e[o+3]);for(let t=4;t<i;t++)n.push(e[o+t])}return n}function A(e,t,i){if(e.transformed)return e;const n=1<<e.z,o=e.x,r=e.y;for(const s of e.features){const e=s.geometry,a=s.type;s.geometry=[];const l=i.cuts&&1!==a?1:0,d=i.dimensions+l;if(1===a)for(let i=0;i<e.length;i+=d)s.geometry.push(C(e,i,d,t,n,o,r));else if(2===a)s.geometry=L(e,t,n,o,r,d);else for(let i=0;i<e.length;i++)s.geometry.push(L(e[i],t,n,o,r,d))}return e.transformed=!0,e}function L(e,t,i,n,o,r=3){const s=[];for(let a=0;a<e.length;a++){const l=[];for(let s=0;s<e[a].length;s+=r)l.push(C(e[a],s,r,t,i,n,o));s.push(l)}return s}function C(e,t,i,n,o,r,s){const a=[Math.round(n*(e[t]*o-r)),Math.round(n*(e[t+1]*o-s))];for(let n=2;n<i;n++)a.push(e[t+n]);return a}function z(e,t,i,n,o){const r=t===o.maxZoom?0:o.tolerance/((1<<t)*o.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const t of e)k(s,t,r,o);return s}function k(e,t,i,n){const o=t.geometry,r=t.type,s=n.dimensions+2;let a=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===r||"MultiPoint"===r)for(let t=0;t<o.length;t+=s){a.push(o[t],o[t+1]);for(let e=4;e<s;e++)a.push(o[t+e]);e.numPoints++,e.numSimplified++}else if("LineString"===r)O(a,o,e,i,!1,!1,n);else if("MultiLineString"===r||"Polygon"===r){for(let t=0;t<o.length;t++)O(a,o[t],e,i,"Polygon"===r,0===t,n);"Polygon"===r&&a.length&&(a=[a])}else if("MultiPolygon"===r)for(let t=0;t<o.length;t++){const r=o[t],s=[];for(let t=0;t<r.length;t++)O(s,r[t],e,i,!0,0===t,n);s.length&&a.push(s)}if(a.length){let i=t.tags||null;if("LineString"===r&&n.lineMetrics){i={};for(const e in t.tags)i[e]=t.tags[e];i.mapbox_clip_start=o.start/o.size,i.mapbox_clip_end=o.end/o.size}const s={geometry:a,type:"Polygon"===r||"MultiPolygon"===r?3:"LineString"===r||"MultiLineString"===r?2:1,tags:i};null!==t.id&&(s.id=t.id),n.generateIndex&&(s.index=t.index),e.features.push(s)}}function O(e,t,i,n,o,r,s){const a=n*n,l=s&&!!s.cuts,d=s.dimensions+2;if(n>0&&t.size<(o?a:n))return void(i.numPoints+=t.length/d);const c=[];for(let e=0;e<t.length;e+=d){if(0===n||t[e+2]>a){i.numSimplified++,c.push(t[e],t[e+1]);for(let i=4;i<d;i++)c.push(t[e+i]);l&&c.push(t[e+3])}i.numPoints++}if(o){!function(e,t,i=3){let n=0;for(let t=0,o=e.length,r=o-i;t<o;r=t,t+=i)n+=(e[t]-e[r])*(e[t+1]+e[r+1]);if(n>0===t)for(let t=0,n=e.length;t<n/2;t+=i)for(let o=0;o<i;o++){const r=e[t+o],s=n-t-(i-o);e[t+o]=e[s],e[s]=r}}(c,r,d-(l?1:2))}e.push(c)}const R=1,F=2,B=3,D={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,generateIndex:!1,debug:0,dimensions:2,cuts:!1};class j{constructor(e,t){const i=(t=this.options=function(e,t){for(const i in t)e[i]=t[i];return e}(Object.create(D),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let n=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)m(i,e.features[n],t,n);else"Feature"===e.type?m(i,e,t,0):m(i,{geometry:e},t,0);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(e,t){const i=t.buffer/t.extent,n=t.dimensions+2;let o=e;const r=y(e,1,-1-i,i,0,-1,2,t),s=y(e,1,1-i,2+i,0,-1,2,t);return(r||s)&&(o=y(e,1,-i,1+i,0,-1,2,t)||[],r&&(o=E(r,1,n).concat(o)),s&&(o=o.concat(E(s,-1,n)))),o}(n,t),n.length&&this.splitTile(n,0,0,0),i&&(n.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(e,t,i,n,o,r,s){const a=[e,t,i,n],l=this.options,d=l.debug;for(;a.length;){n=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();const c=1<<t,u=N(t,i,n);let h=this.tiles[u];if(!h&&(d>1&&console.time("creation"),h=this.tiles[u]=z(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n}),d)){d>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(h.source=e,null==o){if(t===l.indexMaxZoom||h.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===o)continue;if(null!=o){const e=o-t;if(i!==r>>e||n!==s>>e)continue}}if(h.source=null,0===e.length)continue;d>1&&console.time("clipping");const m=.5*l.buffer/l.extent,f=.5-m,_=.5+m,p=1+m;let v=null,g=null,b=null,x=null,w=y(e,c,i-m,i+_,0,h.minX,h.maxX,l),S=y(e,c,i+f,i+p,0,h.minX,h.maxX,l);e=null,w&&(v=y(w,c,n-m,n+_,1,h.minY,h.maxY,l),g=y(w,c,n+f,n+p,1,h.minY,h.maxY,l),w=null),S&&(b=y(S,c,n-m,n+_,1,h.minY,h.maxY,l),x=y(S,c,n+f,n+p,1,h.minY,h.maxY,l),S=null),d>1&&console.timeEnd("clipping"),a.push(v||[],t+1,2*i,2*n),a.push(g||[],t+1,2*i,2*n+1),a.push(b||[],t+1,2*i+1,2*n),a.push(x||[],t+1,2*i+1,2*n+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const n=this.options,{extent:o,debug:r}=n;if(e<0||e>24)return null;const s=1<<e,a=N(e,t=t+s&s-1,i);if(this.tiles[a])return A(this.tiles[a],o,n);r>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,d=e,c=t,u=i;for(;!l&&d>0;)d--,c>>=1,u>>=1,l=this.tiles[N(d,c,u)];return l&&l.source?(r>1&&(console.log("found parent tile z%d-%d-%d",d,c,u),console.time("drilling down")),this.splitTile(l.source,d,c,u,e,t,i),r>1&&console.timeEnd("drilling down"),this.tiles[a]?A(this.tiles[a],o,n):null):null}}function N(e,t,i){return 32*((1<<e)*i+t)+e}var U=i(7084),H=i(6273),G=i(6490),V=i(9073),Z=i(8585);function W(e,t,i,n){const o=[];return e.geometry.forEach((r=>{const s=[],l=[],d=[];r.forEach((e=>{d.push(...function(e,t){const i=[];let n=[];for(let o=0;o<e.length;o++){const r=e[o];if(n.push(q(r,t)),!Y(r,t))continue;const s=e[o+1];if(!s)break;J(r,s,t)&&(n.length>1&&i.push(n),n=[])}n.length>1&&i.push(n);return i}(e,t)),s.length&&l.push(s.length),s.push(...e)}));const c=[];for(let e=0;e<s.length;e++)for(let t=0;t<i;t++)c.push(s[e][t]);const u=U(c,l,i),h=new Array(i);for(let r=0;r<u.length;r+=3){const l=[];for(let e=0;e<i+1;e++)l.push([]);for(let e=0;e<3;e++)$(h,s[u[r+2-e]],t,n),l[0][e]=h[0],l[1][e]=h[1],l[2][e]=0,i>2&&(l[3][e]=h[2]),i>3&&(l[4][e]=h[3]);d.forEach((e=>{const t=[[],[],[]];e.forEach(((e,i)=>{t[0][i]=e[0],t[1][i]=e[1]})),(0,a.fZ)(l,t)})),o.push({tags:e.tags,id:e.id,index:e.index,type:"polygon",vertices:{x:l[0],y:l[1],cut:l[2],signed_z:l[3],abs_z:l[4]}})}})),o}function X(e,t,i,n){const o=Array(i);return e.geometry.map((r=>{const s=[];for(let e=0;e<i;e++)s.push([]);return r.forEach(((e,r)=>{$(o,e,t,n),s[0][r]=o[0],s[1][r]=o[1],i>2&&(s[2][r]=o[2]),i>3&&(s[3][r]=o[3])})),{tags:e.tags,id:e.id,index:e.index,type:"line",vertices:{x:s[0],y:s[1],z:s[2],signed_z:s[2],abs_z:s[3]}}}))}function K(e,t,i,n){const o=Array(i);return e.geometry.map((r=>{var s;$(o,r,t,n);const a={x:[o[0]],y:[o[1]],z:i>2?[null!==(s=o[2])&&void 0!==s?s:0]:void 0,abs_z:i>3&&void 0!==o[3]?[o[3]]:void 0};return{tags:e.tags,id:e.id,index:e.index,type:"point",vertices:a}}))}function $(e,t,i,n){const o=q(t,i);e[0]=o[0],e[1]=o[1];const r=n.min+o[1]/H.Bq*n.range;void 0===t[2]||isNaN(t[2])?e[2]=0:e[2]=t[2]*V.C*r,void 0!==t[3]&&(e[3]=t[3]*V.C*r)}function q(e,t){return[(0,G.uZ)(e[0]/t*H.Bq,0,H.Bq),(0,G.uZ)((t-e[1])/t*H.Bq,0,H.Bq)]}function Y(e,t){return e[0]<0||e[0]>t||e[1]<0||e[1]>t}function J(e,t,i){return e[0]>i&&t[0]>i||e[0]<0&&t[0]<0||e[1]>i&&t[1]>i||e[1]<0&&t[1]<0}const Q={maxZoom:l.f7,tolerance:3,extent:4096,buffer:1,debug:0,lineMetrics:!1,promoteId:null,generateId:!1,generateIndex:!0,indexMaxZoom:0,indexMaxPoints:1e5,dimensions:2};class ee{constructor(e){this.options=e}get geoJsonVtInstance(){var e,t,i,n,o,r,s;return this.geoJsonVT||(this.geoJsonVT=(r=this.options.data,s=Object.assign(Object.assign({},Q),{maxZoom:null!==(e=this.options.maxZoom)&&void 0!==e?e:Q.maxZoom,dimensions:null!==(t=this.options.dimensions)&&void 0!==t?t:Q.dimensions,extent:null!==(i=this.options.extent)&&void 0!==i?i:Q.extent,buffer:null!==(n=this.options.buffer)&&void 0!==n?n:Q.buffer,promoteId:this.options.promoteId,tolerance:null!==(o=this.options.tolerance)&&void 0!==o?o:Q.tolerance}),new j(r,s))),this.geoJsonVT}fetchTile(e){var t,i;const[n,r,s]=(0,o._W)(e),a={components:[],byId:new Map},l=this.geoJsonVtInstance.getTile(s,n,r),d=null!==(t=this.options.dimensions)&&void 0!==t?t:2,c=null!==(i=this.options.extent)&&void 0!==i?i:4096,u=function(e){const t=(0,o.Bs)(e),i=Z.H.scaleFactor((0,o.gQ)(0,0,t)[1]),n=Z.H.scaleFactor((0,o.gQ)(0,H.Bq,t)[1]);return{min:i,max:n,range:n-i}}(e);if(!l)return Promise.resolve(a);for(const e of l.features)switch(e.type){case R:a.components=a.components.concat(K(e,c,d,u));break;case F:a.components=a.components.concat(X(e,c,d,u));break;case B:a.components=a.components.concat(W(e,c,d,u));break;default:console.warn("unsupported type ",l)}return Promise.resolve(a)}destroy(){this.geoJsonVT=void 0}}function te(e,t,i){const n={components:[],byId:new Map};return e.features.forEach(((e,o)=>{n.components.push(...ie(e.geometry,t,i).map((t=>Object.assign(Object.assign({},t),{index:o,id:e.id,tags:e.properties||{}}))))})),n}function ie(e,t,i){switch(e.type){case"GeometryCollection":{let i=[];return e.geometries.forEach((e=>{i=i.concat(ie(e,t))})),i}case"Point":case"MultiPoint":return function(e,t){if("Point"===e.type)return[ne(e.coordinates,t)];return e.coordinates.map((e=>ne(e,t)))}(e,t);case"LineString":case"MultiLineString":return function(e,t){if("LineString"===e.type)return[oe(e.coordinates,t)];return e.coordinates.map((e=>oe(e,t)))}(e,t);case"Polygon":case"MultiPolygon":return function(e,t,i){if("Polygon"===e.type)return re(e.coordinates,t,i);return e.coordinates.reduce(((e,n)=>e.concat(re(n,t,i))),[])}(e,t,i)}}function ne(e,t){const i=[0,0,0];return(0,o.a2)(i,Z.H.fromGeo(e),t),{type:"point",vertices:{x:[i[0]],y:[i[1]]}}}function oe(e,t){const i=[[],[]],n=[0,0,0];return e.forEach(((e,r)=>{(0,o.a2)(n,Z.H.fromGeo(e),t),i[0][r]=n[0],i[1][r]=n[1]})),{type:"line",vertices:{x:i[0],y:i[1]}}}function re(e,t,i){const n=[],r=[],s=[],l=[],d=[];e.forEach((e=>{const n=e.map((e=>{(0,o.a2)(d,Z.H.fromGeo(e),t);const n=[(0,G.uZ)(d[0],0,H.Bq),(0,G.uZ)(d[1],0,H.Bq)];if(i){const t=Z.H.scaleFactor(e[1]);n.push(e[2]*t)}return n}));l.push(n),r.length&&s.push(r.length),r.push(...n)}));const c=[];for(let e=0;e<r.length;e++)c.push(r[e][0]),c.push(r[e][1]);const u=U(c,s);for(let e=0;e<u.length;e+=3){const t=[[],[],[],[]];for(let i=0;i<3;i++)t[0][i]=r[u[e+i]][0],t[1][i]=r[u[e+i]][1],t[2][i]=0,t[3][i]=r[u[e+i]][2];l.forEach((e=>{const i=[[],[],[]];e.forEach(((e,t)=>{i[0][t]=e[0],i[1][t]=e[1]})),(0,a.fZ)(t,i)}));const o={type:"polygon",vertices:{x:t[0],y:t[1],cut:t[2]}};i&&(o.vertices.z=t[3]),n.push(o)}return n}var se=i(2398),ae=i(2435);class le{constructor(e){this.tileLoader=new se.U("json",e.ignoreMissingTiles),this.options=e,this.url=e=>{const t=this.options.flipY?e:(0,o._W)(e);return(0,ae.IG)(this.options.url,{x:t[0].toString(),y:t[1].toString(),z:t[2].toString(),subdomain:(0,o.Kn)(t)})}}fetchTile(e){return this.tileLoader.fetch(e,this.url).then((t=>t.data?te(t.data,(0,o.Bs)(e)):{components:[],byId:new Map}))}abortTile(e){this.tileLoader.abortRequests([(0,o.gx)(e)])}destroy(){this.tileLoader.destroy()}}var de=i(2543),ce=i(9884),ue=i(1777),he=i(6907);class me{constructor(e,t,i){this.scope=e,this.options=t,this.id=i,this.featureStateMap=new ue.r,e.sources[i]=this,this.tileData={},this.styleManager=e.styleManager,this.collector=e.collector,this.sourceAttrs=this.options.attributes||{},this.metatile=(0,a.X4)(),this.tileServer="url"in t?new le(t):new ee(t)}fetchTiles(e){const t=[];for(const i of e)t.push(this.fetchTile(i));return t}abortTileFetches(e){if(this.tileServer instanceof le)for(const t of e)this.tileServer.abortTile(t)}generateTile(e,t,i,l,d,c,u,h){const m=(0,o.gx)(t),f=this.tileData[m],_=(0,o.Bs)(t),p=[],v=[],g=this.styleManager.getStyle(i),y=new Set(l),{promoteId:b}=this.options,x={},w="generateId"in this.options&&this.options.generateId;if(!g)return Promise.resolve({results:p,transferable:v});if(f){let t;if(f.components.forEach(((t,i)=>{const{tileProps:o}=this.metatile,l=[],m=[];if(t.tags){const e=Object.keys(t.tags);(0,r.Qy)(this.metatile,e);for(const i of e)l[o[i]]=t.tags[i]}const p=Object.keys(this.sourceAttrs);(0,r.Qy)(this.metatile,p);const v=Array.from(this.featureStateMap.featureAttrs);(0,r.Qy)(this.metatile,v);for(const e of p)l[o[e]]=this.sourceAttrs[e];const S=l[o.db_hidden_by_plan_id];if(S&&e._activeFloorIds.includes(S))return;const M=w?String(t.index+this.id*Math.pow(2,32)):b?l[o[b]]:void 0;if(void 0!==M){const e=y.has(M);if(l[o.selected]=e?1:0,f.byId.set(M,i),x[M]=t.index,this.featureStateMap.featureAttrs.size>0){const e=void 0!==M&&this.featureStateMap.get(M);if(e)for(const t of this.featureStateMap.featureAttrs)this.featureStateMap.clearAttrs=!1,m[o[t]]=e[t];else if(!1===this.featureStateMap.clearAttrs){this.featureStateMap.clearAttrs=!0;for(const e in o)void 0!==m[o[e]]&&(m[o[e]]=void 0)}}}const{coords:I}=_,T=I[3],E=(0,s.o1)(d),P=(0,de.Yi)(e,this.sourceAttrs,o,l,m,M,_),A=this.styleManager.getLayers(g.id,o,l).filter((e=>(0,a.Y0)(t.type,e.type)&&(0,de.FR)(e.filter,P)&&(!u||(0,de.FR)(u,P))));if(0===A.length&&P.id&&this.collector.idIndexer.addOrphanId(P.id),l[o.db_geometry_type]="line"===t.type?"polyline":t.type,"point"!==t.type&&"line"!==t.type||(void 0===l[o.db_label]&&(l[o.db_label]=NaN),void 0===l[o.db_label2]&&(l[o.db_label2]=NaN)),"line"===t.type){const e=(0,a.Sj)(t);l[o.componentDistanceStart]=0,l[o.componentDistanceEnd]=e,l[o.objectLength]=e,"number"!=typeof l[o.beginningIsCut]&&(l[o.beginningIsCut]=0),"number"!=typeof l[o.endingIsCut]&&(l[o.endingIsCut]=0)}(0,n.PA)(this.collector,g,A,P,this.metatile,ce.h,T,this.id,_,E,t.vertices,void 0,c,h)})),t)for(const e in t)console.warn(`[GeoJsonSourceWorker] Can't render component type '${t[e]}' with layer '${e}'`)}const S=this.collector.getAccumulatedData(),M={regionId:0,metatileHash:H.L2,collectorOutput:S,styleId:g.id};Object.keys(x).length>0&&(M.idToIndex=x),p.push(M),v.push(...S.transferable),this.scope.debouncedResetCollector(),this.scope.syncNewRasterSets();const I={results:p,transferable:v};return Promise.resolve(I)}getObjectAttributes(e,t){const i=this.tileData[t];if(i){const t=i.byId.get(e);if(void 0===t)return;const n=i.components[t];if(void 0===n)return;return n.tags}}deleteTiles(e){for(const t of e)delete this.tileData[(0,o.gx)(t)]}setSourceAttrs(e){this.sourceAttrs=e}destroy(){delete this.scope.sources[this.id],this.tileData={},this.sourceAttrs={},this.tileServer.destroy()}setFeatureStateMap(e){this.featureStateMap=(0,he.M)(e)}setData(e){if("string"==typeof e){if(this.tileServer instanceof le)return this.tileServer.destroy(),this.options=Object.assign(Object.assign({},this.options),{url:e}),this.tileServer=new le(this.options),this.tileData={},Promise.resolve(!0)}else if(this.tileServer instanceof ee)return this.tileServer.destroy(),this.options=Object.assign(Object.assign({},this.options),{data:e}),this.tileServer=new ee(this.options),this.tileData={},Promise.resolve(!0);return Promise.resolve(!1)}fetchTile(e){const t=(0,o.gx)(e);return this.tileData[t]?Promise.resolve(this.tileData[t]):this.tileServer.fetchTile(e).then((e=>(this.tileData[t]=e,e)))}}},9600:(e,t,i)=>{"use strict";i.d(t,{Q:()=>o});let n=1;function o(){return n++}},2627:(e,t,i)=>{"use strict";i.d(t,{dx:()=>u,lG:()=>_,nt:()=>p,qS:()=>m});var n=i(7731),o=i(6392),r=i(7188),s=i(6490),a=i(2435),l=i(314),d=i(4526);const c={db_id:"id",tech_db_beginning_is_cut:"beginningIsCut",tech_db_ending_is_cut:"endingIsCut",tech_db_previous_point_x:"previousPointX",tech_db_previous_point_y:"previousPointY",tech_db_next_point_x:"nextPointX",tech_db_next_point_y:"nextPointY",tech_db_object_length:"objectLength",tech_db_component_distance_start:"componentDistanceStart",tech_db_component_distance_end:"componentDistanceEnd",tech_db_geometry_type:"db_geometry_type"},u=e=>{var t;return null!==(t=c[e])&&void 0!==t?t:e},h={objectClass:"db_object_class",sublayer:"db_sublayer",db_id:"id"};function m(e){var t;return null!==(t=h[e])&&void 0!==t?t:e}const f={Class:"db_class",DisputePosition:"db_dispute_position",ObjectClass:"db_object_class",ParkingType:"db_parking_type",Sublayer:"db_sublayer",Subsublayer:"db_subsublayer",Icon:"db_icon",GeometryType:"db_geometry_type",ModelType:"db_model_type",RoadSupportTypes:"tech_db_road_support_type",RoadMarkingColorType:"db_road_marking_color_type",PoiCategory:"L1_Poi_category",RoadPart:"db_road_part",TriangulationMethod:"db_triangulation_method",RequireAbsZFromReliefSurface:"db_require_abs_z_from_relief_surface",TouristRouteColor:"db_tourist_route_color",TouristRouteSportTrackType:"db_tourist_route_sport_track_type",TouristRouteType:"db_tourist_route_type"},_=e=>{var t;e.enumerationValues=Object.keys(null!==(t=e.enumerationValues)&&void 0!==t?t:{}).reduce(((t,i)=>{const n=f[i];return n&&(t[n]=e.enumerationValues[i]),t}),{})};class p{constructor(e,t,i){var n;this.id=e,this.modules=t,this.options=i,this.type="zenith",this.worker=new t.workers.parser.ZenithSource,this.sourceAttrs=(0,s.kn)(null!==(n=i.sourceAttributes)&&void 0!==n?n:{},r.so),this.objectAttributes={},this.dataFilter=i.dataFilter}fetchTiles(e,t){const{assetManager:i,map:n}=this.modules,o=e.map((e=>({coords:e,tileUrl:this.constructTileUrl(e,t)})));return this.worker.fetchTiles(o).map(((e,r)=>e.catch((()=>Promise.resolve())).then((e=>{if(!e)return;const{metadata:s,err:a}=e;return s.forEach((e=>{const s=this.constructMetaTileUrl(e);i.loadMetatile(s,e.metatileHash,e.regionId),n.emit("tileload",{tileCoords:o[r].coords,regionId:e.regionId}),t.shownRegionIds.add(e.regionId)})),403===(null==a?void 0:a.status)&&n.emit("error",{type:"invalidtilekey"}),s}))))}generateTile(e,t,i,r,s,a={},l,d=this.id,c){return(0,n.mG)(this,void 0,void 0,(function*(){const n=yield this.worker.generateTile(Object.assign(Object.assign({styleId:i,tileInfo:(0,o.Bs)(t),pixelRatio:s,selectedIds:r,styleState:e.styleState,floorsEnabled:e.floorsEnabled,sourceAttrs:this.sourceAttrs,hoverId:l,sourceId:d,isDefaultSource:this.options.isDefaultSource,modelsPath:this.options.modelsPath,promoteAttributes:this.options.promoteAttributes,promoteId:this.options.promoteId,isCustomZenithSource:!this.options.isDefaultSource,dataFilter:this.dataFilter},a),{modelShowHideEventsSublayers:e.modelShowHideEventsSublayers}),c);return n.promotedAttrs&&(this.objectAttributes[(0,o.gx)(t)]=n.promotedAttrs),n}))}getObjectAttributes(e,t){var i;return null===(i=this.objectAttributes[e])||void 0===i?void 0:i[t]}generateModel(e){return this.worker.generateModel(e)}abortTileFetches(e){const t=e.map(o.gx);this.worker.abortTileRequests(t)}deleteTiles(e){const t=e.map(o.gx);for(const e of t)this.objectAttributes[e]=void 0;this.worker.deleteTiles(t)}setAttributes(e){this.sourceAttrs=e}getAttributes(){return this.sourceAttrs}destroy(){this.worker.destroy(),this.sourceAttrs={},this.objectAttributes={}}setFeatureStateMap(e){this.worker.setFeatureStateMap(e)}setDataFilter(e){this.dataFilter=e?(0,d.c$)(e,{precomputes:[]},l.Zx.Generator):void 0}constructTileUrl(e,t){return(0,o.rL)(this.options.tileServer,this.options.tileSet,this.options.tileProtocol,this.options.subdomains,e,this.options.tileKey,this.options.appId,t.lang,this.options.tileTemplateUrl,this.options.defaultLang,this.options.sessionId,this.options.dt)}constructMetaTileUrl(e){const t=this.options.metatileTemplateUrl,i={host:this.options.tileServer,tileSet:this.options.tileSet,protocol:this.options.tileProtocol,subdomain:this.options.subdomains[0],hash:(0,r.GG)(e.metatileHash)};return t?(0,a.Gr)({url:t},i):(0,a.Gr)("metatile",i)}}},6243:(e,t,i)=>{"use strict";i.d(t,{Z:()=>_e});var n=i(7731),o=i(6392),r=i(5095),s=i(1311);class a{constructor(){this.cache=new Map,this.pendingRequests=new Map}fetch(e,t=3,i=300){var o;return(0,n.mG)(this,void 0,void 0,(function*(){let n,a=0;for(;a<=t;)try{if(n=yield this.fetchAttempt(e),!n)return;if(!n.err||!(0,r.UG)(null===(o=n.err)||void 0===o?void 0:o.status))return n;throw new Error(`Fetching ${JSON.stringify(e.coords)} attempt ${a} failed.`)}catch(e){if(a>=t)return{metadata:[]};yield(0,s.g)(Math.pow(2,a)*i),a++}}))}get(e){return this.cache.get(e)||[]}delete(e){this.cache.delete(e)}abortRequest(e){const t=this.pendingRequests.get(e);void 0!==t&&(t.xhr.abort(),t.resolve(),this.pendingRequests.delete(e))}destroy(){this.cache.clear(),this.pendingRequests.clear()}fetchAttempt({tileUrl:e,coords:t}){return new Promise((i=>{const n=(0,o.gx)(t),s=(0,r.nx)({url:e},((e,t)=>{if(this.pendingRequests.delete(n),e||0===t.byteLength)return void 0!==e&&console.error(e),this.cache.set(n,[]),void i({metadata:[],err:e});const r=(0,o.CJ)(t),s=(0,o.xH)(r);this.cache.set(n,r),i({metadata:s,err:e})}));this.pendingRequests.set(n,{xhr:s,resolve:i})}))}}var l=i(1777),d=i(3249),c=i(1375);function u(e){for(let t=1;t<e.length;t++)e[t]=e[t]+e[t-1]}const h={1:u,2:u,4:u,8:function(e){let t=0,i=0,n=0;for(let o=0;o<e.length;o+=2)n=i+e[o],i=n>>>0,e[o]=i,t=t+e[o+1]+(n>4294967295?1:0)>>>0,e[o+1]=t}};class m{constructor(e){this.offset=0,this.buffer=e,this.u8=new Uint8Array(e),this.u16=new Uint16Array(e),this.u32=new Uint32Array(e),this.s8=new Int8Array(e),this.s16=new Int16Array(e),this.s32=new Int32Array(e),this.f32=new Float32Array(e)}readS8(){return this.s8[this.offset++]}readU16(){const e=this.u16[this.offset>>1];return this.offset+=2,e}readU32(){const e=this.u32[this.offset>>2];return this.offset+=4,e}readF32(){const e=this.f32[this.offset>>2];return this.offset+=4,e}readU8Vector(e=1){const t=this.readU32()*e,i=3&-t,n=this.u8.subarray(this.offset,this.offset+t);return this.offset+=t+i,n}readU16Vector(e=1){const t=this.readU32()*e*2,i=3&-t,n=this.u16.subarray(this.offset>>1,this.offset+t>>1);return this.offset+=t+i,n}}function f(e,t,i,n){const o=t.BYTES_PER_ELEMENT;e.offset+=-e.offset&o-1;const r=new t(e.buffer,e.offset,i);return e.offset+=o*i,n&&h[o](r),r}function _(e,t,i){e.offset+=7&-e.offset;const n=new Uint32Array(e.buffer,e.offset,2*t);return e.offset+=8*t,i&&h[8](n),n}function p(e,t,i){e.offset+=3&-e.offset;const n=new Uint32Array(e.buffer,e.offset,t),o=new Float32Array(e.buffer,e.offset,t);let r;if(e.offset+=4*t,i){let e=0;for(r=0;r<t;r++)e=e+n[r]>>>0,o[r]=e/1e3}else for(r=0;r<t;r++)o[r]=n[r]/1e3;return o}function v(e,t,i){e.offset+=3&-e.offset;const n=new Int32Array(e.buffer,e.offset,t),o=new Float32Array(e.buffer,e.offset,t);let r;if(e.offset+=4*t,i){let e=0;for(r=0;r<t;r++)e=e+n[r]>>>0,o[r]=(0|e)/1e3}else for(r=0;r<t;r++)o[r]=n[r]/1e3;return o}function g(e,t,i){switch(i){case 2:case 10:return f(e,Uint8Array,t);case 3:return f(e,Uint8Array,t,!0);case 4:return f(e,Uint16Array,t);case 5:return f(e,Uint16Array,t,!0);case 6:case 25:return f(e,Uint32Array,t);case 7:return f(e,Uint32Array,t,!0);case 8:case 19:return _(e,t);case 9:case 20:return _(e,t,!0);case 11:return function(e,t){let i=e.offset;const n=e.u8,o=e.buffer,r=[];for(;t--;)r.push(0|n[i++]);const s=[];for(;++t<r.length;){let e=r[t];255===e&&(e=n[i++]|n[i++]<<8|n[i++]<<16|0),s.push(new Uint8Array(o,i,e)),i+=e}return e.offset=i,s}(e,t);case 12:return function(e,t){e.offset+=3&-e.offset;let i=e.offset;const n=e.u32,o=e.buffer,r=[];for(let e=0;e<t;e++)r.push(n[i>>2]),i+=4;const s=[];for(let e=0;e<t;e++){const t=r[e];i+=7&-i,s.push(new Uint8Array(o,i,t)),i+=t}return e.offset=i,s}(e,t);case 13:return f(e,Int8Array,t);case 14:return f(e,Int8Array,t,!0);case 15:return f(e,Int16Array,t);case 16:return f(e,Int16Array,t,!0);case 17:return f(e,Int32Array,t);case 18:return f(e,Int32Array,t,!0);case 21:return p(e,t);case 22:return p(e,t,!0);case 23:return v(e,t);case 24:return v(e,t,!0);default:throw new Error("Unknown stream type "+i)}}function y(e){let t=0;for(let i=0;i<e.length;i++)t+=e[i];return t}function b(e,t,i){return new e.constructor(e.buffer,e.byteOffset+t*e.BYTES_PER_ELEMENT,i)}var x=i(1436),w=i(3672),S=i(9981),M=i(9218),I=i(2543),T=i(7609),E=i(7999),P=i(7188),A=i(6273),L=i(143),C=i(9073),z=i(8585);let k;const O=[],R=new Int32Array(256);let F;const B=[],D=[],j=[],N=[0,0,0,0,0];let U=0,H=0,G=0,V={};function Z(e,t,i,n,r,s,a,l,d=!1,c,u,h,_){const{styleState:p,sourceId:v,sourceAttrs:b,tileInfo:x,pixelRatio:w,selectedIds:M,dataFilter:T,floorsEnabled:E,hoverId:A,generateOnlySelectedPoi:L,generateOnlyHoveredPoi:C,modelsPath:z}=r,{data:B}=s,D=new Set(M),j=(0,o.VV)(B);if(j.byteLength<8)return n.getAccumulatedData();O.length=0;const N=new m(j);if(1279676242!==N.readU32())return n.getAccumulatedData();const G=N.readU16();if(2!==G&&3!==G&&4!==G)return console.error(`Unsupported tile format version: "${G}"`),n.getAccumulatedData();k=G,N.readU16();const V=(0,S.o1)(w);return function(e){const t=4===k?2:1,i=e.u8;let n=e.offset,o=e.u32[n>>2];n+=4,U=o,H=n;for(;o--;)n=2*i[n++]+n,n=i[n++]*t+n;e.offset=n+(3&-n)}(N),function(e){const t=e.u32[e.offset>>2];e.offset+=4,F=f(e,Uint8Array,t);const i=f(e,Uint32Array,t);for(let n=0;n<t;n++){const t=F[n];O[n]=g(e,i[n],t),R[n]=0}}(N),function(e,t,i,n,o,r,s,a,l,d,c,u,h,m,_,p,v=!1,g,b,x,w,S,M,T,E){const A=Array.from(o.featureAttrs);(0,P.Qy)(u,A);const L=U,C=f(s,Int32Array,L),z=y(C),k=f(s,Uint8Array,z,!0),O=f(s,Uint8Array,y(k),!0),R=f(s,Uint8Array,z,!0),F=f(s,Uint8Array,y(R),!0),B=f(s,Uint16Array,z,!0);let D=0,j=0,N=0,H=!0;for(let f=0;f<L;f++){const y=C[f];q(s,u,h);for(let s=0;s<y;s++){const s=k[D];s>0&&(W(h,s,O,j,u,e,v),j+=s);const f=R[D];if(f>0&&(X(h,f,F,N),N+=f),!h[u.tileProps.db_geometry_type])return void console.error(`Geometry type not specified for data source ${_}. Metatile version ${u.version}`);H=s>0||f>0;const y=u.tileProps;let P=h[y[null!=T?T:""]];Number.isNaN(P)&&(P=void 0);const A=(0,I.Yi)(n,p,y,h,[],P,a),L=B[D];L>0&&$(e,t,i,n,A,o,r,L,a,l,d,c,u,m,_,g,b,x,w,S,H,M,E),D++}}Y()}(k,e,t,p,i,n,N,x,V,D,T,a,l,E,v,b,d,A,L,C,z,c,u,h,_),n.getAccumulatedData()}function W(e,t,i,n,o,r,s=!1){for(var a,l;t--;){const t=i[n++],d=D[t],c=B[t],u=F[d];if(8===u||9===u||19===u||20===u)e[c]=(0,w.Pc)(O[d][R[d]],O[d][R[d]+1]),R[d]+=2;else{const t=O[d][R[d]];switch(c){case o.tileProps.objectLength:case o.tileProps.db_centroid_x:case o.tileProps.db_centroid_y:case o.tileProps.componentDistanceEnd:case o.tileProps.componentDistanceStart:case o.tileProps.previousPointX:case o.tileProps.previousPointY:case o.tileProps.nextPointX:case o.tileProps.nextPointY:e[c]=2===r?t*A.gt:t;break;case o.tileProps.db_label:case o.tileProps.db_label2:e[c]=(0,E.zT)(t);break;case o.tileProps.db_schedule:e[c]=JSON.parse((0,E.zT)(t));break;case o.tileProps.db_tiers:const i=t.byteLength/Int32Array.BYTES_PER_ELEMENT,n=new DataView(t.buffer,t.byteOffset,t.byteLength),d=n.getInt32(0,!0);if(1!==i||d){const t=new Array(i);t[0]=d;for(let e=1;e<i;e++)t[e]=n.getInt32(e*Int32Array.BYTES_PER_ELEMENT,!0);e[c]=t}else e[c]=void 0;break;default:if(s&&11===u)e[c]=(0,E.zT)(t);else{const i=o.tilePropsByIndex[c];e[c]=null!==(l=null===(a=o.reverseDictionaries[i])||void 0===a?void 0:a[t])&&void 0!==l?l:t}}R[d]++}}}function X(e,t,i,n){for(;t--;){const t=i[n++];e[B[t]]=NaN}}let K=[];function $(e,t,i,n,r,s,a,l,d,c,u,h,m,f,_,p,v,g,y,w=[],S,E,P){var A;const{tileProps:F,defaultProps:B}=m,{tileAttrs:D,featureAttrs:U,id:H}=r,Z=d.coords[3],W=void 0!==F.db_hidden_by_plan_id;if(!S&&0===K.length){for(let e=0;e<G;e++){const t=N[e];R[t]=R[t]+l}return}const X=D[F.db_geometry_type],$=4===k?m.vertexProps:m.vertexPropsLegacy[X];if($){for(let t=0;t<G;t++){const i=4===k?j[t]:t,n=N[t],o=null!==(A=$[i])&&void 0!==A?A:"signed_z";V[o]=J(b(O[n],R[n],l),t,e),4===k&&"z"===o&&(V.signed_z=V.z),R[n]=R[n]+l}if((void 0===F.db_sublayer||Number.isNaN(D[F.db_sublayer])||!(0,T.Ty)(D[F.db_sublayer]))&&!(W&&n._activeFloorIds&&D[F.db_hidden_by_plan_id]&&n._activeFloorIds.includes(D[F.db_hidden_by_plan_id]))){for(const e in B){const t=B[e];Number.isNaN(D[t.index])&&(D[t.index]=t.value)}if(!p||p===H){if(void 0!==H){let e=u.has(H);v&&(e=!0);const t=!!g||!!p&&p===H;if(D[F.selected]=e?1:0,D[F.hovered]=t?1:0,w.length>0){const e={};w.forEach((t=>{e[t]=D[F[t]]})),a.addPromotedObjectAttributes(H,e)}f&&Z>=M.floors.detailLevel&&(D[F.db_hidden_by_plan_building_id]&&a.addFloorHidingMap(H,D[F.db_hidden_by_plan_building_id]),D[F.db_hidden_by_metro_building_id]&&a.addFloorHidingMap(H,D[F.db_hidden_by_metro_building_id]))}else D[F.selected]=0,D[F.hovered]=0;if(s.featureAttrs.size>0){const e=void 0!==H&&s.get(H);if(e)for(const t of s.featureAttrs)s.clearAttrs=!1,U[F[t]]=e[t];else if(!1===s.clearAttrs){s.clearAttrs=!0;for(const e in F)void 0!==U[F[e]]&&(U[F[e]]=void 0)}}if(E){const e=function(e,t,i){var n;const r=[],{x:s,y:a,z:l,signed_z:d}=e;for(let t=0;t<e.x.length;t++){const e=(0,o.gQ)(s[t],a[t],i),c=z.H.scaleFactor(e[1]),u=l?32*l[t]:void 0;e[2]=null!==(n=null!=u?u:null==d?void 0:d[t])&&void 0!==n?n:0,e[2]/=C.C*c,r.push(e)}if(!r.length)return;switch(t){case"point":return{type:"MultiPoint",coordinates:r};case"polyline":return{type:"LineString",coordinates:r};case"polygon":return{type:"Polygon",coordinates:[r.map(((e,t)=>r[(0,L.X)(t,r.length)]))]};default:return}}(V,X,d);if(e){const t=function(e,t){const i={tile:t};return Object.keys(e.tileProps).forEach((t=>{const n=e.tileAttrs[e.tileProps[t]];Number.isNaN(n)||void 0===n||(i[t]=n)})),i}(r,(0,o.gx)(d.coords));a.addFeature({type:"Feature",properties:t,geometry:e})}}else S&&(K=i.getLayers(t.id,F,D).filter((e=>(0,I.FR)(e.filter,r)&&(!h||(0,I.FR)(h,r))))),0===K.length&&r.id&&a.idIndexer.addOrphanId(r.id),(0,x.PA)(a,t,K,r,m,k,Z,_,d,c,V,v||g,y,P)}}}else console.error(`Couldn't get vertex keys for tile ${(0,o.gx)(d.coords)} source ${_}. Metatile version ${m.version}`)}function q(e,t,i){const n=Object.keys(t.tileProps).length,o=e.u8;let r,s,a=H;for(s=1;s<n;s++)i[s]=NaN;for(r=o[a++],s=0;s<r;s++)B[s]=o[a++],D[s]=o[a++];for(r=o[a++],s=0;s<r;s++)4===k&&(j[s]=o[a++]),N[s]=o[a++];G=r,H=a,Y()}function Y(){V={}}function J(e,t,i){if(2===i&&t<3&&e instanceof Uint16Array)for(let t=0;t<e.length;t++)e[t]*=A.gt;return e}var Q=i(9450),ee=i(127),te=i(1678),ie=i(4922);function ne(e){const t=(e=e.slice().sort(re)).length,i=new Array(2*t);let n=0;for(let o=0;o<t;o++){const t=e[o];for(;n>=2&&oe(i[n-2],i[n-1],t)<=0;)n--;i[n++]=t}const o=n+1;for(let r=t-2;r>=0;r--){const t=e[r];for(;n>=o&&oe(i[n-2],i[n-1],t)<=0;)n--;i[n++]=t}return i.slice(0,n-1)}function oe(e,t,i){return(t[1]-e[1])*(i[0]-e[0])-(t[0]-e[0])*(i[1]-e[1])}function re(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]}var se=i(378),ae=i(9090);function le(e){const t=[],i=(e=>{if(e.length>2){let t=0;for(let i=e.length-1,n=i,o=0;o<=i;o++){const i=e[n],r=e[o];t+=(i[0]+r[0])*(i[1]-r[1]),n=o}return t/2}return 0})(e)>0;const n=se.I6(e[0],e[e.length-1]),o=n?e.length-1:e.length;for(let n=o-1,r=0,s=1;r<o;r++,n=r-1,s=(r+1)%o){const o=[];(0,ae.tG)(o,e[n],e[r],e[s],i),t.push(o)}return n&&t.push(t[0]),t}const de=[[0],[0],[0]],ce=[];function ue(e,t,i,n,o,r,s,a,l){const{matrix:d,offset:c,id:u,selected:h}=r,f=new m(o),_=[];if(!e)return{objects:n.getAccumulatedData(),textures:_};if(1296191066!==f.readU32()||1!==f.readU16())return{objects:n.getAccumulatedData(),textures:[]};f.readU16();const p=f.readU32();for(let e=0;e<p;e++)_.push(f.readU8Vector());const{tileProps:v}=s,g=[],y=Object.keys(v).length;for(let e=0;e<y;e++)g[e]=NaN;if(g[v.db_sublayer]="Building_model",g[v.selected]=h?1:0,g[v.db_region]=a,l.featureAttrs.size>0){const e=Array.from(l.featureAttrs);(0,P.Qy)(s,e)}const b=[],w="number"!=typeof u&&l.get(u);if(w)for(const e of l.featureAttrs)l.clearAttrs=!1,b[v[e]]=w[e];else if(!1===l.clearAttrs){l.clearAttrs=!0;for(const e in v)void 0!==b[v[e]]&&(b[v[e]]=void 0)}const S=f.offset,M=(0,I.Yi)(i,P.i4,v,g,b,u),T=t.getLayers(e.id,v,g).filter((e=>(0,I.FR)(e.filter,M)));return 0===T.length&&M.id&&n.idIndexer.addOrphanId(M.id),T.forEach((t=>{if("buildingModel"!==t.type)return;(0,x.Eu)(t,M);(0,I.FR)(t.filter,M)&&(f.offset=S,function(e,t,i,n,o,r,s){const a=o.readU32();for(let l=0;l<a;l++){const a=o.readU32(),l=Q.al(o.readF32(),o.readF32(),o.readF32()),d=Q.al(o.readF32(),o.readF32(),o.readF32()),c=Q.lu(Q.Ue(),d,l),u=[];ee.Iu(u,r,l),ee.bA(u,u,c),u[12]+=s[0],u[13]+=s[1];const h=o.readU16Vector(5),m=o.readU32();for(let r=0;r<m;r++){const r=1===o.readU32()?A.uC:A.Fg,s=o.readU16Vector();do{te.X.processSubmesh(e.id,t,i,n,h,s,r,a,u)}while(n.isOverloaded())}const f=o.readU16Vector();do{te.X.processOuterEdge(e.id,t,i,n,h,f,u)}while(n.isOverloaded());const _=ne(he(h)),p=le(_);for(let t=0;t<_.length-2;t++){for(let e=0;e<3;e++){const i=me(t+e,_.length);de[0][e]=_[i][0],de[1][e]=_[i][1],de[2][e]=0,ce[e]=p[i]}do{ie._.generateFloorsBottomFill(n,e.id,de,ce,te.d,u)}while(n.isOverloaded())}}}(e,t,M,n,f,d,c))})),{objects:n.getAccumulatedData(),textures:_}}function he(e){const t=[];for(let i=0;i<e.length;i+=5)t.push([e[i],e[i+1]]);return t}function me(e,t){return 0===e?0:e%2?(e+1)/2:t-e/2}var fe=i(6907);class _e{constructor(e){this.scope=e,this.tileLoader=new a,this.tileAttrs=[],this.models={},this.featureStateMap=new l.r}fetchTiles(e,t=3){const i=[];for(const n of e)i.push(this.tileLoader.fetch(n,t));return i}abortTileRequests(e){e.forEach((e=>this.tileLoader.abortRequest(e)))}generateTile(e,t){const{styleManager:i,collector:n,metatiles:r}=this.scope,{tileInfo:s,promoteAttributes:a,promoteId:l,isCustomZenithSource:u,modelShowHideEventsSublayers:h}=e,m=(0,o.gx)(s.coords),f=this.tileLoader.get(m),_=[],p=[],v=[],g={};return f.forEach((o=>{var s;const{regionId:m,metatileHash:f}=o,y=this.scope.styleManager.getStyle(e.styleId);if(!y)return;if(e.areTileBoundsVisible&&e.isDefaultSource){const t=i.getStyle(d.jf).layers.find((e=>"debug-tile-bounds"===e.id));(0,c.cX)(n,t,e.styleState)}const b=Z(y,i,this.featureStateMap,n,e,o,r[f],this.tileAttrs,u,a,t,l,h);Object.assign(g,b.promotedObjectAttributes),_.push({regionId:m,metatileHash:f,collectorOutput:b,styleId:y.id}),v.push(...b.transferable),null===(s=b.debugGeoJsonData)||void 0===s||s.forEach((e=>p.push(e)))})),this.scope.resetCollector(),this.scope.syncRasterSets(),Promise.resolve({results:_,transferable:v,promotedAttrs:Object.keys(g).length>0?g:void 0,geoJsonData:t?p:void 0})}deleteTiles(e){for(const t of e)this.tileLoader.delete(t)}setFeatureStateMap(e){this.featureStateMap=(0,fe.M)(e)}generateModel(e){const{regionId:t,metatileHash:i,styleId:n,url:o,id:s}=e,{styleManager:a}=this.scope;return new Promise((l=>{const d=this.models[s];(d?Promise.resolve(d):new Promise((e=>{(0,r.nx)({url:o},((t,i)=>{if(t||0===i.byteLength){const t=this.models[s]=new ArrayBuffer(0);e(t)}else this.models[s]=i,e(i)}))}))).then((o=>{if(0===o.byteLength)return void l({objects:this.scope.collector.getAccumulatedData(),textures:{isBitmap:!1,data:[]}});const r=this.scope.styleManager.getStyle(n);if(!r)return void l({objects:this.scope.collector.getAccumulatedData(),textures:{isBitmap:!1,data:[]}});const{objects:s,textures:d}=ue(r,a,e.styleState,this.scope.collector,o,e,this.scope.metatiles[i],t,this.featureStateMap);if(this.scope.createImageBitmap){const e=d.map((e=>{const t=new Blob([e],{type:"image/png"});return createImageBitmap(t)}));Promise.all(e).then((e=>{l({objects:s,textures:{isBitmap:!0,data:e},transferable:[...s.transferable,...e]}),this.scope.resetCollector()}))}else l({objects:s,textures:{isBitmap:!1,data:d},transferable:[...s.transferable,o]}),this.scope.resetCollector()}))}))}destroy(){this.tileLoader.destroy(),this.tileAttrs=[],this.models={}}}},199:(e,t,i)=>{"use strict";i.d(t,{T:()=>n});const n=[{id:"__2gis_comm_poi",type:"point",style:{textFont:["Noto_Sans_Semibold",["step",["zoom"],"Noto_Sans",16,"Noto_Sans"]],iconImage:"peak",iconWidth:["interpolate",["linear"],["zoom"],15,22,16.8,30],textColor:"#3A3A3A",visibility:"visible",textFontSize:[["interpolate",["linear"],["zoom"],15.5,11,18,13],["interpolate",["linear"],["zoom"],15.5,10,18,12]],textHaloColor:"rgba(255,255,255,0.5)",textHaloWidth:.9,iconLabelingGroup:i(3754).n3,iconLabelingMargin:{leftRight:6,topBottom:6}},filter:["all",["match",["get","db_sublayer"],["Commercial_poi_default","Commercial_poi_city","Commercial_poi_premium"],!0,!1],["any",["==",["in",["get","db_building_id"],["global","_activeFloorBuildingIds"]],!1],["in",["get","db_plan_id"],["global","_activeFloorIds"]]]]}]},9145:(e,t,i)=>{"use strict";i.d(t,{A:()=>o,r:()=>n});const n={[i(314).OD.none]:{ambientColorIntensity:new Float32Array([1,1,1,0]),dir1ColorIntensity:new Float32Array([1,1,1,0]),dir1Direction:new Float32Array([0,-1,0]),dir2ColorIntensity:new Float32Array([1,1,1,0]),dir2Direction:new Float32Array([0,-1,0]),shadowLightIndex:-1,shadowRadius:1}},o=2},7436:(e,t,i)=>{"use strict";i.d(t,{h:()=>u});var n=i(7464);function o(e){return"boolean"!=typeof e&&"attrs"===e.type}function r(e){return"boolean"!=typeof e&&"unextractable"===e.type}function s(e){if(!(0,n.Uu)(e))return[Boolean(e)];let t=[];const i=[];switch(e.type){case"all":const l=e.array.map(s);for(const e of l){const n=[];for(const t of e){if(!1===t)return[!1];o(t)?n.push(t):r(t)&&i.push(t)}n.length>0&&(t=0===t.length?n:a(t,n))}break;case"match":if(!(0,n.vB)(e.input))return[{type:"unextractable",exp:e}];if("precompute"===e.input.type)return[{type:"unextractable",exp:e}];const d=e.input.property,c=e.defaultOutput;for(const n of e.cases){const e=s(n.output),l=[];n.values.forEach((e=>{l.push({type:"attrs",attrs:{[d]:e}})}));for(const n of e)if(o(n))for(const e of a([n],l))t.push(e);else if(r(n)){i.push(n);for(const e of l)t.push(e)}else if(!0===n&&!c)for(const e of l)t.push(e)}break;case"==":{let i,o;if((0,n.vB)(e.leftValue)&&(0,n.HW)(e.rightValue))i=e.leftValue.property,o=e.rightValue;else{if(!(0,n.vB)(e.rightValue)||!(0,n.HW)(e.leftValue))return[{type:"unextractable",exp:e}];i=e.rightValue.property,o=e.leftValue}t.push({type:"attrs",attrs:{[i]:o}});break}default:return[{type:"unextractable",exp:e}]}return t.concat(i)}function a(e,t){const i=[];for(const n of e)for(const e of t)i.push({type:"attrs",attrs:Object.assign(Object.assign({},n.attrs),e.attrs)});return i}var l=i(3672);class d{constructor(){this.layers=[],this.keyStat={},this.orderedKeys=[],this.tree=null,this.treeNodesCount=0,this.traverseCount=0,this.traverseIterations=0}addLayers(e){for(const t of e)"custom"!==t.type&&t.filter&&(this.layers.push(t),this.statLayerKeys(t));this.buildTree()}getLayers(e,t){const i=[],n=(o,r)=>{if(this.traverseIterations+=1,!o)return;for(const e of o.leafs)i.push(e);const s=this.orderedKeys[r];if(!s)return;const a=t[e[s]],d=(0,l.nI)(a)?(0,l.Ak)(a):a;void 0!==d?(n(o.children[d],r+1),n(o.novalue,r+1)):n(o.novalue,r+1)};return this.traverseCount+=1,n(this.tree,0),i}stat(){const e=this.traverseIterations/this.traverseCount||0;return{tree:this.tree,treeNodes:this.treeNodesCount,layers:this.layers.length,keyStat:this.keyStat,itersPerTraverse:e}}statLayerKeys(e){const t=s(e.filter).filter((e=>o(e)))[0];if(t&&o(t))for(const e in t.attrs)void 0===this.keyStat[e]&&(this.keyStat[e]=0),this.keyStat[e]+=1}getOrderedKeys(){return Object.entries(this.keyStat).sort((([e,t],[i,n])=>n-t)).map((([e,t])=>e))}buildTree(){this.orderedKeys=this.getOrderedKeys();const e=[];for(const t of this.layers){const i=s(t.filter).filter(o);0===i.length&&e.push(t);for(const e of i){const i=new Set(Object.keys(e.attrs));let n=0;const o=e.attrs;let r=this.tree;for(let e=0;e<=this.orderedKeys.length;e++){if(n===i.size){null==r||r.leafs.push(t);break}const s=this.orderedKeys[e],a=this.orderedKeys[e+1]||"";if(r||(r=this.makeTreeNode(s),null===this.tree&&(this.tree=r)),i.has(s)){const e=o[s];r.children[e]||(r.children[e]=this.makeTreeNode(a)),r=r.children[e],n+=1}else r.novalue||(r.novalue=this.makeTreeNode(a)),r=r.novalue}}}e.length>0&&(this.tree||(this.tree=this.makeTreeNode("")),this.tree.leafs=e)}makeTreeNode(e){return this.treeNodesCount+=1,{key:e,children:{},novalue:null,leafs:[]}}}var c=i(9145);class u{constructor(){this.metaStyles=new Map,this.layerTrees=new Map}proxySyncStyle(e){const t=new d;t.addLayers(e.layers),this.layerTrees.set(e.id,t),this.metaStyles.set(e.id,e),this.removeUnusedStyle(e.id-c.A)}getStyle(e){return this.metaStyles.get(e)}getLayers(e,t,i){const n=this.layerTrees.get(e);return n?n.getLayers(t,i):[]}removeUnusedStyle(e){e<1||(this.metaStyles.delete(e),this.layerTrees.delete(e))}}},4389:(e,t,i)=>{"use strict";i.d(t,{l:()=>f});var n=i(6273),o=i(378),r=i(9090),s=i(8352),a=i(5600),l=i(159),d=i(2702);const c=o.Ue(),u=o.Ue(),h={type:l.SP.Entrance,offsetMultiplier:18,cDist:0,oLen:0,sLen:0,px:[],py:[],count:0,localID:0};function m(e,t,i,o){return h.px=e.x,h.py=e.y,h.oLen=i/n.Bq,h.count=t,h.localID=o,h}const f=(0,a.D)({symbol:"arrow",sinks:{stroke:{stride:36,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.segmentEnd=new Uint16Array(t,4),e.views.texExtender=new Int8Array(t,8),e.views.arrowExtender=new Int8Array(t,10),e.views.extender=new Int16Array(t,12),e.views.direction=new Int16Array(t,16),e.views.vertexDistance=new Float32Array(t,20),e.views.objectLength=new Float32Array(t,24),e.views.type=new Float32Array(t,28),e.views.localID=new Uint32Array(t,32)},packObjectAttributes:(e,t,i,n)=>(0,d.v)([e,t.innerId,i>2?1:0],t,n),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],isLongArrow:e[2],tileData:e.slice(3)})}},generate:(e,t,i,n,o)=>{const r=o.x,a=o.y,d=o.x.length,c=function(e,t,i){let n=0;for(let o=1;o<i;o++){const i=e[o]-e[o-1],r=t[o]-t[o-1];n+=Math.sqrt(i*i+r*r)}return n}(r,a,d),u=e.getBucket(i.type,"stroke",f.sinks.stroke.packObjectAttributes(t,i,d,n),f.sinks.stroke.binder),h=e.idIndexer.getIndex(n,t,i),p=m(o,d,c,h);(0,s.W)(o.x,o.y,void 0,d,l.kU.Butt,l.kU.Butt,0,0,0,0,p,u);let v=0;_(u,l.gD.StartBorder,r[0],a[0],r[1],a[1],0,0,v,c,h);for(let e=0;e<d-1;e++){if(0!==e){const t=r[e]-r[e-1],i=a[e]-a[e-1];v+=Math.sqrt(t*t+i*i)}_(u,l.gD.Arrow,r[e],a[e],r[e+1],a[e+1],-1,0,v,c,h)}}});function _(e,t,i,n,o,r,s,a,l,d,c){!function(e,t,i,n,o,r,s){const{elements:a,indices:l}=e,{buffer:d,offset:c}=l,u=a.offset;d[c]=u+t,d[c+1]=u+i,d[c+2]=u+n,d[c+3]=u+o,d[c+4]=u+r,d[c+5]=u+s,l.offset=c+6}(e,1,2,0,0,2,3),p(e,t,i,n,o,r,s,a,-1,-1,l,d,!0,c),p(e,t,i,n,o,r,s,a,1,-1,l,d,!1,c),p(e,t,i,n,o,r,s,a,1,1,l,d,!1,c),p(e,t,i,n,o,r,s,a,-1,1,l,d,!0,c)}function p(e,t,i,o,s,a,l,d,h,m,f,_,p,v){const g=e.elements,y=g.stride*g.offset,b=y>>1,x=b>>1;(0,r.uI)(c,i,o,s,a),(0,r.fN)(u,c),e.views.position[b]=n.jO+i,e.views.position[b+1]=n.jO+o,e.views.segmentEnd[b]=n.jO+s,e.views.segmentEnd[b+1]=n.jO+a,e.views.texExtender[y]=(0,r.Tz)(u[0]*m*(p?-1:1)*n.Gt),e.views.texExtender[y+1]=(0,r.Tz)(u[1]*m*(p?-1:1)*n.Gt),e.views.arrowExtender[y]=(0,r.Tz)(h*n.Gt),e.views.arrowExtender[y+1]=(0,r.Tz)(m*n.Gt);const w=h+l,S=m+d,M=c[0]*w+u[0]*S,I=c[1]*w+u[1]*S;e.views.extender[b]=Math.round(M*n.Gt*127),e.views.extender[b+1]=Math.round(I*n.Gt*127),e.views.direction[b]=Math.round(127*c[0]),e.views.direction[b+1]=Math.round(127*c[1]),e.views.vertexDistance[x]=f/n._H,e.views.objectLength[x]=_/n._H,e.views.type[x]=t,e.views.localID[x]=v,e.elements.offset++}},1678:(e,t,i)=>{"use strict";i.d(t,{X:()=>l,d:()=>a});var n=i(5600),o=i(2682),r=i(2702),s=i(6273);const a=[s._H/2,s._H/2],l=(0,n.D)({symbol:"buildingModel",sinks:{fill:{stride:24,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.texCoords=new Uint16Array(t,8),e.views.localID=new Uint32Array(t,12),e.views.demPosition=new Int16Array(t,16),e.views.labelingTextureID=new Uint32Array(t,20)},packObjectAttributes:(e,t,i,n,o,s)=>(0,r.v)([e,t.innerId,i,o,n],t,s),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],texture:e[2],id:e[3],matrix:e[4],tileData:e.slice(5)})},stroke:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.directionDistance=new Int8Array(t,8),e.views.demPosition=new Int16Array(t,12)},packObjectAttributes:(e,t,i,n,o)=>(0,r.v)([e,t.innerId,n,i],t,o),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],id:e[2],matrix:e[3],tileData:e.slice(4)})}},processSubmesh(e,t,i,n,o,r,s,a,c){var u;const h=null!==(u=i.id)&&void 0!==u?u:"",m=n.idIndexer.getIndex(i,e,t),f=n.pointIndexer.getIndex(h),_=n.getBucket(t.type,"fill",l.sinks.fill.packObjectAttributes(e,t,a,c,h,i),l.sinks.fill.binder,s);!function(e,t){const i=e.elements.offset;let n=e.indices.offset;for(let o=0;o<t.length;o++)e.indices.buffer[n++]=i+t[o];e.indices.offset=n}(_,r);for(let e=0;e<o.length;e++)d(_,o,e,m,f)},processOuterEdge(e,t,i,n,r,s,d){var c;const u=null!==(c=i.id)&&void 0!==c?c:"",h=n.getBucket(t.type,"stroke",l.sinks.stroke.packObjectAttributes(e,t,d,u,i),l.sinks.stroke.binder);for(let e=0;e<s.length;e+=2){const t=5*s[e],i=5*s[e+1];(0,o.n)(h,r[t],r[t+1],r[t+2],r[i],r[i+1],r[i+2],a,!0)}}});function d(e,t,i,n,o){const r=e.elements.offset,d=l.sinks.fill.stride,c=5*i,u=r*(d/e.views.position.BYTES_PER_ELEMENT),h=r*(d/e.views.localID.BYTES_PER_ELEMENT);e.views.position[u]=t[c],e.views.position[u+1]=t[c+1],e.views.height[h]=t[c+2]/s._H,e.views.texCoords[u]=t[c+3],e.views.texCoords[u+1]=t[c+4],e.views.localID[h]=n,e.views.demPosition[u]=a[0]/8,e.views.demPosition[u+1]=a[1]/8,e.views.labelingTextureID[h]=o,e.elements.offset++}},871:(e,t,i)=>{"use strict";i.d(t,{p:()=>l});var n=i(5600),o=i(2702),r=i(6273),s=i(6392),a=i(9073);const l=(0,n.D)({symbol:"circle",sinks:{fill:{stride:20,binder:(e,t)=>{e.views.flatPosition=new Uint16Array(t),e.views.ecefPosition=new Int16Array(t,6),e.views.extender=new Int16Array(t,12),e.views.localID=new Uint32Array(t,16)},packObjectAttributes:(e,t,i)=>(0,o.v)([e,t.innerId],t,i),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})}},generate(e,t,i,n,o){const r=e.getBucket(i.type,"fill",l.sinks.fill.packObjectAttributes(t,i,n),l.sinks.fill.binder),a=e.idIndexer.getIndex(n,t,i),c=[o.x[0],o.y[0],o.z?o.z[0]:0],u=n.tileInfo?(0,s.$F)(n.tileInfo,c):[0,0,0];!function(e,t,i,n,o,r,s){const{elements:a,indices:l}=e,{buffer:d,offset:c}=l,u=a.offset;d[c]=u+t,d[c+1]=u+i,d[c+2]=u+n,d[c+3]=u+o,d[c+4]=u+r,d[c+5]=u+s,l.offset=c+6}(r,0,2,1,0,3,2),d(r,c,u,-1,-1,a),d(r,c,u,-1,1,a),d(r,c,u,1,1,a),d(r,c,u,1,-1,a)}});function d(e,[t,i,n],o,l,d,c){const u=e.elements.offset*e.elements.stride>>1,h=u>>1;e.views.flatPosition[u]=r.jO+t,e.views.flatPosition[u+1]=r.jO+i,e.views.flatPosition[u+2]=(0,s.VW)(n),e.views.ecefPosition[u]=o[0]*a.qz,e.views.ecefPosition[u+1]=o[1]*a.qz,e.views.ecefPosition[u+2]=o[2]*a.qz,e.views.extender[u]=l,e.views.extender[u+1]=d,e.views.localID[h]=c,e.elements.offset++}},3097:(e,t,i)=>{"use strict";i.d(t,{L:()=>m});var n=i(8352),o=i(159),r=i(5600),s=i(2702),a=i(6273),l=i(6659),d=i(2543),c=i(3376);const u={type:o.SP.Striped,cDist:0,oLen:0,sLen:0,localID:0,offsetMultiplier:14,px:[],py:[],count:0};function h(e,t,i,n){return u.cDist=e,u.oLen=t,u.localID=i,u.offsetMultiplier=n,u}const m=(0,r.D)({symbol:"dashedLine",sinks:{stroke:{stride:28,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int16Array(t,4),e.views.texExtender=new Int8Array(t,8),e.views.vertexDistance=new Float32Array(t,12),e.views.componentDistance=new Float32Array(t,16),e.views.objectLength=new Float32Array(t,20),e.views.localID=new Uint32Array(t,24)},packObjectAttributes:(e,t,i,n,o)=>(0,s.v)([e,t.innerId,i,n],t,o),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tiers:e[2],hiddenByFloorComplexId:e[3],tileData:e.slice(4)})},stroke3d:{stride:32,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int16Array(t,4),e.views.texExtender=new Int8Array(t,8),e.views.vertexDistance=new Float32Array(t,12),e.views.componentDistance=new Float32Array(t,16),e.views.objectLength=new Float32Array(t,20),e.views.height=new Float32Array(t,24),e.views.localID=new Uint32Array(t,28)},packObjectAttributes:(e,t,i)=>(0,s.v)([e,t.innerId],t,i),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})}},generate(e,t,i,r,s,u){const f=(0,l.I)((0,d.FR)(i.style.geometryModifier,r),s,u,r);if(null===f)return;const{tileAttrs:_,tileProps:p}=r,v=(0,d.FR)(i.ignoreTier,r)?null:r.tileAttrs[p.db_tiers],g=_[p.db_hidden_by_metro_building_id]||"",y=i.style.withHeight?e.getBucket(i.type,"stroke3d",m.sinks.stroke3d.packObjectAttributes(t,i,r),m.sinks.stroke3d.binder):e.getBucket(i.type,"stroke",m.sinks.stroke.packObjectAttributes(t,i,v,g,r),m.sinks.stroke.binder),b=e.idIndexer.getIndex(r,t,i),x=h(_[p.componentDistanceStart]/a.Bq,_[p.objectLength]/a.Bq,b,i.style.withHeight?m.sinks.stroke3d.stride/2:m.sinks.stroke.stride/2),w=!Number.isNaN(_[p.beginningIsCut])&&0!==_[p.beginningIsCut],S=!Number.isNaN(_[p.endingIsCut])&&0!==_[p.endingIsCut],M=i.style.withHeight?(0,c.nm)(r,f):void 0;(0,n.W)(f.x,f.y,M,f.x.length,w?o.kU.TileCut:o.kU.Butt,S?o.kU.TileCut:o.kU.Butt,_[p.previousPointX],_[p.previousPointY],_[p.nextPointX],_[p.nextPointY],x,y)}})},4922:(e,t,i)=>{"use strict";i.d(t,{_:()=>d});var n=i(5600),o=i(3698),r=i(6273),s=i(132);const a={stride:4,binder:(e,t)=>{},packObjectAttributes:(e,t)=>[e,t],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(3)})},l={stride:20,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.normal=new Float32Array(t,4),e.views.height=new Float32Array(t,16)},packObjectAttributes:(e,t)=>[e,t],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})},d=(0,n.D)({symbol:"dem",sinks:{mesh:a,ground:a,mesh2:l,ground2:l,elevation:l,hillshade:{stride:8,binder:(e,t)=>{},packObjectAttributes:(e,t)=>[e,t],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})},flatBottom:{stride:12,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.demPosition=new Int16Array(t,4),e.views.extender=new Int8Array(t,8)},packObjectAttributes:(e,t,i)=>i?[e,t,i]:[e,t],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],matrix:e[2]?e[2]:void 0,tileData:e.slice(3)})}},generateMeshElevation(e,t,i,n){const o=e.getBucket("dem","elevation",d.sinks.elevation.packObjectAttributes(i,n),d.sinks.elevation.binder),r=e.getBucket("dem","mesh2",d.sinks.mesh2.packObjectAttributes(i,n),d.sinks.mesh2.binder),s=e.getBucket("dem","ground2",d.sinks.ground2.packObjectAttributes(i,n),d.sinks.ground2.binder);h(o,t,!0),h(r,t),h(s,t)},generateHillshade(e,t,i,n){const s=new Uint16Array(t.reduce(((e,t)=>{const[i,n,s,a]=t;return e.push(i*r.Bq,n*r.Bq,(0,o.Bb)(s),(0,o.Bb)(a)),e}),[]));return{symbol:d.symbol,sink:"hillshade",buffer:s.buffer,generatedObjects:[{drawMode:r.Fg,attributes:d.sinks.hillshade.packObjectAttributes(i,n),rangeStart:0,rangeEnd:s.buffer.byteLength,extents:new Float32Array(6)}]}},generateFloorsBottomFill(e,t,i,n,o,r){const a=i[0],l=i[1],h=i[0].length,m=d.sinks.flatBottom.packObjectAttributes(t,s.he,r);!function(e,t,i,n,o,r,s){let a=e.elements.offset;const l=a;if(t<3)return;c(e,a++,i[0],n[0],r,o[0],s),c(e,a++,i[1],n[1],r,o[1],s);for(let d=2;d<t;d++)u(e,l,d),c(e,a++,i[d],n[d],r,o[d],s);e.elements.offset=a}(e.getBucket("dem","flatBottom",m,d.sinks.flatBottom.binder),h,a,l,n,o,!!r)}});function c(e,t,i,n,o,s,a){const l=t*(e.elements.stride/e.views.position.BYTES_PER_ELEMENT),d=t*(e.elements.stride/e.views.extender.BYTES_PER_ELEMENT);e.views.position[l]=a?i:r.jO+i,e.views.position[l+1]=a?n:r.jO+n,e.views.demPosition[l]=(a?o[0]:r.jO+o[0])/8,e.views.demPosition[l+1]=(a?o[1]:r.jO+o[1])/8,e.views.extender[d]=127*s[0],e.views.extender[d+1]=127*s[1]}function u(e,t,i){const n=e.indices.buffer;let o=e.indices.offset;i%2==0?(n[o++]=t+i-2,n[o++]=t+i-1,n[o++]=t+i):(n[o++]=t+i-1,n[o++]=t+i-2,n[o++]=t+i),e.indices.offset=o}function h(e,t,i=!1){for(let n=0;n<t.indices.length;n++){const o=t.indices[n],s=e.elements.offset*(e.elements.stride/e.views.position.BYTES_PER_ELEMENT),a=t.vertices[3*o],l=t.vertices[3*o+1];e.views.position[s]=r.jO+(i?m(a):a),e.views.position[s+1]=r.jO+(i?m(l):l);const d=e.elements.offset*(e.elements.stride/e.views.normal.BYTES_PER_ELEMENT);e.views.normal[d]=t.normals[3*o],e.views.normal[d+1]=t.normals[3*o+1],e.views.normal[d+2]=t.normals[3*o+2];const c=e.elements.offset*(e.elements.stride/e.views.height.BYTES_PER_ELEMENT);e.views.height[c]=t.vertices[3*o+2],e.elements.offset++,e.indices.buffer[e.indices.offset]=n,e.indices.offset++}}function m(e){return 0===e?e-=128:e===r.Bq&&(e+=128),e}},6659:(e,t,i)=>{"use strict";i.d(t,{I:()=>u});var n=i(378),o=i(9090);const r={x:0,y:1};function s(e,t){for(const i in e){const n=r[i];void 0!==n?e[i].push(t[n]):e[i].push(NaN)}}var a=i(6392),l=i(6273),d=i(9073);function c(e,t,i,r){if(isNaN(e.step)||isNaN(e.width))return i;const{tileProps:c,tileAttrs:u}=r,h=(0,a.iq)(t,[0,0]),m=l.Bq/(0,a.aq)(t.coords[2])*d.C*h;let f=e.step*m;if(isNaN(f)&&(f=0),0===f)return i;const _=e.width*m,p={},v=i.x,g=i.y,y=v.length;for(const e in i)p[e]=[];let b=0;const x=[b];for(let e=1;e<y;e++)b+=n.TK([v[e-1],g[e-1]],[v[e],g[e]]),x.push(b);const w=n.Ue(),S=n.Ue(),M=[0,0],I=Math.abs(b/Math.trunc(b/f)),T=[v[0],g[0]];let E=(e.stopLines?1:-1)*Math.sign(e.width),P=0,A=0;for(s(p,T),e.stopLines&&!u[c.beginningIsCut]&&((0,o.uI)(w,v[A],g[A],v[A+1],g[A+1]),(0,o.fN)(S,w),n.bA(M,S,E*_),n.IH(T,T,M),s(p,T),P+=I/2,E=-E);P<=b;){for(;P>x[A+1];)A++;if((0,o.uI)(w,v[A],g[A],v[A+1],g[A+1]),(0,o.fN)(S,w),E>0)n.bA(M,S,E*_),n.IH(T,T,M),n.bA(M,w,I/2),n.IH(T,T,M),s(p,T);else{const e=Math.min(1,(P-x[A])/(x[A+1]-x[A]));n.t7(T,[v[A],g[A]],[v[A+1],g[A+1]],e),s(p,T)}E=-E,P+=I/2}return e.stopLines&&!u[c.endingIsCut]&&(n.bA(M,S,E*_),n.IH(T,T,M),s(p,T)),p}function u(e,t,i,n){if(!(o=e,o&&Array.isArray(o)&&0!==e.length))return i;var o;let r=function(e){const t={};for(const i in e)e[i]&&(t[i]=Array.from(e[i]));return t}(i);for(const i of e){if("object"!=typeof i||!i)return console.warn(`Wrong value ${i} in modifiers list.`),null;if(!("type"in i))return console.warn(`Wrong value ${i} in modifiers list.`),null;if("zigzag-modifier"!==i.type)return console.warn(`Expression with type ${i.type} cannot be used as geometry modifier.`),null;if(r=c(i,t,r,n),null===r)return null}return r}},7965:(e,t,i)=>{"use strict";i.d(t,{D:()=>l});var n=i(5600),o=i(6392),r=i(6273),s=i(8585),a=i(9073);const l=(0,n.D)({symbol:"globe",sinks:{fill:{stride:16,binder:(e,t)=>{e.views.ecefPosition=new Int16Array(t),e.views.flatPosition=new Uint16Array(t,6),e.views.texture=new Uint16Array(t,12)},packObjectAttributes:(e,t,i)=>[e,t.innerId,i],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)}),generate(e,t,i,n){const s=n.coords.join("/");!function(e,t,i){const n=(0,o.Bs)(i),s=e.views.ecefPosition,u=e.indices.buffer,h=i[1]===Math.pow(2,i[2])-1,m=0===i[1],f=e.elements.offset*l.sinks.fill.stride/Uint16Array.BYTES_PER_ELEMENT;let _=0,p=e.indices.offset;for(let e=0;e<t;e++)for(let i=0;i<t;i++){let l;const u=[e*Math.pow(2,15)/(t-1),i*Math.pow(2,15)/(t-1)];l=h&&i===t-1?d:m&&0===i?c:(0,o.$F)(n,u),s[f+_++]=l[0]*a.qz,s[f+_++]=l[1]*a.qz,s[f+_++]=l[2]*a.qz,s[f+_++]=r.jO+u[0],s[f+_++]=r.jO+u[1],s[f+_++]=0,s[f+_++]=e/(t-1)*(Math.pow(2,16)-1),s[f+_++]=i/(t-1)*(Math.pow(2,16)-1)}for(let e=0;e<t-1;e++)for(let i=0;i<t-1;i++){const n=e*t+i,o=n+1,r=n+t,s=r+1;u[p++]=n,u[p++]=r,u[p++]=o,u[p++]=o,u[p++]=r,u[p++]=s}e.indices.offset=p,e.elements.offset=f+_/8}(e.getBucket("globe","fill",l.sinks.fill.packObjectAttributes(t.id,i,s),l.sinks.fill.binder),32,n.coords)}}}}),d=s._.fromGeo([0,90]),c=s._.fromGeo([0,-90])},7407:(e,t,i)=>{"use strict";i.d(t,{m:()=>z});var n=i(378),o=i(9450),r=i(351),s=i(127),a=i(9090),l=i(6273),d=i(5600),c=i(2702),u=i(2543),h=i(6392),m=i(9073),f=i(2618),_=i(7966),p=i(6490),v=i(9865),g=i(7464),y=i(8585),b=i(4693),x=i(9218);const w=[0,0,0],S=new Int16Array([0,0,0]),M=new Array(16),I=new Float32Array(9),T=[0,0,0],E=[0,0,0],P=[0,0,0],A=[0,0,0],L=o.Ue(),C=o.Zh([1,1,1]),z=(0,d.D)({symbol:"gltfModel",sinks:{instances:{stride:64,binder:(e,t)=>{e.views.flatPosition=new Uint16Array(t),e.views.flatHeight=new Float32Array(t,4),e.views.ecefPosition=new Int16Array(t,8),e.views.matrix=new Float32Array(t,16),e.views.localID=new Uint32Array(t,52),e.views.labelingTextureID=new Uint32Array(t,56),e.views.absZ=new Float32Array(t,60)},packObjectAttributes:(e,t,i,n,o,r,s,a,l=[],d,u,h,m,f,_)=>(0,c.v)([e,t.innerId,i,l,a,r,n,o,d,u,h,m,f,_],t,s),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],modelIndices:e[2],lngLat:e[3],emitShowHideEvents:e[4],sourceId:e[5],modelStepValues:e[6],modelStepSource:e[7],parentId:e[8],absZ:e[9],floorId:e[10],hiddenByFloorComplexId:e[11],subkey:e[12],extToReliefNeeded:e[13],tileData:e.slice(14)})}},generateInstances(e,t,i,n,r,s,a,l,d,c,m=0){var M,A,L;const C=(0,u.FR)(i.style.linkedIds,n),R=""===C?[]:(0,v.l)(C),F=i.style.modelSrc,B=[];let D=b.N.None;const j=(0,u.EG)(F,n,i,!0);if(1===j.length)B.push(0);else if(j.length>1){if(!(0,g.Uu)(F)||"step"!==F.type||!(0,g.Uu)(F.value))return void console.error(`Only step-expression is allowed as 'modelSrc' style property. Models won't be displayed for layer ${i.id}`);switch(F.value.type){case"zoom":D=b.N.Zoom;break;case"distance":D=b.N.Distance;break;default:return void console.error(`'${F.value.type}' type in 'modelSrc' step expression is not supported. Only 'zoom' and 'distance' are supported. Models won't be displayed for layer ${i.id}`)}F.steps.forEach((({key:e})=>{B.push(e)}))}D===b.N.Distance&&j.reverse(),j.forEach(((e,t)=>{null===e&&0!==t&&(j[t]=j[t-1])})),D===b.N.Distance&&j.reverse();const N=j.map((e=>null===e?"":e)).map((i=>{let n=t.modelIndex[i];return void 0===n&&(i=(0,_.mN)(i,null!=l?l:"",s.coords),n=e.addUsedModelByUrl(i)),e.addUsedModel(n),n})),{tileProps:U,tileAttrs:H}=n;let G=f.X4;i.interactive?n.id&&(G=H[U.hovered]?f.gl:e.idIndexer.getIndex(n,t.id,i,{metatile:c,objectClass:H[U.db_object_class]})):G=i.interactiveOcclusion?f.X4:f.gl;const V=null!==(M=n.id)&&void 0!==M?M:"-1",Z=H[U.db_point_building_id],W=H[U.db_hidden_by_metro_building_id]||"";let X=f.X4;n.id&&(X=e.pointIndexer.getIndex(null!=Z?Z:n.id));const K=(null==d?void 0:d.has(H[U.db_sublayer]))&&"-1"!==V?1:0,$=void 0!==r.abs_z&&Array.from(r.abs_z).some((e=>e))?r.abs_z:void 0,q=e.getBucket("gltfModel","instances",z.sinks.instances.packObjectAttributes(t.id,i,N,B,D,a,n,K,K?(0,h.gQ)(r.x[0],r.y[0],s):void 0,Z,!!$,H[U.db_plan_id]||"",W,(0,h.XJ)(s,r.x[0],r.y[0],m),!1),z.sinks.instances.binder);let Y,J=q.meta;if(J)J.linkedIds.push(...R);else{const e=U.db_plan_id?H[U.db_plan_id]:void 0;J=q.meta={linkedIds:R.slice(),modelsPath:null!=l?l:"",buildingId:V,planId:e}}K&&(J.sublayer=H[U.db_sublayer]),Z&&(J.childrenIds||(J.childrenIds=[]),J.childrenIds.push(V));const Q=function(e,t){const i=e[t.tileProps.direction];if(void 0===i)return null;if(Array.isArray(i))return i;if("Point"===i.type)return i.coordinates;return null}(H,n);if(Q){const e=r.x[0],t=r.y[0],i=[0,0,0];(0,h.Z$)(i,[e,t],s),Y=[i,y.H.fromGeo(Q)]}for(let e=0;e<r.x.length;e++)o.t8(E,0,0,0),(0,p.FR)((0,u.FR)(i.style.rotation,n),E),o.t8(T,1,1,1),(0,p.FR)((0,u.FR)(i.style.scale,n),T),o.t8(P,0,0,0),(0,p.FR)((0,u.FR)(i.style.offset,n),P),k(r.x[e],r.y[e],null!==(L=null===(A=r.z)||void 0===A?void 0:A[e])&&void 0!==L?L:0,P,T,E,Y,s,i.minzoom<x.globeConfig.globeMaxZoom),O(q,w,S,I,G,X,null==$?void 0:$[e])},patchBuffer(e,t,i,n,o,r,s,a){const d=z.sinks.instances.stride*t;k(n[0],n[1],n[2],o,r,s,void 0,i,a);const c=w[0]+l.jO,u=w[1]+l.jO,h=w[2]/(32*l._H);e.subData(d+0,new Uint16Array([c,u])),e.subData(d+4,new Float32Array([h])),a&&e.subData(d+8,S),e.subData(d+16,I)}});function k(e,t,i,a,d,c,u,f,_){o.t8(w,e,t,i);const v=(0,h.iq)(f,w)*m.C;if(s.yR(M),s.jI(M,M,(0,p.Id)(c[2])),s.uD(M,M,(0,p.Id)(c[1])),s.lM(M,M,(0,p.Id)(c[0])),s.bA(M,M,d),u?function(e,t,i){n.lu(A,i,t),s.jI(e,e,Math.atan2(A[1],A[0]));const r=n.kE(A);o.t8(T,r,r,r),s.bA(e,e,T)}(M,u[0],u[1]):(o.t8(T,v,v,v),s.bA(M,M,T)),s.lM(M,M,Math.PI/2),r.xO(I,M),function(e,t,i,r){const s=i*l.Bq/(0,h.aq)(r.coords[2]);n.bA(t,t,s),t[2]*=i,o.IH(e,e,t)}(w,a,v,f),_){const e=(0,h.$F)(f,w);S[0]=e[0]*m.qz,S[1]=e[1]*m.qz,S[2]=e[2]*m.qz}}function O(e,t,i,n,r,s,d){const c=e.elements.offset*z.sinks.instances.stride,u=e.views,m=c/u.flatPosition.BYTES_PER_ELEMENT,f=l.jO+t[0],_=l.jO+t[1],p=t[2]*h.My;if(u.flatPosition[m]=f,u.flatPosition[m+1]=_,u.flatHeight[c/u.flatHeight.BYTES_PER_ELEMENT]=p/l._H,u.ecefPosition[m]=i[0],u.ecefPosition[m+1]=i[1],u.ecefPosition[m+2]=i[2],e.elements.offset>e.elements.maximum-1)return;u.matrix.set(n,c/u.matrix.BYTES_PER_ELEMENT),u.localID[c/u.localID.BYTES_PER_ELEMENT]=r,u.labelingTextureID[c/u.labelingTextureID.BYTES_PER_ELEMENT]=s,u.absZ[c/u.absZ.BYTES_PER_ELEMENT]=null!=d?d:0,function(e,t,i,n,r){const s=e.extents;t<s[0]&&(s[0]=t);i<s[1]&&(s[1]=i);n<s[2]&&(s[2]=n);t>s[3]&&(s[3]=t);i>s[4]&&(s[4]=i);n>s[5]&&(s[5]=n);const l=L;(0,a.Iq)(r,l);const d=o.Zh(l)/C;d>e.maxDiag&&(e.maxDiag=d)}(e,f,_,p,n);const v=e.indices;v.buffer[v.offset]=e.elements.offset,v.offset++,e.elements.offset++}},749:(e,t,i)=>{"use strict";i.d(t,{B:()=>s});var n=i(5600),o=i(2543),r=i(6273);const s=(0,n.D)({symbol:"heatmap",sinks:{fill:{stride:8,binder:(e,t)=>{e.views.position=new Float32Array(t)},packObjectAttributes:(e,t,i,n)=>[e,t.innerId,i,n],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],textureIndex:e[2],rampTextureIndex:e[3],tileData:e.slice(4)})},framebuffer:{stride:12,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.weight=new Float32Array(t,4),e.views.widen=new Int8Array(t,8)},packObjectAttributes:(e,t)=>[e,t],unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})}},generate(e,t,i,n,r){const a=n.x,c=n.y,u=Number((0,o.FR)(i.style.weight,r));if(Number.isNaN(u))return void console.error("Can't resolve style.weight to number");const h=e.getBucket(i.type,"framebuffer",s.sinks.framebuffer.packObjectAttributes(t,i.innerId),s.sinks.framebuffer.binder);for(let e=0;e<a.length;e++)d(h,0,1,2,2,1,3),l(h,a[e],c[e],-1,-1,u),l(h,a[e],c[e],1,-1,u),l(h,a[e],c[e],-1,1,u),l(h,a[e],c[e],1,1,u)},generateTexture(e,t,i,n,o){const r=[-1,1,1,-1],l=[-1,-1,1,1],d=e.getBucket(i.type,"fill",s.sinks.fill.packObjectAttributes(t,i,n,o),s.sinks.fill.binder);let c=d.elements.offset;!function(e,t,i,n,o,r,s,a){const l=e.buffer,d=e.offset;l[d]=t+i,l[d+1]=t+n,l[d+2]=t+o,l[d+3]=t+r,l[d+4]=t+s,l[d+5]=t+a,e.offset=d+6}(d.indices,c,0,1,2,0,2,3),a(d,c++,r[0],l[0]),a(d,c++,r[1],l[1]),a(d,c++,r[2],l[2]),a(d,c++,r[3],l[3]),d.elements.offset=c}});function a(e,t,i,n){const o=2*t;e.views.position[o]=i,e.views.position[o+1]=n}function l(e,t,i,n,o,s){const a=e.elements.offset*e.elements.stride,l=a>>1,d=l>>1;e.views.position[l]=r.jO+t,e.views.position[l+1]=r.jO+i,e.views.weight[d]=s,e.views.widen[a]=n,e.views.widen[a+1]=o,e.elements.offset++}function d(e,t,i,n,o,r,s){const{elements:a,indices:l}=e,{buffer:d,offset:c}=l,u=a.offset;d[c]=u+t,d[c+1]=u+i,d[c+2]=u+n,d[c+3]=u+o,d[c+4]=u+r,d[c+5]=u+s,l.offset=c+6}},143:(e,t,i)=>{"use strict";function n(e,t){return 0===e?0:Math.min(2*e-1,2*(t-e))}i.d(t,{X:()=>n})},4999:(e,t,i)=>{"use strict";i.d(t,{$Y:()=>c,MD:()=>h,Uu:()=>m,k8:()=>f});var n=i(9218),o=i(7840),r=i(6273),s=i(9090),a=i(6392),l=i(9073);const d=[0,0];function c(e,t,i,r,s,a,l,c){let{textLineHeight:u,textLetterSpacing:h}=a.style;l===o.bR.Icon&&(u=a.style.iconTextLineHeight,h=a.style.iconTextLetterSpacing);const{identifyPoiLabelIndex:m,labelingTextureIndex:f,spritePointTextureIndex:v}=t,{lines:g,maxWidth:y}=s,b=u*n.fonts.baseSize;let x=_(1,b,g.length);for(let t=0;t<g.length;t++){const o=g[t].width;let s=0;s=-o/2,d[0]=s,d[1]=x;const a=g[t].glyphs;for(let t=0;t<a.length;t++){const o=a[t];void 0!==o.bitmap&&p(e[o.range],i,r,d,o,m,f,v,c),d[0]+=o.advance+n.fonts.baseSize*h}x-=b}}const u=[0,0];function h(e,t,i,o,s,a){const{lines:l,maxWidth:d}=i;if(!l.length)return u[0]=0,u[1]=0,u;const{textLineHeight:c}=o.style,h=c*n.fonts.baseSize,m=-d/2,f=_(1,h,l.length),p=d/2,v=f-(l.length-1)*h;u[0]=s*(m+p)/2,u[1]=s*(f+v)/2;const y=s*r.Jv/2,b=u[0]-y,w=u[0]+y,S=u[1]+y,M=u[1]-y,I=e.elements.offset;return x(e.indices,I,1,0,3,2,3,0),g(e,t,b,S,a),g(e,t,w,S,a),g(e,t,b,M,a),g(e,t,w,M,a),u}function m(e,t,i,n,o,r,s){const a=i[1]+n.top,l=i[0]+n.left,d=a-n.height,c=l+n.width,u=Math.sin(o),h=Math.cos(o),m=l*h-a*u,f=l*u+a*h,_=c*h-a*u,p=c*u+a*h,v=l*h-d*u,g=l*u+d*h,b=c*h-d*u,w=c*u+d*h,S=e.elements.offset;y(e,t,m,f,n.texLeft,n.texTop,r,s),y(e,t,_,p,n.texRight,n.texTop,r,s),y(e,t,v,g,n.texLeft,n.texBottom,r,s),y(e,t,b,w,n.texRight,n.texBottom,r,s),x(e.indices,S,1,0,3,2,3,0)}function f(e,t,i){const n=e.elements.offset,o=(0,s.Tz)(Math.cos(i)),r=(0,s.Tz)(Math.sin(i));b(e,t,o,r,-1,-1),b(e,t,o,r,1,-1),b(e,t,o,r,1,1),b(e,t,o,r,-1,1),x(e.indices,n,0,1,2,2,3,0)}function _(e,t,i){let n;switch(e){case 0:n=t/2+t*(i-1);break;case 2:n=-t/2;break;default:n=1&i?t*(i>>1):t/2+t*(i-1>>1)}return n}function p(e,t,i,n,o,r,s,a,l){const d=n[1]+o.top,c=n[0]+o.left,u=d-o.height,h=c+o.width,[m,f]=l,_=e.elements.offset;v(e,t,i,c,d,o.texLeft,o.texTop,m,f,r,s,a),v(e,t,i,h,d,o.texRight,o.texTop,m,f,r,s,a),v(e,t,i,c,u,o.texLeft,o.texBottom,m,f,r,s,a),v(e,t,i,h,u,o.texRight,o.texBottom,m,f,r,s,a),x(e.indices,_,1,0,3,2,3,0)}function v(e,t,i,n,o,s,d,c,u,h,m,f){const _=e.elements,p=_.stride*_.offset>>1,v=p>>1;e.views.flatPosition[p]=r.jO+t[0],e.views.flatPosition[p+1]=r.jO+t[1],e.views.flatPosition[p+2]=(0,a.VW)(t[2]),e.views.ecefPosition[p]=i[0]*l.qz,e.views.ecefPosition[p+1]=i[1]*l.qz,e.views.ecefPosition[p+2]=i[2]*l.qz,e.views.cornerOffset[p]=n,e.views.cornerOffset[p+1]=o,e.views.checkPointOffset[p]=c,e.views.checkPointOffset[p+1]=u,e.views.texCoords[p]=s,e.views.texCoords[p+1]=d,e.views.localID[v]=h,e.views.labelingTextureID[v]=m,e.views.spritePointTextureID[v]=f,_.offset++}function g(e,t,i,n,o){const s=e.elements,l=s.stride*s.offset>>1;e.views.position[l]=r.jO+t[0],e.views.position[l+1]=r.jO+t[1],e.views.position[l+2]=(0,a.VW)(t[2]),e.views.cornerOffset[l]=i,e.views.cornerOffset[l+1]=n,e.views.labelingTextureID[l>>1]=o,s.offset++}function y(e,t,i,n,o,s,l,d){const c=e.elements;let u=c.stride*c.offset>>1;e.views.position[u]=r.jO+t[0],e.views.position[u+1]=r.jO+t[1],e.views.position[u+2]=(0,a.VW)(t[2]),e.views.texCoords[u]=o,e.views.texCoords[u+1]=s,u>>=1,e.views.cornerOffset[u]=i,e.views.cornerOffset[u+1]=n,e.views.styleZoomLimits[u]=l,e.views.styleZoomLimits[u+1]=d,c.offset++}function b(e,t,i,n,o,s){const a=e.elements.stride*e.elements.offset,l=a/e.views.position.BYTES_PER_ELEMENT,d=a/e.views.direction.BYTES_PER_ELEMENT;e.views.position[l]=r.jO+t[0],e.views.position[l+1]=r.jO+t[1],e.views.direction[d]=i,e.views.direction[d+1]=n,e.views.widenDirection[d]=o,e.views.widenDirection[d+1]=s,e.elements.offset++}function x(e,t,i,n,o,r,s,a){const l=e.buffer,d=e.offset;l[d]=t+i,l[d+1]=t+n,l[d+2]=t+o,l[d+3]=t+r,l[d+4]=t+s,l[d+5]=t+a,e.offset=d+6}},159:(e,t,i)=>{"use strict";var n,o,r;i.d(t,{SP:()=>n,gD:()=>o,kU:()=>r}),function(e){e[e.Striped=1]="Striped",e[e.Entrance=2]="Entrance",e[e.Patterned=3]="Patterned"}(n||(n={})),function(e){e[e.Line=0]="Line",e[e.Arrow=1]="Arrow",e[e.StartBorder=2]="StartBorder",e[e.LineEnding=3]="LineEnding"}(o||(o={})),function(e){e[e.TileCut=0]="TileCut",e[e.Butt=1]="Butt",e[e.Round=2]="Round"}(r||(r={}))},8352:(e,t,i)=>{"use strict";i.d(t,{W:()=>x});var n=i(9090),o=i(159),r=i(6273);const s=-1,a=[.5,.5],l=[.5,.5],d=[.5,.5],c=[.5,.5],u=[0,0],h=[0,0];let m,f,_,p=0,v=0,g=0,y=0;const b={x:0,y:0,z:0,xn2:0,yn2:0,xn1:0,yn1:0,patternedLine:!1,noTurn:!0,leftTurn:!1,sharpTurn:!1,reverseTurn:!1,extender:[.5,.5],faExtender:[.5,.5],saExtender:[.5,.5]};function x(e,t,i,l,c,u,b,x,S,A,C,z,k=!1){var O,R,F,B,D,j,N;let U,H,G,V,Z,W,X,K,$,q,Y,J,Q;if(0!==l)if(_=C,f=z,m=f.indices,v=f.elements.offset,p=0,g=0,y=0,h[0]=e[0],h[1]=t[0],1===l)U=e[0],H=t[0],G=null!==(O=null==i?void 0:i[0])&&void 0!==O?O:0,Q=0,L(m,v,0,2,1,1,2,3),P(f,_,0,U,H,G,1,-1,1,-1,Q,!1,s),P(f,_,0,U,H,G,-1,-1,-1,-1,Q,!1,1),P(f,_,0,U,H,G,1,1,1,1,Q,!1,s),P(f,_,0,U,H,G,-1,1,-1,1,Q,!1,1),p+=4;else{switch(V=e[0],Z=t[0],W=null!==(R=null==i?void 0:i[0])&&void 0!==R?R:0,X=e[1],K=t[1],$=null!==(F=null==i?void 0:i[1])&&void 0!==F?F:0,Q=k?_.cDist:0,c){case o.kU.TileCut:(0,n.AE)(a,V,Z,b,x),(0,n.AE)(d,X,K,V,Z),J=w(X,K,$,a[0],a[1],d[0],d[1],k),J.noTurn?I(V,Z,W,d[0],d[1],Q):M(0,V,Z,W,a[0],a[1],d[0],d[1],Q,k);break;case o.kU.Butt:case o.kU.Round:(0,n.AE)(d,X,K,V,Z),I(V,Z,W,d[0],d[1],Q),c===o.kU.Round&&M(0,V,Z,W,d[0],d[1],d[0],d[1],Q,k);break;default:throw new Error("LoftedLine: unknown Ending Type")}const s=l-1;for(let o=1;o<s;o++){V=e[o-1],Z=t[o-1],W=null!==(B=null==i?void 0:i[o-1])&&void 0!==B?B:0,X=e[o],K=t[o],$=null!==(D=null==i?void 0:i[o])&&void 0!==D?D:0,q=e[o+1],Y=t[o+1],h[0]=V,h[1]=Z;const s=X-V,l=K-Z;Q+=Math.sqrt(s*s+l*l)/r.Bq,(0,n.AE)(a,X,K,V,Z),(0,n.AE)(d,q,Y,X,K),M(o,X,K,$,a[0],a[1],d[0],d[1],Q,k)}V=e[l-2],Z=t[l-2],W=null!==(j=null==i?void 0:i[l-2])&&void 0!==j?j:0,X=e[s],K=t[s],$=null!==(N=null==i?void 0:i[s])&&void 0!==N?N:0;const m=X-V,f=K-Z;switch(Q+=Math.sqrt(m*m+f*f)/r.Bq,u){case o.kU.TileCut:(0,n.AE)(a,X,K,V,Z),(0,n.AE)(d,S,A,X,K),J=w(X,K,$,a[0],a[1],d[0],d[1],k),J.noTurn?T(s,X,K,$,d[0],d[1],Q):E(s,Q,J);break;case o.kU.Butt:case o.kU.Round:(0,n.AE)(d,X,K,V,Z),T(s,X,K,$,d[0],d[1],Q),u===o.kU.Round&&M(s,X,K,$,d[0],d[1],-d[0],-d[1],Q,k);break;default:throw new Error("LoftedLine: unknown Ending Type")}}}function w(e,t,i,o,r,s,a,d){const c=function(e,t,i,n,o,r,s,a){const l=b;l.x=e,l.y=t,l.z=i,l.xn2=n,l.yn2=o,l.xn1=r,l.yn1=s,l.patternedLine=a;const d=n*r+o*s;return l.noTurn=d>.9999,l.leftTurn=n*-s+o*r<0,l.sharpTurn=d<0&&d>-.9,l.reverseTurn=d<-.9,l}(e,t,i,o,r,s,a,d);if(c.noTurn||c.reverseTurn)c.extender[0]=0,c.extender[1]=0,c.faExtender[0]=0,c.faExtender[1]=0,c.saExtender[0]=0,c.saExtender[1]=0;else{(0,n.ax)(l,o,r,s,a);const e=l[0],t=l[1];c.extender[0]=e,c.extender[1]=t,c.faExtender[0]=e-2*o,c.faExtender[1]=t-2*r,c.saExtender[0]=e-2*s,c.saExtender[1]=t-2*a}return c}function S(e,t,i,o,r,s,a,d,c,u){(0,n.ax)(l,r,s,a,d);r*-d+s*a<0?P(f,_,e,t,i,o,-l[0],-l[1],-l[0],-l[1],c,!1,u):P(f,_,e,t,i,o,l[0],l[1],l[0],l[1],c,!1,u),p++}function M(e,t,i,o,r,a,l,d,u,h){const b=w(t,i,o,r,a,l,d,h);E(e,u,b),function(e,t,i){if(i.noTurn)return;const o=i.sharpTurn?2:1;let r,a;i.reverseTurn||i.patternedLine&&i.sharpTurn?(r=y,a=g):i.leftTurn?(r=g,a=p+o):(r=p+o,a=y);const l=p;if(A(m,v,g,y,l),i.sharpTurn){const e=p+1;i.leftTurn?L(m,v,l,e,r,r,e,a):L(m,v,l,a,e,e,a,r)}else i.leftTurn,A(m,v,l,a,r);const d=i.leftTurn?1:s;i.sharpTurn?(i.leftTurn?(0,n.AE)(c,i.xn2,i.yn2,i.xn1,i.yn1):(0,n.AE)(c,i.xn1,i.yn1,i.xn2,i.yn2),S(e,i.x,i.y,i.z,i.xn2,i.yn2,c[0],c[1],t,d),S(e,i.x,i.y,i.z,c[0],c[1],i.xn1,i.yn1,t,d)):S(e,i.x,i.y,i.z,i.xn2,i.yn2,i.xn1,i.yn1,t,d);i.reverseTurn||(i.leftTurn?P(f,_,e,i.x,i.y,i.z,-i.xn1,-i.yn1,-i.xn1,-i.yn1,t,!1,d):P(f,_,e,i.x,i.y,i.z,i.xn1,i.yn1,i.xn1,i.yn1,t,!1,d),p++);y=a,g=r}(e,u,b),function(e,t,i){if(i.noTurn||i.reverseTurn)return;const n=p+1,o=p;if(i.patternedLine&&i.sharpTurn)return P(f,_,e,i.x,i.y,i.z,i.xn2,i.yn2,i.xn2,i.yn2,t,!1,1),P(f,_,e,i.x,i.y,i.z,-i.xn2,-i.yn2,-i.xn2,-i.yn2,t,!1,s),p+=2,y=o,void(g=n);i.leftTurn?(P(f,_,e,i.x,i.y,i.z,-i.xn1,-i.yn1,i.saExtender[0],i.saExtender[1],t,!1,1),P(f,_,e,i.x,i.y,i.z,i.xn1,i.yn1,i.extender[0],i.extender[1],t,!1,s)):(P(f,_,e,i.x,i.y,i.z,-i.xn1,-i.yn1,-i.extender[0],-i.extender[1],t,!1,1),P(f,_,e,i.x,i.y,i.z,i.xn1,i.yn1,-i.saExtender[0],-i.saExtender[1],t,!1,s));p+=2,i.leftTurn?L(m,v,y,o,g,g,o,n):L(m,v,g,y,n,n,y,o);y=o,g=n}(e,u,b)}function I(e,t,i,n,o,r){P(f,_,0,e,t,i,-n,-o,-n,-o,r,!1,1),P(f,_,0,e,t,i,n,o,n,o,r,!1,s),p+=2,g=1,y=0}function T(e,t,i,n,o,r,a){const l=p+1,d=p;P(f,_,e,t,i,n,-o,-r,-o,-r,a,!1,1),P(f,_,e,t,i,n,o,r,o,r,a,!1,s),p+=2,L(m,v,y,d,g,g,d,l),g=l,y=d}function E(e,t,i){if(i.noTurn)return;const n=p+1,o=p;if(i.reverseTurn||i.patternedLine&&i.sharpTurn?(P(f,_,e,i.x,i.y,i.z,-i.xn2,-i.yn2,-i.xn2,-i.yn2,t,!1,1),P(f,_,e,i.x,i.y,i.z,i.xn2,i.yn2,i.xn2,i.yn2,t,!1,s)):i.leftTurn?(P(f,_,e,i.x,i.y,i.z,-i.xn2,-i.yn2,i.faExtender[0],i.faExtender[1],t,!0,1),P(f,_,e,i.x,i.y,i.z,i.xn2,i.yn2,i.extender[0],i.extender[1],t,!0,s)):(P(f,_,e,i.x,i.y,i.z,-i.xn2,-i.yn2,-i.extender[0],-i.extender[1],t,!0,1),P(f,_,e,i.x,i.y,i.z,i.xn2,i.yn2,-i.faExtender[0],-i.faExtender[1],t,!0,s)),p+=2,L(m,v,y,o,g,g,o,n),y=o,g=n,!i.patternedLine&&!i.reverseTurn){const r=p+1,s=p;i.leftTurn?(P(f,_,e,i.x,i.y,i.z,-i.xn2,-i.yn2,-i.xn2,-i.yn2,t,!1,0),P(f,_,e,i.x,i.y,i.z,0,0,0,0,t,!1,0),L(m,v,n,o,r,r,o,s)):(P(f,_,e,i.x,i.y,i.z,0,0,0,0,t,!1,0),P(f,_,e,i.x,i.y,i.z,i.xn2,i.yn2,i.xn2,i.yn2,t,!1,0),L(m,v,o,s,n,n,s,r)),p+=2,y=s,g=r}}function P(e,t,i,s,a,l,d,c,h,m,f,_,p){const v=e.elements.offset*t.offsetMultiplier,g=v>>1,y=v<<1;if(e.views.position[v]=r.jO+s,e.views.position[v+1]=r.jO+a,e.views.extender[v]=Math.floor(h*r.Gt*127+.5),e.views.extender[v+1]=Math.floor(m*r.Gt*127+.5),t.type===o.SP.Patterned){const t=1e-5;e.views.texture[g]=(t+f)*Math.sign(p)}else if(t.type===o.SP.Striped){const i=e;i.views.texExtender[y]=(0,n.Tz)(d*r.Gt),i.views.texExtender[y+1]=(0,n.Tz)(c*r.Gt),i.views.vertexDistance[g]=f,i.views.objectLength[g]=t.oLen,"componentDistance"in e.views&&(e.views.componentDistance[g]=t.cDist)}else if(t.type===o.SP.Entrance){const s=e,{px:a,py:l,count:h}=t,m=0===i,p=i===h-1,b=m?i:i-1,x=m?i+1:i;(0,n.uI)(u,a[b],l[b],a[x],l[x]),s.views.direction[v]=Math.round(127*u[0]),s.views.direction[v+1]=Math.round(127*u[1]),s.views.type[g]=p?o.gD.LineEnding:o.gD.Line,s.views.texExtender[y]=(0,n.Tz)(d*(_||p?-1:1)*r.Gt),s.views.texExtender[y+1]=(0,n.Tz)(c*(_||p?-1:1)*r.Gt),s.views.vertexDistance[g]=f,s.views.objectLength[g]=t.oLen}e.views.localID[g]=t.localID,"height"in e.views&&(e.views.height[g]=l),e.elements.offset++}function A(e,t,i,n,o){const r=e.buffer,s=e.offset;r[s]=t+i,r[s+1]=t+n,r[s+2]=t+o,e.offset=s+3}function L(e,t,i,n,o,r,s,a){const l=e.buffer,d=e.offset;l[d]=t+i,l[d+1]=t+n,l[d+2]=t+o,l[d+3]=t+r,l[d+4]=t+s,l[d+5]=t+a,e.offset=d+6}},2682:(e,t,i)=>{"use strict";i.d(t,{n:()=>d});var n=i(9450),o=i(6273),r=i(6392);const s=n.Ue(),a=n.Ue(),l=n.Ue();function d(e,t,i,o,r,d,u,h,m,f,_,p,v,g){n.t8(s,t,i,o),n.t8(a,r,d,u),n.lu(l,a,s),n.fS(a,s)||(n.Fv(l,l),n.bA(l,l,127)),function(e,t,i,n,o,r,s){const a=e.indices.buffer,l=e.indices.offset,d=e.elements.offset;a[l]=d+t,a[l+1]=d+i,a[l+2]=d+n,a[l+3]=d+o,a[l+4]=d+r,a[l+5]=d+s,e.indices.offset=l+6}(e,0,1,3,3,1,2),c(e,s,l,1,h,m,f,_,v),c(e,s,l,-1,h,m,f,_,v),c(e,a,l,-1,h,m,f,p,g),c(e,a,l,1,h,m,f,p,g)}function c(e,t,i,n,s,a,l,d,c){const u=e.elements.offset*e.elements.stride,h=u/e.views.position.BYTES_PER_ELEMENT;if(e.views.position[h]=a?t[0]:o.jO+t[0],e.views.position[h+1]=a?t[1]:o.jO+t[1],"height"in e.views){const i=u/e.views.height.BYTES_PER_ELEMENT;e.views.height[i]=(a?t[2]:l?t[2]*r.My:(0,r.VW)(t[2]))/o._H}if(e.views.directionDistance[u]=i[0],e.views.directionDistance[u+1]=i[1],e.views.directionDistance[u+2]=i[2],e.views.directionDistance[u+3]=n,"demPosition"in e.views){const i=u/e.views.demPosition.BYTES_PER_ELEMENT;s=null!=s?s:t,e.views.demPosition[i]=(a?s[0]:o.jO+s[0])/8,e.views.demPosition[i+1]=(a?s[1]:o.jO+s[1])/8}"absZ"in e.views&&void 0!==d&&(e.views.absZ[u/e.views.absZ.BYTES_PER_ELEMENT]=d),"isPivot"in e.views&&(e.views.isPivot[u/e.views.isPivot.BYTES_PER_ELEMENT]=null!=c?c:0),e.elements.offset++}},6563:(e,t,i)=>{"use strict";i.d(t,{e:()=>g});var n=i(6273),o=i(378),r=i(6490),s=i(9090),a=i(159);const l=o.Ue(),d=o.Ue(),c=o.Ue(),u=o.Ue(),h=o.Ue(),m=o.Ue(),f=o.Ue(),_=o.Ue();let p=0,v=0;function g(e,t,i,n,o,r,d,c,u,h,m){var f,_,v,g;if(!(r<2)){if((0,s.uI)(l,t[0],i[0],t[1],i[1]),p=0,d===a.kU.Round){const r=void 0!==h?h[0]:0,s=void 0!==m?m[0]:0;b(e,t[0],i[0],null!==(f=null==n?void 0:n[0])&&void 0!==f?f:0,null!==(_=null==o?void 0:o[0])&&void 0!==_?_:0,-l[0],-l[1],r,s,u)}for(let s=1;s<r;s++)y(e,t,i,n,o,s,r,u,h,m);if(c===a.kU.Round){const s=void 0!==h?h[r-1]:0,a=void 0!==m?m[r-1]:0;b(e,t[r-1],i[r-1],null!==(v=null==n?void 0:n[r-1])&&void 0!==v?v:0,null!==(g=null==o?void 0:o[r-1])&&void 0!==g?g:0,l[0],l[1],s,a,u)}}}function y(e,t,i,a,g,y,w,S,M,I){var T,E,P,A,L,C,z,k,O,R;const F=y===w-1;if(o.t8(h,t[y-1],i[y-1]),o.t8(m,t[y],i[y]),void 0!==M&&void 0!==I?(o.t8(c,M[y-1],I[y-1]),o.t8(u,M[y],I[y])):(o.t8(c,0,0),o.t8(u,0,0)),(0,s.fN)(_,l),F)v=0;else{o.t8(f,t[y+1],i[y+1]),(0,s.uI)(d,m[0],m[1],f[0],f[1]);const n=(0,r.uZ)(o.AK(l,d),-1,1);if(n<=0)v=0,b(e,m[0],m[1],null!==(T=null==a?void 0:a[y])&&void 0!==T?T:0,null!==(E=null==g?void 0:g[y])&&void 0!==E?E:0,l[0],l[1],u[0],u[1],S);else{const e=Math.sqrt((1-n)/(1+n)),t=(0,r.Xx)(o.AK(_,d));v=e*t}}!function(e,t,i,n,o,r,s){const a=e.indices.buffer,l=e.indices.offset,d=e.elements.offset;a[l]=d+t,a[l+1]=d+i,a[l+2]=d+n,a[l+3]=d+o,a[l+4]=d+r,a[l+5]=d+s,e.indices.offset=l+6}(e,0,1,3,3,1,2);const B=_[0]*n.Gt,D=_[1]*n.Gt;x(e,h[0],h[1],null!==(P=null==a?void 0:a[y-1])&&void 0!==P?P:0,null!==(A=null==g?void 0:g[y-1])&&void 0!==A?A:0,(_[0]+l[0]*p)*n.Gt,(_[1]+l[1]*p)*n.Gt,B,D,c[0],c[1],S),x(e,h[0],h[1],null!==(L=null==a?void 0:a[y-1])&&void 0!==L?L:0,null!==(C=null==g?void 0:g[y-1])&&void 0!==C?C:0,(-_[0]-l[0]*p)*n.Gt,(-_[1]-l[1]*p)*n.Gt,-B,-D,c[0],c[1],S),x(e,m[0],m[1],null!==(z=null==a?void 0:a[y])&&void 0!==z?z:0,null!==(k=null==g?void 0:g[y])&&void 0!==k?k:0,(-_[0]+l[0]*v)*n.Gt,(-_[1]+l[1]*v)*n.Gt,-B,-D,u[0],u[1],S),x(e,m[0],m[1],null!==(O=null==a?void 0:a[y])&&void 0!==O?O:0,null!==(R=null==g?void 0:g[y])&&void 0!==R?R:0,(_[0]-l[0]*v)*n.Gt,(_[1]-l[1]*v)*n.Gt,B,D,u[0],u[1],S),F||(o.JG(l,d),p=v)}function b(e,t,i,n,o,r,s,a,l,d){!function(e,t,i,n){const o=e.indices.buffer,r=e.indices.offset,s=e.elements.offset;o[r]=s+t,o[r+1]=s+i,o[r+2]=s+n,e.indices.offset=r+3}(e,0,1,2);const c=.01*-r,u=.01*-s;x(e,t,i,n,o,r+c,s+u,r,s,a,l,d),x(e,t,i,n,o,-s+c,r+u,-s,r,a,l,d),x(e,t,i,n,o,s+c,-r+u,s,-r,a,l,d)}function x(e,t,i,o,r,s,a,l,d,c,u,h){const m=e.elements.offset*e.elements.stride,f=m>>1,_=m>>2;e.views.position[f]=n.jO+t,e.views.position[f+1]=n.jO+i,e.views.extender[m]=127*s,e.views.extender[m+1]=127*a,e.views.normal[m]=127*l,e.views.normal[m+1]=127*d,"height"in e.views&&(e.views.height[_]=o),"absZ"in e.views&&(e.views.absZ[_]=r),"shift"in e.views&&(e.views.shift[_]=c,e.views.shift[_+1]=u),"localID"in e.views&&(e.views.localID[_]=h),e.elements.offset++}},3376:(e,t,i)=>{"use strict";i.d(t,{AN:()=>m,nm:()=>f});var n=i(6490),o=i(7464),r=i(2543),s=i(314),a=i(309),l=i(9981),d=i(5549),c=i(9073),u=i(6392),h=i(1393);function m(e,t,i,n,c){const u=(0,l.fL)(c);(0,r.EG)(n.textureImage).forEach((r=>{if(!r.length)return;const l=i.byKey[(0,o.FD)(r)];if(!l)return void console.error(`Not found raster set with texture ${r}`);const c=function(e){if((0,o.Uu)(e))return"step"===e.type?e.steps.map((e=>Array.isArray(e.value)||"number"==typeof e.value?e.value:"literalArray"===e.value.type?e.value.array:(console.warn("textureSize only supports shallow step expression"),[0]))):"literalArray"===e.type?[(0,o.pV)(e)]:((0,a.cM)(`Unsupported texture size expression of type "${e.type}". Can't resovle.`),[0]);return[e]}(n.textureSize),h=n.lengthUnits===s.vR.Meters;c.forEach((i=>{let[n,o]=Array.isArray(i)?i:[i,i];h&&(n*=(0,d.N5)(n,n),o*=(0,d.N5)(o,o)),l.isSvg?e.atlasPacker.packSvg(l,[{w:n,h:o}],u):e.atlasPacker.packPng(l,[{w:n,h:o}],u),l.rasters.forEach((i=>e.atlasPacker.addRastersToLoad(t,i)))}))}))}function f(e,t){var i,o,r,s,a;const{tileAttrs:l,tileProps:d}=e,m=Number.isNaN(l[d.db_begin_nominal_height])?0:null!==(i=l[d.db_begin_nominal_height])&&void 0!==i?i:0,f=Number.isNaN(l[d.db_end_nominal_height])?0:null!==(o=l[d.db_end_nominal_height])&&void 0!==o?o:0,_=null!==(r=l[d.objectLength])&&void 0!==r?r:1,p=null!==(s=l[d.componentDistanceStart])&&void 0!==s?s:0,v=null!==(a=l[d.componentDistanceEnd])&&void 0!==a?a:0,g=(0,n.t7)(m,f,p/_),y=(0,n.t7)(m,f,v/_),b=e.tileInfo?(0,u.iq)(e.tileInfo,[0,0]):1,x=Array.from({length:t.x.length});if(g===y)return x.fill(g*c.C*b),x;const w=t.x.length;for(let e=0;e<w;e++)x[e]=c.C*b*(0,n.t7)(g,y,(0,h.lG)([t.x[0],t.y[0]],[t.x[w-1],t.y[w-1]],[t.x[e],t.y[e]]));return x}},8308:(e,t,i)=>{"use strict";i.d(t,{C:()=>d,b:()=>c});var n=i(143),o=i(9090),r=i(6392),s=i(6273);const a=[.5,.5],l=[.5,.5];function d(e,t,i,r,s,a){let d=e.elements.offset;const c=(0,n.X)(t-1,t);let u=i[c],p=r[c],v=s?s[c]:0;const g=d;for(let c=0;c<t;c++){const b=(0,n.X)(c,t),x=c===t-1,w=i[b],S=r[b],M=s?s[b]:x?0:1;0!==v&&((0,o.uI)(l,u,p,w,S),y(e,d,M,x?g:d+4),m(e,d,u,p,w,S),a?h(e,d,a[0],a[1],a[0],a[1]):h(e,d,u,p,w,S),(0,o.af)(l),f(e,d,l),_(e,d,l),d+=4),u=w,p=S,v=M}e.elements.offset=d}function c(e,t,i,r,s,d,c){let h=e.elements.offset;const m=(0,n.X)(t-2,t),f=(0,n.X)(t-1,t);let _=i[f],b=r[f],x=s?s[m]:1,w=s?s[f]:0;(0,o.AE)(a,i[m],r[m],_,b);let S=a[0],M=a[1];for(let m=0;m<t;m++){const f=(0,n.X)(m,t),I=m===t-1,T=i[f],E=r[f],P=s?s[f]:I?0:1;(0,o.uI)(l,_,b,T,E);const A=l[1],L=-l[0];0!==x&&(0===w?(a[0]=S,a[1]=M):u(a,S,M,A,L),(0,o.m2)(l,S,M,a[0],a[1]),y(e,h,0,0),p(e,h,_,b,d,null!=c?c:[_,b]),v(e,h,(0,o.af)(a),(0,o.af)(l)),g(e,h),h+=4),_=T,b=E,x=w,w=P,S=A,M=L}e.elements.offset=h}function u(e,t,i,n,o){let r,s,a;t*n+i*o>0?(r=t+n,s=i+o,a=1/Math.sqrt(r*r+s*s),e[0]=r*a,e[1]=s*a):(r=o-i,s=t-n,0!==r&&0!==s?(a=1/Math.sqrt(r*r+s*s),e[0]=r*a,e[1]=s*a):(e[0]=0,e[1]=0))}function h(e,t,i,n,o,r){const a=e.views.demPosition,l=e.elements.stride/a.BYTES_PER_ELEMENT;t*=l,i=(i+s.jO)/8,n=(n+s.jO)/8,o=(o+s.jO)/8,r=(r+s.jO)/8,a[t]=i,a[t+1]=n,a[t+=l]=i,a[t+1]=n,a[t+=l]=o,a[t+1]=r,a[t+=l]=o,a[t+1]=r}function m(e,t,i,n,o,r){const{position:a,distance:l,height:d}=e.views,c=e.elements.stride/a.BYTES_PER_ELEMENT;a[t*=c]=s.jO+i,a[t+1]=s.jO+n,d[t>>1]=0,l[t]=0,a[t+=c]=s.jO+i,a[t+1]=s.jO+n,d[t>>1]=0,l[t]=-32767,a[t+=c]=s.jO+o,a[t+1]=s.jO+r,d[t>>1]=0,l[t]=-32767,a[t+=c]=s.jO+o,a[t+1]=s.jO+r,d[t>>1]=0,l[t]=0}function f(e,t,i){const n=e.elements.stride/e.views.normals.BYTES_PER_ELEMENT;t*=n;for(let o=0;o<4;o++)e.views.normals[t]=i[0],e.views.normals[t+1]=i[1],e.views.normals[t+2]=0,e.views.normals[t+3]=0,t+=n}function _(e,t,i){const n=e.elements.stride/e.views.direction.BYTES_PER_ELEMENT;t*=n;for(let o=0;o<4;o++)e.views.direction[t]=i[0],e.views.direction[t+1]=i[1],e.views.direction[t+2]=0,e.views.direction[t+3]=0,t+=n}function p(e,t,i,n,o,a){const l=e.elements.stride/e.views.position.BYTES_PER_ELEMENT;t*=l,e.views.position[t]=s.jO+i,e.views.position[t+1]=s.jO+n,e.views.height[t>>1]=0,e.views.distance[t]=32767,e.views.demPosition[t]=(s.jO+a[0])/8,e.views.demPosition[t+1]=(s.jO+a[1])/8,t+=l,e.views.position[t]=s.jO+i,e.views.position[t+1]=s.jO+n,e.views.height[t>>1]=0,e.views.distance[t]=-32767,e.views.demPosition[t]=(s.jO+a[0])/8,e.views.demPosition[t+1]=(s.jO+a[1])/8,t+=l,e.views.position[t]=s.jO+i,e.views.position[t+1]=s.jO+n,e.views.height[t>>1]=(0,r.VW)(o)/s._H,e.views.distance[t]=-32767,e.views.demPosition[t]=(s.jO+a[0])/8,e.views.demPosition[t+1]=(s.jO+a[1])/8,t+=l,e.views.position[t]=s.jO+i,e.views.position[t+1]=s.jO+n,e.views.height[t>>1]=(0,r.VW)(o)/s._H,e.views.distance[t]=32767,e.views.demPosition[t]=(s.jO+a[0])/8,e.views.demPosition[t+1]=(s.jO+a[1])/8}function v(e,t,i,n){const o=e.elements.stride/e.views.normals.BYTES_PER_ELEMENT;t*=o;for(let r=0;r<4;r++)e.views.normals[t]=i[0],e.views.normals[t+1]=i[1],e.views.normals[t+2]=n[0],e.views.normals[t+3]=n[1],t+=o}function g(e,t){const i=e.elements.stride/e.views.direction.BYTES_PER_ELEMENT;t*=i;for(let n=0;n<4;n++)e.views.direction[t]=0,e.views.direction[t+2]=127,t+=i}function y(e,t,i,n){const o=e.indices.buffer;let r=e.indices.offset;o[r++]=t,o[r++]=t+1,o[r++]=t+3,o[r++]=t+3,o[r++]=t+1,o[r++]=t+2,0!==i&&(o[r++]=t+2,o[r++]=n+1,o[r++]=n+0),e.indices.offset=r}},1558:(e,t,i)=>{"use strict";i.d(t,{y:()=>s});var n=i(6392),o=i(143),r=i(6273);function s(e,t,i,n,r,s,u,h,m){let f=e.elements.offset;for(let _=0;_<t;_++){const p=(0,o.X)(_,t),v=_===t-1;if(r&&1===r[p]||!r&&!v){const r=i[p],v=n[p],g=(_+1)%t,y=(0,o.X)(g,t),b=i[y],x=n[y];c(e,f),a(e,f,r,v,b,x,s),m?l(e,f,m[0],m[1],m[0],m[1]):l(e,f,r,v,b,x),void 0!==u&&"localID"in e.views&&void 0!==e.views.localID&&d(e.views.localID,f,u,e.elements.stride),void 0!==h&&"labelingTextureID"in e.views&&void 0!==e.views.labelingTextureID&&d(e.views.labelingTextureID,f,h,e.elements.stride),f+=4}}e.elements.offset=f}function a(e,t,i,o,s,a,l){const d=e.views.position,c=e.views.height,u=e.elements.stride/d.BYTES_PER_ELEMENT;d[t*=u]=r.jO+i,d[t+1]=r.jO+o,c[t>>1]=0,d[t+=u]=r.jO+i,d[t+1]=r.jO+o,c[t>>1]=(0,n.VW)(l)/r._H,d[t+=u]=r.jO+s,d[t+1]=r.jO+a,c[t>>1]=0,d[t+=u]=r.jO+s,d[t+1]=r.jO+a,c[t>>1]=(0,n.VW)(l)/r._H}function l(e,t,i,n,o,s){const a=e.views.demPosition,l=e.elements.stride/a.BYTES_PER_ELEMENT;t*=l,i=(i+r.jO)/8,n=(n+r.jO)/8,o=(o+r.jO)/8,s=(s+r.jO)/8,a[t]=i,a[t+1]=n,a[t+=l]=i,a[t+1]=n,a[t+=l]=o,a[t+1]=s,a[t+=l]=o,a[t+1]=s}function d(e,t,i,n){const o=n/e.BYTES_PER_ELEMENT;e[t*=o]=i,e[t+=o]=i,e[t+=o]=i,e[t+=o]=i}function c(e,t){const i=e.indices.buffer;let n=e.indices.offset;i[n++]=t,i[n++]=t+3,i[n++]=t+1,i[n++]=t,i[n++]=t+2,i[n++]=t+3,e.indices.offset=n}},1436:(e,t,i)=>{"use strict";i.d(t,{jh:()=>re,PA:()=>he,XI:()=>ae,kF:()=>le,Pn:()=>fe,SV:()=>me,Eu:()=>ue,vP:()=>ce});var n=i(8009),o=i(5600),r=i(6563),s=i(2702),a=i(159),l=i(2543);const d=(0,o.D)({symbol:"shiftedLine",sinks:{solid:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int8Array(t,4),e.views.normal=new Int8Array(t,6),e.views.shift=new Float32Array(t,8)},packObjectAttributes:(e,t,i,n)=>(0,s.v)([e,t.innerId,i],t,n),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tiers:e[2],tileData:e.slice(3)})}},generate(e,t,i,n,o){const{tileAttrs:s,tileProps:c}=n,u=!Number.isNaN(s[c.beginningIsCut])&&0!==s[c.beginningIsCut],h=!Number.isNaN(s[c.endingIsCut])&&0!==s[c.endingIsCut],m=(0,l.FR)(i.ignoreTier,n)?null:n.tileAttrs[c.db_tiers],f=e.getBucket(i.type,"solid",d.sinks.solid.packObjectAttributes(t,i,m,n),d.sinks.solid.binder);(0,r.e)(f,o.x,o.y,void 0,void 0,o.x.length,u?a.kU.TileCut:a.kU.Round,h?a.kU.TileCut:a.kU.Round,0,o.normal_x,o.normal_y)}});var c=i(5970),u=i(3097),h=i(1678),m=i(4389),f=i(871),_=i(6195),p=i(6263),v=i(2097),g=i(6392),y=i(9073),b=i(4999),x=i(9218),w=i(6490),S=i(6273),M=i(7293);const I=[0,0,0],T=[0,0],E=(0,o.D)({symbol:"labelLine",sinks:{raster:{stride:28,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.texCoords=new Uint16Array(t,8),e.views.cornerOffset=new Float32Array(t,12),e.views.styleZoomLimits=new Float32Array(t,20)},packObjectAttributes:(e,t,i,n,o,r)=>(0,s.L)([e.styleId,e.layer.innerId,t,i,n,o],r),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],animDirection:e[2],range:e[3],fontIndex:e[4],tiers:e[5],tileData:e.slice(6)})}},processElement(e,t,i,n,o,r,s){var a;const{label:d,anchorPosition:c,anchorSegmentIndex:u,halfLabelWidth:h,layer:m}=i;if("labelLine"!==m.type)return;const{axis:f}=d,{center:_,styleZoom:p}=r,v=(0,l.bs)(p,r.styleState,!1,d.tileData),P=(0,l.Q9)(m.style.textFont,v),A=null!==(a=e.fontNameToIndex[P])&&void 0!==a?a:e.fontNameToIndex[S.Uo],L={},C=(0,l.FR)(m.ignoreTier,v)?null:d.tiers;for(const e of d.ranges)L[e]=t.getBucket("labelLine","raster",E.sinks.raster.packObjectAttributes(d,n,e,A,null!=C?C:null,(0,M.u)(d.tileData,m)),E.sinks.raster.binder);const z=d.textMetrics.lines[0],k=(0,l.vn)(m.style.textFontSize,v)/x.fonts.baseSize,O=z.glyphs,R=function(e,t,i,n){const o=e.interpolate(t-i,e.getSegmentIndex(t-i)),r=e.interpolate(t+i,e.getSegmentIndex(t+i)),s=Math.atan2(r[1]-o[1],r[0]-o[0])-n;return Math.cos(s)<0}(f,c,h,r.rotation);T[0]=-z.width/2,T[1]=0;for(let e=0;e<O.length;e++){const t=O[e],n=(T[0]+t.left+t.width/2)*k*(R?-1:1),o=(0,w.Xx)(n)||1;let r=-1/0,a=1/0;for(let e=u;e>=1&&e<f.vertexCount&&!(a<i.overflowStyleZoom);e+=o,a=r){const l=1===o?e:e-1;r=(0,y.X$)((0,y.to)(n,f.lengths[l]-c),_);const d=f.interpolate(c,e);(0,g.a2)(I,d,s),(0,g.hm)(I)&&void 0!==t.bitmap&&(0,b.Uu)(L[t.range],I,T,t,d[3]+(R?Math.PI:0),Math.max(r,i.overflowStyleZoom),a)}T[0]+=t.advance+x.fonts.baseSize*m.style.textLetterSpacing}},getLabelingInfo(){}});const P=[0,0,0],A=(0,o.D)({symbol:"oneWayLine",sinks:{raster:{stride:12,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.direction=new Int8Array(t,8),e.views.widenDirection=new Int8Array(t,10)},packObjectAttributes:(e,t,i)=>(0,s.L)([e.styleId,e.layer.innerId,t,i],e.tileData),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],animDirection:e[2],tiers:e[3],tileData:e.slice(4)})}},processElement(e,t,i,n,o,r,s){var a;const{label:l,anchorWorld:d}=i;if((0,g.a2)(P,d,s),!(0,g.hm)(P))return;const c=t.getBucket("oneWayLine","raster",A.sinks.raster.packObjectAttributes(l,n,null!==(a=l.tiers)&&void 0!==a?a:null),A.sinks.raster.binder);(0,b.k8)(c,P,d[3])},getLabelingInfo(){}});var L=i(7840),C=i(749),z=i(4922),k=i(4333),O=i(6201);const R=(e,t,i,n,o,r,s)=>{var a;const d={type:O.R2.Line,styleId:t,layerId:i.innerId,sourceId:o,tileCoords:n,id:null!==(a=r.id)&&void 0!==a?a:"",floorId:r.tileAttrs[r.tileProps.db_plan_id]||"",planLevel:r.tileAttrs[r.tileProps.db_plan_level]||NaN,componentDistanceStart:(0,O.hs)(r.tileAttrs[r.tileProps.componentDistanceStart],0),componentDistanceEnd:(0,O.hs)(r.tileAttrs[r.tileProps.componentDistanceEnd],0),objectLength:(0,O.hs)(r.tileAttrs[r.tileProps.objectLength],0),labelPriority:(0,O.hs)(r.tileAttrs[r.tileProps.db_label_priority],0),styleIconPriority:(0,l.vn)(i.style.textPriority,r),styleTextPriority:(0,l.vn)(i.style.textPriority,r),vertices:[s.x,s.y],tileData:[...r.tileData],tiers:(0,l.FR)(i.ignoreTier,r)?void 0:r.tileAttrs[r.tileProps.db_tiers]};e.addLabel(d)},F=(e,t,i,n,o,r,s)=>{var a;const{tileProps:d,tileAttrs:c}=r,u=(0,l.FR)(i.ignoreTier,r)?null:c[d.db_tiers],h={type:O.R2.OneWayLine,styleId:t,layerId:i.innerId,sourceId:o,tileCoords:n,id:null!==(a=r.id)&&void 0!==a?a:"",floorId:r.tileAttrs[r.tileProps.db_plan_id]||"",planLevel:r.tileAttrs[r.tileProps.db_plan_level]||NaN,componentDistanceStart:(0,O.hs)(r.tileAttrs[r.tileProps.componentDistanceStart],0),componentDistanceEnd:(0,O.hs)(r.tileAttrs[r.tileProps.componentDistanceEnd],0),objectLength:(0,O.hs)(r.tileAttrs[r.tileProps.objectLength],0),labelPriority:(0,O.hs)(r.tileAttrs[r.tileProps.db_label_priority],0),styleIconPriority:(0,l.vn)(i.style.priority,r),styleTextPriority:0,vertices:[s.x,s.y],tileData:[...r.tileData],tiers:u};e.addLabel(h)};var B=i(7407),D=i(8965),j=i(1573),N=i(3642),U=i(3698),H=i(9981),G=i(7464),V=i(5549);const Z=(0,o.D)({symbol:"metricPoint",sinks:{fill:{stride:8,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.texCoords=new Uint16Array(t,4)},packObjectAttributes:function(e,t,i,n){return(0,s.v)([e,t.innerId,i],t,n)},unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tiers:e[2],tileData:e.slice(3)})}},generate(e,t,i,n,o,r,s){!function(e,t,i,n,o){const{rasterSets:r}=t,s=(0,H.fL)(n);(0,l.EG)(i.style.iconImage).forEach((n=>{if(!n.length)return;const a=r.byKey[(0,G.FD)(n)];if(!a)return void console.error(`Not found raster set with texture ${n}`);if(!a.isSvg)return;const d=(0,l.vn)(i.style.width,o),c=(0,l.vn)(i.style.height,o),u=(0,V.N5)(d,c),h=d*u,m=c*u;e.atlasPacker.packSvg(a,[{w:h,h:m}],s),a.rasters.forEach((i=>e.atlasPacker.addRastersToLoad(t.id,i)))}))}(e,n,o,i,r);const a=(0,l.vn)(o.style.width,r),d=(0,l.vn)(o.style.height,r),c=(0,l.vn)(o.style.rotation,r),[u,h]=(0,V.DR)([t.x,t.y],a,d,c,s),m=(0,l.FR)(o.ignoreTier,r)?null:r.tileAttrs[r.tileProps.db_tiers],f=e.getBucket("metricPoint","fill",Z.sinks.fill.packObjectAttributes(n.id,o,m,r),Z.sinks.fill.binder);let _=f.elements.offset;!function(e,t,i,n,o,r,s,a){const l=e.buffer,d=e.offset;l[d]=t+i,l[d+1]=t+n,l[d+2]=t+o,l[d+3]=t+r,l[d+4]=t+s,l[d+5]=t+a,e.offset=d+6}(f.indices,_,0,1,2,0,2,3),W(f,_++,u[0],h[0],0,0),W(f,_++,u[1],h[1],1,0),W(f,_++,u[2],h[2],1,1),W(f,_++,u[3],h[3],0,1),f.elements.offset=_}});function W(e,t,i,n,o,r){t*=4,e.views.position[t]=S.jO+i,e.views.position[t+1]=S.jO+n,e.views.texCoords[t]=(0,U.Bb)(o),e.views.texCoords[t+1]=(0,U.Bb)(r)}var X=i(378),K=i(9450),$=i(127),q=i(3672),Y=i(9090);const J=[0,0,0],Q=[0,0,0],ee=new Float64Array(16),te=(0,o.D)({symbol:"tunnel",sinks:{},generate(e,t,i,n,o,r,s,a){var l,d,c;const{tileProps:u,tileAttrs:h}=n,m=null===(l=h[u.db_tiers])||void 0===l?void 0:l[0];if("70030076221371399"!==(0,q.Ak)(h[u.id]))return;if(!m)return;const f=t.id;X.t8(J,0,0);const _=(0,g.iq)(r,J)*y.C,p=S.Bq/r.size*_,v=1/(S.Bq/r.size),b=h[u.objectLength],x=null!==(d=h[u.componentDistanceStart])&&void 0!==d?d:0,M=null!==(c=h[u.componentDistanceEnd])&&void 0!==c?c:0,I=0===x?0:-5,T=M===b?0:-5;if(Number.isNaN(b)||Number.isNaN(x)||0===b)return void 0;const E=175+68*x/b,P=175+68*M/b,A=3.5*p,L=5*p,C=[];let z=0;for(let e=0;e<o.x.length;e++){const t=[o.x[e],o.y[e],0];e>0&&(z+=X.TK(t,C[e-1]),t[2]=z),C.push(t)}const k=function(e){let t=0;for(let i=0;i<e.length-1;i++)t+=X.TE(e[i],e[i+1]);return t}(C),O=(0,j.tS)(C);C.forEach((e=>{const t=e[2]/k;e[2]=(I+t*(T-I))*_,e[5]=(E+t*(P-E))*_}));const R=D.j.sinks.stroke.packObjectAttributes(f,i,D.z.side,!0,n),F=(0,j.$V)(C,O,A),B=(0,j.$V)(C,O,-A),U=(0,j.kF)(F,B),H=(0,j.$V)(C,O,L),G=H.map((e=>{const t=e.slice();return t[2]=Math.max(0,t[2]),t}));D.j.generate(e,f,i,D.z.side,n,(0,j.In)((0,j.kF)(H,G)),r,s,a,void 0,"inverse");const V=(0,j.$V)(C,O,-L),Z=V.map((e=>{const t=e.slice();return t[2]=Math.max(0,t[2]),t}));D.j.generate(e,f,i,D.z.side,n,(0,j.In)((0,j.kF)(Z,V)),r,s,a,void 0,"inverse"),0!==C[0][2]&&0!==C[C.length-1][2]&&D.j.generate(e,f,i,D.z.side,n,(0,j.In)((0,j.kF)(G,Z)),r,s,a,void 0,"inverse");do{N._.generate(e,f,i,n,(0,j.In)(U),m,r,void 0)}while(e.isOverloaded());for(let t=1;t<C.length;t++){const o=[],l=[],d=C[t-1],c=C[t],u=O[t-1],h=O[t];for(let e=0;e<=181;e+=15){const t=(0,w.Id)(e),i=d.slice();K.t8(J,u[0],u[1],0),K.bA(J,J,A),(0,Y.fN)(Q,J),$.Us(ee,-t,Q),K.fF(J,J,ee),J[2]*=v,K.IH(i,i,J),o.push(i);const n=c.slice();K.t8(J,h[0],h[1],0),K.bA(J,J,A),(0,Y.fN)(Q,J),$.Us(ee,-t,Q),K.fF(J,J,ee),J[2]*=v,K.IH(n,n,J),l.push(n)}const m=(0,j.kF)(o,l);if(D.j.generate(e,f,i,D.z.side,n,(0,j.In)(m),r,s,a,void 0,"fill"),1===t&&0===C[0][2]){(0,j.m5)(e,R,o);const t=C[0].slice(),l=C[0].slice(),d=O[0].slice(),c=O[0].slice();X.bA(d,d,L),X.bA(c,c,-L),X.IH(t,t,d),X.IH(l,l,c);const u=t.slice(),h=l.slice();u[2]+=L*v,h[2]+=L*v;const m=[t];for(let e=0;e<5;e++)m.push(u);for(let e=0;e<5;e++)m.push(h);m.push(l),(0,j.m5)(e,R,m),D.j.generate(e,f,i,D.z.side,n,(0,j.In)((0,j.kF)(m,o)),r,s,a,void 0,"fill")}else if(t===C.length-1&&0===C[C.length-1][2]){(0,j.m5)(e,R,l);const t=C[C.length-1].slice(),o=C[C.length-1].slice(),d=O[C.length-1].slice(),c=O[C.length-1].slice();X.bA(d,d,L),X.bA(c,c,-L),X.IH(t,t,d),X.IH(o,o,c);const u=t.slice(),h=o.slice();u[2]+=L*v,h[2]+=L*v;const m=[t];for(let e=0;e<5;e++)m.push(u);for(let e=0;e<5;e++)m.push(h);m.push(o),(0,j.m5)(e,R,m),D.j.generate(e,f,i,D.z.side,n,(0,j.In)((0,j.kF)(l,m)),r,s,a,void 0,"fill")}}if(0===C[0][2]||0===C[C.length-1][2]){const t=(0,j.$V)(C,O,L),o=(0,j.$V)(C,O,-L),l=t.map((e=>{const t=e.slice();return t[2]=Math.max(0,t[2]+L*v),t})),d=o.map((e=>{const t=e.slice();return t[2]=Math.max(0,t[2]+L*v),t}));t.forEach((e=>{e[2]=Math.max(0,e[2])})),o.forEach((e=>{e[2]=Math.max(0,e[2])}));const c=(0,j.kF)(t,l),u=(0,j.kF)(d,o);(0,j.m5)(e,R,t),(0,j.m5)(e,R,o),(0,j.m5)(e,R,l),(0,j.m5)(e,R,d),D.j.generate(e,f,i,D.z.side,n,(0,j.In)(c),r,s,a,void 0,"fill"),D.j.generate(e,f,i,D.z.side,n,(0,j.In)(u),r,s,a,void 0,"fill");const h=(0,j.kF)(l,d);D.j.generate(e,f,i,D.z.top,n,(0,j.In)(h),r,s,a,void 0,"fill")}}});var ie=i(173),ne=i(3024);const oe=(0,o.D)({symbol:"simpleMesh",sinks:{fill:{stride:24,binder:()=>{},packObjectAttributes:(e,t,i)=>(0,s.v)([e,t.innerId],t,i),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})}}});var re,se=i(7965);function ae({collector:e,generator:t,args:i}){do{t(e,...i)}while(e.isOverloaded())}!function(e){e[e.none=0]="none",e[e.fadeIn=1]="fadeIn",e[e.fadeOut=-1]="fadeOut"}(re||(re={}));const le={arrow:m.l,line:n.z,polygon:v.a,embankment:D.j,polygon3d:D.j,metricPoint:Z,labelLine:E,lineExtrusion:_.Q,polygonExtrusion:c.p,oneWayLine:A,dashedLine:u.L,shiftedLine:d,circle:f.p,buildingModel:h.X,gltfModel:B.m,point:L.uF,raster:p.h,heatmap:C.B,dem:z._,mesh:D.j,mapMesh:N._,overpass:j.tw,tunnel:te,simpleMesh:oe,globe:se.D},de={labelLine:E,oneWayLine:A,point:L.uF};function ce(e,t){const i=le[e];return i?i.sinks[t].stride:0}function ue(e,t){e.precomputes.forEach(((e,i)=>{t.tileData[i]=(0,l.FR)(e.expr,t)}))}function he(e,t,i,o,r,s,a,h,f,p,g,y,b,w){const S=o.styleState.graphicsPreset&&t.graphicsPresets[o.styleState.graphicsPreset]||{};i.forEach((i=>{if((0,ie.b8)(o,[g.x[0],g.y[0]]),(void 0===a||!(i.maxzoom<=a||i.minzoom>=a+1&&a!==x.tiles.maxDetailLevel))&&(!o.tileProps.hovered||Number.isNaN(o.tileAttrs[o.tileProps.hovered])||1!==o.tileAttrs[o.tileProps.hovered]||"polygon"===i.type||"polygonExtrusion"===i.type||"point"===i.type||"polygon3d"===i.type)){ue(i,o);do{switch(i.type){case"line":const a=(0,l.FR)(i.style.pattern,o);a&&a[0]!==ne.y.None?n.z.generatePatterned(e,t.id,i,o,f,g):n.z.generate(e,t.id,i,o,f,g);break;case"dashedLine":u.L.generate(e,t.id,i,o,f,g);break;case"shiftedLine":d.generate(e,t.id,i,o,g);break;case"polygon":v.a.generate(e,t.id,i,o,g,p,t.rasterSets);break;case"polygon3d":case"embankment":D.j.generate(e,t.id,i,D.z.top,o,g,f,p,t.rasterSets,void 0,"fill");break;case"metricPoint":Z.generate(e,g,p,t,i,o,f);break;case"polygonExtrusion":c.p.generate(e,t.id,i,o,g,S);break;case"labelLine":R(e,t.id,i,f.coords,h,o,g);break;case"oneWayLine":F(e,t.id,i,f.coords,h,o,g);break;case"point":(0,k.p)(e,t,i,o,r,s,f.coords,h,g,p,y);break;case"lineExtrusion":_.Q.generate(e,t.id,i,o,g,S);break;case"arrow":m.l.generate(e,t.id,i,o,g);break;case"heatmap":C.B.generate(e,t.id,i,g,o);break;case"gltfModel":B.m.generateInstances(e,t,i,o,g,f,h,b,w,r,2);break;case"overpass":j.tw.generate(e,t,i,o,g,f,p,t.rasterSets);break;case"tunnel":te.generate(e,t,i,o,g,f,p,t.rasterSets)}}while(e.isOverloaded())}}))}function me(e,t,i,n,o,r,s,a){const l=de[t.type];if(l)do{l.processElement(e,i,n,o,r,s,a)}while(i.isOverloaded())}function fe(e,t,i,n,o,r,s){const a=de[n.type];a&&a.getLabelingInfo(e,t,i,o,r,s)}},8009:(e,t,i)=>{"use strict";i.d(t,{z:()=>h});var n=i(5600),o=i(6563),r=i(2702),s=i(6659),a=i(2543),l=i(159),d=i(6273),c=i(8352),u=i(3376);const h=(0,n.D)({symbol:"line",sinks:{solid:{stride:12,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int8Array(t,4),e.views.normal=new Int8Array(t,6),e.views.localID=new Uint32Array(t,8)},packObjectAttributes:(e,t,i,n,o)=>(0,r.v)([e,t.innerId,i,n],t,o),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tiers:e[2],hiddenByFloorComplexId:e[3],tileData:e.slice(4)})},solid3d:{stride:20,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int8Array(t,4),e.views.normal=new Int8Array(t,6),e.views.height=new Float32Array(t,8),e.views.absZ=new Float32Array(t,12),e.views.localID=new Uint32Array(t,16)},packObjectAttributes:(e,t,i,n)=>(0,r.v)([e,t.innerId,i],t,n),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],absZ:e[2],tileData:e.slice(3)})},patterned:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int16Array(t,4),e.views.texture=new Float32Array(t,8),e.views.localID=new Uint32Array(t,12)},packObjectAttributes:(e,t,i,n,o)=>(0,r.v)([e,t.innerId,i,n],t,o),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tiers:e[2],hiddenByFloorComplexId:e[3],tileData:e.slice(3)})},patterned3d:{stride:20,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.extender=new Int16Array(t,4),e.views.texture=new Float32Array(t,8),e.views.height=new Float32Array(t,12),e.views.localID=new Uint32Array(t,16)},packObjectAttributes:(e,t,i)=>(0,r.v)([e,t.innerId],t,i),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tileData:e.slice(2)})}},generate(e,t,i,n,r,d){var c;const m=(0,s.I)((0,a.FR)(i.style.geometryModifier,n),r,d,n);if(null===m)return;const{tileAttrs:f,tileProps:p}=n,v=i.style.withHeight?null!==(c=m.z)&&void 0!==c?c:(0,u.nm)(n,m):void 0,g=e.idIndexer.getIndex(n,t,i),y=(0,a.FR)(i.ignoreTier,n)?null:n.tileAttrs[p.db_tiers],b=f[p.db_hidden_by_metro_building_id]||"",x=i.style.withHeight?e.getBucket(i.type,"solid3d",h.sinks.solid3d.packObjectAttributes(t,i,!!m.abs_z,n),h.sinks.solid3d.binder):e.getBucket(i.type,"solid",h.sinks.solid.packObjectAttributes(t,i,y,b,n),h.sinks.solid.binder),w=!Number.isNaN(f[p.beginningIsCut])&&0!==f[p.beginningIsCut],S=!Number.isNaN(f[p.endingIsCut])&&0!==f[p.endingIsCut],M=(0,a.Q9)(i.style.startCap,n),I=(0,a.Q9)(i.style.endCap,n);(0,o.e)(x,m.x,m.y,v,m.abs_z,m.x.length,w?l.kU.TileCut:_(M),S?l.kU.TileCut:_(I),g)},generatePatterned(e,t,i,n,o,r){var m;const p=(0,s.I)((0,a.FR)(i.style.geometryModifier,n),o,r,n);if(null===p)return;const{tileAttrs:v,tileProps:g}=n,y=(0,a.FR)(i.ignoreTier,n)?null:n.tileAttrs[g.db_tiers],b=null!==(m=v[g.db_hidden_by_metro_building_id])&&void 0!==m?m:"",x=i.style.withHeight?e.getBucket("line","patterned3d",h.sinks.patterned3d.packObjectAttributes(t,i,n),h.sinks.patterned3d.binder):e.getBucket("line","patterned",h.sinks.patterned.packObjectAttributes(t,i,y,b,n),h.sinks.patterned.binder),w=e.idIndexer.getIndex(n,t,i),S=f(v[g.componentDistanceStart]/d.Bq,v[g.componentDistanceEnd]/d.Bq,v[g.objectLength]/d.Bq,w,i.style.withHeight?h.sinks.patterned3d.stride/2:h.sinks.patterned.stride/2),M=!Number.isNaN(v[g.beginningIsCut])&&0!==v[g.beginningIsCut],I=!Number.isNaN(v[g.endingIsCut])&&0!==v[g.endingIsCut],T=(0,a.Q9)(i.style.startCap,n),E=(0,a.Q9)(i.style.endCap,n),P=i.style.withHeight?(0,u.nm)(n,p):void 0;(0,c.W)(p.x,p.y,P,p.x.length,M?l.kU.TileCut:_(T),I?l.kU.TileCut:_(E),v[g.previousPointX],v[g.previousPointY],v[g.nextPointX],v[g.nextPointY],S,x,!0)}}),m={type:l.SP.Patterned,cDist:0,sLen:0,oLen:0,localID:0,offsetMultiplier:8,px:[],py:[],count:0};function f(e,t,i,n,o){return m.cDist=e,m.sLen=t-e,m.oLen=i,m.localID=n,m.offsetMultiplier=o,m}function _(e){switch(e){case"round":return l.kU.Round;case"tilecut":return l.kU.TileCut;default:return l.kU.Butt}}},6195:(e,t,i)=>{"use strict";i.d(t,{Q:()=>g});var n=i(5600),o=i(378),r=i(1558),s=i(2682),a=i(8308),l=i(2702),d=i(6392),c=i(8450);const u=o.Ue(),h=o.Ue(),m=o.Ue(),f=o.Ue(),_=(e,t,i,n)=>(0,l.v)([e,t.innerId,i],t,n),p=e=>({styleId:e[0],layerId:e[1],hiddenByFloorComplexId:e[2],tileData:e.slice(3)}),v=(0,d.d1)(1),g=(0,n.D)({symbol:"lineExtrusion",sinks:{fill:{stride:12,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.demPosition=new Int16Array(t,8)},packObjectAttributes:_,unpackObjectAttributes:p},topStroke:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.directionDistance=new Int8Array(t,8),e.views.demPosition=new Int16Array(t,12)},packObjectAttributes:_,unpackObjectAttributes:p},sideStroke:{stride:24,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.normals=new Int8Array(t,8),e.views.direction=new Int8Array(t,12),e.views.demPosition=new Int16Array(t,16),e.views.distance=new Int16Array(t,20)},packObjectAttributes:_,unpackObjectAttributes:p}},generate(e,t,i,n,l,d){const _=l.x,p=l.y,y=_.length,b=n.tileAttrs[n.tileProps.db_hidden_by_metro_building_id]||"",x=e.getBucket(i.type,"fill",g.sinks.fill.packObjectAttributes(t,i,b,n),g.sinks.fill.binder),w=e.getBucket(i.type,"topStroke",g.sinks.topStroke.packObjectAttributes(t,i,b,n),g.sinks.topStroke.binder),S=e.getBucket(i.type,"sideStroke",g.sinks.sideStroke.packObjectAttributes(t,i,b,n),g.sinks.sideStroke.binder),M=!d.AALinesOff||!(0,c.BL)(i,n);for(let e=0;e<y-1;e++){const t=_[e],i=p[e],n=_[e+1],l=p[e+1];o.t8(u,t,n),o.t8(h,i,l),o.t8(m,n,t),o.t8(f,l,i),(0,r.y)(x,2,u,h,void 0,v),(0,s.n)(w,t,i,v,n,l,v),M&&((0,a.C)(S,2,u,h,void 0),(0,a.C)(S,2,m,f,void 0),(0,a.b)(S,2,u,h,void 0,v))}M&&(o.t8(u,_[y-1],_[0]),o.t8(h,p[y-1],p[0]),(0,a.b)(S,2,u,h,void 0,v))}})},3642:(e,t,i)=>{"use strict";i.d(t,{_:()=>h});var n=i(9450),o=i(5600),r=i(2702),s=i(6273),a=i(9090);const l=[0,0,0],d=[0,0,0],c=[0,0,0],u=[0,0,0],h=(0,o.D)({symbol:"mapMesh",sinks:{fill:{stride:24,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.extender=new Int16Array(t,8),e.views.normal=new Int8Array(t,12),e.views.gradient=new Int8Array(t,15),e.views.demPosition=new Int16Array(t,16),e.views.absZ=new Float32Array(t,16),e.views.isPivot=new Uint8Array(t,20)},packObjectAttributes:(e,t,i,n,o)=>(0,r.v)([e,t.innerId,i,n],t,o),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],meshTier:e[2],absZ:e[3],tileData:e.slice(4)})}},generate(e,t,i,o,r,_,p,v){var g;const y=r.x,b=r.y,x=null!==(g=r.signed_z)&&void 0!==g?g:[],w=r.gradient,S=r.is_pivot,M=r.abs_z,I=y.length,T=null==v?void 0:v[0],E=null==v?void 0:v[1];if(I<3)return;const P=s.Bq/p.size,A=e.getBucket("mapMesh","fill",h.sinks.fill.packObjectAttributes(t,i,_,!!M,o),h.sinks.fill.binder),L=A.indices.buffer;let C=A.indices.offset;const z=A.elements.offset;for(let e=2;e<I;e++){const t=!(e%2),i=t?e-2:e-1,o=t?e-1:e-2;m(L,C,z,3*(e-2)+2),n.t8(c,y[i],b[i],x[i]*P),n.t8(d,y[o],b[o],x[o]*P),n.t8(l,y[e],b[e],x[e]*P),(0,a.Cb)(u,c,d,l),f(A,y[i],b[i],x[i],null==w?void 0:w[i],null==S?void 0:S[i],null==M?void 0:M[i],u,T,E),f(A,y[o],b[o],x[o],null==w?void 0:w[o],null==S?void 0:S[o],null==M?void 0:M[o],u,T,E),f(A,y[e],b[e],x[e],null==w?void 0:w[e],null==S?void 0:S[e],null==M?void 0:M[e],u,T,E),C+=3}A.indices.offset=C}});function m(e,t,i,n){e[t]=i+n-2,e[t+1]=i+n-1,e[t+2]=i+n}function f(e,t,i,n,o,r,l,d,c=t,u=i){const h=e.elements.offset*e.elements.stride,m=h/e.views.position.BYTES_PER_ELEMENT,f=h/e.views.normal.BYTES_PER_ELEMENT,_=h/e.views.demPosition.BYTES_PER_ELEMENT;e.views.position[m]=s.jO+t,e.views.position[m+1]=s.jO+i,e.views.height[h/e.views.height.BYTES_PER_ELEMENT]=n,e.views.normal[f]=(0,a.Tz)(d[0]),e.views.normal[f+1]=(0,a.Tz)(d[1]),e.views.normal[f+2]=(0,a.Tz)(d[2]),e.views.gradient[h/e.views.gradient.BYTES_PER_ELEMENT]=null!=o?o:0,e.views.isPivot[h/e.views.isPivot.BYTES_PER_ELEMENT]=null!=r?r:0,e.views.demPosition[_]=(s.jO+c)/8,e.views.demPosition[_+1]=(s.jO+u)/8,void 0!==l&&(e.views.absZ[h/e.views.absZ.BYTES_PER_ELEMENT]=l),e.elements.offset++}},8965:(e,t,i)=>{"use strict";i.d(t,{j:()=>w,z:()=>n});var n,o=i(9450),r=i(2702),s=i(5600),a=i(2618),l=i(6273),d=i(9090),c=i(3376),u=i(2543),h=i(9073),m=i(6392);!function(e){e[e.side=0]="side",e[e.top=1]="top",e[e.bottom=2]="bottom"}(n||(n={}));const f=[0,0,0],_=[0,0,0],p=[0,0,0],v=[0,0,0],g=(e,t,i,n,o)=>(0,r.v)([e,t.innerId,i,n],t,o),y=(e,t,i,n)=>(0,r.v)([e,t.innerId,i],t,n),b=e=>({styleId:e[0],layerId:e[1],side:e[2],absZ:e[3],tileData:e.slice(4)}),x=e=>({styleId:e[0],layerId:e[1],absZ:e[2],tileData:e.slice(3)}),w=(0,s.D)({symbol:"mesh",sinks:{fill:{stride:28,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.normal=new Int8Array(t,8),e.views.gradient=new Int8Array(t,11),e.views.localID=new Uint32Array(t,12),e.views.demPosition=new Int16Array(t,16),e.views.absZ=new Float32Array(t,16),e.views.isPivot=new Uint8Array(t,20),e.views.labelingTextureID=new Uint32Array(t,24)},packObjectAttributes:g,unpackObjectAttributes:b},inverse:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.demPosition=new Int16Array(t,8),e.views.absZ=new Float32Array(t,8),e.views.isPivot=new Uint8Array(t,12)},packObjectAttributes:y,unpackObjectAttributes:x},depthClear:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.demPosition=new Int16Array(t,8),e.views.absZ=new Float32Array(t,8),e.views.isPivot=new Uint8Array(t,12)},packObjectAttributes:y,unpackObjectAttributes:x},stroke:{stride:20,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.directionDistance=new Int8Array(t,8),e.views.demPosition=new Int16Array(t,12),e.views.absZ=new Float32Array(t,12),e.views.isPivot=new Uint8Array(t,16)},packObjectAttributes:g,unpackObjectAttributes:b}},generate(e,t,i,n,r,s,g,y,b,x,I="fill",T=!1){var E,P,A,L;const C=s.x,z=s.y,k=s.signed_z;let O=0;if("polygon3d"===i.type||"embankment"===i.type){const e=(0,u.FR)(i.style.elevation,r),t=r.tileInfo?(0,m.iq)(r.tileInfo,[0,0]):1;O=e*h.C*t}const R=s.gradient,F=s.abs_z,B=s.is_pivot,D=C.length,j=r.tileAttrs[r.tileProps.hovered],N=null!==(E=r.id)&&void 0!==E?E:"",U=e.pointIndexer.getIndex(N);let H,G=a.X4;switch(i.type){case"polygon3d":i.interactive?(G=j?a.gl:e.idIndexer.getIndex(r,t,i),j||G!==a.gl||(G=a.X4)):G=i.interactiveOcclusion?a.X4:a.gl;break;case"overpass":case"tunnel":G=e.idIndexer.getIndex(r,t,i),G===a.gl&&(G=a.X4);break;case"embankment":G=a.X4;break;default:{const{type:e}=i;0}}if("embankment"!==i.type&&"polygon3d"!==i.type||!b||(0,c.AN)(e,t,b,i.style,y),"inverse"===I)H=e.getBucket("mesh","inverse",w.sinks.inverse.packObjectAttributes(t,i,!!F,r),w.sinks.inverse.binder);else if("fill"===I)H=e.getBucket("mesh","fill",w.sinks.fill.packObjectAttributes(t,i,n,!!F,r),w.sinks.fill.binder);else{if("depthClear"!==I)return;H=e.getBucket("mesh","depthClear",w.sinks.depthClear.packObjectAttributes(t,i,!!F,r),w.sinks.depthClear.binder)}for(let e=0;e<D-2;e++){const t=!(e%2);M(H);const i=T?2:1,n=T?1:2,r=t?e+i:e+n,s=t?e+n:e+i,a=l.Bq/g.size;o.t8(f,C[e],z[e],(null!==(P=null==k?void 0:k[e])&&void 0!==P?P:0)*a),o.t8(_,C[r],z[r],(null!==(A=null==k?void 0:k[r])&&void 0!==A?A:0)*a),o.t8(p,C[s],z[s],(null!==(L=null==k?void 0:k[s])&&void 0!==L?L:0)*a),(0,d.Cb)(v,f,_,p),f[2]/=a,_[2]/=a,p[2]/=a,f[2]+=O,_[2]+=O,p[2]+=O;const c=H.elements.offset;S(H,f,v,null==R?void 0:R[e],G,U,x,null==F?void 0:F[e],null==B?void 0:B[e]),S(H,_,v,null==R?void 0:R[r],G,U,x,null==F?void 0:F[r],null==B?void 0:B[r]),S(H,p,v,null==R?void 0:R[s],G,U,x,null==F?void 0:F[s],null==B?void 0:B[s]),H.objectsData[c]={objectId:N,size:H.elements.offset-c}}}});function S(e,t,i,n,o,r,s,a,c){var u,h;const m=e.elements.stride*e.elements.offset,f=m/e.views.position.BYTES_PER_ELEMENT;e.views.position[f]=l.jO+t[0],e.views.position[f+1]=l.jO+t[1],e.views.height[m/e.views.height.BYTES_PER_ELEMENT]=t[2];const _=m/e.views.demPosition.BYTES_PER_ELEMENT;if(e.views.demPosition[_]=((null!==(u=null==s?void 0:s[0])&&void 0!==u?u:t[0])+l.jO)/8,e.views.demPosition[_+1]=((null!==(h=null==s?void 0:s[1])&&void 0!==h?h:t[1])+l.jO)/8,void 0!==a&&(e.views.absZ[m/e.views.absZ.BYTES_PER_ELEMENT]=a),e.views.isPivot[m/e.views.isPivot.BYTES_PER_ELEMENT]=null!=c?c:0,"normal"in e.views){const t=m/e.views.normal.BYTES_PER_ELEMENT,s=m/e.views.localID.BYTES_PER_ELEMENT,a=m/e.views.gradient.BYTES_PER_ELEMENT;e.views.normal[t]=(0,d.Tz)(i[0]),e.views.normal[t+1]=(0,d.Tz)(i[1]),e.views.normal[t+2]=(0,d.Tz)(i[2]),e.views.gradient[a]=(0,d.Tz)(null!=n?n:0),e.views.localID[s]=o,e.views.labelingTextureID[s]=r}e.elements.offset++}function M(e){const t=e.indices.buffer,i=e.indices.offset,n=e.elements.offset;t[i]=n,t[i+1]=n+1,t[i+2]=n+2,e.indices.offset+=3}},5549:(e,t,i)=>{"use strict";i.d(t,{DR:()=>a,N5:()=>l});var n=i(6392),o=i(3741),r=i(6490),s=i(8585);function a(e,t,i,a,l){const d=[e[0][0],e[1][0]],c=(0,r.Id)(90+a),u=[];(0,n.Z$)(u,d,l);const h=s.H.toGeo(u),m=(0,o.geoToMapDistance)(h,t),f=(0,o.geoToMapDistance)(h,i),_=Math.sqrt(Math.pow(m,2)+Math.pow(f,2))/2,p=Math.atan(m/-f)+Math.PI+c,v=_*Math.cos(p),g=_*Math.sin(p),y=Math.atan(-m/-f)+Math.PI+c,b=_*Math.cos(y),x=_*Math.sin(y),w=Math.atan(-m/f)+2*Math.PI+c,S=_*Math.cos(w),M=_*Math.sin(w),I=Math.atan(m/f)+c,T=_*Math.cos(I),E=_*Math.sin(I),P=[],A=[],L=[],C=[];return(0,n.a2)(P,[u[0]+v,u[1]+g],l),(0,n.a2)(A,[u[0]+b,u[1]+x],l),(0,n.a2)(L,[u[0]+S,u[1]+M],l),(0,n.a2)(C,[u[0]+T,u[1]+E],l),[[P[0],A[0],L[0],C[0]],[P[1],A[1],L[1],C[1]]]}function l(e,t){const i=Math.max(e,t);return 32*i>512?512/i:32}},1573:(e,t,i)=>{"use strict";i.d(t,{$V:()=>C,In:()=>O,bg:()=>E,kF:()=>k,m5:()=>z,tS:()=>A,tw:()=>P});var n=i(378),o=i(9450),r=i(5600),s=i(9073),a=i(3642),l=i(2682),d=i(8965),c=i(6392),u=i(9090),h=i(6490),m=i(6273),f=i(2543),_=i(2097),p=i(2618),v=i(143);const g=Math.tan((0,h.Id)(87.5)),y=[0,0,0],b=[0,0,0],x=[0,0,0],w=[0,0,0],S=[0,0,0],M=[0,0,0];let I=0,T=0;const E=(e,t)=>e<0||t<0?Math.floor(Math.min(e,t)):Math.ceil(Math.max(e,t)),P=(0,r.D)({symbol:"overpass",sinks:{},generate(e,t,i,o,r,l,u,h){var v,g,y,b;let x=r.signed_z;if(!x)return;let S=void 0!==r.abs_z&&Array.from(r.abs_z).some((e=>e))?r.abs_z:void 0;const M=!0===o.styleState.terrainEnabled,I=o.tileAttrs[o.tileProps.db_road_part],T=o.tileAttrs[o.tileProps.db_geometry_type],E=null===(v=o.tileAttrs[o.tileProps.db_tiers])||void 0===v?void 0:v[0],P=!1,L="tunnel_arch"===I&&P,B="border_tunnel"===I&&P;if("roadbed_flat"===I||"border_tunnel_descent"===I&&P)return;const D=o.tileProps,j=o.tileAttrs.slice();o.id=void 0,j[D.db_tiers]=void 0;const N=t.id,U=r.x.length,H=r.x,G=r.y,V=null!==(g=r.cut)&&void 0!==g?g:[],Z=new Uint8Array(U);L||x.forEach(((e,t)=>{Z[t]=e?0:1}));const W=M&&("roadbed_tunnel"===I||"roadbed_tunnel_descent"===I||"border_tunnel"===I||"border_tunnel_descent"===I);W&&(S=void 0);Boolean(o.tileAttrs[o.tileProps.db_ignore_z])&&!!S&&M&&(x=new Int32Array(x.length));const X=M?1.3:1;W&&(x=new Int32Array(x).map((e=>e*X))),n.t8(w,0,0);const K=(0,c.iq)(l,w)*s.C,$=m.Bq/l.size*K,q=Math.max((0,f.vn)(i.style.borderWidth,o,0),0)*$,Y=Math.max((0,f.vn)(i.style.thickness,o,0),0)*K,J=q>0?Math.max(-Y,(0,f.vn)(i.style.borderHeight,o,0)*K):0,Q=Math.max((0,f.vn)(i.style.tunnelHeight,o,0),0)*K;if("polygon"===T){if(void 0===E)return;const t=[H,G,V,x,new Int8Array(U),Z];S&&t.push(S);const n="roadbed_tunnel_descent"===I,r="roadbed_tunnel"===I||n;a._.generate(e,N,i,o,O(t),E,l,void 0);const s=t.map((e=>Array.from(e)));for(let e=0;e<s[3].length;e++)s[3][e]-=Y,s[4][e]=0;d.j.generate(e,N,i,d.z.bottom,o,O(s),l,u,h,void 0,r?"inverse":"fill",!0);const c=[];for(let e=0;e<E;e++)c.push(e);const m=e.getBucket("polygon","shadow",_.a.sinks.shadow.packObjectAttributes(N,i,c,"",o),_.a.sinks.shadow.binder);if((0,_.d)(m,t[0].length,t[0],t[1],p.gl),r&&!n){const n=t.slice();n[3]=Array.from(t[3]).map((e=>e+Math.abs(e/X)-1)),d.j.generate(e,N,i,d.z.top,o,O(n),l,u,h,void 0,"inverse")}if(n&&M){const n=t.slice();n[3]=new Array(t[0].length).fill(Math.max(0,J)),d.j.generate(e,N,i,d.z.top,o,O(n),l,u,h,void 0,"depthClear")}}else if("polyline"===T){const t=d.j.sinks.stroke.packObjectAttributes(N,i,d.z.top,!!S,o),n=d.j.sinks.stroke.packObjectAttributes(N,i,d.z.side,!!S,o),r=d.j.sinks.stroke.packObjectAttributes(N,i,d.z.bottom,!!S,o),s=function(e){var t,i,n,o,r,s;const a=[],l=e.x.length;for(let d=0;d<l;d++){const l=[e.x[d],e.y[d],null!==(i=null===(t=e.signed_z)||void 0===t?void 0:t[d])&&void 0!==i?i:0,null!==(o=null===(n=e.cut)||void 0===n?void 0:n[d])&&void 0!==o?o:0,0,null!==(s=null===(r=e.is_pivot)||void 0===r?void 0:r[d])&&void 0!==s?s:0];e.abs_z&&l.push(e.abs_z[d]),a.push(l)}return a}({x:H,y:G,cut:V,signed_z:x,is_pivot:Z,abs_z:S});if("tunnel_arch"===I){const a=Math.max(J,0),c=A(s),m=R(s,q),f=s.map((e=>{const t=e.slice();return t[2]=M?-300:-200,t[4]=0,t}));z(e,r,f);const _=C(m,c,q).map((e=>(e[2]=a,e[4]=1,e))),p=m.map((e=>{const t=e.slice();return t[2]=a,t[4]=1,t})),v=k(_,p);do{d.j.generate(e,N,i,d.z.top,o,O(v),l,u,h,void 0,a?"fill":"inverse")}while(e.isOverloaded());const g=s.map((e=>{const t=e.slice();return t[2]=a,t[4]=1,t}));z(e,t,g);const y=k(g,f);do{d.j.generate(e,N,i,d.z.side,o,O(y),l,u,h)}while(e.isOverloaded());const b=k(_.map((e=>{const t=e.slice();return t[2]=M?-300:-200,t[4]=0,t})),_.map((e=>{const t=e.slice();return t[2]=0,t})));do{d.j.generate(e,N,i,d.z.side,o,O(b),l,u,h,void 0,"inverse")}while(e.isOverloaded());if(a){const s=C(m,c,q).map((e=>(e[2]=0,e[4]=0,e)));z(e,r,s),z(e,t,_);const a=k(s,_);do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"fill")}while(e.isOverloaded());const f=m.map((e=>{const t=e.slice();return t[2]=0,t[4]=0,t})),g=k([p[0],f[0]],[_[0],s[0]]);do{d.j.generate(e,N,i,d.z.side,o,O(g),l,u,h,void 0,"fill")}while(e.isOverloaded());z(e,t,[p[0],_[0]]),z(e,n,[_[0],s[0]]),z(e,r,[s[0],f[0]]);const y=p.length-1,b=k([f[y],p[y]],[s[y],_[y]]);do{d.j.generate(e,N,i,d.z.side,o,O(b),l,u,h,void 0,"fill")}while(e.isOverloaded());if(z(e,t,[p[y],_[y]]),z(e,n,[_[y],s[y]]),z(e,r,[s[y],f[y]]),M){do{d.j.generate(e,N,i,d.z.top,o,O(v),l,u,h,void 0,"depthClear")}while(e.isOverloaded());do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"depthClear")}while(e.isOverloaded());do{d.j.generate(e,N,i,d.z.side,o,O(g),l,u,h,void 0,"depthClear")}while(e.isOverloaded());do{d.j.generate(e,N,i,d.z.side,o,O(b),l,u,h,void 0,"depthClear")}while(e.isOverloaded())}}}else if(L){if(!Q)return;const t=A(s),n=R(s,q),r=C(s,t,q),a=C(n,t,q),c=k(s.map((e=>{const t=e.slice();return t[2]=Q,t})),s);do{d.j.generate(e,N,i,d.z.side,o,O(c),l,u,h,void 0,"depthClear")}while(e.isOverloaded());if(q){const t=[s[0],n[0]],c=t.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),m=k(t,c);do{d.j.generate(e,N,i,d.z.side,o,O(m),l,u,h)}while(e.isOverloaded());const f=[r[0],a[0]],_=k(f.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),f);do{d.j.generate(e,N,i,d.z.side,o,O(_),l,u,h)}while(e.isOverloaded());const p=[r[0],s[0]],v=p.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),g=k(p,v);do{d.j.generate(e,N,i,d.z.side,o,O(g),l,u,h)}while(e.isOverloaded());const y=[n[0],a[0]],b=y.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),x=k(y,b);do{d.j.generate(e,N,i,d.z.side,o,O(x),l,u,h)}while(e.isOverloaded());const w=s.length-1,S=[n[w],s[w]],M=S.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),I=k(S,M);do{d.j.generate(e,N,i,d.z.side,o,O(I),l,u,h)}while(e.isOverloaded());const T=[a[w],r[w]],E=k(T.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),T);do{d.j.generate(e,N,i,d.z.side,o,O(E),l,u,h)}while(e.isOverloaded());const P=[a[w],n[w]],A=P.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),L=k(P,A);do{d.j.generate(e,N,i,d.z.side,o,O(L),l,u,h)}while(e.isOverloaded());const C=[s[w],r[w]],z=C.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),R=k(C,z);do{d.j.generate(e,N,i,d.z.side,o,O(R),l,u,h)}while(e.isOverloaded())}if(J){const t=s.length-1,c=[n[t],s[t],s[0],n[0]].map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),m=c.map((e=>{const t=e.slice();return t[2]=Q+J,t[4]=1,t})),f=k(c,m);do{d.j.generate(e,N,i,d.z.side,o,O(f),l,u,h)}while(e.isOverloaded());const _=[a[t],r[t],r[0],a[0]].map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),p=_.map((e=>{const t=e.slice();return t[2]=Q+J,t[4]=1,t})),v=k(p,_);do{d.j.generate(e,N,i,d.z.side,o,O(v),l,u,h)}while(e.isOverloaded());const g=k(m,p);do{d.j.generate(e,N,i,d.z.top,o,O(g),l,u,h)}while(e.isOverloaded());const y=k(_,c);do{d.j.generate(e,N,i,d.z.bottom,o,O(y),l,u,h)}while(e.isOverloaded());const b=[n[0],a[0]].map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),x=b.map((e=>{const t=e.slice();return t[2]=Q+J,t[4]=1,t})),w=k(b,x);do{d.j.generate(e,N,i,d.z.side,o,O(w),l,u,h)}while(e.isOverloaded());const S=[a[t],n[t]].map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),M=S.map((e=>{const t=e.slice();return t[2]=Q+J,t[4]=1,t})),I=k(S,M);do{d.j.generate(e,N,i,d.z.side,o,O(I),l,u,h)}while(e.isOverloaded())}}else if("border_overpass"===I||"border_flat"===I){const a=[j[D.previousPointX],j[D.previousPointY],null!==(y=x[0])&&void 0!==y?y:0,0],c=!!j[D.beginningIsCut]&&F(s[1],s[0],a);c&&s.splice(0,0,a);const m=s.length-1,f=[j[D.nextPointX],j[D.nextPointY],null!==(b=x[x.length-1])&&void 0!==b?b:0,0],_=!!j[D.endingIsCut]&&F(s[m-1],s[m],f);_&&s.push(f);const p=A(s);c&&(p.shift(),s.shift()),_&&(p.pop(),s.pop());const v=s.map((e=>{const t=e.slice();return t[2]=Math.max(t[2]-Y,0),t[4]=0,t}));z(e,n,s);const g=C(s,p,q).map((e=>{const t=e.slice();return t[2]=Math.max(e[2]-Y,0),t[4]=0,t})),w=C(s,p,q).map((e=>{const t=e.slice();return t[2]=Math.max(e[2]+J,0),t[4]=1,t})),S=s.map((e=>{const t=e.slice();return J>0&&(t[2]=Math.max(t[2]+J,0)),t[4]=1,t}));if(J>0){z(e,t,S);const n=k(S,s.map((e=>{const t=e.slice();return t[4]=0,t})));do{d.j.generate(e,N,i,d.z.side,o,O(n),l,u,h)}while(e.isOverloaded())}z(e,r,g),z(e,t,w);const M=k(w,S);do{d.j.generate(e,N,i,d.z.top,o,O(M),l,u,h)}while(e.isOverloaded());const I=k(v,g);do{d.j.generate(e,N,i,d.z.bottom,o,O(I),l,u,h,void 0,"fill")}while(e.isOverloaded());const T=k(g,w);do{d.j.generate(e,N,i,d.z.side,o,O(T),l,u,h,void 0,"fill")}while(e.isOverloaded());if(0===x[0]){const s=k([S[0],v[0]],[w[0],g[0]]);do{d.j.generate(e,N,i,d.z.side,o,O(s),l,u,h,void 0,"fill")}while(e.isOverloaded());z(e,t,[w[0],S[0]]),z(e,n,[S[0],v[0]]),z(e,n,[g[0],w[0]]),z(e,r,[v[0],g[0]])}if(0===x[x.length-1]){const s=v.length-1,a=k([v[s],S[s]],[g[s],w[s]]);do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"fill")}while(e.isOverloaded());z(e,t,[S[s],w[s]]),z(e,n,[v[s],S[s]]),z(e,n,[w[s],g[s]]),z(e,r,[g[s],v[s]])}}else if(B){const t=k(s.map((e=>{const t=e.slice();return t[2]=Q,t[4]=Q/(Q+J),t})),s);do{d.j.generate(e,N,i,d.z.side,o,O(t),l,u,h)}while(e.isOverloaded());do{d.j.generate(e,N,i,d.z.side,o,O(t),l,u,h,void 0,"fill",!0)}while(e.isOverloaded())}else{const a=A(s),c="border_tunnel_descent"===I,m="border_tunnel"===I||c,f=m?Math.max(J,0):J,_=s.map((e=>{const t=e.slice();return t[2]-=Y,c?t[2]=0:m&&(t[2]=Math.max(t[2],-1)),t[4]=0,t})),p=C(s,a,q).map((e=>(e[2]-=Y,c&&(e[2]=0),e[4]=0,e))),v=C(s,a,q).map((e=>(e[2]+=f,c?e[2]=f:m&&(e[2]=Math.max(e[2],-1)),e[4]=1,e))),g=s.map((e=>{const t=e.slice();if(t[4]=1,c)t[2]=f;else if(m){const e=Math.abs(t[2]/X),i=f-t[2],n=t[2]+e-1;t[4]=(n+Math.abs(t[2]))/i,t[2]=n}else t[2]+=f;return t}));if(m){c&&z(e,t,g);const n=k(g,s.map((e=>{const t=e.slice();return t[4]=0,t})));do{d.j.generate(e,N,i,d.z.side,o,O(n),l,u,h)}while(e.isOverloaded());const r=k(g.map((e=>{const t=e.slice();return t[2]=Math.min(e[2],-1),t})),s);do{d.j.generate(e,N,i,d.z.side,o,O(r),l,u,h,void 0,"inverse",!0)}while(e.isOverloaded())}if(J>0&&(!m||c)){z(e,r,p),z(e,t,v);const n=k(v,g);do{d.j.generate(e,N,i,d.z.top,o,O(n),l,u,h)}while(e.isOverloaded());if(c&&M)do{d.j.generate(e,N,i,d.z.top,o,O(n),l,u,h,void 0,"depthClear")}while(e.isOverloaded())}if(!m||c){const s=k(_,p);do{d.j.generate(e,N,i,d.z.bottom,o,O(s),l,u,h,void 0,"fill")}while(e.isOverloaded());const a=k(p,v);do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"fill")}while(e.isOverloaded());if(c&&M)do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"depthClear")}while(e.isOverloaded());if(0===x[0]){const s=k([g[0],_[0]],[v[0],p[0]]);do{d.j.generate(e,N,i,d.z.side,o,O(s),l,u,h,void 0,"fill")}while(e.isOverloaded());if(c&&M)do{d.j.generate(e,N,i,d.z.side,o,O(s),l,u,h,void 0,"depthClear")}while(e.isOverloaded());z(e,t,[v[0],g[0]]),z(e,n,[g[0],_[0]]),z(e,n,[p[0],v[0]]),z(e,r,[_[0],p[0]])}if(0===x[x.length-1]){const s=_.length-1,a=k([_[s],g[s]],[p[s],v[s]]);do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"fill")}while(e.isOverloaded());if(c&&M)do{d.j.generate(e,N,i,d.z.side,o,O(a),l,u,h,void 0,"depthClear")}while(e.isOverloaded());z(e,t,[g[s],v[s]]),z(e,n,[_[s],g[s]]),z(e,n,[v[s],p[s]]),z(e,r,[p[s],_[s]])}}}}}});function A(e){const t=[];(0,u.uI)(y,e[0][0],e[0][1],e[1][0],e[1][1]),I=0;for(let i=1;i<e.length;i++)L(t,e,i);return t}function L(e,t,i){const o=i===t.length-1;if(n.t8(x,t[i-1][0],t[i-1][1]),n.t8(w,t[i][0],t[i][1]),(0,u.IB)(M,y),o)T=0;else{n.t8(S,t[i+1][0],t[i+1][1]),(0,u.uI)(b,w[0],w[1],S[0],S[1]);const e=(0,h.uZ)(n.AK(y,b),-1,1),o=Math.min(Math.sqrt((1-e)/(1+e)),g),r=(0,h.Xx)(n.AK(M,b));T=o*r}let r=M[0]+y[0]*I,s=M[1]+y[1]*I;e.push([r,s]),o&&(r=M[0]+y[0]*T,s=M[1]+y[1]*T,e.push([r,s])),o||(n.JG(y,b),I=T)}function C(e,t,i){const o=[];for(let r=0;r<e.length;r++){const s=e[r].slice();n.JG(M,t[r]),n.bA(M,M,i),n.IH(s,s,M),o.push(s)}return o}function z(e,t,i){do{const n=e.getBucket("mesh","stroke",t,d.j.sinks.stroke.binder),o=i.length;for(let e=0;e<o-1;e++){const t=e+1;(0,l.n)(n,i[e][0],i[e][1],i[e][2],i[t][0],i[t][1],i[t][2],void 0,!1,!0,i[e][6],i[t][6],i[e][5],i[t][5])}}while(e.isOverloaded())}function k(e,t){return function(e){var t,i,n;const o=e.length,r=[[],[],[],[],[],[]];void 0!==e[0][6]&&r.push([]);for(let s=0;s<o;s++){const a=(0,v.X)(s,o),l=e[s];r[0][a]=l[0],r[1][a]=l[1],r[2][a]=l[3],r[3][a]=l[2],r[4][a]=null!==(t=l[4])&&void 0!==t?t:0,r[5][a]=null!==(i=l[5])&&void 0!==i?i:0,r[6]&&(r[6][a]=null!==(n=l[6])&&void 0!==n?n:0)}return r}([e[0]].concat(e,t.slice().reverse()))}function O(e){return{x:e[0],y:e[1],cut:e[2],signed_z:e[3],gradient:e[4],is_pivot:e[5],abs_z:e[6]}}function R(e,t){return e=e.map((e=>e.slice())),o.lu(M,e[0],e[1]),o.Fv(M,M),o.bA(M,M,t),o.IH(e[0],e[0],M),o.lu(M,e[e.length-1],e[e.length-2]),o.Fv(M,M),o.bA(M,M,t),o.IH(e[e.length-1],e[e.length-1],M),e}const F=function(){const e=Math.cos((0,h.Id)(1));return(t,i,o)=>(n.lu(y,i,t),n.Fv(y,y),n.lu(b,i,o),n.Fv(b,b),n.AK(y,b)<=e)}()},7840:(e,t,i)=>{"use strict";i.d(t,{bR:()=>C,uF:()=>G,GN:()=>W,vg:()=>Z,qp:()=>V});var n=i(3698),o=i(6273);function r(e,t){const i=e.reduce(((e,t)=>e.concat(t)),[0]).concat(t),n=i.length-1;return{coords:i.slice(i[0]===i[1]?1:0,i[n-1]===i[n]?n:n+1),isOddStretchable:s(e)}}function s(e){var t;return!(null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0])}function a(e,t,i,n){if(e.coords.length<2)throw new Error("The source coords array must have at least two coordinates");return e.coords.map(((o,r)=>(t+o+n*(0===r?-1:r===e.coords.length-1?1:0))/i))}function l(e,t){const{stretchSize:i,fixSize:n}=d(e),{coords:o,isOddStretchable:r}=e,s=t<n?n:t,a=[o[0]];for(let e=1;e<o.length;e++){const t=o[e-1],l=o[e],d=e%2==(r?1:0),c=a[a.length-1];d?a.push(Math.round((s-n)*(l-t)/i)+c):a.push(c+l-t)}return a}function d({coords:e,isOddStretchable:t}){if(e.length<2)throw new Error("An axis must have at least two coordinates");if(2===e.length)return{stretchSize:e[e.length-1],fixSize:0};let i=0;for(let n=t?0:1;n<e.length-1;n+=2)i+=e[n+1]-e[n];return{stretchSize:i,fixSize:e[e.length-1]-i}}function c(e,t,i=0){const n=e[e.length-1]-e[0],o=e.map((e=>Math.round(e-n/2+i)));return 2===o.length?o[o.length-1]+=2*t:(o[0]-=t,o[o.length-1]+=t),o}var u=i(6392),h=i(9073);function m(e,t,i,n,s,d,u,h,m){const f=function(e,t,i=[],n=[]){return{x:r(i,e),y:r(n,t)}}(i.w,i.h,h,m),_=function(e,t,i,n,o){return[a(e.x,t,n[0],o),a(e.y,i,n[1],o)]}(f,i.x,i.y,t,o.CW),p=function(e,t,i,n,o=0,r=0){return[c(l(e.x,t),n,o),c(l(e.y,i),n,r)]}(f,n,s,o.CW,d,u);e.set(p,_)}const f=[0,0];function _(e,t,i,r,s,a,l,d,c,m,f,_,p,v,g,y){let b=20*e.elements.offset;e.views.flatPosition[b]=o.jO+t,e.views.flatPosition[b+1]=o.jO+i,e.views.flatPosition[b+2]=(0,u.VW)(r),e.views.ecefPosition[b]=s[0]*h.qz,e.views.ecefPosition[b+1]=s[1]*h.qz,e.views.ecefPosition[b+2]=s[2]*h.qz,e.views.cornerOffset[b]=a,e.views.cornerOffset[b+1]=-l,e.views.checkPointOffset[b]=m,e.views.checkPointOffset[b+1]=f,e.views.texCoords[b]=(0,n.Bb)(d),e.views.texCoords[b+1]=(0,n.Bb)(c),e.views.scales[b]=(0,n.KF)(_),e.views.scales[b+1]=(0,n.wj)(p),b>>=1,e.views.localID[b]=v,e.views.labelingTextureID[b]=g,e.views.spritePointTextureID[b]=y,e.elements.offset++}function p(e,t,i,n,r,s,a){const l=e.elements,d=l.stride*l.offset>>1;e.views.position[d]=o.jO+t,e.views.position[d+1]=o.jO+i,e.views.position[d+2]=(0,u.VW)(n),e.views.cornerOffset[d]=r,e.views.cornerOffset[d+1]=-s,e.views.labelingTextureID[d>>1]=a,l.offset++}function v(e,t,i,n,o,r,s){const{elements:a,indices:l}=e,{buffer:d,offset:c}=l,u=a.offset;d[c]=u+t,d[c+1]=u+i,d[c+2]=u+n,d[c+3]=u+o,d[c+4]=u+r,d[c+5]=u+s,l.offset=c+6}var g=i(4999),y=i(5317),b=i(9218),x=i(7464),w=i(2543);function S(e,t,i,n,o,r){if(!e||o&&!r)return[0,0];if(!r)return[e.w/t,e.h/t];const s=T(i,n,r),a=(0,x.pV)(i.style.iconTextPadding);return[a[3]+a[1]+s[0],a[0]+a[2]+s[1]]}function M(e,t,i){return E((0,w.vn)(e.style.textFontSize,t),e.style.textLineHeight,i)}function I(e,t,i){return E((0,w.vn)(e.style.textFontSize2,t),e.style.textLineHeight,i)}function T(e,t,i){return E((0,w.vn)(e.style.iconTextFontSize,t),e.style.iconTextLineHeight,i)}function E(e,t,i){return[e/b.fonts.baseSize*i.maxWidth,e*t*i.lines.length]}function P(e,t,i){var n,o;const r=null!==(n=i[0])&&void 0!==n?n:0,s=null!==(o=i[1])&&void 0!==o?o:0;return[(.5-e.anchorX)*t[0]+r,(.5-e.anchorY)*t[1]+s]}function A(e,t,i,n,o){var r,s,a,l;const d=null!==(r=i[0])&&void 0!==r?r:.5,c=null!==(s=i[1])&&void 0!==s?s:.5,u=null!==(a=o[0])&&void 0!==a?a:0,h=null!==(l=o[1])&&void 0!==l?l:0;return[e[0]/2-d*t[0]-n[3]+u,e[1]/2-c*t[1]-n[0]+h]}function L(e,t,i,n,o){const r=t[0],s=t[1],a=i[0],l=i[1];let d=0,c=0;const u=l/2+s/2,h=l/2-s/2,m=-u,f=-h,_=a/2+r/2,p=a/2-r/2,v=-_,g=-p;switch(e){case"bottomCenter":c=u+o;break;case"rightCenter":d=_+o;break;case"topCenter":c=m-o;break;case"leftCenter":d=v-o;break;case"bottomRight":d=p,c=u+o;break;case"topRight":d=p,c=m-o;break;case"bottomLeft":d=g,c=u+o;break;case"rightBottom":d=_+o,c=f;break;case"rightTop":d=_+o,c=h;break;case"topLeft":d=g,c=m-o;break;case"leftTop":d=v-o,c=h;break;case"leftBottom":d=v-o,c=f}return[d+n[0],c+n[1]]}var C,z=i(5600),k=i(2153),O=i(7486),R=i(2702),F=i(1959),B=i(7293),D=i(3625),j=i(8585);!function(e){e[e.Icon=0]="Icon",e[e.First=1]="First",e[e.Second=2]="Second"}(C||(C={}));const N=new class{constructor(){this.countX=0,this.countY=0,this.textureX=[],this.textureY=[],this.stretchedX=[],this.stretchedY=[]}reset(){this.countX=0,this.countY=0}set(e,t){this.countX=t[0].length,this.countY=t[1].length,this.textureX=t[0],this.textureY=t[1],this.stretchedX=e[0],this.stretchedY=e[1]}isEmpty(){return 0===this.countX||0===this.countY}},U=[0,0,0];let H=[0,0,0];const G=(0,z.D)({symbol:"point",sinks:{raster:{stride:40,binder:(e,t)=>{e.views.flatPosition=new Uint16Array(t),e.views.ecefPosition=new Int16Array(t,6),e.views.cornerOffset=new Int16Array(t,12),e.views.checkPointOffset=new Int16Array(t,16),e.views.texCoords=new Uint16Array(t,20),e.views.scales=new Int16Array(t,24),e.views.localID=new Uint32Array(t,28),e.views.labelingTextureID=new Uint32Array(t,32),e.views.spritePointTextureID=new Uint32Array(t,36)},packObjectAttributes:(e,t,i,n,o,r)=>(0,R.L)([e.styleId,e.layer.innerId,t,i,n,o],r),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],animDirection:e[2],atlasIndex:e[3],labelTest:e[4],floorId:e[5],tileData:e.slice(6)})},text:{stride:36,binder:(e,t)=>{e.views.flatPosition=new Uint16Array(t),e.views.ecefPosition=new Int16Array(t,6),e.views.cornerOffset=new Int16Array(t,12),e.views.checkPointOffset=new Int16Array(t,16),e.views.texCoords=new Uint16Array(t,20),e.views.localID=new Uint32Array(t,24),e.views.labelingTextureID=new Uint32Array(t,28),e.views.spritePointTextureID=new Uint32Array(t,32)},packObjectAttributes:(e,t,i,n,o,r,s,a)=>(0,R.L)([e.styleId,e.layer.innerId,t,i,n[0],-n[1],o,r,s],a),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],animDirection:e[2],range:e[3],offsetX:e[4],offsetY:e[5],labelIndex:e[6],fontIndex:e[7],floorId:e[8],tileData:e.slice(9)})},labelingTexture:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.cornerOffset=new Int16Array(t,8),e.views.labelingTextureID=new Uint32Array(t,12)},packObjectAttributes:(e,t=[0,0])=>(0,R.L)([e.styleId,e.layer.innerId,t[0],-t[1],e.floorId],[]),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],offsetX:e[2],offsetY:e[3],floorId:e[4],tileData:e.slice(5)})}},processElement(e,t,i,n,r,s,a){const{layer:l,label:d}=i;if("point"!==l.type)return;const c=(0,w.bs)(s.styleZoom,s.styleState,!0,d.tileData),h=s.styleState._activeFloorIds.length>0,m=(0,D.hn)(d)&&!h?"":d.floorId,f=X(c,e,r,d),_=e.icons[(0,w.Q9)(l.style.iconImage,c)],p=(0,F.x)(_),v=S(f,r,l,c,p,d.iconTextMetrics),g=(0,x.pV)(l.style.iconTextOffset),y=(0,x.pV)(l.style.iconTextPadding);let E,z=[0,0];if(f)if(d.iconTextMetrics){const e=(0,x.pV)(l.style.iconTextAnchor);E=T(l,c,d.iconTextMetrics),z=A(v,E,e,y,g)}else{z=P(f,v,(0,x.pV)(l.style.iconOffset))}(0,u.a2)(U,i.anchorWorld,a);const{globeInterStartZoom:O}=b.globeConfig;if(s.globeMode&&s.zoom<O||(0,u.hm)(U))switch(H=j._.fromGeo(i.anchorGeo),i.type){case k.Dl.Icon:if(!f||p&&!d.iconTextMetrics)return;const a=p?_.stretchX:void 0,c=p?_.stretchY:void 0;if(W(t,d,m,U,H,n,f,v[0]*r,v[1]*r,z[0]*r,z[1]*r,r,null==a?void 0:a.map((([e,t])=>[e*r,t*r])),null==c?void 0:c.map((([e,t])=>[e*r,t*r]))),!E)return;const u=(0,x.pV)(l.style.iconTextAnchor);return void function(e,t,i,n,r,s,a,l,d,c,u){var h;const{iconTextMetrics:m}=i;if(!m||!c.style.iconTextFont)return;const f=(0,w.bs)(a.styleZoom,a.styleState,!1,i.tileData),_=(0,w.Q9)(c.style.iconTextFont,f),p=null!==(h=e.fontNameToIndex[_])&&void 0!==h?h:e.fontNameToIndex[o.Uo];V(t,i,n,C.Icon,m,r,s,l,d,c,p,u)}(e,t,d,m,U,H,s,n,function(e,t,i){var n,o,r,s;const a=null!==(n=t[0])&&void 0!==n?n:.5,l=null!==(o=t[1])&&void 0!==o?o:.5,d=null!==(r=i[0])&&void 0!==r?r:0,c=null!==(s=i[1])&&void 0!==s?s:0;return[(.5-a)*e[0]+d,(.5-l)*e[1]+c]}(E,u,g),l,r);case k.Dl.PoiText:return void function(e,t,i,n,r,s,a,l,d,c,u,h){var m;const{label:f}=i,{textMetrics:_}=f,p=(0,w.bs)(l.styleZoom,l.styleState,!1,f.tileData),v=(0,w.Q9)(u.style.textFont,p);if(!v.length)return;const g=M(u,p,_),y=null!==(m=e.fontNameToIndex[v])&&void 0!==m?m:e.fontNameToIndex[o.Uo],b=i.parent?(0,w.uA)(u.style.textPlacement,p):"centerCenter",x=(0,w.vn)(u.style.textOffset,p),S=L(b,a,g,c,x);V(t,f,n,C.First,f.textMetrics,r,s,d,S,u,y,h)}(e,t,i,m,U,H,v,s,n,z,l,r);case k.Dl.PoiText2:return void function(e,t,i,n,r,s,a,l,d,c,u,h){var m,f;const{label:_}=i,{textMetrics:p,textMetrics2:v}=_;if(!v||!u.style.textFont2)return;const g=(0,w.bs)(l.styleZoom,l.styleState,!1,_.tileData),y=(0,w.Q9)(u.style.textFont2,g);if(!y.length)return;const b=M(u,g,p),x=I(u,g,v),S=(0,w.vn)(u.style.textOffset,g),T=(0,w.vn)(null!==(m=u.style.textOffset2)&&void 0!==m?m:0,g,0),E=null!==(f=e.fontNameToIndex[y])&&void 0!==f?f:e.fontNameToIndex[o.Uo],P=L((0,w.uA)(u.style.textPlacement,g),a,[x[0],b[1]],c,S);P[1]+=(b[1]+x[1])/2+T,V(t,_,n,C.Second,v,r,s,d,P,u,E,h)}(e,t,i,m,U,H,v,s,n,z,l,r)}},getLabelingInfo(e,t,i,n,o,r){const{layer:s}=e;if("point"!==s.type)return;e.labelingElements.length=0;const a=(0,w.bs)(n.styleZoom,n.styleState,!0,e.tileData),l=X(a,i,r,e),d=i.icons[(0,w.Q9)(s.style.iconImage,a)],c=(0,F.x)(d),u=S(l,r,s,a,c,e.iconTextMetrics);let h,m=[0,0];if(l&&(!c||e.iconTextMetrics)){if(e.iconTextMetrics){const t=(0,x.pV)(s.style.iconTextAnchor),i=(0,x.pV)(s.style.iconTextOffset),n=(0,x.pV)(s.style.iconTextPadding);h=T(s,a,e.iconTextMetrics),m=A(u,h,t,n,i)}else{m=P(l,u,(0,x.pV)(s.style.iconOffset))}const r=new y.x(e,k.Dl.Icon,t,n.buildingHeight,o,i,n.globeMode,n.styleState._floorHeight);r.boxes.push([-u[0]/2+m[0],-u[1]/2+m[1],u[0]/2+m[0],u[1]/2+m[1]]),e.labelingElements.push(r)}const f=(0,w.Q9)(s.style.textFont,a);e.label.length>0&&f.length&&(function(e,t,i,n,o,r,s,a){const{textMetrics:l}=e;if(!l)return;const d=(0,w.bs)(o.styleZoom,o.styleState,!1,e.tileData),c=(0,w.vn)(a.style.textOffset,d),u=M(a,d,l),h=new y.x(e,k.Dl.PoiText,t,o.buildingHeight,r,i,o.globeMode,o.styleState._floorHeight);e.labelingElements.length>0&&(h.parent=e.labelingElements[0]);const m=L(h.parent?(0,w.uA)(a.style.textPlacement,d):"centerCenter",n,u,s,c);h.boxes.push([m[0]-u[0]/2,m[1]-u[1]/2,m[0]+u[0]/2,m[1]+u[1]/2]),e.labelingElements.push(h)}(e,t,i,u,n,o,m,s),e.label2&&function(e,t,i,n,o,r,s,a){var l;const{textMetrics:d,textMetrics2:c}=e;if(!c)return;const u=(0,w.bs)(o.styleZoom,o.styleState,!1,e.tileData),h=M(a,u,d),m=I(a,u,c),f=(0,w.vn)(a.style.textOffset,u),_=(0,w.vn)(null!==(l=a.style.textOffset2)&&void 0!==l?l:0,u,0),p=new y.x(e,k.Dl.PoiText2,t,o.buildingHeight,r,i,o.globeMode,o.styleState._floorHeight);e.labelingElements.length>1?(p.parent=e.labelingElements[0],p.firstLabel=e.labelingElements[1]):e.labelingElements.length>0&&(p.parent=e.labelingElements[0],p.firstLabel=e.labelingElements[0]);const v=L((0,w.uA)(a.style.textPlacement,u),n,[m[0],h[1]],s,f);v[1]+=(h[1]+m[1])/2+_,p.boxes.push([v[0]-m[0]/2,v[1]-m[1]/2,v[0]+m[0]/2,v[1]+m[1]/2]),e.labelingElements.push(p)}(e,t,i,u,n,o,m,s))}});function V(e,t,i,n,o,r,s,a,l,d,c,u){if(n===C.First&&1===t.labelingElements.length){const i=e.getBucket("point","labelingTexture",G.sinks.labelingTexture.packObjectAttributes(t),G.sinks.labelingTexture.binder);t.checkPointOffset=(0,g.MD)(i,r,o,d,u,t.labelingTextureIndex)}const h={};for(const o of t.ranges)h[o]=e.getBucket("point","text",G.sinks.text.packObjectAttributes(t,a,o,l,n,c,i,(0,B.u)(t.tileData,d)),G.sinks.text.binder);(0,g.$Y)(h,t,r,s,o,d,n,t.checkPointOffset)}function Z(e,t,i,n,o,r,s,a){return W(e,t,i,n,o,r,s,s.w,s.h,s.w*(.5-s.anchorX),s.h*(.5-s.anchorY),a,void 0,void 0)}function W(e,t,i,n,r,s,a,l,d,c,u,h,g,y){if(l<=0||d<=0)return;const x=t.layer;if("point"!==x.type)return;m(N,b.atlasSize,a,l,d,c,u,g,y),e.atlasPacker.addRastersToLoad(t.styleId,a);const w=e.getBucket("point","labelingTexture",G.sinks.labelingTexture.packObjectAttributes(t),G.sinks.labelingTexture.binder);t.checkPointOffset=function(e,t,i,n,r,s,a){const{stretchedX:l,stretchedY:d}=n,c=Math.ceil((l[l.length-1]-l[0])/2),u=Math.ceil((d[d.length-1]-d[0])/2),h=s*o.Jv/2;f[0]=l[0]+c,f[1]=d[0]+u;const m=f[0]-h,_=f[0]+h,g=f[1]-h,y=f[1]+h;return v(r,0,2,1,1,2,3),p(r,e,t,i,m,g,a),p(r,e,t,i,_,g,a),p(r,e,t,i,m,y,a),p(r,e,t,i,_,y,a),f}(n[0],n[1],n[2],N,w,h,t.labelingTextureIndex);const S=e.getBucket("point","raster",G.sinks.raster.packObjectAttributes(t,s,a.atlasIndex,void 0!==g||void 0!==y,i,(0,B.u)(t.tileData,x)),G.sinks.raster.binder);!function(e,t,i,n,r,s,a,l,d,c,u,h){const{textureX:m,textureY:f,stretchedX:p,stretchedY:g,countX:y,countY:b}=r,x=a!==-1/0?a:o.vL,w=l!==1/0?l:o.Fv,[S,M]=h;for(let o=0;o<y-1;o++){const r=m[o],a=m[o+1],l=p[o],h=p[o+1];for(let o=0;o<b-1;o++){const m=f[o],p=f[o+1],y=g[o],b=g[o+1];v(s,0,2,1,1,2,3),_(s,e,t,i,n,l,y,r,m,S,M,x,w,d,c,u),_(s,e,t,i,n,h,y,a,m,S,M,x,w,d,c,u),_(s,e,t,i,n,l,b,r,p,S,M,x,w,d,c,u),_(s,e,t,i,n,h,b,a,p,S,M,x,w,d,c,u)}}}(n[0],n[1],n[2],r,N,S,-1/0,1/0,t.identifyIndex,t.labelingTextureIndex,t.spritePointTextureIndex,t.checkPointOffset)}function X(e,t,i,n){const{rasterSets:o}=t,{layer:r}=n;if("point"!==r.type)return;let s;const a=(0,D.hn)(n);if(a||n.pointType===k.a_.Landmark)s=o.byKey[(0,x.zV)(n.id,a?"commercial":"landmark")];else{const t=(0,w.Q9)(r.style.iconImage,e);if(t.length){const e=(0,x.pV)(r.style.iconAnchor);s=o.byKey[(0,x.PR)(t,e[0],e[1])]}}if(s){const t=(0,w.vn)(r.style.iconWidth,e),n=(0,O.Bl)(s.rasters,t*i,!0);if(void 0!==n)return s.rasters[n]}}},2097:(e,t,i)=>{"use strict";i.d(t,{a:()=>f,d:()=>_});var n=i(5600),o=i(143),r=i(2682),s=i(2702),a=i(6273),l=i(8450),d=i(3376),c=i(2543),u=i(7464);function h(e,t,i,n,o,r){return(0,s.v)([e,t.innerId,i,n,o],t,r)}const m=e=>({styleId:e[0],layerId:e[1],tiers:e[2],floorId:e[3],hiddenByFloorComplexId:e[4],tileData:e.slice(5)}),f=(0,n.D)({symbol:"polygon",sinks:{fill:{stride:8,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.localID=new Uint32Array(t,4)},packObjectAttributes:h,unpackObjectAttributes:m},stroke:{stride:8,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.directionDistance=new Int8Array(t,4)},packObjectAttributes:h,unpackObjectAttributes:m},shadow:{stride:4,binder:(e,t)=>{e.views.position=new Uint16Array(t)},packObjectAttributes:(e,t,i,n,o)=>(0,s.v)([e,t.innerId,i,n],t,o),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],tiers:e[2],floorId:e[3],tileData:e.slice(4)})},fillWithMixFactor:{stride:8,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.mixFactor=new Float32Array(t,4)},packObjectAttributes:h,unpackObjectAttributes:m}},generate(e,t,i,n,s,a,h){var m;if("polyline"===n.tileAttrs[n.tileProps.db_geometry_type])return;const p=((e,t)=>{const i="polygon"===e.type&&(0,c.FR)(e.style.color,t);return(0,u.bd)(i)&&"vertexAttribute"===i.factor.type})(i,n),v=s.x,g=s.y,y=s.cut,b=n.tileAttrs[n.tileProps.db_plan_id]||"",x=p?s.z:void 0;if((0,l.nc)(i)&&h&&((0,d.AN)(e,t,h,i.style,a),i.style.normalMapTextureImage)){const n={textureImage:i.style.normalMapTextureImage,textureSize:i.style.normalMapTextureSize,lengthUnits:i.style.normalMapTextureLengthUnits,textureOpacity:1};(0,d.AN)(e,t,h,n,a)}const w=e.idIndexer.getIndex(n,t,i,{floorId:b||void 0}),S=null!==(m=n.id)&&void 0!==m?m:"",M="polygon"!==i.type||(0,c.FR)(i.ignoreTier,n)?null:n.tileAttrs[n.tileProps.db_tiers],I=n.tileAttrs[n.tileProps.db_hidden_by_metro_building_id]||"",T=p?e.getBucket("polygon","fillWithMixFactor",f.sinks.fillWithMixFactor.packObjectAttributes(t,i,M,b,I,n),f.sinks.fillWithMixFactor.binder):e.getBucket("polygon","fill",f.sinks.fill.packObjectAttributes(t,i,M,b,I,n),f.sinks.fill.binder),E=T.indices.offset;_(T,v.length,v,g,w,x),T.objectsData[E]={objectId:S,size:T.indices.offset-E};const P=e.getBucket("polygon","stroke",f.sinks.stroke.packObjectAttributes(t,i,M,b,I,n),f.sinks.stroke.binder);if(y){const e=P.indices.offset;!function(e,t,i,n,s){for(let a=0;a<t;a++){const l=(0,o.X)(a,t);if(1===s[l]){const s=(0,o.X)((a+1)%t,t);(0,r.n)(e,i[l],n[l],0,i[s],n[s],0)}}}(P,v.length,v,g,y),P.objectsData[e]={objectId:S,size:P.indices.offset-e}}}});function _(e,t,i,n,o,r){const s=e.indices.buffer;let a=e.indices.offset,l=e.elements.offset;const d=l;p(e,l++,i[0],n[0],o,null==r?void 0:r[0]),p(e,l++,i[1],n[1],o,null==r?void 0:r[1]);for(let c=2;c<t;c++)v(s,a,d,c),p(e,l++,i[c],n[c],o,null==r?void 0:r[c]),a+=3;e.elements.offset=l,e.indices.offset=a}function p(e,t,i,n,o,r){t=t*e.elements.stride/e.views.position.BYTES_PER_ELEMENT,e.views.position[t]=a.jO+i,e.views.position[t+1]=a.jO+n,t>>=1,"localID"in e.views&&(e.views.localID[t]=o),void 0!==r&&"mixFactor"in e.views&&(e.views.mixFactor[t]=r/1072)}function v(e,t,i,n){n%2==0?(e[t]=i+n-2,e[t+1]=i+n-1,e[t+2]=i+n):(e[t]=i+n-1,e[t+1]=i+n-2,e[t+2]=i+n)}},5970:(e,t,i)=>{"use strict";i.d(t,{p:()=>y});var n=i(143),o=i(6392),r=i(5600),s=i(1558),a=i(8308),l=i(2682),d=i(2543),c=i(2702),u=i(8194),h=i(6273),m=i(9073),f=i(8450);const _=h.Bq/2,p=1/(0,o.VW)(1),v=(e,t,i,n,o,r)=>(0,c.v)([e,t.innerId,i,n,o],t,r),g=e=>({styleId:e[0],layerId:e[1],hiddenByFloorComplexId:e[2],floorId:e[3],isFloorStack:e[4],tileData:e.slice(5)}),y=(0,r.D)({symbol:"polygonExtrusion",sinks:{sideFill:{stride:20,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.localID=new Uint32Array(t,8),e.views.demPosition=new Int16Array(t,12),e.views.labelingTextureID=new Uint32Array(t,16)},packObjectAttributes:v,unpackObjectAttributes:g},topFill:{stride:20,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.localID=new Uint32Array(t,8),e.views.demPosition=new Int16Array(t,12),e.views.labelingTextureID=new Uint32Array(t,16)},packObjectAttributes:v,unpackObjectAttributes:g},sideStroke:{stride:24,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.normals=new Int8Array(t,8),e.views.direction=new Int8Array(t,12),e.views.demPosition=new Int16Array(t,16),e.views.distance=new Int16Array(t,20)},packObjectAttributes:v,unpackObjectAttributes:g},topStroke:{stride:16,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.height=new Float32Array(t,4),e.views.directionDistance=new Int8Array(t,8),e.views.demPosition=new Int16Array(t,12)},packObjectAttributes:v,unpackObjectAttributes:g}},generate(e,t,i,r,c,_){var g,M;const I=c.x,T=c.y,E=null!==(g=c.cut)&&void 0!==g?g:[],P=r.tileAttrs[r.tileProps.db_plan_id]||"",A=r.tileAttrs[r.tileProps.db_hidden_by_plan_building_id]||"",L="Floor_half_walls_width_extended_ground"===r.tileAttrs[r.tileProps.db_sublayer],C=I.length,z=null!==(M=r.id)&&void 0!==M?M:"";let k;k=r.tileProps.db_centroid_x&&r.tileProps.db_centroid_y&&!Number.isNaN(r.tileAttrs[r.tileProps.db_centroid_x])&&!Number.isNaN(r.tileAttrs[r.tileProps.db_centroid_y])?[r.tileAttrs[r.tileProps.db_centroid_x],r.tileAttrs[r.tileProps.db_centroid_y]]:function(e,t,i){let o,r=Math.pow(h.Bq,2);const s=e.length,a=u.Ue();for(let l=0;l<s;l++){o||u.aM(a,[e[l],t[l]]);const d=(0,n.X)(l,s);if(0===i[d]){const i=[e[d],t[d]],a=(0,n.X)((l+1)%s,s),c=[e[a],t[a]];if(S(i)){const e=w(i);e<r&&(o=i,r=e);const t=w(c);t<r&&(o=c,r=t)}else o=[(e[d]+e[a])/2,(t[d]+t[a])/2]}}o||(o=[],u.be(o,a));return o}(I,T,E);const O=(0,d.FR)(i.style.height,r),R=r.tileInfo?(0,o.iq)(r.tileInfo,[0,0]):1,F=Math.max(O*m.C*R,p),B=e.idIndexer.getIndex(r,t,i,{floorId:Number.isNaN(P)?void 0:P}),D=e.pointIndexer.getIndex(z),j=v(t,i,A,P,L,r);if(F>0){const t=e.getBucket("polygonExtrusion","sideFill",j,y.sinks.sideFill.binder);let n=t.indices.offset;if((0,s.y)(t,C,I,T,E,F,B,D,k),t.objectsData[n]={objectId:z,size:t.indices.offset-n},!(P||_.AALinesOff&&(0,f.BL)(i,r))){const t=e.getBucket("polygonExtrusion","sideStroke",j,y.sinks.sideStroke.binder);n=t.indices.offset,(0,a.C)(t,C,I,T,E,k),(0,a.b)(t,C,I,T,E,F,k),t.objectsData[n]={objectId:z,size:t.indices.offset-n}}}const N=e.getBucket("polygonExtrusion","topFill",j,y.sinks.topFill.binder);let U=N.indices.offset;!function(e,t,i,n,o,r,s,a){let l=e.elements.offset;const d=l;b(e,l++,i[0],n[0],o,r,s,a),b(e,l++,i[1],n[1],o,r,s,a);for(let c=2;c<t;c++)x(e,d,c),b(e,l++,i[c],n[c],o,r,s,a);e.elements.offset=l}(N,C,I,T,F,B,D,k),N.objectsData[U]={objectId:z,size:N.indices.offset-U};const H=e.getBucket("polygonExtrusion","topStroke",j,y.sinks.topStroke.binder);U=H.indices.offset,function(e,t,i,o,r,s,a){for(let d=0;d<t;d++){const c=(0,n.X)(d,t);if(r&&1===r[c]){const r=(0,n.X)((d+1)%t,t);(0,l.n)(e,i[c],o[c],s,i[r],o[r],s,a)}}}(H,C,I,T,E,F,k),H.objectsData[U]={objectId:z,size:H.indices.offset-U}}});function b(e,t,i,n,r,s,a,l){const d=e.elements.stride,c=t*(d/e.views.position.BYTES_PER_ELEMENT),u=t*(d/e.views.height.BYTES_PER_ELEMENT);e.views.position[c]=h.jO+i,e.views.position[c+1]=h.jO+n,e.views.height[u]=(0,o.VW)(r)/h._H,e.views.demPosition[c]=(h.jO+l[0])/8,e.views.demPosition[c+1]=(h.jO+l[1])/8;const m=t*(d/e.views.localID.BYTES_PER_ELEMENT);e.views.localID[m]=s,e.views.labelingTextureID[m]=a}function x(e,t,i){const n=e.indices.buffer;let o=e.indices.offset;i%2==0?(n[o++]=t+i-2,n[o++]=t+i-1,n[o++]=t+i):(n[o++]=t+i-1,n[o++]=t+i-2,n[o++]=t+i),e.indices.offset=o}function w(e){return Math.pow(_-Math.abs(e[0]-_),2)+Math.pow(_-Math.abs(e[1]-_),2)}function S(e){return 0===e[0]||e[0]===h.Bq||0===e[1]||e[1]===h.Bq}},6201:(e,t,i)=>{"use strict";i.d(t,{It:()=>s,R2:()=>n,hs:()=>r});var n,o=i(2543);function r(e,t){return Number.isNaN(e)?t:e}function s(e,t){if(!e)return"";const i=(0,o.FR)(e,t);return Number.isNaN(i)||!i&&0!==i?"":String(i)}!function(e){e[e.Point=0]="Point",e[e.Line=1]="Line",e[e.OneWayLine=2]="OneWayLine"}(n||(n={}))},4333:(e,t,i)=>{"use strict";i.d(t,{p:()=>_});var n=i(7609),o=i(9218),r=i(7486),s=i(7464),a=i(9981),l=i(2543),d=i(2618),c=i(2153),u=i(6201),h=i(1959),m=i(6392),f=i(9073);const _=(e,t,i,_,p,v,g,y,b,x,w)=>{var S,M,I,T;const{tileProps:E,tileAttrs:P}=_;if(function(e,t,i,d,c,u){var m;const{tileProps:f,tileAttrs:_}=d,{rasterSets:p,icons:v}=t,g=(0,a.fL)(c),y=(0,l.EG)(i.style.iconWidth),b=(0,n.Ty)(_[f.db_sublayer]),x=(0,n.Cz)(_[f.db_sublayer]),w=(0,s.pV)(i.style.iconAnchor);if(b||x){if(u)return;const i=b?o.commercialPoi.rasterSizes:o.landmarkRasterSizes,n=(0,r.rA)(null!==(m=d.id)&&void 0!==m?m:"",i,_[f.db_region],w,b?"commercial":"landmark",f.url_src?_[f.url_src]:void 0);e.atlasPacker.addNewRasterSet(t.id,n),e.atlasPacker.pack(n,y,g)}else(0,l.EG)(i.style.iconImage).forEach((i=>{if(!i.length)return;const n=p.byKey[(0,s.PR)(i,w[0],w[1])];if(!n)return void console.error(`Not found raster set with image ${i}, anchorX: ${w[0]}, anchorY: ${w[1]}`);if(!n.isSvg)return;const o=v[i],r=o&&(0,h.x)(o)?[{w:o.width,h:o.height}]:y.map((e=>({w:e,h:e})));e.atlasPacker.packSvg(n,r,g),u&&n.rasters.forEach((i=>e.atlasPacker.addRastersToLoad(t.id,i)))}))}(e,t,i,_,x,w),w)return;let A=c.a_.Common;const L=P[E.db_sublayer];(0,n.wu)(L)?A=c.a_.CommercialCity:(0,n.CE)(L)?A=c.a_.CommercialPremium:(0,n.Ty)(L)?A=c.a_.Commercial:(0,n.Cz)(L)&&(A=c.a_.Landmark);const C=1===b.x.length?c._r.Point:c._r.Line;let z,k=[];if(C===c._r.Point){if(_&&i.style.allowElevation){const e=(0,l.vn)(i.style.elevation,_);if(Number.isNaN(e))void 0!==b.z&&(b.z=[v<4?(0,m.d1)(b.z[0]):b.z[0]]);else{const t=e*f.C*(0,m.iq)((0,m.Bs)(g),[b.x[0],b.y[0]]);b.z=[t]}}k=[[b.x[0]],[b.y[0]],void 0!==b.z?[b.z[0]]:[0]],z=[0,0,0],(0,m.Z$)(z,[k[0][0],k[1][0],k[2][0]],(0,m.Bs)(g))}else k=[b.x,b.y];const O=null!==(S=_.id)&&void 0!==S?S:"",R=null!==(M=P[E.db_plan_id])&&void 0!==M?M:"",F=null!==(I=P[E.db_plan_level])&&void 0!==I?I:NaN;let B=d.gl,D=d.gl;Number.isNaN(O)||(B=e.idIndexer.getIndex(_,t.id,i,{objectClass:P[E.db_object_class],instanceId:0,metatile:p,center:z,floorId:R,ignoreHover:!0}),D=e.idIndexer.getIndex(_,t.id,i,{objectClass:P[E.db_object_class],instanceId:1,metatile:p,center:z,floorId:R,ignoreHover:!0}));const j=P[E.db_point_building_id],N=e.pointIndexer.getIndex(j),U=e.pointIndexer.getIndex(O),H={type:u.R2.Point,pointType:A,geometryType:C,styleId:t.id,layerId:i.innerId,sourceId:y,tileCoords:g,id:null!==(T=_.id)&&void 0!==T?T:"",floorId:R,planLevel:F,identifyIndex:B,identifyPoiLabelIndex:D,labelingTextureIndex:N,spritePointTextureIndex:U,labelPriority:(0,u.hs)(P[E.db_label_priority],0),label2Priority:(0,u.hs)(P[E.db_label2_priority],0),styleIconPriority:(0,l.vn)(i.style.iconPriority,_),styleTextPriority:(0,l.vn)(i.style.textPriority,_),iconPriority:(0,u.hs)(P[E.db_icon_priority],0),hovered:(0,u.hs)(P[E.hovered],0),componentDistanceStart:(0,u.hs)(P[E.componentDistanceStart],0),componentDistanceEnd:(0,u.hs)(P[E.componentDistanceEnd],0),objectLength:(0,u.hs)(P[E.objectLength],0),vertices:k,demElevation:NaN,tileData:[..._.tileData]};e.addLabel(H)}},6263:(e,t,i)=>{"use strict";i.d(t,{h:()=>a});var n=i(5600),o=i(3698),r=i(6273),s=i(2702);const a=(0,n.D)({symbol:"raster",sinks:{fill:{stride:8,binder:(e,t)=>{e.views.position=new Uint16Array(t),e.views.txtrCoords=new Uint16Array(t,4)},packObjectAttributes:(e,t,i,n,o)=>(0,s.v)([e,t.innerId,n,o],t,i),unpackObjectAttributes:e=>({styleId:e[0],layerId:e[1],textureIndex:e[2],tiers:e[3],tileData:e.slice(4)})}},generate(e,t,i,n,o,r,s){const d=t.x,c=t.y,u=e.getBucket(o.type,"fill",a.sinks.fill.packObjectAttributes(i,o,n,r,s),a.sinks.fill.binder);let h=u.elements.offset;!function(e,t,i,n,o,r,s,a){const l=e.buffer,d=e.offset;l[d]=t+i,l[d+1]=t+n,l[d+2]=t+o,l[d+3]=t+r,l[d+4]=t+s,l[d+5]=t+a,e.offset=d+6}(u.indices,h,0,1,2,2,1,3),l(u,h++,d[0],c[0],0,1),l(u,h++,d[1],c[1],1,1),l(u,h++,d[2],c[2],0,0),l(u,h++,d[3],c[3],1,0),u.elements.offset=h}});function l(e,t,i,n,s,a){t*=4,e.views.position[t]=r.jO+i,e.views.position[t+1]=r.jO+n,e.views.txtrCoords[t]=(0,o.Bb)(s),e.views.txtrCoords[t+1]=(0,o.Bb)(a)}},6757:(e,t,i)=>{"use strict";i.d(t,{l:()=>u,r:()=>f});var n=i(4265),o=i(878),r=i(8369),s=i(1436),a=i(6874),l=i(8451),d=i(1359),c=i(5220);function u(e,t,i,n){for(const o of t)h(e,i,o,n)}function h(e,t,i,d){const{renderer:u,instanceLinker:h,map:_}=e,{symbol:p,sink:v,generatedObjects:g,buffer:y,elementsBuffer:b,elementSize:x}=i;if(void 0===u.symbolSettingsList[p])return;const w=f(u,p,v);if(0===w.length)return;const S=(0,s.vP)(p,v);if(w[0].instanceBinder){const e=function(e,t,i){const n=t.buffer,o=[];for(const s of t.generatedObjects){const t=new DataView(n,s.rangeStart,s.rangeEnd-s.rangeStart),a=e.createBuffer(t);a.purpose="instanced",a.drawType=r.l.StaticDraw,s.buffer=a,s.rangeEnd-s.rangeStart===i&&(s.tMatrix3x3=new Float32Array(t.buffer,s.rangeStart+16,9)),o.push(a)}return o}(u,i,S);return t.buffers.push(...e),void h.enqueue(i,t)}let M=0;M=b&&x?b.byteLength/x:y.byteLength/S;const{buffer:I,vaos:T,visibilityBuffer:E}=function(e,t,i,n,o){const s=e.createBuffer(i);s.purpose="attributes",s.drawType=r.l.StaticDraw;const a=[];let d,c,u;return o&&(u=e.createBuffer(o,{itemSize:1,dataType:r.l.UnsignedShort},!0),u.elementsType=r.l.UnsignedShort),t.forEach((t=>{const i=e.getShaderProgram(t.programName),o=t.vaoCreator(s,i,u);if(t.needsVisibilityBuffer){if(!d||!c){const t=new Uint8Array(new Array(n).fill(1));d=e.createBuffer(t,void 0,!1,!0),d.purpose="visibility",c=new l.K(d,{itemSize:1,dataType:r.l.UnsignedByte})}o.setAttribute("a_float_visibility",c)}a.push(o)})),{buffer:s,visibilityBuffer:d,vaos:a}}(u,w,y,M,b);t.pushBuffer(I),E&&t.pushBuffer(E);const P="polygonExtrusion"===p&&!_.getFeatureFlag("transparentBuildingsOff")||"lineExtrusion"===p;for(let e=0;e<g.length;e++){const{rangeStart:i,rangeEnd:r,attributes:l,drawMode:u,meta:h,objectsData:f}=g[e],_=s.kF[p].sinks[v].unpackObjectAttributes(l),y=[];for(let e=0;e<w.length;e++){const n=w[e],s=T[e],d=n.uniformSet||"fill",m={id:(0,a.fD)(),type:o.H.Tile,layerSettings:n,start:i/S,count:(r-i)/S,attributes:_,renderingProperties:{},attributesHash:JSON.stringify(l)+"_"+d+"_"+t.detailLevel,vao:s,drawMode:u,tile:t,symbol:p,sink:v,meta:h,canRender:!0};P&&(m.shaderDefinitions=c.e.createShaderDefinitions([{type:"BLEND"}])),t.push(m),n.needsVisibilityBuffer&&y.push(s)}d&&y.length>0&&f&&t instanceof n.W&&m(f,t,y,d,!!_.floorId)}}function m(e,t,i,n,o){const r=o?t.floorObjectsMap:t.objectsMap,s=[];for(const t in e){const o=e[t];let a=r[t];a||(a=new Map,r[t]=a);let l=a.get(i);l||(l=[],a.set(i,l));for(const e of o)l.push(e);n.isHidden(t,d.Rv.PolygonExtrusion)&&s.push(t)}n.triggerIdUpdate(s)}function f(e,t,i){const n=e.symbolSettingsList[t];if(void 0===n)return[];const o=n[i];return null==o||0===o.length?[]:o}},4288:(e,t,i)=>{"use strict";i.d(t,{r:()=>m});var n=i(462),o=i(4635),r=i(6392);function s(e,t,i){const n=function(e){const t={};for(const i in e){const n=e[i];l(n)&&(t[i]=n)}return t}(e),o=Object.keys(n).reduce(((e,t)=>{const i=n[t];return e[u(i.coords[0],i.coords[1],i.coords[2])]=i,e}),{}),r=Math.min(...Object.values(n).map((e=>e.coords[2]))),s=Math.min(...Array.from(t).map((t=>e[t].coords[2]))),h=function(e,t){const i={};for(const n in e){const o=e[n];let r=Math.floor(o.coords[0]/2),s=Math.floor(o.coords[1]/2);for(let e=o.coords[2]-1;e>=t;e--){const t=u(r,s,e),n=i[t];n?n.push(o):i[t]=[o],r=Math.floor(r/2),s=Math.floor(s/2)}}return i}(n,s),m={},f=new Set;for(const s of t){const t=n[s];if(t){d(m,t),i.matched++;continue}const l=e[s],_=a(l,n,3);if(_){i.shifted++,d(m,_);continue}const p=u(l.coords[0],l.coords[1],l.coords[2]),v=c(l,r,o);if(v){i.parent++,d(m,v),f.add(v);continue}const g=h[p];if(g)for(const e of g)i.children++,d(m,e)}function _(e){const t=c(e,r,o);t&&f.has(t)&&(delete m[e.currentMod.key],_(t))}for(const e in m)_(m[e].tile);return m}function a(e,t,i){const{coords:n}=e,o=Math.min(n[3]+i,32);for(let e=Math.max(n[3]-i,0);e<=o;e+=1){if(e===n[3])continue;const i=t[(0,r.LQ)(n[0],n[1],n[2],e)];if(i)return i}}function l(e){const t=e.currentMod;return void 0!==t&&t.ready}function d(e,t){const i=t.currentMod;e[i.key]=i}function c(e,t,i){let[n,o,r]=e.coords;for(;r-- >=t;){n=Math.floor(n/2),o=Math.floor(o/2);const e=u(n,o,r);if(i[e])return i[e]}}function u(e,t,i){return`${e}_${t}_${i}`}var h=i(9833);function m(e,t,i){f(e,t,i),_(e),p(e);for(const t in e.displayedMods)e.tileModsCache.get(t);v(e),g(e)}function f(e,t,i){for(const n in e.tiles)(0,h.qC)(e.tiles[n],e.tileModsCache,t,i,e.ids)}function _(e){switch(e.tilesAppearance){case n.W.ByOne:(0,o.TQ)(e);break;case n.W.WaitingLayer:(0,o.ej)(e.tiles,e.viewportTiles)&&(e.tilesAppearance=n.W.ByOne,(0,o.TQ)(e));case n.W.GlobalWaiting:}}function p(e){const{tiles:t,viewportTiles:i,displayStats:n}=e;e.displayedMods=s(t,i,n)}function v({tiles:e,displayedMods:t,viewportTiles:i}){for(const n in e){if(i.has(n))continue;const o=e[n],r=o.currentMod;r&&!t[r.key]&&(0,h.U9)(o)}}function g(e){switch(e.zoomDirection){case n.Y.ZoomingIn:(e.zoomLevel<=e.zoomStartZoom||y(e))&&(e.zoomDirection=n.Y.Stationary,e.zoomStartZoom=e.zoomLevel);break;case n.Y.ZoomingOut:(e.zoomLevel>=e.zoomStartZoom||y(e))&&(e.zoomDirection=n.Y.Stationary,e.zoomStartZoom=e.zoomLevel)}}function y(e){const{tiles:t,viewportTiles:i,displayedMods:n}=e;for(const e of i){const i=t[e],o=(0,h.hW)(i);if(!o)return!1;if(void 0===n[o.key])return!1}return!0}},1285:(e,t,i)=>{"use strict";i.d(t,{I2:()=>d,TZ:()=>l,YY:()=>s,bj:()=>a,cA:()=>c});var n=i(462),o=i(4635),r=i(9833);function s(e,t,i,s){var a;i.selectedIds=s,i.tilesAppearance=n.W.WaitingLayer,(0,o.eh)(i);for(const n in i.tiles){const o=i.tiles[n];(0,r.IF)(e,t,o,i.sourceId,null===(a=o.hover)||void 0===a?void 0:a.id,!0)}}function a(e,t,i,n){if(!t.disableHoverStyles){for(const o in i.tiles){const s=i.tiles[o];(0,r.IF)(e,t,s,i.sourceId,n)}e.labeler.disableThrottleUpdateOnce()}}function l(e,t){e.styleState=t,(0,o.eh)(e)}function d(e,t,i,r){e.tilesAppearance=r?n.W.ByOne:n.W.GlobalWaiting,e.styleId=t,e.styleRevision=i,(0,o.eh)(e)}function c(e){e.tilesAppearance=n.W.ByOne,(0,o.TQ)(e)}},9311:(e,t,i)=>{"use strict";i.d(t,{o:()=>l});var n=i(462),o=i(6490),r=i(6392),s=i(9218),a=i(4635);function l(e,t,i){d(e,t.styleZoom,t.zoom),c(e,t,i),u(e),(0,a.eh)(e)}function d(e,t,i){const o=(0,a.uk)(e.type,i,t),r=o-e.zoomLevel;e.zoomDirection===n.Y.Stationary&&(r>0?(e.zoomDirection=n.Y.ZoomingIn,e.zoomStartZoom=e.zoomLevel):r<0&&(e.zoomDirection=n.Y.ZoomingOut,e.zoomStartZoom=e.zoomLevel)),e.zoomLevel=o}function c(e,t,i){if(e.zoomLevel<e.minZoomLevel)return void(e.viewportTiles=new Set);const n=(0,o.uZ)(e.zoomLevel,e.minZoomLevel,e.maxZoomLevel),s=(0,o.uZ)(e.zoomLevel,e.minDetailLevel,e.maxDetailLevel);let a;if("globe"===e.type)a=(0,r.Bh)(t,n,e.minZoomLevel).map(r.gx);else a=(0,r.b5)(t,i,n,e.minZoomLevel,s,e.viewportPadding,e.maxZoomLevel,e.requestOddTiles).map(r.gx),t.stats.foundVisibleTilesCount=e.viewportTiles.size;e.viewportTiles=new Set(a)}function u(e){const t=Math.round((Object.keys(e.displayedMods).length+e.viewportTiles.size)*s.tiles.cacheRatio);e.tileModsCacheMaxCount<t&&(e.tileModsCacheMaxCount=t),t>e.tileModsCacheMaxCount/2&&e.tileModsCache.setSize(t)}},4635:(e,t,i)=>{"use strict";i.d(t,{HM:()=>p,Rh:()=>w,TQ:()=>x,aq:()=>b,d1:()=>y,e:()=>_,eh:()=>u,ej:()=>h,lH:()=>f,uk:()=>g,w1:()=>m,y7:()=>v});var n=i(6490),o=i(9833),r=i(6392),s=i(3429),a=i(462),l=i(1683),d=i(9218),c=i(647);function u(e){const t=e.viewportTiles;for(const t in e.tiles)(0,o.bt)(e.tiles[t]);for(const i of t){let t=e.tiles[i];t||(t=e.tiles[i]=(0,o.Tp)(e.type,(0,r.cL)(i),e.sourceId,e.tileLayerId));const n=new c.l(e.selectedIds,e.styleState,t.revision,e.styleId,e.styleRevision);(0,o.a7)(t,n,e.tileModsCache)}}function h(e,t){for(const i of t){const t=e[i],n=(0,o.hW)(t);if(!n||!n.ready)return!1}return!0}function m(e){const t=[];for(const i in e.tiles){const n=e.tiles[i];n.needFetch&&(n.needFetch=!1,t.push(n))}return t}function f(e){const t=[];for(const i in e.tiles){const n=e.tiles[i];n.needAbortFetch&&(n.needAbortFetch=!1,t.push(n))}return t}function _(e){const t=[];for(const i in e.tiles){const n=e.tiles[i];n.needGenerate&&(n.needGenerate=!1,t.push(n))}return t}function p(e){const t=e.viewportTiles,i=new Set(e.tileModsCache.getData().map((e=>e.tile))),n=[];for(const r in e.tiles){const s=e.tiles[r];!(0,o.LC)(s)||t.has(r)||e.zoomDirection!==a.Y.Stationary||i.has(s)||n.push(s)}return n}function v(e,t,i,n,o,r,d,c,u,h,m=0,f=!1){return{type:e,sourceId:t,tileLayerId:i,styleId:u.handyStyleId,styleRevision:c.styleManager.getStyleRevision(u.handyStyleId),styleState:u.styleState,minZoomLevel:n,maxZoomLevel:o,minDetailLevel:r,maxDetailLevel:d,tiles:{},viewportTiles:new Set,zoomLevel:g(e,u.zoom,u.styleZoom),zoomDirection:a.Y.Stationary,zoomStartZoom:0,tileModsCache:new s.L(0,((e,t)=>{var i;c.labeler.removeLabels(t.labelsKey),null===(i=t.objects)||void 0===i||i.forEach((e=>c.tileManager.removeObject(e))),(0,l.Bp)(t,u)})),tileModsCacheMaxCount:0,selectedIds:[],displayedMods:{},tilesAppearance:a.W.ByOne,mapState:u,stopLabelAnimation:!1,viewportPadding:m,displayStats:{matched:0,shifted:0,parent:0,children:0},requestOddTiles:f,ids:h}}function g(e,t,i){return"raster"===e?Math.round(t):Math.floor(i)}function y(e){for(const t in e.tiles)(0,o.QT)(e.tiles[t],e.mapState);e.tiles={},e.viewportTiles=new Set,e.zoomDirection=a.Y.Stationary,e.tileModsCache.reset(),e.displayedMods={},e.tilesAppearance=a.W.ByOne}function b(e,t,i,o,s=!1){const{tileManager:a,renderer:l}=e,c=i.displayedMods,u=(0,n.$X)(c,o);u.forEach((e=>{if(void 0!==e.objects){let i=!s;for(const t in o)if((0,r.HL)(e.tile,o[t].tile)){i=!1;break}e.objects.forEach((e=>{a.addObject(e),i&&e.startTicker(t,d.tileAnimation.type,d.tileAnimation.time,0,1)}))}}));const h=(0,n.$X)(o,c);h.forEach((e=>{var t;void 0!==e.objects&&(e.objects.forEach((e=>{a.removeObject(e)})),null===(t=e.tile.hover)||void 0===t||t.tileObjects.forEach((e=>a.removeObject(e))))}));const m=u.length>0||h.length>0;return m&&(t.needLabeling=!0,l.addRerenderEvent()),m}function x(e){e.viewportTiles.forEach((t=>(0,o.bg)(e.tiles[t])))}function w(e){switch(e){case"geojson":return 3;case"raster":return 1/0}return 2}},9833:(e,t,i)=>{"use strict";i.d(t,{IF:()=>h,LC:()=>_,NQ:()=>I,QT:()=>p,Tp:()=>u,U9:()=>v,_v:()=>f,a7:()=>b,b9:()=>M,bg:()=>S,bt:()=>y,hW:()=>g,nR:()=>T,qC:()=>w,z3:()=>n});var n,o=i(1683),r=i(6392),s=i(4265),a=i(9218),l=i(647),d=i(2153),c=i(1359);function u(e,t,i,o){return{type:e,sourceId:i,key:(0,r.gx)(t),labelsKey:`${e}_${i}_${o}`,coords:t,zoomLevel:t[2],detailLevel:t[3],needFetch:!1,revision:0,needAbortFetch:!1,needGenerate:!1,status:n.Initial,oldHoverTileObjects:[]}}function h(e,t,i,n,o,r){const l=[];i.oldHoverTileObjects.forEach((i=>{i.tickerFinished(t)?(e.tileManager.removeObject(i),i.clean(t)):l.push(i)})),i.oldHoverTileObjects=l,void 0!==o?t.performanceCaveatEmitted||!r&&i.hover&&i.hover.id!==o||function(e,t,i,n,o){if(!i.idSet||!i.idSet.has(n)||!function(e,t){const i=Math.min(Math.floor(e.styleZoom),a.tiles.maxDetailLevel),n=t.coords[3];return i===n}(t,i))return void m(e,i,t);const r=e.identifier.getIdScope(c.JQ);if(r.isHidden(n,c.Rv.PolygonExtrusion))return;(function(e,t,i,n){const o=t.newMod||t.currentMod,r=(null==o?void 0:o.params.getSelectedIds())||[],s=e.map.state;return e.defaultSource.generateHoverTile(s,t.coords,s.handyStyleId,r,self.devicePixelRatio,{},i,n)})(e,i,n,o).then((o=>{m(e,i,t);const l={id:n,tileObjects:[],generatedData:[]},c=[];o.results.forEach((n=>{const o=new s.W("hover",n.collectorOutput.data,e,t,i.coords,void 0,r),{packedRasters:d,rastersToLoad:u}=n.collectorOutput;void 0!==d&&e.assetManager.prepareRasters(n.styleId,d),e.assetManager.loadRasters(u),l.tileObjects.push(o),e.tileManager.addObject(o),o.startTicker(t,a.houseHover.inAnimationType,a.houseHover.inAnimationTime,0,1),n.collectorOutput.labels.length&&c.push({metatileHash:n.metatileHash,labels:n.collectorOutput.labels,styleId:n.styleId})})),l.generatedData=o.results,e.labeler.addLabels("label_hover",d.AL.Tile,c),e.identifier.debouncedFillCache(),i.hover=l}))}(e,t,i,o,n):m(e,i,t)}function m(e,t,i){t.hover&&(t.hover.tileObjects.forEach((e=>{t.oldHoverTileObjects.push(e),e.startTicker(i,a.houseHover.outAnimationType,a.houseHover.outAnimationTime,1,0)})),t.hover=void 0,e.labeler.removeLabels("label_hover"),e.identifier.debouncedFillCache())}function f(e){if(e.newMod&&e.newMod.needGenerate)return e.newMod.needGenerate=!1,e.newMod}function _(e){return(!e.currentMod||(0,o.jW)(e.currentMod))&&(!e.newMod||(0,o.jW)(e.newMod))}function p(e,t){e.currentMod&&(0,o.Bp)(e.currentMod,t),e.newMod&&(0,o.Bp)(e.newMod,t)}function v(e){e.currentMod=void 0}function g(e){return e.currentMod&&e.currentMod.useful?e.currentMod:e.newMod&&e.newMod.useful?e.newMod:void 0}function y(e){e.currentMod&&(e.currentMod.useful=!1),e.newMod&&(e.newMod.useful=!1)}function b(e,t,i){if(e.idSet&&t.setTileIds(e.idSet),e.currentMod||e.newMod){if(e.currentMod){if(l.l.equal(e.currentMod.params,t))return e.currentMod.useful=!0,void(e.newMod=void 0)}if(e.newMod){l.l.equal(e.newMod.params,t)?e.newMod.useful=!0:x(e,t,i)}else x(e,t,i)}else x(e,t,i)}function x(e,t,i){const n=(0,r.vl)(e.coords,t),s=i.get(n);s?(e.newMod=s,e.newMod.useful=!0):(e.newMod=(0,o.es)(e,n,t),e.idSet&&e.newMod.params.setTileIds(e.idSet))}function w(e,t,i,r,s){switch(e.status){case n.Initial:e.newMod&&e.newMod.useful&&(e.status=n.Loading,e.needFetch=!0);break;case n.Loading:e.newMod&&e.newMod.useful?e.serverMetadata&&(e.status=n.Loaded):(e.status=n.Initial,e.needAbortFetch=!0);case n.Loaded:}e.currentMod&&(0,o.zL)(e.currentMod,t,i,r,s),e.newMod&&((0,o.zL)(e.newMod,t,i,r,s),e.newMod.needGenerate&&(e.needGenerate=!0))}function S(e){e.newMod&&e.newMod.ready&&(e.currentMod=e.newMod,e.newMod=void 0)}function M(e){const t=new Set;return e.forEach((e=>{const{idBuffer:i,orphanIds:n}=e.collectorOutput.identifyIds;for(const e of i)t.add(e);for(const e of n)t.add(e)})),t}function I(e){e.status===n.Loading&&(e.needAbortFetch=!0),e.status=n.Initial,e.serverMetadata=void 0,e.revision++}function T(e){e.revision++}!function(e){e[e.Initial=0]="Initial",e[e.Loading=1]="Loading",e[e.Loaded=2]="Loaded"}(n||(n={}))},7619:(e,t,i)=>{"use strict";i.d(t,{I:()=>y});var n=i(6392),o=i(9311),r=i(9833),s=i(1683),a=i(2153),l=i(4635),d=i(4288),c=i(1285),u=i(462);function h(e){e.tilesAppearance=u.W.WaitingLayer,e.stopLabelAnimation=!0,Object.keys(e.tiles).forEach((t=>{(0,r.NQ)(e.tiles[t])})),(0,l.eh)(e)}var m=i(6874);function f(e){e.tilesAppearance=u.W.WaitingLayer,Object.keys(e.tiles).forEach((t=>{(0,r.nR)(e.tiles[t])})),(0,l.eh)(e)}var _=i(309),p=i(3187),v=i(1359),g=i(7407);class y{constructor(e,t,i,n,o,r,s,a={}){var d;this.disabledRegions=null,this.generatingCount=0,this.tilesGenerationQueue=[],this.disableTilesAnimation=!1,this.idsToUpdate=new Set,this.destroyed=!1,a=Object.assign({viewportPadding:0,disableTilesAnimation:!1,requestOddTiles:!1},a),this.ids=o.identifier.getIdScope(null!==(d=a.idScope)&&void 0!==d?d:v.JQ),this.ids.registerTileLayer(this),this.modules=o,this.mapState=r,this.prevStyleState=r.styleState,this.sourceCore=s,this.id=(0,m.fD)(),this.disableTilesAnimation=!!a.disableTilesAnimation,this.gridState=(0,l.y7)(s.type,s.id,this.id,e,t,i,n,o,this.mapState,this.ids,a.viewportPadding,a.requestOddTiles),this.maxGeneratingCount=(0,l.Rh)(s.type)}memSizeJs(){const e=this.gridState;return{gridState:{displayedMods:Object.keys(e.displayedMods).map((t=>(0,p.gt)(e.displayedMods[t]))),tileModsCache:e.tileModsCache.keys().filter((t=>!e.displayedMods[t])).map((t=>(0,p.gt)(e.tileModsCache.get(t))))}}}memSizeGpu(){const e=this.gridState;return{gridState:{displayedMods:Object.keys(e.displayedMods).map((t=>(0,p.LO)(e.displayedMods[t]))),tileModsCache:e.tileModsCache.keys().filter((t=>!e.displayedMods[t])).map((t=>(0,p.LO)(e.tileModsCache.get(t))))}}}destroy(){this.destroyed=!0,(0,l.d1)(this.gridState),this.modules.modelsScene.clearSourceTileMapBySource(this.sourceCore.id),this.ids.unregisterTileLayer(this)}redraw(){(0,l.d1)(this.gridState),this.modules.modelsScene.clearSourceTileMapBySource(this.sourceCore.id),(0,o.o)(this.gridState,this.mapState,this.modules)}getZoomDirection(){return this.gridState.zoomDirection}getDisplayedTileObjects(){const e=[];for(const t in this.gridState.displayedMods){const i=this.gridState.displayedMods[t];i.objects&&e.push(...i.objects)}return e}getDisplayedIdentifyData(){var e,t;const i=[];for(const n in this.gridState.displayedMods){const o=this.gridState.displayedMods[n];null===(e=o.generatedData)||void 0===e||e.concat((null===(t=o.tile.hover)||void 0===t?void 0:t.generatedData)||[]).forEach((e=>i.push({ids:e.collectorOutput.identifyIds,metatileHash:e.metatileHash,sourceId:o.tile.sourceId,tileKey:o.tile.key})))}return i}getLabelingData(){const e={sourceId:this.gridState.sourceId,animate:!this.gridState.stopLabelAnimation,labelsKeys:[]};for(const t in this.gridState.displayedMods){const i=this.gridState.displayedMods[t];e.labelsKeys.push(i.labelsKey)}return this.gridState.stopLabelAnimation&&this.viewportTilesReady()&&(this.gridState.stopLabelAnimation=!1),e}getViewportTiles(){const e=[],t=this.gridState.viewportTiles;for(const i of t){const t=this.gridState.tiles[i];t&&e.push(t)}return e}viewportTilesReady(){return(0,l.ej)(this.gridState.tiles,this.gridState.viewportTiles)}isEmpty(){return 0===this.gridState.viewportTiles.size}displayedTilesAnimationFinished(){for(const e in this.gridState.displayedMods){const t=this.gridState.displayedMods[e];if(t.objects)for(const e of t.objects)if(!e.tickerFinished(this.mapState))return!1}return!0}activateStyleUpdating(){(0,c.I2)(this.gridState,this.mapState.handyStyleId,this.modules.styleManager.getStyleRevision(this.mapState.handyStyleId),this.modules.map.core.getIsFirstStyleUpdate())}finishStyleUpdating(){(0,c.cA)(this.gridState)}setSelectedIds(e){(0,c.YY)(this.modules,this.mapState,this.gridState,e)}setHoverId(e){(0,c.bj)(this.modules,this.mapState,this.gridState,e)}resetHoverId(){(0,c.bj)(this.modules,this.mapState,this.gridState)}onSourceDataChange(){h(this.gridState)}onFeatureStateMapChange(){f(this.gridState)}getTileCount(){let e=0;for(const t in this.gridState.displayedMods){const i=this.gridState.displayedMods[t].objects;void 0!==i&&(e+=i.length)}return e}isBlank(){for(const e of this.gridState.viewportTiles){const t=this.gridState.tiles[e],{serverMetadata:i}=t;if(void 0===i||0===i.length)continue;const n=(0,r.hW)(t);if(n&&n.ready)return!1}return!0}updateViewport(){(0,o.o)(this.gridState,this.mapState,this.modules)}update(){this.mapState.needReplicasUpdate&&this.setModObjectsSyncNecessity();const e=Object.assign({},this.gridState.displayedMods);this.mapState.styleState!==this.prevStyleState&&((0,c.TZ)(this.gridState,this.mapState.styleState),this.prevStyleState=this.mapState.styleState,this.modules.identifier.debouncedFillCache()),(0,d.r)(this.gridState,this.mapState,this.modules);const{demManager:t,labeler:i}=this.modules;!function(e,t,i){for(const n of e.viewportTiles){const o=e.tiles[n],l=(0,r.hW)(o);if(!l)continue;const d=(0,s.Hd)(l);if(0===d.length)continue;const c=t.getLabelsDemKey(d);l.demKey!==c&&(l.demKey=c,i.addTileLabels(l.labelsKey,a.AL.Tile,d))}}(this.gridState,t,i),this.fetch((0,l.w1)(this.gridState)),this.abortFetch((0,l.lH)(this.gridState)),this.generate((0,l.e)(this.gridState)),this.clearTiles((0,l.HM)(this.gridState)),(0,l.aq)(this.modules,this.mapState,this.gridState,e,this.disableTilesAnimation),this.updateVisibility()}pushIdsToUpdate(e){e.forEach((e=>this.idsToUpdate.add(e)))}getSourceType(){return this.sourceCore.type}fetch(e){if(0===e.length)return;const t=e.sort(((e,t)=>(0,n.qu)(this.mapState.center,e,t))).map((e=>e.coords));this.sourceCore.fetchTiles(t,this.mapState).forEach(((t,i)=>{t.then((t=>{const n=e[i];n.status===r.z3.Loading&&(n.serverMetadata=t)}))}))}abortFetch(e){0!==e.length&&this.sourceCore.abortTileFetches(e.map((e=>e.coords)))}updateGenerationQueue(){if(this.destroyed)return;if(this.generatingCount>this.maxGeneratingCount)return;const e=this.getTileToGenerate();if(!e)return;++this.generatingCount;const{tile:t,mod:i}=e,o={tileCoords:t.coords,selectedIds:i.params.getSelectedIds(),styleId:i.params.styleId},l=this.disabledRegions,d={areTileBoundsVisible:this.mapState.showDefaultTileBounds};this.sourceCore.generateTile(this.mapState,o.tileCoords,o.styleId,o.selectedIds,devicePixelRatio,d).then((e=>{if(!e)return void(0,_.wm)(this.sourceCore.type);if(!Array.isArray(e.results))return;let{results:d}=e;l&&(d=d.filter((e=>!l.includes(e.regionId))));const c=new Map;if(d.forEach((e=>{e.collectorOutput.data.forEach((e=>{"gltfModel"===e.symbol&&"instances"===e.sink&&e.generatedObjects.forEach((e=>{var t;const i=g.m.sinks.instances.unpackObjectAttributes(e.attributes),n=null===(t=e.meta)||void 0===t?void 0:t.childrenIds,o=i.parentId;if(!n||!o)return;let r=c.get(o);r||(r=new Set,c.set(o,r));for(const e of n)r.add(e)}))}))})),c.size){const e=(0,n.gx)(o.tileCoords);this.ids.updateParentChildrenData(e,c)}d.forEach((e=>{const{styleId:t,metatileHash:i,regionId:n,collectorOutput:o}=e,{packedRasters:r,rastersToLoad:s,floorHidingMap:a,dataModelsUrls:l}=o;void 0!==r&&this.modules.assetManager.prepareRasters(t,r),this.modules.assetManager.fillDataModelUrlMap(l),this.modules.assetManager.loadRasters(s),this.modules.floorManager.prepareFloors(n,i,a,this.sourceCore.type)})),t.idSet=(0,r.b9)(d),(0,s.aK)(i,d,t.idSet),this.modules.labeler.addTileLabels(i.labelsKey,a.AL.Tile,(0,s.Hd)(i))})).finally((()=>{this.generatingCount=this.generatingCount-1,this.updateGenerationQueue()}))}getTileToGenerate(){this.tilesGenerationQueue.sort(((e,t)=>(0,n.qu)(this.mapState.center,e,t)));let e=this.tilesGenerationQueue.shift();for(;e;){const t=(0,r._v)(e);if(t){if(t.useful)return{mod:t,tile:e};e.newMod=void 0}e=this.tilesGenerationQueue.shift()}return null}addTileToGenerationQueue(e){this.tilesGenerationQueue.push(e)}generate(e){let t=!1;e.sort(((e,t)=>(0,n.qu)(this.mapState.center,e,t))).forEach((e=>{var i;(null===(i=e.newMod)||void 0===i?void 0:i.needGenerate)&&!this.tilesGenerationQueue.includes(e)&&(this.addTileToGenerationQueue(e),t=!0)})),t&&this.updateGenerationQueue()}clearTiles(e){if(!e.length)return;const t=[];this.modules.modelsScene.clearSourceTileMapByTiles(this.sourceCore.id,e),this.sourceCore.deleteTiles(e.map((e=>e.coords)));for(const i of e)t.push(i.key),delete this.gridState.tiles[i.key];this.ids.removeParentChildrenData(t)}updateVisibility(){if(0===this.idsToUpdate.size)return;const e=[];this.gridState.tileModsCache.getData().forEach((t=>{t.objects&&t.objects.forEach((t=>{e.push(t)}))})),0!==e.length&&this.updateObjectsVisibility(e)}updateObjectsVisibility(e){let t=!1;for(const i of this.idsToUpdate){const n=Number(!this.ids.isHidden(i,v.Rv.PolygonExtrusion)),o=Number(!this.ids.isHidden(i,v.Rv.FloorPolygons));for(const r of e)r.updateObjVisibility(i,n,!1)&&(t=!0),r.updateObjVisibility(i,o,!0)&&(t=!0)}this.idsToUpdate.clear(),t&&(this.modules.renderer.addRerenderEvent(),this.modules.identifier.debouncedFillCache())}setModObjectsSyncNecessity(){this.gridState.tileModsCache.getData().forEach((e=>{var t;null===(t=e.objects)||void 0===t||t.forEach((e=>{e.needSync=!0}))}))}}},1683:(e,t,i)=>{"use strict";i.d(t,{Bp:()=>d,Hd:()=>l,aK:()=>a,es:()=>s,jW:()=>c,zL:()=>u});var n,o=i(4265),r=i(9218);function s(e,t,i){return{key:t,labelsKey:`${e.labelsKey}_${t}`,useful:!0,ready:!1,needGenerate:!1,tile:e,status:n.Initial,params:i.clone()}}function a(e,t,i){e.generatedData=t,i&&e.params.setTileIds(i)}function l(e){const t=e.generatedData,i=[];if(!t)return i;for(let e=0;e<t.length;e++){const n=t[e];n.collectorOutput.labels&&i.push({metatileHash:n.metatileHash,labels:n.collectorOutput.labels,styleId:n.styleId})}return i}function d(e,t){e.status=n.Initial,e.generatedData=void 0,void 0!==e.objects&&e.objects.forEach((e=>e.clean(t))),e.objects=void 0,e.ready=!1,e.tile.currentMod===e&&(e.tile.currentMod=void 0)}function c(e){return e.status===n.Initial}function u(e,t,i,s,a){switch(e.status){case n.Initial:e.useful&&(e.status=n.Loading);break;case n.Loading:e.useful?e.tile.serverMetadata&&(e.status=n.Loaded):e.status=n.Initial;break;case n.Loaded:(function(e,t,i){switch(e.tile.type){case"zenith":return Boolean(e.useful&&e.tile.serverMetadata&&function(e,t,i){const{assetManager:n,modelLayer:o}=i;for(let i=0;i<e.length;i++){const{regionId:s,metatileHash:a}=e[i];if(!n.getMetatile(a)||t.styleZoom>r.loadModelsInfoStyleZoom&&!o.isModelsInfoLoaded(s))return!1}return!0}(e.tile.serverMetadata,t,i));case"traffic":return Boolean(e.useful&&e.tile.serverMetadata);case"raster":case"geojson":case"globe":case"dem":return Boolean(e.useful);default:return!1}})(e,i,s)&&(e.status=n.Generating,e.needGenerate=!0);break;case n.Generating:e.generatedData&&(e.status=n.Generated,e.ready=!0,e.objects=e.generatedData.map((t=>{const{collectorOutput:{data:n}}=t;return new o.W(e.tile.type,n,s,i,e.tile.coords,void 0,a,e.tile.sourceId)})),t.add(e.key,e))}}!function(e){e[e.Initial=0]="Initial",e[e.Loading=1]="Loading",e[e.Loaded=2]="Loaded",e[e.Generating=3]="Generating",e[e.Generated=4]="Generated"}(n||(n={}))},647:(e,t,i)=>{"use strict";i.d(t,{l:()=>o});var n=i(6490);class o{constructor(e,t,i,n,o){this.selectedIds=e.slice(),this.styleState=Object.assign({},t),this.tileRevision=i,this.styleRevision=o,this.styleId=n}static equal(e,t){return e.tileRevision===t.tileRevision&&e.styleId===t.styleId&&e.styleRevision===t.styleRevision&&(0,n.vZ)(e.getSelectedIds(),t.getSelectedIds())&&(0,n.vZ)(e.styleState,t.styleState)}clone(){return new o(this.selectedIds,this.styleState,this.tileRevision,this.styleId,this.styleRevision)}stringify(){const e=this.selectedIds.join("|");return`sId=${this.styleId}_sRev=${this.styleRevision}_tRev=${this.tileRevision}_sel=${e}_sSt=${JSON.stringify(this.styleState)}`}getSelectedIds(){return this.tileIds?this.selectedIds.filter((e=>{var t;return null===(t=this.tileIds)||void 0===t?void 0:t.has(e)})):this.selectedIds.slice()}setTileIds(e){this.tileIds=e}}},4265:(e,t,i)=>{"use strict";i.d(t,{W:()=>u,Y:()=>c});var n=i(127),o=i(9450),r=i(6392),s=i(6757),a=i(6273),l=i(1684);let d=0;class c{constructor(e,t){this.isDestroyed=!1,this.id=d++,this.ids=t,this.tickerName=`tile-fade-${e}-${this.id}`,this.readiness=1,this.needSync=!1,this.modelMatrices=new Map,this.coords=[0,0,0,0],this.bounds=new Map,this.mvpMatrices=new Map,this.demMatrices=new Map,this.flatMapTexMatrices=new Map,this.purpose=e,this.buffers=[],this.children=[],this.identifyChildren=[],this.depthTestChildren=[],this.shadowChildren=[],this.labelTestChildren=[]}get destroyed(){return this.isDestroyed}get empty(){return 0===this.children.length}updateMvpMatrix(e,t,i){this.modelMatrices.forEach(((o,r)=>{var s,a,l;const d=null!==(s=this.mvpMatrices.get(r))&&void 0!==s?s:new Float32Array(16);if(n.dC(d,e,o),this.mvpMatrices.set(r,d),t){const e=null!==(a=this.demMatrices.get(r))&&void 0!==a?a:new Float32Array(16);n.dC(e,t,o),this.demMatrices.set(r,e)}if(i){const e=null!==(l=this.flatMapTexMatrices.get(r))&&void 0!==l?l:new Float32Array(16);n.dC(e,i,o),this.flatMapTexMatrices.set(r,e)}}))}setMvpMatrix(e){this.modelMatrices.forEach(((t,i)=>{this.mvpMatrices.set(i,new Float32Array(e))}))}clean(e){for(const e of this.buffers)e.remove();this.buffers=[],this.children=[],this.labelTestChildren=[],this.identifyChildren=[],this.depthTestChildren=[],this.shadowChildren=[],l.sT(this.tickerName,e),this.isDestroyed=!0}updateTicker(e){l.Vx(this.tickerName,{step:(e,t)=>{this.readiness=t}},e)}startTicker(e,t,i,n,o){l.BL(this.tickerName,{easing:t},e,n,o,i,1)}tickerFinished(e){return!l.rS(this.tickerName,e)}push(e){const t=e.layerSettings;t.identify?this.identifyChildren.push(e):t.depthTest?this.depthTestChildren.push(e):t.labelTest?"raster"===e.sink&&"point"===e.symbol&&this.labelTestChildren.push(e):t.shadow?this.shadowChildren.push(e):this.children.push(e)}pushBuffer(e){this.buffers.push(e)}}class u extends c{constructor(e,t,i,n,o=[0,0,0,0],r,a,l){super(e,a),this.objectsMap={},this.floorObjectsMap={},this.dynamicObject=r,this.sourceId=l,(0,s.l)(i,t,this,a),this.setTileCoords(o,n)}setTileCoords(e,t){const i=e[2],n=e[3],o=(0,r.aq)(i);this.coords=e,this.size=o,this.zoomLevel=i,this.detailLevel=n,this.mvpMatrices.clear(),this.demMatrices.clear(),this.flatMapTexMatrices.clear(),this.syncReplicas(t)}syncReplicas(e){let t=[...e.visibleMapReplicas];if("globe"===this.purpose){const{center:i}=e,n=(0,r.aq)(this.coords[2]),o=Math.trunc((Math.pow(2,31)+i[0])/n);t=[Math.round((o-this.coords[0])/Math.pow(2,this.coords[2]))]}if(this.dynamicObject&&this.dynamicObject.isOutOfMainReplica()){const e=t[0],i=t[t.length-1];t.push(e-1,i+1)}const i=a.jO/a.Bq*this.size,s=Math.pow(2,this.coords[2]);this.bounds.clear(),this.modelMatrices.clear(),t.forEach((e=>{const t=[this.coords[0]+e*s,this.coords[1],this.coords[2],this.coords[3]],l=(0,r.Oy)(t);this.bounds.set(e,{min:[l[0],l[1]],max:[l[0]+this.size,l[1]+this.size]});const d=n.Ue();n.wA(d,[l[0]-i,l[1]-i,0],o.al(this.size/a.gt,this.size/a.gt,a._9/a.gt)),this.modelMatrices.set(e,d)})),this.needSync=!1}updateObjVisibility(e,t,i){const n=i?this.floorObjectsMap[e]:this.objectsMap[e];if(!n)return!1;let o=!1;return n.forEach(((e,i)=>{const n=i[0].getBuffer("a_float_visibility").getData();if(!(n instanceof Uint8Array))return;let r=!1;for(const{offset:i,size:o}of e)if(n[i]!==t){for(let e=i;e<i+o;++e)n[e]=t;r=!0}if(r){i[0].rewriteData("a_float_visibility");for(const e of i)e.isDirty=!0;o=!0}})),o}clean(e){for(const e in this.objectsMap)this.objectsMap[e].forEach(((e,t)=>{t.forEach((e=>{e.unbind(),e.remove()}))}));for(const e in this.floorObjectsMap)this.floorObjectsMap[e].forEach(((e,t)=>{t.forEach((e=>{e.unbind(),e.remove()}))}));super.clean(e)}}},4693:(e,t,i)=>{"use strict";var n,o;i.d(t,{N:()=>n,m:()=>o}),function(e){e[e.None=0]="None",e[e.Zoom=1]="Zoom",e[e.Distance=2]="Distance"}(n||(n={})),function(e){e[e.default=0]="default",e[e.flat=1]="flat",e[e.axis=2]="axis",e[e.centroid=3]="centroid"}(o||(o={}))},5600:(e,t,i)=>{"use strict";function n(e){return e}i.d(t,{D:()=>n})},2153:(e,t,i)=>{"use strict";var n,o,r,s,a;i.d(t,{AL:()=>r,Dl:()=>a,_r:()=>o,a_:()=>n,m3:()=>s}),function(e){e[e.Common=0]="Common",e[e.Commercial=1]="Commercial",e[e.CommercialCity=2]="CommercialCity",e[e.CommercialPremium=3]="CommercialPremium",e[e.Landmark=4]="Landmark"}(n||(n={})),function(e){e[e.Point=0]="Point",e[e.Line=1]="Line"}(o||(o={})),function(e){e[e.Tile=0]="Tile",e[e.Floor=1]="Floor",e[e.DynamicObject=2]="DynamicObject",e[e.PersonalPoi=3]="PersonalPoi"}(r||(r={})),function(e){e[e.Dead=0]="Dead",e[e.Alive=1]="Alive",e[e.Unused=2]="Unused",e[e.CommercialAlive=3]="CommercialAlive",e[e.CommercialDead=4]="CommercialDead"}(s||(s={})),function(e){e[e.Text=0]="Text",e[e.Icon=1]="Icon",e[e.PoiText=2]="PoiText",e[e.PoiText2=3]="PoiText2",e[e.OneWayLine=4]="OneWayLine",e[e.LineText=5]="LineText",e[e.Box=6]="Box"}(a||(a={}))},3024:(e,t,i)=>{"use strict";var n;function o(e){switch(e){case"chess":return n.Chess;case"doubledash":return n.DoubleDash;case"triangles":return n.Triangles;case"circle":return n.Circle;case"heart":return n.Chevron;case"stripe":return n.Stripe;default:return n.None}}i.d(t,{R:()=>o,y:()=>n}),function(e){e[e.Chess=1]="Chess",e[e.DoubleDash=2]="DoubleDash",e[e.Stripe=3]="Stripe",e[e.Triangles=4]="Triangles",e[e.Circle=5]="Circle",e[e.Chevron=6]="Chevron",e[e.None=-1]="None"}(n||(n={}))},6479:(e,t,i)=>{"use strict";var n;i.d(t,{f:()=>n}),function(e){e[e.Static=0]="Static",e[e.Unique=1]="Unique",e[e.Loaded=2]="Loaded"}(n||(n={}))},878:(e,t,i)=>{"use strict";var n;i.d(t,{H:()=>n}),function(e){e[e.Tile=0]="Tile",e[e.Custom=1]="Custom"}(n||(n={}))},462:(e,t,i)=>{"use strict";var n,o;i.d(t,{W:()=>o,Y:()=>n}),function(e){e[e.Stationary=0]="Stationary",e[e.ZoomingIn=1]="ZoomingIn",e[e.ZoomingOut=2]="ZoomingOut"}(n||(n={})),function(e){e[e.ByOne=0]="ByOne",e[e.WaitingLayer=1]="WaitingLayer",e[e.GlobalWaiting=2]="GlobalWaiting"}(o||(o={}))},5095:(e,t,i)=>{"use strict";function n(e,t){const i=new XMLHttpRequest;if(i.open("GET",e.url,!0),i.responseType="arraybuffer",e.headers)for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);return i.onerror=function(){t({status:0,message:"Network error"},new ArrayBuffer(0))},i.onload=function(){i.status>=200&&i.status<300&&i.response?t(void 0,i.response):t({status:i.status,message:i.statusText},new ArrayBuffer(0))},i.send(),i}function o(e,t){const i=new XMLHttpRequest;if(i.open("GET",e.url,!0),e.headers)for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);return i.onerror=function(){t({status:0,message:"Network error"},{})},i.onload=function(){if(i.status>=200&&i.status<300){if(!i.response||!i.response.length)return t({status:204,message:"No content"},{});let n;try{n=JSON.parse(i.response),t(void 0,n)}catch(i){t({status:0,message:`Json parse data error from url ${e.url}`},{})}}else t({status:i.status,message:i.statusText},{})},i.send(),i}function r(e){return!!e&&(e>=500&&e<=599)}i.d(t,{LK:()=>o,UG:()=>r,nx:()=>n})},9865:(e,t,i)=>{"use strict";function n(e){return Array.isArray(e)?e:[e]}function o(e){return e&&e.buffer instanceof ArrayBuffer}i.d(t,{f:()=>o,l:()=>n})},7966:(e,t,i)=>{"use strict";i.d(t,{As:()=>f,HB:()=>x,U0:()=>h,bX:()=>d,fb:()=>l,gA:()=>c,mN:()=>u,sD:()=>v,z:()=>_});var n=i(6392),o=i(2435),r=i(7464),s=i(2543),a=i(7486);function l(e,t,i){return(0,o.IG)(i.fontUrlTemplate,{name:e,range:String(t)})}function d(e,t,i){const n=v(e)?e:g(t.iconBaseUrl,e);return(0,o.IG)(n,{subdomain:i,appHost:window.location.host})}function c(e,t){return v(e)?e:g(t.modelsBaseUrl,e)}function u(e,t,i){return v(e)?e:t?/{\w+}/g.test(t)?(0,o.XK)(t,{modelSrc:e,subdomain:(0,n.Kn)(i)}):g(t,e):e}function h(e,t,i){return e.replace("image",`image_${t}x${i}`)}const m=/_i$/;function f(e,t){const i=v(t.fontsPath)?t.fontsPath:g(t.rootUrl,t.fontsPath);e.fontUrlTemplate=g(i,"{name}_{range}.pbf"),e.iconBaseUrl=v(t.iconsPath)?t.iconsPath:g(t.rootUrl,t.iconsPath),e.modelsBaseUrl=v(t.modelsPath)?t.modelsPath:g(t.rootUrl,t.modelsPath)}function _(e){return v(e.stylePath)?e.stylePath:g(e.rootUrl,e.stylePath)}const p=new RegExp("^(?:(?:[a-z]+:)?(?:[a-z]+:)?//|data:)","i");function v(e){return p.test(e)}function g(...e){const t=e.filter((e=>e.length>0));let i=t[0];for(let e=1;e<t.length;e++){"/"!==i[i.length-1]&&(i+="/");const n=t[e];"/"===n[0]?i+=n.slice(1):i+=n}return i}function y(e,t,i){const n=(0,r.pV)(i.style.iconAnchor),o=(0,r.PR)(e,n[0],n[1]);return t.rasterSets.byKey[o]}function b(e,t,i,n){const r=y(n.replace(m,""),t,i);if(!r)return;const s=t.icons[r.name];return s?d(s.url,t,(0,o.Sy)(e.map.state.subdomains,r.name)):void 0}function x(e,t,i){const n=e.styleManager.getStyle(e.map.state.handyStyleId);if(!n)return;const l=n.layersById[t.layerId];if(!l)return;const c=(0,s.jJ)(e.map.state.styleZoom,e.map.state.styleState,[]);let u;const f=l.style.iconWidth,_=(0,s.vn)(f,c);if(i.isCommercial){u=n.rasterSets.byKey[(0,r.zV)(t.id,"commercial")];const e=u.url;if(!e)return;const i=(0,a.Bl)(u.rasters,_*window.devicePixelRatio,!0);if(void 0===i)return;const{w:o,h:s}=u.rasters[i];return{baseUrl:e,fullUrl:h(e,o,s),width:o,height:s}}const p=l.style.iconImage;if(!p)return;const v=(0,s.Q9)(p,c);if(u=y(v,n,l),!u)return;const g=function(e,t,i,n){const r=t.icons[i.name];if(!r)return;const s=(0,a.Bl)(i.rasters,n*window.devicePixelRatio,!0);if(void 0===s)return;const l=d(r.url,t,(0,o.Sy)(e.map.state.subdomains,i.name)),{w:c,h:u}=i.rasters[s];return{fullUrl:l,width:c,height:u}}(e,n,u,_);if(g){if(function(e){return m.test(e)}(v)){const t=b(e,n,l,v);void 0!==t&&(g.fullUrlUnhovered=t)}return g}}},1274:(e,t,i)=>{"use strict";function n(e,t,i){const n=e.getBoundingClientRect();return[t-n.left-e.clientLeft,i-n.top-e.clientTop]}function o(e,t){const i=[];for(let o=0;o<e.length;o++)i[o]=n(t,e[o].clientX,e[o].clientY);return i}function r(e){return e.touches.length>1}i.d(t,{KK:()=>o,N2:()=>r,yK:()=>n})},6490:(e,t,i)=>{"use strict";i.d(t,{$I:()=>w,$X:()=>v,AB:()=>f,FR:()=>E,Id:()=>u,Kh:()=>b,Kn:()=>A,Kv:()=>m,P_:()=>L,Rw:()=>T,TH:()=>x,Te:()=>c,VJ:()=>M,Xx:()=>d,ZY:()=>h,kn:()=>_,l4:()=>p,nw:()=>P,sB:()=>g,t7:()=>I,uZ:()=>l,vO:()=>y,vZ:()=>S});var n=i(9450),o=i(4874),r=i(8585),s=i(9218),a=i(9073);function l(e,t,i){return e=Math.max(e,t),e=Math.min(e,i)}function d(e){return 0===e||Number.isNaN(e)?e:e>0?1:-1}function c(e,t){return[t[0]/e[0]*2-1,-t[1]/e[1]*2+1]}function u(e){return e*Math.PI/180}function h(e){return e/Math.PI*180}function m(e,t,i){void 0!==i.zoom&&(i.zoom=l(i.zoom,e.minZoom,e.maxZoom));const d=Object.assign({},e);(0,a.kC)(d.center);const c=new o.V(d),u=c.unproject(t),h=r.H.fromGeo(u);i.center&&(0,a.kC)(i.center),c.setState(Object.assign(Object.assign({},e),i));const m=r.H.fromGeo(c.unproject(t));Math.abs(h[0]-m[0])>Math.pow(2,31)&&(m[0]+=(h[0]>0?1:-1)*Math.pow(2,32));const f=n.Ue();if(n.lu(f,h,m),e.globeMode&&Math.abs(u[1])>70&&e.zoom>s.globeConfig.globeInterStartZoom&&e.zoom<s.globeConfig.globeMaxZoom){const t=Math.abs(e.zoom-i.zoom);if(t>1e-4){const e=Math.abs(h[0]-m[0]),i=Math.log10(e/t),o=Math.min(1,Math.pow(10,6-i));Number.isNaN(o)||n.bA(f,f,o)}}return f}function f(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)+1}function _(e,t){const i=Object.assign({},t);for(const t in e)void 0!==e[t]&&(i[t]=e[t]);return i}function p(e){const t={};for(const i in e){t[e[i]]=i}return t}function v(e,t){const i=[];for(const n in e)t[n]||i.push(e[n]);return i}function g(e,t,i){return l((i-e)/(t-e),0,1)}function y(e){return e%1}function b(e,t,i){return e>=t&&e<=i}function x(e,t){if(e.size!==t.size)return!1;for(const i of Array.from(e))if(!t.has(i))return!1;return!0}function w(e,t){return e===t||e.length===t.length&&!e.some(((e,i)=>e!==t[i]))}function S(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const i=Array.isArray(e),n=Array.isArray(t);let o,r,s;if(i&&n){if(r=e.length,r!==t.length)return!1;for(o=r;0!=o--;)if(!S(e[o],t[o]))return!1;return!0}if(i!==n)return!1;const a=e instanceof Date,l=t instanceof Date;if(a!==l)return!1;if(a&&l)return e.getTime()===t.getTime();const d=e instanceof RegExp,c=t instanceof RegExp;if(d!==c)return!1;if(d&&c)return e.toString()===t.toString();const u=Object.keys(e);if(r=u.length,r!==Object.keys(t).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,u[o]))return!1;for(o=r;0!=o--;)if(s=u[o],!S(e[s],t[s]))return!1;return!0}return e!=e&&t!=t}function M(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}function I(e,t,i){return e+(t-e)*i}function T(e){return null==e}function E(e,t){const i=t;"number"==typeof e?i.fill(e):Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]&&(i[0]=e[0],i[1]=e[1],i[2]=e[2])}class P{constructor(e,t){this.getNewValidFor=t,this.getNewValue=e,this.currentValue=NaN,this.currentValidFor=new Array(t().length).fill(NaN)}get value(){const e=this.getNewValidFor();return this.currentValidFor.some(((t,i)=>t!==e[i]))&&(this.currentValidFor=e,this.currentValue=this.getNewValue()),this.currentValue}}function A(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function L(e){return[l((e>>24&255)/255,0,1),l((e>>16&255)/255,0,1),l((e>>8&255)/255,0,1),l((255&e)/255,0,1)]}},1375:(e,t,i)=>{"use strict";i.d(t,{I0:()=>u,cX:()=>c});i(8369),i(9218);var n=i(3249),o=i(7188),r=i(1436),s=i(8009),a=i(6273),l=i(2543),d=i(6392);function c(e,t,i){const c=a.Bq,u={x:new Uint16Array([0,c,c,0,0]),y:new Uint16Array([0,0,c,c,0])},h=(0,n.FJ)({}),m=(0,l.Yi)(i,o.i4,o.Dz,h,o.wz);(0,r.XI)({collector:e,generator:s.z.generate,args:[n.jf,t,m,(0,d.Bs)([0,0,0,0]),u]})}function u(){try{return!!localStorage.getItem("debugStatusCompile")}catch(e){return console.warn("Error accessing localStorage in forceGlStatusCheck:",e),!1}}},4576:(e,t,i)=>{"use strict";i.d(t,{dm:()=>b,rq:()=>x,JA:()=>y,Xq:()=>w});var n=i(2447),o=i(9899),r=i(7999);class s{constructor(){this.name="",this.range="",this.glyphs={}}}class a{constructor(){this.id=0,this.range=0,this.bitmap=null,this.top=0,this.left=0,this.advance=0,this.x=0,this.y=0,this.width=0,this.height=0,this.texTop=0,this.texLeft=0,this.texRight=0,this.texBottom=0}}class l{constructor(e,t){this.stacks=e.readFields(d,[],t)}}function d(e,t,i){if(1===e){const e=i.readMessage(c,new s);t.push(e)}}function c(e,t,i){switch(e){case 1:t.name=i.readString();break;case 2:t.range=i.readString();break;case 3:{const e=i.readMessage(u,new a);t.glyphs[e.id]=e;break}}}function u(e,t,i){switch(e){case 1:t.id=i.readVarint(),t.range=(0,r.rx)(t.id);break;case 2:t.bitmap=i.readBytes();break;case 3:t.width=i.readVarint()+6;break;case 4:t.height=i.readVarint()+6;break;case 5:t.left=i.readSVarint()-3;break;case 6:t.top=i.readSVarint()+17+3;break;case 7:t.advance=i.readVarint()}}var h=i(3698),m=i(6490),f=i(9218),_=i(309),p=i(2543),v=i(6273);class g{constructor(e,t,i){const n=[];let o=0;for(let i=0;i<e.length;i++){const r=e.charCodeAt(i),s=t&&t[r];s?(n.push(s),o+=s.advance):r!==f.fonts.bomCharCode&&(0,_.Q7)(e[i],r)}this.glyphs=n,this.width=o+f.fonts.baseSize*i*(e.length-1)}}function y(e,t,i){const n={lines:[],maxWidth:0},o=e.split("\n");for(let e=0;e<o.length;e++){const r=new g(o[e],i,t);n.lines.push(r),r.width>n.maxWidth&&(n.maxWidth=r.width)}return n}function b(e,t,i){for(const n of t)if(!i.has(e,n))return!1;return!0}function x(e,t,i){if(void 0===e)return;const n=(0,p.Q9)(e,t);return""!==n?void 0===i.fontNameToIndex[n]?v.Uo:n:void 0}function w(e){const t=new l(new n.Z(new Uint8Array(e))).stacks[0].glyphs,{width:i,height:r}=function(e){const t=[],i=new o.Z(512,512,{autoResize:!0}),n=Object.keys(e);for(let i=0;i<n.length;i++){const o=e[Number(n[i])];o.bitmap&&t.push({glyph:o,width:o.width,height:o.height})}i.pack(t,{inPlace:!0}),i.shrink();for(let e=0;e<t.length;e++){const i=t[e].glyph;i.x=t[e].x,i.y=t[e].y}return{width:(0,m.AB)(i.w),height:(0,m.AB)(i.h)}}(t);!function(e,t,i){const n=Object.keys(e);for(let o=0;o<n.length;o++){const r=e[Number(n[o])];r.bitmap&&(r.texTop=(0,h.Bb)(r.y/i),r.texLeft=(0,h.Bb)(r.x/t),r.texBottom=(0,h.Bb)((r.y+r.height)/i),r.texRight=(0,h.Bb)((r.x+r.width)/t))}}(t,i,r);const s=function(e,t,i){const n=new Uint8Array(t*i),o=Object.keys(e);for(let i=0;i<o.length;i++){const r=e[Number(o[i])];if(r.bitmap)for(let e=0;e<r.height;e++){const i=t*(r.y+e)+r.x,o=r.width*e;for(let e=0;e<r.width;e++)n[i+e]=r.bitmap[o+e]}}return n.buffer}(t,i,r);return{glyphData:t,bitmap:s,width:i,height:r}}},9073:(e,t,i)=>{"use strict";i.d(t,{$X:()=>U,A5:()=>h,C:()=>m,EO:()=>w,I0:()=>H,LX:()=>_,OD:()=>I,Qn:()=>P,TD:()=>f,Vv:()=>z,X$:()=>T,XV:()=>C,YG:()=>M,Z3:()=>E,_L:()=>k,a4:()=>A,es:()=>V,gr:()=>N,h0:()=>R,ik:()=>F,iw:()=>G,kC:()=>O,nn:()=>x,pc:()=>y,qz:()=>v,r9:()=>b,to:()=>B,vF:()=>p,vn:()=>L,xX:()=>g});var n=i(378),o=i(127),r=i(6273),s=i(6490),a=i(8194),l=i(4874),d=i(9218),c=i(8585);const u=6378137,h=2*Math.PI*u,m=r.sX/h,f=o.wA([],[-1,-1,0],[2,2,1]),_=o.wA([],[.5,.5,0],[.5,.5,1]),p=u*(Math.PI/2),v=Math.pow(2,15)/r.sX;function g(e,t,i,o,r,s,a=0){r[0]=(i[0]+o[0])/2,r[1]=(i[1]+o[1])/2;const l=e.project(i),d=e.project(o),c=e.project(r),u=n.TK(c,t),h=n.TK(l,t),m=n.TK(d,t);if(u<s)return r;if(h<s)return i;if(m<s)return o;if(a>=10)return r;return g(e,t,h+u>m+u?o:i,r,r,s,a+1)}function y(e){return Math.max(e,d.minCalculationScreenHeight)}function b(e,t){const i=d.defaultCameraConfig,n=y(t[1])/2,o=r.sX/Math.pow(2,e);return n/r.y4*o/Math.tan(i.fov/2)}function x(e,t){const i=d.defaultCameraConfig;return Math.log(y(t[1])*r.sX/(2*r.y4*Math.tan(i.fov/2)*e))/Math.LN2}function w(e){return r.ax*Math.pow(2,-e)}function S(e){const t=c.H.toGeo(e)[1],i=1/(2*Math.cos((0,s.Id)(t)));return Math.log(i)/Math.log(2)}function M(e,t){return Math.pow(2,Math.round(e)-t.coords[2])}function I(e,t){return 1+e*(c.H.scaleFactor(t[1])-1)}function T(e,t){const i=S(t)*(0,s.sB)(9,10,e);return e+(0,s.uZ)(i,-1,0)}function E(e,t){const i=S(t),n=i*(0,s.sB)(9,10+i,e);return e-(0,s.uZ)(n,-1,0)}function P(e,t){return r.LF*(e/r.$U)/t}function A(e,t){return t*m*c.H.scaleFactor(e[1])}function L(e,t){const i=Math.PI/180,n=e[1]*i,o=t[1]*i,r=Math.sin((t[1]-e[1])*i/2),s=Math.sin((t[0]-e[0])*i/2),a=r*r+Math.cos(n)*Math.cos(o)*s*s,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return Math.round(6371e3*l)}function C(e){let t=0;if(e.length>1)for(let i=0;i<e.length-1;i++)t+=L(e[i],e[i+1]);return t}const z=a.Ue([-r.sX/2,-r.sX/2],[r.sX/2,r.sX/2]),k=a.Ue([-100*r.sX/2,-r.sX/2],[100*r.sX/2,r.sX/2]);function O(e){const t=-r.ed,i=r.ed;let n=e[0];if(n>=-r.ed&&n<=r.ed)return;const o=i-t;n=((n-t)%o+o)%o+t,e[0]=n}function R(e,t){return e*Math.pow(2,-t)*r.sX/r.y4}function F(e,t){return e*Math.pow(2,t)*r.y4/r.sX}function B(e,t){return 0===e?-1/0:-Math.log(t*r.y4/(e*r.sX))/Math.LN2}const D=n.Ue(),j=n.Ue();function N(e,t,i){n.$X(D,i,e),n.$X(j,t,e);const o=n.AK(D,j)/n.kE(D);return Math.atan2(o,e[2])}function U(e,t,i,n,o,r,a={top:0,right:0,bottom:0,left:0},u={top:0,right:0,bottom:0,left:0},h,m){const f=d.defaultCameraConfig,_=new l.V({center:c.H.fromGeo(e),zoom:t,rotation:(0,s.Id)(i),size:n,pitch:(0,s.Id)(o),viewport:a,padding:u,cameraConfig:f,globeMode:!1,styleState:{}}),p=c.H.toGeo(_.flat.unproject(r)),v=c.H.toGeo(_.flat.unproject([r[0]+h,r[1]+m]));return Math.max(1,L(p,v))}function H(e){const t=[...e];return function(e){const t=e[0],i=e[1];return(0,s.Kh)(t,-r.ed,r.ed)&&(0,s.Kh)(i,-r.ed,r.ed)}(t)||(t[0]=(r.sX+(t[0]+r.ed)%r.sX)%r.sX-r.ed),t}function G(e,t){const i=Math.cos((0,s.Id)(t[0]-e[0])),n=Math.sin((0,s.Id)(t[1])),o=Math.sin((0,s.Id)(e[1])),r=Math.cos((0,s.Id)(t[1])),a=Math.cos((0,s.Id)(e[1]));return Math.acos(n*o+r*a*i)}function V(e,t,i){const n=(0,s.Id)(e[0]),o=(0,s.Id)(e[1]),r=[0,0];return r[1]=Math.asin(Math.sin(o)*Math.cos(i)+Math.cos(o)*Math.sin(i)*Math.cos(t)),r[0]=n+Math.atan2(Math.sin(t)*Math.sin(i)*Math.cos(o),Math.cos(i)-Math.sin(o)*Math.sin(r[1])),[(0,s.ZY)(r[0]),(0,s.ZY)(r[1])]}},1959:(e,t,i)=>{"use strict";function n(e){return!!e&&"stretchX"in e&&Array.isArray(e.stretchX)&&"stretchY"in e&&Array.isArray(e.stretchY)&&"width"in e&&"number"==typeof e.width&&"height"in e&&"number"==typeof e.height}i.d(t,{x:()=>n})},309:(e,t,i)=>{"use strict";i.d(t,{$z:()=>s,Q7:()=>o,cM:()=>l,wm:()=>a});var n=i(7999);function o(e,t){l(`No glyph for character ${e} (code = ${t}, range = ${(0,n.rx)(t)})`)}const r=new Set;function s(e){console.group("Gltf model error"),console.warn("Stage:",e.layer),e.message&&console.warn("Message:",e.message),e.originalError&&(console.groupCollapsed("Original error"),console.warn(e.originalError),console.groupEnd()),console.groupEnd()}function a(e){l(`Got an empty response from the "${e}" tile generation.`)}function l(e){r.has(e)||(console.log(e),r.add(e))}},7636:(e,t,i)=>{"use strict";i.d(t,{g:()=>d});var n=i(9450),o=i(8194),r=i(6490),s=i(9073),a=i(9090),l=i(8585);function d(e,t,i){if(0===e.length)return;const s=(0,r.Id)(t),d=o.Ue();for(const t of e){const e=l.H.fromGeo(t);(0,a.hk)(e,-s),o.aM(d,e)}const u=n.Ue();return o.be(u,d),(0,a.hk)(u,s),{center:u,zoom:c(d,i)}}function c(e,t){return Math.min((0,s.to)(t[0],Math.abs(e.max[0]-e.min[0])),(0,s.to)(t[1],Math.abs(e.max[1]-e.min[1])))}},8194:(e,t,i)=>{"use strict";i.d(t,{JG:()=>d,Rk:()=>h,Ue:()=>s,X3:()=>a,aM:()=>l,bA:()=>v,be:()=>u,jV:()=>p,kK:()=>_,mc:()=>c,r3:()=>m,se:()=>f});var n=i(378),o=i(6490),r=i(8585);function s(e,t){return{min:e||n.al(1/0,1/0),max:t||n.al(-1/0,-1/0)}}function a(e){return s(r.H.fromGeo(e.southWest),r.H.fromGeo(e.northEast))}function l(e,t){n.VV(e.min,e.min,t),n.Fp(e.max,e.max,t)}function d(e,t){e.min[0]=t.min[0],e.max[0]=t.max[0],e.min[1]=t.min[1],e.max[1]=t.max[1]}function c(e){e.min[0]=1/0,e.max[0]=-1/0,e.min[1]=1/0,e.max[1]=-1/0}function u(e,t){return e[0]=t.min[0]+(t.max[0]-t.min[0])/2,e[1]=t.min[1]+(t.max[1]-t.min[1])/2,e}function h(e,t,i){e[0]=(0,o.uZ)(i[0],t.min[0],t.max[0]),e[1]=(0,o.uZ)(i[1],t.min[1],t.max[1])}function m(e,t){return t[0]<=e.max[0]&&t[0]>=e.min[0]&&t[1]<=e.max[1]&&t[1]>=e.min[1]}function f(e,t){return t[1]<=e.max[1]&&t[1]>=e.min[1]}function _(e,t,i=0){const n=e.min[0]+i<=t.max[0]-i&&t.min[0]+i<=e.max[0]-i,o=e.min[1]+i<=t.max[1]-i&&t.min[1]+i<=e.max[1]-i;return n&&o}function p(e,t){return{min:[Math.max(e.min[0],t.min[0]),Math.max(e.min[1],t.min[1])],max:[Math.min(e.max[0],t.max[0]),Math.min(e.max[1],t.max[1])]}}function v(e,t){const i=u([],e),n=(e.max[0]-e.min[0])/2*t,o=(e.max[1]-e.min[1])/2*t;e.min[0]=i[0]-n,e.min[1]=i[1]-o,e.max[0]=i[0]+n,e.max[1]=i[1]+o}},291:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ease:()=>a,easeInBack:()=>z,easeInCirc:()=>T,easeInCubic:()=>u,easeInElastic:()=>A,easeInExpo:()=>S,easeInOutBack:()=>O,easeInOutCirc:()=>P,easeInOutCubic:()=>m,easeInOutElastic:()=>C,easeInOutExpo:()=>I,easeInOutQuad:()=>c,easeInOutQuart:()=>p,easeInOutQuint:()=>y,easeInOutSine:()=>w,easeInQuad:()=>l,easeInQuart:()=>f,easeInQuint:()=>v,easeInSine:()=>b,easeOutBack:()=>k,easeOutBounce:()=>R,easeOutCirc:()=>E,easeOutCubic:()=>h,easeOutElastic:()=>L,easeOutExpo:()=>M,easeOutQuad:()=>d,easeOutQuart:()=>_,easeOutQuint:()=>g,easeOutSine:()=>x,inertia:()=>F,linear:()=>r});var n=i(9218),o=i(6636);function r(e,t,i,n){return t+i/n*e}const s=o(.25,.1,.25,1);function a(e,t,i,n){return t+i*s(e/n)}function l(e,t,i,n){return i*(e/=n)*e+t}function d(e,t,i,n){return-i*(e/=n)*(e-2)+t}function c(e,t,i,n){return(e/=n/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t}function u(e,t,i,n){return i*(e/=n)*e*e+t}function h(e,t,i,n){return i*((e=e/n-1)*e*e+1)+t}function m(e,t,i,n){return(e/=n/2)<1?i/2*e*e*e+t:i/2*((e-=2)*e*e+2)+t}function f(e,t,i,n){return i*(e/=n)*e*e*e+t}function _(e,t,i,n){return-i*((e=e/n-1)*e*e*e-1)+t}function p(e,t,i,n){return(e/=n/2)<1?i/2*e*e*e*e+t:-i/2*((e-=2)*e*e*e-2)+t}function v(e,t,i,n){return i*(e/=n)*e*e*e*e+t}function g(e,t,i,n){return i*((e=e/n-1)*e*e*e*e+1)+t}function y(e,t,i,n){return(e/=n/2)<1?i/2*e*e*e*e*e+t:i/2*((e-=2)*e*e*e*e+2)+t}function b(e,t,i,n){return-i*Math.cos(e/n*(Math.PI/2))+i+t}function x(e,t,i,n){return i*Math.sin(e/n*(Math.PI/2))+t}function w(e,t,i,n){return-i/2*(Math.cos(Math.PI*e/n)-1)+t}function S(e,t,i,n){return 0==e?t:i*Math.pow(2,10*(e/n-1))+t}function M(e,t,i,n){return e==n?t+i:i*(1-Math.pow(2,-10*e/n))+t}function I(e,t,i,n){return 0==e?t:e==n?t+i:(e/=n/2)<1?i/2*Math.pow(2,10*(e-1))+t:i/2*(2-Math.pow(2,-10*--e))+t}function T(e,t,i,n){return-i*(Math.sqrt(1-(e/=n)*e)-1)+t}function E(e,t,i,n){return i*Math.sqrt(1-(e=e/n-1)*e)+t}function P(e,t,i,n){return(e/=n/2)<1?-i/2*(Math.sqrt(1-e*e)-1)+t:i/2*(Math.sqrt(1-(e-=2)*e)+1)+t}function A(e,t,i,n){var o=1.70158,r=0,s=i;if(0==e)return t;if(1==(e/=n))return t+i;if(r||(r=.3*n),s<Math.abs(i)){s=i;o=r/4}else o=r/(2*Math.PI)*Math.asin(i/s);return-s*Math.pow(2,10*(e-=1))*Math.sin((e*n-o)*(2*Math.PI)/r)+t}function L(e,t,i,n){var o=1.70158,r=0,s=i;if(0==e)return t;if(1==(e/=n))return t+i;if(r||(r=.3*n),s<Math.abs(i)){s=i;o=r/4}else o=r/(2*Math.PI)*Math.asin(i/s);return s*Math.pow(2,-10*e)*Math.sin((e*n-o)*(2*Math.PI)/r)+i+t}function C(e,t,i,n){var o=1.70158,r=0,s=i;if(0==e)return t;if(2==(e/=n/2))return t+i;if(r||(r=n*(.3*1.5)),s<Math.abs(i)){s=i;o=r/4}else o=r/(2*Math.PI)*Math.asin(i/s);return e<1?s*Math.pow(2,10*(e-=1))*Math.sin((e*n-o)*(2*Math.PI)/r)*-.5+t:s*Math.pow(2,-10*(e-=1))*Math.sin((e*n-o)*(2*Math.PI)/r)*.5+i+t}function z(e,t,i,n,o){return null==o&&(o=1.70158),i*(e/=n)*e*((o+1)*e-o)+t}function k(e,t,i,n,o){return null==o&&(o=1.70158),i*((e=e/n-1)*e*((o+1)*e+o)+1)+t}function O(e,t,i,n,o){return null==o&&(o=1.70158),(e/=n/2)<1?i/2*(e*e*((1+(o*=1.525))*e-o))+t:i/2*((e-=2)*e*((1+(o*=1.525))*e+o)+2)+t}function R(e,t,i,n){return(e/=n)<1/2.75?i*(7.5625*e*e)+t:e<2/2.75?i*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?i*(7.5625*(e-=2.25/2.75)*e+.9375)+t:i*(7.5625*(e-=2.625/2.75)*e+.984375)+t}function F(e,t,i,o){return i*(1-Math.pow(1-e/o,n.inertia.nonLinearity+1))+t}},2539:(e,t,i)=>{"use strict";i.d(t,{Jh:()=>f,Oy:()=>a,Z4:()=>_,hS:()=>s,iE:()=>l,z_:()=>m});i(1245);var n=i(9450),o=i(378),r=(i(127),i(8194));Array(16);function s(e,t){return{a:e[1]-t[1],b:t[0]-e[0],c:e[0]*t[1]-t[0]*e[1]}}function a(e,t){return Math.abs(l(e,t))}function l(e,t){return(t.a*e[0]+t.b*e[1]+t.c)/Math.sqrt(t.a*t.a+t.b*t.b)}function d(e,t,i){const{a:o,b:r,c:a}=s(e,t);return n.al(i,-(o*i+a)/r,0)}function c(e,t,i){const{a:o,b:r,c:a}=s(e,t);return n.al(-(r*i+a)/o,i,0)}const u=r.Ue(),h=r.Ue();function m(e,t,i){const n=t[t.length-1]*i;let r=e[0],s=0;const a=[r];let l,d=1;for(;d<e.length&&!l;){const i=e[d],c=t[d];let u=i;if(c>n){if(!l){const e=(n-s)/(c-s);l=[],o.t7(l,r,i,e)}u=l}a.push(u),r=u,s=t[d],d++}return a}function f(e,t){let i=e[0];r.mc(u),r.aM(u,i);let n=[i];const o=[n];let s=1;for(;s<e.length;){const a=e[s];let l=!1,m=a;if(r.JG(h,u),r.aM(h,m),h.max[0]-h.min[0]>t){m=d(i,m,h.max[0]===m[0]?h.min[0]+t:h.max[0]-t),l=!0}if(l&&(r.JG(h,u),r.aM(h,m)),h.max[1]-h.min[1]>t){m=c(i,m,h.max[1]===m[1]?h.min[1]+t:h.max[1]-t),l=!0}l?(n.push(m),r.mc(u),r.aM(u,m),n=[m],o.push(n),i=m):(n.push(a),r.aM(u,a),i=a,s++)}return o}function _(e,t,i){const n=e[0]-t[0],o=e[1]-t[1],r=i[0]-t[0],s=i[1]-t[1],a=r*r+s*s,l=0!==a?(n*r+o*s)/a:0;return l<0?t:l>1?i:[t[0]+l*r,t[1]+l*s]}},267:(e,t,i)=>{"use strict";i.d(t,{BS:()=>s,By:()=>a,M4:()=>l,mW:()=>d});var n=i(9450),o=i(8194),r=i(2539);function s(e){const t=e[0][0],i=e[0][1],n=e[1][0],o=e[1][1],r=e[2][0],s=e[2][1],a=e[3][0],l=e[3][1];return{min:[Math.min(t,n,r,a),Math.min(i,o,s,l)],max:[Math.max(t,n,r,a),Math.max(i,o,s,l)]}}function a(e){return[[e[0][0],e[0][1],e[0][2]],[e[1][0],e[1][1],e[1][2]],[e[2][0],e[2][1],e[2][2]],[e[3][0],e[3][1],e[3][2]]]}function l(e,t){const i=s(e);if(!(0,o.kK)(t,i))return!1;const n=[(0,r.hS)(e[3],e[2]),(0,r.hS)(e[1],e[0]),(0,r.hS)(e[0],e[3]),(0,r.hS)(e[2],e[1])],a=[t.min,t.max,[t.min[0],t.max[1]],[t.max[0],t.min[1]]];for(const e of n){let t=!0;for(let i=0;i<a.length;i++){const n=a[i];if(e.a*n[0]+e.b*n[1]+e.c<0){t=!1;break}}if(t)return!1}return!0}function d(e,t,i){e.forEach((e=>{const o=1+t/n.TE(i,e);n.t7(e,i,e,o)}))}},9090:(e,t,i)=>{"use strict";i.d(t,{AE:()=>h,BY:()=>P,Cb:()=>m,Hl:()=>w,IB:()=>b,Iq:()=>T,L$:()=>S,Tz:()=>p,af:()=>v,ax:()=>_,bt:()=>E,fN:()=>y,hk:()=>M,m2:()=>g,se:()=>x,tG:()=>I,uI:()=>f});var n=i(378),o=i(9450),r=i(351),s=i(7063),a=i(6490);const l=[0,0,0],d=[0,0,0],c=o.Ue(),u=r.Ue();function h(e,t,i,n,o){if(t!==n||i!==o){const r=o-i,s=t-n,a=1/Math.sqrt(r*r+s*s);e[0]=r*a,e[1]=s*a}else e[0]=0,e[1]=0}function m(e,t,i,n){return o.lu(l,i,t),o.lu(d,i,n),o.kC(e,d,l),o.Fv(e,e),e}function f(e,t,i,n,o){if(t!==n||i!==o){const r=n-t,s=o-i,a=1/Math.sqrt(r*r+s*s);e[0]=r*a,e[1]=s*a}else e[0]=0,e[1]=0}function _(e,t,i,o,r){const s=t+o,a=i+r,l=t*s+i*a;if(0!==l){const t=1/l;e[0]=s*t,e[1]=a*t,n.kE(e)>5&&n.Fv(e,e)}else e[0]=0,e[1]=0}function p(e){return(0,a.uZ)(127*e,-127,127)}function v(e,t=e){return e[0]=p(t[0]),e[1]=p(t[1]),e}function g(e,t,i,n,o){e[0]=t*n+i*o,e[1]=i*n-t*o}function y(e,t){const i=t[0];e[0]=-t[1],e[1]=i}function b(e,t){const i=t[0];e[0]=t[1],e[1]=-i}function x(e){return 0===e[0]&&0===e[1]}function w(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])}function S(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function M(e,t){const i=Math.sin(t),o=Math.cos(t),r=o*e[0]-i*e[1],s=i*e[0]+o*e[1];n.t8(e,r,s)}function I(e,t,i,o,r=!0){n.I6(t,i)||n.I6(i,o)?n.t8(e,0,0):(n.lu(l,i,t),n.lu(d,o,i),r?(y(l,l),y(d,d)):(b(l,l),b(d,d)),n.Fv(l,l),n.Fv(d,d),n.IH(e,l,d),n.Fv(e,e))}function T(e,t,i){t[0]=o.kE(o.t8(c,e[0],e[1],e[2])),t[1]=o.kE(o.t8(c,e[3],e[4],e[5])),t[2]=o.kE(o.t8(c,e[6],e[7],e[8])),i&&(r.t8(u,e[0]/t[0],e[1]/t[0],e[2]/t[0],e[3]/t[1],e[4]/t[1],e[5]/t[1],e[6]/t[2],e[7]/t[2],e[8]/t[2]),s.bz(i,u))}function E(e,t,i,n){t[0]=o.kE(o.al(e[0],e[1],e[2])),t[1]=o.kE(o.al(e[4],e[5],e[6])),t[2]=o.kE(o.al(e[8],e[9],e[10])),i[0]=e[12],i[1]=e[13],i[2]=e[14],n&&(r.t8(u,e[0]/t[0],e[1]/t[0],e[2]/t[0],e[3]/t[1],e[4]/t[1],e[5]/t[1],e[6]/t[2],e[7]/t[2],e[8]/t[2]),s.bz(n,u))}function P(e,t,i,n){const[o,r]=e,[s,a]=t,[l,d]=i;return n[0]=Math.min(Math.max(o,s),l),n[1]=Math.min(Math.max(r,a),d),n[2]=0,n}},3187:(e,t,i)=>{"use strict";i.d(t,{CL:()=>f,Hh:()=>m,LO:()=>u,QE:()=>p,X5:()=>h,Y5:()=>s,aW:()=>_,dr:()=>a,e5:()=>v,gt:()=>c});var n=i(7731),o=i(8369),r=i(1436);function s(e){return{_src:e.memSizeJs()}}function a(e){return{_texture:e.memSizeGPU()}}function l(e){return{[String(e.purpose)]:{_initData:e.memSizeJs()}}}function d(e){return{[String(e.purpose)]:{_glBuffer:e.memSizeGPU()}}}function c(e){var t;const i={};return e.generatedData&&(i.generatedData={collectorOutput:null===(t=e.generatedData)||void 0===t?void 0:t.map((e=>{return{data:(t=e.collectorOutput).data.reduce(((e,t)=>(e[`${t.symbol}_${t.sink}`]=t.buffer.byteLength,e)),{}),identifyIds:{centerBuffer:t.identifyIds.centerBuffer.byteLength,instanceIdBuffer:t.identifyIds.instanceIdBuffer.byteLength,layerIdBuffer:t.identifyIds.layerIdBuffer.byteLength,objectClassBuffer:t.identifyIds.objectClassBuffer.byteLength,phaseBuffer:t.identifyIds.phaseBuffer.byteLength,styleIdBuffer:t.identifyIds.styleIdBuffer.byteLength,sublayerBuffer:t.identifyIds.sublayerBuffer.byteLength}};var t}))}),e.objects&&(i.objects=e.objects.map((e=>h(e)))),i}function u(e){return{objects:e.objects?e.objects.map((e=>m(e))):0}}function h(e){return{buffers:e.buffers.map(l)}}function m(e){return{children:e.children.map((e=>{var t;return{[`${e.symbol}_${e.sink}`]:(null!==(t=e.instanceCount)&&void 0!==t?t:e.count)*(0,r.vP)(e.symbol,e.sink)}})),buffers:e.buffers.filter((e=>"attributes"!==e.purpose&&"instanced"!==e.purpose)).map((e=>({[String(e.purpose)]:e.byteLength})))}}function f(e){return{buffers:e.buffers.filter((e=>e instanceof o.l)).map(l).filter((e=>e._initData)),textures:e.textures.map(s)}}function _(e){return{buffers:e.buffers.filter((e=>e instanceof o.l)).map(d),textures:e.textures.map(s)}}function p(e){if("number"==typeof e)return e;let t=0;if(Array.isArray(e))for(const i of e)t+=p(i);else for(const i in e){const n=e[i];t+="number"==typeof n?n:p(n)}return t}function v(e){return(0,n.mG)(this,void 0,void 0,(function*(){return{defaultSource:e.defaultSource.getMemoryFootprint(),tileManager:e.tileManager.getMemoryFootprint((t=>!e.defaultSource.hasLayer(t))),identifier:e.identifier.getMemoryFootprint(),assetManager:e.assetManager.getMemoryFootprint(),trafficTileLayer:e.trafficTileLayer.getMemoryFootprint(),imageManager:e.imageManager.getMemoryFootprint(),parserThread:yield e.workers.parser.getMemoryFootprint(),labelingThread:yield e.workers.labeling.getMemoryFootprint(),renderer:e.renderer.getMemoryFootprint(),labeler:e.labeler.getMemoryFootprint(),postEffectsManager:e.postEffectsManager.getMemoryFootprint(),shadowManager:e.shadowManager.getMemoryFootprint()}}))}},7188:(e,t,i)=>{"use strict";i.d(t,{Dz:()=>h,GG:()=>s,KP:()=>d,Qy:()=>c,SD:()=>r,ev:()=>a,i4:()=>_,nF:()=>m,so:()=>p,wz:()=>f});var n=i(6490),o=i(5620);function r(e){let t=0;for(let i=0;i<e.length;i++)t+=e[i]*Math.pow(256,e.length-1-i);return t}function s(e){const t=new Uint8Array(6);for(let i=0;i<6;i++)t[i]=255&Math.floor(e/Math.pow(256,5-i));return encodeURIComponent(o.c(t))}function a(e){const t=function(e,t){var i,n,o,r,s,a;const l={};e.forEach(((e,t)=>{l[e]=t}));let d=e.length;l.selected=null!==(i=l.selected)&&void 0!==i?i:d++,l.hovered=null!==(n=l.hovered)&&void 0!==n?n:d++,l.dpi=null!==(o=l.dpi)&&void 0!==o?o:d++,l.isRealtime=null!==(r=l.isRealtime)&&void 0!==r?r:d++,l.pixelDensityPreset=null!==(s=l.pixelDensityPreset)&&void 0!==s?s:d++,l.tier=null!==(a=l.tier)&&void 0!==a?a:d++;for(const e in t)void 0===l[e]&&(l[e]=d++);return l}(e.tileProps,e.defaultProps),i={};for(const n in e.defaultProps)i[n]={index:t[n],value:e.defaultProps[n]};return{version:e.version,dictionaries:e.enumerationValues,reverseDictionaries:Object.keys(e.enumerationValues).reduce(((t,i)=>(t[i]=(0,n.l4)(e.enumerationValues[i]),t)),{}),tileProps:t,tilePropsByIndex:(0,n.l4)(t),defaultProps:i,vertexPropsLegacy:v(e.vertexProps)?l(e):{},vertexProps:v(e.vertexProps)?[]:e.vertexProps}}function l(e){const t=e.vertexProps,i={point:["x","y","z"],polygon:["x","y","cut","signed_z"],polyline:["x","y"]};if(!t)return i;if(!v(t))return console.warn(`Попытка сгенерировать vertexPropsLegacy для метатайла версии ${e.version}`),{};const n={0:"point",1:"polyline",2:"polygon"};return Object.keys(t).forEach((e=>{const o=n[e];void 0!==o?i[o]=t[parseInt(e,10)]:console.warn(`Неизвестный тип геометрии "${e}", нужно его поддержать`)})),i}function d(e,t){const i={};if(t)for(let e=0;e<t.length;e++)i[t[e]]=e;return a({enumerationValues:{db_sublayer:i},version:"7.0.0",zenithVersion:"",date:"",defaultProps:{},tileProps:e,vertexProps:[]})}function c(e,t){const{tileProps:i}=e;let n=Object.keys(i).length;for(const e of t)void 0===i[e]&&(i[e]=n,n+=1)}let u=0;const h={beginningIsCut:u++,class:u++,componentDistanceEnd:u++,componentDistanceStart:u++,db_icon_priority:u++,db_label_priority:u++,db_label2_priority:u++,dpi:u++,endingIsCut:u++,height:u++,db_hidden_by_plan_building_id:u++,db_hidden_by_plan_id:u++,id:u++,isRealtime:u++,db_label:u++,db_label2:u++,nextPointX:u++,nextPointY:u++,db_object_class:u++,objectLength:u++,pixelDensityPreset:u++,previousPointX:u++,previousPointY:u++,db_region:u++,selected:u++,hovered:u++,db_sublayer:u++,traffic_color:u++,traffic_road_class:u++,traffic_road_z_level:u++,db_tiers:u++,model_src:u++,linkedIds:u++,db_model_rotation_angle:u++,db_plan_id:u++,traffic_color2:u++},m={version:"5.0.0",tileProps:h,tilePropsByIndex:(0,n.l4)(h),defaultProps:{},dictionaries:{},reverseDictionaries:{},vertexPropsLegacy:{},vertexProps:[]},f=[],_={},p={sourceName:"zenith"};function v(e){return!Array.isArray(e)}},2702:(e,t,i)=>{"use strict";function n(e,t,i){return t.precomputes.forEach(((t,n)=>{e.push(i.tileData[n])})),e}function o(e,t){for(let i=0,n=t.length;i<n;i++)e.push(t[i]);return e}i.d(t,{L:()=>o,v:()=>n})},3698:(e,t,i)=>{"use strict";function n(e){const t=256*Math.log(e);return t+(t<0?-.5:.5)<<16>>16}function o(e){return 32768*e+.5<<16>>>16}function r(e){return 256*Math.log(e)+.5<<16>>16}i.d(t,{Bb:()=>o,KF:()=>r,wj:()=>n})},173:(e,t,i)=>{"use strict";i.d(t,{R4:()=>a,_u:()=>d,b8:()=>r,ff:()=>s});var n=i(309),o=i(9450);function r(e,t){let i=2166136261;for(const e of t)i^=e,i*=16777619;e.randomSeed=Math.abs(i)}function s(e,t,i){let o=.5;return e.randomSeed?(e.randomSeed=16807*e.randomSeed%2147483647,o=(e.randomSeed-1)/2147483646):(0,n.cM)("Resolve 'random': random seed is absent, the mean value between start and end will be used."),o*(i-t)+t}function a(e=128){const t=[],i=[];for(let n=0;n<e;n++)t.push(l(n,2)),i.push(l(n,3));return{base2:t,base3:i}}function l(e,t){let i=0,n=1/t;for(;e>0;)i+=n*(e%t),e=Math.floor(e/t),n/=t;return i}function d(e,t){const i=[];for(let n=0;n<t;n++){const t=s(e,0,2*Math.PI),n=Math.acos(s(e,0,2)-1),r=Math.sin(n)*Math.cos(t),a=Math.sin(n)*Math.sin(t),l=Math.cos(n);i.push(o.al(r,a,l))}return i}},7486:(e,t,i)=>{"use strict";i.d(t,{Bl:()=>c,W8:()=>d,rA:()=>l});var n=i(7464),o=i(6479);let r=10001;const s={w:0,h:0,x:0,y:0,atlasIndex:0,isPacked:!1},a={};function l(e,t,i,l,d,c){const u=(0,n.zV)(e,d);if(!a[u]){const n=r++;a[u]={type:o.f.Unique,isSvg:!1,index:n,key:u,name:"",fileName:"",id:e,regionId:i,url:c,rasters:t.map(((e,t)=>Object.assign(Object.assign({},s),{rasterSetIndex:n,rasterIndex:t,w:e,h:e,anchorX:l[0],anchorY:l[1]})))}}return a[u]}function d(e){const t=r++;return{type:o.f.Loaded,isSvg:!1,index:t,key:`loaded-${t}`,name:"",fileName:"",rasters:e.map(((e,i)=>Object.assign(Object.assign({},e),{rasterIndex:i,rasterSetIndex:t})))}}function c(e,t,i){let n,o=1/0;for(let r=0;r<e.length;r++){const s=e[r];if(i&&!s.isPacked)continue;const a=Math.abs(s.w-t);a<o&&(n=r,o=a)}return n}},297:(e,t,i)=>{"use strict";i.d(t,{ng:()=>c,Iw:()=>l,dp:()=>o,iY:()=>n,GY:()=>s,rJ:()=>r,w7:()=>d});let n=e=>e,o=null,r=!1;const s=new Promise((e=>{o=()=>{r=!0,e()}})),a=new Set(["ar"]);function l(e,t){return"always-on"===e||"depends-on-language"===e&&a.has(t)}function d(e,t,i){const n=t.workers.labeling;function r(){n.markRtlPluginLoaded().then((()=>{null!==o&&o()}))}return l(e.scenario,i)?fetch(e.url,{integrity:e.hash}).then((e=>e.text())).then((e=>Promise.all([n.loadRtlPlugin(e),Promise.resolve(c(e))]))).catch((e=>{r();const t=new Error,i="[RTL Plugin]: loading failed.";var n;throw t.message="object"==typeof(n=e)&&Boolean(n)&&"message"in n?`${i} ${e.message}`:i,t})):(r(),Promise.resolve())}const c=function(e){let t,i=!1;return function(...n){return i||(i=!0,t=e.apply(this,n)),t}}((function(e){new Function(e)(),n=self.mapglRtlPlugin.processRtl,o&&o()}))},7999:(e,t,i)=>{"use strict";i.d(t,{Go:()=>l,io:()=>d,lD:()=>s,rx:()=>a,zT:()=>r});var n,o=i(9218);function r(e){let t="",i=0;for(;i<e.length;){let n=e[i++];if(n>127){if(n>191&&n<224){if(i>=e.length)return console.error("Incomplete 2-byte sequence"),t;n=(31&n)<<6|63&e[i]}else if(n>223&&n<240){if(i+1>=e.length)return console.error("Incomplete 3-byte sequence"),t;n=(15&n)<<12|(63&e[i])<<6|63&e[++i]}else{if(!(n>239&&n<248))return console.error(`Unknown multibyte start 0x${n.toString(16)} at index ${i-1}`),t;if(i+2>=e.length)return console.error("Incomplete 4-byte sequence"),t;n=(7&n)<<18|(63&e[i])<<12|(63&e[++i])<<6|63&e[++i]}++i}if(n<=65535)t+=String.fromCharCode(n);else{if(!(n<=1114111))return console.error(`Code point 0x${n.toString(16)} exceeds UTF-16 reach`),t;n-=65536,t+=String.fromCharCode(n>>10|55296),t+=String.fromCharCode(1023&n|56320)}}return t}function s(e,t){if(e.length<=t||-1!==e.indexOf("\n"))return e;const i=[];return e.split(" ").forEach((e=>{const n=i.length-1;0===i.length||i[n].length+e.length>=t?i.push(e):i[n]+=" "+e})),i.join("\n")}function a(e){return Math.floor(e/256)}function l(e){const t=new Set;return e.forEach((e=>{if(void 0!==e)for(let i=0;i<e.length;i++){const n=e.charCodeAt(i);n!==o.fonts.bomCharCode&&t.add(a(n))}})),Array.from(t)}function d(e,t,i=1,o="…"){if(e.length<=t)return e;const r=t-o.length;switch(i){case n.END:return e.substring(0,r)+o;case n.MIDDLE:{const t=Math.ceil(r/2);return e.substring(0,t)+o+e.substring(e.length-(r-t),e.length)}}}!function(e){e[e.MIDDLE=1]="MIDDLE",e[e.END=2]="END"}(n||(n={}))},2398:(e,t,i)=>{"use strict";i.d(t,{U:()=>a});var n=i(7731),o=i(6392),r=i(5095),s=i(1311);class a{constructor(e,t=!1){this.dataType=e,this.pendingRequests=new Map,this.ignoredStatusCodes=t?[204,404]:[204]}fetch(e,t,i=3,o=300){var a;return(0,n.mG)(this,void 0,void 0,(function*(){let n=0;for(;n<=i;)try{const i=yield this.fetchAttempt(e,t);if(!i.error||!(0,r.UG)(null===(a=i.error)||void 0===a?void 0:a.status))return i;throw new Error(`Fetching ${e} attempt ${n} failed.`)}catch(e){if(n>=i)return{rejected:!0};yield(0,s.g)(Math.pow(2,n)*o),n++}return{rejected:!0}}))}destroy(){const e=Array.from(this.pendingRequests.keys());this.abortRequests(e)}abortRequests(e){for(const t of e){const e=this.pendingRequests.get(t);if(void 0===e)return;e.xhr.abort(),e.resolve({rejected:!0}),this.pendingRequests.delete(t)}}fetchAttempt(e,t){return new Promise((i=>{const n=t(e),s=(0,o.gx)(e),a=("json"===this.dataType?r.LK:r.nx)({url:n},((e,t)=>{if(this.pendingRequests.delete(s),void 0!==e)return this.ignoredStatusCodes.includes(e.status)||console.error(`Failed to fetch a tile by url "${n}" Error: status "${e.status}", message: ${e.message}`),void i({error:e});i({data:t})}));this.pendingRequests.set(s,{xhr:a,resolve:i})}))}}},8124:(e,t,i)=>{"use strict";i.d(t,{H:()=>n});class n{constructor(e){this.defs=e.map((e=>new o(e)))}check(e){const t=this.defs;let i=!1;for(let n=0;n<t.length;n++)i?t[n].update(e):i=!t[n].equal(e);return i}}class o{constructor(e){this.path=Array.isArray(e.path)?e.path:[e.path],this.type=e.type,"number"===this.type?(this.last=NaN,this.compare=this.primitive,this.updateFn=this.primitiveUpdate):"boolean"===this.type?(this.last=void 0,this.compare=this.primitive,this.updateFn=this.primitiveUpdate):"vec2"===this.type?(this.last=[NaN,NaN],this.compare=this.vec2,this.updateFn=this.vec2Update):"vec3"===this.type?(this.last=[NaN,NaN,NaN],this.compare=this.vec3,this.updateFn=this.vec3Update):"string"===this.type?(this.last="",this.compare=this.primitive,this.updateFn=this.primitiveUpdate):"padding"===this.type?(this.last={left:0,right:0,bottom:0,top:0},this.compare=this.padding,this.updateFn=this.paddingUpdate):"replicas"===this.type&&(this.last={min:0,max:0},this.compare=this.replicas,this.updateFn=this.replicasUpdate)}equal(e){const t=this.take(e),i=this.compare(this.last,t);return this.updateFn(t),i}update(e){this.updateFn(this.take(e))}take(e){const t=this.path;let i=0;do{e=e[t[i++]]}while(i<t.length);return e}primitive(e,t){return e===t}padding(e,t){return e.top===t.top&&e.bottom===t.bottom&&e.left===t.left&&e.right===t.right}paddingUpdate(e){this.last.top=e.top,this.last.bottom=e.bottom,this.last.right=e.right,this.last.left=e.left}vec2(e,t){return e[0]===t[0]&&e[1]===t[1]}vec3(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}primitiveUpdate(e){this.last=e}vec2Update(e){this.last[0]=e[0],this.last[1]=e[1]}vec3Update(e){this.last[0]=e[0],this.last[1]=e[1],this.last[2]=e[2]}replicas(e,t){const i=t[0],n=t[t.length-1];return e.min===i&&e.max===n}replicasUpdate(e){this.last.min=e[0],this.last.max=e[e.length-1]}}},3675:(e,t,i)=>{"use strict";i.d(t,{c:()=>n});class n{constructor(){this.events={}}on(e,t){let i=this.events[e];return i||(i=this.events[e]=[]),i.push(t),this}once(e,t){const i=n=>{this.off(e,i),t.call(this,n)};return this.on(e,i),this}off(e,t){const i=this.events[e];if(!i)return this;const n=i.indexOf(t);return-1!==n&&i.splice(n,1),this}emit(e,t){const i=this.events[e];if(!i)return this;const n=i.slice();for(let e=0;e<n.length;e++)n[e].call(this,t);return this}}},1777:(e,t,i)=>{"use strict";i.d(t,{r:()=>n});class n extends Map{constructor(e){super(e),this.featureAttrs=(null==e?void 0:e.featureAttrs)||new Set,this.clearAttrs=!0}set(e,t){return super.set(e,t),Object.keys(t).forEach((e=>this.featureAttrs.add(e))),this}}},3672:(e,t,i)=>{"use strict";i.d(t,{Ak:()=>r,Pc:()=>c,nI:()=>o});const n=1e5;function o(e){return null!==e&&"object"==typeof e&&64===e.type}function r(e){return c(e.lo,e.hi)}function s(e){return[e%n,Math.floor(e/n)%n,0,0]}function a(e){let t=0;for(let i=0;i<4;i++){const o=4294967296*e[i]+t;t=Math.floor(o/n),e[i]=o%n}}function l(e,t){let i=0;for(let o=0;o<4;o++){const r=e[o]+t[o]+i;i=Math.floor(r/n),e[o]=r%n}}function d(e){let t=!0,i=4,n="";for(;--i>=0;){const o=String(e[i]);t?0!==e[i]&&(n+=o,t=!1):n+="00000".slice(o.length)+o}return n.length||(n="0"),n}function c(e,t){const i=s(e),n=s(t);return a(n),l(n,i),d(n)}},3429:(e,t,i)=>{"use strict";i.d(t,{L:()=>o});const n=()=>{};class o{constructor(e,t=n){this.size=e,this.onRemove=t,this.map=new Map,this._length=0}add(e,t){if(this.map.has(e))return;const i={key:e,value:t};this.map.set(e,i),this._addToFront(i),this._length++,this._length>this.size&&this._removeLRU()}remove(e){const t=this.map.get(e);t&&(this._removeNode(t),this.map.delete(e),this._length--)}get(e){const t=this.map.get(e);if(t)return this._moveToFront(t),t.value}reset(){for(const[e,t]of this.map)this.onRemove(e,t.value);this.map.clear(),this.head=void 0,this.tail=void 0,this._length=0}setSize(e){for(this.size=e;this._length>this.size;)this._removeLRU()}getSize(){return this.size}keys(){return Array.from(this.map.keys())}getData(){return Array.from(this.map.values()).map((e=>e.value))}_addToFront(e){e.next=this.head,e.prev=void 0,this.head&&(this.head.prev=e),this.head=e,this.tail||(this.tail=e)}_removeNode(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.next=void 0,e.prev=void 0}_moveToFront(e){this._removeNode(e),this._addToFront(e)}_removeLRU(){if(!this.tail)return;const e=this.tail.key,t=this.tail.value;this._removeNode(this.tail),this.map.delete(e),this._length--,this.onRemove(e,t)}}},8278:(e,t,i)=>{"use strict";function n(e,t){const i=new Set;return e.forEach((e=>{t.has(e)||i.add(e)})),i}function o(e,t){if(!e||!t)return e===t;if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}function r(e,t){const i=new Set;for(const n of t)e.has(n)&&i.add(n);return i}i.d(t,{$X:()=>n,Xy:()=>o,jV:()=>r})},3487:(e,t,i)=>{"use strict";i.d(t,{c:()=>n});class n{constructor(e){this.map=(null==e?void 0:e.map)||{}}set(e,t,i){void 0===this.map[e]&&(this.map[e]={}),this.map[e][t]=i}get(e,t){const i=this.map[e];if(void 0!==i)return i[t]}has(e,t){const i=this.map[e];return void 0!==i&&void 0!==i[t]}reduce(e,t){return Object.values(this.map).reduce(((t,i)=>Object.values(i).reduce(((t,i,n,o)=>e(t,i,n,o)),t)),t)}}},9981:(e,t,i)=>{"use strict";i.d(t,{IB:()=>d,aU:()=>s,fL:()=>r,o1:()=>o,xE:()=>c,z:()=>l});var n=i(6273);function o(e){return n.$U*e}function r(e){return e/n.$U}function s(e){return!!e.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i)}const a={arrow:!0,buildingModel:!0,custom:!0,dashedLine:!0,embankment:!0,group:!0,heatmap:!0,labelLine:!0,line:!0,lineExtrusion:!0,metricPoint:!0,model:!0,oneWayLine:!0,overpass:!0,point:!0,polygon:!0,polygon3d:!0,polygonExtrusion:!0,raster:!0,shiftedLine:!0,tunnel:!0};function l(e){return a[e]}function d(e){return"group"!==e&&"custom"!==e}function c(e){return"model"===e?"gltfModel":"group"!==e?e:void 0}},7609:(e,t,i)=>{"use strict";i.d(t,{CE:()=>h,Cz:()=>f,M7:()=>_,Ty:()=>c,h3:()=>m,wu:()=>u});var n=i(9218);const o=new Set(n.commercialSublayers),r=new Set(n.commercialCitySublayers),s=new Set(n.commercialPremiumSublayers),a=new Set(n.personalSublayers),l=new Set(n.landmarkPoiSublayers),d=new Set(n.commercialModelSublayers);function c(e){return o.has(e)}function u(e){return r.has(e)}function h(e){return s.has(e)}function m(e){return a.has(e)}function f(e){return l.has(e)}function _(e){return d.has(e)}},4411:(e,t,i)=>{"use strict";i.d(t,{Z:()=>n});class n{constructor(e){this.fnRegistry=e,this.onClassCreate=({id:e,name:t,args:i})=>{const n=this.classes.get(t);if(!n)return void console.error(`ClassRegistry#onClassCreate: class ${t} not found`);const o=n.scope?new n.ClassConstructor(n.scope,...i):new n.ClassConstructor(...i);n.hosts.set(e,o)},this.onMethodUse=({id:e,name:t,method:i,args:n})=>{const o=this.classes.get(t);if(!o)return void console.error(`ClassRegistry#onMethodUse: class ${t} not found`);const r=o.hosts.get(e);if(r){if(r[i])return"destroy"===i&&o.hosts.delete(e),r[i](...n);console.error(`ClassRegistry#onMethodUse: method ${i} in instance ${e} in class ${t} not found`)}else console.error(`ClassRegistry#onMethodUse: instance ${e} in class ${t} not found when calling the ${i} method`)},this.classes=new Map,this.idCounter=0,this.fnRegistry.set("createClass",this.onClassCreate),this.fnRegistry.set("classMethodUse",this.onMethodUse)}set(e,t,i,n){const o=this,r={ClassConstructor:t,hosts:new Map,proxies:new Map,scope:i};return this.classes.set(e,r),{get:i=>{class r{constructor(...t){this.id=o.idCounter++,o.fnRegistry.get(i,"createClass")({id:this.id,args:t,name:e})}}return Object.getOwnPropertyNames(t.prototype).forEach((s=>{"constructor"!==s&&"function"==typeof t.prototype[s]&&(r.prototype[s]=function(...t){const r=n&&n.includes(s)&&Array.isArray(t[0])?[...Array(t[0].length).keys()].map((e=>e)):void 0;return o.fnRegistry.get(i,"classMethodUse",r)({id:this.id,name:e,method:s,args:t})})})),r}}}}},7256:(e,t,i)=>{"use strict";i.d(t,{D:()=>s,H:()=>r});var n=i(6892),o=i(3675);class r extends o.c{constructor(){super(),this.workers=new Map}addWorker(e,t){this.workers.set(e,t),t.addEventListener("message",(t=>{const{to:i,msg:n,transferable:o}=t.data,r={from:e,to:i,msg:n,transferable:o};this.routeMessage(r)}))}send(e,t,i){const o=this.workers.get(e);if(o){const r={to:e,from:n.P.Main,msg:t,transferable:i};void 0!==i?o.postMessage(r,i):o.postMessage(r)}}broadcast(e){this.workers.forEach(((t,i)=>{const o={to:i,from:n.P.Main,msg:e};t.postMessage(o)}))}routeMessage(e){const{from:t,to:i,transferable:o,msg:{type:r}}=e;if(i===n.P.Main)this.emit("message",e);else if(i===n.P.All)t!==n.P.Main&&this.emit(r,e),this.workers.forEach(((i,n)=>{n!==t&&(void 0!==o?i.postMessage(e,o):i.postMessage(e))}));else{const t=this.workers.get(i);t&&(void 0!==o?t.postMessage(e,o):t.postMessage(e))}}}class s extends o.c{constructor(e){super(),this.worker=e,e.addEventListener("message",(e=>{const t=e.data;this.emit("message",t)}))}send(e,t,i){const n={to:e,msg:t,transferable:i};this.worker.postMessage(n,i)}broadcast(e){const t={to:n.P.All,msg:e};this.worker.postMessage(t)}}},4500:(e,t,i)=>{"use strict";i.d(t,{J:()=>o});var n=i(6892);class o{constructor(e){this.onMessage=e=>{const{from:t,msg:i}=e;switch(i.type){case n.C.FunctionUse:this.onFunctionUse(i,t);break;case n.C.FunctionResult:this.onFunctionResult(i)}},this.connector=e,this.functions=new Map,this.functionIdCounter=0,this.pendingFunctions=new Map,e.on("message",this.onMessage)}set(e,t){this.functions.set(e,t)}get(e,t,i){return(...o)=>{const r=this.functionIdCounter++,s={type:n.C.FunctionUse,data:{id:r,name:t,args:o,subids:i}};let a;return a=i?i.map((e=>new Promise((t=>{this.pendingFunctions.set(String(r)+`-${e}`,t)})))):new Promise((e=>{this.pendingFunctions.set(String(r),e)})),this.connector.send(e,s),a}}onFunctionUse(e,t){const{data:{name:i,args:n,id:o}}=e,s=this.functions.get(i);if(s){const e=s(...n);if(Array.isArray(e)&&r(e[0]))for(let i=0;i<e.length;i++)Promise.resolve(e[i]).then((e=>{this.sendFunctionResult(t,o,e,i)}));else e&&r(e)?Promise.resolve(e).then((e=>this.sendFunctionResult(t,o,e))):this.sendFunctionResult(t,o,e)}else console.error(`FnRegistry#onFunctionUse: function ${i} not found`)}sendFunctionResult(e,t,i,o){const r={type:n.C.FunctionResult,data:{id:t,result:i,subid:o}};i&&i.transferable?this.connector.send(e,r,i.transferable):this.connector.send(e,r)}onFunctionResult(e){const{data:{id:t,result:i,subid:n}}=e,o=String(t)+(void 0!==n?`-${n}`:""),r=this.pendingFunctions.get(o);r?(r(i),this.pendingFunctions.delete(o)):console.error(`FnRegistry#onFunctionResult: pending function ${o} not found`)}}function r(e){return"object"==typeof e&&"function"==typeof e.then}},6892:(e,t,i)=>{"use strict";var n,o;i.d(t,{C:()=>o,P:()=>n}),function(e){e[e.Main=0]="Main",e[e.Parser=1]="Parser",e[e.Labeling=2]="Labeling",e[e.Models=3]="Models",e[e.All=4]="All"}(n||(n={})),function(e){e[e.FunctionUse=0]="FunctionUse",e[e.FunctionResult=1]="FunctionResult"}(o||(o={}))},1684:(e,t,i)=>{"use strict";i.d(t,{BL:()=>s,U2:()=>r,Vx:()=>d,rS:()=>l,sT:()=>a});var n=i(291);const o={easing:"easeInOutQuad",forceFinalValue:!0,renderAfterUpdate:!0};function r(e,t){return t.tickers[e]}function s(e,t,i,n,r,s,a,l){let d;t.animationGroup&&(d=Object.keys(i.tickers).filter((e=>i.tickers[e].animationGroup===t.animationGroup))),i.tickers[e]=Object.assign(Object.assign(Object.assign({},o),t),{from:n,to:r,duration:s,attributes:l,startTime:i.time,alreadyStartedGroupTickers:d,iterationCount:a})}function a(e,t){delete t.tickers[e]}function l(e,t){return!!t.tickers[e]}function d(e,t,i){var n;const o=i.tickers[e];if(!o)return;if(o.alreadyStartedGroupTickers&&o.alreadyStartedGroupTickers.some((e=>!!i.tickers[e])))return void(o.startTime=i.time);let r,s=i.time-o.startTime;if(o.iterationCount>1){const e=s;s=e%o.duration,o.iterationCount!==1/0&&e>=o.duration*o.iterationCount&&(s=o.duration)}if(o.from.length){r=[];for(let e=0;e<o.from.length;e++){const t=c(o.easing,o.from[e],o.to[e],o.duration,s);r.push(t)}}else r=c(o.easing,o.from,o.to,o.duration,s);let l=!1;s>=o.duration&&(o.forceFinalValue&&(r=o.to),l=!0),t.step&&t.step(i,r,o.attributes,l),l&&(t.keepFinished||a(e,i),t.complete&&t.complete(i));("function"==typeof o.renderAfterUpdate?o.renderAfterUpdate():o.renderAfterUpdate)&&((null===(n=o.attributes)||void 0===n?void 0:n.layerId)?i.rerenderEvents.push({type:"layerAnimationTicker",layerId:o.attributes.layerId,styleId:o.attributes.styleId}):i.rerenderEvents.push({type:"coreAnimationTicker"}))}function c(e,t,i,o,r){return"string"==typeof e?n[e](r,t,i-t,o):e(r,t,i-t,o)}},6392:(e,t,i)=>{"use strict";i.d(t,{$F:()=>ce,Bh:()=>z,Bs:()=>y,C5:()=>Y,CJ:()=>I,HL:()=>H,IR:()=>ie,Kn:()=>M,L7:()=>X,LQ:()=>x,My:()=>Q,Ny:()=>L,Oy:()=>te,S3:()=>A,Sl:()=>P,Tc:()=>fe,VV:()=>E,VW:()=>J,XJ:()=>pe,Z$:()=>Z,_W:()=>se,a2:()=>K,aq:()=>$,b5:()=>B,cL:()=>S,d1:()=>ee,gQ:()=>le,gx:()=>b,hm:()=>q,iq:()=>ae,qu:()=>V,rL:()=>U,tW:()=>de,vl:()=>w,x7:()=>re,xH:()=>T,z6:()=>oe});var n=i(378),o=i(9450),r=i(5620),s=i(2447),a=i(7188),l=i(2435),d=i(267),c=i(9748),u=i(6273),h=i(8194),m=i(9073),f=i(9218),_=i(6490),p=i(4874),v=i(8585);const g=[0,0,0];function y(e){return{coords:e,size:$(e[2]),offset:te(e)}}function b(e){return x(e[0],e[1],e[2],e[3])}function x(e,t,i,n){return`${e}_${t}_${i}_${n}`}function w(e,t){return`${b(e)}_${t.stringify()}`}function S(e){const t=e.split("_");return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}function M(e){return f.tiles.subdomains[Math.abs(e[0]+e[1])%f.tiles.subdomains.length]}function I(e){const t=new s.Z(e),i=c.JE(t),{x:n,y:o,zoom:r,tiles:l}=i.tileGroups[0];return l.map((({regionId:e,hash:t,data:i})=>(i||(console.warn(`Tile ${r}_${n}_${o} from region ${e} is corrupt (has no data)`),i=new Uint8Array(0)),{data:i,regionId:e,metatileHash:(0,a.SD)(t)})))}function T(e){return e.map((e=>({regionId:e.regionId,metatileHash:e.metatileHash})))}function E(e){const t=4*Math.ceil(e.byteLength/4),i=new ArrayBuffer(t);return new Uint8Array(i).set(e),i}function P(e){const[t,i,n]=e;return{min:te([t,i,n,n]),max:te([t+1,i+1,n,n])}}function A(e,t){return(0,h.kK)(P(e),P(t),.001)}function L(e,t,i,n=0){const o=P(e);return o.min[0]-=n,o.min[1]-=n,o.max[0]+=n,o.max[1]+=n,!i.environmentManager.isAABBInFog(o)&&(0,d.M4)(t,o)}function C(e,t=1,i=3,n=!1){let o=1/Math.cos((0,_.Id)(e));return n&&(o=Math.log2(o)),(0,_.uZ)(Math.ceil(o),t,i)-1}function z(e,t,i){const n=function(e,t){const i=m.vF*m.C,n=(0,m.r9)(e,t)+i,o=f.defaultCameraConfig.fov/2,r=Math.sin(o),s=Math.cos(o),a=i/n;let l=(0,_.ZY)(Math.acos(Math.pow(r,2)/a+s*Math.sqrt(1-Math.pow(r,2)/Math.pow(a,2))));Number.isNaN(l)&&(l=90);return l}(t,e.size),o=Math.trunc(t),r=Array.from(e.center);(0,m.kC)(r);const s=v.H.toGeo(r),a={min:[s[0]-(0,_.uZ)(2*n,0,90),(0,_.uZ)(s[1]-n,-85,85)],max:[s[0]+(0,_.uZ)(2*n,0,90),(0,_.uZ)(s[1]+n,-85,85)]},l=Math.max(C(a.min[1],2,4),C(a.max[1],2,4)),d=oe(r,Math.max(i,o-l),!0);d[0]=Math.round(d[0]),d[1]=Math.round(d[1]);const c=new p.V(e),u=function(e,t,i,n,o){const r=300,s=500,a=new Map,l=[e],d=[];d.push(e);for(;l.length;){if(d.length>r){console.warn("collectVisibleGlobeTiles: too many tiles",d.length);break}if(l.length>s){console.warn("collectVisibleGlobeTiles: queue overflow");break}const e=l.shift();if(e){const[r,s,c]=e;a.set(r+"."+s+"."+c,!0);_e(e,a,t,i).filter((e=>fe(o,n,e))).forEach((e=>{const[t,i,n]=e;a.set(t+"."+i+"."+n,!0),d.push(e),l.push(e)}))}}return d}(d,s,k(e,c,s),c,e),h=[];return u.forEach((e=>{var t,i;t=[NaN,2,2,NaN],i=e,!isNaN(t[0])&&t[0]!==i[0]||!isNaN(t[1])&&t[1]!==i[1]||!isNaN(t[2])&&t[2]!==i[2]||!isNaN(t[3])&&t[3]!==i[3]?h.push(e):h.push(...j(e,1))})),h.filter((t=>fe(e,c,t)))}function k(e,t,i){const n=v._.toGeo(t.ecef.unproject([e.viewport.left,e.viewport.top]));return Math.min(3*Math.max((0,m.iw)(n,i)),t.ecef.visibleArc)}function O(e,t,i,n,o,r){const[,,s]=e,a=function(e){return{min:F(e),max:F([e[0]+1,e[1]+1,e[2],e[3]])}}(e),l=n>=5?2:1,d=C((a.max[1]+a.min[1])/2,l,3,!0),c=Math.max(Math.abs(a.min[1]),Math.abs(a.max[1]));return s>=Math.max(i,n-d)||c>70&&r>0||c>82||(0,m.iw)(t,[(a.max[0]+a.min[0])/2,(a.max[1]+a.min[1])/2])>.75*o}function R(e,t){const i=Math.trunc(e.zoom),n=Array.from(e.center);(0,m.kC)(n),v.H.toGeo(n,n);const o=[],r=new p.V(e),s=k(e,r,n);function a(t,l=0){if(he(n,s,t)&&fe(e,r,t))if(O(t,n,2,i,r.ecef.visibleArc,l))o.push(t);else for(const e of j(t,1))a(e,l+1)}return z(e,Math.trunc(e.zoom),2).map((([e,i,n])=>{a([e,i,n,t])})),o}function F(e){const t=te(e);return v.H.toGeo(t)}function B(e,t,i,n,o,r=0,s=1/0,a=!1){if(e.globeMode){return R(e,o)}var l;a&&(l=i,(i=2*Math.trunc(l/2)+1)>s&&(i-=2));const c=(0,d.BS)(e.tilesBounds),h=$(i),m=Math.pow(2,i),f=Math.floor((c.min[0]+u.ed-r)/h),_=Math.floor((c.max[0]+u.ed+r)/h),p=Math.max(Math.floor((c.min[1]+u.ed-r)/h),0),v=Math.min(Math.floor((c.max[1]+u.ed+r)/h),m-1),g=[],y=new Set;for(let n=f;n<=_;n++)for(let s=p;s<=v;s++){const a=[n,s,i,o];if(L(a,e.tilesBounds,t,r)){a[0]=(m+a[0]%m)%m;const e=b(a);y.has(e)||(y.add(e),g.push(a))}}return e.demMode&&function(e,t,i,n,o,r){const s=new Set(e.map(b)),a=new Set,l=(0,d.By)(t.tilesBounds);let c=e.slice();for(let h=n;h>=o;h--){let n=0;const o=[];c.forEach((r=>{const l=D(r),d=b(l);a.has(d)||(o.push(l),a.add(d),N(l,(o=>{const r=b(o);s.has(r)||a.has(r)||!L(o,t.extendedTilesBounds,i)||(e.push(o),s.add(r),n++)})))}));const m=$(h-1);(0,d.mW)(l,m,t.center);const f=(0,d.BS)(l),_=Math.pow(2,h-1),p=Math.floor((f.min[0]+u.ed)/m),v=Math.floor((f.max[0]+u.ed)/m),g=Math.max(Math.floor((f.min[1]+u.ed)/m),0),y=Math.min(Math.floor((f.max[1]+u.ed)/m),_-1);for(let e=p;e<=v;e++)for(let t=g;t<=y;t++){const s=[e,t,h-1,r];s[0]=(_+s[0]%_)%_;const d=b(s);!a.has(d)&&L(s,l,i)&&(o.push(s),n++)}if(!n)break;c=o}}(g,e,t,i,n,o),g}function D(e,t=1){const[i,n,o,r]=e,s=Math.pow(2,t);return[Math.trunc(i/s),Math.trunc(n/s),o-t,r]}function j(e,t){const[i,n,o,r]=e,s=Math.pow(2,t),a=[];for(let e=0;e<s;e++)for(let l=0;l<s;l++)a.push([i*s+e,n*s+l,o+t,r]);return a}function N(e,t){let[i,n,o]=e;const r=e[3];i*=2,n*=2,o++,t([i,n,o,r]),t([i+1,n,o,r]),t([i,n+1,o,r]),t([i+1,n+1,o,r])}function U(e,t,i,n,o,a,d,u,h,m,f,_){const p=new s.Z,v={tiles:[{x:o[0],y:o[1],zoom:o[2]}]};c.a9(v,p);const g={x:o[0].toString(),y:o[1].toString(),z:o[2].toString(),protocol:i,host:e,subdomain:n[Math.abs(o[0]+o[1])%n.length],tileSet:t,lang:u,appId:d,tileKey:a,sessionId:f,defaultLang:m,dt:null==_?void 0:_.join(","),request:encodeURIComponent(r.c(p.finish()))};return h?(0,l.Gr)({url:h},g):(0,l.Gr)("tiles",g)}function H(e,t){const i=e.coords,n=t.coords,o=i[2],r=n[2];return o===r?i[0]===n[0]&&i[1]===n[1]:o<r?G(e,t):G(t,e)}function G(e,t){if(t.zoomLevel<e.zoomLevel)return!1;if(t.zoomLevel===e.zoomLevel)return t.coords[0]===e.coords[0]&&t.coords[1]===e.coords[1]&&t.detailLevel>e.detailLevel;const i=Math.pow(2,t.coords[2]-e.coords[2]),n=e.coords[0]*i,o=n+i,r=e.coords[1]*i,s=r+i,a=t.coords[0],l=t.coords[1];return a>=n&&a<o&&l>=r&&l<s}function V(e,t,i){return n.TE(e,ne(t.coords,g))-n.TE(e,ne(i.coords,g))}function Z(e,t,i){e[0]=t[0]*i.size/u.Bq+i.offset[0],e[1]=t[1]*i.size/u.Bq+i.offset[1],e[2]=t[2]}const W=o.Ue();function X(e,t,i,n){var o;W[0]=t[0][i],W[1]=t[1][i],W[2]=(null!==(o=t[2])&&void 0!==o?o:[])[i],Z(e,W,n)}function K(e,t,i){e[0]=(t[0]-i.offset[0])*u.Bq/i.size,e[1]=(t[1]-i.offset[1])*u.Bq/i.size,e[2]=t[2]}function $(e){return Math.pow(2,32-e)}function q(e){return e[0]>=0&&e[0]<=u.Bq&&e[1]>=0&&e[1]<=u.Bq}function Y(e,t){return e*u.sX/(u.Bq*Math.pow(2,t))}function J(e){return(0,_.uZ)(e/u._9*u.Bq,0,u._H)}const Q=u.Bq/u._9;function ee(e){return e/u.Bq*u._9}function te(e){const t=$(e[2]),i=2147483648;return o.al(e[0]*t-i,e[1]*t-i,0)}function ie(e){const t=2147483648;return[e[0]+t,e[1]+t,32,32]}function ne(e,t){const i=$(e[2]),n=2147483648;return o.t8(t,(e[0]+.5)*i-n,(e[1]+.5)*i-n,0)}function oe(e,t,i=!1){const n=2147483648,o=$(t),r=i?Math.min(n-1,e[1]):e[1];return[(e[0]-o/2+n)/o,(r-o/2+n)/o,t,t]}function re(e,t=1){const i=Math.max(e.max[0]-e.min[0],e.max[1]-e.min[1],1)*t,o=32-Math.log(i)/Math.LN2,r=n.Ue();return(0,h.be)(r,e),oe(r,o)}const se=e=>{const[t,i,n,o]=e;return[t,Math.pow(2,n)-1-i,n,o]},ae=(e,t)=>{Z(g,t,e);const i=v.H.toGeo(g);return v.H.scaleFactor(i[1])};function le(e,t,i){const n=[0,0,0];return Z(n,[e,t],i),v.H.toGeo(n)}function de(e,t){const i=Math.min(e[0][0],e[1][0],e[2][0],e[3][0])+u.ed,n=Math.max(e[0][0],e[1][0],e[2][0],e[3][0])+u.ed,o=Math.floor(i/u.sX),r=Math.floor(n/u.sX);return t?[o]:Array.from({length:r-o+1},((e,t)=>t+o))}function ce(e,t){return v._.fromGeo(le(t[0],t[1],e))}new Float32Array([4,0,0,0,0,4,0,0,0,0,1,0,-2,-2,0,1]);function ue(e,t,i,n){const o=[];return Z(o,n,i),(0,m.iw)(v.H.toGeo(o),e)<t}function he(e,t,i){const n=y(i),o=u.Bq;return ue(e,t,n,[0,o/2,0])||ue(e,t,n,[o,o/2,0])||ue(e,t,n,[o/2,o,0])||ue(e,t,n,[o/2,0,0])||ue(e,t,n,[0,0,0])||ue(e,t,n,[0,o,0])||ue(e,t,n,[o,o,0])||ue(e,t,n,[o,0,0])}function me(e,t,i){const n=[];return Z(n,i,t),e.ecef.project(v._.fromGeo(v.H.toGeo(n)))}function fe(e,t,i){const[,n,o]=i;if(0===n||n===Math.pow(2,o)-1)return!0;const r=y(i),s=u.Bq,a=[me(t,r,[0,0,0]),me(t,r,[0,s,0]),me(t,r,[s,s,0]),me(t,r,[s,0,0])],l=a.map((e=>e[0])),d=a.map((e=>e[1])),c={min:[Math.min(...l),Math.min(...d)],max:[Math.max(...l),Math.max(...d)]},m={min:[e.viewport.left,e.viewport.top],max:[e.viewport.left+e.size[0],e.viewport.top+e.size[1]]};return(0,h.kK)(c,m)}function _e(e,t,i,n){const[o,r,s,a]=e,l=Math.pow(2,s)-1,d=e=>e>l?0:e<0?l:e,c=([e,t,i,n])=>((t>l||t<0)&&(t=t>l?l:0,e=0===i?e:(e+Math.pow(2,i-1))%Math.pow(2,i)),[e,t,i,n]),u=[d(o-1),r,s,a],h=[d(o+1),r,s,a],m=c([o,r-1,s,a]);return[h,c([o,r+1,s,a]),m,u].filter((e=>{const[i,n,o]=e;return!t.has(i+"."+n+"."+o)})).filter((e=>he(i,n,e)))}function pe(e,t,i,n=0){return""}},9476:(e,t,i)=>{"use strict";function n(e,t,i){let n,o,r,s;const a=function(){const l=Date.now()-r;l<t&&l>=0?n=setTimeout(a,t-l):(n=null,i||(s=e(...o),n||(o=null)))};function l(...l){o=l,r=Date.now();const d=i&&!n;return n||(n=setTimeout(a,t)),d&&(s=e(...o),o=null),s}return l.cancel=function(){void 0!==n&&(clearTimeout(n),n=null)},l}i.d(t,{D:()=>n})},1311:(e,t,i)=>{"use strict";function n(e){return new Promise((t=>setTimeout(t,e)))}i.d(t,{g:()=>n})},7628:(e,t,i)=>{"use strict";function n(e,t){let i,n=!1;function o(){n=!1,i&&(r(...i),i=!1)}function r(...r){n?i=r:(e(...r),setTimeout(o,t),n=!0)}return r}i.d(t,{P:()=>n})},6874:(e,t,i)=>{"use strict";i.d(t,{HW:()=>s,NR:()=>a,fD:()=>o,lx:()=>l});let n=1;function o(){return n++}let r=1;const s=()=>++r,a=s(),l=s()},2435:(e,t,i)=>{"use strict";i.d(t,{Ag:()=>u,Gr:()=>l,IG:()=>d,Nt:()=>a,Sy:()=>c,XK:()=>r});var n=i(9218);const o=/\{(\w+)\}/g;function r(e,t){return e.replace(o,((e,i)=>t[i]))}function s(e){const[t,i]=e.split("?");if(!i)return t;const n=i.split("&").map((e=>e.split("="))).filter((([,e])=>"undefined"!==e)).map((e=>e.join("="))).join("&");return n.length?`${t}?${n}`:t}function a(e,t){return("object"==typeof e?e.url:n.urls[e]).replace(o,((e,i)=>{var n;return null!==(n=t[i])&&void 0!==n?n:e})).replace(o,((e,i)=>{var n;return null!==(n=t[i])&&void 0!==n?n:e}))}function l(e,t){const i=r(t.host,{subdomain:t.subdomain});return s(r("object"==typeof e?e.url:n.urls[e],Object.assign(Object.assign({},t),{host:i})))}function d(e,t){return s(r(e,t))}function c(e,t){let i=0;for(let e=0;e<t.length;e++)i+=t.charCodeAt(e);return e[i%e.length]}function u(e,t){const i=new URL(t);return e.startsWith("//")?`${i.protocol}${e}`:e.startsWith("/")?`${i.origin}${e}`:e}},8369:(e,t,i)=>{"use strict";i.d(t,{l:()=>r,m:()=>s});var n,o=i(9141);class r{constructor(e,t,i,n=!1,o=!1){var s;this.elementsType=null,this.isDirty=!0,this._glBuffer=null,this._gl=e,this._initData=t,this.byteLength=t.byteLength,this.type=n?r.ElementArrayBuffer:r.ArrayBuffer,this.options=Object.assign({},r.defaultOptions,i),this.drawType=null!==(s=null==i?void 0:i.drawType)&&void 0!==s?s:r.StaticDraw;const a=[r.UnsignedByte,r.UnsignedShort,r.UnsignedInt];n&&!a.includes(this.options.dataType)&&(console.warn("Please provide dataType of one of the following values:Buffer.UnsignedByte, Buffer.UnsignedShort, Buffer.UnsignedInt. Defaulting to UnsignedInt"),this.options.dataType=r.UnsignedInt),this._preserveData=o}static _dataTypeSize(e){switch(e){case r.Byte:case r.UnsignedByte:return 1;case r.UnsignedShort:case r.Short:return 2;case r.Float:case r.Int:case r.UnsignedInt:return 4}throw new Error(`[WebGl] Unsupported Buffer data type: ${String(e)}`)}memSizeJs(){var e,t;return null!==(t=null===(e=this._initData)||void 0===e?void 0:e.byteLength)&&void 0!==t?t:0}memSizeGPU(){return this.byteLength}bind(e,t,i,n){const s=this._gl;if(this._glBuffer||this.prepare(),this.type===r.ArrayBuffer){s.bindBuffer(s.ARRAY_BUFFER,this._glBuffer),e=e||0,t=t||this.options,n=null!=n?n:1,(0,o.S)(n);const a=this._toGlParam(t.dataType)||s.FLOAT;if(1===n)s.vertexAttribPointer(e,t.itemSize,a,t.normalized,t.stride,t.offset),this.bindVertexAttribDivisor(e,t,i);else{const o=r._dataTypeSize(t.dataType);for(let r=0;r<n;r++)s.vertexAttribPointer(e+r,n,a,t.normalized,t.stride,t.offset+r*n*o),this.bindVertexAttribDivisor(e+r,t,i)}}else this.type===r.ElementArrayBuffer&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,this._glBuffer);return this}remove(){return this._unprepare(),this}subData(e,t){const i=this._gl;this._glBuffer||this.prepare();const n=this._toGlParam(this.type)||i.ARRAY_BUFFER;return i.bindBuffer(n,this._glBuffer),i.bufferSubData(n,e,t),this}replaceData(e){e&&(this._initData=e),this.isDirty=!0}commitData(){const e=this._gl,t=this._toGlParam(this.type)||e.ARRAY_BUFFER,i=this._toGlParam(this.drawType)||e.STATIC_DRAW;e.bindBuffer(t,this._glBuffer),e.bufferData(t,this._initData,i),this.isDirty=!1}getGLType(){return this._toGlParam(this.options.dataType)}getData(){return this._initData}prepare(){return this._glBuffer=this._gl.createBuffer(),this.commitData(),this._preserveData||(this._initData=null),this}_unprepare(){this._glBuffer&&this._gl.deleteBuffer(this._glBuffer),this._glBuffer=null,this._initData=null,this.isDirty=!1}_toGlParam(e){const t=this._gl;return e===r.ArrayBuffer?t.ARRAY_BUFFER:e===r.ElementArrayBuffer?t.ELEMENT_ARRAY_BUFFER:e===r.StaticDraw?t.STATIC_DRAW:e===r.DynamicDraw?t.DYNAMIC_DRAW:e===r.Byte?t.BYTE:e===r.Short?t.SHORT:e===r.Int?t.INT:e===r.Float?t.FLOAT:e===r.UnsignedByte?t.UNSIGNED_BYTE:e===r.UnsignedShort?t.UNSIGNED_SHORT:e===r.UnsignedInt?t.UNSIGNED_INT:null}_hasRealWebGLContext(){return"undefined"!=typeof window&&("WebGLRenderingContext"in window||"WebGL2RenderingContext"in window)}bindVertexAttribDivisor(e,t,i){const n=this._gl;t.instanceDivisor&&this._hasRealWebGLContext()&&(n instanceof WebGLRenderingContext?i?i.vertexAttribDivisorANGLE(e,t.instanceDivisor):console.error("Can't set up instanced attribute divisor. Missing ANGLE_instanced_arrays extension"):n.vertexAttribDivisor(e,t.instanceDivisor))}}function s(e){if(void 0===e)return;const t=window.WebGLRenderingContext,i={[t.UNSIGNED_BYTE]:r.UnsignedByte,[t.UNSIGNED_SHORT]:r.UnsignedShort,[t.UNSIGNED_INT]:r.UnsignedInt,[t.BYTE]:r.Byte,[t.SHORT]:r.Short,[t.INT]:r.Int,[t.FLOAT]:r.Float}[e];return void 0===i?(console.error(`Cannot translate ${e} gltf componentType`),NaN):i}n=r,r.ArrayBuffer=1,r.ElementArrayBuffer=2,r.StaticDraw=10,r.DynamicDraw=11,r.Float=20,r.UnsignedByte=21,r.UnsignedShort=22,r.UnsignedInt=23,r.Byte=24,r.Short=25,r.Int=26,r.defaultOptions={itemSize:3,dataType:n.Float,stride:0,offset:0,normalized:!1,instanceDivisor:0,drawType:r.StaticDraw}},8451:(e,t,i)=>{"use strict";i.d(t,{K:()=>o});var n=i(8369);class o{constructor(e,t={}){this._buffer=e,this.options=Object.assign({},n.l.defaultOptions,t)}get isDirty(){return this._buffer.isDirty}set isDirty(e){this._buffer.isDirty=e}bind(e,t,i,n){this._buffer.bind(e,t||this.options,i,n)}replaceData(e){this._buffer.replaceData(e)}commitData(){this._buffer.commitData()}getData(){return this._buffer.getData()}}},5220:(e,t,i)=>{"use strict";i.d(t,{e:()=>r,f:()=>o});var n=i(1375);const o={defines:[],hash:""};class r{constructor(e,t,i=o,n=o){this.shader=null,this.type="vertex"===e?r.Vertex:r.Fragment,this.sourceCode=t,this.commonDefinitions=i,this.definitions=n}static createShaderDefinitions(e){return{defines:e,hash:e.map((e=>{var t;return`${e.type}:${null!==(t=e.value)&&void 0!==t?t:""}`})).join("")}}get(e){return this.shader||this.compile(e),this.shader}remove(e){this.shader&&(e.deleteShader(this.shader),this.shader=null)}getCode(){return this.assembleShaderText().slice()}compile(e){const t=this.type===r.Vertex?e.VERTEX_SHADER:e.FRAGMENT_SHADER,i=this.shader=e.createShader(t);if(!i||e.isContextLost())throw new Error(`[WebGl] Failed to create shader. Shader is null: ${String(!i)}. Context is lost: ${String(e.isContextLost())}`);const o=this.assembleShaderText();if(e.shaderSource(i,o),e.compileShader(i),(0,n.I0)()&&!e.getShaderParameter(i,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(i),n=(o||"").split("\n");throw new Error(t?t.replace(/^ERROR:\s*(\d+):(\d+):\s*(.*?)\n/,(function(e,t,i,o){const r=n[Number(i)-1];return r?`ERROR ${t}:${i}: ${o}\nErroneous line: <<${r}>>\n`:e})):"Unknown shader compilation error")}}assembleShaderText(){const e=this.sourceCode,t=[...this.commonDefinitions.defines,...this.definitions.defines].map((e=>void 0!==e.value?"#define "+e.type+" "+e.value:"#define "+e.type)),i=Array.isArray(e)?e:[e||""];let n=!0;for(const e of i)n&&-1!==e.indexOf("#version")?t.unshift(e):t.push(e),n=!1;return t.join("\n")}}r.Vertex=1,r.Fragment=2},9141:(e,t,i)=>{"use strict";i.d(t,{L:()=>n,S:()=>o});class n{constructor(e){var t;this._enable=!1,this.name=e.name,this.index=e.index,this.location=void 0!==e.location?e.location:-1,this.locationsCount=null!==(t=e.locationsCount)&&void 0!==t?t:1,o(this.locationsCount)}bindLocation(e,t){return-1!==this.location&&!0!==this.index&&e.bindAttribLocation(t,this.location,this.name),this}getLocation(e,t){return-1===this.location&&!0!==this.index&&(this.location=e.getAttribLocation(t,this.name)),this}bind(e,t){if(!this._enable&&!0!==this.index){for(let t=0;t<this.locationsCount;t++)e.enableVertexAttribArray(this.location+t);this._enable=!0}return t.bind(this.location,void 0),this}disable(e){if(this._enable&&!0!==this.index){for(let t=0;t<this.locationsCount;t++)e.disableVertexAttribArray(this.location+t);this._enable=!1}return this}}function o(e){if(e<0||e>4)throw new Error("[WebGl] Invalid attribute location count. Must be 1, 2, 3 or 4")}},2618:(e,t,i)=>{"use strict";i.d(t,{TD:()=>c,X4:()=>r,gl:()=>o});var n=i(6273);const o=4294967295,r=4294967040,s=r-1,a={},l=["main","parser","labeling","models"];let d=0;l.forEach((e=>{const t=d+Math.floor(s/l.length);a[e]={min:d,max:t-1e6},d=t}));class c{constructor(e){this.ids=[],this.orphanIds=[],this.phases=[],this.sublayers=[],this.styleIds=[],this.layerIds=[],this.instanceIds=[],this.objectClasses=[],this.floorIds=[],this.center=[],this.strings={},this.minIdentifyIndex=a[e].min,this.maxIdentifyIndex=a[e].max,this.index=this.minIdentifyIndex}getIndex(e,t,i,n={}){const{id:r,tileProps:s,tileAttrs:a}=e,l=i.interactive,d=!n.ignoreHover&&a[s.hovered],c=d&&"polygon3d"!==i.type||"embankment"===i.type;return!!r&&l&&!d&&!c?this.getIndexInternal(Object.assign({id:r,styleId:t,layer:i,sublayer:a[s.db_sublayer]},n)):o}getIndexInternal(e){var t,i,r,s,a,l,d;const c=this.index+this.ids.length;this.ids.push(e.id),this.floorIds.push(null!==(t=e.floorId)&&void 0!==t?t:""),this.phases.push(e.layer.renderIndex),this.sublayers.push(null!==(s=null===(r=null===(i=e.metatile)||void 0===i?void 0:i.dictionaries.db_sublayer)||void 0===r?void 0:r[e.sublayer])&&void 0!==s?s:NaN),this.styleIds.push(e.styleId),this.layerIds.push(e.layer.innerId),this.instanceIds.push(null!==(a=e.instanceId)&&void 0!==a?a:0);const{center:u,objectClass:h}=e;if(u?this.center.push(Math.round(u[0]),Math.round(u[1])):this.center.push(n.Cd,n.Cd),"string"==typeof h){const t=null===(d=null===(l=e.metatile)||void 0===l?void 0:l.dictionaries.db_object_class)||void 0===d?void 0:d[h];t?this.objectClasses.push(t):(this.objectClasses.push(0),this.strings[c]={objectClass:h})}else this.objectClasses.push(o);return c}addOrphanId(e){this.orphanIds.push(e)}getIndexerStats(){return{ids:this.ids.length,orphanIds:this.orphanIds.length,floorIds:this.floorIds.length,phases:this.phases.length,sublayers:this.sublayers.length,styleIds:this.styleIds.length,layerIds:this.layerIds.length,instanceIds:this.instanceIds.length,objectClasses:this.objectClasses.length,strings:Object.keys(this.strings).length,center:this.center.length}}getPacked(){const e=this.ids,t=this.orphanIds,i=this.floorIds,n=new Float32Array(this.phases).buffer,o=new Uint32Array(this.sublayers).buffer,r=new Uint16Array(this.styleIds).buffer,s=new Uint32Array(this.layerIds).buffer,a=new Uint8Array(this.instanceIds).buffer,l=new Uint32Array(this.objectClasses).buffer,d=new Int32Array(this.center).buffer,c=this.index,u=this.index+this.ids.length-1;this.index=this.index+this.ids.length,this.index>this.maxIdentifyIndex&&(this.index=this.minIdentifyIndex);const h=this.strings;return this.ids=[],this.orphanIds=[],this.floorIds=[],this.phases=[],this.sublayers=[],this.styleIds=[],this.layerIds=[],this.instanceIds=[],this.objectClasses=[],this.strings={},this.center=[],{idBuffer:e,orphanIds:t,floorIdBuffer:i,startIndex:c,endIndex:u,phaseBuffer:n,sublayerBuffer:o,styleIdBuffer:r,layerIdBuffer:s,instanceIdBuffer:a,objectClassBuffer:l,centerBuffer:d,strings:h}}}},6311:(e,t,i)=>{"use strict";i.d(t,{P:()=>y});var n=i(1436);const o=.8;class r{constructor(e,t){this.offset=0,this.stride=t,this.buffer=new ArrayBuffer(e),this.view=new Int32Array(this.buffer),this.comittedOffsets=0,this.maximum=e/t,this.watermark=this.maximum*o}extend(){const e=2*this.buffer.byteLength;this.maximum=e/this.stride,this.watermark=this.maximum*o;const t=new ArrayBuffer(e),i=new Int32Array(t);return i.set(this.view),this.buffer=t,this.view=i,t}}class s{constructor(e){this.offset=0,this.buffer=new Int32Array(e),this.comittedOffsets=0,this.watermark=e*o}extend(){const e=2*this.buffer.length;this.watermark=e*o;const t=new Int32Array(e);t.set(this.buffer),this.buffer=t}}class a{constructor(e,t,i,o,a,l){this.objectsData={},this.extents=new Float32Array([1/0,1/0,1/0,-1/0,-1/0,-1/0]),this.maxDiag=0,this.drawMode=a;const d="buildingModel"!==e?67200:336e3,c=(0,n.vP)(e,t);this.elements=new r(d,c),this.indices=new s(2*d/c),this.views={},this.binder=o,o(this,this.elements.buffer),this.attributes=i,this.key=l}static generateKey(e){const t=e;return JSON.stringify(t)}resetOffsets(){this.elements.offset=0,this.elements.comittedOffsets=0,this.indices.offset=0,this.indices.comittedOffsets=0}resetBuildingsData(){this.objectsData={}}resetInstancesExtents(){this.extents[0]=1/0,this.extents[1]=1/0,this.extents[2]=1/0,this.extents[3]=-1/0,this.extents[4]=-1/0,this.extents[5]=-1/0,this.maxDiag=0}commit(){this.elements.comittedOffsets=this.elements.offset,this.indices.comittedOffsets=this.indices.offset}rollback(){this.elements.offset=this.elements.comittedOffsets,this.indices.offset=this.indices.comittedOffsets}checkWatermarks(){let e=0;const t=this.elements;t.offset>t.watermark&&(t.offset>=t.buffer.byteLength/t.stride&&(e=1),this.binder(this,t.extend()));const i=this.indices;return i.offset>i.watermark&&(i.offset>=i.buffer.length&&(e=1),i.extend()),e}}var l=i(2618),d=i(9899),c=i(9218),u=i(6479),h=i(7486);class m{constructor(){this.packer=new d.Z(c.atlasSize[0],c.atlasSize[1]),this.currentAtlasIndex=0,this.packedRasters=[],this.rastersToLoad=[],this.newRasterSets=new Map}addNewRasterSet(e,t){let i=this.newRasterSets.get(e);i||(i=[],this.newRasterSets.set(e,i)),i.push(t)}pack(e,t,i){e.isSvg?this.packSvg(e,t.map((e=>({w:e,h:e}))),i):this.packPng(e,t.map((e=>({w:e,h:e}))),i)}packSvg(e,t,i){const{rasters:n}=e,o=new Set;for(const{w:e,h:t}of n)o.add(`${e}_${t}`);for(const r of t){const t=r.w*i,s=r.h*i;if(o.has(`${t}_${s}`))continue;let a=this.packer.packOne(t+2,s+2);null===a&&(this.packer=new d.Z(c.atlasSize[0],c.atlasSize[1]),this.currentAtlasIndex++,a=this.packer.packOne(t+2,s+2));const l=n.length,u={rasterSetIndex:e.index,rasterIndex:l,w:t,h:s,x:a.x+1,y:a.y+1,anchorX:e.anchorX,anchorY:e.anchorY,atlasIndex:this.currentAtlasIndex,isPacked:!0};n.push(u),this.packedRasters.push(e.index,l,u.x,u.y,u.w,u.h,this.currentAtlasIndex)}}addRastersToLoad(e,t){this.rastersToLoad.push(e,t.rasterSetIndex,t.rasterIndex)}getNewRasterSets(){const e=this.newRasterSets;return this.newRasterSets=new Map,e}getPackedRasters(){if(0===this.packedRasters.length)return;const e=new Uint16Array(this.packedRasters);return this.packedRasters=[],e}getRastersToLoad(){const e=new Float64Array(this.rastersToLoad);return this.rastersToLoad=[],e}packPng(e,t,i){const{rasters:n}=e,o=new Set;for(const{w:e,h:t}of n)o.add(`${e}_${t}`);for(const r of t){if(o.has(`${r.w}_${r.h}`)&&e.type===u.f.Static)continue;const t=r.w*i,s=r.h*i;let a,l=(0,h.Bl)(n,t,!1);if(void 0===l)l=n.length,a={rasterSetIndex:e.index,rasterIndex:l,w:t,h:s,x:0,y:0,anchorX:0,anchorY:0,atlasIndex:this.currentAtlasIndex,isPacked:!1},n.push(a);else if(a=e.rasters[l],a.isPacked)continue;let m=this.packer.packOne(a.w+2,a.h+2);null===m&&(this.packer=new d.Z(c.atlasSize[0],c.atlasSize[1]),this.currentAtlasIndex++,m=this.packer.packOne(a.w+2,a.h+2)),a.x=m.x+1,a.y=m.y+1,a.atlasIndex=this.currentAtlasIndex,a.isPacked=!0,this.packedRasters.push(e.index,l,a.x,a.y,a.w,a.h,this.currentAtlasIndex)}}}var f=i(6273),_=i(5589);const p=Math.pow(2,20),v=["main","parser","labeling","models"],g={};for(let e=0;e<v.length;e++){g[v[e]]={min:1+e*p,max:(e+1)*p}}class y{constructor(e){this.atlasPacker=new m,this.pointIndexer=new _.JR,this.floorHidingMap=new Map,this.usedModels=new Set,this.dataModels={},this.promotedObjectAttributes={},this.addedBuckets=[],this.labels=[],this.idIndexer=new l.TD(e),this.workerName=e,this.dataModelsIndex=g[e].min,this.buckets={},this.geoJsonData=[],this.reset()}reset(){this.buckets={},this.geoJsonData=[],this.addedBuckets=[],this.floorHidingMap.clear(),this.labels=[],this.usedModels.clear()}getStatsAfterReset(){return{buckets:Object.keys(this.buckets).length,geoJsonData:this.geoJsonData.length,addedBuckets:this.addedBuckets.length,floorHidingMap:this.floorHidingMap.size,labels:this.labels.length,usedModels:this.usedModels.size}}addLabel(e){this.labels.push(e)}addUsedModel(e){this.usedModels.add(e)}getIndexerStats(){return this.idIndexer.getIndexerStats()}getBucketsMemoryFootprint(){return Object.keys(this.buckets).map((e=>{const t=e,i=this.buckets[t];return i?{[e]:Object.keys(i).map((e=>{const t=i[e];if(t&&"object"==typeof t){return{[e]:Object.keys(t).map((e=>{const i=t[e];if(i&&i.elements&&i.elements.buffer)return{elementsBuffer:i.elements.buffer.byteLength,indices:i.indices.buffer.byteLength}}))}}return{[e]:0}}))}:{[e]:[]}}))}addPromotedObjectAttributes(e,t){this.promotedObjectAttributes[e]=t}addFeature(e){this.geoJsonData.push(e)}addUsedModelByUrl(e){const t=this.dataModels[e];if(void 0!==t)return t;const{min:i,max:n}=g[this.workerName];this.dataModelsIndex=i+(this.dataModelsIndex+1-i)%(n-i);const o=-this.dataModelsIndex;return this.dataModels[e]=o,o}getDataModelsUrls(){const e={};for(const t in this.dataModels)this.usedModels.has(this.dataModels[t])&&(e[t]=this.dataModels[t]);return e}getBucket(e,t,i,n,o=f.Fg){let r=this.buckets[e];void 0===r&&(r={},this.buckets[e]=r);let s=r[t];void 0===s&&(s=r[t]={});const l=a.generateKey(i),d=s[l];if(d)return this.addedBuckets.push(d),d;const c=new a(e,t,i,n,o,l);return s[l]=c,this.addedBuckets.push(c),c}isOverloaded(){const e=this.addedBuckets;let t=0,i=0;for(;i<e.length;)t+=e[i++].checkWatermarks();const n=t>0;if(n)for(;i--;)e[i].rollback();else for(;i--;)e[i].commit();return e.length=0,n}addFloorHidingMap(e,t){let i=this.floorHidingMap.get(t);void 0===i&&(i=[],this.floorHidingMap.set(t,i)),i.push(e)}getAccumulatedData(){const e=this.buckets,t=[],i=[];for(const o in e){const r=o,s=e[r];for(const e in s){const o=e,a=s[o],l=(0,n.vP)(r,o)/4;let d=0;for(const e in a)d+=a[e].indices.offset;if(0===d)continue;const c=[],u=new Int32Array(d*l);let h=0;for(const e in a){const t=a[e],{elements:i,indices:n,attributes:o,meta:r,objectsData:s,extents:d,maxDiag:m}=t,{view:f}=i,{buffer:_}=n;if(0===i.offset)continue;const p=h,v={};for(let e=0;e<n.offset;e++){const t=s?s[e]:null;if(t){b(t,h/l,v)}const i=_[e]*l;for(let e=0;e<l;e++)u[h++]=f[i+e]}c.push({attributes:o,drawMode:t.drawMode,rangeStart:4*p,rangeEnd:4*h,meta:r,objectsData:Object.keys(v).length>0?v:void 0,extents:new Float32Array(d),maxDiag:m}),t.resetOffsets(),t.resetBuildingsData(),t.resetInstancesExtents(),t.meta=void 0}t.push({symbol:r,sink:o,buffer:u.buffer,generatedObjects:c}),i.push(u.buffer)}}const o=this.idIndexer.getPacked();i.push(o.centerBuffer),i.push(o.instanceIdBuffer),i.push(o.layerIdBuffer),i.push(o.objectClassBuffer),i.push(o.phaseBuffer),i.push(o.styleIdBuffer),i.push(o.sublayerBuffer);const r=this.atlasPacker.getPackedRasters();void 0!==r&&i.push(r.buffer);const s=this.atlasPacker.getRastersToLoad();i.push(s.buffer);const a=this.getDataModelsUrls();this.usedModels=new Set;const l=this.floorHidingMap;this.floorHidingMap=new Map;const d=this.labels;this.labels=[];const c=this.promotedObjectAttributes;this.promotedObjectAttributes={};const u=this.geoJsonData.length?this.geoJsonData:void 0;return this.geoJsonData=[],{data:t,labels:d,floorHidingMap:l,packedRasters:r,rastersToLoad:s,dataModelsUrls:a,identifyIds:o,transferable:i,promotedObjectAttributes:c,debugGeoJsonData:u}}}function b(e,t,i){const n=e.objectId;i[n]||(i[n]=[]);let o=!1;for(const r of i[n]){const i=r.offset+r.size,n=t+e.size;(r.offset<=t&&i>=t||t<=r.offset&&n>=r.offset)&&(r.offset=Math.min(t,r.offset),r.size=Math.max(i,n)-r.offset,o=!0)}o||i[n].push({offset:t,size:e.size})}},5589:(e,t,i)=>{"use strict";i.d(t,{JR:()=>a,KJ:()=>r,V$:()=>s});var n=i(6490);const o=Math.pow(2,32)-2,r=(0,n.P_)(Math.pow(2,32)-1),s=(0,n.P_)(Math.pow(2,32)-2);class a{constructor(){this.colorById=new Map,this.index=0}getIndex(e){if(!e)return this.nextIndex();const t=this.colorById.get(e);if(void 0!==t)return t;const i=this.nextIndex();return this.colorById.set(e,i),i}nextIndex(){return++this.index%o}}},5317:(e,t,i)=>{"use strict";i.d(t,{x:()=>u});var n=i(2153),o=i(3754),r=i(1245),s=i(6336),a=i(3625),l=i(8585),d=i(9073);const c=new Map;class u{constructor(e,t,i,u,h,m,f,_){if(this.anchorWorld=[0,0,0,0],this.anchorGeo=[0,0],this.groupPriority=0,this.labelingGroup=o.T_,this.marginTopBottom=0,this.marginLeftRight=0,this.elevation=0,this.type=t,this.label=e,this.layer=e.layer,this.elevation=e.elevation,e.planLevel&&(this.elevation+=e.planLevel*(0,d.a4)(e.geoPoint,_)),this.id=e.id+"_"+t+"_"+Math.floor(i[0]/1e3)+"_"+Math.floor(i[1]/1e3)+this.getIconLabelPriorityToId(e),r.JG(this.anchorWorld,i),this.anchorGeo=e.geoPoint,0!==u&&(this.anchorWorld[2]*=u),f){const e=l._.fromGeo(this.anchorGeo);this.anchorScreen=h.ecef.project(e,!1)}else this.anchorScreen=h.flat.project([this.anchorWorld[0],this.anchorWorld[1],this.anchorWorld[2]+this.elevation,0]);switch(this.anchorPosition=0,this.anchorSegmentIndex=0,this.halfLabelWidth=0,this.commPriorityRandomFactor=NaN,this.itemPriority=t===n.Dl.Icon?e.iconPriority:e.labelPriority,this.layer.type){case"labelLine":this.labelingGroup=this.layer.style.labelingGroup,this.groupPriority=e.styleTextPriority;break;case"oneWayLine":this.labelingGroup=this.layer.style.labelingGroup,this.groupPriority=this.layer.style.priority;break;case"point":if((0,a.hn)(e))if(c.has(this.label.id))this.commPriorityRandomFactor=c.get(this.label.id);else{const e=(0,s.M)();this.commPriorityRandomFactor=e,c.set(this.label.id,e)}t===n.Dl.PoiText?(this.labelingGroup=this.layer.style.allowOverlap?o.R_:this.layer.style.textLabelingGroup,this.groupPriority=this.layer.style.iconImage?Math.min(e.styleTextPriority,e.styleIconPriority):e.styleTextPriority,this.marginTopBottom=this.layer.style.textLabelingMargin.topBottom,this.marginLeftRight=this.layer.style.textLabelingMargin.leftRight):t===n.Dl.PoiText2?(this.labelingGroup=this.layer.style.allowOverlap?o.R_:this.layer.style.textLabelingGroup2,this.groupPriority=Math.min(e.styleTextPriority,e.styleIconPriority),this.marginTopBottom=this.layer.style.textLabelingMargin.topBottom,this.marginLeftRight=this.layer.style.textLabelingMargin.leftRight):(this.labelingGroup=this.layer.style.allowOverlap?o.R_:this.layer.style.iconLabelingGroup,this.groupPriority=e.styleIconPriority,this.marginTopBottom=this.layer.style.iconLabelingMargin.topBottom,this.marginLeftRight=this.layer.style.iconLabelingMargin.leftRight)}this.labelingGroupTable=m.labelingGroups.table,this.overflowStyleZoom=-1/0,this.boxes=[],this.placementIndex=0}getIconLabelPriorityToId(e){if((0,a.hn)(e))return"";const{layer:t}=e;if("point"===t.type){return"_"+e.styleIconPriority.toFixed(0)+"_"+e.styleTextPriority.toFixed(0)}return""}}},3625:(e,t,i)=>{"use strict";i.d(t,{D$:()=>M,Ty:()=>p,dy:()=>g,hn:()=>b,m2:()=>y});var n=i(9218),o=i(2153);function r(e,t,i){const n=e[t];if(void 0!==n)return n[i]}var s,a=i(7123),l=i(9808);function d(e,t,i){const{minX:n,maxX:o,minY:r,maxY:s}=i;e.push(n,r,o-n,s-r,t)}function c(e,t,i,n){const o=e.anchorScreen,r=e.boxes[t];return{element:e,minX:o[0]+r[0]-i,maxX:o[0]+r[2]+i,minY:o[1]+r[1]-n,maxY:o[1]+r[3]+n}}function u(e,t){if(e.parent===t||e.firstLabel===t||t.parent===e||t.firstLabel===e)return!1;const i=e.labelingGroup,n=t.labelingGroup;return function(e,t,i,n){const o=r(e,i,n),s=r(t,i,n);return void 0===o&&void 0===s||(void 0===o?void 0===s||s:void 0===s?void 0===o||o:o||s)}(e.labelingGroupTable,t.labelingGroupTable,i,n)}function h(e,t,i,n,o,r){const s=c(t,i,n,o);if(s.minX>r.maxX||s.maxX<r.minX||s.minY>r.maxY||s.maxY<r.minY)return!0;const a=e.search(s);for(let e=0;e<a.length;e++)if(u(t,a[e].element))return!0;return!1}function m(e,t,i,n,r){if(-1!==e.placementIndex)if(h(t,e,0,n.leftRight,n.topBottom,i))e.placementIndex=-1,r&&d(r,o.m3.CommercialDead,c(e,0,n.leftRight,n.topBottom));else{e.placementIndex=0;const i=c(e,0,n.leftRight,n.topBottom);t.insert(i),r&&d(r,o.m3.CommercialAlive,i)}else r&&d(r,o.m3.CommercialDead,c(e,0,n.leftRight,n.topBottom))}function f(e,t,i,n){let r=!0;for(let s=0;s<e.boxes.length;s++)if(h(t,e,s,e.marginLeftRight,e.marginTopBottom,i)){if(r=!1,n)for(let t=0;t<e.boxes.length;t++){const i=c(e,t,e.marginLeftRight,e.marginTopBottom);let r;r=t===s?o.m3.Dead:t<s?o.m3.Alive:o.m3.Unused,d(n,r,i)}break}if(r)for(let i=0;i<e.boxes.length;i++){const r=c(e,i,e.marginLeftRight,e.marginTopBottom);t.insert(r),n&&d(n,o.m3.Alive,r)}e.placementIndex=r?0:-1}function _(e,t){return e.sort(((e,i)=>i.groupPriority-e.groupPriority||(t.has(i.id)?1:0)-(t.has(e.id)?1:0)||i.commPriorityRandomFactor-e.commPriorityRandomFactor))}function p(e){return e.type!==o.Dl.Box&&!Number.isNaN(e.commPriorityRandomFactor)}function v(e){return e.label.pointType===o.a_.CommercialCity}function g(e){return p(e)&&v(e)}function y(e){return p(e)&&e.label.pointType===o.a_.CommercialPremium}function b(e){return e.pointType===o.a_.Commercial||e.pointType===o.a_.CommercialCity||e.pointType===o.a_.CommercialPremium}function x(e){return e.label.pointType!==o.a_.CommercialCity||-1!==e.placementIndex&&e.label.pointType===o.a_.CommercialCity}function w(e,t){if(0===t.size)return!1;const i=e.filter((e=>!!function(e,t){return e.type===o.Dl.Icon&&t.has(e.label.id)}(e,t)&&(e.adsType=s.Donor,!0))).length;return i>0}function S(e,t,i,n,r){switch(e.type){case o.Dl.LineText:case o.Dl.Icon:if(-1===e.placementIndex&&p(e))break;f(e,i,n,r);if(e.adsType===s.Donor){const o=t.get(e.label.id);if(!o)break;-1!==e.placementIndex&&(o.parent=e,f(o,i,n,r),t.delete(e.label.id))}break;case o.Dl.Box:if(!e.parent){f(e,i,n,r);break}e.placementIndex=-1;break;case o.Dl.PoiText:case o.Dl.PoiText2:e.parent&&-1===e.parent.placementIndex||e.firstLabel&&-1===e.firstLabel.placementIndex?e.placementIndex=-1:function(e,t,i,n){e.placementIndex=-1;for(let r=0;r<e.boxes.length;r++)if(!e.firstLabel||e.firstLabel.placementIndex===r){if(!h(t,e,r,e.marginLeftRight,e.marginTopBottom,i)){const i=c(e,r,e.marginLeftRight,e.marginTopBottom);if(t.insert(i),e.placementIndex=r,n){d(n,o.m3.Alive,i);for(let t=r+1;t<e.boxes.length;t++)d(n,o.m3.Unused,c(e,t,e.marginLeftRight,e.marginTopBottom))}break}n&&d(n,o.m3.Dead,c(e,r,e.marginLeftRight,e.marginTopBottom))}}(e,i,n,r)}}function M(e,t,i,r,d,c){const u=[],h=new Map;t.forEach((e=>{if((t=e).type===o.Dl.Box&&"markerText"===t.labelingGroup&&void 0!==t.parent)return h.set(e.parent.label.id,e),void(e.placementIndex=-1);var t;u.push(e)}));const f=new Set(h.keys());let g=[];if(i.globeMode){for(const t of e)c.ecef.canSee(t.anchorGeo)?g.push(t):t.placementIndex=-1;for(const e of u)c.ecef.canSee(e.anchorGeo)?g.push(e):e.placementIndex=-1}else g=e.concat(u);const y=i.debugLabels?[]:void 0,{size:b,viewport:M}=i,I=b[0],T=b[1],E=(n.labeling.tileMultiplier-1)/2,P=Math.round(I*E),A=Math.round(T*E),L={minX:M.left-P,maxX:M.left+I+P,minY:M.top-A,maxY:M.top+T+A},C=a(),z=w(g,f),k=g.sort(((e,t)=>{const n=e.label instanceof l._?e.label.hovered:0,o=t.label instanceof l._?t.label.hovered:0,a=r.has(e.id),d=r.has(t.id),c=i.disableSurvivedPoiPrevalence?0:(d?1:0)-(a?1:0),u=z?(t.adsType===s.Donor?1:0)-(e.adsType===s.Donor?1:0):0;return t.groupPriority-e.groupPriority||(p(t)?t.commPriorityRandomFactor+ +d:0)-(p(e)?e.commPriorityRandomFactor+ +a:0)||u||c||o-n||t.itemPriority-e.itemPriority||(t.label.id>e.label.id?1:t.label.id===e.label.id?0:-1)||t.label.layer.innerId-e.label.layer.innerId||t.anchorWorld[0]-e.anchorWorld[0]||t.anchorWorld[1]-e.anchorWorld[1]}));let O=-1;const R=k.filter(((e,t)=>!!p(e)&&(O=t,!0)));if(-1!==O){for(let e=0;e<=O;e++)S(k[e],h,C,L,y);C.clear(),function(e,t,i,n,o){const r=a();_(e.filter(v),i).forEach((e=>{m(e,r,t,n.city,o)})),r.clear(),_(e.filter(x),i).forEach((e=>{m(e,r,t,n.default,o)}))}(R,L,r,d,y)}for(let e=0;e<k.length;e++)S(k[e],h,C,L,y);return y}!function(e){e[e.Donor=0]="Donor"}(s||(s={}))},4824:(e,t,i)=>{"use strict";var n=i(9218),o=i(1436),r=i(7628),s=i(9808),a=i(3625),l=i(6311);class d{constructor(e,t,i){this.line=e,this.lengths=[],this.angles=[];let n=t,o=e[0],r=e[1];const s=e.length/3;for(let t=0;t<s;t++){const i=e[3*t]-o,s=e[3*t+1]-r;n+=Math.sqrt(i*i+s*s),this.lengths.push(n),o+=i,r+=s}this.finishLength=this.lengths[this.lengths.length-1],this.startLength=this.lengths[0],this.midLength=i/2,this.vertexCount=s,this.angles.push(0);for(let e=1;e<s;e++){const t=this.line[3*(e-1)],i=this.line[3*e],n=this.line[3*(e-1)+1],o=this.line[3*e+1];this.angles.push(Math.atan2(o-n,i-t))}}interpolate(e,t){const i=t,n=i-1,o=this.lengths[n],r=(e-o)/(this.lengths[i]-o);return[(1-r)*this.line[3*n]+r*this.line[3*i],(1-r)*this.line[3*n+1]+r*this.line[3*i+1],0,this.angles[t]]}getSegmentIndex(e){for(let t=0;t<this.lengths.length;t++)if(e<this.lengths[t])return t;return this.lengths.length}}class c{constructor(){this.labels={}}add(e){const t=e.id,i=e.componentDistanceStart;void 0===this.labels[t]&&(this.labels[t]={});const n=this.labels[t];void 0===n[i]&&(n[i]=[]),n[i].push(e)}merge(){const e=[];for(const t in this.labels){const i=this.labels[t],n=Object.keys(i).sort(((e,t)=>Number(e)-Number(t)));let o=0;for(;o<n.length;){const t=n[o];if(0===i[t].length){o++;continue}const r=[];let s=i[t].pop();for(;void 0!==s;)if(r.push(s),0===s.componentDistanceStart&&0===s.componentDistanceEnd||void 0===i[s.componentDistanceEnd])s=void 0;else{const e=s;if(s=i[s.componentDistanceEnd].pop(),s){const t=e.mapPointVertices.length;e.mapPointVertices[t-3]===s.mapPointVertices[0]&&e.mapPointVertices[t-2]===s.mapPointVertices[1]||(s=void 0)}}if(1===r.length){const t=r[0];t.axis=new d(t.mapPointVertices,t.componentDistanceStartWorld,t.objectLengthWorld),e.push(t)}else r.length>1&&e.push(this.stitch(r))}}return e}stitch(e){let t=0;for(let i=0;i<e.length;i++)t+=e[i].mapPointVertices.length;t-=3*(e.length-1);const i=new Int32Array(t);let n=0;for(let t=0;t<e.length;t++){const o=e[t].mapPointVertices;for(let e=t>0?3:0;e<o.length;e++)i[n++]=o[e]}const o=e[0];return o.axis=new d(i,o.componentDistanceStartWorld,o.objectLengthWorld),e[0]}}var u=i(5317),h=i(378),m=i(9450),f=i(1245),_=i(2153),p=i(6273),v=i(8585);class g{constructor(e,t,i,n,o,r,s,a,l,d,c,u){this.type=_.Dl.Box,this.marginTopBottom=0,this.marginLeftRight=0,this.id=e,this.label={layer:{innerId:0},styleId:-100,id:this.id,symbol:"nevermind",phase:NaN},this.groupPriority=null!=u?u:p.Rw,this.itemPriority=null!=c?c:1,this.parent=d,this.placementIndex=0,this.labelingGroup=l,this.labelingGroupTable=a.labelingGroups.table,this.anchorWorld=f.Ue(),m.JG(this.anchorWorld,n),0!==r&&(this.anchorWorld[2]*=r),this.anchorGeo=v.H.toGeo(this.anchorWorld),this.anchorScreen=s.project(this.anchorGeo),h.IH(this.anchorScreen,this.anchorScreen,o),this.boxes=[[0,0,t,i]]}}var y=i(9073),b=i(6490),x=i(4576),w=i(2543),S=i(3249),M=i(3754),I=i(297);const T=(0,b.Id)(n.labeling.axisAngleToleranceDeg),E=n.labeling.axisCheckDistancePx,P=(0,b.Id)(n.labeling.lineLabelsHidePitchDeg);function A(e,t,i,n,o,r,s,l,d,u,h,m){const f=[],p=[],v=[],y=[],b={},x=function(e,t){const i={personalPoi:new Set,commercialPoi:new Set};for(const n of e){const e=t.get(n);if(void 0!==e)for(const t of e)t.source===_.AL.PersonalPoi?i.personalPoi.add(t.id):(0,a.hn)(t)&&i.commercialPoi.add(t.id)}return i}(e,o),w=new c;for(let r=0;r<e.length;r++){const c=e[r],f=o.get(c);if(void 0===f)continue;const p=t.styleState._activeFloorIds;for(let e=0;e<f.length;e++){const o=f[e];if(o.source===_.AL.Tile&&u.has(o.id)&&!o.floorId)continue;if(o.floorId&&(o.planLevel=m[o.floorId],!((0,a.hn)(o)||0!==p.length&&p.includes(o.floorId))))continue;const r=n.getStyle(o.styleId);if(r){if((o.source===_.AL.PersonalPoi||!x.personalPoi.has(o.id)||(0,a.hn)(o))&&(o.source!==_.AL.PersonalPoi||!x.commercialPoi.has(o.id)))switch(o.layer.type){case"point":if(L(o,s,l,t.styleState,t.styleZoom,r,h,t.elevation)&&B(o,t.styleZoom))if(o.geometryType===_._r.Line)w.add(o);else{const e=[o.mapPointVertices[0],o.mapPointVertices[1],o.mapPointVertices[2],0];C(y,v,b,o,e,i,t,r,d)}break;case"labelLine":L(o,s,l,t.styleState,t.styleZoom,r,h,t.elevation)&&B(o,t.styleZoom)&&w.add(o);break;case"oneWayLine":B(o,t.styleZoom)&&w.add(o)}}else console.error(`Not found style ${o.styleId} in labeling#collectLabelingElements`)}}const M=w.merge();for(let e=0;e<M.length;e++){const o=M[e],r=n.getStyle(o.styleId);r?"point"===o.layer.type?z(y,v,b,o,r,i,t,d):k(p,y,o,r,i,t):console.error(`Not found style ${o.styleId} in labeling#collectLabelingElements`)}return r.forEach((({id:e,width:o,height:r,position:s,offset:a,labelingGroup:l,parentPoiId:d})=>{let c;if(d&&(c=b[d],!c))return;const u=n.getStyle(S.jf);if(!u)return void console.error(`Not found style ${S.jf} in labeling#collectLabelingElements`);const h=new g(e,o,r,s,a,t.buildingHeight,i,u,l,c,null==c?void 0:c.itemPriority,null==c?void 0:c.groupPriority);f.push(h)})),{boxElements:f,oneWayTileElements:p,noLabelingElements:v,otherTileElements:y}}function L(e,t,i,n,o,r,s,a){var l;const{layer:d}=e;if("point"!==d.type&&"labelLine"!==d.type)return!1;Number.isNaN(e.demElevation)?e.elevation=0:e.elevation=(e.demElevation-(null!=a?a:0))*y.C;const c=(0,w.bs)(o,n,!1,e.tileData);if(I.rJ&&!e.rtlProcessed&&(e.label=null!==(l=(0,I.iY)(e.label))&&void 0!==l?l:"",e.label2=(0,I.iY)(e.label2),e.iconLabel=(0,I.iY)(e.iconLabel),e.updateRanges(),s(p.Uo,e.ranges),(0,w.EG)(d.style.textFont).forEach((t=>{t.length&&s(t,e.ranges)})),"point"===d.type&&d.style.textFont2&&(0,w.EG)(d.style.textFont2).forEach((t=>{t.length&&s(t,e.ranges)})),"point"===d.type&&d.style.iconTextFont&&(0,w.EG)(d.style.iconTextFont).forEach((t=>{t.length&&s(t,e.ranges)})),e.rtlProcessed=!0),!e.rtlProcessed)return!1;const{ranges:u}=e,h=(0,x.rq)(d.style.textFont,c,r);let m;if(h&&e.label&&(0,x.dm)(h,u,i)&&(m=(0,x.JA)(e.label,d.style.textLetterSpacing,t[h]),e.textMetrics=m),"labelLine"===d.type)return!h||!!m;const f=(0,x.rq)(d.style.iconTextFont,c,r);f&&e.iconLabel&&(0,x.dm)(f,u,i)&&(e.iconTextMetrics=(0,x.JA)(e.iconLabel,d.style.iconTextLetterSpacing,t[f]));const _=(0,x.rq)(d.style.textFont2,c,r);return h&&e.label&&_&&e.label2&&(0,x.dm)(_,u,i)&&(e.textMetrics2=(0,x.JA)(e.label2,d.style.textLetterSpacing,t[_])),h&&e.label?!(!m||f&&e.iconLabel&&!e.iconTextMetrics||_&&e.label2&&!e.textMetrics2):!f||!e.iconLabel||!!e.iconTextMetrics}function C(e,t,i,n,r,s,a,l,d){var c;(0,o.Pn)(n,r,l,n.layer,a,s,d);for(let o=0;o<n.labelingElements.length;o++){const r=n.labelingElements[o];r.labelingGroup!==M.R_&&(null===(c=r.parent)||void 0===c?void 0:c.labelingGroup)!==M.R_?(e.push(r),r.type===_.Dl.Icon&&(i[r.label.id]=r)):t.push(r)}}function z(e,t,i,n,o,r,s,a){const{layer:l}=n;if("point"!==l.type)return;const{zoom:d,styleZoom:c}=s,u=Math.floor(c),h=d+(u-c),{startLength:m,midLength:f,finishLength:_}=n.axis,p=(0,w.bs)(u,s.styleState,!1,n.tileData),v=Math.max((0,y.h0)((0,w.vn)(l.style.duplicationSpacing,p),h),1),g=(0,y.h0)(l.style.endingOffsets,d),b=m+g,x=_-g;for(let l=m+(f-m)%v;l<x;l+=v)if(l>b){const d=n.axis,c=l,u=d.getSegmentIndex(c);C(e,t,i,n,d.interpolate(c,u),r,s,o,a)}}function k(e,t,i,o,r,s){const{layer:a}=i;if("labelLine"!==a.type&&"oneWayLine"!==a.type)return;const{zoom:l,styleZoom:d}=s,c=Math.floor(d),u=l+(c-d),{startLength:h,midLength:m,finishLength:f}=i.axis,_=(0,w.bs)(d,s.styleState,!1,i.tileData),p=(0,w.bs)(c,s.styleState,!1,i.tileData);let v,g,b,x;if("labelLine"===a.type){const e=(0,w.vn)(a.style.textFontSize,_)/n.fonts.baseSize,t=(0,w.vn)(a.style.textFontSize,p)/n.fonts.baseSize;v=i.textMetrics.maxWidth*e,g=i.textMetrics.maxWidth*t,b=(0,y.h0)((0,w.vn)(a.style.textDuplicationSpacing,p),u),x=(0,y.h0)(Math.max(a.style.lineEndingOffsets,a.style.textLabelingSideMargin),l)}else v=(0,w.vn)(a.style.lineLength,_),g=(0,w.vn)(a.style.lineLength,p),b=(0,y.h0)((0,w.vn)(a.style.duplicationSpacing,p),u),x=(0,y.h0)(a.style.endingOffsets,l);const S=(0,y.h0)(g,u),M=(0,y.h0)(v,l)/2,I=b+S,T=h+(m-h)%I,E=h+M+x,P=f-M-x,A="labelLine"!==a.type?e:t;for(let e=T;e<P;e+=I)e>E&&O(A,i,e,M,v,r,s,o)}function O(e,t,i,o,r,s,a,l){const d=t.axis,{zoom:c,styleZoom:h}=a,{startLength:m,finishLength:f}=d,p=d.getSegmentIndex(i),v=d.interpolate(i,p);if((0,y.gr)(s.position,v,a.center)>P||!function(e,t,i,o,r,s){if("oneWayLine"===e.layer.type)return!0;const a=e.axis,l=(0,w.bs)(r,s,!1,e.tileData),d=(0,w.vn)(e.layer.style.textFontSize,l)/n.fonts.baseSize,c=a.getSegmentIndex(t-i),u=a.getSegmentIndex(t+i),h=(0,y.h0)(E*d,o);for(let e=c;e<u;e++){if(e>1&&R(a.angles[e-1],a.angles[e])>T)return!1;const t=a.getSegmentIndex(a.lengths[e]-h);if(0!==t){if(R(a.angles[t],a.angles[a.getSegmentIndex(a.lengths[e]+h)])>T)return!1}}return!0}(t,i,o,c,h,a.styleState))return;const g="oneWayLine"===t.layer.type,b=g?_.Dl.OneWayLine:_.Dl.LineText,x=new u.x(t,b,v,a.buildingHeight,s,l,a.globeMode,a.styleState._floorHeight);x.anchorPosition=i,x.anchorSegmentIndex=p,x.halfLabelWidth=o,g||(x.overflowStyleZoom=(0,y.X$)((0,y.to)(r,f-m),v),function(e,t,i,n,o,r){const{axis:s,layer:a}=t;if("labelLine"!==a.type)return;const{zoom:l,styleZoom:d}=o,c=(0,w.bs)(d,o.styleState,!1,t.tileData),u=(0,w.vn)(a.style.textFontSize,c),h=u/2,m=(0,y.h0)(u,l),f=(0,y.h0)(a.style.textLabelingSideMargin,l),_=Math.max(0,i-n+m/2-f),p=Math.min(s.lengths[s.lengths.length-1],i+n-m/2+f);let v=s.getSegmentIndex(_);for(let t=_;t<p;t+=m){for(;s.lengths[v]<t;)v++;F(e,s,t,v,r,h)}for(;s.lengths[v]<p;)v++;F(e,s,p,v,r,h)}(x,t,i,o,a,s)),e.push(x)}function R(e,t){const i=Math.abs(e-t);return i>Math.PI?2*Math.PI-i:i}function F(e,t,i,n,o,r){const s=o.flat.project(t.interpolate(i,n));s[0]=s[0]-e.anchorScreen[0],s[1]=s[1]-e.anchorScreen[1],e.boxes.push([s[0]-r,s[1]-r,s[0]+r,s[1]+r])}function B(e,t){const{source:i,detailLevel:o,layer:{minzoom:r,maxzoom:s}}=e,a=i===_.AL.PersonalPoi,l=a||r>o,d=a||s<o+1||o===n.tiles.maxDetailLevel;return(!l||t>=r)&&(!d||t<s)}var D=i(7256),j=i(4500),N=i(3487),U=i(6892),H=i(7436),G=i(267),V=i(8194),Z=i(6336),W=i(4874),X=i(3187);const K=new Map;"function"==typeof self.importScripts&&function(e){const t=new D.D(e),i=new j.J(t),d=new l.P("labeling"),c=new H.h,u=i.get(U.P.Main,"loadFont"),h=new Map,m=new Map;let f=[],p=new Map;const v=new N.c,g=new N.c,y={},b=(0,r.P)((()=>d.reset()),n.workerResetInterval);function x(e,t){for(const i of t)v.has(e,i)||(u(e,i),v.set(e,i,!0))}function w(e,t,i){if(e.has(i.label.sourceId))return o.jh.none;const n=t.get(i.id);return void 0===n||void 0===n.placementIndex||n.type===_.Dl.Icon&&n.layer.innerId!==i.layer.innerId?o.jh.fadeIn:n.placementIndex===i.placementIndex?o.jh.none:o.jh.fadeIn}i.set("setComPoiRandomSeed",(e=>{(0,Z.P)(e)})),i.set("getMemoryFootprint",(()=>{const e=d.getBucketsMemoryFootprint(),t=[];let i=0;Array.from(h.keys()).forEach((e=>{const n=h.get(e);n&&(i+=n.length,t.push({label:{[e]:n.map((()=>({label:1})))}}))}));const n={collector:{buckets:e},labeling:t};return{js:Object.assign(Object.assign({},n),{"--labelsCount":i,"--sum":(0,X.QE)(n)})}})),i.set("appendLabels",((e,t,i,n,o)=>{const r=(0,s.v)(i,t,c,n,o);h.set(e,r)})),i.set("appendLabelBox",((e,t)=>{m.set(e,t)})),i.set("removeEmptyBoxLabel",(e=>{m.delete(e)})),i.set("removeLabels",(e=>{h.delete(e),m.delete(e)})),i.set("processLabels",((e,t,i,n,r,s,l,u)=>{const v=new Set(r),S=[];let M=new Map;const I=[];return i.forEach((i=>{const r=new W.V(i),b=new Set,T=[...t];e.forEach((({sourceId:e,animate:t,labelsKeys:i})=>{t||b.add(e),T.push(...i)}));const{boxElements:E,oneWayTileElements:P,otherTileElements:L,noLabelingElements:C}=A(T,i,r,c,h,m,y,g,n,v,x,u),z=(0,a.D$)(L,E,i,l?K:p,s,r),k=[...C,...P,...L],O=new Map;for(let e=0;e<k.length;e++){const t=k[e];-1!==t.placementIndex&&O.set(t.id,t)}for(let e=0;e<k.length;e++){const t=k[e],{label:{styleId:r,layer:s}}=t;if(-1===t.placementIndex)continue;const a=w(b,p,t),l=c.getStyle(r);l?(0,o.SV)(l,s,d,t,a,n,i,i.tileInfo):console.error(`Not found style ${r} in labeling#processLabels`)}for(let e=0;e<f.length;e++){const t=f[e],{id:r,label:s,layer:a}=t,{styleId:l}=s,u=c.getStyle(l);if(!u){console.error(`Not found style ${l} in labeling#processLabels`);continue}if(b.has(t.label.sourceId))continue;const h=t.placementIndex,m=O.get(r);-1!==h&&(t.placementIndex!==(null==m?void 0:m.placementIndex)||t.type===_.Dl.Icon&&t.layer.innerId!==(null==m?void 0:m.layer.innerId))&&(i.styleZoom<t.overflowStyleZoom||i.styleZoom<a.minzoom||i.styleZoom>=a.maxzoom||(0,o.SV)(u,a,d,t,o.jh.fadeOut,n,i,i.tileInfo))}S.push(...k),M=new Map([...M,...O]);const R=d.getAccumulatedData(),F=[];for(const e of E)-1!==e.placementIndex&&F.push(e.label.id);const B=new Map,D=(0,G.BS)(i.tilesBounds);for(const e of L)if(-1!==e.placementIndex&&(0,a.Ty)(e)&&V.r3(D,e.anchorWorld)){const t={};(0,a.dy)(e)?t.adsPriority="city":(0,a.m2)(e)&&(t.adsPriority="premium"),B.set(e.label.id,t)}const j={survivedLabelBoxIds:F,survivedCommPois:Array.from(B).map((e=>{const t={id:e[0]};return void 0!==e[1].adsPriority&&(t.adsPriority=e[1].adsPriority),t})),collectorOutput:R,transferable:R.transferable};if(z){const e=new Int32Array(z.length);e.set(z),j.labels=e.buffer}I.push(j)})),f=S,p=M,b(),I})),i.set("appendFont",((e,t)=>{y[e]||(y[e]={});const i=y[e];for(const e in t)i[e]=t[e]})),i.set("markFontAsLoaded",((e,t)=>{g.set(e,t,!0)})),i.set("addNewRasterSets",((e,t)=>{const i=c.getStyle(e);if(!i)return void console.error(`Not found style ${e} in labeling#addNewRasterSets`);const{rasterSets:n}=i;t.forEach((e=>{n.byIndex[e.index]=e,n.byKey[e.key]=e}))})),i.set("updatePackingInfo",((e,t)=>{var i;const n=c.getStyle(e);if(!n)return void console.error(`Not found style ${e} in labeling#updatePackingInfo`);const{rasterSets:o}=n,r=t.length/7;for(let e=0;e<r;e++){const n=t[7*e],r=t[7*e+1],s=t[7*e+6],a=t[7*e+2],l=t[7*e+3],d=t[7*e+4],c=t[7*e+5],u=o.byIndex[n];if(void 0!==u)if(u.isSvg)u.rasters[r]={rasterIndex:r,rasterSetIndex:n,x:a,y:l,w:d,h:c,anchorX:u.anchorX,anchorY:u.anchorY,atlasIndex:s,isPacked:!0};else{const e=null!==(i=u.rasters[r])&&void 0!==i?i:{rasterIndex:r,rasterSetIndex:n,x:a,y:l,w:d,h:c,anchorX:0,anchorY:0,atlasIndex:s,isPacked:!0};u.rasters[r]=e,e.x=a,e.y=l,e.atlasIndex=s,e.isPacked=!0}else console.error(`Not found raster set with index ${n}`)}})),i.set("clearPreviousLabels",(()=>{f=[],p.clear()})),i.set("syncStyle",((...e)=>c.proxySyncStyle(...e))),i.set("loadRtlPlugin",I.ng),i.set("markRtlPluginLoaded",(()=>{I.dp&&(0,I.dp)()}))}(self)},9808:(e,t,i)=>{"use strict";i.d(t,{_:()=>h,v:()=>u});var n=i(7999),o=i(2153),r=i(6392),s=i(6201),a=i(2618),l=i(2543),d=i(8585);function c(e){return"labelLine"===e.type||"point"===e.type||"oneWayLine"===e.type}function u(e,t,i,n,o){const r=[];for(const a of e)for(const e of a.labels){const l=i.getStyle(e.styleId);if(!l){console.error(`Not found style ${e.styleId} in unpackPreLabelingResult`);continue}const d=l.layersById[e.layerId];if(!d||!c(d)){console.error(`Not found layer: ${e.layerId} in style ${e.styleId} in unpackPreLabelingResult`);continue}const u=new h(e,d,t,a.metatileHash,!!n.floorStackOn);switch(e.type){case s.R2.Point:u.setSpecificPointAttributes(e,n,o);break;case s.R2.Line:u.setSpecificLineAttributes(e,n,o);break;case s.R2.OneWayLine:u.setSpecificOneWayAttributes(e)}r.push(u)}return r}class h{constructor(e,t,i,n,r){this.rtlProcessed=!1,this.labelingElements=[],this.id="",this.floorId="",this.planLevel=NaN,this.detailLevel=0,this.labelPriority=0,this.label="",this.ranges=[],this.pointType=o.a_.Common,this.iconPriority=0,this.styleIconPriority=0,this.styleTextPriority=0,this.identifyIndex=a.gl,this.identifyPoiLabelIndex=a.gl,this.labelingTextureIndex=a.gl,this.spritePointTextureIndex=a.gl,this.hovered=0,this.label2Priority=0,this.mapPointVertices=[0,0,0],this.geoPoint=[NaN,NaN],this.demElevation=0,this.elevation=0,this.componentDistanceStartWorld=0,this.componentDistanceEnd=0,this.componentDistanceStart=0,this.objectLengthWorld=0,this.checkPointOffset=[0,0],this.layer=t,this.styleId=e.styleId,this.source=i,this.sourceId=e.sourceId,this.metatileHash=n,this.geometryType=e.type===s.R2.Point?e.geometryType:o._r.Line,this.tileData=e.tileData,this.labelPriority=e.labelPriority,this.detailLevel=e.tileCoords[2],this.styleIconPriority=e.styleIconPriority,this.styleTextPriority=e.styleTextPriority,this.id=e.id,this.floorId=e.floorId,this.planLevel=r?Math.max(0,e.planLevel):0}setSpecificPointAttributes(e,t,i){if("point"!==this.layer.type)throw new Error("Label: layer type is not a point");const a=this.layer.style;this.pointType=e.pointType,this.label2Priority=e.label2Priority,this.iconPriority=e.iconPriority,this.identifyIndex=e.identifyIndex,this.identifyPoiLabelIndex=e.identifyPoiLabelIndex,this.labelingTextureIndex=e.labelingTextureIndex,this.spritePointTextureIndex=e.spritePointTextureIndex,this.hovered=e.hovered,this.demElevation=e.demElevation;const c=(0,l.bs)(i,t,!0,e.tileData);this.label=(0,n.lD)((0,s.It)(a.textField,c),a.textMaxLengthPerLine),a.textField2&&(this.label2=(0,n.lD)((0,s.It)(a.textField2,c),a.textMaxLengthPerLine)),"point"===this.layer.type&&a.iconTextField&&(this.iconLabel=(0,n.lD)((0,s.It)(a.iconTextField,c),a.textMaxLengthPerLine));const u=(0,r.Bs)(e.tileCoords);this.mapPointVertices=[];const h=[0,0,0],m=[0,0,0];if(e.geometryType===o._r.Point)(0,r.L7)(this.mapPointVertices,e.vertices,0,u),this.geoPoint=d.H.toGeo(this.mapPointVertices),this.layer.style.allowElevation||(this.mapPointVertices[2]=0);else{for(let t=0;t<e.vertices[0].length;t++)h[0]=e.vertices[0][t],h[1]=e.vertices[1][t],(0,r.Z$)(m,h,u),this.mapPointVertices.push(m[0],m[1],m[2]);this.componentDistanceStart=e.componentDistanceStart,this.componentDistanceEnd=e.componentDistanceEnd,this.componentDistanceStartWorld=(0,r.C5)(this.componentDistanceStart,e.tileCoords[2]),this.objectLengthWorld=(0,r.C5)(e.objectLength,e.tileCoords[2])}}setSpecificLineAttributes(e,t,i){if("labelLine"!==this.layer.type)throw new Error("Label: layer type is not a labelLine");const n=(0,l.bs)(i,t,!0,e.tileData);this.label=(0,s.It)(this.layer.style.textField,n);const o=(0,r.Bs)(e.tileCoords);this.mapPointVertices=[];const a=[0,0,0],d=[0,0,0];for(let t=0;t<e.vertices[0].length;t++)a[0]=e.vertices[0][t],a[1]=e.vertices[1][t],(0,r.Z$)(d,a,o),this.mapPointVertices.push(d[0],d[1],d[2]);this.componentDistanceStart=e.componentDistanceStart,this.componentDistanceEnd=e.componentDistanceEnd,this.componentDistanceStartWorld=(0,r.C5)(this.componentDistanceStart,e.tileCoords[2]),this.objectLengthWorld=(0,r.C5)(e.objectLength,e.tileCoords[2]),this.tiers=(0,l.FR)(this.layer.ignoreTier,n)?void 0:e.tiers}setSpecificOneWayAttributes(e){const t=(0,r.Bs)(e.tileCoords);this.mapPointVertices=[];const i=[0,0,0],n=[0,0,0];for(let o=0;o<e.vertices[0].length;o++)i[0]=e.vertices[0][o],i[1]=e.vertices[1][o],(0,r.Z$)(n,i,t),this.mapPointVertices.push(n[0],n[1],n[2]);this.componentDistanceStart=e.componentDistanceStart,this.componentDistanceEnd=e.componentDistanceEnd,this.componentDistanceStartWorld=(0,r.C5)(this.componentDistanceStart,e.tileCoords[2]),this.objectLengthWorld=(0,r.C5)(e.objectLength,e.tileCoords[2]),this.tiers=e.tiers}updateRanges(){this.ranges=(0,n.Go)([this.label,this.label2,this.iconLabel])}}},6336:(e,t,i)=>{"use strict";i.d(t,{M:()=>o,P:()=>r});var n=i(173);let o=Math.random;const r=e=>{const t={randomSeed:0};(0,n.b8)(t,[e]),o=()=>(0,n.ff)(t,0,1)}},6100:(e,t,i)=>{"use strict";var n=i(7256),o=i(4500),r=i(4411),s=i(8894);if("function"!=typeof self.importScripts)throw new Error("Models worker should be used in a worker context.");!function(e){const t=new n.D(e),i=new o.J(t);new r.Z(i).set("ModelsWorker",s.q)}(self)},8894:(e,t,i)=>{"use strict";i.d(t,{q:()=>H});var n=i(7731),o=i(9450),r=i(1245),s=i(127);function a(e){return{copyright:e.copyright,generator:e.generator,version:e.version,minVersion:e.minVersion}}function l(e=[]){return e.map((e=>{var t;return{bufferView:e.bufferView,byteOffset:null!==(t=e.byteOffset)&&void 0!==t?t:0,componentType:e.componentType,normalized:e.normalized,count:e.count,type:e.type,max:e.max,min:e.min,sparse:e.sparse,name:e.name,extensions:e.extensions,extras:e.extras}}))}function d(e=[]){return e.map((e=>({channels:e.channels,samplers:e.samplers,name:e.name,extensions:e.extensions,extras:e.extras})))}function c(e=[]){return e.map((e=>({uri:e.uri,byteLength:e.byteLength,name:e.name,extensions:e.extensions,extras:e.extras,buffer:void 0})))}function u(e=[]){return e.map((e=>({buffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength,byteStride:e.byteStride,target:e.target,name:e.name,extensions:e.extensions,extras:e.extras})))}function h(e=[]){return e.map((e=>({type:e.type,orthographic:e.orthographic,perspective:e.perspective,name:e.name,extensions:e.extensions,extras:e.extras})))}function m(e=[]){return e.map((e=>({primitives:e.primitives,name:e.name,weights:e.weights,extensions:e.extensions,extras:e.extras})))}function f(e=[]){return e.map((e=>({alphaCutoff:e.alphaCutoff,alphaMode:e.alphaMode,doubleSided:e.doubleSided,emissiveFactor:e.emissiveFactor,emissiveTexture:e.emissiveTexture,normalTexture:e.normalTexture,occlusionTexture:e.occlusionTexture,pbrMetallicRoughness:e.pbrMetallicRoughness,name:e.name,extras:e.extras,extensions:e.extensions})))}function _(e=[]){return e.map((e=>({nodes:e.nodes,extensions:e.extensions,extras:e.extras,name:e.name})))}function p(e=[]){return e.map((e=>{var t,i,n;const a=null!==(t=e.rotation)&&void 0!==t?t:[0,0,0,1],l=null!==(i=e.scale)&&void 0!==i?i:[1,1,1],d=null!==(n=e.translation)&&void 0!==n?n:[0,0,0];return{camera:e.camera,children:e.children,matrix:e.matrix?s.al(...e.matrix):void 0,rotation:r.al(...a),scale:o.al(...l),translation:o.al(...d),name:e.name,mesh:e.mesh,skin:e.skin,extras:e.extras,extensions:e.extensions}}))}function v(e=[]){return e.map((e=>({bufferView:e.bufferView,mimeType:e.mimeType,name:e.name,uri:e.uri,extensions:e.extensions,extras:e.extras,image:void 0})))}function g(e=[]){return e.map((e=>({extensions:e.extensions,extras:e.extras,name:e.name,sampler:e.sampler,source:e.source})))}function y(e=[]){return e.map((e=>({extensions:e.extensions,extras:e.extras,name:e.name,magFilter:e.magFilter,minFilter:e.minFilter,wrapS:e.wrapS,wrapT:e.wrapT})))}function b(e=[]){return e.map((e=>({joints:e.joints,extensions:e.extensions,extras:e.extras,inverseBindMatrices:e.inverseBindMatrices,name:e.name,skeleton:e.skeleton})))}const x="image/jpeg",w="image/png",S="image/texture";function M(e){return e.substring(0,e.lastIndexOf("/")+1)}function I(e){const t=atob(e.split(",")[1]),i=new ArrayBuffer(t.length),n=new Uint8Array(i);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return i}class T{constructor(e){this.data=e}static isGlb(e){const t=new Uint32Array(e,0,T.glbHeaderInts),i=t[0],n=t[1];return i===this.glbMagic&&n===this.glbVersion}extractGlbData(){if(void 0===this.getCheckedGlbInfo())return{json:D,buffers:[]};let e;const t=[],i=this.getAllChunkInfos();for(const n of i)n.type!==T.jsonChunkType||e?n.type===T.binaryChunkType&&t.push(this.getBufferFromChunk(n)):e=this.getJsonFromChunk(n);return{json:e||D,buffers:t}}getCheckedGlbInfo(){const e=new Uint32Array(this.data,0,T.glbHeaderInts),t=e[0],i=e[1],n=e[2];if(this.checkEquality(t,T.glbMagic,"glb magic")&&this.checkEquality(i,T.glbVersion,"glb header version")&&this.checkEquality(n,this.data.byteLength,"glb byte length"))return{magic:t,version:i,length:n}}getAllChunkInfos(){const e=[];let t=4*T.glbHeaderInts;for(;t<this.data.byteLength;){const i=this.getChunkInfo(t);e.push(i),t+=i.length+4*T.glbChunkHeaderInts}return e}getChunkInfo(e){const t=new Uint32Array(this.data,e,T.glbChunkHeaderInts);return{start:e+4*T.glbChunkHeaderInts,length:t[0],type:t[1]}}getJsonFromChunk(e){const t=e.length,i=4*(T.glbHeaderInts+T.glbChunkHeaderInts),n=new Uint8Array(this.data,i,t),o=new TextDecoder("utf-8").decode(n);return JSON.parse(o)}getBufferFromChunk(e){return this.data.slice(e.start,e.start+e.length)}checkEquality(e,t,i){return e===t||(console.error(`[GLB MODEL PARSING ERROR] Found invalid/unsupported ${i}, expected: ${t}, but was: ${e}`),!1)}}T.glbHeaderInts=3,T.glbChunkHeaderInts=2,T.glbMagic=1179937895,T.glbVersion=2,T.jsonChunkType=1313821514,T.binaryChunkType=5130562;let E;function P(e){E=function(e){return(0,n.mG)(this,void 0,void 0,(function*(){const t=yield function(e){return(0,n.mG)(this,void 0,void 0,(function*(){let t=yield fetch(e).then((e=>e.text()));const i="if (typeof exports === 'object' && typeof module === 'object')",n=t.indexOf(i);return 0!==n&&(t=t.slice(0,n),t+="return DracoDecoderModule;"),t}))}(e);return new Function(t)()()}))}(e).then((e=>e)).catch((e=>{const t="Draco decoder module failed to initialize"+((null==e?void 0:e.message)?` with the following error: ${e.message}`:".");throw new Error(t)}))}function A(e){switch(e){case 5120:return"Int8Array";case 5121:return"Uint8Array";case 5122:return"Int16Array";case 5123:return"Uint16Array";case 5124:return"Int32Array";case 5125:return"Uint32Array";default:return"Float32Array"}}function L(e,t,i,n,o,r){const s=o.num_components(),a=i.num_points()*s;let l,d,c;switch(r){case"Float32Array":c=4*a,l=e._malloc(c),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_FLOAT32,c,l),d=new Float32Array(e.HEAPF32.buffer,l,a).slice(),e._free(l);break;case"Int8Array":l=e._malloc(a),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_INT8,a,l),d=new Int8Array(e.HEAP8.buffer,l,a).slice(),e._free(l);break;case"Int16Array":c=2*a,l=e._malloc(c),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_INT16,c,l),d=new Int16Array(e.HEAP16.buffer,l,a).slice(),e._free(l);break;case"Int32Array":c=4*a,l=e._malloc(c),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_INT32,c,l),d=new Int32Array(e.HEAP32.buffer,l,a).slice(),e._free(l);break;case"Uint8Array":l=e._malloc(a),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_UINT8,a,l),d=new Uint8Array(e.HEAPU8.buffer,l,a).slice(),e._free(l);break;case"Uint16Array":c=2*a,l=e._malloc(c),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_UINT16,c,l),d=new Uint16Array(e.HEAPU16.buffer,l,a).slice(),e._free(l);break;case"Uint32Array":c=4*a,l=e._malloc(c),t.GetAttributeDataArrayForAllPoints(i,o,e.DT_UINT32,c,l),d=new Uint32Array(e.HEAPU32.buffer,l,a).slice(),e._free(l);break;default:throw new Error("DRACOLoader: Unexpected attribute type.")}return{name:n,array:d,itemSize:s,componentType:r}}function C(e,t,i,n){const o=e.bufferView,r=t.bufferViews[o],s=t.buffers[r.buffer],a=new Int8Array(s.buffer).slice(r.byteOffset,r.byteOffset+r.byteLength),l=new i.Decoder,d=new i.DecoderBuffer;d.Init(a,r.byteLength);const c=function(e,t,i,n,o,r){let s,a;const l=t.GetEncodedGeometryType(i);if(l!==e.TRIANGULAR_MESH)throw new Error("DRACOLoader: Unexpected geometry type.");if(s=new e.Mesh,a=t.DecodeBufferToMesh(i,s),!a.ok()||0===s.ptr)throw new Error("DRACOLoader: Decoding failed: "+a.error_msg());const d={index:null,attributes:{}},c=s.num_points();for(const i in n){let a,l=5120;for(const[e,t]of Object.entries(r))if(e===i){l=o.accessors[t].componentType,a=o.accessors[t].count;break}if(c!==a)throw new Error(`DRACOLoader: Accessor vertex count ${a} does not match draco decoder vertex count  ${c}`);l=A(l);const u=t.GetAttributeByUniqueId(s,n[i]),h=L(e,t,s,i,u,l);d.attributes[h.name]=h}if(l===e.TRIANGULAR_MESH){const i=3*s.num_faces(),n=4*i,o=e._malloc(n);t.GetTrianglesUInt32Array(s,n,o);const r=new Uint32Array(e.HEAPU32.buffer,o,i).slice();e._free(o),d.index={array:r,itemSize:1}}return e.destroy(s),d}(i,l,d,e.attributes,t,n);return i.destroy(d),c}function z(e,t,i,n,o){const r={buffer:e,byteLength:e.byteLength,extensions:void 0,extras:void 0,name:void 0,uri:void 0};t.buffers.push(r);const s={buffer:t.buffers.length-1,byteLength:e.byteLength,byteOffset:0,byteStride:0,extensions:void 0,extras:void 0,name:o,target:n};t.bufferViews.push(s),t.accessors[i].byteOffset=0,t.accessors[i].bufferView=t.bufferViews.length-1}function k(e,t){let i;switch(t){case"Int8Array":i=new ArrayBuffer(e.length);new Int8Array(i).set(e);break;case"Uint8Array":i=new ArrayBuffer(e.length);new Uint8Array(i).set(e);break;case"Int16Array":i=new ArrayBuffer(2*e.length);new Int16Array(i).set(e);break;case"Uint16Array":i=new ArrayBuffer(2*e.length);new Uint16Array(i).set(e);break;case"Int32Array":i=new ArrayBuffer(4*e.length);new Int32Array(i).set(e);break;case"Uint32Array":i=new ArrayBuffer(4*e.length);new Uint32Array(i).set(e);break;default:i=new ArrayBuffer(4*e.length);new Float32Array(i).set(e)}return i}function O(e,t,i,n){const o=t.index.array;if(void 0!==n&&(z(o,e,n,34963,"index buffer view"),e.accessors[n].componentType=5125),void 0!==t.attributes.POSITION){z(k(t.attributes.POSITION.array,t.attributes.POSITION.componentType),e,i.POSITION,34962,"position buffer view")}if(void 0!==t.attributes.NORMAL){z(k(t.attributes.NORMAL.array,t.attributes.NORMAL.componentType),e,i.NORMAL,34962,"normal buffer view")}for(let n=0;n<4;++n){const o=`TEXCOORD_${n}`;if(void 0!==t.attributes[o]){z(k(t.attributes[o].array,t.attributes[o].componentType),e,i[o],34962,`${o} buffer view`)}}if(void 0!==t.attributes.TANGENT){z(k(t.attributes.TANGENT.array,t.attributes.TANGENT.componentType),e,i.TANGENT,34962,"Tangent buffer view")}if(void 0!==t.attributes.COLOR_0){z(k(t.attributes.COLOR_0.array,t.attributes.COLOR_0.componentType),e,i.COLOR_0,34962,"color buffer view")}if(void 0!==t.attributes.JOINTS_0){z(k(t.attributes.JOINTS_0.array,t.attributes.JOINTS_0.componentType),e,i.JOINTS_0,34963,"JOINTS_0 buffer view")}if(void 0!==t.attributes.WEIGHTS_0){z(k(t.attributes.WEIGHTS_0.array,t.attributes.WEIGHTS_0.componentType),e,i.WEIGHTS_0,34963,"WEIGHTS_0 buffer view")}if(void 0!==t.attributes.JOINTS_1){z(k(t.attributes.JOINTS_1.array,t.attributes.JOINTS_1.componentType),e,i.JOINTS_1,34963,"JOINTS_1 buffer view")}if(void 0!==t.attributes.WEIGHTS_1){z(k(t.attributes.WEIGHTS_1.array,t.attributes.WEIGHTS_1.componentType),e,i.WEIGHTS_1,34963,"WEIGHTS_1 buffer view")}}var R=i(2435),F=i(7966);function B(e){return(0,n.mG)(this,void 0,void 0,(function*(){const t=yield self.fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}: ${t.url}`);return t}))}const D={asset:{version:""}};function j(e,t){return(0,n.mG)(this,void 0,void 0,(function*(){if(void 0===t.uri)return!1;const i=t.mimeType||((n=t.uri).startsWith("data:image")?n.split(";")[0].split(":")[1]:".png"===n.substring(n.lastIndexOf("."))?w:x);var n;if(t.mimeType=i,"undefined"==typeof createImageBitmap||i!==x&&i!==w)return console.error(`Unsupported image type ${i}`),!1;if(t.uri.startsWith("data:image")){const e=I(t.uri);t.image=yield createImageBitmap(new Blob([e],{type:i}))}else{const n=(0,F.sD)(t.uri)?t.uri:`${M(e.path)}${t.uri}`,o=yield B(n),r=yield o.arrayBuffer();t.image=yield createImageBitmap(new Blob([r],{type:i}))}return!0}))}function N(e,t){return(0,n.mG)(this,void 0,void 0,(function*(){yield Promise.all(e.images.map((i=>(0,n.mG)(this,void 0,void 0,(function*(){if(i.image)return void(i.mimeType!==S&&console.error("Image has already been loaded"));const o=yield function(e,t,i){var o;return(0,n.mG)(this,void 0,void 0,(function*(){if(!t.bufferView)return!1;const n=e.bufferViews[t.bufferView];if(void 0===n)return!1;yield i;const r=e.buffers[n.buffer].buffer;if(!r)return!1;const s=new Uint8Array(r,n.byteOffset,n.byteLength);if("undefined"==typeof createImageBitmap)return!1;if(!function(e){const t=137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7],i=255===e[0]&&216===e[1]&&255===e[2];return t||i}(s))return console.error(`Unsupported image type ${null!==(o=t.mimeType)&&void 0!==o?o:""}`),!1;{const e=new Blob([s],{type:t.mimeType});t.image=yield createImageBitmap(e)}return!0}))}(e,i,t);if(o)return;(yield j(e,i))||console.error(`Was not able to resolve image with uri ${i.uri}`)})))))}))}function U(e,t){return(0,n.mG)(this,void 0,void 0,(function*(){const i=(0,R.Ag)(e,self.origin);try{const e=yield B(i);let o,r=D;try{const s=yield e.arrayBuffer();if(T.isGlb(s)){const e=new T(s).extractGlbData();r=e.json,o=e.buffers}else{const e=new TextDecoder("utf-8"),t=new Uint8Array(s);r=JSON.parse(e.decode(t))}const x=function(e,t){var i,n,o;return{path:t,extensions:e.extensions,extensionsRequired:null!==(i=e.extensionsRequired)&&void 0!==i?i:[],extensionsUsed:null!==(n=e.extensionsUsed)&&void 0!==n?n:[],extras:e.extras,accessors:l(e.accessors),buffers:c(e.buffers),bufferViews:u(e.bufferViews),cameras:h(e.cameras),scene:null!==(o=e.scene)&&void 0!==o?o:0,scenes:_(e.scenes),nodes:p(e.nodes),materials:f(e.materials),meshes:m(e.meshes),asset:a(e.asset),animations:d(e.animations),images:v(e.images),textures:g(e.textures),samplers:y(e.samplers),skins:b(e.skins)}}(r,i),w=function(e,t){return(0,n.mG)(this,void 0,void 0,(function*(){t?e.buffers[0].buffer=t[0]||[]:yield Promise.all(e.buffers.map((t=>(0,n.mG)(this,void 0,void 0,(function*(){if(t.buffer)console.error("Buffer is already loaded");else if(t.uri)if(t.uri.startsWith("data:"))t.buffer=I(t.uri);else{const i=(0,F.sD)(t.uri)?t.uri:M(e.path)+t.uri,n=yield B(i).then((e=>e.arrayBuffer()));t.buffer=n}else console.error("Buffer can not be loaded. No uri")})))))}))}(x,o),S=N(x,w),A=function(e,t){var i;return(0,n.mG)(this,void 0,void 0,(function*(){if(!Array.isArray(e.meshes))return Promise.resolve();for(const n of e.meshes)if(Array.isArray(n.primitives))for(const o of n.primitives){if(void 0===(null===(i=o.extensions)||void 0===i?void 0:i.KHR_draco_mesh_compression))continue;E||P(t);const n=yield E;if(!n)continue;const r=C(o.extensions.KHR_draco_mesh_compression,e,n,o.attributes);O(e,r,o.attributes,o.indices)}}))}(x,t);return yield Promise.all([w,S,A]),{type:"ok",result:x}}catch(e){return{type:"error",layer:"parsing",originalError:e}}}catch(e){return{type:"error",layer:"network",originalError:e}}}))}class H{loadModel(e,t){return(0,n.mG)(this,void 0,void 0,(function*(){return yield U(e,t)}))}}},9884:(e,t,i)=>{"use strict";i.d(t,{h:()=>n});const n=4},2354:(e,t,i)=>{"use strict";var n=i(7628),o=i(9218),r=i(6311),s=i(5095),a=i(6479),l=i(7256),d=i(4500),c=i(6892),u=i(6392),h=i(2543),m=i(1436),f=i(9981),_=i(7188),p=i(6273),v=i(1573),g=i(9884);var y=i(9450),b=i(8194),x=i(8585);let w=[];var S=i(2435);class M{constructor(){this.cache=new Map,this.pendingRequests=new Map}fetch(e,t,i,n,o){return new Promise((r=>{const a=I(e,n,o,t,i),l=(0,u.gx)(e),d=(0,s.LK)({url:a},((e,t)=>{if(this.pendingRequests.delete(l),void 0!==e)return 204!==e.status&&console.error(e),this.cache.set(l,void 0),void r();const i=t[0];i?this.cache.set(l,i):this.cache.set(l,void 0),r()}));this.pendingRequests.set(l,{xhr:d,resolve:r})}))}get(e){return this.cache.get(e)}delete(e){this.cache.delete(e)}abortRequest(e){const t=this.pendingRequests.get(e);void 0!==t&&(t.xhr.abort(),t.resolve(),this.pendingRequests.delete(e))}}function I(e,t,i,n,r){const s=Math.pow(2,e[2])-1,a=e[0],l=(16777215&s-e[1])*(1<<24)+(16777215&a);return(0,S.XK)(o.traffic.url,{protocol:r,host:n,z:String(e[2]),tiles:String(l),regions:t.join(","),time:String(i)})}var T=i(7436),E=i(4411),P=i(2176),A=i(6243),L=i(3187);"function"==typeof self.importScripts&&function(e){const t=new l.D(e),i=new d.J(t),S=new E.Z(i),I=new M,C=new T.h,z={main:{addNewRasterSets:i.get(c.P.Main,"addNewRasterSets")},labeling:{addNewRasterSets:i.get(c.P.Labeling,"addNewRasterSets")}},k={},O=new r.P("parser"),R=(0,n.P)((()=>O.reset()),o.workerResetInterval),F=()=>{const e=O.atlasPacker.getNewRasterSets();e.size&&e.forEach(((e,t)=>{z.main.addNewRasterSets(t,e),z.labeling.addNewRasterSets(t,e)}))},B={sources:{},collector:O,styleManager:C,syncNewRasterSets:F,debouncedResetCollector:R};S.set("GeoJsonSource",P.T,B,["fetchTiles"]);const D={collector:O,metatiles:k,styleManager:C,syncRasterSets:F,resetCollector:R,createImageBitmap:e.createImageBitmap?e.createImageBitmap.bind(e):void 0};S.set("ZenithWorker",A.Z,D,["fetchTiles"]),i.set("setMetatile",((e,t)=>{k[e]=t})),i.set("getMemoryFootprint",(()=>{var e;const t=O.getIndexerStats(),i=O.getStatsAfterReset(),n=O.getBucketsMemoryFootprint(),o=[];null===(e=S.classes.get("ZenithWorker"))||void 0===e||e.hosts.forEach((e=>{e.tileLoader&&e.tileLoader.cache.size>0&&e.tileLoader.cache.forEach(((t,i)=>{o.push({[i]:e.tileLoader.cache.get(i).reduce(((e,t)=>e+t.data.byteLength),0)})}))}));const r={collector:{buckets:n,reset:i,idIndexer:t},zenit:{cache:o}};return{js:Object.assign(Object.assign({},r),{"--sum":(0,L.QE)(r)})}})),i.set("syncStyle",((...e)=>C.proxySyncStyle(...e))),i.set("prepareAtlas",(t=>new Promise((i=>{(0,s.nx)({url:t},((t,n)=>{if(t||0===n.byteLength)i(void 0);else if(e.createImageBitmap){const e=new Blob([n],{type:"image/png"});createImageBitmap(e).then((e=>{i({isBitmap:!0,data:[e],transferable:[e]})}))}else i({isBitmap:!1,data:[n],transferable:[n]})}))})))),i.set("packRasters",(e=>{for(let t=0;t<e.length;t+=3){const i=e[t+2],n={type:a.f.Loaded,isSvg:!1,index:i,key:`loaded-${i}`,name:"",fileName:"",rasters:[{rasterSetIndex:i,rasterIndex:0,w:e[t],h:e[t+1],atlasIndex:0,x:0,y:0,isPacked:!1,anchorX:0,anchorY:0}]};O.atlasPacker.pack(n,[e[t]],1)}const t=O.atlasPacker.getPackedRasters(),i=[];return void 0!==t&&i.push(t.buffer),{packedRasters:t,transferable:i}})),i.set("fetchTrafficTile",(e=>I.fetch(e.coords,e.tileServer,e.tileProtocol,e.regionIds,e.timestamp))),i.set("deleteTrafficTile",(e=>{I.delete(e)})),i.set("abortTrafficTileRequest",(e=>{I.abortRequest(e)}));const j=(0,_.KP)(["db_sublayer","traffic_road_class","traffic_color","traffic_road_z_level","db_tiers","db_has_immersive_counterpart","beginningIsCut","endingIsCut","traffic_color2"],["Traffic_jams"]);i.set("generateTrafficTile",(({coords:e,pixelRatio:t,styleState:i,styleId:n,sourceId:o})=>{const r=(0,u.gx)(e),s=(0,u.Bs)(e),a=[],l=[],d=C.getStyle(n);if(!d)return Promise.resolve({results:a,transferable:l});const c=I.get(r);if(c){const e=function(e,t,i,n,o,r,s,a,l){if(!i)return e.getAccumulatedData();const d=a.coords[3],{tileProps:c}=t,u=Object.keys(c).length,y=[],b=(0,f.o1)(r),x=(0,h.Yi)(o,_.i4,c,y,_.wz,void 0,a);for(const o of s.tile){const{color:r=0,color2:s=0,geo:f,road:_,normals:w,zLevel:S=0,is_immersive:M,logicalLevels:I}=o;for(let e=0;e<u;e++)y[e]=NaN;y[c.db_sublayer]="Traffic_jams",y[c.traffic_color]=r,y[c.traffic_color2]=s,y[c.traffic_road_class]=_,y[c.traffic_road_z_level]=S,y[c.db_tiers]=I?[(0,v.bg)(I.begin,I.end)]:void 0,y[c.db_has_immersive_counterpart]=Number(M),y[c.beginningIsCut]=0,y[c.endingIsCut]=0;for(let o=0;o<f.length;o++){const r=f[o],s=w[o],u=[],_=[],v=[],S=[];for(let e=0;e<r.length;e++)u[e]=r[e][0]*p.gt,_[e]=r[e][1]*p.gt,v[e]=s[e][0],S[e]=s[e][1];const M={x:u,y:_,normal_x:v,normal_y:S},I=n.getLayers(i.id,c,y).filter((e=>(0,h.FR)(e.filter,x)));0===I.length&&x.id&&e.idIndexer.addOrphanId(x.id),(0,m.PA)(e,i,I,x,t,g.h,d,l,a,b,M)}}return e.getAccumulatedData()}(O,j,d,C,i,t,c,s,o);a.push({regionId:1,metatileHash:0,styleId:d.id,collectorOutput:e})}return Promise.resolve({results:a,transferable:l})})),i.set("generatePersonalPoi",((e,t,i,n,o,r,s,a)=>{const l=C.getStyle(r);if(!l)return;const d=function(e,t,i,n,o,r,s,a,l){var d,c,p;const{tileProps:v,dictionaries:S}=n,M=Object.keys(v).length,I=new Set(s),T=[];if(void 0===(null===(d=S.db_sublayer)||void 0===d?void 0:d.s_personal_poi))return e.getAccumulatedData();for(let e=0;e<M;e++)T[e]=NaN;const E=(0,f.o1)(r),P=b.Ue(),A=[];for(const e of a){const t=x.H.fromGeo(e.point);b.aM(P,t),A.push(t)}const L=(0,u.x7)(P),C=(0,u.Bs)(L),z=(0,h.Yi)(i,_.i4,v,T,_.wz,void 0,C);for(let i=0;i<a.length;i++){const r=a[i],s=y.Ue();(0,u.a2)(s,A[i],C);const d=r.id;z.id=d;const f={x:[s[0]],y:[s[1]]};for(let e=0;e<M;e++)T[e]=NaN;T[v.db_sublayer]="s_personal_poi",T[v.db_object_class]=null!==(c=r.humanReadableClassId)&&void 0!==c?c:null===(p=n.reverseDictionaries.db_object_class)||void 0===p?void 0:p[r.classId],T[v.db_label]=r.name,T[v.db_icon_priority]=1,T[v.db_label_priority]=0,T[v.selected]=I.has(d)?1:0,T[v.db_region]=o,w=t.layers.filter((e=>(0,h.FR)(e.filter,z))),0===w.length&&z.id&&e.idIndexer.addOrphanId(z.id);const _=void 0;(0,m.PA)(e,t,w,z,n,g.h,_,l,C,E,f)}return e.getAccumulatedData()}(O,l,s,k[i],t,n,o,e,a);return R(),F(),{collectorOutput:d,transferable:d.transferable,styleId:l.id}}))}(self)},2205:()=>{"use strict";setTimeout((()=>{if("__mapglPlugins"in window)for(const e in window.__mapglPlugins)window.mapgl[e]=window.__mapglPlugins[e]}),0)},9748:(e,t)=>{function i(e,t,i){1===e&&t.tiles.push(n(i,i.readVarint()+i.pos))}function n(e,t){return e.readFields(o,{x:0,y:0,zoom:0},t)}function o(e,t,i){1===e?t.x=i.readVarint():2===e?t.y=i.readVarint():3===e&&(t.zoom=i.readVarint())}function r(e,t){e.x&&t.writeVarintField(1,e.x),e.y&&t.writeVarintField(2,e.y),e.zoom&&t.writeVarintField(3,e.zoom)}function s(e,t,i){1===e&&t.tileGroups.push(a(i,i.readVarint()+i.pos))}function a(e,t){return e.readFields(l,{x:0,y:0,zoom:0,tiles:[]},t)}function l(e,t,i){1===e?t.x=i.readVarint():2===e?t.y=i.readVarint():3===e?t.zoom=i.readVarint():4===e&&t.tiles.push(c(i,i.readVarint()+i.pos))}function d(e,t){if(e.x&&t.writeVarintField(1,e.x),e.y&&t.writeVarintField(2,e.y),e.zoom&&t.writeVarintField(3,e.zoom),e.tiles)for(const i of e.tiles)t.writeMessage(4,h,i)}function c(e,t){return e.readFields(u,{regionId:0,hash:void 0,data:void 0},t)}function u(e,t,i){1===e?t.regionId=i.readVarint():2===e?t.hash=i.readBytes():3===e&&(t.data=i.readBytes())}function h(e,t){e.regionId&&t.writeVarintField(1,e.regionId),null!=e.hash&&t.writeBytesField(2,e.hash),null!=e.data&&t.writeBytesField(3,e.data)}t.a9=function(e,t){if(e.tiles)for(const i of e.tiles)t.writeMessage(1,r,i)},t.JE=function(e,t){return e.readFields(s,{tileGroups:[]},t)}},9899:(e,t,i)=>{"use strict";i.d(t,{Z:()=>n});const n=o;function o(e,t,i){i=i||{},this.w=e||64,this.h=t||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function r(e,t,i){this.x=0,this.y=e,this.w=this.free=t,this.h=i}function s(e,t,i,n,o,r,s){this.id=e,this.x=t,this.y=i,this.w=n,this.h=o,this.maxw=r||n,this.maxh=s||o,this.refcount=0}o.prototype.pack=function(e,t){e=[].concat(e),t=t||{};for(var i,n,o,r,s=[],a=0;a<e.length;a++)if(i=e[a].w||e[a].width,n=e[a].h||e[a].height,o=e[a].id,i&&n){if(!(r=this.packOne(i,n,o)))continue;t.inPlace&&(e[a].x=r.x,e[a].y=r.y,e[a].id=r.id),s.push(r)}return this.shrink(),s},o.prototype.packOne=function(e,t,i){var n,o,s,a,l,d,c,u,h={freebin:-1,shelf:-1,waste:1/0},m=0;if("string"==typeof i||"number"==typeof i){if(n=this.getBin(i))return this.ref(n),n;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(a=0;a<this.freebins.length;a++){if(t===(n=this.freebins[a]).maxh&&e===n.maxw)return this.allocFreebin(a,e,t,i);t>n.maxh||e>n.maxw||t<=n.maxh&&e<=n.maxw&&(s=n.maxw*n.maxh-e*t)<h.waste&&(h.waste=s,h.freebin=a)}for(a=0;a<this.shelves.length;a++)if(m+=(o=this.shelves[a]).h,!(e>o.free)){if(t===o.h)return this.allocShelf(a,e,t,i);t>o.h||t<o.h&&(s=(o.h-t)*e)<h.waste&&(h.freebin=-1,h.waste=s,h.shelf=a)}return-1!==h.freebin?this.allocFreebin(h.freebin,e,t,i):-1!==h.shelf?this.allocShelf(h.shelf,e,t,i):t<=this.h-m&&e<=this.w?(o=new r(m,this.w,t),this.allocShelf(this.shelves.push(o)-1,e,t,i)):this.autoResize?(l=d=this.h,((c=u=this.w)<=l||e>c)&&(u=2*Math.max(e,c)),(l<c||t>l)&&(d=2*Math.max(t,l)),this.resize(u,d),this.packOne(e,t,i)):null},o.prototype.allocFreebin=function(e,t,i,n){var o=this.freebins.splice(e,1)[0];return o.id=n,o.w=t,o.h=i,o.refcount=0,this.bins[n]=o,this.ref(o),o},o.prototype.allocShelf=function(e,t,i,n){var o=this.shelves[e].alloc(t,i,n);return this.bins[n]=o,this.ref(o),o},o.prototype.shrink=function(){if(this.shelves.length>0){for(var e=0,t=0,i=0;i<this.shelves.length;i++){var n=this.shelves[i];t+=n.h,e=Math.max(n.w-n.free,e)}this.resize(e,t)}},o.prototype.getBin=function(e){return this.bins[e]},o.prototype.ref=function(e){if(1==++e.refcount){var t=e.h;this.stats[t]=1+(0|this.stats[t])}return e.refcount},o.prototype.unref=function(e){return 0===e.refcount?0:(0==--e.refcount&&(this.stats[e.h]--,delete this.bins[e.id],this.freebins.push(e)),e.refcount)},o.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},o.prototype.resize=function(e,t){this.w=e,this.h=t;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(e);return!0},r.prototype.alloc=function(e,t,i){if(e>this.free||t>this.h)return null;var n=this.x;return this.x+=e,this.free-=e,new s(i,n,this.y,e,t,e,this.h)},r.prototype.resize=function(e){return this.free+=e-this.w,this.w=e,!0}},2447:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});const n=4294967296,o=1/n,r="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class s{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,o=this.pos;this.type=7&i,e(n,t,this),this.pos===o&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*n;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*n;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,n;return n=t[this.pos++],i=127&n,n<128?i:(n=t[this.pos++],i|=(127&n)<<7,n<128?i:(n=t[this.pos++],i|=(127&n)<<14,n<128?i:(n=t[this.pos++],i|=(127&n)<<21,n<128?i:(n=t[this.pos],i|=(15&n)<<28,function(e,t,i){const n=i.buf;let o,r;if(r=n[i.pos++],o=(112&r)>>4,r<128)return a(e,o,t);if(r=n[i.pos++],o|=(127&r)<<3,r<128)return a(e,o,t);if(r=n[i.pos++],o|=(127&r)<<10,r<128)return a(e,o,t);if(r=n[i.pos++],o|=(127&r)<<17,r<128)return a(e,o,t);if(r=n[i.pos++],o|=(127&r)<<24,r<128)return a(e,o,t);if(r=n[i.pos++],o|=(1&r)<<31,r<128)return a(e,o,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&r?r.decode(this.buf.subarray(t,e)):function(e,t,i){let n="",o=t;for(;o<i;){const t=e[o];let r,s,a,l=null,d=t>239?4:t>223?3:t>191?2:1;if(o+d>i)break;1===d?t<128&&(l=t):2===d?(r=e[o+1],128==(192&r)&&(l=(31&t)<<6|63&r,l<=127&&(l=null))):3===d?(r=e[o+1],s=e[o+2],128==(192&r)&&128==(192&s)&&(l=(15&t)<<12|(63&r)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===d&&(r=e[o+1],s=e[o+2],a=e[o+3],128==(192&r)&&128==(192&s)&&128==(192&a)&&(l=(15&t)<<18|(63&r)<<12|(63&s)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,d=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),o+=d}return n}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*o),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*o),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let i,n;e>=0?(i=e%4294967296|0,n=e/4294967296|0):(i=~(-e%4294967296),n=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){const i=(7&e)<<4;if(t.buf[t.pos++]|=i|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let n,o,r=0;r<t.length;r++){if(n=t.charCodeAt(r),n>55295&&n<57344){if(!o){n>56319||r+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):o=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(e[i++]=239,e[i++]=191,e[i++]=189,o=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&l(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const n=this.pos-i;n>=128&&l(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,d,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,c,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,m,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,u,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,h,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,f,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,_,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,p,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,v,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function a(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function l(e,t,i){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(let t=i.pos-1;t>=e;t--)i.buf[t+n]=i.buf[t]}function d(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function c(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function u(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function h(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function m(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function f(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function _(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function p(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function v(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={id:n,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.exports}return i.m=e,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0,i(1239)})()));