PageSourceSearch

https://survivalbrasil.org/assets/mapbox-gl-4a46f983.js

js survivalbrasil.org collected 2026-09-25 18:52:16 UTC 1,495,190 bytes, 2 lines download raw bytes

1import Le from"process";var Re=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:global;var Oe={};var Ue=Le;(function(Le,Re){Oe=Re()})(0,(function(){var Le,Oe,qe;function define(Re,Ue){if(Le)if(Oe){var Ct="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+Le+")(sharedChunk); ("+Oe+")(sharedChunk); self.onerror = null;";var Ot={};Le(Ot);qe=Ue(Ot);typeof window!=="undefined"&&window&&window.URL&&window.URL.createObjectURL&&(qe.workerUrl=window.URL.createObjectURL(new Blob([Ct],{type:"text/javascript"})))}else Oe=Ue;else Le=Ue}define(["exports"],(function(Le){function e(Le){return Le&&Le.__esModule&&Object.prototype.hasOwnProperty.call(Le,"default")?Le.default:Le}var Oe,qe={},Ct={};function s(){if(Oe)return Ct;Oe=1,Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.setMatrixArrayType=function(Le){Ct.ARRAY_TYPE=Re=Le},Ct.toRadian=function(Le){return Le*qe},Ct.equals=function(Re,Oe){return Math.abs(Re-Oe)<=Le*Math.max(1,Math.abs(Re),Math.abs(Oe))},Ct.RANDOM=Ct.ARRAY_TYPE=Ct.EPSILON=void 0;var Le=1e-6;Ct.EPSILON=Le;var Re="undefined"!=typeof Float32Array?Float32Array:Array;Ct.ARRAY_TYPE=Re;var Ue=Math.random;Ct.RANDOM=Ue;var qe=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var Le=0,Re=arguments.length;Re--;)Le+=arguments[Re]*arguments[Re];return Math.sqrt(Le)}),Ct}var Ot,Jt={};function l(){if(Ot)return Jt;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}Ot=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.create=function(){var Re=new Le.ARRAY_TYPE(4);return Le.ARRAY_TYPE!=Float32Array&&(Re[1]=0,Re[2]=0),Re[0]=1,Re[3]=1,Re},Jt.clone=function(Re){var Oe=new Le.ARRAY_TYPE(4);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe[3]=Re[3],Oe},Jt.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le},Jt.identity=function(Le){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=1,Le},Jt.fromValues=function(Re,Oe,Ue,qe){var Ct=new Le.ARRAY_TYPE(4);return Ct[0]=Re,Ct[1]=Oe,Ct[2]=Ue,Ct[3]=qe,Ct},Jt.set=function(Le,Re,Oe,Ue,qe){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=qe,Le},Jt.transpose=function(Le,Re){if(Le===Re){var Oe=Re[1];Le[1]=Re[2],Le[2]=Oe}else Le[0]=Re[0],Le[1]=Re[2],Le[2]=Re[1],Le[3]=Re[3];return Le},Jt.invert=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Oe*Ct-qe*Ue;return Ot?(Le[0]=Ct*(Ot=1/Ot),Le[1]=-Ue*Ot,Le[2]=-qe*Ot,Le[3]=Oe*Ot,Le):null},Jt.adjoint=function(Le,Re){var Oe=Re[0];return Le[0]=Re[3],Le[1]=-Re[1],Le[2]=-Re[2],Le[3]=Oe,Le},Jt.determinant=function(Le){return Le[0]*Le[3]-Le[2]*Le[1]},Jt.multiply=n,Jt.rotate=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Math.sin(Oe),_i=Math.cos(Oe);return Le[0]=Ue*_i+Ct*Jt,Le[1]=qe*_i+Ot*Jt,Le[2]=Ue*-Jt+Ct*_i,Le[3]=qe*-Jt+Ot*_i,Le},Jt.scale=function(Le,Re,Oe){var Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Oe[0],Jt=Oe[1];return Le[0]=Re[0]*Ot,Le[1]=Ue*Ot,Le[2]=qe*Jt,Le[3]=Ct*Jt,Le},Jt.fromRotation=function(Le,Re){var Oe=Math.sin(Re),Ue=Math.cos(Re);return Le[0]=Ue,Le[1]=Oe,Le[2]=-Oe,Le[3]=Ue,Le},Jt.fromScaling=function(Le,Re){return Le[0]=Re[0],Le[1]=0,Le[2]=0,Le[3]=Re[1],Le},Jt.str=function(Le){return"mat2("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+")"},Jt.frob=function(Le){return Math.hypot(Le[0],Le[1],Le[2],Le[3])},Jt.LDU=function(Le,Re,Oe,Ue){return Le[2]=Ue[2]/Ue[0],Oe[0]=Ue[0],Oe[1]=Ue[1],Oe[3]=Ue[3]-Le[2]*Oe[1],[Le,Re,Oe]},Jt.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le[3]=Re[3]+Oe[3],Le},Jt.subtract=i,Jt.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]&&Le[3]===Re[3]},Jt.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Oe[0],_i=Oe[1],xi=Oe[2],vi=Oe[3];return Math.abs(Ue-Jt)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(Jt))&&Math.abs(qe-_i)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(_i))&&Math.abs(Ct-xi)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(xi))&&Math.abs(Ot-vi)<=Le.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(vi))},Jt.multiplyScalar=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le[3]=Re[3]*Oe,Le},Jt.multiplyScalarAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le[2]=Re[2]+Oe[2]*Ue,Le[3]=Re[3]+Oe[3]*Ue,Le},Jt.sub=Jt.mul=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}
1return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Oe[0],_i=Oe[1],xi=Oe[2],vi=Oe[3];return Le[0]=Ue*Jt+Ct*_i,Le[1]=qe*Jt+Ot*_i,Le[2]=Ue*xi+Ct*vi,Le[3]=qe*xi+Ot*vi,Le}function i(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le[2]=Re[2]-Oe[2],Le[3]=Re[3]-Oe[3],Le}return Jt.mul=n,Jt.sub=i,Jt}var _i,xi={};function h(){if(_i)return xi;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}_i=1,Object.defineProperty(xi,"__esModule",{value:!0}),xi.create=function(){var Re=new Le.ARRAY_TYPE(6);return Le.ARRAY_TYPE!=Float32Array&&(Re[1]=0,Re[2]=0,Re[4]=0,Re[5]=0),Re[0]=1,Re[3]=1,Re},xi.clone=function(Re){var Oe=new Le.ARRAY_TYPE(6);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe[3]=Re[3],Oe[4]=Re[4],Oe[5]=Re[5],Oe},xi.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le[4]=Re[4],Le[5]=Re[5],Le},xi.identity=function(Le){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=1,Le[4]=0,Le[5]=0,Le},xi.fromValues=function(Re,Oe,Ue,qe,Ct,Ot){var Jt=new Le.ARRAY_TYPE(6);return Jt[0]=Re,Jt[1]=Oe,Jt[2]=Ue,Jt[3]=qe,Jt[4]=Ct,Jt[5]=Ot,Jt},xi.set=function(Le,Re,Oe,Ue,qe,Ct,Ot){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=qe,Le[4]=Ct,Le[5]=Ot,Le},xi.invert=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Oe*Ct-Ue*qe;return _i?(Le[0]=Ct*(_i=1/_i),Le[1]=-Ue*_i,Le[2]=-qe*_i,Le[3]=Oe*_i,Le[4]=(qe*Jt-Ct*Ot)*_i,Le[5]=(Ue*Ot-Oe*Jt)*_i,Le):null},xi.determinant=function(Le){return Le[0]*Le[3]-Le[1]*Le[2]},xi.multiply=n,xi.rotate=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Math.sin(Oe),vi=Math.cos(Oe);return Le[0]=Ue*vi+Ct*xi,Le[1]=qe*vi+Ot*xi,Le[2]=Ue*-xi+Ct*vi,Le[3]=qe*-xi+Ot*vi,Le[4]=Jt,Le[5]=_i,Le},xi.scale=function(Le,Re,Oe){var Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Oe[0],xi=Oe[1];return Le[0]=Re[0]*_i,Le[1]=Ue*_i,Le[2]=qe*xi,Le[3]=Ct*xi,Le[4]=Ot,Le[5]=Jt,Le},xi.translate=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Oe[0],vi=Oe[1];return Le[0]=Ue,Le[1]=qe,Le[2]=Ct,Le[3]=Ot,Le[4]=Ue*xi+Ct*vi+Jt,Le[5]=qe*xi+Ot*vi+_i,Le},xi.fromRotation=function(Le,Re){var Oe=Math.sin(Re),Ue=Math.cos(Re);return Le[0]=Ue,Le[1]=Oe,Le[2]=-Oe,Le[3]=Ue,Le[4]=0,Le[5]=0,Le},xi.fromScaling=function(Le,Re){return Le[0]=Re[0],Le[1]=0,Le[2]=0,Le[3]=Re[1],Le[4]=0,Le[5]=0,Le},xi.fromTranslation=function(Le,Re){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=1,Le[4]=Re[0],Le[5]=Re[1],Le},xi.str=function(Le){return"mat2d("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+", "+Le[4]+", "+Le[5]+")"},xi.frob=function(Le){return Math.hypot(Le[0],Le[1],Le[2],Le[3],Le[4],Le[5],1)},xi.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le[3]=Re[3]+Oe[3],Le[4]=Re[4]+Oe[4],Le[5]=Re[5]+Oe[5],Le},xi.subtract=i,xi.multiplyScalar=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le[3]=Re[3]*Oe,Le[4]=Re[4]*Oe,Le[5]=Re[5]*Oe,Le},xi.multiplyScalarAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le[2]=Re[2]+Oe[2]*Ue,Le[3]=Re[3]+Oe[3]*Ue,Le[4]=Re[4]+Oe[4]*Ue,Le[5]=Re[5]+Oe[5]*Ue,Le},xi.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]&&Le[3]===Re[3]&&Le[4]===Re[4]&&Le[5]===Re[5]},xi.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Oe[0],vi=Oe[1],bi=Oe[2],Pi=Oe[3],Hr=Oe[4],Jr=Oe[5];return Math.abs(Ue-xi)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(xi))&&Math.abs(qe-vi)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(vi))&&Math.abs(Ct-bi)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(bi))&&Math.abs(Ot-Pi)<=Le.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(Pi))&&Math.abs(Jt-Hr)<=Le.EPSILON*Math.max(1,Math.abs(Jt),Math.abs(Hr))&&Math.abs(_i-Jr)<=Le.EPSILON*Math.max(1,Math.abs(_i),Math.abs(Jr))},xi.sub=xi.mul=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}
1return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Oe[0],vi=Oe[1],bi=Oe[2],Pi=Oe[3],Hr=Oe[4],Jr=Oe[5];return Le[0]=Ue*xi+Ct*vi,Le[1]=qe*xi+Ot*vi,Le[2]=Ue*bi+Ct*Pi,Le[3]=qe*bi+Ot*Pi,Le[4]=Ue*Hr+Ct*Jr+Jt,Le[5]=qe*Hr+Ot*Jr+_i,Le}function i(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le[2]=Re[2]-Oe[2],Le[3]=Re[3]-Oe[3],Le[4]=Re[4]-Oe[4],Le[5]=Re[5]-Oe[5],Le}return xi.mul=n,xi.sub=i,xi}var vi,bi={};function d(){if(vi)return bi;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}vi=1,Object.defineProperty(bi,"__esModule",{value:!0}),bi.create=function(){var Re=new Le.ARRAY_TYPE(9);return Le.ARRAY_TYPE!=Float32Array&&(Re[1]=0,Re[2]=0,Re[3]=0,Re[5]=0,Re[6]=0,Re[7]=0),Re[0]=1,Re[4]=1,Re[8]=1,Re},bi.fromMat4=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[4],Le[4]=Re[5],Le[5]=Re[6],Le[6]=Re[8],Le[7]=Re[9],Le[8]=Re[10],Le},bi.clone=function(Re){var Oe=new Le.ARRAY_TYPE(9);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe[3]=Re[3],Oe[4]=Re[4],Oe[5]=Re[5],Oe[6]=Re[6],Oe[7]=Re[7],Oe[8]=Re[8],Oe},bi.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le[4]=Re[4],Le[5]=Re[5],Le[6]=Re[6],Le[7]=Re[7],Le[8]=Re[8],Le},bi.fromValues=function(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi){var vi=new Le.ARRAY_TYPE(9);return vi[0]=Re,vi[1]=Oe,vi[2]=Ue,vi[3]=qe,vi[4]=Ct,vi[5]=Ot,vi[6]=Jt,vi[7]=_i,vi[8]=xi,vi},bi.set=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=qe,Le[4]=Ct,Le[5]=Ot,Le[6]=Jt,Le[7]=_i,Le[8]=xi,Le},bi.identity=function(Le){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=1,Le[5]=0,Le[6]=0,Le[7]=0,Le[8]=1,Le},bi.transpose=function(Le,Re){if(Le===Re){var Oe=Re[1],Ue=Re[2],qe=Re[5];Le[1]=Re[3],Le[2]=Re[6],Le[3]=Oe,Le[5]=Re[7],Le[6]=Ue,Le[7]=qe}else Le[0]=Re[0],Le[1]=Re[3],Le[2]=Re[6],Le[3]=Re[1],Le[4]=Re[4],Le[5]=Re[7],Le[6]=Re[2],Le[7]=Re[5],Le[8]=Re[8];return Le},bi.invert=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Re[6],xi=Re[7],vi=Re[8],bi=vi*Ot-Jt*xi,Pi=-vi*Ct+Jt*_i,Hr=xi*Ct-Ot*_i,Jr=Oe*bi+Ue*Pi+qe*Hr;return Jr?(Le[0]=bi*(Jr=1/Jr),Le[1]=(-vi*Ue+qe*xi)*Jr,Le[2]=(Jt*Ue-qe*Ot)*Jr,Le[3]=Pi*Jr,Le[4]=(vi*Oe-qe*_i)*Jr,Le[5]=(-Jt*Oe+qe*Ct)*Jr,Le[6]=Hr*Jr,Le[7]=(-xi*Oe+Ue*_i)*Jr,Le[8]=(Ot*Oe-Ue*Ct)*Jr,Le):null},bi.adjoint=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Re[6],xi=Re[7],vi=Re[8];return Le[0]=Ot*vi-Jt*xi,Le[1]=qe*xi-Ue*vi,Le[2]=Ue*Jt-qe*Ot,Le[3]=Jt*_i-Ct*vi,Le[4]=Oe*vi-qe*_i,Le[5]=qe*Ct-Oe*Jt,Le[6]=Ct*xi-Ot*_i,Le[7]=Ue*_i-Oe*xi,Le[8]=Oe*Ot-Ue*Ct,Le},bi.determinant=function(Le){var Re=Le[3],Oe=Le[4],Ue=Le[5],qe=Le[6],Ct=Le[7],Ot=Le[8];return Le[0]*(Ot*Oe-Ue*Ct)+Le[1]*(-Ot*Re+Ue*qe)+Le[2]*(Ct*Re-Oe*qe)},bi.multiply=n,bi.translate=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Oe[0],Hr=Oe[1];return Le[0]=Ue,Le[1]=qe,Le[2]=Ct,Le[3]=Ot,Le[4]=Jt,Le[5]=_i,Le[6]=Pi*Ue+Hr*Ot+xi,Le[7]=Pi*qe+Hr*Jt+vi,Le[8]=Pi*Ct+Hr*_i+bi,Le},bi.rotate=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Math.sin(Oe),Hr=Math.cos(Oe);return Le[0]=Hr*Ue+Pi*Ot,Le[1]=Hr*qe+Pi*Jt,Le[2]=Hr*Ct+Pi*_i,Le[3]=Hr*Ot-Pi*Ue,Le[4]=Hr*Jt-Pi*qe,Le[5]=Hr*_i-Pi*Ct,Le[6]=xi,Le[7]=vi,Le[8]=bi,Le},bi.scale=function(Le,Re,Oe){var Ue=Oe[0],qe=Oe[1];return Le[0]=Ue*Re[0],Le[1]=Ue*Re[1],Le[2]=Ue*Re[2],Le[3]=qe*Re[3],Le[4]=qe*Re[4],Le[5]=qe*Re[5],Le[6]=Re[6],Le[7]=Re[7],Le[8]=Re[8],Le},bi.fromTranslation=function(Le,Re){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=1,Le[5]=0,Le[6]=Re[0],Le[7]=Re[1],Le[8]=1,Le},bi.fromRotation=function(Le,Re){var Oe=Math.sin(Re),Ue=Math.cos(Re);return Le[0]=Ue,Le[1]=Oe,Le[2]=0,Le[3]=-Oe,Le[4]=Ue,Le[5]=0,Le[6]=0,Le[7]=0,Le[8]=1,Le},bi.fromScaling=function(Le,Re){return Le[0]=Re[0],Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=Re[1],Le[5]=0,Le[6]=0,Le[7]=0,Le[8]=1,Le},bi.fromMat2d=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=0,Le[3]=Re[2],Le[4]=Re[3],Le[5]=0,Le[6]=Re[4],Le[7]=Re[5],Le[8]=1,Le},bi.fromQuat=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Oe+Oe,Jt=Ue+Ue,_i=qe+qe,xi=Oe*Ot,vi=Ue*Ot,bi=Ue*Jt,Pi=qe*Ot,Hr=qe*Jt,Jr=qe*_i,Ln=Ct*Ot,Nn=Ct*Jt,Gn=Ct*_i;return Le[0]=1-bi-Jr,Le[3]=vi-Gn,Le[6]=Pi+Nn,Le[1]=vi+Gn,Le[4]=1-xi-Jr,Le[7]=Hr-Ln,Le[2]=Pi-Nn,Le[5]=Hr+Ln,Le[8]=1-xi-bi,Le},bi.normalFromMat4=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Re[6],xi=Re[7],vi=Re[8],bi=Re[9],Pi=Re[10],Hr=Re[11],Jr=Re[12],Ln=Re[13],Nn=Re[14],Gn=Re[15],qn=Oe*Jt-Ue*Ot,Zn=Oe*_i-qe*Ot,$n=Oe*xi-Ct*Ot,Xn=Ue*_i-qe*Jt,Yn=Ue*xi-Ct*Jt,lo=qe*xi-Ct*_i,uo=vi*Ln-bi*Jr,po=v
1i*Nn-Pi*Jr,fo=vi*Gn-Hr*Jr,Io=bi*Nn-Pi*Ln,is=bi*Gn-Hr*Ln,as=Pi*Gn-Hr*Nn,Is=qn*as-Zn*is+$n*Io+Xn*fo-Yn*po+lo*uo;return Is?(Le[0]=(Jt*as-_i*is+xi*Io)*(Is=1/Is),Le[1]=(_i*fo-Ot*as-xi*po)*Is,Le[2]=(Ot*is-Jt*fo+xi*uo)*Is,Le[3]=(qe*is-Ue*as-Ct*Io)*Is,Le[4]=(Oe*as-qe*fo+Ct*po)*Is,Le[5]=(Ue*fo-Oe*is-Ct*uo)*Is,Le[6]=(Ln*lo-Nn*Yn+Gn*Xn)*Is,Le[7]=(Nn*$n-Jr*lo-Gn*Zn)*Is,Le[8]=(Jr*Yn-Ln*$n+Gn*qn)*Is,Le):null},bi.projection=function(Le,Re,Oe){return Le[0]=2/Re,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=-2/Oe,Le[5]=0,Le[6]=-1,Le[7]=1,Le[8]=1,Le},bi.str=function(Le){return"mat3("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+", "+Le[4]+", "+Le[5]+", "+Le[6]+", "+Le[7]+", "+Le[8]+")"},bi.frob=function(Le){return Math.hypot(Le[0],Le[1],Le[2],Le[3],Le[4],Le[5],Le[6],Le[7],Le[8])},bi.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le[3]=Re[3]+Oe[3],Le[4]=Re[4]+Oe[4],Le[5]=Re[5]+Oe[5],Le[6]=Re[6]+Oe[6],Le[7]=Re[7]+Oe[7],Le[8]=Re[8]+Oe[8],Le},bi.subtract=i,bi.multiplyScalar=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le[3]=Re[3]*Oe,Le[4]=Re[4]*Oe,Le[5]=Re[5]*Oe,Le[6]=Re[6]*Oe,Le[7]=Re[7]*Oe,Le[8]=Re[8]*Oe,Le},bi.multiplyScalarAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le[2]=Re[2]+Oe[2]*Ue,Le[3]=Re[3]+Oe[3]*Ue,Le[4]=Re[4]+Oe[4]*Ue,Le[5]=Re[5]+Oe[5]*Ue,Le[6]=Re[6]+Oe[6]*Ue,Le[7]=Re[7]+Oe[7]*Ue,Le[8]=Re[8]+Oe[8]*Ue,Le},bi.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]&&Le[3]===Re[3]&&Le[4]===Re[4]&&Le[5]===Re[5]&&Le[6]===Re[6]&&Le[7]===Re[7]&&Le[8]===Re[8]},bi.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Oe[0],Hr=Oe[1],Jr=Oe[2],Ln=Oe[3],Nn=Oe[4],Gn=Oe[5],qn=Oe[6],Zn=Oe[7],$n=Oe[8];return Math.abs(Ue-Pi)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(Pi))&&Math.abs(qe-Hr)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(Hr))&&Math.abs(Ct-Jr)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(Jr))&&Math.abs(Ot-Ln)<=Le.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(Ln))&&Math.abs(Jt-Nn)<=Le.EPSILON*Math.max(1,Math.abs(Jt),Math.abs(Nn))&&Math.abs(_i-Gn)<=Le.EPSILON*Math.max(1,Math.abs(_i),Math.abs(Gn))&&Math.abs(xi-qn)<=Le.EPSILON*Math.max(1,Math.abs(xi),Math.abs(qn))&&Math.abs(vi-Zn)<=Le.EPSILON*Math.max(1,Math.abs(vi),Math.abs(Zn))&&Math.abs(bi-$n)<=Le.EPSILON*Math.max(1,Math.abs(bi),Math.abs($n))},bi.sub=bi.mul=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Oe[0],Hr=Oe[1],Jr=Oe[2],Ln=Oe[3],Nn=Oe[4],Gn=Oe[5],qn=Oe[6],Zn=Oe[7],$n=Oe[8];return Le[0]=Pi*Ue+Hr*Ot+Jr*xi,Le[1]=Pi*qe+Hr*Jt+Jr*vi,Le[2]=Pi*Ct+Hr*_i+Jr*bi,Le[3]=Ln*Ue+Nn*Ot+Gn*xi,Le[4]=Ln*qe+Nn*Jt+Gn*vi,Le[5]=Ln*Ct+Nn*_i+Gn*bi,Le[6]=qn*Ue+Zn*Ot+$n*xi,Le[7]=qn*qe+Zn*Jt+$n*vi,Le[8]=qn*Ct+Zn*_i+$n*bi,Le}function i(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le[2]=Re[2]-Oe[2],Le[3]=Re[3]-Oe[3],Le[4]=Re[4]-Oe[4],Le[5]=Re[5]-Oe[5],Le[6]=Re[6]-Oe[6],Le[7]=Re[7]-Oe[7],Le[8]=Re[8]-Oe[8],Le}return bi.mul=n,bi.sub=i,bi}var Pi,Hr={};function g(){if(Pi)return Hr;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}Pi=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.create=function(){var Re=new Le.ARRAY_TYPE(16);return Le.ARRAY_TYPE!=Float32Array&&(Re[1]=0,Re[2]=0,Re[3]=0,Re[4]=0,Re[6]=0,Re[7]=0,Re[8]=0,Re[9]=0,Re[11]=0,Re[12]=0,Re[13]=0,Re[14]=0),Re[0]=1,Re[5]=1,Re[10]=1,Re[15]=1,Re},Hr.clone=function(Re){var Oe=new Le.ARRAY_TYPE(16);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe[3]=Re[3],Oe[4]=Re[4],Oe[5]=Re[5],Oe[6]=Re[6],Oe[7]=Re[7],Oe[8]=Re[8],Oe[9]=Re[9],Oe[10]=Re[10],Oe[11]=Re[11],Oe[12]=Re[12],Oe[13]=Re[13],Oe[14]=Re[14],Oe[15]=Re[15],Oe},Hr.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le[4]=Re[4],Le[5]=Re[5],Le[6]=Re[6],Le[7]=Re[7],Le[8]=Re[8],Le[9]=Re[9],Le[10]=Re[10],Le[11]=Re[11],Le[12]=Re[12],Le[13]=Re[13],Le[14]=Re[14],Le[15]=Re[15],Le},Hr.fromValues=function(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn){var Gn=new Le.ARRAY_TYPE(16);return Gn[0]=Re,Gn[1]=Oe,Gn[2]=Ue,Gn[3]=qe,Gn[4]=Ct,Gn[5]=Ot,Gn[6]=Jt,Gn[7]=_i,Gn[8]=xi,Gn[9]=vi,Gn[10]=bi,Gn[11]=Pi,Gn[12]=Hr,Gn[13]=Jr,Gn[14]=Ln,Gn[15]=Nn,Gn},Hr.set=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=qe,Le[4]=Ct,Le[5]=Ot,Le[6]=Jt,Le[7]=_i,Le[8]=xi,Le[9]=vi,Le[10]=bi,Le[11]=Pi,Le[12]=Hr,Le[13]=Jr,Le[14]=Ln,Le[15]=Nn,Le},Hr.identity=n,Hr.transpose=function(Le,Re){if(Le===Re){var Oe=Re[1],Ue=Re[2],qe=Re[3],Ct=Re[6],Ot=Re[7],Jt=Re[11];Le[1]=Re[4],Le[2]=Re[8],Le[3]=Re[12],Le[4]=Oe,Le[6]=Re[9],Le[7]=Re[13],Le[8]=Ue,Le[9]=Ct,Le[11]=Re[14],Le[12]=qe,Le[13]=Ot,Le[14]=Jt}else Le[0]=Re[0],Le[1]=Re[4],Le[2]=Re[8],Le[3]=Re[12],Le[4]=Re[1],Le[5]=Re[5],Le[6]=Re[9],Le[7]=Re[13],Le[8]=Re[2],Le[9]=Re[6],Le[10]=Re[10],Le[11]=Re[14],Le[12]=Re[3],Le[13]=Re[7],Le[14]=Re[11],Le[15]=Re[15];return Le},Hr.invert=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Re[6],xi=Re[7],vi=Re[8],bi=Re[9],Pi=Re[10],Hr=Re[11],Jr=Re[12],Ln=Re[13],Nn=Re[14],Gn=Re[15],qn=Oe*Jt-Ue*Ot,Zn=Oe*_i-qe*Ot,$n=Oe*xi-Ct*Ot,Xn=Ue*_i-qe*Jt,Yn=Ue*xi-Ct*Jt,lo=qe*xi-Ct*_i,uo=vi*Ln-bi*Jr,po=v
1i*Nn-Pi*Jr,fo=vi*Gn-Hr*Jr,Io=bi*Nn-Pi*Ln,is=bi*Gn-Hr*Ln,as=Pi*Gn-Hr*Nn,Is=qn*as-Zn*is+$n*Io+Xn*fo-Yn*po+lo*uo;return Is?(Le[0]=(Jt*as-_i*is+xi*Io)*(Is=1/Is),Le[1]=(qe*is-Ue*as-Ct*Io)*Is,Le[2]=(Ln*lo-Nn*Yn+Gn*Xn)*Is,Le[3]=(Pi*Yn-bi*lo-Hr*Xn)*Is,Le[4]=(_i*fo-Ot*as-xi*po)*Is,Le[5]=(Oe*as-qe*fo+Ct*po)*Is,Le[6]=(Nn*$n-Jr*lo-Gn*Zn)*Is,Le[7]=(vi*lo-Pi*$n+Hr*Zn)*Is,Le[8]=(Ot*is-Jt*fo+xi*uo)*Is,Le[9]=(Ue*fo-Oe*is-Ct*uo)*Is,Le[10]=(Jr*Yn-Ln*$n+Gn*qn)*Is,Le[11]=(bi*$n-vi*Yn-Hr*qn)*Is,Le[12]=(Jt*po-Ot*Io-_i*uo)*Is,Le[13]=(Oe*Io-Ue*po+qe*uo)*Is,Le[14]=(Ln*Zn-Jr*Xn-Nn*qn)*Is,Le[15]=(vi*Xn-bi*Zn+Pi*qn)*Is,Le):null},Hr.adjoint=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Re[4],Jt=Re[5],_i=Re[6],xi=Re[7],vi=Re[8],bi=Re[9],Pi=Re[10],Hr=Re[11],Jr=Re[12],Ln=Re[13],Nn=Re[14],Gn=Re[15];return Le[0]=Jt*(Pi*Gn-Hr*Nn)-bi*(_i*Gn-xi*Nn)+Ln*(_i*Hr-xi*Pi),Le[1]=-(Ue*(Pi*Gn-Hr*Nn)-bi*(qe*Gn-Ct*Nn)+Ln*(qe*Hr-Ct*Pi)),Le[2]=Ue*(_i*Gn-xi*Nn)-Jt*(qe*Gn-Ct*Nn)+Ln*(qe*xi-Ct*_i),Le[3]=-(Ue*(_i*Hr-xi*Pi)-Jt*(qe*Hr-Ct*Pi)+bi*(qe*xi-Ct*_i)),Le[4]=-(Ot*(Pi*Gn-Hr*Nn)-vi*(_i*Gn-xi*Nn)+Jr*(_i*Hr-xi*Pi)),Le[5]=Oe*(Pi*Gn-Hr*Nn)-vi*(qe*Gn-Ct*Nn)+Jr*(qe*Hr-Ct*Pi),Le[6]=-(Oe*(_i*Gn-xi*Nn)-Ot*(qe*Gn-Ct*Nn)+Jr*(qe*xi-Ct*_i)),Le[7]=Oe*(_i*Hr-xi*Pi)-Ot*(qe*Hr-Ct*Pi)+vi*(qe*xi-Ct*_i),Le[8]=Ot*(bi*Gn-Hr*Ln)-vi*(Jt*Gn-xi*Ln)+Jr*(Jt*Hr-xi*bi),Le[9]=-(Oe*(bi*Gn-Hr*Ln)-vi*(Ue*Gn-Ct*Ln)+Jr*(Ue*Hr-Ct*bi)),Le[10]=Oe*(Jt*Gn-xi*Ln)-Ot*(Ue*Gn-Ct*Ln)+Jr*(Ue*xi-Ct*Jt),Le[11]=-(Oe*(Jt*Hr-xi*bi)-Ot*(Ue*Hr-Ct*bi)+vi*(Ue*xi-Ct*Jt)),Le[12]=-(Ot*(bi*Nn-Pi*Ln)-vi*(Jt*Nn-_i*Ln)+Jr*(Jt*Pi-_i*bi)),Le[13]=Oe*(bi*Nn-Pi*Ln)-vi*(Ue*Nn-qe*Ln)+Jr*(Ue*Pi-qe*bi),Le[14]=-(Oe*(Jt*Nn-_i*Ln)-Ot*(Ue*Nn-qe*Ln)+Jr*(Ue*_i-qe*Jt)),Le[15]=Oe*(Jt*Pi-_i*bi)-Ot*(Ue*Pi-qe*bi)+vi*(Ue*_i-qe*Jt),Le},Hr.determinant=function(Le){var Re=Le[0],Oe=Le[1],Ue=Le[2],qe=Le[3],Ct=Le[4],Ot=Le[5],Jt=Le[6],_i=Le[7],xi=Le[8],vi=Le[9],bi=Le[10],Pi=Le[11],Hr=Le[12],Jr=Le[13],Ln=Le[14],Nn=Le[15];return(Re*Ot-Oe*Ct)*(bi*Nn-Pi*Ln)-(Re*Jt-Ue*Ct)*(vi*Nn-Pi*Jr)+(Re*_i-qe*Ct)*(vi*Ln-bi*Jr)+(Oe*Jt-Ue*Ot)*(xi*Nn-Pi*Hr)-(Oe*_i-qe*Ot)*(xi*Ln-bi*Hr)+(Ue*_i-qe*Jt)*(xi*Jr-vi*Hr)},Hr.multiply=i,Hr.translate=function(Le,Re,Oe){var Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln=Oe[0],Nn=Oe[1],Gn=Oe[2];return Re===Le?(Le[12]=Re[0]*Ln+Re[4]*Nn+Re[8]*Gn+Re[12],Le[13]=Re[1]*Ln+Re[5]*Nn+Re[9]*Gn+Re[13],Le[14]=Re[2]*Ln+Re[6]*Nn+Re[10]*Gn+Re[14],Le[15]=Re[3]*Ln+Re[7]*Nn+Re[11]*Gn+Re[15]):(qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Re[9],Hr=Re[10],Jr=Re[11],Le[0]=Ue=Re[0],Le[1]=qe,Le[2]=Ct,Le[3]=Ot,Le[4]=Jt,Le[5]=_i,Le[6]=xi,Le[7]=vi,Le[8]=bi,Le[9]=Pi,Le[10]=Hr,Le[11]=Jr,Le[12]=Ue*Ln+Jt*Nn+bi*Gn+Re[12],Le[13]=qe*Ln+_i*Nn+Pi*Gn+Re[13],Le[14]=Ct*Ln+xi*Nn+Hr*Gn+Re[14],Le[15]=Ot*Ln+vi*Nn+Jr*Gn+Re[15]),Le},Hr.scale=function(Le,Re,Oe){var Ue=Oe[0],qe=Oe[1],Ct=Oe[2];return Le[0]=Re[0]*Ue,Le[1]=Re[1]*Ue,Le[2]=Re[2]*Ue,Le[3]=Re[3]*Ue,Le[4]=Re[4]*qe,Le[5]=Re[5]*qe,Le[6]=Re[6]*qe,Le[7]=Re[7]*qe,Le[8]=Re[8]*Ct,Le[9]=Re[9]*Ct,Le[10]=Re[10]*Ct,Le[11]=Re[11]*Ct,Le[12]=Re[12],Le[13]=Re[13],Le[14]=Re[14],Le[15]=Re[15],Le},Hr.rotate=function(Re,Oe,Ue,qe){var Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn,Yn,lo,uo,po,fo,Io,is,as=qe[0],Is=qe[1],Xs=qe[2],ta=Math.hypot(as,Is,Xs);return ta<Le.EPSILON?null:(as*=ta=1/ta,Is*=ta,Xs*=ta,Ct=Math.sin(Ue),Ot=Math.cos(Ue),xi=Oe[1],vi=Oe[2],bi=Oe[3],Hr=Oe[5],Jr=Oe[6],Ln=Oe[7],Gn=Oe[9],qn=Oe[10],Zn=Oe[11],$n=as*as*(Jt=1-Ot)+Ot,lo=as*Is*Jt-Xs*Ct,uo=Is*Is*Jt+Ot,po=Xs*Is*Jt+as*Ct,fo=as*Xs*Jt+Is*Ct,Io=Is*Xs*Jt-as*Ct,is=Xs*Xs*Jt+Ot,Re[0]=(_i=Oe[0])*$n+(Pi=Oe[4])*(Xn=Is*as*Jt+Xs*Ct)+(Nn=Oe[8])*(Yn=Xs*as*Jt-Is*Ct),Re[1]=xi*$n+Hr*Xn+Gn*Yn,Re[2]=vi*$n+Jr*Xn+qn*Yn,Re[3]=bi*$n+Ln*Xn+Zn*Yn,Re[4]=_i*lo+Pi*uo+Nn*po,Re[5]=xi*lo+Hr*uo+Gn*po,Re[6]=vi*lo+Jr*uo+qn*po,Re[7]=bi*lo+Ln*uo+Zn*po,Re[8]=_i*fo+Pi*Io+Nn*is,Re[9]=xi*fo+Hr*Io+Gn*is,Re[10]=vi*fo+Jr*Io+qn*is,Re[11]=bi*fo+Ln*Io+Zn*is,Oe!==Re&&(Re[12]=Oe[12],Re[13]=Oe[13],Re[14]=Oe[14],Re[15]=Oe[15]),Re)},Hr.rotateX=function(Le,Re,Oe){var Ue=Math.sin(Oe),qe=Math.cos(Oe),Ct=Re[4],Ot=Re[5],Jt=Re[6],_i=Re[7],xi=Re[8],vi=Re[9],bi=Re[10],Pi=Re[11];return Re!==Le&&(Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le[12]=Re[12],Le[13]=Re[13],Le[14]=Re[14],Le[15]=Re[15]),Le[4]=Ct*qe+xi*Ue,Le[5]=Ot*qe+vi*Ue,Le[6]=Jt*qe+bi*Ue,Le[7]=_i*qe+Pi*Ue,Le[8]=xi*qe-Ct*Ue,Le[9]=vi*qe-Ot*Ue,Le[10]=bi*qe-Jt*Ue,Le[11]=Pi*qe-_i*Ue,Le}
vendor: 4,222 bytes, line 1
1,Hr.rotateY=function(Le,Re,Oe){var Ue=Math.sin(Oe),qe=Math.cos(Oe),Ct=Re[0],Ot=Re[1],Jt=Re[2],_i=Re[3],xi=Re[8],vi=Re[9],bi=Re[10],Pi=Re[11];return Re!==Le&&(Le[4]=Re[4],Le[5]=Re[5],Le[6]=Re[6],Le[7]=Re[7],Le[12]=Re[12],Le[13]=Re[13],Le[14]=Re[14],Le[15]=Re[15]),Le[0]=Ct*qe-xi*Ue,Le[1]=Ot*qe-vi*Ue,Le[2]=Jt*qe-bi*Ue,Le[3]=_i*qe-Pi*Ue,Le[8]=Ct*Ue+xi*qe,Le[9]=Ot*Ue+vi*qe,Le[10]=Jt*Ue+bi*qe,Le[11]=_i*Ue+Pi*qe,Le},Hr.rotateZ=function(Le,Re,Oe){var Ue=Math.sin(Oe),qe=Math.cos(Oe),Ct=Re[0],Ot=Re[1],Jt=Re[2],_i=Re[3],xi=Re[4],vi=Re[5],bi=Re[6],Pi=Re[7];return Re!==Le&&(Le[8]=Re[8],Le[9]=Re[9],Le[10]=Re[10],Le[11]=Re[11],Le[12]=Re[12],Le[13]=Re[13],Le[14]=Re[14],Le[15]=Re[15]),Le[0]=Ct*qe+xi*Ue,Le[1]=Ot*qe+vi*Ue,Le[2]=Jt*qe+bi*Ue,Le[3]=_i*qe+Pi*Ue,Le[4]=xi*qe-Ct*Ue,Le[5]=vi*qe-Ot*Ue,Le[6]=bi*qe-Jt*Ue,Le[7]=Pi*qe-_i*Ue,Le},Hr.fromTranslation=function(Le,Re){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=1,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[10]=1,Le[11]=0,Le[12]=Re[0],Le[13]=Re[1],Le[14]=Re[2],Le[15]=1,Le},Hr.fromScaling=function(Le,Re){return Le[0]=Re[0],Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=Re[1],Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[10]=Re[2],Le[11]=0,Le[12]=0,Le[13]=0,Le[14]=0,Le[15]=1,Le},Hr.fromRotation=function(Re,Oe,Ue){var qe,Ct,Ot,Jt=Ue[0],_i=Ue[1],xi=Ue[2],vi=Math.hypot(Jt,_i,xi);return vi<Le.EPSILON?null:(Jt*=vi=1/vi,_i*=vi,xi*=vi,qe=Math.sin(Oe),Ct=Math.cos(Oe),Re[0]=Jt*Jt*(Ot=1-Ct)+Ct,Re[1]=_i*Jt*Ot+xi*qe,Re[2]=xi*Jt*Ot-_i*qe,Re[3]=0,Re[4]=Jt*_i*Ot-xi*qe,Re[5]=_i*_i*Ot+Ct,Re[6]=xi*_i*Ot+Jt*qe,Re[7]=0,Re[8]=Jt*xi*Ot+_i*qe,Re[9]=_i*xi*Ot-Jt*qe,Re[10]=xi*xi*Ot+Ct,Re[11]=0,Re[12]=0,Re[13]=0,Re[14]=0,Re[15]=1,Re)},Hr.fromXRotation=function(Le,Re){var Oe=Math.sin(Re),Ue=Math.cos(Re);return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=Ue,Le[6]=Oe,Le[7]=0,Le[8]=0,Le[9]=-Oe,Le[10]=Ue,Le[11]=0,Le[12]=0,Le[13]=0,Le[14]=0,Le[15]=1,Le},Hr.fromYRotation=function(Le,Re){var Oe=Math.sin(Re),Ue=Math.cos(Re);return Le[0]=Ue,Le[1]=0,Le[2]=-Oe,Le[3]=0,Le[4]=0,Le[5]=1,Le[6]=0,Le[7]=0,Le[8]=Oe,Le[9]=0,Le[10]=Ue,Le[11]=0,Le[12]=0,Le[13]=0,Le[14]=0,Le[15]=1,Le},Hr.fromZRotation=function(Le,Re){var Oe=Math.sin(Re),Ue=Math.cos(Re);return Le[0]=Ue,Le[1]=Oe,Le[2]=0,Le[3]=0,Le[4]=-Oe,Le[5]=Ue,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[10]=1,Le[11]=0,Le[12]=0,Le[13]=0,Le[14]=0,Le[15]=1,Le},Hr.fromRotationTranslation=a,Hr.fromQuat2=function(Re,Oe){var Ue=new Le.ARRAY_TYPE(3),qe=-Oe[0],Ct=-Oe[1],Ot=-Oe[2],Jt=Oe[3],_i=Oe[4],xi=Oe[5],vi=Oe[6],bi=Oe[7],Pi=qe*qe+Ct*Ct+Ot*Ot+Jt*Jt;return Pi>0?(Ue[0]=2*(_i*Jt+bi*qe+xi*Ot-vi*Ct)/Pi,Ue[1]=2*(xi*Jt+bi*Ct+vi*qe-_i*Ot)/Pi,Ue[2]=2*(vi*Jt+bi*Ot+_i*Ct-xi*qe)/Pi):(Ue[0]=2*(_i*Jt+bi*qe+xi*Ot-vi*Ct),Ue[1]=2*(xi*Jt+bi*Ct+vi*qe-_i*Ot),Ue[2]=2*(vi*Jt+bi*Ot+_i*Ct-xi*qe)),a(Re,Oe,Ue),Re},Hr.getTranslation=function(Le,Re){return Le[0]=Re[12],Le[1]=Re[13],Le[2]=Re[14],Le},Hr.getScaling=o,Hr.getRotation=function(Re,Oe){var Ue=new Le.ARRAY_TYPE(3);o(Ue,Oe);var qe=1/Ue[0],Ct=1/Ue[1],Ot=1/Ue[2],Jt=Oe[0]*qe,_i=Oe[1]*Ct,xi=Oe[2]*Ot,vi=Oe[4]*qe,bi=Oe[5]*Ct,Pi=Oe[6]*Ot,Hr=Oe[8]*qe,Jr=Oe[9]*Ct,Ln=Oe[10]*Ot,Nn=Jt+bi+Ln,Gn=0;return Nn>0?(Gn=2*Math.sqrt(Nn+1),Re[3]=.25*Gn,Re[0]=(Pi-Jr)/Gn,Re[1]=(Hr-xi)/Gn,Re[2]=(_i-vi)/Gn):Jt>bi&&Jt>Ln?(Gn=2*Math.sqrt(1+Jt-bi-Ln),Re[3]=(Pi-Jr)/Gn,Re[0]=.25*Gn,Re[1]=(_i+vi)/Gn,Re[2]=(Hr+xi)/Gn):bi>Ln?(Gn=2*Math.sqrt(1+bi-Jt-Ln),Re[3]=(Hr-xi)/Gn,Re[0]=(_i+vi)/Gn,Re[1]=.25*Gn,Re[2]=(Pi+Jr)/Gn):(Gn=2*Math.sqrt(1+Ln-Jt-bi),Re[3]=(_i-vi)/Gn,Re[0]=(Hr+xi)/Gn,Re[1]=(Pi+Jr)/Gn,Re[2]=.25*Gn),Re},Hr.fromRotationTranslationScale=function(Le,Re,Oe,Ue){var qe=Re[0],Ct=Re[1],Ot=Re[2],Jt=Re[3],_i=qe+qe,xi=Ct+Ct,vi=Ot+Ot,bi=qe*_i,Pi=qe*xi,Hr=qe*vi,Jr=Ct*xi,Ln=Ct*vi,Nn=Ot*vi,Gn=Jt*_i,qn=Jt*xi,Zn=Jt*vi,$n=Ue[0],Xn=Ue[1],Yn=Ue[2];return Le[0]=(1-(Jr+Nn))*$n,Le[1]=(Pi+Zn)*$n,Le[2]=(Hr-qn)*$n,Le[3]=0,Le[4]=(Pi-Zn)*Xn,Le[5]=(1-(bi+Nn))*Xn,Le[6]=(Ln+Gn)*Xn,Le[7]=0,Le[8]=(Hr+qn)*Yn,Le[9]=(Ln-Gn)*Yn,Le[10]=(1-(bi+Jr))*Yn,Le[11]=0,Le[12]=Oe[0],Le[13]=Oe[1],Le[14]=Oe[2],Le[15]=1,Le},Hr.fromRotationTranslationScaleOrigin=function(Le,Re,Oe,Ue,qe){var Ct=Re[0],Ot=Re[1],Jt=Re[2],_i=Re[3],xi=Ct+Ct,vi=Ot+Ot,bi=Jt+Jt,Pi=Ct*xi,Hr=Ct*vi,Jr=Ct*bi,Ln=Ot*vi,Nn=Ot*bi,Gn=Jt*bi,qn=_i*xi,Zn=_i*vi,$n=_i*bi,Xn=Ue[0],Yn=Ue[1],lo=Ue[2],uo=qe[0],po=qe[1],fo=qe[2],Io=(1-(Ln+Gn)
1)*Xn,is=(Hr+$n)*Xn,as=(Jr-Zn)*Xn,Is=(Hr-$n)*Yn,Xs=(1-(Pi+Gn))*Yn,ta=(Nn+qn)*Yn,ha=(Jr+Zn)*lo,el=(Nn-qn)*lo,tl=(1-(Pi+Ln))*lo;return Le[0]=Io,Le[1]=is,Le[2]=as,Le[3]=0,Le[4]=Is,Le[5]=Xs,Le[6]=ta,Le[7]=0,Le[8]=ha,Le[9]=el,Le[10]=tl,Le[11]=0,Le[12]=Oe[0]+uo-(Io*uo+Is*po+ha*fo),Le[13]=Oe[1]+po-(is*uo+Xs*po+el*fo),Le[14]=Oe[2]+fo-(as*uo+ta*po+tl*fo),Le[15]=1,Le},Hr.fromQuat=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Oe+Oe,Jt=Ue+Ue,_i=qe+qe,xi=Oe*Ot,vi=Ue*Ot,bi=Ue*Jt,Pi=qe*Ot,Hr=qe*Jt,Jr=qe*_i,Ln=Ct*Ot,Nn=Ct*Jt,Gn=Ct*_i;return Le[0]=1-bi-Jr,Le[1]=vi+Gn,Le[2]=Pi-Nn,Le[3]=0,Le[4]=vi-Gn,Le[5]=1-xi-Jr,Le[6]=Hr+Ln,Le[7]=0,Le[8]=Pi+Nn,Le[9]=Hr-Ln,Le[10]=1-xi-bi,Le[11]=0,Le[12]=0,Le[13]=0,Le[14]=0,Le[15]=1,Le},Hr.frustum=function(Le,Re,Oe,Ue,qe,Ct,Ot){var Jt=1/(Oe-Re),_i=1/(qe-Ue),xi=1/(Ct-Ot);return Le[0]=2*Ct*Jt,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=2*Ct*_i,Le[6]=0,Le[7]=0,Le[8]=(Oe+Re)*Jt,Le[9]=(qe+Ue)*_i,Le[10]=(Ot+Ct)*xi,Le[11]=-1,Le[12]=0,Le[13]=0,Le[14]=Ot*Ct*2*xi,Le[15]=0,Le},Hr.perspectiveNO=l,Hr.perspectiveZO=function(Le,Re,Oe,Ue,qe){var Ct,Ot=1/Math.tan(Re/2);return Le[0]=Ot/Oe,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=Ot,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[11]=-1,Le[12]=0,Le[13]=0,Le[15]=0,null!=qe&&qe!==1/0?(Le[10]=qe*(Ct=1/(Ue-qe)),Le[14]=qe*Ue*Ct):(Le[10]=-1,Le[14]=-Ue),Le},Hr.perspectiveFromFieldOfView=function(Le,Re,Oe,Ue){var qe=Math.tan(Re.upDegrees*Math.PI/180),Ct=Math.tan(Re.downDegrees*Math.PI/180),Ot=Math.tan(Re.leftDegrees*Math.PI/180),Jt=Math.tan(Re.rightDegrees*Math.PI/180),_i=2/(Ot+Jt),xi=2/(qe+Ct);return Le[0]=_i,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=xi,Le[6]=0,Le[7]=0,Le[8]=-(Ot-Jt)*_i*.5,Le[9]=(qe-Ct)*xi*.5,Le[10]=Ue/(Oe-Ue),Le[11]=-1,Le[12]=0,Le[13]=0,Le[14]=Ue*Oe/(Oe-Ue),Le[15]=0,Le},Hr.orthoNO=u,Hr.orthoZO=function(Le,Re,Oe,Ue,qe,Ct,Ot){var Jt=1/(Re-Oe),_i=1/(Ue-qe),xi=1/(Ct-Ot);return Le[0]=-2*Jt,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=-2*_i,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[10]=xi,Le[11]=0,Le[12]=(Re+Oe)*Jt,Le[13]=(qe+Ue)*_i,Le[14]=Ct*xi,Le[15]=1,Le},Hr.lookAt=function(Re,Oe,Ue,qe){var Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln=Oe[0],Nn=Oe[1],Gn=Oe[2],qn=qe[0],Zn=qe[1],$n=qe[2],Xn=Ue[0],Yn=Ue[1],lo=Ue[2];return Math.abs(Ln-Xn)<Le.EPSILON&&Math.abs(Nn-Yn)<Le.EPSILON&&Math.abs(Gn-lo)<Le.EPSILON?n(Re):(bi=Ln-Xn,Pi=Nn-Yn,Hr=Gn-lo,Ct=Zn*(Hr*=Jr=1/Math.hypot(bi,Pi,Hr))-$n*(Pi*=Jr),Ot=$n*(bi*=Jr)-qn*Hr,Jt=qn*Pi-Zn*bi,(Jr=Math.hypot(Ct,Ot,Jt))?(Ct*=Jr=1/Jr,Ot*=Jr,Jt*=Jr):(Ct=0,Ot=0,Jt=0),_i=Pi*Jt-Hr*Ot,xi=Hr*Ct-bi*Jt,vi=bi*Ot-Pi*Ct,(Jr=Math.hypot(_i,xi,vi))?(_i*=Jr=1/Jr,xi*=Jr,vi*=Jr):(_i=0,xi=0,vi=0),Re[0]=Ct,Re[1]=_i,Re[2]=bi,Re[3]=0,Re[4]=Ot,Re[5]=xi,Re[6]=Pi,Re[7]=0,Re[8]=Jt,Re[9]=vi,Re[10]=Hr,Re[11]=0,Re[12]=-(Ct*Ln+Ot*Nn+Jt*Gn),Re[13]=-(_i*Ln+xi*Nn+vi*Gn),Re[14]=-(bi*Ln+Pi*Nn+Hr*Gn),Re[15]=1,Re)},Hr.targetTo=function(Le,Re,Oe,Ue){var qe=Re[0],Ct=Re[1],Ot=Re[2],Jt=Ue[0],_i=Ue[1],xi=Ue[2],vi=qe-Oe[0],bi=Ct-Oe[1],Pi=Ot-Oe[2],Hr=vi*vi+bi*bi+Pi*Pi;Hr>0&&(vi*=Hr=1/Math.sqrt(Hr),bi*=Hr,Pi*=Hr);var Jr=_i*Pi-xi*bi,Ln=xi*vi-Jt*Pi,Nn=Jt*bi-_i*vi;return(Hr=Jr*Jr+Ln*Ln+Nn*Nn)>0&&(Jr*=Hr=1/Math.sqrt(Hr),Ln*=Hr,Nn*=Hr),Le[0]=Jr,Le[1]=Ln,Le[2]=Nn,Le[3]=0,Le[4]=bi*Nn-Pi*Ln,Le[5]=Pi*Jr-vi*Nn,Le[6]=vi*Ln-bi*Jr,Le[7]=0,Le[8]=vi,Le[9]=bi,Le[10]=Pi,Le[11]=0,Le[12]=qe,Le[13]=Ct,Le[14]=Ot,Le[15]=1,Le},Hr.str=function(Le){return"mat4("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+", "+Le[4]+", "+Le[5]+", "+Le[6]+", "+Le[7]+", "+Le[8]+", "+Le[9]+", "+Le[10]+", "+Le[11]+", "+Le[12]+", "+Le[13]+", "+Le[14]+", "+Le[15]+")"},Hr.frob=function(Le){return Math.hypot(Le[0],Le[1],Le[2],Le[3],Le[4],Le[5],Le[6],Le[7],Le[8],Le[9],Le[10],Le[11],Le[12],Le[13],Le[14],Le[15])},Hr.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le[3]=Re[3]+Oe[3],Le[4]=Re[4]+Oe[4],Le[5]=Re[5]+Oe[5],Le[6]=Re[6]+Oe[6],Le[7]=Re[7]+Oe[7],Le[8]=Re[8]+Oe[8],Le[9]=Re[9]+Oe[9],Le[10]=Re[10]+Oe[10],Le[11]=Re[11]+Oe[11],Le[12]=Re[12]+Oe[12],Le[13]=Re[13]+Oe[13],Le[14]=Re[14]+Oe[14],Le[15]=Re[15]+Oe[15],Le},Hr.subtract=c,Hr.multiplyScalar=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le[3]=Re[3]*Oe,Le[4]=Re[4]*Oe,Le[5]=Re[5]*Oe,Le[6]=Re[6]*Oe,Le[7]=Re[7]*Oe,Le[8]=Re[8]*Oe,Le[9]=Re[9]*Oe,Le[10]=Re[10]*Oe,Le[11]=Re[11]*Oe,Le[12]=Re[12]*Oe,Le[13]=Re[13]*Oe,Le[14]=Re[14]*Oe,Le[15]=Re[15]*Oe,Le},Hr.multiplyScalarAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le[2]=Re[2]+Oe[2]*Ue,Le[3]=Re[3]+Oe[3]*Ue,Le[4]=Re[4]+Oe[4]*Ue,Le[5]=Re[5]+Oe[5]*Ue,Le[6]=Re[6]+Oe[6]*Ue,Le[7]=Re[7]+Oe[7]*Ue,Le[8]=Re[8]+Oe[8]*Ue,Le[9]=Re[9]+Oe[9]*Ue,Le[10]=Re[10]+Oe[10]*Ue,Le[11]=Re[11]+Oe[11]*Ue,Le[12]=Re[12]+Oe[12]*Ue,Le[13]=Re[13]+Oe[13]*Ue,Le[14]=Re[14]+Oe[14]*Ue,Le[15]=Re[15]+Oe[15]*Ue,Le},Hr.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]&&Le[3]===Re[3]&&Le[4]===Re[4]&&Le[5]===Re[5]&&Le[6]===Re[6]&&Le[7]===Re[7]&&Le[8]===Re[8]&&Le[9]===Re[9]&&Le[10]===Re[10]&&Le[11]===Re[11]&&Le[12]===Re[12]&&Le[13]===Re[13]&&Le[14]===Re[14]&&Le[15]===Re[15]},Hr.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Re[9],Hr=Re[10],Jr=Re[11],Ln=Re[12],Nn=Re[13],Gn=Re[14],qn=Re[15],Zn=Oe[0],$n=Oe[1],Xn=Oe[2],Yn=Oe[3],lo=Oe[4],uo=Oe[5],po=Oe[6],fo=Oe[7],Io=Oe[8],is=Oe[9],as=Oe[10],Is=Oe[11],Xs=Oe[12],ta=Oe[13],ha=Oe[14],el=Oe[15];return Math.abs(Ue-Zn)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(Zn))&&Math.abs(qe-$n)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs($n))&&Math.abs(Ct-Xn)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(Xn))&&Math.abs(Ot-Yn)<=Le.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(Yn))&&Math.abs(Jt-lo)<=Le.EPSILON*Math.max(1,Math.abs(Jt),Math.abs(lo))&&Math.abs(_i-uo)<=Le.EPSILON*Math.max(1,Math.abs(_i),Math.abs(uo))&&Math.abs(xi-po)<=Le.EPSILON*Math.max(1,Math.abs(xi),Math.abs(po))&&Math.abs(vi-fo)<=Le.EPSILON*Math.max(1,Math.abs(vi),Math.abs(fo))&&Math.abs(bi-Io)<=Le.EPSILON*Math.max(1,Math.abs(bi),Math.abs(Io))&&Math.abs(Pi-is)<=Le.EPSILON*Math.max(1,Math.abs(Pi),Math.abs(is))&&Math.abs(Hr-as)<=Le.EPSILON*Math.max(1,Math.abs(Hr),Math.abs(as))&&Math.abs(Jr-Is)<=Le.EPSILON*Math.max(1,Math.abs(Jr),Math.abs(Is))&&Math.abs(Ln-Xs)<=Le.EPSILON*Math.max(1,Math.abs(Ln),Math.abs(Xs))&&Math.abs(Nn-ta)<=Le.EPSILON*Math.max(1,Math.abs(Nn),Math.abs(ta))&&Math.abs(Gn-ha)<=Le.EPSILON*Math.max(1,Math.abs(Gn),Math.abs(ha))&&Math.abs(qn-el)<=Le.EPSILON*Math.max(1,Math.abs(qn),Math.abs(el))},Hr.sub=Hr.mul=Hr.ortho=Hr.perspective=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}
1return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(Le){return Le[0]=1,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=1,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[10]=1,Le[11]=0,Le[12]=0,Le[13]=0,Le[14]=0,Le[15]=1,Le}function i(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Re[8],Pi=Re[9],Hr=Re[10],Jr=Re[11],Ln=Re[12],Nn=Re[13],Gn=Re[14],qn=Re[15],Zn=Oe[0],$n=Oe[1],Xn=Oe[2],Yn=Oe[3];return Le[0]=Zn*Ue+$n*Jt+Xn*bi+Yn*Ln,Le[1]=Zn*qe+$n*_i+Xn*Pi+Yn*Nn,Le[2]=Zn*Ct+$n*xi+Xn*Hr+Yn*Gn,Le[3]=Zn*Ot+$n*vi+Xn*Jr+Yn*qn,Le[4]=(Zn=Oe[4])*Ue+($n=Oe[5])*Jt+(Xn=Oe[6])*bi+(Yn=Oe[7])*Ln,Le[5]=Zn*qe+$n*_i+Xn*Pi+Yn*Nn,Le[6]=Zn*Ct+$n*xi+Xn*Hr+Yn*Gn,Le[7]=Zn*Ot+$n*vi+Xn*Jr+Yn*qn,Le[8]=(Zn=Oe[8])*Ue+($n=Oe[9])*Jt+(Xn=Oe[10])*bi+(Yn=Oe[11])*Ln,Le[9]=Zn*qe+$n*_i+Xn*Pi+Yn*Nn,Le[10]=Zn*Ct+$n*xi+Xn*Hr+Yn*Gn,Le[11]=Zn*Ot+$n*vi+Xn*Jr+Yn*qn,Le[12]=(Zn=Oe[12])*Ue+($n=Oe[13])*Jt+(Xn=Oe[14])*bi+(Yn=Oe[15])*Ln,Le[13]=Zn*qe+$n*_i+Xn*Pi+Yn*Nn,Le[14]=Zn*Ct+$n*xi+Xn*Hr+Yn*Gn,Le[15]=Zn*Ot+$n*vi+Xn*Jr+Yn*qn,Le}function a(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Ue+Ue,_i=qe+qe,xi=Ct+Ct,vi=Ue*Jt,bi=Ue*_i,Pi=Ue*xi,Hr=qe*_i,Jr=qe*xi,Ln=Ct*xi,Nn=Ot*Jt,Gn=Ot*_i,qn=Ot*xi;return Le[0]=1-(Hr+Ln),Le[1]=bi+qn,Le[2]=Pi-Gn,Le[3]=0,Le[4]=bi-qn,Le[5]=1-(vi+Ln),Le[6]=Jr+Nn,Le[7]=0,Le[8]=Pi+Gn,Le[9]=Jr-Nn,Le[10]=1-(vi+Hr),Le[11]=0,Le[12]=Oe[0],Le[13]=Oe[1],Le[14]=Oe[2],Le[15]=1,Le}function o(Le,Re){var Oe=Re[4],Ue=Re[5],qe=Re[6],Ct=Re[8],Ot=Re[9],Jt=Re[10];return Le[0]=Math.hypot(Re[0],Re[1],Re[2]),Le[1]=Math.hypot(Oe,Ue,qe),Le[2]=Math.hypot(Ct,Ot,Jt),Le}function l(Le,Re,Oe,Ue,qe){var Ct,Ot=1/Math.tan(Re/2);return Le[0]=Ot/Oe,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=Ot,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[11]=-1,Le[12]=0,Le[13]=0,Le[15]=0,null!=qe&&qe!==1/0?(Le[10]=(qe+Ue)*(Ct=1/(Ue-qe)),Le[14]=2*qe*Ue*Ct):(Le[10]=-1,Le[14]=-2*Ue),Le}function u(Le,Re,Oe,Ue,qe,Ct,Ot){var Jt=1/(Re-Oe),_i=1/(Ue-qe),xi=1/(Ct-Ot);return Le[0]=-2*Jt,Le[1]=0,Le[2]=0,Le[3]=0,Le[4]=0,Le[5]=-2*_i,Le[6]=0,Le[7]=0,Le[8]=0,Le[9]=0,Le[10]=2*xi,Le[11]=0,Le[12]=(Re+Oe)*Jt,Le[13]=(qe+Ue)*_i,Le[14]=(Ot+Ct)*xi,Le[15]=1,Le}function c(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le[2]=Re[2]-Oe[2],Le[3]=Re[3]-Oe[3],Le[4]=Re[4]-Oe[4],Le[5]=Re[5]-Oe[5],Le[6]=Re[6]-Oe[6],Le[7]=Re[7]-Oe[7],Le[8]=Re[8]-Oe[8],Le[9]=Re[9]-Oe[9],Le[10]=Re[10]-Oe[10],Le[11]=Re[11]-Oe[11],Le[12]=Re[12]-Oe[12],Le[13]=Re[13]-Oe[13],Le[14]=Re[14]-Oe[14],Le[15]=Re[15]-Oe[15],Le}return Hr.perspective=l,Hr.ortho=u,Hr.mul=i,Hr.sub=c,Hr}var Jr,Ln={},Nn={};function w(){if(Jr)return Nn;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}Jr=1,Object.defineProperty(Nn,"__esModule",{value:!0}),Nn.create=n,Nn.clone=function(Re){var Oe=new Le.ARRAY_TYPE(3);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe},Nn.length=i,Nn.fromValues=function(Re,Oe,Ue){var qe=new Le.ARRAY_TYPE(3);return qe[0]=Re,qe[1]=Oe,qe[2]=Ue,qe},Nn.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le},Nn.set=function(Le,Re,Oe,Ue){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le},Nn.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le},Nn.subtract=a,Nn.multiply=o,Nn.divide=l,Nn.ceil=function(Le,Re){return Le[0]=Math.ceil(Re[0]),Le[1]=Math.ceil(Re[1]),Le[2]=Math.ceil(Re[2]),Le},Nn.floor=function(Le,Re){return Le[0]=Math.floor(Re[0]),Le[1]=Math.floor(Re[1]),Le[2]=Math.floor(Re[2]),Le},Nn.min=function(Le,Re,Oe){return Le[0]=Math.min(Re[0],Oe[0]),Le[1]=Math.min(Re[1],Oe[1]),Le[2]=Math.min(Re[2],Oe[2]),Le},Nn.max=function(Le,Re,Oe){return Le[0]=Math.max(Re[0],Oe[0]),Le[1]=Math.max(Re[1],Oe[1]),Le[2]=Math.max(Re[2],Oe[2]),Le},Nn.round=function(Le,Re){return Le[0]=Math.round(Re[0]),Le[1]=Math.round(Re[1]),Le[2]=Math.round(Re[2]),Le},Nn.scale=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le},Nn.scaleAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le[2]=Re[2]+Oe[2]*Ue,Le},Nn.distance=u,Nn.squaredDistance=c,Nn.squaredLength=h,Nn.negate=function(Le,Re){return Le[0]=-Re[0],Le[1]=-Re[1],Le[2]=-Re[2],Le},Nn.inverse=function(Le,Re){return Le[0]=1/Re[0],Le[1]=1/Re[1],Le[2]=1/Re[2],Le},Nn.normalize=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Oe*Oe+Ue*Ue+qe*qe;return Ct>0&&(Ct=1/Math.sqrt(Ct)),Le[0]=Re[0]*Ct,Le[1]=Re[1]*Ct,Le[2]=Re[2]*Ct,Le},Nn.dot=p,Nn.cross=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Oe[0],Jt=Oe[1],_i=Oe[2];return Le[0]=qe*_i-Ct*Jt,Le[1]=Ct*Ot-Ue*_i,Le[2]=Ue*Jt-qe*Ot,Le},Nn.lerp=function(Le,Re,Oe,Ue){var qe=Re[0],Ct=Re[1],Ot=Re[2];return Le[0]=qe+Ue*(Oe[0]-qe),Le[1]=Ct+Ue*(Oe[1]-Ct),Le[2]=Ot+Ue*(Oe[2]-Ot),Le},Nn.hermite=function(Le,Re,Oe,Ue,qe,Ct){var Ot=Ct*Ct,Jt=Ot*(2*Ct-3)+1,_i=Ot*(Ct-2)+Ct,xi=Ot*(Ct-1),vi=Ot*(3-2*Ct);return Le[0]=Re[0]*Jt+Oe[0]*_i+Ue[0]*xi+qe[0]*vi,Le[1]=Re[1]*Jt+Oe[1]*_i+Ue[1]*xi+qe[1]*vi,Le[2]=Re[2]*Jt+Oe[2]*_i+Ue[2]*xi+qe[2]*vi,Le},Nn.bezier=function(Le,Re,Oe,Ue,qe,Ct){var Ot=1-Ct,Jt=Ot*Ot,_i=Ct*Ct,xi=Jt*Ot,vi=3*Ct*Jt,bi=3*_i*Ot,Pi=_i*Ct;return Le[0]=Re[0]*xi+Oe[0]*vi+Ue[0]*bi+qe[0]*Pi,Le[1]=Re[1]*xi+Oe[1]*vi+Ue[1]*bi+qe[1]*Pi,Le[2]=Re[2]*xi+Oe[2]*vi+Ue[2]*bi+qe[2]*Pi,Le},Nn.random=function(Re,Oe){Oe=Oe||1;var Ue=2*Le.RANDOM()*Math.PI,qe=2*Le.RANDOM()-1,Ct=Math.sqrt(1-qe*qe)*Oe;return Re[0]=Math.cos(Ue)*Ct,Re[1]=Math.sin(Ue)*Ct,Re[2]=qe*Oe,Re},Nn.transformMat4=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Oe[3]*Ue+Oe[7]*qe+Oe[11]*Ct+Oe[15];return Le[0]=(Oe[0]*Ue+Oe[4]*qe+Oe[8]*Ct+Oe[12])/(Ot=Ot||1),Le[1]=(Oe[1]*Ue+Oe[5]*qe+Oe[9]*Ct+Oe[13])/Ot,Le[2]=(Oe[2]*Ue+Oe[6]*qe+Oe[10]*Ct+Oe[14])/Ot,Le},Nn.transformMat3=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2];return Le[0]=Ue*Oe[0]+qe*Oe[3]+Ct*Oe[6],Le[1]=Ue*Oe[1]+qe*Oe[4]+Ct*Oe[7],Le[2]=Ue*Oe[2]+qe*Oe[5]+Ct*Oe[8],Le},Nn.transformQuat=function(Le,Re,Oe){var Ue=Oe[0],qe=Oe[1],Ct=Oe[2],Ot=Re[0],Jt=Re[1],_i=Re[2],xi=qe*_i-Ct*Jt,vi=Ct*Ot-Ue*_i,bi=Ue*Jt-qe*Ot,Pi=qe*bi-Ct*vi,Hr=Ct*xi-Ue*bi,Jr=Ue*vi-qe*xi,Ln=2*Oe[3];return vi*=Ln,bi*=Ln,Hr*=2,Jr*=2,Le[0]=Ot+(xi*=Ln)+(Pi*=2),Le[1]=Jt+vi+Hr,Le[2]=_i+bi+Jr,Le},Nn.rotateX=function(Le,Re,Oe,Ue){var qe=[],Ct=[];return qe[0]=Re[0]-Oe[0],qe[1]=Re[1]-Oe[1],qe[2]=Re[2]-Oe[2],Ct[0]=qe[0],Ct[1]=qe[1]*Math.cos(Ue)-qe[2]*Math.sin(Ue),Ct[2]=qe[1]*Math.sin(Ue)+qe[2]*Math.cos(Ue),Le[0]=Ct[0]+Oe[0],Le[1]=Ct[1]+Oe[1],Le[2]=Ct[2]+Oe[2],Le},Nn.rotateY=function(Le,Re,Oe,Ue){var qe=[],Ct=[];return qe[0]=Re[0]-Oe[0],qe[1]=Re[1]-Oe[1],qe[2]=Re[2]-Oe[2],Ct[0]=qe[2]*Math.sin(Ue)+qe[0]*Math.cos(Ue),Ct[1]=qe[1],Ct[2]=qe[2]*Math.cos(Ue)-qe[0]*Math.sin(Ue),Le[0]=Ct[0]+Oe[0],Le[1]=Ct[1]+Oe[1],Le[2]=Ct[2]+Oe[2],Le},Nn.rotateZ=function(Le,Re,Oe,Ue){var qe=[],Ct=[];return qe[0]=Re[0]-Oe[0],qe[1]=Re[1]-Oe[1],qe[2]=Re[2]-Oe[2],Ct[0]=qe[0]*Math.cos(Ue)-qe[1]*Math.sin(Ue),Ct[1]=qe[0]*Math.sin(Ue)+qe[1]*Math.cos(Ue),Ct[2]=qe[2],Le[0]=Ct[0]+Oe[0],Le[1]=Ct[1]+Oe[1],Le[2]=Ct[2]+Oe[2],Le},Nn.angle=function(Le,Re){var Oe=Le[0],Ue=Le[1],qe=Le[2],Ct=Re[0],Ot=Re[1],Jt=Re[2],_i=Math.sqrt(Oe*Oe+Ue*Ue+qe*qe)*Math.sqrt(Ct*Ct+Ot*Ot+Jt*Jt),xi=_i&&p(Le,Re)/_i;return Math.acos(Math.min(Math.max(xi,-1),1))},Nn.zero=function(Le){return Le[0]=0,Le[1]=0,Le[2]=0,Le},Nn.str=function(Le){return"vec3("+Le[0]+", "+Le[1]+", "+Le[2]+")"},Nn.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]},Nn.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Oe[0],Jt=Oe[1],_i=Oe[2];return Math.abs(Ue-Ot)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(Ot))&&Math.abs(qe-Jt)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(Jt))&&Math.abs(Ct-_i
1)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(_i))},Nn.forEach=Nn.sqrLen=Nn.len=Nn.sqrDist=Nn.dist=Nn.div=Nn.mul=Nn.sub=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(){var Re=new Le.ARRAY_TYPE(3);return Le.ARRAY_TYPE!=Float32Array&&(Re[0]=0,Re[1]=0,Re[2]=0),Re}function i(Le){return Math.hypot(Le[0],Le[1],Le[2])}function a(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le[2]=Re[2]-Oe[2],Le}function o(Le,Re,Oe){return Le[0]=Re[0]*Oe[0],Le[1]=Re[1]*Oe[1],Le[2]=Re[2]*Oe[2],Le}function l(Le,Re,Oe){return Le[0]=Re[0]/Oe[0],Le[1]=Re[1]/Oe[1],Le[2]=Re[2]/Oe[2],Le}function u(Le,Re){return Math.hypot(Re[0]-Le[0],Re[1]-Le[1],Re[2]-Le[2])}function c(Le,Re){var Oe=Re[0]-Le[0],Ue=Re[1]-Le[1],qe=Re[2]-Le[2];return Oe*Oe+Ue*Ue+qe*qe}function h(Le){var Re=Le[0],Oe=Le[1],Ue=Le[2];return Re*Re+Oe*Oe+Ue*Ue}function p(Le,Re){return Le[0]*Re[0]+Le[1]*Re[1]+Le[2]*Re[2]}Nn.sub=a,Nn.mul=o,Nn.div=l,Nn.dist=u,Nn.sqrDist=c,Nn.len=i,Nn.sqrLen=h;var Re,Oe=(Re=n(),function(Le,Oe,Ue,qe,Ct,Ot){var Jt,_i;for(Oe||(Oe=3),Ue||(Ue=0),_i=qe?Math.min(qe*Oe+Ue,Le.length):Le.length,Jt=Ue;Jt<_i;Jt+=Oe)Re[0]=Le[Jt],Re[1]=Le[Jt+1],Re[2]=Le[Jt+2],Ct(Re,Re,Ot),Le[Jt]=Re[0],Le[Jt+1]=Re[1],Le[Jt+2]=Re[2];return Le});return Nn.forEach=Oe,Nn}var Gn,qn,Zn={};function S(){if(Gn)return Zn;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}Gn=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.create=n,Zn.clone=function(Re){var Oe=new Le.ARRAY_TYPE(4);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe[3]=Re[3],Oe},Zn.fromValues=function(Re,Oe,Ue,qe){var Ct=new Le.ARRAY_TYPE(4);return Ct[0]=Re,Ct[1]=Oe,Ct[2]=Ue,Ct[3]=qe,Ct},Zn.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le},Zn.set=function(Le,Re,Oe,Ue,qe){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=qe,Le},Zn.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le[3]=Re[3]+Oe[3],Le},Zn.subtract=i,Zn.multiply=a,Zn.divide=o,Zn.ceil=function(Le,Re){return Le[0]=Math.ceil(Re[0]),Le[1]=Math.ceil(Re[1]),Le[2]=Math.ceil(Re[2]),Le[3]=Math.ceil(Re[3]),Le},Zn.floor=function(Le,Re){return Le[0]=Math.floor(Re[0]),Le[1]=Math.floor(Re[1]),Le[2]=Math.floor(Re[2]),Le[3]=Math.floor(Re[3]),Le},Zn.min=function(Le,Re,Oe){return Le[0]=Math.min(Re[0],Oe[0]),Le[1]=Math.min(Re[1],Oe[1]),Le[2]=Math.min(Re[2],Oe[2]),Le[3]=Math.min(Re[3],Oe[3]),Le},Zn.max=function(Le,Re,Oe){return Le[0]=Math.max(Re[0],Oe[0]),Le[1]=Math.max(Re[1],Oe[1]),Le[2]=Math.max(Re[2],Oe[2]),Le[3]=Math.max(Re[3],Oe[3]),Le},Zn.round=function(Le,Re){return Le[0]=Math.round(Re[0]),Le[1]=Math.round(Re[1]),Le[2]=Math.round(Re[2]),Le[3]=Math.round(Re[3]),Le},Zn.scale=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le[3]=Re[3]*Oe,Le},Zn.scaleAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le[2]=Re[2]+Oe[2]*Ue,Le[3]=Re[3]+Oe[3]*Ue,Le},Zn.distance=l,Zn.squaredDistance=u,Zn.length=c,Zn.squaredLength=h,Zn.negate=function(Le,Re){return Le[0]=-Re[0],Le[1]=-Re[1],Le[2]=-Re[2],Le[3]=-Re[3],Le},Zn.inverse=function(Le,Re){return Le[0]=1/Re[0],Le[1]=1/Re[1],Le[2]=1/Re[2],Le[3]=1/Re[3],Le},Zn.normalize=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Oe*Oe+Ue*Ue+qe*qe+Ct*Ct;return Ot>0&&(Ot=1/Math.sqrt(Ot)),Le[0]=Oe*Ot,Le[1]=Ue*Ot,Le[2]=qe*Ot,Le[3]=Ct*Ot,Le},Zn.dot=function(Le,Re){return Le[0]*Re[0]+Le[1]*Re[1]+Le[2]*Re[2]+Le[3]*Re[3]},Zn.cross=function(Le,Re,Oe,Ue){var qe=Oe[0]*Ue[1]-Oe[1]*Ue[0],Ct=Oe[0]*Ue[2]-Oe[2]*Ue[0],Ot=Oe[0]*Ue[3]-Oe[3]*Ue[0],Jt=Oe[1]*Ue[2]-Oe[2]*Ue[1],_i=Oe[1]*Ue[3]-Oe[3]*Ue[1],xi=Oe[2]*Ue[3]-Oe[3]*Ue[2],vi=Re[0],bi=Re[1],Pi=Re[2],Hr=Re[3];return Le[0]=bi*xi-Pi*_i+Hr*Jt,Le[1]=-vi*xi+Pi*Ot-Hr*Ct,Le[2]=vi*_i-bi*Ot+Hr*qe,Le[3]=-vi*Jt+bi*Ct-Pi*qe,Le},Zn.lerp=function(Le,Re,Oe,Ue){var qe=Re[0],Ct=Re[1],Ot=Re[2],Jt=Re[3];return Le[0]=qe+Ue*(Oe[0]-qe),Le[1]=Ct+Ue*(Oe[1]-Ct),Le[2]=Ot+Ue*(Oe[2]-Ot),Le[3]=Jt+Ue*(Oe[3]-Jt),Le},Zn.random=function(Re,Oe){var Ue,qe,Ct,Ot,Jt,_i;Oe=Oe||1;do{Jt=(Ue=2*Le.RANDOM()-1)*Ue+(qe=2*Le.RANDOM()-1)*qe}while(Jt>=1);do{_i=(Ct=2*Le.RANDOM()-1)*Ct+(Ot=2*Le.RANDOM()-1)*Ot}while(_i>=1);var xi=Math.sqrt((1-Jt)/_i);return Re[0]=Oe*Ue,Re[1]=Oe*qe,Re[2]=Oe*Ct*xi,Re[3]=Oe*Ot*xi,Re},Zn.transformMat4=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3];return Le[0]=Oe[0]*Ue+Oe[4]*qe+Oe[8]*Ct+Oe[12]*Ot,Le[1]=Oe[1]*Ue+Oe[5]*qe+Oe[9]*Ct+Oe[13]*Ot,Le[2]=Oe[2]*Ue+Oe[6]*qe+Oe[10]*Ct+Oe[14]*Ot,Le[3]=Oe[3]*Ue+Oe[7]*qe+Oe[11]*Ct+Oe[15]*Ot,Le},Zn.transformQuat=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Oe[0],Jt=Oe[1],_i=Oe[2],xi=Oe[3],vi=xi*Ue+Jt*Ct-_i*qe,bi=xi*qe+_i*Ue-Ot*Ct,P
1i=xi*Ct+Ot*qe-Jt*Ue,Hr=-Ot*Ue-Jt*qe-_i*Ct;return Le[0]=vi*xi+Hr*-Ot+bi*-_i-Pi*-Jt,Le[1]=bi*xi+Hr*-Jt+Pi*-Ot-vi*-_i,Le[2]=Pi*xi+Hr*-_i+vi*-Jt-bi*-Ot,Le[3]=Re[3],Le},Zn.zero=function(Le){return Le[0]=0,Le[1]=0,Le[2]=0,Le[3]=0,Le},Zn.str=function(Le){return"vec4("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+")"},Zn.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]&&Le[3]===Re[3]},Zn.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Oe[0],_i=Oe[1],xi=Oe[2],vi=Oe[3];return Math.abs(Ue-Jt)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(Jt))&&Math.abs(qe-_i)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(_i))&&Math.abs(Ct-xi)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(xi))&&Math.abs(Ot-vi)<=Le.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(vi))},Zn.forEach=Zn.sqrLen=Zn.len=Zn.sqrDist=Zn.dist=Zn.div=Zn.mul=Zn.sub=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(){var Re=new Le.ARRAY_TYPE(4);return Le.ARRAY_TYPE!=Float32Array&&(Re[0]=0,Re[1]=0,Re[2]=0,Re[3]=0),Re}function i(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le[2]=Re[2]-Oe[2],Le[3]=Re[3]-Oe[3],Le}function a(Le,Re,Oe){return Le[0]=Re[0]*Oe[0],Le[1]=Re[1]*Oe[1],Le[2]=Re[2]*Oe[2],Le[3]=Re[3]*Oe[3],Le}function o(Le,Re,Oe){return Le[0]=Re[0]/Oe[0],Le[1]=Re[1]/Oe[1],Le[2]=Re[2]/Oe[2],Le[3]=Re[3]/Oe[3],Le}function l(Le,Re){return Math.hypot(Re[0]-Le[0],Re[1]-Le[1],Re[2]-Le[2],Re[3]-Le[3])}function u(Le,Re){var Oe=Re[0]-Le[0],Ue=Re[1]-Le[1],qe=Re[2]-Le[2],Ct=Re[3]-Le[3];return Oe*Oe+Ue*Ue+qe*qe+Ct*Ct}function c(Le){return Math.hypot(Le[0],Le[1],Le[2],Le[3])}function h(Le){var Re=Le[0],Oe=Le[1],Ue=Le[2],qe=Le[3];return Re*Re+Oe*Oe+Ue*Ue+qe*qe}Zn.sub=i,Zn.mul=a,Zn.div=o,Zn.dist=l,Zn.sqrDist=u,Zn.len=c,Zn.sqrLen=h;var Re,Oe=(Re=n(),function(Le,Oe,Ue,qe,Ct,Ot){var Jt,_i;for(Oe||(Oe=4),Ue||(Ue=0),_i=qe?Math.min(qe*Oe+Ue,Le.length):Le.length,Jt=Ue;Jt<_i;Jt+=Oe)Re[0]=Le[Jt],Re[1]=Le[Jt+1],Re[2]=Le[Jt+2],Re[3]=Le[Jt+3],Ct(Re,Re,Ot),Le[Jt]=Re[0],Le[Jt+1]=Re[1],Le[Jt+2]=Re[2],Le[Jt+3]=Re[3];return Le});return Zn.forEach=Oe,Zn}function I(){if(qn)return Ln;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}qn=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.create=l,Ln.identity=function(Le){return Le[0]=0,Le[1]=0,Le[2]=0,Le[3]=1,Le},Ln.setAxisAngle=u,Ln.getAxisAngle=function(Re,Oe){var Ue=2*Math.acos(Oe[3]),qe=Math.sin(Ue/2);return qe>Le.EPSILON?(Re[0]=Oe[0]/qe,Re[1]=Oe[1]/qe,Re[2]=Oe[2]/qe):(Re[0]=1,Re[1]=0,Re[2]=0),Ue},Ln.getAngle=function(Le,Re){var Oe=Ct(Le,Re);return Math.acos(2*Oe*Oe-1)},Ln.multiply=c,Ln.rotateX=function(Le,Re,Oe){Oe*=.5;var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Math.sin(Oe),_i=Math.cos(Oe);return Le[0]=Ue*_i+Ot*Jt,Le[1]=qe*_i+Ct*Jt,Le[2]=Ct*_i-qe*Jt,Le[3]=Ot*_i-Ue*Jt,Le},Ln.rotateY=function(Le,Re,Oe){Oe*=.5;var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Math.sin(Oe),_i=Math.cos(Oe);return Le[0]=Ue*_i-Ct*Jt,Le[1]=qe*_i+Ot*Jt,Le[2]=Ct*_i+Ue*Jt,Le[3]=Ot*_i-qe*Jt,Le},Ln.rotateZ=function(Le,Re,Oe){Oe*=.5;var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Math.sin(Oe),_i=Math.cos(Oe);return Le[0]=Ue*_i+qe*Jt,Le[1]=qe*_i-Ue*Jt,Le[2]=Ct*_i+Ot*Jt,Le[3]=Ot*_i-Ct*Jt,Le},Ln.calculateW=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2];return Le[0]=Oe,Le[1]=Ue,Le[2]=qe,Le[3]=Math.sqrt(Math.abs(1-Oe*Oe-Ue*Ue-qe*qe)),Le},Ln.exp=h,Ln.ln=p,Ln.pow=function(Le,Re,Oe){return p(Le,Re),qe(Le,Le,Oe),h(Le,Le),Le},Ln.slerp=f,Ln.random=function(Re){var Oe=Le.RANDOM(),Ue=Le.RANDOM(),qe=Le.RANDOM(),Ct=Math.sqrt(1-Oe),Ot=Math.sqrt(Oe);return Re[0]=Ct*Math.sin(2*Math.PI*Ue),Re[1]=Ct*Math.cos(2*Math.PI*Ue),Re[2]=Ot*Math.sin(2*Math.PI*qe),Re[3]=Ot*Math.cos(2*Math.PI*qe),Re},Ln.invert=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Oe*Oe+Ue*Ue+qe*qe+Ct*Ct,Jt=Ot?1/Ot:0;return Le[0]=-Oe*Jt,Le[1]=-Ue*Jt,Le[2]=-qe*Jt,Le[3]=Ct*Jt,Le},Ln.conjugate=function(Le,Re){return Le[0]=-Re[0],Le[1]=-Re[1],Le[2]=-Re[2],Le[3]=Re[3],Le},Ln.fromMat3=m,Ln.fromEuler=function(Le,Re,Oe,Ue){var qe=.5*Math.PI/180;Re*=qe,Oe*=qe,Ue*=qe;var Ct=Math.sin(Re),Ot=Math.cos(Re),Jt=Math.sin(Oe),_i=Math.cos(Oe),xi=Math.sin(Ue),vi=Math.cos(Ue);return Le[0]=Ct*_i*vi-Ot*Jt*xi,Le[1]=Ot*Jt*vi+Ct*_i*xi,Le[2]=Ot*_i*xi-Ct*Jt*vi,Le[3]=Ot*_i*vi+Ct*Jt*xi,Le},Ln.str=function(Le){return"quat("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+")"},Ln.setAxes=Ln.sqlerp=Ln.rotationTo=Ln.equals=Ln.exactEquals=Ln.normalize=Ln.sqrLen=Ln.squaredLength=Ln.len=Ln.length=Ln.lerp=Ln.dot=Ln.scale=Ln.mul=Ln.add=Ln.set=Ln.copy=Ln.fromValues=Ln.clone=void 0;var Le=o(s()),Re=o(d()),Oe=o(w()),Ue=o(S());function a(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(a=function(Le){return Le?Oe:Re})(Le)}function o(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=a(Re);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}
1return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}function l(){var Re=new Le.ARRAY_TYPE(4);return Le.ARRAY_TYPE!=Float32Array&&(Re[0]=0,Re[1]=0,Re[2]=0),Re[3]=1,Re}function u(Le,Re,Oe){Oe*=.5;var Ue=Math.sin(Oe);return Le[0]=Ue*Re[0],Le[1]=Ue*Re[1],Le[2]=Ue*Re[2],Le[3]=Math.cos(Oe),Le}function c(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Oe[0],_i=Oe[1],xi=Oe[2],vi=Oe[3];return Le[0]=Ue*vi+Ot*Jt+qe*xi-Ct*_i,Le[1]=qe*vi+Ot*_i+Ct*Jt-Ue*xi,Le[2]=Ct*vi+Ot*xi+Ue*_i-qe*Jt,Le[3]=Ot*vi-Ue*Jt-qe*_i-Ct*xi,Le}function h(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Math.sqrt(Oe*Oe+Ue*Ue+qe*qe),Jt=Math.exp(Ct),_i=Ot>0?Jt*Math.sin(Ot)/Ot:0;return Le[0]=Oe*_i,Le[1]=Ue*_i,Le[2]=qe*_i,Le[3]=Jt*Math.cos(Ot),Le}function p(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Re[2],Ct=Re[3],Ot=Math.sqrt(Oe*Oe+Ue*Ue+qe*qe),Jt=Ot>0?Math.atan2(Ot,Ct)/Ot:0;return Le[0]=Oe*Jt,Le[1]=Ue*Jt,Le[2]=qe*Jt,Le[3]=.5*Math.log(Oe*Oe+Ue*Ue+qe*qe+Ct*Ct),Le}function f(Re,Oe,Ue,qe){var Ct,Ot,Jt,_i,xi,vi=Oe[0],bi=Oe[1],Pi=Oe[2],Hr=Oe[3],Jr=Ue[0],Ln=Ue[1],Nn=Ue[2],Gn=Ue[3];return(Ot=vi*Jr+bi*Ln+Pi*Nn+Hr*Gn)<0&&(Ot=-Ot,Jr=-Jr,Ln=-Ln,Nn=-Nn,Gn=-Gn),1-Ot>Le.EPSILON?(Ct=Math.acos(Ot),Jt=Math.sin(Ct),_i=Math.sin((1-qe)*Ct)/Jt,xi=Math.sin(qe*Ct)/Jt):(_i=1-qe,xi=qe),Re[0]=_i*vi+xi*Jr,Re[1]=_i*bi+xi*Ln,Re[2]=_i*Pi+xi*Nn,Re[3]=_i*Hr+xi*Gn,Re}function m(Le,Re){var Oe,Ue=Re[0]+Re[4]+Re[8];if(Ue>0)Oe=Math.sqrt(Ue+1),Le[3]=.5*Oe,Le[0]=(Re[5]-Re[7])*(Oe=.5/Oe),Le[1]=(Re[6]-Re[2])*Oe,Le[2]=(Re[1]-Re[3])*Oe;else{var qe=0;Re[4]>Re[0]&&(qe=1),Re[8]>Re[3*qe+qe]&&(qe=2);var Ct=(qe+1)%3,Ot=(qe+2)%3;Oe=Math.sqrt(Re[3*qe+qe]-Re[3*Ct+Ct]-Re[3*Ot+Ot]+1),Le[qe]=.5*Oe,Le[3]=(Re[3*Ct+Ot]-Re[3*Ot+Ct])*(Oe=.5/Oe),Le[Ct]=(Re[3*Ct+qe]+Re[3*qe+Ct])*Oe,Le[Ot]=(Re[3*Ot+qe]+Re[3*qe+Ot])*Oe}return Le}Ln.clone=Ue.clone,Ln.fromValues=Ue.fromValues,Ln.copy=Ue.copy,Ln.set=Ue.set,Ln.add=Ue.add,Ln.mul=c;var qe=Ue.scale;Ln.scale=qe;var Ct=Ue.dot;Ln.dot=Ct,Ln.lerp=Ue.lerp;var Ot=Ue.length;Ln.length=Ot,Ln.len=Ot;var Jt=Ue.squaredLength;Ln.squaredLength=Jt,Ln.sqrLen=Jt;var _i=Ue.normalize;Ln.normalize=_i,Ln.exactEquals=Ue.exactEquals,Ln.equals=Ue.equals;var xi,vi,bi,Pi=(xi=Oe.create(),vi=Oe.fromValues(1,0,0),bi=Oe.fromValues(0,1,0),function(Le,Re,Ue){var qe=Oe.dot(Re,Ue);return qe<-.999999?(Oe.cross(xi,vi,Re),Oe.len(xi)<1e-6&&Oe.cross(xi,bi,Re),Oe.normalize(xi,xi),u(Le,xi,Math.PI),Le):qe>.999999?(Le[0]=0,Le[1]=0,Le[2]=0,Le[3]=1,Le):(Oe.cross(xi,Re,Ue),Le[0]=xi[0],Le[1]=xi[1],Le[2]=xi[2],Le[3]=1+qe,_i(Le,Le))});Ln.rotationTo=Pi;var Hr,Jr,Nn=(Hr=l(),Jr=l(),function(Le,Re,Oe,Ue,qe,Ct){return f(Hr,Re,qe,Ct),f(Jr,Oe,Ue,Ct),f(Le,Hr,Jr,2*Ct*(1-Ct)),Le});Ln.sqlerp=Nn;var Gn,Zn=(Gn=Re.create(),function(Le,Re,Oe,Ue){return Gn[0]=Oe[0],Gn[3]=Oe[1],Gn[6]=Oe[2],Gn[1]=Ue[0],Gn[4]=Ue[1],Gn[7]=Ue[2],Gn[2]=-Re[0],Gn[5]=-Re[1],Gn[8]=-Re[2],_i(Le,m(Le,Gn))});return Ln.setAxes=Zn,Ln}var $n,Xn={};function k(){if($n)return Xn;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}$n=1,Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.create=function(){var Re=new Le.ARRAY_TYPE(8);return Le.ARRAY_TYPE!=Float32Array&&(Re[0]=0,Re[1]=0,Re[2]=0,Re[4]=0,Re[5]=0,Re[6]=0,Re[7]=0),Re[3]=1,Re},Xn.clone=function(Re){var Oe=new Le.ARRAY_TYPE(8);return Oe[0]=Re[0],Oe[1]=Re[1],Oe[2]=Re[2],Oe[3]=Re[3],Oe[4]=Re[4],Oe[5]=Re[5],Oe[6]=Re[6],Oe[7]=Re[7],Oe},Xn.fromValues=function(Re,Oe,Ue,qe,Ct,Ot,Jt,_i){var xi=new Le.ARRAY_TYPE(8);return xi[0]=Re,xi[1]=Oe,xi[2]=Ue,xi[3]=qe,xi[4]=Ct,xi[5]=Ot,xi[6]=Jt,xi[7]=_i,xi},Xn.fromRotationTranslationValues=function(Re,Oe,Ue,qe,Ct,Ot,Jt){var _i=new Le.ARRAY_TYPE(8);_i[0]=Re,_i[1]=Oe,_i[2]=Ue,_i[3]=qe;var xi=.5*Ct,vi=.5*Ot,bi=.5*Jt;return _i[4]=xi*qe+vi*Ue-bi*Oe,_i[5]=vi*qe+bi*Re-xi*Ue,_i[6]=bi*qe+xi*Oe-vi*Re,_i[7]=-xi*Re-vi*Oe-bi*Ue,_i},Xn.fromRotationTranslation=o,Xn.fromTranslation=function(Le,Re){return Le[0]=0,Le[1]=0,Le[2]=0,Le[3]=1,Le[4]=.5*Re[0],Le[5]=.5*Re[1],Le[6]=.5*Re[2],Le[7]=0,Le},Xn.fromRotation=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le[4]=0,Le[5]=0,Le[6]=0,Le[7]=0,Le},Xn.fromMat4=function(Ue,qe){var Ct=Re.create();Oe.getRotation(Ct,qe);var Ot=new Le.ARRAY_TYPE(3);return Oe.getTranslation(Ot,qe),o(Ue,Ct,Ot),Ue},Xn.copy=l,Xn.identity=function(Le){return Le[0]=0,Le[1]=0,Le[2]=0,Le[3]=1,Le[4]=0,Le[5]=0,Le[6]=0,Le[7]=0,Le},Xn.set=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){return Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=qe,Le[4]=Ct,Le[5]=Ot,Le[6]=Jt,Le[7]=_i,Le},Xn.getDual=function(Le,Re){return Le[0]=Re[4],Le[1]=Re[5],Le[2]=Re[6],Le[3]=Re[7],Le},Xn.setDual=function(Le,Re){return Le[4]=Re[0],Le[5]=Re[1],Le[6]=Re[2],Le[7]=Re[3],Le},Xn.getTranslation=function(Le,Re){var Oe=Re[4],Ue=Re[5],qe=Re[6],Ct=Re[7],Ot=-Re[0],Jt=-Re[1],_i=-Re[2],xi=Re[3];return Le[0]=2*(Oe*xi+Ct*Ot+Ue*_i-qe*Jt),Le[1]=2*(Ue*xi+Ct*Jt+qe*Ot-Oe*_i),Le[2]=2*(qe*xi+Ct*_i+Oe*Jt-Ue*Ot),Le},Xn.translate=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=.5*Oe[0],_i=.5*Oe[1],xi=.5*Oe[2],vi=Re[4],bi=Re[5],Pi=Re[6],Hr=Re[7];return Le[0]=Ue,Le[1]=qe,Le[2]=Ct,Le[3]=Ot,Le[4]=Ot*Jt+qe*xi-Ct*_i+vi,Le[5]=Ot*_i+Ct*Jt-Ue*xi+bi,Le[6]=Ot*xi+Ue*_i-qe*Jt+Pi,Le[7]=-Ue*Jt-qe*_i-Ct*xi+Hr,
1Le},Xn.rotateX=function(Le,Oe,Ue){var qe=-Oe[0],Ct=-Oe[1],Ot=-Oe[2],Jt=Oe[3],_i=Oe[4],xi=Oe[5],vi=Oe[6],bi=Oe[7],Pi=_i*Jt+bi*qe+xi*Ot-vi*Ct,Hr=xi*Jt+bi*Ct+vi*qe-_i*Ot,Jr=vi*Jt+bi*Ot+_i*Ct-xi*qe,Ln=bi*Jt-_i*qe-xi*Ct-vi*Ot;return Re.rotateX(Le,Oe,Ue),Le[4]=Pi*(Jt=Le[3])+Ln*(qe=Le[0])+Hr*(Ot=Le[2])-Jr*(Ct=Le[1]),Le[5]=Hr*Jt+Ln*Ct+Jr*qe-Pi*Ot,Le[6]=Jr*Jt+Ln*Ot+Pi*Ct-Hr*qe,Le[7]=Ln*Jt-Pi*qe-Hr*Ct-Jr*Ot,Le},Xn.rotateY=function(Le,Oe,Ue){var qe=-Oe[0],Ct=-Oe[1],Ot=-Oe[2],Jt=Oe[3],_i=Oe[4],xi=Oe[5],vi=Oe[6],bi=Oe[7],Pi=_i*Jt+bi*qe+xi*Ot-vi*Ct,Hr=xi*Jt+bi*Ct+vi*qe-_i*Ot,Jr=vi*Jt+bi*Ot+_i*Ct-xi*qe,Ln=bi*Jt-_i*qe-xi*Ct-vi*Ot;return Re.rotateY(Le,Oe,Ue),Le[4]=Pi*(Jt=Le[3])+Ln*(qe=Le[0])+Hr*(Ot=Le[2])-Jr*(Ct=Le[1]),Le[5]=Hr*Jt+Ln*Ct+Jr*qe-Pi*Ot,Le[6]=Jr*Jt+Ln*Ot+Pi*Ct-Hr*qe,Le[7]=Ln*Jt-Pi*qe-Hr*Ct-Jr*Ot,Le},Xn.rotateZ=function(Le,Oe,Ue){var qe=-Oe[0],Ct=-Oe[1],Ot=-Oe[2],Jt=Oe[3],_i=Oe[4],xi=Oe[5],vi=Oe[6],bi=Oe[7],Pi=_i*Jt+bi*qe+xi*Ot-vi*Ct,Hr=xi*Jt+bi*Ct+vi*qe-_i*Ot,Jr=vi*Jt+bi*Ot+_i*Ct-xi*qe,Ln=bi*Jt-_i*qe-xi*Ct-vi*Ot;return Re.rotateZ(Le,Oe,Ue),Le[4]=Pi*(Jt=Le[3])+Ln*(qe=Le[0])+Hr*(Ot=Le[2])-Jr*(Ct=Le[1]),Le[5]=Hr*Jt+Ln*Ct+Jr*qe-Pi*Ot,Le[6]=Jr*Jt+Ln*Ot+Pi*Ct-Hr*qe,Le[7]=Ln*Jt-Pi*qe-Hr*Ct-Jr*Ot,Le},Xn.rotateByQuatAppend=function(Le,Re,Oe){var Ue=Oe[0],qe=Oe[1],Ct=Oe[2],Ot=Oe[3],Jt=Re[0],_i=Re[1],xi=Re[2],vi=Re[3];return Le[0]=Jt*Ot+vi*Ue+_i*Ct-xi*qe,Le[1]=_i*Ot+vi*qe+xi*Ue-Jt*Ct,Le[2]=xi*Ot+vi*Ct+Jt*qe-_i*Ue,Le[3]=vi*Ot-Jt*Ue-_i*qe-xi*Ct,Le[4]=(Jt=Re[4])*Ot+(vi=Re[7])*Ue+(_i=Re[5])*Ct-(xi=Re[6])*qe,Le[5]=_i*Ot+vi*qe+xi*Ue-Jt*Ct,Le[6]=xi*Ot+vi*Ct+Jt*qe-_i*Ue,Le[7]=vi*Ot-Jt*Ue-_i*qe-xi*Ct,Le},Xn.rotateByQuatPrepend=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Oe[0],_i=Oe[1],xi=Oe[2],vi=Oe[3];return Le[0]=Ue*vi+Ot*Jt+qe*xi-Ct*_i,Le[1]=qe*vi+Ot*_i+Ct*Jt-Ue*xi,Le[2]=Ct*vi+Ot*xi+Ue*_i-qe*Jt,Le[3]=Ot*vi-Ue*Jt-qe*_i-Ct*xi,Le[4]=Ue*(vi=Oe[7])+Ot*(Jt=Oe[4])+qe*(xi=Oe[6])-Ct*(_i=Oe[5]),Le[5]=qe*vi+Ot*_i+Ct*Jt-Ue*xi,Le[6]=Ct*vi+Ot*xi+Ue*_i-qe*Jt,Le[7]=Ot*vi-Ue*Jt-qe*_i-Ct*xi,Le},Xn.rotateAroundAxis=function(Re,Oe,Ue,qe){if(Math.abs(qe)<Le.EPSILON)return l(Re,Oe);var Ct=Math.hypot(Ue[0],Ue[1],Ue[2]);qe*=.5;var Ot=Math.sin(qe),Jt=Ot*Ue[0]/Ct,_i=Ot*Ue[1]/Ct,xi=Ot*Ue[2]/Ct,vi=Math.cos(qe),bi=Oe[0],Pi=Oe[1],Hr=Oe[2],Jr=Oe[3];Re[0]=bi*vi+Jr*Jt+Pi*xi-Hr*_i,Re[1]=Pi*vi+Jr*_i+Hr*Jt-bi*xi,Re[2]=Hr*vi+Jr*xi+bi*_i-Pi*Jt,Re[3]=Jr*vi-bi*Jt-Pi*_i-Hr*xi;var Ln=Oe[4],Nn=Oe[5],Gn=Oe[6],qn=Oe[7];return Re[4]=Ln*vi+qn*Jt+Nn*xi-Gn*_i,Re[5]=Nn*vi+qn*_i+Gn*Jt-Ln*xi,Re[6]=Gn*vi+qn*xi+Ln*_i-Nn*Jt,Re[7]=qn*vi-Ln*Jt-Nn*_i-Gn*xi,Re},Xn.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le[2]=Re[2]+Oe[2],Le[3]=Re[3]+Oe[3],Le[4]=Re[4]+Oe[4],Le[5]=Re[5]+Oe[5],Le[6]=Re[6]+Oe[6],Le[7]=Re[7]+Oe[7],Le},Xn.multiply=u,Xn.scale=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le[2]=Re[2]*Oe,Le[3]=Re[3]*Oe,Le[4]=Re[4]*Oe,Le[5]=Re[5]*Oe,Le[6]=Re[6]*Oe,Le[7]=Re[7]*Oe,Le},Xn.lerp=function(Le,Re,Oe,qe){var Ct=1-qe;return Ue(Re,Oe)<0&&(qe=-qe),Le[0]=Re[0]*Ct+Oe[0]*qe,Le[1]=Re[1]*Ct+Oe[1]*qe,Le[2]=Re[2]*Ct+Oe[2]*qe,Le[3]=Re[3]*Ct+Oe[3]*qe,Le[4]=Re[4]*Ct+Oe[4]*qe,Le[5]=Re[5]*Ct+Oe[5]*qe,Le[6]=Re[6]*Ct+Oe[6]*qe,Le[7]=Re[7]*Ct+Oe[7]*qe,Le},Xn.invert=function(Le,Re){var Oe=Ct(Re);return Le[0]=-Re[0]/Oe,Le[1]=-Re[1]/Oe,Le[2]=-Re[2]/Oe,Le[3]=Re[3]/Oe,Le[4]=-Re[4]/Oe,Le[5]=-Re[5]/Oe,Le[6]=-Re[6]/Oe,Le[7]=Re[7]/Oe,Le},Xn.conjugate=function(Le,Re){return Le[0]=-Re[0],Le[1]=-Re[1],Le[2]=-Re[2],Le[3]=Re[3],Le[4]=-Re[4],Le[5]=-Re[5],Le[6]=-Re[6],Le[7]=Re[7],Le},Xn.normalize=function(Le,Re){var Oe=Ct(Re);if(Oe>0){Oe=Math.sqrt(Oe);var Ue=Re[0]/Oe,qe=Re[1]/Oe,Ot=Re[2]/Oe,Jt=Re[3]/Oe,_i=Re[4],xi=Re[5],vi=Re[6],bi=Re[7],Pi=Ue*_i+qe*xi+Ot*vi+Jt*bi;Le[0]=Ue,Le[1]=qe,Le[2]=Ot,Le[3]=Jt,Le[4]=(_i-Ue*Pi)/Oe,Le[5]=(xi-qe*Pi)/Oe,Le[6]=(vi-Ot*Pi)/Oe,Le[7]=(bi-Jt*Pi)/Oe}return Le},Xn.str=function(Le){return"quat2("+Le[0]+", "+Le[1]+", "+Le[2]+", "+Le[3]+", "+Le[4]+", "+Le[5]+", "+Le[6]+", "+Le[7]+")"},Xn.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]&&Le[2]===Re[2]&&Le[3]===Re[3]&&Le[4]===Re[4]&&Le[5]===Re[5]&&Le[6]===Re[6]&&Le[7]===Re[7]},Xn.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Re[4],_i=Re[5],xi=Re[6],vi=Re[7],bi=Oe[0],Pi=Oe[1],Hr=Oe[2],Jr=Oe[3],Ln=Oe[4],Nn=Oe[5],Gn=Oe[6],qn=Oe[7];return Math.abs(Ue-bi)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(bi))&&Math.abs(qe-Pi)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(Pi))&&Math.abs(Ct-Hr)<=Le.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(Hr))&&Math.abs(Ot-Jr)<=Le.EPSILON*Math.max(1,Math.abs(Ot),Math.abs(Jr))&&Math.abs(Jt-Ln)<=Le.EPSILON*Math.max(1,Math.abs(Jt),Math.abs(Ln))&&Math.abs(_i-Nn)<=Le.EPSILON*Math.max(1,Math.abs(_i),Math.abs(Nn))&&Math.abs(xi-Gn)<=Le.EPSILON*Math.max(1,Math.abs(xi),Math.abs(Gn))&&Math.abs(vi-qn)<=Le.EPSILON*Math.max(1,Math.abs(vi),Math.abs(qn))},Xn.sqrLen=Xn.squaredLength=Xn.len=Xn.length=Xn.dot=Xn.mul=Xn.setReal=Xn.getReal=void 0;var Le=a(s()),Re=a(I()),Oe=a(g());function i(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(i=function(Le){return Le?Oe:Re})(Le)}function a(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=i(Re);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}
vendor: 4,895 bytes, line 1
1return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}function o(Le,Re,Oe){var Ue=.5*Oe[0],qe=.5*Oe[1],Ct=.5*Oe[2],Ot=Re[0],Jt=Re[1],_i=Re[2],xi=Re[3];return Le[0]=Ot,Le[1]=Jt,Le[2]=_i,Le[3]=xi,Le[4]=Ue*xi+qe*_i-Ct*Jt,Le[5]=qe*xi+Ct*Ot-Ue*_i,Le[6]=Ct*xi+Ue*Jt-qe*Ot,Le[7]=-Ue*Ot-qe*Jt-Ct*_i,Le}function l(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le[2]=Re[2],Le[3]=Re[3],Le[4]=Re[4],Le[5]=Re[5],Le[6]=Re[6],Le[7]=Re[7],Le}function u(Le,Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Re[2],Ot=Re[3],Jt=Oe[4],_i=Oe[5],xi=Oe[6],vi=Oe[7],bi=Re[4],Pi=Re[5],Hr=Re[6],Jr=Re[7],Ln=Oe[0],Nn=Oe[1],Gn=Oe[2],qn=Oe[3];return Le[0]=Ue*qn+Ot*Ln+qe*Gn-Ct*Nn,Le[1]=qe*qn+Ot*Nn+Ct*Ln-Ue*Gn,Le[2]=Ct*qn+Ot*Gn+Ue*Nn-qe*Ln,Le[3]=Ot*qn-Ue*Ln-qe*Nn-Ct*Gn,Le[4]=Ue*vi+Ot*Jt+qe*xi-Ct*_i+bi*qn+Jr*Ln+Pi*Gn-Hr*Nn,Le[5]=qe*vi+Ot*_i+Ct*Jt-Ue*xi+Pi*qn+Jr*Nn+Hr*Ln-bi*Gn,Le[6]=Ct*vi+Ot*xi+Ue*_i-qe*Jt+Hr*qn+Jr*Gn+bi*Nn-Pi*Ln,Le[7]=Ot*vi-Ue*Jt-qe*_i-Ct*xi+Jr*qn-bi*Ln-Pi*Nn-Hr*Gn,Le}Xn.getReal=Re.copy,Xn.setReal=Re.copy,Xn.mul=u;var Ue=Re.dot;Xn.dot=Ue;var qe=Re.length;Xn.length=qe,Xn.len=qe;var Ct=Re.squaredLength;return Xn.squaredLength=Ct,Xn.sqrLen=Ct,Xn}var Yn,lo,uo={};function V(){if(Yn)return uo;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}Yn=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.create=n,uo.clone=function(Re){var Oe=new Le.ARRAY_TYPE(2);return Oe[0]=Re[0],Oe[1]=Re[1],Oe},uo.fromValues=function(Re,Oe){var Ue=new Le.ARRAY_TYPE(2);return Ue[0]=Re,Ue[1]=Oe,Ue},uo.copy=function(Le,Re){return Le[0]=Re[0],Le[1]=Re[1],Le},uo.set=function(Le,Re,Oe){return Le[0]=Re,Le[1]=Oe,Le},uo.add=function(Le,Re,Oe){return Le[0]=Re[0]+Oe[0],Le[1]=Re[1]+Oe[1],Le},uo.subtract=i,uo.multiply=a,uo.divide=o,uo.ceil=function(Le,Re){return Le[0]=Math.ceil(Re[0]),Le[1]=Math.ceil(Re[1]),Le},uo.floor=function(Le,Re){return Le[0]=Math.floor(Re[0]),Le[1]=Math.floor(Re[1]),Le},uo.min=function(Le,Re,Oe){return Le[0]=Math.min(Re[0],Oe[0]),Le[1]=Math.min(Re[1],Oe[1]),Le},uo.max=function(Le,Re,Oe){return Le[0]=Math.max(Re[0],Oe[0]),Le[1]=Math.max(Re[1],Oe[1]),Le},uo.round=function(Le,Re){return Le[0]=Math.round(Re[0]),Le[1]=Math.round(Re[1]),Le},uo.scale=function(Le,Re,Oe){return Le[0]=Re[0]*Oe,Le[1]=Re[1]*Oe,Le},uo.scaleAndAdd=function(Le,Re,Oe,Ue){return Le[0]=Re[0]+Oe[0]*Ue,Le[1]=Re[1]+Oe[1]*Ue,Le},uo.distance=l,uo.squaredDistance=u,uo.length=c,uo.squaredLength=h,uo.negate=function(Le,Re){return Le[0]=-Re[0],Le[1]=-Re[1],Le},uo.inverse=function(Le,Re){return Le[0]=1/Re[0],Le[1]=1/Re[1],Le},uo.normalize=function(Le,Re){var Oe=Re[0],Ue=Re[1],qe=Oe*Oe+Ue*Ue;return qe>0&&(qe=1/Math.sqrt(qe)),Le[0]=Re[0]*qe,Le[1]=Re[1]*qe,Le},uo.dot=function(Le,Re){return Le[0]*Re[0]+Le[1]*Re[1]},uo.cross=function(Le,Re,Oe){var Ue=Re[0]*Oe[1]-Re[1]*Oe[0];return Le[0]=Le[1]=0,Le[2]=Ue,Le},uo.lerp=function(Le,Re,Oe,Ue){var qe=Re[0],Ct=Re[1];return Le[0]=qe+Ue*(Oe[0]-qe),Le[1]=Ct+Ue*(Oe[1]-Ct),Le},uo.random=function(Re,Oe){Oe=Oe||1;var Ue=2*Le.RANDOM()*Math.PI;return Re[0]=Math.cos(Ue)*Oe,Re[1]=Math.sin(Ue)*Oe,Re},uo.transformMat2=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1];return Le[0]=Oe[0]*Ue+Oe[2]*qe,Le[1]=Oe[1]*Ue+Oe[3]*qe,Le},uo.transformMat2d=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1];return Le[0]=Oe[0]*Ue+Oe[2]*qe+Oe[4],Le[1]=Oe[1]*Ue+Oe[3]*qe+Oe[5],Le},uo.transformMat3=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1];return Le[0]=Oe[0]*Ue+Oe[3]*qe+Oe[6],Le[1]=Oe[1]*Ue+Oe[4]*qe+Oe[7],Le},uo.transformMat4=function(Le,Re,Oe){var Ue=Re[0],qe=Re[1];return Le[0]=Oe[0]*Ue+Oe[4]*qe+Oe[12],Le[1]=Oe[1]*Ue+Oe[5]*qe+Oe[13],Le},uo.rotate=function(Le,Re,Oe,Ue){var qe=Re[0]-Oe[0],Ct=Re[1]-Oe[1],Ot=Math.sin(Ue),Jt=Math.cos(Ue);return Le[0]=qe*Jt-Ct*Ot+Oe[0],Le[1]=qe*Ot+Ct*Jt+Oe[1],Le},uo.angle=function(Le,Re){var Oe=Le[0],Ue=Le[1],qe=Re[0],Ct=Re[1],Ot=Math.sqrt(Oe*Oe+Ue*Ue)*Math.sqrt(qe*qe+Ct*Ct);return Math.acos(Math.min(Math.max(Ot&&(Oe*qe+Ue*Ct)/Ot,-1),1))},uo.zero=function(Le){return Le[0]=0,Le[1]=0,Le},uo.str=function(Le){return"vec2("+Le[0]+", "+Le[1]+")"},uo.exactEquals=function(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]},uo.equals=function(Re,Oe){var Ue=Re[0],qe=Re[1],Ct=Oe[0],Ot=Oe[1];return Math.abs(Ue-Ct)<=Le.EPSILON*Math.max(1,Math.abs(Ue),Math.abs(Ct))&&Math.abs(qe-Ot)<=Le.EPSILON*Math.max(1,Math.abs(qe),Math.abs(Ot))},uo.forEach=uo.sqrLen=uo.sqrDist=uo.dist=uo.div=uo.mul=uo.sub=uo.len=void 0;var Le=function(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=r(void 0);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}
1return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}(s());function r(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(r=function(Le){return Le?Oe:Re})(Le)}function n(){var Re=new Le.ARRAY_TYPE(2);return Le.ARRAY_TYPE!=Float32Array&&(Re[0]=0,Re[1]=0),Re}function i(Le,Re,Oe){return Le[0]=Re[0]-Oe[0],Le[1]=Re[1]-Oe[1],Le}function a(Le,Re,Oe){return Le[0]=Re[0]*Oe[0],Le[1]=Re[1]*Oe[1],Le}function o(Le,Re,Oe){return Le[0]=Re[0]/Oe[0],Le[1]=Re[1]/Oe[1],Le}function l(Le,Re){return Math.hypot(Re[0]-Le[0],Re[1]-Le[1])}function u(Le,Re){var Oe=Re[0]-Le[0],Ue=Re[1]-Le[1];return Oe*Oe+Ue*Ue}function c(Le){return Math.hypot(Le[0],Le[1])}function h(Le){var Re=Le[0],Oe=Le[1];return Re*Re+Oe*Oe}uo.len=c,uo.sub=i,uo.mul=a,uo.div=o,uo.dist=l,uo.sqrDist=u,uo.sqrLen=h;var Re,Oe=(Re=n(),function(Le,Oe,Ue,qe,Ct,Ot){var Jt,_i;for(Oe||(Oe=2),Ue||(Ue=0),_i=qe?Math.min(qe*Oe+Ue,Le.length):Le.length,Jt=Ue;Jt<_i;Jt+=Oe)Re[0]=Le[Jt],Re[1]=Le[Jt+1],Ct(Re,Re,Ot),Le[Jt]=Re[0],Le[Jt+1]=Re[1];return Le});return uo.forEach=Oe,uo}function C(){if(lo)return qe;function t(Le){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(Le){return typeof Le}:function(Le){return Le&&"function"==typeof Symbol&&Le.constructor===Symbol&&Le!==Symbol.prototype?"symbol":typeof Le},t(Le)}lo=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.vec4=qe.vec3=qe.vec2=qe.quat2=qe.quat=qe.mat4=qe.mat3=qe.mat2d=qe.mat2=qe.glMatrix=void 0;var Le=x(s());qe.glMatrix=Le;var Re=x(l());qe.mat2=Re;var Oe=x(h());qe.mat2d=Oe;var Ue=x(d());qe.mat3=Ue;var Ct=x(g());qe.mat4=Ct;var Ot=x(I());qe.quat=Ot;var Jt=x(k());qe.quat2=Jt;var _i=x(V());qe.vec2=_i;var xi=x(w());qe.vec3=xi;var vi=x(S());function y(Le){if("function"!=typeof WeakMap)return null;var Re=new WeakMap,Oe=new WeakMap;return(y=function(Le){return Le?Oe:Re})(Le)}function x(Le,Re){if(Le&&Le.__esModule)return Le;if(null===Le||"object"!==t(Le)&&"function"!=typeof Le)return{default:Le};var Oe=y(Re);if(Oe&&Oe.has(Le))return Oe.get(Le);var Ue={},qe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ct in Le)if("default"!==Ct&&Object.prototype.hasOwnProperty.call(Le,Ct)){var Ot=qe?Object.getOwnPropertyDescriptor(Le,Ct):null;Ot&&(Ot.get||Ot.set)?Object.defineProperty(Ue,Ct,Ot):Ue[Ct]=Le[Ct]}return Ue.default=Le,Oe&&Oe.set(Le,Ue),Ue}return qe.vec4=vi,qe}var po,fo,Io,is,as=C(),Is=function(){if(fo)return po;function t(Le,Oe,Ue,qe){(this||Re).cx=3*Le,(this||Re).bx=3*(Ue-Le)-(this||Re).cx,(this||Re).ax=1-(this||Re).cx-(this||Re).bx,(this||Re).cy=3*Oe,(this||Re).by=3*(qe-Oe)-(this||Re).cy,(this||Re).ay=1-(this||Re).cy-(this||Re).by,(this||Re).p1x=Le,(this||Re).p1y=Oe,(this||Re).p2x=Ue,(this||Re).p2y=qe}return fo=1,po=t,t.prototype={sampleCurveX:function(Le){return(((this||Re).ax*Le+(this||Re).bx)*Le+(this||Re).cx)*Le},sampleCurveY:function(Le){return(((this||Re).ay*Le+(this||Re).by)*Le+(this||Re).cy)*Le},sampleCurveDerivativeX:function(Le){return(3*(this||Re).ax*Le+2*(this||Re).bx)*Le+(this||Re).cx},solveCurveX:function(Le,Re){if(void 0===Re&&(Re=1e-6),Le<0)return 0;if(Le>1)return 1;for(var Oe=Le,Ue=0;Ue<8;Ue++){var qe=this.sampleCurveX(Oe)-Le;if(Math.abs(qe)<Re)return Oe;var Ct=this.sampleCurveDerivativeX(Oe);if(Math.abs(Ct)<1e-6)break;Oe-=qe/Ct}var Ot=0,Jt=1;for(Oe=Le,Ue=0;Ue<20&&(qe=this.sampleCurveX(Oe),!(Math.abs(qe-Le)<Re));Ue++)Le>qe?Ot=Oe:Jt=Oe,Oe=.5*(Jt-Ot)+Ot;return Oe},solve:function(Le,Re){return this.sampleCurveY(this.solveCurveX(Le,Re))}},po}(),Xs=e(Is);function N(){if(is)return Io;function t(Le,Oe){(this||Re).x=Le,(this||Re).y=Oe}return is=1,Io=t,t.prototype={clone:function(){return new t((this||Re).x,(this||Re).y)},add:function(Le){return this.clone()._add(Le)},sub:function(Le){return this.clone()._sub(Le)},multByPoint:function(Le){return this.clone()._multByPoint(Le)},divByPoint:function(Le){return this.clone()._divByPoint(Le)},mult:function(Le){return this.clone()._mult(Le)},div:function(Le){return this.clone()._div(Le)},rotate:function(Le){return this.clone()._rotate(Le)},rotateAround:function(Le,Re){return this.clone()._rotateAround(Le,Re)},matMult:function(Le){return this.clone()._matMult(Le)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt((this||Re).x*(this||Re).x+(this||Re).y*(this||Re).y)},equals:function(Le){return(this||Re).x===Le.x&&(this||Re).y===Le.y},dist:function(Le){return Math.sqrt(this.distSqr(Le))},distSqr:function(Le){var Oe=Le.x-(this||Re).x,Ue=Le.y-(this||Re).y;return Oe*Oe+Ue*Ue},angle:function(){return Math.atan2((this||Re).y,(this||Re).x)}
1,angleTo:function(Le){return Math.atan2((this||Re).y-Le.y,(this||Re).x-Le.x)},angleWith:function(Le){return this.angleWithSep(Le.x,Le.y)},angleWithSep:function(Le,Oe){return Math.atan2((this||Re).x*Oe-(this||Re).y*Le,(this||Re).x*Le+(this||Re).y*Oe)},_matMult:function(Le){var Oe=Le[2]*(this||Re).x+Le[3]*(this||Re).y;return(this||Re).x=Le[0]*(this||Re).x+Le[1]*(this||Re).y,(this||Re).y=Oe,this||Re},_add:function(Le){return(this||Re).x+=Le.x,(this||Re).y+=Le.y,this||Re},_sub:function(Le){return(this||Re).x-=Le.x,(this||Re).y-=Le.y,this||Re},_mult:function(Le){return(this||Re).x*=Le,(this||Re).y*=Le,this||Re},_div:function(Le){return(this||Re).x/=Le,(this||Re).y/=Le,this||Re},_multByPoint:function(Le){return(this||Re).x*=Le.x,(this||Re).y*=Le.y,this||Re},_divByPoint:function(Le){return(this||Re).x/=Le.x,(this||Re).y/=Le.y,this||Re},_unit:function(){return this._div(this.mag()),this||Re},_perp:function(){var Le=(this||Re).y;return(this||Re).y=(this||Re).x,(this||Re).x=-Le,this||Re},_rotate:function(Le){var Oe=Math.cos(Le),Ue=Math.sin(Le),qe=Ue*(this||Re).x+Oe*(this||Re).y;return(this||Re).x=Oe*(this||Re).x-Ue*(this||Re).y,(this||Re).y=qe,this||Re},_rotateAround:function(Le,Oe){var Ue=Math.cos(Le),qe=Math.sin(Le),Ct=Oe.y+qe*((this||Re).x-Oe.x)+Ue*((this||Re).y-Oe.y);return(this||Re).x=Oe.x+Ue*((this||Re).x-Oe.x)-qe*((this||Re).y-Oe.y),(this||Re).y=Ct,this||Re},_round:function(){return(this||Re).x=Math.round((this||Re).x),(this||Re).y=Math.round((this||Re).y),this||Re}},t.convert=function(Le){return Le instanceof t?Le:Array.isArray(Le)?new t(Le[0],Le[1]):Le},Io}var ta=e(N());function $(Le,Re){if(Array.isArray(Le)){if(!Array.isArray(Re)||Le.length!==Re.length)return!1;for(let Oe=0;Oe<Le.length;Oe++)if(!$(Le[Oe],Re[Oe]))return!1;return!0}if("object"==typeof Le&&null!==Le&&null!==Re){if("object"!=typeof Re)return!1;if(Object.keys(Le).length!==Object.keys(Re).length)return!1;for(const Oe in Le)if(!$(Le[Oe],Re[Oe]))return!1;return!0}return Le===Re}const ha=Math.PI/180,el=180/Math.PI;function Y(Le){return Le*ha}function Z(Le){return Le*el}const tl=[[0,0],[1,0],[1,1],[0,1]];function H(Le){if(Le<=0)return 0;if(Le>=1)return 1;const Re=Le*Le,Oe=Re*Le;return 4*(Le<.5?Oe:3*(Le-Re)+Oe-.75)}function K(Le,Re,Oe,Ue){const qe=new Xs(Le,Re,Oe,Ue);return function(Le){return qe.solve(Le)}}const il=K(.25,.1,.25,1);function Q(Le,Re,Oe){return Math.min(Oe,Math.max(Re,Le))}function tt(Le,Re,Oe){return(Oe=Q((Oe-Le)/(Re-Le),0,1))*Oe*(3-2*Oe)}function et(Le,Re,Oe){const Ue=Oe-Re,qe=((Le-Re)%Ue+Ue)%Ue+Re;return qe===Re?Oe:qe}function rt(Le,Re,Oe){if(!Le.length)return Oe(null,[]);let Ue=Le.length;const qe=new Array(Le.length);let Ct=null;Le.forEach(((Le,Ot)=>{Re(Le,((Le,Re)=>{Le&&(Ct=Le),qe[Ot]=Re,0==--Ue&&Oe(Ct,qe)}))}))}function nt(Le,...Re){for(const Oe of Re)for(const Re in Oe)Le[Re]=Oe[Re];return Le}let sl=1;function st(){return sl++}function at(Le){return Le<=1?1:Math.pow(2,Math.ceil(Math.log(Le)/Math.LN2))}function ot(Le,Re){Le.forEach((Le=>{Re[Le]&&(Re[Le]=Re[Le].bind(Re))}))}function lt(Le,Re){return-1!==Le.indexOf(Re,Le.length-Re.length)}function ut(Le,Oe,Ue){const qe={};for(const Ue in Le)qe[Ue]=Oe.call(this||Re,Le[Ue],Ue,Le);return qe}function ct(Le,Oe,Ue){const qe={};for(const Ue in Le)Oe.call(this||Re,Le[Ue],Ue,Le)&&(qe[Ue]=Le[Ue]);return qe}function ht(Le){return Array.isArray(Le)?Le.map(ht):"object"==typeof Le&&Le?ut(Le,ht):Le}const fl={};function ft(Le){fl[Le]||("undefined"!=typeof console&&console.warn(Le),fl[Le]=!0)}function dt(Le,Re,Oe){return(Oe.y-Le.y)*(Re.x-Le.x)>(Re.y-Le.y)*(Oe.x-Le.x)}function mt(Le){let Re=0;for(let Oe,Ue,qe=0,Ct=Le.length,Ot=Ct-1;qe<Ct;Ot=qe++)Oe=Le[qe],Ue=Le[Ot],Re+=(Ue.x-Oe.x)*(Oe.y+Ue.y);return Re}function yt([Le,Re,Oe]){const Ue=Y(Re+90),qe=Y(Oe);return{x:Le*Math.cos(Ue)*Math.sin(qe),y:Le*Math.sin(Ue)*Math.sin(qe),z:Le*Math.cos(qe),azimuthal:Re,polar:Oe}}function gt(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function xt(Le){const Re={};if(Le.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((Le,Oe,Ue,qe)=>{const Ct=Ue||qe;return Re[Oe]=!Ct||Ct.toLowerCase(),""})),Re["max-age"]){const Le=parseInt(Re["max-age"],10);isNaN(Le)?delete Re["max-age"]:Re["max-age"]=Le}return Re}let Ml,Al=null;function wt(Le,Re){return[Le[4*Re],Le[4*Re+1],Le[4*Re+2],Le[4*Re+3]]}function _t(Le,Re,Oe,Ue){for(;Re<Oe;){const qe=Re+Oe>>1;Le[qe]<Ue?Re=qe+1:Oe=qe}return Re}function Mt(Le,Re,Oe,Ue){for(;Re<Oe;){const qe=Re+Oe>>1;Le[qe]<=Ue?Re=qe+1:Oe=qe}return Re}function At(Le){return Le>0?1/(1.001-Le):1+Le}function St(Le){return Le>0?1-1/(1.001-Le):-Le}const Hl={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==Ml){const Le=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Ml=null!=Ue.env.API_URL_REGEX?new RegExp(Ue.env.API_URL_REGEX):Le}catch(Re){Ml=Le}}return Ml},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Hl.API_URL)return null;try{const Le=new URL(Hl.API_URL);return"api.mapbox.cn"===Le.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===Le.hostname?"https://events.mapbox.com/events/v2":null}catch(Le){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
1HOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Pt(Le){return Hl.API_URL_REGEX.test(Le)}function zt(Le){return Hl.API_SPRITE_REGEX.test(Le)}let Wl,Jl,Kl,Ql,oc,lc;function Rt(){return null==Wl&&(Wl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),Wl}const Oc={now:()=>void 0!==Ql?Ql:performance.now(),setNow(Le){Ql=Le},restoreNow(){Ql=void 0},frame(Le){const Re=requestAnimationFrame(Le);return{cancel:()=>cancelAnimationFrame(Re)}},getImageData(Le,Re=0){const{width:Oe,height:Ue}=Le;oc||(oc=document.createElement("canvas"));const qe=oc.getContext("2d",{willReadFrequently:!0});if(!qe)throw new Error("failed to create canvas 2d context");return(Oe>oc.width||Ue>oc.height)&&(oc.width=Oe,oc.height=Ue),qe.clearRect(-Re,-Re,Oe+2*Re,Ue+2*Re),qe.drawImage(Le,0,0,Oe,Ue),qe.getImageData(-Re,-Re,Oe+2*Re,Ue+2*Re)},resolveURL:Le=>(Jl||(Jl=document.createElement("a")),Jl.href=Le,Jl.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==Kl&&(Kl=window.matchMedia("(prefers-reduced-motion: reduce)")),Kl.matches)},hasCanvasFingerprintNoise(){if(void 0!==lc)return lc;if(!Rt())return lc=!1,!1;const Le=new OffscreenCanvas(85,1),Re=Le.getContext("2d",{willReadFrequently:!0});let Oe=0;for(let Ue=0;Ue<Le.width;++Ue)Re.fillStyle=`rgba(${Oe++},${Oe++},${Oe++}, 255)`,Re.fillRect(Ue,0,1,1);const Ue=Re.getImageData(0,0,Le.width,Le.height);Oe=0;for(let Le=0;Le<Ue.data.length;++Le)if(Le%4!=3&&Oe++!==Ue.data[Le])return lc=!0,!0;return lc=!1,!1}};function Lt(Le,Re){const Oe=Le.indexOf("?");if(Oe<0)return`${Le}?${new URLSearchParams(Re).toString()}`;const Ue=new URLSearchParams(Le.slice(Oe));for(const Le in Re)Ue.set(Le,Re[Le]);return`${Le.slice(0,Oe)}?${Ue.toString()}`}
1function Ft(Le,Re={persistentParams:[]}){const Oe=Le.indexOf("?");if(Oe<0)return Le;const Ue=new URLSearchParams,qe=new URLSearchParams(Le.slice(Oe));for(const Le of Re.persistentParams){const Re=qe.get(Le);Re&&Ue.set(Le,Re)}const Ct=Ue.toString();return`${Le.slice(0,Oe)}${Ct.length>0?`?${Ct}`:""}`}const Nc="mapbox-tiles";let Uc=500,jc=50;const Zc=["language","worldview","jobid"];let Hc,Wc;function Gt(){try{return caches}catch(Le){}}function Xt(){const Le=Gt();Le&&null==Hc&&(Hc=Le.open(Nc))}let Xc=1/0;const Yc={supported:!1,testSupport:function(Le){!Qc&&Kc&&(eh?te(Le):Jc=Le)}};let Jc,Kc,Qc=!1,eh=!1;const th="undefined"!=typeof self?self:{};function te(Le){const Re=Le.createTexture();Le.bindTexture(Le.TEXTURE_2D,Re);try{if(Le.texImage2D(Le.TEXTURE_2D,0,Le.RGBA,Le.RGBA,Le.UNSIGNED_BYTE,Kc),Le.isContextLost())return;Yc.supported=!0}catch(Le){}Le.deleteTexture(Re),Qc=!0}th.document&&(Kc=th.document.createElement("img"),Kc.onload=function(){Jc&&te(Jc),Jc=null,eh=!0},Kc.onerror=function(){Qc=!0,Jc=null},Kc.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ih={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(ih);class re extends Error{constructor(Le,Re,Oe){401===Re&&Pt(Oe)&&(Le+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(Le),this.status=Re,this.url=Oe}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const rh=gt()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href;const ie=function(Le,Re){if(!(/^file:/.test(Oe=Le.url)||/^file:/.test(rh())&&!/^\w+:/.test(Oe))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(Le,Re){const Oe=new AbortController,Ue=new Request(Le.url,{method:Le.method||"GET",body:Le.body,credentials:Le.credentials,headers:Le.headers,referrer:rh(),referrerPolicy:Le.referrerPolicy,signal:Oe.signal});let qe=!1,Ct=!1;const Ot=(Jt=Ue.url).indexOf("sku=")>0&&Pt(Jt);var Jt;"json"===Le.type&&Ue.headers.set("Accept","application/json");const l=(Oe,qe,Jt)=>{if(Ct)return;if(Oe&&"SecurityError"!==Oe.message&&ft(Oe.toString()),qe&&Jt)return u(qe);const _i=Date.now();fetch(Ue).then((Oe=>{if(Oe.ok){const Le=Ot?Oe.clone():null;return u(Oe,Le,_i)}return Re(new re(Oe.statusText,Oe.status,Le.url))})).catch((Oe=>{"AbortError"!==Oe.name&&Re(new Error(`${Oe.message} ${Le.url}`))}))},u=(Oe,Ot,Jt)=>{("arrayBuffer"===Le.type?Oe.arrayBuffer():"json"===Le.type?Oe.json():Oe.text()).then((Le=>{Ct||(Ot&&Jt&&function(Le,Re,Oe){if(Xt(),null==Hc)return;const Ue=xt(Re.headers.get("Cache-Control")||"");if(Ue["no-store"])return;const qe={status:Re.status,statusText:Re.statusText,headers:new Headers};Re.headers.forEach(((Le,Re)=>qe.headers.set(Re,Le))),Ue["max-age"]&&qe.headers.set("Expires",new Date(Oe+1e3*Ue["max-age"]).toUTCString());const Ct=qe.headers.get("Expires");if(!Ct)return;if(new Date(Ct).getTime()-Oe<42e4)return;
1let Ot=Ft(Le.url,{persistentParams:Zc});if(206===Re.status){const Re=Le.headers.get("Range");if(!Re)return;qe.status=200,Ot=Lt(Ot,{range:Re})}!function(Le,Re){if(void 0===Wc)try{new Response(new ReadableStream),Wc=!0}catch(Le){Wc=!1}Wc?Re(Le.body):Le.blob().then(Re)}(Re,(Le=>{const Oe=new Response(200!==(Ue=Re.status)&&404!==Ue&&[101,103,204,205,304].includes(Ue)?null:Le,qe);var Ue;Xt(),null!=Hc&&Hc.then((Le=>Le.put(Ot,Oe))).catch((Le=>ft(Le.message)))}))}(Ue,Ot,Jt),qe=!0,Re(null,Le,Oe.headers.get("Cache-Control"),Oe.headers.get("Expires")))})).catch((Le=>{Ct||Re(new Error(Le.message))}))};return Ot?function(Le,Re){if(Xt(),null==Hc)return Re(null);Hc.then((Oe=>{let Ue=Ft(Le.url,{persistentParams:Zc});const qe=Le.headers.get("Range");qe&&(Ue=Lt(Ue,{range:qe})),Oe.match(Ue).then((Le=>{const qe=function(Le){if(!Le)return!1;const Re=new Date(Le.headers.get("Expires")||0),Oe=xt(Le.headers.get("Cache-Control")||"");return Re>Date.now()&&!Oe["no-cache"]}(Le);Oe.delete(Ue),qe&&Oe.put(Ue,Le.clone()),Re(null,Le,qe)})).catch(Re)})).catch(Re)}(Ue,l):l(null,null),{cancel:()=>{Ct=!0,qe||Oe.abort()}}}(Le,Re);if(gt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",Le,Re,void 0,!0)}var Oe;return function(Le,Re){const Oe=new XMLHttpRequest;Oe.open(Le.method||"GET",Le.url,!0),"arrayBuffer"===Le.type&&(Oe.responseType="arraybuffer");for(const Re in Le.headers)Oe.setRequestHeader(Re,Le.headers[Re]);return"json"===Le.type&&(Oe.responseType="text",Oe.setRequestHeader("Accept","application/json")),Oe.withCredentials="include"===Le.credentials,Oe.onerror=()=>{Re(new Error(Oe.statusText))},Oe.onload=()=>{if((Oe.status>=200&&Oe.status<300||0===Oe.status)&&null!==Oe.response){let Ue=Oe.response;if("json"===Le.type)try{Ue=JSON.parse(Oe.response)}catch(Le){return Re(Le)}Re(null,Ue,Oe.getResponseHeader("Cache-Control"),Oe.getResponseHeader("Expires"))}else Re(new re(Oe.statusText,Oe.status,Le.url))},Oe.send(Le.body),{cancel:()=>Oe.abort()}}(Le,Re)},se=function(Le,Re){return ie(nt(Le,{type:"arrayBuffer"}),Re)};function ae(Le){const Re=document.createElement("a");return Re.href=Le,Re.protocol===location.protocol&&Re.host===location.host}const nh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let sh,ah;sh=[],ah=0;const ce=function(Le,Oe){if(Yc.supported&&(Le.headers||(Le.headers={}),Le.headers.accept="image/webp,*/*"),ah>=Hl.MAX_PARALLEL_IMAGE_REQUESTS){const Ue={requestParameters:Le,callback:Oe,cancelled:!1,cancel(){(this||Re).cancelled=!0}};return sh.push(Ue),Ue}ah++;let Ue=!1;const n=()=>
vendor: 10,089 bytes, line 1
1{if(!Ue)for(Ue=!0,ah--;sh.length&&ah<Hl.MAX_PARALLEL_IMAGE_REQUESTS;){const Le=sh.shift(),{requestParameters:Re,callback:Oe,cancelled:Ue}=Le;Ue||(Le.cancel=ce(Re,Oe).cancel)}},qe=se(Le,((Le,Re,Ue,qe)=>{n(),Le?Oe(Le):Re&&(self.createImageBitmap?function(Le,Re){const Oe=new Blob([new Uint8Array(Le)],{type:"image/png"});createImageBitmap(Oe).then((Le=>{Re(null,Le)})).catch((Le=>{Re(new Error(`Could not load image because of ${Le.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(Re,((Le,Re)=>Oe(Le,Re,Ue,qe))):function(Le,Re){const Oe=new Image;Oe.onload=()=>{Re(null,Oe),URL.revokeObjectURL(Oe.src),Oe.onload=null,requestAnimationFrame((()=>{Oe.src=nh}))},Oe.onerror=()=>Re(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const Ue=new Blob([new Uint8Array(Le)],{type:"image/png"});Oe.src=Le.byteLength?URL.createObjectURL(Ue):nh}(Re,((Le,Re)=>Oe(Le,Re,Ue,qe))))}));return{cancel:()=>{qe.cancel(),n()}}};var ch,yh,Th,Eh={exports:{}},Ch={exports:{}},zh={exports:{}},Dh=function(){if(Th)return Eh.exports;Th=1;var Le=(ch||(ch=1,Ch.exports=function(Le,Re){var Oe,Ue,qe,Ct,Ot,Jt,_i,xi;for(Ue=Le.length-(Oe=3&Le.length),qe=Re,Ot=3432918353,Jt=461845907,xi=0;xi<Ue;)_i=255&Le.charCodeAt(xi)|(255&Le.charCodeAt(++xi))<<8|(255&Le.charCodeAt(++xi))<<16|(255&Le.charCodeAt(++xi))<<24,++xi,qe=27492+(65535&(Ct=5*(65535&(qe=(qe^=_i=(65535&(_i=(_i=(65535&_i)*Ot+(((_i>>>16)*Ot&65535)<<16)&4294967295)<<15|_i>>>17))*Jt+(((_i>>>16)*Jt&65535)<<16)&4294967295)<<13|qe>>>19))+((5*(qe>>>16)&65535)<<16)&4294967295))+((58964+(Ct>>>16)&65535)<<16);switch(_i=0,Oe){case 3:_i^=(255&Le.charCodeAt(xi+2))<<16;case 2:_i^=(255&Le.charCodeAt(xi+1))<<8;case 1:qe^=_i=(65535&(_i=(_i=(65535&(_i^=255&Le.charCodeAt(xi)))*Ot+(((_i>>>16)*Ot&65535)<<16)&4294967295)<<15|_i>>>17))*Jt+(((_i>>>16)*Jt&65535)<<16)&4294967295}return qe^=Le.length,qe=2246822507*(65535&(qe^=qe>>>16))+((2246822507*(qe>>>16)&65535)<<16)&4294967295,qe=3266489909*(65535&(qe^=qe>>>13))+((3266489909*(qe>>>16)&65535)<<16)&4294967295,(qe^=qe>>>16)>>>0}),Ch.exports),Re=(yh||(yh=1,zh.exports=function(Le,Re){for(var Oe,Ue=Le.length,qe=Re^Ue,Ct=0;Ue>=4;)Oe=1540483477*(65535&(Oe=255&Le.charCodeAt(Ct)|(255&Le.charCodeAt(++Ct))<<8|(255&Le.charCodeAt(++Ct))<<16|(255&Le.charCodeAt(++Ct))<<24))+((1540483477*(Oe>>>16)&65535)<<16),qe=1540483477*(65535&qe)+((1540483477*(qe>>>16)&65535)<<16)^(Oe=1540483477*(65535&(Oe^=Oe>>>24))+((1540483477*(Oe>>>16)&65535)<<16)),Ue-=4,++Ct;switch(Ue){case 3:qe^=(255&Le.charCodeAt(Ct+2))<<16;case 2:qe^=(255&Le.charCodeAt(Ct+1))<<8;case 1:qe=1540483477*(65535&(qe^=255&Le.charCodeAt(Ct)))+((1540483477*(qe>>>16)&65535)<<16)}return qe=1540483477*(65535&(qe^=qe>>>13))+((1540483477*(qe>>>16)&65535)<<16),(qe^=qe>>>15)>>>0}),zh.exports);return Eh.exports=Le,Eh.exports.murmur3=Le,Eh.exports.murmur2=Re,Eh.exports}(),Rh=e(Dh);class be{constructor(Le,...Re){nt(this,Re[0]||{}),this.type=Le}}class ve extends be{constructor(Le,Re={}){super("error",nt({error:Le},Re))}}function we(Le,Re,Oe){Oe[Le]&&-1!==Oe[Le].indexOf(Re)||(Oe[Le]=Oe[Le]||[],Oe[Le].push(Re))}function _e(Le,Re,Oe){if(Oe&&Oe[Le]){const Ue=Oe[Le].indexOf(Re);-1!==Ue&&Oe[Le].splice(Ue,1)}}class Me{on(Le,Re){return this._listeners=this._listeners||{},we(Le,Re,this._listeners),this}off(Le,Re){return _e(Le,Re,this._listeners),_e(Le,Re,this._oneTimeListeners),this}once(Le,Re){return Re?(this._oneTimeListeners=this._oneTimeListeners||{},we(Le,Re,this._oneTimeListeners),this):new Promise((Re=>this.once(Le,Re)))}fire(Le,Re){const Oe="string"==typeof Le?new be(Le,Re):Le,Ue=Oe.type;if(this.listens(Ue)){Oe.target=this;const Le=this._listeners&&this._listeners[Ue]?this._listeners[Ue].slice():[];for(const Re of Le)Re.call(this,Oe);const Re=this._oneTimeListeners&&this._oneTimeListeners[Ue]?this._oneTimeListeners[Ue].slice():[];for(const Le of Re)_e(Ue,Le,this._oneTimeListeners),Le.call(this,Oe);const qe=this._eventedParent;qe&&(nt(Oe,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),qe.fire(Oe))}else Oe instanceof ve&&console.error(Oe.error);return this}listens(Le){return!!(this._listeners&&this._listeners[Le]&&this._listeners[Le].length>0||this._oneTimeListeners&&this._oneTimeListeners[Le]&&this._oneTimeListeners[Le].length>0||this._eventedParent&&this._eventedParent.listens(Le))}setEventedParent(Le,Re){return this._eventedParent=Le,this._eventedParentData=Re,this}}var Bh,Vh={},Gh=function(){if(Bh)return Vh;Bh=1;var Le={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(Le){return(Le=Math.round(Le))<0?0:Le>255?255:Le}function r(Le){return e("%"===Le[Le.length-1]?parseFloat(Le)/100*255:parseInt(Le))}function n(Le){return(Re="%"===Le[Le.length-1]?parseFloat(Le)/100:parseFloat(Le))<0?0:Re>1?1:Re;var Re}function i(Le,Re,Oe){return Oe<0?Oe+=1:Oe>1&&(Oe-=1),6*Oe<1?Le+(Re-Le)*Oe*6:2*Oe<1?Re:3*Oe<2?Le+(Re-Le)*(2/3-Oe)*6:Le}try{Vh.parseCSSColor=function(Re){var Oe,Ue=Re.replace(/ /g,"").toLowerCase();if(Ue in Le)return Le[Ue].slice();if("#"===Ue[0])return 4===Ue.length?(Oe=parseInt(Ue.substr(1),16))>=0&&Oe<=4095?[(3840&Oe)>>4|(3840&Oe)>>8,240&Oe|(240&Oe)>>4,15&Oe|(15&Oe)<<4,1]:null:7===Ue.length&&(Oe=parseInt(Ue.substr(1),16))>=0&&Oe<=16777215?[(16711680&Oe)>>16,(65280&Oe)>>8,255&Oe,1]:null;var qe=Ue.indexOf("("),Ct=Ue.indexOf(")");if(-1!==qe&&Ct+1===Ue.length){var Ot=Ue.substr(0,qe),Jt=Ue.substr(qe+1,Ct-(qe+1)).split(","),_i=1;switch(Ot){case"rgba":if(4!==Jt.length)return null;_i=n(Jt.pop());case"rgb":return 3!==Jt.length?null:[r(Jt[0]),r(Jt[1]),r(Jt[2]),_i];case"hsla":if(4!==Jt.length)return null;_i=n(Jt.pop());case"hsl":if(3!==Jt.length)return null;var xi=(parseFloat(Jt[0])%360+360)%360/360,vi=n(Jt[1]),bi=n(Jt[2]),Pi=bi<=.5?bi*(vi+1):bi+vi-bi*vi,Hr=2*bi-Pi;return[e(255*i(Hr,Pi,xi+1/3)),e(255*i(Hr,Pi,xi)),e(255*i(Hr,Pi,xi-1/3)),_i];default:return null}}return null}}catch(Le){}return Vh}();class Pe{constructor(Le,Re,Oe,Ue=1){this.r=Le,this.g=Re,this.b=Oe,this.a=Ue}static parse(Le){if(!Le)return;if(Le instanceof Pe)return Le;if("string"!=typeof Le)return;const Re=Gh.parseCSSColor(Le);return Re?new Pe(Re[0]/255*Re[3],Re[1]/255*Re[3],Re[2]/255*Re[3],Re[3]):void 0}toString(){const[Le,Re,Oe,Ue]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(Le)},${Math.round(Re)},${Math.round(Oe)},${Ue})`}
1toRenderColor(Le){const{r:Re,g:Oe,b:Ue,a:qe}=this;return new ze(Le,Re,Oe,Ue,qe)}}class ze{constructor(Le,Re,Oe,Ue,qe){if(Le){const Ct=Le.image.height,Ot=Ct*Ct;Re=0===qe?0:Re/qe*(Ct-1),Oe=0===qe?0:Oe/qe*(Ct-1),Ue=0===qe?0:Ue/qe*(Ct-1);const Jt=Math.floor(Re),_i=Math.floor(Oe),xi=Math.floor(Ue),vi=Math.ceil(Re),bi=Math.ceil(Oe),Pi=Math.ceil(Ue),Hr=Re-Jt,Jr=Oe-_i,Ln=Ue-xi,Nn=Le.image.data,Gn=4*(Jt+_i*Ot+xi*Ct),qn=4*(Jt+_i*Ot+Pi*Ct),Zn=4*(Jt+bi*Ot+xi*Ct),$n=4*(Jt+bi*Ot+Pi*Ct),Xn=4*(vi+_i*Ot+xi*Ct),Yn=4*(vi+_i*Ot+Pi*Ct),lo=4*(vi+bi*Ot+xi*Ct),uo=4*(vi+bi*Ot+Pi*Ct);if(Gn<0||uo>=Nn.length)throw new Error("out of range");this.r=ke(ke(ke(Nn[Gn],Nn[qn],Ln),ke(Nn[Zn],Nn[$n],Ln),Jr),ke(ke(Nn[Xn],Nn[Yn],Ln),ke(Nn[lo],Nn[uo],Ln),Jr),Hr)/255*qe,this.g=ke(ke(ke(Nn[Gn+1],Nn[qn+1],Ln),ke(Nn[Zn+1],Nn[$n+1],Ln),Jr),ke(ke(Nn[Xn+1],Nn[Yn+1],Ln),ke(Nn[lo+1],Nn[uo+1],Ln),Jr),Hr)/255*qe,this.b=ke(ke(ke(Nn[Gn+2],Nn[qn+2],Ln),ke(Nn[Zn+2],Nn[$n+2],Ln),Jr),ke(ke(Nn[Xn+2],Nn[Yn+2],Ln),ke(Nn[lo+2],Nn[uo+2],Ln),Jr),Hr)/255*qe,this.a=qe}else this.r=Re,this.g=Oe,this.b=Ue,this.a=qe}toArray(){const{r:Le,g:Re,b:Oe,a:Ue}=this;return 0===Ue?[0,0,0,0]:[255*Le/Ue,255*Re/Ue,255*Oe/Ue,Ue]}toArray01(){const{r:Le,g:Re,b:Oe,a:Ue}=this;return 0===Ue?[0,0,0,0]:[Le/Ue,Re/Ue,Oe/Ue,Ue]}toArray01Scaled(Le){const{r:Re,g:Oe,b:Ue,a:qe}=this;return 0===qe?[0,0,0]:[Re/qe*Le,Oe/qe*Le,Ue/qe*Le]}toArray01PremultipliedAlpha(){const{r:Le,g:Re,b:Oe,a:Ue}=this;return[Le,Re,Oe,Ue]}toArray01Linear(){const{r:Le,g:Re,b:Oe,a:Ue}=this;return 0===Ue?[0,0,0,0]:[Math.pow(Le/Ue,2.2),Math.pow(Re/Ue,2.2),Math.pow(Oe/Ue,2.2),Ue]}}function ke(Le,Re,Oe){return Le*(1-Oe)+Re*Oe}function Te(Le,Re,Oe){return Le.map(((Le,Ue)=>ke(Le,Re[Ue],Oe)))}Pe.black=new Pe(0,0,0,1),Pe.white=new Pe(1,1,1,1),Pe.transparent=new Pe(0,0,0,0),Pe.red=new Pe(1,0,0,1),Pe.blue=new Pe(0,0,1,1);var iu=Object.freeze({__proto__:null,array:Te,color:function(Le,Re,Oe){return new Pe(ke(Le.r,Re.r,Oe),ke(Le.g,Re.g,Oe),ke(Le.b,Re.b,Oe),ke(Le.a,Re.a,Oe))},number:ke});function Be(Le,...Re){for(const Oe of Re)for(const Re in Oe)Le[Re]=Oe[Re];return Le}class Ve extends Error{constructor(Le,Re){super(Re),this.message=Re,this.key=Le}}class Ce{constructor(Le,Re=[]){this.parent=Le,this.bindings={};for(const[Le,Oe]of Re)this.bindings[Le]=Oe}concat(Le){return new Ce(this,Le)}get(Le){if(this.bindings[Le])return this.bindings[Le];if(this.parent)return this.parent.get(Le);throw new Error(`${Le} not found in scope.`)}has(Le){return!!this.bindings[Le]||!!this.parent&&this.parent.has(Le)}}const ou={kind:"null"},su={kind:"number"},au={kind:"string"},lu={kind:"boolean"},xu={kind:"color"},Tu={kind:"object"},Ou={kind:"value"},Nu={kind:"collator"},Uu={kind:"formatted"},ju={kind:"resolvedImage"};function Ge(Le,Re){return{kind:"array",itemType:Le,N:Re}}function Xe(Le){if("array"===Le.kind){const Re=Xe(Le.itemType);return"number"==typeof Le.N?`array<${Re}, ${Le.N}>`:"value"===Le.itemType.kind?"array":`array<${Re}>`}return Le.kind}const Hu=[ou,su,au,lu,xu,Uu,Tu,Ge(Ou),ju];function Ze(Le,Re){if("error"===Re.kind)return null;if("array"===Le.kind){if("array"===Re.kind&&(0===Re.N&&"value"===Re.itemType.kind||!Ze(Le.itemType,Re.itemType))&&("number"!=typeof Le.N||Le.N===Re.N))return null}else{if(Le.kind===Re.kind)return null;if("value"===Le.kind)for(const Le of Hu)if(!Ze(Le,Re))return null}return`Expected ${Xe(Le)} but found ${Xe(Re)} instead.`}function We(Le,Re){return Re.some((Re=>Re.kind===Le.kind))}function He(Le,Re){return Re.some((Re=>"null"===Re?null===Le:"array"===Re?Array.isArray(Le):"object"===Re?Le&&!Array.isArray(Le)&&"object"==typeof Le:Re===typeof Le))}class Ke{constructor(Le,Re,Oe){this.sensitivity=Le?Re?"variant":"case":Re?"accent":"base",this.locale=Oe,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(Le,Re){return this.collator.compare(Le,Re)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Je{constructor(Le,Re,Oe,Ue,qe){this.text=Le.normalize?Le.normalize():Le,this.image=Re,this.scale=Oe,this.fontStack=Ue,this.textColor=qe}}class Qe{constructor(Le){this.sections=Le}static fromString(Le){return new Qe([new Je(Le,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((Le=>0!==Le.text.length||Le.image&&0!==Le.image.namePrimary.length))}static factory(Le){return Le instanceof Qe?Le:Qe.fromString(Le)}toString(){return 0===this.sections.length?"":this.sections.map((Le=>Le.text)).join("")}serialize(){const Le=["format"];for(const Re of this.sections){if(Re.image){Le.push(["image",Re.image.namePrimary]);continue}Le.push(Re.text);const Oe={};Re.fontStack&&(Oe["text-font"]=["literal",Re.fontStack.split(",")]),Re.scale&&(Oe["font-scale"]=Re.scale),Re.textColor&&(Oe["text-color"]=["rgba"].concat(Re.textColor.toRenderColor(null).toArray())),Le.push(Oe)}return Le}}class tr{constructor(Le){this.namePrimary=Le.namePrimary,Le.nameSecondary&&(this.nameSecondary=Le.nameSecondary),this.available=Le.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(Le,Re){return Le?new tr({namePrimary:Le,nameSecondary:Re,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function er(Le,Re,Oe,Ue){return"number"==typeof Le&&Le>=0&&Le<=255&&"number"==typeof Re&&Re>=0&&Re<=255&&"number"==typeof Oe&&Oe>=0&&Oe<=255?void 0===Ue||"number"==typeof Ue&&Ue>=0&&Ue<=1?null:`Invalid rgba value [${[Le,Re,Oe,Ue].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof Ue?[Le,Re,Oe,Ue]:[Le,Re,Oe]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rr(Le){if(null===Le)return!0;
vendor: 6,363 bytes, line 1
1if("string"==typeof Le)return!0;if("boolean"==typeof Le)return!0;if("number"==typeof Le)return!0;if(Le instanceof Pe)return!0;if(Le instanceof Ke)return!0;if(Le instanceof Qe)return!0;if(Le instanceof tr)return!0;if(Array.isArray(Le)){for(const Re of Le)if(!rr(Re))return!1;return!0}if("object"==typeof Le){for(const Re in Le)if(!rr(Le[Re]))return!1;return!0}return!1}function nr(Le){if(null===Le)return ou;if("string"==typeof Le)return au;if("boolean"==typeof Le)return lu;if("number"==typeof Le)return su;if(Le instanceof Pe)return xu;if(Le instanceof Ke)return Nu;if(Le instanceof Qe)return Uu;if(Le instanceof tr)return ju;if(Array.isArray(Le)){const Re=Le.length;let Oe;for(const Re of Le){const Le=nr(Re);if(Oe){if(Oe===Le)continue;Oe=Ou;break}Oe=Le}return Ge(Oe||Ou,Re)}return Tu}function ir(Le){const Re=typeof Le;return null===Le?"":"string"===Re||"number"===Re||"boolean"===Re?String(Le):Le instanceof Pe||Le instanceof Qe||Le instanceof tr?Le.toString():JSON.stringify(Le)}class sr{constructor(Le,Re){this.type=Le,this.value=Re}static parse(Le,Re){if(2!==Le.length)return Re.error(`'literal' expression requires exactly one argument, but found ${Le.length-1} instead.`);if(!rr(Le[1]))return Re.error("invalid value");const Oe=Le[1];let Ue=nr(Oe);const qe=Re.expectedType;return"array"!==Ue.kind||0!==Ue.N||!qe||"array"!==qe.kind||"number"==typeof qe.N&&0!==qe.N||(Ue=qe),new sr(Ue,Oe)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Pe?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof Qe?this.value.serialize():this.value}}class ar{constructor(Le){this.name="ExpressionEvaluationError",this.message=Le}toJSON(){return this.message}}const Xu={string:au,number:su,boolean:lu,object:Tu};class lr{constructor(Le,Re){this.type=Le,this.args=Re}static parse(Le,Re){if(Le.length<2)return Re.error("Expected at least one argument.");let Oe,Ue=1;const qe=Le[0];if("array"===qe){let qe,Ct;if(Le.length>2){const Oe=Le[1];if("string"!=typeof Oe||!(Oe in Xu)||"object"===Oe)return Re.error('The item type argument of "array" must be one of string, number, boolean',1);qe=Xu[Oe],Ue++}else qe=Ou;if(Le.length>3){if(null!==Le[2]&&("number"!=typeof Le[2]||Le[2]<0||Le[2]!==Math.floor(Le[2])))return Re.error('The length argument to "array" must be a positive integer literal',2);Ct=Le[2],Ue++}Oe=Ge(qe,Ct)}else Oe=Xu[qe];const Ct=[];for(;Ue<Le.length;Ue++){const Oe=Re.parse(Le[Ue],Ue,Ou);if(!Oe)return null;Ct.push(Oe)}return new lr(Oe,Ct)}evaluate(Le){for(let Re=0;Re<this.args.length;Re++){const Oe=this.args[Re].evaluate(Le);if(!Ze(this.type,nr(Oe)))return Oe;if(Re===this.args.length-1)throw new ar(`The expression ${JSON.stringify(this.args[Re].serialize())} evaluated to ${Xe(nr(Oe))} but was expected to be of type ${Xe(this.type)}.`)}return null}eachChild(Le){this.args.forEach(Le)}outputDefined(){return this.args.every((Le=>Le.outputDefined()))}serialize(){const Le=this.type,Re=[Le.kind];if("array"===Le.kind){const Oe=Le.itemType;if("string"===Oe.kind||"number"===Oe.kind||"boolean"===Oe.kind){Re.push(Oe.kind);const Ue=Le.N;("number"==typeof Ue||this.args.length>1)&&Re.push(Ue)}}return Re.concat(this.args.map((Le=>Le.serialize())))}}class ur{constructor(Le){this.type=Uu,this.sections=Le}static parse(Le,Re){if(Le.length<2)return Re.error("Expected at least one argument.");const Oe=Le[1];if(!Array.isArray(Oe)&&"object"==typeof Oe)return Re.error("First argument must be an image or text section.");const Ue=[];let qe=!1;for(let Oe=1;Oe<=Le.length-1;++Oe){const Ct=Le[Oe];if(qe&&"object"==typeof Ct&&!Array.isArray(Ct)){qe=!1;let Le=null;if(Ct["font-scale"]&&(Le=Re.parseObjectValue(Ct["font-scale"],Oe,"font-scale",su),!Le))return null;let Ot=null;if(Ct["text-font"]&&(Ot=Re.parseObjectValue(Ct["text-font"],Oe,"text-font",Ge(au)),!Ot))return null;let Jt=null;if(Ct["text-color"]&&(Jt=Re.parseObjectValue(Ct["text-color"],Oe,"text-color",xu),!Jt))return null;const _i=Ue[Ue.length-1];_i.scale=Le,_i.font=Ot,_i.textColor=Jt}else{const Ct=Re.parse(Le[Oe],Oe,Ou);if(!Ct)return null;const Ot=Ct.type.kind;if("string"!==Ot&&"value"!==Ot&&"null"!==Ot&&"resolvedImage"!==Ot)return Re.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");qe=!0,Ue.push({content:Ct,scale:null,font:null,textColor:null})}}return new ur(Ue)}evaluate(Le){return new Qe(this.sections.map((Re=>{const Oe=Re.content.evaluate(Le);return nr(Oe)===ju?new Je("",Oe,null,null,null):new Je(ir(Oe),null,Re.scale?Re.scale.evaluate(Le):null,Re.font?Re.font.evaluate(Le).join(","):null,Re.textColor?Re.textColor.evaluate(Le):null)})))}eachChild(Le){for(const Re of this.sections)Le(Re.content),Re.scale&&Le(Re.scale),Re.font&&Le(Re.font),Re.textColor&&Le(Re.textColor)}outputDefined(){return!1}serialize(){const Le=["format"];for(const Re of this.sections){Le.push(Re.content.serialize());const Oe={};Re.scale&&(Oe["font-scale"]=Re.scale.serialize()),Re.font&&(Oe["text-font"]=Re.font.serialize()),Re.textColor&&(Oe["text-color"]=Re.textColor.serialize()),Le.push(Oe)}return Le}}class cr{constructor(Le,Re){this.type=ju,this.inputPrimary=Le,this.inputSecondary=Re}static parse(Le,Re){if(Le.length<2)return Re.error("Expected two or more arguments.");const Oe=Re.parse(Le[1],1,au);if(!Oe)return Re.error("No image name provided.");if(2===Le.length)return new cr(Oe);const Ue=Re.parse(Le[2],1,au);return Ue?new cr(Oe,Ue):Re.error("Secondary image variant is not a string.")}evaluate(Le){const Re=tr.fromString(this.inputPrimary.evaluate(Le),this.inputSecondary?this.inputSecondary.evaluate(Le):void 0);return Re&&Le.availableImages&&(Re.available=Le.availableImages.indexOf(Re.namePrimary)>-1,Re.nameSecondary&&Re.available&&Le.availableImages&&(Re.available=Le.availableImages.indexOf(Re.nameSecondary)>-1)),Re}eachChild(Le){Le(this.inputPrimary),this.inputSecondary&&Le(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function hr(Le){return Le instanceof Number?"number":Le instanceof String?"string":Le instanceof Boolean?"boolean":Array.isArray(Le)?"array":null===Le?"null":typeof Le}const Yu={"to-boolean":lu,"to-color":xu,"to-number":su,"to-string":au};
vendor: 7,514 bytes, line 1
1class fr{constructor(Le,Re){this.type=Le,this.args=Re}static parse(Le,Re){if(Le.length<2)return Re.error("Expected at least one argument.");const Oe=Le[0],Ue=[];let qe=ou;if("to-array"===Oe){if(!Array.isArray(Le[1]))return null;const Oe=Le[1].length;if(Re.expectedType){if("array"!==Re.expectedType.kind)return Re.error(`Expected ${Re.expectedType.kind} but found array.`);qe=Ge(Re.expectedType.itemType,Oe)}else{if(!(Oe>0&&rr(Le[1][0])))return null;qe=Ge(nr(Le[1][0]),Oe)}for(let Ct=0;Ct<Oe;Ct++){const Oe=Le[1][Ct];let Ot;if("array"===hr(Oe))Ot=Re.parse(Oe,void 0,qe.itemType);else{const Le=hr(Oe);if(Le!==qe.itemType.kind)return Re.error(`Expected ${qe.itemType.kind} but found ${Le}.`);Ot=Re.registry.literal.parse(["literal",void 0===Oe?null:Oe],Re)}if(!Ot)return null;Ue.push(Ot)}}else{if(("to-boolean"===Oe||"to-string"===Oe)&&2!==Le.length)return Re.error("Expected one argument.");qe=Yu[Oe];for(let Oe=1;Oe<Le.length;Oe++){const qe=Re.parse(Le[Oe],Oe,Ou);if(!qe)return null;Ue.push(qe)}}return new fr(qe,Ue)}evaluate(Le){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(Le));if("color"===this.type.kind){let Re,Oe;for(const Ue of this.args){if(Re=Ue.evaluate(Le),Oe=null,Re instanceof Pe)return Re;if("string"==typeof Re){const Oe=Le.parseColor(Re);if(Oe)return Oe}else if(Array.isArray(Re)&&(Oe=Re.length<3||Re.length>4?`Invalid rbga value ${JSON.stringify(Re)}: expected an array containing either three or four numeric values.`:er(Re[0],Re[1],Re[2],Re[3]),!Oe))return new Pe(Re[0]/255,Re[1]/255,Re[2]/255,Re[3])}throw new ar(Oe||`Could not parse color from value '${"string"==typeof Re?Re:String(JSON.stringify(Re))}'`)}if("number"===this.type.kind){let Re=null;for(const Oe of this.args){if(Re=Oe.evaluate(Le),null===Re)return 0;const Ue=Number(Re);if(!isNaN(Ue))return Ue}throw new ar(`Could not convert ${JSON.stringify(Re)} to number.`)}return"formatted"===this.type.kind?Qe.fromString(ir(this.args[0].evaluate(Le))):"resolvedImage"===this.type.kind?tr.fromString(ir(this.args[0].evaluate(Le))):"array"===this.type.kind?this.args.map((Re=>Re.evaluate(Le))):ir(this.args[0].evaluate(Le))}eachChild(Le){this.args.forEach(Le)}outputDefined(){return this.args.every((Le=>Le.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new ur([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new cr(this.args[0]).serialize();const Le="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((Re=>{Le.push(Re.serialize())})),Le}}const Ju=["Unknown","Point","LineString","Polygon"];class mr{constructor(Le,Re){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=Le,this.options=Re}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ju[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(Le){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const Le=this.featureDistanceData.center,Re=this.featureDistanceData.scale,{x:Oe,y:Ue}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(Oe*Re-Le[0])+this.featureDistanceData.bearing[1]*(Ue*Re-Le[1])}return 0}parseColor(Le){let Re=this._parseColorCache[Le];return Re||(Re=this._parseColorCache[Le]=Pe.parse(Le)),Re}getConfig(Le){return this.options?this.options.get(Le):null}}class yr{constructor(Le,Re,Oe,Ue,qe){this.name=Le,this.type=Re,this._evaluate=Oe,this.args=Ue,this._overloadIndex=qe}evaluate(Le){if(!this._evaluate){const Le=yr.definitions[this.name];this._evaluate=Array.isArray(Le)?Le[2]:Le.overloads[this._overloadIndex][1]}return this._evaluate(Le,this.args)}eachChild(Le){this.args.forEach(Le)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((Le=>Le.serialize())))}static parse(Le,Re){const Oe=Le[0],Ue=yr.definitions[Oe];if(!Ue)return Re.error(`Unknown expression "${Oe}". If you wanted a literal array, use ["literal", [...]].`,0);const qe=Array.isArray(Ue)?Ue[0]:Ue.type,Ct=Array.isArray(Ue)?[[Ue[1],Ue[2]]]:Ue.overloads,Ot=[];let Jt=null,_i=-1;for(const[Ue,xi]of Ct){if(Array.isArray(Ue)&&Ue.length!==Le.length-1)continue;Ot.push(Ue),_i++,Jt=new wd(Re.registry,Re.path,null,Re.scope,void 0,Re._scope,Re.options);const Ct=[];let vi=!1;for(let Re=1;Re<Le.length;Re++){const Oe=Le[Re],qe=Array.isArray(Ue)?Ue[Re-1]:Ue.type,Ot=Jt.parse(Oe,1+Ct.length,qe);if(!Ot){vi=!0;break}Ct.push(Ot)}if(!vi)if(Array.isArray(Ue)&&Ue.length!==Ct.length)Jt.error(`Expected ${Ue.length} arguments, but found ${Ct.length} instead.`);else{for(let Le=0;Le<Ct.length;Le++){const Re=Array.isArray(Ue)?Ue[Le]:Ue.type,Oe=Ct[Le];Jt.concat(Le+1).checkSubtype(Re,Oe.type)}if(0===Jt.errors.length)return new yr(Oe,qe,xi,Ct,_i)}}if(1===Ot.length)Re.errors.push(...Jt.errors);else{const Oe=(Ot.length?Ot:Ct.map((([Le])=>Le))).map(gr).join(" | "),Ue=[];for(let Oe=1;Oe<Le.length;Oe++){const qe=Re.parse(Le[Oe],1+Ue.length);if(!qe)return null;Ue.push(Xe(qe.type))}Re.error(`Expected arguments of type ${Oe}, but found (${Ue.join(", ")}) instead.`)}return null}static register(Le,Re){yr.definitions=Re;for(const Oe in Re)Le[Oe]=yr}}function gr(Le){return Array.isArray(Le)?`(${Le.map(Xe).join(", ")})`:`(${Xe(Le.type)}...)`}class xr{constructor(Le,Re,Oe){this.type=Nu,this.locale=Oe,this.caseSensitive=Le,this.diacriticSensitive=Re}static parse(Le,Re){if(2!==Le.length)return Re.error("Expected one argument.");const Oe=Le[1];if("object"!=typeof Oe||Array.isArray(Oe))return Re.error("Collator options argument must be an object.");const Ue=void 0===Oe["case-sensitive"]?Re.parse(!1,1,lu):Re.parseObjectValue(Oe["case-sensitive"],1,"case-sensitive",lu);if(!Ue)return null;const qe=void 0===Oe["diacritic-sensitive"]?Re.parse(!1,1,lu):Re.parseObjectValue(Oe["diacritic-sensitive"],1,"diacritic-sensitive",lu);if(!qe)return null;let Ct=null;return Oe.locale&&(Ct=Re.parseObjectValue(Oe.locale,1,"locale",au),!Ct)?null:new xr(Ue,qe,Ct)}evaluate(Le){return new Ke(this.caseSensitive.evaluate(Le),this.diacriticSensitive.evaluate(Le),this.locale?this.locale.evaluate(Le):null)}eachChild(Le){Le(this.caseSensitive),Le(this.diacriticSensitive),this.locale&&Le(this.locale)}outputDefined(){return!1}serialize(){const Le={};return Le["case-sensitive"]=this.caseSensitive.serialize(),Le["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(Le.locale=this.locale.serialize()),["collator",Le]}}function br(Le,Re,Oe=0,Ue=Le.length-1,qe=wr){for(;Ue>Oe;){if(Ue-Oe>600){const Ct=Ue-Oe+1,Ot=Re-Oe+1,Jt=Math.log(Ct),_i=.5*Math.exp(2*Jt/3),xi=.5*Math.sqrt(Jt*_i*(Ct-_i)/Ct)*(Ot-Ct/2<0?-1:1);br(Le,Re,Math.max(Oe,Math.floor(Re-Ot*_i/Ct+xi)),Math.min(Ue,Math.floor(Re+(Ct-Ot)*_i/Ct+xi)),qe)}const Ct=Le[Re];let Ot=Oe,Jt=Ue;for(vr(Le,Oe,Re),qe(Le[Ue],Ct)>0&&vr(Le,Oe,Ue);Ot<Jt;){for(vr(Le,Ot,Jt),Ot++,Jt--;qe(Le[Ot],Ct)<0;)Ot++;for(;qe(Le[Jt],Ct)>0;)Jt--}0===qe(Le[Oe],Ct)?vr(Le,Oe,Jt):(Jt++,vr(Le,Jt,Ue)),Jt<=Re&&(Oe=Jt+1),Re<=Jt&&(Ue=Jt-1)}}function vr(Le,Re,Oe){const Ue=Le[Re];Le[Re]=Le[Oe],Le[Oe]=Ue}function wr(Le,Re){return Le<Re?-1:Le>Re?1:0}function _r(Le){let Re=0;for(let Oe,Ue,qe=0,Ct=Le.length,Ot=Ct-1;qe<Ct;
vendor: 4,142 bytes, line 1
1Ot=qe++)Oe=Le[qe],Ue=Le[Ot],Re+=(Ue.x-Oe.x)*(Oe.y+Ue.y);return Re}function Mr(Le,Re){Le[0]=Math.min(Le[0],Re[0]),Le[1]=Math.min(Le[1],Re[1]),Le[2]=Math.max(Le[2],Re[0]),Le[3]=Math.max(Le[3],Re[1])}function Ar(Le,Re){return!(Le[0]<=Re[0]||Le[2]>=Re[2]||Le[1]<=Re[1]||Le[3]>=Re[3])}function Sr(Le,Re,Oe){const Ue=Le[0]-Re[0],qe=Le[1]-Re[1],Ct=Le[0]-Oe[0],Ot=Le[1]-Oe[1];return Ue*Ot-Ct*qe==0&&Ue*Ct<=0&&qe*Ot<=0}function Ir(Le,Re,Oe=!1){let Ue=!1;for(let Jt=0,_i=Re.length;Jt<_i;Jt++){const _i=Re[Jt];for(let Re=0,Jt=_i.length,xi=Jt-1;Re<Jt;xi=Re++){const Jt=_i[xi],vi=_i[Re];if(Sr(Le,Jt,vi))return Oe;(Ct=Jt)[1]>(qe=Le)[1]!=(Ot=vi)[1]>qe[1]&&qe[0]<(Ot[0]-Ct[0])*(qe[1]-Ct[1])/(Ot[1]-Ct[1])+Ct[0]&&(Ue=!Ue)}}var qe,Ct,Ot;return Ue}function Pr(Le,Re,Oe,Ue){const qe=Ue[0]-Oe[0],Ct=Ue[1]-Oe[1],Ot=(Le[0]-Oe[0])*Ct-qe*(Le[1]-Oe[1]),Jt=(Re[0]-Oe[0])*Ct-qe*(Re[1]-Oe[1]);return Ot>0&&Jt<0||Ot<0&&Jt>0}function zr(Le,Re,Oe,Ue){return 0!=(qe=[Ue[0]-Oe[0],Ue[1]-Oe[1]])[0]*(Ct=[Re[0]-Le[0],Re[1]-Le[1]])[1]-qe[1]*Ct[0]&&!(!Pr(Le,Re,Oe,Ue)||!Pr(Oe,Ue,Le,Re));var qe,Ct}const Ku=8192;function Tr(Le,Re){const Oe=(180+Le[0])/360,Ue=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+Le[1]*Math.PI/360)))/360,qe=Math.pow(2,Re.z);return[Math.round(Oe*qe*Ku),Math.round(Ue*qe*Ku)]}function Er(Le,Re){for(let Oe=0;Oe<Re.length;Oe++)if(Ir(Le,Re[Oe]))return!0;return!1}function Br(Le,Re,Oe){for(const Ue of Oe)for(let Oe=0,qe=Ue.length,Ct=qe-1;Oe<qe;Ct=Oe++)if(zr(Le,Re,Ue[Ct],Ue[Oe]))return!0;return!1}function Vr(Le,Re){for(let Oe=0;Oe<Le.length;++Oe)if(!Ir(Le[Oe],Re))return!1;for(let Oe=0;Oe<Le.length-1;++Oe)if(Br(Le[Oe],Le[Oe+1],Re))return!1;return!0}function Cr(Le,Re){for(let Oe=0;Oe<Re.length;Oe++)if(Vr(Le,Re[Oe]))return!0;return!1}function Rr(Le,Re,Oe){const Ue=[];for(let qe=0;qe<Le.length;qe++){const Ct=[];for(let Ue=0;Ue<Le[qe].length;Ue++){const Ot=Tr(Le[qe][Ue],Oe);Mr(Re,Ot),Ct.push(Ot)}Ue.push(Ct)}return Ue}function Dr(Le,Re,Oe){const Ue=[];for(let qe=0;qe<Le.length;qe++){const Ct=Rr(Le[qe],Re,Oe);Ue.push(Ct)}return Ue}function Lr(Le,Re,Oe,Ue){if(Le[0]<Oe[0]||Le[0]>Oe[2]){const Re=.5*Ue;let qe=Le[0]-Oe[0]>Re?-Ue:Oe[0]-Le[0]>Re?Ue:0;0===qe&&(qe=Le[0]-Oe[2]>Re?-Ue:Oe[2]-Le[0]>Re?Ue:0),Le[0]+=qe}Mr(Re,Le)}function Fr(Le,Re,Oe,Ue){const qe=Math.pow(2,Ue.z)*Ku,Ct=[Ue.x*Ku,Ue.y*Ku],Ot=[];if(!Le)return Ot;for(const Ue of Le)for(const Le of Ue){const Ue=[Le.x+Ct[0],Le.y+Ct[1]];Lr(Ue,Re,Oe,qe),Ot.push(Ue)}return Ot}function Or(Le,Re,Oe,Ue){const qe=Math.pow(2,Ue.z)*Ku,Ct=[Ue.x*Ku,Ue.y*Ku],Ot=[];if(!Le)return Ot;for(const Oe of Le){const Le=[];for(const Ue of Oe){const Oe=[Ue.x+Ct[0],Ue.y+Ct[1]];Mr(Re,Oe),Le.push(Oe)}Ot.push(Le)}if(Re[2]-Re[0]<=qe/2){(Jt=Re)[0]=Jt[1]=1/0,Jt[2]=Jt[3]=-1/0;for(const Le of Ot)for(const Ue of Le)Lr(Ue,Re,Oe,qe)}var Jt;return Ot}class Ur{constructor(Le,Re){this.type=lu,this.geojson=Le,this.geometries=Re}static parse(Le,Re){if(2!==Le.length)return Re.error(`'within' expression requires exactly one argument, but found ${Le.length-1} instead.`);if(rr(Le[1])){const Re=Le[1];if("FeatureCollection"===Re.type)for(let Le=0;Le<Re.features.length;++Le){const Oe=Re.features[Le].geometry.type;if("Polygon"===Oe||"MultiPolygon"===Oe)return new Ur(Re,Re.features[Le].geometry)}else if("Feature"===Re.type){const Le=Re.geometry.type;if("Polygon"===Le||"MultiPolygon"===Le)return new Ur(Re,Re.geometry)}else if("Polygon"===Re.type||"MultiPolygon"===Re.type)return new Ur(Re,Re)}return Re.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(Le){if(null!=Le.geometry()&&null!=Le.canonicalID()){if("Point"===Le.geometryType())return function(Le,Re){const Oe=[1/0,1/0,-1/0,-1/0],Ue=[1/0,1/0,-1/0,-1/0],qe=Le.canonicalID();if(!qe)return!1;if("Polygon"===Re.type){const Ct=Rr(Re.coordinates,Ue,qe),Ot=Fr(Le.geometry(),Oe,Ue,qe);if(!Ar(Oe,Ue))return!1;for(const Le of Ot)if(!Ir(Le,Ct))return!1}if("MultiPolygon"===Re.type){const Ct=Dr(Re.coordinates,Ue,qe),Ot=Fr(Le.geometry(),Oe,Ue,qe);if(!Ar(Oe,Ue))return!1;for(const Le of Ot)if(!Er(Le,Ct))return!1}return!0}(Le,this.geometries);if("LineString"===Le.geometryType())return function(Le,Re){const Oe=[1/0,1/0,-1/0,-1/0],Ue=[1
1/0,1/0,-1/0,-1/0],qe=Le.canonicalID();if(!qe)return!1;if("Polygon"===Re.type){const Ct=Rr(Re.coordinates,Ue,qe),Ot=Or(Le.geometry(),Oe,Ue,qe);if(!Ar(Oe,Ue))return!1;for(const Le of Ot)if(!Vr(Le,Ct))return!1}if("MultiPolygon"===Re.type){const Ct=Dr(Re.coordinates,Ue,qe),Ot=Or(Le.geometry(),Oe,Ue,qe);if(!Ar(Oe,Ue))return!1;for(const Le of Ot)if(!Cr(Le,Ct))return!1}return!0}(Le,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Qu={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},id=1/298.257223563,nd=id*(2-id),ld=Math.PI/180;class Gr{static fromTile(Le,Re,Oe){const Ue=Math.PI*(1-2*(Le+.5)/Math.pow(2,Re)),qe=Math.atan(.5*(Math.exp(Ue)-Math.exp(-Ue)))/ld;return new Gr(qe,Oe)}static get units(){return Qu}constructor(Le,Re){if(void 0===Le)throw new Error("No latitude given.");if(Re&&!Qu[Re])throw new Error(`Unknown unit ${Re}. Use one of: ${Object.keys(Qu).join(", ")}`);const Oe=6378.137*ld*(Re?Qu[Re]:1),Ue=Math.cos(Le*ld),qe=1/(1-nd*(1-Ue*Ue)),Ct=Math.sqrt(qe);this.kx=Oe*Ct*Ue,this.ky=Oe*Ct*qe*(1-nd)}distance(Le,Re){const Oe=Zr(Le[0]-Re[0])*this.kx,Ue=(Le[1]-Re[1])*this.ky;return Math.sqrt(Oe*Oe+Ue*Ue)}bearing(Le,Re){const Oe=Zr(Re[0]-Le[0])*this.kx;return Math.atan2(Oe,(Re[1]-Le[1])*this.ky)/ld}destination(Le,Re,Oe){const Ue=Oe*ld;return this.offset(Le,Math.sin(Ue)*Re,Math.cos(Ue)*Re)}offset(Le,Re,Oe){return[Le[0]+Re/this.kx,Le[1]+Oe/this.ky]}lineDistance(Le){let Re=0;for(let Oe=0;Oe<Le.length-1;Oe++)Re+=this.distance(Le[Oe],Le[Oe+1]);return Re}area(Le){let Re=0;for(let Oe=0;Oe<Le.length;Oe++){const Ue=Le[Oe];for(let Le=0,qe=Ue.length,Ct=qe-1;Le<qe;Ct=Le++)Re+=Zr(Ue[Le][0]-Ue[Ct][0])*(Ue[Le][1]+Ue[Ct][1])*(Oe?-1:1)}return Math.abs(Re)/2*this.kx*this.ky}along(Le,Re){let Oe=0;if(Re<=0)return Le[0];for(let Ue=0;Ue<Le.length-1;Ue++){const qe=Le[Ue],Ct=Le[Ue+1],Ot=this.distance(qe,Ct);if(Oe+=Ot,Oe>Re)return Yr(qe,Ct,(Re-(Oe-Ot))/Ot)}return Le[Le.length-1]}pointToSegmentDistance(Le,Re,Oe){let[Ue,qe]=Re,Ct=Zr(Oe[0]-Ue)*this.kx,Ot=(Oe[1]-qe)*this.ky;if(0!==Ct||0!==Ot){const Re=(Zr(Le[0]-Ue)*this.kx*Ct+(Le[1]-qe)*this.ky*Ot)/(Ct*Ct+Ot*Ot);Re>1?(Ue=Oe[0],qe=Oe[1]):Re>0&&(Ue+=Ct/this.kx*Re,qe+=Ot/this.ky*Re)}return Ct=Zr(Le[0]-Ue)*this.kx,Ot=(Le[1]-qe)*this.ky,Math.sqrt(Ct*Ct+Ot*Ot)}pointOnLine(Le,Re){let Oe=1/0,Ue=Le[0][0],qe=Le[0][1],Ct=0,Ot=0;for(let Jt=0;Jt<Le.length-1;Jt++){let _i=Le[Jt][0],xi=Le[Jt][1],vi=Zr(Le[Jt+1][0]-_i)*this.kx,bi=(Le[Jt+1][1]-xi)*this.ky,Pi=0;0===vi&&0===bi||(Pi=(Zr(Re[0]-_i)*this.kx*vi+(Re[1]-xi)*this.ky*bi)/(vi*vi+bi*bi),Pi>1?(_i=Le[Jt+1][0],xi=Le[Jt+1][1]):Pi>0&&(_i+=vi/this.kx*Pi,xi+=bi/this.ky*Pi)),vi=Zr(Re[0]-_i)*this.kx,bi=(Re[1]-xi)*this.ky;const Hr=vi*vi+bi*bi;Hr<Oe&&(Oe=Hr,Ue=_i,qe=xi,Ct=Jt,Ot=Pi)}return{point:[Ue,qe],index:Ct,t:Math.max(0,Math.min(1,Ot))}}lineSlice(Le,Re,Oe){let Ue=this.pointOnLine(Oe,Le),qe=this.pointOnLine(Oe,Re);if(Ue.index>qe.index||Ue.index===qe.index&&Ue.t>qe.t){const Le=Ue;Ue=qe,qe=Le}const Ct=[Ue.point],Ot=Ue.index+1,Jt=qe.index;!Xr(Oe[Ot],Ct[0])&&Ot<=Jt&&Ct.push(Oe[Ot]);for(let Le=Ot+1;Le<=Jt;Le++)Ct.push(Oe[Le]);return Xr(Oe[Jt],qe.point)||Ct.push(qe.point),Ct}lineSliceAlong(Le,Re,Oe){let Ue=0;const qe=[];for(let Ct=0;Ct<Oe.length-1;Ct++){const Ot=Oe[Ct],Jt=Oe[Ct+1],_i=this.distance(Ot,Jt);if(Ue+=_i,Ue>Le&&0===qe.length&&qe.push(Yr(Ot,Jt,(Le-(Ue-_i))/_i)),Ue>=Re)return qe.push(Yr(Ot,Jt,(Re-(Ue-_i))/_i)),qe;Ue>Le&&qe.push(Jt)}return qe}bufferPoint(Le,Re){const Oe=Re/this.ky,Ue=Re/this.kx;return[Le[0]-Ue,Le[1]-Oe,Le[0]+Ue,Le[1]+Oe]}bufferBBox(Le,Re){const Oe=Re/this.ky,Ue=Re/this.kx;return[Le[0]-Ue,Le[1]-Oe,Le[2]+Ue,Le[3]+Oe]}insideBBox(Le,Re){return Zr(Le[0]-Re[0])>=0&&Zr(Le[0]-Re[2])<=0&&Le[1]>=Re[1]&&Le[1]<=Re[3]}}function Xr(Le,Re){return Le[0]===Re[0]&&Le[1]===Re[1]}function Yr(Le,Re,Oe){const Ue=Zr(Re[0]-Le[0]);return[Le[0]+Ue*Oe,Le[1]+(Re[1]-Le[1])*Oe]}function Zr(Le){for(;Le<-180;)Le+=360;for(;Le>180;)Le-=360;return Le}class Wr{constructor(Le=[],Re=((Le,Re)=>Le<Re?-1:Le>Re?1:0)){if(this.data=Le,this.length=this.data.length,this.compare=Re,this.length>0)for(let Le=(this.length>>1)-1;Le>=0;Le--)this._down(Le)}push(Le){this.data.push(Le),this._up(this.length++)}pop(){if(0===this.length)return;const Le=this.data[0],Re=this.data.pop();return--this.length>0&&(this.data[0]=Re,this._down(0)),Le}peek(){return this.data[0]}_up(Le){const{data:Re,compare:Oe}=this,Ue=Re[Le];for(;Le>0;){const qe=Le-1>>1,Ct=Re[qe];if(Oe(Ue,Ct)>=0)break;Re[Le]=Ct,Le=qe}Re[Le]=Ue}_down(Le){const{data:Re,compare:Oe}=this,Ue=this.length>>1,qe=Re[Le];for(;Le<Ue;){let Ue=1+(Le<<1);const Ct=Ue+1;if(Ct<this.length&&Oe(Re[Ct],Re[Ue])<0&&(Ue=Ct),Oe(Re[Ue],qe)>=0)break;Re[Le]=Re[Ue],Le=Ue}Re[Le]=qe}}var ud=8192;function Kr(Le,Re){return Re.dist-Le.dist}const _d=100,xd=50;function tn(Le){const Re=[1/0,1/0,-1/0,-1/0];if(Re.length!==Le.length)return!1;for(let Oe=0;Oe<Re.length;Oe++)if(Re[Oe]!==Le[Oe])return!1;return!0}function en(Le){return Le[1]-Le[0]+1}function rn(Le,Re){const Oe=Le[1]>=Le[0]&&Le[1]<Re;
vendor: 7,197 bytes, line 1
1return Oe||console.warn("Distance Expression: Index is out of range"),Oe}function nn(Le,Re){if(Le[0]>Le[1])return[null,null];const Oe=en(Le);if(Re){if(2===Oe)return[Le,null];const Re=Math.floor(Oe/2);return[[Le[0],Le[0]+Re],[Le[0]+Re,Le[1]]]}{if(1===Oe)return[Le,null];const Re=Math.floor(Oe/2)-1;return[[Le[0],Le[0]+Re],[Le[0]+Re+1,Le[1]]]}}function sn(Le,Re){const Oe=[1/0,1/0,-1/0,-1/0];if(!rn(Re,Le.length))return Oe;for(let Ue=Re[0];Ue<=Re[1];++Ue)Mr(Oe,Le[Ue]);return Oe}function an(Le){const Re=[1/0,1/0,-1/0,-1/0];for(let Oe=0;Oe<Le.length;++Oe)for(let Ue=0;Ue<Le[Oe].length;++Ue)Mr(Re,Le[Oe][Ue]);return Re}function on(Le,Re,Oe){if(tn(Le)||tn(Re))return NaN;let Ue=0,qe=0;return Le[2]<Re[0]&&(Ue=Re[0]-Le[2]),Le[0]>Re[2]&&(Ue=Le[0]-Re[2]),Le[1]>Re[3]&&(qe=Le[1]-Re[3]),Le[3]<Re[1]&&(qe=Re[1]-Le[3]),Oe.distance([0,0],[Ue,qe])}function ln(Le){return 360*Le-180}function un(Le){return 360/Math.PI*Math.atan(Math.exp((180-360*Le)*Math.PI/180))-90}function cn(Le,Re){const Oe=Math.pow(2,Re.z),Ue=(Le.y/ud+Re.y)/Oe;return[ln((Le.x/ud+Re.x)/Oe),un(Ue)]}function hn(Le,Re){const Oe=[];for(let Ue=0;Ue<Le.length;++Ue)Oe.push(cn(Le[Ue],Re));return Oe}function pn(Le,Re,Oe){const Ue=Oe.pointOnLine(Re,Le).point;return Oe.distance(Le,Ue)}function fn(Le,Re,Oe,Ue,qe){const Ct=Oe.slice(Ue[0],Ue[1]+1);let Ot=1/0;for(let Oe=Re[0];Oe<=Re[1];++Oe)if(0===(Ot=Math.min(Ot,pn(Le[Oe],Ct,qe))))return 0;return Ot}function dn(Le,Re,Oe,Ue,qe){const Ct=Math.min(qe.pointToSegmentDistance(Le,Oe,Ue),qe.pointToSegmentDistance(Re,Oe,Ue)),Ot=Math.min(qe.pointToSegmentDistance(Oe,Le,Re),qe.pointToSegmentDistance(Ue,Le,Re));return Math.min(Ct,Ot)}function mn(Le,Re,Oe,Ue,qe){if(!rn(Re,Le.length)||!rn(Ue,Oe.length))return NaN;let Ct=1/0;for(let Ot=Re[0];Ot<Re[1];++Ot)for(let Re=Ue[0];Re<Ue[1];++Re){if(zr(Le[Ot],Le[Ot+1],Oe[Re],Oe[Re+1]))return 0;Ct=Math.min(Ct,dn(Le[Ot],Le[Ot+1],Oe[Re],Oe[Re+1],qe))}return Ct}function yn(Le,Re,Oe,Ue,qe){if(!rn(Re,Le.length)||!rn(Ue,Oe.length))return NaN;let Ct=1/0;for(let Ot=Re[0];Ot<=Re[1];++Ot)for(let Re=Ue[0];Re<=Ue[1];++Re)if(0===(Ct=Math.min(Ct,qe.distance(Le[Ot],Oe[Re]))))return Ct;return Ct}function gn(Le,Re,Oe){if(Ir(Le,Re,!0))return 0;let Ue=1/0;for(const qe of Re){const Re=qe.length;if(Re<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(qe[0]!==qe[Re-1]&&0===(Ue=Math.min(Ue,Oe.pointToSegmentDistance(Le,qe[Re-1],qe[0]))))return Ue;if(0===(Ue=Math.min(Ue,pn(Le,qe,Oe))))return Ue}return Ue}function xn(Le,Re,Oe,Ue){if(!rn(Re,Le.length))return NaN;for(let Ue=Re[0];Ue<=Re[1];++Ue)if(Ir(Le[Ue],Oe,!0))return 0;let qe=1/0;for(let Ct=Re[0];Ct<Re[1];++Ct)for(const Re of Oe)for(let Oe=0,Ot=Re.length,Jt=Ot-1;Oe<Ot;Jt=Oe++){if(zr(Le[Ct],Le[Ct+1],Re[Jt],Re[Oe]))return 0;qe=Math.min(qe,dn(Le[Ct],Le[Ct+1],Re[Jt],Re[Oe],Ue))}return qe}function bn(Le,Re){for(const Oe of Le)for(let Le=0;Le<=Oe.length-1;++Le)if(Ir(Oe[Le],Re,!0))return!0;return!1}function vn(Le,Re,Oe,Ue=1/0){const qe=an(Le),Ct=an(Re);if(Ue!==1/0&&on(qe,Ct,Oe)>=Ue)return Ue;if(Ar(qe,Ct)){if(bn(Le,Re))return 0}else if(bn(Re,Le))return 0;let Ot=Ue;for(const Ue of Le)for(let Le=0,qe=Ue.length,Ct=qe-1;Le<qe;Ct=Le++)for(const qe of Re)for(let Re=0,Jt=qe.length,_i=Jt-1;Re<Jt;_i=Re++){if(zr(Ue[Ct],Ue[Le],qe[_i],qe[Re]))return 0;Ot=Math.min(Ot,dn(Ue[Ct],Ue[Le],qe[_i],qe[Re],Oe))}return Ot}function wn(Le,Re,Oe,Ue,qe,Ct,Ot){if(null===Ct||null===Ot)return;const Jt=on(sn(Ue,Ct),sn(qe,Ot),Oe);Jt<Re&&Le.push({dist:Jt,range1:Ct,range2:Ot})}function _n(Le,Re,Oe,Ue,qe=1/0){let Ct=Math.min(Ue.distance(Le[0],Oe[0][0]),qe);if(0===Ct)return Ct;const Ot=new Wr([{dist:0,range1:[0,Le.length-1],range2:[0,0]}],Kr),Jt=Re?xd:_d,_i=an(Oe);for(;Ot.length;){const qe=Ot.pop();if(qe.dist>=Ct)continue;const xi=qe.range1;if(en(xi)<=Jt){if(!rn(xi,Le.length))return NaN;if(Re){const Re=xn(Le,xi,Oe,Ue);if(0===(Ct=Math.min(Ct,Re)))return Ct}else for(let Re=xi[0];Re<=xi[1];++Re){const qe=gn(Le[Re],Oe,Ue);if(0===(Ct=Math.min(Ct,qe)))return Ct}}else{const Oe=nn(xi,Re);if(null!==Oe[0]){const Re=on(sn(Le,Oe[0]),_i,Ue);Re<Ct&&Ot.push({dist:Re,range1:Oe[0],range2:[0,0]})}if(null!==Oe[1]){const Re=on(sn(Le,Oe[1]),_i,Ue);Re<Ct&&Ot.push({dist:Re,range1:Oe[1],range2:[0,0]})}}}return Ct}function Mn(Le,Re,Oe,Ue,qe,Ct=1/0){let Ot=Math.min(Ct,qe.distance(Le[0],Oe[0]));if(0===Ot)return Ot;const Jt=new Wr([{dist:0,range1:[0,Le.length-1],range2:[0,Oe.length-1]}],Kr),_i=Re?xd:_d,xi=Ue?xd:_d;for(;Jt.length;){const Ct=Jt.pop();if(Ct.dist>=Ot)continue;const vi=Ct.range1,bi=Ct.range2;if(en(vi)<=_i&&en(bi)<=xi){if(!rn(vi,Le.length)||!rn(bi,Oe.length))return NaN;if(Re&&Ue?Ot=Math.min(Ot,mn(Le,vi,Oe,bi,qe)):Re||Ue?Re&&!Ue?Ot=Math.min(Ot,fn(Oe,bi,Le,vi,qe)):!Re&&Ue&&(Ot=Math.min(Ot,fn(Le,vi,Oe,bi,qe))):Ot=Math.min(Ot,yn(Le,vi,Oe,bi,qe)),0===Ot)return Ot}else{const Ct=nn(vi,Re),_i=nn(bi,Ue);wn(Jt,Ot,qe,Le,Oe,Ct[0],_i[0]),wn(Jt,Ot,qe,Le,Oe,Ct[0],_i[1]),wn(Jt,Ot,qe,Le,Oe,Ct[1],_i[0]),wn(Jt,Ot,qe,Le,Oe,Ct[1],_i[1])}}return Ot}function An(Le,Re,Oe,Ue,qe=1/0){let Ct=qe;const Ot=sn(Le,[0,Le.length-1]);for(const qe of Oe)if(!(Ct!==1/0&&on(Ot,sn(qe,[0,qe.length-1]),Ue)>=Ct)&&(Ct=Math.min(Ct,Mn(Le,Re,qe,!0,Ue,Ct)),0===Ct))return Ct;return Ct}function Sn(Le,Re,Oe,Ue,qe=1/0){let Ct=qe;const Ot=sn(Le,[0,Le.length-1]);for(const qe of Oe){if(Ct!==1/0&&on(Ot,an(qe),Ue)>=Ct)continue;const Oe=_n(Le,Re,qe,Ue,Ct);if(isNaN(Oe))return Oe;if(0===(Ct=Math.min(Ct,Oe)))return Ct}return Ct}function In(Le){return"Point"===Le||"MultiPoint"===Le||"LineString"===Le||"MultiLineString"===Le||"Polygon"===Le||"MultiPolygon"===Le}class Pn{constructor(Le,Re){this.type=su,this.geojson=Le,this.geometries=Re}static parse(Le,Re){if(2!==Le.length)return Re.error(`'distance' expression requires either one argument, but found ' ${Le.length-1} instead.`);if(rr(Le[1])){const Re=Le[1];if("FeatureCollection"===Re.type){for(let Le=0;Le<Re.features.length;++Le)if(In(Re.features[Le].geometry.type))return new Pn(Re,Re.features[Le].geometry)}else if("Feature"===Re.type){if(In(Re.geometry.type))return new Pn(Re,Re.geometry)}else if(In(Re.type))return new Pn(Re,Re)}return Re.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(Le){const Re=Le.geometry(),Oe=Le.canonicalID();if(null!=Re&&null!=Oe){if("Point"===Le.geometryType())return function(Le,Re,Oe){const Ue=[];for(const Oe of Le)for(const Le of Oe)Ue.push(cn(Le,Re));const qe=new Gr(Ue[0][1],"meters");return"Point"===Oe.type||"MultiPoint"===Oe.type||"LineString"===Oe.type?Mn(Ue,!1,"Point"===Oe.type?[Oe.coordinates]:Oe.coordinates,"LineString"===Oe.type,qe):"MultiLineString"===Oe.type?An(Ue,!1,Oe.coordinates,qe):"Polygon"===Oe.type||"MultiPolygon"===Oe.type?Sn(Ue,!1,"Polygon"===Oe.type?[Oe.coordinates]:Oe.coordinates,qe):null}(Re,Oe,this.geometries);if("LineString"===Le.geometryType())return function(Le,Re,Oe){const Ue=[];for(const Oe of Le){const Le=[];for(const Ue of Oe)Le.push(cn(Ue,Re));Ue.push(Le)}const qe=new Gr(Ue[0][0][1],"meters");if("Point"===Oe.type||"MultiPoint"===Oe.type||"LineString"===Oe.type)return An("Point"===Oe.type?[Oe.coordinates]:Oe.coordinates,"LineString"===Oe.type,Ue,qe);if("MultiLineString"===Oe.type){let Le=1/0;for(let Re=0;Re<Oe.coordinates.length;Re++){const Ct=An(Oe.coordinates[Re],!0,Ue,qe,Le);
1if(isNaN(Ct))return Ct;if(0===(Le=Math.min(Le,Ct)))return Le}return Le}if("Polygon"===Oe.type||"MultiPolygon"===Oe.type){let Le=1/0;for(let Re=0;Re<Ue.length;Re++){const Ct=Sn(Ue[Re],!0,"Polygon"===Oe.type?[Oe.coordinates]:Oe.coordinates,qe,Le);if(isNaN(Ct))return Ct;if(0===(Le=Math.min(Le,Ct)))return Le}return Le}return null}(Re,Oe,this.geometries);if("Polygon"===Le.geometryType())return function(Le,Re,Oe){const Ue=[];for(const Oe of function(Le,Re){const Oe=Le.length;if(Oe<=1)return[Le];const Ue=[];let qe,Ct;for(let Re=0;Re<Oe;Re++){const Oe=_r(Le[Re]);0!==Oe&&(Le[Re].area=Math.abs(Oe),void 0===Ct&&(Ct=Oe<0),Ct===Oe<0?(qe&&Ue.push(qe),qe=[Le[Re]]):qe.push(Le[Re]))}return qe&&Ue.push(qe),Ue}(Le)){const Le=[];for(let Ue=0;Ue<Oe.length;++Ue)Le.push(hn(Oe[Ue],Re));Ue.push(Le)}const qe=new Gr(Ue[0][0][0][1],"meters");if("Point"===Oe.type||"MultiPoint"===Oe.type||"LineString"===Oe.type)return Sn("Point"===Oe.type?[Oe.coordinates]:Oe.coordinates,"LineString"===Oe.type,Ue,qe);if("MultiLineString"===Oe.type){let Le=1/0;for(let Re=0;Re<Oe.coordinates.length;Re++){const Ct=Sn(Oe.coordinates[Re],!0,Ue,qe,Le);if(isNaN(Ct))return Ct;if(0===(Le=Math.min(Le,Ct)))return Le}return Le}return"Polygon"===Oe.type||"MultiPolygon"===Oe.type?function(Le,Re,Oe){let Ue=1/0;for(const qe of Le)for(const Le of Re){const Re=vn(qe,Le,Oe,Ue);if(isNaN(Re))return Re;if(0===(Ue=Math.min(Ue,Re)))return Ue}return Ue}("Polygon"===Oe.type?[Oe.coordinates]:Oe.coordinates,Ue,qe):null}(Re,Oe,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function zn(Le,Re){switch(Le){case"string":return ir(Re);case"number":return+Re;case"boolean":return!!Re;case"color":return Pe.parse(Re);case"formatted":return Qe.fromString(ir(Re));case"resolvedImage":return tr.fromString(ir(Re))}return Re}function kn(Le,Re,Oe,Ue){return void 0!==Ue&&(Le=Ue*Math.round(Le/Ue)),void 0!==Re&&Le<Re&&(Le=Re),void 0!==Oe&&Le>Oe&&(Le=Oe),Le}class Tn{constructor(Le,Re,Oe){this.type=Le,this.key=Re,this.scope=Oe}static parse(Le,Re){let Oe=Re.expectedType;if(null==Oe&&(Oe=Ou),Le.length<2||Le.length>3)return Re.error("Invalid number of arguments for 'config' expression.");const Ue=Re.parse(Le[1],1);if(!(Ue instanceof sr))return Re.error("Key name of 'config' expression must be a string literal.");if(Le.length>=3){const qe=Re.parse(Le[2],2);return qe instanceof sr?new Tn(Oe,ir(Ue.value),ir(qe.value)):Re.error("Scope of 'config' expression must be a string literal.")}return new Tn(Oe,ir(Ue.value))}evaluate(Le){const Re=[this.key,this.scope,Le.scope].filter(Boolean).join("�"),Oe=Le.getConfig(Re);if(!Oe)return null;const{type:Ue,value:qe,values:Ct,minValue:Ot,maxValue:Jt,stepValue:_i}=Oe,xi=Oe.default.evaluate(Le);let vi=xi;if(qe){const Re=Le.scope;Le.scope=(Re||"").split("�").slice(1).join("�"),vi=qe.evaluate(Le),Le.scope=Re}return Ue&&(vi=zn(Ue,vi)),void 0===vi||void 0===Ot&&void 0===Jt&&void 0===_i||("number"==typeof vi?vi=kn(vi,Ot,Jt,_i):Array.isArray(vi)&&(vi=vi.map((Le=>"number"==typeof Le?kn(Le,Ot,Jt,_i):Le)))),void 0!==qe&&void 0!==vi&&Ct&&!Ct.includes(vi)&&(vi=xi,Ue&&(vi=zn(Ue,vi))),(Ue&&Ue!==this.type||void 0!==vi&&nr(vi)!==this.type)&&(vi=zn(this.type.kind,vi)),vi}eachChild(){}outputDefined(){return!1}serialize(){const Le=["config",this.key];return this.scope&&Le.concat(this.key),Le}}function En(Le){if(Le instanceof yr){if("get"===Le.name&&1===Le.args.length)return!1;if("feature-state"===Le.name)return!1;if("has"===Le.name&&1===Le.args.length)return!1;if("properties"===Le.name||"geometry-type"===Le.name||"id"===Le.name)return!1;if(/^filter-/.test(Le.name))return!1}if(Le instanceof Ur)return!1;if(Le instanceof Pn)return!1;let Re=!0;return Le.eachChild((Le=>{Re&&!En(Le)&&(Re=!1)})),Re}function Bn(Le){if(Le instanceof yr&&"feature-state"===Le.name)return!1;let Re=!0;return Le.eachChild((Le=>{Re&&!Bn(Le)&&(Re=!1)})),Re}function Vn(Le){if(Le instanceof Tn)return new Set([Le.key]);let Re=new Set;return Le.eachChild((Le=>{Re=new Set([...Re,...Vn(Le)])}
vendor: 8,616 bytes, line 1
1)),Re}function Cn(Le,Re){if(Le instanceof yr&&Re.indexOf(Le.name)>=0)return!1;let Oe=!0;return Le.eachChild((Le=>{Oe&&!Cn(Le,Re)&&(Oe=!1)})),Oe}class Rn{constructor(Le,Re){this.type=Re.type,this.name=Le,this.boundExpression=Re}static parse(Le,Re){if(2!==Le.length||"string"!=typeof Le[1])return Re.error("'var' expression requires exactly one string literal argument.");const Oe=Le[1];return Re.scope.has(Oe)?new Rn(Oe,Re.scope.get(Oe)):Re.error(`Unknown variable "${Oe}". Make sure "${Oe}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(Le){return this.boundExpression.evaluate(Le)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Dn{constructor(Le,Re=[],Oe,Ue=new Ce,qe=[],Ct,Ot){this.registry=Le,this.path=Re,this.key=Re.map((Le=>"string"==typeof Le?`['${Le}']`:`[${Le}]`)).join(""),this.scope=Ue,this.errors=qe,this.expectedType=Oe,this._scope=Ct,this.options=Ot}parse(Le,Re,Oe,Ue,qe={}){return Re||Oe?this.concat(Re,null,Oe,Ue)._parse(Le,qe):this._parse(Le,qe)}parseObjectValue(Le,Re,Oe,Ue,qe,Ct={}){return this.concat(Re,Oe,Ue,qe)._parse(Le,Ct)}_parse(Le,Re){function r(Le,Re,Oe){return"assert"===Oe?new lr(Re,[Le]):"coerce"===Oe?new fr(Re,[Le]):Le}if(null!==Le&&"string"!=typeof Le&&"boolean"!=typeof Le&&"number"!=typeof Le||(Le=["literal",Le]),Array.isArray(Le)){if(0===Le.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const Oe="string"==typeof Le[0]?this.registry[Le[0]]:void 0;if(Oe){let Ue=Oe.parse(Le,this);if(!Ue)return null;if(this.expectedType){const Le=this.expectedType,Oe=Ue.type;if("string"!==Le.kind&&"number"!==Le.kind&&"boolean"!==Le.kind&&"object"!==Le.kind&&"array"!==Le.kind||"value"!==Oe.kind)if("color"!==Le.kind&&"formatted"!==Le.kind&&"resolvedImage"!==Le.kind||"value"!==Oe.kind&&"string"!==Oe.kind){if(this.checkSubtype(Le,Oe))return null}else Ue=r(Ue,Le,Re.typeAnnotation||"coerce");else Ue=r(Ue,Le,Re.typeAnnotation||"assert")}if(!(Ue instanceof sr)&&"resolvedImage"!==Ue.type.kind&&Fn(Ue)){const Re=new mr(this._scope,this.options);try{Ue=new sr(Ue.type,Ue.evaluate(Re))}catch(Le){return this.error(Le.message),null}}return Ue}return fr.parse(["to-array",Le],this)}return this.error(void 0===Le?"'undefined' value invalid. Use null instead.":"object"==typeof Le?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof Le} instead.`)}concat(Le,Re,Oe,Ue){let qe="number"==typeof Le?this.path.concat(Le):this.path;qe="string"==typeof Re?qe.concat(Re):qe;const Ct=Ue?this.scope.concat(Ue):this.scope;return new Dn(this.registry,qe,Oe||null,Ct,this.errors,this._scope,this.options)}error(Le,...Re){const Oe=`${this.key}${Re.map((Le=>`[${Le}]`)).join("")}`;this.errors.push(new Ve(Oe,Le))}checkSubtype(Le,Re){const Oe=Ze(Le,Re);return Oe&&this.error(Oe),Oe}}var wd=Dn;function Fn(Le){if(Le instanceof Rn)return Fn(Le.boundExpression);if(Le instanceof yr&&"error"===Le.name)return!1;if(Le instanceof xr)return!1;if(Le instanceof Ur)return!1;if(Le instanceof Pn)return!1;if(Le instanceof Tn)return!1;const Re=Le instanceof fr||Le instanceof lr;let Oe=!0;return Le.eachChild((Le=>{Oe=Re?Oe&&Fn(Le):Oe&&Le instanceof sr})),!!Oe&&En(Le)&&Cn(Le,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function On(Le,Re){const Oe=Le.length-1;let Ue,qe,Ct=0,Ot=Oe,Jt=0;for(;Ct<=Ot;)if(Jt=Math.floor((Ct+Ot)/2),Ue=Le[Jt],qe=Le[Jt+1],Ue<=Re){if(Jt===Oe||Re<qe)return Jt;Ct=Jt+1}else{if(!(Ue>Re))throw new ar("Input is not a number.");Ot=Jt-1}return 0}class Un{constructor(Le,Re,Oe){this.type=Le,this.input=Re,this.labels=[],this.outputs=[];for(const[Le,Re]of Oe)this.labels.push(Le),this.outputs.push(Re)}static parse(Le,Re){if(Le.length-1<4)return Re.error(`Expected at least 4 arguments, but found only ${Le.length-1}.`);if((Le.length-1)%2!=0)return Re.error("Expected an even number of arguments.");const Oe=Re.parse(Le[1],1,su);if(!Oe)return null;const Ue=[];let qe=null;Re.expectedType&&"value"!==Re.expectedType.kind&&(qe=Re.expectedType);for(let Oe=1;Oe<Le.length;Oe+=2){const Ct=1===Oe?-1/0:Le[Oe],Ot=Le[Oe+1],Jt=Oe,_i=Oe+1;if("number"!=typeof Ct)return Re.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Jt);if(Ue.length&&Ue[Ue.length-1][0]>=Ct)return Re.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',Jt);const xi=Re.parse(Ot,_i,qe);if(!xi)return null;qe=qe||xi.type,Ue.push([Ct,xi])}return new Un(qe,Oe,Ue)}evaluate(Le){const Re=this.labels,Oe=this.outputs;if(1===Re.length)return Oe[0].evaluate(Le);const Ue=this.input.evaluate(Le);if(Ue<=Re[0])return Oe[0].evaluate(Le);const qe=Re.length;return Ue>=Re[qe-1]?Oe[qe-1].evaluate(Le):Oe[On(Re,Ue)].evaluate(Le)}eachChild(Le){Le(this.input);for(const Re of this.outputs)Le(Re)}outputDefined(){return this.outputs.every((Le=>Le.outputDefined()))}serialize(){const Le=["step",this.input.serialize()];for(let Re=0;Re<this.labels.length;Re++)Re>0&&Le.push(this.labels[Re]),Le.push(this.outputs[Re].serialize());return Le}}const Md=.95047,Sd=1.08883,Ad=4/29,Cd=6/29,zd=3*Cd*Cd,Od=Cd*Cd*Cd,Bd=Math.PI/180,Ud=180/Math.PI;function Wn(Le){return Le>Od?Math.pow(Le,1/3):Le/zd+Ad}function Hn(Le){return Le>Cd?Le*Le*Le:zd*(Le-Ad)}function Kn(Le){return 255*(Le<=.0031308?12.92*Le:1.055*Math.pow(Le,1/2.4)-.055)}function Jn(Le){return(Le/=255)<=.04045?Le/12.92:Math.pow((Le+.055)/1.055,2.4)}function Qn(Le){const Re=Jn(Le.r),Oe=Jn(Le.g),Ue=Jn(Le.b),qe=Wn((.4124564*Re+.3575761*Oe+.1804375*Ue)/Md),Ct=Wn((.2126729*Re+.7151522*Oe+.072175*Ue)/1);return{l:116*Ct-16,a:500*(qe-Ct),b:200*(Ct-Wn((.0193339*Re+.119192*Oe+.9503041*Ue)/Sd)),alpha:Le.a}}function ti(Le){let Re=(Le.l+16)/116,Oe=isNaN(Le.a)?Re:Re+Le.a/500,Ue=isNaN(Le.b)?Re:Re-Le.b/200;return Re=1*Hn(Re),Oe=Md*Hn(Oe),Ue=Sd*Hn(Ue),new Pe(Kn(3.2404542*Oe-1.5371385*Re-.4985314*Ue),Kn(-.969266*Oe+1.8760108*Re+.041556*Ue),Kn(.0556434*Oe-.2040259*Re+1.0572252*Ue),Le.alpha)}function ei(Le,Re,Oe){const Ue=Re-Le;return Le+Oe*(Ue>180||Ue<-180?Ue-360*Math.round(Ue/360):Ue)}const Hd={forward:Qn,reverse:ti,interpolate:function(Le,Re,Oe){return{l:ke(Le.l,Re.l,Oe),a:ke(Le.a,Re.a,Oe),b:ke(Le.b,Re.b,Oe),alpha:ke(Le.alpha,Re.alpha,Oe)}}},Wd={forward:function(Le){const{l:Re,a:Oe,b:Ue}=Qn(Le),qe=Math.atan2(Ue,Oe)*Ud;return{h:qe<0?qe+360:qe,c:Math.sqrt(Oe*Oe+Ue*Ue),l:Re,alpha:Le.a}},reverse:function(Le){const Re=Le.h*Bd,Oe=Le.c;return ti({l:Le.l,a:Math.cos(Re)*Oe,b:Math.sin(Re)*Oe,alpha:Le.alpha})},interpolate:function(Le,Re,Oe){return{h:ei(Le.h,Re.h,Oe),c:ke(Le.c,Re.c,Oe),l:ke(Le.l,Re.l,Oe),alpha:ke(Le.alpha,Re.alpha,Oe)}}};var Kd=Object.freeze({__proto__:null,hcl:Wd,lab:Hd});class si{constructor(Le,Re,Oe,Ue,qe){this.type=Le,this.operator=Re,this.interpolation=Oe,this.input=Ue,this.labels=[],this.outputs=[];for(const[Le,Re]of qe)this.labels.push(Le),this.outputs.push(Re)}static interpolationFactor(Le,Re,Oe,Ue){let qe=0;if("exponential"===Le.name)qe=ai(Re,Le.base,Oe,Ue);else if("linear"===Le.name)qe=ai(Re,1,Oe,Ue);else if("cubic-bezier"===Le.name){const Ct=Le.controlPoints;qe=new Xs(Ct[0],Ct[1],Ct[2],Ct[3]).solve(ai(Re,1,Oe,Ue))}return qe}static parse(Le,Re){let[Oe,Ue,qe,...Ct]=Le;if(!Array.isArray(Ue)||0===Ue.length)return Re.error("Expected an interpolation type expression.",1);if("linear"===Ue[0])Ue={name:"linear"};else if("exponential"===Ue[0]){const Le=Ue[1];if("number"!=typeof Le)return Re.error("Exponential interpolation requires a numeric base.",1,1);Ue={name:"exponential",base:Le}}else{if("cubic-bezier"!==Ue[0])return Re.error(`Unknown interpolation type ${String(Ue[0])}`,1,0);{const Le=Ue.slice(1);if(4!==Le.length||Le.some((Le=>"number"!=typeof Le||Le<0||Le>1)))return Re.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);Ue={name:"cubic-bezier",controlPoints:Le}}}if(Le.length-1<4)return Re.error(`Expected at least 4 arguments, but found only ${Le.length-1}.`);if((Le.length-1)%2!=0)return Re.error("Expected an even number of arguments.");if(qe=Re.parse(qe,2,su),!qe)return null;const Ot=[];let Jt=null;"interpolate-hcl"===Oe||"interpolate-lab"===Oe?Jt=xu:Re.expectedType&&"value"!==Re.expectedType.kind&&(Jt=Re.expectedType);for(let Le=0;Le<Ct.length;Le+=2){const Oe=Ct[Le],Ue=Ct[Le+1],qe=Le+3,_i=Le+4;if("number"!=typeof Oe)return Re.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',qe);if(Ot.length&&Ot[Ot.length-1][0]>=Oe)return Re.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',qe);const xi=Re.parse(Ue,_i,Jt);if(!xi)return null;Jt=Jt||xi.type,Ot.push([Oe,xi])}return"number"===Jt.kind||"color"===Jt.kind||"array"===Jt.kind&&"number"===Jt.itemType.kind&&"number"==typeof Jt.N?new si(Jt,Oe,Ue,qe,Ot):Re.error(`Type ${Xe(Jt)} is not interpolatable.`)}evaluate(Le){const Re=this.labels,Oe=this.outputs;if(1===Re.length)return Oe[0].evaluate(Le);const Ue=this.input.evaluate(Le);if(Ue<=Re[0])return Oe[0].evaluate(Le);const qe=Re.length;if(Ue>=Re[qe-1])return Oe[qe-1].evaluate(Le);const Ct=On(Re,Ue),Ot=si.interpolationFactor(this.interpolation,Ue,Re[Ct],Re[Ct+1]),Jt=Oe[Ct].evaluate(Le),_i=Oe[Ct+1].evaluate(Le);return"interpolate"===this.operator?iu[this.type.kind.toLowerCase()](Jt,_i,Ot):"interpolate-hcl"===this.operator?Wd.reverse(Wd.interpolate(Wd.forward(Jt),Wd.forward(_i),Ot)):Hd.reverse(Hd.interpolate(Hd.forward(Jt),Hd.forward(_i),Ot))}eachChild(Le){Le(this.input);for(const Re of this.outputs)Le(Re)}outputDefined(){return this.outputs.every((Le=>Le.outputDefined()))}serialize(){let Le;Le="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const Re=[this.operator,Le,this.input.serialize()];for(let Le=0;Le<this.labels.length;Le++)Re.push(this.labels[Le],this.outputs[Le].serialize());return Re}}function ai(Le,Re,Oe,Ue){const qe=Ue-Oe,Ct=Le-Oe;return 0===qe?0:1===Re?Ct/qe:(Math.pow(Re,Ct)-1)/(Math.pow(Re,qe)-1)}class oi{constructor(Le,Re){this.type=Le,this.args=Re}static parse(Le,Re){if(Le.length<2)return Re.error("Expectected at least one argument.");let Oe=null;const Ue=Re.expectedType;Ue&&"value"!==Ue.kind&&(Oe=Ue);const qe=[];for(const Ue of Le.slice(1)){const Le=Re.parse(Ue,1+qe.length,Oe,void 0,{typeAnnotation:"omit"});if(!Le)return null;Oe=Oe||Le.type,qe.push(Le)}const Ct=Ue&&qe.some((Le=>Ze(Ue,Le.type)));return new oi(Ct?Ou:Oe,qe)}evaluate(Le){let Re,Oe=null,Ue=0;for(const qe of this.args){if(Ue++,Oe=qe.evaluate(Le),Oe&&Oe instanceof tr&&!Oe.available&&(Re||(Re=Oe),Oe=null,Ue===this.args.length))return Re;if(null!==Oe)break}return Oe}eachChild(Le){this.args.forEach(Le)}outputDefined(){return this.args.every((Le=>Le.outputDefined()))}serialize(){const Le=["coalesce"];return this.eachChild((Re=>{Le.push(Re.serialize())})),Le}}class li{constructor(Le,Re){this.type=Re.type,this.bindings=[].concat(Le),this.result=Re}evaluate(Le){return this.result.evaluate(Le)}eachChild(Le){for(const Re of this.bindings)Le(Re[1]);Le(this.result)}static parse(Le,Re){if(Le.length<4)return Re.error(`Expected at least 3 arguments, but found ${Le.length-1} instead.`);const Oe=[];for(let Ue=1;Ue<Le.length-1;Ue+=2){const qe=Le[Ue];if("string"!=typeof qe)return Re.error(`Expected string, but found ${typeof qe} instead.`,Ue);if(/[^a-zA-Z0-9_]/.test(qe))return Re.error("Variable names must contain only alphanumeric characters or '_'.",Ue);const Ct=Re.parse(Le[Ue+1],Ue+1);if(!Ct)return null;Oe.push([qe,Ct])}const Ue=Re.parse(Le[Le.length-1],Le.length-1,Re.expectedType,Oe);return Ue?new li(Oe,Ue):null}outputDefined(){return this.result.outputDefined()}serialize(){const Le=["let"];for(const[Re,Oe]of this.bindings)Le.push(Re,Oe.serialize());return Le.push(this.result.serialize()),Le}}class ui{constructor(Le,Re,Oe){this.type=Le,this.index=Re,this.input=Oe}static parse(Le,Re){if(3!==Le.length)return Re.error(`Expected 2 arguments, but found ${Le.length-1} instead.`);const Oe=Re.parse(Le[1],1,su),Ue=Re.parse(Le[2],2,Ge(Re.expectedType||Ou));return Oe&&Ue?new ui(Ue.type.itemType,Oe,Ue):null}evaluate(Le){const Re=this.index.evaluate(Le),Oe=this.input.evaluate(Le);if(Re<0)throw new ar(`Array index out of bounds: ${Re} < 0.`);if(Re>=Oe.length)throw new ar(`Array index out of bounds: ${Re} > ${Oe.length-1}.`);if(Re!==Math.floor(Re))throw new ar(`Array index must be an integer, but found ${Re} instead.`);return Oe[Re]}eachChild(Le){Le(this.index),Le(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class ci{constructor(Le,Re){this.type=lu,this.needle=Le,this.haystack=Re}static parse(Le,Re){if(3!==Le.length)return Re.error(`Expected 2 arguments, but found ${Le.length-1} instead.`);const Oe=Re.parse(Le[1],1,Ou),Ue=Re.parse(Le[2],2,Ou);return Oe&&Ue?We(Oe.type,[lu,au,su,ou,Ou])?new ci(Oe,Ue):Re.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(Oe.type)} instead`):null}evaluate(Le){const Re=this.needle.evaluate(Le),Oe=this.haystack.evaluate(Le);if(null==Oe)return!1;if(!He(Re,["boolean","string","number","null"]))throw new ar(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(nr(
1Re))} instead.`);if(!He(Oe,["string","array"]))throw new ar(`Expected second argument to be of type array or string, but found ${Xe(nr(Oe))} instead.`);return Oe.indexOf(Re)>=0}eachChild(Le){Le(this.needle),Le(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class hi{constructor(Le,Re,Oe){this.type=su,this.needle=Le,this.haystack=Re,this.fromIndex=Oe}static parse(Le,Re){if(Le.length<=2||Le.length>=5)return Re.error(`Expected 3 or 4 arguments, but found ${Le.length-1} instead.`);const Oe=Re.parse(Le[1],1,Ou),Ue=Re.parse(Le[2],2,Ou);if(!Oe||!Ue)return null;if(!We(Oe.type,[lu,au,su,ou,Ou]))return Re.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(Oe.type)} instead`);if(4===Le.length){const qe=Re.parse(Le[3],3,su);return qe?new hi(Oe,Ue,qe):null}return new hi(Oe,Ue)}evaluate(Le){const Re=this.needle.evaluate(Le),Oe=this.haystack.evaluate(Le);if(!He(Re,["boolean","string","number","null"]))throw new ar(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(nr(Re))} instead.`);if(!He(Oe,["string","array"]))throw new ar(`Expected second argument to be of type array or string, but found ${Xe(nr(Oe))} instead.`);if(this.fromIndex){const Ue=this.fromIndex.evaluate(Le);return Oe.indexOf(Re,Ue)}return Oe.indexOf(Re)}eachChild(Le){Le(this.needle),Le(this.haystack),this.fromIndex&&Le(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const Le=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),Le]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class pi{constructor(Le,Re,Oe,Ue,qe,Ct){this.inputType=Le,this.type=Re,this.input=Oe,this.cases=Ue,this.outputs=qe,this.otherwise=Ct}static parse(Le,Re){if(Le.length<5)return Re.error(`Expected at least 4 arguments, but found only ${Le.length-1}.`);if(Le.length%2!=1)return Re.error("Expected an even number of arguments.");let Oe,Ue;Re.expectedType&&"value"!==Re.expectedType.kind&&(Ue=Re.expectedType);const qe={},Ct=[];for(let Ot=2;Ot<Le.length-1;Ot+=2){let Jt=Le[Ot];const _i=Le[Ot+1];Array.isArray(Jt)||(Jt=[Jt]);const xi=Re.concat(Ot);if(0===Jt.length)return xi.error("Expected at least one branch label.");for(const Le of Jt){if("number"!=typeof Le&&"string"!=typeof Le)return xi.error("Branch labels must be numbers or strings.");if("number"==typeof Le&&Math.abs(Le)>Number.MAX_SAFE_INTEGER)return xi.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof Le&&Math.floor(Le)!==Le)return xi.error("Numeric branch labels must be integer values.");if(Oe){if(xi.checkSubtype(Oe,nr(Le)))return null}else Oe=nr(Le);if(void 0!==qe[String(Le)])return xi.error("Branch labels must be unique.");qe[String(Le)]=Ct.length}const vi=Re.parse(_i,Ot,Ue);if(!vi)return null;Ue=Ue||vi.type,Ct.push(vi)}const Ot=Re.parse(Le[1],1,Ou);if(!Ot)return null;const Jt=Re.parse(Le[Le.length-1],Le.length-1,Ue);return Jt?"value"!==Ot.type.kind&&Re.concat(1).checkSubtype(Oe,Ot.type)?null:new pi(Oe,Ue,Ot,qe,Ct,Jt):null}evaluate(Le){const Re=this.input.evaluate(Le);return(nr(Re)===this.inputType&&this.outputs[this.cases[Re]]||this.otherwise).evaluate(Le)}eachChild(Le){Le(this.input),this.outputs.forEach(Le),Le(this.otherwise)}outputDefined(){return this.outputs.every((Le=>Le.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const Le=["match",this.input.serialize()],Re=Object.keys(this.cases).sort(),Oe=[],Ue={};for(const Le of Re){const Re=Ue[this.cases[Le]];void 0===Re?(Ue[this.cases[Le]]=Oe.length,Oe.push([this.cases[Le],[Le]])):Oe[Re][1].push(Le)}const i=Le=>"number"===this.inputType.kind?Number(Le):Le;for(const[Re,Ue]of Oe)Le.push(1===Ue.length?i(Ue[0]):Ue.map(i)),Le.push(this.outputs[Re].serialize());return Le.push(this.otherwise.serialize()),Le}}class fi{constructor(Le,Re,Oe){this.type=Le,this.branches=Re,this.otherwise=Oe}static parse(Le,Re){if(Le.length<4)return Re.error(`Expected at least 3 arguments, but found only ${Le.length-1}.`);if(Le.length%2!=0)return Re.error("Expected an odd number of arguments.");let Oe;Re.expectedType&&"value"!==Re.expectedType.kind&&(Oe=Re.expectedType);const Ue=[];for(let qe=1;qe<Le.length-1;qe+=2){const Ct=Re.parse(Le[qe],qe,lu);if(!Ct)return null;const Ot=Re.parse(Le[qe+1],qe+1,Oe);if(!Ot)return null;Ue.push([Ct,Ot]),Oe=Oe||Ot.type}const qe=Re.parse(Le[Le.length-1],Le.length-1,Oe);return qe?new fi(Oe,Ue,qe):null}evaluate(Le){for(const[Re,Oe]of this.branches)if(Re.evaluate(Le))return Oe.evaluate(Le);return this.otherwise.evaluate(Le)}eachChild(Le){for(const[Re,Oe]of this.branches)Le(Re),Le(Oe);Le(this.otherwise)}outputDefined(){return this.branches.every((([Le,Re])=>Re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const Le=["case"];return this.eachChild((Re=>{Le.push(Re.serialize())})),Le}}class di{constructor(Le,Re,Oe,Ue){this.type=Le,this.input=Re,this.beginIndex=Oe,this.endIndex=Ue}static parse(Le,Re){if(Le.length<=2||Le.length>=5)return Re.error(`Expected 3 or 4 arguments, but found ${Le.length-1} instead.`);const Oe=Re.parse(Le[1],1,Ou),Ue=Re.parse(Le[2],2,su);if(!Oe||!Ue)return null;if(!We(Oe.type,[Ge(Ou),au,Ou]))return Re.error(`Expected first argument to be of type array or string, but found ${Xe(Oe.type)} instead`);
vendor: 3,791 bytes, line 1
1if(4===Le.length){const qe=Re.parse(Le[3],3,su);return qe?new di(Oe.type,Oe,Ue,qe):null}return new di(Oe.type,Oe,Ue)}evaluate(Le){const Re=this.input.evaluate(Le),Oe=this.beginIndex.evaluate(Le);if(!He(Re,["string","array"]))throw new ar(`Expected first argument to be of type array or string, but found ${Xe(nr(Re))} instead.`);if(this.endIndex){const Ue=this.endIndex.evaluate(Le);return Re.slice(Oe,Ue)}return Re.slice(Oe)}eachChild(Le){Le(this.input),Le(this.beginIndex),this.endIndex&&Le(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const Le=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),Le]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function mi(Le,Re){return"=="===Le||"!="===Le?"boolean"===Re.kind||"string"===Re.kind||"number"===Re.kind||"null"===Re.kind||"value"===Re.kind:"string"===Re.kind||"number"===Re.kind||"value"===Re.kind}function yi(Le,Re,Oe,Ue){return 0===Ue.compare(Re,Oe)}function gi(Le,Re,Oe){const Ue="=="!==Le&&"!="!==Le;return class i{constructor(Le,Re,Oe){this.type=lu,this.lhs=Le,this.rhs=Re,this.collator=Oe,this.hasUntypedArgument="value"===Le.type.kind||"value"===Re.type.kind}static parse(Le,Re){if(3!==Le.length&&4!==Le.length)return Re.error("Expected two or three arguments.");const Oe=Le[0];let qe=Re.parse(Le[1],1,Ou);if(!qe)return null;if(!mi(Oe,qe.type))return Re.concat(1).error(`"${Oe}" comparisons are not supported for type '${Xe(qe.type)}'.`);let Ct=Re.parse(Le[2],2,Ou);if(!Ct)return null;if(!mi(Oe,Ct.type))return Re.concat(2).error(`"${Oe}" comparisons are not supported for type '${Xe(Ct.type)}'.`);if(qe.type.kind!==Ct.type.kind&&"value"!==qe.type.kind&&"value"!==Ct.type.kind)return Re.error(`Cannot compare types '${Xe(qe.type)}' and '${Xe(Ct.type)}'.`);Ue&&("value"===qe.type.kind&&"value"!==Ct.type.kind?qe=new lr(Ct.type,[qe]):"value"!==qe.type.kind&&"value"===Ct.type.kind&&(Ct=new lr(qe.type,[Ct])));let Ot=null;if(4===Le.length){if("string"!==qe.type.kind&&"string"!==Ct.type.kind&&"value"!==qe.type.kind&&"value"!==Ct.type.kind)return Re.error("Cannot use collator to compare non-string types.");if(Ot=Re.parse(Le[3],3,Nu),!Ot)return null}return new i(qe,Ct,Ot)}evaluate(qe){const Ct=this.lhs.evaluate(qe),Ot=this.rhs.evaluate(qe);if(Ue&&this.hasUntypedArgument){const Re=nr(Ct),Oe=nr(Ot);if(Re.kind!==Oe.kind||"string"!==Re.kind&&"number"!==Re.kind)throw new ar(`Expected arguments for "${Le}" to be (string, string) or (number, number), but found (${Re.kind}, ${Oe.kind}) instead.`)}if(this.collator&&!Ue&&this.hasUntypedArgument){const Le=nr(Ct),Oe=nr(Ot);if("string"!==Le.kind||"string"!==Oe.kind)return Re(qe,Ct,Ot)}return this.collator?Oe(qe,Ct,Ot,this.collator.evaluate(qe)):Re(qe,Ct,Ot)}eachChild(Le){Le(this.lhs),Le(this.rhs),this.collator&&Le(this.collator)}outputDefined(){return!0}serialize(){const Re=[Le];return this.eachChild((Le=>{Re.push(Le.serialize())})),Re}}}const sp=gi("==",(function(Le,Re,Oe){return Re===Oe}),yi),ap=gi("!=",(function(Le,Re,Oe){return Re!==Oe}),(function(Le,Re,Oe,Ue){return!yi(0,Re,Oe,Ue)})),cp=gi("<",(function(Le,Re,Oe){return Re<Oe}),(function(Le,Re,Oe,Ue){return Ue.compare(Re,Oe)<0})),hp=gi(">",(function(Le,Re,Oe){return Re>Oe}),(function(Le,Re,Oe,Ue){return Ue.compare(Re,Oe)>0})),dp=gi("<=",(function(Le,Re,Oe){return Re<=Oe}),(function(Le,Re,Oe,Ue){return Ue.compare(Re,Oe)<=0})),pp=gi(">=",(function(Le,Re,Oe){return Re>=Oe}),(function(Le,Re,Oe,Ue){return Ue.compare(Re,Oe)>=0}));class Ai{constructor(Le,Re,Oe,Ue,qe,Ct){this.type=au,this.number=Le,this.locale=Re,this.currency=Oe,this.unit=Ue,this.minFractionDigits=qe,this.maxFractionDigits=Ct}static parse(Le,Re){if(3!==Le.length)return Re.error("Expected two arguments.");const Oe=Re.parse(Le[1],1,su);
vendor: 5,667 bytes, line 1
1if(!Oe)return null;const Ue=Le[2];if("object"!=typeof Ue||Array.isArray(Ue))return Re.error("NumberFormat options argument must be an object.");let qe=null;if(Ue.locale&&(qe=Re.parseObjectValue(Ue.locale,2,"locale",au),!qe))return null;let Ct=null;if(Ue.currency&&(Ct=Re.parseObjectValue(Ue.currency,2,"currency",au),!Ct))return null;let Ot=null;if(Ue.unit&&(Ot=Re.parseObjectValue(Ue.unit,2,"unit",au),!Ot))return null;let Jt=null;if(Ue["min-fraction-digits"]&&(Jt=Re.parseObjectValue(Ue["min-fraction-digits"],2,"min-fraction-digits",su),!Jt))return null;let _i=null;return Ue["max-fraction-digits"]&&(_i=Re.parseObjectValue(Ue["max-fraction-digits"],2,"max-fraction-digits",su),!_i)?null:new Ai(Oe,qe,Ct,Ot,Jt,_i)}evaluate(Le){return new Intl.NumberFormat(this.locale?this.locale.evaluate(Le):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(Le):void 0,unit:this.unit?this.unit.evaluate(Le):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(Le):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(Le):void 0}).format(this.number.evaluate(Le))}eachChild(Le){Le(this.number),this.locale&&Le(this.locale),this.currency&&Le(this.currency),this.unit&&Le(this.unit),this.minFractionDigits&&Le(this.minFractionDigits),this.maxFractionDigits&&Le(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const Le={};return this.locale&&(Le.locale=this.locale.serialize()),this.currency&&(Le.currency=this.currency.serialize()),this.unit&&(Le.unit=this.unit.serialize()),this.minFractionDigits&&(Le["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(Le["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),Le]}}class Si{constructor(Le){this.type=su,this.input=Le}static parse(Le,Re){if(2!==Le.length)return Re.error(`Expected 1 argument, but found ${Le.length-1} instead.`);const Oe=Re.parse(Le[1],1);return Oe?"array"!==Oe.type.kind&&"string"!==Oe.type.kind&&"value"!==Oe.type.kind?Re.error(`Expected argument of type string or array, but found ${Xe(Oe.type)} instead.`):new Si(Oe):null}evaluate(Le){const Re=this.input.evaluate(Le);if("string"==typeof Re)return Re.length;if(Array.isArray(Re))return Re.length;throw new ar(`Expected value to be of type string or array, but found ${Xe(nr(Re))} instead.`)}eachChild(Le){Le(this.input)}outputDefined(){return!1}serialize(){const Le=["length"];return this.eachChild((Re=>{Le.push(Re.serialize())})),Le}}function Ii(Le){return function(){Le=1831565813+(Le|=0)|0;let Re=Math.imul(Le^Le>>>15,1|Le);return Re=Re+Math.imul(Re^Re>>>7,61|Re)^Re,((Re^Re>>>14)>>>0)/4294967296}}const fp={"==":sp,"!=":ap,">":hp,"<":cp,">=":pp,"<=":dp,array:lr,at:ui,boolean:lr,case:fi,coalesce:oi,collator:xr,format:ur,image:cr,in:ci,"index-of":hi,interpolate:si,"interpolate-hcl":si,"interpolate-lab":si,length:Si,let:li,literal:sr,match:pi,number:lr,"number-format":Ai,object:lr,slice:di,step:Un,string:lr,"to-boolean":fr,"to-color":fr,"to-number":fr,"to-string":fr,var:Rn,within:Ur,distance:Pn,config:Tn};function zi(Le,[Re,Oe,Ue,qe]){Re=Re.evaluate(Le),Oe=Oe.evaluate(Le),Ue=Ue.evaluate(Le);const Ct=qe?qe.evaluate(Le):1,Ot=er(Re,Oe,Ue,Ct);if(Ot)throw new ar(Ot);return new Pe(Re/255*Ct,Oe/255*Ct,Ue/255*Ct,Ct)}function ki(Le,[Re,Oe,Ue,qe]){Re=Re.evaluate(Le),Oe=Oe.evaluate(Le),Ue=Ue.evaluate(Le);const Ct=qe?qe.evaluate(Le):1,Ot=function(Le,Re,Oe,Ue){return"number"==typeof Le&&Le>=0&&Le<=360?"number"==typeof Re&&Re>=0&&Re<=100&&"number"==typeof Oe&&Oe>=0&&Oe<=100?void 0===Ue||"number"==typeof Ue&&Ue>=0&&Ue<=1?null:`Invalid hsla value [${[Le,Re,Oe,Ue].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof Ue?[Le,Re,Oe,Ue]:[Le,Re,Oe]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof Ue?[Le,Re,Oe,Ue]:[Le,Re,Oe]).join(", ")}]: 'h' must be between 0 and 360.`}(Re,Oe,Ue,Ct);if(Ot)throw new ar(Ot);const Jt=`hsla(${Re}, ${Oe}%, ${Ue}%, ${Ct})`,_i=Pe.parse(Jt);if(!_i)throw new ar(`Failed to parse HSLA color: ${Jt}`);return _i}function Ti(Le,Re){return Le in Re}function Ei(Le,Re){const Oe=Re[Le];return void 0===Oe?null:Oe}function Bi(Le){return{type:Le}}function Vi(Le){return{result:"success",value:Le}}function Ci(Le){return{result:"error",value:Le}}function Ri(Le,Re){return!!Le&&!!Le.parameters&&Le.parameters.indexOf(Re)>-1}function Di(Le){return"data-driven"===Le["property-type"]}function Li(Le){return Ri(Le.expression,"measure-light")}function Fi(Le){return Ri(Le.expression,"zoom")}function Oi(Le){return!!Le.expression&&Le.expression.interpolated}function Ui(Le){return"object"==typeof Le&&null!==Le&&!Array.isArray(Le)}function ji(Le){return Le}function Ni(Le,Re){const Oe="color"===Re.type,Ue=Le.stops&&"object"==typeof Le.stops[0][0],qe=Ue||!(Ue||void 0!==Le.property),Ct=Le.type||(Oi(Re)?"exponential":"interval");if(Oe&&((Le=Be({},Le)).stops&&(Le.stops=Le.stops.map((Le=>[Le[0],Pe.parse(Le[1])]))),Le.default=Pe.parse(Le.default?Le.default:Re.default)),Le.colorSpace&&"rgb"!==Le.colorSpace&&!Kd[Le.colorSpace])throw new Error(`Unknown color space: ${Le.colorSpace}`);let Ot,Jt,_i;if("exponential"===Ct)Ot=Xi;else if("interval"===Ct)Ot=Gi;else if("categorical"===Ct){Ot=$i,Jt=Object.create(null);for(const Re of Le.stops)Jt[Re[0]]=Re[1];_i=typeof Le.stops[0][0]}else{if("identity"!==Ct)throw new Error(`Unknown function type "${Ct}"`);Ot=Yi}if(Ue){const Oe={},Ue=[];for(let Re=0;Re<Le.stops.length;Re++){const qe=Le.stops[Re],Ct=qe[0].zoom;void 0===Oe[Ct]&&(Oe[Ct]={zoom:Ct,type:Le.type,property:Le.property,default:Le.default,stops:[]}
vendor: 13,688 bytes, line 1
1,Ue.push(Ct)),Oe[Ct].stops.push([qe[0].value,qe[1]])}const qe=[];for(const Le of Ue)qe.push([Oe[Le].zoom,Ni(Oe[Le],Re)]);const Ct={name:"linear"};return{kind:"composite",interpolationType:Ct,interpolationFactor:si.interpolationFactor.bind(void 0,Ct),zoomStops:qe.map((Le=>Le[0])),evaluate:({zoom:Oe},Ue)=>Xi({stops:qe,base:Le.base},Re,Oe).evaluate(Oe,Ue)}}if(qe){const Oe="exponential"===Ct?{name:"exponential",base:void 0!==Le.base?Le.base:1}:null;return{kind:"camera",interpolationType:Oe,interpolationFactor:si.interpolationFactor.bind(void 0,Oe),zoomStops:Le.stops.map((Le=>Le[0])),evaluate:({zoom:Oe})=>Ot(Le,Re,Oe,Jt,_i)}}return{kind:"source",evaluate(Oe,Ue){const qe=Ue&&Ue.properties?Ue.properties[Le.property]:void 0;return void 0===qe?qi(Le.default,Re.default):Ot(Le,Re,qe,Jt,_i)}}}function qi(Le,Re,Oe){return void 0!==Le?Le:void 0!==Re?Re:void 0!==Oe?Oe:void 0}function $i(Le,Re,Oe,Ue,qe){return qi(typeof Oe===qe?Ue[Oe]:void 0,Le.default,Re.default)}function Gi(Le,Re,Oe){if("number"!==hr(Oe))return qi(Le.default,Re.default);const Ue=Le.stops.length;if(1===Ue)return Le.stops[0][1];if(Oe<=Le.stops[0][0])return Le.stops[0][1];if(Oe>=Le.stops[Ue-1][0])return Le.stops[Ue-1][1];const qe=On(Le.stops.map((Le=>Le[0])),Oe);return Le.stops[qe][1]}function Xi(Le,Re,Oe){const Ue=void 0!==Le.base?Le.base:1;if("number"!==hr(Oe))return qi(Le.default,Re.default);const qe=Le.stops.length;if(1===qe)return Le.stops[0][1];if(Oe<=Le.stops[0][0])return Le.stops[0][1];if(Oe>=Le.stops[qe-1][0])return Le.stops[qe-1][1];const Ct=On(Le.stops.map((Le=>Le[0])),Oe),Ot=function(Le,Re,Oe,Ue){const qe=Ue-Oe,Ct=Le-Oe;return 0===qe?0:1===Re?Ct/qe:(Math.pow(Re,Ct)-1)/(Math.pow(Re,qe)-1)}(Oe,Ue,Le.stops[Ct][0],Le.stops[Ct+1][0]),Jt=Le.stops[Ct][1],_i=Le.stops[Ct+1][1];let xi=iu[Re.type]||ji;if(Le.colorSpace&&"rgb"!==Le.colorSpace){const Re=Kd[Le.colorSpace];xi=(Le,Oe)=>Re.reverse(Re.interpolate(Re.forward(Le),Re.forward(Oe),Ot))}return"function"==typeof Jt.evaluate?{evaluate(...Le){const Re=Jt.evaluate.apply(void 0,Le),Oe=_i.evaluate.apply(void 0,Le);if(void 0!==Re&&void 0!==Oe)return xi(Re,Oe,Ot)}}:xi(Jt,_i,Ot)}function Yi(Le,Re,Oe){return"color"===Re.type?Oe=Pe.parse(Oe):"formatted"===Re.type?Oe=Qe.fromString(Oe.toString()):"resolvedImage"===Re.type?Oe=tr.fromString(Oe.toString()):hr(Oe)===Re.type||"enum"===Re.type&&Re.values[Oe]||(Oe=void 0),qi(Oe,Le.default,Re.default)}yr.register(fp,{error:[{kind:"error"},[au],(Le,[Re])=>{throw new ar(Re.evaluate(Le))}],typeof:[au,[Ou],(Le,[Re])=>Xe(nr(Re.evaluate(Le)))],"to-rgba":[Ge(su,4),[xu],(Le,[Re])=>Re.evaluate(Le).toRenderColor(null).toArray()],rgb:[xu,[su,su,su],zi],rgba:[xu,[su,su,su,su],zi],hsl:[xu,[su,su,su],ki],hsla:[xu,[su,su,su,su],ki],has:{type:lu,overloads:[[[au],(Le,[Re])=>Ti(Re.evaluate(Le),Le.properties())],[[au,Tu],(Le,[Re,Oe])=>Ti(Re.evaluate(Le),Oe.evaluate(Le))]]},get:{type:Ou,overloads:[[[au],(Le,[Re])=>Ei(Re.evaluate(Le),Le.properties())],[[au,Tu],(Le,[Re,Oe])=>Ei(Re.evaluate(Le),Oe.evaluate(Le))]]},"feature-state":[Ou,[au],(Le,[Re])=>Ei(Re.evaluate(Le),Le.featureState||{})],properties:[Tu,[],Le=>Le.properties()],"geometry-type":[au,[],Le=>Le.geometryType()],id:[Ou,[],Le=>Le.id()],zoom:[su,[],Le=>Le.globals.zoom],pitch:[su,[],Le=>Le.globals.pitch||0],"distance-from-center":[su,[],Le=>Le.distanceFromCenter()],"measure-light":[su,[au],(Le,[Re])=>Le.measureLight(Re.evaluate(Le))],"heatmap-density":[su,[],Le=>Le.globals.heatmapDensity||0],"line-progress":[su,[],Le=>Le.globals.lineProgress||0],"raster-value":[su,[],Le=>Le.globals.rasterValue||0],"raster-particle-speed":[su,[],Le=>Le.globals.rasterParticleSpeed||0],"sky-radial-progress":[su,[],Le=>Le.globals.skyRadialProgress||0],accumulated:[Ou,[],Le=>void 0===Le.globals.accumulated?null:Le.globals.accumulated],"+":[su,Bi(su),(Le,Re)=>{let Oe=0;for(const Ue of Re)Oe+=Ue.evaluate(Le);return Oe}],"*":[su,Bi(su),(Le,Re)=>{let Oe=1;for(const Ue of Re)Oe*=Ue.evaluate(Le);return Oe}],"-":{type:su,overloads:[[[su,su],(Le,[Re,Oe])=>Re.evaluate(Le)-Oe.evaluate(Le)],[[su],(Le,[Re])=>-Re.evaluate(Le)]]},"/":[su,[su,su],(Le,[Re,Oe])=>Re.evaluate(Le)/Oe.evaluate(Le)],"%":[su,[su,su],(Le,[Re,Oe])=>Re.evaluate(Le)%Oe.evaluate(Le)],ln2:[su,[],()=>Math.LN2],pi:[su,[],()=>Math.PI],e:[su,[],()=>Math.E],"^":[su,[su,su],(Le,[Re,Oe])=>Math.pow(Re.evaluate(Le),Oe.evaluate(Le))],sqrt:[su,[su],(Le,[Re])=>Math.sqrt(Re.evaluate(Le))],log10:[su,[su],(Le,[Re])=>Math.log(Re.evaluate(Le))/Math.LN10],ln:[su,[su],(Le,[Re])=>Math.log(Re.evaluate(Le))],log2:[su,[su],(Le,[Re])=>Math.log(Re.evaluate(Le))/Math.LN2],sin:[su,[su],(Le,[Re])=>Math.sin(Re.evaluate(Le))],cos:[su,[su],(Le,[Re])=>Math.cos(Re.evaluate(Le))],tan:[su,[su],(Le,[Re])=>Math.tan(Re.evaluate(Le))],asin:[su,[su],(Le,[Re])=>Math.asin(Re.evaluate(Le))],acos:[su,[su],(Le,[Re])=>Math.acos(Re.evaluate(Le))],atan:[su,[su],(Le,[Re])=>Math.atan(Re.evaluate(Le))],min:[su,Bi(su),(Le,Re)=>Math.min(...Re.map((Re=>Re.evaluate(Le))))],max:[su,Bi(su),(Le,Re)=>Math.max(...Re.map((Re=>Re.evaluate(Le))))],abs:[su,[su],(Le,[Re])=>Math.abs(Re.evaluate(Le))],round:[su,[su],(Le,[Re])=>{const Oe=Re.evaluate(Le);return Oe<0?-Math.round(-Oe):Math.round(Oe)}],floor:[su,[su],(Le,[Re])=>Math.floor(Re.evaluate(Le))],ceil:[su,[su],(Le,[Re])=>Math.ceil(Re.evaluate(Le))],"filter-==":[lu,[au,Ou],(Le,[Re,Oe])=>Le.properties()[Re.value]===Oe.value],"filter-id-==":[lu,[Ou],(Le,[Re])=>Le.id()===Re.value],"filter-type-==":[lu,[au],(Le,[Re])=>Le.geometryType()===Re.value],"filter-<":[lu,[au,Ou],(Le,[Re,Oe])=>{const Ue=Le.properties()[Re.value],qe=Oe.value;return typeof Ue==typeof qe&&Ue<qe}],"filter-id-<":[lu,[Ou],(Le,[Re])=>{const Oe=Le.id(),Ue=Re.value;return typeof Oe==typeof Ue&&Oe<Ue}],"filter->":[lu,[au,Ou],(Le,[Re,Oe])=>{const Ue=Le.properties()[Re.value],qe=Oe.value;return typeof Ue==typeof qe&&Ue>qe}],"filter-id->":[lu,[Ou],(Le,[Re])=>{const Oe=Le.id(),Ue=Re.value;return typeof Oe==typeof Ue&&Oe>Ue}],"filter-<=":[lu,[au,Ou],(Le,[Re,Oe])=>{const Ue=Le.properties()[Re.value],qe=Oe.value;return typeof Ue==typeof qe&&Ue<=qe}],"filter-id-<=":[lu,[Ou],(Le,[Re])=>{const Oe=Le.id(),Ue=Re.value;return typeof Oe==typeof Ue&&Oe<=Ue}],"filter->=":[lu,[au,Ou],(Le,[Re,Oe])=>{const Ue=Le.properties()[Re.value],qe=Oe.value;return typeof Ue==typeof qe&&Ue>=qe}],"filter-id->=":[lu,[Ou],(Le,[Re])=>{const Oe=Le.id(),Ue=Re.value;return typeof Oe==typeof Ue&&Oe>=Ue}],"filter-has":[lu,[Ou],(Le,[Re])=>Re.value in Le.properties()],"filter-has-id":[lu,[],Le=>null!==Le.id()&&void 0!==Le.id()],"filter-type-in":[lu,[Ge(au)],(Le,[Re])=>Re.value.indexOf(Le.geometryType())>=0],"filter-id-in":[lu,[Ge(Ou)],(Le,[Re])=>Re.value.indexOf(Le.id())>=0],"filter-in-small":[lu,[au,Ge(Ou)],(Le,[Re,Oe])=>Oe.value.indexOf(Le.properties()[Re.value])>=0],"filter-in-large":[lu,[au,Ge(Ou)],(Le,[Re,Oe])=>function(Le,Re,Oe,Ue){for(;Oe<=Ue;){const qe=Oe+Ue>>1;if(Re[qe]===Le)return!0;Re[qe]>Le?Ue=qe-1:Oe=qe+1}return!1}(Le.properties()[Re.value],Oe.value,0,Oe.value.length-1)],all:{type:lu,overloads:[[[lu,lu],(Le,[Re,Oe])=>Re.evaluate(Le)&&Oe.evaluate(Le)],[Bi(lu),(Le,Re)=>{for(const Oe of Re)if(!Oe.evaluate(Le))return!1;return!0}]]},any:{type:lu,overloads:[[[lu,lu],(Le,[Re,Oe])=>Re.evaluate(Le)||Oe.evaluate(Le)],[Bi(lu),(Le,Re)=>{for(const Oe of Re)if(Oe.evaluate(Le))return!0;return!1}]]},"!":[lu,[lu],(Le,[Re])=>!Re.evaluate(Le)],"is-supported-script":[lu,[au],(Le,[Re])=>{const Oe=Le.globals&&Le.globals.isSupportedScript;return!Oe||Oe(Re.evaluate(Le))}],upcase:[au,[au],(Le,[Re])=>Re.evaluate(Le).toUpperCase()],downcase:[au,[au],(Le,[Re])=>Re.evaluate(Le).toLowerCase()],concat:[au,Bi(Ou),(Le,Re)=>Re.map((Re=>ir(Re.evaluate(Le)))).join("")],"resolved-locale":[au,[Nu],(Le,[Re])=>Re.evaluate(Le).resolvedLocale()],random:[su,[su,su,Ou],(Le,Re)=>{const[Oe,Ue,qe]=Re.map((Re=>Re.evaluate(Le)));if(Oe>Ue)return Oe;if(Oe===Ue)return Oe;let Ct;if("string"==typeof qe)Ct=function(Le){let Re=0;if(0===Le.length)return Re;for(let Oe=0;Oe<Le.length;Oe++)Re=(Re<<5)-Re+Le.charCodeAt(Oe),Re|=0;return Re}(qe);else{if("number"!=typeof qe)throw new ar(`Invalid seed input: ${qe}`);Ct=qe}return Oe+Ii(Ct)()*(Ue-Oe)}]});class Zi{constructor(Le,Re,Oe,Ue){this.expression=Le,this._warningHistory={},this._evaluator=new mr(Oe,Ue),this._defaultValue=Re?function(Le){return"color"===Le.type&&(Ui(Le.default)||Array.isArray(Le.default))?new Pe(0,0,0,0):"color"===Le.type?Pe.parse(Le.default)||null:void 0===Le.default?null:Le.default}(Re):null,this._enumValues=Re&&"enum"===Re.type?Re.values:null}evaluateWithoutErrorHandling(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){return this._evaluator.globals=Le,this._evaluator.feature=Re,this._evaluator.featureState=Oe,this._evaluator.canonical=Ue||null,this._evaluator.availableImages=qe||null,this._evaluator.formattedSection=Ct,this._evaluator.featureTileCoord=Ot||null,this._evaluator.featureDistanceData=Jt||null,this.expression.evaluate(this._evaluator)}evaluate(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){this._evaluator.globals=Le,this._evaluator.feature=Re||null,this._evaluator.featureState=Oe||null,this._evaluator.canonical=Ue||null,this._evaluator.availableImages=qe||null,this._evaluator.formattedSection=Ct||null,this._evaluator.featureTileCoord=Ot||null,this._evaluator.featureDistanceData=Jt||null;try{const Le=this.expression.evaluate(this._evaluator);if(null==Le||"number"==typeof Le&&Le!=Le)return this._defaultValue;if(this._enumValues&&!(Le in this._enumValues))throw new ar(`Expected value to be one of ${Object.keys(this._enumValues).map((Le=>JSON.stringify(Le))).join(", ")}, but found ${JSON.stringify(Le)} instead.`);return Le}catch(Le){return this._warningHistory[Le.message]||(this._warningHistory[Le.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${Le.message}`)),this._defaultValue}}}function Wi(Le){return Array.isArray(Le)&&Le.length>0&&"string"==typeof Le[0]&&Le[0]in fp}function Hi(Le,Re,Oe,Ue){const qe=new wd(fp,[],Re?function(Le){const Re={color:xu,string:au,number:su,enum:au,boolean:lu,formatted:Uu,resolvedImage:ju};return"array"===Le.type?Ge(Re[Le.value]||Ou,Le.length):Re[Le.type]}(Re):void 0,void 0,void 0,Oe,Ue),Ct=qe.parse(Le,void 0,void 0,void 0,Re&&"string"===Re.type?{typeAnnotation:"coerce"}:void 0);return Ct?Vi(new Zi(Ct,Re,Oe,Ue)):Ci(qe.errors)}class Ki{constructor(Le,Re,Oe){this.kind=Le,this._styleExpression=Re,this.isLightConstant=Oe,this.isStateDependent="constant"!==Le&&!Bn(Re.expression),this.configDependencies=Vn(Re.expression)}evaluateWithoutErrorHandling(Le,Re,Oe,Ue,qe,Ct){return this._styleExpression.evaluateWithoutErrorHandling(Le,Re,Oe,Ue,qe,Ct)}evaluate(Le,Re,Oe,Ue,qe,Ct){return this._styleExpression.evaluate(Le,Re,Oe,Ue,qe,Ct)}}class Ji{constructor(Le,Re,Oe,Ue,qe){this.kind=Le,this.zoomStops=Oe,this._styleExpression=Re,this.isStateDependent="camera"!==Le&&!Bn(Re.expression),this.isLightConstant=qe,this.configDependencies=Vn(Re.expression),this.interpolationType=Ue}evaluateWithoutErrorHandling(Le,Re,Oe,Ue,qe,Ct){return this._styleExpression.evaluateWithoutErrorHandling(Le,Re,Oe,Ue,qe,Ct)}evaluate(Le,Re,Oe,Ue,qe,Ct){return this._styleExpression.evaluate(Le,Re,Oe,Ue,qe,Ct)}interpolationFactor(Le,Re,Oe){return this.interpolationType?si.interpolationFactor(this.interpolationType,Le,Re,Oe):0}}function Qi(Le,Re,Oe,Ue){if("error"===(Le=Hi(Le,Re,Oe,Ue)).result)return Le;const qe=Le.value.expression,Ct=En(qe);if(!Ct&&!Di(Re))return Ci([new Ve("","data expressions not supported")]);const Ot=Cn(qe,["zoom","pitch","distance-from-center"]);if(!Ot&&!Fi(Re))return Ci([new Ve("","zoom expressions not supported")]);const Jt=Cn(qe,["measure-light"]);if(!Jt&&!Li(Re))return Ci([new Ve("","measure-light expression not supported")]);const _i=Re.expression&&Re.expression.relaxZoomRestriction,xi=es(qe);return xi||Ot||_i?xi instanceof Ve?Ci([xi]):xi instanceof si&&!Oi(Re)?Ci([new Ve("",'"interpolate" expressions cannot be used with this property')]):Vi(xi?new Ji(Ct?"camera":"composite",Le.value,xi.labels,xi instanceof si?xi.interpolation:void 0,Jt):new Ki(Ct?"constant":"source",Le.value,Jt)):Ci([new Ve("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ts{constructor(Le,Re){this._parameters=Le,this._specification=Re,Be(this,Ni(this._parameters,this._specification))}static deserialize(Le){return new ts(Le._parameters,Le._specification)}static serialize(Le){return{_parameters:Le._parameters,_specification:Le._specification}}}function es(Le){let Re=null;if(Le instanceof li)Re=es(Le.result);else if(Le instanceof oi){for(const Oe of Le.args)if(Re=es(Oe),Re)break}else(Le instanceof Un||Le instanceof si)&&Le.input instanceof yr&&"zoom"===Le.input.name&&(Re=Le);return Re instanceof Ve||Le.eachChild((Le=>{const Oe=es(Le);Oe instanceof Ve?Re=Oe:Re&&Oe&&Re!==Oe&&(Re=new Ve("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),Re}var mp,yp,xp=function(){if(yp)return mp;yp=1,mp=e;var Le=3;function e(Oe,Ue,qe){var Ct=(this||Re).cells=[];if(Oe instanceof ArrayBuffer){(this||Re).arrayBuffer=Oe;var Ot=new Int32Array((this||Re).arrayBuffer);Oe=Ot[0],(this||Re).d=(Ue=Ot[1])+2*(qe=Ot[2]);for(var Jt=0;Jt<(this||Re).d*(this||Re).d;Jt++){var _i=Ot[Le+Jt],xi=Ot[Le+Jt+1];Ct.push(_i===xi?null:Ot.subarray(_i,xi))}var vi=Ot[Le+Ct.length+1];(this||Re).keys=Ot.subarray(Ot[Le+Ct.length],vi),(this||Re).bboxes=Ot.subarray(vi),(this||Re).insert=(this||Re)._insertReadonly}else{(this||Re).d=Ue+2*qe;for(var bi=0;bi<(this||Re).d*(this||Re).d;bi++)Ct.push([]);(this||Re).keys=[],(this||Re).bboxes=[]}(this||Re).n=Ue,(this||Re).extent=Oe,(this||Re).padding=qe,(this||Re).scale=Ue/Oe,(this||Re).uid=0;var Pi=qe/Ue*Oe;(this||Re).min=-Pi,(this||Re).max=Oe+Pi}
1return e.prototype.insert=function(Le,Oe,Ue,qe,Ct){this._forEachCell(Oe,Ue,qe,Ct,(this||Re)._insertCell,(this||Re).uid++),(this||Re).keys.push(Le),(this||Re).bboxes.push(Oe),(this||Re).bboxes.push(Ue),(this||Re).bboxes.push(qe),(this||Re).bboxes.push(Ct)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(Le,Oe,Ue,qe,Ct,Ot){(this||Re).cells[Ct].push(Ot)},e.prototype.query=function(Le,Oe,Ue,qe,Ct){var Ot=(this||Re).min,Jt=(this||Re).max;if(Le<=Ot&&Oe<=Ot&&Jt<=Ue&&Jt<=qe&&!Ct)return Array.prototype.slice.call((this||Re).keys);var _i=[];return this._forEachCell(Le,Oe,Ue,qe,(this||Re)._queryCell,_i,{},Ct),_i},e.prototype._queryCell=function(Le,Oe,Ue,qe,Ct,Ot,Jt,_i){var xi=(this||Re).cells[Ct];if(null!==xi)for(var vi=(this||Re).keys,bi=(this||Re).bboxes,Pi=0;Pi<xi.length;Pi++){var Hr=xi[Pi];if(void 0===Jt[Hr]){var Jr=4*Hr;(_i?_i(bi[Jr+0],bi[Jr+1],bi[Jr+2],bi[Jr+3]):Le<=bi[Jr+2]&&Oe<=bi[Jr+3]&&Ue>=bi[Jr+0]&&qe>=bi[Jr+1])?(Jt[Hr]=!0,Ot.push(vi[Hr])):Jt[Hr]=!1}}},e.prototype._forEachCell=function(Le,Oe,Ue,qe,Ct,Ot,Jt,_i){for(var xi=this._convertToCellCoord(Le),vi=this._convertToCellCoord(Oe),bi=this._convertToCellCoord(Ue),Pi=this._convertToCellCoord(qe),Hr=xi;Hr<=bi;Hr++)for(var Jr=vi;Jr<=Pi;Jr++){var Ln=(this||Re).d*Jr+Hr;if((!_i||_i(this._convertFromCellCoord(Hr),this._convertFromCellCoord(Jr),this._convertFromCellCoord(Hr+1),this._convertFromCellCoord(Jr+1)))&&Ct.call(this||Re,Le,Oe,Ue,qe,Ln,Ot,Jt,_i))return}},e.prototype._convertFromCellCoord=function(Le){return(Le-(this||Re).padding)/(this||Re).scale},e.prototype._convertToCellCoord=function(Le){return Math.max(0,Math.min((this||Re).d-1,Math.floor(Le*(this||Re).scale)+(this||Re).padding))},e.prototype.toArrayBuffer=function(){if((this||Re).arrayBuffer)return(this||Re).arrayBuffer;for(var Oe=(this||Re).cells,Ue=Le+(this||Re).cells.length+1+1,qe=0,Ct=0;Ct<(this||Re).cells.length;Ct++)qe+=(this||Re).cells[Ct].length;var Ot=new Int32Array(Ue+qe+(this||Re).keys.length+(this||Re).bboxes.length);Ot[0]=(this||Re).extent,Ot[1]=(this||Re).n,Ot[2]=(this||Re).padding;for(var Jt=Ue,_i=0;_i<Oe.length;_i++){var xi=Oe[_i];Ot[Le+_i]=Jt,Ot.set(xi,Jt),Jt+=xi.length}return Ot[Le+Oe.length]=Jt,Ot.set((this||Re).keys,Jt),Ot[Le+Oe.length+1]=Jt+=(this||Re).keys.length,Ot.set((this||Re).bboxes,Jt),Jt+=(this||Re).bboxes.length,Ot.buffer},mp}(),vp=e(xp);const bp={};function os(Le,Re,Oe={}){Object.defineProperty(Le,"_classRegistryKey",{value:Re,writable:!1}),bp[Re]={klass:Le,omit:Oe.omit||[]}}os(Object,"Object"),vp.serialize=function(Le,Re){const Oe=Le.toArrayBuffer();return Re&&Re.add(Oe),{buffer:Oe}},vp.deserialize=function(Le){return new vp(Le.buffer)},Object.defineProperty(vp,"name",{value:"Grid"}),os(vp,"Grid"),os(Pe,"Color"),os(Error,"Error"),os(Qe,"Formatted"),os(Je,"FormattedSection"),os(re,"AJAXError"),os(tr,"ResolvedImage"),os(ts,"StylePropertyFunction"),os(Zi,"StyleExpression",{omit:["_evaluator"]}),os(Ji,"ZoomDependentExpression"),os(Ki,"ZoomConstantExpression"),os(yr,"CompoundExpression",{omit:["_evaluate"]});for(const Le in fp)bp[fp[Le]._classRegistryKey]||os(fp[Le],`Expression${Le}`);function ls(Le){return Le&&"undefined"!=typeof ArrayBuffer&&(Le instanceof ArrayBuffer||Le.constructor&&"ArrayBuffer"===Le.constructor.name)}function us(Le){return self.ImageBitmap&&Le instanceof ImageBitmap}function cs(Le,Re){if(null==Le||"boolean"==typeof Le||"number"==typeof Le||"string"==typeof Le||Le instanceof Boolean||Le instanceof Number||Le instanceof String||Le instanceof Date||Le instanceof RegExp)return Le;if(ls(Le)||us(Le))return Re&&Re.add(Le),Le;if(ArrayBuffer.isView(Le)){const Oe=Le;return Re&&Re.add(Oe.buffer),Oe}if(Le instanceof ImageData)return Re&&Re.add(Le.data.buffer),Le;if(Array.isArray(Le)){const Oe=[];for(const Ue of Le)Oe.push(cs(Ue,Re));return Oe}if(Le instanceof Map){const Re={$name:"Map"};for(const[Oe,Ue]of Le.entries())Re[Oe]=cs(Ue);return Re}if(Le instanceof Set){const Re={$name:"Set"};let Oe=0;for(const Ue of Le.values())Re[++Oe]=cs(Ue);return Re}if("object"==typeof Le){const Oe=Le.constructor,Ue=Oe._classRegistryKey;if(!Ue)throw new Error(`can't serialize object of unregistered class ${Ue}`);const qe=Oe.serialize?Oe.serialize(Le,Re):{};if(!Oe.serialize){for(const Oe in Le)Le.hasOwnProperty(Oe)&&(bp[Ue].omit.indexOf(Oe)>=0||(qe[Oe]=cs(Le[Oe],Re)));Le instanceof Error&&(qe.message=Le.message)}if(qe.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==Ue&&(qe.$name=Ue),qe}throw new Error("can't serialize object of type "+typeof Le)}function hs(Le){if(null==Le||"boolean"==typeof Le||"number"==typeof Le||"string"==typeof Le||Le instanceof Boolean||Le instanceof Number||Le instanceof String||Le instanceof Date||Le instanceof RegExp||ls(Le)||us(Le)||ArrayBuffer.isView(Le)||Le instanceof ImageData)return Le;if(Array.isArray(Le))return Le.map(hs);
1if("object"==typeof Le){const Re=Le.$name||"Object";if("Map"===Re){const Re=new Map;for(const Oe of Object.keys(Le))"$name"!==Oe&&Re.set(Oe,hs(Le[Oe]));return Re}if("Set"===Re){const Re=new Set;for(const Oe of Object.keys(Le))"$name"!==Oe&&Re.add(hs(Le[Oe]));return Re}const{klass:Oe}=bp[Re];if(!Oe)throw new Error(`can't deserialize unregistered class ${Re}`);if(Oe.deserialize)return Oe.deserialize(Le);const Ue=Object.create(Oe.prototype);for(const Re of Object.keys(Le))"$name"!==Re&&(Ue[Re]=hs(Le[Re]));return Ue}throw new Error("can't deserialize object of type "+typeof Le)}const Tp={"Latin-1 Supplement":Le=>Le>=128&&Le<=255,Arabic:Le=>Le>=1536&&Le<=1791,"Arabic Supplement":Le=>Le>=1872&&Le<=1919,"Arabic Extended-A":Le=>Le>=2208&&Le<=2303,"Hangul Jamo":Le=>Le>=4352&&Le<=4607,"Unified Canadian Aboriginal Syllabics":Le=>Le>=5120&&Le<=5759,Khmer:Le=>Le>=6016&&Le<=6143,"Unified Canadian Aboriginal Syllabics Extended":Le=>Le>=6320&&Le<=6399,"General Punctuation":Le=>Le>=8192&&Le<=8303,"Letterlike Symbols":Le=>Le>=8448&&Le<=8527,"Number Forms":Le=>Le>=8528&&Le<=8591,"Miscellaneous Technical":Le=>Le>=8960&&Le<=9215,"Control Pictures":Le=>Le>=9216&&Le<=9279,"Optical Character Recognition":Le=>Le>=9280&&Le<=9311,"Enclosed Alphanumerics":Le=>Le>=9312&&Le<=9471,"Geometric Shapes":Le=>Le>=9632&&Le<=9727,"Miscellaneous Symbols":Le=>Le>=9728&&Le<=9983,"Miscellaneous Symbols and Arrows":Le=>Le>=11008&&Le<=11263,"CJK Radicals Supplement":Le=>Le>=11904&&Le<=12031,"Kangxi Radicals":Le=>Le>=12032&&Le<=12255,"Ideographic Description Characters":Le=>Le>=12272&&Le<=12287,"CJK Symbols and Punctuation":Le=>Le>=12288&&Le<=12351,Hiragana:Le=>Le>=12352&&Le<=12447,Katakana:Le=>Le>=12448&&Le<=12543,Bopomofo:Le=>Le>=12544&&Le<=12591,"Hangul Compatibility Jamo":Le=>Le>=12592&&Le<=12687,Kanbun:Le=>Le>=12688&&Le<=12703,"Bopomofo Extended":Le=>Le>=12704&&Le<=12735,"CJK Strokes":Le=>Le>=12736&&Le<=12783,"Katakana Phonetic Extensions":Le=>Le>=12784&&Le<=12799,"Enclosed CJK Letters and Months":Le=>Le>=12800&&Le<=13055,"CJK Compatibility":Le=>Le>=13056&&Le<=13311,"CJK Unified Ideographs Extension A":Le=>Le>=13312&&Le<=19903,"Yijing Hexagram Symbols":Le=>Le>=19904&&Le<=19967,"CJK Unified Ideographs":Le=>Le>=19968&&Le<=40959,"Yi Syllables":Le=>Le>=40960&&Le<=42127,"Yi Radicals":Le=>Le>=42128&&Le<=42191,"Hangul Jamo Extended-A":Le=>Le>=43360&&Le<=43391,"Hangul Syllables":Le=>Le>=44032&&Le<=55215,"Hangul Jamo Extended-B":Le=>Le>=55216&&Le<=55295,"Private Use Area":Le=>Le>=57344&&Le<=63743,"CJK Compatibility Ideographs":Le=>Le>=63744&&Le<=64255,"Arabic Presentation Forms-A":Le=>Le>=64336&&Le<=65023,"Vertical Forms":Le=>Le>=65040&&Le<=65055,"CJK Compatibility Forms":Le=>Le>=65072&&Le<=65103,"Small Form Variants":Le=>Le>=65104&&Le<=65135,"Arabic Presentation Forms-B":Le=>Le>=65136&&Le<=65279,"Halfwidth and Fullwidth Forms":Le=>Le>=65280&&Le<=65519,"CJK Unified Ideographs Extension B":Le=>Le>=131072&&Le<=173791};function fs(Le){for(const Re of Le)if(ys(Re.charCodeAt(0)))return!0;return!1}function ds(Le){for(const Re of Le)if(!ms(Re.charCodeAt(0)))return!1;return!0}function ms(Le){return!(Tp.Arabic(Le)||Tp["Arabic Supplement"](Le)||Tp["Arabic Extended-A"](Le)||Tp["Arabic Presentation Forms-A"](Le)||Tp["Arabic Presentation Forms-B"](Le))}function ys(Le){return!(746!==Le&&747!==Le&&(Le<4352||!(Tp["Bopomofo Extended"](Le)||Tp.Bopomofo(Le)||Tp["CJK Compatibility Forms"](Le)&&!(Le>=65097&&Le<=65103)||Tp["CJK Compatibility Ideographs"](Le)||Tp["CJK Compatibility"](Le)||Tp["CJK Radicals Supplement"](Le)||Tp["CJK Strokes"](Le)||!(!Tp["CJK Symbols and Punctuation"](Le)||Le>=12296&&Le<=12305||Le>=12308&&Le<=12319||12336===Le)||Tp["CJK Unified Ideographs Extension A"](Le)||Tp["CJK Unified Ideographs"](Le)||Tp["Enclosed CJK Letters and Months"](Le)||Tp["Hangul Compatibility Jamo"](Le)||Tp["Hangul Jamo Extended-A"](Le)||Tp["Hangul Jamo Extended-B"](Le)||Tp["Hangul Jamo"](Le)||Tp["Hangul Syllables"](Le)||Tp.Hiragana(Le)||Tp["Ideographic Description Characters"](Le)||Tp.Kanbun(Le)||Tp["Kangxi Radicals"](Le)||Tp["Katakana Phonetic Extensions"](Le)||Tp.Katakana(Le)&&12540!==Le||!(!Tp["Halfwidth and Fullwidth Forms"](Le)||65288===Le||65289===Le||65293===Le||Le>=65306&&Le<=65310||65339===Le||65341===Le||65343===Le||Le>=65371&&Le<=65503||65507===Le||Le>=65512&&Le<=65519)||!(!Tp["Small Form Variants"](Le)||Le>=65112&&Le<=65118||Le>=65123&&Le<=65126)||Tp["Unified Canadian Aboriginal Syllabics"](Le)||Tp["Unified Canadian Aboriginal Syllabics Extended"](Le)||Tp["Vertical Forms"](Le)||Tp["Yijing Hexagram Symbols"](Le)||Tp["Yi Syllables"](Le)||Tp["Yi Radicals"](Le))))}function gs(Le){return!(ys(Le)||function(Le){return!!(Tp["Latin-1 Supplement"](Le)&&(167===Le||169===Le||174===Le||177===Le||188===Le||189===Le||190===Le||215===Le||247===Le)||Tp["General Punctuation"](Le)&&(8214===Le||8224===Le||8225===Le||8240===Le||8241===Le||8251===Le||8252===Le||8258===Le||8263===Le||8264===Le||8265===Le||8273===Le)||Tp["Letterlike Symbols"](Le)||Tp["Number Forms"](Le)||Tp["Miscellaneous Technical"](Le)&&(Le>=8960&&Le<=8967||Le>=8972&&Le<=8991||Le>=8996&&Le<=9e3||9003===Le||Le>=9085&&Le<=9114||Le>=9150&&Le<=9165||9167===Le||Le>=9169&&Le<=9179||Le>=9186&&Le<=9215)||Tp["Control Pictures"](Le)&&9251!==Le||Tp["Optical Character Recognition"](Le)||Tp["Enclosed Alphanumerics"](Le)||Tp["Geometric Shapes"](Le)||Tp["Miscellaneous Symbols"](Le)&&!(Le>=9754&&Le<=9759)||Tp["Miscellaneous Symbols and Arrows"](Le)&&(Le>=11026&&Le<=11055||Le>=11088&&Le<=11097||Le>=11192&&Le<=11243)||Tp["CJK Symbols and Punctuation"](Le)||Tp.Katakana(Le)||Tp["Private Use Area"](Le)||Tp["CJK Compatibility Forms"](Le)||Tp["Small Form Variants"](Le)||Tp["Halfwidth and Fullwidth Forms"](Le)||8734===Le||8756===Le||8757===Le||Le>=9984&&Le<=10087||Le>=10102&&Le<=10131||65532===Le||65533===Le)}(Le))}function xs(Le){return Le>=1424&&Le<=2303||Tp["Arabic Presentation Forms-A"](Le)||Tp["Arabic Presentation Forms-B"](Le)}function bs(Le,Re){return!(!Re&&xs(Le)||Le>=2304&&Le<=3583||Le>=3840&&Le<=4255||Tp.Khmer(Le))}function vs(Le){for(const Re of Le)if(xs(Re.charCodeAt(0)))return!0;return!1}const Mp="deferred",Ap="loading",Dp="loaded";let Lp=null,Rp="unavailable",Op=null;const Ps=function(Le){Le&&"string"==typeof Le&&Le.indexOf("NetworkError")>-1&&(Rp="error"),Lp&&Lp(Le)};function zs(){Fp.fire(new be("pluginStateChange",{pluginStatus:Rp,pluginURL:Op}))}const Fp=new Me,Ts=function(){return Rp},Es=function(){if(Rp!==Mp||!Op)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Rp=Ap,zs(),Op&&se({url:Op},(Le=>{Le?Ps(Le):(Rp=Dp,zs())}))},Np={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Rp===Dp||null!=Np.applyArabicShaping,isLoading:()=>Rp===Ap,setState(Le){Rp=Le.pluginStatus,Op=Le.pluginURL},isParsed:()=>null!=Np.applyArabicShaping&&null!=Np.processBidirectionalText&&null!=Np.processStyledBidirectionalText,getPluginURL:()=>Op};class Vs{constructor(Le,Re){this.zoom=Le,Re?(this.now=Re.now,this.fadeDuration=Re.fadeDuration,this.transition=Re.transition,this.pitch=Re.pitch,this.brightness=Re.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(Le){return function(Le,Re){for(const Oe of Le)if(!bs(Oe.charCodeAt(0),Re))return!1;return!0}(Le,Np.isLoaded())}}class Cs{constructor(Le,Re,Oe,Ue){this.property=Le,this.value=Re,this.expression=function(Le,Re,Oe,Ue){if(Ui(Le))return new ts(Le,Re);if(Wi(Le)||Array.isArray(Le)&&Le.length>0){const qe=Qi(Le,Re,Oe,Ue);if("error"===qe.result)throw new Error(qe.value.map((Le=>`${Le.key}: ${Le.message}`)).join(", "));return qe.value}{let Oe=Le;return"string"==typeof Le&&"color"===Re.type&&(Oe=Pe.parse(Le)),{kind:"constant",configDependencies:new Set,evaluate:()=>Oe}}}(void 0===Re?Le.specification.default:Re,Le.specification,Oe,Ue)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(Le,Re,Oe){return this.property.possiblyEvaluate(this,Le,Re,Oe)}}class Rs{constructor(Le,Re,Oe){this.property=Le,this.value=new Cs(Le,void 0,Re,Oe)}transitioned(Le,Re){return new Ls(this.property,this.value,Re,nt({},Le.transition,this.transition),Le.now)}
vendor: 6,720 bytes, line 1
1untransitioned(){return new Ls(this.property,this.value,null,{},0)}}class Ds{constructor(Le,Re,Oe){this._properties=Le,this._values=Object.create(Le.defaultTransitionablePropertyValues),this._scope=Re,this._options=Oe,this.configDependencies=new Set}getValue(Le){return ht(this._values[Le].value.value)}setValue(Le,Re){this._values.hasOwnProperty(Le)||(this._values[Le]=new Rs(this._values[Le].property,this._scope,this._options)),this._values[Le].value=new Cs(this._values[Le].property,null===Re?void 0:ht(Re),this._scope,this._options),this._values[Le].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[Le].value.expression.configDependencies]))}setTransitionOrValue(Le,Re){Re&&(this._options=Re);const Oe=this._properties.properties;if(Le)for(const Re in Le){const Ue=Le[Re];if(lt(Re,"-transition")){const Le=Re.slice(0,-11);Oe[Le]&&this.setTransition(Le,Ue)}else Oe.hasOwnProperty(Re)&&this.setValue(Re,Ue)}}getTransition(Le){return ht(this._values[Le].transition)}setTransition(Le,Re){this._values.hasOwnProperty(Le)||(this._values[Le]=new Rs(this._values[Le].property)),this._values[Le].transition=ht(Re)||void 0}serialize(){const Le={};for(const Re of Object.keys(this._values)){const Oe=this.getValue(Re);void 0!==Oe&&(Le[Re]=Oe);const Ue=this.getTransition(Re);void 0!==Ue&&(Le[`${Re}-transition`]=Ue)}return Le}transitioned(Le,Re){const Oe=new Fs(this._properties);for(const Ue of Object.keys(this._values))Oe._values[Ue]=this._values[Ue].transitioned(Le,Re._values[Ue]);return Oe}untransitioned(){const Le=new Fs(this._properties);for(const Re of Object.keys(this._values))Le._values[Re]=this._values[Re].untransitioned();return Le}}class Ls{constructor(Le,Re,Oe,Ue,qe){const Ct=Ue.delay||0,Ot=Ue.duration||0;qe=qe||0,this.property=Le,this.value=Re,this.begin=qe+Ct,this.end=this.begin+Ot,Le.specification.transition&&(Ue.delay||Ue.duration)&&(this.prior=Oe)}possiblyEvaluate(Le,Re,Oe){const Ue=Le.now||0,qe=this.value.possiblyEvaluate(Le,Re,Oe),Ct=this.prior;if(Ct){if(Ue>this.end)return this.prior=null,qe;if(this.value.isDataDriven())return this.prior=null,qe;if(Ue<this.begin)return Ct.possiblyEvaluate(Le,Re,Oe);{const Ot=(Ue-this.begin)/(this.end-this.begin);return this.property.interpolate(Ct.possiblyEvaluate(Le,Re,Oe),qe,H(Ot))}}return qe}}class Fs{constructor(Le){this._properties=Le,this._values=Object.create(Le.defaultTransitioningPropertyValues)}possiblyEvaluate(Le,Re,Oe){const Ue=new js(this._properties);for(const qe of Object.keys(this._values))Ue._values[qe]=this._values[qe].possiblyEvaluate(Le,Re,Oe);return Ue}hasTransition(){for(const Le of Object.keys(this._values))if(this._values[Le].prior)return!0;return!1}}class Os{constructor(Le,Re,Oe){this._properties=Le,this._values=Object.create(Le.defaultPropertyValues),this._scope=Re,this._options=Oe,this.configDependencies=new Set}getValue(Le){return ht(this._values[Le].value)}setValue(Le,Re){this._values[Le]=new Cs(this._values[Le].property,null===Re?void 0:ht(Re),this._scope,this._options),this._values[Le].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[Le].expression.configDependencies]))}serialize(){const Le={};for(const Re of Object.keys(this._values)){const Oe=this.getValue(Re);void 0!==Oe&&(Le[Re]=Oe)}return Le}possiblyEvaluate(Le,Re,Oe){const Ue=new js(this._properties);for(const qe of Object.keys(this._values))Ue._values[qe]=this._values[qe].possiblyEvaluate(Le,Re,Oe);return Ue}}class Us{constructor(Le,Re,Oe){this.property=Le,this.value=Re,this.parameters=Oe}isConstant(){return"constant"===this.value.kind}constantOr(Le){return"constant"===this.value.kind?this.value.value:Le}evaluate(Le,Re,Oe,Ue){return this.property.evaluate(this.value,this.parameters,Le,Re,Oe,Ue)}}class js{constructor(Le){this._properties=Le,this._values=Object.create(Le.defaultPossiblyEvaluatedValues)}get(Le){return this._values[Le]}}class Ns{constructor(Le){this.specification=Le}possiblyEvaluate(Le,Re){return Le.expression.evaluate(Re)}interpolate(Le,Re,Oe){const Ue=iu[this.specification.type];return Ue?Ue(Le,Re,Oe):Le}}class qs{constructor(Le,Re){this.specification=Le,this.overrides=Re}possiblyEvaluate(Le,Re,Oe,Ue){return new Us(this,"constant"===Le.expression.kind||"camera"===Le.expression.kind?{kind:"constant",value:Le.expression.evaluate(Re,null,{},Oe,Ue)}:Le.expression,Re)}interpolate(Le,Re,Oe){if("constant"!==Le.value.kind||"constant"!==Re.value.kind)return Le;if(void 0===Le.value.value||void 0===Re.value.value)return new Us(this,{kind:"constant",value:void 0},Le.parameters);const Ue=iu[this.specification.type];return Ue?new Us(this,{kind:"constant",value:Ue(Le.value.value,Re.value.value,Oe)},Le.parameters):Le}evaluate(Le,Re,Oe,Ue,qe,Ct){return"constant"===Le.kind?Le.value:Le.evaluate(Re,Oe,Ue,qe,Ct)}}class $s{constructor(Le){this.specification=Le}possiblyEvaluate(Le,Re,Oe,Ue){return!!Le.expression.evaluate(Re,null,{},Oe,Ue)}interpolate(){return!1}}class Gs{constructor(Le){this.properties=Le,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const Re=new Vs(0,{});for(const Oe in Le){const Ue=Le[Oe];Ue.specification.overridable&&this.overridableProperties.push(Oe);const qe=this.defaultPropertyValues[Oe]=new Cs(Ue,void 0),Ct=this.defaultTransitionablePropertyValues[Oe]=new Rs(Ue);this.defaultTransitioningPropertyValues[Oe]=Ct.untransitioned(),this.defaultPossiblyEvaluatedValues[Oe]=qe.possiblyEvaluate(Re)}}}os(qs,"DataDrivenProperty"),os(Ns,"DataConstantProperty"),os($s,"ColorRampProperty");var Vp=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"experimental":true,"type":"featuresets"}},"featuresets":{"experimental":true,"*":{"type":"featureset"}}
1,"featureset":{"experimental":true,"selectors":{"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"type":"string","required":true},"properties":{"type":"selectorProperty","required":false},"featureNamespace":{"type":"string","required":false}},"selectorProperty":{"experimental":true,"*":{"type":"*"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{"experimental":true}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant","experimental":true},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant","experimental":true}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"lin
1e-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":
1{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function Ys(Le){return Le instanceof Number||Le instanceof String||Le instanceof Boolean?Le.valueOf():Le}function Zs(Le){if(Array.isArray(Le))return Le.map(Zs);if(Le instanceof Object&&!(Le instanceof Number||Le instanceof String||Le instanceof Boolean)){const Re={};for(const Oe in Le)Re[Oe]=Zs(Le[Oe]);return Re}return Ys(Le)}function Ws(Le){if(!0===Le||!1===Le)return!0;
vendor: 6,610 bytes, line 1
1if(!Array.isArray(Le)||0===Le.length)return!1;switch(Le[0]){case"has":return Le.length>=2&&"$id"!==Le[1]&&"$type"!==Le[1];case"in":return Le.length>=3&&("string"!=typeof Le[1]||Array.isArray(Le[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==Le.length||Array.isArray(Le[1])||Array.isArray(Le[2]);case"any":case"all":for(const Re of Le.slice(1))if(!Ws(Re)&&"boolean"!=typeof Re)return!1;return!0;default:return!0}}function Hs(Le,Re="",Oe=null,Ue="fill"){if(null==Le)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Ws(Le)||(Le=na(Le));const qe=Le;let Ct=!0;try{Ct=function(Le){if(!Qs(Le))return Le;let Re=Zs(Le);return Js(Re),Re=Ks(Re),Re}(qe)}catch(Le){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(qe,null,2)}\n        `)}const Ot=Vp[`filter_${Ue}`],Jt=Hi(Ct,Ot,Re,Oe);let _i=null;if("error"===Jt.result)throw new Error(Jt.value.map((Le=>`${Le.key}: ${Le.message}`)).join(", "));_i=(Le,Re,Oe)=>Jt.value.evaluate(Le,Re,{},Oe);let xi=null,vi=null;if(Ct!==qe){const Le=Hi(qe,Ot,Re,Oe);if("error"===Le.result)throw new Error(Le.value.map((Le=>`${Le.key}: ${Le.message}`)).join(", "));xi=(Re,Oe,Ue,qe,Ct)=>Le.value.evaluate(Re,Oe,{},Ue,void 0,void 0,qe,Ct),vi=!En(Le.value.expression)}return{filter:_i,dynamicFilter:xi||void 0,needGeometry:ra(Ct),needFeature:!!vi}}function Ks(Le){if(!Array.isArray(Le))return Le;const Re=function(Le){if(Up.has(Le[0]))for(let Re=1;Re<Le.length;Re++)if(Qs(Le[Re]))return!0;return Le}(Le);return!0===Re?Re:Re.map((Le=>Ks(Le)))}function Js(Le){let Re=!1;const Oe=[];if("case"===Le[0]){for(let Ue=1;Ue<Le.length-1;Ue+=2)Re=Re||Qs(Le[Ue]),Oe.push(Le[Ue+1]);Oe.push(Le[Le.length-1])}else if("match"===Le[0]){Re=Re||Qs(Le[1]);for(let Re=2;Re<Le.length-1;Re+=2)Oe.push(Le[Re+1]);Oe.push(Le[Le.length-1])}else if("step"===Le[0]){Re=Re||Qs(Le[1]);for(let Re=1;Re<Le.length-1;Re+=2)Oe.push(Le[Re+1])}Re&&(Le.length=0,Le.push("any",...Oe));for(let Re=1;Re<Le.length;Re++)Js(Le[Re])}function Qs(Le){if(!Array.isArray(Le))return!1;if("pitch"===(Re=Le[0])||"distance-from-center"===Re)return!0;var Re;for(let Re=1;Re<Le.length;Re++)if(Qs(Le[Re]))return!0;return!1}const Up=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function ea(Le,Re){return Le<Re?-1:Le>Re?1:0}function ra(Le){if(!Array.isArray(Le))return!1;if("within"===Le[0]||"distance"===Le[0])return!0;for(let Re=1;Re<Le.length;Re++)if(ra(Le[Re]))return!0;return!1}function na(Le){if(!Le)return!0;const Re=Le[0];return Le.length<=1?"any"!==Re:"=="===Re?ia(Le[1],Le[2],"=="):"!="===Re?oa(ia(Le[1],Le[2],"==")):"<"===Re||">"===Re||"<="===Re||">="===Re?ia(Le[1],Le[2],Re):"any"===Re?(Oe=Le.slice(1),["any"].concat(Oe.map(na))):"all"===Re?["all"].concat(Le.slice(1).map(na)):"none"===Re?["all"].concat(Le.slice(1).map(na).map(oa)):"in"===Re?sa(Le[1],Le.slice(2)):"!in"===Re?oa(sa(Le[1],Le.slice(2))):"has"===Re?aa(Le[1]):"!has"!==Re||oa(aa(Le[1]));var Oe}function ia(Le,Re,Oe){switch(Le){case"$type":return[`filter-type-${Oe}`,Re];case"$id":return[`filter-id-${Oe}`,Re];default:return[`filter-${Oe}`,Le,Re]}}function sa(Le,Re){if(0===Re.length)return!1;switch(Le){case"$type":return["filter-type-in",["literal",Re]];case"$id":return["filter-id-in",["literal",Re]];default:return Re.length>200&&!Re.some((Le=>typeof Le!=typeof Re[0]))?["filter-in-large",Le,["literal",Re.sort(ea)]]:["filter-in-small",Le,["literal",Re]]}}function aa(Le){switch(Le){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",Le]}}function oa(Le){return["!",Le]}const jp="�";function ua(Le,Re){return Re?`${Le}${jp}${Re}`:Le}const Gp="-transition",qp=new Set(["fill","line","background","hillshade","raster"]);class pa extends Me{constructor(Le,Re,Oe,Ue,qe){if(super(),this.id=Le.id,this.fqid=ua(this.id,Oe),this.type=Le.type,this.scope=Oe,this.lut=Ue,this.options=qe,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==Le.type&&(this.metadata=Le.metadata,this.minzoom=Le.minzoom,this.maxzoom=Le.maxzoom,"background"!==Le.type&&"sky"!==Le.type&&"slot"!==Le.type&&(this.source=Le.source,this.sourceLayer=Le["source-layer"],this.filter=Le.filter),Le.slot&&(this.slot=Le.slot),Re.layout&&(this._unevaluatedLayout=new Os(Re.layout,this.scope,qe),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),Re.paint)){this._transitionablePaint=new Ds(Re.paint,this.scope,qe);for(const Re in Le.paint)this.setPaintProperty(Re,Le.paint[Re]);for(const Re in Le.layout)this.setLayoutProperty(Re,Le.layout[Re]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new js(Re.paint)}}onAdd(Le){}onRemove(Le){}isDraped(Le){return!this.is3D()&&qp.has(this.type)}getLayoutProperty(Le){return"visibility"===Le?this.visibility:this._unevaluatedLayout.getValue(Le)}setLayoutProperty(Le,Re){if("custom"===this.type&&"visibility"===Le)return void(this.visibility=Re);const Oe=this._unevaluatedLayout;Oe._properties.properties[Le]&&(Oe.setValue(Le,Re),this.configDependencies=new Set([...this.configDependencies,...Oe.configDependencies]),"visibility"===Le&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(Le){return lt(Le,Gp)?this._transitionablePaint.getTransition(Le.slice(0,-11)):this._transitionablePaint.getValue(Le)}setPaintProperty(Le,Re){const Oe=this._transitionablePaint,Ue=Oe._properties.properties;if(lt(Le,Gp)){const qe=Le.slice(0,-11);return Ue[qe]&&Oe.setTransition(qe,Re||void 0),!1}if(!Ue[Le])return!1;const qe=Oe._values[Le],Ct=qe.value.isDataDriven(),Ot=qe.value;Oe.setValue(Le,Re),this.configDependencies=new Set([...this.configDependencies,...Oe.configDependencies]),this._handleSpecialPaintPropertyUpdate(Le);const Jt=Oe._values[Le].value,_i=Jt.isDataDriven(),xi=lt(Le,"pattern")||"line-dasharray"===Le;return _i||Ct||xi||this._handleOverridablePaintPropertyUpdate(Le,Ot,Jt)}_handleSpecialPaintPropertyUpdate(Le){}getProgramIds(){return null}getDefaultProgramParams(Le,Re,Oe){return null}_handleOverridablePaintPropertyUpdate(Le,Re,Oe){return!1}
vendor: 25,880 bytes, line 1
1isHidden(Le){return!!(this.minzoom&&Le<this.minzoom)||!!(this.maxzoom&&Le>=this.maxzoom)||"none"===this.visibility}updateTransitions(Le){this._transitioningPaint=this._transitionablePaint.transitioned(Le,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(Le,Re){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(Le,void 0,Re)),this.paint=this._transitioningPaint.possiblyEvaluate(Le,void 0,Re)}serialize(){return ct({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},((Le,Re)=>!(void 0===Le||"layout"===Re&&!Object.keys(Le).length||"paint"===Re&&!Object.keys(Le).length)))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const Le in this.paint._values){const Re=this.paint.get(Le);if(Re instanceof Us&&Di(Re.property.specification)&&("source"===Re.value.kind||"composite"===Re.value.kind)&&Re.value.isStateDependent)return!0}return!1}compileFilter(Le){this._filterCompiled||(this._featureFilter=Hs(this.filter,this.scope,Le),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(Le){this._stats&&("shadow"===Le.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(Le){}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){}queryIntersectsMatchingFeature(Le,Re,Oe,Ue){}}const $p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class da{constructor(Le,Re){this._structArray=Le,this._pos1=Re*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ma{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(Le,Re){return Le._trim(),Re&&(Le.isTransferred=!0,Re.add(Le.arrayBuffer)),{length:Le.length,arrayBuffer:Le.arrayBuffer}}static deserialize(Le){const Re=Object.create(this.prototype);return Re.arrayBuffer=Le.arrayBuffer,Re.length=Le.length,Re.capacity=Le.arrayBuffer.byteLength/Re.bytesPerElement,Re._refreshViews(),Re}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(Le){this.reserve(Le),this.length=Le}reserve(Le){if(Le>this.capacity){this.capacity=Math.max(Le,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const Re=this.uint8;this._refreshViews(),Re&&this.uint8.set(Re)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...Le){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...Le){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ya(Le,Re=1){let Oe=0,Ue=0;return{members:Le.map((Le=>{const qe=$p[Le.type].BYTES_PER_ELEMENT,Ct=Oe=ga(Oe,Math.max(Re,qe)),Ot=Le.components||1;return Ue=Math.max(Ue,qe),Oe+=qe*Ot,{name:Le.name,type:Le.type,components:Ot,offset:Ct}})),size:ga(Oe,Math.max(Ue,Re)),alignment:Re}}function ga(Le,Re){return Math.ceil(Le/Re)*Re}class xa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,Le,Re)}emplace(Le,Re,Oe){const Ue=2*Le;return this.int16[Ue+0]=Re,this.int16[Ue+1]=Oe,Le}}xa.prototype.bytesPerElement=4,os(xa,"StructArrayLayout2i4");class ba extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe){const Ue=this.length;return this.resize(Ue+1),this.emplace(Ue,Le,Re,Oe)}emplace(Le,Re,Oe,Ue){const qe=3*Le;return this.int16[qe+0]=Re,this.int16[qe+1]=Oe,this.int16[qe+2]=Ue,Le}}ba.prototype.bytesPerElement=6,os(ba,"StructArrayLayout3i6");class va extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue){const qe=this.length;return this.resize(qe+1),this.emplace(qe,Le,Re,Oe,Ue)}emplace(Le,Re,Oe,Ue,qe){const Ct=4*Le;return this.int16[Ct+0]=Re,this.int16[Ct+1]=Oe,this.int16[Ct+2]=Ue,this.int16[Ct+3]=qe,Le}}va.prototype.bytesPerElement=8,os(va,"StructArrayLayout4i8");class wa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,Le,Re,Oe,Ue,qe)}emplace(Le,Re,Oe,Ue,qe,Ct){const Ot=5*Le;return this.int16[Ot+0]=Re,this.int16[Ot+1]=Oe,this.int16[Ot+2]=Ue,this.int16[Ot+3]=qe,this.int16[Ot+4]=Ct,Le}}wa.prototype.bytesPerElement=10,os(wa,"StructArrayLayout5i10");class _a extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.length;return this.resize(Jt+1),this.emplace(Jt,Le,Re,Oe,Ue,qe,Ct,Ot)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=6*Le,xi=12*Le,vi=3*Le;return this.int16[_i+0]=Re,this.int16[_i+1]=Oe,this.uint8[xi+4]=Ue,this.uint8[xi+5]=qe,this.uint8[xi+6]=Ct,this.uint8[xi+7]=Ot,this.float32[vi+2]=Jt,Le}}_a.prototype.bytesPerElement=12,os(_a,"StructArrayLayout2i4ub1f12");class Ma extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue){const qe=this.length;return this.resize(qe+1),this.emplace(qe,Le,Re,Oe,Ue)}emplace(Le,Re,Oe,Ue,qe){const Ct=4*Le;return this.float32[Ct+0]=Re,this.float32[Ct+1]=Oe,this.float32[Ct+2]=Ue,this.float32[Ct+3]=qe,Le}}Ma.prototype.bytesPerElement=16,os(Ma,"StructArrayLayout4f16");class Aa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe){const Ue=this.length;return this.resize(Ue+1),this.emplace(Ue,Le,Re,Oe)}emplace(Le,Re,Oe,Ue){const qe=3*Le;return this.float32[qe+0]=Re,this.float32[qe+1]=Oe,this.float32[qe+2]=Ue,Le}}Aa.prototype.bytesPerElement=12,os(Aa,"StructArrayLayout3f12");class Sa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,Le,Re,Oe,Ue,qe)}emplace(Le,Re,Oe,Ue,qe,Ct){const Ot=6*Le,Jt=3*Le;return this.uint16[Ot+0]=Re,this.uint16[Ot+1]=Oe,this.uint16[Ot+2]=Ue,this.uint16[Ot+3]=qe,this.float32[Jt+2]=Ct,Le}}Sa.prototype.bytesPerElement=12,os(Sa,"StructArrayLayout4ui1f12");class Ia extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue){const qe=this.length;return this.resize(qe+1),this.emplace(qe,Le,Re,Oe,Ue)}emplace(Le,Re,Oe,Ue,qe){const Ct=4*Le;return this.uint16[Ct+0]=Re,this.uint16[Ct+1]=Oe,this.uint16[Ct+2]=Ue,this.uint16[Ct+3]=qe,Le}}Ia.prototype.bytesPerElement=8,os(Ia,"StructArrayLayout4ui8");class Pa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct){const Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,Le,Re,Oe,Ue,qe,Ct)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=6*Le;return this.int16[Jt+0]=Re,this.int16[Jt+1]=Oe,this.int16[Jt+2]=Ue,this.int16[Jt+3]=qe,this.int16[Jt+4]=Ct,this.int16[Jt+5]=Ot,Le}}Pa.prototype.bytesPerElement=12,os(Pa,"StructArrayLayout6i12");class za extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi){const Pi=this.length;return this.resize(Pi+1),this.emplace(Pi,Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi){const Hr=12*Le;return this.int16[Hr+0]=Re,this.int16[Hr+1]=Oe,this.int16[Hr+2]=Ue,this.int16[Hr+3]=qe,this.uint16[Hr+4]=Ct,this.uint16[Hr+5]=Ot,this.uint16[Hr+6]=Jt,this.uint16[Hr+7]=_i,this.int16[Hr+8]=xi,this.int16[Hr+9]=vi,this.int16[Hr+10]=bi,this.int16[Hr+11]=Pi,Le}}za.prototype.bytesPerElement=24,os(za,"StructArrayLayout4i4ui4i24");class ka extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct){const Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,Le,Re,Oe,Ue,qe,Ct)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=10*Le,_i=5*Le;return this.int16[Jt+0]=Re,this.int16[Jt+1]=Oe,this.int16[Jt+2]=Ue,this.float32[_i+2]=qe,this.float32[_i+3]=Ct,this.float32[_i+4]=Ot,Le}}ka.prototype.bytesPerElement=20,os(ka,"StructArrayLayout3i3f20");class Ta extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(Le){const Re=this.length;return this.resize(Re+1),this.emplace(Re,Le)}emplace(Le,Re){return this.uint32[1*Le+0]=Re,Le}}Ta.prototype.bytesPerElement=4,os(Ta,"StructArrayLayout1ul4");class Ea extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le,Re){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,Le,Re)}emplace(Le,Re,Oe){const Ue=2*Le;return this.uint16[Ue+0]=Re,this.uint16[Ue+1]=Oe,Le}}Ea.prototype.bytesPerElement=4,os(Ea,"StructArrayLayout2ui4");class Ba extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi){const Hr=this.length;return this.resize(Hr+1),this.emplace(Hr,Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr){const Jr=20*Le,Ln=10*Le;return this.int16[Jr+0]=Re,this.int16[Jr+1]=Oe,this.int16[Jr+2]=Ue,this.int16[Jr+3]=qe,this.int16[Jr+4]=Ct,this.float32[Ln+3]=Ot,this.float32[Ln+4]=Jt,this.float32[Ln+5]=_i,this.float32[Ln+6]=xi,this.int16[Jr+14]=vi,this.uint32[Ln+8]=bi,this.uint16[Jr+18]=Pi,this.uint16[Jr+19]=Hr,Le}}Ba.prototype.bytesPerElement=40,os(Ba,"StructArrayLayout5i4f1i1ul2ui40");class Va extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.length;return this.resize(Jt+1),this.emplace(Jt,Le,Re,Oe,Ue,qe,Ct,Ot)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=8*Le;return this.int16[_i+0]=Re,this.int16[_i+1]=Oe,this.int16[_i+2]=Ue,this.int16[_i+4]=qe,this.int16[_i+5]=Ct,this.int16[_i+6]=Ot,this.int16[_i+7]=Jt,Le}}Va.prototype.bytesPerElement=16,os(Va,"StructArrayLayout3i2i2i16");class Ca extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,Le,Re,Oe,Ue,qe)}emplace(Le,Re,Oe,Ue,qe,Ct){const Ot=4*Le,Jt=8*Le;return this.float32[Ot+0]=Re,this.float32[Ot+1]=Oe,this.float32[Ot+2]=Ue,this.int16[Jt+6]=qe,this.int16[Jt+7]=Ct,Le}}Ca.prototype.bytesPerElement=16,os(Ca,"StructArrayLayout2f1f2i16");class Ra extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct){const Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,Le,Re,Oe,Ue,qe,Ct)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=20*Le,_i=5*Le;return this.uint8[Jt+0]=Re,this.uint8[Jt+1]=Oe,this.float32[_i+1]=Ue,this.float32[_i+2]=qe,this.float32[_i+3]=Ct,this.float32[_i+4]=Ot,Le}}Ra.prototype.bytesPerElement=20,os(Ra,"StructArrayLayout2ub4f20");class Da extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe){const Ue=this.length;return this.resize(Ue+1),this.emplace(Ue,Le,Re,Oe)}emplace(Le,Re,Oe,Ue){const qe=3*Le;return this.uint16[qe+0]=Re,this.uint16[qe+1]=Oe,this.uint16[qe+2]=Ue,Le}}Da.prototype.bytesPerElement=6,os(Da,"StructArrayLayout3ui6");class La extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n){const Xn=this.length;return this.resize(Xn+1),this.emplace(Xn,Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn){const Yn=30*Le,lo=15*Le,uo=60*Le;return this.int16[Yn+0]=Re,this.int16[Yn+1]=Oe,this.int16[Yn+2]=Ue,this.float32[lo+2]=qe,this.float32[lo+3]=Ct,this.uint16[Yn+8]=Ot,this.uint16[Yn+9]=Jt,this.uint32[lo+5]=_i,this.uint32[lo+6]=xi,this.uint32[lo+7]=vi,this.uint16[Yn+16]=bi,this.uint16[Yn+17]=Pi,this.uint16[Yn+18]=Hr,this.float32[lo+10]=Jr,this.float32[lo+11]=Ln,this.uint8[uo+48]=Nn,this.uint8[uo+49]=Gn,this.uint8[uo+50]=qn,this.uint32[lo+13]=Zn,this.int16[Yn+28]=$n,this.uint8[uo+58]=Xn,Le}}La.prototype.bytesPerElement=60,os(La,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Fa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn,Yn,lo,uo,po,fo,Io,is,as,Is,Xs){const ta=this.length;return this.resize(ta+1),this.emplace(ta,Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn,Yn,lo,uo,po,fo,Io,is,as,Is,Xs)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn,Yn,lo,uo,po,fo,Io,is,as,Is,Xs,ta){const ha=20*Le,el=40*Le,tl=80*Le;return this.float32[ha+0]=Re,this.float32[ha+1]=Oe,this.int16[el+4]=Ue,this.int16[el+5]=qe,this.int16[el+6]=Ct,this.int16[el+7]=Ot,this.int16[el+8]=Jt,this.int16[el+9]=_i,this.int16[el+10]=xi,this.int16[el+11]=vi,this.int16[el+12]=bi,this.uint16[el+13]=Pi,this.uint16[el+14]=Hr,this.uint16[el+15]=Jr,this.uint16[el+16]=Ln,this.uint16[el+17]=Nn,this.uint16[el+18]=Gn,this.uint16[el+19]=qn,this.uint16[el+20]=Zn,this.uint16[el+21]=$n,this.uint16[el+22]=Xn,this.uint16[el+23]=Yn,this.uint16[el+24]=lo,this.uint16[el+25]=uo,this.uint16[el+26]=po,this.uint16[el+27]=fo,this.uint32[ha+14]=Io,this.float32[ha+15]=is,this.float32[ha+16]=as,this.float32[ha+17]=Is,this.float32[ha+18]=Xs,this.uint8[tl+76]=ta,Le}}Fa.prototype.bytesPerElement=80,os(Fa,"StructArrayLayout2f9i15ui1ul4f1ub80");class Oa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le){const Re=this.length;return this.resize(Re+1),this.emplace(Re,Le)}emplace(Le,Re){return this.float32[1*Le+0]=Re,Le}}Oa.prototype.bytesPerElement=4,os(Oa,"StructArrayLayout1f4");class Ua extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,Le,Re,Oe,Ue,qe)}emplace(Le,Re,Oe,Ue,qe,Ct){const Ot=5*Le;return this.float32[Ot+0]=Re,this.float32[Ot+1]=Oe,this.float32[Ot+2]=Ue,this.float32[Ot+3]=qe,this.float32[Ot+4]=Ct,Le}}Ua.prototype.bytesPerElement=20,os(Ua,"StructArrayLayout5f20");class ja extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.length;return this.resize(Jt+1),this.emplace(Jt,Le,Re,Oe,Ue,qe,Ct,Ot)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=7*Le;return this.float32[_i+0]=Re,this.float32[_i+1]=Oe,this.float32[_i+2]=Ue,this.float32[_i+3]=qe,this.float32[_i+4]=Ct,this.float32[_i+5]=Ot,this.float32[_i+6]=Jt,Le}}ja.prototype.bytesPerElement=28,os(ja,"StructArrayLayout7f28");class Na extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue){const qe=this.length;return this.resize(qe+1),this.emplace(qe,Le,Re,Oe,Ue)}emplace(Le,Re,Oe,Ue,qe){const Ct=6*Le;return this.uint32[3*Le+0]=Re,this.uint16[Ct+2]=Oe,this.uint16[Ct+3]=Ue,this.uint16[Ct+4]=qe,Le}}Na.prototype.bytesPerElement=12,os(Na,"StructArrayLayout1ul3ui12");class qa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(Le){const Re=this.length;return this.resize(Re+1),this.emplace(Re,Le)}emplace(Le,Re){return this.uint16[1*Le+0]=Re,Le}}qa.prototype.bytesPerElement=2,os(qa,"StructArrayLayout1ui2");class $a extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,Le,Re)}emplace(Le,Re,Oe){const Ue=2*Le;return this.float32[Ue+0]=Re,this.float32[Ue+1]=Oe,Le}}$a.prototype.bytesPerElement=8,os($a,"StructArrayLayout2f8");class Ga extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln){const Nn=this.length;return this.resize(Nn+1),this.emplace(Nn,Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn){const Gn=16*Le;return this.float32[Gn+0]=Re,this.float32[Gn+1]=Oe,this.float32[Gn+2]=Ue,this.float32[Gn+3]=qe,this.float32[Gn+4]=Ct,this.float32[Gn+5]=Ot,this.float32[Gn+6]=Jt,this.float32[Gn+7]=_i,this.float32[Gn+8]=xi,this.float32[Gn+9]=vi,this.float32[Gn+10]=bi,this.float32[Gn+11]=Pi,this.float32[Gn+12]=Hr,this.float32[Gn+13]=Jr,this.float32[Gn+14]=Ln,this.float32[Gn+15]=Nn,Le}}Ga.prototype.bytesPerElement=64,os(Ga,"StructArrayLayout16f64");class Xa extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.length;return this.resize(Jt+1),this.emplace(Jt,Le,Re,Oe,Ue,qe,Ct,Ot)}emplace(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=10*Le,xi=5*Le;return this.uint16[_i+0]=Re,this.uint16[_i+1]=Oe,this.uint16[_i+2]=Ue,this.uint16[_i+3]=qe,this.float32[xi+2]=Ct,this.float32[xi+3]=Ot,this.float32[xi+4]=Jt,Le}}Xa.prototype.bytesPerElement=20,os(Xa,"StructArrayLayout4ui3f20");class Ya extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(Le){const Re=this.length;return this.resize(Re+1),this.emplace(Re,Le)}emplace(Le,Re){return this.int16[1*Le+0]=Re,Le}}Ya.prototype.bytesPerElement=2,os(Ya,"StructArrayLayout1i2");class Za extends ma{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(Le){const Re=this.length;return this.resize(Re+1),this.emplace(Re,Le)}emplace(Le,Re){return this.uint8[1*Le+0]=Re,Le}}Za.prototype.bytesPerElement=1,os(Za,"StructArrayLayout1ub1");class Wa extends da{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Wa.prototype.size=40;class Ha extends Ba{get(Le){return new Wa(this,Le)}}os(Ha,"CollisionBoxArray");class Ka extends da{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(Le){this._structArray.uint8[this._pos1+49]=Le}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(Le){this._structArray.uint8[this._pos1+50]=Le}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(Le){this._structArray.uint32[this._pos4+13]=Le}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(Le){this._structArray.uint8[this._pos1+58]=Le}}Ka.prototype.size=60;class Ja extends La{get(Le){return new Ka(this,Le)}}os(Ja,"PlacedSymbolArray");class Qa extends da{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(Le){this._structArray.uint32[this._pos4+14]=Le}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(Le){this._structArray.float32[this._pos4+18]=Le}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}Qa.prototype.size=80;class to extends Fa{get(Le){return new Qa(this,Le)}}os(to,"SymbolInstanceArray");class eo extends Oa{getoffsetX(Le){return this.float32[1*Le+0]}}os(eo,"GlyphOffsetArray");class ro extends xa{getx(Le){return this.int16[2*Le+0]}gety(Le){return this.int16[2*Le+1]}}os(ro,"SymbolLineVertexArray");class no extends da{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}no.prototype.size=12;class io extends Na{get(Le){return new no(this,Le)}}os(io,"FeatureIndexArray");
vendor: 4,631 bytes, line 1
1class so extends Ea{geta_centroid_pos0(Le){return this.uint16[2*Le+0]}geta_centroid_pos1(Le){return this.uint16[2*Le+1]}}os(so,"FillExtrusionCentroidArray");class ao extends da{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}ao.prototype.size=6;class oo extends ba{get(Le){return new ao(this,Le)}}os(oo,"FillExtrusionWallArray");const Wp=ya([{name:"a_pos",components:2,type:"Int16"}],4),Kp=ya([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class co{constructor(Le=[]){this.segments=Le}_prepareSegment(Le,Re,Oe,Ue){let qe=this.segments[this.segments.length-1];return Le>co.MAX_VERTEX_ARRAY_LENGTH&&ft(`Max vertices per segment is ${co.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${Le}`),(!qe||qe.vertexLength+Le>co.MAX_VERTEX_ARRAY_LENGTH||qe.sortKey!==Ue)&&(qe={vertexOffset:Re,primitiveOffset:Oe,vertexLength:0,primitiveLength:0},void 0!==Ue&&(qe.sortKey=Ue),this.segments.push(qe)),qe}prepareSegment(Le,Re,Oe,Ue){return this._prepareSegment(Le,Re.length,Oe.length,Ue)}get(){return this.segments}destroy(){for(const Le of this.segments)for(const Re in Le.vaos)Le.vaos[Re].destroy()}static simpleSegment(Le,Re,Oe,Ue){return new co([{vertexOffset:Le,primitiveOffset:Re,vertexLength:Oe,primitiveLength:Ue,vaos:{},sortKey:0}])}}function ho(Le,Re){return 256*(Le=Q(Math.floor(Le),0,255))+Q(Math.floor(Re),0,255)}co.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,os(co,"SegmentVector");const ef=ya([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),tf=ya([{name:"a_dash",components:4,type:"Uint16"}]);class mo{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(Le,Re,Oe,Ue){this.ids.push(yo(Le)),this.positions.push(Re,Oe,Ue)}eachPosition(Le,Re){const Oe=yo(Le);let Ue=0,qe=this.ids.length-1;for(;Ue<qe;){const Le=Ue+qe>>1;this.ids[Le]>=Oe?qe=Le:Ue=Le+1}for(;this.ids[Ue]===Oe;)Re(this.positions[3*Ue],this.positions[3*Ue+1],this.positions[3*Ue+2]),Ue++}static serialize(Le,Re){const Oe=new Float64Array(Le.ids),Ue=new Uint32Array(Le.positions);return go(Oe,Ue,0,Oe.length-1),Re&&(Re.add(Oe.buffer),Re.add(Ue.buffer)),{ids:Oe,positions:Ue}}static deserialize(Le){const Re=new mo;let Oe;Re.ids=Le.ids,Re.positions=Le.positions;for(const Le of Re.ids)Le!==Oe&&Re.uniqueIds.push(Le),Oe=Le;return Re.indexed=!0,Re}}function yo(Le){const Re=+Le;return!isNaN(Re)&&Number.MIN_SAFE_INTEGER<=Re&&Re<=Number.MAX_SAFE_INTEGER?Re:Rh(String(Le))}function go(Le,Re,Oe,Ue){for(;Oe<Ue;){const qe=Le[Oe+Ue>>1];let Ct=Oe-1,Ot=Ue+1;for(;;){do{Ct++}while(Le[Ct]<qe);do{Ot--}while(Le[Ot]>qe);if(Ct>=Ot)break;xo(Le,Ct,Ot),xo(Re,3*Ct,3*Ot),xo(Re,3*Ct+1,3*Ot+1),xo(Re,3*Ct+2,3*Ot+2)}Ot-Oe<Ue-Ot?(go(Le,Re,Oe,Ot),Oe=Ot+1):(go(Le,Re,Ot+1,Ue),Ue=Ot)}}function xo(Le,Re,Oe){const Ue=Le[Re];Le[Re]=Le[Oe],Le[Oe]=Ue}os(mo,"FeaturePositionMap");class bo{constructor(Le){this.gl=Le.gl,this.initialized=!1}fetchUniformLocation(Le,Re){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(Le,Re),this.initialized=!0),!!this.location}set(Le,Re,Oe){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class vo extends bo{constructor(Le){super(Le),this.current=0}set(Le,Re,Oe){this.fetchUniformLocation(Le,Re)&&this.current!==Oe&&(this.current=Oe,this.gl.uniform1i(this.location,Oe))}}class wo extends bo{constructor(Le){super(Le),this.current=0}set(Le,Re,Oe){this.fetchUniformLocation(Le,Re)&&this.current!==Oe&&(this.current=Oe,this.gl.uniform1f(this.location,Oe))}}class _o extends bo{constructor(Le){super(Le),this.current=[0,0]}set(Le,Re,Oe){this.fetchUniformLocation(Le,Re)&&(Oe[0]===this.current[0]&&Oe[1]===this.current[1]||(this.current=Oe,this.gl.uniform2f(this.location,Oe[0],Oe[1])))}}class Mo extends bo{constructor(Le){super(Le),this.current=[0,0,0]}set(Le,Re,Oe){this.fetchUniformLocation(Le,Re)&&(Oe[0]===this.current[0]&&Oe[1]===this.current[1]&&Oe[2]===this.current[2]||(this.current=Oe,this.gl.uniform3f(this.location,Oe[0],Oe[1],Oe[2])))}}class Ao extends bo{constructor(Le){super(Le),this.current=[0,0,0,0]}set(Le,Re,Oe){this.fetchUniformLocation(Le,Re)&&(Oe[0]===this.current[0]&&Oe[1]===this.current[1]&&Oe[2]===this.current[2]&&Oe[3]===this.current[3]||(this.current=Oe,this.gl.uniform4f(this.location,Oe[0],Oe[1],Oe[2],Oe[3])))}}class So extends bo{constructor(Le){super(Le),this.current=Pe.transparent.toRenderColor(null)}set(Le,Re,Oe){this.fetchUniformLocation(Le,Re)&&(Oe.r===this.current.r&&Oe.g
1===this.current.g&&Oe.b===this.current.b&&Oe.a===this.current.a||(this.current=Oe,this.gl.uniform4f(this.location,Oe.r,Oe.g,Oe.b,Oe.a)))}}const rf=new Float32Array(16);class Po extends bo{constructor(Le){super(Le),this.current=rf}set(Le,Re,Oe){if(this.fetchUniformLocation(Le,Re)){if(Oe[12]!==this.current[12]||Oe[0]!==this.current[0])return this.current=Oe,void this.gl.uniformMatrix4fv(this.location,!1,Oe);for(let Le=1;Le<16;Le++)if(Oe[Le]!==this.current[Le]){this.current=Oe,this.gl.uniformMatrix4fv(this.location,!1,Oe);break}}}}const nf=new Float32Array(9),of=new Float32Array(4);class To extends bo{constructor(Le){super(Le),this.current=of}set(Le,Re,Oe){if(this.fetchUniformLocation(Le,Re))for(let Le=0;Le<4;Le++)if(Oe[Le]!==this.current[Le]){this.current=Oe,this.gl.uniformMatrix2fv(this.location,!1,Oe);break}}}function Eo(Le){return[ho(255*Le.r,255*Le.g),ho(255*Le.b,255*Le.a)]}class Bo{constructor(Le,Re,Oe,Ue){this.value=Le,this.uniformNames=Re.map((Le=>`u_${Le}`)),this.type=Oe,this.context=Ue}setUniform(Le,Re,Oe,Ue,qe){const Ct=Ue.constantOr(this.value);Re.set(Le,qe,Ct instanceof Pe?Ct.toRenderColor(this.context.lut):Ct)}getBinding(Le,Re){return"color"===this.type?new So(Le):new wo(Le)}}class Vo{constructor(Le,Re){this.uniformNames=Re.map((Le=>`u_${Le}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(Le){this.pixelRatio=Le.pixelRatio||1,this.pattern=Le.tl.concat(Le.br)}setUniform(Le,Re,Oe,Ue,qe){const Ct="u_pattern"===qe||"u_dash"===qe?this.pattern:"u_pixel_ratio"===qe?this.pixelRatio:null;Ct&&Re.set(Le,qe,Ct)}getBinding(Le,Re){return"u_pattern"===Re||"u_dash"===Re?new Ao(Le):new wo(Le)}}class Co{constructor(Le,Re,Oe,Ue){this.expression=Le,this.type=Oe,this.maxValue=0,this.paintVertexAttributes=Re.map((Le=>({name:`a_${Le}`,type:"Float32",components:"color"===Oe?2:1,offset:0}))),this.paintVertexArray=new Ue}populatePaintArray(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.paintVertexArray.length,_i=this.expression.evaluate(new Vs(0,{brightness:Ct}),Re,{},qe,Ue,Ot);this.paintVertexArray.resize(Le),this._setPaintValue(Jt,Le,_i,this.context)}updatePaintArray(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.expression.evaluate({zoom:0,brightness:Ot},Oe,Ue,void 0,qe);this._setPaintValue(Le,Re,Jt,this.context)}_setPaintValue(Le,Re,Oe,Ue){if("color"===this.type){const qe=Eo(Oe.toRenderColor(Ue.lut));for(let Oe=Le;Oe<Re;Oe++)this.paintVertexArray.emplace(Oe,qe[0],qe[1])}else{for(let Ue=Le;Ue<Re;Ue++)this.paintVertexArray.emplace(Ue,Oe);this.maxValue=Math.max(this.maxValue,Math.abs(Oe))}}upload(Le){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=Le.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ro{constructor(Le,Re,Oe,Ue,qe,Ct){this.expression=Le,this.uniformNames=Re.map((Le=>`u_${Le}_t`)),this.type=Oe,this.useIntegerZoom=Ue,this.context=qe,this.maxValue=0,this.paintVertexAttributes=Re.map((Le=>({name:`a_${Le}`,type:"Float32",components:"color"===Oe?4:2,offset:0}))),this.paintVertexArray=new Ct}populatePaintArray(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.expression.evaluate(new Vs(this.context.zoom,{brightness:Ct}),Re,{},qe,Ue,Ot),_i=this.expression.evaluate(new Vs(this.context.zoom+1,{brightness:Ct}),Re,{},qe,Ue,Ot),xi=this.paintVertexArray.length;this.paintVertexArray.resize(Le),this._setPaintValue(xi,Le,Jt,_i,this.context)}updatePaintArray(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.expression.evaluate({zoom:this.context.zoom,brightness:Ot},Oe,Ue,void 0,qe),_i=this.expression.evaluate({zoom:this.context.zoom+1,brightness:Ot},Oe,Ue,void 0,qe);this._setPaintValue(Le,Re,Jt,_i,this.context)}_setPaintValue(Le,Re,Oe,Ue,qe){if("color"===this.type){const Ue=Eo(Oe.toRenderColor(qe.lut)),Ct=Eo(Oe.toRenderColor(qe.lut));for(let Oe=Le;Oe<Re;Oe++)this.paintVertexArray.emplace(Oe,Ue[0],Ue[1],Ct[0],Ct[1])}else{for(let qe=Le;qe<Re;qe++)this.paintVertexArray.emplace(qe,Oe,Ue);this.maxValue=Math.max(this.maxValue,Math.abs(Oe),Math.abs(Ue))}}upload(Le){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=Le.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(Le,Re,Oe,Ue,qe){const Ct=this.useIntegerZoom?Math.floor(Oe.zoom):Oe.zoom,Ot
vendor: 6,425 bytes, line 1
1=Q(this.expression.interpolationFactor(Ct,this.context.zoom,this.context.zoom+1),0,1);Re.set(Le,qe,Ot)}getBinding(Le,Re){return new wo(Le)}}class Do{constructor(Le,Re,Oe,Ue,qe){this.expression=Le,this.layerId=qe,this.paintVertexAttributes=("array"===Oe?tf:ef).members;for(let Le=0;Le<Re.length;++Le);this.paintVertexArray=new Ue}populatePaintArray(Le,Re,Oe,Ue){const qe=this.paintVertexArray.length;this.paintVertexArray.resize(Le),this._setPaintValues(qe,Le,Re.patterns&&Re.patterns[this.layerId],Oe)}updatePaintArray(Le,Re,Oe,Ue,qe,Ct,Ot){this._setPaintValues(Le,Re,Oe.patterns&&Oe.patterns[this.layerId],Ct)}_setPaintValues(Le,Re,Oe,Ue){if(!Ue||!Oe)return;const qe=Ue[Oe];if(!qe)return;const{tl:Ct,br:Ot,pixelRatio:Jt}=qe;for(let Oe=Le;Oe<Re;Oe++)this.paintVertexArray.emplace(Oe,Ct[0],Ct[1],Ot[0],Ot[1],Jt)}upload(Le){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=Le.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Lo{constructor(Le,Re,Oe=(()=>!0)){this.binders={},this._buffers=[],this.context=Re;const Ue=[];for(const qe in Le.paint._values){const Ct=Le.paint.get(qe);if(!Oe(qe))continue;if(!(Ct instanceof Us&&Di(Ct.property.specification)))continue;const Ot=Uo(qe,Le.type),Jt=Ct.value,_i=Ct.property.specification.type,xi=!!Ct.property.useIntegerZoom,vi="line-dasharray"===qe||qe.endsWith("pattern"),bi="line-dasharray"===qe&&"constant"!==Le.layout.get("line-cap").value.kind;if("constant"!==Jt.kind||bi)if("source"===Jt.kind||bi||vi){const Re=qo(qe,_i,"source");this.binders[qe]=vi?new Do(Jt,Ot,_i,Re,Le.id):new Co(Jt,Ot,_i,Re),Ue.push(`/a_${qe}`)}else{const Le=qo(qe,_i,"composite");this.binders[qe]=new Ro(Jt,Ot,_i,xi,Re,Le),Ue.push(`/z_${qe}`)}else this.binders[qe]=vi?new Vo(Jt.value,Ot):new Bo(Jt.value,Ot,_i,Re),Ue.push(`/u_${qe}`)}this.cacheKey=Ue.sort().join("")}getMaxValue(Le){const Re=this.binders[Le];return Re instanceof Co||Re instanceof Ro?Re.maxValue:0}populatePaintArrays(Le,Re,Oe,Ue,qe,Ct,Ot){for(const Jt in this.binders){const _i=this.binders[Jt];_i.context=this.context,(_i instanceof Co||_i instanceof Ro||_i instanceof Do)&&_i.populatePaintArray(Le,Re,Oe,Ue,qe,Ct,Ot)}}setConstantPatternPositions(Le){for(const Re in this.binders){const Oe=this.binders[Re];Oe instanceof Vo&&Oe.setConstantPatternPositions(Le)}}updatePaintArrays(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){let _i=!1;const xi=Object.keys(Le),vi=0!==xi.length,bi=vi?xi:Re.uniqueIds;this.context.lut=qe.lut;for(const xi in this.binders){const Pi=this.binders[xi];if(Pi.context=this.context,(Pi instanceof Co||Pi instanceof Ro||Pi instanceof Do)&&(!0===Pi.expression.isStateDependent||!1===Pi.expression.isLightConstant)){const Hr=qe.paint.get(xi);Pi.expression=Hr.value;for(const Oe of bi){const qe=Le[Oe.toString()];Re.eachPosition(Oe,((Le,Re,Oe)=>{const _i=Ue.feature(Le);Pi.updatePaintArray(Re,Oe,_i,qe,Ct,Ot,Jt)}))}if(!vi)for(const Re of Oe.uniqueIds){const qe=Le[Re.toString()];Oe.eachPosition(Re,((Le,Re,Oe)=>{const _i=Ue.feature(Le);Pi.updatePaintArray(Re,Oe,_i,qe,Ct,Ot,Jt)}))}_i=!0}}return _i}defines(){const Le=[];for(const Re in this.binders){const Oe=this.binders[Re];(Oe instanceof Bo||Oe instanceof Vo)&&Le.push(...Oe.uniformNames.map((Le=>`#define HAS_UNIFORM_${Le}`)))}return Le}getBinderAttributes(){const Le=[];for(const Re in this.binders){const Oe=this.binders[Re];if(Oe instanceof Co||Oe instanceof Ro||Oe instanceof Do)for(let Re=0;Re<Oe.paintVertexAttributes.length;Re++)Le.push(Oe.paintVertexAttributes[Re].name)}return Le}getBinderUniforms(){const Le=[];for(const Re in this.binders){const Oe=this.binders[Re];if(Oe instanceof Bo||Oe instanceof Vo||Oe instanceof Ro)for(const Re of Oe.uniformNames)Le.push(Re)}return Le}getPaintVertexBuffers(){return this._buffers}getUniforms(Le){const Re=[];for(const Oe in this.binders){const Ue=this.binders[Oe];if(Ue instanceof Bo||Ue instanceof Vo||Ue instanceof Ro)for(const qe of Ue.uniformNames)Re.push({name:qe,property:Oe,binding:Ue.getBinding(Le,qe)})}return Re}setUniforms(Le,Re,Oe,Ue,qe){for(const{name:Re,property:Ct,binding:Ot}of Oe)this.binders[Ct].setUniform(Le,Ot,qe,Ue.get(Ct),Re)}updatePaintBuffers(){this._buffers=[];for(const Le in this.binders){const Re=this.binders[Le];(Re instanceof Co||Re instanceof Ro||Re instanceof Do)&&Re.paintVertexBuffer&&this._buffers.push(Re.paintVertexBuffer)}}upload(Le){for(const Re in this.binders){const Oe=this.binders[Re];(Oe instanceof Co||Oe instanceof Ro||Oe instanceof Do)&&Oe.upload(Le)}this.updatePaintBuffers()}destroy(){for(const Le in this.binders){const Re=this.binders[Le];(Re instanceof Co||Re instanceof Ro||Re instanceof Do)&&Re.destroy()}}}class Fo{constructor(Le,Re,Oe=(()=>!0)){this.programConfigurations={};for(const Ue of Le)this.programConfigurations[Ue.id]=new Lo(Ue,Re,Oe);this.needsUpload=!1,this._featureMap=new mo,this._featureMapWithoutIds=new mo,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){for(const Oe in this.programConfigurations)this.programConfigurations[Oe].populatePaintArrays(Le,Re,Ue,qe,Ct,Ot,Jt);void 0!==Re.id?this._featureMap.add(Re.id,Oe,this._bufferOffset,Le):(this._featureMapWithoutIds.add(this._idlessCounter,Oe,this._bufferOffset,Le),this._idlessCounter+=1),this._bufferOffset=Le,this.needsUpload=!0}updatePaintArrays(Le,Re,Oe,Ue,qe,Ct){for(const Ot of Oe)this.needsUpload=this.programConfigurations[Ot.id].updatePaintArrays(Le,this._featureMap,this._featureMapWithoutIds,Re,Ot,Ue,qe,Ct||0)||this.needsUpload}get(Le){return this.programConfigurations[Le]}upload(Le){if(this.needsUpload){for(const Re in this.programConfigurations)this.programConfigurations[Re].upload(Le);this.needsUpload=!1}}destroy(){for(const Le in this.programConfigurations)this.programConfigurations[Le].destroy()}}const lf={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
1pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Uo(Le,Re){return lf[Le]||[Le.replace(`${Re}-`,"").replace(/-/g,"_")]}const pf={"line-pattern":{source:Sa,composite:Sa},"fill-pattern":{source:Sa,composite:Sa},"fill-extrusion-pattern":{source:Sa,composite:Sa},"line-dasharray":{source:Ia,composite:Ia}},ff={color:{source:$a,composite:Ma},number:{source:Oa,composite:$a}};function qo(Le,Re,Oe){const Ue=pf[Le];return Ue&&Ue[Oe]||ff[Re][Oe]}os(Bo,"ConstantBinder"),os(Vo,"PatternConstantBinder"),os(Co,"SourceExpressionBinder"),os(Do,"PatternCompositeBinder"),os(Ro,"CompositeExpressionBinder"),os(Lo,"ProgramConfiguration",{omit:["_buffers"]}),os(Fo,"ProgramConfigurationSet");const gf=ud/Math.PI/2,xf=5,Ff=6,jf=16383,Gf=64,$f=[Gf,32,16],Yf=-gf,em=gf;function Jo(Le,Re,Oe,Ue=gf){return Oe=Y(Oe),[Le*Math.sin(Oe)*Ue,-Re*Ue,Le*Math.cos(Oe)*Ue]}function Qo(Le,Re,Oe){return Jo(Math.cos(Y(Le)),Math.sin(Y(Le)),Re,Oe)}const im=6371008.8,rm=2*Math.PI*im;class rl{constructor(Le,Re){if(isNaN(Le)||isNaN(Re))throw new Error(`Invalid LngLat object: (${Le}, ${Re})`);if(this.lng=+Le,this.lat=+Re,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new rl(et(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(Le){const Re=Math.PI/180,Oe=this.lat*Re,Ue=Le.lat*Re,qe=Math.sin(Oe)*
vendor: 4,121 bytes, line 1
1Math.sin(Ue)+Math.cos(Oe)*Math.cos(Ue)*Math.cos((Le.lng-this.lng)*Re);return im*Math.acos(Math.min(qe,1))}toBounds(Le=0){const Re=360*Le/40075017,Oe=Re/Math.cos(Math.PI/180*this.lat);return new nl({lng:this.lng-Oe,lat:this.lat-Re},{lng:this.lng+Oe,lat:this.lat+Re})}toEcef(Le){return Qo(this.lat,this.lng,gf+Le*gf/im)}static convert(Le){if(Le instanceof rl)return Le;if(Array.isArray(Le)&&(2===Le.length||3===Le.length))return new rl(Number(Le[0]),Number(Le[1]));if(!Array.isArray(Le)&&"object"==typeof Le&&null!==Le)return new rl(Number("lng"in Le?Le.lng:Le.lon),Number(Le.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class nl{constructor(Le,Re){if(Le)if(Re)this.setSouthWest(Le).setNorthEast(Re);else if(4===Le.length){const Re=Le;this.setSouthWest([Re[0],Re[1]]).setNorthEast([Re[2],Re[3]])}else{const Re=Le;this.setSouthWest(Re[0]).setNorthEast(Re[1])}}setNorthEast(Le){return this._ne=Le instanceof rl?new rl(Le.lng,Le.lat):rl.convert(Le),this}setSouthWest(Le){return this._sw=Le instanceof rl?new rl(Le.lng,Le.lat):rl.convert(Le),this}extend(Le){const Re=this._sw,Oe=this._ne;let Ue,qe;if(Le instanceof rl)Ue=Le,qe=Le;else{if(!(Le instanceof nl))return Array.isArray(Le)?4===Le.length||Le.every(Array.isArray)?this.extend(nl.convert(Le)):this.extend(rl.convert(Le)):"object"==typeof Le&&null!==Le&&Le.hasOwnProperty("lat")&&(Le.hasOwnProperty("lon")||Le.hasOwnProperty("lng"))?this.extend(rl.convert(Le)):this;if(Ue=Le._sw,qe=Le._ne,!Ue||!qe)return this}return Re||Oe?(Re.lng=Math.min(Ue.lng,Re.lng),Re.lat=Math.min(Ue.lat,Re.lat),Oe.lng=Math.max(qe.lng,Oe.lng),Oe.lat=Math.max(qe.lat,Oe.lat)):(this._sw=new rl(Ue.lng,Ue.lat),this._ne=new rl(qe.lng,qe.lat)),this}getCenter(){return new rl((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new rl(this.getWest(),this.getNorth())}getSouthEast(){return new rl(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(Le){const{lng:Re,lat:Oe}=rl.convert(Le);let Ue=this._sw.lng<=Re&&Re<=this._ne.lng;return this._sw.lng>this._ne.lng&&(Ue=this._sw.lng>=Re&&Re>=this._ne.lng),this._sw.lat<=Oe&&Oe<=this._ne.lat&&Ue}static convert(Le){if(Le)return Le instanceof nl?Le:new nl(Le)}}const nm=0,sm=25.5;function al(Le){return rm*Math.cos(Le*Math.PI/180)}function ol(Le){return(180+Le)/360}function ll(Le){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+Le*Math.PI/360)))/360}function ul(Le,Re){return Le/al(Re)}function cl(Le){return 360*Le-180}function hl(Le){return 360/Math.PI*Math.atan(Math.exp((180-360*Le)*Math.PI/180))-90}function pl(Le,Re){return Le*al(hl(Re))}const dm=85.051129;function dl(Le){return Math.cos(Y(Q(Le,-dm,dm)))}function ml(Le,Re){const Oe=Q(Re,nm,sm),Ue=Math.pow(2,Oe);return dl(Le)*rm/(512*Ue)}function yl(Le){return 1/Math.cos(Le*Math.PI/180)}function gl(Le,Re=0){const Oe=Math.exp(Math.PI*(1-(Le.y+Re/ud)/(1<<Le.z)*2));return 80150034*Oe/(Oe*Oe+1)/ud/(1<<Le.z)}class xl{constructor(Le,Re,Oe=0){this.x=+Le,this.y=+Re,this.z=+Oe}static fromLngLat(Le,Re=0){const Oe=rl.convert(Le);return new xl(ol(Oe.lng),ll(Oe.lat),ul(Re,Oe.lat))}toLngLat(){return new rl(cl(this.x),hl(this.y))}toAltitude(){return pl(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/rm*yl(hl(this.y))}}function bl(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=(Re+Ue)/2,vi=(Oe+qe)/2,bi=new ta(xi,vi);Jt(bi),function(Le,Re,Oe,Ue,qe,Ct){const Ot=Oe-qe,Jt=Ue-Ct;return Math.abs((Ue-Re)*Ot-(Oe-Le)*Jt)/Math.hypot(Ot,Jt)}(bi.x,bi.y,Ct.x,Ct.y,Ot.x,Ot.y)>=_i?(bl(Le,Re,Oe,xi,vi,Ct,bi,Jt,_i),bl(Le,xi,vi,Ue,qe,bi,Ot,Jt,_i)):Le.push(Ot)}function vl(Le,Re,Oe){let Ue=Le[0],qe=Ue.x,Ct=Ue.y;Re(Ue);const Ot=[Ue];for(let Jt=1;Jt<Le.length;Jt++){const _i=Le[Jt],{x:xi,y:vi}
vendor: 5,633 bytes, line 1
1=_i;Re(_i),bl(Ot,qe,Ct,xi,vi,Ue,_i,Re,Oe),qe=xi,Ct=vi,Ue=_i}return Ot}function wl(Le,Re,Oe,Ue){if(Ue(Re,Oe)){const qe=Re.add(Oe)._mult(.5);wl(Le,Re,qe,Ue),wl(Le,qe,Oe,Ue)}else Le.push(Oe)}function _l(Le,Re){let Oe=Le[0];const Ue=[Oe];for(let qe=1;qe<Le.length;qe++){const Ct=Le[qe];wl(Ue,Oe,Ct,Re),Oe=Ct}return Ue}const gm=Math.pow(2,14)-1,ym=-gm-1;function Sl(Le,Re){const Oe=Math.round(Le.x*Re),Ue=Math.round(Le.y*Re);return Le.x=Q(Oe,ym,gm),Le.y=Q(Ue,ym,gm),(Oe<Le.x||Oe>Le.x+1||Ue<Le.y||Ue>Le.y+1)&&ft("Geometry exceeds allowed extent, reduce your vector tile buffer size"),Le}function Il(Le,Re,Oe){const Ue=Le.loadGeometry(),qe=Le.extent,Ct=ud/qe;if(Re&&Oe&&Oe.projection.isReprojectedInTileSpace){const Ct=1<<Re.z,{scale:Ot,x:Jt,y:_i,projection:xi}=Oe,c=Le=>{const Oe=cl((Re.x+Le.x/qe)/Ct),Ue=hl((Re.y+Le.y/qe)/Ct),vi=xi.project(Oe,Ue);Le.x=(vi.x*Ot-Jt)*qe,Le.y=(vi.y*Ot-_i)*qe};for(let Re=0;Re<Ue.length;Re++)if(1!==Le.type)Ue[Re]=vl(Ue[Re],c,1);else{const Le=[];for(const Oe of Ue[Re])Oe.x<0||Oe.x>=qe||Oe.y<0||Oe.y>=qe||(c(Oe),Le.push(Oe));Ue[Re]=Le}}for(const Le of Ue)for(const Re of Le)Sl(Re,Ct);return Ue}function Pl(Le,Re){return{type:Le.type,id:Le.id,properties:Le.properties,geometry:Re?Il(Le):[]}}function zl(Le,Re,Oe,Ue,qe){Le.emplaceBack(2*Re+(Ue+1)/2,2*Oe+(qe+1)/2)}function kl(Le,Re,Oe){const Ue=16384;Le.emplaceBack(Re.x,Re.y,Re.z,Oe[0]*Ue,Oe[1]*Ue,Oe[2]*Ue)}class Tl{constructor(Le){this.zoom=Le.zoom,this.overscaling=Le.overscaling,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.index=Le.index,this.hasPattern=!1,this.projection=Le.projection,this.layoutVertexArray=new xa,this.indexArray=new Da,this.segments=new co,this.programConfigurations=new Fo(Le.layers,{zoom:Le.zoom,lut:Le.lut}),this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id))}updateFootprints(Le,Re){}populate(Le,Re,Oe,Ue){const qe=this.layers[0],Ct=[];let Ot=null;"circle"===qe.type&&(Ot=qe.layout.get("circle-sort-key"));for(const{feature:Re,id:qe,index:Jt,sourceLayerIndex:_i}of Le){const Le=this.layers[0]._featureFilter.needGeometry,xi=Pl(Re,Le);if(!this.layers[0]._featureFilter.filter(new Vs(this.zoom),xi,Oe))continue;const vi=Ot?Ot.evaluate(xi,{},Oe):void 0,bi={id:qe,properties:Re.properties,type:Re.type,sourceLayerIndex:_i,index:Jt,geometry:Le?xi.geometry:Il(Re,Oe,Ue),patterns:{},sortKey:vi};Ct.push(bi)}Ot&&Ct.sort(((Le,Re)=>Le.sortKey-Re.sortKey));let Jt=null;"globe"===Ue.projection.name&&(this.globeExtVertexArray=new Pa,Jt=Ue.projection);for(const Ue of Ct){const{geometry:qe,index:Ct,sourceLayerIndex:Ot}=Ue,_i=Le[Ct].feature;this.addFeature(Ue,qe,Ct,Re.availableImages,Oe,Jt,Re.brightness),Re.featureIndex.insert(_i,qe,Ct,Ot,this.index)}}update(Le,Re,Oe,Ue,qe){const Ct=0!==Object.keys(Le).length;Ct&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(Le,Re,Ct?this.stateDependentLayers:this.layers,Oe,Ue,qe)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(Le){this.uploaded||(this.layoutVertexBuffer=Le.createVertexBuffer(this.layoutVertexArray,Wp.members),this.indexBuffer=Le.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=Le.createVertexBuffer(this.globeExtVertexArray,Kp.members))),this.programConfigurations.upload(Le),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(Le,Re,Oe,Ue,qe,Ct,Ot){for(const Oe of Re)for(const Re of Oe){const Oe=Re.x,Ue=Re.y;if(Oe<0||Oe>=ud||Ue<0||Ue>=ud)continue;if(Ct){const Le=Ct.projectTilePoint(Oe,Ue,qe),Re=Ct.upVector(qe,Oe,Ue),Ot=this.globeExtVertexArray;kl(Ot,Le,Re),kl(Ot,Le,Re),kl(Ot,Le,Re),kl(Ot,Le,Re)}const Ot=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,Le.sortKey),Jt=Ot.vertexLength;zl(this.layoutVertexArray,Oe,Ue,-1,-1),zl(this.layoutVertexArray,Oe,Ue,1,-1),zl(this.layoutVertexArray,Oe,Ue,1,1),zl(this.layoutVertexArray,Oe,Ue,-1,1),this.indexArray.emplaceBack(Jt,Jt+1,Jt+2),this.indexArray.emplaceBack(Jt,Jt+2,Jt+3),Ot.vertexLength+=4,Ot.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,Le,Oe,{},Ue,qe,Ot)}}function El(Le,Re){for(let Oe=0;Oe<Le.length;Oe++)if(Ul(Re,Le[Oe]))return!0;for(let Oe=0;Oe<Re.length;Oe++)if(Ul(Le,Re[Oe]))return!0;return!!Rl(Le,Re)}function Bl(Le,Re,Oe){return!!Ul(Le,Re)||!!Ll(Re,Le,Oe)}function Vl(Le,Re){if(1===Le.length)return Ol(Re,Le[0]);for(let Oe=0;Oe<Re.length;Oe++){const Ue=Re[Oe];for(let Re=0;Re<Ue.length;Re++)if(Ul(Le,Ue[Re]))return!0}for(let Oe=0;Oe<Le.length;Oe++)if(Ol(Re,Le[Oe]))return!0;for(let Oe=0;Oe<Re.length;Oe++)if(Rl(Le,Re[Oe]))return!0;return!1}function Cl(Le,Re,Oe){if(Le.length>1){if(Rl(Le,Re))return!0;for(let Ue=0;Ue<Re.length;Ue++)if(Ll(Re[Ue],Le,Oe))return!0}for(let Ue=0;Ue<Le.length;Ue++)if(Ll(Le[Ue],Re,Oe))return!0;return!1}function Rl(Le,Re){if(0===Le.length||0===Re.length)return!1;for(let Oe=0;Oe<Le.length-1;Oe++){const Ue=Le[Oe],qe=Le[Oe+1];for(let Le=0;Le<Re.length-1;Le++)if(Dl(Ue,qe,Re[Le],Re[Le+1]))return!0}return!1}function Dl(Le,Re,Oe,Ue){return dt(Le,Oe,Ue)!==dt(Re,Oe,Ue)&&dt(Le,Re,Oe)!==dt(Le,Re,Ue)}function Ll(Le,Re,Oe){const Ue=Oe*Oe;if(1===Re.length)return Le.distSqr(Re[0])<Ue;for(let Oe=1;Oe<Re.length;Oe++)if(Fl(Le,Re[Oe-1],Re[Oe])<Ue)return!0;return!1}function Fl(Le,Re,Oe){const Ue=Re.distSqr(Oe);if(0===Ue)return Le.distSqr(Re);const qe=((Le.x-Re.x)*(Oe.x-Re.x)+(Le.y-Re.y)*(Oe.y-Re.y))/Ue;
vendor: 5,066 bytes, line 1
1return Le.distSqr(qe<0?Re:qe>1?Oe:Oe.sub(Re)._mult(qe)._add(Re))}function Ol(Le,Re){let Oe,Ue,qe,Ct=!1;for(let Ot=0;Ot<Le.length;Ot++){Oe=Le[Ot];for(let Le=0,Ot=Oe.length-1;Le<Oe.length;Ot=Le++)Ue=Oe[Le],qe=Oe[Ot],Ue.y>Re.y!=qe.y>Re.y&&Re.x<(qe.x-Ue.x)*(Re.y-Ue.y)/(qe.y-Ue.y)+Ue.x&&(Ct=!Ct)}return Ct}function Ul(Le,Re){let Oe=!1;for(let Ue=0,qe=Le.length-1;Ue<Le.length;qe=Ue++){const Ct=Le[Ue],Ot=Le[qe];Ct.y>Re.y!=Ot.y>Re.y&&Re.x<(Ot.x-Ct.x)*(Re.y-Ct.y)/(Ot.y-Ct.y)+Ct.x&&(Oe=!Oe)}return Oe}function jl(Le,Re,Oe,Ue,qe){for(const Ct of Le)if(Re<=Ct.x&&Oe<=Ct.y&&Ue>=Ct.x&&qe>=Ct.y)return!0;const Ct=[new ta(Re,Oe),new ta(Re,qe),new ta(Ue,qe),new ta(Ue,Oe)];if(Le.length>2)for(const Re of Ct)if(Ul(Le,Re))return!0;for(let Re=0;Re<Le.length-1;Re++)if(Nl(Le[Re],Le[Re+1],Ct))return!0;return!1}function Nl(Le,Re,Oe){const Ue=Oe[0],qe=Oe[2];if(Le.x<Ue.x&&Re.x<Ue.x||Le.x>qe.x&&Re.x>qe.x||Le.y<Ue.y&&Re.y<Ue.y||Le.y>qe.y&&Re.y>qe.y)return!1;const Ct=dt(Le,Re,Oe[0]);return Ct!==dt(Le,Re,Oe[1])||Ct!==dt(Le,Re,Oe[2])||Ct!==dt(Le,Re,Oe[3])}function ql(Le,Re,Oe,Ue,qe,Ct){let Ot=Re.y-Le.y,Jt=Le.x-Re.x;if(Ct=Ct||0){const Le=Ot*Ot+Jt*Jt;if(0===Le)return!0;const Re=Math.sqrt(Le);Ot/=Re,Jt/=Re}return!((Oe.x-Le.x)*Ot+(Oe.y-Le.y)*Jt-Ct<0||(Ue.x-Le.x)*Ot+(Ue.y-Le.y)*Jt-Ct<0||(qe.x-Le.x)*Ot+(qe.y-Le.y)*Jt-Ct<0)}function $l(Le,Re,Oe,Ue,qe,Ct,Ot){return!(ql(Le,Re,Ue,qe,Ct,Ot)||ql(Re,Oe,Ue,qe,Ct,Ot)||ql(Oe,Le,Ue,qe,Ct,Ot)||ql(Ue,qe,Le,Re,Oe,Ot)||ql(qe,Ct,Le,Re,Oe,Ot)||ql(Ct,Ue,Le,Re,Oe,Ot))}function Gl(Le,Re,Oe){const Ue=Re.paint.get(Le).value;return"constant"===Ue.kind?Ue.value:Oe.programConfigurations.get(Re.id).getMaxValue(Le)}function Xl(Le){return Math.sqrt(Le[0]*Le[0]+Le[1]*Le[1])}function Yl(Le,Re,Oe,Ue,qe){if(!Re[0]&&!Re[1])return Le;const Ct=ta.convert(Re)._mult(qe);"viewport"===Oe&&Ct._rotate(-Ue);const Ot=[];for(let Re=0;Re<Le.length;Re++)Ot.push(Le[Re].sub(Ct));return Ot}function Zl(Le,Re,Oe,Ue){const qe=ta.convert(Le)._mult(Ue);return"viewport"===Re&&qe._rotate(-Oe),qe}let xm,vm;os(Tl,"CircleBucket",{omit:["layers"]});var bm,Cm={exports:{}},Pm=(bm||(bm=1,function(Le,Re){!function(Le){function e(Le,Re,Oe){var Ue=r(256*Le,256*(Re=Math.pow(2,Oe)-Re-1),Oe),qe=r(256*(Le+1),256*(Re+1),Oe);return Ue[0]+","+Ue[1]+","+qe[0]+","+qe[1]}function r(Le,Re,Oe){var Ue=2*Math.PI*6378137/256/Math.pow(2,Oe);return[Le*Ue-2*Math.PI*6378137/2,Re*Ue-2*Math.PI*6378137/2]}Le.getURL=function(Le,Re,Oe,Ue,qe,Ct){return Ct=Ct||{},Le+"?"+["bbox="+e(Oe,Ue,qe),"format="+(Ct.format||"image/png"),"service="+(Ct.service||"WMS"),"version="+(Ct.version||"1.1.1"),"request="+(Ct.request||"GetMap"),"srs="+(Ct.srs||"EPSG:3857"),"width="+(Ct.width||256),"height="+(Ct.height||256),"layers="+Re].join("&")},Le.getTileBBox=e,Le.getMercCoords=r,Object.defineProperty(Le,"__esModule",{value:!0})}(Re)}(0,Cm.exports)),Cm.exports);class tu{constructor(Le,Re,Oe){this.z=Le,this.x=Re,this.y=Oe,this.key=nu(0,Le,Le,Re,Oe)}equals(Le){return this.z===Le.z&&this.x===Le.x&&this.y===Le.y}url(Le,Re){const Oe=Pm.getTileBBox(this.x,this.y,this.z),Ue=function(Le,Re,Oe){let Ue,qe="";for(let Ct=Le;Ct>0;Ct--)Ue=1<<Ct-1,qe+=(Re&Ue?1:0)+(Oe&Ue?2:0);return qe}(this.z,this.x,this.y);return Le[(this.x+this.y)%Le.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===Re?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",Ue).replace("{bbox-epsg-3857}",Oe)}toString(){return`${this.z}/${this.x}/${this.y}`}}class eu{constructor(Le,Re){this.wrap=Le,this.canonical=Re,this.key=nu(Le,Re.z,Re.z,Re.x,Re.y)}}class ru{constructor(Le,Re,Oe,Ue,qe){this.overscaledZ=Le,this.wrap=Re,this.canonical=new tu(Oe,+Ue,+qe),this.key=0===Re&&Le===Oe?this.canonical.key:nu(Re,Le,Oe,Ue,qe)}equals(Le){return this.overscaledZ===Le.overscaledZ&&this.wrap===Le.wrap&&this.canonical.equals(Le.canonical)}scaledTo(Le){const Re=this.canonical.z-Le;return Le>this.canonical.z?new ru(Le,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ru(Le,this.wrap,Le,this.canonical.x>>Re,this.canonical.y>>Re)}calculateScaledKey(Le,Re=!0){if(this.overscaledZ===Le&&Re)return this.key;if(Le>this.canonical.z)return nu(this.wrap*+Re,Le,this.canonical.z,this.canonical.x,this.canonical.y);{const Oe=this.canonical.z-Le;return nu(this.wrap*+Re,Le,Le,this.canonical.x>>Oe,this.canonical.y>>Oe)}}isChildOf(Le){if(Le.wrap!==this.wrap)return!1;const Re=this.canonical.z-Le.canonical.z;return 0===Le.overscaledZ||Le.overscaledZ<this.overscaledZ&&Le.canonical.z<this.canonical.z&&Le.canonical.x===this.canonical.x>>Re&&Le.canonical.y===this.canonical.y>>Re}children(Le){if(this.overscaledZ>=Le)return[new ru(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const Re=this.canonical.z+1,Oe=2*this.canonical.x,Ue=2*this.canonical.y;return[new ru(Re,this.wrap,Re,Oe,Ue),new ru(Re,this.wrap,Re,Oe+1,Ue),new ru(Re,this.wrap,Re,Oe,Ue+1),new ru(Re,this.wrap,Re,Oe+1,Ue+1)]}isLessThan(Le){return this.wrap<Le.wrap||!(this.wrap>Le.wrap)&&(this.overscaledZ<Le.overscaledZ||!(this.overscaledZ>
vendor: 9,207 bytes, line 1
1Le.overscaledZ)&&(this.canonical.x<Le.canonical.x||!(this.canonical.x>Le.canonical.x)&&this.canonical.y<Le.canonical.y))}wrapped(){return new ru(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(Le){return new ru(this.overscaledZ,Le,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new eu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function nu(Le,Re,Oe,Ue,qe){const Ct=1<<Math.min(Oe,22);let Ot=Ct*(qe%Ct)+Ue%Ct;return Le&&Oe<22&&(Ot+=Ct*Ct*((Le<0?-2*Le-1:2*Le)%(1<<2*(22-Oe)))),16*(32*Ot+Oe)+(Re-Oe)}const Dm=[Le=>{let Re=Le.canonical.x-1,Oe=Le.wrap;return Re<0&&(Re=(1<<Le.canonical.z)-1,Oe--),new ru(Le.overscaledZ,Oe,Le.canonical.z,Re,Le.canonical.y)},Le=>{let Re=Le.canonical.x+1,Oe=Le.wrap;return Re===1<<Le.canonical.z&&(Re=0,Oe++),new ru(Le.overscaledZ,Oe,Le.canonical.z,Re,Le.canonical.y)},Le=>new ru(Le.overscaledZ,Le.wrap,Le.canonical.z,Le.canonical.x,(0===Le.canonical.y?1<<Le.canonical.z:Le.canonical.y)-1),Le=>new ru(Le.overscaledZ,Le.wrap,Le.canonical.z,Le.canonical.x,Le.canonical.y===(1<<Le.canonical.z)-1?0:Le.canonical.y+1)];os(tu,"CanonicalTileID"),os(ru,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Lm=ya([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Rm}=Lm,Om=ya([{name:"a_pos_3",components:3,type:"Int16"}]);var Fm=ya([{name:"a_pos",type:"Int16",components:2}]);class uu{constructor(Le,Re){this.pos=Le,this.dir=Re}intersectsPlane(Le,Re,Oe){const Ue=as.vec3.dot(Re,this.dir);if(Math.abs(Ue)<1e-6)return!1;const qe=((Le[0]-this.pos[0])*Re[0]+(Le[1]-this.pos[1])*Re[1]+(Le[2]-this.pos[2])*Re[2])/Ue;return Oe[0]=this.pos[0]+this.dir[0]*qe,Oe[1]=this.pos[1]+this.dir[1]*qe,Oe[2]=this.pos[2]+this.dir[2]*qe,!0}closestPointOnSphere(Le,Re,Oe){if(as.vec3.equals(this.pos,Le)||0===Re)return Oe[0]=Oe[1]=Oe[2]=0,!1;const[Ue,qe,Ct]=this.dir,Ot=this.pos[0]-Le[0],Jt=this.pos[1]-Le[1],_i=this.pos[2]-Le[2],xi=Ue*Ue+qe*qe+Ct*Ct,vi=2*(Ot*Ue+Jt*qe+_i*Ct),bi=vi*vi-4*xi*(Ot*Ot+Jt*Jt+_i*_i-Re*Re);if(bi<0){const Le=Math.max(-vi/2,0),xi=Ot+Ue*Le,bi=Jt+qe*Le,Pi=_i+Ct*Le,Hr=Math.hypot(xi,bi,Pi);return Oe[0]=xi*Re/Hr,Oe[1]=bi*Re/Hr,Oe[2]=Pi*Re/Hr,!1}{const Le=(-vi-Math.sqrt(bi))/(2*xi);if(Le<0){const Le=Math.hypot(Ot,Jt,_i);return Oe[0]=Ot*Re/Le,Oe[1]=Jt*Re/Le,Oe[2]=_i*Re/Le,!1}return Oe[0]=Ot+Ue*Le,Oe[1]=Jt+qe*Le,Oe[2]=_i+Ct*Le,!0}}}class cu{constructor(Le,Re,Oe,Ue,qe){this.TL=Le,this.TR=Re,this.BR=Oe,this.BL=Ue,this.horizon=qe}static fromInvProjectionMatrix(Le,Re,Oe){const Ue=[-1,1,1],qe=[1,1,1],Ct=[1,-1,1],Ot=[-1,-1,1],Jt=as.vec3.transformMat4(Ue,Ue,Le),_i=as.vec3.transformMat4(qe,qe,Le),xi=as.vec3.transformMat4(Ct,Ct,Le),vi=as.vec3.transformMat4(Ot,Ot,Le);return new cu(Jt,_i,xi,vi,Re/Oe)}}function hu(Le,Re,Oe){let Ue=1/0,qe=-1/0;const Ct=[];for(const Ot of Le){as.vec3.sub(Ct,Ot,Re);const Le=as.vec3.dot(Ct,Oe);Ue=Math.min(Ue,Le),qe=Math.max(qe,Le)}return[Ue,qe]}function pu(Le,Re){let Oe=!0;for(let Ue=0;Ue<Le.planes.length;Ue++){const qe=Le.planes[Ue];let Ct=0;for(let Le=0;Le<Re.length;Le++)Ct+=as.vec3.dot(qe,Re[Le])+qe[3]>=0;if(0===Ct)return 0;Ct!==Re.length&&(Oe=!1)}return Oe?2:1}function fu(Le,Re){for(const Oe of Le.projections){const Ue=hu(Re,Le.points[0],Oe.axis);if(Oe.projection[1]<Ue[0]||Oe.projection[0]>Ue[1])return 0}return 1}function du(Le,Re){let Oe=0;const Ue=[0,0,0,0];for(let qe=0;qe<Le.length;qe++)Ue[0]=Le[qe][0],Ue[1]=Le[qe][1],Ue[2]=Le[qe][2],Ue[3]=1,as.vec4.dot(Ue,Re)>=0&&Oe++;return Oe}class mu{constructor(Le,Re){this.points=Le||new Array(8).fill([0,0,0]),this.planes=Re||new Array(6).fill([0,0,0,0]),this.bounds=yu.fromPoints(this.points),this.projections=[],this.frustumEdges=[as.vec3.sub([],this.points[2],this.points[3]),as.vec3.sub([],this.points[0],this.points[3]),as.vec3.sub([],this.points[4],this.points[0]),as.vec3.sub([],this.points[5],this.points[1]),as.vec3.sub([],this.points[6],this.points[2]),as.vec3.sub([],this.points[7],this.points[3])];for(const Le of this.frustumEdges){const Re=[0,-Le[2],Le[1]],Oe=[Le[2],0,-Le[0]];this.projections.push({axis:Re,projection:hu(this.points,this.points[0],Re)}),this.projections.push({axis:Oe,projection:hu(this.points,this.points[0],Oe)})}}static fromInvProjectionMatrix(Le,Re,Oe,Ue){const qe=Math.pow(2,Oe),Ct=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((Oe=>{const Ct=as.vec4.transformMat4([],Oe,Le),Ot=1/Ct[3]/Re*qe;return as.vec4.mul(Ct,Ct,[Ot,Ot,Ue?1/Ct[3]:Ot,Ot])})),Ot=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((Le=>{const Re=as.vec3.sub([],Ct[Le[0]],Ct[Le[1]]),Oe=as.vec3.sub([],Ct[Le[2]],Ct[Le[1]]),Ue=as.vec3.normalize([],as.vec3.cross([],Re,Oe)),qe=-as.vec3.dot(Ue,Ct[Le[1]]);return Ue.concat(qe)})),Jt=[];for(let Le=0;Le<Ct.length;Le++)Jt.push([Ct[Le][0],Ct[Le][1],Ct[Le][2]]);return new mu(Jt,Ot)}intersectsPrecise(Le,Re,Oe){for(let Oe=0;Oe<Re.length;Oe++)if(!du(Le,Re[Oe]))return 0;for(let Re=0;Re<this.planes.length;Re++)if(!du(Le,this.planes[Re]))return 0;for(const Re of Oe)for(const Oe of this.frustumEdges){const Ue=as.vec3.cross([],Re,Oe),qe=as.vec3.length(Ue);if(0===qe)continue;as.vec3.scale(Ue,Ue,1/qe);const Ct=hu(this.points,this.points[0],Ue),Ot=hu(Le,this.points[0],Ue);if(Ct[0]>Ot[1]||Ot[0]>Ct[1])return 0}return 1}containsPoint(Le){for(const Re of this.planes){const Oe=Re[3];if(as.vec3.dot([Re[0],Re[1],Re[2]],Le)+Oe<0)return!1}return!0}}class yu{static fromPoints(Le){const Re=[1/0,1/0,1/0],Oe=[-1/0,-1/0,-1/0];for(const Ue of Le)as.vec3.min(Re,Re,Ue),as.vec3.max(Oe,Oe,Ue);return new yu(Re,Oe)}static fromTileIdAndHeight(Le,Re,Oe){const Ue=1<<Le.canonical.z,qe=Le.canonical.x,Ct=Le.canonical.y;return new yu([qe/Ue,Ct/Ue,Re],[(qe+1)/Ue,(Ct+1)/Ue,Oe])}static applyTransform(Le,Re){const Oe=Le.getCorners();for(let Le=0;Le<Oe.length;++Le)as.vec3.transformMat4(Oe[Le],Oe[Le],Re);return yu.fromPoints(Oe)}static applyTransformFast(Le,Re){const Oe=[Re[12],Re[13],Re[14]],Ue=[...Oe];for(let qe=0;qe<3;qe++)for(let Ct=0;Ct<3;Ct++){const Ot=Re[4*Ct+qe],Jt=Ot*Le.min[Ct],_i=Ot*Le.max[Ct];Oe[qe]+=Math.min(Jt,_i),Ue[qe]+=Math.max(Jt,_i)}return new yu(Oe,Ue)}static projectAabbCorners(Le,Re){const Oe=Le.getCorners();for(let Le=0;Le<Oe.length;++Le)as.vec3.transformMat4(Oe[Le],Oe[Le],Re);return Oe}constructor(Le,Re){this.min=Le,this.max=Re,this.center=as.vec3.scale([],as.vec3.add([],this.min,this.max),.5)}quadrant(Le){const Re=[Le%2==0,Le<2],Oe=as.vec3.clone(this.min),Ue=as.vec3.clone(this.max);for(let Le=0;Le<Re.length;Le++)Oe[Le]=Re[Le]?this.min[Le]:this.center[Le],Ue[Le]=Re[Le]?this.center[Le]:this.max[Le];return Ue[2]=this.max[2],new yu(Oe,Ue)}distanceX(Le){return Math.max(Math.min(this.max[0],Le[0]),this.min[0])-Le[0]}distanceY(Le){return Math.max(Math.min(this.max[1],Le[1]),this.min[1])-Le[1]}distanceZ(Le){return Math.max(Math.min(this.max[2],Le[2]),this.min[2])-Le[2]}getCorners(){const Le=this.min,Re=this.max;return[[Le[0],Le[1],Le[2]],[Re[0],Le[1],Le[2]],[Re[0],Re[1],Le[2]],[Le[0],Re[1],Le[2]],[Le[0],Le[1],Re[2]],[Re[0],Le[1],Re[2]],[Re[0],Re[1],Re[2]],[Le[0],Re[1],Re[2]]]}intersects(Le){return this.intersectsAabb(Le.bounds)?pu(Le,this.getCorners()):0}intersectsFlat(Le){return this.intersectsAabb(Le.bounds)?pu(Le,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(Le,Re){return Re||this.intersects(Le)?fu(Le,this.getCorners()):0}intersectsPreciseFlat(Le,Re){return Re||this.intersectsFlat(Le)?fu(Le,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(Le){for(let Re=0;Re<3;++Re)if(this.min[Re]>Le.max[Re]||Le.min[Re]>this.max[Re])return!1;return!0}intersectsAabbXY(Le){return!(this.min[0]>Le.max[0]||Le.min[0]>this.max[0]||this.min[1]>Le.max[1]||Le.min[1]>this.max[1])}encapsulate(Le){for(let Re=0;Re<3;Re++)this.min[Re]=Math.min(this.min[Re],Le.min[Re]),this.max[Re]=Math.max(this.max[Re],Le.max[Re])}encapsulatePoint(Le){for(let Re=0;Re<3;Re++)this.min[Re]=Math.min(this.min[Re],Le[Re]),this.max[Re]=Math.max(this.max[Re],Le[Re])}closestPoint(Le){return[Math.max(Math.min(this.max[0],Le[0]),this.min[0]),Math.max(Math.min(this.max[1],Le[1]),this.min[1]),Math.max(Math.min(this.max[2],Le[2]),this.min[2])]}}function gu(Le){return Le*gf/im}os(yu,"Aabb");const Um=[new yu([Yf,Yf,Yf],[em,em,em]),new yu([Yf,Yf,Yf],[0,0,em]),new yu([0,Yf,Yf],[em,0,em]),new yu([Yf,0,Yf],[0,em,em]),new yu([0,0,Yf],[em,em,em])];function bu(Le,Re,Oe,Ue=!0){const qe=as.vec3.scale([],Le._camera.position,Le.worldSize),Ct=[Re,Oe,1,1];as.vec4.transformMat4(Ct,Ct,Le.pixelMatrixInverse),as.vec4.scale(Ct,Ct,1/Ct[3]);const Ot=as.vec3.sub([],Ct,qe),Jt=as.vec3.normalize([],Ot),_i=Le.globeMatrix,xi=[_i[12],_i[13],_i[14]],vi=as.vec3.sub([],xi,qe),bi=as.vec3.length(vi),Pi=as.vec3.normalize([],vi),Hr=Le.worldSize/(2*Math.PI),Jr=as.vec3.dot(Pi,Jt),Ln=Math.asin(Hr/bi);if(Ln<Math.acos(Jr)){if(!Ue)return null;const Le=[],Re=[];as.vec3.scale(Le,Jt,bi/Jr),as.vec3.normalize(Re,as.vec3.sub(Re,Le,vi)),as.vec3.normalize(Jt,as.vec3.add(Jt,vi,as.vec3.scale(Jt,Re,Math.tan(Ln)*bi)))}const Nn=[];
1new uu(qe,Jt).closestPointOnSphere(xi,Hr,Nn);const Gn=as.vec3.normalize([],wt(_i,0)),qn=as.vec3.normalize([],wt(_i,1)),Zn=as.vec3.normalize([],wt(_i,2)),$n=as.vec3.dot(Gn,Nn),Xn=as.vec3.dot(qn,Nn),Yn=as.vec3.dot(Zn,Nn),lo=Z(Math.asin(-Xn/Hr));let uo=Z(Math.atan2($n,Yn));uo=Le.center.lng+function(Le,Re){const Oe=(Re-Le+180)%360-180;return Oe<-180?Oe+360:Oe}(Le.center.lng,uo);const po=ol(uo),fo=Q(ll(lo),0,1);return new xl(po,fo)}class vu{constructor(Le,Re,Oe){this.a=as.vec3.sub([],Le,Oe),this.b=as.vec3.sub([],Re,Oe),this.center=Oe;const Ue=as.vec3.normalize([],this.a),qe=as.vec3.normalize([],this.b);this.angle=Math.acos(as.vec3.dot(Ue,qe))}}function wu(Le,Re){if(0===Le.angle)return null;let Oe;return Oe=0===Le.a[Re]?1/Le.angle*.5*Math.PI:1/Le.angle*Math.atan(Le.b[Re]/Le.a[Re]/Math.sin(Le.angle)-1/Math.tan(Le.angle)),Oe<0||Oe>1?null:function(Le,Re,Oe,Ue){const qe=Math.sin(Oe);return Le*(Math.sin((1-Ue)*Oe)/qe)+Re*(Math.sin(Ue*Oe)/qe)}(Le.a[Re],Le.b[Re],Le.angle,Q(Oe,0,1))+Le.center[Re]}function _u(Le){if(Le.z<=1)return Um[Le.z+2*Le.y+Le.x];const Re=Pu(Iu(Le));return yu.fromPoints(Re)}function Mu(Le,Re,Oe){return as.vec3.scale(Le,Le,1-Oe),as.vec3.scaleAndAdd(Le,Le,Re,Oe)}function Au(Le,Re,Oe){for(const Ue of Le)as.vec3.transformMat4(Ue,Ue,Re),as.vec3.scale(Ue,Ue,Oe)}function Su(Le,Re,Oe,Ue){const qe=Re/Le.worldSize,Ct=Le.globeMatrix;if(Oe.z<=1){const Le=_u(Oe).getCorners();return Au(Le,Ct,qe),yu.fromPoints(Le)}const Ot=Iu(Oe,Ue),Jt=Pu(Ot,gf+gu(Le._tileCoverLift));Au(Jt,Ct,qe);const _i=Number.MAX_VALUE,xi=[-_i,-_i,-_i],vi=[_i,_i,_i];if(Ot.contains(Le.center)){for(const Le of Jt)as.vec3.min(vi,vi,Le),as.vec3.max(xi,xi,Le);xi[2]=0;const Re=Le.point,Oe=[Re.x*qe,Re.y*qe,0];return as.vec3.min(vi,vi,Oe),as.vec3.max(xi,xi,Oe),new yu(vi,xi)}if(Le._tileCoverLift>0){for(const Le of Jt)as.vec3.min(vi,vi,Le),as.vec3.max(xi,xi,Le);return new yu(vi,xi)}const bi=[Ct[12]*qe,Ct[13]*qe,Ct[14]*qe],Pi=Ot.getCenter(),Hr=Q(Le.center.lat,-dm,dm),Jr=Q(Pi.lat,-dm,dm),Ln=ol(Le.center.lng),Nn=ll(Hr);let Gn=Ln-ol(Pi.lng);const qn=Nn-ll(Jr);Gn>.5?Gn-=1:Gn<-.5&&(Gn+=1);let Zn=0;if(Math.abs(Gn)>Math.abs(qn))Zn=Gn>=0?1:3;else{Zn=qn>=0?0:2;const Le=[Ct[4]*qe,Ct[5]*qe,Ct[6]*qe],Re=-Math.sin(Y(qn>=0?Ot.getSouth():Ot.getNorth()))*gf;as.vec3.scaleAndAdd(bi,bi,Le,Re)}const $n=Jt[Zn],Xn=Jt[(Zn+1)%4],Yn=new vu($n,Xn,bi),lo=[wu(Yn,0)||$n[0],wu(Yn,1)||$n[1],wu(Yn,2)||$n[2]],uo=Du(Le.zoom);if(uo>0){const Ue=function({x:Le,y:Re,z:Oe},Ue,qe,Ct,Ot){const Jt=1/(1<<Oe);let _i=Le*Jt,xi=_i+Jt,vi=Re*Jt,bi=vi+Jt,Pi=0;const Hr=(_i+xi)/2-Ct;return Hr>.5?Pi=-1:Hr<-.5&&(Pi=1),_i=((_i+Pi)*Ue-(Ct*=Ue))*qe+Ct,xi=((xi+Pi)*Ue-Ct)*qe+Ct,vi=(vi*Ue-(Ot*=Ue))*qe+Ot,bi=(bi*Ue-Ot)*qe+Ot,[[_i,bi,0],[xi,bi,0],[xi,vi,0],[_i,vi,0]]}(Oe,Re,Le._pixelsPerMercatorPixel,Ln,Nn);for(let Le=0;Le<Jt.length;Le++)Mu(Jt[Le],Ue[Le],uo);const qe=as.vec3.add([],Ue[Zn],Ue[(Zn+1)%4]);as.vec3.scale(qe,qe,.5),Mu(lo,qe,uo)}for(const Le of Jt)as.vec3.min(vi,vi,Le),as.vec3.max(xi,xi,Le);return vi[2]=Math.min($n[2],Xn[2]),as.vec3.min(vi,vi,lo),as.vec3.max(xi,xi,lo),new yu(vi,xi)}function Iu({x:Le,y:Re,z:Oe},Ue=!1){const qe=1/(1<<Oe),Ct=new rl(cl(Le*qe),Re===(1<<Oe)-1&&Ue?-90:hl((Re+1)*qe)),Ot=new rl(cl((Le+1)*qe),0===Re&&Ue?90:hl(Re*qe));return new nl(Ct,Ot)}function Pu(Le,Re=gf){const Oe=Y(Le.getNorth()),Ue=Y(Le.getSouth()),qe=Math.cos(Oe),Ct=Math.cos(Ue),Ot=Math.sin(Oe),Jt=Math.sin(Ue),_i=Le.getWest(),xi=Le.getEast();return[Jo(Ct,Jt,_i,Re),Jo(Ct,Jt,xi,Re),Jo(qe,Ot,xi,Re),Jo(qe,Ot,_i,Re)]}function zu(Le,Re,Oe,Ue){const qe=1<<Oe.z,Ct=(Le/ud+Oe.x)/qe;return Qo(hl((Re/ud+Oe.y)/qe),cl(Ct),Ue)}function ku({min:Le,max:Re}){return jf/Math.max(Re[0]-Le[0],Re[1]-Le[1],Re[2]-Le[2])}const jm=new Float64Array(16);function Eu(Le){const Re=ku(Le),Oe=as.mat4.fromScaling(jm,[Re,Re,Re]);return as.mat4.translate(Oe,Oe,as.vec3.negate([],Le.min))}function Bu(Le){const Re=as.mat4.fromTranslation(jm,Le.min),Oe=1/ku(Le);return as.mat4.scale(Re,Re,[Oe,Oe,Oe])}function Vu(Le){const Re=ud/(2*Math.PI);return Le/(2*Math.PI)/Re}function Cu(Le,Re){return ud/(512*Math.pow(2,Le))*ku(_u(Re))}function Ru(Le,Re,Oe,Ue,qe){const Ct=Vu(Oe),Ot=[Le,Re,-Oe/(2*Math.PI)],Jt=as.mat4.identity(new Float64Array(16));return as.mat4.translate(Jt,Jt,Ot),as.mat4.scale(Jt,Jt,[Ct,Ct,Ct]),as.mat4.rotateX(Jt,Jt,Y(-qe)),as.mat4.rotateY(Jt,Jt,Y(-Ue)),Jt}function Du(Le){return tt(xf,Ff,Le)}function Lu(Le,Re){const Oe=Qo(Re.lat,Re.lng),Ue=function(Le){const Re=Qo(Le._center.lat,Le._center.lng),Oe=as.vec3.fromValues(0,1,0);let Ue=as.vec3.cross([],Oe,Re);const qe=as.mat4.fromRotation([],-Le.angle,Re);Ue=as.vec3.transformMat4(Ue,Ue,qe),as.mat4.fromRotation(qe,-Le._pitch,Ue);const Ct=as.vec3.normalize([],Re);return as.vec3.scale(Ct,Ct,gu(Le.cameraToCenterDistance/Le.pixelsPerMeter)),as.vec3.transformMat4(Ct,Ct,qe),as.vec3.add([],Re,Ct)}(Le),qe=as.vec3.subtract([],Ue,Oe);return as.vec3.angle(qe,Oe)}function Fu(Le,Re){return Lu(Le,Re)>
1Math.PI/2*1.01}const Zm=Y(85),Hm=Math.cos(Zm),Wm=Math.sin(Zm),Ym=as.mat4.create(),qu=Le=>{const Re=[];return"map"===Le.paint.get("circle-pitch-alignment")&&Re.push("PITCH_WITH_MAP"),"map"===Le.paint.get("circle-pitch-scale")&&Re.push("SCALE_WITH_MAP"),Re};function $u(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){if(Ct&&Le.queryGeometry.isAboveHorizon)return!1;Ct&&(_i*=Le.pixelToTileUnitsFactor);const xi=Le.tileID.canonical,vi=Oe.projection.upVectorScale(xi,Oe.center.lat,Oe.worldSize).metersToTile;for(const bi of Re)for(const Re of bi){const bi=Re.add(Jt),Pi=qe&&Oe.elevation?Oe.elevation.exaggeration()*qe.getElevationAt(bi.x,bi.y,!0):0,Hr=Oe.projection.projectTilePoint(bi.x,bi.y,xi);if(Pi>0){const Le=Oe.projection.upVector(xi,bi.x,bi.y);Hr.x+=Le[0]*vi*Pi,Hr.y+=Le[1]*vi*Pi,Hr.z+=Le[2]*vi*Pi}const Jr=Ct?bi:Gu(Hr.x,Hr.y,Hr.z,Ue),Ln=Ct?Le.tilespaceRays.map((Le=>Zu(Le,Pi))):Le.queryGeometry.screenGeometry,Nn=as.vec4.transformMat4([],[Hr.x,Hr.y,Hr.z,1],Ue);if(!Ot&&Ct?_i*=Nn[3]/Oe.cameraToCenterDistance:Ot&&!Ct&&(_i*=Oe.cameraToCenterDistance/Nn[3]),Ct){const Le=hl((Re.y/ud+xi.y)/(1<<xi.z));_i/=Oe.projection.pixelsPerMeter(Le,1)/ul(1,Le)}if(Bl(Ln,Jr,_i))return!0}return!1}function Gu(Le,Re,Oe,Ue){const qe=as.vec4.transformMat4([],[Le,Re,Oe,1],Ue);return new ta(qe[0]/qe[3],qe[1]/qe[3])}const e_=as.vec3.fromValues(0,0,0),t_=as.vec3.fromValues(0,0,1);function Zu(Le,Re){const Oe=as.vec3.create();return e_[2]=Re,Le.intersectsPlane(e_,t_,Oe),new ta(Oe[0],Oe[1])}class Wu extends Tl{}let i_,r_,n_,o_;function tc(Le,{width:Re,height:Oe},Ue,qe){if(qe){if(qe instanceof Uint8ClampedArray)qe=new Uint8Array(qe.buffer);else if(qe.length!==Re*Oe*Ue)throw new RangeError("mismatched image size")}else qe=new Uint8Array(Re*Oe*Ue);return Le.width=Re,Le.height=Oe,Le.data=qe,Le}function ec(Le,Re,Oe){const{width:Ue,height:qe}=Re;Ue===Le.width&&qe===Le.height||(rc(Le,Re,{x:0,y:0},{x:0,y:0},{width:Math.min(Le.width,Ue),height:Math.min(Le.height,qe)},Oe,null),Le.width=Ue,Le.height=qe,Le.data=Re.data)}function rc(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){if(0===qe.width||0===qe.height)return Re;if(qe.width>Le.width||qe.height>Le.height||Oe.x>Le.width-qe.width||Oe.y>Le.height-qe.height)throw new RangeError("out of range source coordinates for image copy");if(qe.width>Re.width||qe.height>Re.height||Ue.x>Re.width-qe.width||Ue.y>Re.height-qe.height)throw new RangeError("out of range destination coordinates for image copy");const _i=Le.data,xi=Re.data,vi=4===Ct&&Jt;for(let Jt=0;Jt<qe.height;Jt++){const bi=((Oe.y+Jt)*Le.width+Oe.x)*Ct,Pi=((Ue.y+Jt)*Re.width+Ue.x)*Ct;if(vi)for(let Le=0;Le<qe.width;Le++){const Re=bi+Le*Ct+3,Oe=Pi+Le*Ct;xi[Oe+0]=255,xi[Oe+1]=255,xi[Oe+2]=255,xi[Oe+3]=_i[Re]}else if(Ot)for(let Le=0;Le<qe.width;Le++){const Re=bi+Le*Ct,Oe=Pi+Le*Ct,Ue=_i[Re+3],qe=new Pe(_i[Re+0]/255*Ue,_i[Re+1]/255*Ue,_i[Re+2]/255*Ue,Ue).toRenderColor(Ot).toArray();xi[Oe+0]=qe[0],xi[Oe+1]=qe[1],xi[Oe+2]=qe[2],xi[Oe+3]=qe[3]}else for(let Le=0;Le<qe.width*Ct;Le++)xi[Pi+Le]=_i[bi+Le]}return Re}os(Wu,"HeatmapBucket",{omit:["layers"]});class nc{constructor(Le,Re){tc(this,Le,1,Re)}resize(Le){ec(this,new nc(Le),1)}clone(){return new nc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(Le,Re,Oe,Ue,qe){rc(Le,Re,Oe,Ue,qe,1,null)}}class ic{constructor(Le,Re){tc(this,Le,4,Re)}resize(Le){ec(this,new ic(Le),4)}replace(Le,Re){Re?this.data.set(Le):this.data=Le instanceof Uint8ClampedArray?new Uint8Array(Le.buffer):Le}clone(){return new ic({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(Le,Re,Oe,Ue,qe,Ct,Ot){rc(Le,Re,Oe,Ue,qe,4,Ct,Ot)}}class sc{constructor(Le,Re){this.width=Le.width,this.height=Le.height,this.data=Re instanceof Uint8Array?new Float32Array(Re.buffer):Re}}function ac(Le){const Re={},Oe=Le.resolution||256,Ue=Le.clips?Le.clips.length:1,qe=Le.image||new ic({width:Oe,height:Ue}),s=(Oe,Ue,Ct)=>{Re[Le.evaluationKey]=Ct;const Ot=Le.expression.evaluate(Re);Ot&&(qe.data[Oe+Ue+0]=Math.floor(255*Ot.r/Ot.a),qe.data[Oe+Ue+1]=Math.floor(255*Ot.g/Ot.a),qe.data[Oe+Ue+2]=Math.floor(255*Ot.b/Ot.a),qe.data[Oe+Ue+3]=Math.floor(255*Ot.a))};if(Le.clips)for(let Re=0,qe=0;Re<Ue;++Re,qe+=4*Oe)for(let Ue=0,Ct=0;Ue<Oe;Ue++,Ct+=4){const Ot=Ue/(Oe-1),{start:Jt,end:_i}=Le.clips[Re];s(qe,Ct,Jt*(1-Ot)+_i*Ot)}else for(let Le=0,Re=0;Le<Oe;Le++,Re+=4)s(0,Re,Le/(Oe-1));return qe}os(nc,"AlphaImage"),os(ic,"RGBAImage");const s_=ya([{name:"a_pos",components:2,type:"Int16"}],4),{members:a_}=s_;function uc(Le,Re,Oe=2){const Ue=Re&&Re.length,qe=Ue?Re[0]*Oe:Le.length;let Ct=cc(Le,0,qe,Oe,!0);const Ot=[];
vendor: 4,231 bytes, line 1
1if(!Ct||Ct.next===Ct.prev)return Ot;let Jt,_i,xi;if(Ue&&(Ct=function(Le,Re,Oe,Ue){const qe=[];for(let Oe=0,Ct=Re.length;Oe<Ct;Oe++){const Ot=cc(Le,Re[Oe]*Ue,Oe<Ct-1?Re[Oe+1]*Ue:Le.length,Ue,!1);Ot===Ot.next&&(Ot.steiner=!0),qe.push(wc(Ot))}qe.sort(gc);for(let Le=0;Le<qe.length;Le++)Oe=xc(qe[Le],Oe);return Oe}(Le,Re,Ct,Oe)),Le.length>80*Oe){Jt=1/0,_i=1/0;let Re=-1/0,Ue=-1/0;for(let Ct=Oe;Ct<qe;Ct+=Oe){const Oe=Le[Ct],qe=Le[Ct+1];Oe<Jt&&(Jt=Oe),qe<_i&&(_i=qe),Oe>Re&&(Re=Oe),qe>Ue&&(Ue=qe)}xi=Math.max(Re-Jt,Ue-_i),xi=0!==xi?32767/xi:0}return pc(Ct,Ot,Oe,Jt,_i,xi,0),Ot}function cc(Le,Re,Oe,Ue,qe){let Ct;if(qe===function(Le,Re,Oe,Ue){let qe=0;for(let Ct=Re,Ot=Oe-Ue;Ct<Oe;Ct+=Ue)qe+=(Le[Ot]-Le[Ct])*(Le[Ct+1]+Le[Ot+1]),Ot=Ct;return qe}(Le,Re,Oe,Ue)>0)for(let qe=Re;qe<Oe;qe+=Ue)Ct=Ec(qe/Ue|0,Le[qe],Le[qe+1],Ct);else for(let qe=Oe-Ue;qe>=Re;qe-=Ue)Ct=Ec(qe/Ue|0,Le[qe],Le[qe+1],Ct);return Ct&&Sc(Ct,Ct.next)&&(Bc(Ct),Ct=Ct.next),Ct}function hc(Le,Re){if(!Le)return Le;Re||(Re=Le);let Oe,Ue=Le;do{if(Oe=!1,Ue.steiner||!Sc(Ue,Ue.next)&&0!==Ac(Ue.prev,Ue,Ue.next))Ue=Ue.next;else{if(Bc(Ue),Ue=Re=Ue.prev,Ue===Ue.next)break;Oe=!0}}while(Oe||Ue!==Re);return Re}function pc(Le,Re,Oe,Ue,qe,Ct,Ot){if(!Le)return;!Ot&&Ct&&function(Le,Re,Oe,Ue){let qe=Le;do{0===qe.z&&(qe.z=vc(qe.x,qe.y,Re,Oe,Ue)),qe.prevZ=qe.prev,qe.nextZ=qe.next,qe=qe.next}while(qe!==Le);qe.prevZ.nextZ=null,qe.prevZ=null,function(Le){let Re,Oe=1;do{let Ue,qe=Le;Le=null;let Ct=null;for(Re=0;qe;){Re++;let Ot=qe,Jt=0;for(let Le=0;Le<Oe&&(Jt++,Ot=Ot.nextZ,Ot);Le++);let _i=Oe;for(;Jt>0||_i>0&&Ot;)0!==Jt&&(0===_i||!Ot||qe.z<=Ot.z)?(Ue=qe,qe=qe.nextZ,Jt--):(Ue=Ot,Ot=Ot.nextZ,_i--),Ct?Ct.nextZ=Ue:Le=Ue,Ue.prevZ=Ct,Ct=Ue;qe=Ot}Ct.nextZ=null,Oe*=2}while(Re>1)}(qe)}(Le,Ue,qe,Ct);let Jt=Le;for(;Le.prev!==Le.next;){const _i=Le.prev,xi=Le.next;if(Ct?dc(Le,Ue,qe,Ct):fc(Le))Re.push(_i.i,Le.i,xi.i),Bc(Le),Le=xi.next,Jt=xi.next;else if((Le=xi)===Jt){Ot?1===Ot?pc(Le=mc(hc(Le),Re),Re,Oe,Ue,qe,Ct,2):2===Ot&&yc(Le,Re,Oe,Ue,qe,Ct):pc(hc(Le),Re,Oe,Ue,qe,Ct,1);break}}}function fc(Le){const Re=Le.prev,Oe=Le,Ue=Le.next;if(Ac(Re,Oe,Ue)>=0)return!1;const qe=Re.x,Ct=Oe.x,Ot=Ue.x,Jt=Re.y,_i=Oe.y,xi=Ue.y,vi=qe<Ct?qe<Ot?qe:Ot:Ct<Ot?Ct:Ot,bi=Jt<_i?Jt<xi?Jt:xi:_i<xi?_i:xi,Pi=qe>Ct?qe>Ot?qe:Ot:Ct>Ot?Ct:Ot,Hr=Jt>_i?Jt>xi?Jt:xi:_i>xi?_i:xi;let Jr=Ue.next;for(;Jr!==Re;){if(Jr.x>=vi&&Jr.x<=Pi&&Jr.y>=bi&&Jr.y<=Hr&&_c(qe,Jt,Ct,_i,Ot,xi,Jr.x,Jr.y)&&Ac(Jr.prev,Jr,Jr.next)>=0)return!1;Jr=Jr.next}return!0}function dc(Le,Re,Oe,Ue){const qe=Le.prev,Ct=Le,Ot=Le.next;if(Ac(qe,Ct,Ot)>=0)return!1;const Jt=qe.x,_i=Ct.x,xi=Ot.x,vi=qe.y,bi=Ct.y,Pi=Ot.y,Hr=Jt<_i?Jt<xi?Jt:xi:_i<xi?_i:xi,Jr=vi<bi?vi<Pi?vi:Pi:bi<Pi?bi:Pi,Ln=Jt>_i?Jt>xi?Jt:xi:_i>xi?_i:xi,Nn=vi>bi?vi>Pi?vi:Pi:bi>Pi?bi:Pi,Gn=vc(Hr,Jr,Re,Oe,Ue),qn=vc(Ln,Nn,Re,Oe,Ue);let Zn=Le.prevZ,$n=Le.nextZ;for(;Zn&&Zn.z>=Gn&&$n&&$n.z<=qn;){if(Zn.x>=Hr&&Zn.x<=Ln&&Zn.y>=Jr&&Zn.y<=Nn&&Zn!==qe&&Zn!==Ot&&_c(Jt,vi,_i,bi,xi,Pi,Zn.x,Zn.y)&&Ac(Zn.prev,Zn,Zn.next)>=0)return!1;if(Zn=Zn.prevZ,$n.x>=Hr&&$n.x<=Ln&&$n.y>=Jr&&$n.y<=Nn&&$n!==qe&&$n!==Ot&&_c(Jt,vi,_i,bi,xi,Pi,$n.x,$n.y)&&Ac($n.prev,$n,$n.next)>=0)return!1;$n=$n.nextZ}for(;Zn&&Zn.z>=Gn;){if(Zn.x>=Hr&&Zn.x<=Ln&&Zn.y>=Jr&&Zn.y<=Nn&&Zn!==qe&&Zn!==Ot&&_c(Jt,vi,_i,bi,xi,Pi,Zn.x,Zn.y)&&Ac(Zn.prev,Zn,Zn.next)>=0)return!1;Zn=Zn.prevZ}for(;$n&&$n.z<=qn;){if($n.x>=Hr&&$n.x<=Ln&&$n.y>=Jr&&$n.y<=Nn&&$n!==qe&&$n!==Ot&&_c(Jt,vi,_i,bi,xi,Pi,$n.x,$n.y)&&Ac($n.prev,$n,$n.next)>=0)return!1;$n=$n.nextZ}return!0}function mc(Le,Re){let Oe=Le;do{const Ue=Oe.prev,qe=Oe.next.next;!Sc(Ue,qe)&&Ic(Ue,Oe,Oe.next,qe)&&kc(Ue,qe)&&kc(qe,Ue)&&(Re.push(Ue.i,Oe.i,qe.i),Bc(Oe),Bc(Oe.next),Oe=Le=qe),Oe=Oe.next}while(Oe!==Le);return hc(Oe)}function yc(Le,Re,Oe,Ue,qe,Ct){let Ot=Le;do{let Le=Ot.next.next;for(;Le!==Ot.prev;){if(Ot.i!==Le.i&&Mc(Ot,Le)){let Jt=Tc(Ot,Le);return Ot=hc(Ot,Ot.next),Jt=hc(Jt,Jt.next),pc(Ot,Re,Oe,Ue,qe,Ct,0),void pc(Jt,Re,Oe,Ue,qe,Ct,0)}Le=Le.next}Ot=Ot.next}while(Ot!==Le)}function gc(Le,Re){return Le.x-Re.x}function xc(Le,Re){const Oe=function(Le,Re){let Oe=Re;const Ue=Le.x,qe=Le.y;let Ct,Ot=-1/0;do{if(qe<=Oe.y&&qe>=Oe.next.y&&Oe.next.y!==Oe.y){const Le=Oe.x+(qe-Oe.y)*(Oe.next.x-Oe.x)/(Oe.next.y-Oe.y);if(Le<=Ue&&Le>Ot&&(Ot=Le,Ct=Oe.x<Oe.next.x?Oe:Oe.next,Le===Ue))return Ct}Oe=Oe.next}
vendor: 12,444 bytes, line 1
1while(Oe!==Re);if(!Ct)return null;const Jt=Ct,_i=Ct.x,xi=Ct.y;let vi=1/0;Oe=Ct;do{if(Ue>=Oe.x&&Oe.x>=_i&&Ue!==Oe.x&&_c(qe<xi?Ue:Ot,qe,_i,xi,qe<xi?Ot:Ue,qe,Oe.x,Oe.y)){const Re=Math.abs(qe-Oe.y)/(Ue-Oe.x);kc(Oe,Le)&&(Re<vi||Re===vi&&(Oe.x>Ct.x||Oe.x===Ct.x&&bc(Ct,Oe)))&&(Ct=Oe,vi=Re)}Oe=Oe.next}while(Oe!==Jt);return Ct}(Le,Re);if(!Oe)return Re;const Ue=Tc(Oe,Le);return hc(Ue,Ue.next),hc(Oe,Oe.next)}function bc(Le,Re){return Ac(Le.prev,Le,Re.prev)<0&&Ac(Re.next,Le,Le.next)<0}function vc(Le,Re,Oe,Ue,qe){return(Le=1431655765&((Le=858993459&((Le=252645135&((Le=16711935&((Le=(Le-Oe)*qe|0)|Le<<8))|Le<<4))|Le<<2))|Le<<1))|(Re=1431655765&((Re=858993459&((Re=252645135&((Re=16711935&((Re=(Re-Ue)*qe|0)|Re<<8))|Re<<4))|Re<<2))|Re<<1))<<1}function wc(Le){let Re=Le,Oe=Le;do{(Re.x<Oe.x||Re.x===Oe.x&&Re.y<Oe.y)&&(Oe=Re),Re=Re.next}while(Re!==Le);return Oe}function _c(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){return(qe-Ot)*(Re-Jt)>=(Le-Ot)*(Ct-Jt)&&(Le-Ot)*(Ue-Jt)>=(Oe-Ot)*(Re-Jt)&&(Oe-Ot)*(Ct-Jt)>=(qe-Ot)*(Ue-Jt)}function Mc(Le,Re){return Le.next.i!==Re.i&&Le.prev.i!==Re.i&&!function(Le,Re){let Oe=Le;do{if(Oe.i!==Le.i&&Oe.next.i!==Le.i&&Oe.i!==Re.i&&Oe.next.i!==Re.i&&Ic(Oe,Oe.next,Le,Re))return!0;Oe=Oe.next}while(Oe!==Le);return!1}(Le,Re)&&(kc(Le,Re)&&kc(Re,Le)&&function(Le,Re){let Oe=Le,Ue=!1;const qe=(Le.x+Re.x)/2,Ct=(Le.y+Re.y)/2;do{Oe.y>Ct!=Oe.next.y>Ct&&Oe.next.y!==Oe.y&&qe<(Oe.next.x-Oe.x)*(Ct-Oe.y)/(Oe.next.y-Oe.y)+Oe.x&&(Ue=!Ue),Oe=Oe.next}while(Oe!==Le);return Ue}(Le,Re)&&(Ac(Le.prev,Le,Re.prev)||Ac(Le,Re.prev,Re))||Sc(Le,Re)&&Ac(Le.prev,Le,Le.next)>0&&Ac(Re.prev,Re,Re.next)>0)}function Ac(Le,Re,Oe){return(Re.y-Le.y)*(Oe.x-Re.x)-(Re.x-Le.x)*(Oe.y-Re.y)}function Sc(Le,Re){return Le.x===Re.x&&Le.y===Re.y}function Ic(Le,Re,Oe,Ue){const qe=zc(Ac(Le,Re,Oe)),Ct=zc(Ac(Le,Re,Ue)),Ot=zc(Ac(Oe,Ue,Le)),Jt=zc(Ac(Oe,Ue,Re));return qe!==Ct&&Ot!==Jt||!(0!==qe||!Pc(Le,Oe,Re))||!(0!==Ct||!Pc(Le,Ue,Re))||!(0!==Ot||!Pc(Oe,Le,Ue))||!(0!==Jt||!Pc(Oe,Re,Ue))}function Pc(Le,Re,Oe){return Re.x<=Math.max(Le.x,Oe.x)&&Re.x>=Math.min(Le.x,Oe.x)&&Re.y<=Math.max(Le.y,Oe.y)&&Re.y>=Math.min(Le.y,Oe.y)}function zc(Le){return Le>0?1:Le<0?-1:0}function kc(Le,Re){return Ac(Le.prev,Le,Le.next)<0?Ac(Le,Re,Le.next)>=0&&Ac(Le,Le.prev,Re)>=0:Ac(Le,Re,Le.prev)<0||Ac(Le,Le.next,Re)<0}function Tc(Le,Re){const Oe=Vc(Le.i,Le.x,Le.y),Ue=Vc(Re.i,Re.x,Re.y),qe=Le.next,Ct=Re.prev;return Le.next=Re,Re.prev=Le,Oe.next=qe,qe.prev=Oe,Ue.next=Oe,Oe.prev=Ue,Ct.next=Ue,Ue.prev=Ct,Ue}function Ec(Le,Re,Oe,Ue){const qe=Vc(Le,Re,Oe);return Ue?(qe.next=Ue.next,qe.prev=Ue,Ue.next.prev=qe,Ue.next=qe):(qe.prev=qe,qe.next=qe),qe}function Bc(Le){Le.next.prev=Le.prev,Le.prev.next=Le.next,Le.prevZ&&(Le.prevZ.nextZ=Le.nextZ),Le.nextZ&&(Le.nextZ.prevZ=Le.prevZ)}function Vc(Le,Re,Oe){return{i:Le,x:Re,y:Oe,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Cc(Le,Re){const Oe=Le.length;if(Oe<=1)return[Le];const Ue=[];let qe,Ct;for(let Re=0;Re<Oe;Re++){const Oe=mt(Le[Re]);0!==Oe&&(Le[Re].area=Math.abs(Oe),void 0===Ct&&(Ct=Oe<0),Ct===Oe<0?(qe&&Ue.push(qe),qe=[Le[Re]]):qe.push(Le[Re]))}if(qe&&Ue.push(qe),Re>1)for(let Le=0;Le<Ue.length;Le++)Ue[Le].length<=Re||(br(Ue[Le],Re,1,Ue[Le].length-1,Rc),Ue[Le]=Ue[Le].slice(0,Re));return Ue}function Rc(Le,Re){return Re.area-Le.area}function Dc(Le,Re,Oe){const Ue=Oe.patternDependencies;let qe=!1;for(const Oe of Re){const Re=Oe.paint.get(`${Le}-pattern`);Re.isConstant()||(qe=!0);const Ct=Re.constantOr(null);Ct&&(qe=!0,Ue[Ct]=!0)}return qe}function Lc(Le,Re,Oe,Ue,qe){const Ct=qe.patternDependencies;for(const Ot of Re){const Re=Ot.paint.get(`${Le}-pattern`).value;if("constant"!==Re.kind){let Le=Re.evaluate({zoom:Ue},Oe,{},qe.availableImages);Le=Le&&Le.name?Le.name:Le,Ct[Le]=!0,Oe.patterns[Ot.id]=Le}}return Oe}class Fc{constructor(Le){this.zoom=Le.zoom,this.overscaling=Le.overscaling,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.index=Le.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new xa,this.indexArray=new Da,this.indexArray2=new Ea,this.programConfigurations=new Fo(Le.layers,{zoom:Le.zoom,lut:Le.lut}),this.segments=new co,this.segments2=new co,this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id)),this.projection=Le.projection}updateFootprints(Le,Re){}populate(Le,Re,Oe,Ue){this.hasPattern=Dc("fill",this.layers,Re);const qe=this.layers[0].layout.get("fill-sort-key"),Ct=[];for(const{feature:Ot,id:Jt,index:_i,sourceLayerIndex:xi}of Le){const Le=this.layers[0]._featureFilter.needGeometry,vi=Pl(Ot,Le);if(!this.layers[0]._featureFilter.filter(new Vs(this.zoom),vi,Oe))continue;const bi=qe?qe.evaluate(vi,{},Oe,Re.availableImages):void 0,Pi={id:Jt,properties:Ot.properties,type:Ot.type,sourceLayerIndex:xi,index:_i,geometry:Le?vi.geometry:Il(Ot,Oe,Ue),patterns:{},sortKey:bi};Ct.push(Pi)}qe&&Ct.sort(((Le,Re)=>Le.sortKey-Re.sortKey));for(const Ue of Ct){const{geometry:qe,index:Ct,sourceLayerIndex:Ot}=Ue;if(this.hasPattern){const Le=Lc("fill",this.layers,Ue,this.zoom,Re);this.patternFeatures.push(Le)}else this.addFeature(Ue,qe,Ct,Oe,{},Re.availableImages,Re.brightness);Re.featureIndex.insert(Le[Ct].feature,qe,Ct,Ot,this.index)}}update(Le,Re,Oe,Ue,qe){const Ct=0!==Object.keys(Le).length;Ct&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(Le,Re,Ct?this.stateDependentLayers:this.layers,Oe,Ue,qe)}addFeatures(Le,Re,Oe,Ue,qe,Ct){for(const Le of this.patternFeatures)this.addFeature(Le,Le.geometry,Le.index,Re,Oe,Ue,Ct)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(Le){this.uploaded||(this.layoutVertexBuffer=Le.createVertexBuffer(this.layoutVertexArray,a_),this.indexBuffer=Le.createIndexBuffer(this.indexArray),this.indexBuffer2=Le.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(Le),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(Le,Re,Oe,Ue,qe,Ct=[],Ot){for(const Le of Cc(Re,500)){let Re=0;for(const Oe of Le)Re+=Oe.length;const Oe=this.segments.prepareSegment(Re,this.layoutVertexArray,this.indexArray),Ue=Oe.vertexLength,qe=[],Ct=[];for(const Re of Le){if(0===Re.length)continue;Re!==Le[0]&&Ct.push(qe.length/2);const Oe=this.segments2.prepareSegment(Re.length,this.layoutVertexArray,this.indexArray2),Ue=Oe.vertexLength;this.layoutVertexArray.emplaceBack(Re[0].x,Re[0].y),this.indexArray2.emplaceBack(Ue+Re.length-1,Ue),qe.push(Re[0].x),qe.push(Re[0].y);for(let Le=1;Le<Re.length;Le++)this.layoutVertexArray.emplaceBack(Re[Le].x,Re[Le].y),this.indexArray2.emplaceBack(Ue+Le-1,Ue+Le),qe.push(Re[Le].x),qe.push(Re[Le].y);Oe.vertexLength+=Re.length,Oe.primitiveLength+=Re.length}const Ot=uc(qe,Ct);for(let Le=0;Le<Ot.length;Le+=3)this.indexArray.emplaceBack(Ue+Ot[Le],Ue+Ot[Le+1],Ue+Ot[Le+2]);Oe.vertexLength+=Re,Oe.primitiveLength+=Ot.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,Le,Oe,qe,Ct,Ue,Ot)}}let l_,c_,h_,u_;os(Fc,"FillBucket",{omit:["layers","patternFeatures"]});class qc{constructor(Le,Re,Oe,Ue){if(this.triangleCount=Re.length/3,this.min=new ta(0,0),this.max=new ta(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===Le.length)return;const[qe,Ct]=[Le[0].clone(),Le[0].clone()];for(let Re=1;Re<Le.length;++Re){const Oe=Le[Re];qe.x=Math.min(qe.x,Oe.x),qe.y=Math.min(qe.y,Oe.y),Ct.x=Math.max(Ct.x,Oe.x),Ct.y=Math.max(Ct.y,Oe.y)}if(Ue){const Le=Math.ceil(Math.max(Ct.x-qe.x,Ct.y-qe.y)/Ue);Oe=Math.max(Oe,Le)}if(0===Oe)return;this.min=qe,this.max=Ct;const Ot=this.max.sub(this.min);Ot.x=Math.max(Ot.x,1),Ot.y=Math.max(Ot.y,1);const Jt=Math.max(Ot.x,Ot.y)/Oe;this.cellsX=Math.max(1,Math.ceil(Ot.x/Jt)),this.cellsY=Math.max(1,Math.ceil(Ot.y/Jt)),this.xScale=1/Jt,this.yScale=1/Jt;const _i=[];for(let Oe=0;Oe<this.triangleCount;Oe++){const Ue=Le[Re[3*Oe+0]].sub(this.min),qe=Le[Re[3*Oe+1]].sub(this.min),Ct=Le[Re[3*Oe+2]].sub(this.min),Ot=$c(Math.floor(Math.min(Ue.x,qe.x,Ct.x)),this.xScale,this.cellsX),xi=$c(Math.floor(Math.max(Ue.x,qe.x,Ct.x)),this.xScale,this.cellsX),vi=$c(Math.floor(Math.min(Ue.y,qe.y,Ct.y)),this.yScale,this.cellsY),bi=$c(Math.floor(Math.max(Ue.y,qe.y,Ct.y)),this.yScale,this.cellsY),Pi=new ta(0,0),Hr=new ta(0,0),Jr=new ta(0,0),Ln=new ta(0,0);for(let Le=vi;Le<=bi;++Le){Pi.y=Hr.y=Le*Jt,Jr.y=Ln.y=(Le+1)*Jt;for(let Re=Ot;Re<=xi;++Re)Pi.x=Jr.x=Re*Jt,Hr.x=Ln.x=(Re+1)*Jt,($l(Ue,qe,Ct,Pi,Hr,Ln)||$l(Ue,qe,Ct,Pi,Ln,Jr))&&_i.push({cellIdx:Le*this.cellsX+Re,triIdx:Oe})}}if(0===_i.length)return;_i.sort(((Le,Re)=>Le.cellIdx-Re.cellIdx||Le.triIdx-Re.triIdx));let xi=0;for(;xi<_i.length;){const Le=_i[xi].cellIdx,Re={start:this.payload.length,len:0};for(;xi<_i.length&&_i[xi].cellIdx===Le;)++Re.len,this.payload.push(_i[xi++].triIdx);this.cells[Le]=Re}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(Le,Re){if(0===this.triangleCount||0===this.cells.length)return;if(Le.x>this.max.x||this.min.x>Le.x||Le.y>this.max.y||this.min.y>Le.y)return;const Oe=$c(Le.x-this.min.x,this.xScale,this.cellsX),Ue=$c(Le.y-this.min.y,this.yScale,this.cellsY),qe=this.cells[Ue*this.cellsX+Oe];if(qe){this._lazyInitLookup();for(let Le=0;Le<qe.len;Le++){const Oe=this.payload[qe.start+Le],Ue=Math.floor(Oe/8),Ct=1<<Oe%8;if(!(this.lookup[Ue]&Ct)&&(this.lookup[Ue]|=Ct,Re.push(Oe),Re.length===this.triangleCount))return}}}query(Le,Re,Oe){if(0===this.triangleCount||0===this.cells.length)return;if(Le.x>this.max.x||this.min.x>Re.x)return;if(Le.y>this.max.y||this.min.y>Re.y)return;this._lazyInitLookup();const Ue=$c(Le.x-this.min.x,this.xScale,this.cellsX),qe=$c(Re.x-this.min.x,this.xScale,this.cellsX),Ct=$c(Le.y-this.min.y,this.yScale,this.cellsY),Ot=$c(Re.y-this.min.y,this.yScale,this.cellsY);for(let Le=Ct;Le<=Ot;Le++)for(let Re=Ue;Re<=qe;Re++){const Ue=this.cells[Le*this.cellsX+Re];if(Ue)for(let Le=0;Le<Ue.len;Le++){const Re=this.payload[Ue.start+Le],qe=Math.floor(Re/8),Ct=1<<Re%8;if(!(this.lookup[qe]&Ct)&&(this.lookup[qe]|=Ct,Oe.push(Re),Oe.length===this.triangleCount))return}}}}function $c(Le,Re,Oe){return Math.max(0,Math.min(Oe-1,Math.floor(Le*Re)))}os(qc,"TriangleGridIndex");class Gc{constructor(Le){this.zoom=Le.zoom,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.index=Le.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id)),this.footprints=[]}updateFootprints(Le,Re){for(const Oe of this.footprints)Re.push({footprint:Oe,id:Le})}populate(Le,Re,Oe,Ue){const qe=[];for(const{feature:Re,id:Ct,index:Ot,sourceLayerIndex:Jt}of Le){const Le=this.layers[0]._featureFilter.needGeometry,_i=Pl(Re,Le);if(!this.layers[0]._featureFilter.filter(new Vs(this.zoom),_i,Oe))continue;const xi={id:Ct,properties:Re.properties,type:Re.type,sourceLayerIndex:Jt,index:Ot,geometry:Le?_i.geometry:Il(Re,Oe,Ue),patterns:{}};qe.push(xi)}for(const Ue of qe){const{geometry:qe,index:Ct,sourceLayerIndex:Ot}=Ue;this.addFeature(Ue,qe,Ct,Oe,{},Re.availableImages,Re.brightness),Re.featureIndex.insert(Le[Ct].feature,qe,Ct,Ot,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(Le){}update(Le,Re,Oe,Ue,qe){}destroy(){}addFeature(Le,Re,Oe,Ue,qe,Ct=[],Ot){for(const Le of Cc(Re,2)){const Re=[],Oe=[],Ue=[],qe=new ta(1/0,1/0),Ct=new ta(-1/0,-1/0);for(const Ot of Le)if(0!==Ot.length){Ot!==Le[0]&&Ue.push(Oe.length/2);for(let Le=0;Le<Ot.length;Le++)Oe.push(Ot[Le].x),Oe.push(Ot[Le].y),Re.push(Ot[Le]),qe.x=Math.min(qe.x,Ot[Le].x),qe.y=Math.min(qe.y,Ot[Le].y),Ct.x=Math.max(Ct.x,Ot[Le].x),Ct.y=Math.max(Ct.y,Ot[Le].y)}const Ot=uc(Oe,Ue),Jt=new qc(Re,Ot,8,256);this.footprints.push({vertices:Re,indices:Ot,grid:Jt,min:qe,max:Ct})}}}os(Gc,"ClipBucket",{omit:["layers"]});const d_=ya([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),p_=ya([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),f_=ya([{name:"a_centroid_pos",components:2,type:"Uint16"}]),m_=ya([{name:"a_join_normal_inside",components:3,type:"Int16"}]),__=ya([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),g_=ya([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:y_}=d_;var x_,v_,b_,w_,T_,M_,S_,E_={};
1function oh(){if(v_)return x_;v_=1;var Le=N();function e(Le,Oe,Ue,qe,Ct){(this||Re).properties={},(this||Re).extent=Ue,(this||Re).type=0,(this||Re)._pbf=Le,(this||Re)._geometry=-1,(this||Re)._keys=qe,(this||Re)._values=Ct,Le.readFields(r,this||Re,Oe)}function r(Le,Re,Oe){1==Le?Re.id=Oe.readVarint():2==Le?function(Le,Re){for(var Oe=Le.readVarint()+Le.pos;Le.pos<Oe;){var Ue=Re._keys[Le.readVarint()],qe=Re._values[Le.readVarint()];Re.properties[Ue]=qe}}(Oe,Re):3==Le?Re.type=Oe.readVarint():4==Le&&(Re._geometry=Oe.pos)}function n(Le){for(var Re,Oe,Ue=0,qe=0,Ct=Le.length,Ot=Ct-1;qe<Ct;Ot=qe++)Ue+=((Oe=Le[Ot]).x-(Re=Le[qe]).x)*(Re.y+Oe.y);return Ue}return x_=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var Oe=(this||Re)._pbf;Oe.pos=(this||Re)._geometry;for(var Ue,qe=Oe.readVarint()+Oe.pos,Ct=1,Ot=0,Jt=0,_i=0,xi=[];Oe.pos<qe;){if(Ot<=0){var vi=Oe.readVarint();Ct=7&vi,Ot=vi>>3}if(Ot--,1===Ct||2===Ct)Jt+=Oe.readSVarint(),_i+=Oe.readSVarint(),1===Ct&&(Ue&&xi.push(Ue),Ue=[]),Ue.push(new Le(Jt,_i));else{if(7!==Ct)throw new Error("unknown command "+Ct);Ue&&Ue.push(Ue[0].clone())}}return Ue&&xi.push(Ue),xi},e.prototype.bbox=function(){var Le=(this||Re)._pbf;Le.pos=(this||Re)._geometry;for(var Oe=Le.readVarint()+Le.pos,Ue=1,qe=0,Ct=0,Ot=0,Jt=1/0,_i=-1/0,xi=1/0,vi=-1/0;Le.pos<Oe;){if(qe<=0){var bi=Le.readVarint();Ue=7&bi,qe=bi>>3}if(qe--,1===Ue||2===Ue)(Ct+=Le.readSVarint())<Jt&&(Jt=Ct),Ct>_i&&(_i=Ct),(Ot+=Le.readSVarint())<xi&&(xi=Ot),Ot>vi&&(vi=Ot);else if(7!==Ue)throw new Error("unknown command "+Ue)}return[Jt,xi,_i,vi]},e.prototype.toGeoJSON=function(Le,Oe,Ue){var qe,Ct,Ot=(this||Re).extent*Math.pow(2,Ue),Jt=(this||Re).extent*Le,_i=(this||Re).extent*Oe,xi=this.loadGeometry(),vi=e.types[(this||Re).type];function p(Le){for(var Re=0;Re<Le.length;Re++){var Oe=Le[Re];Le[Re]=[360*(Oe.x+Jt)/Ot-180,360/Math.PI*Math.atan(Math.exp((180-360*(Oe.y+_i)/Ot)*Math.PI/180))-90]}}switch((this||Re).type){case 1:var bi=[];for(qe=0;qe<xi.length;qe++)bi[qe]=xi[qe][0];p(xi=bi);break;case 2:for(qe=0;qe<xi.length;qe++)p(xi[qe]);break;case 3:for(xi=function(Le){var Re=Le.length;if(Re<=1)return[Le];for(var Oe,Ue,qe=[],Ct=0;
1Ct<Re;Ct++){var Ot=n(Le[Ct]);0!==Ot&&(void 0===Ue&&(Ue=Ot<0),Ue===Ot<0?(Oe&&qe.push(Oe),Oe=[Le[Ct]]):Oe.push(Le[Ct]))}return Oe&&qe.push(Oe),qe}(xi),qe=0;qe<xi.length;qe++)for(Ct=0;Ct<xi[qe].length;Ct++)p(xi[qe][Ct])}1===xi.length?xi=xi[0]:vi="Multi"+vi;var Pi={type:"Feature",geometry:{type:vi,coordinates:xi},properties:(this||Re).properties};return"id"in(this||Re)&&(Pi.id=(this||Re).id),Pi},x_}function lh(){if(w_)return b_;w_=1;var Le=oh();function e(Le,Oe){(this||Re).version=1,(this||Re).name=null,(this||Re).extent=4096,(this||Re).length=0,(this||Re)._pbf=Le,(this||Re)._keys=[],(this||Re)._values=[],(this||Re)._features=[],Le.readFields(r,this||Re,Oe),(this||Re).length=(this||Re)._features.length}function r(Le,Re,Oe){15===Le?Re.version=Oe.readVarint():1===Le?Re.name=Oe.readString():5===Le?Re.extent=Oe.readVarint():2===Le?Re._features.push(Oe.pos):3===Le?Re._keys.push(Oe.readString()):4===Le&&Re._values.push(function(Le){for(var Re=null,Oe=Le.readVarint()+Le.pos;Le.pos<Oe;){var Ue=Le.readVarint()>>3;Re=1===Ue?Le.readString():2===Ue?Le.readFloat():3===Ue?Le.readDouble():4===Ue?Le.readVarint64():5===Ue?Le.readVarint():6===Ue?Le.readSVarint():7===Ue?Le.readBoolean():null}return Re}(Oe))}return b_=e,e.prototype.feature=function(Oe){if(Oe<0||Oe>=(this||Re)._features.length)throw new Error("feature index out of bounds");(this||Re)._pbf.pos=(this||Re)._features[Oe];var Ue=(this||Re)._pbf.readVarint()+(this||Re)._pbf.pos;return new Le((this||Re)._pbf,Ue,(this||Re).extent,(this||Re)._keys,(this||Re)._values)},b_}function uh(){return S_||(S_=1,E_.VectorTile=function(){if(M_)return T_;M_=1;var Le=lh();function e(Re,Oe,Ue){if(3===Re){var qe=new Le(Ue,Ue.readVarint()+Ue.pos);qe.length&&(Oe[qe.name]=qe)}}return T_=function(Le,Oe){(this||Re).layers=Le.readFields(e,{},Oe)},T_}(),E_.VectorTileFeature=oh(),E_.VectorTileLayer=lh()),E_}var A_=uh();class hh extends ta{constructor(Le,Re,Oe){super(Le,Re),this.z=Oe}}class ph extends hh{constructor(Le,Re,Oe,Ue){super(Le,Re,Oe),this.w=Ue}}function fh(Le,Re,Oe,Ue){const qe=[],Ct=0===Ue?(Le,Re,Oe,Ue,qe,Ct)=>{Le.push(new ta(Ct,Oe+(Ct-Re)/(Ue-Re)*(qe-Oe)))}:(Le,Re,Oe,Ue,qe,Ct)=>{Le.push(new ta(Re+(Ct-Oe)/(qe-Oe)*(Ue-Re),Ct))};for(const Ot of Le){const Le=[];for(const qe of Ot){if(qe.length<=2)continue;const Ot=[];for(let Le=0;Le<qe.length-1;Le++){const Jt=qe[Le].x,_i=qe[Le].y,xi=qe[Le+1].x,vi=qe[Le+1].y,bi=0===Ue?Jt:_i,Pi=0===Ue?xi:vi;bi<Re?Pi>Re&&Ct(Ot,Jt,_i,xi,vi,Re):bi>Oe?Pi<Oe&&Ct(Ot,Jt,_i,xi,vi,Oe):Ot.push(qe[Le]),Pi<Re&&bi>=Re&&Ct(Ot,Jt,_i,xi,vi,Re),Pi>Oe&&bi<=Oe&&Ct(Ot,Jt,_i,xi,vi,Oe)}let Jt=qe[qe.length-1];const _i=0===Ue?Jt.x:Jt.y;_i>=Re&&_i<=Oe&&Ot.push(Jt),Ot.length&&(Jt=Ot[Ot.length-1],Ot[0].x===Jt.x&&Ot[0].y===Jt.y||Ot.push(Ot[0]),Le.push(Ot))}Le.length&&qe.push(Le)}return qe}function dh(Le,Re,Oe,Ue){const qe="x"===Oe?"y":"x",Ct=(Ue-Le[Oe])/(Re[Oe]-Le[Oe]);Le[qe]=Le[qe]+(Re[qe]-Le[qe])*Ct,Le[Oe]=Ue,Le.hasOwnProperty("z")&&(Le.z=ke(Le.z,Re.z,Ct)),Le.hasOwnProperty("w")&&(Le.w=ke(Le.w,Re.w,Ct))}function mh(Le,Re,Oe,Ue){const qe=Oe,Ct=Ue;for(const Oe of["x","y"]){let Ue=Le,Ot=Re;Ue[Oe]>=Ot[Oe]&&(Ue=Re,Ot=Le),Ue[Oe]<qe&&Ot[Oe]>qe&&dh(Ue,Ot,Oe,qe),Ue[Oe]<Ct&&Ot[Oe]>Ct&&dh(Ot,Ue,Oe,Ct)}}const I_=Number.MAX_SAFE_INTEGER;function gh(Le,Re,Oe,Ue){return Le.order<Re||Le.order===I_||!(Le.clipMask&Oe)||function(Le,Re){return 0!==Re.length&&void 0===Re.find((Re=>Re===Le))}(Ue,Le.clipScope)}function xh(Le,Re){return Le.x-Re.x||Le.y-Re.y}function bh(Le,Re){return 0===xh(Le.min,Re.min)&&0===xh(Le.max,Re.max)}function vh(Le,Re){return!(Le.min.x>Re.max.x||Le.max.x<Re.min.x||Le.min.y>Re.max.y||Le.max.y<Re.min.y)}function wh(Le,Re){if(Le.length!==Re.length)return!1;for(let Oe=0;Oe<Le.length;Oe++)if(Le[Oe].sourceId!==Re[Oe].sourceId||!bh(Le[Oe],Re[Oe])||Le[Oe].order!==Re[Oe].order||Le[Oe].clipMask!==Re[Oe].clipMask||!$(Le[Oe].clipScope,Re[Oe].clipScope))return!1;return!0}function _h(Le,Re,Oe){const Ue=1/ud,qe=1/(1<<Oe.canonical.z),Ct=(Re.x*Ue+Oe.canonical.x)*qe+Oe.wrap,Ot=(Re.y*Ue+Oe.canonical.y)*qe;return{min:new ta((Le.x*Ue+Oe.canonical.x)*qe+Oe.wrap,(Le.y*Ue+Oe.canonical.y)*qe),max:new ta(Ct,Ot)}}function Mh(Le,Re,Oe){const Ue=1<<Oe.canonical.z,qe=((Re.x-Oe.wrap)*Ue-Oe.canonical.x)*ud,Ct=(Re.y*Ue-Oe.canonical.y)*ud;return{min:new ta(((Le.x-Oe.wrap)*Ue-Oe.canonical.x)*ud,(Le.y*Ue-Oe.canonical.y)*ud),max:new ta(qe,Ct)}}function Ah(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=Le.indices,_i=Le.vertices,xi=[];for(let vi=Ue;vi<Ue+qe;vi+=3){const Ue=Re[Oe[vi+0]+Ct],qe=Re[Oe[vi+1]+Ct],bi=Re[Oe[vi+2]+Ct],Pi=Math.min(Ue.x,qe.x,bi.x),Hr=Math.max(Ue.x,qe.x,bi.x),Jr=Math.min(Ue.y,qe.y,bi.y),Ln=Math.max(Ue.
vendor: 10,131 bytes, line 1
1y,qe.y,bi.y);xi.length=0,Le.grid.query(new ta(Pi,Jr),new ta(Hr,Ln),xi);for(let Le=0;Le<xi.length;Le++){const Re=xi[Le];if($l(_i[Jt[3*Re+0]],_i[Jt[3*Re+1]],_i[Jt[3*Re+2]],Ue,qe,bi,Ot))return!0}}return!1}function Sh(Le,Re,Oe,Ue){if(!Le||!Oe)return!1;let qe=Le.vertices;if(!Re.canonical.equals(Ue.canonical)||Re.wrap!==Ue.wrap){if(Oe.vertices.length<Le.vertices.length)return Sh(Oe,Ue,Le,Re);const Ct=Re.canonical,Ot=Ue.canonical,Jt=Math.pow(2,Ot.z-Ct.z);qe=Le.vertices.map((Le=>new ta((Le.x+Ct.x*ud)*Jt-Ot.x*ud,(Le.y+Ct.y*ud)*Jt-Ot.y*ud)))}return Ah(Oe,qe,Le.indices,0,Le.indices.length,0,0)}function Ih(Le,Re,Oe,Ue){const qe=Math.pow(2,Ue.z-Oe.z);return new ta((Le+Oe.x*ud)*qe-Ue.x*ud,(Re+Oe.y*ud)*qe-Ue.y*ud)}function Ph(Le,Re){const Oe=[];Re.grid.queryPoint(Le,Oe);const Ue=Re.indices,qe=Re.vertices;for(let Re=0;Re<Oe.length;Re++){const Ct=Oe[Re];if(Ul([qe[Ue[3*Ct+0]],qe[Ue[3*Ct+1]],qe[Ue[3*Ct+2]]],Le))return!0}return!1}const C_=[new ta(0,0),new ta(ud,0),new ta(ud,ud),new ta(0,ud)];function kh(Le,Re){const Oe=[];let Ue=[];if(!Re||Le.length<2)return[Le];if(2===Le.length)return Nl(Le[0],Le[1],C_)?[Le]:[];for(let Re=0;Re<Le.length+2;Re++){const qe=Le[Re%Le.length],Ct=Le[(Re+1)%Le.length],Ot=Nl(0===Re?Le[Le.length-1]:Le[(Re-1)%Le.length],qe,C_),Jt=Nl(qe,Ct,C_),_i=Ot||Jt;_i&&Ue.push(qe),_i&&Jt||Ue.length>0&&(Ue.length>1&&Oe.push(Ue),Ue=[])}return Ue.length>1&&Oe.push(Ue),Oe}const P_=A_.VectorTileFeature.types,z_=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],D_=["fill-extrusion-flood-light-ground-radius"],L_=Math.pow(2,13),R_=Math.pow(2,15)-1,k_=new ta(0,1),O_=2147483648;function Lh(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){Le.emplaceBack((Re<<1)+Ot,(Oe<<1)+Ct,(Math.floor(Ue*L_)<<1)+qe,Math.round(Jt))}function Fh(Le,Re,Oe){Le.emplaceBack(Re.x*ud,Re.y*ud,Oe?1:0)}function Oh(Le,Re,Oe,Ue,qe,Ct){Le.emplaceBack(Re.x,Re.y,(Oe.x<<1)+Ue,(Oe.y<<1)+qe,Ct)}function Uh(Le,Re,Oe){const Ue=16384;Le.emplaceBack(Re.x,Re.y,Re.z,Oe[0]*Ue,Oe[1]*Ue,Oe[2]*Ue)}class jh{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Nh{constructor(){this.centroidXY=new ta(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new ta(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ta(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new ta(this.max.x-this.min.x,this.max.y-this.min.y)}}class qh{constructor(){this.acc=new ta(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(Le,Re){Le.min.x===Number.MAX_VALUE&&(Le.min.x=Le.max.x=Re.x,Le.min.y=Le.max.y=Re.y)}appendEdge(Le,Re,Oe){this.accCount++,this.acc._add(Re);let Ue=!!this.borders;Re.x<Le.min.x?(Le.min.x=Re.x,Ue=!0):Re.x>Le.max.x&&(Le.max.x=Re.x,Ue=!0),Re.y<Le.min.y?(Le.min.y=Re.y,Ue=!0):Re.y>Le.max.y&&(Le.max.y=Re.y,Ue=!0),((0===Re.x||Re.x===ud)&&Re.x===Oe.x)!=((0===Re.y||Re.y===ud)&&Re.y===Oe.y)&&this.processBorderOverlap(Re,Oe),Ue&&this.checkBorderIntersection(Re,Oe)}checkBorderIntersection(Le,Re){Re.x<0!=Le.x<0&&this.addBorderIntersection(0,ke(Re.y,Le.y,(0-Re.x)/(Le.x-Re.x))),Re.x>ud!=Le.x>ud&&this.addBorderIntersection(1,ke(Re.y,Le.y,(ud-Re.x)/(Le.x-Re.x))),Re.y<0!=Le.y<0&&this.addBorderIntersection(2,ke(Re.x,Le.x,(0-Re.y)/(Le.y-Re.y))),Re.y>ud!=Le.y>ud&&this.addBorderIntersection(3,ke(Re.x,Le.x,(ud-Re.y)/(Le.y-Re.y)))}addBorderIntersection(Le,Re){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const Oe=this.borders[Le];Re<Oe[0]&&(Oe[0]=Re),Re>Oe[1]&&(Oe[1]=Re)}processBorderOverlap(Le,Re){if(Le.x===Re.x){if(Le.y===Re.y)return;const Oe=0===Le.x?0:1;this.addBorderIntersection(Oe,Re.y),this.addBorderIntersection(Oe,Le.y)}else{const Oe=0===Le.y?2:3;this.addBorderIntersection(Oe,Re.x),this.addBorderIntersection(Oe,Le.x)}}centroid(){return 0===this.accCount?new ta(0,0):new ta(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((Le,Re)=>Le+ +(Re[0]!==Number.MAX_VALUE)),0):0}}function $h(Le,Re){const Oe=Le.add(Re)._unit(),Ue=Q(Le.x*Oe.x+Le.y*Oe.y,-1,1);var qe,Ct,Ot;return Ot=Math.acos(Ue),Math.min(4,Math.max(-4,Math.tan(Ot)))/4*R_*((qe=Le).x*(Ct=Re).y-qe.y*Ct.x<0?-1:1)}const F_=[Le=>Le.x<0,Le=>Le.x>ud,Le=>Le.y<0,Le=>Le.y>ud];function Xh(Le,Re,Oe,Ue){const qe=[4];if(0===Ue)return qe;Oe._mult(Ue);const Ct=Le.sub(Oe),Ot=Re.sub(Oe),Jt=[Le,Re,Ct,Ot];for(let Le=0;Le<4;Le++)for(const Re of Jt)if(F_[Le](Re)){qe.push(Le);break}return qe}class Yh{constructor(Le){this.vertexArray=new wa,this.indexArray=new Da,this.programConfigurations=new Fo(Le.layers,{zoom:Le.zoom,lut:Le.lut},(Le=>D_.includes(Le))),this._segments=new co,this.hiddenByLandmarkVertexArray=new Za,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new co}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(Le,Re,Oe,Ue=!1){const qe=Le.length;if(qe>2){let Ct=Math.max(0,this._segments.get().length-1);const Ot=this._segments._prepareSegment(4*qe,this.vertexArray.length,2*this._segmentToGroundQuads[Ct].length);let Jt;Ct!==this._segments.get().length-1&&(Ct++,this._segmentToGroundQuads[Ct]=[],this._segmentToRegionTriCounts[Ct]=[0,0,0,0,0]);{const Re=Le[0],Oe=Le[1];Jt=$h(Re.sub(Le[qe-1])._perp()._unit(),Oe.sub(Re)._perp()._unit())}for(let _i=0;_i<qe;_i++){const xi=_i===qe-1?0:_i+1,vi=Le[_i],bi=Le[xi],Pi=Le[xi===qe-1?0:xi+1],Hr=bi.sub(vi)._perp()._unit(),Jr=$h(Hr,Pi.sub(bi)._perp()._unit()),Ln=Jt,Nn=Jr;if(Jh(vi,bi,Re)||Ue&&Qh(vi,Re)&&Qh(bi,Re)){Jt=Jr;continue}const Gn=Ot.vertexLength;Oh(this.vertexArray,vi,bi,1,1,Ln),Oh(this.vertexArray,vi,bi,1,0,Ln),Oh(this.vertexArray,vi,bi,0,1,Nn),Oh(this.vertexArray,vi,bi,0,0,Nn),Ot.vertexLength+=4;const qn=Xh(vi,bi,Hr,Oe);for(const Le of qn)this._segmentToGroundQuads[Ct].push({id:Gn,region:Le}),this._segmentToRegionTriCounts[Ct][Le]+=2,Ot.primitiveLength+=2;Jt=Jr}}}prepareBorderSegments(){if(!this.hasData())return;const Le=this._segments.get(),Re=Le.length;for(let Le=0;Le<Re;Le++)this._segmentToGroundQuads[Le].sort(((Le,Re)=>Le.region-Re.region));for(let Oe=0;Oe<Re;Oe++){const Re=this._segmentToGroundQuads[Oe],Ue=Le[Oe],qe=this._segmentToRegionTriCounts[Oe];qe.reduce(((Le,Re)=>Le+Re),0);let Ct=0;for(let Le=0;Le<=4;Le++){const Re=qe[Le];if(0!==Re){let Oe=this.regionSegments[Le];Oe||(Oe=this.regionSegments[Le]=new co);const qe={vertexOffset:Ue.vertexOffset,primitiveOffset:Ue.primitiveOffset+Ct,vertexLength:Ue.vertexLength,primitiveLength:Re};Oe.get().push(qe)}Ct+=Re}for(let Le=0;Le<Re.length;Le++){const Oe=Re[Le].id;this.indexArray.emplaceBack(Oe,Oe+1,Oe+3),this.indexArray.emplaceBack(Oe,Oe+3,Oe+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(Le,Re,Oe,Ue,qe,Ct){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,Le,Re,Oe,Ue,qe,Ct)}upload(Le){this.hasData()&&(this.vertexBuffer=Le.createVertexBuffer(this.vertexArray,p_.members),this.indexBuffer=Le.createIndexBuffer(this.indexArray))}uploadPaintProperties(Le){this.hasData()&&this.programConfigurations.upload(Le)}update(Le,Re,Oe,Ue,qe,Ct){this.hasData()&&this.programConfigurations.updatePaintArrays(Le,Re,Oe,Ue,qe,Ct)}updateHiddenByLandmark(Le){if(!this.hasData())return;const Re=Le.groundVertexCount+Le.groundVertexArrayOffset;if(0===Le.groundVertexCount)return;const Oe=Le.flags&O_?1:0;for(let Ue=Le.groundVertexArrayOffset;Ue<Re;++Ue)this.hiddenByLandmarkVertexArray.emplace(Ue,Oe);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(Le){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=Le.createVertexBuffer(this.hiddenByLandmarkVertexArray,__.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let Le=0;Le<=4;Le++){const Re=this.regionSegments[Le];Re&&Re.destroy()}}}}class Zh{constructor(Le){this.zoom=Le.zoom,this.canonical=Le.canonical,this.overscaling=Le.overscaling,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.index=Le.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=Le.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Da,this.footprintVertices=new xa,this.footprintSegments=[],this.layoutVertexArray=new va,this.centroidVertexArray=new so,this.wallVertexArray=new oo,this.indexArray=new Da,this.programConfigurations=new Fo(Le.layers,{zoom:Le.zoom,lut:Le.lut},(Le=>z_.includes(Le))),this.segments=new co,this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id)),this.groundEffect=new Yh(Le),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(Le,Re){}populate(Le,Re,Oe,Ue){this.features=[],this.hasPattern=Dc("fill-extrusion",this.layers,Re),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=gl(Oe),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:qe,id:Ct,index:Ot,sourceLayerIndex:Jt}of Le){const Le=this.layers[0]._featureFilter.needGeometry,_i=Pl(qe,Le);
vendor: 4,404 bytes, line 1
1if(!this.layers[0]._featureFilter.filter(new Vs(this.zoom),_i,Oe))continue;const xi={id:Ct,sourceLayerIndex:Jt,index:Ot,geometry:Le?_i.geometry:Il(qe,Oe,Ue),properties:qe.properties,type:qe.type,patterns:{}},vi=this.layoutVertexArray.length,bi="Polygon"===P_[xi.type];if(this.hasPattern)this.features.push(Lc("fill-extrusion",this.layers,xi,this.zoom,Re));else if(this.wallMode)for(const Le of xi.geometry)for(const qe of kh(Le,bi))this.addFeature(xi,[qe],Ot,Oe,{},Re.availableImages,Ue,Re.brightness);else this.addFeature(xi,xi.geometry,Ot,Oe,{},Re.availableImages,Ue,Re.brightness);Re.featureIndex.insert(qe,xi.geometry,Ot,Jt,this.index,vi)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(Le,Re,Oe,Ue,qe,Ct){for(const Le of this.features){const Ot="Polygon"===P_[Le.type],{geometry:Jt}=Le;if(this.wallMode)for(const _i of Jt)for(const Jt of kh(_i,Ot))this.addFeature(Le,[Jt],Le.index,Re,Oe,Ue,qe,Ct);else this.addFeature(Le,Jt,Le.index,Re,Oe,Ue,qe,Ct)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(Le,Re,Oe,Ue,qe){const Ct=0!==Object.keys(Le).length;if(Ct&&!this.stateDependentLayers.length)return;const Ot=Ct?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(Le,Re,Ot,Oe,Ue,qe),this.groundEffect.update(Le,Re,Ot,Oe,Ue,qe)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(Le){this.uploaded||(this.layoutVertexBuffer=Le.createVertexBuffer(this.layoutVertexArray,y_),this.indexBuffer=Le.createIndexBuffer(this.indexArray),this.wallVertexBuffer=Le.createVertexBuffer(this.wallVertexArray,m_.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=Le.createVertexBuffer(this.layoutVertexExtArray,g_.members,!0)),this.groundEffect.upload(Le)),this.groundEffect.uploadPaintProperties(Le),this.programConfigurations.upload(Le),this.uploaded=!0}uploadCentroid(Le){this.groundEffect.uploadHiddenByLandmark(Le),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=Le.createVertexBuffer(this.centroidVertexArray,f_.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(Le,{})/this.tileToMeter,xi=[new ta(0,0),new ta(ud,ud)],vi=Ot.projection,bi="globe"===vi.name,Pi=this.wallMode||"Polygon"===P_[Le.type],Hr=new qh;Hr.centroidDataIndex=this.centroidData.length;const Jr=new Nh,Ln=this.layers[0].paint.get("fill-extrusion-base").evaluate(Le,{},Ue)<=0,Nn=this.layers[0].paint.get("fill-extrusion-height").evaluate(Le,{},Ue);let Gn;if(Jr.height=Nn,Jr.vertexArrayOffset=this.layoutVertexArray.length,Jr.groundVertexArrayOffset=this.groundEffect.vertexArray.length,bi&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Pa),this.wallMode){if(bi)return void ft("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==Re.length)return;Gn=function(Le){const Re=Le[0].x===Le[Le.length-1].x&&Le[0].y===Le[Le.length-1].y,Oe=function(Le){let Re=0;const Oe=Le.length;for(let Ue=0;Ue<Oe;Ue++)Re+=(Le[(Ue+1)%Oe].x-Le[Ue].x)*(Le[(Ue+1)%Oe].y+Le[Ue].y);return Re>=0}(Le);Oe||(Le=Le.reverse());const Ue={geometry:[],joinNormals:[],indices:[]},qe=[],Ct=[],Ot=[];let Jt=Le.length;if(Jt<(Re?3:2))return Ue;for(;Jt>=2&&Le[Jt-1].equals(Le[Jt-2]);)Jt--;let _i,xi,vi,bi,Pi,Hr=0;for(;Hr<Jt-1&&Le[Hr].equals(Le[Hr+1]);)Hr++;Re&&(_i=Le[Jt-2],Pi=Le[Hr].sub(_i)._unit()._perp());for(let Oe=Hr;Oe<Jt;Oe++){if(vi=Oe===Jt-1?Re?Le[Hr+1]:void 0:Le[Oe+1],vi&&Le[Oe].equals(vi))continue;Pi&&(bi=Pi),_i&&(xi=_i),_i=Le[Oe],Pi=vi?vi.sub(_i)._unit()._perp():bi,bi=bi||Pi;let Ue=bi.add(Pi);0===Ue.x&&0===Ue.y||Ue._unit();const Jr=Ue.x*Pi.x+Ue.y*Pi.y,Ln=0!==Jr?1/Jr:1/0,Nn=bi.x*Pi.y-bi.y*Pi.x>0;let Gn="miter";const qn=2;
vendor: 4,136 bytes, line 1
1"miter"===Gn&&Ln>qn&&(Gn="bevel"),"bevel"===Gn&&(Ln>100&&(Gn="flipbevel"),Ln<qn&&(Gn="miter"));const b=(Le,Re,Oe,Ue)=>{const Jt=new ta(Le.x,Le.y),_i=new ta(Le.x,Le.y);Jt.x+=Re.x*Ue,Jt.y+=Re.y*Ue,_i.x-=Re.x*Math.max(Oe,1),_i.y-=Re.y*Math.max(Oe,1),Ot.push(Re),qe.push(Jt),Ct.push(_i)};if("miter"===Gn)Ue._mult(Ln),b(_i,Ue,0,0);else if("flipbevel"===Gn)Ue=Pi.mult(-1),b(_i,Ue,0,0),b(_i,Ue.mult(-1),0,0);else{const Le=-Math.sqrt(Ln*Ln-1),Re=Nn?Le:0,Oe=Nn?0:Le;xi&&b(_i,bi,Re,Oe),vi&&b(_i,Pi,Re,Oe)}}Ue.geometry=[...qe,...Ct.reverse(),qe[0]],Ue.joinNormals=[...Ot,...Ot.reverse(),Ot[Ot.length-1]];const Jr=Ue.geometry.length-1;for(let Le=0;Le<Jr/2;Le++)if(Le+1<Jr/2){let Re=Le,Oe=Le+1,qe=Jr-1-Le,Ct=Jr-2-Le;Re=0===Re?Jr-1:Re-1,Oe=0===Oe?Jr-1:Oe-1,qe=0===qe?Jr-1:qe-1,Ct=0===Ct?Jr-1:Ct-1,Ue.indices.push(qe),Ue.indices.push(Oe),Ue.indices.push(Re),Ue.indices.push(qe),Ue.indices.push(Ct),Ue.indices.push(Oe)}return Ue}(Re[0]),Re=[Gn.geometry]}const x=(Le,Re)=>Le<(Re.length-1)/2||Le===Re.length-1,qn=this.wallMode?[Re]:Cc(Re,500);for(let Le=qn.length-1;Le>=0;Le--){const Re=qn[Le];(0===Re.length||(Zn=Re[0]).every((Le=>Le.x<=0))||Zn.every((Le=>Le.x>=ud))||Zn.every((Le=>Le.y<=0))||Zn.every((Le=>Le.y>=ud)))&&qn.splice(Le,1)}var Zn;let $n;if(bi)$n=np(qn,xi,Ue);else{$n=[];for(const Le of qn)$n.push({polygon:Le,bounds:xi})}const Xn=Pi?this.edgeRadius:0,Yn=Xn>0&&this.zoom<17,A=(Le,Re)=>{if(0===Le.length)return!1;const Oe=Le[Le.length-1];return Re.x===Oe.x&&Re.y===Oe.y};for(const{polygon:Le,bounds:Re}of $n){let Oe=0,qe=0;for(const Re of Le)Pi&&!Re[0].equals(Re[Re.length-1])&&Re.push(Re[0]),qe+=Pi?Re.length-1:Re.length;const Ct=this.segments.prepareSegment((Pi?5:4)*qe,this.layoutVertexArray,this.indexArray);Jr.footprintSegIdx<0&&(Jr.footprintSegIdx=this.footprintSegments.length),Jr.polygonSegIdx<0&&(Jr.polygonSegIdx=this.polygonSegments.length);const Ot={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Jt=new jh;if(Jt.vertexOffset=this.footprintVertices.length,Jt.indexOffset=3*this.footprintIndices.length,Jt.ringIndices=[],Pi){const qe=[],Ot=[];Oe=Ct.vertexLength;for(let Oe=0;Oe<Le.length;Oe++){const xi=Le[Oe];xi.length&&0!==Oe&&Ot.push(qe.length/2);const Pi=[];let Hr,Jr;Hr=xi[1].sub(xi[0])._perp()._unit(),Jt.ringIndices.push(xi.length-1);for(let Le=1;Le<xi.length;Le++){const Re=xi[Le],Oe=xi[Le===xi.length-1?1:Le+1],Ot=Re.clone();if(Xn){Jr=Oe.sub(Re)._perp()._unit();const Le=Hr.add(Jr)._unit(),Ue=Xn*Math.min(4,1/(Hr.x*Le.x+Hr.y*Le.y));Ot.x+=Ue*Le.x,Ot.y+=Ue*Le.y,Ot.x=Math.round(Ot.x),Ot.y=Math.round(Ot.y),Hr=Jr}if(!Ln||0!==Xn&&!Yn||A(Pi,Ot)||Pi.push(Ot),Lh(this.layoutVertexArray,Ot.x,Ot.y,0,0,1,1,0),this.wallMode){const Re=x(Le,xi);Fh(this.wallVertexArray,Gn.joinNormals[Le],!Re)}Ct.vertexLength++,this.footprintVertices.emplaceBack(Re.x,Re.y),qe.push(Re.x,Re.y),bi&&Uh(this.layoutVertexExtArray,vi.projectTilePoint(Ot.x,Ot.y,Ue),vi.upVector(Ue,Ot.x,Ot.y))}Ln&&(0===Xn||Yn)&&(0!==Pi.length&&A(Pi,Pi[0])&&Pi.pop(),this.groundEffect.addData(Pi,Re,_i))}const xi=this.wallMode?Gn.indices:uc(qe,Ot);for(let Le=0;Le<xi.length;Le+=3)this.footprintIndices.emplaceBack(Jt.vertexOffset+xi[Le+0],Jt.vertexOffset+xi[Le+1],Jt.vertexOffset+xi[Le+2]),this.indexArray.emplaceBack(Oe+xi[Le],Oe+xi[Le+2],Oe+xi[Le+1]),Ct.primitiveLength++;Jt.indexCount+=xi.length,Jt.vertexCount+=this.footprintVertices.length-Jt.vertexOffset}for(let qe=0;qe<Le.length;qe++){const Ot=Le[qe];Hr.startRing(Jr,Ot[0]);let Jt=Ot.length>4&&tp(Ot[Ot.length-2],Ot[0],Ot[1]),xi=Xn?Hh(Ot[Ot.length-2],Ot[0],Ot[1],Xn):0;const Nn=[];let qn,Zn,$n;Zn=Ot[1].sub(Ot[0])._perp()._unit();let Yn=!0;for(let Le=1,qe=0;Le<Ot.length;Le++){let _i=Ot[Le-1],Pi=Ot[Le];const lo=Ot[Le===Ot.length-1?1:Le+1];if(Hr.appendEdge(Jr,Pi,_i),Jh(Pi,_i,Re)){Xn&&(Zn=lo.sub(Pi)._perp()._unit(),Yn=!Yn);continue}const uo=Pi.sub(_i)._perp(),po=uo.x/(Math.abs(uo.x)+Math.abs(uo.y)),fo=uo.y>0?1:0,Io=_i.dist(Pi);if(qe+Io>32768&&(qe=0),Xn){$n=lo.sub(Pi)._perp()._unit();let Le=Kh(_i,Pi,lo,Wh(Zn,$n),Xn);isNaN(Le)&&(Le=0);const Re=Pi.sub(_i)._unit();_i=_i.add(Re.mult(xi))._round(),Pi=Pi.add(Re.mult(-Le))._round(),xi=Le,Zn=$n,Ln&&this.zoom>
vendor: 10,586 bytes, line 1
1=17&&(A(Nn,_i)||Nn.push(_i),A(Nn,Pi)||Nn.push(Pi))}const is=Ct.vertexLength,as=Ot.length>4&&tp(_i,Pi,lo);let Is=ep(qe,Jt,Yn);if(Lh(this.layoutVertexArray,_i.x,_i.y,po,fo,0,0,Is),Lh(this.layoutVertexArray,_i.x,_i.y,po,fo,0,1,Is),this.wallMode){const Re=x(Le-1,Ot),Oe=Gn.joinNormals[Le-1];Fh(this.wallVertexArray,Oe,Re),Fh(this.wallVertexArray,Oe,Re)}if(qe+=Io,Is=ep(qe,as,!Yn),Jt=as,Lh(this.layoutVertexArray,Pi.x,Pi.y,po,fo,0,0,Is),Lh(this.layoutVertexArray,Pi.x,Pi.y,po,fo,0,1,Is),this.wallMode){const Re=x(Le,Ot),Oe=Gn.joinNormals[Le];Fh(this.wallVertexArray,Oe,Re),Fh(this.wallVertexArray,Oe,Re)}if(Ct.vertexLength+=4,this.indexArray.emplaceBack(is+0,is+1,is+2),this.indexArray.emplaceBack(is+1,is+3,is+2),Ct.primitiveLength+=2,Xn){const Ue=Oe+(1===Le?Ot.length-2:Le-2),qe=1===Le?Oe:Ue+1;if(this.indexArray.emplaceBack(is+1,Ue,is+3),this.indexArray.emplaceBack(Ue,qe,is+3),Ct.primitiveLength+=2,void 0===qn&&(qn=is),!Jh(lo,Ot[Le],Re)){const Re=Le===Ot.length-1?qn:Ct.vertexLength;this.indexArray.emplaceBack(is+2,is+3,Re),this.indexArray.emplaceBack(is+3,Re+1,Re),this.indexArray.emplaceBack(is+3,qe,Re+1),Ct.primitiveLength+=3}Yn=!Yn}if(bi){const Le=this.layoutVertexExtArray,Re=vi.projectTilePoint(_i.x,_i.y,Ue),Oe=vi.projectTilePoint(Pi.x,Pi.y,Ue),qe=vi.upVector(Ue,_i.x,_i.y),Ct=vi.upVector(Ue,Pi.x,Pi.y);Uh(Le,Re,qe),Uh(Le,Re,qe),Uh(Le,Oe,Ct),Uh(Le,Oe,Ct)}}Pi&&(Oe+=Ot.length-1),Ln&&Xn&&this.zoom>=17&&(0!==Nn.length&&A(Nn,Nn[0])&&Nn.pop(),this.groundEffect.addData(Nn,Re,_i,Xn>0))}this.footprintSegments.push(Jt),Ot.triangleCount=this.indexArray.length-Ot.triangleArrayOffset,this.polygonSegments.push(Ot),++Jr.footprintSegLen,++Jr.polygonSegLen}if(Jr.vertexCount=this.layoutVertexArray.length-Jr.vertexArrayOffset,Jr.groundVertexCount=this.groundEffect.vertexArray.length-Jr.groundVertexArrayOffset,0!==Jr.vertexCount){if(Jr.centroidXY=Hr.borders?k_:this.encodeCentroid(Hr,Jr),this.centroidData.push(Jr),Hr.borders){this.featuresOnBorder.push(Hr);const Le=this.featuresOnBorder.length-1;for(let Re=0;Re<Hr.borders.length;Re++)Hr.borders[Re][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Re].push(Le)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,Le,Oe,qe,Ct,Ue,Jt),this.groundEffect.addPaintPropertiesData(Le,Oe,qe,Ct,Ue,Jt),this.maxHeight=Math.max(this.maxHeight,Nn)}}sortBorders(){for(let Le=0;Le<this.borderFeatureIndices.length;Le++)this.borderFeatureIndices[Le].sort(((Re,Oe)=>this.featuresOnBorder[Re].borders[Le][0]-this.featuresOnBorder[Oe].borders[Le][0]))}splitToSubtiles(){const Le=[];for(let Re=0;Re<this.centroidData.length;Re++){const Oe=this.centroidData[Re],Ue=+(Oe.min.y+Oe.max.y>ud),qe=2*Ue+(+(Oe.min.x+Oe.max.x>ud)^Ue);for(let Ue=0;Ue<Oe.polygonSegLen;Ue++){const Ct=Oe.polygonSegIdx+Ue;Le.push({centroidIdx:Re,subtile:qe,polygonSegmentIdx:Ct,triangleSegmentIdx:this.polygonSegments[Ct].triangleSegIdx})}}const Re=new Da;Le.sort(((Le,Re)=>Le.triangleSegmentIdx===Re.triangleSegmentIdx?Le.subtile-Re.subtile:Le.triangleSegmentIdx-Re.triangleSegmentIdx));let Oe=0,Ue=0,qe=0;for(const Re of Le){if(Re.triangleSegmentIdx!==Oe)break;qe++}const Ct=Le.length;for(;Ue!==Le.length;){Oe=Le[Ue].triangleSegmentIdx;let Ot=0,Jt=Ue,_i=Ue;for(let Re=Jt;Re<qe&&Le[Re].subtile===Ot;Re++)_i++;for(;Jt!==qe;){const Ue=Le[Jt];Ot=Ue.subtile;const Ct=this.centroidData[Ue.centroidIdx].min.clone(),xi=this.centroidData[Ue.centroidIdx].max.clone(),vi={vertexOffset:this.segments.segments[Oe].vertexOffset,primitiveOffset:Re.length,vertexLength:this.segments.segments[Oe].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let Oe=Jt;Oe<_i;Oe++){const Ue=Le[Oe],qe=this.polygonSegments[Ue.polygonSegmentIdx],Ot=this.centroidData[Ue.centroidIdx].min,Jt=this.centroidData[Ue.centroidIdx].max,_i=this.indexArray.uint16;for(let Le=qe.triangleArrayOffset;Le<qe.triangleArrayOffset+qe.triangleCount;Le++)Re.emplaceBack(_i[3*Le],_i[3*Le+1],_i[3*Le+2]);vi.primitiveLength+=qe.triangleCount,Ct.x=Math.min(Ct.x,Ot.x),Ct.y=Math.min(Ct.y,Ot.y),xi.x=Math.max(xi.x,Jt.x),xi.y=Math.max(xi.y,Jt.y)}vi.primitiveLength>0&&this.triangleSubSegments.push({segment:vi,min:Ct,max:xi}),Jt=_i;for(let Re=Jt;Re<qe&&Le[Re].subtile===Le[Jt].subtile;Re++)_i++}Ue=qe;for(let Re=Ue;Re<Ct&&Le[Re].triangleSegmentIdx===Le[Ue].triangleSegmentIdx;Re++)qe++}Re._trim(),this.indexArray=Re}getVisibleSegments(Le,Re,Oe){const Ue=new co;if(this.wallMode){for(const Le of this.triangleSubSegments)Ue.segments.push(Le.segment);return Ue}let qe=0,Ct=0;const Ot=1<<Le.canonical.z;if(Re){const Oe=Re.getMinMaxForTile(Le);Oe&&(qe=Oe.min,Ct=Oe.max)}Ct+=this.maxHeight;const Jt=Le.toUnwrapped();let _i;const xi=[Jt.canonical.x/Ot+Jt.wrap,Jt.canonical.y/Ot],vi=[(Jt.canonical.x+1)/Ot+Jt.wrap,(Jt.canonical.y+1)/Ot],h=(Le,Re,Oe)=>[Le[0]*(1-Oe[0])+Re[0]*Oe[0],Le[1]*(1-Oe[1])+Re[1]*Oe[1]],bi=[],Pi=[];for(const Le of this.triangleSubSegments){bi[0]=Le.min.x/ud,bi[1]=Le.min.y/ud,Pi[0]=Le.max.x/ud,Pi[1]=Le.max.y/ud;const Re=h(xi,vi,bi),Ot=h(xi,vi,Pi);if(0===new yu([Re[0],Re[1],qe],[Ot[0],Ot[1],Ct]).intersectsPrecise(Oe)){_i&&(Ue.segments.push(_i),_i=void 0);continue}const Jt=Le.segment;_i&&_i.vertexOffset!==Jt.vertexOffset&&(Ue.segments.push(_i),_i=void 0),_i?(_i.vertexLength+=Jt.vertexLength,_i.primitiveLength+=Jt.primitiveLength):_i={vertexOffset:Jt.vertexOffset,primitiveLength:Jt.primitiveLength,vertexLength:Jt.vertexLength,primitiveOffset:Jt.primitiveOffset,sortKey:void 0,vaos:{}}}return _i&&Ue.segments.push(_i),Ue}encodeCentroid(Le,Re){const Oe=Le.centroid(),Ue=Re.span(),qe=Math.min(7,Math.round(Ue.x*this.tileToMeter/10)),Ct=Math.min(7,Math.round(Ue.y*this.tileToMeter/10));return new ta(Q(Oe.x,1,ud-1)<<3|qe,Q(Oe.y,1,ud-1)<<3|Ct)}encodeBorderCentroid(Le){if(!Le.borders)return new ta(0,0);const Re=Le.borders,Oe=Number.MAX_VALUE;if(Re[0][0]!==Oe||Re[1][0]!==Oe){const Le=Re[0][0]!==Oe?0:1;return new ta(6|(Re[0][0]!==Oe?0:65528),(Re[Le][0]+Re[Le][1])/2<<3|6)}{const Le=Re[2][0]!==Oe?2:3;return new ta((Re[Le][0]+Re[Le][1])/2<<3|6,6|(Re[2][0]!==Oe?0:65528))}}showCentroid(Le){const Re=this.centroidData[Le.centroidDataIndex];Re.flags&=O_,Re.centroidXY.x=0,Re.centroidXY.y=0,this.writeCentroidToBuffer(Re)}writeCentroidToBuffer(Le){this.groundEffect.updateHiddenByLandmark(Le);const Re=Le.vertexArrayOffset,Oe=Le.vertexCount+Le.vertexArrayOffset,Ue=Le.flags&O_?k_:Le.centroidXY,qe=this.centroidVertexArray.geta_centroid_pos0(Re);if(this.centroidVertexArray.geta_centroid_pos1(Re)!==Ue.y||qe!==Ue.x){for(let Le=Re;Le<Oe;++Le)this.centroidVertexArray.emplace(Le,Ue.x,Ue.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const Le of this.centroidData)this.writeCentroidToBuffer(Le)}updateReplacement(Le,Re,Oe){if(Re.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=Re.updateTime;const Ue=Re.getReplacementRegionsForTile(Le.toUnwrapped());if(wh(this.activeReplacements,Ue))return;if(this.activeReplacements=Ue,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const Le of this.centroidData)Le.flags&=2147483647;const qe=[];for(const Re of this.activeReplacements){if(Re.order<Oe)continue;const Ue=Math.pow(2,Re.footprintTileId.canonical.z-Le.canonical.z);for(const Oe of this.centroidData)if(!(Oe.flags&O_||Re.min.x>Oe.max.x||Oe.min.x>Re.max.x||Re.min.y>Oe.max.y||Oe.min.y>Re.max.y))for(let Ct=0;Ct<Oe.footprintSegLen;Ct++){const Ot=this.footprintSegments[Oe.footprintSegIdx+Ct];if(qe.length=0,ip(this.footprintVertices,Ot.vertexOffset,Ot.vertexCount,Re.footprintTileId.canonical,Le.canonical,qe),Ah(Re.footprint,qe,this.footprintIndices.uint16,Ot.indexOffset,Ot.indexCount,-Ot.vertexOffset,-Ue)){Oe.flags|=O_;break}}}for(const Le of this.centroidData)this.writeCentroidToBuffer(Le);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(Le,Re,Oe){let Ue=!1;for(let qe=0;qe<Oe.footprintSegLen;qe++){const Ct=this.footprintSegments[Oe.footprintSegIdx+qe];let Ot=0;for(const Oe of Ct.ringIndices){for(let qe=Ot,Jt=Oe+Ot-1;qe<Oe+Ot;Jt=qe++){const Oe=this.footprintVertices.int16[2*(qe+Ct.vertexOffset)+0],Ot=this.footprintVertices.int16[2*(qe+Ct.vertexOffset)+1],_i=this.footprintVertices.int16[2*(Jt+Ct.vertexOffset)+1];Ot>Re!=_i>Re&&Le<(this.footprintVertices.int16[2*(Jt+Ct.vertexOffset)+0]-Oe)*(Re-Ot)/(_i-Ot)+Oe&&(Ue=!Ue)}Ot=Oe}}return Ue}getHeightAtTileCoord(Le,Re){let Oe=Number.NEGATIVE_INFINITY,Ue=!0;const qe=4*(Le+ud)*ud+(Re+ud);if(this.partLookup.hasOwnProperty(qe)){const Le=this.partLookup[qe];return Le?{height:Le.height,hidden:!!(Le.flags&O_)}:void 0}for(const Ct of this.centroidData)Le>Ct.max.x||Ct.min.x>Le||Re>Ct.max.y||Ct.min.y>Re||this.footprintContainsPoint(Le,Re,Ct)&&Ct&&Ct.height>Oe&&(Oe=Ct.height,this.partLookup[qe]=Ct,Ue=!!(Ct.flags&O_));if(Oe!==Number.NEGATIVE_INFINITY)return{height:Oe,hidden:Ue};this.partLookup[qe]=void 0}}function Wh(Le,Re){const Oe=Le.add(Re)._unit();return Le.x*Oe.x+Le.y*Oe.y}function Hh(Le,Re,Oe,Ue){const qe=Re.sub(Le)._perp()._unit(),Ct=Oe.sub(Re)._perp()._unit();return Kh(Le,Re,Oe,Wh(qe,Ct),Ue)}function Kh(Le,Re,Oe,Ue,qe){const Ct=Math.sqrt(1-Ue*Ue);return Math.min(Le.dist(Re)/3,Re.dist(Oe)/3,qe*Ct/Ue)}function Jh(Le,Re,Oe){return Le.x<Oe[0].x&&Re.x<Oe[0].x||Le.x>Oe[1].x&&Re.x>Oe[1].x||Le.y<Oe[0].y&&Re.y<Oe[0].y||Le.y>Oe[1].y&&Re.y>Oe[1].y}function Qh(Le,Re){return Le.x<Re[0].x||Le.x>Re[1].x||Le.y<Re[0].y||Le.y>Re[1].y}function tp(Le,Re,Oe){if(Le.x<0||Le.x>=ud||Re.x<0||Re.x>=ud||Oe.x<0||Oe.x>=ud)return!1;const Ue=Oe.sub(Re),qe=Ue.perp(),Ct=Le.sub(Re);return(Ue.x*Ct.x+Ue.y*Ct.y)/Math.sqrt((Ue.x*Ue.x+Ue.y*Ue.y)*(Ct.x*Ct.x+Ct.y*Ct.y))>-.866&&qe.x*Ct.x+qe.y*Ct.y<0}function ep(Le,Re,Oe){const Ue=Re?2|Le:-3&Le;return Oe?1|Ue:-2&Ue}function rp(){const Le=Math.PI/32,Re=Math.tan(Le),Oe=im;return Oe*Math.sqrt(1+2*Re*Re)-Oe}function np(Le,Re,Oe){const Ue=1<<Oe.z,qe=cl(Oe.x/Ue),Ct=cl((Oe.x+1)/Ue),Ot=hl(Oe.y/Ue),Jt=hl((Oe.y+1)/Ue);return function(Le,Re,Oe,Ue,qe=0,Ct){const Ot=[];if(!Le.length||!Oe||!Ue)return Ot;const o=(Le,Re)=>{for(const Oe of Le)Ot.push({polygon:Oe,bounds:Re})},Jt=Math.ceil(Math.log2(Oe)),_i=Math.ceil(Math.log2(Ue)),xi=Jt-_i,vi=[];for(let Le=0;Le<Math.abs(xi);Le++)vi.push(xi>0?0:1);for(let Le=0;Le<Math.min(Jt,_i);Le++)vi.push(0),vi.push(1);let bi=Le;if(bi=fh(bi,Re[0].y-qe,Re[1].y+qe,1),bi=fh(bi,Re[0].x-qe,Re[1].x+qe,0),!bi.length)return Ot;const Pi=[];for(vi.length?Pi.push({polygons:bi,bounds:Re,depth:0}):o(bi,Re);Pi.length;){const Le=Pi.pop(),Re=Le.depth,Oe=vi[Re],Ue=Le.bounds[0],Ot=Le.bounds[1],Jt=0===Oe?Ue.x:Ue.y,_i=0===Oe?Ot.x:Ot.y,xi=Ct?Ct(Oe,Jt,_i):.5*(Jt+_i
vendor: 4,364 bytes, line 1
1),bi=fh(Le.polygons,Jt-qe,xi+qe,Oe),Hr=fh(Le.polygons,xi-qe,_i+qe,Oe);if(bi.length){const Le=[Ue,new ta(0===Oe?xi:Ot.x,1===Oe?xi:Ot.y)];vi.length>Re+1?Pi.push({polygons:bi,bounds:Le,depth:Re+1}):o(bi,Le)}if(Hr.length){const Le=[new ta(0===Oe?xi:Ue.x,1===Oe?xi:Ue.y),Ot];vi.length>Re+1?Pi.push({polygons:Hr,bounds:Le,depth:Re+1}):o(Hr,Le)}}return Ot}(Le,Re,Math.ceil((Ct-qe)/11.25),Math.ceil((Ot-Jt)/11.25),1,((Le,Re,qe)=>{if(0===Le)return.5*(Re+qe);{const Le=hl((Oe.y+Re/ud)/Ue);return(ll(.5*(hl((Oe.y+qe/ud)/Ue)+Le))*Ue-Oe.y)*ud}}))}function ip(Le,Re,Oe,Ue,qe,Ct){const Ot=Math.pow(2,Ue.z-qe.z);for(let Jt=0;Jt<Oe;Jt++){let Oe=Le.int16[2*(Jt+Re)+0],_i=Le.int16[2*(Jt+Re)+1];Oe=(Oe+qe.x*ud)*Ot-Ue.x*ud,_i=(_i+qe.y*ud)*Ot-Ue.y*ud,Ct.push(new ta(Oe,_i))}}let B_,N_;function op(Le,Re){return Le.x*Re.x+Le.y*Re.y}function lp(Le,Re){if(1===Le.length){let Oe=0;const Ue=Re[Oe++];let qe;for(;!qe||Ue.equals(qe);)if(qe=Re[Oe++],!qe)return 1/0;for(;Oe<Re.length;Oe++){const Ct=Re[Oe],Ot=Le[0],Jt=qe.sub(Ue),_i=Ct.sub(Ue),xi=Ot.sub(Ue),vi=op(Jt,Jt),bi=op(Jt,_i),Pi=op(_i,_i),Hr=op(xi,Jt),Jr=op(xi,_i),Ln=vi*Pi-bi*bi,Nn=(Pi*Hr-bi*Jr)/Ln,Gn=(vi*Jr-bi*Hr)/Ln,qn=Ue.z*(1-Nn-Gn)+qe.z*Nn+Ct.z*Gn;if(isFinite(qn))return qn}return 1/0}{let Le=1/0;for(const Oe of Re)Le=Math.min(Le,Oe.z);return Le}}function up(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Ot*qe.getElevationAt(Le,Re,!0,!0),xi=0!==Ct[0],vi=xi?0===Ct[1]?Ot*(Ct[0]/7-450):Ot*function(Le,Re,Oe){const Ue=Math.floor(Re[0]/8),qe=Math.floor(Re[1]/8),Ct=10*(Re[0]-8*Ue),Ot=10*(Re[1]-8*qe),Jt=Le.getElevationAt(Ue,qe,!0,!0),_i=Le.getMeterToDEM(Oe),xi=Math.floor(.5*(Ct*_i-1)),vi=Math.floor(.5*(Ot*_i-1)),bi=Le.tileCoordToPixel(Ue,qe),Pi=2*xi+1,Hr=2*vi+1,Jr=function(Le,Re,Oe,Ue,qe){return[Le.getElevationAtPixel(Re,Oe,!0),Le.getElevationAtPixel(Re+qe,Oe,!0),Le.getElevationAtPixel(Re,Oe+qe,!0),Le.getElevationAtPixel(Re+Ue,Oe+qe,!0)]}(Le,bi.x-xi,bi.y-vi,Pi,Hr),Ln=Math.abs(Jr[0]-Jr[1]),Nn=Math.abs(Jr[2]-Jr[3]),Gn=Math.abs(Jr[0]-Jr[2])+Math.abs(Jr[1]-Jr[3]),qn=Math.min(.25,.5*_i*(Ln+Nn)/Pi),Zn=Math.min(.25,.5*_i*Gn/Hr);return Jt+Math.max(qn*Ct,Zn*Ot)}(qe,Ct,Jt):_i;return{base:_i+(0===Oe)?-1:Oe,top:xi?Math.max(vi+Ue,_i+Oe+2):_i+Ue}}os(Zh,"FillExtrusionBucket",{omit:["layers","features"]}),os(Nh,"PartData"),os(jh,"FootprintSegment"),os(qh,"BorderCentroidData"),os(Yh,"GroundEffect");const V_=ya([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),U_=ya([{name:"a_z_offset",components:1,type:"Float32"}],4),{members:j_}=V_,G_=ya([{name:"a_packed",components:4,type:"Float32"}]),{members:q_}=G_,Z_=ya([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:$_}=Z_;class gp{constructor(Le,Re){this.width=Le,this.height=Re,this.nextRow=0,this.image=new nc({width:Le,height:Re}),this.positions={},this.uploaded=!1}getDash(Le,Re){const Oe=this.getKey(Le,Re);return this.positions[Oe]}trim(){const Le=this.width,Re=this.height=at(this.nextRow);this.image.resize({width:Le,height:Re})}getKey(Le,Re){return Le.join(",")+Re}getDashRanges(Le,Re,Oe){const Ue=[];let qe=Le.length%2==1?-Le[Le.length-1]*Oe:0,Ct=Le[0]*Oe,Ot=!0;Ue.push({left:qe,right:Ct,isDash:Ot,zeroLength:0===Le[0]});let Jt=Le[0];for(let Re=1;Re<Le.length;Re++){Ot=!Ot;const _i=Le[Re];qe=Jt*Oe,Jt+=_i,Ct=Jt*Oe,Ue.push({left:qe,right:Ct,isDash:Ot,zeroLength:0===_i})}return Ue}addRoundDash(Le,Re,Oe){const Ue=Re/2;for(let Re=-Oe;Re<=Oe;Re++){const qe=this.width*(this.nextRow+Oe+Re);let Ct=0,Ot=Le[Ct];for(let Jt=0;Jt<this.width;Jt++){Jt/Ot.right>1&&(Ot=Le[++Ct]);const _i=Math.abs(Jt-Ot.left),xi=Math.abs(Jt-Ot.right),vi=Math.min(_i,xi);let bi;const Pi=Re/Oe*(Ue+1);if(Ot.isDash){const Le=Ue-Math.abs(Pi);bi=Math.sqrt(vi*vi+Le*Le)}else bi=Ue-Math.sqrt(vi*vi+Pi*Pi);this.image.data[qe+Jt]=Math.max(0,Math.min(255,bi+128))}}}addRegularDash(Le,Re){for(let Re=Le.length-1;Re>=0;--Re){const Oe=Le[Re],Ue=Le[Re+1];Oe.zeroLength?Le.splice(Re,1):Ue&&Ue.isDash===Oe.isDash&&(Ue.left=Oe.left,Le.splice(Re,1))}const Oe=Le[0],Ue=Le[Le.length-1];Oe.isDash===Ue.isDash&&(Oe.left=Ue.left-this.width,Ue.right=Oe.right+this.width);const qe=this.width*this.nextRow;let Ct=0,Ot=Le[Ct];for(let Oe=0;Oe<this.width;Oe++){Oe/Ot.right>1&&(Ot=Le[++Ct]);const Ue=Math.abs(Oe-Ot.left),Jt=Math.abs(Oe-Ot.right),_i=Math.min(Ue,Jt);this.image.data[qe+Oe]=Math.max(0,Math.min(255,(Ot.isDash?_i:-_i)+Re+128))}}
1addDash(Le,Re){const Oe=this.getKey(Le,Re);if(this.positions[Oe])return this.positions[Oe];const Ue="round"===Re,qe=Ue?7:0,Ct=2*qe+1;if(this.nextRow+Ct>this.height)return ft("LineAtlas out of space"),null;0===Le.length&&Le.push(1);let Ot=0;for(let Re=0;Re<Le.length;Re++)Le[Re]<0&&(ft("Negative value is found in line dasharray, replacing values with 0"),Le[Re]=0),Ot+=Le[Re];if(0!==Ot){const Oe=this.width/Ot,Ct=this.getDashRanges(Le,this.width,Oe);Ue?this.addRoundDash(Ct,Oe,qe):this.addRegularDash(Ct,"square"===Re?.5*Oe:0)}const Jt=this.nextRow+qe;this.nextRow+=Ct;const _i={tl:[Jt,qe],br:[Ot,0]};return this.positions[Oe]=_i,_i}}os(gp,"LineAtlas");const H_=A_.VectorTileFeature.types,W_=Math.cos(Math.PI/180*37.5),X_=Math.cos(Math.PI/180*5);class wp{constructor(Le){this.zoom=Le.zoom,this.overscaling=Le.overscaling,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.index=Le.index,this.projection=Le.projection,this.hasPattern=!1,this.hasZOffset=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((Le=>{this.gradients[Le.id]={}})),this.layoutVertexArray=new _a,this.layoutVertexArray2=new Ma,this.patternVertexArray=new Aa,this.indexArray=new Da,this.programConfigurations=new Fo(Le.layers,{zoom:Le.zoom,lut:Le.lut}),this.segments=new co,this.maxLineLength=0,this.zOffsetVertexArray=new Oa,this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id)),this.tessellationStep=Le.tessellationStep?Le.tessellationStep:ud/64}updateFootprints(Le,Re){}populate(Le,Re,Oe,Ue){this.hasPattern=Dc("line",this.layers,Re);const qe=this.layers[0].layout.get("line-sort-key"),Ct=this.layers[0].layout.get("line-z-offset");this.hasZOffset=!Ct.isConstant()||!!Ct.constantOr(0);const Ot=[];for(const{feature:Re,id:Ct,index:Jt,sourceLayerIndex:_i}of Le){const Le=this.layers[0]._featureFilter.needGeometry,xi=Pl(Re,Le);if(!this.layers[0]._featureFilter.filter(new Vs(this.zoom),xi,Oe))continue;const vi=qe?qe.evaluate(xi,{},Oe):void 0,bi={id:Ct,properties:Re.properties,type:Re.type,sourceLayerIndex:_i,index:Jt,geometry:Le?xi.geometry:Il(Re,Oe,Ue),patterns:{},sortKey:vi};Ot.push(bi)}qe&&Ot.sort(((Le,Re)=>Le.sortKey-Re.sortKey));const{lineAtlas:Jt,featureIndex:_i}=Re,xi=this.addConstantDashes(Jt);for(const Ue of Ot){const{geometry:qe,index:Ct,sourceLayerIndex:Ot}=Ue;if(xi&&this.addFeatureDashes(Ue,Jt),this.hasPattern){const Le=Lc("line",this.layers,Ue,this.zoom,Re);this.patternFeatures.push(Le)}else this.addFeature(Ue,qe,Ct,Oe,Jt.positions,Re.availableImages,Re.brightness);_i.insert(Le[Ct].feature,qe,Ct,Ot,this.index)}}addConstantDashes(Le){let Re=!1;for(const Oe of this.layers){const Ue=Oe.paint.get("line-dasharray").value,qe=Oe.layout.get("line-cap").value;if("constant"!==Ue.kind||"constant"!==qe.kind)Re=!0;else{const Re=qe.value,Oe=Ue.value;if(!Oe)continue;Le.addDash(Oe,Re)}}return Re}addFeatureDashes(Le,Re){const Oe=this.zoom;for(const Ue of this.layers){const qe=Ue.paint.get("line-dasharray").value,Ct=Ue.layout.get("line-cap").value;if("constant"===qe.kind&&"constant"===Ct.kind)continue;let Ot,Jt;if("constant"===qe.kind){if(Ot=qe.value,!Ot)continue}else Ot=qe.evaluate({zoom:Oe},Le);Jt="constant"===Ct.kind?Ct.value:Ct.evaluate({zoom:Oe},Le),Re.addDash(Ot,Jt),Le.patterns[Ue.id]=Re.getKey(Ot,Jt)}}update(Le,Re,Oe,Ue,qe){const Ct=0!==Object.keys(Le).length;Ct&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(Le,Re,Ct?this.stateDependentLayers:this.layers,Oe,Ue,qe)}addFeatures(Le,Re,Oe,Ue,qe,Ct){for(const Le of this.patternFeatures)this.addFeature(Le,Le.geometry,Le.index,Re,Oe,Ue,Ct)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(Le){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=Le.createVertexBuffer(this.layoutVertexArray2,q_)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=Le.createVertexBuffer(this.patternVertexArray,$_)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=Le.createVertexBuffer(this.zOffsetVertexArray,U_.members,!0)),this.layoutVertexBuffer=Le.createVertexBuffer(this.layoutVertexArray,j_),this.indexBuffer=Le.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(Le),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(Le){if(Le.properties&&Le.properties.hasOwnProperty("mapbox_clip_start")&&Le.properties.hasOwnProperty("mapbox_clip_end"))return{start:+Le.properties.mapbox_clip_start,end:+Le.properties.mapbox_clip_end}}addFeature(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=this.layers[0].layout,_i=Jt.get("line-join").evaluate(Le,{}),xi=Jt.get("line-cap").evaluate(Le,{}),vi=Jt.get("line-miter-limit"),bi=Jt.get("line-round-limit");this.lineClips=this.lineFeatureClips(Le);for(const Oe of Re)this.addLine(Oe,Le,Ue,_i,xi,vi,bi);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,Le,Oe,qe,Ct,Ue,Ot)}addLine(Le,Re,Oe,Ue,qe,Ct,Ot){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
1oFar=0,this.currentVertex=void 0;const Jt={zoom:this.zoom,lineProgress:void 0},_i=this.layers[0].layout,xi="none"===Ue;if(this.patternJoinNone=this.hasPattern&&xi,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Re=0;Re<Le.length-1;Re++)this.totalDistance+=Le[Re].dist(Le[Re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const vi="Polygon"===H_[Re.type];let bi=Le.length;for(;bi>=2&&Le[bi-1].equals(Le[bi-2]);)bi--;let Pi=0;for(;Pi<bi-1&&Le[Pi].equals(Le[Pi+1]);)Pi++;if(bi<(vi?3:2))return;"bevel"===Ue&&(Ct=1.05);const Hr=this.overscaling<=16?15*ud/(512*this.overscaling):0,Jr=this.segments.prepareSegment(10*bi,this.layoutVertexArray,this.indexArray);let Ln,Nn,Gn,qn,Zn,$n;this.e1=this.e2=-1,vi&&(Ln=Le[bi-2],Zn=Le[Pi].sub(Ln)._unit()._perp());for(let Oe=Pi;Oe<bi;Oe++){if(Gn=Oe===bi-1?vi?Le[Pi+1]:void 0:Le[Oe+1],Gn&&Le[Oe].equals(Gn))continue;if(Zn&&(qn=Zn),Ln&&(Nn=Ln),Ln=Le[Oe],this.hasZOffset){const Le=_i.get("line-z-offset").value;if("constant"===Le.kind)$n=Le.value;else{if(this.lineClips){const Le=this.totalDistance/(this.lineClips.end-this.lineClips.start);Jt.lineProgress=(Le*this.lineClips.start+this.distance+(Nn?Nn.dist(Ln):0))/Le}else ft(`line-z-offset evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`),Jt.lineProgress=0;$n=Le.evaluate(Jt,Re)}$n=$n||0}Zn=Gn?Gn.sub(Ln)._unit()._perp():qn,qn=qn||Zn;const Xn=Nn&&Gn;let Yn=Xn?Ue:vi||xi?"butt":qe;const lo=qn.x*Zn.x+qn.y*Zn.y;if(xi){const t=function(Le){if(Le.patternJoinNone){const Re=Le.segmentPoints.length/2,Oe=Le.lineSoFar-Le.segmentStart;for(let Ue=0;Ue<Re;++Ue){const Re=Le.segmentPoints[2*Ue+1],qe=Math.round(Le.segmentPoints[2*Ue])+.5+.25*Re;Le.patternVertexArray.emplaceBack(qe,Oe,Le.segmentStart),Le.patternVertexArray.emplaceBack(qe,Oe,Le.segmentStart)}Le.segmentPoints.length=0}Le.e1=Le.e2=-1};if(Xn&&lo<X_){this.updateDistance(Nn,Ln),this.addCurrentVertex(Ln,qn,1,1,Jr,$n),t(this),this.addCurrentVertex(Ln,Zn,-1,-1,Jr,$n);continue}if(Nn){if(!Gn){this.updateDistance(Nn,Ln),this.addCurrentVertex(Ln,qn,1,1,Jr,$n),t(this);continue}Yn="miter"}}let uo=qn.add(Zn);0===uo.x&&0===uo.y||uo._unit();const po=uo.x*Zn.x+uo.y*Zn.y,fo=0!==po?1/po:1/0,Io=2*Math.sqrt(2-2*po),is=po<W_&&Nn&&Gn,as=qn.x*Zn.y-qn.y*Zn.x>0;if(is&&Oe>Pi){const Le=Ln.dist(Nn);if(Le>2*Hr){const Re=Ln.sub(Ln.sub(Nn)._mult(Hr/Le)._round());this.updateDistance(Nn,Re),this.addCurrentVertex(Re,qn,0,0,Jr,$n),Nn=Re}}if(Xn&&"round"===Yn&&(fo<Ot?Yn="miter":fo<=2&&(Yn="fakeround")),"miter"===Yn&&fo>Ct&&(Yn="bevel"),"bevel"===Yn&&(fo>2&&(Yn="flipbevel"),fo<Ct&&(Yn="miter")),Nn&&this.updateDistance(Nn,Ln),"miter"===Yn)uo._mult(fo),this.addCurrentVertex(Ln,uo,0,0,Jr,$n);else if("flipbevel"===Yn){if(fo>100)uo=Zn.mult(-1);else{const Le=fo*qn.add(Zn).mag()/qn.sub(Zn).mag();uo._perp()._mult(Le*(as?-1:1))}this.addCurrentVertex(Ln,uo,0,0,Jr,$n),this.addCurrentVertex(Ln,uo.mult(-1),0,0,Jr,$n)}else if("bevel"===Yn||"fakeround"===Yn){const Le=-Math.sqrt(fo*fo-1),Re=as?Le:0,Oe=as?0:Le;if(Nn&&this.addCurrentVertex(Ln,qn,Re,Oe,Jr,$n),"fakeround"===Yn){const Le=Math.round(180*Io/Math.PI/20);for(let Re=1;Re<Le;Re++){let Oe=Re/Le;if(.5!==Oe){const Le=Oe-.5;Oe+=Oe*Le*(Oe-1)*((1.0904+lo*(lo*(3.55645-1.43519*lo)-3.2452))*Le*Le+(.848013+lo*(.215638*lo-1.06021)))}const Ue=Zn.sub(qn)._mult(Oe)._add(qn)._unit()._mult(as?-1:1);this.addHalfVertex(Ln,Ue.x,Ue.y,!1,as,0,Jr,$n)}}Gn&&this.addCurrentVertex(Ln,Zn,-Re,-Oe,Jr,$n)}else"butt"===Yn?this.addCurrentVertex(Ln,uo,0,0,Jr,$n):"square"===Yn?(Nn||this.addCurrentVertex(Ln,uo,-1,-1,Jr,$n),this.addCurrentVertex(Ln,uo,0,0,Jr,$n),Nn&&this.addCurrentVertex(Ln,uo,1,1,Jr,$n)):"round"===Yn&&(Nn&&(this.addCurrentVertex(Ln,qn,0,0,Jr,$n),this.addCurrentVertex(Ln,qn,1,1,Jr,$n,!0)),Gn&&(this.addCurrentVertex(Ln,Zn,-1,-1,Jr,$n,!0),this.addCurrentVertex(Ln,Zn,0,0,Jr,$n)));if(is&&Oe<bi-1){const Le=Ln.dist(Gn);if(Le>2*Hr){const Re=Ln.add(Gn.sub(Ln)._mult(Hr/Le)._round());this.updateDistance(Ln,Re),this.addCurrentVertex(Re,Zn,0,0,Jr,$n),Ln=Re}}}}addVerticesTo(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi){const vi=(Re.w-Le.w)/this.tessellationStep|0;if(vi>
11){this.lineSoFar=Le.w;const bi=(Re.x-Le.x)/vi,Pi=(Re.y-Le.y)/vi,Hr=(Re.z-Le.z)/vi,Jr=(Re.w-Le.w)/vi;for(let Re=1;Re<vi;++Re)Le.x+=bi,Le.y+=Pi,Le.z+=Hr,this.lineSoFar+=Jr,this.addHalfVertex(Le,Oe,Ue,xi,!1,Ot,_i,Le.z),this.addHalfVertex(Le,qe,Ct,xi,!0,-Jt,_i,Le.z)}this.lineSoFar=Re.w,this.addHalfVertex(Re,Oe,Ue,xi,!1,Ot,_i,Re.z),this.addHalfVertex(Re,qe,Ct,xi,!0,-Jt,_i,Re.z)}addCurrentVertex(Le,Re,Oe,Ue,qe,Ct,Ot=!1){const Jt=Re.x+Re.y*Oe,_i=Re.y-Re.x*Oe,xi=Re.y*Ue-Re.x,vi=-Re.y-Re.x*Ue;if(null!=Ct){const Re=-10,bi=ud+10,Pi=Ct,Hr=new ph(Le.x,Le.y,Pi,this.lineSoFar),Jr=_p(Le,Re,bi),Ln=this.lineSoFar;if(this.currentVertex)if(Jr){const Ct=this.currentVertexIsOutside,Hr=this.currentVertex,Jr=new ph(Le.x,Le.y,Pi,this.lineSoFar);mh(Hr,Jr,Re,bi),_p(Jr,Re,bi)||(Ct&&(this.e1=this.e2=-1,this.lineSoFar=Hr.w,this.addHalfVertex(Hr,Jt,_i,Ot,!1,Oe,qe,Hr.z),this.addHalfVertex(Hr,xi,vi,Ot,!0,-Ue,qe,Hr.z)),this.addVerticesTo(Hr,Jr,Jt,_i,xi,vi,Oe,Ue,qe,Ot))}else{const Le=this.currentVertex;this.currentVertexIsOutside&&(mh(Le,Hr,Re,bi),this.e1=this.e2=-1,this.lineSoFar=Le.w,this.addHalfVertex(Le,Jt,_i,Ot,!1,Oe,qe,Le.z),this.addHalfVertex(Le,xi,vi,Ot,!0,-Ue,qe,Le.z)),this.addVerticesTo(Le,Hr,Jt,_i,xi,vi,Oe,Ue,qe,Ot)}else Jr||(this.addHalfVertex(Le,Jt,_i,Ot,!1,Oe,qe,Ct),this.addHalfVertex(Le,xi,vi,Ot,!0,-Ue,qe,Ct));this.currentVertex=Hr,this.currentVertexIsOutside=Jr,this.lineSoFar=Ln}else this.addHalfVertex(Le,Jt,_i,Ot,!1,Oe,qe,Ct),this.addHalfVertex(Le,xi,vi,Ot,!0,-Ue,qe,Ct)}addHalfVertex({x:Le,y:Re},Oe,Ue,qe,Ct,Ot,Jt,_i){this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),Ct||this.segmentPoints.push(this.lineSoFar-this.segmentStart,Ot)),this.layoutVertexArray.emplaceBack((Le<<1)+(qe?1:0),(Re<<1)+(Ct?1:0),Math.round(63*Oe)+128,Math.round(63*Ue)+128,1+(0===Ot?0:Ot<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const xi=Jt.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,xi),Jt.primitiveLength++),Ct?this.e2=xi:this.e1=xi,null!=_i&&this.zOffsetVertexArray.emplaceBack(_i)}updateScaledDistance(){if(this.lineClips){const Le=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=Le*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(Le,Re){this.distance+=Le.dist(Re),this.updateScaledDistance()}}function _p(Le,Re,Oe){return Le.x<Re||Le.x>Oe||Le.y<Re||Le.y>Oe}let Y_,J_;function Sp(Le,Re,Oe){return Re*(ud/(Le.tileSize*Math.pow(2,Oe-Le.tileID.overscaledZ)))}function Ip(Le,Re){return 1/Sp(Le,1,Re.tileZoom)}function Pp(Le,Re,Oe,Ue){return Le.translatePosMatrix(Ue||Re.tileID.projMatrix,Re,Oe.paint.get("line-translate"),Oe.paint.get("line-translate-anchor"))}os(wp,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const zp=Le=>{const Re=[];kp(Le)&&Re.push("RENDER_LINE_DASH"),Le.paint.get("line-gradient")&&Re.push("RENDER_LINE_GRADIENT");const Oe=Le.paint.get("line-trim-offset");0===Oe[0]&&0===Oe[1]||Re.push("RENDER_LINE_TRIM_OFFSET"),0!==Le.paint.get("line-border-width").constantOr(1)&&Re.push("RENDER_LINE_BORDER");const Ue="none"===Le.layout.get("line-join").constantOr("miter"),qe=!!Le.paint.get("line-pattern").constantOr(1);return Ue&&qe&&Re.push("LINE_JOIN_NONE"),Re};function kp(Le){const Re=Le.paint.get("line-dasharray").value;return Re.value||"constant"!==Re.kind}let K_;const Ep=()=>K_||(K_={layout:Y_||(Y_=new Gs({"line-cap":new qs(Vp.layout_line["line-cap"]),"line-join":new qs(Vp.layout_line["line-join"]),"line-miter-limit":new Ns(Vp.layout_line["line-miter-limit"]),"line-round-limit":new Ns(Vp.layout_line["line-round-limit"]),"line-sort-key":new qs(Vp.layout_line["line-sort-key"]),"line-z-offset":new qs(Vp.layout_line["line-z-offset"]),visibility:new Ns(Vp.layout_line.visibility)})),paint:J_||(J_=new Gs({"line-opacity":new qs(Vp.paint_line["line-opacity"]),"line-color":new qs(Vp.paint_line["line-color"]),"line-translate":new Ns(Vp.paint_line["line-translate"]),"line-translate-anchor":new Ns(Vp.paint_line["line-translate-anchor"]),"line-width":new qs(Vp.paint_line["line-width"]),"line-gap-width":new qs(Vp.paint_line["line-gap-width"]),"line-offset":new qs(Vp.paint_line["line-offset"]),"line-blur"
vendor: 8,503 bytes, line 1
1:new qs(Vp.paint_line["line-blur"]),"line-dasharray":new qs(Vp.paint_line["line-dasharray"]),"line-pattern":new qs(Vp.paint_line["line-pattern"]),"line-gradient":new $s(Vp.paint_line["line-gradient"]),"line-trim-offset":new Ns(Vp.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ns(Vp.paint_line["line-trim-fade-range"]),"line-trim-color":new Ns(Vp.paint_line["line-trim-color"]),"line-emissive-strength":new Ns(Vp.paint_line["line-emissive-strength"]),"line-border-width":new qs(Vp.paint_line["line-border-width"]),"line-border-color":new qs(Vp.paint_line["line-border-color"]),"line-occlusion-opacity":new Ns(Vp.paint_line["line-occlusion-opacity"])}))},K_);class Bp extends qs{possiblyEvaluate(Le,Re){return Re=new Vs(Math.floor(Re.zoom),{now:Re.now,fadeDuration:Re.fadeDuration,transition:Re.transition}),super.possiblyEvaluate(Le,Re)}evaluate(Le,Re,Oe,Ue){return Re=nt({},Re,{zoom:Math.floor(Re.zoom)}),super.evaluate(Le,Re,Oe,Ue)}}let Q_;function Cp(Le,Re){return Re>0?Re+2*Le:Le}const eg=ya([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),tg=ya([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),rg=ya([{name:"a_projected_pos",components:4,type:"Float32"}],4);ya([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ng=ya([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),og=ya([{name:"a_texb",components:2,type:"Uint16"}]),sg=ya([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),ag=ya([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ya([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const lg=ya([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),dg=ya([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ya([{name:"triangle",components:3,type:"Uint16"}]),ya([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),ya([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),ya([{type:"Float32",name:"offsetX"}]),ya([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var pg=24;const mg=128;function Xp(Le,Re){const{expression:Oe}=Re;if("constant"===Oe.kind)return{kind:"constant",layoutSize:Oe.evaluate(new Vs(Le+1))};if("source"===Oe.kind)return{kind:"source"};{const{zoomStops:Re,interpolationType:Ue}=Oe;let qe=0;for(;qe<Re.length&&Re[qe]<=Le;)qe++;qe=Math.max(0,qe-1);let Ct=qe;for(;Ct<Re.length&&Re[Ct]<Le+1;)Ct++;Ct=Math.min(Re.length-1,Ct);const Ot=Re[qe],Jt=Re[Ct];return"composite"===Oe.kind?{kind:"composite",minZoom:Ot,maxZoom:Jt,interpolationType:Ue}:{kind:"camera",minZoom:Ot,maxZoom:Jt,minSize:Oe.evaluate(new Vs(Ot)),maxSize:Oe.evaluate(new Vs(Jt)),interpolationType:Ue}}}function Yp(Le,{uSize:Re,uSizeT:Oe},{lowerSize:Ue,upperSize:qe}){return"source"===Le.kind?Ue/mg:"composite"===Le.kind?ke(Ue/mg,qe/mg,Oe):Re}function Zp(Le,Re){let Oe=0,Ue=0;if("constant"===Le.kind)Ue=Le.layoutSize;else if("source"!==Le.kind){const{interpolationType:qe,minZoom:Ct,maxZoom:Ot}=Le,Jt=qe?Q(si.interpolationFactor(qe,Re,Ct,Ot),0,1):0;"camera"===Le.kind?Ue=ke(Le.minSize,Le.maxSize,Jt):Oe=Jt}return{uSizeT:Oe,uSize:Ue}}var yg=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:mg,evaluateSizeForFeature:Yp,evaluateSizeForZoom:Zp,getSizeData:Xp});function Hp(Le,Re,Oe){return Le.sections.forEach((Le=>{Le.text=function(Le,Re,Oe){const Ue=Re.layout.get("text-transform").evaluate(Oe,{});return"uppercase"===Ue?Le=Le.toLocaleUpperCase():"lowercase"===Ue&&(Le=Le.toLocaleLowerCase()),Np.applyArabicShaping&&(Le=Np.applyArabicShaping(Le)),Le}(Le.text,Re,Oe)})),Le}const xg={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Jp(Le){return"︶"===Le||"﹈"===Le||"︸"===Le||"﹄"===Le||"﹂"===Le||"︾"===Le||"︼"===Le||"︺"===Le||"︘"===Le||"﹀"===Le||"︐"===Le||"︓"===Le||"︔"===Le||"`"===Le||" ̄"===Le||"︑"===Le||"︒"===Le}function Qp(Le){return"︵"===Le||"﹇"===Le||"︷"===Le||"﹃"===Le||"﹁"===Le||"︽"===Le||"︻"===Le||"︹"===Le||"︗"===Le||"︿"===Le}var vg,bg,wg,Tg={};function sf(){return vg||(vg=1,Tg.read=function(Le,Re,Oe,Ue,qe){var Ct,Ot,Jt=8*qe-Ue-1,_i=(1<<Jt)-1,xi=_i>>1,vi=-7,bi=Oe?qe-1:0,Pi=Oe?-1:1,Hr=Le[Re+bi];for(bi+=Pi,Ct=Hr&(1<<-vi)-1,Hr>>=-vi,vi+=Jt;vi>0;Ct=256*Ct+Le[Re+bi],bi+=Pi,vi-=8);for(Ot=Ct&(1<<-vi)-1,Ct>>=-vi,vi+=Ue;vi>0;Ot=256*Ot+Le[Re+bi],bi+=Pi,vi-=8);if(0===Ct)Ct=1-xi;else{if(Ct===_i)return Ot?NaN:1/0*(Hr?-1:1);Ot+=Math.pow(2,Ue),Ct-=xi}return(Hr?-1:1)*Ot*Math.pow(2,Ct-Ue)},Tg.write=function(Le,Re,Oe,Ue,qe,Ct){var Ot,Jt,_i,xi=8*Ct-qe-1,vi=(1<<xi)-1,bi=vi>>1,Pi=23===qe?Math.pow(2,-24)-Math.pow(2,-77):0,Hr=Ue?0:Ct-1,Jr=Ue?1:-1,Ln=Re<0||0===Re&&1/Re<0?1:0;for(Re=Math.abs(Re),isNaN(Re)||Re===1/0?(Jt=isNaN(Re)?1:0,Ot=vi):(Ot=Math.floor(Math.log(Re)/Math.LN2),Re*(_i=Math.pow(2,-Ot))<1&&(Ot--,_i*=2),(Re+=Ot+bi>=1?Pi/_i:Pi*Math.pow(2,1-bi))*_i>=2&&(Ot++,_i/=2),Ot+bi>=vi?(Jt=0,Ot=vi):Ot+bi>
1=1?(Jt=(Re*_i-1)*Math.pow(2,qe),Ot+=bi):(Jt=Re*Math.pow(2,bi-1)*Math.pow(2,qe),Ot=0));qe>=8;Le[Oe+Hr]=255&Jt,Hr+=Jr,Jt/=256,qe-=8);for(Ot=Ot<<qe|Jt,xi+=qe;xi>0;Le[Oe+Hr]=255&Ot,Hr+=Jr,Ot/=256,xi-=8);Le[Oe+Hr-Jr]|=128*Ln}),Tg}function af(){if(wg)return bg;wg=1,bg=e;var Le=sf();function e(Le){(this||Re).buf=ArrayBuffer.isView&&ArrayBuffer.isView(Le)?Le:new Uint8Array(Le||0),(this||Re).pos=0,(this||Re).type=0,(this||Re).length=(this||Re).buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var Oe=4294967296,Ue=1/Oe,qe="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function s(Le){return Le.type===e.Bytes?Le.readVarint()+Le.pos:Le.pos+1}function a(Le,Re,Oe){return Oe?4294967296*Re+(Le>>>0):4294967296*(Re>>>0)+(Le>>>0)}function o(Le,Re,Oe){var Ue=Re<=16383?1:Re<=2097151?2:Re<=268435455?3:Math.floor(Math.log(Re)/(7*Math.LN2));Oe.realloc(Ue);for(var qe=Oe.pos-1;qe>=Le;qe--)Oe.buf[qe+Ue]=Oe.buf[qe]}function l(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeVarint(Le[Oe])}function u(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeSVarint(Le[Oe])}function c(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeFloat(Le[Oe])}function h(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeDouble(Le[Oe])}function p(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeBoolean(Le[Oe])}function f(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeFixed32(Le[Oe])}function d(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeSFixed32(Le[Oe])}function m(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeFixed64(Le[Oe])}function y(Le,Re){for(var Oe=0;Oe<Le.length;Oe++)Re.writeSFixed64(Le[Oe])}function g(Le,Re){return(Le[Re]|Le[Re+1]<<8|Le[Re+2]<<16)+16777216*Le[Re+3]}function x(Le,Re,Oe){Le[Oe]=Re,Le[Oe+1]=Re>>>8,Le[Oe+2]=Re>>>16,Le[Oe+3]=Re>>>24}function b(Le,Re){return(Le[Re]|Le[Re+1]<<8|Le[Re+2]<<16)+(Le[Re+3]<<24)}return e.prototype={destroy:function(){(this||Re).buf=null},readFields:function(Le,Oe,Ue){for(Ue=Ue||(this||Re).length;(this||Re).pos<Ue;){var qe=this.readVarint(),Ct=qe>>3,Ot=(this||Re).pos;(this||Re).type=7&qe,Le(Ct,Oe,this||Re),(this||Re).pos===Ot&&this.skip(qe)}return Oe},readMessage:function(Le,Oe){return this.readFields(Le,Oe,this.readVarint()+(this||Re).pos)},readFixed32:function(){var Le=g((this||Re).buf,(this||Re).pos);return(this||Re).pos+=4,Le},readSFixed32:function(){var Le=b((this||Re).buf,(this||Re).pos);return(this||Re).pos+=4,Le},readFixed64:function(){var Le=g((this||Re).buf,(this||Re).pos)+g((this||Re).buf,(this||Re).pos+4)*Oe;return(this||Re).pos+=8,Le},readSFixed64:function(){var Le=g((this||Re).buf,(this||Re).pos)+b((this||Re).buf,(this||Re).pos+4)*Oe;return(this||Re).pos+=8,Le},readFloat:function(){var Oe=Le.read((this||Re).buf,(this||Re).pos,!0,23,4);return(this||Re).pos+=4,Oe},readDouble:function(){var Oe=Le.read((this||Re).buf,(this||Re).pos,!0,52,8);return(this||Re).pos+=8,Oe},readVarint:function(Le){var Oe,Ue,qe=(this||Re).buf;return Oe=127&(Ue=qe[(this||Re).pos++]),Ue<128?Oe:(Oe|=(127&(Ue=qe[(this||Re).pos++]))<<7,Ue<128?Oe:(Oe|=(127&(Ue=qe[(this||Re).pos++]))<<14,Ue<128?Oe:(Oe|=(127&(Ue=qe[(this||Re).pos++]))<<21,Ue<128?Oe:function(Le,Re,Oe){var Ue,qe,Ct=Oe.buf;if(Ue=(112&(qe=Ct[Oe.pos++]))>>4,qe<128)return a(Le,Ue,Re);if(Ue|=(127&(qe=Ct[Oe.pos++]))<<3,qe<128)return a(Le,Ue,Re);if(Ue|=(127&(qe=Ct[Oe.pos++]))<<10,qe<128)return a(Le,Ue,Re);if(Ue|=(127&(qe=Ct[Oe.pos++]))<<17,qe<128)return a(Le,Ue,Re);if(Ue|=(127&(qe=Ct[Oe.pos++]))<<24,qe<128)return a(Le,Ue,Re);if(Ue|=(1&(qe=Ct[Oe.pos++]))<<31,qe<128)return a(Le,Ue,Re);throw new Error("Expected varint not more than 10 bytes")}(Oe|=(15&(Ue=qe[(this||Re).pos]))<<28,Le,this||Re))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var Le=this.readVarint();return Le%2==1?(Le+1)/-2:Le/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var Le=this.readVarint()+(this||Re).pos,Oe=(this||Re).pos;return(this||Re).pos=Le,Le-Oe>=12&&qe?function(Le,Re,Oe){return qe.decode(Le.subarray(Re,Oe))}((this||Re).buf,Oe,Le):function(Le,Re,Oe){for(var Ue="",qe=Re;qe<Oe;){var Ct,Ot,Jt,_i=Le[qe],xi=null,vi=_i>239?4:_i>223?3:_i>191?2:1;if(qe+vi>Oe)break;1===vi?_i<128&&(xi=_i):2===vi?128==(192&(Ct=Le[qe+1]))&&(xi=(31&_i)<<6|63&Ct)<=127&&(xi=null):3===vi?(Ot=Le[qe+2],128==(192&(Ct=Le[qe+1]))&&128==(192&Ot)&&((xi=(15&_i)<<12|(63&Ct)<<6|63&Ot)<=2047||xi>
1=55296&&xi<=57343)&&(xi=null)):4===vi&&(Ot=Le[qe+2],Jt=Le[qe+3],128==(192&(Ct=Le[qe+1]))&&128==(192&Ot)&&128==(192&Jt)&&((xi=(15&_i)<<18|(63&Ct)<<12|(63&Ot)<<6|63&Jt)<=65535||xi>=1114112)&&(xi=null)),null===xi?(xi=65533,vi=1):xi>65535&&(xi-=65536,Ue+=String.fromCharCode(xi>>>10&1023|55296),xi=56320|1023&xi),Ue+=String.fromCharCode(xi),qe+=vi}return Ue}((this||Re).buf,Oe,Le)},readBytes:function(){var Le=this.readVarint()+(this||Re).pos,Oe=(this||Re).buf.subarray((this||Re).pos,Le);return(this||Re).pos=Le,Oe},readPackedVarint:function(Le,Oe){if((this||Re).type!==e.Bytes)return Le.push(this.readVarint(Oe));var Ue=s(this||Re);for(Le=Le||[];(this||Re).pos<Ue;)Le.push(this.readVarint(Oe));return Le},readPackedSVarint:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readSVarint());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readSVarint());return Le},readPackedBoolean:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readBoolean());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readBoolean());return Le},readPackedFloat:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readFloat());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readFloat());return Le},readPackedDouble:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readDouble());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readDouble());return Le},readPackedFixed32:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readFixed32());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readFixed32());return Le},readPackedSFixed32:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readSFixed32());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readSFixed32());return Le},readPackedFixed64:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readFixed64());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readFixed64());return Le},readPackedSFixed64:function(Le){if((this||Re).type!==e.Bytes)return Le.push(this.readSFixed64());var Oe=s(this||Re);for(Le=Le||[];(this||Re).pos<Oe;)Le.push(this.readSFixed64());return Le},skip:function(Le){var Oe=7&Le;if(Oe===e.Varint)for(;(this||Re).buf[(this||Re).pos++]>127;);else if(Oe===e.Bytes)(this||Re).pos=this.readVarint()+(this||Re).pos;else if(Oe===e.Fixed32)(this||Re).pos+=4;else{if(Oe!==e.Fixed64)throw new Error("Unimplemented type: "+Oe);(this||Re).pos+=8}},writeTag:function(Le,Re){this.writeVarint(Le<<3|Re)},realloc:function(Le){for(var Oe=(this||Re).length||16;Oe<(this||Re).pos+Le;)Oe*=2;if(Oe!==(this||Re).length){var Ue=new Uint8Array(Oe);Ue.set((this||Re).buf),(this||Re).buf=Ue,(this||Re).length=Oe}},finish:function(){return(this||Re).length=(this||Re).pos,(this||Re).pos=0,(this||Re).buf.subarray(0,(this||Re).length)},writeFixed32:function(Le){this.realloc(4),x((this||Re).buf,Le,(this||Re).pos),(this||Re).pos+=4},writeSFixed32:function(Le){this.realloc(4),x((this||Re).buf,Le,(this||Re).pos),(this||Re).pos+=4},writeFixed64:function(Le){this.realloc(8),x((this||Re).buf,-1&Le,(this||Re).pos),x((this||Re).buf,Math.floor(Le*Ue),(this||Re).pos+4),(this||Re).pos+=8},writeSFixed64:function(Le){this.realloc(8),x((this||Re).buf,-1&Le,(this||Re).pos),x((this||Re).buf,Math.floor(Le*Ue),(this||Re).pos+4),(this||Re).pos+=8},writeVarint:function(Le){(Le=+Le||0)>268435455||Le<0?function(Le,Re){var Oe,Ue;if(Le>=0?(Oe=Le%4294967296|0,Ue=Le/4294967296|0):(Ue=~(-Le/4294967296),4294967295^(Oe=~(-Le%4294967296))?Oe=Oe+1|0:(Oe=0,Ue=Ue+1|0)),Le>=0x10000000000000000||Le<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");Re.realloc(10),function(Le,Re,Oe){Oe.buf[Oe.pos++]=127&Le|128,Le>>>=7,Oe.buf[Oe.pos++]=127&Le|128,Le>>>=7,Oe.buf[Oe.pos++]=127&Le|128,Le>>>=7,Oe.buf[Oe.pos++]=127&Le|128,Oe.buf[Oe.pos]=127&(Le>>>=7)}(Oe,0,Re),function(Le,Re){var Oe=(7&Le)<<4;Re.buf[Re.pos++]|=Oe|((Le>>>=3)?128:0),Le&&(Re.buf[Re.pos++]=127&Le|((Le>>>=7)?128:0),Le&&(Re.buf[Re.pos++]=127&Le|((Le>>>=7)?128:0),Le&&(Re.buf[Re.pos++]=127&Le|((Le>>>=7)?128:0),Le&&(Re.buf[Re.pos++]=127&Le|((Le>>>=7)?128:0),Le&&(Re.buf[Re.pos++]=127&Le)))))}(Ue,Re)}(Le,this||Re):(this.realloc(4),(this||Re).buf[(this||Re).pos++]=127&Le|(Le>127?128:0),Le<=127||((this||Re).buf[(this||Re).pos++]=127&(Le>>>=7)|(Le>127?128:0),Le<=127||((this||Re).buf[(this||Re).pos++]=127&(Le>>>=7)|(Le>127?128:0),Le<=127||((this||Re).buf[(this||Re).pos++]=Le>>>7&127))))},writeSVarint:function(Le){this.writeVarint(Le<0?2*-Le-1:2*Le)},writeBoolean:function(Le){this.writeVarint(Boolean(Le))},writeString:function(Le){Le=String(Le),this.realloc(4*Le.length),(this||Re).pos++;var Oe=(this||Re).pos;(this||Re).pos=function(Le,Re,Oe){for(var Ue,qe,Ct=0;
1Ct<Re.length;Ct++){if((Ue=Re.charCodeAt(Ct))>55295&&Ue<57344){if(!qe){Ue>56319||Ct+1===Re.length?(Le[Oe++]=239,Le[Oe++]=191,Le[Oe++]=189):qe=Ue;continue}if(Ue<56320){Le[Oe++]=239,Le[Oe++]=191,Le[Oe++]=189,qe=Ue;continue}Ue=qe-55296<<10|Ue-56320|65536,qe=null}else qe&&(Le[Oe++]=239,Le[Oe++]=191,Le[Oe++]=189,qe=null);Ue<128?Le[Oe++]=Ue:(Ue<2048?Le[Oe++]=Ue>>6|192:(Ue<65536?Le[Oe++]=Ue>>12|224:(Le[Oe++]=Ue>>18|240,Le[Oe++]=Ue>>12&63|128),Le[Oe++]=Ue>>6&63|128),Le[Oe++]=63&Ue|128)}return Oe}((this||Re).buf,Le,(this||Re).pos);var Ue=(this||Re).pos-Oe;Ue>=128&&o(Oe,Ue,this||Re),(this||Re).pos=Oe-1,this.writeVarint(Ue),(this||Re).pos+=Ue},writeFloat:function(Oe){this.realloc(4),Le.write((this||Re).buf,Oe,(this||Re).pos,!0,23,4),(this||Re).pos+=4},writeDouble:function(Oe){this.realloc(8),Le.write((this||Re).buf,Oe,(this||Re).pos,!0,52,8),(this||Re).pos+=8},writeBytes:function(Le){var Oe=Le.length;this.writeVarint(Oe),this.realloc(Oe);for(var Ue=0;Ue<Oe;Ue++)(this||Re).buf[(this||Re).pos++]=Le[Ue]},writeRawMessage:function(Le,Oe){(this||Re).pos++;var Ue=(this||Re).pos;Le(Oe,this||Re);var qe=(this||Re).pos-Ue;qe>=128&&o(Ue,qe,this||Re),(this||Re).pos=Ue-1,this.writeVarint(qe),(this||Re).pos+=qe},writeMessage:function(Le,Re,Oe){this.writeTag(Le,e.Bytes),this.writeRawMessage(Re,Oe)},writePackedVarint:function(Le,Re){Re.length&&this.writeMessage(Le,l,Re)},writePackedSVarint:function(Le,Re){Re.length&&this.writeMessage(Le,u,Re)},writePackedBoolean:function(Le,Re){Re.length&&this.writeMessage(Le,p,Re)},writePackedFloat:function(Le,Re){Re.length&&this.writeMessage(Le,c,Re)},writePackedDouble:function(Le,Re){Re.length&&this.writeMessage(Le,h,Re)},writePackedFixed32:function(Le,Re){Re.length&&this.writeMessage(Le,f,Re)},writePackedSFixed32:function(Le,Re){Re.length&&this.writeMessage(Le,d,Re)},writePackedFixed64:function(Le,Re){Re.length&&this.writeMessage(Le,m,Re)},writePackedSFixed64:function(Le,Re){Re.length&&this.writeMessage(Le,y,Re)},writeBytesField:function(Le,Re){this.writeTag(Le,e.Bytes),this.writeBytes(Re)},writeFixed32Field:function(Le,Re){this.writeTag(Le,e.Fixed32),this.writeFixed32(Re)},writeSFixed32Field:function(Le,Re){this.writeTag(Le,e.Fixed32),this.writeSFixed32(Re)},writeFixed64Field:function(Le,Re){this.writeTag(Le,e.Fixed64),this.writeFixed64(Re)},writeSFixed64Field:function(Le,Re){this.writeTag(Le,e.Fixed64),this.writeSFixed64(Re)},writeVarintField:function(Le,Re){this.writeTag(Le,e.Varint),this.writeVarint(Re)},writeSVarintField:function(Le,Re){this.writeTag(Le,e.Varint),this.writeSVarint(Re)},writeStringField:function(Le,Re){this.writeTag(Le,e.Bytes),this.writeString(Re)},writeFloatField:function(Le,Re){this.writeTag(Le,e.Fixed32),this.writeFloat(Re)},writeDoubleField:function(Le,Re){this.writeTag(Le,e.Fixed64),this.writeDouble(Re)},writeBooleanField:function(Le,Re){this.writeVarintField(Le,Boolean(Re))}},bg}var Sg=e(af());const Eg=3;function uf(Le,Re,Oe){Re.glyphs=[],1===Le&&Oe.readMessage(cf,Re)}function cf(Le,Re,Oe){if(3===Le){const{id:Le,bitmap:Ue,width:qe,height:Ct,left:Ot,top:Jt,advance:_i}=Oe.readMessage(hf,{});Re.glyphs.push({id:Le,bitmap:new nc({width:qe+2*Eg,height:Ct+2*Eg},Ue),metrics:{width:qe,height:Ct,left:Ot,top:Jt,advance:_i}})}else 4===Le?Re.ascender=Oe.readSVarint():5===Le&&(Re.descender=Oe.readSVarint())}function hf(Le,Re,Oe){1===Le?Re.id=Oe.readVarint():2===Le?Re.bitmap=Oe.readBytes():3===Le?Re.width=Oe.readVarint():4===Le?Re.height=Oe.readVarint():5===Le?Re.left=Oe.readSVarint():6===Le?Re.top=Oe.readSVarint():7===Le&&(Re.advance=Oe.readVarint())}const Ig=Eg,Cg={horizontal:1,vertical:2,horizontalOnly:3};class df{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(Le,Re){const Oe=new df;return Oe.scale=Le||1,Oe.fontStack=Re,Oe}static forImage(Le){const Re=new df;return Re.imageName=Le,Re}}class mf{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(Le,Re){const Oe=new mf;for(let Ue=0;Ue<Le.sections.length;Ue++){const qe=Le.sections[Ue];qe.image?Oe.addImageSection(qe):Oe.addTextSection(qe,Re)}return Oe}length(){return this.text.length}getSection(Le){return this.sections[this.sectionIndex[Le]]}getSections(){return this.sections}getSectionIndex(Le){return this.sectionIndex[Le]}getCodePoint(Le){return this.text.codePointAt(Le)}verticalizePunctuation(Le){this.text=function(Le,Re){let Oe="";for(let Ue=0;Ue<Le.length;Ue++){const qe=Le.charCodeAt(Ue+1)||null,Ct=Le.charCodeAt(Ue-1)||null;Oe+=!Re&&(qe&&gs(qe)&&!xg[Le[Ue+1]]||Ct&&gs(Ct)&&!xg[Le[Ue-1]])||!xg[Le[Ue]]?Le[Ue]:xg[Le[Ue]]}return Oe}(this.text,Le)}trim(){let Le=0;for(let Re=0;Re<this.text.length&&zg[this.text.charCodeAt(Re)];Re++)Le++;let Re=this.text.length;for(let Oe=this.text.length-1;Oe>=0&&Oe>=Le&&zg[this.text.charCodeAt(Oe)];
vendor: 9,271 bytes, line 1
1Oe--)Re--;this.text=this.text.substring(Le,Re),this.sectionIndex=this.sectionIndex.slice(Le,Re)}substring(Le,Re){const Oe=new mf;return Oe.text=this.text.substring(Le,Re),Oe.sectionIndex=this.sectionIndex.slice(Le,Re),Oe.sections=this.sections,Oe}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((Le,Re)=>Math.max(Le,this.sections[Re].scale)),0)}addTextSection(Le,Re){this.text+=Le.text,this.sections.push(df.forText(Le.scale,Le.fontStack||Re));const Oe=this.sections.length-1;for(let Re=0;Re<Le.text.length;++Re)this.sectionIndex.push(Oe)}addImageSection(Le){const Re=Le.image?Le.image.namePrimary:"";if(0===Re.length)return void ft("Can't add FormattedSection with an empty image.");const Oe=this.getNextImageSectionCharCode();Oe?(this.text+=String.fromCodePoint(Oe),this.sections.push(df.forImage(Re)),this.sectionIndex.push(this.sections.length-1)):ft("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function yf(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr){const Ln=mf.fromFeature(Le,qe);bi===Cg.vertical&&Ln.verticalizePunctuation(Pi);let Nn=[];const Gn=function(Le,Re,Oe,Ue,qe,Ct){if(!Le)return[];const Ot=[],Jt=function(Le,Re,Oe,Ue,qe,Ct){let Ot=0;for(let Oe=0;Oe<Le.length();Oe++){const Jt=Le.getSection(Oe);Ot+=bf(Le.getCodePoint(Oe),Jt,Ue,qe,Re,Ct)}return Ot/Math.max(1,Math.ceil(Ot/Oe))}(Le,Re,Oe,Ue,qe,Ct),_i=Le.text.indexOf("​")>=0;let xi=0;for(let Oe=0;Oe<Le.length();Oe++){const bi=Le.getSection(Oe),Pi=Le.getCodePoint(Oe);if(zg[Pi]||(xi+=bf(Pi,bi,Ue,qe,Re,Ct)),Oe<Le.length()-1){const Re=!((vi=Pi)<11904||!(Tp["Bopomofo Extended"](vi)||Tp.Bopomofo(vi)||Tp["CJK Compatibility Forms"](vi)||Tp["CJK Compatibility Ideographs"](vi)||Tp["CJK Compatibility"](vi)||Tp["CJK Radicals Supplement"](vi)||Tp["CJK Strokes"](vi)||Tp["CJK Symbols and Punctuation"](vi)||Tp["CJK Unified Ideographs Extension A"](vi)||Tp["CJK Unified Ideographs"](vi)||Tp["Enclosed CJK Letters and Months"](vi)||Tp["Halfwidth and Fullwidth Forms"](vi)||Tp.Hiragana(vi)||Tp["Ideographic Description Characters"](vi)||Tp["Kangxi Radicals"](vi)||Tp["Katakana Phonetic Extensions"](vi)||Tp.Katakana(vi)||Tp["Vertical Forms"](vi)||Tp["Yi Radicals"](vi)||Tp["Yi Syllables"](vi)));(Rg[Pi]||Re||bi.imageName)&&Ot.push(_f(Oe+1,xi,Jt,Ot,wf(Pi,Le.getCodePoint(Oe+1),Re&&_i),!1))}}var vi;return Mf(_f(Le.length(),xi,Jt,Ot,0,!0))}(Ln,xi,Ct,Re,Ue,Hr),{processBidirectionalText:qn,processStyledBidirectionalText:Zn}=Np;if(qn&&1===Ln.sections.length){const Le=qn(Ln.toString(),Gn);for(const Re of Le){const Le=new mf;Le.text=Re,Le.sections=Ln.sections;for(let Oe=0;Oe<Re.length;Oe++)Le.sectionIndex.push(0);Nn.push(Le)}}else if(Zn){const Le=Zn(Ln.text,Ln.sectionIndex,Gn);for(const Re of Le){const Le=new mf;Le.text=Re[0],Le.sectionIndex=Re[1],Le.sections=Ln.sections,Nn.push(Le)}}else Nn=function(Le,Re){const Oe=[],Ue=Le.text;let qe=0;for(const Ue of Re)Oe.push(Le.substring(qe,Ue)),qe=Ue;return qe<Ue.length&&Oe.push(Le.substring(qe,Ue.length)),Oe}(Ln,Gn);const $n=[],Xn={positionedLines:$n,text:Ln.toString(),top:vi[1],bottom:vi[1],left:vi[0],right:vi[0],writingMode:bi,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi){let Pi=0,Hr=0,Jr=0;const Ln="right"===Jt?1:"left"===Jt?0:.5;let Nn=!1;for(const Le of qe){const Oe=Le.getSections();for(const Le of Oe){if(Le.imageName)continue;const Oe=Re[Le.fontStack];if(Oe&&(Nn=void 0!==Oe.ascender&&void 0!==Oe.descender,!Nn))break}if(!Nn)break}let Gn=0;for(const Ot of qe){Ot.trim();const qe=Ot.getMaxScale(),Jt=(qe-1)*pg,Zn={positionedGlyphs:[],lineOffset:0};Le.positionedLines[Gn]=Zn;const $n=Zn.positionedGlyphs;let Xn=0;if(!Ot.length()){Hr+=Ct,++Gn;continue}let Yn=0,lo=0;for(let Ct=0;Ct<Ot.length();Ct++){const Jt=Ot.getSection(Ct),Jr=Ot.getSectionIndex(Ct),Ln=Ot.getCodePoint(Ct);let Gn=Jt.scale,Zn=null,uo=null,po=null,fo=pg,Io=0;const is=!(_i===Cg.horizontal||!vi&&!ys(Ln)||vi&&(zg[Ln]||(qn=Ln,Tp.Arabic(qn)||Tp["Arabic Supplement"](qn)||Tp["Arabic Extended-A"](qn)||Tp["Arabic Presentation Forms-A"](qn)||Tp["Arabic Presentation Forms-B"](qn))));if(Jt.imageName){const Re=Ue[Jt.imageName];if(!Re)continue;po=Jt.imageName,Le.iconsInText=Le.iconsInText||!0,uo=Re.paddedRect;const Oe=Re.displaySize;Gn=Gn*pg/bi,Zn={width:Oe[0],height:Oe[1],left:0,top:-Ig,advance:is?Oe[1]:Oe[0],localGlyph:!1},Io=Nn?-Zn.height*Gn:qe*pg-17-Oe[1]*Gn,fo=Zn.advance;const Ct=(is?Oe[0]:Oe[1])*Gn-pg*qe;Ct>0&&Ct>Xn&&(Xn=Ct)}else{const Le=Oe[Jt.fontStack];if(!Le)continue;Le[Ln]&&(uo=Le[Ln]);const Ue=Re[Jt.fontStack];if(!Ue)continue;const Ct=Ue.glyphs[Ln];if(!Ct)continue;if(Zn=Ct.metrics,fo=8203!==Ln?pg:0,Nn){const Le=void 0!==Ue.ascender?Math.abs(Ue.ascender):0,Re=void 0!==Ue.descender?Math.abs(Ue.descender):0,Oe=(Le+Re)*Gn;Yn<Oe&&(Yn=Oe,lo=(Le-Re)/2*Gn),Io=-Le*Gn}else Io=(qe-Gn)*pg-17}is?(Le.verticalizable=!0,$n.push({glyph:Ln,imageName:po,x:Pi,y:Hr+Io,vertical:is,scale:Gn,localGlyph:Zn.localGlyph,fontStack:Jt.fontStack,sectionIndex:Jr,metrics:Zn,rect:uo}),Pi+=fo*Gn+xi):($n.push({glyph:Ln,imageName:po,x:Pi,y:Hr+Io,vertical:is,scale:Gn,localGlyph:Zn.localGlyph,fontStack:Jt.fontStack,sectionIndex:Jr,metrics:Zn,rect:uo}),Pi+=Zn.advance*Gn+xi)}0!==$n.length&&(Jr=Math.max(Pi-xi,Jr),Nn?Sf($n,Ln,Xn,lo,Ct*qe/2):Sf($n,Ln,Xn,0,Ct/2)),Pi=0;const uo=Ct*qe+Xn;Zn.lineOffset=Math.max(Xn,Jt),Hr+=uo,++Gn}var qn;const Zn=Hr,{horizontalAlign:$n,verticalAlign:Xn}=Af(Ot);(function(Le,Re,Oe,Ue,qe,Ct){const Ot=(Re-Oe)*qe,Jt=-Ct*Ue;for(const Re of Le)for(const Le of Re.positionedGlyphs)Le.x+=Ot,Le.y+=Jt})(Le.positionedLines,Ln,$n,Xn,Jr,Zn),Le.top+=-Xn*Zn,Le.bottom=Le.top+Zn,Le.left+=-$n*Jr,Le.right=Le.left+Jr,Le.hasBaseline=Nn}(Xn,Re,Oe,Ue,Nn,Ot,Jt,_i,bi,xi,Pi,Jr),!function(Le){for(const Re of Le)if(0!==Re.positionedGlyphs.length)return!1;return!0}($n)&&Xn}const zg={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Rg={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function bf(Le,Re,Oe,Ue,qe,Ct){if(Re.imageName){const Le=Ue[Re.imageName];return Le?Le.displaySize[0]*Re.scale*pg/Ct+qe:0}{const Ue=Oe[Re.fontStack],Ct=Ue&&Ue.glyphs[Le];return Ct?Ct.metrics.advance*Re.scale+qe:0}}function vf(Le,Re,Oe,Ue){const qe=Math.pow(Le-Re,2);return Ue?Le<Re?qe/2:2*qe:qe+Math.abs(Oe)*Oe}function wf(Le,Re,Oe){let Ue=0;return 10===Le&&(Ue-=1e4),Oe&&(Ue+=150),40!==Le&&65288!==Le||(Ue+=50),41!==Re&&65289!==Re||(Ue+=50),Ue}function _f(Le,Re,Oe,Ue,qe,Ct){let Ot=null,Jt=vf(Re,Oe,qe,Ct);for(const Le of Ue){const Ue=vf(Re-Le.x,Oe,qe,Ct)+Le.badness;Ue<=Jt&&(Ot=Le,Jt=Ue)}return{index:Le,x:Re,priorBreak:Ot,badness:Jt}}function Mf(Le){return Le?Mf(Le.priorBreak).concat(Le.index):[]}function Af(Le){let Re=.5,Oe=.5;switch(Le){case"right":case"top-right":case"bottom-right":Re=1;break;case"left":case"top-left":case"bottom-left":Re=0}switch(Le){case"bottom":case"bottom-right":case"bottom-left":Oe=1;break;case"top":case"top-right":case"top-left":Oe=0}return{horizontalAlign:Re,verticalAlign:Oe}}function Sf(Le,Re,Oe,Ue,qe){if(!(Re||Oe||Ue||qe))return;const Ct=Le.length-1,Ot=Le[Ct],Jt=(Ot.x+Ot.metrics.advance*Ot.scale)*Re;for(let Re=0;Re<=Ct;Re++)Le[Re].x-=Jt,Le[Re].y+=Oe+Ue+qe}function If(Le,Re,Oe,Ue){const{horizontalAlign:qe,verticalAlign:Ct}=Af(Ue),Ot=Oe[0]-Le.displaySize[0]*qe,Jt=Oe[1]-Le.displaySize[1]*Ct;return{imagePrimary:Le,imageSecondary:Re,top:Jt,bottom:Jt+Le.displaySize[1],left:Ot,right:Ot+Le.displaySize[0]}}function Pf(Le,Re,Oe,Ue,qe,Ct){const Ot=Le.imagePrimary;let Jt;if(Ot.content){const Le=Ot.content,Re=Ot.pixelRatio||1;Jt=[Le[0]/Re,Le[1]/Re,Ot.displaySize[0]-Le[2]/Re,Ot.displaySize[1]-Le[3]/Re]}const _i=Re.left*Ct,xi=Re.right*Ct;let vi,bi,Pi,Hr;"width"===Oe||"both"===Oe?(Hr=qe[0]+_i-Ue[3],bi=qe[0]+xi+Ue[1]):(Hr=qe[0]+(_i+xi-Ot.displaySize[0])/2,bi=Hr+Ot.displaySize[0]);const Jr=Re.top*Ct,Ln=Re.bottom*Ct;return"height"===Oe||"both"===Oe?(vi=qe[1]+Jr-Ue[0],Pi=qe[1]+Ln+Ue[2]):(vi=qe[1]+(Jr+Ln-Ot.displaySize[1])/2,Pi=vi+Ot.displaySize[1]),{imagePrimary:Ot,imageSecondary:void 0,top:vi,right:bi,bottom:Pi,left:Hr,collisionPadding:Jt}}class zf extends ta{constructor(Le,Re,Oe,Ue,qe){super(Le,Re),this.angle=Ue,this.z=Oe,void 0!==qe&&(this.segment=qe)}clone(){return new zf(this.x,this.y,this.z,this.angle,this.segment)}}function kf(Le,Re,Oe,Ue,qe){if(void 0===Re.segment)return!0;let Ct=Re,Ot=Re.segment+1,Jt=0;for(;Jt>-Oe/2;){if(Ot--,Ot<0)return!1;Jt-=Le[Ot].dist(Ct),Ct=Le[Ot]}Jt+=Le[Ot].dist(Le[Ot+1]),Ot++;const _i=[];let xi=0;for(;Jt<Oe/2;){const Re=Le[Ot],Oe=Le[Ot+1];if(!Oe)return!1;let Ct=Le[Ot-1].angleTo(Re)-Re.angleTo(Oe);for(Ct=Math.abs((Ct+3*Math.PI)%(2*Math.PI)-Math.PI),_i.push({distance:Jt,angleDelta:Ct}),xi+=Ct;Jt-_i[0].distance>Ue;)xi-=_i.shift().angleDelta;if(xi>qe)return!1;Ot++,Jt+=Re.dist(Oe)}return!0}function Tf(Le){let Re=0;for(let Oe=0;Oe<Le.length-1;Oe++)Re+=Le[Oe].dist(Le[Oe+1]);return Re}function Ef(Le,Re,Oe){return Le?.6*Re*Oe:0}function Bf(Le,Re){return Math.max(Le?Le.right-Le.left:0,Re?Re.right-Re.left:0)}function Vf(Le,Re,Oe,Ue,qe,Ct){const Ot=Ef(Oe,qe,Ct),Jt=Bf(Oe,Ue)*Ct;let _i=0;const xi=Tf(Le)/2;for(let Oe=0;Oe<Le.length-1;Oe++){const Ue=Le[Oe],qe=Le[Oe+1],Ct=Ue.dist(qe);if(_i+Ct>xi){const vi=(xi-_i)/Ct,bi=ke(Ue.x,qe.x,vi),Pi=ke(Ue.y,qe.y,vi),Hr=ne
1w zf(bi,Pi,0,qe.angleTo(Ue),Oe);return!Ot||kf(Le,Hr,Jt,Ot,Re)?Hr:void 0}_i+=Ct}}function Cf(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=Ef(Ue,Ct,Ot),vi=Bf(Ue,qe),bi=vi*Ot,Pi=0===Le[0].x||Le[0].x===_i||0===Le[0].y||Le[0].y===_i;return Re-bi<Re/4&&(Re=bi+Re/4),Rf(Le,Pi?Re/2*Jt%Re:(vi/2+2*Ct)*Ot*Jt%Re,Re,xi,Oe,bi,Pi,!1,_i)}function Rf(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=Ct/2,vi=Tf(Le);let bi=0,Pi=Re-Oe,Hr=[];for(let Re=0;Re<Le.length-1;Re++){const Ot=Le[Re],Jt=Le[Re+1],Jr=Ot.dist(Jt),Ln=Jt.angleTo(Ot);for(;Pi+Oe<bi+Jr;){Pi+=Oe;const Nn=(Pi-bi)/Jr,Gn=ke(Ot.x,Jt.x,Nn),qn=ke(Ot.y,Jt.y,Nn);if(Gn>=0&&Gn<_i&&qn>=0&&qn<_i&&Pi-xi>=0&&Pi+xi<=vi){const Oe=new zf(Gn,qn,0,Ln,Re);Ue&&!kf(Le,Oe,Ct,Ue,qe)||Hr.push(Oe)}}bi+=Jr}return Jt||Hr.length||Ot||(Hr=Rf(Le,bi/2,Oe,Ue,qe,Ct,Ot,!0,_i)),Hr}function Df(Le,Re,Oe,Ue,qe){const Ct=[];for(let Ot=0;Ot<Le.length;Ot++){const Jt=Le[Ot];let _i;for(let Le=0;Le<Jt.length-1;Le++){let Ot=Jt[Le],xi=Jt[Le+1];Ot.x<Re&&xi.x<Re||(Ot.x<Re?Ot=new ta(Re,Ot.y+(Re-Ot.x)/(xi.x-Ot.x)*(xi.y-Ot.y))._round():xi.x<Re&&(xi=new ta(Re,Ot.y+(Re-Ot.x)/(xi.x-Ot.x)*(xi.y-Ot.y))._round()),Ot.y<Oe&&xi.y<Oe||(Ot.y<Oe?Ot=new ta(Ot.x+(Oe-Ot.y)/(xi.y-Ot.y)*(xi.x-Ot.x),Oe)._round():xi.y<Oe&&(xi=new ta(Ot.x+(Oe-Ot.y)/(xi.y-Ot.y)*(xi.x-Ot.x),Oe)._round()),Ot.x>=Ue&&xi.x>=Ue||(Ot.x>=Ue?Ot=new ta(Ue,Ot.y+(Ue-Ot.x)/(xi.x-Ot.x)*(xi.y-Ot.y))._round():xi.x>=Ue&&(xi=new ta(Ue,Ot.y+(Ue-Ot.x)/(xi.x-Ot.x)*(xi.y-Ot.y))._round()),Ot.y>=qe&&xi.y>=qe||(Ot.y>=qe?Ot=new ta(Ot.x+(qe-Ot.y)/(xi.y-Ot.y)*(xi.x-Ot.x),qe)._round():xi.y>=qe&&(xi=new ta(Ot.x+(qe-Ot.y)/(xi.y-Ot.y)*(xi.x-Ot.x),qe)._round()),_i&&Ot.equals(_i[_i.length-1])||(_i=[Ot],Ct.push(_i)),_i.push(xi)))))}}return Ct}function Lf(Le){let Re=0,Oe=0;for(const Ue of Le)Re+=Ue.w*Ue.h,Oe=Math.max(Oe,Ue.w);Le.sort(((Le,Re)=>Re.h-Le.h));const Ue=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(Re/.95)),Oe),h:1/0}];let qe=0,Ct=0;for(const Re of Le)for(let Le=Ue.length-1;Le>=0;Le--){const Oe=Ue[Le];if(!(Re.w>Oe.w||Re.h>Oe.h)){if(Re.x=Oe.x,Re.y=Oe.y,Ct=Math.max(Ct,Re.y+Re.h),qe=Math.max(qe,Re.x+Re.w),Re.w===Oe.w&&Re.h===Oe.h){const Re=Ue.pop();Le<Ue.length&&(Ue[Le]=Re)}else Re.h===Oe.h?(Oe.x+=Re.w,Oe.w-=Re.w):Re.w===Oe.w?(Oe.y+=Re.h,Oe.h-=Re.h):(Ue.push({x:Oe.x+Re.w,y:Oe.y,w:Oe.w-Re.w,h:Re.h}),Oe.y+=Re.h,Oe.h-=Re.h);break}}return{w:qe,h:Ct,fill:Re/(qe*Ct)||0}}os(zf,"Anchor");const Og=1;class Of{constructor(Le,{pixelRatio:Re,version:Oe,stretchX:Ue,stretchY:qe,content:Ct},Ot){this.paddedRect=Le,this.pixelRatio=Re,this.stretchX=Ue,this.stretchY=qe,this.content=Ct,this.version=Oe,this.padding=Ot}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class Uf{constructor(Le,Re,Oe){const Ue={},qe={};this.haveRenderCallbacks=[];const Ct=[];this.addImages(Le,Ue,Og,Ct),this.addImages(Re,qe,2,Ct);const{w:Ot,h:Jt}=Lf(Ct),_i=new ic({width:Ot||1,height:Jt||1});for(const Re in Le){const qe=Le[Re],Ct=Ue[Re].paddedRect;ic.copy(qe.data,_i,{x:0,y:0},{x:Ct.x+Og,y:Ct.y+Og},qe.data,Oe,qe.sdf)}for(const Le in Re){const Ue=Re[Le],Ct=qe[Le].paddedRect;let Ot=qe[Le].padding;const Jt=Ct.x+Ot,xi=Ct.y+Ot,vi=Ue.data.width,bi=Ue.data.height;Ot=Ot>1?Ot-1:Ot,ic.copy(Ue.data,_i,{x:0,y:0},{x:Jt,y:xi},Ue.data,Oe),ic.copy(Ue.data,_i,{x:0,y:bi-Ot},{x:Jt,y:xi-Ot},{width:vi,height:Ot},Oe),ic.copy(Ue.data,_i,{x:0,y:0},{x:Jt,y:xi+bi},{width:vi,height:Ot},Oe),ic.copy(Ue.data,_i,{x:vi-Ot,y:0},{x:Jt-Ot,y:xi},{width:Ot,height:bi},Oe),ic.copy(Ue.data,_i,{x:0,y:0},{x:Jt+vi,y:xi},{width:Ot,height:bi},Oe),ic.copy(Ue.data,_i,{x:vi-Ot,y:bi-Ot},{x:Jt-Ot,y:xi-Ot},{width:Ot,height:Ot},Oe),ic.copy(Ue.data,_i,{x:0,y:bi-Ot},{x:Jt+vi,y:xi-Ot},{width:Ot,height:Ot},Oe),ic.copy(Ue.data,_i,{x:0,y:0},{x:Jt+vi,y:xi+bi},{width:Ot,height:Ot},Oe),ic.copy(Ue.data,_i,{x:vi-Ot,y:0},{x:Jt-Ot,y:xi+bi},{width:Ot,height:Ot},Oe)}this.image=_i,this.iconPositions=Ue,this.patternPositions=qe}addImages(Le,Re,Oe,Ue){for(const qe in Le){const Ct=Le[qe],Ot={x:0,y:0,w:Ct.data.width+2*Oe,h:Ct.data.height+2*Oe};Ue.push(Ot),Re[qe]=new Of(Ot,Ct,Oe),Ct.hasRenderCallback&&this.haveRenderCallbacks.push(qe)}}patchUpdatedImages(Le,Re,Oe){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((Re=>Le.hasImage(Re,Oe))),Le.dispatchRenderCallbacks(this.haveRenderCallbacks,Oe);for(const Ue in Le.getUpdatedImages(Oe))this.patchUpdatedImage(this.iconPositions[Ue],Le.getImage(Ue,Oe),Re),this.patchUpdatedImage(this.patternPositions[Ue],Le.getImage(Ue,Oe),Re)}patchUpdatedImage(Le,Re,Oe){if(!Le||!Re)return;if(Le.version===Re.version)return;Le.version=Re.version;
vendor: 24,052 bytes, line 1
1const[Ue,qe]=Le.tl;Oe.update(Re.data,{position:{x:Ue,y:qe}})}}os(Of,"ImagePosition"),os(Uf,"ImageAtlas");const Fg=1e20;function Nf(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){for(let xi=Re;xi<Re+Ue;xi++)qf(Le,Oe*Ct+xi,Ct,qe,Ot,Jt,_i);for(let xi=Oe;xi<Oe+qe;xi++)qf(Le,xi*Ct+Re,1,Ue,Ot,Jt,_i)}function qf(Le,Re,Oe,Ue,qe,Ct,Ot){Ct[0]=0,Ot[0]=-Fg,Ot[1]=Fg,qe[0]=Le[Re];for(let Jt=1,_i=0,xi=0;Jt<Ue;Jt++){qe[Jt]=Le[Re+Jt*Oe];const Ue=Jt*Jt;do{const Le=Ct[_i];xi=(qe[Jt]-qe[Le]+Ue-Le*Le)/(Jt-Le)/2}while(xi<=Ot[_i]&&--_i>-1);_i++,Ct[_i]=Jt,Ot[_i]=xi,Ot[_i+1]=Fg}for(let Jt=0,_i=0;Jt<Ue;Jt++){for(;Ot[_i+1]<Jt;)_i++;const Ue=Ct[_i],xi=Jt-Ue;Le[Re+Jt*Oe]=qe[Ue]+xi*xi}}const Bg=2,Ng={none:0,ideographs:1,all:2};class Xf{constructor(Le,Re,Oe){this.requestManager=Le,this.localGlyphMode=Re,this.localFontFamily=Oe,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(Le,Re){this.urls[Re]=Le}getGlyphs(Le,Re,Oe){const Ue=[],qe=this.urls[Re]||Hl.GLYPHS_URL;for(const Re in Le)for(const Oe of Le[Re])Ue.push({stack:Re,id:Oe});rt(Ue,(({stack:Le,id:Re},Oe)=>{let Ue=this.entries[Le];Ue||(Ue=this.entries[Le]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let Ct=Ue.glyphs[Re];if(void 0!==Ct)return void Oe(null,{stack:Le,id:Re,glyph:Ct});if(Ct=this._tinySDF(Ue,Le,Re),Ct)return Ue.glyphs[Re]=Ct,void Oe(null,{stack:Le,id:Re,glyph:Ct});const Ot=Math.floor(Re/256);if(256*Ot>65535)return void Oe(new Error("glyphs > 65535 not supported"));if(Ue.ranges[Ot])return void Oe(null,{stack:Le,id:Re,glyph:Ct});let Jt=Ue.requests[Ot];Jt||(Jt=Ue.requests[Ot]=[],Xf.loadGlyphRange(Le,Ot,qe,this.requestManager,((Le,Re)=>{if(Re){Ue.ascender=Re.ascender,Ue.descender=Re.descender;for(const Le in Re.glyphs)this._doesCharSupportLocalGlyph(+Le)||(Ue.glyphs[+Le]=Re.glyphs[+Le]);Ue.ranges[Ot]=!0}for(const Oe of Jt)Oe(Le,Re);delete Ue.requests[Ot]}))),Jt.push(((Ue,qe)=>{Ue?Oe(Ue):qe&&Oe(null,{stack:Le,id:Re,glyph:qe.glyphs[Re]||null})}))}),((Le,Re)=>{if(Le)Oe(Le);else if(Re){const Le={};for(const{stack:Oe,id:Ue,glyph:qe}of Re)void 0===Le[Oe]&&(Le[Oe]={}),void 0===Le[Oe].glyphs&&(Le[Oe].glyphs={}),Le[Oe].glyphs[Ue]=qe&&{id:qe.id,bitmap:qe.bitmap.clone(),metrics:qe.metrics},Le[Oe].ascender=this.entries[Oe].ascender,Le[Oe].descender=this.entries[Oe].descender;Oe(null,Le)}}))}_doesCharSupportLocalGlyph(Le){return this.localGlyphMode!==Ng.none&&(this.localGlyphMode===Ng.all?!!this.localFontFamily:!!this.localFontFamily&&(Tp["CJK Unified Ideographs"](Le)||Tp["Hangul Syllables"](Le)||Tp.Hiragana(Le)||Tp.Katakana(Le)||Tp["CJK Symbols and Punctuation"](Le)||Tp["CJK Unified Ideographs Extension A"](Le)||Tp["CJK Unified Ideographs Extension B"](Le)))}_tinySDF(Le,Re,Oe){const Ue=this.localFontFamily;if(!Ue||!this._doesCharSupportLocalGlyph(Oe))return;let qe=Le.tinySDF;if(!qe){let Oe="400";/bold/i.test(Re)?Oe="900":/medium/i.test(Re)?Oe="500":/light/i.test(Re)&&(Oe="200"),qe=Le.tinySDF=new Xf.TinySDF({fontFamily:Ue,fontWeight:Oe,fontSize:24*Bg,buffer:3*Bg,radius:8*Bg}),qe.fontWeight=Oe}if(this.localGlyphs[qe.fontWeight][Oe])return this.localGlyphs[qe.fontWeight][Oe];const Ct=String.fromCodePoint(Oe),{data:Ot,width:Jt,height:_i,glyphWidth:xi,glyphHeight:vi,glyphLeft:bi,glyphTop:Pi,glyphAdvance:Hr}=qe.draw(Ct);return this.localGlyphs[qe.fontWeight][Oe]={id:Oe,bitmap:new nc({width:Jt,height:_i},Ot),metrics:{width:xi/Bg,height:vi/Bg,left:bi/Bg,top:Pi/Bg-27,advance:Hr/Bg,localGlyph:!0}}}}Xf.loadGlyphRange=function(Le,Re,Oe,Ue,qe){const Ct=256*Re,Ot=Ct+255,Jt=Ue.transformRequest(Ue.normalizeGlyphsURL(Oe).replace("{fontstack}",Le).replace("{range}",`${Ct}-${Ot}`),ih.Glyphs);se(Jt,((Le,Re)=>{if(Le)qe(Le);else if(Re){const Le={},Oe=function(Le){return new Sg(Le).readFields(uf,{})}(Re);for(const Re of Oe.glyphs)Le[Re.id]=Re;qe(null,{glyphs:Le,ascender:Oe.ascender,descender:Oe.descender})}}))},Xf.TinySDF=class{constructor({fontSize:Le=24,buffer:Re=3,radius:Oe=8,cutoff:Ue=.25,fontFamily:qe="sans-serif",fontWeight:Ct="normal",fontStyle:Ot="normal"}={}){this.buffer=Re,this.cutoff=Ue,this.radius=Oe;const Jt=this.size=Le+4*Re,_i=this._createCanvas(Jt),xi=this.ctx=_i.getContext("2d",{willReadFrequently:!0});xi.font=`${Ot} ${Ct} ${Le}px ${qe}`,xi.textBaseline="alphabetic",xi.textAlign="left",xi.fillStyle="black",this.gridOuter=new Float64Array(Jt*Jt),this.gridInner=new Float64Array(Jt*Jt),this.f=new Float64Array(Jt),this.z=new Float64Array(Jt+1),this.v=new Uint16Array(Jt)}_createCanvas(Le){const Re=document.createElement("canvas");return Re.width=Re.height=Le,Re}draw(Le){const{width:Re,actualBoundingBoxAscent:Oe,actualBoundingBoxDescent:Ue,actualBoundingBoxLeft:qe,actualBoundingBoxRight:Ct}=this.ctx.measureText(Le),Ot=Math.ceil(Oe),Jt=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(Ct-qe))),_i=Math.min(this.size-this.buffer,Ot+Math.ceil(Ue)),xi=Jt+2*this.buffer,vi=_i+2*this.buffer,bi=Math.max(xi*vi,0),Pi=new Uint8ClampedArray(bi),Hr={data:Pi,width:xi,height:vi,glyphWidth:Jt,glyphHeight:_i,glyphTop:Ot,glyphLeft:0,glyphAdvance:Re};if(0===Jt||0===_i)return Hr;const{ctx:Jr,buffer:Ln,gridInner:Nn,gridOuter:Gn}=this;Jr.clearRect(Ln,Ln,Jt,_i),Jr.fillText(Le,Ln,Ln+Ot);const qn=Jr.getImageData(Ln,Ln,Jt,_i);Gn.fill(Fg,0,bi),Nn.fill(0,0,bi);for(let Le=0;Le<_i;Le++)for(let Re=0;Re<Jt;Re++){const Oe=qn.data[4*(Le*Jt+Re)+3]/255;if(0===Oe)continue;const Ue=(Le+Ln)*xi+Re+Ln;if(1===Oe)Gn[Ue]=0,Nn[Ue]=Fg;else{const Le=.5-Oe;Gn[Ue]=Le>0?Le*Le:0,Nn[Ue]=Le<0?Le*Le:0}}Nf(Gn,0,0,xi,vi,xi,this.f,this.v,this.z),Nf(Nn,Ln,Ln,Jt,_i,xi,this.f,this.v,this.z);for(let Le=0;Le<bi;Le++){const Re=Math.sqrt(Gn[Le])-Math.sqrt(Nn[Le]);Pi[Le]=Math.round(255-255*(Re/this.radius+this.cutoff))}return Hr}};const Vg=Og;function Zf(Le,Re,Oe,Ue){const qe=[],Ct=Le.imagePrimary,Ot=Ct.pixelRatio,Jt=Ct.paddedRect.w-2*Vg,_i=Ct.paddedRect.h-2*Vg,xi=Le.right-Le.left,vi=Le.bottom-Le.top,bi=Ct.stretchX||[[0,Jt]],Pi=Ct.stretchY||[[0,_i]],f=(Le,Re)=>Le+Re[1]-Re[0],Hr=bi.reduce(f,0),Jr=Pi.reduce(f,0),Ln=Jt-Hr,Nn=_i-Jr;let Gn=0,qn=Hr,Zn=0,$n=Jr,Xn=0,Yn=Ln,lo=0,uo=Nn;if(Ct.content&&Ue){const Le=Ct.content;Gn=Wf(bi,0,Le[0]),Zn=Wf(Pi,0,Le[1]),qn=Wf(bi,Le[0],Le[2]),$n=Wf(Pi,Le[1],Le[3]),Xn=Le[0]-Gn,lo=Le[1]-Zn,Yn=Le[2]-Le[0]-qn,uo=Le[3]-Le[1]-$n}const I=(Ue,qe,Jt,_i)=>{const bi=Kf(Ue.stretch-Gn,qn,xi,Le.left),Pi=Jf(Ue.fixed-Xn,Yn,Ue.stretch,Hr),Ln=Kf(qe.stretch-Zn,$n,vi,Le.top),Nn=Jf(qe.fixed-lo,uo,qe.stretch,Jr),po=Kf(Jt.stretch-Gn,qn,xi,Le.left),fo=Jf(Jt.fixed-Xn,Yn,Jt.stretch,Hr),Io=Kf(_i.stretch-Zn,$n,vi,Le.top),is=Jf(_i.fixed-lo,uo,_i.stretch,Jr),as=new ta(bi,Ln),Is=new ta(po,Ln),Xs=new ta(po,Io),ha=new ta(bi,Io),el=new ta(Pi/Ot,Nn/Ot),tl=new ta(fo/Ot,is/Ot),il=Re*Math.PI/180;if(il){const Le=Math.sin(il),Re=Math.cos(il),Oe=[Re,-Le,Le,Re];as._matMult(Oe),Is._matMult(Oe),ha._matMult(Oe),Xs._matMult(Oe)}const sl=Ue.stretch+Ue.fixed,fl=Jt.stretch+Jt.fixed,Ml=qe.stretch+qe.fixed,Al=_i.stretch+_i.fixed,Hl=Le.imageSecondary;return{tl:as,tr:Is,bl:ha,br:Xs,texPrimary:{x:Ct.paddedRect.x+Vg+sl,y:Ct.paddedRect.y+Vg+Ml,w:fl-sl,h:Al-Ml},texSecondary:Hl?{x:Hl.paddedRect.x+Vg+sl,y:Hl.paddedRect.y+Vg+Ml,w:fl-sl,h:Al-Ml}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:el,pixelOffsetBR:tl,minFontScaleX:Yn/Ot/xi,minFontScaleY:uo/Ot/vi,isSDF:Oe}};if(Ue&&(Ct.stretchX||Ct.stretchY)){const Le=Hf(bi,Ln,Hr),Re=Hf(Pi,Nn,Jr);for(let Oe=0;Oe<Le.length-1;Oe++){const Ue=Le[Oe],Ct=Le[Oe+1];for(let Le=0;Le<Re.length-1;Le++)qe.push(I(Ue,Re[Le],Ct,Re[Le+1]))}}else qe.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:Jt+1},{fixed:0,stretch:_i+1}));return qe}function Wf(Le,Re,Oe){let Ue=0;for(const qe of Le)Ue+=Math.max(Re,Math.min(Oe,qe[1]))-Math.max(Re,Math.min(Oe,qe[0]));return Ue}function Hf(Le,Re,Oe){const Ue=[{fixed:-Vg,stretch:0}];for(const[Re,Oe]of Le){const Le=Ue[Ue.length-1];Ue.push({fixed:Re-Le.stretch,stretch:Le.stretch}),Ue.push({fixed:Re-Le.stretch,stretch:Le.stretch+(Oe-Re)})}return Ue.push({fixed:Re+Vg,stretch:Oe}),Ue}function Kf(Le,Re,Oe,Ue){return Le/Re*Oe+Ue}function Jf(Le,Re,Oe,Ue){return Le-Re*Oe/Ue}function Qf(Le,Re,Oe,Ue){const qe=Re+Le.positionedLines[Ue].lineOffset;return 0===Ue?Oe+qe/2:Oe+(qe+(Re+Le.positionedLines[Ue-1].lineOffset))/2}function td(Le,Re=1,Oe=!1){let Ue=1/0,qe=1/0,Ct=-1/0,Ot=-1/0;const Jt=Le[0];for(let Le=0;Le<Jt.length;Le++){const Re=Jt[Le];(!Le||Re.x<Ue)&&(Ue=Re.x),(!Le||Re.y<qe)&&(qe=Re.y),(!Le||Re.x>Ct)&&(Ct=Re.x),(!Le||Re.y>Ot)&&(Ot=Re.y)}const _i=Math.min(Ct-Ue,Ot-qe);let xi=_i/2;const vi=new Wr([],ed);if(0===_i)return new ta(Ue,qe);for(let Re=Ue;Re<Ct;Re+=_i)for(let Oe=qe;Oe<Ot;Oe+=_i)vi.push(new rd(Re+xi,Oe+xi,xi,Le));let bi=function(Le){let Re=0,Oe=0,Ue=0;const qe=Le[0];for(let Le=0,Ct=qe.length,Ot=Ct-1;Le<Ct;Ot=Le++){const Ct=qe[Le],Jt=qe[Ot],_i=Ct.x*Jt.y-Jt.x*Ct.y;Oe+=(Ct.x+Jt.x)*_i,Ue+=(Ct.y+Jt.y)*_i,Re+=3*_i}return new rd(Oe/Re,Ue/Re,0,Le)}(Le),Pi=vi.length;for(;vi.length;){const Ue=vi.pop();(Ue.d>bi.d||!bi.d)&&(bi=Ue,Oe&&console.log("found best %d after %d probes",Math.round(1e4*Ue.d)/1e4,Pi)),Ue.max-bi.d<=Re||(xi=Ue.h/2,vi.push(new rd(Ue.p.x-xi,Ue.p.y-xi,xi,Le)),vi.push(new rd(Ue.p.x+xi,Ue.p.y-xi,xi,Le)),vi.push(new rd(Ue.p.x-xi,Ue.p.y+xi,xi,Le)),vi.push(new rd(Ue.p.x+xi,Ue.p.y+xi,xi,Le)),Pi+=4)}return Oe&&(console.log(`num probes: ${Pi}`),console.log(`best distance: ${bi.d}`)),bi.p}function ed(Le,Re){return Re.max-Le.max}class rd{constructor(Le,Re,Oe,Ue){this.p=new ta(Le,Re),this.h=Oe,this.d=function(Le,Re){let Oe=!1,Ue=1/0;for(let qe=0;qe<Re.length;qe++){const Ct=Re[qe];for(let Re=0,qe=Ct.length,Ot=qe-1;Re<qe;Ot=Re++){const qe=Ct[Re],Jt=Ct[Ot];qe.y>Le.y!=Jt.y>Le.y&&Le.x<(Jt.x-qe.x)*(Le.y-qe.y)/(Jt.y-qe.y)+qe.x&&(Oe=!Oe),Ue=Math.min(Ue,Fl(Le,qe,Jt))}}return(Oe?1:-1)*Math.sqrt(Ue)}(this.p,Ue),this.max=this.d+this.h*Math.SQRT2}}const Ug=Number.POSITIVE_INFINITY,$g=Math.sqrt(2);function sd(Le,[Re,Oe]){let Ue=0,qe=0;if(Oe===Ug){Re<0&&(Re=0);const Oe=Re/$g;switch(Le){case"top-right":case"top-left":qe=Oe-7;break;case"bottom-right":case"bottom-left":qe=7-Oe;break;case"bottom":qe=7-Re;break;case"top":qe=Re-7}switch(Le){case"top-right":case"bottom-right":Ue=-Oe;break;case"top-left":case"bottom-left":Ue=Oe;break;case"left":Ue=Re;break;case"right":Ue=-Re}}else{switch(Re=Math.abs(Re),Oe=Math.abs(Oe),Le){case"top-right":case"top-left":case"top":qe=Oe-7;break;case"bottom-right":case"bottom-left":case"bottom":qe=7-Oe}switch(Le){case"top-right":case"bottom-right":case"right":Ue=-Re;break;case"top-left":case"bottom-left":case"left":Ue=Re}}return[Ue,qe]}function ad(Le){switch(Le){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function od(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr){let Ln=Ct.textMaxSize.evaluate(Re,{},bi);void 0===Ln&&(Ln=Ot);const Nn=Le.layers[0].layout,Gn=Nn.get("icon-offset").evaluate(Re,{},bi),qn=hd(Oe.horizontal)||Oe.vertical,Zn="globe"===Pi.name,$n=pg,Xn=Ot/$n,Yn=Le.tilePixelRatio*Ln/$n,lo=(Xs=Le.overscaling,Le.zoom>18&&Xs>2&&(Xs>>=1),Math.max(ud/(512*Xs),1)*Nn.get("symbol-spacing")),uo=Nn.get("text-padding")*Le.tilePixelRatio,po=Nn.get("icon-padding")*Le.tilePixelRatio,fo=Y(Nn.get("text-max-angle")),Io="map"===Nn.get("text-rotation-alignment")&&"point"!==Nn.get("symbol-placement"),is="map"===Nn.get("icon-rotation-alignment")&&"point"!==Nn.get("symbol-placement"),as=Nn.get("symbol-placement"),Is=lo/2;var Xs;const ta=Nn.get("icon-text-fit").evaluate(Re,{},bi),ha=Nn.get("icon-text-fit-padding").evaluate(Re,{},bi),el="none"!==ta;let tl;!1===Le.hasAnyIconTextFit&&el&&(Le.hasAnyIconTextFit=!0),Ue&&el&&(Le.allowVerticalPlacement&&Oe.vertical&&(tl=Pf(Ue,Oe.vertical,ta,ha,Gn,Xn)),qn&&(Ue=Pf(Ue,qn,ta,ha,Gn,Xn)));const D=(Ot,Jt,Ln)=>{if(Jt.x<0||Jt.x>=ud||Jt.y<0||Jt.y>=ud)return;let Nn=null;if(Zn){const{x:Le,y:Re,z:Oe}=Pi.projectTilePoint(Jt.x,Jt.y,Ln);Nn={anchor:new zf(Le,Re,Oe,0,void 0),up:Pi.upVector(Ln,Jt.x,Jt.y)}}!function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn,Yn,lo,uo,po,fo){const Io=Le.addToLineVertexArray(Re,Ue);let is,as,Is,Xs,ta,ha,el,tl=0,il=0,sl=0,fl=0,Ml=-1,Al=-1;const Hl={};let Wl=Rh("");const Jl=Oe?Oe.anchor:Re,Kl="none"!==_i.layout.get("icon-text-fit").evaluate($n,{},uo);let Ql=0,oc=0;if(void 0===_i._unevaluatedLayout.getValue("text-radial-offset")?[Ql,oc]=_i.layout.get("text-offset").evaluate($n,{},uo).map((Le=>Le*pg)):(Ql=_i.layout.get("text-radial-offset").evaluate($n,{},uo)*pg,oc=Ug),Le.allowVerticalPlacement&&qe.vertical){const Le=qe.vertical;if(Jr)ha=fd(Le),Jt&&(el=fd(Jt));else{const Oe=_i.layout.get("text-rotate").evaluate($n,{},uo)+90;Is=pd(xi,Jl,Re,vi,bi,Pi,Le,Hr,Oe,Ln),Jt&&(Xs=pd(xi,Jl,Re,vi,bi,Pi,Jt,Gn,Oe))}}if(Ct){const Ue=_i.layout.get("icon-rotate").evaluate($n,{},uo),qe=Zf(Ct,Ue,Yn,Kl),Ot=Jt?Zf(Jt,Ue,Yn,Kl):void 0;as=pd(xi,Jl,Re,vi,bi,Pi,Ct,Gn,Ue),tl=4*qe.length;const Hr=Le.iconSizeData;let Jr=null;"source"===Hr.kind?(Jr=[mg*_i.layout.get("icon-size").evaluate($n,{},uo)],Jr[0]>Yg&&ft(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Xg}. Reduce your "icon-size".`)):"composite"===Hr.kind&&(Jr=[mg*Xn.compositeIconSizes[0].evaluate($n,{},uo),mg*Xn.compositeIconSizes[1].evaluate($n,{},uo)],(Jr[0]>Yg||Jr[1]>Yg)&&ft(`${Le.layerIds[0]}: Value for "icon-size" is >= ${Xg}. Reduce your "icon-size".`)),Le.addSymbols(Le.icon,qe,Jr,Zn,qn,$n,!1,Oe,Re,Io.lineStartIndex,Io.lineLength,-1,lo,uo,po,fo),Ml=Le.icon.placedSymbolArray.length-1,Ot&&(il=4*Ot.length,Le.addSymbols(Le.icon,Ot,Jr,Zn,qn,$n,Cg.vertical,Oe,Re,Io.lineStartIndex,Io.lineLength,-1,lo,uo,po,fo),Al=Le.icon.placedSymbolArray.length-1)}for(const Ue in qe.horizontal){const Ct=qe.horizontal[Ue];is||(Wl=Rh(Ct.text),Jr?ta=fd(Ct):is=pd(xi,Jl,Re,vi,bi,Pi,Ct,Hr,_i.layout.get("text-rotate").evaluate($n,{},uo),Ln));const Jt=1===Ct.positionedLines.length;if(sl+=cd(Le,Oe,Re,Ct,Ot,_i,Jr,$n,Ln,Io,qe.vertical?Cg.horizontal:Cg.horizontalOnly,Jt?Object.keys(qe.horizontal):[Ue],Hl,Ml,Xn,lo,uo,po),Jt)break}qe.vertical&&(fl+=cd(Le,Oe,Re,qe.vertical,Ot,_i,Jr,$n,Ln,Io,Cg.vertical,["vertical"],Hl,Al,Xn,lo,uo,po));let lc=-1;const Z=(Le,Re)=>Le?Math.max(Le,Re):Re;lc=Z(ta,lc),lc=Z(ha,lc),lc=Z(el,lc);const Oc=lc>-1?1:0;Le.glyphOffsetArray.length>=65535&&ft("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==$n.sortKey&&Le.addToSortKeyRanges(Le.symbolInstances.length,$n.sortKey),Le.symbolInstances.emplaceBack(Re.x,Re.y,Jl.x,Jl.y,Jl.z,Hl.right>=0?Hl.right:-1,Hl.center>=0?Hl.center:-1,Hl.left>=0?Hl.left:-1,Hl.vertical>=0?Hl.vertical:-1,Ml,Al,Wl,void 0!==is?is:Le.collisionBoxArray.length,void 0!==is?is+1:Le.collisionBoxArray.length,void 0!==Is?Is:Le.collisionBoxArray.length,void 0!==Is?Is+1:Le.collisionBoxArray.length,void 0!==as?as:Le.collisionBoxArray.length,void 0!==as?as+1:Le.collisionBoxArray.length,Xs||Le.collisionBoxArray.length,Xs?Xs+1:Le.collisionBoxArray.length,vi,sl,fl,tl,il,Oc,0,Ql,oc,lc,0,Kl?1:0)}(Le,Jt,Nn,Ot,Oe,Ue,qe,tl,Le.layers[0],Le.collisionBoxArray,Re.index,Re.sourceLayerIndex,Le.index,uo,Io,_i,0,po,is,Gn,Re,Ct,xi,vi,bi,Hr,Jr)};if("line"===as)for(const qe of Df(Re.geometry,0,0,ud,ud)){const Re=Cf(qe,lo,fo,Oe.vertical||qn,Ue,$n,Yn,Le.overscaling,ud);for(const Oe of Re)qn&&dd(Le,qn.text,Is,Oe)||D(qe,Oe,bi)}else if("line-center"===as){for(const Le of Re.geometry)if(Le.length>1){const Re=Vf(Le,fo,Oe.vertical||qn,Ue,$n,Yn);Re&&D(Le,Re,bi)}}else if("Polygon"===Re.type)for(const Le of Cc(Re.geometry,0)){const Re=td(Le,16);D(Le[0],new zf(Re.x,Re.y,0,0,void 0),bi)}else if("LineString"===Re.type)for(const Le of Re.geometry)D(Le,new zf(Le[0].x,Le[0].y,0,0,void 0),bi);else if("Point"===Re.type)for(const Le of Re.geometry)for(const Re of Le)D([Re],new zf(Re.x,Re.y,0,0,void 0),bi)}const Xg=255,Yg=Xg*mg;function cd(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn){const qn=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=[];if(0===Re.positionedLines.length)return _i;const xi=Ue.layout.get("text-rotate").evaluate(Ct,{})*Math.PI/180,vi=function(Le){const Re=Le[0],Oe=Le[1],Ue=Re*Oe;return Ue>0?[Re,-Oe]:Ue<0?[-Re,Oe]:0===Re?[Oe,Re]:[Oe,-Re]}(Oe);let bi=Math.abs(Re.top-Re.bottom);for(const Le of Re.positionedLines)bi-=Le.lineOffset;const Pi=Re.positionedLines.length,Hr=bi/Pi;let Jr=Re.top-Oe[1];for(let Le=0;Le<Pi;++Le){const Ue=Re.positionedLines[Le];Jr=Qf(Re,Hr,Jr,Le);for(const Le of Ue.positionedGlyphs){if(!Le.rect)continue;const Ue=Le.rect||{};let Ct=Ig+1,bi=!0,Pi=1,Hr=0;if(Le.imageName){const Re=Ot[Le.imageName];if(!Re)continue;if(Re.sdf){ft("SDF images are not supported in formatted text and will be ignored.");continue}bi=!1,Pi=Re.pixelRatio,Ct=Og/Pi}const Ln=(qe||Jt)&&Le.vertical,Nn=Le.metrics.advance*Le.scale/2,Gn=Le.metrics,qn=Le.rect;if(null===qn)continue;Jt&&Re.verticalizable&&(Hr=Le.imageName?Nn-Le.metrics.width*Le.scale/2:0);const Zn=qe?[Le.x+Nn,Le.y]:[0,0];let $n=[0,0],Xn=[0,0],Yn=!1;qe||(Ln?(Xn=[Le.x+Nn+vi[0],Le.y+vi[1]-Hr],Yn=!0):$n=[Le.x+Nn+Oe[0],Le.y+Oe[1]-Hr]);const lo=qn.w*Le.scale/(Pi*(Le.localGlyph?Bg:1)),uo=qn.h*Le.scale/(Pi*(Le.localGlyph?Bg:1));let po,fo,Io,is;if(Ln){const Re=Le.y-Jr,Oe=new ta(-Nn,Nn-Re),Ue=-Math.PI/2,qe=new ta(...Xn);po=new ta(-Nn+$n[0],$n[1]),po._rotateAround(Ue,Oe)._add(qe),po.x+=-Re+Nn,po.y-=(Gn.left-Ct)*Le.scale;const Ot=Le.imageName?Gn.advance*Le.scale:pg*Le.scale,Jt=String.fromCodePoint(Le.glyph);Jp(Jt)?po.x+=(1-Ct)*Le.scale:Qp(Jt)?po.x+=Ot-Gn.height*Le.scale+(-Ct-1)*Le.scale:po.x+=Le.imageName||Gn.width+2*Ct===qn.w&&Gn.height+2*Ct===qn.h?(Ot-uo)/2:(Ot-(Gn.height+2*Ct)*Le.scale)/2,fo=new ta(po.x,po.y-lo),Io=new ta(po.x+uo,po.y),is=new ta(po.x+uo,po.y-lo)}else{const Re=(Gn.left-Ct)*Le.scale-Nn+$n[0],Oe=(-Gn.top-Ct)*Le.scale+$n[1],Ue=Re+lo,qe=Oe+uo;po=new ta(Re,Oe),fo=new ta(Ue,Oe),Io=new ta(Re,qe),is=new ta(Ue,qe)}if(xi){let Le;Le=qe?new ta(0,0):Yn?new ta(vi[0],vi[1]):new ta(Oe[0],Oe[1]),po._rotateAround(xi,Le),fo._rotateAround(xi,Le),Io._rotateAround(xi,Le),is._rotateAround(xi,Le)}const as=new ta(0,0),Is=new ta(0,0);_i.push({tl:po,tr:fo,bl:Io,br:is,texPrimary:Ue,texSecondary:void 0,writingMode:Re.writingMode,glyphOffset:Zn,sectionIndex:Le.sectionIndex,isSDF:bi,pixelOffsetTL:as,pixelOffsetBR:Is,minFontScaleX:0,minFontScaleY:0})}}return _i}(0,Ue,_i,Ct,Ot,Jt,qe,Le.allowVerticalPlacement),Zn=Le.textSizeData;let $n=null;"source"===Zn.kind?($n=[mg*Ct.layout.get("text-size").evaluate(Jt,{},Nn)],$n[0]>Yg&&ft(`${Le.layerIds[0]}: Value for "text-size" is >= ${Xg}. Reduce your "text-size".`)):"composite"===Zn.kind&&($n=[mg*Jr.compositeTextSizes[0].evaluate(Jt,{},Nn),mg*Jr.compositeTextSizes[1].evaluate(Jt,{},Nn)],($n[0]>Yg||$n[1]>Yg)&&ft(`${Le.layerIds[0]}: Value for "text-size" is >= ${Xg}. Reduce your "text-size".`)),Le.addSymbols(Le.text,qn,$n,_i,Ot,Jt,vi,Re,Oe,xi.lineStartIndex,xi.lineLength,Hr,Ln,Nn,Gn,!1);for(const Re of bi)Pi[Re]=Le.text.placedSymbolArray.length-1;return 4*qn.length}function hd(Le){for(const Re in Le)return Le[Re];return null}function pd(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi){let vi=Ot.top,bi=Ot.bottom,Pi=Ot.left,Hr=Ot.right;const Jr=Ot.collisionPadding;if(Jr&&(Pi-=Jr[0],vi-=Jr[1],Hr+=Jr[2],bi+=Jr[3]),_i){const Le=new ta(Pi,vi),Re=new ta(Hr,vi),Oe=new ta(Pi,bi),Ue=new ta(Hr,bi),qe=Y(_i);let Ct=new ta(0,0);xi&&(Ct=new ta(xi[0],xi[1])),Le._rotateAround(qe,Ct),Re._rotateAround(qe,Ct),Oe._rotateAround(qe,Ct),Ue._rotateAround(qe,Ct),Pi=Math.min(Le.x,Re.x,Oe.x,Ue.x),Hr=Math.max(Le.x,Re.x,Oe.x,Ue.x),vi=Math.min(Le.y,Re.y,Oe.y,Ue.y),bi=Math.max(Le.y,Re.y,Oe.y,Ue.y)}return Le.emplaceBack(Re.x,Re.y,Re.z,Oe.x,Oe.y,Pi,vi,Hr,bi,Jt,Ue,qe,Ct),Le.length-1}function fd(Le){Le.collisionPadding&&(Le.top-=Le.collisionPadding[1],Le.bottom+=Le.collisionPadding[3]);const Re=Le.bottom-Le.top;return Re>0?Math.max(10,Re):null}function dd(Le,Re,Oe,Ue){const qe=Le.compareText;if(Re in qe){const Le=qe[Re];for(let Re=Le.length-1;Re>=0;Re--)if(Ue.dist(Le[Re])<Oe)return!0}else qe[Re]=[];return qe[Re].push(Ue),!1}function md(Le,Re){const Oe=Le.fovAboveCenter,Ue=Le.elevation?Le.elevation.getMinElevationBelowMSL()*Re:0,qe=(Le._camera.position[2]*Le.worldSize-Ue)/Math.cos(Le._pitch),Ct=Math.sin(Oe)*qe/Math.sin(Math.max(Math.PI/2-Le._pitch-Oe,.01));let Ot=Math.sin(Le._pitch)*Ct+qe;const Jt=qe*(1/Le._horizonShift);return Le.elevation&&0!==Le.elevation.exaggeration()||(Ot*=1+Math.max(Le.zoom-17,0)),Math.min(1.01*Ot,Jt)}function yd(Le,Re){if(!Re.isReprojectedInTileSpace)return{scale:1<<Le.z,x:Le.x,y:Le.y,x2:Le.x+1,y2:Le.y+1,projection:Re};const Oe=Math.pow(2,-Le.z),Ue=Le.x*Oe,qe=(Le.x+1)*Oe,Ct=Le.y*Oe,Ot=(Le.y+1)*Oe,Jt=cl(Ue),_i=cl(qe),xi=hl(Ct),vi=hl(Ot),bi=Re.project(Jt,xi),Pi=Re.project(_i,xi),Hr=Re.project(_i,vi),Jr=Re.project(Jt,vi);let Ln=Math.min(bi.x,Pi.x,Hr.x,Jr.x),Nn=Math.min(bi.y,Pi.y,Hr.y,Jr.y),Gn=Math.max(bi.x,Pi.x,Hr.x,Jr.x),qn=Math.max(bi.y,Pi.y,Hr.y,Jr.y);const Zn=Oe/16;function v(Le,Oe,Ue,qe,Ct,Ot){const Jt=(Ue+Ct)/2,_i=(qe+Ot)/2,xi=Re.project(cl(Jt),hl(_i)),vi=Math.max(0,Ln-xi.x,Nn-xi.y,xi.x-Gn,xi.y-qn);Ln=Math.min(Ln,xi.x),Gn=Math.max(Gn,xi.x),Nn=Math.min(Nn,xi.y),qn=Math.max(qn,xi.y),vi>Zn&&(v(Le,xi,Ue,qe,Jt,_i),v(xi,Oe,Jt,_i,Ct,Ot))}v(bi,Pi,Ue,Ct,qe,Ct),v(Pi,Hr,qe,Ct,qe,Ot),v(Hr,Jr,qe,Ot,Ue,Ot),v(Jr,bi,Ue,Ot,Ue,Ct),Ln-=Zn,Nn-=Zn,Gn+=Zn,qn+=Zn;const $n=1/Math.max(Gn-Ln,qn-Nn);return{scale:$n,x:Ln*$n,y:Nn*$n,x2:Gn*$n,y2:qn*$n,projection:Re}}function gd(Le,{x:Re,y:Oe},Ue=0){return new ta(((Re-Ue)*Le.scale-Le.x)*ud,(Oe*Le.scale-Le.y)*ud)}const iy=as.mat4.identity(new Float32Array(16));class bd{constructor(Le){this.spec=Le,this.name=Le.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(Le,Re){return{x:0,y:0,z:0}}unproject(Le,Re){return new rl(0,0)}projectTilePoint(Le,Re,Oe){return{x:Le,y:Re,z:0}}locationPoint(Le,Re,Oe=!0){return Le._coordinatePoint(Le.locationCoordinate(Re),Oe)}pixelsPerMeter(Le,Re){return ul(1,Le)*Re}pixelSpaceConversion(Le,Re,Oe){return 1}farthestPixelDistance(Le){return md(Le,Le.pixelsPerMeter)}pointCoordinate(Le,Re,Oe,Ue){const qe=Le.horizonLineFromTop(!1),Ct=new ta(Re,Math.max(qe,Oe));return Le.rayIntersectionCoordinate(Le.pointRayIntersection(Ct,Ue))}pointCoordinate3D(Le,Re,Oe){const Ue=new ta(Re,Oe);if(Le.elevation)return Le.elevation.pointCoordinate(Ue);{const Re=this.pointCoordinate(Le,Ue.x,Ue.y,0);return[Re.x,Re.y,Re.z]}}isPointAboveHorizon(Le,Re){if(Le.elevation&&Le.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(Le,Re.x,Re.y);const Oe=Le.horizonLineFromTop();return Re.y<Oe}createInversionMatrix(Le,Re){return iy}createTileMatrix(Le,Re,Oe){let Ue,qe,Ct;const Ot=Oe.canonical,Jt=as.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const _i=yd(Ot,this);Ue=1,qe=_i.x+Oe.wrap*_i.scale,Ct=_i.y,as.mat4.scale(Jt,Jt,[Ue/_i.scale,Ue/_i.scale,Le.pixelsPerMeter/Re])}else Ue=Re/Le.zoomScale(Ot.z),qe=(Ot.x+Math.pow(2,Ot.z)*Oe.wrap)*Ue,Ct=Ot.y*Ue;return as.mat4.translate(Jt,Jt,[qe,Ct,0]),as.mat4.scale(Jt,Jt,[Ue/ud,Ue/ud,1]),Jt}upVector(Le,Re,Oe){return[0,0,1]}upVectorScale(Le,Re,Oe){return{metersToTile:1}}}class vd extends bd{constructor(Le){super(Le),this.range=[4,7],this.center=Le.center||[-96,37.5];const[Re,Oe]=this.parallels=Le.parallels||[29.5,45.5],Ue=Math.sin(Y(Re));this.n=(Ue+Math.sin(Y(Oe)))/2,this.c=1+Ue*(2*this.n-Ue),this.r0=Math.sqrt(this.c)/this.n}project(Le,Re){const{n:Oe,c:Ue,r0:qe}=this,Ct=Y(Le-this.center[0]),Ot=Y(Re),Jt=Math.sqrt(Ue-2*Oe*Math.sin(Ot))/Oe;return{x:Jt*Math.sin(Ct*Oe),y:Jt*Math.cos(Ct*Oe)-qe,z:0}}unproject(Le,Re){const{n:Oe,c:Ue,r0:qe}=this,Ct=qe+Re;let Ot=Math.atan2(Le,Math.abs(Ct))*Math.sign(Ct);Ct*Oe<0&&(Ot-=Math.PI*Math.sign(Le)*Math.sign(Ct));const Jt=Y(this.center[0])*Oe;Ot=et(Ot,-Math.PI-Jt,Math.PI-Jt);const _i=Q(Z(Ot/Oe)+this.center[0],-180,180),xi=Math.asin(Q((Ue-(Le*Le+Ct*Ct)*Oe*Oe)/(2*Oe),-1,1)),vi=Q(Z(xi),-dm,dm);return new rl(_i,vi)}}const sy=1.340264,ly=-.081106,my=893e-6,zy=.003796,Gy=Math.sqrt(3)/2;class Id extends bd{project(Le,Re){Re=Re/180*Math.PI,Le=Le/180*Math.PI;const Oe=Math.asin(Gy*Math.sin(Re)),Ue=Oe*Oe,qe=Ue*Ue*Ue;return{x:.5*(Le*Math.cos(Oe)/(Gy*(sy+3*ly*Ue+qe*(7*my+9*zy*Ue)))/Math.PI+.5),y:1-.5*(Oe*(sy+ly*Ue+qe*(my+zy*Ue))/Math.PI+1),z:0}}unproject(Le,Re){Le=(2*Le-.5)*Math.PI;
vendor: 4,303 bytes, line 1
1let Oe=Re=(2*(1-Re)-1)*Math.PI,Ue=Oe*Oe,qe=Ue*Ue*Ue;for(let Le,Ct,Ot,Jt=0;Jt<12&&(Ct=Oe*(sy+ly*Ue+qe*(my+zy*Ue))-Re,Ot=sy+3*ly*Ue+qe*(7*my+9*zy*Ue),Le=Ct/Ot,Oe=Q(Oe-Le,-Math.PI/3,Math.PI/3),Ue=Oe*Oe,qe=Ue*Ue*Ue,!(Math.abs(Le)<1e-12));++Jt);const Ct=Gy*Le*(sy+3*ly*Ue+qe*(7*my+9*zy*Ue))/Math.cos(Oe),Ot=Math.asin(Math.sin(Oe)/Gy),Jt=Q(180*Ct/Math.PI,-180,180),_i=Q(180*Ot/Math.PI,-dm,dm);return new rl(Jt,_i)}}class Pd extends bd{constructor(Le){super(Le),this.wrap=!0,this.supportsWorldCopies=!0}project(Le,Re){return{x:.5+Le/360,y:.5-Re/360,z:0}}unproject(Le,Re){const Oe=360*(Le-.5),Ue=Q(360*(.5-Re),-dm,dm);return new rl(Oe,Ue)}}const Zy=Math.PI/2;function kd(Le){return Math.tan((Zy+Le)/2)}class Td extends bd{constructor(Le){super(Le),this.center=Le.center||[0,30];const[Re,Oe]=this.parallels=Le.parallels||[30,30];let Ue=Y(Re),qe=Y(Oe);this.southernCenter=Ue+qe<0,this.southernCenter&&(Ue=-Ue,qe=-qe);const Ct=Math.cos(Ue),Ot=kd(Ue);this.n=Ue===qe?Math.sin(Ue):Math.log(Ct/Math.cos(qe))/Math.log(kd(qe)/Ot),this.f=Ct*Math.pow(kd(Ue),this.n)/this.n}project(Le,Re){Re=Y(Re),this.southernCenter&&(Re=-Re),Le=Y(Le-this.center[0]);const Oe=1e-6,{n:Ue,f:qe}=this;qe>0?Re<-Zy+Oe&&(Re=-Zy+Oe):Re>Zy-Oe&&(Re=Zy-Oe);const Ct=qe/Math.pow(kd(Re),Ue);let Ot=Ct*Math.sin(Ue*Le),Jt=qe-Ct*Math.cos(Ue*Le);return Ot=.5*(Ot/Math.PI+.5),Jt=.5*(Jt/Math.PI+.5),{x:Ot,y:this.southernCenter?Jt:1-Jt,z:0}}unproject(Le,Re){Le=(2*Le-.5)*Math.PI,this.southernCenter&&(Re=1-Re),Re=(2*(1-Re)-.5)*Math.PI;const{n:Oe,f:Ue}=this,qe=Ue-Re,Ct=Math.sign(qe),Ot=Math.sign(Oe)*Math.sqrt(Le*Le+qe*qe);let Jt=Math.atan2(Le,Math.abs(qe))*Ct;qe*Oe<0&&(Jt-=Math.PI*Math.sign(Le)*Ct);const _i=Q(Z(Jt/Oe)+this.center[0],-180,180),xi=Q(Z(2*Math.atan(Math.pow(Ue/Ot,1/Oe))-Zy),-dm,dm);return new rl(_i,this.southernCenter?-xi:xi)}}class Ed extends bd{constructor(Le){super(Le),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(Le,Re){return{x:ol(Le),y:ll(Re),z:0}}unproject(Le,Re){const Oe=cl(Le),Ue=hl(Re);return new rl(Oe,Ue)}}const $y=Y(dm);class Vd extends bd{project(Le,Re){const Oe=(Re=Y(Re))*Re,Ue=Oe*Oe;return{x:.5*((Le=Y(Le))*(.8707-.131979*Oe+Ue*(Ue*(.003971*Oe-.001529*Ue)-.013791))/Math.PI+.5),y:1-.5*(Re*(1.007226+Oe*(.015085+Ue*(.028874*Oe-.044475-.005916*Ue)))/Math.PI+1),z:0}}unproject(Le,Re){Le=(2*Le-.5)*Math.PI;let Oe=Re=(2*(1-Re)-1)*Math.PI,Ue=25,qe=0,Ct=Oe*Oe;do{Ct=Oe*Oe;const Le=Ct*Ct;qe=(Oe*(1.007226+Ct*(.015085+Le*(.028874*Ct-.044475-.005916*Le)))-Re)/(1.007226+Ct*(.045255+Le*(.259866*Ct-.311325-.005916*11*Le))),Oe=Q(Oe-qe,-$y,$y)}while(Math.abs(qe)>1e-6&&--Ue>0);Ct=Oe*Oe;const Ot=Q(Z(Le/(.8707+Ct*(Ct*(Ct*Ct*Ct*(.003971-.001529*Ct)-.013791)-.131979))),-180,180),Jt=Z(Oe);return new rl(Ot,Jt)}}const Wy=Y(dm);class Rd extends bd{project(Le,Re){Re=Y(Re),Le=Y(Le);const Oe=Math.cos(Re),Ue=2/Math.PI,qe=Math.acos(Oe*Math.cos(Le/2)),Ct=Math.sin(qe)/qe,Ot=.5*(Le*Ue+2*Oe*Math.sin(Le/2)/Ct)||0,Jt=.5*(Re+Math.sin(Re)/Ct)||0;return{x:.5*(Ot/Math.PI+.5),y:1-.5*(Jt/Math.PI+1),z:0}}unproject(Le,Re){let Oe=Le=(2*Le-.5)*Math.PI,Ue=Re=(2*(1-Re)-1)*Math.PI,qe=25;const Ct=1e-6;let Ot=0,Jt=0;do{const qe=Math.cos(Ue),Ct=Math.sin(Ue),_i=2*Ct*qe,xi=Ct*Ct,vi=qe*qe,bi=Math.cos(Oe/2),Pi=Math.sin(Oe/2),Hr=2*bi*Pi,Jr=Pi*Pi,Ln=1-vi*bi*bi,Nn=Ln?1/Ln:0,Gn=Ln?Math.acos(qe*bi)*Math.sqrt(1/Ln):0,qn=.5*(2*Gn*qe*Pi+2*Oe/Math.PI)-Le,Zn=.5*(Gn*Ct+Ue)-Re,$n=.5*Nn*(vi*Jr+Gn*qe*bi*xi)+1/Math.PI,Xn=Nn*(Hr*_i/4-Gn*Ct*Pi),Yn=.125*Nn*(_i*Pi-Gn*Ct*vi*Hr),lo=.5*Nn*(xi*bi+Gn*Jr*qe)+.5,uo=Xn*Yn-lo*$n;Ot=(Zn*Xn-qn*lo)/uo,Jt=(qn*Yn-Zn*$n)/uo,Oe=Q(Oe-Ot,-Math.PI,Math.PI),Ue=Q(Ue-Jt,-Wy,Wy)}while((Math.abs(Ot)>Ct||Math.abs(Jt)>Ct)&&--qe>0);return new rl(Z(Oe),Z(Ue))}}class Dd extends bd{constructor(Le){super(Le),this.center=Le.center||[0,0],this.parallels=Le.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Y(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(Le,Re){const{scale:Oe,cosPhi:Ue}=this;return{x:Y(Le)*Ue*Oe+.5,y:-Math.sin(Y(Re))/Ue*Oe+.5,z:0}}unproject(Le,Re){const{scale:Oe,cosPhi:Ue}=this,qe=-(Re-.5)/Oe,Ct=Q(Z((Le-.5)/Oe)/Ue,-180,180),Ot=Math.asin(Q(qe*Ue,-1,1)),Jt=Q(Z(Ot),-dm,dm);return new rl(Ct,Jt)}}
1class Ld extends Ed{constructor(Le){super(Le),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(Le,Re,Oe){const Ue=zu(Le,Re,Oe),qe=Eu(_u(Oe));return as.vec3.transformMat4(Ue,Ue,qe),{x:Ue[0],y:Ue[1],z:Ue[2]}}locationPoint(Le,Re){const Oe=Qo(Re.lat,Re.lng),Ue=as.vec3.normalize([],Oe),qe=Le.elevation?Le.elevation.getAtPointOrZero(Le.locationCoordinate(Re),Le._centerAltitude):Le._centerAltitude,Ct=ul(1,0)*ud*qe;as.vec3.scaleAndAdd(Oe,Oe,Ue,Ct);const Ot=as.mat4.identity(new Float64Array(16));return as.mat4.multiply(Ot,Le.pixelMatrix,Le.globeMatrix),as.vec3.transformMat4(Oe,Oe,Ot),new ta(Oe[0],Oe[1])}pixelsPerMeter(Le,Re){return ul(1,0)*Re}pixelSpaceConversion(Le,Re,Oe){const Ue=ul(1,Le)*Re,qe=ke(ul(1,45)*Re,Ue,Oe);return this.pixelsPerMeter(Le,Re)/qe}createTileMatrix(Le,Re,Oe){const Ue=Bu(_u(Oe.canonical));return as.mat4.multiply(new Float64Array(16),Le.globeMatrix,Ue)}createInversionMatrix(Le,Re){const{center:Oe}=Le,Ue=Eu(_u(Re));return as.mat4.rotateY(Ue,Ue,Y(Oe.lng)),as.mat4.rotateX(Ue,Ue,Y(Oe.lat)),as.mat4.scale(Ue,Ue,[Le._pixelsPerMercatorPixel,Le._pixelsPerMercatorPixel,1]),Float32Array.from(Ue)}pointCoordinate(Le,Re,Oe,Ue){return bu(Le,Re,Oe,!0)||new xl(0,0)}pointCoordinate3D(Le,Re,Oe){const Ue=this.pointCoordinate(Le,Re,Oe,0);return[Ue.x,Ue.y,Ue.z]}isPointAboveHorizon(Le,Re){return!bu(Le,Re.x,Re.y,!1)}farthestPixelDistance(Le){const Re=function(Le,Re){const Oe=Le.cameraToCenterDistance,Ue=Le._centerAltitude*Re,qe=Le._camera,Ct=Le._camera.forward(),Ot=as.vec3.add([],as.vec3.scale([],Ct,-Oe),[0,0,Ue]),Jt=Le.worldSize/(2*Math.PI),_i=[0,0,-Jt],xi=Le.width/Le.height,vi=Math.tan(Le.fovAboveCenter),bi=as.vec3.scale([],qe.up(),vi),Pi=as.vec3.scale([],qe.right(),vi*xi),Hr=as.vec3.normalize([],as.vec3.add([],as.vec3.add([],Ct,bi),Pi)),Jr=[];let Ln;if(new uu(Ot,Hr).closestPointOnSphere(_i,Jt,Jr)){const Re=as.vec3.add([],Jr,_i),Oe=as.vec3.sub([],Re,Ot);Ln=Math.cos(Le.fovAboveCenter)*as.vec3.length(Oe)}else{const Le=as.vec3.sub([],Ot,_i),Re=as.vec3.sub([],_i,Ot);as.vec3.normalize(Re,Re);const Oe=as.vec3.length(Le)-Jt;Ln=Math.sqrt(Oe*(Oe+2*Jt));const Ue=Math.acos(Ln/(Jt+Oe))-Math.acos(as.vec3.dot(Ct,Re));Ln*=Math.cos(Ue)}return 1.01*Ln}(Le,this.pixelsPerMeter(Le.center.lat,Le.worldSize)),Oe=Du(Le.zoom);if(Oe>0){const Ue=md(Le,ul(1,Le.center.lat)*Le.worldSize),qe=Le.worldSize/(2*Math.PI),Ct=Math.max(Le.width,Le.height)/Le.worldSize*Math.PI;return ke(Re,Ue+qe*(1-Math.cos(Ct)),Math.pow(Oe,10))}return Re}upVector(Le,Re,Oe){return zu(Re,Oe,Le,1)}upVectorScale(Le){return{metersToTile:gu(ku(_u(Le)))}}}function Fd(Le){const Re=Le.parallels,Oe=!!Re&&Math.abs(Re[0]+Re[1])<.01;switch(Le.name){case"mercator":return new Ed(Le);case"equirectangular":return new Pd(Le);case"naturalEarth":return new Vd(Le);case"equalEarth":return new Id(Le);case"winkelTripel":return new Rd(Le);case"albers":return Oe?new Dd(Le):new vd(Le);case"lambertConformalConic":return Oe?new Dd(Le):new Td(Le);case"globe":return new Ld(Le)}throw new Error(`Invalid projection name: ${Le.name}`)}const Xy=A_.VectorTileFeature.types,Yy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];
vendor: 3,184 bytes, line 1
1function jd(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi){const Hr=Jt?Math.min(Yg,Math.round(Jt[0])):0,Jr=Jt?Math.min(Yg,Math.round(Jt[1])):0;Le.emplaceBack(Re,Oe,Math.round(32*Ue),Math.round(32*qe),Ct,Ot,(Hr<<1)+(_i?1:0),Jr,16*xi,16*vi,256*bi,256*Pi)}function Nd(Le,Re,Oe){Le.emplaceBack(Re,Oe)}function qd(Le,Re,Oe,Ue,qe,Ct,Ot){Le.emplaceBack(Re,Oe,Ue,qe,Ct,Ot)}function $d(Le,Re,Oe,Ue,qe){Le.emplaceBack(Re,Oe,Ue,qe),Le.emplaceBack(Re,Oe,Ue,qe),Le.emplaceBack(Re,Oe,Ue,qe),Le.emplaceBack(Re,Oe,Ue,qe)}function Gd(Le){for(const Re of Le.sections)if(vs(Re.text))return!0;return!1}class Xd{constructor(Le){this.layoutVertexArray=new za,this.indexArray=new Da,this.programConfigurations=Le,this.segments=new co,this.dynamicLayoutVertexArray=new Ma,this.opacityVertexArray=new Ta,this.placedSymbolArray=new Ja,this.iconTransitioningVertexArray=new Ea,this.globeExtVertexArray=new ka,this.zOffsetVertexArray=new Oa}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(Le,Re,Oe,Ue,qe){this.isEmpty()||(Oe&&(this.layoutVertexBuffer=Le.createVertexBuffer(this.layoutVertexArray,eg.members),this.indexBuffer=Le.createIndexBuffer(this.indexArray,Re),this.dynamicLayoutVertexBuffer=Le.createVertexBuffer(this.dynamicLayoutVertexArray,rg.members,!0),this.opacityVertexBuffer=Le.createVertexBuffer(this.opacityVertexArray,Yy,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=Le.createVertexBuffer(this.iconTransitioningVertexArray,og.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=Le.createVertexBuffer(this.globeExtVertexArray,tg.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||qe)&&(this.zOffsetVertexBuffer=Le.createVertexBuffer(this.zOffsetVertexArray,ng.members,!0)),this.opacityVertexBuffer.itemSize=1),(Oe||Ue)&&this.programConfigurations.upload(Le))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}os(Xd,"SymbolBuffers");class Yd{constructor(Le,Re,Oe){this.layoutVertexArray=new Le,this.layoutAttributes=Re,this.indexArray=new Oe,this.segments=new co,this.collisionVertexArray=new Ra,this.collisionVertexArrayExt=new Ma}upload(Le){this.layoutVertexBuffer=Le.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=Le.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=Le.createVertexBuffer(this.collisionVertexArray,sg.members,!0),this.collisionVertexBufferExt=Le.createVertexBuffer(this.collisionVertexArrayExt,ag.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
1stroy())}}os(Yd,"CollisionBuffers");class Zd{constructor(Le){this.collisionBoxArray=Le.collisionBoxArray,this.zoom=Le.zoom,this.lut=Le.lut,this.overscaling=Le.overscaling,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.index=Le.index,this.pixelRatio=Le.pixelRatio,this.sourceLayerIndex=Le.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=as.mat4.identity([]),this.placementViewportMatrix=as.mat4.identity([]);const Re=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Xp(this.zoom,Re["text-size"]),this.iconSizeData=Xp(this.zoom,Re["icon-size"]);const Oe=this.layers[0].layout,Ue=Oe.get("symbol-sort-key"),qe=Oe.get("symbol-z-order");this.canOverlap=Oe.get("text-allow-overlap")||Oe.get("icon-allow-overlap")||Oe.get("text-ignore-placement")||Oe.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==qe&&void 0!==Ue.constantOr(1),this.sortFeaturesByY=("viewport-y"===qe||"auto"===qe&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=Oe.get("text-writing-mode").map((Le=>Cg[Le])),this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id)),this.sourceID=Le.sourceID,this.projection=Le.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=Oe.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new Xd(new Fo(this.layers,{zoom:this.zoom,lut:this.lut},(Le=>Le.startsWith("text")||Le.startsWith("symbol")))),this.icon=new Xd(new Fo(this.layers,{zoom:this.zoom,lut:this.lut},(Le=>Le.startsWith("icon")||Le.startsWith("symbol")))),this.glyphOffsetArray=new eo,this.lineVertexArray=new ro,this.symbolInstances=new to}calculateGlyphDependencies(Le,Re,Oe,Ue,qe){for(let Oe=0;Oe<Le.length;Oe++){const Ct=Le.codePointAt(Oe);if(void 0===Ct)break;if(Re[Ct]=!0,Ue&&qe&&Ct<=65535){const Ue=xg[Le.charAt(Oe)];Ue&&(Re[Ue.charCodeAt(0)]=!0)}}}updateFootprints(Le,Re){}updateReplacement(Le,Re){if(Re.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=Re.updateTime;const Oe=Re.getReplacementRegionsForTile(Le.toUnwrapped(),!0);return!wh(this.activeReplacements,Oe)&&(this.activeReplacements=Oe,!0)}populate(Le,Re,Oe,Ue){const qe=this.layers[0],Ct=qe.layout,Ot="globe"===this.projection.name,Jt=Ct.get("text-font"),_i=Ct.get("text-field"),xi=Ct.get("icon-image"),vi=("constant"!==_i.value.kind||_i.value.value instanceof Qe&&!_i.value.value.isEmpty()||_i.value.value.toString().length>0)&&("constant"!==Jt.value.kind||Jt.value.value.length>0),bi="constant"!==xi.value.kind||!!xi.value.value||Object.keys(xi.parameters).length>0,Pi=Ct.get("symbol-sort-key");if(this.features=[],!vi&&!bi)return;const Hr=Re.iconDependencies,Jr=Re.glyphDependencies,Ln=Re.availableImages,Nn=new Vs(this.zoom);for(const{feature:Re,id:_i,index:xi,sourceLayerIndex:Gn}of Le){const Le=qe._featureFilter.needGeometry,qn=Pl(Re,Le);if(!qe._featureFilter.filter(Nn,qn,Oe))continue;if(Le||(qn.geometry=Il(Re,Oe,Ue)),Ot&&1!==Re.type&&Oe.z<=5){const Le=qn.geometry,Re=.98078528056,n=(Le,Ue)=>{const qe=zu(Le.x,Le.y,Oe,1),Ct=zu(Ue.x,Ue.y,Oe,1);return as.vec3.dot(qe,Ct)<Re};for(let Re=0;Re<Le.length;Re++)Le[Re]=_l(Le[Re],n)}let Zn,$n;if(vi){const Le=qe.getValueAndResolveTokens("text-field",qn,Oe,Ln),Re=Qe.factory(Le);Gd(Re)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Ts()||this.hasRTLText&&Np.isParsed())&&(Zn=Hp(Re,qe,qn))}if(bi){const Le=qe.getValueAndResolveTokens("icon-image",qn,Oe,Ln);$n=Le instanceof tr?Le:tr.fromString(Le)}if(!Zn&&!$n)continue;const Xn=this.sortFeaturesByKey?Pi.evaluate(qn,{},Oe):void 0;if(this.features.push({id:_i,text:Zn,icon:$n,index:xi,sourceLayerIndex:Gn,geometry:qn.geometry,properties:Re.properties,type:Xy[Re.type],sortKey:Xn}),$n&&(Hr[$n.namePrimary]=!0,$n.nameSecondary&&(Hr[$n.nameSecondary]=!0)),Zn){const Le=Jt.evaluate(qn,{},Oe).join(","),Re="map"===Ct.get("text-rotation-alignment")&&"point"!==Ct.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Cg.vertical)>=0;for(const Oe of Zn.sections)if(Oe.image)Hr[Oe.image.namePrimary]=!0;else{const Ue=fs(Zn.toString()),qe=Oe.fontStack||Le,Ct=Jr[qe]=Jr[qe]||{};this.calculateGlyphDependencies(Oe.text,Ct,Re,this.allowVerticalPlacement,Ue)}}}"line"===Ct.get("symbol-placement")&&(this.features=function(Le){const Re={},Oe={},Ue=[];let qe=0;function s(Re){Ue.push(Le[Re]),qe++}function a(Le,Re,qe){const Ct=Oe[Le];return delete Oe[Le],Oe[Re]=Ct,Ue[Ct].geometry[0].pop(),Ue[Ct].geometry[0]=Ue[Ct].geometry[0].concat(qe[0]),Ct}function o(Le,Oe,qe){const Ct=Re[Oe];return delete Re[Oe],Re[Le]=Ct,Ue[Ct].geometry[0].shift(),Ue[Ct].geometry[0]=qe[0].concat(Ue[Ct].geometry[0]),Ct}function l(Le,Re,Oe){const Ue=Oe?Re[0][Re[0].length-1]:Re[0][0];return`${Le}:${Ue.x}:${Ue.y}`}for(let Ct=0;Ct<Le.length;Ct++){const Ot=Le[Ct],Jt=Ot.geometry,_i=Ot.text?Ot.text.toString():null;
vendor: 11,729 bytes, line 1
1if(!_i){s(Ct);continue}const xi=l(_i,Jt),vi=l(_i,Jt,!0);if(xi in Oe&&vi in Re&&Oe[xi]!==Re[vi]){const Le=o(xi,vi,Jt),qe=a(xi,vi,Ue[Le].geometry);delete Re[xi],delete Oe[vi],Oe[l(_i,Ue[qe].geometry,!0)]=qe,Ue[Le].geometry=null}else xi in Oe?a(xi,vi,Jt):vi in Re?o(xi,vi,Jt):(s(Ct),Re[xi]=qe-1,Oe[vi]=qe-1)}return Ue.filter((Le=>Le.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((Le,Re)=>Le.sortKey-Re.sortKey))}update(Le,Re,Oe,Ue,qe){const Ct=0!==Object.keys(Le).length;if(Ct&&!this.stateDependentLayers.length)return;const Ot=Ct?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(Le,Re,Ot,Oe,Ue,qe),this.icon.programConfigurations.updatePaintArrays(Le,Re,Ot,Oe,Ue,qe)}updateZOffset(){const t=(Re,Oe,Ue)=>{Le+=Oe,Le>Re.length&&Re.resize(Le);for(let qe=-Oe;qe<0;qe++)Re.emplace(qe+Le,Ue)},e=(Le,Oe,Ue)=>{Re+=Oe,Re>Le.length&&Le.resize(Re);for(let qe=-Oe;qe<0;qe++)Le.emplace(qe+Re,Ue)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let Le=0,Re=0;for(let Le=0;Le<this.symbolInstances.length;Le++){const Re=this.symbolInstances.get(Le),{numHorizontalGlyphVertices:Oe,numVerticalGlyphVertices:Ue,numIconVertices:qe}=Re,Ct=Re.zOffset,Ot=qe>0;if((Oe>0||Ue>0)&&(t(this.text.zOffsetVertexArray,Oe,Ct),t(this.text.zOffsetVertexArray,Ue,Ct)),Ot){const{placedIconSymbolIndex:Le,verticalPlacedIconSymbolIndex:Oe}=Re;Le>=0&&e(this.icon.zOffsetVertexArray,qe,Ct),Oe>=0&&e(this.icon.zOffsetVertexArray,Re.numVerticalIconVertices,Ct)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(Le){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(Le),this.iconCollisionBox.upload(Le)),this.text.upload(Le,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(Le,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Fd(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(Le,Re){const Oe=this.lineVertexArray.length;if(void 0!==Le.segment)for(const{x:Le,y:Oe}of Re)this.lineVertexArray.emplaceBack(Le,Oe);return{lineStartIndex:Oe,lineLength:this.lineVertexArray.length-Oe}}addSymbols(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln){const Nn=Le.indexArray,Gn=Le.layoutVertexArray,qn=Le.globeExtVertexArray,Zn=Le.segments.prepareSegment(4*Re.length,Gn,Nn,this.canOverlap?Ct.sortKey:void 0),$n=this.glyphOffsetArray.length,Xn=Zn.vertexLength,Yn=this.allowVerticalPlacement&&Ot===Cg.vertical?Math.PI/2:0,lo=Ct.text&&Ct.text.sections;for(let Ue=0;Ue<Re.length;Ue++){const{tl:qe,tr:Ot,bl:xi,br:vi,texPrimary:bi,texSecondary:$n,pixelOffsetTL:Xn,pixelOffsetBR:uo,minFontScaleX:po,minFontScaleY:fo,glyphOffset:Io,isSDF:is,sectionIndex:as}=Re[Ue],Is=Zn.vertexLength,Xs=Io[1];if(jd(Gn,_i.x,_i.y,qe.x,Xs+qe.y,bi.x,bi.y,Oe,is,Xn.x,Xn.y,po,fo),jd(Gn,_i.x,_i.y,Ot.x,Xs+Ot.y,bi.x+bi.w,bi.y,Oe,is,uo.x,Xn.y,po,fo),jd(Gn,_i.x,_i.y,xi.x,Xs+xi.y,bi.x,bi.y+bi.h,Oe,is,Xn.x,uo.y,po,fo),jd(Gn,_i.x,_i.y,vi.x,Xs+vi.y,bi.x+bi.w,bi.y+bi.h,Oe,is,uo.x,uo.y,po,fo),Jt){const{x:Re,y:Oe,z:Ue}=Jt.anchor,[qe,Ct,Ot]=Jt.up;qd(qn,Re,Oe,Ue,qe,Ct,Ot),qd(qn,Re,Oe,Ue,qe,Ct,Ot),qd(qn,Re,Oe,Ue,qe,Ct,Ot),qd(qn,Re,Oe,Ue,qe,Ct,Ot),$d(Le.dynamicLayoutVertexArray,Re,Oe,Ue,Yn)}else $d(Le.dynamicLayoutVertexArray,_i.x,_i.y,_i.z,Yn);if(Ln){const Re=$n||bi;Nd(Le.iconTransitioningVertexArray,Re.x,Re.y),Nd(Le.iconTransitioningVertexArray,Re.x+Re.w,Re.y),Nd(Le.iconTransitioningVertexArray,Re.x,Re.y+Re.h),Nd(Le.iconTransitioningVertexArray,Re.x+Re.w,Re.y+Re.h)}Nn.emplaceBack(Is,Is+1,Is+2),Nn.emplaceBack(Is+1,Is+2,Is+3),Zn.vertexLength+=4,Zn.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Io[0]),Ue!==Re.length-1&&as===Re[Ue+1].sectionIndex||Le.programConfigurations.populatePaintArrays(Gn.length,Ct,Ct.index,{},Pi,Hr,Jr,lo&&lo[as])}const uo=Jt?Jt.anchor:_i;Le.placedSymbolArray.emplaceBack(uo.x,uo.y,uo.z,_i.x,_i.y,$n,this.glyphOffsetArray.length-$n,Xn,xi,vi,_i.segment,Oe?Oe[0]:0,Oe?Oe[1]:0,Ue[0],Ue[1],Ot,0,!1,0,bi,0)}_commitLayoutVertex(Le,Re,Oe,Ue,qe,Ct,Ot){Le.emplaceBack(Re,Oe,Ue,qe,Ct,Math.round(Ot.x),Math.round(Ot.y))}_addCollisionDebugVertices(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=Oe.segments.prepareSegment(4,Oe.layoutVertexArray,Oe.indexArray),_i=Jt.vertexLength,xi=Ot.tileAnchorX,vi=Ot.tileAnchorY;for(let Le=0;Le<4;Le++)Oe.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(Oe.collisionVertexArrayExt,Re,Le.padding,Ot.zOffset),this._commitLayoutVertex(Oe.layoutVertexArray,Ue,qe,Ct,xi,vi,new ta(Le.x1,Le.y1)),this._commitLayoutVertex(Oe.layoutVertexArray,Ue,qe,Ct,xi,vi,new ta(Le.x2,Le.y1)),this._commitLayoutVertex(Oe.layoutVertexArray,Ue,qe,Ct,xi,vi,new ta(Le.x2,Le.y2)),this._commitLayoutVertex(Oe.layoutVertexArray,Ue,qe,Ct,xi,vi,new ta(Le.x1,Le.y2)),Jt.vertexLength+=4;const bi=Oe.indexArray;bi.emplaceBack(_i,_i+1),bi.emplaceBack(_i+1,_i+2),bi.emplaceBack(_i+2,_i+3),bi.emplaceBack(_i+3,_i),Jt.primitiveLength+=4}_addTextDebugCollisionBoxes(Le,Re,Oe,Ue,qe,Ct){for(let Ot=Ue;Ot<qe;Ot++){const Ue=Oe.get(Ot),qe=this.getSymbolInstanceTextSize(Le,Ct,Re,Ot);this._addCollisionDebugVertices(Ue,qe,this.textCollisionBox,Ue.projectedAnchorX,Ue.projectedAnchorY,Ue.projectedAnchorZ,Ct)}}_addIconDebugCollisionBoxes(Le,Re,Oe,Ue,qe,Ct){for(let Ot=Ue;Ot<qe;Ot++){const Ue=Oe.get(Ot),qe=this.getSymbolInstanceIconSize(Le,Re,Ct.placedIconSymbolIndex);this._addCollisionDebugVertices(Ue,qe,this.iconCollisionBox,Ue.projectedAnchorX,Ue.projectedAnchorY,Ue.projectedAnchorZ,Ct)}}generateCollisionDebugBuffers(Le,Re){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Yd(Va,lg.members,Ea),this.iconCollisionBox=new Yd(Va,lg.members,Ea);const Oe=Zp(this.iconSizeData,Le),Ue=Zp(this.textSizeData,Le);for(let qe=0;qe<this.symbolInstances.length;qe++){const Ct=this.symbolInstances.get(qe);this._addTextDebugCollisionBoxes(Ue,Le,Re,Ct.textBoxStartIndex,Ct.textBoxEndIndex,Ct),this._addTextDebugCollisionBoxes(Ue,Le,Re,Ct.verticalTextBoxStartIndex,Ct.verticalTextBoxEndIndex,Ct),this._addIconDebugCollisionBoxes(Oe,Le,Re,Ct.iconBoxStartIndex,Ct.iconBoxEndIndex,Ct),this._addIconDebugCollisionBoxes(Oe,Le,Re,Ct.verticalIconBoxStartIndex,Ct.verticalIconBoxEndIndex,Ct)}}getSymbolInstanceTextSize(Le,Re,Oe,Ue){const qe=this.text.placedSymbolArray.get(Re.rightJustifiedTextSymbolIndex>=0?Re.rightJustifiedTextSymbolIndex:Re.centerJustifiedTextSymbolIndex>=0?Re.centerJustifiedTextSymbolIndex:Re.leftJustifiedTextSymbolIndex>=0?Re.leftJustifiedTextSymbolIndex:Re.verticalPlacedTextSymbolIndex>=0?Re.verticalPlacedTextSymbolIndex:Ue),Ct=Yp(this.textSizeData,Le,qe)/pg;return this.tilePixelRatio*Ct}getSymbolInstanceIconSize(Le,Re,Oe){const Ue=this.icon.placedSymbolArray.get(Oe),qe=Yp(this.iconSizeData,Le,Ue);return this.tilePixelRatio*qe}_commitDebugCollisionVertexUpdate(Le,Re,Oe,Ue){Le.emplaceBack(Re,-Oe,-Oe,Ue),Le.emplaceBack(Re,Oe,-Oe,Ue),Le.emplaceBack(Re,Oe,Oe,Ue),Le.emplaceBack(Re,-Oe,Oe,Ue)}_updateTextDebugCollisionBoxes(Le,Re,Oe,Ue,qe,Ct){for(let Ot=Ue;Ot<qe;Ot++){const Ue=Oe.get(Ot),qe=this.getSymbolInstanceTextSize(Le,Ct,Re,Ot);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,qe,Ue.padding,Ct.zOffset)}}_updateIconDebugCollisionBoxes(Le,Re,Oe,Ue,qe,Ct){for(let Ot=Ue;Ot<qe;Ot++){const Ue=Oe.get(Ot),qe=this.getSymbolInstanceIconSize(Le,Re,Ct.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,qe,Ue.padding,Ct.zOffset)}}updateCollisionDebugBuffers(Le,Re){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const Oe=Zp(this.iconSizeData,Le),Ue=Zp(this.textSizeData,Le);for(let qe=0;qe<this.symbolInstances.length;qe++){const Ct=this.symbolInstances.get(qe);this._updateTextDebugCollisionBoxes(Ue,Le,Re,Ct.textBoxStartIndex,Ct.textBoxEndIndex,Ct),this._updateTextDebugCollisionBoxes(Ue,Le,Re,Ct.verticalTextBoxStartIndex,Ct.verticalTextBoxEndIndex,Ct),this._updateIconDebugCollisionBoxes(Oe,Le,Re,Ct.iconBoxStartIndex,Ct.iconBoxEndIndex,Ct),this._updateIconDebugCollisionBoxes(Oe,Le,Re,Ct.verticalIconBoxStartIndex,Ct.verticalIconBoxEndIndex,Ct)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi={};if(Re<Oe){const{x1:Oe,y1:Ue,x2:qe,y2:Ct,padding:Ot,projectedAnchorX:Jt,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi,featureIndex:Hr}=Le.get(Re);xi.textBox={x1:Oe,y1:Ue,x2:qe,y2:Ct,padding:Ot,projectedAnchorX:Jt,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi},xi.textFeatureIndex=Hr}if(Ue<qe){const{x1:Re,y1:Oe,x2:qe,y2:Ct,padding:Ot,projectedAnchorX:Jt,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi,featureIndex:Hr}=Le.get(Ue);xi.verticalTextBox={x1:Re,y1:Oe,x2:qe,y2:Ct,padding:Ot,projectedAnchorX:Jt,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi},xi.verticalTextFeatureIndex=Hr}if(Ct<Ot){const{x1:Re,y1:Oe,x2:Ue,y2:qe,padding:Ot,projectedAnchorX:Jt,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi,featureIndex:Hr}=Le.get(Ct);xi.iconBox={x1:Re,y1:Oe,x2:Ue,y2:qe,padding:Ot,projectedAnchorX:Jt,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi},xi.iconFeatureIndex=Hr}if(Jt<_i){const{x1:Re,y1:Oe,x2:Ue,y2:qe,padding:Ct,projectedAnchorX:Ot,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi,featureIndex:Hr}=Le.get(Jt);xi.verticalIconBox={x1:Re,y1:Oe,x2:Ue,y2:qe,padding:Ct,projectedAnchorX:Ot,projectedAnchorY:_i,projectedAnchorZ:vi,tileAnchorX:bi,tileAnchorY:Pi},xi.verticalIconFeatureIndex=Hr}return xi}deserializeCollisionBoxes(Le){this.collisionArrays=[];for(let Re=0;Re<this.symbolInstances.length;Re++){const Oe=this.symbolInstances.get(Re);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(Le,Oe.textBoxStartIndex,Oe.textBoxEndIndex,Oe.verticalTextBoxStartIndex,Oe.verticalTextBoxEndIndex,Oe.iconBoxStartIndex,Oe.iconBoxEndIndex,Oe.verticalIconBoxStartIndex,Oe.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(Le,Re){const Oe=Le.placedSymbolArray.get(Re),Ue=Oe.vertexStartIndex+4*Oe.numGlyphs;for(let Re=Oe.vertexStartIndex;Re<Ue;Re+=4)Le.indexArray.emplaceBack(Re,Re+1,Re+2),Le.indexArray.emplaceBack(Re+1,Re+2,Re+3)}
vendor: 5,663 bytes, line 1
1getSortedSymbolIndexes(Le){if(this.sortedAngle===Le&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const Re=Math.sin(Le),Oe=Math.cos(Le),Ue=[],qe=[],Ct=[];for(let Le=0;Le<this.symbolInstances.length;++Le){Ct.push(Le);const Ot=this.symbolInstances.get(Le);Ue.push(0|Math.round(Re*Ot.tileAnchorX+Oe*Ot.tileAnchorY)),qe.push(Ot.featureIndex)}return Ct.sort(((Le,Re)=>Ue[Le]-Ue[Re]||qe[Re]-qe[Le])),Ct}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let Le=0;Le<this.symbolInstances.length;++Le)this.symbolInstanceIndexesSortedZOffset.push(Le)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort(((Le,Re)=>this.symbolInstances.get(Re).zOffset-this.symbolInstances.get(Le).zOffset))}addToSortKeyRanges(Le,Re){const Oe=this.sortKeyRanges[this.sortKeyRanges.length-1];Oe&&Oe.sortKey===Re?Oe.symbolInstanceEnd=Le+1:this.sortKeyRanges.push({sortKey:Re,symbolInstanceStart:Le,symbolInstanceEnd:Le+1})}sortFeatures(Le){if(this.sortFeaturesByY&&this.sortedAngle!==Le&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(Le),this.sortedAngle=Le,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const Le of this.symbolInstanceIndexes){const Re=this.symbolInstances.get(Le);this.featureSortOrder.push(Re.featureIndex);const{rightJustifiedTextSymbolIndex:Oe,centerJustifiedTextSymbolIndex:Ue,leftJustifiedTextSymbolIndex:qe,verticalPlacedTextSymbolIndex:Ct,placedIconSymbolIndex:Ot,verticalPlacedIconSymbolIndex:Jt}=Re;Oe>=0&&this.addIndicesForPlacedSymbol(this.text,Oe),Ue>=0&&Ue!==Oe&&this.addIndicesForPlacedSymbol(this.text,Ue),qe>=0&&qe!==Ue&&qe!==Oe&&this.addIndicesForPlacedSymbol(this.text,qe),Ct>=0&&this.addIndicesForPlacedSymbol(this.text,Ct),Ot>=0&&this.addIndicesForPlacedSymbol(this.icon,Ot),Jt>=0&&this.addIndicesForPlacedSymbol(this.icon,Jt)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Jy,Ky,Qy;os(Zd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Zd.addDynamicAttributes=$d;class Jd{constructor(Le){this.type=Le.property.overrides?Le.property.overrides.runtimeType:ou,this.defaultValue=Le}evaluate(Le){if(Le.formattedSection){const Re=this.defaultValue.property.overrides;if(Re&&Re.hasOverride(Le.formattedSection))return Re.getOverride(Le.formattedSection)}return Le.feature&&Le.featureState?this.defaultValue.evaluate(Le.feature,Le.featureState):this.defaultValue.property.specification.default}eachChild(Le){this.defaultValue.isConstant()||Le(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}os(Jd,"FormatSectionOverride",{omit:["defaultValue"]});const Qd=()=>Qy||(Qy={layout:Jy||(Jy=new Gs({"symbol-placement":new Ns(Vp.layout_symbol["symbol-placement"]),"symbol-spacing":new Ns(Vp.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ns(Vp.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new qs(Vp.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ns(Vp.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ns(Vp.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new Ns(Vp.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ns(Vp.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ns(Vp.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ns(Vp.layout_symbol["icon-rotation-alignment"]),"icon-size":new qs(Vp.layout_symbol["icon-size"]),"icon-text-fit":new qs(Vp.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qs(Vp.layout_symbol["icon-text-fit-padding"]),"icon-image":new qs(Vp.layout_symbol["icon-image"]),"icon-rotate":new qs(Vp.layout_symbol["icon-rotate"]),"icon-padding":new Ns(Vp.layout_symbol["icon-padding"]),"icon-keep-upright":new Ns(Vp.layout_symbol["icon-keep-upright"]),"icon-offset":new qs(Vp.layout_symbol["icon-offset"]),"icon-anchor":new qs(Vp.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ns(Vp.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ns(Vp.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ns(Vp.layout_symbol["text-rotation-alignment"]),"text-field":new qs(Vp.layout_symbol["text-field"]),"text-font":new qs(Vp.layout_symbol["text-font"]),"text-size":new qs(Vp.layout_symbol["text-size"]),"text-max-width":new qs(Vp.layout_symbol["text-max-width"]),"text-line-height":new qs(Vp.layout_symbol["text-line-height"]),"text-letter-spacing":new qs(Vp.layout_symbol["text-letter-spacing"]),"text-justify":new qs(Vp.layout_symbol["text-justify"]),"text-radial-offset":new qs(Vp.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ns(Vp.layout_symbol["text-variable-anchor"]),"text-anchor":new qs(Vp.layout_symbol["text-anchor"]),"text-max-angle":new Ns(Vp.layout_symbol["text-max-angle"]),"text-writing-mode":new Ns(Vp.layout_symbol["text-writing-mode"]),"text-rotate":new qs(Vp.layout_symbol["text-rotate"]),"text-padding":new Ns(Vp.layout_symbol["text-padding"]),"text-keep-upright":new Ns(Vp.layout_symbol["text-keep-upright"]),"text-transform":new qs(Vp.layout_symbol["text-transform"]),"text-offset":new qs(Vp.layout_symbol["text-offset"]),"text-allow-overlap":new Ns(Vp.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ns(Vp.layout_symbol["text-ignore-placement"]),"text-optional":new Ns(Vp.layout_symbol["text-optional"]),visibility:new Ns(Vp.layout_symbol.visibility)}
vendor: 22,314 bytes, line 1
1)),paint:Ky||(Ky=new Gs({"icon-opacity":new qs(Vp.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new qs(Vp.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new qs(Vp.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new qs(Vp.paint_symbol["text-emissive-strength"]),"icon-color":new qs(Vp.paint_symbol["icon-color"]),"icon-halo-color":new qs(Vp.paint_symbol["icon-halo-color"]),"icon-halo-width":new qs(Vp.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qs(Vp.paint_symbol["icon-halo-blur"]),"icon-translate":new Ns(Vp.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ns(Vp.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new qs(Vp.paint_symbol["icon-image-cross-fade"]),"text-opacity":new qs(Vp.paint_symbol["text-opacity"]),"text-occlusion-opacity":new qs(Vp.paint_symbol["text-occlusion-opacity"]),"text-color":new qs(Vp.paint_symbol["text-color"],{runtimeType:xu,getOverride:Le=>Le.textColor,hasOverride:Le=>!!Le.textColor}),"text-halo-color":new qs(Vp.paint_symbol["text-halo-color"]),"text-halo-width":new qs(Vp.paint_symbol["text-halo-width"]),"text-halo-blur":new qs(Vp.paint_symbol["text-halo-blur"]),"text-translate":new Ns(Vp.paint_symbol["text-translate"]),"text-translate-anchor":new Ns(Vp.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ns(Vp.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ns(Vp.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ns(Vp.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ns(Vp.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new qs(Vp.paint_symbol["symbol-z-offset"]),"symbol-elevation-reference":new Ns(Vp.paint_symbol["symbol-elevation-reference"])}))},Qy);class tm extends pa{constructor(Le,Re,Oe,Ue){super(Le,Qd(),Re,Oe,Ue),this._colorAdjustmentMatrix=as.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==Le.paint&&("icon-occlusion-opacity"in Le.paint||"text-occlusion-opacity"in Le.paint)}recalculate(Le,Re){super.recalculate(Le,Re),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const Oe=this.layout.get("text-writing-mode");if(Oe){const Le=[];for(const Re of Oe)Le.indexOf(Re)<0&&Le.push(Re);this.layout._values["text-writing-mode"]=Le}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(Le,Re,Oe,Ue){return this._saturation===Le&&this._contrast===Re&&this._brightnessMin===Oe&&this._brightnessMax===Ue||(this._colorAdjustmentMatrix=function(Le,Re,Oe,Ue){Le=St(Le),Re=At(Re);const qe=as.mat4.create(),Ct=Le/3,Ot=1-2*Ct,Jt=[Ot,Ct,Ct,0,Ct,Ot,Ct,0,Ct,Ct,Ot,0,0,0,0,1],_i=.5-.5*Re,xi=Ue-Oe;return as.mat4.multiply(qe,[xi,0,0,0,0,xi,0,0,0,0,xi,0,Oe,Oe,Oe,1],[Re,0,0,0,0,Re,0,0,0,0,Re,0,_i,_i,_i,1]),as.mat4.multiply(qe,qe,Jt),qe}(Le,Re,Oe,Ue),this._saturation=Le,this._contrast=Re,this._brightnessMin=Oe,this._brightnessMax=Ue),this._colorAdjustmentMatrix}getValueAndResolveTokens(Le,Re,Oe,Ue){const qe=this.layout.get(Le).evaluate(Re,{},Oe,Ue),Ct=this._unevaluatedLayout._values[Le];return Ct.isDataDriven()||Wi(Ct.value)||!qe?qe:function(Le,Re){return Re.replace(/{([^{}]+)}/g,((Re,Oe)=>Oe in Le?String(Le[Oe]):""))}(Re.properties,qe)}createBucket(Le){return new Zd(Le)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const Le of Qd().paint.overridableProperties){if(!tm.hasPaintOverride(this.layout,Le))continue;const Re=this.paint.get(Le),Oe=new Jd(Re),Ue=new Zi(Oe,Re.property.specification,this.scope,this.options);let qe=null;qe="constant"===Re.value.kind||"source"===Re.value.kind?new Ki("source",Ue):new Ji("composite",Ue,Re.value.zoomStops,Re.value._interpolationType),this.paint._values[Le]=new Us(Re.property,qe,Re.parameters)}}_handleOverridablePaintPropertyUpdate(Le,Re,Oe){return!(!this.layout||Re.isDataDriven()||Oe.isDataDriven())&&tm.hasPaintOverride(this.layout,Le)}static hasPaintOverride(Le,Re){const Oe=Le.get("text-field"),Ue=Qd().paint.properties[Re];let qe=!1;const s=Le=>{for(const Re of Le)if(Ue.overrides&&Ue.overrides.hasOverride(Re))return void(qe=!0)};if("constant"===Oe.value.kind&&Oe.value.value instanceof Qe)s(Oe.value.value.sections);else if("source"===Oe.value.kind){const t=Le=>{qe||(Le instanceof sr&&nr(Le.value)===Uu?s(Le.value.sections):Le instanceof ur?s(Le.sections):Le.eachChild(t))},Le=Oe.value;Le._styleExpression&&t(Le._styleExpression.expression)}return qe}getProgramIds(){return["symbol"]}getDefaultProgramParams(Le,Re,Oe){return{config:new Lo(this,{zoom:Re,lut:Oe}),overrideFog:!1}}}let cx,mx,_x,Tx;var Mx=ya([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function am(Le){switch(Le){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function om(Le){switch(Le){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class lm{constructor(Le,Re,Oe,Ue){this.context=Le,this.format=Oe,this.useMipmap=Ue&&Ue.useMipmap,this.texture=Le.gl.createTexture(),this.update(Re,{premultiply:Ue&&Ue.premultiply})}update(Le,Re){const Oe=Le&&Le instanceof HTMLVideoElement&&0===Le.width?Le.videoWidth:Le.width,Ue=Le&&Le instanceof HTMLVideoElement&&0===Le.height?Le.videoHeight:Le.height,{context:qe}=this,{gl:Ct}=qe,{x:Ot,y:Jt}=Re&&Re.position?Re.position:{x:0,y:0},_i=Math.max(Ot+Oe,this.size?this.size[0]:0),xi=Math.max(Jt+Ue,this.size?this.size[1]:0);!this.size||this.size[0]===_i&&this.size[1]===xi||(Ct.bindTexture(Ct.TEXTURE_2D,null),Ct.deleteTexture(this.texture),this.texture=Ct.createTexture(),this.size=null),Ct.bindTexture(Ct.TEXTURE_2D,this.texture),qe.pixelStoreUnpackFlipY.set(!1),qe.pixelStoreUnpack.set(1),qe.pixelStoreUnpackPremultiplyAlpha.set(this.format===Ct.RGBA8&&(!Re||!1!==Re.premultiply));const vi=Le instanceof HTMLImageElement||Le instanceof HTMLCanvasElement||Le instanceof HTMLVideoElement||Le instanceof ImageData||ImageBitmap&&Le instanceof ImageBitmap;if(!this.size&&_i>0&&xi>0){const Le=this.useMipmap?Math.floor(Math.log2(Math.max(_i,xi)))+1:1;Ct.texStorage2D(Ct.TEXTURE_2D,Le,this.format,_i,xi),this.size=[_i,xi]}if(this.size)if(vi)Ct.texSubImage2D(Ct.TEXTURE_2D,0,Ot,Jt,am(this.format),om(this.format),Le);else{const Re=Le.data;Re&&Ct.texSubImage2D(Ct.TEXTURE_2D,0,Ot,Jt,Oe,Ue,am(this.format),om(this.format),Re)}this.useMipmap&&Ct.generateMipmap(Ct.TEXTURE_2D)}bind(Le,Re,Oe=!1){const{context:Ue}=this,{gl:qe}=Ue;qe.bindTexture(qe.TEXTURE_2D,this.texture),Le!==this.minFilter&&(qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_MAG_FILTER,Le),qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_MIN_FILTER,this.useMipmap&&!Oe?Le===qe.NEAREST?qe.NEAREST_MIPMAP_NEAREST:qe.LINEAR_MIPMAP_LINEAR:Le),this.minFilter=Le),Re!==this.wrapS&&(qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_WRAP_S,Re),qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_WRAP_T,Re),this.wrapS=Re)}bindExtraParam(Le,Re,Oe,Ue){const{context:qe}=this,{gl:Ct}=qe;Ct.bindTexture(Ct.TEXTURE_2D,this.texture),Re!==this.magFilter&&(Ct.texParameteri(Ct.TEXTURE_2D,Ct.TEXTURE_MAG_FILTER,Re),this.magFilter=Re),Le!==this.minFilter&&(Ct.texParameteri(Ct.TEXTURE_2D,Ct.TEXTURE_MIN_FILTER,this.useMipmap?Le===Ct.NEAREST?Ct.NEAREST_MIPMAP_NEAREST:Ct.LINEAR_MIPMAP_LINEAR:Le),this.minFilter=Le),Oe!==this.wrapS&&(Ct.texParameteri(Ct.TEXTURE_2D,Ct.TEXTURE_WRAP_S,Oe),this.wrapS=Oe),Ue!==this.wrapT&&(Ct.texParameteri(Ct.TEXTURE_2D,Ct.TEXTURE_WRAP_T,Ue),this.wrapT=Ue)}destroy(){const{gl:Le}=this.context;Le.deleteTexture(this.texture),this.texture=null}}class um{constructor(Le,Re){this.context=Le,this.texture=Re}bind(Le,Re){const{context:Oe}=this,{gl:Ue}=Oe;Ue.bindTexture(Ue.TEXTURE_2D,this.texture),Le!==this.minFilter&&(Ue.texParameteri(Ue.TEXTURE_2D,Ue.TEXTURE_MAG_FILTER,Le),Ue.texParameteri(Ue.TEXTURE_2D,Ue.TEXTURE_MIN_FILTER,Le),this.minFilter=Le),Re!==this.wrapS&&(Ue.texParameteri(Ue.TEXTURE_2D,Ue.TEXTURE_WRAP_S,Re),Ue.texParameteri(Ue.TEXTURE_2D,Ue.TEXTURE_WRAP_T,Re),this.wrapS=Re)}}function cm(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=[Le,Re,1,Oe,Ue,1,qe,Ct,1],xi=[Ot,Jt,1],vi=as.mat3.adjoint([],_i),[bi,Pi,Hr]=as.vec3.transformMat3(xi,xi,vi);return as.mat3.multiply(_i,_i,[bi,0,0,0,Pi,0,0,0,Hr])}function hm(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=cm(0,0,1,0,1,1,0,1),xi=cm(Le,Re,Oe,Ue,qe,Ct,Ot,Jt),vi=as.mat3.adjoint([],_i);return as.mat3.multiply(xi,xi,vi)}(Le,Re,Oe,Ue,qe,Ct,Ot,Jt);return[_i[2]/_i[8]/ud,_i[5]/_i[8]/ud]}function pm(Le){return[Le[0],Math.min(Math.max(Le[1],-dm),dm)]}class fm extends Me{constructor(Le,Re,Oe,Ue){super(),this.id=Le,this.dispatcher=Oe,this.coordinates=Re.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(Ue),this.options=Re,this._dirty=!1}load(Le,Re){if(this._loaded=Re||!1,this.fire(new be("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return Le&&(this.coordinates=Le),this._loaded=!0,void this._finishLoading();this._imageRequest=ce(this.map._requestManager.transformRequest(this.url,ih.Image),((Re,Oe)=>{this._imageRequest=null,this._loaded=!0,Re?this.fire(new ve(Re)):Oe&&(this.image=Oe instanceof HTMLImageElement?Oc.getImageData(Oe):Oe,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,Le&&(this.coordinates=Le),this._finishLoading())}))}loaded(){return this._loaded}updateImage(Le){return Le.url?(this._imageRequest&&Le.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=Le.url,this.load(Le.coordinates,this._loaded),this):this}setTexture(Le){if(!(Le.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new um(this.map.painter.context,Le.handle),this.width=Le.dimensions[0],this.height=Le.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new be("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(Le){this.map=Le,this.load()}onRemove(Le){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof um||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(Le){if(this.coordinates=Le,this._boundsArray=void 0,this._unsupportedCoords=!1,!Le.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let Re=Le[0][1],Oe=Le[0][1];for(const Ue of Le)Ue[1]>Oe&&(Oe=Ue[1]),Ue[1]<Re&&(Re=Ue[1]);const Ue=(Oe+Re)/2;if(Ue>dm?this.onNorthPole=!0:Ue<-dm&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const Re=Le.map(xl.fromLngLat);this.tileID=function(Le){let Re=1/0,Oe=1/0,Ue=-1/0,qe=-1/0;for(const Ct of Le)Re=Math.min(Re,Ct.x),Oe=Math.min(Oe,Ct.y),Ue=Math.max(Ue,Ct.x),qe=Math.max(qe,Ct.y);const Ct=Math.max(Ue-Re,qe-Oe),Ot=Math.max(0,Math.floor(-Math.log(Ct)/Math.LN2)),Jt=Math.pow(2,Ot);let _i=Math.floor((Re+Ue)/2*Jt);return _i>1&&(_i-=1),new tu(Ot,_i,Math.floor((Oe+qe)/2*Jt))}(Re),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new be("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(Le){for(const Le in this.tiles){const Re=this.tiles[Le];"loaded"!==Re.state&&(Re.state="loaded",Re.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const Re=yd(new tu(0,0,0),this.map.transform.projection),Oe=[Re.projection.project(this.coordinates[0][0],this.coordinates[0][1]),Re.projection.project(this.coordinates[1][0],this.coordinates[1][1]),Re.projection.project(this.coordinates[2][0],this.coordinates[2][1]),Re.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(Le){const Re=Le[1].x-Le[0].x,Oe=Le[1].y-Le[0].y,Ue=Le[2].x-Le[1].x,qe=Le[2].y-Le[1].y,Ct=Le[3].x-Le[2].x,Ot=Le[3].y-Le[2].y,Jt=Le[0].x-Le[3].x,_i=Le[0].y-Le[3].y,xi=Re*qe-Ue*Oe,vi=Ue*Ot-Ct*qe,bi=Ct*_i-Jt*Ot,Pi=Jt*Oe-Re*_i;return xi>0&&vi>0&&bi>0&&Pi>0||xi<0&&vi<0&&bi<0&&Pi<0}(Oe))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const Ue=yd(this.tileID,this.map.transform.projection),[qe,Ct,Ot,Jt]=this.coordinates.map((Le=>{const Re=Ue.projection.project(Le[0],Le[1]);return gd(Ue,Re)._round()}));this.perspectiveTransform=hm(qe.x,qe.y,Ct.x,Ct.y,Ot.x,Ot.y,Jt.x,Jt.y);const _i=this._boundsArray=new va;_i.emplaceBack(qe.x,qe.y,0,0),_i.emplaceBack(Ct.x,Ct.y,ud,0),_i.emplaceBack(Jt.x,Jt.y,0,ud),_i.emplaceBack(Ot.x,Ot.y,ud,ud),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=Le.createVertexBuffer(_i,Mx.members),this.boundsSegments=co.simpleSegment(0,0,4,2);const xi=[],vi=[pm((bi=this.coordinates)[0]),pm(bi[1]),pm(bi[2]),pm(bi[3])];var bi;const[Pi,Hr,Jr,Ln]=function(Le){let Re=Le[0][0],Oe=Re,Ue=Le[0][1],qe=Ue;for(let Ct=1;Ct<Le.length;Ct++)Le[Ct][0]<Re?Re=Le[Ct][0]:Le[Ct][0]>Oe&&(Oe=Le[Ct][0]),Le[Ct][1]<Ue?Ue=Le[Ct][1]:Le[Ct][1]>qe&&(qe=Le[Ct][1]);return[Re,Ue,Oe-Re,qe-Ue]}(vi);{const Ue=new va,[qe,Ct,Ot,Jt]=function(Le){let Re=Le[0].x,Oe=Re,Ue=Le[0].y,qe=Ue;for(let Ct=1;Ct<Le.length;Ct++)Le[Ct].x<Re?Re=Le[Ct].x:Le[Ct].x>Oe&&(Oe=Le[Ct].x),Le[Ct].y<Ue?Ue=Le[Ct].y:Le[Ct].y>qe&&(qe=Le[Ct].y);return[Re,Ue,Oe-Re,qe-Ue]}(Oe),l=Le=>[(Le.x-qe)/Ot,(Le.y-Ct)/Jt],[_i,vi,bi,Nn]=Oe.map(l),Gn=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=cm(0,0,1,0,1,1,0,1),xi=cm(Le,Re,Oe,Ue,qe,Ct,Ot,Jt),vi=as.mat3.adjoint([],xi);return as.mat3.multiply(_i,_i,vi)}(_i[0],_i[1],vi[0],vi[1],bi[0],bi[1],Nn[0],Nn[1]);this.elevatedGlobePerspectiveTransform=hm(_i[0],_i[1],vi[0],vi[1],bi[0],bi[1],Nn[0],Nn[1]);const b=(Le,Re)=>{xi.push(Le.lng);const Oe=Math.round((Le.lng-Pi)/Jr*ud),qe=Math.round((Le.lat-Hr)/Ln*ud),Ct=l(Re),Ot=as.vec3.transformMat3([],[Ct[0],Ct[1],1],Gn),Jt=Math.round(Ot[0]/Ot[2]*ud),_i=Math.round(Ot[1]/Ot[2]*ud);Ue.emplaceBack(Oe,qe,Jt,_i)},qn=Oe[3].x-Oe[0].x,Zn=Oe[3].y-Oe[0].y,$n=Oe[2].x-Oe[1].x,Xn=Oe[2].y-Oe[1].y;for(let Le=0;Le<65;Le++){const Ue=Le/64,qe=[Oe[0].x+Ue*qn,Oe[0].y+Ue*Zn],Ct=[Oe[1].x+Ue*$n,Oe[1].y+Ue*Xn],Ot=Ct[0]-qe[0],Jt=Ct[1]-qe[1];for(let Le=0;Le<65;Le++){const Oe=Le/64,Ue={x:qe[0]+Ot*Oe,y:qe[1]+Jt*Oe,z:0};b(Re.projection.unproject(Ue.x,Ue.y),Ue)}}this.elevatedGlobeVertexBuffer=Le.createVertexBuffer(Ue,Mx.members)}{this.maxLongitudeTriangleSize=0;let Re=[],Oe=new Da;const n=(Le,Ue,qe)=>{Oe.emplaceBack(Le,Ue,qe);const Ct=xi[Le],Ot=xi[Ue],Jt=xi[qe],_i=Math.min(Math.min(Ct,Ot),Jt),vi=Math.max(Math.max(Ct,Ot),Jt)-_i;vi>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=vi),Re.push(_i+vi/2)};for(let Le=0;Le<64;Le++)for(let Re=0;Re<64;Re++){const Oe=65*Le+Re,Ue=Oe+1,qe=Oe+65,Ct=qe+1;n(Oe,qe,Ue),n(Ue,qe,Ct)}[Re,Oe]=function(Le,Re){const Oe=Array.from({length:Le.length},((Le,Re)=>Re));Oe.sort(((Re,Oe)=>Le[Re]-Le[Oe]));const Ue=[],qe=new Da;for(let Ct=0;Ct<Oe.length;Ct++){const Ot=Oe[Ct];Ue.push(Le[Ot]);const Jt=3*Ot,_i=Jt+1;qe.emplaceBack(Re.uint16[Jt],Re.uint16[_i],Re.uint16[_i+1])}return[Ue,qe]}(Re,Oe),this.elevatedGlobeTrianglesCenterLongitudes=Re,this.elevatedGlobeIndexBuffer=Le.createIndexBuffer(Oe)}this.elevatedGlobeSegments=co.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,Jr/ud,0,Ln/ud,0,0,Hr,Pi,0])}prepare(){const Le=0!==Object.keys(this.tiles).length;if(this.tileID&&!Le)return;const Re=this.map.painter.context,Oe=Re.gl;!this._dirty||this.texture instanceof um||(this.texture?this.texture.update(this.image):(this.texture=new lm(Re,this.image,Oe.RGBA8),this.texture.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE)),this._dirty=!1),Le&&this._prepareData(Re)}loadTile(Le,Re){this.tileID&&this.tileID.equals(Le.tileID.canonical)?(this.tiles[String(Le.tileID.wrap)]=Le,Le.buckets={},Re(null)):(Le.state="errored",Re(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(Le){const Re=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!Re)return null;const Oe=this.elevatedGlobeTrianglesCenterLongitudes;let Ue=(qe=Le+180)+360*Math.round((Oe[0]-qe)/360);var qe;const Ct=new co,a=(Le,Oe)=>{Ct.segments.push({vertexOffset:0,primitiveOffset:Le,vertexLength:Re.segments[0].vertexLength,primitiveLength:Oe,sortKey:void 0,vaos:{}})},Ot=.51*this.maxLongitudeTriangleSize;if(Math.abs(Oe[0]-Ue)<=Ot){const Le=Mt(Oe,0,Oe.length,Ue+Ot);return Le===Oe.length||a(Le,_t(Oe,Le+1,Oe.length,Ue+360-Ot)-Le),Ct}Ue<Oe[0]&&(Ue+=360);const Jt=_t(Oe,0,Oe.length,Ue-Ot);if(Jt===Oe.length)return a(0,Oe.length),Ct;a(0,Jt-0);const _i=Mt(Oe,Jt+1,Oe.length,Ue+Ot);return _i!==Oe.length&&a(_i,Oe.length-_i),Ct}}const Sx=(Math.pow(256,2)-1)/16907520;class mm extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:_x||(_x=new Gs({visibility:new Ns(Vp.layout_raster.visibility)})),paint:Tx||(Tx=new Gs({"raster-opacity":new Ns(Vp.paint_raster["raster-opacity"]),"raster-color":new $s(Vp.paint_raster["raster-color"]),"raster-color-mix":new Ns(Vp.paint_raster["raster-color-mix"]),"raster-color-range":new Ns(Vp.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ns(Vp.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ns(Vp.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ns(Vp.paint_raster["raster-brightness-max"]),"raster-saturation":new Ns(Vp.paint_raster["raster-saturation"]),"raster-contrast":new Ns(Vp.paint_raster["raster-contrast"]),"raster-resampling":new Ns(Vp.paint_raster["raster-resampling"]),"raster-fade-duration":new Ns(Vp.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ns(Vp.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ns(Vp.paint_raster["raster-array-band"]),"raster-elevation":new Ns(Vp.paint_raster["raster-elevation"])}))},Re,Oe,Ue),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(Le){return!(Le&&Le._source instanceof fm&&(Le._source.onNorthPole||Le._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(Le){"raster-color"!==Le&&"raster-color-range"!==Le||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(Le){if(!this.hasColorMap())return;if(!this._curRampRange)return;const Re=this._transitionablePaint._values["raster-color"].value.expression,[Oe,Ue]=Le||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(Oe)&&isNaN(Ue)||Oe===this._curRampRange[0]&&Ue===this._curRampRange[1]||(this.colorRamp=ac({expression:Re,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:Oe,end:Ue}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[Oe,Ue])}}let Ex,Ax,Ix,Cx,Px;class wm extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:Ex||(Ex=new Gs({visibility:new Ns(Vp["layout_raster-particle"].visibility)})),paint:Ax||(Ax=new Gs({"raster-particle-array-band":new Ns(Vp["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ns(Vp["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new $s(Vp["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ns(Vp["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ns(Vp["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ns(Vp["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ns(Vp["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Ns(Vp["paint_raster-particle"]["raster-particle-elevation"])}))},Re,Oe,Ue),this._updateColorRamp(),this.lastInvalidatedAt=Oc.now()}onRemove(Le){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(Le){return!1}_handleSpecialPaintPropertyUpdate(Le){"raster-particle-color"!==Le&&"raster-particle-max-speed"!==Le||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===Le&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const Le=this._transitionablePaint._values["raster-particle-color"].value.expression,Re=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=ac({expression:Le,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:Re}],resolution:256}),this.colorRampTexture=null}
1_invalidateAnimationState(){this.lastInvalidatedAt=Oc.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class _m extends pa{constructor(Le,Re){super(Le,{},Re,null),this.implementation=Le,Le.slot&&(this.slot=Le.slot)}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(Le){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(Le){this.implementation.onAdd&&this.implementation.onAdd(Le,Le.painter.context.gl)}onRemove(Le){this.implementation.onRemove&&this.implementation.onRemove(Le,Le.painter.context.gl)}}function Mm(Le,Re,Oe){const Ue=[0,0,1],qe=as.quat.identity([]);return as.quat.rotateY(qe,qe,Oe?-Y(Le)+Math.PI:Y(Le)),as.quat.rotateX(qe,qe,-Y(Re)),as.vec3.transformQuat(Ue,Ue,qe),as.vec3.normalize(Ue,Ue)}function Am(Le,Re){const Oe=Im(Le.projection,Le.zoom,Le.width,Le.height),Ue=function(Le,Re,Oe,Ue,qe){const Ct=new rl(Oe.lng-180*zx,Oe.lat),Ot=new rl(Oe.lng+180*zx,Oe.lat),Jt=Le.project(Ct.lng,Ct.lat),_i=Le.project(Ot.lng,Ot.lat),xi=-Math.atan2(_i.y-Jt.y,_i.x-Jt.x),vi=xl.fromLngLat(Oe);vi.y=Q(vi.y,-1+zx,1-zx);const bi=vi.toLngLat(),Pi=Le.project(bi.lng,bi.lat),Hr=xl.fromLngLat(bi);Hr.x+=zx;const Jr=Hr.toLngLat(),Ln=Le.project(Jr.lng,Jr.lat),Nn=km(Ln.x-Pi.x,Ln.y-Pi.y,xi),Gn=xl.fromLngLat(bi);Gn.y+=zx;const qn=Gn.toLngLat(),Zn=Le.project(qn.lng,qn.lat),$n=km(Zn.x-Pi.x,Zn.y-Pi.y,xi),Xn=Math.abs(Nn.x)/Math.abs($n.y),Yn=as.mat4.identity([]);as.mat4.rotateZ(Yn,Yn,-xi*(1-(qe?0:Ue)));const lo=as.mat4.identity([]);return as.mat4.scale(lo,lo,[1,1-(1-Xn)*Ue,1]),lo[4]=-$n.x/$n.y*Ue,as.mat4.rotateZ(lo,lo,xi),as.mat4.multiply(lo,Yn,lo),lo}(Le.projection,0,Le.center,Oe,Re),qe=Sm(Le);return as.mat4.scale(Ue,Ue,[qe,qe,1]),Ue}function Sm(Le){const Re=Le.projection,Oe=Im(Le.projection,Le.zoom,Le.width,Le.height),Ue=zm(Re,Le.center),qe=zm(Re,rl.convert(Re.center));return Math.pow(2,Ue*Oe+(1-Oe)*qe)}function Im(Le,Re,Oe,Ue,qe=1/0){const Ct=Le.range;if(!Ct)return 0;const Ot=Math.min(qe,Math.max(Oe,Ue)),Jt=Math.log(Ot/1024)/Math.LN2;return tt(Ct[0]+Jt,Ct[1]+Jt,Re)}const zx=1/4e4;function zm(Le,Re){const Oe=Q(Re.lat,-dm,dm),Ue=new rl(Re.lng-180*zx,Oe),qe=new rl(Re.lng+180*zx,Oe),Ct=Le.project(Ue.lng,Oe),Ot=Le.project(qe.lng,Oe),Jt=xl.fromLngLat(Ue),_i=xl.fromLngLat(qe),xi=Ot.x-Ct.x,vi=Ot.y-Ct.y,bi=_i.x-Jt.x,Pi=_i.y-Jt.y,Hr=Math.sqrt((bi*bi+Pi*Pi)/(xi*xi+vi*vi));return Math.log(Hr)/Math.LN2}function km(Le,Re,Oe){const Ue=Math.cos(Oe),qe=Math.sin(Oe);return{x:Le*Ue-Re*qe,y:Le*qe+Re*Ue}}function Tm(Le,Re,Oe){as.mat4.identity(Le),as.mat4.rotateZ(Le,Le,Y(Re[2])),as.mat4.rotateX(Le,Le,Y(Re[0])),as.mat4.rotateY(Le,Le,Y(Re[1])),as.mat4.scale(Le,Le,Oe),as.mat4.multiply(Le,Le,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Em(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=[Oe[0]-Re[0],Oe[1]-Re[1],0],xi=[Ue[0]-Re[0],Ue[1]-Re[1],0];if(as.vec3.length(_i)<1e-12||as.vec3.length(xi)<1e-12)return as.quat.identity(Le);const vi=as.vec3.cross([],_i,xi);as.vec3.normalize(vi,vi),as.vec3.subtract(xi,Ue,Re),_i[2]=(Ct-qe)*Jt,xi[2]=(Ot-qe)*Jt;const bi=_i;return as.vec3.cross(bi,_i,xi),as.vec3.normalize(bi,bi),as.quat.rotationTo(Le,vi,bi)}function Bm(Le,Re,Oe=!1){const Ue=Du(Re.zoom),qe=function(Le,Re,Oe){const Ue=Re.worldSize,qe=[Le[12],Le[13],Le[14]],Ct=hl(qe[1]/Ue),Ot=cl(qe[0]/Ue),Jt=as.mat4.identity([]),_i=ul(1,Ct)*Ue,xi=ul(1,0)*Ue*ml(Ct,Re.zoom),vi=1/Vu(Ue);let bi=xi*vi;if(Oe){const Le=Im(Re.projection,Re.zoom,Re.width,Re.height,1024);bi=vi*Re.projection.pixelSpaceConversion(Re.center.lat,Ue,Le)}const Pi=Qo(Ct,Ot);as.vec3.add(Pi,Pi,as.vec3.scale([],as.vec3.normalize([],Pi),_i*bi*qe[2]));const Hr=function(Le){const Re=[Le[0],Le[1],Le[2]];let Oe=[0,1,0];const Ue=as.vec3.cross([],Oe,Re);return as.vec3.cross(Oe,Re,Ue),0===as.vec3.squaredLength(Oe)&&(Oe=[0,1,0],as.vec3.cross(Ue,Re,Oe)),as.vec3.normalize(Ue,Ue),as.vec3.normalize(Oe,Oe),as.vec3.normalize(Re,Re),[Ue[0],Ue[1],Ue[2],0,Oe[0],Oe[1],Oe[2],0,Re[0],Re[1],Re[2],0,Le[0],Le[1],Le[2],1]}(Pi);as.mat4.scale(Jt,Jt,[bi,bi,bi*_i]),as.mat4.translate(Jt,Jt,[-qe[0],-qe[1],-qe[2]]);const Jr=as.mat4.multiply([],Re.globeMatrix,Hr);return as.mat4.multiply(Jr,Jr,Jt),as.mat4.multiply(Jr,Jr,Le),Jr}(Le,Re,Oe);if(Ue>0){const Oe=function(Le,Re){const Oe=Re.worldSize,Ue=ul(1,0)*Oe*ml(Re.center.lat,Re.zoom)/Vu(Oe),qe=ul(1,Re.center.lat)*Oe,Ct=as.mat4.identity([]);return as.mat4.rotateY(Ct,Ct,Y(Re.center.lng)),as.mat4.rotateX(Ct,Ct,Y(Re.center.lat)),as.mat4.translate(Ct,Ct,[0,0,gf]),as.mat4.scale(Ct,Ct,[Ue,Ue,Ue*qe]),as.mat4.translate(Ct,Ct,[Re.point.x-.5*Oe,Re.point.y-.5*Oe,0]),as.mat4.multiply(Ct,Ct,Le),as.mat4.multiply(Ct,Re.globeMatrix,Ct)}(Le,Re);return function(Le,Re,Oe){const n=(Le,Re,Oe)=>{const Ue=as.vec3.length(Le),qe=as.vec3.length(Re),Ct=Mu(Le,Re,Oe);return as.vec3.scale(Ct,Ct,1/as.vec3.length(Ct)*ke(Ue,qe,Oe))},Ue=n([Le[0],Le[1],Le[2]],[Re[0],Re[1],Re[2]],Oe),qe=n([Le[4],Le[5],Le[6]],[Re[4],Re[5],Re[6]],Oe),Ct=n([Le[8],Le[9],Le[10]],[Re[8],Re[9],Re[10]],Oe),Ot=Mu([Le[12],Le[13],Le[14]],[Re[12],Re[13],Re[14]],Oe);return[Ue[0],Ue[1],Ue[2],0,qe[0],qe[1],qe[2],0,Ct[0],Ct[1],Ct[2],0,Ot[0],Ot[1],Ot[2],1]}(qe,Oe,Ue)}return qe}function Vm(Le,Re,Oe,Ue){const qe=yu.projectAabbCorners(Ue,Oe);let Ct=Number.MAX_VALUE,Ot=-1;for(let Le=0;Le<qe.length;++Le){const Oe=qe[Le];Oe[0]=(.5*Oe[0]+.5)*Re.width,Oe[1]=(.5-.5*Oe[1])*Re.height,Oe[2]<Ct&&(Ot=Le,Ct=Oe[2])}const o=Le=>new ta(qe[Le][0],qe[Le][1]);let Jt;switch(Ot){case 0:case 6:Jt=[o(1),o(5),o(4),o(7),o(3),o(2),o(1)];break;case 1:case 7:Jt=[o(0),o(4),o(5),o(6),o(2),o(3),o(0)];break;case 3:case 5:Jt=[o(1),o(0),o(4),o(7),o(6),o(2),o(1)];break;default:Jt=[o(1),o(5),o(6),o(7),o(3),o(0),o(1)]}if(El(Le,Jt))return Ct}const Dx=ya([{name:"a_pos_3f",components:3,type:"Float32"}]),Lx=ya([{name:"a_color_3f",components:3,type:"Float32"}]),Rx=ya([{name:"a_color_4f",components:4,type:"Float32"}]),kx=ya([{name:"a_uv_2f",components:2,type:"Float32"}]),Ox=ya([{name:"a_normal_3f",components:3,type:"Float32"}]),Fx=ya([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Bx=ya([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),Nx={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class Nm{constructor(Le,Re,Oe,Ue){this.message=(Le?`${Le}: `:"")+Oe,Ue&&(this.identifier=Ue),null!=Re&&Re.__line__&&(this.line=Re.__line__)}}function qm(Le,Re){const Oe=-1===Le.indexOf("://");try{return new URL(Le,Oe&&Re?"http://example.com":void 0),!0}catch(Le){return!1}}class $m{constructor(Le,Re){this.feature=Le,this.instancedDataOffset=Re,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Gm{constructor(){this.instancedDataArray=new Ga,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Xm{constructor(Le){this.zoom=Le.zoom,this.canonical=Le.canonical,this.layers=Le.layers,this.layerIds=this.layers.map((Le=>Le.fqid)),this.projection=Le.projection,this.index=Le.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((Le=>Le.isStateDependent())).map((Le=>Le.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(Le,Re){}populate(Le,Re,Oe,Ue){this.tileToMeter=gl(Oe);const qe=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:Ct,id:Ot,index:Jt,sourceLayerIndex:_i}of Le){const Le=null!=Ot?Ot:Ct.properties&&Ct.properties.hasOwnProperty("id")?Ct.properties.id:void 0,xi=Pl(Ct,qe);if(!this.layers[0]._featureFilter.filter(new Vs(this.zoom),xi,Oe))continue;const vi={id:Le,sourceLayerIndex:_i,index:Jt,geometry:qe?xi.geometry:Il(Ct,Oe,Ue),properties:Ct.properties,type:Ct.type,patterns:{}},bi=this.addFeature(vi,vi.geometry,xi);bi&&Re.featureIndex.insert(Ct,vi.geometry,Jt,_i,this.index,this.instancesPerModel[b
vendor: 1,696 bytes, line 1
1i].instancedDataArray.length,ud/32)}this.lookup=null}update(Le,Re,Oe,Ue){for(const Re in this.instancesPerModel){const Oe=this.instancesPerModel[Re];for(const Re in Le)Oe.idToFeaturesIndex.hasOwnProperty(Re)&&(this.evaluate(Oe.features[Oe.idToFeaturesIndex[Re]],Le[Re],Oe,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let Le=!1;for(const Re in this.instancesPerModel){const Oe=this.instancesPerModel[Re];for(const Re of Oe.features){const Ue=this.layers[0],qe=Re.feature,Ct=this.canonical,Ot=Ue.paint.get("model-rotation").evaluate(qe,{},Ct),Jt=Ue.paint.get("model-scale").evaluate(qe,{},Ct),_i=Ue.paint.get("model-translation").evaluate(qe,{},Ct);as.vec3.exactEquals(Re.rotation,Ot)&&as.vec3.exactEquals(Re.scale,Jt)&&as.vec3.exactEquals(Re.translation,_i)||(this.evaluate(Re,Re.featureStates,Oe,!0),Le=!0)}}return Le}updateReplacement(Le,Re,Oe,Ue){if(Re.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=Re.updateTime;const qe=Re.getReplacementRegionsForTile(Le.toUnwrapped(),!0);if(wh(this.activeReplacements,qe))return!1;this.activeReplacements=qe;let Ct=!1;for(const Re in this.instancesPerModel){const qe=this.instancesPerModel[Re],Ot=qe.instancedDataArray;for(const Re of qe.features){const qe=Re.instancedDataOffset,Jt=Re.instancedDataCount;for(let Re=0;Re<Jt;Re++){const Jt=16*(Re+qe);let _i=Ot.float32[Jt+0];const xi=_i>ud;_i=xi?_i-ud:_i;const vi=Math.floor(_i),bi=Ot.float32[Jt+1];let Pi=!1;for(const Re of this.activeReplacements)if(!gh(Re,Oe,Nx.Model,Ue)&&!(Re.min.x>vi||vi>Re.max.x||Re.min.y>bi||bi>Re.max.y)&&(Pi=Ph(Ih(vi,bi,Le.canonical,Re.footprintTileId.canonical),Re.footprint),Pi
1))break;Ot.float32[Jt]=Pi?_i+ud:_i,Ct=Ct||Pi!==xi}}}return Ct}isEmpty(){for(const Le in this.instancesPerModel)if(0!==this.instancesPerModel[Le].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(Le){if(!this.uploaded)for(const Re in this.instancesPerModel){const Oe=this.instancesPerModel[Re];Oe.instancedDataArray.length<0||0===Oe.instancedDataArray.length||(Oe.instancedDataBuffer?Oe.instancedDataBuffer.updateData(Oe.instancedDataArray):Oe.instancedDataBuffer=Le.createVertexBuffer(Oe.instancedDataArray,Fx.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const Le in this.instancesPerModel){const Re=this.instancesPerModel[Le];0!==Re.instancedDataArray.length&&Re.instancedDataBuffer&&Re.instancedDataBuffer.destroy()}const Le=this.layers[0].modelManager;if(Le&&this.modelUris)for(const Re of this.modelUris)Le.removeModel(Re,"")}addFeature(Le,Re,Oe){const Ue=this.layers[0],qe=Ue.layout.get("model-id").evaluate(Oe,{},this.canonical);if(!qe)return ft(`modelId is not evaluated for layer ${Ue.id} and it is not going to get rendered.`),qe;qm(qe,!1)&&(this.modelUris.includes(qe)||this.modelUris.push(qe)),this.instancesPerModel[qe]||(this.instancesPerModel[qe]=new Gm);const Ct=this.instancesPerModel[qe],Ot=Ct.instancedDataArray,Jt=new $m(Oe,Ot.length);for(const Le of Re)for(const Re of Le){if(Re.x<0||Re.x>=ud||Re.y<0||Re.y>=ud)continue;const Le=(this.lookupDim-1)/ud,Oe=this.lookupDim*(Re.y*Le|0)+Re.x*Le|0;if(this.lookup){if(0!==this.lookup[Oe])continue;this.lookup[Oe]=1}this.instanceCount++;const Ue=Ot.length;Ot.resize(Ue+1),Ct.instancesEvaluatedElevation.push(0),Ot.float32[16*Ue]=Re.x,Ot.float32[16*Ue+1]=Re.y}return Jt.instancedDataCount=Ct.instancedDataArray.length-Jt.instancedDataOffset,Jt.instancedDataCount>0&&(Le.id&&(Ct.idToFeaturesIndex[Le.id]=Ct.features.length),Ct.features.push(Jt),this.evaluate(Jt,{},Ct,!1)),qe}getModelUris(){return this.modelUris}evaluate(Le,Re,Oe,Ue){const qe=this.layers[0],Ct=Le.feature,Ot=this.canonical,Jt=Le.rotation=qe.paint.get("model-rotation").evaluate(Ct,Re,Ot),_i=Le.scale=qe.paint.get("model-scale").evaluate(Ct,Re,Ot),xi=Le.translation=qe.paint.get("model-translation").evaluate(Ct,Re,Ot),vi=qe.paint.get("model-color").evaluate(Ct,Re,Ot);vi.a=qe.paint.get("model-color-mix-intensity").evaluate(Ct,Re,Ot);const bi=[];this.maxVerticalOffset<xi[2]&&(this.maxVerticalOffset=xi[2]),this.maxScale=Math.max(Math.max(this.maxScale,_i[0]),Math.max(_i[1],_i[2])),Tm(bi,Jt,_i);const Pi=Math.round(100*vi.a)+vi.b/1.05;for(let Re=0;Re<Le.instancedDataCount;++Re){const qe=Le.instancedDataOffset+Re,Ct=16*qe,Jt=Oe.instancedDataArray.float32;let _i=0;Ue&&(_i=Jt[Ct+6]-Oe.instancesEvaluatedElevation[qe]);const Hr=0|Jt[Ct+1];Jt[Ct]=(0|Jt[Ct])+vi.r/1.05,Jt[Ct+1]=Hr+vi.g/1.05,Jt[Ct+2]=Pi,Jt[Ct+3]=1/(Ot.z>10?this.tileToMeter:gl(Ot,Hr)),Jt[Ct+4]=xi[0],Jt[Ct+5]=xi[1],Jt[Ct+6]=xi[2]+_i,Jt[Ct+7]=bi[0],Jt[Ct+8]=bi[1],Jt[Ct+9]=bi[2],Jt[Ct+10]=bi[4],Jt[Ct+11]=bi[5],Jt[Ct+12]=bi[6],Jt[Ct+13]=bi[8],Jt[Ct+14]=bi[9],Jt[Ct+15]=bi[10],Oe.instancesEvaluatedElevation[qe]=xi[2]}}}let Vx,Ux;os(Xm,"ModelBucket",{omit:["layers"]}),os(Gm,"PerModelAttributes"),os($m,"ModelFeature");const jx=64,Gx={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapbox
vendor: 5,401 bytes, line 1
1MeshFeatures:4,HasMeshoptCompression:8};function Km(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi=!1){const vi=Oe.zoom,bi=Oe.project(Ue),Pi=ml(Ue.lat,vi),Hr=1/Pi;as.mat4.identity(Le),as.mat4.translate(Le,Le,[bi.x+Ot[0]*Hr,bi.y+Ot[1]*Hr,Ot[2]]);let Jr=1,Ln=1;const Nn=Oe.worldSize;if(xi){if("mercator"===Oe.projection.name){let Le=0;Oe.elevation&&(Le=Oe.elevation.getAtPointOrZero(new xl(bi.x/Nn,bi.y/Nn),0));const Re=as.vec4.transformMat4([],[bi.x,bi.y,Le,1],Oe.projMatrix)[3]/Oe.cameraToCenterDistance;Jr=Re,Ln=Re*ml(Oe.center.lat,vi)}else if("globe"===Oe.projection.name){const Re=Bm(Le,Oe),qe=as.mat4.multiply([],Oe.projMatrix,Re),Ct=[0,0,0,1];as.vec4.transformMat4(Ct,Ct,qe);const Ot=Ct[3]/Oe.cameraToCenterDistance,Jt=Du(vi),_i=Oe.projection.pixelsPerMeter(Ue.lat,Nn)*ml(Ue.lat,vi),xi=Oe.projection.pixelsPerMeter(Oe.center.lat,Nn)*ml(Oe.center.lat,vi);Jr=Ot/ke(_i,dl(Oe.center.lat),Jt),Ln=Ot*Pi/_i,Jr*=xi,Ln*=xi}}else Jr=Hr;as.mat4.scale(Le,Le,[Jr,Jr,Ln]);const Gn=[...Le],qn=Re.orientation,Zn=[];if(Tm(Zn,[qn[0]+qe[0],qn[1]+qe[1],qn[2]+qe[2]],Ct),as.mat4.multiply(Le,Gn,Zn),Jt&&Oe.elevation){let qe=0;const Ct=[];if(_i&&Oe.elevation){qe=function(Le,Re,Oe,Ue,qe){const Ct=Re.elevation;if(!Ct)return 0;const Ot=yu.projectAabbCorners(Oe,Ue),Jt=ul(1,qe.lat)*Re.worldSize,_i=function(Le,Re){const Oe=[0,0,1],Ue=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const qe of Ue){const Ue=Le[qe.corners[0]],Ct=Le[qe.corners[1]],Ot=Le[qe.corners[2]],Jt=[Ct[0]-Ue[0],Ct[1]-Ue[1],Re*(Ct[2]-Ue[2])],_i=as.vec3.cross(Jt,Jt,[Ot[0]-Ue[0],Ot[1]-Ue[1],Re*(Ot[2]-Ue[2])]);as.vec3.normalize(_i,_i),qe.dotProductWithUp=as.vec3.dot(_i,Oe)}return Ue.sort(((Le,Re)=>Le.dotProductWithUp-Re.dotProductWithUp)),Ue[0].corners}(Ot,Jt),xi=Ot[_i[0]],vi=Ot[_i[1]],bi=Ot[_i[2]],Pi=Ot[_i[3]],Hr=Ct.getAtPointOrZero(new xl(xi[0]/Re.worldSize,xi[1]/Re.worldSize),0),Jr=Ct.getAtPointOrZero(new xl(vi[0]/Re.worldSize,vi[1]/Re.worldSize),0),Ln=Ct.getAtPointOrZero(new xl(bi[0]/Re.worldSize,bi[1]/Re.worldSize),0),Nn=Ct.getAtPointOrZero(new xl(Pi[0]/Re.worldSize,Pi[1]/Re.worldSize),0),Gn=(Hr+Nn)/2,qn=(Jr+Ln)/2;return Gn>qn?Jr<Ln?Em(Le,vi,Pi,xi,Jr,Nn,Hr,Jt):Em(Le,bi,xi,Pi,Ln,Hr,Nn,Jt):Hr<Nn?Em(Le,xi,vi,bi,Hr,Jr,Ln,Jt):Em(Le,Pi,bi,vi,Nn,Ln,Jr,Jt),Math.max(Gn,qn)}(Ct,Oe,Re.aabb,Le,Ue);const Ot=as.mat4.fromQuat([],Ct),Jt=as.mat4.multiply([],Ot,Zn);as.mat4.multiply(Le,Gn,Jt)}else qe=Oe.elevation.getAtPointOrZero(new xl(bi.x/Nn,bi.y/Nn),0);0!==qe&&(Le[14]+=qe)}}function Jm(Le,Re,Oe=!1){Le.uploaded||(Le.gfxTexture=new lm(Re,Le.image,Oe?Re.gl.R8:Re.gl.RGBA8,{useMipmap:Le.sampler.minFilter>=Re.gl.NEAREST_MIPMAP_NEAREST}),Le.uploaded=!0,Le.image=null)}function Qm(Le,Re,Oe){Le.indexBuffer=Re.createIndexBuffer(Le.indexArray,!1,!0),Le.vertexBuffer=Re.createVertexBuffer(Le.vertexArray,Dx.members,!1,!0),Le.normalArray&&(Le.normalBuffer=Re.createVertexBuffer(Le.normalArray,Ox.members,!1,!0)),Le.texcoordArray&&(Le.texcoordBuffer=Re.createVertexBuffer(Le.texcoordArray,kx.members,!1,!0)),Le.colorArray&&(Le.colorBuffer=Re.createVertexBuffer(Le.colorArray,(12===Le.colorArray.bytesPerElement?Lx:Rx).members,!1,!0)),Le.featureArray&&(Le.pbrBuffer=Re.createVertexBuffer(Le.featureArray,Bx.members,!0)),Le.segments=co.simpleSegment(0,0,Le.vertexArray.length,Le.indexArray.length);const Ue=Le.material;Ue.pbrMetallicRoughness.baseColorTexture&&Jm(Ue.pbrMetallicRoughness.baseColorTexture,Re),Ue.pbrMetallicRoughness.metallicRoughnessTexture&&Jm(Ue.pbrMetallicRoughness.metallicRoughnessTexture,Re),Ue.normalTexture&&Jm(Ue.normalTexture,Re),Ue.occlusionTexture&&Jm(Ue.occlusionTexture,Re,Oe),Ue.emissionTexture&&Jm(Ue.emissionTexture,Re)}function ty(Le,Re,Oe){if(Le.meshes)for(const Ue of Le.meshes)Qm(Ue,Re,Oe);if(Le.children)for(const Ue of Le.children)ty(Ue,Re,Oe)}function ey(Le){if(Le.meshes)for(const Re of Le.meshes)Re.indexArray.destroy(),Re.vertexArray.destroy(),Re.colorArray&&Re.colorArray.destroy(),Re.normalArray&&Re.normalArray.destroy(),Re.texcoordArray&&Re.texcoordArray.destroy(),Re.featureArray&&Re.featureArray.destroy();if(Le.children)for(const Re of Le.children)ey(Re)}function ry(Le){if(Le.meshes)for(const Oe of Le.meshes)Oe.vertexBuffer&&(Oe.vertexBuffer.destroy(),Oe.indexBuffer.destroy(),Oe.normalBuffer&&Oe.normalBuffer.destroy(),Oe.texcoordBuffer&&Oe.texcoordBuffer.destroy(),Oe.colorBuffer&&Oe.colorBuffer.destroy(),Oe.pbrBuffer&&Oe.pbrBuffer.destroy(),Oe.segments.destroy(),Oe.material&&((Re=Oe.material).pbrMetallicRoughness.baseColorTexture&&Re.pbrMetallicRoughness.baseColorTexture.gfxTexture&&Re.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),Re.pbrMetallicRoughness.metallicRoughnessTexture&&Re.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&Re.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),Re.normalTexture&&Re.normalTexture.gfxTexture&&Re.normalTexture.gfxTexture.destroy(),Re.emissionTexture&&Re.emissionTexture.gfxTexture&&Re.emissionTexture.gfxTexture.destroy(),Re.occlusionTexture&&Re.occlusionTexture.gfxTexture&&Re.occlusionTexture.gfxTexture.destroy()));var Re;if(Le.children)for(const Re of Le.children)ry(Re)}class ny{constructor(Le,Re,Oe){this._demTile=Le,this._dem=this._demTile.dem,this._scale=Re,this._offset=Oe}static create(Le,Re,Oe){const Ue=Oe||Le.findDEMTileFor(Re);
1if(!Ue||!Ue.dem)return;const qe=Ue.dem,Ct=Ue.tileID,Ot=1<<Re.canonical.z-Ct.canonical.z;return new ny(Ue,qe.dim/ud/Ot,[(Re.canonical.x/Ot-Ct.canonical.x)*qe.dim,(Re.canonical.y/Ot-Ct.canonical.y)*qe.dim])}tileCoordToPixel(Le,Re){const Oe=Re*this._scale+this._offset[1],Ue=Math.floor(Le*this._scale+this._offset[0]),qe=Math.floor(Oe);return new ta(Ue,qe)}getElevationAt(Le,Re,Oe,Ue){const qe=Le*this._scale+this._offset[0],Ct=Re*this._scale+this._offset[1],Ot=Math.floor(qe),Jt=Math.floor(Ct),_i=this._dem;return Ue=!!Ue,Oe?ke(ke(_i.get(Ot,Jt,Ue),_i.get(Ot,Jt+1,Ue),Ct-Jt),ke(_i.get(Ot+1,Jt,Ue),_i.get(Ot+1,Jt+1,Ue),Ct-Jt),qe-Ot):_i.get(Ot,Jt,Ue)}getElevationAtPixel(Le,Re,Oe){return this._dem.get(Le,Re,!!Oe)}getMeterToDEM(Le){return(1<<this._demTile.tileID.canonical.z)*ul(1,Le)*this._dem.stride}}const qx=new Float32Array(262144),Zx=new Uint8Array(262144);function ay(Le){let Re=0;if(Le.meshes)for(const Oe of Le.meshes)Re=Math.max(Re,Oe.aabb.max[2]);if(Le.children)for(const Oe of Le.children)Re=Math.max(Re,ay(Oe));return Re}function oy(Le,Re,Oe){if(Le.meshes)for(const Ue of Le.meshes)Ue.aabb.min[0]!==1/0&&Oe.insert(Re,Ue.aabb.min[0],Ue.aabb.min[1],Ue.aabb.max[0],Ue.aabb.max[1]);if(Le.children)for(const Ue of Le.children)oy(Ue,Re,Oe)}const $x=["","wall","door","roof","window","lamp","logo"];class uy{constructor(Le){this.node=Le,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:Le.id,geometry:[],properties:{height:ay(Le)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new yu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let Le=0;const Re=new yu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const Oe of this.node.meshes)this.node.lightMeshIndex!==Le&&(Oe.transformedAabb=yu.applyTransformFast(Oe.aabb,this.node.matrix),Re.encapsulate(Oe.transformedAabb)),Le++;this.aabb=Re}return this.aabb}}class cy{constructor(Le,Re,Oe,Ue,qe,Ct){this.id=Re,this.modelTraits|=Gx.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,Oe&&(this.modelTraits|=Gx.HasMapboxMeshFeatures),Ue&&(this.modelTraits|=Gx.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=qe,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const Re of Le)this.nodesInfo.push(new uy(Re)),oy(Re,Ct.featureIndexArray.length,Ct.grid),Ct.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,Ct.bucketLayerIDs.length-1,0)}updateFootprints(Le,Re){for(const Oe of this.getNodesInfo()){const Ue=Oe.node;Ue.footprint&&Re.push({footprint:Ue.footprint,id:Le})}}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(Le){if(!this.needsUpload)return;const Re=this.getNodesInfo();for(const Oe of Re){const Re=Oe.node;this.uploaded?this.updatePbrBuffer(Re):ty(Re,Le,!0)}for(const Le of Re)ey(Le.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(Le){let Re=!1;if(!Le.meshes)return Re;for(const Oe of Le.meshes)Oe.pbrBuffer&&(Oe.pbrBuffer.updateData(Oe.featureArray),Re=!0);return Re}needsReEvaluation(Le,Re,Oe){const Ue=Le.transform.projectionOptions,qe=Le.style.getBrightness(),Ct=this.brightness!==qe;return!!(!this.uploaded||this.dirty||Ue.name!==this.projection.name||hy(Oe.paint.get("model-color").value,Ct)||hy(Oe.paint.get("model-color-mix-intensity").value,Ct)||hy(Oe.paint.get("model-roughness").value,Ct)||hy(Oe.paint.get("model-emissive-strength").value,Ct)||hy(Oe.paint.get("model-height-based-emissive-strength-multiplier").value,Ct))&&(this.projection=Ue,this.brightness=qe,!0)}evaluateScale(Le,Re){if(Le.transform.zoom===this.zoom)return;this.zoom=Le.transform.zoom;const Oe=this.getNodesInfo(),Ue=this.id.canonical;for(const Le of Oe){const Oe=Le.feature;Le.evaluatedScale=Re.paint.get("model-scale").evaluate(Oe,{},Ue)}}evaluate(Le){const Re=this.getNodesInfo();for(const Oe of Re){if(!Oe.node.meshes)continue;const Re=Oe.feature,Ue=Oe.node.meshes&&Oe.node.meshes[0].featureData,qe=Oe.evaluatedColor[2],Ct=Oe.evaluatedRMEA[2],Ot=this.id.canonical;if(Oe.hasTranslucentParts=!1,Ue){for(let Ue=0;Ue<$x.length;Ue++){const qe=$x[Ue];qe.length&&(Re.properties.part=qe);const Ct=Le.paint.get("model-color").evaluate(Re,{},Ot).toRenderColor(null),Jt=Le.paint.get("model-color-mix-intensity").evaluate(Re,{},Ot);Oe.evaluatedColor[Ue]=[Ct.r,Ct.g,Ct.b,Jt],Oe.evaluatedRMEA[Ue][0]=Le.paint.get("model-roughness").evaluate(Re,{},Ot),Oe.evaluatedRMEA[Ue][2]=Le.paint.get("model-emissive-strength").evaluate(Re,{},Ot),Oe.evaluatedRMEA[Ue][3]=Ct.a,Oe.emissionHeightBasedParams[Ue]=Le.paint.get("model-height-based-emissive-strength-multiplier").evaluate(Re,{},Ot),!Oe.hasTranslucentParts&&Ct.a<1&&(Oe.hasTranslucentParts=!0)}delete Re.properties.part,fy(Oe,qe!==Oe.evaluatedColor[2]||Ct!==Oe.evaluatedRMEA[2],this.modelTraits)}else Oe.evaluatedRMEA[0][2]=Le.paint.get("model-emissive-strength").evaluate(Re,{},Ot);Oe.evaluatedScale=Le.paint.get("model-scale").evaluate(Re,{},Ot),this.updatePbrBuffer(Oe.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(Le,Re,Oe,Ue){const qe=Le.findDEMTileFor(Oe);if(qe&&(qe.tileID.canonical!==this.terrainTile||Re!==this.terrainExaggeration)){if
1(qe.dem&&qe.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=qe.tileID.overscaledZ;const Re=ny.create(Le,Oe,qe);if(!Re)return;this.modelTraits&Gx.HasMapboxMeshFeatures&&this.updateDEM(Le,Re,Oe,Ue);for(const Le of this.getNodesInfo()){const Oe=Le.node;if(!Oe.footprint||!Oe.footprint.vertices||!Oe.footprint.vertices.length)continue;const Ue=Oe.footprint.vertices;let qe=Re.getElevationAt(Ue[0].x,Ue[0].y,!0,!0);for(let Le=1;Le<Ue.length;Le++)qe=Math.min(qe,Re.getElevationAt(Ue[Le].x,Ue[Le].y,!0,!0));Oe.elevation=qe}}this.terrainTile=qe.tileID.canonical,this.terrainExaggeration=Re}}updateDEM(Le,Re,Oe,Ue){let qe=Re._dem._modifiedForSources[Ue];if(void 0===qe&&(Re._dem._modifiedForSources[Ue]=[],qe=Re._dem._modifiedForSources[Ue]),qe.includes(Oe.canonical))return;const Ct=Re._dem.dim;qe.push(Oe.canonical);let Ot=!1;for(const Le of this.getNodesInfo()){const Oe=Le.node;if(!Oe.footprint||!Oe.footprint.grid)continue;const Ue=Oe.footprint.grid,qe=Re.tileCoordToPixel(Ue.min.x,Ue.min.y),Jt=Re.tileCoordToPixel(Ue.max.x,Ue.max.y),_i=Math.min(Math.min(Ct-Jt.y,qe.x),Math.min(qe.y,Ct-Jt.x));if(_i<0)continue;const xi=Q(_i,2,5);let vi=Math.max(0,qe.x-xi),bi=Math.max(0,qe.y-xi),Pi=Math.min(Jt.x+xi,Ct-1),Hr=Math.min(Jt.y+xi,Ct-1);for(let Le=bi;Le<=Hr;++Le)for(let Re=vi;Re<=Pi;++Re)Zx[Le*Ct+Re]=255;let Jr=0,Ln=0;for(let Le=0;Le<Ue.cellsY;++Le)for(let Oe=0;Oe<Ue.cellsX;++Oe){if(!Ue.cells[Le*Ue.cellsX+Oe])continue;const qe=Re.tileCoordToPixel(Ue.min.x+Oe/Ue.xScale,Ue.min.y+Le/Ue.yScale),Ot=Re.tileCoordToPixel(Ue.min.x+(Oe+1)/Ue.xScale,Ue.min.y+(Le+1)/Ue.yScale);for(let Le=qe.y;Le<=Math.min(Ot.y+1,Ct-1);++Le)for(let Oe=qe.x;Oe<=Math.min(Ot.x+1,Ct-1);++Oe)255===Zx[Le*Ct+Oe]&&(Zx[Le*Ct+Oe]=0,Jr+=Re.getElevationAtPixel(Oe,Le),Ln++)}const Nn=Jr/Ln;vi=Math.max(1,qe.x-xi),bi=Math.max(1,qe.y-xi),Pi=Math.min(Jt.x+xi,Ct-2),Hr=Math.min(Jt.y+xi,Ct-2),Ot=!0;for(let Le=bi;Le<=Hr;++Le)for(let Oe=vi;Oe<=Pi;++Oe)0===Zx[Le*Ct+Oe]&&(qx[Le*Ct+Oe]=Re._dem.set(Oe,Le,Nn));for(let Le=1;Le<xi;++Le){vi=Math.max(1,qe.x-Le),bi=Math.max(1,qe.y-Le),Pi=Math.min(Jt.x+Le,Ct-2),Hr=Math.min(Jt.y+Le,Ct-2);for(let Oe=bi;Oe<=Hr;++Oe)for(let Ue=vi;Ue<=Pi;++Ue){const qe=Oe*Ct+Ue;if(255===Zx[qe]){let Ot=0,Jt=0,_i=-1,vi=-1;for(let Re=-1;Re<=1;++Re)for(let qe=-1;qe<=1;++qe){const xi=(Oe+Re)*Ct+Ue+qe;if(Zx[xi]>=Le)continue;const bi=qx[xi],Pi=Math.abs(bi);Pi>Jt&&(Ot=bi,Jt=Pi,_i=qe,vi=Re)}if(Jt>.1){const Ct=1-(Le+.5*Math.abs(_i*vi))/xi;let Jt=Re._dem.get(Ue,Oe)+Ot*Ct;const bi=Re._dem.get(Ue+_i,Oe+vi),Pi=Re._dem.get(Ue-_i,Oe-vi,!0);(Jt-bi)*(Jt-Pi)>0&&(Jt=(bi+Pi)/2),qx[qe]=Re._dem.set(Ue,Oe,Jt),Zx[qe]=Le}}}}}Ot&&(Re._demTile.needsDEMTextureUpload=!0,Re._dem._timestamp=Oc.now())}getNodesInfo(){return this.nodesInfo}destroy(){const Le=this.getNodesInfo();for(const Re of Le)ey(Re.node),ry(Re.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(Le,Re){if(Re.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=Re.updateTime;const Oe=Re.getReplacementRegionsForTile(Le.toUnwrapped()),Ue=this.getNodesInfo();for(let Le=0;Le<this.nodesInfo.length;Le++){const Re=Ue[Le].node;Ue[Le].hiddenByReplacement=!!Re.footprint&&!Oe.find((Le=>Le.footprint===Re.footprint))}}getHeightAtTileCoord(Le,Re){const Oe=this.getNodesInfo(),Ue=[],qe=[0,0,0],Ct=as.mat4.identity([]);for(let Ot=0;Ot<this.nodesInfo.length;Ot++){const Jt=Oe[Ot],_i=Jt.node.meshes[0],xi=_i.transformedAabb;if(Le<xi.min[0]||Re<xi.min[1]||Le>xi.max[0]||Re>xi.max[1])continue;if(!0===Jt.node.hidden)return{height:1/0,maxHeight:Jt.feature.properties.height,hidden:!1,verticalScale:Jt.evaluatedScale[2]};as.mat4.invert(Ct,Jt.node.matrix),qe[0]=Le,qe[1]=Re,as.vec3.transformMat4(qe,qe,Ct);const vi=(qe[0]-_i.aabb.min[0])/(_i.aabb.max[0]-_i.aabb.min[0])*jx|0,bi=Math.min(63,(qe[1]-_i.aabb.min[1])/(_i.aabb.max[1]-_i.aabb.min[1])*jx|0)*jx+Math.min(63,vi),Pi=_i.heightmap[bi];if(!(Pi<0&&Jt.node.footprint)){if(Jt.hiddenByReplacement)return;return{height:Pi,maxHeight:Jt.feature.properties.height,hidden:!1,verticalScale:Jt.evaluatedScale[2]}}if(Jt.node.footprint.grid.query(new ta(Le,Re),new ta(Le,Re),Ue),Ue.length>0)return{height:void 0,maxHeight:Jt.feature.properties.height,hidden:Jt.hiddenByReplacement,verticalScale:Jt.evaluatedScale[2]}}}}function hy(Le,Re){return!Le.isLightConstant&&Re}function py(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){let _i=(61440&Re|(61440&Re)>>4)>>8,xi=(3840&Re|(3840&Re)>>4)>>4,vi=240&Re|(240&Re)>>4;Oe[3]>0&&(_i=ke(_i,255*Oe[0],Oe[3]),xi=ke(xi,255*Oe[1],Oe[3]),vi=ke(vi,255*Oe[2],Oe[3]));const bi=_i<<8|xi,Pi=vi<<8|Math.floor(255*Ue[3]),Hr=function(Le){const Re=Q(Le,0,2);return Math.min(Math.round(.5*Re*255),255)}(Ue[2])<<8|15*Ue[0]<<4|15*Ue[1],Jr=Q(qe[0],0,1),Ln=Q(qe[1],0,1),Nn=Q(qe[2],0,1),Gn=Q(qe[3],0,1);let qn,Zn,$n,Xn;if(Jr!==Ln&&Ot!==Ct&&Ln!==Jr){const Le=Ot-Ct;Zn=1/(Le*(Ln-Jr)),$n=-(Ct+Le*Jr)/(Le*(Ln-Jr));const Re=Q(qe[4],-1,1);Xn=Math.pow(10,Re),qn=255*Nn<<8|255*Gn}else qn=65535,Zn=0,$n=1,Xn=1;if(Le.emplaceBack(bi,Pi,Hr,qn,Zn,$n,Xn),Jt){const Le=Jt.length;Jt.clear();for(let Re=0;Re<Le;Re++)Jt.emplaceBack(bi,Pi,Hr,qn,Zn,$n,Xn)}}function fy(Le,Re,Oe){const Ue=Le.node;let qe=0;const Ct=Oe&Gx.HasMeshoptCompression;for(const Oe of Ue.meshes){if(Ue.lights&&Ue.lightMeshIndex===qe)continue;if(!Oe.featureData)continue;Oe.featureArray=new Xa,Oe.featureArray.reserve(Oe.featureData.length);let Ot=Re;for(const Re of Oe.featureData){const qe=Ct?65535&Re:Re>>16&65535,Jt=Ct?Re>>16&65535:65535&Re,_i=(15&Jt)<8?15&Jt:0,xi=Le.evaluatedRMEA[_i],vi=Le.evaluatedColor[_i],bi=Le.emissionHeightBasedParams[_i];let Pi;if(Ot&&2===_i&&Ue.lights&&(Pi=new Xa,Pi.resize(10*Ue.lights.length)),py(Oe.featureArray,qe,vi,xi,bi,Oe.aabb.min[2],Oe.aabb.max[2],Pi),Pi&&Ot){Ot=!1;const Le=Ue.meshes[Ue.lightMeshIndex];Le.featureArray=Pi,Le.featureArray._trim()}}Oe.featureArray._trim(),qe++}}function dy(Le,Re,Oe,Ue){const qe=1<<Le.z;Re.lat=hl((Ue/ud+Le.y)/qe),Re.lng=cl((Oe/ud+Le.x)/qe)}os(cy,"Tiled3dModelBucket",{omit:["layers"]}),os(uy,"Tiled3dModelFeature");const Hx={circle:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:xm||(xm=new Gs({"circle-sort-key":new qs(Vp.layout_circle["circle-sort-key"]),visibility:new Ns(Vp.layout_circle.visibility)})),paint:vm||(vm=new Gs({"circle-radius":new qs(Vp.paint_circle["circle-radius"]),"circle-color":new qs(Vp.paint_circle["circle-color"]),"circle-blur":new qs(Vp.paint_circle["circle-blur"]),"circle-opacity":new qs(Vp.paint_circle["circle-opacity"]),"circle-translate":new Ns(Vp.paint_circle["circle-translate"]),"circle-translate-anchor":new Ns(Vp.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ns(Vp.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ns(Vp.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new qs(Vp.paint_circle["circle-stroke-width"]),"circle-stroke-color":new qs(Vp.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new qs(Vp.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ns(Vp.paint_circle["circle-emissive-strength"])}))},Re,Oe,Ue)}createBucket(Le){return new Tl(Le)}queryRadius(Le){const Re=Le;
vendor: 16,549 bytes, line 1
1return Gl("circle-radius",this,Re)+Gl("circle-stroke-width",this,Re)+Xl(this.paint.get("circle-translate"))}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Zl(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),Ct.angle,Le.pixelToTileUnitsFactor),xi=this.paint.get("circle-radius").evaluate(Re,Oe)+this.paint.get("circle-stroke-width").evaluate(Re,Oe);return $u(Le,Ue,Ct,Ot,Jt,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),_i,xi)}getProgramIds(){return["circle"]}getDefaultProgramParams(Le,Re,Oe){const Ue=qu(this);return{config:new Lo(this,{zoom:Re,lut:Oe}),defines:Ue,overrideFog:!1}}},heatmap:class extends pa{createBucket(Le){return new Wu(Le)}constructor(Le,Re,Oe,Ue){super(Le,{layout:i_||(i_=new Gs({visibility:new Ns(Vp.layout_heatmap.visibility)})),paint:r_||(r_=new Gs({"heatmap-radius":new qs(Vp.paint_heatmap["heatmap-radius"]),"heatmap-weight":new qs(Vp.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ns(Vp.paint_heatmap["heatmap-intensity"]),"heatmap-color":new $s(Vp.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ns(Vp.paint_heatmap["heatmap-opacity"])}))},Re,Oe,Ue),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(Le){"heatmap-color"===Le&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ac({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(Le){return Gl("heatmap-radius",this,Le)}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=this.paint.get("heatmap-radius").evaluate(Re,Oe);return $u(Le,Ue,Ct,Ot,Jt,!0,!0,new ta(0,0),_i)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(Le,Re,Oe){return"heatmap"===Le?{config:new Lo(this,{zoom:Re,lut:Oe}),overrideFog:!1}:{}}},hillshade:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:n_||(n_=new Gs({visibility:new Ns(Vp.layout_hillshade.visibility)})),paint:o_||(o_=new Gs({"hillshade-illumination-direction":new Ns(Vp.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ns(Vp.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ns(Vp.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ns(Vp.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ns(Vp.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ns(Vp.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ns(Vp.paint_hillshade["hillshade-emissive-strength"])}))},Re,Oe,Ue)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(Le,Re,Oe){return{overrideFog:!1}}},fill:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:l_||(l_=new Gs({"fill-sort-key":new qs(Vp.layout_fill["fill-sort-key"]),visibility:new Ns(Vp.layout_fill.visibility)})),paint:c_||(c_=new Gs({"fill-antialias":new Ns(Vp.paint_fill["fill-antialias"]),"fill-opacity":new qs(Vp.paint_fill["fill-opacity"]),"fill-color":new qs(Vp.paint_fill["fill-color"]),"fill-outline-color":new qs(Vp.paint_fill["fill-outline-color"]),"fill-translate":new Ns(Vp.paint_fill["fill-translate"]),"fill-translate-anchor":new Ns(Vp.paint_fill["fill-translate-anchor"]),"fill-pattern":new qs(Vp.paint_fill["fill-pattern"]),"fill-emissive-strength":new Ns(Vp.paint_fill["fill-emissive-strength"]),"fill-z-offset":new qs(Vp.paint_fill["fill-z-offset"])}))},Re,Oe,Ue)}getProgramIds(){const Le=this.paint.get("fill-pattern"),Re=Le&&Le.constantOr(1),Oe=[Re?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&Oe.push(Re&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),Oe}getDefaultProgramParams(Le,Re,Oe){return{config:new Lo(this,{zoom:Re,lut:Oe}),overrideFog:!1}}recalculate(Le,Re){super.recalculate(Le,Re);const Oe=this.paint._values["fill-outline-color"];"constant"===Oe.value.kind&&void 0===Oe.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(Le){return new Fc(Le)}queryRadius(){return Xl(this.paint.get("fill-translate"))}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct){return!Le.queryGeometry.isAboveHorizon&&Vl(Yl(Le.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),Ct.angle,Le.pixelToTileUnitsFactor),Ue)}isTileClipped(){return!0}is3D(){return 0!==this.paint.get("fill-z-offset").constantOr(1)}},"fill-extrusion":class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:B_||(B_=new Gs({visibility:new Ns(Vp["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ns(Vp["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:N_||(N_=new Gs({"fill-extrusion-opacity":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new qs(Vp["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Ns(Vp["paint_fill-extrusion"]["fill-extrusion-cast-shadows"])}))},Re,Oe,Ue),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(Le){return new Zh(Le)}queryRadius(){return Xl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=Zl(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),Ct.angle,Le.pixelToTileUnitsFactor),vi=this.paint.get("fill-extrusion-height").evaluate(Re,Oe),bi=this.paint.get("fill-extrusion-base").evaluate(Re,Oe),Pi=[0,0],Hr=Jt&&Ct.elevation,Jr=Ct.elevation?Ct.elevation.exaggeration():1,Ln=Le.tile.getBucket(this);if(Hr&&Ln instanceof Zh){const Le=Ln.centroidVertexArray,Re=_i+1;Re<Le.length&&(Pi[0]=Le.geta_centroid_pos0(Re),Pi[1]=Le.geta_centroid_pos1(Re))}if(0===Pi[0]&&1===Pi[1])return!1;"globe"===Ct.projection.name&&(Ue=np([Ue],[new ta(0,0),new ta(ud,ud)],Le.tileID.canonical).map((Le=>Le.polygon)).flat());const Nn=Hr?Jt:null,[Gn,qn]=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi){return"globe"===Le.projection.name?function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi){const bi=[],Pi=[],Hr=Le.projection.upVectorScale(vi,Le.center.lat,Le.worldSize).metersToTile,Jr=[0,0,0,1],Ln=[0,0,0,1],y=(Le,Re,Oe,Ue)=>{Le[0]=Re,Le[1]=Oe,Le[2]=Ue,Le[3]=1},Nn=rp();Oe>0&&(Oe+=Nn),Ue+=Nn;for(const Nn of Re){const Re=[],Gn=[];for(const bi of Nn){const Pi=bi.x+qe.x,Nn=bi.y+qe.y,qn=Le.projection.projectTilePoint(Pi,Nn,vi),Zn=Le.projection.upVector(vi,bi.x,bi.y);let $n=Oe,Xn=Ue;if(Ot){const Le=up(Pi,Nn,Oe,Ue,Ot,Jt,_i,xi);$n+=Le.base,Xn+=Le.top}0!==Oe?y(Jr,qn.x+Zn[0]*Hr*$n,qn.y+Zn[1]*Hr*$n,qn.z+Zn[2]*Hr*$n):y(Jr,qn.x,qn.y,qn.z),y(Ln,qn.x+Zn[0]*Hr*Xn,qn.y+Zn[1]*Hr*Xn,qn.z+Zn[2]*Hr*Xn),as.vec3.transformMat4(Jr,Jr,Ct),as.vec3.transformMat4(Ln,Ln,Ct),Re.push(new hh(Jr[0],Jr[1],Jr[2])),Gn.push(new hh(Ln[0],Ln[1],Ln[2]))}bi.push(Re),Pi.push(Gn)}return[bi,Pi]}(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi):Ot?function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=[],vi=[],bi=[0,0,0,1];for(const Pi of Le){const Le=[],Hr=[];for(const xi of Pi){const vi=xi.x+Ue.x,Pi=xi.y+Ue.y,Jr=up(vi,Pi,Re,Oe,Ct,Ot,Jt,_i);bi[0]=vi,bi[1]=Pi,bi[2]=Jr.base,bi[3]=1,as.vec4.transformMat4(bi,bi,qe),bi[3]=Math.max(bi[3],1e-5);const Ln=new hh(bi[0]/bi[3],bi[1]/bi[3],bi[2]/bi[3]);bi[0]=vi,bi[1]=Pi,bi[2]=Jr.top,bi[3]=1,as.vec4.transformMat4(bi,bi,qe),bi[3]=Math.max(bi[3],1e-5);const Nn=new hh(bi[0]/bi[3],bi[1]/bi[3],bi[2]/bi[3]);Le.push(Ln),Hr.push(Nn)}xi.push(Le),vi.push(Hr)}return[xi,vi]}(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi):function(Le,Re,Oe,Ue,qe){const Ct=[],Ot=[],Jt=qe[8]*Re,_i=qe[9]*Re,xi=qe[10]*Re,vi=qe[11]*Re,bi=qe[8]*Oe,Pi=qe[9]*Oe,Hr=qe[10]*Oe,Jr=qe[11]*Oe;for(const Re of Le){const Le=[],Oe=[];for(const Ct of Re){const Re=Ct.x+Ue.x,Ot=Ct.y+Ue.y,Ln=qe[0]*Re+qe[4]*Ot+qe[12],Nn=qe[1]*Re+qe[5]*Ot+qe[13],Gn=qe[2]*Re+qe[6]*Ot+qe[14],qn=qe[3]*Re+qe[7]*Ot+qe[15],Zn=Ln+Jt,$n=Nn+_i,Xn=Gn+xi,Yn=Math.max(qn+vi,1e-5),lo=Ln+bi,uo=Nn+Pi,po=Gn+Hr,fo=Math.max(qn+Jr,1e-5);Le.push(new hh(Zn/Yn,$n/Yn,Xn/Yn)),Oe.push(new hh(lo/fo,uo/fo,po/fo))}Ct.push(Le),Ot.push(Oe)}return[Ct,Ot]}(Re,Oe,Ue,qe,Ct)}(Ct,Ue,bi,vi,xi,Ot,Nn,Pi,Jr,Ct.center.lat,Le.tileID.canonical),Zn=Le.queryGeometry;return function(Le,Re,Oe){let Ue=1/0;Vl(Oe,Re)&&(Ue=lp(Oe,Re[0]));for(let qe=0;qe<Re.length;qe++){const Ct=Re[qe],Ot=Le[qe];for(let Le=0;Le<Ct.length-1;Le++){const Re=Ct[Le],qe=[Re,Ct[Le+1],Ot[Le+1],Ot[Le],Re];El(Oe,qe)&&(Ue=Math.min(Ue,lp(Oe,qe)))}}return Ue!==1/0&&Ue}(Gn,qn,Zn.isPointQuery()?Zn.screenBounds:Zn.screenGeometry)}},line:class extends pa{constructor(Le,Re,Oe,Ue){const qe=Ep();super(Le,qe,Re,Oe,Ue),qe.layout&&(this.layout=new js(qe.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(Le){if("line-gradient"===Le){const Le=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=Le._styleExpression&&Le._styleExpression.expression instanceof Un,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(Le,Re){super.recalculate(Le,Re),this.paint._values["line-floorwidth"]=(()=>{if(Q_)return Q_;const Le=Ep();return Q_=new Bp(Le.paint.properties["line-width"].specification),Q_.useIntegerZoom=!0,Q_})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,Le)}createBucket(Le){return new wp(Le)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(Le,Re,Oe){const Ue=zp(this);return{config:new Lo(this,{zoom:Re,lut:Oe}),defines:Ue,overrideFog:!1}}queryRadius(Le){const Re=Le,Oe=Cp(Gl("line-width",this,Re),Gl("line-gap-width",this,Re)),Ue=Gl("line-offset",this,Re);return Oe/2+Math.abs(Ue)+Xl(this.paint.get("line-translate"))}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct){if(Le.queryGeometry.isAboveHorizon)return!1;const Ot=Yl(Le.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),Ct.angle,Le.pixelToTileUnitsFactor),Jt=Le.pixelToTileUnitsFactor/2*Cp(this.paint.get("line-width").evaluate(Re,Oe),this.paint.get("line-gap-width").evaluate(Re,Oe)),_i=this.paint.get("line-offset").evaluate(Re,Oe);return _i&&(Ue=function(Le,Re){const Oe=[],Ue=new ta(0,0);for(let qe=0;qe<Le.length;qe++){const Ct=Le[qe],Ot=[];for(let Le=0;Le<Ct.length;Le++){const Oe=Ct[Le],qe=Ct[Le+1],Jt=0===Le?Ue:Oe.sub(Ct[Le-1])._unit()._perp(),_i=Le===Ct.length-1?Ue:qe.sub(Oe)._unit()._perp(),xi=Jt._add(_i)._unit();xi._mult(1/(xi.x*_i.x+xi.y*_i.y)),Ot.push(xi._mult(Re)._add(Oe))}Oe.push(Ot)}return Oe}(Ue,_i*Le.pixelToTileUnitsFactor)),function(Le,Re,Oe){for(let Ue=0;Ue<Re.length;Ue++){const qe=Re[Ue];if(Le.length>=3)for(let Re=0;Re<qe.length;Re++)if(Ul(Le,qe[Re]))return!0;if(Cl(Le,qe,Oe))return!0}return!1}(Ot,Ue,Jt)}isTileClipped(){return!0}isDraped(Le){const Re=this.layout.get("line-z-offset");return Re.isConstant()&&!Re.constantOr(0)}},symbol:tm,background:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:cx||(cx=new Gs({visibility:new Ns(Vp.layout_background.visibility)})),paint:mx||(mx=new Gs({"background-pitch-alignment":new Ns(Vp.paint_background["background-pitch-alignment"]),"background-color":new Ns(Vp.paint_background["background-color"]),"background-pattern":new Ns(Vp.paint_background["background-pattern"]),"background-opacity":new Ns(Vp.paint_background["background-opacity"]),"background-emissive-strength":new Ns(Vp.paint_background["background-emissive-strength"])}))},Re,Oe,Ue)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(Le,Re,Oe){return{overrideFog:!1}}is3D(){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:mm,"raster-particle":wm,sky:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:Ix||(Ix=new Gs({visibility:new Ns(Vp.layout_sky.visibility)})),paint:Cx||(Cx=new Gs({"sky-type":new Ns(Vp.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ns(Vp.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ns(Vp.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ns(Vp.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ns(Vp.paint_sky["sky-gradient-radius"]),"sky-gradient":new $s(Vp.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ns(Vp.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ns(Vp.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ns(Vp.paint_sky["sky-opacity"])}))},Re,Oe,Ue),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(Le){"sky-gradient"===Le?this._updateColorRamp():"sky-atmosphere-sun"!==Le&&"sky-atmosphere-halo-color"!==Le&&"sky-atmosphere-color"!==Le&&"sky-atmosphere-sun-intensity"!==Le||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=ac({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(Le){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const Re=Le.style.light.properties.get("position");return this._lightPosition.azimuthal!==Re.azimuthal||this._lightPosition.polar!==Re.polar}return!1}getCenter(Le,Re){if("atmosphere"===this.paint.get("sky-type")){const Oe=this.paint.get("sky-atmosphere-sun"),Ue=!Oe,qe=Le.style.light,Ct=qe.properties.get("position");return Ue&&"viewport"===qe.properties.get("anchor")&&ft("The sun direction is attached to a light with viewport anchor, lighting may behave unex
1pectedly."),Ue?Mm(Ct.azimuthal,90-Ct.polar,Re):Mm(Oe[0],90-Oe[1],Re)}const Oe=this.paint.get("sky-gradient-center");return Mm(Oe[0],90-Oe[1],Re)}isSky(){return!0}markSkyboxValid(Le){this._skyboxInvalidated=!1,this._lightPosition=Le.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const Le=this.paint.get("sky-type");return"atmosphere"===Le?["skyboxCapture","skybox"]:"gradient"===Le?["skyboxGradient"]:null}},slot:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{paint:Px||(Px=new Gs({}))},Re,null)}},model:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:Vx||(Vx=new Gs({visibility:new Ns(Vp.layout_model.visibility),"model-id":new qs(Vp.layout_model["model-id"])})),paint:Ux||(Ux=new Gs({"model-opacity":new Ns(Vp.paint_model["model-opacity"]),"model-rotation":new qs(Vp.paint_model["model-rotation"]),"model-scale":new qs(Vp.paint_model["model-scale"]),"model-translation":new qs(Vp.paint_model["model-translation"]),"model-color":new qs(Vp.paint_model["model-color"]),"model-color-mix-intensity":new qs(Vp.paint_model["model-color-mix-intensity"]),"model-type":new Ns(Vp.paint_model["model-type"]),"model-cast-shadows":new Ns(Vp.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ns(Vp.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ns(Vp.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new qs(Vp.paint_model["model-emissive-strength"]),"model-roughness":new qs(Vp.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new qs(Vp.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ns(Vp.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ns(Vp.paint_model["model-front-cutoff"])}))},Re,Oe,Ue),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(Le){return new Xm(Le)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(Le){return Le instanceof cy?ud-1:0}queryIntersectsFeature(Le,Re,Oe,Ue,qe,Ct){if(!this.modelManager)return!1;const Ot=this.modelManager,Jt=Le.tile.getBucket(this);if(!(Jt&&Jt instanceof Xm))return!1;const _i=Jt;for(const Oe in _i.instancesPerModel){const Ue=_i.instancesPerModel[Oe],qe=void 0!==Re.id?Re.id:Re.properties&&Re.properties.hasOwnProperty("id")?Re.properties.id:void 0;if(Ue.idToFeaturesIndex.hasOwnProperty(qe)){const Re=Ue.features[Ue.idToFeaturesIndex[qe]],Jt=Ot.getModel(Oe,this.scope);if(!Jt)return!1;let xi=as.mat4.create();const vi=new rl(0,0),bi=_i.canonical;let Pi=Number.MAX_VALUE;for(let Oe=0;Oe<Re.instancedDataCount;++Oe){const qe=16*(Re.instancedDataOffset+Oe),Ot=Ue.instancedDataArray.float32,_i=[Ot[qe+4],Ot[qe+5],Ot[qe+6]];dy(bi,vi,Ot[qe],0|Ot[qe+1]),Km(xi,Jt,Ct,vi,Re.rotation,Re.scale,_i,!1,!1,!1),"globe"===Ct.projection.name&&(xi=Bm(xi,Ct));const Hr=as.mat4.multiply([],Ct.projMatrix,xi),Jr=Le.queryGeometry,Ln=Vm(Jr.isPointQuery()?Jr.screenBounds:Jr.screenGeometry,Ct,Hr,Jt.aabb);null!=Ln&&(Pi=Math.min(Ln,Pi))}return Pi!==Number.MAX_VALUE&&Pi}}return!1}_handleOverridablePaintPropertyUpdate(Le,Re,Oe){return!(!this.layout||Re.isDataDriven()||Oe.isDataDriven()||"model-color"!==Le&&"model-color-mix-intensity"!==Le&&"model-rotation"!==Le&&"model-scale"!==Le&&"model-translation"!==Le&&"model-emissive-strength"!==Le)}_isPropertyZoomDependent(Le){const Re=this._transitionablePaint._values[Le];return null!=Re&&null!=Re.value&&null!=Re.value.expression&&Re.value.expression instanceof Ji}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(Le,Re,Oe,Ue){const qe=Le.tile,Ct=qe.getBucket(this);let Ot=null,Jt=Number.MAX_VALUE;if(!(Ct&&Ct instanceof cy))return{queryFeature:Ot,intersectionZ:Jt};const _i=Ct.getNodesInfo()[Re];if(_i.hiddenByReplacement||!_i.node.meshes||!Oe.filter(new Vs(qe.tileID.overscaledZ
1),_i.feature,qe.tileID.canonical))return{queryFeature:Ot,intersectionZ:Jt};const xi=_i.node,vi=Ue.calculatePosMatrix(qe.tileID.toUnwrapped(),Ue.worldSize),bi=_i.evaluatedScale;let Pi=0;Ue.elevation&&xi.elevation&&(Pi=xi.elevation*Ue.elevation.exaggeration()),as.mat4.translate(vi,vi,[(xi.anchor?xi.anchor[0]:0)*(bi[0]-1),(xi.anchor?xi.anchor[1]:0)*(bi[1]-1),Pi]),as.mat4.scale(vi,vi,bi),as.mat4.multiply(vi,vi,xi.matrix);const Hr=Le.queryGeometry,Jr=Hr.isPointQuery()?Hr.screenBounds:Hr.screenGeometry,m=function(Le){const Re=as.mat4.multiply([],vi,Le.matrix),Oe=as.mat4.multiply(Re,Ue.expandedFarZProjMatrix,Re);for(let Re=0;Re<Le.meshes.length;++Re){const qe=Le.meshes[Re];if(Re===Le.lightMeshIndex)continue;const Ct=Vm(Jr,Ue,Oe,qe.aabb);null!=Ct&&(Jt=Math.min(Ct,Jt))}if(Le.children)for(const Re of Le.children)m(Re)};if(m(xi),Jt===Number.MAX_VALUE)return{queryFeature:Ot,intersectionZ:Jt};const Ln=new rl(0,0);return dy(qe.tileID.canonical,Ln,_i.node.anchor[0],_i.node.anchor[1]),Ot={type:"Feature",geometry:{type:"Point",coordinates:[Ln.lng,Ln.lat]},properties:_i.feature.properties,id:_i.feature.id,state:{},layer:this.serialize()},{queryFeature:Ot,intersectionZ:Jt}}},clip:class extends pa{constructor(Le,Re,Oe,Ue){super(Le,{layout:h_||(h_=new Gs({"clip-layer-types":new Ns(Vp.layout_clip["clip-layer-types"]),"clip-layer-scope":new Ns(Vp.layout_clip["clip-layer-scope"])})),paint:u_||(u_=new Gs({}))},Re,Oe,Ue)}recalculate(Le,Re){super.recalculate(Le,Re)}createBucket(Le){return new Gc(Le)}isTileClipped(){return!0}is3D(){return!0}}};class yy{constructor(Le){this._callback=Le,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class gy{constructor(){this.tasks={},this.taskQueue=[],ot(["process"],this),this.invoker=new yy(this.process),this.nextId=0}add(Le,Re){const Oe=this.nextId++,Ue=function({type:Le,isSymbolTile:Re,zoom:Oe}){return Oe=Oe||0,"message"===Le?0:"maybePrepare"!==Le||Re?"parseTile"!==Le||Re?"parseTile"===Le&&Re?300-Oe:"maybePrepare"===Le&&Re?400-Oe:500:200-Oe:100-Oe}(Re);if(0===Ue){try{Le()}finally{}return null}return this.tasks[Oe]={fn:Le,metadata:Re,priority:Ue,id:Oe},this.taskQueue.push(Oe),this.invoker.trigger(),{cancel:()=>{delete this.tasks[Oe]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((Le=>!!this.tasks[Le])),!this.taskQueue.length)return;const Le=this.pick();if(null===Le)return;const Re=this.tasks[Le];if(delete this.tasks[Le],this.taskQueue.length&&this.invoker.trigger(),!Re)return;Re.fn()}finally{}}pick(){let Le=null,Re=1/0;for(let Oe=0;Oe<this.taskQueue.length;Oe++){const Ue=this.tasks[this.taskQueue[Oe]];Ue.priority<Re&&(Re=Ue.priority,Le=Oe)}if(null===Le)return null;const Oe=this.taskQueue[Le];return this.taskQueue.splice(Le,1),Oe}remove(){this.invoker.remove()}}class xy{constructor(Le,Re,Oe){this.target=Le,this.parent=Re,this.mapId=Oe,this.callbacks={},this.cancelCallbacks={},ot(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new gy}send(Le,Re,Oe,Ue,qe=!1,Ct){const Ot=Math.round(1e18*Math.random()).toString(36).substring(0,10);Oe&&(Oe.metadata=Ct,this.callbacks[Ot]=Oe);const Jt=new Set;return this.target.postMessage({id:Ot,type:Le,hasCallback:!!Oe,targetMapId:Ue,mustQueue:qe,sourceMapId:this.mapId,data:cs(Re,Jt)},Jt),{cancel:()=>{Oe&&delete this.callbacks[Ot],this.target.postMessage({id:Ot,type:"<cancel>",targetMapId:Ue,sourceMapId:this.mapId})}}}receive(Le){const Re=Le.data,Oe=Re.id;if(Oe&&(!Re.targetMapId||this.mapId===Re.targetMapId))if("<cancel>"===Re.type){const Le=this.cancelCallbacks[Oe];delete this.cancelCallbacks[Oe],Le&&Le.cancel()}else if(Re.mustQueue||gt()){const Le=this.callbacks[Oe],Ue=this.scheduler.add((()=>this.processTask(Oe,Re)),Le&&Le.metadata||{type:"message"});Ue&&(this.cancelCallbacks[Oe]=Ue)}else this.processTask(Oe,Re)}processTask(Le,Re){if(delete this.cancelCallbacks[Le],"<response>"===Re.type){const Oe=this.callbacks[Le];delete this.callbacks[Le],Oe&&(Re.error?Oe(hs(Re.error)):Oe(null,hs(Re.data)))}else{const Oe=new Set,Ue=Re.hasCallback?(Re,Ue)=>{this.target.postMessage({id:Le,type:"<response>",sourceMapId:this.mapId,error:Re?cs(Re):null,data:cs(Ue,Oe)},Oe)}:Le=>{},qe=hs(Re.data);if(this.parent[Re.type])this.parent[Re.type](Re.sourceMapId,qe,Ue);else if(this.parent.getWorkerSource){const Le=Re.type.split(".");this.parent.getWorkerSource(Re.sourceMapId,Le[0],qe.source,qe.scope)[Le[1]](qe,Ue)}else Ue(new Error(`Could not find function ${Re.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class by{constructor(Le,Re){this.workerPool=Le,this.actors=[],this.currentActor=0,this.id=st();
vendor: 7,576 bytes, line 1
1const Oe=this.workerPool.acquire(this.id);for(let Le=0;Le<Oe.length;Le++){const Ue=new by.Actor(Oe[Le],Re,this.id);Ue.name=`Worker ${Le}`,this.actors.push(Ue)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(Le,Re,Oe){rt(this.actors,((Oe,Ue)=>{Oe.send(Le,Re,Ue)}),Oe=Oe||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((Le=>{Le.remove()})),this.actors=[],this.workerPool.release(this.id)}}by.Actor=xy;class vy{constructor(Le){this.size=Le,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(Le,Re){const Oe=this.toIdx(Le,Re);return{min:this.minimums[Oe],max:this.maximums[Oe]}}isLeaf(Le,Re){return this.leaves[this.toIdx(Le,Re)]}toIdx(Le,Re){return Re*this.size+Le}}function wy(Le,Re,Oe,Ue){let qe=0,Ct=Number.MAX_VALUE;for(let Ot=0;Ot<3;Ot++)if(Math.abs(Ue[Ot])<1e-15){if(Oe[Ot]<Le[Ot]||Oe[Ot]>Re[Ot])return null}else{const Jt=1/Ue[Ot];let _i=(Le[Ot]-Oe[Ot])*Jt,xi=(Re[Ot]-Oe[Ot])*Jt;if(_i>xi){const Le=_i;_i=xi,xi=Le}if(_i>qe&&(qe=_i),xi<Ct&&(Ct=xi),qe>Ct)return null}return qe}function _y(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi){const bi=Ue-Le,Pi=qe-Re,Hr=Ct-Oe,Jr=Ot-Le,Ln=Jt-Re,Nn=_i-Oe,Gn=vi[1]*Nn-vi[2]*Ln,qn=vi[2]*Jr-vi[0]*Nn,Zn=vi[0]*Ln-vi[1]*Jr,$n=bi*Gn+Pi*qn+Hr*Zn;if(Math.abs($n)<1e-15)return null;const Xn=1/$n,Yn=xi[0]-Le,lo=xi[1]-Re,uo=xi[2]-Oe,po=(Yn*Gn+lo*qn+uo*Zn)*Xn;if(po<0||po>1)return null;const fo=lo*Hr-uo*Pi,Io=uo*bi-Yn*Hr,is=Yn*Pi-lo*bi,as=(vi[0]*fo+vi[1]*Io+vi[2]*is)*Xn;return as<0||po+as>1?null:(Jr*fo+Ln*Io+Nn*is)*Xn}function My(Le,Re,Oe){return(Le-Re)/(Oe-Re)}function Ay(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=1<<Oe,vi=Ct-Ue,bi=Ot-qe,Pi=(Le+1)/xi*vi+Ue,Hr=(Re+0)/xi*bi+qe,Jr=(Re+1)/xi*bi+qe;Jt[0]=(Le+0)/xi*vi+Ue,Jt[1]=Hr,_i[0]=Pi,_i[1]=Jr}class Sy{constructor(Le){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=Le,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const Re=function(Le){const Re=Math.ceil(Math.log2(Le.dim/8)),Oe=[];let Ue=Math.ceil(Math.pow(2,Re));const qe=1/Ue,s=(Le,Re,Oe,Ue,qe)=>{const Ct=Ue?1:0,Ot=(Le+1)*Oe-Ct,Jt=Re*Oe,_i=(Re+1)*Oe-Ct;qe[0]=Le*Oe,qe[1]=Jt,qe[2]=Ot,qe[3]=_i};let Ct=new vy(Ue);const Ot=[];for(let Re=0;Re<Ue*Ue;Re++){s(Re%Ue,Math.floor(Re/Ue),qe,!1,Ot);const Oe=Py(Ot[0],Ot[1],Le),Jt=Py(Ot[2],Ot[1],Le),_i=Py(Ot[2],Ot[3],Le),xi=Py(Ot[0],Ot[3],Le);Ct.minimums.push(Math.min(Oe,Jt,_i,xi)),Ct.maximums.push(Math.max(Oe,Jt,_i,xi)),Ct.leaves.push(1)}for(Oe.push(Ct),Ue/=2;Ue>=1;Ue/=2){const Le=Oe[Oe.length-1];Ct=new vy(Ue);for(let Re=0;Re<Ue*Ue;Re++){s(Re%Ue,Math.floor(Re/Ue),2,!0,Ot);const Oe=Le.getElevation(Ot[0],Ot[1]),qe=Le.getElevation(Ot[2],Ot[1]),Jt=Le.getElevation(Ot[2],Ot[3]),_i=Le.getElevation(Ot[0],Ot[3]),xi=Le.isLeaf(Ot[0],Ot[1]),vi=Le.isLeaf(Ot[2],Ot[1]),bi=Le.isLeaf(Ot[2],Ot[3]),Pi=Le.isLeaf(Ot[0],Ot[3]),Hr=Math.min(Oe.min,qe.min,Jt.min,_i.min),Jr=Math.max(Oe.max,qe.max,Jt.max,_i.max),Ln=xi&&vi&&bi&&Pi;Ct.maximums.push(Jr),Ct.minimums.push(Hr),Ct.leaves.push(Jr-Hr<=5&&Ln?1:0)}Oe.push(Ct)}return Oe}(this.dem),Oe=Re.length-1,Ue=Re[Oe];this._addNode(Ue.minimums[0],Ue.maximums[0],Ue.leaves[0]),this._construct(Re,0,0,Oe,0)}raycastRoot(Le,Re,Oe,Ue,qe,Ct,Ot=1){return wy([Le,Re,-100],[Oe,Ue,this.maximums[0]*Ot],qe,Ct)}raycast(Le,Re,Oe,Ue,qe,Ct,Ot=1){if(!this.nodeCount)return null;const Jt=this.raycastRoot(Le,Re,Oe,Ue,qe,Ct,Ot);if(null==Jt)return null;const _i=[],xi=[],vi=[],bi=[],Pi=[{idx:0,t:Jt,nodex:0,nodey:0,depth:0}];for(;Pi.length>0;){const{idx:Jt,t:Hr,nodex:Jr,nodey:Ln,depth:Nn}=Pi.pop();if(this.leaves[Jt]){Ay(Jr,Ln,Nn,Le,Re,Oe,Ue,vi,bi);const Jt=1<<Nn,_i=(Jr+0)/Jt,xi=(Jr+1)/Jt,Pi=(Ln+0)/Jt,Gn=(Ln+1)/Jt,qn=Py(_i,Pi,this.dem)*Ot,Zn=Py(xi,Pi,this.dem)*Ot,$n=Py(xi,Gn,this.dem)*Ot,Xn=Py(_i,Gn,this.dem)*Ot,Yn=_y(vi[0],vi[1],qn,bi[0],vi[1],Zn,bi[0],bi[1],$n,qe,Ct),lo=_y(bi[0],bi[1],$n,vi[0],bi[1],Xn,vi[0],vi[1],qn,qe,Ct),uo=Math.min(null!==Yn?Yn:Number.MAX_VALUE,null!==lo?lo:Number.MAX_VALUE);if(uo!==Number.MAX_VALUE)return uo;{const Le=as.vec3.scaleAndAdd([],qe,Ct,Hr);if(Iy(qn,Zn,Xn,$n,My(Le[0],vi[0],bi[0]),My(Le[1],vi[1],bi[1]))>=Le[2])return Hr}continue}let Gn=0;for(let Pi=0;Pi<this._siblingOffset.length;Pi++){Ay((Jr<<1)+this._siblingOffset[Pi][0],(Ln<<1)+this._siblingOffset[Pi][1],Nn+1,Le,Re,Oe,Ue,vi,bi),vi[2]=-100,bi[2]=this.maximums[this.childOffsets[Jt]+Pi]*Ot;const Hr=wy(vi,bi,qe,Ct);if(null!=Hr){const Le=Hr;_i[Pi]=Le;let Re=!1;for(let Oe=0;Oe<Gn&&!Re;Oe++)Le>=_i[xi[Oe]]&&(xi.splice(Oe,0,Pi),Re=!0);Re||(xi[Gn]=Pi),Gn++}}for(let Le=0;Le<Gn;Le++){const Re=xi[Le];Pi.push({idx:this.childOffsets[Jt]+Re,t:_i[Re],nodex:(Jr<<1)+this._siblingOffset[Re][0],nodey:(Ln<<1)+this._siblingOffset[Re][1],depth:Nn+1})}}return null}_addNode(Le,Re,Oe){return this.minimums.push(Le),this.maximums.push(Re),this.leaves.push(Oe),this.childOffsets.push(0),this.nodeCount++}_construct(Le,Re,Oe,Ue,qe){if(1===Le[Ue].isLeaf(Re,Oe))return;this.childOffsets[qe]||(this.childOffsets[qe]=this.nodeCount);const Ct=Ue-1,Ot=Le[Ct];let Jt=0,_i=0;for(let Le=0;Le<this._siblingOffset.length;Le++){const Ue=2*Re+this._siblingOffset[Le][0],qe=2*Oe+this._siblingOffset[Le][1],Ct=Ot.getElevation(Ue,qe),xi=Ot.isLeaf(Ue,qe),vi=this._addNode(Ct.min,Ct.max,xi);xi&&(Jt|=1<<Le),_i||(_i=vi)}for(let Ue=0;Ue<this._siblingOffset.length;Ue++)Jt&1<<Ue||this._construct(Le,2*Re+this._siblingOffset[Ue][0],2*Oe+this._siblingOffset[Ue][1],Ct,_i+Ue)}}function Iy(Le,Re,Oe,Ue,qe,Ct){return ke(ke(Le,Oe,Ct),ke(Re,Ue,Ct),qe)}function Py(Le,Re,Oe){const Ue=Oe.dim,qe=Q(Le*Ue-.5,0,Ue-1),Ct=Q(Re*Ue-.5,0,Ue-1),Ot=Math.floor(qe),Jt=Math.floor(Ct),_i=Math.min(Ot+1,Ue-1),xi=Math.min(Jt+1,Ue-1);return Iy(Oe.get(Ot,Jt),Oe.get(_i,Jt),Oe.get(Ot,xi),Oe.get(_i,xi),qe-Ot,Ct-Jt)}const Wx={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ky(Le,Re,Oe){return(256*Le*256+256*Re+Oe)/10-1e4}function Ty(Le,Re,Oe){return 256*Le+Re+Oe/256-32768}class Ey{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(Le,Re,Oe,Ue=!1){if(this.uid=Le,Re.height!==Re.width)throw new RangeError("DEM tiles must be square");if(Oe&&"mapbox"!==Oe&&"terrarium"!==Oe)return void ft(`"${Oe}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=Re.height;const qe=this.dim=Re.height-2,Ct=new Uint32Array(Re.data.buffer);if(this.pixels=new Uint8Array(Re.data.buffer),this.floatView=new Float32Array(Re.data.buffer),this.borderReady=Ue,this._modifiedForSources={},!Ue){for(let Le=0;Le<qe;Le++)Ct[this._idx(-1,Le)]=Ct[this._idx(0,Le)],Ct[this._idx(qe,Le)]=Ct[this._idx(qe-1,Le)],Ct[this._idx(Le,-1)]=Ct[this._idx(Le,0)],Ct[this._idx(Le,qe)]=Ct[this._idx(Le,qe-1)];Ct[this._idx(-1,-1)]=Ct[this._idx(0,0)],Ct[this._idx(qe,-1)]=Ct[this._idx(qe-1,0)],Ct[this._idx(-1,qe)]=Ct[this._idx(0,qe-1)],Ct[this._idx(qe,qe)]=Ct[this._idx(qe-1,qe-1)]}const Ot="terrarium"===Oe?Ty:ky;for(let Le=0;Le<Ct.length;++Le){const Re=4*Le;this.floatView[Le]=Ot(this.pixels[Re],this.pixels[Re+1],this.pixels[Re+2])}this._timestamp=Oc.now()}_buildQuadTree(){this._tree=new Sy(this)}get(Le,Re,Oe=!1){Oe&&(Le=Q(Le,-1,this.dim),Re=Q(Re,-1,this.dim));const Ue=this._idx(Le,Re);return this.floatView[Ue]}set(Le,Re,Oe){const Ue=this._idx(Le,Re),qe=this.floatView[Ue];return this.floatView[Ue]=Oe,Oe-qe}static getUnpackVector(Le){return Wx[Le]}_idx(Le,Re){if(Le<-1||Le>=this.dim+1||Re<-1||Re>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(Re+1)*this.stride+(Le+1)}static pack(Le,Re){const Oe=[0,0,0,0],Ue=Ey.getUnpackVector(Re);let qe=Math.floor((Le+Ue[3])/Ue[2]);
vendor: 5,451 bytes, line 1
1return Oe[2]=qe%256,qe=Math.floor(qe/256),Oe[1]=qe%256,qe=Math.floor(qe/256),Oe[0]=qe,Oe}getPixels(){return new sc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(Le,Re,Oe){if(this.dim!==Le.dim)throw new Error("dem dimension mismatch");let Ue=Re*this.dim,qe=Re*this.dim+this.dim,Ct=Oe*this.dim,Ot=Oe*this.dim+this.dim;switch(Re){case-1:Ue=qe-1;break;case 1:qe=Ue+1}switch(Oe){case-1:Ct=Ot-1;break;case 1:Ot=Ct+1}const Jt=-Re*this.dim,_i=-Oe*this.dim;for(let Re=Ct;Re<Ot;Re++)for(let Oe=Ue;Oe<qe;Oe++){const Ue=4*this._idx(Oe,Re),qe=4*this._idx(Oe+Jt,Re+_i);this.pixels[Ue+0]=Le.pixels[qe+0],this.pixels[Ue+1]=Le.pixels[qe+1],this.pixels[Ue+2]=Le.pixels[qe+2],this.pixels[Ue+3]=Le.pixels[qe+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function By(Le,Re,Oe){1===Le?Re.header_length=Oe.readFixed32():2===Le?Re.x=Oe.readVarint():3===Le?Re.y=Oe.readVarint():4===Le?Re.z=Oe.readVarint():5===Le&&Re.layers.push(function(Le,Re){return Le.readFields(Ly,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},Re)}(Oe,Oe.readVarint()+Oe.pos))}function Vy(Le,Re,Oe){1===Le?(Re.delta_filter=function(Le,Re){return Le.readFields(Cy,{block_size:0},Re)}(Oe,Oe.readVarint()+Oe.pos),Re.filter="delta_filter"):2===Le?(Oe.readVarint(),Re.filter="zigzag_filter"):3===Le?(Oe.readVarint(),Re.filter="bitshuffle_filter"):4===Le&&(Oe.readVarint(),Re.filter="byteshuffle_filter")}function Cy(Le,Re,Oe){1===Le&&(Re.block_size=Oe.readVarint())}function Ry(Le,Re,Oe){1===Le?(Oe.readVarint(),Re.codec="gzip_data"):2===Le?(Oe.readVarint(),Re.codec="jpeg_image"):3===Le?(Oe.readVarint(),Re.codec="webp_image"):4===Le&&(Oe.readVarint(),Re.codec="png_image")}function Dy(Le,Re,Oe){1===Le?Re.first_byte=Oe.readFixed64():2===Le?Re.last_byte=Oe.readFixed64():3===Le?Re.filters.push(function(Le,Re){return Le.readFields(Vy,{},Re)}(Oe,Oe.readVarint()+Oe.pos)):4===Le?Re.codec=function(Le,Re){return Le.readFields(Ry,{},Re)}(Oe,Oe.readVarint()+Oe.pos):5===Le?Re.deprecated_offset=Oe.readFloat():6===Le?Re.deprecated_scale=Oe.readFloat():7===Le?Re.bands.push(Oe.readString()):8===Le?Re.offset=Oe.readDouble():9===Le&&(Re.scale=Oe.readDouble())}function Ly(Le,Re,Oe){1===Le?Re.version=Oe.readVarint():2===Le?Re.name=Oe.readString():3===Le?Re.units=Oe.readString():4===Le?Re.tilesize=Oe.readVarint():5===Le?Re.buffer=Oe.readVarint():6===Le?Re.pixel_format=Oe.readVarint():7===Le&&Re.data_index.push(function(Le,Re){return Le.readFields(Dy,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,deprecated_offset:0,deprecated_scale:0,bands:[]},Re)}(Oe,Oe.readVarint()+Oe.pos))}function Fy(Le,Re,Oe){if(2===Le)!function(Le,Re,Oe){Le.readFields(Oy,Oe,Re)}(Oe,Oe.readVarint()+Oe.pos,Re);else if(3===Le)throw new Error("Not implemented")}function Oy(Le,Re,Oe){if(1===Le){let Le=0;const Ue=Oe.readVarint()+Oe.pos;for(;Oe.pos<Ue;)Re[Le++]=Oe.readVarint()}}os(Ey,"DEMData"),os(Sy,"DemMinMaxQuadTree",{omit:["dem"]});class Uy{constructor(Le){this.capacity=Le,this.cache=new Map}get(Le){if(!this.cache.has(Le))return;const Re=this.cache.get(Le);return this.cache.delete(Le),this.cache.set(Le,Re),Re}put(Le,Re){this.cache.has(Le)?this.cache.delete(Le):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(Le,Re)}}function jy(Le,Re){if(4!==Re.length)throw new Error(`Expected data of dimension 4 but got ${Re.length}.`);let Oe=Re[3];for(let Ue=2;Ue>=1;Ue--){const qe=1===Ue?1:0,Ct=2===Ue?1:0;for(let Ue=0;Ue<Re[0];Ue++){const Ot=Re[1]*Ue;for(let Ue=qe;Ue<Re[1];Ue++){const qe=Re[2]*(Ue+Ot);for(let Ue=Ct;Ue<Re[2];Ue++){const Ct=Re[3]*(Ue+qe);for(let Ue=0;Ue<Re[3];Ue++){const Re=Ct+Ue;Le[Re]+=Le[Re-Oe]}}}}Oe*=Re[Ue]}return Le}function Ny(Le){for(let Re=0,Oe=Le.length;Re<Oe;Re++)Le[Re]=Le[Re]>>>1^-(1&Le[Re]);return Le}function qy(Le,Re){switch(Re){case"uint32":return Le;case"uint16":for(let Re=0;Re<Le.length;Re+=2){const Oe=Le[Re],Ue=Le[Re+1];Le[Re]=(240&Oe)>>4|(61440&Oe)>>8|(240&Ue)<<4|61440&Ue,Le[Re+1]=15&Oe|(3840&Oe)>>4|(15&Ue)<<8|(3840&Ue)<<4}return Le;case"uint8":for(let Re=0;Re<Le.length;Re+=4){const Oe=Le[Re],Ue=Le[Re+1],qe=Le[Re+2],Ct=Le[Re+3];Le[Re+0]=(192&Oe)>>6|(192&Ue)>>4|(192&qe)>>2|192&Ct,Le[Re+1]=(48&Oe)>>4|(48&Ue)>>2|48&qe|(48&Ct)<<2,Le[Re+2]=(12&Oe)>>2|12&Ue|(12&qe)<<2|(12&Ct)<<4,Le[Re+3]=3&Oe|(3&Ue)<<2|(3&qe)<<4|(3&Ct)<<6}return Le;default:throw new Error(`Invalid pixel format, "${Re}"`)}}var Xx=Uint8Array,Yx=Uint16Array,Jx=Int32Array,Kx=new Xx([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Qx=new Xx([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ev=new Xx([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hy=function(Le,Re){for(var Oe=new Yx(31),Ue=0;Ue<31;++Ue)Oe[Ue]=Re+=1<<Le[Ue-1];var qe=new Jx(Oe[30]);for(Ue=1;Ue<30;++Ue)for(var Ct=Oe[Ue];Ct<Oe[Ue+1];++Ct)qe[Ct]=Ct-Oe[Ue]<<5|Ue;return{b:Oe,r:qe}},tv=Hy(Kx,2),iv=tv.b,rv=tv.r;iv[28]=258,rv[258]=28;for(var nv=Hy(Qx,0).b,ov=new Yx(32768),sv=0;sv<32768;++sv){var av=(43690&sv)>>1|(21845&sv)<<1;ov[sv]=((65280&(av=(61680&(av=(52428&av)>>2|(13107&av)<<2))>>4|(3855&av)<<4))>>8|(255&av)<<8)>>1}var ig=function(Le,Re,Oe){for(var Ue=Le.length,qe=0,Ct=new Yx(Re);qe<Ue;++qe)Le[qe]&&++Ct[Le[qe]-1];var Ot,Jt=new Yx(Re);for(qe=1;qe<Re;++qe)Jt[qe]=Jt[qe-1]+Ct[qe-1]<<1;Ot=new Yx(1<<Re);var _i=15-Re;for(qe=0;qe<Ue;++qe)if(Le[qe])for(var xi=qe<<4|Le[qe],vi=Re-Le[qe],bi=Jt[Le[qe]-1]++<<vi,Pi=bi|(1<<vi)-1;bi<=Pi;++bi)Ot[ov[bi]>>_i]=xi;return Ot},lv=new Xx(288);for(sv=0;
vendor: 4,313 bytes, line 1
1sv<144;++sv)lv[sv]=8;for(sv=144;sv<256;++sv)lv[sv]=9;for(sv=256;sv<280;++sv)lv[sv]=7;for(sv=280;sv<288;++sv)lv[sv]=8;var cv=new Xx(32);for(sv=0;sv<32;++sv)cv[sv]=5;var hv=ig(lv,9),uv=ig(cv,5),ug=function(Le){for(var Re=Le[0],Oe=1;Oe<Le.length;++Oe)Le[Oe]>Re&&(Re=Le[Oe]);return Re},cg=function(Le,Re,Oe){var Ue=Re/8|0;return(Le[Ue]|Le[Ue+1]<<8)>>(7&Re)&Oe},hg=function(Le,Re){var Oe=Re/8|0;return(Le[Oe]|Le[Oe+1]<<8|Le[Oe+2]<<16)>>(7&Re)},dv=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],fg=function(Le,Re,Oe){var Ue=new Error(Re||dv[Le]);if(Ue.code=Le,Error.captureStackTrace&&Error.captureStackTrace(Ue,fg),!Oe)throw Ue;return Ue},pv=new Xx(0),fv="undefined"!=typeof TextDecoder&&new TextDecoder;try{fv.decode(pv,{stream:!0})}catch(Le){}const mv={gzip_data:"gzip"};class gg extends Error{constructor(Le){super(Le),this.name="MRTError"}}const _v={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},gv={uint32:1,uint16:2,uint8:4},yv={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let xv;class _g{constructor(Le=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=Le}getLayer(Le){const Re=this.layers[Le];if(!Re)throw new gg(`Layer '${Le}' not found`);return Re}getHeaderLength(Le){const Re=new Uint8Array(Le),Oe=new DataView(Le);if(13!==Re[0])throw new gg("File is not a valid MRT.");return Oe.getUint32(1,!0)}parseHeader(Le){const Re=new Uint8Array(Le),Oe=this.getHeaderLength(Le);if(Re.length<Oe)throw new gg(`Expected header with length >= ${Oe} but got buffer of length ${Re.length}`);const Ue=function(Le,Re){return Le.readFields(By,{header_length:0,x:0,y:0,z:0,layers:[]},void 0)}(new xv(Re.subarray(0,Oe)));if(!isNaN(this.x)&&(this.x!==Ue.x||this.y!==Ue.y||this.z!==Ue.z))throw new gg(`Invalid attempt to parse header ${Ue.z}/${Ue.x}/${Ue.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=Ue.x,this.y=Ue.y,this.z=Ue.z;for(const Le of Ue.layers)this.layers[Le.name]=new Mg(Le,{cacheSize:this._cacheSize});return this}createDecodingTask(Le){const Re=[],Oe=this.getLayer(Le.layerName);for(let Ue of Le.blockIndices){const qe=Oe.dataIndex[Ue],Ct=qe.first_byte-Le.firstByte,Ot=qe.last_byte-Le.firstByte;if(Oe._blocksInProgress.has(Ue))continue;const Jt={layerName:Oe.name,firstByte:Ct,lastByte:Ot,pixelFormat:Oe.pixelFormat,blockIndex:Ue,blockShape:[qe.bands.length].concat(Oe.bandShape),buffer:Oe.buffer,codec:qe.codec.codec,filters:qe.filters.map((Le=>Le.filter))};Oe._blocksInProgress.add(Ue),Re.push(Jt)}return new Ag(Re,(()=>{Re.forEach((Le=>Oe._blocksInProgress.delete(Le.blockIndex)))}),((Le,Ue)=>{if(Re.forEach((Le=>Oe._blocksInProgress.delete(Le.blockIndex))),Le)throw Le;Ue.forEach((Le=>{this.getLayer(Le.layerName).processDecodedData(Le)}))}))}}class Mg{constructor({version:Le,name:Re,units:Oe,tilesize:Ue,pixel_format:qe,buffer:Ct,data_index:Ot},Jt){if(this.version=Le,1!==this.version)throw new gg(`Cannot parse raster layer encoded with MRT version ${Le}`);this.name=Re,this.units=Oe,this.tileSize=Ue,this.buffer=Ct,this.pixelFormat=_v[qe],this.dataIndex=Ot,this.bandShape=[Ue+2*Ct,Ue+2*Ct,gv[this.pixelFormat]],this._decodedBlocks=new Uy(Jt?Jt.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return gv[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:Le})=>Le)).flat()}processDecodedData(Le){const Re=Le.blockIndex.toString();this._decodedBlocks.get(Re)||this._decodedBlocks.put(Re,Le.data)}getBlockForBand(Le){let Re=0;switch(typeof Le){case"string":for(const[Oe,Ue]of this.dataIndex.entries()){for(const[qe,Ct]of Ue.bands.entries())if(Ct===Le)return{bandIndex:Re+qe,blockIndex:Oe,blockBandIndex:qe};Re+=Ue.bands.length}break;case"number":for(const[Oe,Ue]of this.dataIndex.entries()){if(Le>=Re&&Le<Re+Ue.bands.length)return{bandIndex:Le,blockIndex:Oe,blockBandIndex:Le-Re};Re+=Ue.bands.length}break;default:throw new gg(`Invalid band \`${JSON.stringify(Le)}\`. Expected string or integer.`)}throw new gg(`Band not found: ${JSON.stringify(Le)}`)}getDataRange(Le){let Re=1/0,Oe=-1/0;const Ue=[],qe=new Set;for(const Ct of Le){const{blockIndex:Le}=this.getBlockForBand(Ct);
vendor: 4,749 bytes, line 1
1if(Le<0)throw new gg(`Invalid band: ${JSON.stringify(Ct)}`);const Ot=this.dataIndex[Le];Ue.includes(Le)||Ue.push(Le),qe.add(Le),Re=Math.min(Re,Ot.first_byte),Oe=Math.max(Oe,Ot.last_byte)}if(qe.size>this.cacheSize)throw new gg(`Number of blocks to decode (${qe.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:Re,lastByte:Oe,blockIndices:Ue}}hasBand(Le){const{blockIndex:Re}=this.getBlockForBand(Le);return Re>=0}hasDataForBand(Le){const{blockIndex:Re}=this.getBlockForBand(Le);return Re>=0&&!!this._decodedBlocks.get(Re.toString())}getBandView(Le){const{blockIndex:Re,blockBandIndex:Oe}=this.getBlockForBand(Le),Ue=this._decodedBlocks.get(Re.toString());if(!Ue)throw new gg(`Data for band ${JSON.stringify(Le)} of layer "${this.name}" not decoded.`);const qe=this.dataIndex[Re],Ct=this.bandShape.reduce(((Le,Re)=>Le*Re),1),Ot=Oe*Ct,Jt=Ue.subarray(Ot,Ot+Ct);return{data:Jt,bytes:new Uint8Array(Jt.buffer).subarray(Jt.byteOffset,Jt.byteOffset+Jt.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:0!==qe.offset?qe.offset:qe.deprecated_offset,scale:0!==qe.scale?qe.scale:qe.deprecated_scale}}}_g.setPbf=function(Le){xv=Le};class Ag{constructor(Le,Re,Oe){this.tasks=Le,this._onCancel=Re,this._onComplete=Oe,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(Le,Re){this._finalized||(this._onComplete(Le,Re),this._finalized=!0)}}_g.performDecoding=function(Le,Re){const Oe=new Uint8Array(Le);return Promise.all(Re.tasks.map((Le=>{const{layerName:Re,firstByte:Ue,lastByte:qe,pixelFormat:Ct,blockShape:Ot,blockIndex:Jt,filters:_i,codec:xi}=Le,vi=Oe.subarray(Ue,qe+1),bi=new Uint32Array(Ot[0]*Ot[1]*Ot[2]);let Pi;if("gzip_data"!==xi)throw new gg(`Unhandled codec: ${xi}`);return Pi=function(Le,Re){if(!globalThis.DecompressionStream&&"gzip_data"===Re)return Promise.resolve(((Ct=function(Le){31==Le[0]&&139==Le[1]&&8==Le[2]||fg(6,"invalid gzip data");var Re=Le[3],Oe=10;4&Re&&(Oe+=2+(Le[10]|Le[11]<<8));for(var Ue=(Re>>3&1)+(Re>>4&1);Ue>0;Ue-=!Le[Oe++]);return Oe+(2&Re)}(qe=Le))+8>qe.length&&fg(6,"invalid gzip data"),function(Le,Re,Oe,Ue){var qe=Le.length;if(!qe||Re.f&&!Re.l)return Oe||new Xx(0);var Ct=!Oe,Ot=Ct||2!=Re.i,Jt=Re.i;Ct&&(Oe=new Xx(3*qe));var _i,xi,c=function(Le){var Re=Oe.length;if(Le>Re){var Ue=new Xx(Math.max(2*Re,Le));Ue.set(Oe),Oe=Ue}},vi=Re.f||0,bi=Re.p||0,Pi=Re.b||0,Hr=Re.l,Jr=Re.d,Ln=Re.m,Nn=Re.n,Gn=8*qe;do{if(!Hr){vi=cg(Le,bi,1);var qn=cg(Le,bi+1,3);if(bi+=3,!qn){var Zn=Le[(Is=4+((bi+7)/8|0))-4]|Le[Is-3]<<8,$n=Is+Zn;if($n>qe){Jt&&fg(0);break}Ot&&c(Pi+Zn),Oe.set(Le.subarray(Is,$n),Pi),Re.b=Pi+=Zn,Re.p=bi=8*$n,Re.f=vi;continue}if(1==qn)Hr=hv,Jr=uv,Ln=9,Nn=5;else if(2==qn){var Xn=cg(Le,bi,31)+257,Yn=cg(Le,bi+10,15)+4,lo=Xn+cg(Le,bi+5,31)+1;bi+=14;for(var uo=new Xx(lo),po=new Xx(19),fo=0;fo<Yn;++fo)po[ev[fo]]=cg(Le,bi+3*fo,7);bi+=3*Yn;var Io=ug(po),is=(1<<Io)-1,as=ig(po,Io);for(fo=0;fo<lo;){var Is,Xs=as[cg(Le,bi,is)];if(bi+=15&Xs,(Is=Xs>>4)<16)uo[fo++]=Is;else{var ta=0,ha=0;for(16==Is?(ha=3+cg(Le,bi,3),bi+=2,ta=uo[fo-1]):17==Is?(ha=3+cg(Le,bi,7),bi+=3):18==Is&&(ha=11+cg(Le,bi,127),bi+=7);ha--;)uo[fo++]=ta}}var el=uo.subarray(0,Xn),tl=uo.subarray(Xn);Ln=ug(el),Nn=ug(tl),Hr=ig(el,Ln),Jr=ig(tl,Nn)}else fg(1);if(bi>Gn){Jt&&fg(0);break}}Ot&&c(Pi+131072);for(var il=(1<<Ln)-1,sl=(1<<Nn)-1,fl=bi;;fl=bi){var Ml=(ta=Hr[hg(Le,bi)&il])>>4;if((bi+=15&ta)>Gn){Jt&&fg(0);break}if(ta||fg(2),Ml<256)Oe[Pi++]=Ml;else{if(256==Ml){fl=bi,Hr=null;break}var Al=Ml-254;Ml>264&&(Al=cg(Le,bi,(1<<(Jl=Kx[fo=Ml-257]))-1)+iv[fo],bi+=Jl);var Hl=Jr[hg(Le,bi)&sl],Wl=Hl>>4;if(Hl||fg(3),bi+=15&Hl,tl=nv[Wl],Wl>3){var Jl=Qx[Wl];tl+=hg(Le,bi)&(1<<Jl)-1,bi+=Jl}if(bi>Gn){Jt&&fg(0);break}Ot&&c(Pi+131072);var Kl=Pi+Al;if(Pi<tl){var Ql=0-tl,oc=Math.min(tl,Kl);for(Ql+Pi<0&&fg(3);Pi<oc;++Pi)Oe[Pi]=(void 0)[Ql+Pi]}for(;Pi<Kl;++Pi)Oe[Pi]=Oe[Pi-tl]}}Re.l=Hr,Re.p=fl,Re.b=Pi,Re.f=vi,Hr&&(vi=1,Re.m=Ln,Re.d=Jr,Re.n=Nn)}while(!vi);return Pi!=Oe.length&&Ct?(_i=Oe,(null==(xi=Pi)||xi>_i.length)&&(xi=_i.length),new Xx(_i.subarray(0,xi))):Oe.subarray(0,Pi)}(qe.subarray(Ct,-8),{i:2},new Xx(((Oe=qe)[(Ue=Oe.length)-4]|Oe[Ue-3]<<8|Oe[Ue-2]<<16|Oe[Ue-1]<<24)>>>0))));var Oe,Ue,qe,Ct;const Ot=mv[Re];if(!Ot)throw new Error(`Unhandled codec: ${Re}`);const Jt=new globalThis.DecompressionStream(Ot);return new Response(new Blob([Le]).stream().pipeThrough(Jt)).arrayBuffer().then((Le=>new Uint8Array(Le)))}(vi,xi).then((Le=>(function(Le,Re){Le.readFields(Fy,Re)}(new xv(Le),bi),new(0,yv[Ct])(bi.buffer)))),Pi.then((Le=>{for(let Re=_i.length-1;Re>=0;Re--)switch(_i[Re]){case"delta_filter":jy(Le,Ot);break;case"zigzag_filter":Ny(Le);break;case"bitshuffle_filter":qy(Le,Ct);break;default:throw new gg(`Unhandled filter "${_i[Re]}
1"`)}return{layerName:Re,blockIndex:Jt,data:Le}})).catch((Le=>{throw Le}))})))},os(Ag,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});var vv={workerUrl:"",workerClass:null,workerParams:void 0};const bv="mapboxgl_preloaded_worker_pool";class Pg{constructor(){this.active={}}acquire(Le){if(!this.workers)for(this.workers=[];this.workers.length<Pg.workerCount;)this.workers.push(null!=vv.workerClass?new vv.workerClass:new self.Worker(vv.workerUrl,vv.workerParams));return this.active[Le]=!0,this.workers.slice()}release(Le){delete this.active[Le],this.workers&&0===this.numActive()&&(this.workers.forEach((Le=>{Le.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[bv]}numActive(){return Object.keys(this.active).length}}let wv;function kg(){return wv||(wv=new Pg),wv}Pg.workerCount=2;let Tv,Mv,Sv,Ev,Av,Iv=null;function Dg(){return gt()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Mv||Hl.DRACO_URL}function Lg(){if(gt()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Ev)return Ev;const Le=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Ev=WebAssembly.validate(Le)?Hl.MESHOPT_SIMD_URL:Hl.MESHOPT_URL,Ev}const Cv={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pv={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},zv={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function jg(Le,Re,Oe){const Ue=Oe.json.bufferViews.length,qe=Oe.buffers.length;Re.bufferView=Ue,Oe.json.bufferViews[Ue]={buffer:qe,byteLength:Le.byteLength},Oe.buffers[qe]=Le}const Dv="KHR_draco_mesh_compression";function qg(Le,Re){const Oe=Le.extensions&&Le.extensions[Dv];if(!Oe)return;const Ue=new Sv.Decoder,qe=Hg(Re,Oe.bufferView),Ct=new Sv.Mesh;if(!Ue.DecodeArrayToMesh(qe,qe.byteLength,Ct))throw new Error("Failed to decode Draco mesh");const Ot=Re.json.accessors[Le.indices],Jt=Cv[Ot.componentType],_i=Ot.count*Jt.BYTES_PER_ELEMENT,xi=Sv._malloc(_i);Jt===Uint16Array?Ue.GetTrianglesUInt16Array(Ct,_i,xi):Ue.GetTrianglesUInt32Array(Ct,_i,xi),jg(Sv.memory.buffer.slice(xi,xi+_i),Ot,Re),Sv._free(xi);for(const qe of Object.keys(Oe.attributes)){const Ot=Ue.GetAttributeByUniqueId(Ct,Oe.attributes[qe]),Jt=Re.json.accessors[Le.attributes[qe]],_i=Pv[Jt.componentType],xi=Jt.count*zv[Jt.type]*Cv[Jt.componentType].BYTES_PER_ELEMENT,vi=Sv._malloc(xi);Ue.GetAttributeDataArrayForAllPoints(Ct,Ot,Sv[_i],xi,vi),jg(Sv.memory.buffer.slice(vi,vi+xi),Jt,Re),Sv._free(vi)}Ue.destroy(),Ct.destroy(),delete Le.extensions[Dv]}const Lv="EXT_meshopt_compression";function Gg(Le,Re){if(!Le.extensions||!Le.extensions[Lv])return;const Oe=Le.extensions[Lv],Ue=new Uint8Array(Re.buffers[Oe.buffer],Oe.byteOffset||0,Oe.byteLength||0),qe=new Uint8Array(Oe.count*Oe.byteStride);Av.decodeGltfBuffer(qe,Oe.count,Oe.byteStride,Ue,Oe.mode,Oe.filter),Le.buffer=Re.buffers.length,Le.byteOffset=0,Re.buffers[Le.buffer]=qe.buffer,delete Le.extensions[Lv]}const Rv=1179937895,kv=new TextDecoder("utf8");function Zg(Le,Re){return new URL(Le,Re).href}function Wg(Le,Re,Oe,Ue){return fetch(Zg(Le.uri,Ue)).then((Le=>Le.arrayBuffer())).then((Le=>{Re.buffers[Oe]=Le}))}function Hg(Le,Re){const Oe=Le.json.bufferViews[Re];return new Uint8Array(Le.buffers[Oe.buffer],Oe.byteOffset||0,Oe.byteLength)}function Kg(Le,Re,Oe,Ue){if(Le.uri){const qe=Zg(Le.uri,Ue);return fetch(qe).then((Le=>Le.blob())).then((Le=>createImageBitmap(Le))).then((Le=>{Re.images[Oe]=Le}))}if(void 0!==Le.bufferView){const Ue=Hg(Re,Le.bufferView),qe=new Blob([Ue],{type:Le.mimeType});return createImageBitmap(qe).then((Le=>{Re.images[Oe]=Le}))}}function Jg(Le,Re=0,Oe){const Ue={json:null,images:[],buffers:[]};if(new Uint32Array(Le,Re,1)[0]===Rv){const Oe=new Uint32Array(Le,Re);let qe=2;const Ct=(Oe[qe++]>>2)-3,Ot=Oe[qe++]>>2;if(qe++,Ue.json=JSON.parse(kv.decode(Oe.subarray(qe,qe+Ot))),qe+=Ot,qe<Ct){const Ct=Oe[qe++];qe++;const Ot=Re+(qe<<2);Ue.buffers[0]=Le.slice(Ot,Ot+Ct)}}else Ue.json=JSON.parse(kv.decode(new Uint8Array(Le,Re)));const{buffers:qe,images:Ct,meshes:Ot,extensionsUsed:Jt,bufferViews:_i}=Ue.json;let xi=Promise.resolve();if(qe){const Le=[];for(let Re=0;Re<qe.length;Re++){const Ct=qe[Re];Ct.uri?Le.push(Wg(Ct,Ue,Re,Oe)):Ue.buffers[Re]||(Ue.buffers[Re]=null)}
1xi=Promise.all(Le)}return xi.then((()=>{const Le=[],Re=Jt&&Jt.includes(Dv),qe=Jt&&Jt.includes(Lv);if(Re&&Le.push(function(){if(!Sv)return null!=Tv?Tv:(Tv=function(Le){let Re,Oe=null;function n(){Re=new Uint8Array(Oe.buffer)}function i(){throw new Error("Unexpected Draco error.")}const Ue={a:{a:i,d:function(Le,Oe,Ue){return Re.copyWithin(Le,Oe,Oe+Ue)},c:function(Le){const Ue=Re.length,qe=Math.max(Le>>>0,Math.ceil(1.2*Ue)),Ct=Math.ceil((qe-Ue)/65536);try{return Oe.grow(Ct),n(),!0}catch(Le){return!1}},b:i}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(Le,Ue):Le.then((Le=>Le.arrayBuffer())).then((Le=>WebAssembly.instantiate(Le,Ue)))).then((Le=>{const{Rb:Ue,Qb:qe,P:Ct,T:Ot,X:Jt,Ja:_i,La:xi,Qa:vi,Va:bi,Wa:Pi,eb:Hr,jb:Jr,f:Ln,e:Nn,yb:Gn,zb:qn,Ab:Zn,Bb:$n,Db:Xn,Gb:Yn}=Le.instance.exports;Oe=Nn;const lo=(()=>{let Le=0,Oe=0,Ct=0,Ot=0;return Jt=>{Ct&&(Ue(Ot),Ue(Le),Oe+=Ct,Ct=Le=0),Le||(Oe+=128,Le=qe(Oe));const _i=Jt.length+7&-8;let xi=Le;_i>=Oe&&(Ct=_i,xi=Ot=qe(_i));for(let Le=0;Le<Jt.length;Le++)Re[xi+Le]=Jt[Le];return xi}})();return n(),Ln(),{memory:Nn,_free:Ue,_malloc:qe,Mesh:class{constructor(){this.ptr=Ct()}destroy(){Ot(this.ptr)}},Decoder:class{constructor(){this.ptr=_i()}destroy(){Jr(this.ptr)}DecodeArrayToMesh(Le,Re,Oe){const Ue=lo(Le),qe=xi(this.ptr,Ue,Re,Oe.ptr);return!!Jt(qe)}GetAttributeByUniqueId(Le,Re){return{ptr:vi(this.ptr,Le.ptr,Re)}}GetTrianglesUInt16Array(Le,Re,Oe){bi(this.ptr,Le.ptr,Re,Oe)}GetTrianglesUInt32Array(Le,Re,Oe){Pi(this.ptr,Le.ptr,Re,Oe)}GetAttributeDataArrayForAllPoints(Le,Re,Oe,Ue,qe){Hr(this.ptr,Le.ptr,Re.ptr,Oe,Ue,qe)}},DT_INT8:Gn(),DT_UINT8:qn(),DT_INT16:Zn(),DT_UINT16:$n(),DT_UINT32:Xn(),DT_FLOAT32:Yn()}}))}(fetch(Dg())),Tv.then((Le=>{Sv=Le,Tv=void 0})))}()),qe&&Le.push(function(){if(Av)return;const Le=function(Le){let Re;const Oe=WebAssembly.instantiateStreaming(Le,{}).then((Le=>{Re=Le.instance,Re.exports.__wasm_call_ctors()})),Ue={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},qe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Oe,supported:!0,decodeGltfBuffer(Le,Oe,Ct,Ot,Jt,_i){!function(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=Le.exports.sbrk,_i=Ue+3&-4,xi=Jt(_i*qe),vi=Jt(Ct.length),bi=new Uint8Array(Le.exports.memory.buffer);bi.set(Ct,vi);const Pi=Re(xi,Ue,qe,vi,Ct.length);if(0===Pi&&Ot&&Ot(xi,_i,qe),Oe.set(bi.subarray(xi,xi+Ue*qe)),Jt(xi-Jt(0)),0!==Pi)throw new Error(`Malformed buffer data: ${Pi}`)}(Re,Re.exports[qe[Jt]],Le,Oe,Ct,Ot,Re.exports[Ue[_i]])}}}(fetch(Lg()));return Le.ready.then((()=>{Av=Le}))}()),Ct)for(let Re=0;Re<Ct.length;Re++)Le.push(Kg(Ct[Re],Ue,Re,Oe));return(Le.length?Promise.all(Le):Promise.resolve()).then((()=>
1{if(Re&&Ot)for(const{primitives:Le}of Ot)for(const Re of Le)qg(Re,Ue);if(qe&&Ot&&_i)for(const Le of _i)Gg(Le,Ue);return Ue}))}))}function Qg(Le,Re){const Oe=Le.json.bufferViews[Re.bufferView],Ue=Cv[Re.componentType];return new Ue(Le.buffers[Oe.buffer],(Re.byteOffset||0)+(Oe.byteOffset||0),Re.count*(Oe.byteStride&&Oe.byteStride!==zv[Re.type]*Ue.BYTES_PER_ELEMENT?Oe.byteStride/Ue.BYTES_PER_ELEMENT:zv[Re.type]))}function tx(Le,Re,Oe,Ue){const qe=Cv[Re.componentType],Ct=function(Le){switch(Le){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(qe),Ot=Le.json.bufferViews[Re.bufferView],Jt=Ot.byteStride?Ot.byteStride/qe.BYTES_PER_ELEMENT:zv[Re.type],_i=Oe.float32,xi=_i.length/Oe.capacity;for(let Le=0,Oe=0;Le<Re.count*Jt;Le+=Jt,Oe+=xi)for(let Re=0;Re<xi;Re++)_i[Oe+Re]=Ue[Le+Re]*Ct;Oe._trim()}function ex(Le,Re,Oe){const Ue=Le.indices,qe=Le.attributes,Ct={};Ct.indexArray=new Da;const Ot=Re.json.accessors[Ue],Jt=Ot.count/3;Ct.indexArray.reserve(Jt);const _i=Qg(Re,Ot);for(let Le=0;Le<Jt;Le++)Ct.indexArray.emplaceBack(_i[3*Le],_i[3*Le+1],_i[3*Le+2]);Ct.indexArray._trim(),Ct.vertexArray=new Aa;const xi=Re.json.accessors[qe.POSITION];Ct.vertexArray.reserve(xi.count);const vi=Qg(Re,xi);for(let Le=0;Le<xi.count;Le++)Ct.vertexArray.emplaceBack(vi[3*Le],vi[3*Le+1],vi[3*Le+2]);if(Ct.vertexArray._trim(),Ct.aabb=new yu(xi.min,xi.max),Ct.centroid=function(Le,Re){const Oe=[0,0,0],Ue=Le.length;if(Ue>0){for(let qe=0;qe<Ue;qe++){const Ue=3*Le[qe];Oe[0]+=Re[Ue],Oe[1]+=Re[Ue+1],Oe[2]+=Re[Ue+2]}Oe[0]/=Ue,Oe[1]/=Ue,Oe[2]/=Ue}return Oe}(_i,vi),void 0!==qe.COLOR_0){const Le=Re.json.accessors[qe.COLOR_0],Oe=zv[Le.type],Ue=Qg(Re,Le);Ct.colorArray=3===Oe?new Aa:new Ma,Ct.colorArray.resize(Le.count),tx(Re,Le,Ct.colorArray,Ue)}if(void 0!==qe.NORMAL){Ct.normalArray=new Aa;const Le=Re.json.accessors[qe.NORMAL];Ct.normalArray.resize(Le.count);const Oe=Qg(Re,Le);
vendor: 3,230 bytes, line 1
1tx(Re,Le,Ct.normalArray,Oe)}if(void 0!==qe.TEXCOORD_0&&Oe.length>0){Ct.texcoordArray=new $a;const Le=Re.json.accessors[qe.TEXCOORD_0];Ct.texcoordArray.resize(Le.count);const Oe=Qg(Re,Le);tx(Re,Le,Ct.texcoordArray,Oe)}if(void 0!==qe._FEATURE_ID_RGBA4444){const Le=Re.json.accessors[qe._FEATURE_ID_RGBA4444];Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("EXT_meshopt_compression")&&(Ct.featureData=Qg(Re,Le))}void 0!==qe._FEATURE_RGBA4444&&(Ct.featureData=new Uint32Array(Qg(Re,Re.json.accessors[qe._FEATURE_RGBA4444]).buffer));const bi=Le.material;return Ct.material=function(Le,Re){const{emissiveFactor:Oe=[0,0,0],alphaMode:Ue="OPAQUE",alphaCutoff:qe=.5,normalTexture:Ct,occlusionTexture:Ot,emissiveTexture:Jt,doubleSided:_i}=Le,{baseColorFactor:xi=[1,1,1,1],metallicFactor:vi=1,roughnessFactor:bi=1,baseColorTexture:Pi,metallicRoughnessTexture:Hr}=Le.pbrMetallicRoughness||{},Jr=Ot?Re[Ot.index]:void 0;if(Ot&&Ot.extensions&&Ot.extensions.KHR_texture_transform&&Jr){const Le=Ot.extensions.KHR_texture_transform;Jr.offsetScale=[Le.offset[0],Le.offset[1],Le.scale[0],Le.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Pe(...xi),metallicFactor:vi,roughnessFactor:bi,baseColorTexture:Pi?Re[Pi.index]:void 0,metallicRoughnessTexture:Hr?Re[Hr.index]:void 0},doubleSided:_i,emissiveFactor:Oe,alphaMode:Ue,alphaCutoff:qe,normalTexture:Ct?Re[Ct.index]:void 0,occlusionTexture:Jr,emissionTexture:Jt?Re[Jt.index]:void 0,defined:void 0===Le.defined}}(void 0!==bi?Re.json.materials[bi]:{defined:!1},Oe),Ct}function rx(Le,Re,Oe){const{matrix:Ue,rotation:qe,translation:Ct,scale:Ot,mesh:Jt,extras:_i,children:xi}=Le,vi={};if(vi.matrix=Ue||as.mat4.fromRotationTranslationScale([],qe||[0,0,0,1],Ct||[0,0,0],Ot||[1,1,1]),void 0!==Jt){vi.meshes=Oe[Jt];const Le=vi.anchor=[0,0];for(const Re of vi.meshes){const{min:Oe,max:Ue}=Re.aabb;Le[0]+=Oe[0]+Ue[0],Le[1]+=Oe[1]+Ue[1]}Le[0]=Math.floor(Le[0]/vi.meshes.length/2),Le[1]=Math.floor(Le[1]/vi.meshes.length/2)}if(_i&&(_i.id&&(vi.id=_i.id),_i.lights&&(vi.lights=function(Le){if(!Le.length)return[];const Re=function(Le){const Re=atob(Le),Oe=new Uint8Array(Re.length);for(let Le=0;Le<Re.length;Le++)Oe[Le]=Re.codePointAt(Le);return Oe}(Le),Oe=[],Ue=Re.length/24,qe=new Uint16Array(Re.buffer),Ct=new Float32Array(Re.buffer);for(let Le=0;Le<Ue;Le++){const Re=qe[2*Le*6]/30,Ue=qe[2*Le*6+1]/30,Ot=qe[2*Le*6+10]/100,Jt=Ct[6*Le+1],_i=Ct[6*Le+2],xi=Ct[6*Le+3],vi=Ct[6*Le+4],bi=xi-Jt,Pi=vi-_i,Hr=Math.hypot(bi,Pi);Oe.push({pos:[Jt+.5*bi,_i+.5*Pi,Ue],normal:[Pi/Hr,-bi/Hr,0],width:Hr,height:Re,depth:Ot,points:[Jt,_i,xi,vi]})}return Oe}(_i.lights))),xi){const Le=[];for(const Ue of xi)Le.push(rx(Re.json.nodes[Ue],Re,Oe));vi.children=Le}return vi}function nx(Le){if(0===Le.vertices.length||0===Le.indices.length)return null;const Re=new qc(Le.vertices,Le.indices,8,256),[Oe,Ue]=[Re.min.clone(),Re.max.clone()];return{vertices:Le.vertices,indices:Le.indices,grid:Re,min:Oe,max:Ue}}function ix(Le){if(!Le.extras||!Le.extras.ground)return null;const Re=Le.extras.ground;if(!Re||!Array.isArray(Re)||0===Re.length)return null;const Oe=Re[0];if(!Oe||!Array.isArray(Oe)||0===Oe.length)return null;const Ue=[];for(const Le of Oe){if(!Array.isArray(Le)||2!==Le.length)continue;const Re=Le[0],Oe=Le[1];
vendor: 7,074 bytes, line 1
1"number"==typeof Re&&"number"==typeof Oe&&Ue.push(new ta(Re,Oe))}if(Ue.length<3)return null;Ue.length>1&&Ue[Ue.length-1].equals(Ue[0])&&Ue.pop();let qe=0;for(let Le=0;Le<Ue.length;Le++){const Re=Ue[Le],Oe=Ue[(Le+1)%Ue.length],Ct=Ue[(Le+2)%Ue.length];qe+=(Re.x-Oe.x)*(Ct.y-Oe.y)-(Ct.x-Oe.x)*(Re.y-Oe.y)}qe>0&&Ue.reverse();const Ct=uc(Ue.flatMap((Le=>[Le.x,Le.y])),[]);return 0===Ct.length?null:{vertices:Ue,indices:Ct}}function sx(Le,Re){const Oe=[],Ue=[];let qe=0;const Ct=[];for(const Ot of Le){qe=Oe.length;const Le=Ot.vertexArray.float32,Jt=Ot.indexArray.uint16;for(let Ue=0;Ue<Ot.vertexArray.length;Ue++)Ct[0]=Le[3*Ue+0],Ct[1]=Le[3*Ue+1],Ct[2]=Le[3*Ue+2],as.vec3.transformMat4(Ct,Ct,Re),Oe.push(new ta(Ct[0],Ct[1]));for(let Le=0;Le<3*Ot.indexArray.length;Le++)Ue.push(Jt[Le]+qe)}if(Ue.length%3!=0)return null;for(let Le=0;Le<Ue.length;Le+=3){const Re=Oe[Ue[Le+0]],qe=Oe[Ue[Le+1]],Ct=Oe[Ue[Le+2]];(Re.x-qe.x)*(Ct.y-qe.y)-(Ct.x-qe.x)*(Re.y-qe.y)>0&&([Ue[Le+1],Ue[Le+2]]=[Ue[Le+2],Ue[Le+1]])}return{vertices:Oe,indices:Ue}}function ax(Le){const Re=function(Le,Re){const Oe=[],Ue=WebGL2RenderingContext;if(Le.json.textures)for(const qe of Le.json.textures){const Ct={magFilter:Ue.LINEAR,minFilter:Ue.NEAREST,wrapS:Ue.REPEAT,wrapT:Ue.REPEAT};void 0!==qe.sampler&&Object.assign(Ct,Le.json.samplers[qe.sampler]),Oe.push({image:Re[qe.source],sampler:Ct,uploaded:!1})}return Oe}(Le,Le.images),Oe=function(Le,Re){const Oe=[];for(const Ue of Le.json.meshes){const qe=[];for(const Oe of Ue.primitives)qe.push(ex(Oe,Le,Re));Oe.push(qe)}return Oe}(Le,Re),{scenes:Ue,scene:qe,nodes:Ct}=Le.json,Ot=Ue?Ue[qe||0].nodes:Ct,Jt=[];for(const Re of Ot)Jt.push(rx(Ct[Re],Le,Oe));return function(Le,Re,Oe){const Ue={},qe=new Set;for(let Ct=0;Ct<Le.length;Ct++){const Le=Oe[Re[Ct]];if(!Le.extras)continue;const Ot=Le.extras["mapbox:footprint:version"],Jt=Le.extras["mapbox:footprint:id"];(Ot||Jt)&&qe.add(Ct),"1.0.0"===Ot&&Jt&&(Ue[Jt]=Ct)}for(let Ct=0;Ct<Le.length;Ct++){if(qe.has(Ct))continue;const Ot=Le[Ct],Jt=Oe[Re[Ct]];if(!Jt.extras)continue;let _i=null;Ot.id in Ue&&(_i=sx(Le[Ue[Ot.id]].meshes,Ot.matrix)),_i||(_i=ix(Jt)),_i&&(Ot.footprint=nx(_i))}if(qe.size>0){const Re=Array.from(qe.values()).sort(((Le,Re)=>Le-Re));for(let Oe=Re.length-1;Oe>=0;Oe--)Le.splice(Re[Oe],1)}}(Jt,Ot,Le.json.nodes),Jt}function ox(Le){Le.heightmap=new Float32Array(4096),Le.heightmap.fill(-1);const Re=Le.vertexArray.float32,Oe=Le.aabb.min[0]-1,Ue=Le.aabb.min[1]-1,qe=jx/(Le.aabb.max[0]-Oe+2),Ct=jx/(Le.aabb.max[1]-Ue+2);for(let Ot=0;Ot<Re.length;Ot+=3){const Jt=Re[Ot+2],_i=(Re[Ot+0]-Oe)*qe|0,xi=(Re[Ot+1]-Ue)*Ct|0;Jt>Le.heightmap[xi*jx+_i]&&(Le.heightmap[xi*jx+_i]=Jt)}}function lx(Le,Re){const Oe={};Oe.indexArray=new Da,Oe.indexArray.reserve(4*Le.length),Oe.vertexArray=new Aa,Oe.vertexArray.reserve(10*Le.length),Oe.colorArray=new Ma,Oe.vertexArray.reserve(10*Le.length);let Ue=0;for(const qe of Le){const Le=Math.min(10,Math.max(4,1.3*qe.height))*Re,Ct=[-qe.normal[1],qe.normal[0],0],Ot=Math.min(.29,.1*qe.width/qe.depth),Jt=qe.width-2*qe.depth*Re*(Ot+.01),_i=as.vec3.scaleAndAdd([],qe.pos,Ct,Jt/2),xi=as.vec3.scaleAndAdd([],qe.pos,Ct,-Jt/2),vi=[_i[0],_i[1],_i[2]+qe.height],bi=[xi[0],xi[1],xi[2]+qe.height],Pi=as.vec3.scaleAndAdd([],qe.normal,Ct,Ot);as.vec3.scale(Pi,Pi,Le);const Hr=as.vec3.scaleAndAdd([],qe.normal,Ct,-Ot);as.vec3.scale(Hr,Hr,Le),as.vec3.add(Pi,_i,Pi),as.vec3.add(Hr,xi,Hr),_i[2]+=.1,xi[2]+=.1,Oe.vertexArray.emplaceBack(Pi[0],Pi[1],Pi[2]),Oe.vertexArray.emplaceBack(Hr[0],Hr[1],Hr[2]),Oe.vertexArray.emplaceBack(_i[0],_i[1],_i[2]),Oe.vertexArray.emplaceBack(xi[0],xi[1],xi[2]),Oe.vertexArray.emplaceBack(vi[0],vi[1],vi[2]),Oe.vertexArray.emplaceBack(bi[0],bi[1],bi[2]),Oe.vertexArray.emplaceBack(_i[0],_i[1],_i[2]),Oe.vertexArray.emplaceBack(xi[0],xi[1],xi[2]),Oe.vertexArray.emplaceBack(Pi[0],Pi[1],Pi[2]),Oe.vertexArray.emplaceBack(Hr[0],Hr[1],Hr[2]);const Jr=Jt/Le/2;Oe.colorArray.emplaceBack(-Jr-Ot,-1,Jr,.8),Oe.colorArray.emplaceBack(Jr+Ot,-1,Jr,.8),Oe.colorArray.emplaceBack(-Jr,0,Jr,1.3),Oe.colorArray.emplaceBack(Jr,0,Jr,1.3),Oe.colorArray.emplaceBack(Jr+Ot,-.8,Jr,.7),Oe.colorArray.emplaceBack(Jr+Ot,-.8,Jr,.7),Oe.colorArray.emplaceBack(0,0,Jr,1.3),Oe.colorArray.emplaceBack(0,0,Jr,1.3),Oe.colorArray.emplaceBack(Jr+Ot,-1.2,Jr,.8),Oe.colorArray.emplaceBack(Jr+Ot,-1.2,Jr,.8),Oe.indexArray.emplaceBack(6+Ue,4+Ue,8+Ue),Oe.indexArray.emplaceBack(7+Ue,9+Ue,5+Ue),Oe.indexArray.emplaceBack(0+Ue,1+Ue,2+Ue),Oe.indexArray.emplaceBack(1+Ue,3+Ue,2+Ue),Ue+=10}const qe={defined:!0,emissiveFactor:[0,0,0]},Ct={};return Ct.baseColorFactor=Pe.white,qe.pbrMetallicRoughness=Ct,Oe.material=qe,Oe.aabb=new yu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Oe}class ux{constructor(Le){this._stringToNumber={},this._numberToString=[];for(let Re=0;Re<Le.length;Re++){const Oe=Le[Re];this._stringToNumber[Oe]=Re,this._numberToString[Re]=Oe}}encode(Le){return this._stringToNumber[Le]}decode(Le){return this._numberToString[Le]}}const Ov=["id","tile","layer","source","sourceLayer","state"];class hx{constructor(Le,Re,Oe,Ue,qe){this.type="Feature",this._vectorTileFeature=Le,this._z=Re,this._x=Oe,this._y=Ue,this.properties=Le.properties,this.id=qe}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(Le){this._geometry=Le}toJSON(){const Le={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const Re of Ov)void 0!==this[Re]&&(Le[Re]=this[Re]);return Le}}class px{constructor(Le,Re){this.tileID=Le,this.x=Le.canonical.x,this.y=Le.canonical.y,this.z=Le.canonical.z,this.grid=new vp(ud,16,0),this.featureIndexArray=new io,this.promoteId=Re,this.is3DTile=!1}insert(Le,Re,Oe,Ue,qe,Ct=0,Ot=0){const Jt=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(Oe,Ue,qe,Ct);const _i=this.grid;for(let Le=0;Le<Re.length;Le++){const Oe=Re[Le],Ue=[1/0,1/0,-1/0,-1/0];for(let Le=0;Le<Oe.length;Le++){const Re=Oe[Le];Ue[0]=Math.min(Ue[0],Re.x),Ue[1]=Math.min(Ue[1],Re.y),Ue[2]=Math.max(Ue[2],Re.x),Ue[3]=Math.max(Ue[3],Re.y)}0!==Ot&&(Ue[0]-=Ot,Ue[1]-=Ot,Ue[2]+=Ot,Ue[3]+=Ot),Ue[0]<ud&&Ue[1]<ud&&Ue[2]>=0&&Ue[3]>=0&&_i.insert(Jt,Ue[0],Ue[1],Ue[2],Ue[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new A_.VectorTile(new Sg(this.rawTileData)).layers,this.sourceLayerCoder=new ux(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const Le in this.vtLayers)this.vtFeatures[Le]=[]}return this.vtLayers}query(Le,Re,Oe,Ue){this.loadVTLayers();const qe=Le.params||{},Ct=Hs(qe.filter),Ot=Le.tileResult,Jt=Le.transform,_i=Ot.bufferedTilespaceBounds,xi=this.grid.query(_i.min.x,_i.min.y,_i.max.x,_i.max.y,((Le,Re,Oe,Ue)=>jl(Ot.bufferedTilespaceGeometry,Le,Re,Oe,Ue)));xi.sort(dx);let vi=null;Jt.elevation&&xi.length>0&&(vi=ny.create(Jt.elevation,this.tileID));const bi={};let Pi;for(let _i=0;_i<xi.length;_i++){const Hr=xi[_i];if(Hr===Pi)continue;Pi=Hr;const Jr=this.featureIndexArray.get(Hr);let Ln=null;if(this.is3DTile){const Le=this.bucketLayerIDs[0][0],Oe=Re[Le];if("model"!==Oe.type)continue;const{queryFeature:Ue,intersectionZ:qe}
vendor: 5,041 bytes, line 1
1=Oe.queryIntersectsMatchingFeature(Ot,Jr.featureIndex,Ct,Jt);Ue&&this.appendToResult(bi,Le,Jr.featureIndex,Ue,qe)}else this.loadMatchingFeature(bi,Jr,Ct,qe.layers,qe.availableImages,Re,Oe,Ue,((Re,Oe,Ue,qe=0)=>(Ln||(Ln=Il(Re,this.tileID.canonical,Le.tileTransform)),Oe.queryIntersectsFeature(Ot,Re,Ue,Ln,this.z,Le.transform,Le.pixelPosMatrix,vi,qe))))}return bi}loadMatchingFeature(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const{featureIndex:xi,bucketIndex:vi,sourceLayerIndex:bi,layoutVertexArrayOffset:Pi}=Re,Hr=this.bucketLayerIDs[vi];if(Ue&&!function(Le,Re){for(let Oe=0;Oe<Le.length;Oe++)if(Re.indexOf(Le[Oe])>=0)return!0;return!1}(Ue,Hr))return;const Jr=this.sourceLayerCoder.decode(bi),Ln=this.vtLayers[Jr].feature(xi);if(Oe.needGeometry){const Le=Pl(Ln,!0);if(!Oe.filter(new Vs(this.tileID.overscaledZ),Le,this.tileID.canonical))return}else if(!Oe.filter(new Vs(this.tileID.overscaledZ),Ln))return;const Nn=this.getId(Ln,Jr);for(let Re=0;Re<Hr.length;Re++){const Oe=Hr[Re];if(Ue&&Ue.indexOf(Oe)<0)continue;const vi=Ct[Oe];if(!vi)continue;let bi={};void 0!==Nn&&Jt&&(bi=Jt.getState(vi.sourceLayer||"_geojsonTileLayer",Nn));const Jr=!_i||_i(Ln,vi,bi,Pi);if(!Jr)continue;const Gn=new hx(Ln,this.z,this.x,this.y,Nn),qn=nt({},Ot[Oe]);qn.paint=fx(qn.paint,vi.paint,Ln,bi,qe),qn.layout=fx(qn.layout,vi.layout,Ln,bi,qe),Gn.layer=qn,this.appendToResult(Le,Oe,xi,Gn,Jr)}}appendToResult(Le,Re,Oe,Ue,qe){let Ct=Le[Re];void 0===Ct&&(Ct=Le[Re]=[]),Ct.push({featureIndex:Oe,feature:Ue,intersectionZ:qe})}lookupSymbolFeatures(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i={};this.loadVTLayers();const xi=Hs(qe);for(const qe of Le)this.loadMatchingFeature(_i,{bucketIndex:Oe,sourceLayerIndex:Ue,featureIndex:qe,layoutVertexArrayOffset:0},xi,Ct,Ot,Jt,Re);return _i}loadFeature(Le){const{featureIndex:Re,sourceLayerIndex:Oe}=Le;this.loadVTLayers();const Ue=this.sourceLayerCoder.decode(Oe),qe=this.vtFeatures[Ue];if(qe[Re])return qe[Re];const Ct=this.vtLayers[Ue].feature(Re);return qe[Re]=Ct,Ct}hasLayer(Le){for(const Re of this.bucketLayerIDs)for(const Oe of Re)if(Le===Oe)return!0;return!1}getId(Le,Re){let Oe=Le.id;if(this.promoteId){const Ue="string"==typeof this.promoteId?this.promoteId:this.promoteId[Re];null!=Ue&&(Oe=Le.properties[Ue]),"boolean"==typeof Oe&&(Oe=Number(Oe))}return Oe}}function fx(Le,Re,Oe,Ue,qe){return ut(Le,((Le,Ct)=>{const Ot=Re instanceof js?Re.get(Ct):null;return Ot&&Ot.evaluate?Ot.evaluate(Oe,Ue,qe):Ot}))}function dx(Le,Re){return Re-Le}os(px,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Fv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class yx{static from(Le){if(!(Le instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[Re,Oe]=new Uint8Array(Le,0,2);if(219!==Re)throw new Error("Data does not appear to be in a KDBush format.");const Ue=Oe>>4;if(1!==Ue)throw new Error(`Got v${Ue} data when expected v1.`);const qe=Fv[15&Oe];if(!qe)throw new Error("Unrecognized array type.");const[Ct]=new Uint16Array(Le,2,1),[Ot]=new Uint32Array(Le,4,1);return new yx(Ot,Ct,qe,Le)}constructor(Le,Re=64,Oe=Float64Array,Ue){if(isNaN(Le)||Le<0)throw new Error(`Unpexpected numItems value: ${Le}.`);this.numItems=+Le,this.nodeSize=Math.min(Math.max(+Re,2),65535),this.ArrayType=Oe,this.IndexArrayType=Le<65536?Uint16Array:Uint32Array;const qe=Fv.indexOf(this.ArrayType),Ct=2*Le*this.ArrayType.BYTES_PER_ELEMENT,Ot=Le*this.IndexArrayType.BYTES_PER_ELEMENT,Jt=(8-Ot%8)%8;if(qe<0)throw new Error(`Unexpected typed array class: ${Oe}.`);Ue&&Ue instanceof ArrayBuffer?(this.data=Ue,this.ids=new this.IndexArrayType(this.data,8,Le),this.coords=new this.ArrayType(this.data,8+Ot+Jt,2*Le),this._pos=2*Le,this._finished=!0):(this.data=new ArrayBuffer(8+Ct+Ot+Jt),this.ids=new this.IndexArrayType(this.data,8,Le),this.coords=new this.ArrayType(this.data,8+Ot+Jt,2*Le),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+qe]),new Uint16Array(this.data,2,1)[0]=Re,new Uint32Array(this.data,4,1)[0]=Le)}add(Le,Re){const Oe=this._pos>>1;return this.ids[Oe]=Oe,this.coords[this._pos++]=Le,this.coords[this._pos++]=Re,Oe}finish(){const Le=this._pos>>1;if(Le!==this.numItems)throw new Error(`Added ${Le} items when expected ${this.numItems}.`);return gx(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(Le,Re,Oe,Ue){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:qe,coords:Ct,nodeSize:Ot}=this,Jt=[0,qe.length-1,0],_i=[];for(;Jt.length;){const xi=Jt.pop()||0,vi=Jt.pop()||0,bi=Jt.pop()||0;if(vi-bi<=Ot){for(let Ot=bi;Ot<=vi;Ot++){const Jt=Ct[2*Ot],xi=Ct[2*Ot+1];Jt>=Le&&Jt<=Oe&&xi>=Re&&xi<=Ue&&_i.push(qe[Ot])}continue}const Pi=bi+vi>>1,Hr=Ct[2*Pi],Jr=Ct[2*Pi+1];Hr>=Le&&Hr<=Oe&&Jr>=Re&&Jr<=Ue&&_i.push(qe[Pi]),(0===xi?Le<=Hr:Re<=Jr)&&(Jt.push(bi),Jt.push(Pi-1),Jt.push(1-xi)),(0===xi?Oe>=Hr:Ue>=Jr)&&(Jt.push(Pi+1),Jt.push(vi),Jt.push(1-xi))}return _i}within(Le,Re,Oe){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");
1const{ids:Ue,coords:qe,nodeSize:Ct}=this,Ot=[0,Ue.length-1,0],Jt=[],_i=Oe*Oe;for(;Ot.length;){const xi=Ot.pop()||0,vi=Ot.pop()||0,bi=Ot.pop()||0;if(vi-bi<=Ct){for(let Oe=bi;Oe<=vi;Oe++)wx(qe[2*Oe],qe[2*Oe+1],Le,Re)<=_i&&Jt.push(Ue[Oe]);continue}const Pi=bi+vi>>1,Hr=qe[2*Pi],Jr=qe[2*Pi+1];wx(Hr,Jr,Le,Re)<=_i&&Jt.push(Ue[Pi]),(0===xi?Le-Oe<=Hr:Re-Oe<=Jr)&&(Ot.push(bi),Ot.push(Pi-1),Ot.push(1-xi)),(0===xi?Le+Oe>=Hr:Re+Oe>=Jr)&&(Ot.push(Pi+1),Ot.push(vi),Ot.push(1-xi))}return Jt}}function gx(Le,Re,Oe,Ue,qe,Ct){if(qe-Ue<=Oe)return;const Ot=Ue+qe>>1;xx(Le,Re,Ot,Ue,qe,Ct),gx(Le,Re,Oe,Ue,Ot-1,1-Ct),gx(Le,Re,Oe,Ot+1,qe,1-Ct)}function xx(Le,Re,Oe,Ue,qe,Ct){for(;qe>Ue;){if(qe-Ue>600){const Ot=qe-Ue+1,Jt=Oe-Ue+1,_i=Math.log(Ot),xi=.5*Math.exp(2*_i/3),vi=.5*Math.sqrt(_i*xi*(Ot-xi)/Ot)*(Jt-Ot/2<0?-1:1);xx(Le,Re,Oe,Math.max(Ue,Math.floor(Oe-Jt*xi/Ot+vi)),Math.min(qe,Math.floor(Oe+(Ot-Jt)*xi/Ot+vi)),Ct)}const Ot=Re[2*Oe+Ct];let Jt=Ue,_i=qe;for(bx(Le,Re,Ue,Oe),Re[2*qe+Ct]>Ot&&bx(Le,Re,Ue,qe);Jt<_i;){for(bx(Le,Re,Jt,_i),Jt++,_i--;Re[2*Jt+Ct]<Ot;)Jt++;for(;Re[2*_i+Ct]>Ot;)_i--}Re[2*Ue+Ct]===Ot?bx(Le,Re,Ue,_i):(_i++,bx(Le,Re,_i,qe)),_i<=Oe&&(Ue=_i+1),Oe<=_i&&(qe=_i-1)}}function bx(Le,Re,Oe,Ue){vx(Le,Oe,Ue),vx(Re,2*Oe,2*Ue),vx(Re,2*Oe+1,2*Ue+1)}function vx(Le,Re,Oe){const Ue=Le[Re];Le[Re]=Le[Oe],Le[Oe]=Ue}function wx(Le,Re,Oe,Ue){const qe=Le-Oe,Ct=Re-Ue;return qe*qe+Ct*Ct}Le.$=Ds,Le.A=class extends Nm{},Le.B=hr,Le.C=Be,Le.D=Ys,Le.E=Me,Le.F=Oi,Le.G=Di,Le.H=Fi,Le.I=Of,Le.J=Wi,Le.K=Zs,Le.L=Qi,Le.M=Hi,Le.N=Bn,Le.O=Cn,Le.P=ta,Le.Q=En,Le.R=ih,Le.S=yr,Le.T=lm,Le.U=Gh,Le.V=Nm,Le.W=Ws,Le.X=Ui,Le.Y=Li,Le.Z=function(Le){const Re=Le.value;let Oe=[];if(!Re)return Oe;const Ue=hr(Re);return"string"!==Ue?(Oe=Oe.concat([new Nm(Le.key,Re,`string expected, "${Ue}" found`)]),Oe):(qm(Re,!0)||(Oe=Oe.concat([new Nm(Le.key,Re,`invalid url "${Re}"`)])),Oe)},Le._=Vp,Le.a=function(Le){return Hl.API_CDN_URL_REGEX.test(Le)},Le.a$=qa,Le.a0=Gs,Le.a1=Ns,Le.a2=class{constructor(Le){this.specification=Le}possiblyEvaluate(Le,Re){return yt(Le.expression.evaluate(Re))}interpolate(Le,Re,Oe){return{x:ke(Le.x,Re.x,Oe),y:ke(Le.y,Re.y,Oe),z:ke(Le.z,Re.z,Oe),azimuthal:ke(Le.azimuthal,Re.azimuthal,Oe),polar:ke(Le.polar,Re.polar,Oe)}}},Le.a3=Vs,Le.a4=Ji,Le.a5=xl,Le.a6=as,Le.a7=tt,Le.a8=js,Le.a9=Du,Le.aA=ru,Le.aB=mm,Le.aC=wm,Le.aD=fm,Le.aE=function(Le,Re){const Oe=document.createElement("video");Oe.muted=!0,Oe.onloadstart=function(){Re(null,Oe)};for(let Re=0;Re<Le.length;Re++){const Ue=document.createElement("source");ae(Le[Re])||(Oe.crossOrigin="Anonymous"),Ue.src=Le[Re],Oe.appendChild(Ue)}return{cancel:()=>{}}},Le.aF=um,Le.aG=function(Le){return fetch(Le).then((Le=>Le.arrayBuffer())).then((Re=>Jg(Re,0,Le)))},Le.aH=ax,Le.aI=class{constructor(Le,Re,Oe,Ue){this.id=Le,this.position=null!=Re?new rl(Re[0],Re[1]):new rl(0,0),this.orientation=null!=Oe?Oe:[0,0,0],this.nodes=Ue,this.uploaded=!1,this.aabb=new yu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(Le,Re){if(as.mat4.multiply(Le.matrix,Re,Le.matrix),Le.meshes)for(const Re of Le.meshes){const Oe=yu.applyTransformFast(Re.aabb,Le.matrix);this.aabb.encapsulate(Oe)}if(Le.children)for(const Re of Le.children)this._applyTransformations(Re,Le.matrix)}computeBoundsAndApplyParent(){const Le=as.mat4.identity([]);for(const Re of this.nodes)this._applyTransformations(Re,Le)}computeModelMatrix(Le,Re,Oe,Ue,qe,Ct,Ot=!1){Km(this.matrix,this,Le.transform,this.position,Re,Oe,Ue,qe,Ct,Ot)}upload(Le){if(!this.uploaded){for(const Re of this.nodes)ty(Re,Le);for(const Le of this.nodes)ey(Le);this.uploaded=!0}}destroy(){for(const Le of this.nodes)ry(Le)}},Le.aJ=ot,Le.aK=yd,Le.aL=cl,Le.aM=hl,Le.aN=va,Le.aO=Da,Le.aP=st,Le.aQ=Ha,Le.aR=Zd,Le.aS=function(){Np.isLoading()||Np.isLoaded()||"deferred"!==Ts()||Es()},Le.aT=Hs,Le.aU=Pl,Le.aV=hx,Le.aW=xt,Le.aX=wp,Le.aY=Fc,Le.aZ=Il,Le.a_=xa,Le.aa=ke,Le.ab=ud,Le.ac=Te,Le.ad=class{constructor(Le){this.specification=Le}possiblyEvaluate(Le,Re){return function([Le,Re]){const Oe=yt([1,Le,Re]);return{x:Oe.x,y:Oe.y,z:Oe.z}}(Le.expression.evaluate(Re))}interpolate(Le,Re,Oe){return{x:ke(Le.x,Re.x,Oe),y:ke(Le.y,Re.y,Oe),z:ke(Le.z,Re.z,Oe)}}},Le.ae=function(Le,Re,Oe=0,Ue=!0){const qe=new ta(Oe,Oe),Ct=Le.sub(qe),Ot=Re.add(qe),Jt=[Ct,new ta(Ot.x,Ct.y),Ot,new ta(Ct.x,Ot.y)];return Ue&&Jt.push(Ct.clone()),Jt},Le.af=function(Le,Re){const Oe=[];for(let Ue=0;Ue<Le.length;Ue++){const qe=et(Ue-1,-1,Le.length-1),Ct=et(Ue+1,-1,Le.length-1),Ot=Le[Ue],Jt=Le[Ct],_i=Le[qe].sub(Ot).unit(),xi=Jt.sub(Ot).unit(),vi=xi.angleWithSep(_i.x,_i.y),bi=_i.add(xi).unit().mult(-1*Re/Math.sin(vi/2));Oe.push(Ot.add(bi))}return Oe},Le.ag=gd,Le.ah=jl,Le.ai=function(Le,Re,Oe=0){return as.vec3.fromValues(((Re.x-Oe)*Le.scale-Le.x)*ud,(Re.y*Le.scale-Le.y)*ud,pl(Re.z,Re.y))},Le.aj=uu,Le.ak=Sp,Le.al=function(Le){let Re=1/0,Oe=1/0,Ue=-1/0,qe=-1/0;for(const Ct of Le)Re=Math.min(Re,Ct.x),Oe=Math.min(Oe,Ct.y),Ue=Math.max(Ue,Ct.x),qe=Math.max(qe,Ct.y);return{min:new ta(Re,Oe),max:new ta(Ue,qe)}},Le.am=ol,Le.an=Ul,Le.ao=vl,Le.ap=Q,Le.aq=gf,Le.ar=function(Le,Re){const Oe={};for(let Ue=0;Ue<Re.length;Ue++){const qe=Re[Ue];qe in Le&&(Oe[qe]=Le[qe])}return Oe},Le.as=nl,Le.at=ll,Le.au=class{constructor(Le){this.entries={}
1,this.scheduler=Le}request(Le,Re,Oe,Ue){const qe=this.entries[Le]=this.entries[Le]||{callbacks:[]};if(qe.result){const[Le,Oe]=qe.result;return this.scheduler?this.scheduler.add((()=>{Ue(Le,Oe)}),Re):Ue(Le,Oe),()=>{}}return qe.callbacks.push(Ue),qe.cancel||(qe.cancel=Oe(((Oe,Ue)=>{qe.result=[Oe,Ue];for(const Le of qe.callbacks)this.scheduler?this.scheduler.add((()=>{Le(Oe,Ue)}),Re):Le(Oe,Ue);setTimeout((()=>delete this.entries[Le]),3e3)}))),()=>{qe.result||(qe.callbacks=qe.callbacks.filter((Le=>Le!==Ue)),qe.callbacks.length||(qe.cancel(),delete this.entries[Le]))}}},Le.av=ua,Le.aw=function(Le,Oe,Ue){const qe=JSON.stringify(Le.request);return Le.data&&((this||Re).deduped.entries[qe]={result:[null,Le.data]}),(this||Re).deduped.request(qe,{type:"parseTile",isSymbolTile:Le.isSymbolTile,zoom:Le.tileZoom},(Re=>{const Oe=se(Le.request,((Le,Oe,qe,Ct)=>{Le?Re(Le):Oe&&Re(null,{vectorTile:Ue?void 0:new A_.VectorTile(new Sg(Oe)),rawData:Oe,cacheControl:qe,expires:Ct})}));return()=>{Oe.cancel(),Re()}}),Oe)},Le.ax=function(Le){Xc++,Xc>jc&&(Le.getActor().send("enforceCacheSizeLimit",Uc),Xc=0)},Le.ay=Rt,Le.az=function(Le){return Le<=1?1:Math.pow(2,Math.floor(Math.log(Le)/Math.LN2))},Le.b=function(Le){return Hl.API_FONTS_REGEX.test(Le)},Le.b$=function(Le){const{x:Re,y:Oe}=Le.point,{lng:Ue,lat:qe}=Le._center;return Ru(Re,Oe,Le.worldSize,Ue,qe)},Le.b0=Fm,Le.b1=co,Le.b2=uc,Le.b3=Mx,Le.b4=function(Le,Re){const Oe=Du(Re.zoom);if(0===Oe)return _u(Le);const Ue=Iu(Le),qe=Pu(Ue),Ct=ol(Ue.getWest())*Re.worldSize,Ot=ol(Ue.getEast())*Re.worldSize,Jt=ll(Ue.getNorth())*Re.worldSize,_i=ll(Ue.getSouth())*Re.worldSize,xi=[Ct,Jt,0],vi=[Ot,Jt,0],bi=[Ct,_i,0],Pi=[Ot,_i,0],Hr=as.mat4.invert([],Re.globeMatrix);return as.vec3.transformMat4(xi,xi,Hr),as.vec3.transformMat4(vi,vi,Hr),as.vec3.transformMat4(bi,bi,Hr),as.vec3.transformMat4(Pi,Pi,Hr),qe[0]=Mu(qe[0],bi,Oe),qe[1]=Mu(qe[1],Pi,Oe),qe[2]=Mu(qe[2],vi,Oe),qe[3]=Mu(qe[3],xi,Oe),yu.fromPoints(qe)},Le.b5=Eu,Le.b6=zu,Le.b7=Mu,Le.b8=ba,Le.b9=Om,Le.bA=et,Le.bB=Y,Le.bC=wt,Le.bD=ul,Le.bE=function(Le,Re,Oe){Le[4*Re+0]=Oe[0],Le[4*Re+1]=Oe[1],Le[4*Re+2]=Oe[2],Le[4*Re+3]=Oe[3]},Le.bF=Po,Le.bG=_o,Le.bH=Mo,Le.bI=wo,Le.bJ=vo,Le.bK=rl,Le.bL=Fd,Le.bM=eu,Le.bN=mu,Le.bO=Sm,Le.bP=tu,Le.bQ=Su,Le.bR=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){if("globe"===_i.name)return Su(Le,Re,new tu(Oe,Ue,qe),!1);const xi=yd({z:Oe,x:Ue,y:qe},_i);return new yu([(Ct+xi.x/xi.scale)*Re,Re*(xi.y/xi.scale),Ot],[(Ct+xi.x2/xi.scale)*Re,Re*(xi.y2/xi.scale),Jt])},Le.bS=function(Le,Re,Oe){let Ue=0;for(let Oe=0;Oe<2;++Oe){const qe=0;Le[Oe]>qe&&(Ue+=(Le[Oe]-qe)*(Le[Oe]-qe)),Re[Oe]<qe&&(Ue+=(qe-Re[Oe])*(qe-Re[Oe]))}return Ue},Le.bT=dm,Le.bU=Ff,Le.bV=function(Le){const Re=as.mat4.identity(new Float64Array(16));as.mat4.multiply(Re,Le.pixelMatrix,Le.globeMatrix);const Oe=[0,Yf,0],Ue=[0,em,0];return as.vec3.transformMat4(Oe,Oe,Re),as.vec3.transformMat4(Ue,Ue,Re),[Oe[0]>0&&Oe[0]<=Le.width&&Oe[1]>0&&Oe[1]<=Le.height&&!Fu(Le,new rl(Le.center.lat,90)),Ue[0]>0&&Ue[0]<=Le.width&&Ue[1]>0&&Ue[1]<=Le.height&&!Fu(Le,new rl(Le.center.lat,-90))]},Le.bW=function(Le,Re){const{scale:Oe}=Le.tileTransform,Ue=Oe*ud/(Le.tileSize*Math.pow(2,Re.zoom-Le.tileID.overscaledZ+Le.tileID.canonical.z));return as.mat2.scale(new Float32Array(4),Re.inverseAdjustmentMatrix,[Ue,Ue])},Le.bX=Im,Le.bY=Am,Le.bZ=function(Le){const Re=Am(Le,!0);return as.mat2.invert([],[Re[0],Re[1],Re[4],Re[5]])},Le.b_=cu,Le.ba=_g,Le.bb=Sg,Le.bc=se,Le.bd=function(Le){const Re=[];for(const Oe in Le)Re.push(Le[Oe]);return Re},Le.be=function(Le,Re){const Oe=[];for(const Ue in Le)Ue in Re||Oe.push(Ue);return Oe},Le.bf=rt,Le.bg=["type","source","source-layer","minzoom","maxzoom","filter","layout"],Le.bh=$,Le.bi=function(Le,Re){const{x:Oe,y:Ue}=Le.point,qe=Ru(Oe,Ue,Le.worldSize/Le._pixelsPerMercatorPixel,0,0);return as.mat4.multiply(qe,qe,Bu(_u(Re)))},Le.bj=Zp,Le.bk=Cg,Le.bl=Yp,Le.bm=function(Le,Re,Oe,Ue,qe){const Ct=5*Re+2;Le.float32[Ct+0]=Oe,Le.float32[Ct+1]=Ue,Le.float32[Ct+2]=qe},Le.bn=$d,Le.bo=Df,Le.bp=El,Le.bq=pg,Le.br=gh,Le.bs=Nx,Le.bt=Ih,Le.bu=Ph,Le.bv=ad,Le.bw=sd,Le.bx=Af,Le.by=yx,Le.bz=Pe,Le.c=zt,Le.c$=Dm,Le.c0=Z,Le.c1=nu,Le.c2=xf,Le.c3=function(Le){const Re=Math.round((Le+45+360)%360/90)%4;return tl[Re]},Le.c4=45,Le.c5=al,Le.c6=Ao,Le.c7=function(Le,Re,Oe){const Ue=Math.sqrt(Le*Le+Re*Re+Oe*Oe),qe=Ue>0?Math.acos(Oe/Ue)*el:0;let Ct=0!==Le||0!==Re?Math.atan2(-Re,-Le)*el+90:0;return Ct<0&&(Ct+=360),[Ue,Ct,qe]},Le.c8=gl,Le.c9=yu,Le.cA=function(Le){const Re=dm-5;Le=Q(Le,-Re,Re)/Re*90;const Oe=Math.pow(Math.abs(Math.sin(Y(Le))),3);return Math.round(Oe*($f.length-1))},Le.cB=function(Le,Re,Oe,Ue){const qe=Re.getNorth(),Ct=Re.getSouth(),Ot=Re.getWest(),Jt=Re.getEast(),_i=1<<Le.z,xi=Jt-Ot,vi=qe-Ct,bi=xi/Gf,Pi=-vi/$f[Oe],Hr=[0,bi,0,Pi,0,0,qe,Ot,0];if(Le.z>0){const Le=180/Ue;as.mat3.multiply(Hr,Hr,[Le/xi+1,0,0,0,Le/vi+1,0,-.5*Le/bi,.5*Le/Pi,1])}return Hr[2]=_i,Hr[5]=Le.x,Hr[8]=Le.y,Hr},Le.cC=_u,Le.cD=function(Le,Re,Oe){const Ue=as.mat4.identity(new Float64Array(16)),qe=(Re/(1<<Le)-.5)*Math.PI*2;return as.mat4.rotateY(Ue,Oe.globeMatrix,qe),Float32Array.from(Ue)},Le.cE=class{isDataAvailableAtPoint(Le){const Re=this._source();if(this.isUsingMockSource()||!Re||Le.y<0||Le.y>1)return!1;const Oe=Re.getSource().maxzoom,Ue=1<<Oe,qe=Math.floor(Le.x),Ct=Math.floor((Le.x-qe)*Ue),Ot=Math.floor(Le.y*Ue),Jt=this.findDEMTileFor(new ru(Oe,qe,Oe,Ct,Ot));return!(!Jt||!Jt.dem)}getAtPointOrZero(Le,Re=0){return this.getAtPoint(Le,Re)||0}getAtPoint(Le,Re,Oe=!0){if(this.isUsingMockSource())return null;null==Re&&(Re=null);const Ue=this._source();if(!Ue)return Re;if(Le.y<0||Le.y>1)return Re;
vendor: 4,700 bytes, line 1
1const qe=Ue.getSource().maxzoom,Ct=1<<qe,Ot=Math.floor(Le.x),Jt=Le.x-Ot,_i=new ru(qe,Ot,qe,Math.floor(Jt*Ct),Math.floor(Le.y*Ct)),xi=this.findDEMTileFor(_i);if(!xi||!xi.dem)return Re;const vi=xi.dem,bi=1<<xi.tileID.canonical.z,Pi=(Jt*bi-xi.tileID.canonical.x)*vi.dim,Hr=(Le.y*bi-xi.tileID.canonical.y)*vi.dim,Jr=Math.floor(Pi),Ln=Math.floor(Hr);return(Oe?this.exaggeration():1)*ke(ke(vi.get(Jr,Ln),vi.get(Jr,Ln+1),Hr-Ln),ke(vi.get(Jr+1,Ln),vi.get(Jr+1,Ln+1),Hr-Ln),Pi-Jr)}getAtTileOffset(Le,Re,Oe){const Ue=1<<Le.canonical.z;return this.getAtPointOrZero(new xl(Le.wrap+(Le.canonical.x+Re/ud)/Ue,(Le.canonical.y+Oe/ud)/Ue))}getAtTileOffsetFunc(Le,Re,Oe,Ue){return qe=>{const Ct=this.getAtTileOffset(Le,qe.x,qe.y),Ot=Ue.upVector(Le.canonical,qe.x,qe.y),Jt=Ue.upVectorScale(Le.canonical,Re,Oe).metersToTile;return as.vec3.scale(Ot,Ot,Ct*Jt),Ot}}getForTilePoints(Le,Re,Oe,Ue){if(this.isUsingMockSource())return!1;const qe=ny.create(this,Le,Ue);return!!qe&&(Re.forEach((Le=>{Le[2]=this.exaggeration()*qe.getElevationAt(Le[0],Le[1],Oe)})),!0)}getMinMaxForTile(Le){if(this.isUsingMockSource())return null;const Re=this.findDEMTileFor(Le);if(!Re||!Re.dem)return null;const Oe=Re.dem.tree,Ue=Re.tileID,qe=1<<Le.canonical.z-Ue.canonical.z;let Ct=Le.canonical.x/qe-Ue.canonical.x,Ot=Le.canonical.y/qe-Ue.canonical.y,Jt=0;for(let Re=0;Re<Le.canonical.z-Ue.canonical.z&&!Oe.leaves[Jt];Re++){Ct*=2,Ot*=2;const Le=2*Math.floor(Ot)+Math.floor(Ct);Jt=Oe.childOffsets[Jt]+Le,Ct%=1,Ot%=1}return{min:this.exaggeration()*Oe.minimums[Jt],max:this.exaggeration()*Oe.maximums[Jt]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(Le,Re,Oe){throw new Error("Pure virtual method called.")}pointCoordinate(Le){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(Le){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const Le=this.visibleDemTiles;if(0===Le.length)return null;let Re=!1,Oe=Number.MAX_VALUE,Ue=Number.MIN_VALUE;for(const qe of Le){const Le=this.getMinMaxForTile(qe.tileID);Le&&(Oe=Math.min(Oe,Le.min),Ue=Math.max(Ue,Le.max),Re=!0)}return Re?{min:Oe,max:Ue}:null}},Le.cF=sc,Le.cG=gu,Le.cH=function(Le,Re){return[Math.pow(Le[0],2.2)*Re,Math.pow(Le[1],2.2)*Re,Math.pow(Le[2],2.2)*Re]},Le.cI=Cu,Le.cJ=St,Le.cK=At,Le.cL=256,Le.cM=function(Le,Re){const Oe=[0,0,0],Ue=Eu(_u(Re.canonical));return as.vec3.transformMat4(Oe,Oe,Ue),as.vec3.transformMat4(Oe,Oe,Le),Oe},Le.cN=Le=>({u_camera_to_center_distance:new wo(Le),u_extrude_scale:new To(Le),u_device_pixel_ratio:new wo(Le),u_matrix:new Po(Le),u_inv_rot_matrix:new Po(Le),u_merc_center:new _o(Le),u_tile_id:new Mo(Le),u_zoom_transition:new wo(Le),u_up_dir:new Mo(Le),u_emissive_strength:new wo(Le)}),Le.cO=Le=>({u_matrix:new Po(Le),u_pixels_to_tile_units:new To(Le),u_device_pixel_ratio:new wo(Le),u_units_to_pixels:new _o(Le),u_dash_image:new vo(Le),u_gradient_image:new vo(Le),u_image_height:new wo(Le),u_texsize:new _o(Le),u_tile_units_to_pixels:new wo(Le),u_alpha_discard_threshold:new wo(Le),u_trim_offset:new _o(Le),u_trim_fade_range:new _o(Le),u_trim_color:new Ao(Le),u_emissive_strength:new wo(Le)}),Le.cP=Le=>({u_matrix:new Po(Le),u_texsize:new _o(Le),u_pixels_to_tile_units:new To(Le),u_device_pixel_ratio:new wo(Le),u_image:new vo(Le),u_units_to_pixels:new _o(Le),u_tile_units_to_pixels:new wo(Le),u_alpha_discard_threshold:new wo(Le),u_trim_offset:new _o(Le)}),Le.cQ=Ca,Le.cR=dg,Le.cS=yg,Le.cT=qu,Le.cU=(Le,Re,Oe,Ue,qe,Ct)=>{const Ot=Le.transform,Jt="globe"===Ot.projection.name;let _i;if("map"===Ct.paint.get("circle-pitch-alignment"))if(Jt){const Le=Cu(Ot.zoom,Re.canonical)*Ot._pixelsPerMercatorPixel;_i=Float32Array.from([Le,0,0,Le])}else _i=Ot.calculatePixelsToTileUnitsMatrix(Oe);else _i=new Float32Array([Ot.pixelsToGLUnits[0],0,0,Ot.pixelsToGLUnits[1]]);const xi={u_camera_to_center_distance:Le.transform.getCameraToCenterDistance(Ot.projection),u_matrix:Le.translatePosMatrix(Re.projMatrix,Oe,Ct.paint.get("circle-translate"),Ct.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Oc.devicePixelRatio,u_extrude_scale:_i,u_inv_rot_matrix:Ym,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:Ct.paint.get("circle-emissive-strength")};if(Jt){xi.u_inv_rot_matrix=Ue,xi.u_merc_center=qe,xi.u_tile_id=[Re.canonical.x,Re.canonical.y,1<<Re.canonical.z],xi.u_zoom_transition=Du(Ot.zoom);const Le=qe[0]*ud,Oe=qe[1]*ud;xi.u_up_dir=Ot.projection.upVector(new tu(0,0,0),Le,Oe)}
1return xi},Le.cV=zp,Le.cW=(Le,Re,Oe,Ue,qe,Ct)=>{const Ot=Le.transform;return{u_matrix:Pp(Le,Re,Oe,Ue),u_texsize:Re.imageAtlasTexture?Re.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:Ot.calculatePixelsToTileUnitsMatrix(Re),u_device_pixel_ratio:qe,u_image:0,u_tile_units_to_pixels:Ip(Re,Ot),u_units_to_pixels:[1/Ot.pixelsToGLUnits[0],1/Ot.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:Ct}},Le.cX=(Le,Re,Oe,Ue,qe,Ct,Ot)=>{const Jt=Le.transform,_i=Jt.calculatePixelsToTileUnitsMatrix(Re);return{u_matrix:Pp(Le,Re,Oe,Ue),u_pixels_to_tile_units:_i,u_device_pixel_ratio:Ct,u_units_to_pixels:[1/Jt.pixelsToGLUnits[0],1/Jt.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:qe,u_texsize:kp(Oe)&&Re.lineAtlasTexture?Re.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Ip(Re,Le.transform),u_alpha_discard_threshold:0,u_trim_offset:Ot,u_trim_fade_range:Oe.paint.get("line-trim-fade-range"),u_trim_color:Oe.paint.get("line-trim-color").toRenderColor(Oe.lut).toArray01(),u_emissive_strength:Oe.paint.get("line-emissive-strength")}},Le.cY=at,Le.cZ=ac,Le.c_=rp,Le.ca=yt,Le.cb=function(Le){return[Math.pow(Le[0],1/2.2),Math.pow(Le[1],1/2.2),Math.pow(Le[2],1/2.2)]},Le.cc=function(Le){return Le({pluginStatus:Rp,pluginURL:Op}),Fp.on("pluginStateChange",Le),Le},Le.cd=by,Le.ce=kg,Le.cf=Xf,Le.cg=Ng,Le.ch=rh,Le.ci=Ps,Le.cj=Ft,Le.ck=Rh,Le.cl=ht,Le.cm=function(Le){const Re=Le.indexOf(jp);return Re>=0?Le.slice(0,Re):Le},Le.cn=function(Le){return Le.indexOf(jp)>=0},Le.co=function(Le){const Re=Le.indexOf(jp);return Re>=0?Le.slice(Re+1):""},Le.cp=function(Le){const Re=[],Oe=Le.id;return void 0===Oe&&Re.push({message:`layers.${Oe}: missing required property "id"`}),void 0===Le.render&&Re.push({message:`layers.${Oe}: missing required method "render"`}),Le.renderingMode&&"2d"!==Le.renderingMode&&"3d"!==Le.renderingMode&&Re.push({message:`layers.${Oe}: property "renderingMode" must be either "2d" or "3d"`}),Re},Le.cq=function(Le,Re,Oe,Ue){return"custom"===Le.type?new _m(Le,Re):new Hx[Le.type](Le,Re,Oe,Ue)},Le.cr=ct,Le.cs=Fp,Le.ct=ie,Le.cu=So,Le.cv=class extends bo{constructor(Le){super(Le),this.current=nf}set(Le,Re,Oe){if(this.fetchUniformLocation(Le,Re))for(let Le=0;Le<9;Le++)if(Oe[Le]!==this.current[Le]){this.current=Oe,this.gl.uniformMatrix3fv(this.location,!1,Oe);break}}},Le.cw=H,Le.cx=function(Le,Re,Oe){const Ue=Du(Oe.zoom),qe=Le.style.map._antialias,Ct=Re.options.extStandardDerivativesForceOff||Le.terrain&&Le.terrain.exaggeration()>0;return 0===Ue&&!qe&&!Ct},Le.cy=function(Le){const Re=Le.pixelsPerMeter,Oe=Re/ul(1,Le.center.lat),Ue=as.mat4.identity(new Float64Array(16));return as.mat4.translate(Ue,Ue,[Le.point.x,Le.point.y,0]),as.mat4.scale(Ue,Ue,[Oe,Oe,Re]),Float32Array.from(Ue)},Le.cz=Iu,Le.d=function(Le){return Hl.API_TILEJSON_REGEX.test(Le)},Le.d$=e,Le.d0=Zh,Le.d1=O_,Le.d2=450,Le.d3=7,Le.d4=Sx,Le.d5=ya,Le.d6=Ya,Le.d7=256,Le.d8=Bu,Le.d9=Aa,Le.dA=Lu,Le.dB=function(Le){const Re=[0,0,0],Oe=as.mat4.identity(new Float64Array(16));return as.mat4.multiply(Oe,Le.pixelMatrix,Le.globeMatrix),as.vec3.transformMat4(Re,Re,Oe),new ta(Re[0],Re[1])},Le.dC=function(Le,Re,Oe=!1){if(Rp===Mp||Rp===Ap||Rp===Dp)throw new Error("setRTLTextPlugin cannot be called multiple times.");Op=Oc.resolveURL(Le),Rp=Mp,Lp=Re,zs(),Oe||Es()},Le.dD=Ts,Le.dE=function(){kg().acquire(bv)},Le.dF=function(){const Le=wv;Le&&(Le.isPreloaded()&&1===Le.numActive()?(Le.release(bv),wv=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},Le.dG=Pg,Le.dH=function(Le){const Re=Gt();if(!Re)return;const Oe=Re.delete(Nc);Le&&Oe.catch(Le).then((()=>Le()))},Le.dI=vv,Le.dJ=Dg,Le.dK=function(Le){Mv=Oc.resolveURL(Le),Iv||(Iv=new by(kg(),new Me)),Iv.broadcast("setDracoUrl",Mv)},Le.dL=Lg,Le.dM=function(Le){Ev=Oc.resolveURL(Le),Iv||(Iv=new by(kg(),new Me)),Iv.broadcast("setMeshoptUrl",Ev)},Le.dN=os,Le.dO=nc,Le.dP=Bg,Le.dQ=ux,Le.dR=px,Le.dS=gp,Le.dT=ut,Le.dU=Uf,Le.dV=function(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi){Le.createArrays(),Le.tilePixelRatio=ud/(512*Le.overscaling),Le.compareText={},Le.iconsNeedLinear=!1;const bi=Le.layers[0].layout,Pi=Le.layers[0]._unevaluatedLayout._values,Hr={};if("composite"===Le.textSizeData.kind){const{minZoom:Re,maxZoom:Oe}=Le.textSizeData;Hr.compositeTextSizes=[Pi["text-size"].possiblyEvaluate(new Vs(Re),Jt),Pi["text-size"].possiblyEvaluate(new Vs(Oe),Jt)]}if("composite"===Le.iconSizeData.kind){const{minZoom:Re,maxZoom:Oe}=Le.iconSizeData;Hr.compositeIconSizes=[Pi["icon-size"].possiblyEvaluate(new Vs(Re),Jt),Pi["icon-size"].possiblyEvaluate(new Vs(Oe),Jt)]}Hr.layoutTextSize=Pi["text-size"].possiblyEvaluate(new Vs(_i+1),Jt),Hr.layoutIconSize=Pi["icon-size"].possiblyEvaluate(new Vs(_i+1),Jt),Hr.textMaxSize=Pi["text-size"].possiblyEvaluate(new Vs(18),Jt);const Jr="map"===bi.get("text-rotation-alignment")&&"point"!==bi.get("symbol-placement"),Ln=bi.get("text-size");let Nn=!1;for(const Re of Le.features)if(Re.icon&&Re.icon.nameSecondary){Nn=!0;break}for(const Ct of Le.features){const _i=bi.get("text-font").evaluate(Ct,{},Jt).join(","),Pi=Ln.evaluate(Ct,{},Jt),Gn=Hr.layoutTextSize.evaluate(Ct,{},Jt),qn=(Hr.layoutIconSize.evaluate(Ct,{},Jt),{horizontal:{},vertical:void 0}),Zn=Ct.text;let $n,Xn=[0,0];if(Zn){const Ue=Zn.toString(),Ot=bi.get("text-letter-spacing").evaluate(Ct,{},Jt)*pg,xi=bi.get("text-line-height").evaluate(Ct,{},Jt)*pg,vi=ds(Ue)?Ot:0,Hr=bi.get("text-anchor").evaluate(Ct,{},Jt),Ln=bi.get("text-variable-anchor");if(!Ln){const Le=bi.get("text-radial-offset").evaluate(Ct,{},Jt);Xn=Le?sd(Hr,[Le*pg,Ug]):bi.get("text-offset").evaluate(Ct,{},Jt).map((Le=>Le*pg))}
1let Nn=Jr?"center":bi.get("text-justify").evaluate(Ct,{},Jt);const $n="point"===bi.get("symbol-placement"),Yn=$n?bi.get("text-max-width").evaluate(Ct,{},Jt)*pg:1/0,M=Ct=>{Le.allowVerticalPlacement&&fs(Ue)&&(qn.vertical=yf(Zn,Re,Oe,qe,_i,Yn,xi,Hr,Ct,vi,Xn,Cg.vertical,!0,Gn,Pi))};if(!Jr&&Ln){const Le="auto"===Nn?Ln.map((Le=>ad(Le))):[Nn];let Ue=!1;for(let Ct=0;Ct<Le.length;Ct++){const Ot=Le[Ct];if(!qn.horizontal[Ot])if(Ue)qn.horizontal[Ot]=qn.horizontal[0];else{const Le=yf(Zn,Re,Oe,qe,_i,Yn,xi,"center",Ot,vi,Xn,Cg.horizontal,!1,Gn,Pi);Le&&(qn.horizontal[Ot]=Le,Ue=1===Le.positionedLines.length)}}M("left")}else{if("auto"===Nn&&(Nn=ad(Hr)),$n||bi.get("text-writing-mode").indexOf("horizontal")>=0||!fs(Ue)){const Le=yf(Zn,Re,Oe,qe,_i,Yn,xi,Hr,Nn,vi,Xn,Cg.horizontal,!1,Gn,Pi);Le&&(qn.horizontal[Nn]=Le)}M($n?"left":Nn)}}let Yn=!1;if(Ct.icon&&Ct.icon.namePrimary){const Re=Ue[Ct.icon.namePrimary];Re&&($n=If(qe[Ct.icon.namePrimary],Ct.icon.nameSecondary?qe[Ct.icon.nameSecondary]:void 0,bi.get("icon-offset").evaluate(Ct,{},Jt),bi.get("icon-anchor").evaluate(Ct,{},Jt)),Yn=Re.sdf,void 0===Le.sdfIcons?Le.sdfIcons=Re.sdf:Le.sdfIcons!==Re.sdf&&ft("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Re.pixelRatio!==Le.pixelRatio||0!==bi.get("icon-rotate").constantOr(1))&&(Le.iconsNeedLinear=!0))}const lo=hd(qn.horizontal)||qn.vertical;Le.iconsInText||(Le.iconsInText=!!lo&&lo.iconsInText),(lo||$n)&&od(Le,Ct,qn,$n,Ue,Hr,Gn,0,Xn,Yn,Ot,Jt,xi,vi,Nn)}Ct&&Le.generateCollisionDebugBuffers(_i,Le.collisionBoxArray)},Le.dW=A_,Le.dX=Ey,Le.dY=N,Le.dZ=uh,Le.d_=af,Le.da=Ua,Le.db=ja,Le.dc=function(Le,Re,Oe,Ue,qe){return Q((Le-Re)/(Oe-Re)*(qe-Ue)+Ue,Ue,qe)},Le.dd=Ii,Le.de=ml,Le.df=class{constructor(Le,Re,Oe,Ue){this.context=Le,this.format=Ue,this.size=Oe,this.texture=Le.gl.createTexture();const[qe,Ct,Ot]=this.size,{gl:Jt}=Le;Jt.bindTexture(Jt.TEXTURE_3D,this.texture),Le.pixelStoreUnpackFlipY.set(!1),Le.pixelStoreUnpack.set(1),Le.pixelStoreUnpackPremultiplyAlpha.set(!1),Jt.texImage3D(Jt.TEXTURE_3D,0,this.format,qe,Ct,Ot,0,am(this.format),om(this.format),Re.data)}bind(Le,Re){const{context:Oe}=this,{gl:Ue}=Oe;Ue.bindTexture(Ue.TEXTURE_3D,this.texture),Le!==this.minFilter&&(Ue.texParameteri(Ue.TEXTURE_3D,Ue.TEXTURE_MAG_FILTER,Le),Ue.texParameteri(Ue.TEXTURE_3D,Ue.TEXTURE_MIN_FILTER,Le),this.minFilter=Le),Re!==this.wrapS&&(Ue.texParameteri(Ue.TEXTURE_3D,Ue.TEXTURE_WRAP_S,Re),Ue.texParameteri(Ue.TEXTURE_3D,Ue.TEXTURE_WRAP_T,Re),this.wrapS=Re)}destroy(){const{gl:Le}=this.context;Le.deleteTexture(this.texture),this.texture=null}},Le.dg=Bm,Le.dh=[1,1,1],Le.di=ny,Le.dj=Gx,Le.dk=Ea,Le.dl=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ta(1/0,1/0),max:new ta(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(Le,Re=!1){const Oe=_h(new ta(0,0),new ta(ud,ud),Le),Ue=[];if(Re&&!vh(Oe,this._globalClipBounds))return Ue;for(const Re of this._activeRegions){if(Re.hiddenByOverlap)continue;if(!vh(Oe,Re))continue;const qe=Mh(Re.min,Re.max,Le);Ue.push({min:qe.min,max:qe.max,sourceId:this._sourceIds[Re.priority],footprint:Re.footprint,footprintTileId:Re.tileId,order:Re.order,clipMask:Re.clipMask,clipScope:Re.clipScope})}return Ue}setSources(Le){this._setSources(Le.map((Le=>({getSourceId:()=>Le.cache.id,getFootprints:()=>{const Re=[];for(const Oe of Le.cache.getVisibleCoordinates()){const Ue=Le.cache.getTile(Oe).buckets[Le.layer];Ue&&Ue.updateFootprints(Oe.toUnwrapped(),Re)}return Re},getOrder:()=>Le.order,getClipMask:()=>Le.clipMask,getClipScope:()=>Le.clipScope}))))}_addSource(Le){const Re=Le.getFootprints();if(0===Re.length)return;const Oe=Le.getOrder(),Ue=Le.getClipMask(),qe=Le.getClipScope();for(const Le of Re){if(!Le.footprint)continue;const Re=_h(Le.footprint.min,Le.footprint.max,Le.id);this._activeRegions.push({min:Re.min,max:Re.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:Le.id,footprint:Le.footprint,order:Oe,clipMask:Ue,clipScope:qe})}this._sourceIds.push(Le.getSourceId())}_computeReplacement(){this._activeRegions.sort(((Le,Re)=>Le.priority-Re.priority||xh(Le.min,Re.min)||xh(Le.max,Re.max)||Le.order-Re.order||Le.clipMask-Re.clipMask||function(Le,Re){const r=(Le,Re)=>Le+Re;return Le.length-Re.length||Le.reduce(r,"").localeCompare(Re.reduce(r,""))}(Le.clipScope,Re.clipScope)));let Le=this._activeRegions.length!==this._prevRegions.length;if(!Le){let Re=0;for(;!Le&&Re!==this._activeRegions.length;){const Oe=this._activeRegions[Re],Ue=this._prevRegions[Re];Le=Oe.priority!==Ue.priority||!bh(Oe,Ue)||Oe.order!==Ue.order||Oe.clipMask!==Ue.clipMask||!$(Oe.clipScope,Ue.clipScope),++Re}}if(Le){++this._updateTime;for(const Le of this._activeRegions)Le.order!==I_&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,Le.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,Le.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,Le.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,Le.max.y));const t=Le=>{const Re=this._activeRegions;if(Le>=Re.length)return Le;const Oe=Re[Le].priority;for(;Le<Re.length&&Re[Le].priority===Oe;)++Le;return Le};if(this._sourceIds.length>1){let Le=0,Re=t(Le);for(;Le!==Re;){let Oe=Le;const Ue=Le;for(;Oe!==Re;){const Le=this._activeRegions[Oe];Le.hiddenByOverlap=!1;for(let Re=0;Re<Ue;Re++){const Oe=this._activeRegions[Re];if(!Oe.hiddenByOverlap&&Le.order===I_&&vh(Le,Oe)&&(Le.hiddenByOverlap=Sh(Le.footprint,Le.tileId,Oe.footprint,Oe.tileId),Le.hiddenByOverlap))break}++Oe}Le=Re,Re=t(Le)}}}}_setSources(Le){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let Re=Le.length-1;Re>=0;Re--)this._addSource(Le[Re]);this._computeReplacement()}},Le.dm=class{constructor(Le){this._createGrid(Le),this._createPoles(Le)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const Le of this._poleSegments)Le.destroy();for(const Le of this._gridSegments)Le.withSkirts.destroy(),Le.withoutSkirts.destroy()}_fillGridMeshWithLods(Le,Re){const Oe=new xa,Ue=new Da,qe=[],Ct=Le+1+2,Ot=Re[0]+1,Jt=Re[0]+1+(1+Re.length),l=(Le,Re,Oe)=>{let Ue=Le===Ct-1?Le-2:0===Le?Le:Le-1;return Ue+=Oe?24575:0,[Ue,Re]};for(let Le=0;Le<Ct;++Le)Oe.emplaceBack(...l(Le,0,!0));for(let Le=0;Le<Ot;++Le)for(let Re=0;Re<Ct;++Re)Oe.emplaceBack(...l(Re,Le,(0===Re||Re===Ct-1)&&!0));for(let Le=0;Le<Re.length;++Le){const Ue=Re[Le];for(let Le=0;Le<Ct;++Le)Oe.emplaceBack(...l(Le,Ue,!0))}for(let Le=0;Le<Re.length;++Le){const Ot=Ue.length,_i=Re[Le]+1+2,xi=new Da;for(let Oe=0;Oe<_i-1;Oe++){const qe=Oe===_i-2,Ot=qe?Ct*(Jt-Re.length+Le-Oe):Ct;
1for(let Le=0;Le<Ct-1;Le++){const Re=Oe*Ct+Le;0===Oe||qe||0===Le||Le===Ct-2?(xi.emplaceBack(Re+1,Re,Re+Ot),xi.emplaceBack(Re+Ot,Re+Ot+1,Re+1)):(Ue.emplaceBack(Re+1,Re,Re+Ot),Ue.emplaceBack(Re+Ot,Re+Ot+1,Re+1))}}const vi=co.simpleSegment(0,Ot,Oe.length,Ue.length-Ot);for(let Le=0;Le<xi.uint16.length;Le+=3)Ue.emplaceBack(xi.uint16[Le],xi.uint16[Le+1],xi.uint16[Le+2]);const bi=co.simpleSegment(0,Ot,Oe.length,Ue.length-Ot);qe.push({withoutSkirts:vi,withSkirts:bi})}return{vertices:Oe,indices:Ue,segments:qe}}_createGrid(Le){const Re=this._fillGridMeshWithLods(Gf,$f);this._gridSegments=Re.segments,this._gridBuffer=Le.createVertexBuffer(Re.vertices,Fm.members),this._gridIndexBuffer=Le.createIndexBuffer(Re.indices,!0)}_createPoles(Le){const Re=new Da;for(let Le=0;Le<=Gf;Le++)Re.emplaceBack(0,Le+1,Le+2);this._poleIndexBuffer=Le.createIndexBuffer(Re,!0);const Oe=new Ua,Ue=new Ua,qe=new Ua,Ct=new Ua;this._poleSegments=[];for(let Le=0,Re=0;Le<xf;Le++){const Ot=360/(1<<Le);Oe.emplaceBack(0,-gf,0,.5,0),Ue.emplaceBack(0,-gf,0,.5,1),qe.emplaceBack(0,-gf,0,.5,.5),Ct.emplaceBack(0,-gf,0,.5,.5);for(let Le=0;Le<=Gf;Le++){let Re=Le/Gf,Jt=0;const _i=ke(0,Ot,Re),[xi,vi,bi]=Jo(Hm,Wm,_i,gf);Oe.emplaceBack(xi,vi,bi,Re,Jt),Ue.emplaceBack(xi,vi,bi,Re,1-Jt);const Pi=Y(_i);Re=.5+.5*Math.sin(Pi),Jt=.5+.5*Math.cos(Pi),qe.emplaceBack(xi,vi,bi,Re,Jt),Ct.emplaceBack(xi,vi,bi,Re,1-Jt)}this._poleSegments.push(co.simpleSegment(Re,0,66,64)),Re+=66}this._poleNorthVertexBuffer=Le.createVertexBuffer(Oe,Rm,!1),this._poleSouthVertexBuffer=Le.createVertexBuffer(Ue,Rm,!1),this._texturedPoleNorthVertexBuffer=Le.createVertexBuffer(qe,Rm,!1),this._texturedPoleSouthVertexBuffer=Le.createVertexBuffer(Ct,Rm,!1)}getGridBuffers(Le,Re){return[this._gridBuffer,this._gridIndexBuffer,Re?this._gridSegments[Le].withSkirts:this._gridSegments[Le].withoutSkirts]}getPoleBuffers(Le,Re){return[Re?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,Re?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[Le]]}},Le.dn=I_,Le.dp=K,Le.dq=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},Le.dr=il,Le.ds=yl,Le.dt=Qo,Le.du=function([Le,Re,Oe]){const Ue=Math.hypot(Le,Re,Oe),qe=Math.atan2(Le,Oe),Ct=.5*Math.PI-Math.acos(-Re/Ue);return new rl(Z(qe),Z(Ct))},Le.dv=zm,Le.dw=im,Le.dx=function(Le){const Re=Le.navigator?Le.navigator.userAgent:null;return!!function(Le){if(null==Al){const Re=Le.navigator?Le.navigator.userAgent:null;Al=!!Le.safari||!(!Re||!(/\b(iPad|iPhone|iPod)\b/.test(Re)||Re.match("Safari")&&!Re.match("Chrome")))}return Al}(Le)&&Re&&(Re.match("Version/15.4")||Re.match("Version/15.5")||Re.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},Le.dy=function(Le,Re){Uc=Le,jc=Re},Le.dz=Fu,Le.e=Hl,Le.e0=function(Le){let Re=0;if(new Uint32Array(Le,0,1)[0]!==Rv){const Oe=new Uint32Array(Le,0,7),[,,Ue,qe,Ct,Ot]=Oe;Re=Oe.byteLength+qe+Ct+Ot+Ct,(Ue!==Le.byteLength||Re>=Le.byteLength)&&ft("Invalid b3dm header information.")}return Jg(Le,Re)},Le.e1=function(Le,Re){const Oe=ax(Le);for(const Le of Oe){for(const Re of Le.meshes)ox(Re);Le.lights&&(Le.lightMeshIndex=Le.meshes.length,Le.meshes.push(lx(Le.lights,Re)))}return Oe},Le.e2=cy,Le.e3=xy,Le.e4=Np,Le.e5=function(Le){Xt(),null!=Hc&&Hc.then((Re=>{Re.keys().then((Oe=>{for(let Ue=0;Ue<Oe.length-Le;Ue++)Re.delete(Oe[Ue])}))}))},Le.f=function(Le){return 0===Le.indexOf("mapbox:")},Le.g=function(Le,Re){return ie(nt(Le,{method:"GET"}),Re)},Le.h=Pt,Le.i=function(Le){return Hl.API_STYLE_REGEX.test(Le)&&!zt(Le)},Le.j=function(Le){return decodeURIComponent(atob(Le).split("").map((Le=>"%"+("00"+Le.charCodeAt(0).toString(16)).slice(-2))).join(""))},Le.k=function(Le){return btoa(encodeURIComponent(Le).replace(/%([0-9A-F]{2})/g,((Le,Re)=>String.fromCharCode(Number("0x"+Re)))))},Le.l=nt,Le.m=Yc,Le.n=function(Le,Re){return ie(nt(Le,{type:"json"}),Re)},Le.o=ce,Le.p=function(Le,Re){return ie(nt(Le,{method:"POST"}),Re)},Le.q=Oc,Le.r=ic,Le.s=function(Le){try{const Re=self[Le];return Re.setItem("_mapbox_test_",1),Re.removeItem("_mapbox_test_"),!0}catch(Le){return!1}},Le.t=ve,Le.u=function(){return function t(Le){return Le?(Le^Math.random()*(16>>Le/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()},Le.v=function(Le){return!!Le&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(Le)},Le.w=ft,Le.x=be,Le.y=2,Le.z=Lf}));define(["./shared"],(function(Le){function t(Le){const Re=Le?Le.url.toString():void 0;return Re?performance.getEntriesByName(Re):[]}function o(Le){if("number"==typeof Le||"boolean"==typeof Le||"string"==typeof Le||null==Le)return JSON.stringify(Le);if(Array.isArray(Le)){let Re="[";for(const Oe of Le)Re+=`${o(Oe)},`;return`${Re}]`}let Re="{";
1for(const Oe of Object.keys(Le).sort())Re+=`${Oe}:${o(Le[Oe])},`;return`${Re}}`}function s(Re){let Oe="";for(const Ue of Le.bg)Oe+=`/${o(Re[Ue])}`;return Oe}class i{constructor(Le){this.keyCache={},this._layers={},this._layerConfigs={},Le&&this.replace(Le)}replace(Le,Re){this._layerConfigs={},this._layers={},this.update(Le,[],Re)}update(Re,Oe,Ue){this._options=Ue;for(const Oe of Re)this._layerConfigs[Oe.id]=Oe,(this._layers[Oe.id]=Le.cq(Oe,this.scope,null,this._options)).compileFilter(Ue),this.keyCache[Oe.id]&&delete this.keyCache[Oe.id];for(const Le of Oe)delete this.keyCache[Le],delete this._layerConfigs[Le],delete this._layers[Le];this.familiesBySource={};const qe=function(Le,Re){const Oe={};for(let Ue=0;Ue<Le.length;Ue++){const qe=Re&&Re[Le[Ue].id]||s(Le[Ue]);Re&&(Re[Le[Ue].id]=qe);let Ct=Oe[qe];Ct||(Ct=Oe[qe]=[]),Ct.push(Le[Ue])}const Ue=[];for(const Le in Oe)Ue.push(Oe[Le]);return Ue}(Le.bd(this._layerConfigs),this.keyCache);for(const Le of qe){const Re=Le.map((Le=>this._layers[Le.id])),Oe=Re[0];if("none"===Oe.visibility)continue;const Ue=Oe.source||"";let qe=this.familiesBySource[Ue];qe||(qe=this.familiesBySource[Ue]={});const Ct=Oe.sourceLayer||"_geojsonTileLayer";let Ot=qe[Ct];Ot||(Ot=qe[Ct]=[]),Ot.push(Re)}}}const Oe=1*Le.dP;class r{constructor(Re){const Ue={},qe=[];for(const Le in Re){const Ct=Re[Le],Ot=Ue[Le]={};for(const Le in Ct.glyphs){const Re=Ct.glyphs[+Le];if(!Re||0===Re.bitmap.width||0===Re.bitmap.height)continue;const Ue=Re.metrics.localGlyph?Oe:1,Jt={x:0,y:0,w:Re.bitmap.width+2*Ue,h:Re.bitmap.height+2*Ue};qe.push(Jt),Ot[Le]=Jt}}const{w:Ct,h:Ot}=Le.z(qe),Jt=new Le.dO({width:Ct||1,height:Ot||1});for(const qe in Re){const Ct=Re[qe];for(const Re in Ct.glyphs){const Ot=Ct.glyphs[+Re];if(!Ot||0===Ot.bitmap.width||0===Ot.bitmap.height)continue;const _i=Ue[qe][Re],xi=Ot.metrics.localGlyph?Oe:1;Le.dO.copy(Ot.bitmap,Jt,{x:0,y:0},{x:_i.x+xi,y:_i.y+xi},Ot.bitmap)}}this.image=Jt,this.positions=Ue}}Le.dN(r,"GlyphAtlas");class a{constructor(Re){this.tileID=new Le.aA(Re.tileID.overscaledZ,Re.tileID.wrap,Re.tileID.canonical.z,Re.tileID.canonical.x,Re.tileID.canonical.y),this.tileZoom=Re.tileZoom,this.uid=Re.uid,this.zoom=Re.zoom,this.lut=Re.lut,this.canonical=Re.tileID.canonical,this.pixelRatio=Re.pixelRatio,this.tileSize=Re.tileSize,this.source=Re.source,this.scope=Re.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Re.showCollisionBoxes,this.collectResourceTiming=!!Re.collectResourceTiming,this.promoteId=Re.promoteId,this.isSymbolTile=Re.isSymbolTile,this.tileTransform=Le.aK(Re.tileID.canonical,Re.projection),this.projection=Re.projection,this.brightness=Re.brightness,this.extraShadowCaster=!!Re.extraShadowCaster,this.tessellationStep=Re.tessellationStep}parse(Re,Oe,Ue,qe,Ct){this.status="parsing",this.data=Re,this.collisionBoxArray=new Le.aQ;const Ot=new Le.dQ(Object.keys(Re.layers).sort()),Jt=new Le.dR(this.tileID,this.promoteId);Jt.bucketLayerIDs=[];const _i={},xi=new Le.dS(256,256),vi={featureIndex:Jt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:xi,availableImages:Ue,brightness:this.brightness},bi=Oe.familiesBySource[this.source];for(const Oe in bi){const qe=Re.layers[Oe];if(!qe)continue;let Ct=!1,xi=!1,Pi=!1;for(const Le of bi[Oe])"symbol"===Le[0].type?Ct=!0:xi=!0,Le[0].is3D()&&"model"!==Le[0].type&&(Pi=!0);if(this.extraShadowCaster&&!Pi)continue;if(!0===this.isSymbolTile&&!Ct)continue;if(!1===this.isSymbolTile&&!xi)continue;1===qe.version&&Le.w(`Vector tile source "${this.source}" layer "${Oe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Hr=Ot.encode(Oe),Jr=[];for(let Le=0;Le<qe.length;Le++){const Re=qe.feature(Le),Ue=Jt.getId(Re,Oe);Jr.push({feature:Re,id:Ue,index:Le,sourceLayerIndex:Hr})}for(const Le of bi[Oe]){const Re=Le[0];(!this.extraShadowCaster||Re.is3D()&&"model"!==Re.type)&&(void 0!==this.isSymbolTile&&"symbol"===Re.type!==this.isSymbolTile||Re.minzoom&&this.zoom<Math.floor(Re.minzoom)||Re.maxzoom&&this.zoom>=Re.maxzoom||"none"!==Re.visibility&&(l(Le,this.zoom,vi.brightness,Ue),(_i[Re.id]=Re.createBucket({index:Jt.bucketLayerIDs.length,layers:Le,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Hr,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(Jr,vi,this.tileID.canonical,this.tileTransform),Jt.bucketLayerIDs.push(Le.map((Le=>Le.id)))))}}let Pi,Hr,Jr,Ln;xi.trim();const Nn={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},w=()=>
1{if(Pi)return this.status="done",Ct(Pi);if(this.extraShadowCaster)this.status="done",Ct(null,{buckets:Le.bd(_i).filter((Le=>!Le.isEmpty())),featureIndex:Jt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:vi.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Hr&&Jr&&Ln){const Re=new r(Hr),Oe=new Le.dU(Jr,Ln,this.lut);for(const qe in _i){const Ct=_i[qe];Ct instanceof Le.aR?(l(Ct.layers,this.zoom,vi.brightness,Ue),Le.dV(Ct,Hr,Re.positions,Jr,Oe.iconPositions,this.showCollisionBoxes,Ue,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):Ct.hasPattern&&(Ct instanceof Le.aX||Ct instanceof Le.aY||Ct instanceof Le.d0)&&(l(Ct.layers,this.zoom,vi.brightness,Ue),Ct.addFeatures(vi,this.tileID.canonical,Oe.patternPositions,Ue,this.tileTransform,this.brightness))}this.status="done",Ct(null,{buckets:Le.bd(_i).filter((Le=>!Le.isEmpty())),featureIndex:Jt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Re.image,lineAtlas:xi,imageAtlas:Oe,brightness:vi.brightness})}};if(!this.extraShadowCaster){const Re=Le.dT(vi.glyphDependencies,(Le=>Object.keys(Le).map(Number)));Object.keys(Re).length?qe.send("getGlyphs",{uid:this.uid,stacks:Re,scope:this.scope},((Le,Re)=>{Pi||(Pi=Le,Hr=Re,w())}),void 0,!1,Nn):Hr={};const Oe=Object.keys(vi.iconDependencies);Oe.length?qe.send("getImages",{icons:Oe,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((Le,Re)=>{Pi||(Pi=Le,Jr=Re,w())}),void 0,!1,Nn):Jr={};const Ue=Object.keys(vi.patternDependencies);Ue.length?qe.send("getImages",{icons:Ue,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((Le,Re)=>{Pi||(Pi=Le,Ln=Re,w())}),void 0,!1,Nn):Ln={}}w()}}function l(Re,Oe,Ue,qe){const Ct=new Le.a3(Oe,{brightness:Ue});for(const Le of Re)Le.recalculate(Ct,qe)}class c extends Le.E{constructor(Re,Oe,Ue,qe,Ct,Ot){super(),this.actor=Re,this.layerIndex=Oe,this.availableImages=Ue,this.loadVectorData=Ct||Le.aw,this.loading={},this.loaded={},this.deduped=new Le.au(Re.scheduler),this.isSpriteLoaded=qe,this.scheduler=Re.scheduler,this.brightness=Ot}loadTile(Re,Oe){const Ue=Re.uid,qe=Re&&Re.request,Ct=qe&&qe.collectResourceTiming,Ot=this.loading[Ue]=new a(Re);Ot.abort=this.loadVectorData(Re,((Jt,_i)=>{const xi=!this.loading[Ue];if(delete this.loading[Ue],xi||Jt||!_i)return Ot.status="done",xi||(this.loaded[Ue]=Ot),Oe(Jt);const vi=_i.rawData,bi={};_i.expires&&(bi.expires=_i.expires),_i.cacheControl&&(bi.cacheControl=_i.cacheControl),Ot.vectorTile=_i.vectorTile||new Le.dW.VectorTile(new Le.bb(vi));const f=()=>{Ot.parse(Ot.vectorTile,this.layerIndex,this.availableImages,this.actor,((Re,Ue)=>{if(Re||!Ue)return Oe(Re);const Ot={};if(Ct){const Le=t(qe);Le.length>0&&(Ot.resourceTiming=JSON.parse(JSON.stringify(Le)))}Oe(null,Le.l({rawTileData:vi.slice(0)},Ue,bi,Ot))}))};this.isSpriteLoaded?f():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:Re.isSymbolTile,zoom:Re.tileZoom}
1):f()})),this.loaded=this.loaded||{},this.loaded[Ue]=Ot}))}reloadTile(Re,Oe){const Ue=this.loaded,qe=Re.uid;if(Ue&&Ue[qe]){const Ct=Ue[qe];Ct.showCollisionBoxes=Re.showCollisionBoxes,Ct.projection=Re.projection,Ct.brightness=Re.brightness,Ct.tileTransform=Le.aK(Re.tileID.canonical,Re.projection),Ct.extraShadowCaster=Re.extraShadowCaster,Ct.lut=Re.lut;const r=(Le,Re)=>{const Ue=Ct.reloadCallback;Ue&&(delete Ct.reloadCallback,Ct.parse(Ct.vectorTile,this.layerIndex,this.availableImages,this.actor,Ue)),Oe(Le,Re)};"parsing"===Ct.status?Ct.reloadCallback=r:"done"===Ct.status&&(Ct.vectorTile?Ct.parse(Ct.vectorTile,this.layerIndex,this.availableImages,this.actor,r):r())}else Oe(null,void 0)}abortTile(Le,Re){const Oe=Le.uid,Ue=this.loading[Oe];Ue&&(Ue.abort&&Ue.abort(),delete this.loading[Oe]),Re()}removeTile(Le,Re){const Oe=this.loaded,Ue=Le.uid;Oe&&Oe[Ue]&&delete Oe[Ue],Re()}}class h{loadTile(Re,Oe){const{uid:Ue,encoding:qe,rawImageData:Ct,padding:Ot}=Re,Jt=ImageBitmap&&Ct instanceof ImageBitmap?this.getImageData(Ct,Ot):Ct;Oe(null,new Le.dX(Ue,Jt,qe,Ot<1))}getImageData(Le,Re){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Le.width,Le.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=Le.width,this.offscreenCanvas.height=Le.height,this.offscreenCanvasContext.drawImage(Le,0,0,Le.width,Le.height);const Oe=this.offscreenCanvasContext.getImageData(-Re,-Re,Le.width+2*Re,Le.height+2*Re);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Oe}}Le.ba.setPbf(Le.bb);class u{decodeRasterArray({task:Re,buffer:Oe},Ue){Le.ba.performDecoding(Oe,Re).then((Le=>{Ue(null,Le)}),(Le=>{Ue(Le)}))}}const Ue=Le.dW.VectorTileFeature.prototype.toGeoJSON;class f{constructor(Re){this._feature=Re,this.extent=Le.ab,this.type=Re.type,this.properties=Re.tags,"id"in Re&&!isNaN(Re.id)&&(this.id=parseInt(Re.id,10))}loadGeometry(){if(1===this._feature.type){const Re=[];for(const Oe of this._feature.geometry)Re.push([new Le.P(Oe[0],Oe[1])]);return Re}{const Re=[];for(const Oe of this._feature.geometry){const Ue=[];for(const Re of Oe)Ue.push(new Le.P(Re[0],Re[1]));Re.push(Ue)}return Re}}toGeoJSON(Le,Re,Oe){return Ue.call(this,Le,Re,Oe)}}class p{constructor(Re){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=Le.ab,this.length=Re.length,this._features=Re}feature(Le){return new f(this._features[Le])}}const qe=64/4096,Ct=128;class y{constructor(){this.features=new Map}clear(){this.features.clear()}load(Le=[],Re){for(const Oe of Le){const Le=Oe.id;if(null==Le)continue;let Ue=this.features.get(Le);Ue&&this.updateCache(Ue,Re),Oe.geometry?(Ue=w(Oe),this.updateCache(Ue,Re),this.features.set(Le,Ue)):this.features.delete(Le),this.updateCache(Ue,Re)}}updateCache(Le,Re){for(const{canonical:Oe,uid:Ue}of Object.values(Re)){const{z:qe,x:Ct,y:Ot}=Oe;x(Le,Math.pow(2,qe),Ct,Ot)&&delete Re[Ue]}}getTile(Le,Re,Oe){const Ue=Math.pow(2,Le),qe=[];for(const Le of this.features.values())x(Le,Ue,Re,Oe)&&qe.push(I(Le,Ue,Re,Oe));return{features:qe}}getFeatures(){return[...this.features.values()]}}function x({minX:Le,minY:Re,maxX:Oe,maxY:Ue},Ct,Ot,Jt){return Le<(Ot+1+qe)/Ct&&Re<(Jt+1+qe)/Ct&&Oe>(Ot-qe)/Ct&&Ue>(Jt-qe)/Ct}function w(Le){const{id:Re,geometry:Oe,properties:Ue}=Le;if(!Oe)return;if("GeometryCollection"===Oe.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:qe,coordinates:Ct}=Oe,Ot={id:Re,type:1,geometry:[],tags:Ue,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Jt=Ot.geometry;if("Point"===qe)b(Ct,Jt,Ot);else if("MultiPoint"===qe)for(const Le of Ct)b(Le,Jt,Ot);else if("LineString"===qe)Ot.type=2,S(Ct,Jt,Ot);else if("MultiLineString"===qe)Ot.type=2,v(Ct,Jt,Ot);else if("Polygon"===qe)Ot.type=3,v(Ct,Jt,Ot,!0);else{if("MultiPolygon"!==qe)throw new Error("Input data is not a valid GeoJSON object.");Ot.type=3;for(const Le of Ct)v(Le,Jt,Ot,!0)}return Ot}function b([Re,Oe],Ue,qe){const Ct=Le.am(Re);let Ot=Le.at(Oe);Ot=Ot<0?0:Ot>1?1:Ot,Ue.push(Ct,Ot),qe.minX=Math.min(qe.minX,Ct),qe.minY=Math.min(qe.minY,Ot),qe.maxX=Math.max(qe.maxX,Ct),qe.maxY=Math.max(qe.maxY,Ot)}function S(Le,Re,Oe,Ue=!1,qe=!1){const Ct=[];for(const Re of Le)b(Re,Ct,Oe);Re.push(Ct),Ue&&function(Le,Re){let Oe=0;for(let Re=0,Ue=Le.length,qe=Ue-2;Re<Ue;
1qe=Re,Re+=2)Oe+=(Le[Re]-Le[qe])*(Le[Re+1]+Le[qe+1]);if(Oe>0===Re)for(let Re=0,Oe=Le.length;Re<Oe/2;Re+=2){const Ue=Le[Re],qe=Le[Re+1];Le[Re]=Le[Oe-2-Re],Le[Re+1]=Le[Oe-1-Re],Le[Oe-2-Re]=Ue,Le[Oe-1-Re]=qe}}(Ct,qe)}function v(Le,Re,Oe,Ue=!1){for(let qe=0;qe<Le.length;qe++)S(Le[qe],Re,Oe,Ue,0===qe)}function I(Re,Oe,Ue,qe){const{id:Ct,type:Ot,geometry:Jt,tags:_i}=Re,xi=[];if(1===Ot)!function(Re,Oe,Ue,qe,Ct){for(let Ot=0;Ot<Re.length;Ot+=2){const Jt=Math.round(Le.ab*(Re[Ot+0]*Oe-Ue)),_i=Math.round(Le.ab*(Re[Ot+1]*Oe-qe));Ct.push([Jt,_i])}}(Jt,Oe,Ue,qe,xi);else for(const Le of Jt)M(Le,Oe,Ue,qe,xi);return{id:Ct,type:Ot,geometry:xi,tags:_i}}function M(Re,Oe,Ue,qe,Ot){const Jt=-Ct,_i=Le.ab+Ct;let xi;for(let Ct=0;Ct<Re.length-2;Ct+=2){let vi=Math.round(Le.ab*(Re[Ct+0]*Oe-Ue)),bi=Math.round(Le.ab*(Re[Ct+1]*Oe-qe)),Pi=Math.round(Le.ab*(Re[Ct+2]*Oe-Ue)),Hr=Math.round(Le.ab*(Re[Ct+3]*Oe-qe));const Jr=Pi-vi,Ln=Hr-bi;vi<Jt&&Pi<Jt||(vi<Jt?(bi+=Math.round(Ln*((Jt-vi)/Jr)),vi=Jt):Pi<Jt&&(Hr=bi+Math.round(Ln*((Jt-vi)/Jr)),Pi=Jt),bi<Jt&&Hr<Jt||(bi<Jt?(vi+=Math.round(Jr*((Jt-bi)/Ln)),bi=Jt):Hr<Jt&&(Pi=vi+Math.round(Jr*((Jt-bi)/Ln)),Hr=Jt),vi>=_i&&Pi>=_i||(vi>=_i?(bi+=Math.round(Ln*((_i-vi)/Jr)),vi=_i):Pi>=_i&&(Hr=bi+Math.round(Ln*((_i-vi)/Jr)),Pi=_i),bi>=_i&&Hr>=_i||(bi>=_i?(vi+=Math.round(Jr*((_i-bi)/Ln)),bi=_i):Hr>=_i&&(Pi=vi+Math.round(Jr*((_i-bi)/Ln)),Hr=_i),xi&&vi===xi[xi.length-1][0]&&bi===xi[xi.length-1][1]||(xi=[[vi,bi]],Ot.push(xi)),xi.push([Pi,Hr])))))}}var Ot,Jt,_i,xi={exports:{}},vi=function(){if(_i)return xi.exports;_i=1;var Oe=Le.d_(),Ue=function(){if(Jt)return Ot;Jt=1;var Oe=Le.dY(),Ue=Le.dZ().VectorTileFeature;function s(Le,Oe){(this||Re).options=Oe||{},(this||Re).features=Le,(this||Re).length=Le.length}function i(Le,Oe){(this||Re).id="number"==typeof Le.id?Le.id:void 0,(this||Re).type=Le.type,(this||Re).rawGeometry=1===Le.type?[Le.geometry]:Le.geometry,(this||Re).properties=Le.tags,(this||Re).extent=Oe||4096}return Ot=s,s.prototype.feature=function(Le){return new i((this||Re).features[Le],(this||Re).options.extent)},i.prototype.loadGeometry=function(){var Le=(this||Re).rawGeometry;(this||Re).geometry=[];for(var Ue=0;Ue<Le.length;Ue++){for(var qe=Le[Ue],Ct=[],Ot=0;Ot<qe.length;Ot++)Ct.push(new Oe(qe[Ot][0],qe[Ot][1]));(this||Re).geometry.push(Ct)}return(this||Re).geometry},i.prototype.bbox=function(){(this||Re).geometry||this.loadGeometry();for(var Le=(this||Re).geometry,Oe=1/0,Ue=-1/0,qe=1/0,Ct=-1/0,Ot=0;Ot<Le.length;Ot++)for(var Jt=Le[Ot],_i=0;_i<Jt.length;_i++){var xi=Jt[_i];Oe=Math.min(Oe,xi.x),Ue=Math.max(Ue,xi.x),qe=Math.min(qe,xi.y),Ct=Math.max(Ct,xi.y)}return[Oe,qe,Ue,Ct]},i.prototype.toGeoJSON=Ue.prototype.toGeoJSON,Ot}();function s(Le){var Re=new Oe;return function(Le,Re){for(var Oe in Le.layers)Re.writeMessage(3,i,Le.layers[Oe])}(Le,Re),Re.finish()}function i(Le,Re){var Oe;Re.writeVarintField(15,Le.version||1),Re.writeStringField(1,Le.name||""),Re.writeVarintField(5,Le.extent||4096);var Ue={keys:[],values:[],keycache:{},valuecache:{}};for(Oe=0;Oe<Le.length;Oe++)Ue.feature=Le.feature(Oe),Re.writeMessage(2,n,Ue);var qe=Ue.keys;for(Oe=0;Oe<qe.length;Oe++)Re.writeStringField(3,qe[Oe]);var Ct=Ue.values;for(Oe=0;Oe<Ct.length;Oe++)Re.writeMessage(4,h,Ct[Oe])}function n(Le,Re){var Oe=Le.feature;void 0!==Oe.id&&Re.writeVarintField(1,Oe.id),Re.writeMessage(2,r,Le),Re.writeVarintField(3,Oe.type),Re.writeMessage(4,c,Oe)}function r(Le,Re){var Oe=Le.feature,Ue=Le.keys,qe=Le.values,Ct=Le.keycache,Ot=Le.valuecache;for(var Jt in Oe.properties){var _i=Oe.properties[Jt],xi=Ct[Jt];if(null!==_i){void 0===xi&&(Ue.push(Jt),Ct[Jt]=xi=Ue.length-1),Re.writeVarint(xi);var vi=typeof _i;"string"!==vi&&"boolean"!==vi&&"number"!==vi&&(_i=JSON.stringify(_i));var bi=vi+":"+_i,Pi=Ot[bi];void 0===Pi&&(qe.push(_i),Ot[bi]=Pi=qe.length-1),Re.writeVarint(Pi)}}}function a(Le,Re){return(Re<<3)+(7&Le)}function l(Le){return Le<<1^Le>>31}function c(Le,Re){for(var Oe=Le.loadGeometry(),Ue=Le.type,qe=0,Ct=0,Ot=Oe.length,Jt=0;Jt<Ot;Jt++){var _i=Oe[Jt],xi=1;1===Ue&&(xi=_i.length),Re.writeVarint(a(1,xi));for(var vi=3===Ue?_i.length-1:_i.length,bi=0;bi<vi;bi++){1===bi&&1!==Ue&&Re.writeVarint(a(2,vi-1));var Pi=_i[bi].x-qe,Hr=_i[bi].y-Ct;Re.writeVarint(l(Pi)),Re.writeVarint(l(Hr)),qe+=Pi,Ct+=Hr}3===Ue&&Re.writeVarint(a(7,1))}}function h(Le,Re){var Oe=typeof Le;"string"===Oe?Re.writeStringField(1,Le):"boolean"===Oe?Re.writeBooleanField(7,Le):"number"===Oe&&(Le%1!=0?Re.writeDoubleField(3,Le):Le<0?Re.writeSVarintField(6,Le):Re.writeVarintField(5,Le))}return xi.exports=s,xi.exports.fromVectorTileJs=s,xi.exports.fromGeojsonVt=function(Le,Re){Re=Re||{};var Oe={};for(var qe in Le)Oe[qe]=new Ue(Le[qe].features,Re),Oe[qe].name=qe,Oe[qe].version=Re.version,Oe[qe].extent=Re.extent;return s({layers:Oe})},xi.exports.GeoJSONWrapper=Ue,xi.exports}(),bi=Le.d$(vi);const Pi={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Le=>Le},Hr=Math.fround||(Jr=new Float32Array(1),Le=>(Jr[0]=+Le,Jr[0]));var Jr;const Ln=3,Nn=5,Gn=6;class E{constructor(Le){this.options=Object.assign(Object.create(Pi),Le),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Le){const{log:Re,minZoom:Oe,maxZoom:Ue}=this.options;Re&&console.time("total time");const qe=`prepare ${Le.length} points`;Re&&console.time(qe),this.points=Le;const Ct=[];for(let Re=0;Re<Le.length;Re++){const Oe=Le[Re];if(!Oe.geometry)continue;const[Ue,qe]=Oe.geometry.coordinates,Ot=Hr(N(Ue)),Jt=Hr(X(qe));Ct.push(Ot,Jt,1/0,Re,-1,1),this.options.reduce&&Ct.push(0)}let Ot=this.trees[Ue+1]=this._createTree(Ct);Re&&console.timeEnd(qe);for(let Le=Ue;Le>=Oe;Le--){const Oe=+Date.now();Ot=this.trees[Le]=this._createTree(this._cluster(Ot,Le)),Re&&console.log("z%d: %d clusters in %dms",Le,Ot.numItems,+Date.now()-Oe)}return Re&&console.timeEnd("total time"),this}getClusters(Le,Re){let Oe=((Le[0]+180)%360+360)%360-180;const Ue=Math.max(-90,Math.min(90,Le[1]));let qe=180===Le[2]?180:((Le[2]+180)%360+360)%360-180;const Ct=Math.max(-90,Math.min(90,Le[3]));if(Le[2]-Le[0]>=360)Oe=-180,qe=180;else if(Oe>qe){const Le=this.getClusters([Oe,Ue,180,Ct],Re),Ot=this.getClusters([-180,Ue,qe,Ct],Re);return Le.concat(Ot)}const Ot=this.trees[this._limitZoom(Re)],Jt=Ot.range(N(Oe),X(Ct),N(qe),X(Ue)),_i=Ot.data,xi=[];for(const Le of Jt){const Re=this.stride*Le;xi.push(_i[Re+Nn]>1?F(_i,Re,this.clusterProps):this.points[_i[Re+Ln]])}return xi}getChildren(Le){const Re=this._getOriginId(Le),Oe=this._getOriginZoom(Le),Ue="No cluster with the specified id.",qe=this.trees[Oe];
vendor: 15,742 bytes, line 1
1if(!qe)throw new Error(Ue);const Ct=qe.data;if(Re*this.stride>=Ct.length)throw new Error(Ue);const Ot=this.options.radius/(this.options.extent*Math.pow(2,Oe-1)),Jt=qe.within(Ct[Re*this.stride],Ct[Re*this.stride+1],Ot),_i=[];for(const Re of Jt){const Oe=Re*this.stride;Ct[Oe+4]===Le&&_i.push(Ct[Oe+Nn]>1?F(Ct,Oe,this.clusterProps):this.points[Ct[Oe+Ln]])}if(0===_i.length)throw new Error(Ue);return _i}getLeaves(Le,Re,Oe){const Ue=[];return this._appendLeaves(Ue,Le,Re=Re||10,Oe=Oe||0,0),Ue}getTile(Le,Re,Oe){const Ue=this.trees[this._limitZoom(Le)],qe=Math.pow(2,Le),{extent:Ct,radius:Ot}=this.options,Jt=Ot/Ct,_i=(Oe-Jt)/qe,xi=(Oe+1+Jt)/qe,vi={features:[]};return this._addTileFeatures(Ue.range((Re-Jt)/qe,_i,(Re+1+Jt)/qe,xi),Ue.data,Re,Oe,qe,vi),0===Re&&this._addTileFeatures(Ue.range(1-Jt/qe,_i,1,xi),Ue.data,qe,Oe,qe,vi),Re===qe-1&&this._addTileFeatures(Ue.range(0,_i,Jt/qe,xi),Ue.data,-1,Oe,qe,vi),vi.features.length?vi:null}getClusterExpansionZoom(Le){let Re=this._getOriginZoom(Le)-1;for(;Re<=this.options.maxZoom;){const Oe=this.getChildren(Le);if(Re++,1!==Oe.length)break;Le=Oe[0].properties.cluster_id}return Re}_appendLeaves(Le,Re,Oe,Ue,qe){const Ct=this.getChildren(Re);for(const Re of Ct){const Ct=Re.properties;if(Ct&&Ct.cluster?qe+Ct.point_count<=Ue?qe+=Ct.point_count:qe=this._appendLeaves(Le,Ct.cluster_id,Oe,Ue,qe):qe<Ue?qe++:Le.push(Re),Le.length===Oe)break}return qe}_createTree(Re){const Oe=new Le.by(Re.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Le=0;Le<Re.length;Le+=this.stride)Oe.add(Re[Le],Re[Le+1]);return Oe.finish(),Oe.data=Re,Oe}_addTileFeatures(Le,Re,Oe,Ue,qe,Ct){for(const Ot of Le){const Le=Ot*this.stride,Jt=Re[Le+Nn]>1;let _i,xi,vi;if(Jt)_i=Y(Re,Le,this.clusterProps),xi=Re[Le],vi=Re[Le+1];else{const Oe=this.points[Re[Le+Ln]];_i=Oe.properties;const[Ue,qe]=Oe.geometry.coordinates;xi=N(Ue),vi=X(qe)}const bi={type:1,geometry:[[Math.round(this.options.extent*(xi*qe-Oe)),Math.round(this.options.extent*(vi*qe-Ue))]],tags:_i};let Pi;Pi=Jt||this.options.generateId?Re[Le+Ln]:this.points[Re[Le+Ln]].id,void 0!==Pi&&(bi.id=Pi),Ct.features.push(bi)}}_limitZoom(Le){return Math.max(this.options.minZoom,Math.min(Math.floor(+Le),this.options.maxZoom+1))}_cluster(Le,Re){const{radius:Oe,extent:Ue,reduce:qe,minPoints:Ct}=this.options,Ot=Oe/(Ue*Math.pow(2,Re)),Jt=Le.data,_i=[],xi=this.stride;for(let Oe=0;Oe<Jt.length;Oe+=xi){if(Jt[Oe+2]<=Re)continue;Jt[Oe+2]=Re;const Ue=Jt[Oe],vi=Jt[Oe+1],bi=Le.within(Jt[Oe],Jt[Oe+1],Ot),Pi=Jt[Oe+Nn];let Hr=Pi;for(const Le of bi){const Oe=Le*xi;Jt[Oe+2]>Re&&(Hr+=Jt[Oe+Nn])}if(Hr>Pi&&Hr>=Ct){let Le,Ct=Ue*Pi,Ot=vi*Pi,Jr=-1;const Ln=(Oe/xi<<5)+(Re+1)+this.points.length;for(const Ue of bi){const _i=Ue*xi;if(Jt[_i+2]<=Re)continue;Jt[_i+2]=Re;const vi=Jt[_i+Nn];Ct+=Jt[_i]*vi,Ot+=Jt[_i+1]*vi,Jt[_i+4]=Ln,qe&&(Le||(Le=this._map(Jt,Oe,!0),Jr=this.clusterProps.length,this.clusterProps.push(Le)),qe(Le,this._map(Jt,_i)))}Jt[Oe+4]=Ln,_i.push(Ct/Hr,Ot/Hr,1/0,Ln,-1,Hr),qe&&_i.push(Jr)}else{for(let Le=0;Le<xi;Le++)_i.push(Jt[Oe+Le]);if(Hr>1)for(const Le of bi){const Oe=Le*xi;if(!(Jt[Oe+2]<=Re)){Jt[Oe+2]=Re;for(let Le=0;Le<xi;Le++)_i.push(Jt[Oe+Le])}}}}return _i}_getOriginId(Le){return Le-this.points.length>>5}_getOriginZoom(Le){return(Le-this.points.length)%32}_map(Le,Re,Oe){if(Le[Re+Nn]>1){const Ue=this.clusterProps[Le[Re+Gn]];return Oe?Object.assign({},Ue):Ue}const Ue=this.points[Le[Re+Ln]].properties,qe=this.options.map(Ue);return Oe&&qe===Ue?Object.assign({},qe):qe}}function F(Le,Re,Oe){return{type:"Feature",id:Le[Re+Ln],properties:Y(Le,Re,Oe),geometry:{type:"Point",coordinates:[(Ue=Le[Re],360*(Ue-.5)),W(Le[Re+1])]}};var Ue}function Y(Le,Re,Oe){const Ue=Le[Re+Nn],qe=Ue>=1e4?`${Math.round(Ue/1e3)}k`:Ue>=1e3?Math.round(Ue/100)/10+"k":Ue,Ct=Le[Re+Gn],Ot=-1===Ct?{}:Object.assign({},Oe[Ct]);return Object.assign(Ot,{cluster:!0,cluster_id:Le[Re+Ln],point_count:Ue,point_count_abbreviated:qe})}function N(Le){return Le/360+.5}function X(Le){const Re=Math.sin(Le*Math.PI/180),Oe=.5-.25*Math.log((1+Re)/(1-Re))/Math.PI;return Oe<0?0:Oe>1?1:Oe}function W(Le){const Re=(180-360*Le)*Math.PI/180;return 360*Math.atan(Math.exp(Re))/Math.PI-90}function G(Le,Re,Oe,Ue){let qe=Ue;const Ct=Re+(Oe-Re>>1);let Ot,Jt=Oe-Re;const _i=Le[Re],xi=Le[Re+1],vi=Le[Oe],bi=Le[Oe+1];for(let Ue=Re+3;Ue<Oe;Ue+=3){const Re=B(Le[Ue],Le[Ue+1],_i,xi,vi,bi);if(Re>qe)Ot=Ue,qe=Re;else if(Re===qe){const Le=Math.abs(Ue-Ct);Le<Jt&&(Ot=Ue,Jt=Le)}}qe>Ue&&(Ot-Re>3&&G(Le,Re,Ot,Ue),Le[Ot+2]=qe,Oe-Ot>3&&G(Le,Ot,Oe,Ue))}function B(Le,Re,Oe,Ue,qe,Ct){let Ot=qe-Oe,Jt=Ct-Ue;if(0!==Ot||0!==Jt){const _i=((Le-Oe)*Ot+(Re-Ue)*Jt)/(Ot*Ot+Jt*Jt);_i>1?(Oe=qe,Ue=Ct):_i>0&&(Oe+=Ot*_i,Ue+=Jt*_i)}return Ot=Le-Oe,Jt=Re-Ue,Ot*Ot+Jt*Jt}function J(Le,Re,Oe,Ue){const qe={id:Le??null,type:Re,geometry:Oe,tags:Ue,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===Re||"MultiPoint"===Re||"LineString"===Re)R(qe,Oe);else if("Polygon"===Re)R(qe,Oe[0]);else if("MultiLineString"===Re)for(const Le of Oe)R(qe,Le);else if("MultiPolygon"===Re)for(const Le of Oe)R(qe,Le[0]);return qe}function R(Le,Re){for(let Oe=0;Oe<Re.length;Oe+=3)Le.minX=Math.min(Le.minX,Re[Oe]),Le.minY=Math.min(Le.minY,Re[Oe+1]),Le.maxX=Math.max(Le.maxX,Re[Oe]),Le.maxY=Math.max(Le.maxY,Re[Oe+1])}function V(Le,Re,Oe,Ue){if(!Re.geometry)return;const qe=Re.geometry.coordinates;if(qe&&0===qe.length)return;const Ct=Re.geometry.type,Ot=Math.pow(Oe.tolerance/((1<<Oe.maxZoom)*Oe.extent),2);let Jt=[],_i=Re.id;if(Oe.promoteId?_i=Re.properties[Oe.promoteId]:Oe.generateId&&(_i=Ue||0),"Point"===Ct)$(qe,Jt);else if("MultiPoint"===Ct)for(const Le of qe)$(Le,Jt);else if("LineString"===Ct)q(qe,Jt,Ot,!1);else if("MultiLineString"===Ct){if(Oe.lineMetrics){for(const Oe of qe)Jt=[],q(Oe,Jt,Ot,!1),Le.push(J(_i,"LineString",Jt,Re.properties));return}U(qe,Jt,Ot,!1)}else if("Polygon"===Ct)U(qe,Jt,Ot,!0);else{if("MultiPolygon"!==Ct){if("GeometryCollection"===Ct){for(const qe of Re.geometry.geometries)V(Le,{id:_i,geometry:qe,properties:Re.properties},Oe,Ue);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Le of qe){const Re=[];U(Le,Re,Ot,!0),Jt.push(Re)}}Le.push(J(_i,Ct,Jt,Re.properties))}function $(Le,Re){Re.push(K(Le[0]),Q(Le[1]),0)}function q(Le,Re,Oe,Ue){let qe,Ct,Ot=0;for(let Oe=0;Oe<Le.length;Oe++){const Jt=K(Le[Oe][0]),_i=Q(Le[Oe][1]);Re.push(Jt,_i,0),Oe>0&&(Ot+=Ue?(qe*_i-Jt*Ct)/2:Math.sqrt(Math.pow(Jt-qe,2)+Math.pow(_i-Ct,2))),qe=Jt,Ct=_i}const Jt=Re.length-3;Re[2]=1,G(Re,0,Jt,Oe),Re[Jt+2]=1,Re.size=Math.abs(Ot),Re.start=0,Re.end=Re.size}function U(Le,Re,Oe,Ue){for(let qe=0;qe<Le.length;qe++){const Ct=[];q(Le[qe],Ct,Oe,Ue),Re.push(Ct)}}function K(Le){return Le/360+.5}function Q(Le){const Re=Math.sin(Le*Math.PI/180),Oe=.5-.25*Math.log((1+Re)/(1-Re))/Math.PI;return Oe<0?0:Oe>1?1:Oe}function H(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){if(Ue/=Re,Ct>=(Oe/=Re)&&Ot<Ue)return Le;if(Ot<Oe||Ct>=Ue)return null;const _i=[];for(const Re of Le){const Le=Re.geometry;let Ct=Re.type;const Ot=0===qe?Re.minX:Re.minY,xi=0===qe?Re.maxX:Re.maxY;if(Ot>=Oe&&xi<Ue){_i.push(Re);continue}if(xi<Oe||Ot>=Ue)continue;let vi=[];if("Point"===Ct||"MultiPoint"===Ct)ee(Le,vi,Oe,Ue,qe);else if("LineString"===Ct)te(Le,vi,Oe,Ue,qe,!1,Jt.lineMetrics);else if("MultiLineString"===Ct)se(Le,vi,Oe,Ue,qe,!1);else if("Polygon"===Ct)se(Le,vi,Oe,Ue,qe,!0);else if("MultiPolygon"===Ct)for(const Re of Le){const Le=[];se(Re,Le,Oe,Ue,qe,!0),Le.length&&vi.push(Le)}if(vi.length){if(Jt.lineMetrics&&"LineString"===Ct){for(const Le of vi)_i.push(J(Re.id,Ct,Le,Re.tags));continue}"LineString"!==Ct&&"MultiLineString"!==Ct||(1===vi.length?(Ct="LineString",vi=vi[0]):Ct="MultiLineString"),"Point"!==Ct&&"MultiPoint"!==Ct||(Ct=3===vi.length?"Point":"MultiPoint"),_i.push(J(Re.id,Ct,vi,Re.tags))}}return _i.length?_i:null}function ee(Le,Re,Oe,Ue,qe){for(let Ct=0;Ct<Le.length;Ct+=3){const Ot=Le[Ct+qe];Ot>=Oe&&Ot<=Ue&&ie(Re,Le[Ct],Le[Ct+1],Le[Ct+2])}}function te(Le,Re,Oe,Ue,qe,Ct,Ot){let Jt=oe(Le);const _i=0===qe?ne:re;let xi,vi,bi=Le.start;for(let Pi=0;Pi<Le.length-3;Pi+=3){const Hr=Le[Pi],Jr=Le[Pi+1],Ln=Le[Pi+2],Nn=Le[Pi+3],Gn=Le[Pi+4],qn=0===qe?Hr:Jr,Zn=0===qe?Nn:Gn;let $n=!1;Ot&&(xi=Math.sqrt(Math.pow(Hr-Nn,2)+Math.pow(Jr-Gn,2))),qn<Oe?Zn>Oe&&(vi=_i(Jt,Hr,Jr,Nn,Gn,Oe),Ot&&(Jt.start=bi+xi*vi)):qn>Ue?Zn<Ue&&(vi=_i(Jt,Hr,Jr,Nn,Gn,Ue),Ot&&(Jt.start=bi+xi*vi)):ie(Jt,Hr,Jr,Ln),Zn<Oe&&qn>=Oe&&(vi=_i(Jt,Hr,Jr,Nn,Gn,Oe),$n=!0),Zn>Ue&&qn<=Ue&&(vi=_i(Jt,Hr,Jr,Nn,Gn,Ue),$n=!0),!Ct&&$n&&(Ot&&(Jt.end=bi+xi*vi),Re.push(Jt),Jt=oe(Le)),Ot&&(bi+=xi)}let Pi=Le.length-3;const Hr=Le[Pi],Jr=Le[Pi+1],Ln=0===qe?Hr:Jr;Ln>=Oe&&Ln<=Ue&&ie(Jt,Hr,Jr,Le[Pi+2]),Pi=Jt.length-3,Ct&&Pi>=3&&(Jt[Pi]!==Jt[0]||Jt[Pi+1]!==Jt[1])&&ie(Jt,Jt[0],Jt[1],Jt[2]),Jt.length&&Re.push(Jt)}function oe(Le){const Re=[];return Re.size=Le.size,Re.start=Le.start,Re.end=Le.end,Re}function se(Le,Re,Oe,Ue,qe,Ct){for(const Ot of Le)te(Ot,Re,Oe,Ue,qe,Ct,!1)}function ie(Le,Re,Oe,Ue){Le.push(Re,Oe,Ue)}function ne(Le,Re,Oe,Ue,qe,Ct){const Ot=(Ct-Re)/(Ue-Re);return ie(Le,Ct,Oe+(qe-Oe)*Ot,1),Ot}function re(Le,Re,Oe,Ue,qe,Ct){const Ot=(Ct-Oe)/(qe-Oe);return ie(Le,Re+(Ue-Re)*Ot,Ct,1),Ot}function ae(Le,Re){const Oe=[];for(let Ue=0;Ue<Le.length;Ue++){const qe=Le[Ue],Ct=qe.type;let Ot;if("Point"===Ct||"MultiPoint"===Ct||"LineString"===Ct)Ot=le(qe.geometry,Re);else if("MultiLineString"===Ct||"Polygon"===Ct){Ot=[];for(const Le of qe.geometry)Ot.push(le(Le,Re))}else if("MultiPolygon"===Ct){Ot=[];for(const Le of qe.geometry){const Oe=[];for(const Ue of Le)Oe.push(le(Ue,Re));Ot.push(Oe)}}Oe.push(J(qe.id,Ct,Ot,qe.tags))}return Oe}function le(Le,Re){const Oe=[];Oe.size=Le.size,void 0!==Le.start&&(Oe.start=Le.start,Oe.end=Le.end);for(let Ue=0;Ue<Le.length;Ue+=3)Oe.push(Le[Ue]+Re,Le[Ue+1],Le[Ue+2]);return Oe}function ce(Le,Re){if(Le.transformed)return Le;const Oe=1<<Le.z,Ue=Le.x,qe=Le.y;for(const Ct of Le.features){const Le=Ct.geometry,Ot=Ct.type;if(Ct.geometry=[],1===Ot)for(let Ot=0;Ot<Le.length;Ot+=2)Ct.geometry.push(he(Le[Ot],Le[Ot+1],Re,Oe,Ue,qe));else for(let Ot=0;Ot<Le.length;Ot++){const Jt=[];for(let Ct=0;Ct<Le[Ot].length;Ct+=2)Jt.push(he(Le[Ot][Ct],Le[Ot][Ct+1],Re,Oe,Ue,qe));Ct.geometry.push(Jt)}}return Le.transformed=!0,Le}function he(Le,Re,Oe,Ue,qe,Ct){return[Math.round(Oe*(Le*Ue-qe)),Math.round(Oe*(Re*Ue-Ct))]}function ue(Le,Re,Oe,Ue,qe){const Ct=Re===qe.maxZoom?0:qe.tolerance/((1<<Re)*qe.extent),Ot={features:[],numPoints:0,numSimplified:0,numFeatures:Le.length,source:null,x:Oe,y:Ue,z:Re,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Re of Le)de(Ot,Re,Ct,qe);return Ot}function de(Le,Re,Oe,Ue){const qe=Re.geometry,Ct=Re.type,Ot=[];if(Le.minX=Math.min(Le.minX,Re.minX),Le.minY=Math.min(Le.minY,Re.minY),Le.maxX=Math.max(Le.maxX,Re.maxX),Le.maxY=Math.max(Le.maxY,Re.maxY),"Point"===Ct||"MultiPoint"===Ct)for(let Re=0;Re<qe.length;Re+=3)Ot.push(qe[Re],qe[Re+1]),Le.numPoints++,Le.numSimplified++;else if("LineString"===Ct)fe(Ot,qe,Le,Oe,!1,!1);else if("MultiLineString"===Ct||"Polygon"===Ct)for(let Re=0;Re<qe.length;Re++)fe(Ot,qe[Re],Le,Oe,"Polygon"===Ct,0===Re);else if("MultiPolygon"===Ct)for(let Re=0;Re<qe.length;Re++){const Ue=qe[Re];for(let Re=0;Re<Ue.length;Re++)fe(Ot,Ue[Re],Le,Oe,!0,0===Re)}if(Ot.length){let Oe=Re.tags||null;if("LineString"===Ct&&Ue.lineMetrics){Oe={};for(const Le in Re.tags)Oe[Le]=Re.tags[Le];Oe.mapbox_clip_start=qe.start/qe.size,Oe.mapbox_clip_end=qe.end/qe.size}const Jt={geometry:Ot,type:"Polygon"===Ct||"MultiPolygon"===Ct?3:"LineString"===Ct||"MultiLineString"===Ct?2:1,tags:Oe};null!==Re.id&&(Jt.id=Re.id),Le.features.push(Jt)}}function fe(Le,Re,Oe,Ue,qe,Ct){const Ot=Ue*Ue;if(Ue>0&&Re.size<(qe?Ot:Ue))return void(Oe.numPoints+=Re.length/3);const Jt=[];for(let Le=0;Le<Re.length;Le+=3)(0===Ue||Re[Le+2]>Ot)&&(Oe.numSimplified++,Jt.push(Re[Le],Re[Le+1])),Oe.numPoints++;qe&&function(Le,Re){let Oe=0;for(let Re=0,Ue=Le.length,qe=Ue-2;Re<Ue;qe=Re,Re+=2)Oe+=(Le[Re]-Le[qe])*(Le[Re+1]+Le[qe+1]);if(Oe>0===Re)for(let Re=0,Oe=Le.length;Re<Oe/2;Re+=2){const Ue=Le[Re],qe=Le[Re+1];Le[Re]=Le[Oe-2-Re],Le[Re+1]=Le[Oe-1-Re],Le[Oe-2-Re]=Ue,Le[Oe-1-Re]=qe}}(Jt,Ct),Le.push(Jt)}const qn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ge{constructor(Le,Re){const Oe=(Re=this.options=function(Le,Re){for(const Oe in Re)Le[Oe]=Re[Oe];return Le}(Object.create(qn),Re)).debug;if(Oe&&console.time("preprocess data"),Re.maxZoom<0||Re.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Re.promoteId&&Re.generateId)throw new Error("promoteId and generateId cannot be used together.");let Ue=function(Le,Re){const Oe=[];if("FeatureCollection"===Le.type)for(let Ue=0;Ue<Le.features.length;Ue++)V(Oe,Le.features[Ue],Re,Ue);else V(Oe,"Feature"===Le.type?Le:{geometry:Le},Re);return Oe}(Le,Re);this.tiles={},this.tileCoords=[],Oe&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Re.indexMaxZoom,Re.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Ue=function(Le,Re){const Oe=Re.buffer/Re.extent;let Ue=Le;const qe=H(Le,1,-1-Oe,Oe,0,-1,2,Re),Ct=H(Le,1,1-Oe,2+Oe,0,-1,2,Re);return(qe||Ct)&&(Ue=H(Le,1,-Oe,1+Oe,0,-1,2,Re)||[],qe&&(Ue=ae(qe,1).concat(Ue)),Ct&&(Ue=Ue.concat(ae(Ct,-1)))),Ue}(Ue,Re),Ue.length&&this.splitTile(Ue,0,0,0),Oe&&(Ue.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(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=[Le,Re,Oe,Ue],_i=this.options,xi=_i.debug;for(;Jt.length;){Ue=Jt.pop(),Oe=Jt.pop(),Re=Jt.pop(),Le=Jt.pop();const vi=1<<Re,bi=me(Re,Oe,Ue);let Pi=this.tiles[bi];if(!Pi&&(xi>1&&console.time("creation"),Pi=this.tiles[bi]=ue(Le,Re,Oe,Ue,_i),this.tileCoords.push({z:Re,x:Oe,y:Ue}),xi)){xi>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Re,Oe,Ue,Pi.numFeatures,Pi.numPoints,Pi.numSimplified),console.timeEnd("creation"));const Le=`z${Re}`;this.stats[Le]=(this.stats[Le]||0)+1,this.total++}if(Pi.source=Le,null==qe){if(Re===_i.indexMaxZoom||Pi.numPoints<=_i.indexMaxPoints)continue}else{if(Re===_i.maxZoom||Re===qe)continue;if(null!=qe){const Le=qe-Re;if(Oe!==Ct>>Le||Ue!==Ot>>Le)continue}}if(Pi.source=null,0===Le.length)continue;xi>1&&console.time("clipping");const Hr=.5*_i.buffer/_i.extent,Jr=.5-Hr,Ln=.5+Hr,Nn=1+Hr;let Gn=null,qn=null,Zn=null,$n=null,Xn=H(Le,vi,Oe-Hr,Oe+Ln,0,Pi.minX,Pi.maxX,_i),Yn=H(Le,vi,Oe+Jr,Oe+Nn,0,Pi.minX,Pi.maxX,_i);Le=null,Xn&&(Gn=H(Xn,vi,Ue-Hr,Ue+Ln,1,Pi.minY,Pi.maxY,_i),qn=H(Xn,vi,Ue+Jr,Ue+Nn,1,Pi.minY,Pi.maxY,_i),Xn=null),Yn&&(Zn=H(Yn,vi,Ue-Hr,Ue+Ln,1,Pi.minY,Pi.maxY,_i),$n=H(Yn,vi,Ue+Jr,Ue+Nn,1,Pi.minY,Pi.maxY,_i),Yn=null),xi>1&&console.timeEnd("clipping"),Jt.push(Gn||[],Re+1,2*Oe,2*Ue),Jt.push(qn||[],Re+1,2*Oe,2*Ue+1),Jt.push(Zn||[],Re+1,2*Oe+1,2*Ue),Jt.push($n||[],Re+1,2*Oe+1,2*Ue+1)}}getTile(Le,Re,Oe){Le=+Le,Re=+Re,Oe=+Oe;const Ue=this.options,{extent:qe,debug:Ct}=Ue;if(Le<0||Le>24)return null;const Ot=1<<Le,Jt=me(Le,Re=Re+Ot&Ot-1,Oe);if(this.tiles[Jt])return ce(this.tiles[Jt],qe);Ct>1&&console.log("drilling down to z%d-%d-%d",Le,Re,Oe);let _i,xi=Le,vi=Re,bi=Oe;for(;!_i&&xi>0;)xi--,vi>>=1,bi>>=1,_i=this.tiles[me(xi,vi,bi)];return _i&&_i.source?(Ct>1&&(console.log("found parent tile z%d-%d-%d",xi,vi,bi),console.time("drilling down")),this.splitTile(_i.source,xi,vi,bi,Le,Re,Oe),Ct>1&&console.timeEnd("drilling down"),this.tiles[Jt]?ce(this.tiles[Jt],qe):null):null}}function me(Le,Re,Oe){return 32*((1<<Le)*Oe+Re)+Le}function ye(Le,Oe){const Ue=Le.tileID.canonical;if(!(this||Re)._geoJSONIndex)return void Oe(null,null);const qe=(this||Re)._geoJSONIndex.getTile(Ue.z,Ue.x,Ue.y);if(!qe)return void Oe(null,null);const Ct=new p(qe.features);let Ot=bi(Ct);0===Ot.byteOffset&&Ot.byteLength===Ot.buffer.byteLength||(Ot=new Uint8Array(Ot)),Oe
1(null,{vectorTile:Ct,rawData:Ot.buffer})}class xe extends c{constructor(Le,Re,Oe,Ue,qe,Ct){super(Le,Re,Oe,Ue,ye,Ct),qe&&(this.loadGeoJSON=qe),this._dynamicIndex=new y}loadData(Re,Oe){const Ue=Re&&Re.request,qe=Ue&&Ue.collectResourceTiming;this.loadGeoJSON(Re,((Ct,Ot)=>{if(Ct||!Ot)return Oe(Ct);if("object"!=typeof Ot)return Oe(new Error(`Input data given to '${Re.source}' is not a valid GeoJSON object.`));{try{if(Re.filter){const Oe=Le.M(Re.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===Oe.result)throw new Error(Oe.value.map((Le=>`${Le.key}: ${Le.message}`)).join(", "));Ot.features=Ot.features.filter((Le=>Oe.value.evaluate({zoom:0},Le)))}Re.dynamic?("Feature"===Ot.type&&(Ot={type:"FeatureCollection",features:[Ot]}),Re.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Ot.features,this.loaded),Re.cluster&&(Ot.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=Re.cluster?new E(function({superclusterOptions:Re,clusterProperties:Oe}){if(!Oe||!Re)return Re;const Ue={},qe={},Ct={accumulated:null,zoom:0},Ot={properties:null},Jt=Object.keys(Oe);for(const Re of Jt){const[Ct,Ot]=Oe[Re],Jt=Le.M(Ot),_i=Le.M("string"==typeof Ct?[Ct,["accumulated"],["get",Re]]:Ct);Ue[Re]=Jt.value,qe[Re]=_i.value}return Re.map=Le=>{Ot.properties=Le;const Re={};for(const Le of Jt)Re[Le]=Ue[Le].evaluate(Ct,Ot);return Re},Re.reduce=(Le,Re)=>{Ot.properties=Re;for(const Re of Jt)Ct.accumulated=Le[Re],Le[Re]=qe[Re].evaluate(Ct,Ot)},Re}(Re)).load(Ot.features):Re.dynamic?this._dynamicIndex:function(Le,Re){return new ge(Le,Re)}(Ot,Re.geojsonVtOptions)}catch(Le){return Oe(Le)}const Ct={};if(qe){const Le=t(Ue);Le&&(Ct.resourceTiming={},Ct.resourceTiming[Re.source]=JSON.parse(JSON.stringify(Le)))}Oe(null,Ct)}}))}reloadTile(Le,Re){const Oe=this.loaded;return Oe&&Oe[Le.uid]?Le.partial?Re(null,void 0):super.reloadTile(Le,Re):this.loadTile(Le,Re)}loadGeoJSON(Re,Oe){if(Re.request)Le.n(Re.request,Oe);else{if("string"!=typeof Re.data)return Oe(new Error(`Input data given to '${Re.source}' is not a valid GeoJSON object.`));try{return Oe(null,JSON.parse(Re.data))}catch(Le){return Oe(new Error(`Input data given to '${Re.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(Le,Re){try{Re(null,this._geoJSONIndex.getClusterExpansionZoom(Le.clusterId))}catch(Le){Re(Le)}}getClusterChildren(Le,Re){try{Re(null,this._geoJSONIndex.getChildren(Le.clusterId))}catch(Le){Re(Le)}}getClusterLeaves(Le,Re){try{Re(null,this._geoJSONIndex.getLeaves(Le.clusterId,Le.limit,Le.offset))}catch(Le){Re(Le)}}}class we{constructor(Re,Oe){this.tileID=new Le.aA(Re.tileID.overscaledZ,Re.tileID.wrap,Re.tileID.canonical.z,Re.tileID.canonical.x,Re.tileID.canonical.y),this.tileZoom=Re.tileZoom,this.uid=Re.uid,this.zoom=Re.zoom,this.canonical=Re.tileID.canonical,this.pixelRatio=Re.pixelRatio,this.tileSize=Re.tileSize,this.source=Re.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=Re.projection,this.brightness=Oe}parse(Re,Oe,Ue,qe){this.status="parsing";const Ct=new Le.aA(Ue.tileID.overscaledZ,Ue.tileID.wrap,Ue.tileID.canonical.z,Ue.tileID.canonical.x,Ue.tileID.canonical.y),Ot={},Jt=Oe.familiesBySource[Ue.source],_i=new Le.dR(Ct,Ue.promoteId);return _i.bucketLayerIDs=[],_i.is3DTile=!0,Le.e0(Re).then((Re=>{if(!Re)return qe(new Error("Could not parse tile"));const Oe=Le.e1(Re,1/Le.c8(Ue.tileID.canonical)),xi=Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("MAPBOX_mesh_features")||Re.json.asset.extras&&Re.json.asset.extras.MAPBOX_mesh_features,vi=Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("EXT_meshopt_compression"),bi=new Le.a3(this.zoom,{brightness:this.brightness});for(const Re in Jt)for(const Ue of Jt[Re]){const Re=Ue[0];_i.bucketLayerIDs.push(Ue.map((Le=>Le.id))),Re.recalculate(bi,[]);const qe=new Le.e2(Oe,Ct,xi,vi,this.brightness,_i);xi||(qe.needsUpload=!0),Ot[Re.fqid]=qe,qe.evaluate(Re)}this.status="done",qe(null,{buckets:Ot,featureIndex:_i})})).catch((Le=>qe(new Error(Le.message))))}}class be{constructor(Le,Re,Oe,Ue,qe,Ct){this.actor=Le,this.layerIndex=Re,this.brightness=Ct,this.loading={},this.loaded={}}loadTile(Re,Oe){const Ue=Re.uid,qe=this.loading[Ue]=new we(Re,this.brightness);Le.bc(Re.request,((Le,Ct)=>{const Ot=!this.loading[Ue];return delete this.loading[Ue],Ot||Le?(qe.status="done",Ot||(this.loaded[Ue]=qe),Oe(Le)):Ct&&0!==Ct.byteLength?void qe.parse(Ct,this.layerIndex,Re,((Le,Re)=>{qe.status="done",this.loaded=this.loaded||{},this.loaded[Ue]=qe,Le||!Re?Oe(Le):Oe(null,Re)})):(qe.status="done",this.loaded[Ue]=qe,Oe())}))}reloadTile(Le,Re){const Oe=this.loaded,Ue=Le.uid;if(Oe&&Oe[Ue]){const qe=Oe[Ue];qe.projection=Le.projection,qe.brightness=Le.brightness;const n=(Oe,Ue)=>{qe.reloadCallback&&(delete qe.reloadCallback,this.loadTile(Le,Re)),Re(Oe,Ue)};"parsing"===qe.status?qe.reloadCallback=n:"done"===qe.status&&this.loadTile(Le,Re)}}abortTile(Le,Re){const Oe=Le.uid;this.loading[Oe]&&delete this.loading[Oe],Re()}removeTile(Le,Re){const Oe=this.loaded,Ue=Le.uid;Oe&&Oe[Ue]&&delete Oe[Ue],Re()}}class Se{constructor(Re){this.self=Re,this.actor=new Le.e3(Re,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=Le.bL({name:"mercator"}),this.workerSourceTypes={vector:c,geojson:xe,"batched-model":be},this.workerSources={},this.demWorkerSources={}
1,this.self.registerWorkerSource=(Le,Re)=>{if(this.workerSourceTypes[Le])throw new Error(`Worker source with name "${Le}" already registered.`);this.workerSourceTypes[Le]=Re},this.self.registerRTLTextPlugin=Re=>{if(Le.e4.isParsed())throw new Error("RTL text plugin already registered.");Le.e4.applyArabicShaping=Re.applyArabicShaping,Le.e4.processBidirectionalText=Re.processBidirectionalText,Le.e4.processStyledBidirectionalText=Re.processStyledBidirectionalText}}clearCaches(Le,Re,Oe){delete this.layerIndexes[Le],delete this.availableImages[Le],delete this.workerSources[Le],delete this.demWorkerSources[Le],delete this.rasterArrayWorkerSource,Oe()}checkIfReady(Le,Re,Oe){Oe()}setReferrer(Le,Re){this.referrer=Re}spriteLoaded(Re,{scope:Oe,isLoaded:Ue}){if(this.isSpriteLoaded[Re]||(this.isSpriteLoaded[Re]={}),this.isSpriteLoaded[Re][Oe]=Ue,this.workerSources[Re]&&this.workerSources[Re][Oe])for(const qe in this.workerSources[Re][Oe]){const Ct=this.workerSources[Re][Oe][qe];for(const Re in Ct){const Oe=Ct[Re];Oe instanceof c&&(Oe.isSpriteLoaded=Ue,Oe.fire(new Le.x("isSpriteLoaded")))}}}setImages(Le,{scope:Re,images:Oe},Ue){if(this.availableImages[Le]||(this.availableImages[Le]={}),this.availableImages[Le][Re]=Oe,this.workerSources[Le]&&this.workerSources[Le][Re]){for(const Ue in this.workerSources[Le][Re]){const qe=this.workerSources[Le][Re][Ue];for(const Le in qe)qe[Le].availableImages=Oe}Ue()}else Ue()}setProjection(Re,Oe){this.projections[Re]=Le.bL(Oe)}setBrightness(Le,Re,Oe){this.brightness=Re,Oe()}setLayers(Le,Re,Oe){this.getLayerIndex(Le,Re.scope).replace(Re.layers,Re.options),Oe()}updateLayers(Le,Re,Oe){this.getLayerIndex(Le,Re.scope).update(Re.layers,Re.removedIds,Re.options),Oe()}loadTile(Le,Re,Oe){Re.projection=this.projections[Le]||this.defaultProjection,this.getWorkerSource(Le,Re.type,Re.source,Re.scope).loadTile(Re,Oe)}loadDEMTile(Le,Re,Oe){this.getDEMWorkerSource(Le,Re.source,Re.scope).loadTile(Re,Oe)}decodeRasterArray(Le,Re,Oe){this.getRasterArrayWorkerSource().decodeRasterArray(Re,Oe)}reloadTile(Le,Re,Oe){Re.projection=this.projections[Le]||this.defaultProjection,this.getWorkerSource(Le,Re.type,Re.source,Re.scope).reloadTile(Re,Oe)}abortTile(Le,Re,Oe){this.getWorkerSource(Le,Re.type,Re.source,Re.scope).abortTile(Re,Oe)}removeTile(Le,Re,Oe){this.getWorkerSource(Le,Re.type,Re.source,Re.scope).removeTile(Re,Oe)}removeSource(Le,Re,Oe){if(!(this.workerSources[Le]&&this.workerSources[Le][Re.scope]&&this.workerSources[Le][Re.scope][Re.type]&&this.workerSources[Le][Re.scope][Re.type][Re.source]))return;const Ue=this.workerSources[Le][Re.scope][Re.type][Re.source];delete this.workerSources[Le][Re.scope][Re.type][Re.source],void 0!==Ue.removeSource?Ue.removeSource(Re,Oe):Oe()}loadWorkerSource(Le,Re,Oe){try{this.self.importScripts(Re.url),Oe()}catch(Le){Oe(Le.toString())}}syncRTLPluginState(Re,Oe,Ue){try{Le.e4.setState(Oe);const Re=Le.e4.getPluginURL();if(Le.e4.isLoaded()&&!Le.e4.isParsed()&&null!=Re){this.self.importScripts(Re);const Oe=Le.e4.isParsed();Ue(Oe?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Re}`),Oe)}}catch(Le){Ue(Le.toString())}}setDracoUrl(Le,Re){this.dracoUrl=Re}getAvailableImages(Le,Re){this.availableImages[Le]||(this.availableImages[Le]={});let Oe=this.availableImages[Le][Re];return Oe||(Oe=[]),Oe}getLayerIndex(Le,Re){this.layerIndexes[Le]||(this.layerIndexes[Le]={});let Oe=this.layerIndexes[Le][Re];return Oe||(Oe=this.layerIndexes[Le][Re]=new i,Oe.scope=Re),Oe}getWorkerSource(Le,Re,Oe,Ue){return this.workerSources[Le]||(this.workerSources[Le]={}),this.workerSources[Le][Ue]||(this.workerSources[Le][Ue]={}),this.workerSources[Le][Ue][Re]||(this.workerSources[Le][Ue][Re]={}),this.isSpriteLoaded[Le]||(this.isSpriteLoaded[Le]={}),this.workerSources[Le][Ue][Re][Oe]||(this.workerSources[Le][Ue][Re][Oe]=new this.workerSourceTypes[Re]({send:(Re,Oe,Ue,qe,Ct,Ot)=>{this.actor.send(Re,Oe,Ue,Le,Ct,Ot)},scheduler:this.actor.scheduler},this.getLayerIndex(Le,Ue),this.getAvailableImages(Le,Ue),this.isSpriteLoaded[Le][Ue],void 0,this.brightness)),this.workerSources[Le][Ue][Re][Oe]}getDEMWorkerSource(Le,Re,Oe){return this.demWorkerSources[Le]||(this.demWorkerSources[Le]={}),this.demWorkerSources[Le][Oe]||(this.demWorkerSources[Le][Oe]={}),this.demWorkerSources[Le][Oe][Re]||(this.demWorkerSources[Le][Oe][Re]=new h),this.demWorkerSources[Le][Oe][Re]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new u),this.rasterArrayWorkerSource}enforceCacheSizeLimit(Re,Oe){Le.e5(Oe)}getWorkerPerformanceMetrics(Le,Re,Oe){Oe(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Se(self)),Se}));define(["./shared"],(function(Le){var Re="3.7.0";const Oe={create:"create",load:"load",fullLoad:"fullLoad"},Ue={mark(Le){performance.mark(Le)},measure(Le,Re,Oe){performance.measure(Le,Re,Oe)}};function r(Re){const Oe=Re.name.split("?")[0];return Le.a(Oe)&&Oe.includes("mapbox-gl.js")?"javascript":Le.a(Oe)&&Oe.includes("mapbox-gl.css")?"css":Le.b(Oe)?"fontRange":Le.c(Oe)?"sprite":Le.i(Oe)?"style":Le.d(Oe)?"tilejson":"other"}var qe,Ct={},Ot=function(){if(qe)return Ct;function e(Le){return!t(Le)}function t(Re){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var Le,Re,Oe=new Blob([""],{type:"text/javascript"}),Ue=URL.createObjectURL(Oe);try{Re=new Worker(Ue),Le=!0}catch(Re){Le=!1}return Re&&Re.terminate(),URL.revokeObjectURL(Ue),Le}()?function(){var Le=document.createElement("canvas");Le.width=Le.height=1;var Re=Le.getContext("2d");if(!Re)return!1;var Oe=Re.getImageData(0,0,1,1);return Oe&&Oe.width===Le.width}()?(void 0===Le[Oe=Re&&Re.failIfMajorPerformanceCaveat]&&(Le[Oe]=function(Le){var Re,Oe=function(Le){var Re=document.createElement("canvas"),Oe=Object.create(e.webGLContextAttributes);return Oe.failIfMajorPerformanceCaveat=Le,Re.getContext("webgl2",Oe)}(Le);if(!Oe)return!1;try{Re=Oe.createShader(Oe.VERTEX_SHADER)}catch(Le){return!1}return!(!Re||Oe.isContextLost())&&(Oe.shaderSource(Re,"void main() {}"),Oe.compileShader(Re),!0===Oe.getShaderParameter(Re,Oe.COMPILE_STATUS))}(Oe)),Le[Oe]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var Oe}
1qe=1,Ct.supported=e,Ct.notSupportedReason=t;var Le={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},Ct}();function l(Le,Re,Oe){const Ue=document.createElement(Le);return null!=Re&&(Ue.className=Re),Oe&&Oe.appendChild(Ue),Ue}function c(Le,Re,Oe){const Ue=document.createElementNS("http://www.w3.org/2000/svg",Le);for(const Le of Object.keys(Re))Ue.setAttributeNS(null,Le,String(Re[Le]));return Oe&&Oe.appendChild(Ue),Ue}const Jt="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,_i=Jt&&void 0!==Jt.userSelect?"userSelect":"WebkitUserSelect";let xi;function _(){Jt&&_i&&(xi=Jt[_i],Jt[_i]="none")}function p(){Jt&&_i&&(Jt[_i]=xi)}function m(Le){Le.preventDefault(),Le.stopPropagation(),window.removeEventListener("click",m,!0)}function f(){window.addEventListener("click",m,!0),window.setTimeout((()=>{window.removeEventListener("click",m,!0)}),0)}function g(Le,Re){const Oe=Le.getBoundingClientRect();return y(Le,Oe,Re)}function v(Le,Re){const Oe=Le.getBoundingClientRect(),Ue=[];for(let qe=0;qe<Re.length;qe++)Ue.push(y(Le,Oe,Re[qe]));return Ue}function x(Le){return void 0!==window.InstallTrigger&&2===Le.button&&Le.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:Le.button}function y(Re,Oe,Ue){const qe=Re.offsetWidth===Oe.width?1:Re.offsetWidth/Oe.width;return new Le.P((Ue.clientX-Oe.left)*qe,(Ue.clientY-Oe.top)*qe)}const vi="01",bi="NO_ACCESS_TOKEN";class T{constructor(Le,Re,Oe){this._transformRequestFn=Le,this._customAccessToken=Re,this._silenceAuthErrors=!!Oe,this._createSkuToken()}_createSkuToken(){const Le=function(){let Le="";for(let Re=0;Re<10;Re++)Le+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",vi,Le].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=Le.token,this._skuTokenExpiresAt=Le.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(Le,Re){return this._transformRequestFn&&this._transformRequestFn(Le,Re)||{url:Le}}normalizeStyleURL(Oe,Ue){if(!Le.f(Oe))return Oe;const qe=C(Oe);return qe.params.push(`sdk=js-${Re}`),qe.path=`/styles/v1${qe.path}`,this._makeAPIURL(qe,this._customAccessToken||Ue)}normalizeGlyphsURL(Re,Oe){if(!Le.f(Re))return Re;const Ue=C(Re);return Ue.path=`/fonts/v1${Ue.path}`,this._makeAPIURL(Ue,this._customAccessToken||Oe)}normalizeModelURL(Re,Oe){if(!Le.f(Re))return Re;const Ue=C(Re);return Ue.path=`/models/v1${Ue.path}`,this._makeAPIURL(Ue,this._customAccessToken||Oe)}normalizeSourceURL(Re,Oe,Ue,qe){if(!Le.f(Re))return Re;const Ct=C(Re);return Ct.path=`/v4/${Ct.authority}.json`,Ct.params.push("secure"),Ue&&Ct.params.push(`language=${Ue}`),qe&&Ct.params.push(`worldview=${qe}`),this._makeAPIURL(Ct,this._customAccessToken||Oe)}normalizeSpriteURL(Re,Oe,Ue,qe){const Ct=C(Re);return Le.f(Re)?(Ct.path=`/styles/v1${Ct.path}/sprite${Oe}${Ue}`,this._makeAPIURL(Ct,this._customAccessToken||qe)):(Ct.path+=`${Oe}${Ue}`,S(Ct))}normalizeTileURL(Re,Oe,Ue){if(this._isSkuTokenExpired()&&this._createSkuToken(),Re&&!Le.f(Re))return Re;const qe=C(Re);qe.path=qe.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${Oe||Ue&&"raster"!==qe.authority&&512===Ue?"@2x":""}${Le.m.supported?".webp":"$1"}`),"raster"===qe.authority?qe.path=`/${Le.e.RASTER_URL_PREFIX}${qe.path}`:"rasterarrays"===qe.authority?qe.path=`/${Le.e.RASTERARRAYS_URL_PREFIX}${qe.path}`:"3dtiles"===qe.authority?qe.path=`/${Le.e.TILES3D_URL_PREFIX}${qe.path}`:(qe.path=qe.path.replace(/^.+\/v4\//,"/"),qe.path=`/${Le.e.TILE_URL_VERSION}${qe.path}`);const Ct=this._customAccessToken||function(Le){for(const Re of Le){const Le=Re.match(/^access_token=(.*)$/);if(Le)return Le[1]}return null}(qe.params)||Le.e.ACCESS_TOKEN;return Le.e.REQUIRE_ACCESS_TOKEN&&Ct&&this._skuToken&&qe.params.push(`sku=${this._skuToken}`),this._makeAPIURL(qe,Ct)}canonicalizeTileURL(Re,Oe){const Ue=C(Re);if(!Ue.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!Ue.path.match(/\.[\w]+$/))return Re;let qe="mapbox://";Ue.path.match(/^\/raster\/v1\//)?qe+=`raster/${Ue.path.replace(`/${Le.e.RASTER_URL_PREFIX}/`,"")}`:Ue.path.match(/^\/rasterarrays\/v1\//)?qe+=`rasterarrays/${Ue.path.replace(`/${Le.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:qe+=`tiles/${Ue.path.replace(`/${Le.e.TILE_URL_VERSION}/`,"")}`;let Ct=Ue.params;return Oe&&(Ct=Ct.filter((Le=>
1!Le.match(/^access_token=/)))),Ct.length&&(qe+=`?${Ct.join("&")}`),qe}canonicalizeTileset(Re,Oe){const Ue=!!Oe&&Le.f(Oe),qe=[];for(const Oe of Re.tiles||[])Le.h(Oe)?qe.push(this.canonicalizeTileURL(Oe,Ue)):qe.push(Oe);return qe}_makeAPIURL(Re,Oe){const Ue="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",qe=C(Le.e.API_URL);if(Re.protocol=qe.protocol,Re.authority=qe.authority,"http"===Re.protocol){const Le=Re.params.indexOf("secure");Le>=0&&Re.params.splice(Le,1)}if("/"!==qe.path&&(Re.path=`${qe.path}${Re.path}`),!Le.e.REQUIRE_ACCESS_TOKEN)return S(Re);if(Oe=Oe||Le.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!Oe)throw new Error(`An API access token is required to use Mapbox GL. ${Ue}`);if("s"===Oe[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${Ue}`)}return Re.params=Re.params.filter((Le=>-1===Le.indexOf("access_token"))),Re.params.push(`access_token=${Oe||""}`),S(Re)}}const Pi=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function C(Le){const Re=Le.match(Pi);if(!Re)throw new Error("Unable to parse URL object");return{protocol:Re[1],authority:Re[2],path:Re[3]||"/",params:Re[4]?Re[4].split("&"):[]}}function S(Le){const Re=Le.params.length?`?${Le.params.join("&")}`:"";return`${Le.protocol}://${Le.authority}${Le.path}${Re}`}const Hr="mapbox.eventData";function D(Re){if(!Re)return null;const Oe=Re.split(".");if(!Oe||3!==Oe.length)return null;try{return JSON.parse(Le.j(Oe[1]))}catch(Le){return null}}class R{constructor(Le){this.type=Le,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(Re){const Oe=D(Le.e.ACCESS_TOKEN);let Ue="";return Ue=Oe&&Oe.u?Le.k(Oe.u):Le.e.ACCESS_TOKEN||"",Re?`${Hr}.${Re}:${Ue}`:`${Hr}:${Ue}`}fetchEventData(){const Re=Le.s("localStorage"),Oe=this.getStorageKey(),Ue=this.getStorageKey("uuid");if(Re)try{const Le=localStorage.getItem(Oe);Le&&(this.eventData=JSON.parse(Le));const Re=localStorage.getItem(Ue);Re&&(this.anonId=Re)}catch(Re){Le.w("Unable to read from LocalStorage")}}saveEventData(){const Re=Le.s("localStorage"),Oe=this.getStorageKey(),Ue=this.getStorageKey("uuid"),qe=this.anonId;if(Re&&qe)try{localStorage.setItem(Ue,qe),Object.keys(this.eventData).length>=1&&localStorage.setItem(Oe,JSON.stringify(this.eventData))}catch(Re){Le.w("Unable to write to LocalStorage")}}processRequests(Le){}postEvent(Re,Oe,Ue,qe){if(!Le.e.EVENTS_URL)return;const Ct=C(Le.e.EVENTS_URL);Ct.params.push(`access_token=${qe||Le.e.ACCESS_TOKEN||""}`);const Ot={event:this.type,created:new Date(Re).toISOString()},Jt=Oe?Le.l(Ot,Oe):Ot,_i={url:S(Ct),headers:{"Content-Type":"text/plain"},body:JSON.stringify([Jt])};this.pendingRequest=Le.p(_i,(Le=>{this.pendingRequest=null,Ue(Le),this.saveEventData(),this.processRequests(qe)}))}queueRequest(Le,Re){this.queue.push(Le),this.processRequests(Re)}}const Jr=new class extends R{constructor(Le){super("appUserTurnstile"),this._customAccessToken=Le}postTurnstileEvent(Re,Oe){Le.e.EVENTS_URL&&Le.e.ACCESS_TOKEN&&Array.isArray(Re)&&Re.some((Re=>Le.f(Re)||Le.h(Re)))&&this.queueRequest(Date.now(),Oe)}processRequests(Oe){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const Ue=D(Le.e.ACCESS_TOKEN),qe=Ue?Ue.u:Le.e.ACCESS_TOKEN;let Ct=qe!==this.eventData.tokenU;Le.v(this.anonId)||(this.anonId=Le.u(),Ct=!0);const Ot=this.queue.shift();if(this.eventData.lastSuccess){const Le=new Date(this.eventData.lastSuccess),Re=new Date(Ot),Oe=(Ot-this.eventData.lastSuccess)/864e5;Ct=Ct||Oe>=1||Oe<-1||Le.getDate()!==Re.getDate()}else Ct=!0;Ct?this.postEvent(Ot,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Re,skuId:vi,"enabled.telemetry":!1,userId:this.anonId},(Le=>{Le||(this.eventData.lastSuccess=Ot,this.eventData.tokenU=qe)}),Oe):this.processRequests()}},Ln=Jr.postTurnstileEvent.bind(Jr),Nn=new class extends R{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(Re,Oe,Ue,qe){this.skuToken=Oe,this.errorCb=qe,Le.e.EVENTS_URL&&(Ue||Le.e.ACCESS_TOKEN?this.queueRequest({id:Re,timestamp:Date.now()},Ue):this.errorCb(new Error(bi)))}processRequests(Oe){if(this.pendingRequest||0===this.queue.length)return;const{id:Ue,timestamp:qe}=this.queue.shift();Ue&&this.success[Ue]||(this.anonId||this.fetchEventData(),Le.v(this.anonId)||(this.anonId=Le.u()),this.postEvent(qe,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Re,skuId:vi,skuToken:this.skuToken,userId:this.anonId},(Le=>{Le?this.errorCb(Le):Ue&&(this.success[Ue]=!0)}),Oe))}remove(){this.errorCb=null}},Gn=Nn.postMapLoadEvent.bind(Nn),qn=new class extends R{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(Re){let Oe=this.mapInstanceIdMap.get(Re);
1return Oe||(Oe=Le.u(),this.mapInstanceIdMap.set(Re,Oe)),Oe}getEventId(Le){const Re=this.eventIdPerMapInstanceMap.get(Le)||0;return this.eventIdPerMapInstanceMap.set(Le,Re+1),Re}postStyleLoadEvent(Re,Oe){const{map:Ue,style:qe,importedStyles:Ct}=Oe;if(!Le.e.EVENTS_URL||!Re&&!Le.e.ACCESS_TOKEN)return;const Ot=this.getMapInstanceId(Ue),Jt={mapInstanceId:Ot,eventId:this.getEventId(Ot),style:qe};Ct.length&&(Jt.importedStyles=Ct),this.queueRequest({timestamp:Date.now(),payload:Jt},Re)}processRequests(Le){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:Re,payload:Oe}=this.queue.shift();this.postEvent(Re,Oe,(()=>{}),Le)}},Zn=qn.postStyleLoadEvent.bind(qn),$n=new class extends R{constructor(){super("gljs.performance")}postPerformanceEvent(Re,Oe){Le.e.EVENTS_URL&&(Re||Le.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:Oe},Re)}processRequests(Ue){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:qe,performanceData:Ct}=this.queue.shift(),Ot=function(Ue){const qe=performance.getEntriesByType("resource"),Ct=performance.getEntriesByType("mark"),Ot=function(Le){const Re={};if(Le)for(const Oe in Le)if("other"!==Oe)for(const Ue of Le[Oe]){const Le=`${Oe}ResolveRangeMin`,qe=`${Oe}ResolveRangeMax`,Ct=`${Oe}RequestCount`,Ot=`${Oe}RequestCachedCount`;Re[Le]=Math.min(Re[Le]||1/0,Ue.startTime),Re[qe]=Math.max(Re[qe]||-1/0,Ue.responseEnd);const n=Le=>{void 0===Re[Le]&&(Re[Le]=0),++Re[Le]};void 0!==Ue.transferSize&&0===Ue.transferSize&&n(Ot),n(Ct)}return Re}(function(Le,Re){const Oe={};if(Le)for(const Ue of Le){const Le=Re(Ue);void 0===Oe[Le]&&(Oe[Le]=[]),Oe[Le].push(Ue)}return Oe}(qe,r)),Jt=window.devicePixelRatio,_i=navigator.connection||navigator.mozConnection||navigator.webkitConnection,xi=_i?_i.effectiveType:void 0,vi={counters:[],metadata:[],attributes:[]},d=(Le,Re,Oe)=>{null!=Oe&&Le.push({name:Re,value:Oe.toString()})};for(const Le in Ot)d(vi.counters,Le,Ot[Le]);if(Ue.interactionRange[0]!==1/0&&Ue.interactionRange[1]!==-1/0&&(d(vi.counters,"interactionRangeMin",Ue.interactionRange[0]),d(vi.counters,"interactionRangeMax",Ue.interactionRange[1])),Ct)for(const Le of Object.keys(Oe)){const Re=Oe[Le],Ue=Ct.find((Le=>Le.name===Re));Ue&&d(vi.counters,Re,Ue.startTime)}return d(vi.counters,"visibilityHidden",Ue.visibilityHidden),d(vi.attributes,"style",function(Re){if(Re)for(const Oe of Re){const Re=Oe.name.split("?")[0];if(Le.i(Re)){const Le=Re.split("/").slice(-2);if(2===Le.length)return`mapbox://styles/${Le[0]}/${Le[1]}`}}}(qe)),d(vi.attributes,"terrainEnabled",Ue.terrainEnabled?"true":"false"),d(vi.attributes,"fogEnabled",Ue.fogEnabled?"true":"false"),d(vi.attributes,"projection",Ue.projection),d(vi.attributes,"zoom",Ue.zoom),d(vi.metadata,"devicePixelRatio",Jt),d(vi.metadata,"connectionEffectiveType",xi),d(vi.metadata,"navigatorUserAgent",navigator.userAgent),d(vi.metadata,"screenWidth",window.screen.width),d(vi.metadata,"screenHeight",window.screen.height),d(vi.metadata,"windowWidth",window.innerWidth),d(vi.metadata,"windowHeight",window.innerHeight),d(vi.metadata,"mapWidth",Ue.width/Jt),d(vi.metadata,"mapHeight",Ue.height/Jt),d(vi.metadata,"webglRenderer",Ue.renderer),d(vi.metadata,"webglVendor",Ue.vendor),d(vi.metadata,"sdkVersion",Re),d(vi.metadata,"sdkIdentifier","mapbox-gl-js"),vi}(Ct);for(const Le of Ot.metadata);for(const Le of Ot.counters);for(const Le of Ot.attributes);this.postEvent(qe,Ot,(()=>{}),Ue)}},Xn=$n.postPerformanceEvent.bind($n),Yn=new class extends R{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(Re,Oe,Ue,qe){if(!Le.e.API_URL||!Le.e.SESSION_PATH)return;const Ct=C(Le.e.API_URL+Le.e.SESSION_PATH);Ct.params.push(`sku=${Oe||""}`),Ct.params.push(`access_token=${qe||Le.e.ACCESS_TOKEN||""}`);const Ot={url:S(Ct),headers:{"Content-Type":"text/plain"}};this.pendingRequest=Le.g(Ot,(Le=>{this.pendingRequest=null,Ue(Le),this.saveEventData(),this.processRequests(qe)}))}getSessionAPI(Re,Oe,Ue,qe){this.skuToken=Oe,this.errorCb=qe,Le.e.SESSION_PATH&&Le.e.API_URL&&(Ue||Le.e.ACCESS_TOKEN?this.queueRequest({id:Re,timestamp:Date.now()},Ue):this.errorCb(new Error(bi)))}processRequests(Le){if(this.pendingRequest||0===this.queue.length)return;const{id:Re,timestamp:Oe}=this.queue.shift();
1Re&&this.success[Re]||this.getSession(Oe,this.skuToken,(Le=>{Le?this.errorCb(Le):Re&&(this.success[Re]=!0)}),Le)}remove(){this.errorCb=null}},lo=Yn.getSessionAPI.bind(Yn),uo=new Set;function G(Le,Re){Re?uo.add(Le):uo.delete(Le)}class j{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(Le,Re){this._updatedSourceCaches[Le]=Re,this.setDirty()}discardSourceCacheUpdate(Le){delete this._updatedSourceCaches[Le]}updateLayer(Le){const Re=Le.scope;this._updatedLayers[Re]=this._updatedLayers[Re]||new Set,this._updatedLayers[Re].add(Le.id),this.setDirty()}removeLayer(Le){const Re=Le.scope;this._removedLayers[Re]=this._removedLayers[Re]||{},this._updatedLayers[Re]=this._updatedLayers[Re]||new Set,this._removedLayers[Re][Le.id]=Le,this._updatedLayers[Re].delete(Le.id),this._updatedPaintProps.delete(Le.fqid),this.setDirty()}getRemovedLayer(Le){return this._removedLayers[Le.scope]?this._removedLayers[Le.scope][Le.id]:null}discardLayerRemoval(Le){this._removedLayers[Le.scope]&&delete this._removedLayers[Le.scope][Le.id]}getLayerUpdatesByScope(){const Le={};for(const Re in this._updatedLayers)Le[Re]=Le[Re]||{},Le[Re].updatedIds=Array.from(this._updatedLayers[Re].values());for(const Re in this._removedLayers)Le[Re]=Le[Re]||{},Le[Re].removedIds=Object.keys(this._removedLayers[Re]);return Le}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(Le){this._updatedPaintProps.add(Le.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(Le){this._updatedImages.add(Le),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}function V(Le){const{userImage:Re}=Le;return!!(Re&&Re.render&&Re.render())&&(Le.data.replace(new Uint8Array(Re.data.buffer)),!0)}class q extends Le.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(Re){this.images[Re]={},this.loaded[Re]=!1,this.updatedImages[Re]={},this.patterns[Re]={},this.callbackDispatchedThisFrame[Re]={},this.atlasImage[Re]=new Le.r({width:1,height:1})}isLoaded(){for(const Le in this.loaded)if(!this.loaded[Le])return!1;return!0}setLoaded(Le,Re){if(this.loaded[Re]!==Le&&(this.loaded[Re]=Le,Le)){for(const{ids:Le,callback:Oe}of this.requestors)this._notify(Le,Re,Oe);this.requestors=[]}}hasImage(Le,Re){return!!this.getImage(Le,Re)}getImage(Le,Re){return this.images[Re][Le]}addImage(Le,Re,Oe){this._validate(Le,Oe)&&(this.images[Re][Le]=Oe)}_validate(Re,Oe){let Ue=!0;return this._validateStretch(Oe.stretchX,Oe.data&&Oe.data.width)||(this.fire(new Le.t(new Error(`Image "${Re}" has invalid "stretchX" value`))),Ue=!1),this._validateStretch(Oe.stretchY,Oe.data&&Oe.data.height)||(this.fire(new Le.t(new Error(`Image "${Re}" has invalid "stretchY" value`))),Ue=!1),this._validateContent(Oe.content,Oe)||(this.fire(new Le.t(new Error(`Image "${Re}" has invalid "content" value`))),Ue=!1),Ue}_validateStretch(Le,Re){if(!Le)return!0;let Oe=0;for(const Ue of Le){if(Ue[0]<Oe||Ue[1]<Ue[0]||Re<Ue[1])return!1;Oe=Ue[1]}return!0}_validateContent(Le,Re){return!(Le&&(4!==Le.length||Le[0]<0||Re.data.width<Le[0]||Le[1]<0||Re.data.height<Le[1]||Le[2]<0||Re.data.width<Le[2]||Le[3]<0||Re.data.height<Le[3]||Le[2]<Le[0]||Le[3]<Le[1]))}updateImage(Le,Re,Oe){Oe.version=this.images[Re][Le].version+1,this.images[Re][Le]=Oe,this.updatedImages[Re][Le]=!0}removeImage(Le,Re){const Oe=this.images[Re][Le];delete this.images[Re][Le],delete this.patterns[Re][Le],Oe.userImage&&Oe.userImage.onRemove&&Oe.userImage.onRemove()}listImages(Le){return Object.keys(this.images[Le])}getImages(Le,Re,Oe){let Ue=!0;const qe=!!this.loaded[Re];if(!qe)for(const Oe of Le)this.images[Re][Oe]||(Ue=!1);qe||Ue?this._notify(Le,Re,Oe):this.requestors.push({ids:Le,scope:Re,callback:Oe})}getUpdatedImages(Le){return this.updatedImages[Le]}_notify(Re,Oe,Ue){const qe={};for(const Ue of Re){this.images[Oe][Ue]||this.fire(new Le.x("styleimagemissing",{id:Ue}));const Re=this.images[Oe][Ue];Re?qe[Ue]={data:Re.data.clone(),pixelRatio:Re.pixelRatio,sdf:Re.sdf,version:Re.version,stretchX:Re.stretchX,stretchY:Re.stretchY,content:Re.content,hasRenderCallback:Boolean(Re.userImage&&Re.userImage.render)}:Le.w(`Image "${Ue}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}Ue(null,qe)}getPixelSize(Le){const{width:Re,height:Oe}=this.atlasImage[Le];return{width:Re,height:Oe}}getPattern(Re,Oe,Ue){const qe=this.patterns[Oe][Re],Ct=this.getImage(Re,Oe);if(!Ct)return null;if(qe&&qe.position.version===Ct.version)return qe.position;if(qe)qe.position.version=Ct.version;
1else{const Ue={w:Ct.data.width+2*Le.y,h:Ct.data.height+2*Le.y,x:0,y:0},qe=new Le.I(Ue,Ct,Le.y);this.patterns[Oe][Re]={bin:Ue,position:qe}}return this._updatePatternAtlas(Oe,Ue),this.patterns[Oe][Re].position}bind(Re,Oe){const Ue=Re.gl;let qe=this.atlasTexture[Oe];qe?this.dirty&&(qe.update(this.atlasImage[Oe]),this.dirty=!1):(qe=new Le.T(Re,this.atlasImage[Oe],Ue.RGBA8),this.atlasTexture[Oe]=qe),qe.bind(Ue.LINEAR,Ue.CLAMP_TO_EDGE)}_updatePatternAtlas(Re,Oe){const Ue=[];for(const Le in this.patterns[Re])Ue.push(this.patterns[Re][Le].bin);const{w:qe,h:Ct}=Le.z(Ue),Ot=this.atlasImage[Re];Ot.resize({width:qe||1,height:Ct||1});for(const Ue in this.patterns[Re]){const{bin:qe,position:Ct}=this.patterns[Re][Ue];let Jt=Ct.padding;const _i=qe.x+Jt,xi=qe.y+Jt,vi=this.images[Re][Ue].data,bi=vi.width,Pi=vi.height;Jt=Jt>1?Jt-1:Jt,Le.r.copy(vi,Ot,{x:0,y:0},{x:_i,y:xi},{width:bi,height:Pi},Oe),Le.r.copy(vi,Ot,{x:0,y:Pi-Jt},{x:_i,y:xi-Jt},{width:bi,height:Jt},Oe),Le.r.copy(vi,Ot,{x:0,y:0},{x:_i,y:xi+Pi},{width:bi,height:Jt},Oe),Le.r.copy(vi,Ot,{x:bi-Jt,y:0},{x:_i-Jt,y:xi},{width:Jt,height:Pi},Oe),Le.r.copy(vi,Ot,{x:0,y:0},{x:_i+bi,y:xi},{width:Jt,height:Pi},Oe),Le.r.copy(vi,Ot,{x:bi-Jt,y:Pi-Jt},{x:_i-Jt,y:xi-Jt},{width:Jt,height:Jt},Oe),Le.r.copy(vi,Ot,{x:0,y:Pi-Jt},{x:_i+bi,y:xi-Jt},{width:Jt,height:Jt},Oe),Le.r.copy(vi,Ot,{x:0,y:0},{x:_i+bi,y:xi+Pi},{width:Jt,height:Jt},Oe),Le.r.copy(vi,Ot,{x:bi-Jt,y:0},{x:_i-Jt,y:xi+Pi},{width:Jt,height:Jt},Oe)}this.dirty=!0}beginFrame(){for(const Le in this.images)this.callbackDispatchedThisFrame[Le]={}}dispatchRenderCallbacks(Le,Re){for(const Oe of Le){if(this.callbackDispatchedThisFrame[Re][Oe])continue;this.callbackDispatchedThisFrame[Re][Oe]=!0;const Le=this.images[Re][Oe];V(Le)&&this.updateImage(Oe,Re,Le)}}}function Z(Re){const Oe=Re.key,Ue=Re.value,qe=Re.valueSpec||{},Ct=Re.objectElementValidators||{},Ot=Re.style,Jt=Re.styleSpec;let _i=[];const xi=Le.B(Ue);if("object"!==xi)return[new Le.V(Oe,Ue,`object expected, ${xi} found`)];for(const Re in Ue){const xi=Re.split(".")[0];let vi;Ct[xi]?vi=Ct[xi]:qe[xi]?vi=_e:Ct["*"]?vi=Ct["*"]:qe["*"]&&(vi=_e),vi?_i=_i.concat(vi({key:(Oe?`${Oe}.`:Oe)+Re,value:Ue[Re],valueSpec:qe[xi]||qe["*"],style:Ot,styleSpec:Jt,object:Ue,objectKey:Re},Ue)):_i.push(new Le.A(Oe,Ue[Re],`unknown property "${Re}"`))}for(const Re in qe)Ct[Re]||qe[Re].required&&void 0===qe[Re].default&&void 0===Ue[Re]&&_i.push(new Le.V(Oe,Ue,`missing required property "${Re}"`));return _i}function H(Re){const Oe=Re.value,Ue=Re.valueSpec,qe=Re.style,Ct=Re.styleSpec,Ot=Re.key,Jt=Re.arrayElementValidator||_e;if("array"!==Le.B(Oe))return[new Le.V(Ot,Oe,`array expected, ${Le.B(Oe)} found`)];if(Ue.length&&Oe.length!==Ue.length)return[new Le.V(Ot,Oe,`array length ${Ue.length} expected, length ${Oe.length} found`)];if(Ue["min-length"]&&Oe.length<Ue["min-length"])return[new Le.V(Ot,Oe,`array length at least ${Ue["min-length"]} expected, length ${Oe.length} found`)];let _i={type:Ue.value,values:Ue.values,minimum:Ue.minimum,maximum:Ue.maximum,function:void 0};Ct.$version<7&&(_i.function=Ue.function),"object"===Le.B(Ue.value)&&(_i=Ue.value);let xi=[];for(let Le=0;Le<Oe.length;Le++)xi=xi.concat(Jt({array:Oe,arrayIndex:Le,value:Oe[Le],valueSpec:_i,style:qe,styleSpec:Ct,key:`${Ot}[${Le}]`},!0));return xi}function W(Re){const Oe=Re.key,Ue=Re.value,qe=Re.valueSpec;let Ct=Le.B(Ue);if("number"===Ct&&Ue!=Ue&&(Ct="NaN"),"number"!==Ct)return[new Le.V(Oe,Ue,`number expected, ${Ct} found`)];if("minimum"in qe){let Ct=qe.minimum;if("array"===Le.B(qe.minimum)&&(Ct=qe.minimum[Re.arrayIndex]),Ue<Ct)return[new Le.V(Oe,Ue,`${Ue} is less than the minimum value ${Ct}`)]}if("maximum"in qe){let Ct=qe.maximum;if("array"===Le.B(qe.maximum)&&(Ct=qe.maximum[Re.arrayIndex]),Ue>Ct)return[new Le.V(Oe,Ue,`${Ue} is greater than the maximum value ${Ct}`)]}return[]}function $(Re){const Oe=Re.valueSpec,Ue=Le.D(Re.value.type);let qe,Ct,Ot,Jt={};const _i="categorical"!==Ue&&void 0===Re.value.property,xi=!_i,vi="array"===Le.B(Re.value.stops)&&"array"===Le.B(Re.value.stops[0])&&"object"===Le.B(Re.value.stops[0][0]),bi=Z({key:Re.key,value:Re.value,valueSpec:Re.styleSpec.function,style:Re.style,styleSpec:Re.styleSpec,objectElementValidators:{stops:function(Re){if("identity"===Ue)return[new Le.V(Re.key,Re.value,'identity function may not have a "stops" property')];let Oe=[];const qe=Re.value;return Oe=Oe.concat(H({key:Re.key,value:qe,valueSpec:Re.valueSpec,style:Re.style,styleSpec:Re.styleSpec,arrayElementValidator:d})),"array"===Le.B(qe)&&0===qe.length&&Oe.push(new Le.V(Re.key,qe,"array must have at least one stop")),Oe},default:function(Le){return _e({key:Le.key,value:Le.value,valueSpec:Oe,style:Le.style,styleSpec:Le.styleSpec})}}});return"identity"===Ue&&_i&&bi.push(new Le.V(Re.key,Re.value,'missing required property "property"')),"identity"===Ue||Re.value.stops||bi.push(new Le.V(Re.key,Re.value,'missing required property "stops"')),"exponential"===Ue&&Re.valueSpec.expression&&!Le.F(Re.valueSpec)&&bi.push(new Le.V(Re.key,Re.value,"exponential functions not supported")),Re.styleSpec.$version>=8&&(xi&&!Le.G(Re.valueSpec)?bi.push(new Le.V(Re.key,Re.value,"property functions not supported")):_i&&!Le.H(Re.valueSpec)&&bi.push(new Le.V(Re.key,Re.value,"zoom functions not supported"))),"categorical"!==Ue&&!vi||void 0!==Re.value.property||bi.push(new Le.V(Re.key,Re.value,'"property" property is required')),bi;function d(Re){let Ue=[];const qe=Re.value,_i=Re.key;if("array"!==Le.B(qe))return[new Le.V(_i,qe,`array expected, ${Le.B(qe)} found`)];if(2!==qe.length)return[new Le.V(_i,qe,`array length 2 expected, length ${qe.length} found`)];if(vi){if("object"!==Le.B(qe[0]))return[new Le.V(_i,qe,`object expected, ${Le.B(qe[0])} found`)];if(void 0===qe[0].zoom)return[new Le.V(_i,qe,"object stop key must have zoom")];if(void 0===qe[0].value)return[new Le.V(_i,qe,"object stop key must have value")];const Oe=Le.D(qe[0].zoom);if("number"!=typeof Oe)return[new Le.V(_i,qe[0].zoom,"stop zoom values must be numbers")];if(Ot&&Ot>Oe)return[new Le.V(_i,qe[0].zoom,"stop zoom values must appear in ascending order")];Oe!==Ot&&(Ot=Oe,Ct=void 0,Jt={}),Ue=Ue.concat(Z({key:`${_i}[0]`,value:qe[0],valueSpec:{zoom:{}},style:Re.style,styleSpec:Re.styleSpec,objectElementValidators:{zoom:W,value:_}}))}else Ue=Ue.concat(_({key:`${_i}[0]`,value:qe[0],valueSpec:{},style:Re.style,styleSpec:Re.styleSpec},qe));return Le.J(Le.K(qe[1]))?Ue.concat([new Le.V(`${_i}[1]`,qe[1],"expressions are not allowed in function stops.")]):Ue.concat(_e({key:`${_i}[1]`,value:qe[1],valueSpec:Oe,style:Re.style,styleSpec:Re.styleSpec}))}function _(Re,Ot){const _i=Le.B(Re.value),xi=Le.D(Re.value),vi=null!==Re.value?Re.value:Ot;if(qe){if(_i!==qe)return[new Le.V(Re.key,vi,`${_i} stop domain type must match previous stop domain type ${qe}`)]}else qe=_i;if("number"!==_i&&"string"!==_i&&"boolean"!==_i&&"number"!=typeof xi&&"string"!=typeof xi&&"boolean"!=typeof xi)return[new Le.V(Re.key,vi,"stop domain value must be a number, string, or boolean")];if("number"!==_i&&"categorical"!==Ue){let qe=`number expected, ${_i} found`;return Le.G(Oe)&&void 0===Ue&&(qe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Le.V(Re.key,vi,qe)]}return"categorical"!==Ue||"number"!==_i||"number"==typeof xi&&isFinite(xi)&&Math.floor(xi)===xi?"categorical"!==Ue&&"number"===_i&&"number"==typeof xi&&"number"==typeof Ct&&void 0!==Ct&&xi<Ct?[new Le.V(Re.key,vi,"stop domain values must appear in ascending order")]:(Ct=xi,"categorical"===Ue&&xi in Jt?[new Le.V(Re.key,vi,"stop domain values must be unique")]:(Jt[xi]=!0,[])):[new Le.V(Re.key,vi,`integer expected, found ${String(xi)}`)]}}function X(Re){const Oe=("property"===Re.expressionContext?Le.L:Le.M)(Le.K(Re.value),Re.valueSpec);if("error"===Oe.result)return Oe.value.map((Oe=>new Le.V(`${Re.key}${Oe.key}`,Re.value,Oe.message)));const Ue=Oe.value.expression||Oe.value._styleExpression.expression;if("property"===Re.expressionContext&&"text-font"===Re.propertyKey&&!Ue.outputDefined())return[new Le.V(Re.key,Re.value,`Invalid data expression for "${Re.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===Re.expressionContext&&"layout"===Re.propertyType&&!Le.N(Ue))return[new Le.V(Re.key,Re.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===Re.expressionContext)return Y(Ue,Re);if(Re.expressionContext&&0===Re.expressionContext.indexOf("cluster")){if(!Le.O(Ue,["zoom","feature-state"]))return[new Le.V(Re.key,Re.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===Re.expressionContext&&!Le.Q(Ue))return[new Le.V(Re.key,Re.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Y(Re,Oe){const Ue=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(Oe.valueSpec&&Oe.valueSpec.expression)for(const Le of Oe.valueSpec.expression.parameters)Ue.delete(Le);if(0===Ue.size)return[];const qe=[];return Re instanceof Le.S&&Ue.has(Re.name)?[new Le.V(Oe.key,Oe.value,`["${Re.name}"] expression is not supported in a filter for a ${Oe.object.type}
1 layer with id: ${Oe.object.id}`)]:(Re.eachChild((Le=>{qe.push(...Y(Le,Oe))})),qe)}function K(Re){const Oe=Re.key,Ue=Re.value,qe=Re.valueSpec,Ct=[];return Array.isArray(qe.values)?-1===qe.values.indexOf(Le.D(Ue))&&Ct.push(new Le.V(Oe,Ue,`expected one of [${qe.values.join(", ")}], ${JSON.stringify(Ue)} found`)):-1===Object.keys(qe.values).indexOf(Le.D(Ue))&&Ct.push(new Le.V(Oe,Ue,`expected one of [${Object.keys(qe.values).join(", ")}], ${JSON.stringify(Ue)} found`)),Ct}function J(Re){return Le.W(Le.K(Re.value))?X(Le.C({},Re,{expressionContext:"filter",valueSpec:Re.styleSpec[`filter_${Re.layerType||"fill"}`]})):Q(Re)}function Q(Re){const Oe=Re.value,Ue=Re.key;if("array"!==Le.B(Oe))return[new Le.V(Ue,Oe,`array expected, ${Le.B(Oe)} found`)];const qe=Re.styleSpec;let Ct,Ot=[];if(Oe.length<1)return[new Le.V(Ue,Oe,"filter array must have at least 1 element")];switch(Ot=Ot.concat(K({key:`${Ue}[0]`,value:Oe[0],valueSpec:qe.filter_operator,style:Re.style,styleSpec:Re.styleSpec})),Le.D(Oe[0])){case"<":case"<=":case">":case">=":Oe.length>=2&&"$type"===Le.D(Oe[1])&&Ot.push(new Le.V(Ue,Oe,`"$type" cannot be use with operator "${Oe[0]}"`));case"==":case"!=":3!==Oe.length&&Ot.push(new Le.V(Ue,Oe,`filter array for operator "${Oe[0]}" must have 3 elements`));case"in":case"!in":Oe.length>=2&&(Ct=Le.B(Oe[1]),"string"!==Ct&&Ot.push(new Le.V(`${Ue}[1]`,Oe[1],`string expected, ${Ct} found`)));for(let Jt=2;Jt<Oe.length;Jt++)Ct=Le.B(Oe[Jt]),"$type"===Le.D(Oe[1])?Ot=Ot.concat(K({key:`${Ue}[${Jt}]`,value:Oe[Jt],valueSpec:qe.geometry_type,style:Re.style,styleSpec:Re.styleSpec})):"string"!==Ct&&"number"!==Ct&&"boolean"!==Ct&&Ot.push(new Le.V(`${Ue}[${Jt}]`,Oe[Jt],`string, number, or boolean expected, ${Ct} found`));break;case"any":case"all":case"none":for(let Le=1;Le<Oe.length;Le++)Ot=Ot.concat(Q({key:`${Ue}[${Le}]`,value:Oe[Le],style:Re.style,styleSpec:Re.styleSpec}));break;case"has":case"!has":Ct=Le.B(Oe[1]),2!==Oe.length?Ot.push(new Le.V(Ue,Oe,`filter array for "${Oe[0]}" operator must have 2 elements`)):"string"!==Ct&&Ot.push(new Le.V(`${Ue}[1]`,Oe[1],`string expected, ${Ct} found`))}return Ot}function ee(Re,Oe){const Ue=Re.key,qe=Re.style,Ct=Re.layer,Ot=Re.styleSpec,Jt=Re.value,_i=Re.objectKey,xi=Ot[`${Oe}_${Re.layerType}`];if(!xi)return[];const vi=_i.match(/^(.*)-transition$/);if("paint"===Oe&&vi&&xi[vi[1]]&&xi[vi[1]].transition)return _e({key:Ue,value:Jt,valueSpec:Ot.transition,style:qe,styleSpec:Ot});const bi=Re.valueSpec||xi[_i];if(!bi)return[new Le.A(Ue,Jt,`unknown property "${_i}"`)];let Pi;if("string"===Le.B(Jt)&&Le.G(bi)&&!bi.tokens&&(Pi=/^{([^}]+)}$/.exec(Jt))){const Re=`\`{ "type": "identity", "property": ${Pi?JSON.stringify(Pi[1]):'"_"'} }\``;return[new Le.V(Ue,Jt,`"${_i}" does not support interpolation syntax\nUse an identity property function instead: ${Re}.`)]}const Hr=[];if("symbol"===Re.layerType)"text-field"!==_i||!qe||qe.glyphs||qe.imports||Hr.push(new Le.V(Ue,Jt,'use of "text-field" requires a style "glyphs" property')),"text-font"===_i&&Le.X(Le.K(Jt))&&"identity"===Le.D(Jt.type)&&Hr.push(new Le.V(Ue,Jt,'"text-font" does not support identity functions'));else if("model"===Re.layerType&&"paint"===Oe&&Ct&&Ct.layout&&Ct.layout.hasOwnProperty("model-id")&&Le.G(bi)&&(Le.Y(bi)||Le.H(bi))){const Re=Le.L(Le.K(Jt),bi),Oe=Re.value.expression||Re.value._styleExpression.expression;Oe&&!Le.O(Oe,["measure-light"])&&("model-emissive-strength"===_i&&Le.Q(Oe)&&Le.N(Oe)||Hr.push(new Le.V(Ue,Jt,`${_i} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return Hr.concat(_e({key:Re.key,value:Jt,valueSpec:bi,style:qe,styleSpec:Ot,expressionContext:"property",propertyType:Oe,propertyKey:_i}))}function te(Le){return ee(Le,"paint")}function ie(Le){return ee(Le,"layout")}function oe(Re){let Oe=[];const Ue=Re.value,qe=Re.key,Ct=Re.style,Ot=Re.styleSpec;Ue.type||Ue.ref||Oe.push(new Le.V(qe,Ue,'either "type" or "ref" is required'));let Jt=Le.D(Ue.type);const _i=Le.D(Ue.ref);if(Ue.id){const Ot=Le.D(Ue.id);for(let Jt=0;Jt<Re.arrayIndex;Jt++){const Re=Ct.layers[Jt];Le.D(Re.id)===Ot&&Oe.push(new Le.V(qe,Ue.id,`duplicate layer id "${Ue.id}", previously used at line ${Re.id.__line__}`))}}if("ref"in Ue){let Re;["type","source","source-layer","filter","layout"].forEach((Re=>{Re in Ue&&Oe.push(new Le.V(qe,Ue[Re],`"${Re}" is prohibited for ref layers`))}
1)),Ct.layers.forEach((Oe=>{Le.D(Oe.id)===_i&&(Re=Oe)})),Re?Re.ref?Oe.push(new Le.V(qe,Ue.ref,"ref cannot reference another ref layer")):Jt=Le.D(Re.type):"string"==typeof _i&&Oe.push(new Le.V(qe,Ue.ref,`ref layer "${_i}" not found`))}else if("background"!==Jt&&"sky"!==Jt&&"slot"!==Jt)if(Ue.source){const Re=Ct.sources&&Ct.sources[Ue.source],Ot=Re&&Le.D(Re.type);Re?"vector"===Ot&&"raster"===Jt?Oe.push(new Le.V(qe,Ue.source,`layer "${Ue.id}" requires a raster source`)):"raster"===Ot&&"raster"!==Jt?Oe.push(new Le.V(qe,Ue.source,`layer "${Ue.id}" requires a vector source`)):"vector"!==Ot||Ue["source-layer"]?"raster-dem"===Ot&&"hillshade"!==Jt?Oe.push(new Le.V(qe,Ue.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==Ot||["raster","raster-particle"].includes(Jt)?"line"!==Jt||!Ue.paint||!Ue.paint["line-gradient"]&&!Ue.paint["line-trim-offset"]||"geojson"===Ot&&Re.lineMetrics?"raster-particle"===Jt&&"raster-array"!==Ot&&Oe.push(new Le.V(qe,Ue.source,`layer "${Ue.id}" requires a 'raster-array' source.`)):Oe.push(new Le.V(qe,Ue,`layer "${Ue.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):Oe.push(new Le.V(qe,Ue.source,"raster-array source can only be used with layer type 'raster'.")):Oe.push(new Le.V(qe,Ue,`layer "${Ue.id}" must specify a "source-layer"`)):Oe.push(new Le.V(qe,Ue.source,`source "${Ue.source}" not found`))}else Oe.push(new Le.V(qe,Ue,'missing required property "source"'));return Oe=Oe.concat(Z({key:qe,value:Ue,valueSpec:Ot.layer,style:Re.style,styleSpec:Re.styleSpec,objectElementValidators:{"*":()=>[],type:()=>_e({key:`${qe}.type`,value:Ue.type,valueSpec:Ot.layer.type,style:Re.style,styleSpec:Re.styleSpec,object:Ue,objectKey:"type"}),filter:Re=>J(Le.C({layerType:Jt},Re)),layout:Re=>Z({layer:Ue,key:Re.key,value:Re.value,valueSpec:{},style:Re.style,styleSpec:Re.styleSpec,objectElementValidators:{"*":Re=>ie(Le.C({layerType:Jt},Re))}}),paint:Re=>Z({layer:Ue,key:Re.key,value:Re.value,valueSpec:{},style:Re.style,styleSpec:Re.styleSpec,objectElementValidators:{"*":Re=>te(Le.C({layerType:Jt,layer:Ue},Re))}})}})),Oe}function re(Re){const Oe=Re.value,Ue=Re.key,qe=Le.B(Oe);return"string"!==qe?[new Le.V(Ue,Oe,`string expected, ${qe} found`)]:[]}const po={promoteId:function({key:Re,value:Oe}){if("string"===Le.B(Oe))return re({key:Re,value:Oe});{const Le=[];for(const Ue in Oe)Le.push(...re({key:`${Re}.${Ue}`,value:Oe[Ue]}));return Le}}};function ae(Re){const Oe=Re.value,Ue=Re.key,qe=Re.styleSpec,Ct=Re.style;if(!Oe.type)return[new Le.V(Ue,Oe,'"type" is required')];const Ot=Le.D(Oe.type);let Jt=[];switch(["vector","raster","raster-dem","raster-array"].includes(Ot)&&(Oe.url||Oe.tiles||Jt.push(new Le.A(Ue,Oe,'Either "url" or "tiles" is required.'))),Ot){case"vector":case"raster":case"raster-dem":case"raster-array":return Jt=Jt.concat(Z({key:Ue,value:Oe,valueSpec:qe[`source_${Ot.replace("-","_")}`],style:Re.style,styleSpec:qe,objectElementValidators:po})),Jt;case"geojson":if(Jt=Z({key:Ue,value:Oe,valueSpec:qe.source_geojson,style:Ct,styleSpec:qe,objectElementValidators:po}),Oe.cluster)for(const Le in Oe.clusterProperties){const[Re,qe]=Oe.clusterProperties[Le],Ct="string"==typeof Re?[Re,["accumulated"],["get",Le]]:Re;Jt.push(...X({key:`${Ue}.${Le}.map`,value:qe,expressionContext:"cluster-map"})),Jt.push(...X({key:`${Ue}.${Le}.reduce`,value:Ct,expressionContext:"cluster-reduce"}))}return Jt;case"video":return Z({key:Ue,value:Oe,valueSpec:qe.source_video,style:Ct,styleSpec:qe});case"image":return Z({key:Ue,value:Oe,valueSpec:qe.source_image,style:Ct,styleSpec:qe});case"canvas":return[new Le.V(Ue,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return K({key:`${Ue}.type`,value:Oe.type,valueSpec:{values:ne(qe)},style:Ct,styleSpec:qe})}}function ne(Le){return Le.source.reduce(((Re,Oe)=>{const Ue=Le[Oe];return"enum"===Ue.type.type&&(Re=Re.concat(Object.keys(Ue.type.values))),Re}),[])}function le(Re){const Oe=Re.value,Ue=Re.styleSpec,qe=Ue.light,Ct=Re.style;let Ot=[];const Jt=Le.B(Oe);if(void 0===Oe)return Ot;if("object"!==Jt)return Ot=Ot.concat([new Le.V("light",Oe,`object expected, ${Jt} found`)]),Ot;for(const Re in Oe){const Jt=Re.match(/^(.*)-transition$/);Ot=Ot.concat(Jt&&qe[Jt[1]]&&qe[Jt[1]].transition?_e({key:Re,value:Oe[Re],valueSpec:Ue.transition,style:Ct,styleSpec:Ue}):qe[Re]?_e({key:Re,value:Oe[Re],valueSpec:qe[Re],style:Ct,styleSpec:Ue}):[new Le.V(Re,Oe[Re],`unknown property "${Re}"`)])}return Ot}function ce(Re){const Oe=Re.value;let Ue=[];if(!Oe)return Ue;const qe=Le.B(Oe);if("object"!==qe)return Ue=Ue.concat([new Le.V("light-3d",Oe,`object expected, ${qe}
1 found`)]),Ue;const Ct=Re.styleSpec,Ot=Ct["light-3d"],Jt=Re.key,_i=Re.style,xi=Re.style.lights;for(const Re of["type","id"])if(!(Re in Oe))return Ue=Ue.concat([new Le.V("light-3d",Oe,`missing property ${Re} on light`)]),Ue;if(Oe.type&&xi)for(let qe=0;qe<Re.arrayIndex;qe++){const Re=Le.D(Oe.type),Ct=xi[qe];Le.D(Ct.type)===Re&&Ue.push(new Le.V(Jt,Oe.id,`duplicate light type "${Oe.type}", previously defined at line ${Ct.id.__line__}`))}const vi=`properties_light_${Oe.type}`;if(!(vi in Ct))return Ue=Ue.concat([new Le.V("light-3d",Oe,`Invalid light type ${Oe.type}`)]),Ue;const bi=Ct[vi];for(const qe in Oe)if("properties"===qe){const Ot=Oe[qe],Jt=Le.B(Ot);if("object"!==Jt)return Ue=Ue.concat([new Le.V("properties",Ot,`object expected, ${Jt} found`)]),Ue;for(const Oe in Ot)Ue=Ue.concat(bi[Oe]?_e({key:Oe,value:Ot[Oe],valueSpec:bi[Oe],style:_i,styleSpec:Ct}):[new Le.A(Re.key,Ot[Oe],`unknown property "${Oe}"`)])}else{const Re=qe.match(/^(.*)-transition$/);Ue=Ue.concat(Re&&Ot[Re[1]]&&Ot[Re[1]].transition?_e({key:qe,value:Oe[qe],valueSpec:Ct.transition,style:_i,styleSpec:Ct}):Ot[qe]?_e({key:qe,value:Oe[qe],valueSpec:Ot[qe],style:_i,styleSpec:Ct}):[new Le.A(qe,Oe[qe],`unknown property "${qe}"`)])}return Ue}function he(Re){const Oe=Re.value,Ue=Re.key,qe=Re.style,Ct=Re.styleSpec,Ot=Ct.terrain;let Jt=[];const _i=Le.B(Oe);if(void 0===Oe)return Jt;if("null"===_i)return Jt;if("object"!==_i)return Jt=Jt.concat([new Le.V("terrain",Oe,`object expected, ${_i} found`)]),Jt;for(const Re in Oe){const Ue=Re.match(/^(.*)-transition$/);Jt=Jt.concat(Ue&&Ot[Ue[1]]&&Ot[Ue[1]].transition?_e({key:Re,value:Oe[Re],valueSpec:Ct.transition,style:qe,styleSpec:Ct}):Ot[Re]?_e({key:Re,value:Oe[Re],valueSpec:Ot[Re],style:qe,styleSpec:Ct}):[new Le.A(Re,Oe[Re],`unknown property "${Re}"`)])}if(Oe.source){const Re=qe.sources&&qe.sources[Oe.source],Ct=Re&&Le.D(Re.type);Re?"raster-dem"!==Ct&&Jt.push(new Le.V(Ue,Oe.source,`terrain cannot be used with a source of type ${String(Ct)}, it only be used with a "raster-dem" source type`)):Jt.push(new Le.V(Ue,Oe.source,`source "${Oe.source}" not found`))}else Jt.push(new Le.V(Ue,Oe,'terrain is missing required property "source"'));return Jt}function ue(Re){const Oe=Re.value,Ue=Re.style,qe=Re.styleSpec,Ct=qe.fog;let Ot=[];const Jt=Le.B(Oe);if(void 0===Oe)return Ot;if("object"!==Jt)return Ot=Ot.concat([new Le.V("fog",Oe,`object expected, ${Jt} found`)]),Ot;for(const Re in Oe){const Jt=Re.match(/^(.*)-transition$/);Ot=Ot.concat(Jt&&Ct[Jt[1]]&&Ct[Jt[1]].transition?_e({key:Re,value:Oe[Re],valueSpec:qe.transition,style:Ue,styleSpec:qe}):Ct[Re]?_e({key:Re,value:Oe[Re],valueSpec:Ct[Re],style:Ue,styleSpec:qe}):[new Le.A(Re,Oe[Re],`unknown property "${Re}"`)])}return Ot}const fo={"*":()=>[],array:H,boolean:function(Re){const Oe=Re.value,Ue=Re.key,qe=Le.B(Oe);return"boolean"!==qe?[new Le.V(Ue,Oe,`boolean expected, ${qe} found`)]:[]},number:W,color:function(Re){const Oe=Re.key,Ue=Re.value,qe=Le.B(Ue);return"string"!==qe?[new Le.V(Oe,Ue,`color expected, ${qe} found`)]:null===Le.U.parseCSSColor(Ue)?[new Le.V(Oe,Ue,`color expected, "${Ue}" found`)]:[]},enum:K,filter:J,function:$,layer:oe,object:Z,source:ae,model:Le.Z,light:le,"light-3d":ce,terrain:he,fog:ue,string:re,formatted:function(Le){return 0===re(Le).length?[]:X(Le)},resolvedImage:function(Le){return 0===re(Le).length?[]:X(Le)},projection:function(Re){const Oe=Re.value,Ue=Re.styleSpec,qe=Ue.projection,Ct=Re.style;let Ot=[];const Jt=Le.B(Oe);if("object"===Jt)for(const Le in Oe)Ot=Ot.concat(_e({key:Le,value:Oe[Le],valueSpec:qe[Le],style:Ct,styleSpec:Ue}));else"string"!==Jt&&(Ot=Ot.concat([new Le.V("projection",Oe,`object or string expected, ${Jt} found`)]));return Ot},import:function(Re){const{value:Oe,styleSpec:Ue}=Re,{data:qe,...Ct}=Oe;Object.defineProperty(Ct,"__line__",{value:Oe.__line__,enumerable:!1});let Ot=Z(Le.C({},Re,{value:Ct,valueSpec:Ue.import}));return""===Le.D(Ct.id)&&Ot.push(new Le.V(`${Re.key}.id`,Ct,"import id can't be an empty string")),qe&&(Ot=Ot.concat(me(qe,Ue,{key:`${Re.key}.data`}))),Ot}};function _e(Re,Oe=!1){const Ue=Re.value,qe=Re.valueSpec,Ct=Re.styleSpec;if(qe.expression&&Le.X(Le.D(Ue)))return $(Re);if(qe.expression&&Le.J(Le.K(Ue)))return X(Re);if(qe.type&&fo[qe.type]){const Ue=fo[qe.type](Re);return!0===Oe&&Ue.length>0&&"array"===Le.B(Re.value)?X(Re):Ue}return Z(Le.C({},Re,{valueSpec:qe.type?Ct[qe.type]:qe}))}function pe(Re){const Oe=Re.value,Ue=Re.key,qe=re(Re);return qe.length||(-1===Oe.indexOf("{fontstack}")&&qe.push(new Le.V(Ue,Oe,'"glyphs" url must include a "{fontstack}" token')),-1===Oe.indexOf("{range}")&&qe.push(new Le.V(Ue,Oe,'"glyphs" url must include a "{range}" token'))),qe}function me(Re,Oe=Le._,Ue={}
1){return _e({key:Ue.key||"",value:Re,valueSpec:Oe.$root,styleSpec:Oe,style:Re,objectElementValidators:{glyphs:pe,"*":()=>[]}})}function fe(Re,Oe=Le._){return Ie(me(Re,Oe))}const ge=Le=>Ie(ae(Le)),ve=Le=>Ie(le(Le)),xe=Le=>Ie(ce(Le)),ye=Le=>Ie(he(Le)),be=Le=>Ie(ue(Le)),we=Le=>Ie(oe(Le)),Te=Le=>Ie(J(Le)),Ee=Le=>Ie(te(Le)),Ce=Le=>Ie(ie(Le)),Se=Re=>Ie(Le.Z(Re));function Ie(Le){return Le.slice().sort(((Le,Re)=>Le.line&&Re.line?Le.line-Re.line:0))}function De(Re,Oe){let Ue=!1;if(Oe&&Oe.length)for(const qe of Oe)qe instanceof Le.A?Le.w(qe.message):(Re.fire(new Le.t(new Error(qe.message))),Ue=!0);return Ue}let Io;class Ae extends Le.E{constructor(Re,Oe="flat"){super(),this._transitionable=new Le.$(Io||(Io=new Le.a0({anchor:new Le.a1(Le._.light.anchor),position:new Le.a2(Le._.light.position),color:new Le.a1(Le._.light.color),intensity:new Le.a1(Le._.light.intensity)}))),this.setLight(Re,Oe),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(Le,Re,Oe={}){this._validate(ve,Le,Oe)||(this._transitionable.setTransitionOrValue(Le),this.id=Re)}updateTransitions(Le){this._transitioning=this._transitionable.transitioned(Le,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(Le){this.properties=this._transitioning.possiblyEvaluate(Le)}_validate(Re,Oe,Ue){return(!Ue||!1!==Ue.validate)&&De(this,Re.call(fe,Le.l({value:Oe,style:{glyphs:!0,sprite:!0},styleSpec:Le._})))}}const is=new Le.a0({source:new Le.a1(Le._.terrain.source),exaggeration:new Le.a1(Le._.terrain.exaggeration)});let as=class extends Le.E{constructor(Re,Oe,Ue,qe){super(),this.scope=Ue,this._transitionable=new Le.$(is,Ue,qe),this._transitionable.setTransitionOrValue(Re,qe),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=Oe}get(){return this._transitionable.serialize()}set(Le,Re){this._transitionable.setTransitionOrValue(Le,Re)}updateTransitions(Le){this._transitioning=this._transitionable.transitioned(Le,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(Le){this.properties=this._transitioning.possiblyEvaluate(Le)}getExaggeration(Re){return this._transitioning.possiblyEvaluate(new Le.a3(Re)).get("exaggeration")}isZoomDependent(){const Re=this._transitionable._values.exaggeration;return null!=Re&&null!=Re.value&&null!=Re.value.expression&&Re.value.expression instanceof Le.a4}};const Is=45,Xs=65,ta=.05;function Fe(Re,Oe,Ue,qe){const Ct=Le.a7(Is,Xs,Ue),[Ot,Jt]=ke(Re,qe);let _i=1-Math.min(1,Math.exp((Oe-Ot)/(Jt-Ot)*-6));return _i*=_i*_i,_i=Math.min(1,1.00747*_i),_i*Ct*Re.alpha}function ke(Le,Re){const Oe=.5/Math.tan(.5*Re);return[Le.range[0]+Oe,Le.range[1]+Oe]}function Be(Re,Oe,Ue,qe,Ct){const Ot=Le.a6.vec3.transformMat4([],[Oe,Ue,qe],Ct.mercatorFogMatrix);return Fe(Re,Le.a6.vec3.length(Ot),Ct.pitch,Ct._fov)}function Ne(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=[[Ue,qe,0],[Ct,qe,0],[Ct,Ot,0],[Ue,Ot,0]];let xi=Number.MAX_VALUE,vi=-Number.MAX_VALUE;for(const Re of _i){const Ue=Le.a6.vec3.transformMat4([],Re,Oe),qe=Le.a6.vec3.length(Ue);xi=Math.min(xi,qe),vi=Math.max(vi,qe)}return[Fe(Re,xi,Jt.pitch,Jt._fov),Fe(Re,vi,Jt.pitch,Jt._fov)]}const ha=new Le.a0({range:new Le.a1(Le._.fog.range),color:new Le.a1(Le._.fog.color),"high-color":new Le.a1(Le._.fog["high-color"]),"space-color":new Le.a1(Le._.fog["space-color"]),"horizon-blend":new Le.a1(Le._.fog["horizon-blend"]),"star-intensity":new Le.a1(Le._.fog["star-intensity"]),"vertical-range":new Le.a1(Le._.fog["vertical-range"])});class Ge extends Le.E{constructor(Re,Oe,Ue,qe){super(),this._transitionable=new Le.$(ha,Ue,new Map(qe)),this.set(Re,qe),this._transitioning=this._transitionable.untransitioned(),this._transform=Oe,this.properties=new Le.a8(ha),this.scope=Ue}get state(){const Re=this._transform,Oe="globe"===Re.projection.name,Ue=Le.a9(Re.zoom),qe=this.properties.get("range"),Ct=[.5,3];return{range:Oe?[Le.aa(Ct[0],qe[0],Ue),Le.aa(Ct[1],qe[1],Ue)]:qe,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(Re,Oe,Ue={}
1){if(this._validate(be,Re,Ue))return;const qe=Le.l({},Re);for(const Re of Object.keys(Le._.fog))void 0===qe[Re]&&(qe[Re]=Le._.fog[Re].default);this._options=qe,this._transitionable.setTransitionOrValue(this._options,Oe)}getOpacity(Re){if(!this._transform.projection.supportsFog)return 0;const Oe=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:Le.a7(Is,Xs,Re))*Oe.a}getOpacityAtLatLng(Re,Oe){return this._transform.projection.supportsFog?function(Re,Oe,Ue){const qe=Le.a5.fromLngLat(Oe),Ct=Ue.elevation?Ue.elevation.getAtPointOrZero(qe):0;return Be(Re,qe.x,qe.y,Ct,Ue)}(this.state,Re,Oe):0}getOpacityForTile(Re){if(!this._transform.projection.supportsFog)return[1,1];const Oe=this._transform.calculateFogTileMatrix(Re.toUnwrapped());return Ne(this.state,Oe,0,0,Le.ab,Le.ab,this._transform)}getOpacityForBounds(Le,Re,Oe,Ue,qe){return this._transform.projection.supportsFog?Ne(this.state,Le,Re,Oe,Ue,qe,this._transform):[1,1]}getFovAdjustedRange(Le){return this._transform.projection.supportsFog?ke(this.state,Le):[0,1]}isVisibleOnFrustum(Re){if(!this._transform.projection.supportsFog)return!1;const Oe=[4,5,6,7];for(const Ue of Oe){const Oe=Re.points[Ue];let qe;if(Oe[2]>=0)qe=Oe;else{const Ct=Re.points[Ue-4];qe=Le.ac(Ct,Oe,Ct[2]/(Ct[2]-Oe[2]))}if(Be(this.state,qe[0],qe[1],0,this._transform)>=ta)return!0}return!1}updateConfig(Le){this._transitionable.setTransitionOrValue(this._options,new Map(Le))}updateTransitions(Le){this._transitioning=this._transitionable.transitioned(Le,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(Le){this.properties=this._transitioning.possiblyEvaluate(Le)}_validate(Re,Oe,Ue){return(!Ue||!1!==Ue.validate)&&De(this,Re.call(fe,Le.l({value:Oe,style:{glyphs:!0,sprite:!0},styleSpec:Le._})))}}class je extends Le.E{constructor(Re,Oe,Ue,qe){super(),this.scope=Ue,this._options=Re,this.properties=new Le.a8(Oe),this._transitionable=new Le.$(Oe,Ue,new Map(qe)),this._transitionable.setTransitionOrValue(Re.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(Le){this._transitionable.setTransitionOrValue(this._options.properties,new Map(Le))}updateTransitions(Le){this._transitioning=this._transitionable.transitioned(Le,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(Le){this.properties=this._transitioning.possiblyEvaluate(Le)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(Le,Re){this._options=Le,this._transitionable.setTransitionOrValue(Le.properties,Re)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let el,tl;class Ze{constructor(Le,Re,Oe,Ue){this.screenBounds=Le,this.cameraPoint=Re,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=Oe,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,Ue)}static createFromScreenPoints(Re,Oe){let Ue,qe;if(Re instanceof Le.P||"number"==typeof Re[0]){const Ct=Le.P.convert(Re);Ue=[Ct],qe=Oe.isPointAboveHorizon(Ct)}else{const Ct=Le.P.convert(Re[0]),Ot=Le.P.convert(Re[1]);Ue=[Ct,Ot],qe=Le.ae(Ct,Ot).every((Le=>Oe.isPointAboveHorizon(Le)))}return new Ze(Ue,Oe.getCameraPoint(),qe,Oe)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(Re){return Le.ae(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],Re)}bufferedCameraGeometry(Re){const Oe=this.screenBounds[0],Ue=1===this.screenBounds.length?this.screenBounds[0].add(new Le.P(1,1)):this.screenBounds[1],qe=Le.ae(Oe,Ue,0,!1);return this.cameraPoint.y>Ue.y&&(this.cameraPoint.x>Oe.x&&this.cameraPoint.x<Ue.x?qe.splice(3,0,this.cameraPoint):this.cameraPoint.x>=Ue.x?qe[2]=this.cameraPoint:this.cameraPoint.x<=Oe.x&&(qe[3]=this.cameraPoint)),Le.af(qe,Re)}bufferedCameraGeometryGlobe(Re){const Oe=this.screenBounds[0],Ue=1===this.screenBounds.length?this.screenBounds[0].add(new Le.P(1,1)):this.screenBounds[1],qe=Le.ae(Oe,Ue,Re),Ct=this.cameraPoint.clone();switch(3*((Ct.y>Oe.y)+(Ct.y>Ue.y))+((Ct.x>Oe.x)+(Ct.x>Ue.x))){case 0:qe[0]=Ct,qe[4]=Ct.clone();break;case 1:qe.splice(1,0,Ct);break;case 2:qe[1]=Ct;break;case 3:qe.splice(4,0,Ct);break;case 5:qe.splice(2,0,Ct);break;case 6:qe[3]=Ct;break;case 7:qe.splice(3,0,Ct);break;case 8:qe[2]=Ct}return qe}
vendor: 3,985 bytes, line 1
1containsTile(Re,Oe,Ue,qe=0){const Ct=Re.queryPadding/Oe._pixelsPerMercatorPixel+1,Ot=Ue?this._bufferedCameraMercator(Ct,Oe):this._bufferedScreenMercator(Ct,Oe);let Jt=Re.tileID.wrap+(Ot.unwrapped?qe:0);const _i=Ot.polygon.map((Oe=>Le.ag(Re.tileTransform,Oe,Jt)));if(!Le.ah(_i,0,0,Le.ab,Le.ab))return;Jt=Re.tileID.wrap+(this.screenGeometryMercator.unwrapped?qe:0);const xi=this.screenGeometryMercator.polygon.map((Oe=>Le.ai(Re.tileTransform,Oe,Jt))),vi=xi.map((Re=>new Le.P(Re[0],Re[1]))),bi=Oe.getFreeCameraOptions().position||new Le.a5(0,0,0),Pi=Le.ai(Re.tileTransform,bi,Jt),Hr=xi.map((Re=>{const Oe=Le.a6.vec3.sub(Re,Re,Pi);return Le.a6.vec3.normalize(Oe,Oe),new Le.aj(Pi,Oe)})),Jr=Le.ak(Re,1,Oe.zoom)*Oe._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:vi,tilespaceRays:Hr,bufferedTilespaceGeometry:_i,bufferedTilespaceBounds:(Ln=Le.al(_i),Ln.min.x=Le.ap(Ln.min.x,0,Le.ab),Ln.min.y=Le.ap(Ln.min.y,0,Le.ab),Ln.max.x=Le.ap(Ln.max.x,0,Le.ab),Ln.max.y=Le.ap(Ln.max.y,0,Le.ab),Ln),tile:Re,tileID:Re.tileID,pixelToTileUnitsFactor:Jr};var Ln}_bufferedScreenMercator(Le,Re){const Oe=$e(Le);if(this._screenRaycastCache[Oe])return this._screenRaycastCache[Oe];{let Ue;return Ue="globe"===Re.projection.name?this._projectAndResample(this.bufferedScreenGeometry(Le),Re):{polygon:this.bufferedScreenGeometry(Le).map((Le=>Re.pointCoordinate3D(Le))),unwrapped:!0},this._screenRaycastCache[Oe]=Ue,Ue}}_bufferedCameraMercator(Le,Re){const Oe=$e(Le);if(this._cameraRaycastCache[Oe])return this._cameraRaycastCache[Oe];{let Ue;return Ue="globe"===Re.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(Le),Re):{polygon:this.bufferedCameraGeometry(Le).map((Le=>Re.pointCoordinate3D(Le))),unwrapped:!0},this._cameraRaycastCache[Oe]=Ue,Ue}}_projectAndResample(Re,Oe){const Ue=function(Re,Oe){const Ue=Le.a6.mat4.multiply([],Oe.pixelMatrix,Oe.globeMatrix),qe=[0,-Le.aq,0,1],Ct=[0,Le.aq,0,1],Ot=[0,0,0,1];Le.a6.vec4.transformMat4(qe,qe,Ue),Le.a6.vec4.transformMat4(Ct,Ct,Ue),Le.a6.vec4.transformMat4(Ot,Ot,Ue);const Jt=new Le.P(qe[0]/qe[3],qe[1]/qe[3]),_i=new Le.P(Ct[0]/Ct[3],Ct[1]/Ct[3]),xi=Le.an(Re,Jt)&&qe[3]<Ot[3],vi=Le.an(Re,_i)&&Ct[3]<Ot[3];if(!xi&&!vi)return null;const bi=function(Le,Re,Oe){for(let Ue=1;Ue<Le.length;Ue++){const qe=We(Re.pointCoordinate3D(Le[Ue-1]).x),Ct=We(Re.pointCoordinate3D(Le[Ue]).x);if(Oe<0){if(qe<Ct)return{idx:Ue,t:-qe/(Ct-1-qe)}}else if(Ct<qe)return{idx:Ue,t:(1-qe)/(Ct+1-qe)}}return null}(Re,Oe,xi?-1:1);if(!bi)return null;const{idx:Pi,t:Hr}=bi;let Jr=Pi>1?He(Re.slice(0,Pi),Oe):[],Ln=Pi<Re.length?He(Re.slice(Pi),Oe):[];Jr=Jr.map((Re=>new Le.P(We(Re.x),Re.y))),Ln=Ln.map((Re=>new Le.P(We(Re.x),Re.y)));const Nn=[...Jr];0===Nn.length&&Nn.push(Ln[Ln.length-1]);const Gn=Le.aa(Nn[Nn.length-1].y,(0===Ln.length?Jr[0]:Ln[0]).y,Hr);let qn;return qn=xi?[new Le.P(0,Gn),new Le.P(0,0),new Le.P(1,0),new Le.P(1,Gn)]:[new Le.P(1,Gn),new Le.P(1,1),new Le.P(0,1),new Le.P(0,Gn)],Nn.push(...qn),0===Ln.length?Nn.push(Jr[0]):Nn.push(...Ln),{polygon:Nn.map((Re=>new Le.a5(Re.x,Re.y))),unwrapped:!1}}(Re,Oe);if(Ue)return Ue;const qe=function(Re,Oe){let Ue=!1,qe=-1/0,Ct=0;for(let Le=0;Le<Re.length-1;Le++)Re[Le].x>qe&&(qe=Re[Le].x,Ct=Le);for(let Le=0;Le<Re.length-1;Le++){const Oe=(Ct+Le)%(Re.length-1),qe=Re[Oe],Ot=Re[Oe+1];Math.abs(qe.x-Ot.x)>.5&&(qe.x<Ot.x?(qe.x+=1,0===Oe&&(Re[Re.length-1].x+=1)):(Ot.x+=1,Oe+1===Re.length-1&&(Re[0].x+=1)),Ue=!0)}const Ot=Le.am(Oe.center.lng);return Ue&&Ot<Math.abs(Ot-1)&&Re.forEach((Le=>{Le.x-=1})),{polygon:Re,unwrapped:Ue}}(He(Re,Oe).map((Re=>new Le.P(We(Re.x),Re.y))),Oe);return{polygon:qe.polygon.map((Re=>new Le.a5(Re.x,Re.y))),unwrapped:qe.unwrapped}}}function He(Re,Oe){return Le.ao(Re,(Le=>{const Re=Oe.pointCoordinate3D(Le);Le.x=Re.x,Le.y=Re.y}),1/256)}function We(Le){return Le<0?1+Le%1:Le%1}function $e(Le){return 100*Le|0}function Xe(Re,Oe,Ue,qe,Ct){const a=function(Ue,qe){if(Ue)return Ct(Ue);if(qe){if(Re.url&&qe.tiles&&Re.tiles&&delete Re.tiles,qe.variants){if(!Array.isArray(qe.variants)
1)return Ct(new Error("variants must be an array"));for(const Re of qe.variants){if(null==Re||"object"!=typeof Re||Re.constructor!==Object)return Ct(new Error("variant must be an object"));if(!Array.isArray(Re.capabilities))return Ct(new Error("capabilities must be an array"));if(1===Re.capabilities.length&&"meshopt"===Re.capabilities[0]){qe=Le.l(qe,Re);break}}}const Ue=Le.ar(Le.l(qe,Re),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);qe.vector_layers&&(Ue.vectorLayers=qe.vector_layers,Ue.vectorLayerIds=Ue.vectorLayers.map((Le=>Le.id))),qe.raster_layers&&(Ue.rasterLayers=qe.raster_layers,Ue.rasterLayerIds=Ue.rasterLayers.map((Le=>Le.id))),Ue.tiles=Oe.canonicalizeTileset(Ue,Re.url),Ct(null,Ue)}},Ot=function(Le,Re,Oe){if(!Le)return null;if(!Re&&!Oe)return Le;Oe=Oe||Le.worldview_default;const Ue=Object.values(Le.language||{});if(0===Ue.length)return null;const qe=Object.values(Le.worldview||{});if(0===qe.length)return null;const Ct=Ue.every((Le=>Le===Re)),Ot=qe.every((Le=>Le===Oe));return Ct&&Ot?Le:Re in(Le.language_options||{})||Oe in(Le.worldview_options||{})?null:Le.language_options&&Le.worldview_options?Le:null}(Re.data,Ue,qe);return Ot?Le.q.frame((()=>a(null,Ot))):Re.url?Le.n(Oe.transformRequest(Oe.normalizeSourceURL(Re.url,null,Ue,qe),Le.R.Source),a):Le.q.frame((()=>{const{data:Le,...Oe}=Re;a(null,Oe)}))}class Ye{constructor(Re,Oe,Ue){this.bounds=Le.as.convert(this.validateBounds(Re)),this.minzoom=Oe||0,this.maxzoom=Ue||24}validateBounds(Le){return Array.isArray(Le)&&4===Le.length?[Math.max(-180,Le[0]),Math.max(-90,Le[1]),Math.min(180,Le[2]),Math.min(90,Le[3])]:[-180,-90,180,90]}contains(Re){const Oe=Math.pow(2,Re.z),Ue=Math.floor(Le.am(this.bounds.getWest())*Oe),qe=Math.floor(Le.at(this.bounds.getNorth())*Oe),Ct=Math.ceil(Le.am(this.bounds.getEast())*Oe),Ot=Math.ceil(Le.at(this.bounds.getSouth())*Oe);return Re.x>=Ue&&Re.x<Ct&&Re.y>=qe&&Re.y<Ot}}class Ke extends Le.E{constructor(Re,Oe,Ue,qe){if(super(),this.id=Re,this.dispatcher=Ue,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Le.l(this,Le.ar(Oe,["url","scheme","tileSize","promoteId"])),this._options=Le.l({type:"vector"},Oe),this._collectResourceTiming=!!Oe.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(qe),this._tileWorkers={},this._deduped=new Le.au}load(Re){this._loaded=!1,this.fire(new Le.x("dataloading",{dataType:"source"}));const Oe=Array.isArray(this.map._language)?this.map._language.join():this.map._language,Ue=this.map._worldview;this._tileJSONRequest=Xe(this._options,this.map._requestManager,Oe,Ue,((qe,Ct)=>{this._tileJSONRequest=null,this._loaded=!0,qe?(Oe&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${Oe}`),Ue&&2!==Ue.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${Ue}`),this.fire(new Le.t(qe))):Ct&&(Le.l(this,Ct),Ct.bounds&&(this.tileBounds=new Ye(Ct.bounds,this.minzoom,this.maxzoom)),Ln(Ct.tiles,this.map._requestManager._customAccessToken),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"content"}))),Re&&Re(qe)}))}loaded(){return this._loaded}hasTile(Le){return!this.tileBounds||this.tileBounds.contains(Le.canonical)}onAdd(Le){this.map=Le,this.load()}reload(){this.cancelTileJSONRequest();const Re=Le.av(this.id,this.scope);this.load((()=>this.map.style.clearSource(Re)))}setTiles(Le){return this._options.tiles=Le,this.reload(),this}setUrl(Le){return this.url=Le,this._options.url=Le,this.reload(),this}onRemove(Le){this.cancelTileJSONRequest()}serialize(){return Le.l({},this._options)}loadTile(Re,Oe){const Ue=this.map._requestManager.normalizeTileURL(Re.tileID.canonical.url(this.tiles,this.scheme)),qe=this.map._requestManager.transformRequest(Ue,Le.R.Tile),Ct=this.map.style?this.map.style.getLut(this.scope):null,Ot={request:qe,data:void 0,uid:Re.uid,tileID:Re.tileID,tileZoom:Re.tileZoom,zoom:Re.tileID.overscaledZ,lut:Ct?{image:Ct.image.clone()}:null,tileSize:this.tileSize*Re.tileID.overscaleFactor(),type:this.t
vendor: 1,441 bytes, line 1
1ype,source:this.id,scope:this.scope,pixelRatio:Le.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:Re.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:Re.isExtraShadowCaster,tessellationStep:this.map._tessellationStep};if(Ot.request.collectResourceTiming=this._collectResourceTiming,Re.actor&&"expired"!==Re.state)"loading"===Re.state?Re.reloadCallback=Oe:Re.request=Re.actor.send("reloadTile",Ot,n.bind(this));else if(Re.actor=this._tileWorkers[Ue]=this._tileWorkers[Ue]||this.dispatcher.getActor(),this.dispatcher.ready)Re.request=Re.actor.send("loadTile",Ot,n.bind(this),void 0,!0);else{const Oe=Le.aw.call({deduped:this._deduped},Ot,((Le,Oe)=>{Le||!Oe?n.call(this,Le):(Ot.data={cacheControl:Oe.cacheControl,expires:Oe.expires,rawData:Oe.rawData.slice(0)},Re.actor&&Re.actor.send("loadTile",Ot,n.bind(this),void 0,!0))}),!0);Re.request={cancel:Oe}}function n(Ue,qe){return delete Re.request,Re.aborted?Oe(null):Ue&&404!==Ue.status?Oe(Ue):(qe&&qe.resourceTiming&&(Re.resourceTiming=qe.resourceTiming),this.map._refreshExpiredTiles&&qe&&Re.setExpiryData(qe),Re.loadVectorData(qe,this.map.painter),Le.ax(this.dispatcher),Oe(null),void(Re.reloadCallback&&(this.loadTile(Re,Re.reloadCallback),Re.reloadCallback=null)))}}abortTile(Le){Le.request&&(Le.request.cancel(),delete Le.request),Le.actor&&Le.actor.send("abortTile",{uid:Le.uid,type:this.t
1ype,source:this.id,scope:this.scope})}unloadTile(Le,Re){Le.actor&&Le.actor.send("removeTile",{uid:Le.uid,type:this.type,source:this.id,scope:this.scope}),Le.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Je extends Le.E{constructor(Re,Oe,Ue,qe){super(),this.id=Re,this.dispatcher=Ue,this.setEventedParent(qe),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Le.l({type:"raster"},Oe),Le.l(this,Le.ar(Oe,["url","scheme","tileSize"]))}load(Re){this._loaded=!1,this.fire(new Le.x("dataloading",{dataType:"source"})),this._tileJSONRequest=Xe(this._options,this.map._requestManager,null,null,((Oe,Ue)=>{this._tileJSONRequest=null,this._loaded=!0,Oe?this.fire(new Le.t(Oe)):Ue&&(Le.l(this,Ue),Ue.bounds&&(this.tileBounds=new Ye(Ue.bounds,this.minzoom,this.maxzoom)),Ln(Ue.tiles),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"content"}))),Re&&Re(Oe)}))}loaded(){return this._loaded}onAdd(Le){this.map=Le,this.load()}reload(){this.cancelTileJSONRequest();const Re=Le.av(this.id,this.scope);this.load((()=>this.map.style.clearSource(Re)))}setTiles(Le){return this._options.tiles=Le,this.reload(),this}setUrl(Le){return this.url=Le,this._options.url=Le,this.reload(),this}onRemove(Le){this.cancelTileJSONRequest()}serialize(){return Le.l({},this._options)}hasTile(Le){return!this.tileBounds||this.tileBounds.contains(Le.canonical)}loadTile(Re,Oe){const Ue=Le.q.devicePixelRatio>=2,qe=this.map._requestManager.normalizeTileURL(Re.tileID.canonical.url(this.tiles,this.scheme),Ue,this.tileSize);Re.request=Le.o(this.map._requestManager.transformRequest(qe,Le.R.Tile),((Ue,qe,Ct,Ot)=>(delete Re.request,Re.aborted?(Re.state="unloaded",Oe(null)):Ue?(Re.state="errored",Oe(Ue)):qe?(this.map._refreshExpiredTiles&&Re.setExpiryData({cacheControl:Ct,expires:Ot}),Re.setTexture(qe,this.map.painter),Re.state="loaded",Le.ax(this.dispatcher),void Oe(null)):Oe(null))))}abortTile(Le,Re){Le.request&&(Le.request.cancel(),delete Le.request),Re&&Re()}unloadTile(Re,Oe){Re.texture&&Re.texture instanceof Le.T?(Re.destroy(!0),Re.texture&&Re.texture instanceof Le.T&&this.map.painter.saveTileTexture(Re.texture)):Re.destroy(),Oe&&Oe()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Qe extends Je{constructor(Re,Oe,Ue,qe){super(Re,Oe,Ue,qe),this.type="raster-array",this.maxzoom=22,this._options=Le.l({type:"raster-array"},Oe)}triggerRepaint(Le){const Re=this.map.painter._terrain,Oe=this.map.style.getSourceCache(this.id);Re&&Re.enabled&&Oe&&Re._clearRenderCacheForTile(Oe.id,Le.tileID),this.map.triggerRepaint()}loadTile(Re,Oe){const Ue=this.map._requestManager.normalizeTileURL(Re.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),qe=this.map._requestManager.transformRequest(Ue,Le.R.Tile);Re.requestParams=qe,Re.actor||(Re.actor=this.dispatcher.getActor()),Re.request=Re.fetchHeader(void 0,((Le,Ue,qe,Ct)=>{if(delete Re.request,Re.aborted)return Re.state="unloaded",Oe(null);if(Le){if(20===Le.code)return;return Re.state="errored",Oe(Le)}this.map._refreshExpiredTiles&&Re.setExpiryData({cacheControl:qe,expires:Ct}),Re.state="empty",Oe(null)}))}unloadTile(Re,Oe){const Ue=Re.texture;Ue&&Ue instanceof Le.T?(Re.destroy(!0),this.map.painter.saveTileTexture(Ue)):(Re.destroy(),Re.flushQueues(),Re._isHeaderLoaded=!1,delete Re._mrt,delete Re.textureDescriptor),Re.fbo&&(Re.fbo.destroy(),delete Re.fbo),delete Re.request,delete Re.requestParams,delete Re.neighboringTiles,Re.state="unloaded"}prepareTile(Re,Oe,Ue){Re._isHeaderLoaded&&("empty"!==Re.state&&(Re.state="reloading"),Re.fetchBand(Oe,Ue,((Oe,Ue)=>{if(Oe)return Re.state="errored",this.fire(new Le.t(Oe)),void this.triggerRepaint(Re);Ue&&(Re.setTexture(Ue,this.map.painter),Re.state="loaded",this.triggerRepaint(Re))})))}getInitialBand(Le){if(!this.rasterLayers)return 0;const Re=this.rasterLayers.find((({id:Re})=>Re===Le)),Oe=Re&&Re.fields,Ue=Oe&&Oe.bands&&Oe.bands;return Ue?Ue[0]:0}getTextureDescriptor(Re,Oe,Ue){if(!Re)return;const qe=Oe.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!qe)return;let Ct=null;Oe instanceof Le.aB?Ct=Oe.paint.get("raster-array-band"):Oe instanceof Le.aC&&(Ct=Oe.paint.get("raster-particle-array-band"));const Ot=Ct||this.getInitialBand(qe);if(null!=Ot)if(Re.textureDescriptor){if(!Re.updateNeeded(qe,Ot)||Ue)return Object.assign({},Re.textureDescriptor,{texture:Re.texture})}else this.prepareTile(Re,qe,Ot)}}const il={vector:Ke,raster:Je,"raster-dem":class extends Je{constructor(Re,Oe,Ue,qe){super(Re,Oe,Ue,qe),this.type="raster-dem",this.maxzoom=22,this._options=Le.l({type:"raster-dem"},Oe),this.encoding=Oe.encoding||"mapbox"}loadTile(Re,Oe){const Ue=this.map._requestManager.normalizeTileURL(Re.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(Le,Ue){Le&&(Re.state="errored",Oe(Le)),Ue&&(Re.dem=Ue,Re.dem.onDeserialize(),Re.needsHillshadePrepare=!0,Re.needsDEMTextureUpload=!0,Re.state="loaded",Oe(null))}Re.request=Le.o(this.map._requestManager.transformRequest(Ue,Le.R.Tile),function(Ue,qe,Ct,Ot){if(delete Re.request,Re.aborted)Re.state="unloaded",Oe(null);else if(Ue)Re.state="errored",Oe(Ue);else if(qe){this.map._refreshExpiredTiles&&Re.setExpiryData({cac
1heControl:Ct,expires:Ot});const Oe=ImageBitmap&&qe instanceof ImageBitmap&&Le.ay(),Ue=1-(qe.width-Le.az(qe.width))/2;Ue<1||Re.neighboringTiles||(Re.neighboringTiles=this._getNeighboringTiles(Re.tileID));const Jt=Oe?qe:Le.q.getImageData(qe,Ue),_i={uid:Re.uid,coord:Re.tileID,source:this.id,scope:this.scope,rawImageData:Jt,encoding:this.encoding,padding:Ue};Re.actor&&"expired"!==Re.state||(Re.actor=this.dispatcher.getActor(),Re.actor.send("loadDEMTile",_i,r.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(Re){const Oe=Re.canonical,Ue=Math.pow(2,Oe.z),qe=(Oe.x-1+Ue)%Ue,Ct=0===Oe.x?Re.wrap-1:Re.wrap,Ot=(Oe.x+1+Ue)%Ue,Jt=Oe.x+1===Ue?Re.wrap+1:Re.wrap,_i={};return _i[new Le.aA(Re.overscaledZ,Ct,Oe.z,qe,Oe.y).key]={backfilled:!1},_i[new Le.aA(Re.overscaledZ,Jt,Oe.z,Ot,Oe.y).key]={backfilled:!1},Oe.y>0&&(_i[new Le.aA(Re.overscaledZ,Ct,Oe.z,qe,Oe.y-1).key]={backfilled:!1},_i[new Le.aA(Re.overscaledZ,Re.wrap,Oe.z,Oe.x,Oe.y-1).key]={backfilled:!1},_i[new Le.aA(Re.overscaledZ,Jt,Oe.z,Ot,Oe.y-1).key]={backfilled:!1}),Oe.y+1<Ue&&(_i[new Le.aA(Re.overscaledZ,Ct,Oe.z,qe,Oe.y+1).key]={backfilled:!1},_i[new Le.aA(Re.overscaledZ,Re.wrap,Oe.z,Oe.x,Oe.y+1).key]={backfilled:!1},_i[new Le.aA(Re.overscaledZ,Jt,Oe.z,Ot,Oe.y+1).key]={backfilled:!1}),_i}},"raster-array":Qe,geojson:class extends Le.E{constructor(Re,Oe,Ue,qe){super(),this.id=Re,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=Ue.getActor(),this.setEventedParent(qe),this._data=Oe.data,this._options=Le.l({},Oe),this._collectResourceTiming=Oe.collectResourceTiming,void 0!==Oe.maxzoom&&(this.maxzoom=Oe.maxzoom),void 0!==Oe.minzoom&&(this.minzoom=Oe.minzoom),Oe.type&&(this.type=Oe.type),Oe.attribution&&(this.attribution=Oe.attribution),this.promoteId=Oe.promoteId;const Ct=Le.ab/this.tileSize;this.workerOptions=Le.l({source:this.id,scope:this.scope,cluster:Oe.cluster||!1,geojsonVtOptions:{buffer:(void 0!==Oe.buffer?Oe.buffer:128)*Ct,tolerance:(void 0!==Oe.tolerance?Oe.tolerance:.375)*Ct,extent:Le.ab,maxZoom:this.maxzoom,lineMetrics:Oe.lineMetrics||!1,generateId:Oe.generateId||!1},superclusterOptions:{maxZoom:void 0!==Oe.clusterMaxZoom?Oe.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,Oe.clusterMinPoints||2),extent:Le.ab,radius:(void 0!==Oe.clusterRadius?Oe.clusterRadius:50)*Ct,log:!1,generateId:Oe.generateId||!1},clusterProperties:Oe.clusterProperties,filter:Oe.filter,dynamic:Oe.dynamic},Oe.workerOptions)}onAdd(Le){this.map=Le,this.setData(this._data)}setData(Le){return this._data=Le,this._updateWorkerData(),this}updateData(Re){if(!this._options.dynamic)return this.fire(new Le.t(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof Re&&("Feature"===Re.type&&(Re={type:"FeatureCollection",features:[Re]}),"FeatureCollection"!==Re.type))return this.fire(new Le.t(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof Re&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){const Le=new Map;for(const Re of this._data.features)Le.set(Re.id,Re);for(const Oe of Re.features)Le.set(Oe.id,Oe);this._data.features=[...Le.values()]}else this._data=Re;return this._updateWorkerData(!0),this}getClusterExpansionZoom(Le,Re){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:Le,source:this.id,scope:this.scope},Re),this}getClusterChildren(Le,Re){return this.actor.send("geojson.getClusterChildren",{clusterId:Le,source:this.id,scope:this.scope},Re),this}getClusterLeaves(Le,Re,Oe,Ue){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:Le,limit:Re,offset:Oe},Ue),this}_updateWorkerData(Re=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new Le.x("dataloading",{dataType:"source"})),this._loaded=!1;const Oe=Le.l({append:Re},this.workerOptions);Oe.scope=this.scope;const Ue=this._data;"string"==typeof Ue?(Oe.request=this.map._requestManager.transformRequest(Le.q.resolveURL(Ue),Le.R.Source),Oe.request.collectResourceTiming=this._collectResourceTiming):Oe.data=JSON.stringify(Ue),this._pendingLoad=this.actor.send(`${this.type}.loadData`,Oe,((Oe,Ue)=>{if(this._loaded=!0,this._pendingLoad=null,Oe)this.fire(new Le.t(Oe));else{const Oe={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&Ue&&Ue.resourceTiming&&Ue.resourceTiming[this.id]&&(Oe.resourceTiming=Ue.resourceTiming[this.id]),Re&&(this._partialReload=!0),this.fire(new Le.x("data",Oe)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(Re),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(Re,Oe){const Ue=Re.actor?"reloadTile":"loadTile";Re.actor=this.actor;const qe=this.map.style?this.map.style.getLut(this.scope):null,Ct=this._partialReload,Ot={type:this.t
1ype,uid:Re.uid,tileID:Re.tileID,tileZoom:Re.tileZoom,zoom:Re.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:qe?{image:qe.image.clone()}:null,scope:this.scope,pixelRatio:Le.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,partial:Ct};Re.request=this.actor.send(Ue,Ot,((Le,qe)=>Ct&&!qe?(Re.state="loaded",Oe(null)):(delete Re.request,Re.destroy(),Re.aborted?Oe(null):Le?Oe(Le):(Re.loadVectorData(qe,this.map.painter,"reloadTile"===Ue),Oe(null)))),void 0,"loadTile"===Ue)}abortTile(Le){Le.request&&(Le.request.cancel(),delete Le.request),Le.aborted=!0}unloadTile(Le,Re){this.actor.send("removeTile",{uid:Le.uid,type:this.type,source:this.id,scope:this.scope}),Le.destroy()}onRemove(Le){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Le.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Le.aD{constructor(Le,Re,Oe,Ue){super(Le,Re,Oe,Ue),this.roundZoom=!0,this.type="video",this.options=Re}load(){this._loaded=!1;const Re=this.options;this.urls=[];for(const Oe of Re.urls)this.urls.push(this.map._requestManager.transformRequest(Oe,Le.R.Source).url);Le.aE(this.urls,((Re,Oe)=>{this._loaded=!0,Re?this.fire(new Le.t(Re)):Oe&&(this.video=Oe,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(Re){if(this.video){const Oe=this.video.seekable;Re<Oe.start(0)||Re>Oe.end(0)?this.fire(new Le.t(new Le.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${Oe.start(0)} and ${Oe.end(0)}-second mark.`))):this.video.currentTime=Re}}getVideo(){return this.video}onAdd(Le){this.map||(this.map=Le,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const Re=this.map.painter.context,Oe=Re.gl;this.texture?this.video.paused||(this.texture.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE),Oe.texSubImage2D(Oe.TEXTURE_2D,0,0,0,Oe.RGBA,Oe.UNSIGNED_BYTE,this.video)):(this.texture=new Le.T(Re,this.video,Oe.RGBA8),this.texture.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(Re)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Le.aD,model:class extends Le.E{constructor(Le,Re,Oe,Ue){super(),this.id=Le,this.type="model",this.models=[],this._loaded=!1,this._options=Re}load(){const Re=[];for(const Oe in this._options.models){const Ue=this._options.models[Oe],qe=Le.aG(this.map._requestManager.transformRequest(Ue.uri,Le.R.Model).url).then((Re=>{if(!Re)return;const qe=Le.aH(Re),Ct=new Le.aI(Oe,Ue.position,Ue.orientation,qe);Ct.computeBoundsAndApplyParent(),this.models.push(Ct)})).catch((Re=>{this.fire(new Le.t(new Error(`Could not load model ${Oe} from ${Ue.uri}: ${Re.message}`)))}));Re.push(qe)}return Promise.allSettled(Re).then((()=>{this._loaded=!0,this.fire(new Le.x("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((Re=>{this.fire(new Le.t(new Error(`Could not load models: ${Re.message}`)))}))}onAdd(Le){this.map=Le,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(Le,Re){}serialize(){return{type:"model"}}},"batched-model":class extends Le.E{constructor(Le,Re,Oe,Ue){super(),this.type="batched-model",this.id=Le,this.tileSize=512,this._options=Re,this.tiles=this._options.tiles,this.maxzoom=Re.maxzoom||19,this.minzoom=Re.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=Oe,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(Ue)}onAdd(Le){this.map=Le,this.load()}load(Re){this._loaded=!1,this.fire(new Le.x("dataloading",{dataType:"source"}));const Oe=Array.isArray(this.map._language)?this.map._language.join():this.map._language,Ue=this.map._worldview;this._tileJSONRequest=Xe(this._options,this.map._requestManager,Oe,Ue,((qe,Ct)=>{this._tileJSONRequest=null,this._loaded=!0,qe?(Oe&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${Oe}`),Ue&&2!==Ue.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${Ue}
1`),this.fire(new Le.t(qe))):Ct&&(Le.l(this,Ct),Ct.bounds&&(this.tileBounds=new Ye(Ct.bounds,this.minzoom,this.maxzoom)),Ln(Ct.tiles,this.map._requestManager._customAccessToken),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"content"}))),Re&&Re(qe)}))}hasTransition(){return!1}hasTile(Le){return!this.tileBounds||this.tileBounds.contains(Le.canonical)}loaded(){return this._loaded}loadTile(Re,Oe){const Ue=this.map._requestManager.normalizeTileURL(Re.tileID.canonical.url(this.tiles,this.scheme)),qe={request:this.map._requestManager.transformRequest(Ue,Le.R.Tile),data:void 0,uid:Re.uid,tileID:Re.tileID,tileZoom:Re.tileZoom,zoom:Re.tileID.overscaledZ,tileSize:this.tileSize*Re.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:Re.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(Re.actor&&"expired"!==Re.state)if("loading"===Re.state)Re.reloadCallback=Oe;else{if(Re.buckets){const Le=Object.values(Re.buckets);for(const Re of Le)Re.dirty=!0;return void(Re.state="loaded")}Re.request=Re.actor.send("reloadTile",qe,s.bind(this))}else Re.actor=this.dispatcher.getActor(),Re.request=Re.actor.send("loadTile",qe,s.bind(this),void 0,!0);function s(Le,Ue){return Re.aborted?Oe(null):Le&&404!==Le.status?Oe(Le):(Ue&&(Ue.resourceTiming&&(Re.resourceTiming=Ue.resourceTiming),this.map._refreshExpiredTiles&&Re.setExpiryData(Ue),Re.buckets={...Re.buckets,...Ue.buckets},Ue.featureIndex&&(Re.latestFeatureIndex=Ue.featureIndex)),Re.state="loaded",void Oe(null))}}serialize(){return Le.l({},this._options)}},canvas:class extends Le.aD{constructor(Re,Oe,Ue,qe){super(Re,Oe,Ue,qe),Oe.coordinates?Array.isArray(Oe.coordinates)&&4===Oe.coordinates.length&&!Oe.coordinates.some((Le=>!Array.isArray(Le)||2!==Le.length||Le.some((Le=>"number"!=typeof Le))))||this.fire(new Le.t(new Le.V(`sources.${Re}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Le.t(new Le.V(`sources.${Re}`,null,'missing required property "coordinates"'))),Oe.animate&&"boolean"!=typeof Oe.animate&&this.fire(new Le.t(new Le.V(`sources.${Re}`,null,'optional "animate" property must be a boolean value'))),Oe.canvas?"string"==typeof Oe.canvas||Oe.canvas instanceof HTMLCanvasElement||this.fire(new Le.t(new Le.V(`sources.${Re}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new Le.t(new Le.V(`sources.${Re}`,null,'missing required property "canvas"'))),this.options=Oe,this.animate=void 0===Oe.animate||Oe.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new Le.t(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(Le){this.map=Le,this.load(),this.canvas&&this.animate&&this.play()}onRemove(Le){this.pause()}prepare(){let Re=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,Re=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,Re=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const Oe=this.map.painter.context;this.texture?!Re&&!this._playing||this.texture instanceof Le.aF||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Le.T(Oe,this.canvas,Oe.gl.RGBA8,{premultiply:!0}),this._prepareData(Oe)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const Le of[this.canvas.width,this.canvas.height])if(isNaN(Le)||Le<=0)return!0;return!1}},custom:class extends Le.E{constructor(Re,Oe,Ue,qe){super(),this.id=Re,this.type="custom",this._dataType="raster",this._dispatcher=Ue,this._implementation=Oe,this.setEventedParent(qe),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new Le.t(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new Le.t(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Ye(this._implementation.bounds,this.minzoom,this.maxzoom)),Oe.update=this._update.bind(this),Oe.clearTiles=this._clearTiles.bind(this),Oe.coveringTiles=this._coveringTiles.bind(this),Le.l(this,Le.ar(Oe,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileC
1acheSize"]))}serialize(){return Le.ar(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new Le.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Le.x("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(Re){this.map=Re,this._loaded=!1,this.fire(new Le.x("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(Re),this.load()}onRemove(Le){this._implementation.onRemove&&this._implementation.onRemove(Le)}hasTile(Le){if(this._implementation.hasTile){const{x:Re,y:Oe,z:Ue}=Le.canonical;return this._implementation.hasTile({x:Re,y:Oe,z:Ue})}return!this.tileBounds||this.tileBounds.contains(Le.canonical)}loadTile(Le,Re){const{x:Oe,y:Ue,z:qe}=Le.tileID.canonical,Ct=new AbortController;Le.request=Promise.resolve(this._implementation.loadTile({x:Oe,y:Ue,z:qe},{signal:Ct.signal})).then(function(Oe){return delete Le.request,Le.aborted?(Le.state="unloaded",Re(null)):void 0===Oe?(Le.state="errored",Re(null)):null===Oe?(this.loadTileData(Le,{width:this.tileSize,height:this.tileSize,data:null}),Le.state="loaded",Re(null)):function(Le){return Le instanceof ImageData||Le instanceof HTMLCanvasElement||Le instanceof ImageBitmap||Le instanceof HTMLImageElement}(Oe)?(this.loadTileData(Le,Oe),Le.state="loaded",void Re(null)):(Le.state="errored",Re(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((Oe=>{20!==Oe.code&&(Le.state="errored",Re(Oe))})),Le.request.cancel=()=>Ct.abort()}loadTileData(Le,Re){Le.setTexture(Re,this.map.painter)}unloadTile(Re,Oe){if(Re.texture&&Re.texture instanceof Le.T?(Re.destroy(!0),Re.texture&&Re.texture instanceof Le.T&&this.map.painter.saveTileTexture(Re.texture)):Re.destroy(),this._implementation.unloadTile){const{x:Le,y:Oe,z:Ue}=Re.tileID.canonical;this._implementation.unloadTile({x:Le,y:Oe,z:Ue})}Oe&&Oe()}abortTile(Le,Re){Le.request&&Le.request.cancel&&(Le.request.cancel(),delete Le.request),Re&&Re()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((Le=>({x:Le.canonical.x,y:Le.canonical.y,z:Le.canonical.z})))}_clearTiles(){const Re=Le.av(this.id,this.scope);this.map.style.clearSource(Re)}_update(){this.fire(new Le.x("data",{dataType:"source",sourceDataType:"content"}))}}},tt=function(Re,Oe,Ue,qe){const Ct=new il[Oe.type](Re,Oe,Ue,qe);if(Ct.id!==Re)throw new Error(`Expected Source id to be ${Re} instead of ${Ct.id}`);return Le.aJ(["load","abort","unload","serialize","prepare"],Ct),Ct};function it(Re,Oe){const Ue=Le.a6.mat4.identity([]);return Le.a6.mat4.scale(Ue,Ue,[.5*Re.width,.5*-Re.height,1]),Le.a6.mat4.translate(Ue,Ue,[1,-1,0]),Le.a6.mat4.multiply(Ue,Ue,Re.calculateProjMatrix(Oe.toUnwrapped())),Float32Array.from(Ue)}function ot(Le,Re,Oe,Ue,qe,Ct,Ot,Jt=!1){const _i=Le.tilesIn(Ue,Ot,Jt);_i.sort(st);const xi=[];for(const Ue of _i)xi.push({wrappedTileID:Ue.tile.tileID.wrapped().key,queryResults:Ue.tile.queryRenderedFeatures(Re,Oe,Le._state,Ue,qe,Ct,it(Le.transform,Ue.tile.tileID),Jt)});const vi=function(Le){const Re={},Oe={};for(const Ue of Le){const Le=Ue.queryResults,qe=Ue.wrappedTileID,Ct=Oe[qe]=Oe[qe]||{};for(const Oe in Le){const Ue=Le[Oe],qe=Ct[Oe]=Ct[Oe]||{},Ot=Re[Oe]=Re[Oe]||[];for(const Le of Ue)qe[Le.featureIndex]||(qe[Le.featureIndex]=!0,Ot.push(Le))}}return Re}(xi);for(const Re in vi)vi[Re].forEach((Re=>{const Oe=Re.feature,Ue=Oe.layer;Ue&&"background"!==Ue.type&&"sky"!==Ue.type&&"slot"!==Ue.type&&(Oe.source=Ue.source,Ue["source-layer"]&&(Oe.sourceLayer=Ue["source-layer"]),Oe.state=void 0!==Oe.id?Le.getFeatureState(Ue["source-layer"],Oe.id):{})}));return vi}function rt(Le,Re){const Oe=Le.getRenderableIds().map((Re=>Le.getTileByID(Re))),Ue=[],qe={};for(let Le=0;Le<Oe.length;Le++){const Ct=Oe[Le],Ot=Ct.tileID.canonical.key;qe[Ot]||(qe[Ot]=!0,Ct.querySourceFeatures(Ue,Re))}return Ue}function st(Le,Re){const Oe=Le.tileID,Ue=Re.tileID;return Oe.overscaledZ-Ue.overscaledZ||Oe.canonical.y-Ue.canonical.y||Oe.wrap-Ue.wrap||Oe.canonical.x-Ue.canonical.x}
1const sl=32,fl=33,Ml=new Uint16Array(8184);for(let Le=0;Le<2046;Le++){let Re=Le+2,Oe=0,Ue=0,qe=0,Ct=0,Ot=0,Jt=0;for(1&Re?qe=Ct=Ot=sl:Oe=Ue=Jt=sl;(Re>>=1)>1;){const Le=Oe+qe>>1,_i=Ue+Ct>>1;1&Re?(qe=Oe,Ct=Ue,Oe=Ot,Ue=Jt):(Oe=qe,Ue=Ct,qe=Ot,Ct=Jt),Ot=Le,Jt=_i}const _i=4*Le;Ml[_i+0]=Oe,Ml[_i+1]=Ue,Ml[_i+2]=qe,Ml[_i+3]=Ct}const Al=new Uint16Array(2178),Hl=new Uint8Array(1089),Wl=new Uint16Array(1089);function dt(Le){return 0===Le?-.03125:32===Le?.03125:0}const Jl=(()=>({type:2,extent:Le.ab,loadGeometry:()=>[[new Le.P(0,0),new Le.P(Le.ab+1,0),new Le.P(Le.ab+1,Le.ab+1),new Le.P(0,Le.ab+1),new Le.P(0,0)]]}))();class pt{constructor(Re,Oe,Ue,qe,Ct){this.tileID=Re,this.uid=Le.aP(),this.uses=0,this.tileSize=Oe,this.tileZoom=Ue,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=Ct,qe&&qe.style&&(this._lastUpdatedBrightness=qe.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",qe&&qe.transform&&(this.projection=qe.transform.projection)}registerFadeDuration(Re){const Oe=Re+this.timeAdded;Oe<Le.q.now()||this.fadeEndTime&&Oe<this.fadeEndTime||(this.fadeEndTime=Oe)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=Le.aK(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(Re,Oe,Ue){if(this.unloadVectorData(),this.state="loaded",Re){Re.featureIndex&&(this.latestFeatureIndex=Re.featureIndex,Re.rawTileData?(this.latestRawTileData=Re.rawTileData,this.latestFeatureIndex.rawTileData=Re.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=Re.collisionBoxArray,this.buckets=function(Le,Re){const Oe={};if(!Re)return Oe;for(const Ue of Le){const Le=Ue.layerIds.map((Le=>Re.getLayer(Le))).filter(Boolean);if(0!==Le.length){Ue.layers=Le,Ue.stateDependentLayerIds&&(Ue.stateDependentLayers=Ue.stateDependentLayerIds.map((Re=>Le.filter((Le=>Le.id===Re))[0])));for(const Re of Le)Oe[Re.fqid]=Ue}}return Oe}(Re.buckets,Oe.style),this.hasSymbolBuckets=!1;for(const Re in this.buckets){const Oe=this.buckets[Re];if(Oe instanceof Le.aR){if(this.hasSymbolBuckets=!0,!Ue)break;Oe.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const Re in this.buckets){const Oe=this.buckets[Re];if(Oe instanceof Le.aR&&Oe.hasRTLText){this.hasRTLText=!0,Le.aS();break}}this.queryPadding=0;for(const Le in this.buckets){const Re=this.buckets[Le],Ue=Oe.style.getOwnLayer(Le);if(!Ue)continue;const qe=Ue.queryRadius(Re);this.queryPadding=Math.max(this.queryPadding,qe)}Re.imageAtlas&&(this.imageAtlas=Re.imageAtlas),Re.glyphAtlasImage&&(this.glyphAtlasImage=Re.glyphAtlasImage),Re.lineAtlas&&(this.lineAtlas=Re.lineAtlas),this._lastUpdatedBrightness=Re.brightness}else this.collisionBoxArray=new Le.aQ}unloadVectorData(){if(this.hasData()){for(const Le in this.buckets)this.buckets[Le].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(Le){return this.buckets[Le.fqid]}upload(Re){for(const Le in this.buckets){const Oe=this.buckets[Le];Oe.uploadPending()&&Oe.upload(Re)}const Oe=Re.gl,Ue=this.imageAtlas;if(Ue&&!Ue.uploaded){const qe=!!Object.keys(Ue.patternPositions).length;this.imageAtlasTexture=new Le.T(Re,Ue.image,Oe.RGBA8,{useMipmap:qe}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new Le.T(Re,this.glyphAtlasImage,Oe.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Le.T(Re,this.lineAtlas.image,Oe.R8),this.lineAtlas.uploaded=!0)}prepare(Le,Re,Oe){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(Le,this.imageAtlasTexture,Oe),!Re||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const Ue=Re.style.getBrightness();(this._lastUpdatedBrightness||Ue)&&(this._lastUpdatedBrightness&&Ue&&Math.abs(this._lastUpdatedBrightness-Ue)<.001||(this._lastUpdatedBrightness=Ue,this.updateBuckets(Re)))}queryRenderedFeatures(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:Ue,pixelPosMatrix:Ot,transform:Ct,params:qe,tileTransform:this.tileTransform},Le,Re,Oe):{}}querySourceFeatures(Re,Oe){const Ue=this.latestFeatureIndex;if(!Ue||!Ue.rawTileData)return;const qe=Ue.loadVTLayers(),Ct=Oe?Oe.sourceLayer:"",Ot=qe._geojsonTileLayer||qe[Ct];if(!Ot)return;const Jt=Le.aT(Oe&&Oe.filter),{z:_i,x:xi,y:vi}=this.tileID.canonical,bi={z:_i,x:xi,y:vi};for(let Oe=0;Oe<Ot.length;Oe++){const qe=Ot.feature(Oe);if(Jt.needGeometry){const Re=Le.aU(qe,!0);
vendor: 9,674 bytes, line 1
1if(!Jt.filter(new Le.a3(this.tileID.overscaledZ),Re,this.tileID.canonical))continue}else if(!Jt.filter(new Le.a3(this.tileID.overscaledZ),qe))continue;const Pi=Ue.getId(qe,Ct),Hr=new Le.aV(qe,_i,xi,vi,Pi);Hr.tile=bi,Re.push(Hr)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(Re){const Oe=this.expirationTime;if(Re.cacheControl){const Oe=Le.aW(Re.cacheControl);Oe["max-age"]&&(this.expirationTime=Date.now()+1e3*Oe["max-age"])}else Re.expires&&(this.expirationTime=new Date(Re.expires).getTime());if(this.expirationTime){const Le=Date.now();let Re=!1;if(this.expirationTime>Le)Re=!1;else if(Oe)if(this.expirationTime<Oe)Re=!0;else{const Ue=this.expirationTime-Oe;Ue?this.expirationTime=Le+Math.max(Ue,3e4):Re=!0}else Re=!0;Re?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(Le,Re){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(Le).length&&Re&&this.updateBuckets(Re)}updateBuckets(Re){if(!this.latestFeatureIndex)return;const Oe=this.latestFeatureIndex.loadVTLayers(),Ue=Re.style.listImages(),qe=Re.style.getBrightness();for(const Ct in this.buckets){if(!Re.style.hasLayer(Ct))continue;const Ot=this.buckets[Ct],Jt=Ot.layers[0].sourceLayer||"_geojsonTileLayer",_i=Oe[Jt],xi=Re.style.getOwnSourceCache(Ot.layers[0].source);let vi={};xi&&(vi=xi._state.getState(Jt,void 0)),Ot.update(vi,_i,Ue,this.imageAtlas&&this.imageAtlas.patternPositions||{},qe),(Ot instanceof Le.aX||Ot instanceof Le.aY)&&Re._terrain&&Re._terrain.enabled&&xi&&Ot.programConfigurations.needsUpload&&Re._terrain._clearRenderCacheForTile(xi.id,this.tileID);const bi=Re&&Re.style&&Re.style.getOwnLayer(Ct);bi&&(this.queryPadding=Math.max(this.queryPadding,bi.queryRadius(Ot)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Le.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(Re){this.symbolFadeHoldUntil=Le.q.now()+Re}setTexture(Re,Oe){const Ue=Oe.context,qe=Ue.gl;this.texture=this.texture||Oe.getTileTexture(Re.width),this.texture&&this.texture instanceof Le.T?this.texture.update(Re):(this.texture=new Le.T(Ue,Re,qe.RGBA8,{useMipmap:!0}),this.texture.bind(qe.LINEAR,qe.CLAMP_TO_EDGE))}setDependencies(Le,Re){const Oe={};for(const Le of Re)Oe[Le]=!0;this.dependencies[Le]=Oe}hasDependency(Le,Re){for(const Oe of Le){const Le=this.dependencies[Oe];if(Le)for(const Oe of Re)if(Le[Oe])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(Re,Oe){if(!Oe||"mercator"===Oe.name||this._tileDebugBuffer)return;const Ue=Le.aZ(Jl,this.tileID.canonical,this.tileTransform)[0],qe=new Le.a_,Ct=new Le.a$;for(let Le=0;Le<Ue.length;Le++){const{x:Re,y:Oe}=Ue[Le];qe.emplaceBack(Re,Oe),Ct.emplaceBack(Le)}Ct.emplaceBack(0),this._tileDebugIndexBuffer=Re.createIndexBuffer(Ct),this._tileDebugBuffer=Re.createVertexBuffer(qe,Le.b0.members),this._tileDebugSegments=Le.b1.simpleSegment(0,0,qe.length,Ct.length)}_makeTileBoundsBuffers(Re,Oe){if(this._tileBoundsBuffer||!Oe||"mercator"===Oe.name)return;const Ue=Le.aZ(Jl,this.tileID.canonical,this.tileTransform)[0];let qe,Ct;if(this.isRaster){const Re=function(Re,Oe){const Ue=Le.aK(Re,Oe),qe=Math.pow(2,Re.z);for(let Ct=0;Ct<fl;Ct++)for(let Ot=0;Ot<fl;Ot++){const Jt=Le.aL((Re.x+(Ot+dt(Ot))/sl)/qe),_i=Le.aM((Re.y+(Ct+dt(Ct))/sl)/qe),xi=Oe.project(Jt,_i),vi=Ct*fl+Ot;Al[2*vi+0]=Math.round((xi.x*Ue.scale-Ue.x)*Le.ab),Al[2*vi+1]=Math.round((xi.y*Ue.scale-Ue.y)*Le.ab)}Hl.fill(0),Wl.fill(0);for(let Le=2045;Le>=0;Le--){const Re=4*Le,Oe=Ml[Re+0],Ue=Ml[Re+1],qe=Ml[Re+2],Ct=Ml[Re+3],Ot=Oe+qe>>1,Jt=Ue+Ct>>1,_i=Ot+Jt-Ue,xi=Jt+Oe-Ot,vi=Ue*fl+Oe,bi=Ct*fl+qe,Pi=Jt*fl+Ot,Hr=Math.hypot((Al[2*vi+0]+Al[2*bi+0])/2-Al[2*Pi+0],(Al[2*vi+1]+Al[2*bi+1])/2-Al[2*Pi+1])>=16;Hl[Pi]=Hl[Pi]||(Hr?1:0),Le<1022&&(Hl[Pi]=Hl[Pi]||Hl[(Ue+xi>>1)*fl+(Oe+_i>>1)]||Hl[(Ct+xi>>1)*fl+(qe+_i>>1)])}const Ct=new Le.aN,Ot=new Le.aO;let Jt=0;function l(Re,Oe){const Ue=Oe*fl+Re;return 0===Wl[Ue]&&(Ct.emplaceBack(Al[2*Ue+0],Al[2*Ue+1],Re*Le.ab/sl,Oe*Le.ab/sl),Wl[Ue]=++Jt),Wl[Ue]-1}function c(Le,Re,Oe,Ue,qe,Ct){const Jt=Le+Oe>>1,_i=Re+Ue>>1;if(Math.abs(Le-qe)+Math.abs(Re-Ct)>1&&Hl[_i*fl+Jt])c(qe,Ct,Le,Re,Jt,_i),c(Oe,Ue,qe,Ct,Jt,_i);else{const Jt=l(Le,Re),_i=l(Oe,Ue),xi=l(qe,Ct);Ot.emplaceBack(Jt,_i,xi)}}return c(0,0,sl,sl,sl,0),c(sl,sl,0,0,0,sl),{vertices:Ct,indices:Ot}}(this.tileID.canonical,Oe);qe=Re.vertices,Ct=Re.indices}else{qe=new Le.aN,Ct=new Le.aO;for(const{x:Le,y:Re}of Ue)qe.emplaceBack(Le,Re,0,0);const Re=Le.b2(qe.int16,void 0,4);for(let Le=0;Le<Re.length;Le+=3)Ct.emplaceBack(Re[Le],Re[Le+1],Re[Le+2])}this._tileBoundsBuffer=Re.createVertexBuffer(qe,Le.b3.members),this._tileBoundsIndexBuffer=Re.createIndexBuffer(Ct),this._tileBoundsSegments=Le.b1.simpleSegment(0,0,qe.length,Ct.length)}_makeGlobeTileDebugBuffers(Re,Oe){const Ue=Oe.projection;if(!Ue||"globe"!==Ue.name||Oe.freezeTileCoverage)return;const qe=this.tileID.canonical,Ct=Le.b4(qe,Oe),Ot=Le.b5(Ct),Jt=Le.a9(Oe.zoom);let _i;Jt>0&&(_i=Le.a6.mat4.invert(new Float64Array(16),Oe.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(Re,qe,Oe,Ot,_i,Jt),this._makeGlobeTileDebugTextBuffer(Re,qe,Oe,Ot,_i,Jt)}_globePoint(Re,Oe,Ue,qe,Ct,Ot,Jt){let _i=Le.b6(Re,Oe,Ue);if(Ot){const Ct=1<<Ue.z,xi=Le.am(qe.center.lng),vi=Le.at(qe.center.lat),bi=(Ue.x+.5)/Ct-xi;let Pi=0;bi>.5?Pi=-1:bi<-.5&&(Pi=1);let Hr=(Re/Le.ab+Ue.x)/Ct+Pi,Jr=(Oe/Le.ab+Ue.y)/Ct;Hr=(Hr-xi)*qe._pixelsPerMercatorPixel+xi,Jr=(Jr-vi)*qe._pixelsPerMercatorPixel+vi;const Ln=[Hr*qe.worldSize,Jr*qe.worldSize,0];Le.a6.vec3.transformMat4(Ln,Ln,Ot),_i=Le.b7(_i,Ln,Jt)}return Le.a6.vec3.transformMat4(_i,_i,Ct)}_makeGlobeTileDebugBorderBuffer(Re,Oe,Ue,qe,Ct,Ot){const Jt=new Le.a_,_i=new Le.a$,xi=new Le.b8,h=(Le,Re,vi,bi,Pi)=>{const Hr=(vi-Le)/(Pi-1),Jr=(bi-Re)/(Pi-1),Ln=Jt.length;for(let vi=0;vi<Pi;vi++){const bi=Le+vi*Hr,Pi=Re+vi*Jr;Jt.emplaceBack(bi,Pi);const Nn=this._globePoint(bi,Pi,Oe,Ue,qe,Ct,Ot);xi.emplaceBack(Nn[0],Nn[1],Nn[2]),_i.emplaceBack(Ln+vi)}},vi=Le.ab;h(0,0,vi,0,16),h(vi,0,vi,vi,16),h(vi,vi,0,vi,16),h(0,vi,0,0,16),this._tileDebugIndexBuffer=Re.createIndexBuffer(_i),this._tileDebugBuffer=Re.createVertexBuffer(Jt,Le.b0.members),this._globeTileDebugBorderBuffer=Re.createVertexBuffer(xi,Le.b9.members),this._tileDebugSegments=Le.b1.simpleSegment(0,0,Jt.length,_i.length)}_makeGlobeTileDebugTextBuffer(Re,Oe,Ue,qe,Ct,Ot){const Jt=Le.ab/4,_i=new Le.a_,xi=new Le.aO,vi=new Le.b8,bi=25;xi.reserve(32),_i.reserve(bi),vi.reserve(bi);const d=(Le,Re)=>bi*Le+Re;for(let Le=0;Le<bi;Le++){const Re=Le*Jt;for(let Le=0;Le<bi;Le++){const xi=Le*Jt;_i.emplaceBack(xi,Re);const bi=this._globePoint(xi,Re,Oe,Ue,qe,Ct,Ot);vi.emplaceBack(bi[0],bi[1],bi[2])}}for(let Le=0;Le<4;Le++)for(let Re=0;Re<4;Re++){const Oe=d(Le,Re),Ue=d(Le,Re+1),qe=d(Le+1,Re),Ct=d(Le+1,Re+1);xi.emplaceBack(Oe,Ue,qe),xi.emplaceBack(qe,Ue,Ct)}this._tileDebugTextIndexBuffer=Re.createIndexBuffer(xi),this._tileDebugTextBuffer=Re.createVertexBuffer(_i,Le.b0.members),this._globeTileDebugTextBuffer=Re.createVertexBuffer(vi,Le.b9.members),this._tileDebugTextSegments=Le.b1.simpleSegment(0,0,bi,32)}destroy(Re=!1){for(const Le in this.buckets)this.buckets[Le].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!Re&&this.texture&&this.texture instanceof Le.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}Le.ba.setPbf(Le.bb);class mt extends pt{constructor(Le,Re,Oe,Ue,qe){super(Le,Re,Oe,Ue,qe),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(Re,Oe){const Ue=Oe.context,qe=Ue.gl;this.texture=this.texture||Oe.getTileTexture(Re.width),this.texture&&this.texture instanceof Le.T?this.texture.update(Re,{premultiply:!1}):this.texture=new Le.T(Ue,Re,qe.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(Re=16384,Oe){const Ue=this._mrt=new Le.ba(30),qe=Object.assign({}
1,this.requestParams,{headers:{Range:"bytes=0-"+(Re-1)}});return this.entireBuffer=null,this.request=Le.bc(qe,((Le,qe,Ct,Ot)=>{if(Le)Oe(Le);else try{const Le=Ue.getHeaderLength(qe);if(Le>Re)return void(this.request=this.fetchHeader(Le,Oe));Ue.parseHeader(qe),this._isHeaderLoaded=!0;let Jt=0;for(const Le of Object.values(Ue.layers))Jt=Math.max(Jt,Le.dataIndex[Le.dataIndex.length-1].last_byte);qe.byteLength>=Jt&&(this.entireBuffer=qe),Oe(null,this.entireBuffer||qe,Ct,Ot)}catch(Le){Oe(Le)}})),this.request}fetchBand(Re,Oe,Ue){const qe=this._mrt;if(!this._isHeaderLoaded||!qe)return void Ue(new Error("Tile header is not ready"));const Ct=this.actor;if(!Ct)return void Ue(new Error("Can't fetch tile band without an actor"));let Ot;const n=(Le,qe)=>{Ot.complete(Le,qe),Le?Ue(Le):(this.updateTextureDescriptor(Re,Oe),Ue(null,this.textureDescriptor&&this.textureDescriptor.img))},l=(Le,Re)=>{if(Le)return Ue(Le);const Oe=Ct.send("decodeRasterArray",{buffer:Re,task:Ot},n,void 0,!0);this._workQueue.push((()=>{Oe&&Oe.cancel(),Ot.cancel()}))},Jt=qe.getLayer(Re);if(!Jt)return void Ue(new Error(`Unknown sourceLayer "${Re}"`));if(Jt.hasDataForBand(Oe))return this.updateTextureDescriptor(Re,Oe),void Ue(null,this.textureDescriptor?this.textureDescriptor.img:null);const _i=Jt.getDataRange([Oe]);if(Ot=qe.createDecodingTask(_i),!Ot||Ot.tasks.length)if(this.flushQueues(),this.entireBuffer)l(null,this.entireBuffer.slice(_i.firstByte,_i.lastByte+1));else{const Re=Object.assign({},this.requestParams,{headers:{Range:`bytes=${_i.firstByte}-${_i.lastByte}`}}),Oe=Le.bc(Re,l);this._fetchQueue.push((()=>{Oe.cancel(),Ot.cancel()}))}else Ue(null)}updateNeeded(Le,Re){return(!this.textureDescriptor||this.textureDescriptor.band!==Re||this.textureDescriptor.layer!==Le)&&"errored"!==this.state}updateTextureDescriptor(Re,Oe){if(!this._mrt)return;const Ue=this._mrt.getLayer(Re);if(!Ue||!Ue.hasBand(Oe)||!Ue.hasDataForBand(Oe))return;const{bytes:qe,tileSize:Ct,buffer:Ot,offset:Jt,scale:_i}=Ue.getBandView(Oe),xi=Ct+2*Ot,vi={data:qe,width:xi,height:xi},bi=this.texture;bi&&bi instanceof Le.T&&bi.update(vi,{premultiply:!1}),this.textureDescriptor={layer:Re,band:Oe,img:vi,buffer:Ot,offset:Jt,tileSize:Ct,format:Ue.pixelFormat,mix:[_i,256*_i,65536*_i,16777216*_i]}}}class ft{constructor(Le,Re){this.max=Le,this.onRemove=Re,this.reset()}reset(){for(const Le in this.data)for(const Re of this.data[Le])Re.timeout&&clearTimeout(Re.timeout),this.onRemove(Re.value);return this.data={},this.order=[],this}add(Le,Re,Oe){const Ue=Le.wrapped().key;void 0===this.data[Ue]&&(this.data[Ue]=[]);const qe={value:Re,timeout:void 0};if(void 0!==Oe&&(qe.timeout=setTimeout((()=>{this.remove(Le,qe)}),Oe)),this.data[Ue].push(qe),this.order.push(Ue),this.order.length>this.max){const Le=this._getAndRemoveByKey(this.order[0]);Le&&this.onRemove(Le)}return this}has(Le){return Le.wrapped().key in this.data}getAndRemove(Le){return this.has(Le)?this._getAndRemoveByKey(Le.wrapped().key):null}_getAndRemoveByKey(Le){const Re=this.data[Le].shift();return Re.timeout&&clearTimeout(Re.timeout),0===this.data[Le].length&&delete this.data[Le],this.order.splice(this.order.indexOf(Le),1),Re.value}getByKey(Le){const Re=this.data[Le];return Re?Re[0].value:null}get(Le){return this.has(Le)?this.data[Le.wrapped().key][0].value:null}remove(Le,Re){if(!this.has(Le))return this;const Oe=Le.wrapped().key,Ue=void 0===Re?0:this.data[Oe].indexOf(Re),qe=this.data[Oe][Ue];return this.data[Oe].splice(Ue,1),qe.timeout&&clearTimeout(qe.timeout),0===this.data[Oe].length&&delete this.data[Oe],this.onRemove(qe.value),this.order.splice(this.order.indexOf(Oe),1),this}setMaxSize(Le){for(this.max=Le;this.order.length>this.max;){const Le=this._getAndRemoveByKey(this.order[0]);Le&&this.onRemove(Le)}return this}filter(Le){const Re=[];for(const Oe in this.data)for(const Ue of this.data[Oe])Le(Ue.value)||Re.push(Ue);for(const Le of Re)this.remove(Le.value.tileID,Le)}}class gt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(Re,Oe,Ue){const qe=String(Oe);if(this.stateChanges[Re]=this.stateChanges[Re]||{},this.stateChanges[Re][qe]=this.stateChanges[Re][qe]||{},Le.l(this.stateChanges[Re][qe],Ue),null===this.deletedStates[Re]){this.deletedStates[Re]={};for(const Le in this.state[Re])Le!==qe&&(this.deletedStates[Re][Le]=null)}else if(this.deletedStates[Re]&&null===this.deletedStates[Re][qe]){this.deletedStates[Re][qe]={};for(const Le in this.state[Re][qe])Ue[Le]||(this.deletedStates[Re][qe][Le]=null)}else for(const Le in Ue)this.deletedStates[Re]&&this.deletedStates[Re][qe]&&null===this.deletedStates[Re][qe][Le]&&delete this.deletedStates[Re][qe][Le]}removeFeatureState(Le,Re,Oe){if(null===this.deletedStates[Le])return;const Ue=String(Re);
1if(this.deletedStates[Le]=this.deletedStates[Le]||{},Oe&&void 0!==Re)null!==this.deletedStates[Le][Ue]&&(this.deletedStates[Le][Ue]=this.deletedStates[Le][Ue]||{},this.deletedStates[Le][Ue][Oe]=null);else if(void 0!==Re)if(this.stateChanges[Le]&&this.stateChanges[Le][Ue])for(Oe in this.deletedStates[Le][Ue]={},this.stateChanges[Le][Ue])this.deletedStates[Le][Ue][Oe]=null;else this.deletedStates[Le][Ue]=null;else this.deletedStates[Le]=null}getState(Re,Oe){const Ue=this.state[Re]||{},qe=this.stateChanges[Re]||{},Ct=this.deletedStates[Re];if(null===Ct)return{};if(void 0!==Oe){const Re=String(Oe),Ot=Le.l({},Ue[Re],qe[Re]);if(Ct){const Le=Ct[Oe];if(null===Le)return{};for(const Re in Le)delete Ot[Re]}return Ot}const Ot=Le.l({},Ue,qe);if(Ct)for(const Le in Ct)delete Ot[Le];return Ot}initializeTileState(Le,Re){Le.setFeatureState(this.state,Re)}coalesceChanges(Re,Oe){const Ue={};for(const Re in this.stateChanges){this.state[Re]=this.state[Re]||{};const Oe={};for(const Ue in this.stateChanges[Re])this.state[Re][Ue]||(this.state[Re][Ue]={}),Le.l(this.state[Re][Ue],this.stateChanges[Re][Ue]),Oe[Ue]=this.state[Re][Ue];Ue[Re]=Oe}for(const Re in this.deletedStates){this.state[Re]=this.state[Re]||{};const Oe={};if(null===this.deletedStates[Re])for(const Le in this.state[Re])Oe[Le]={},this.state[Re][Le]={};else for(const Le in this.deletedStates[Re]){if(null===this.deletedStates[Re][Le])this.state[Re][Le]={};else if(this.state[Re][Le])for(const Oe of Object.keys(this.deletedStates[Re][Le]))delete this.state[Re][Le][Oe];Oe[Le]=this.state[Re][Le]}Ue[Re]=Ue[Re]||{},Le.l(Ue[Re],Oe)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(Ue).length)for(const Le in Re)Re[Le].setFeatureState(Ue,Oe)}}class vt extends Le.E{constructor(Le,Re,Oe){super(),this.id=Le,this._onlySymbols=Oe,Re.on("data",(Le=>{"source"===Le.dataType&&"metadata"===Le.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===Le.dataType&&"content"===Le.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),Re.on("error",(()=>{this._sourceErrored=!0})),this._source=Re,this._tiles={},this._cache=new ft(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=Re.minTileCacheSize,this._maxTileCacheSize=Re.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new gt,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(Le){this.map=Le,this._minTileCacheSize=void 0===this._minTileCacheSize&&Le?Le._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&Le?Le._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const Le in this._tiles){const Re=this._tiles[Le];if("loaded"!==Re.state&&"errored"!==Re.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const Le=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,Le&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(Le,Re){return Le.isSymbolTile=this._onlySymbols,Le.isExtraShadowCaster=this._shadowCasterTiles[Le.tileID.key],this._source.loadTile(Le,Re)}_unloadTile(Le){if(this._source.unloadTile)return this._source.unloadTile(Le)}_abortTile(Le){if(this._source.abortTile)return this._source.abortTile(Le)}serialize(){return this._source.serialize()}prepare(Le){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const Re in this._tiles){const Oe=this._tiles[Re];Oe.upload(Le),Oe.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Le.bd(this._tiles).map((Le=>Le.tileID)).sort(xt).map((Le=>Le.key))}getRenderableIds(Re,Oe){const Ue=[];for(const Le in this._tiles)this._isIdRenderable(+Le,Re,Oe)&&Ue.push(this._tiles[Le]);return Re?Ue.sort(((Re,Oe)=>{const Ue=Re.tileID,qe=Oe.tileID,Ct=new Le.P(Ue.canonical.x,Ue.canonical.y)._rotate(this.transform.angle),Ot=new Le.P(qe.canonical.x,qe.canonical.y)._rotate(this.transform.angle);return Ue.overscaledZ-qe.overscaledZ||Ot.y-Ct.y||Ot.x-Ct.x})).map((Le=>Le.tileID.key)):Ue.map((Le=>Le.tileID)).sort(xt).map((Le=>Le.key))}hasRenderableParent(Le){const Re=this.findLoadedParent(Le,0);return!!Re&&this._isIdRenderable(Re.tileID.key)}_isIdRenderable(Le,Re,Oe){return this._tiles[Le]&&this._tiles[Le].hasData()&&!this._coveredTiles[Le]&&(Re||!this._tiles[Le].holdingForFade())&&(Oe||!this._shadowCasterTiles[Le])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const Le in this._tiles)"errored"!==this._tiles[Le].state&&this._reloadTile(+Le,"reloading")}}_reloadTile(Le,Re){const Oe=this._tiles[Le];Oe&&("loading"!==Oe.state&&(Oe.state=Re),this._loadTile(Oe,this._tileLoaded.bind(this,Oe,Le,Re)))}_tileLoaded(Re,Oe,Ue,qe){if(qe)if(Re.state="errored",404!==qe.status)this._source.fire(new Le.t(qe,{tile:Re}));else{if(this._source.fire(new Le.x("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:Re})),!(Re.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const Le=this.map.painter.terrain;this.update(this.transform,Le.getScaledDemTileSize(),!0),Le.resetTileLookupCache(this.id
vendor: 4,547 bytes, line 1
1)}else this.update(this.transform)}else Re.timeAdded=Le.q.now(),"expired"===Ue&&(Re.refreshedUponExpiration=!0),this._setTileReloadTimer(Oe,Re),"raster-dem"===this._source.type&&Re.dem&&this._backfillDEM(Re),this._state.initializeTileState(Re,this.map?this.map.painter:null),this._source.fire(new Le.x("data",{dataType:"source",tile:Re,coord:Re.tileID,sourceCacheId:this.id}))}_backfillDEM(Le){const Re=this.getRenderableIds();for(let Oe=0;Oe<Re.length;Oe++){const Ue=Re[Oe];if(Le.neighboringTiles&&Le.neighboringTiles[Ue]){const Re=this.getTileByID(Ue);i(Le,Re),i(Re,Le)}}function i(Le,Re){if(!Le.dem||Le.dem.borderReady)return;Le.needsHillshadePrepare=!0,Le.needsDEMTextureUpload=!0;let Oe=Re.tileID.canonical.x-Le.tileID.canonical.x;const Ue=Re.tileID.canonical.y-Le.tileID.canonical.y,qe=Math.pow(2,Le.tileID.canonical.z),Ct=Re.tileID.key;0===Oe&&0===Ue||Math.abs(Ue)>1||(Math.abs(Oe)>1&&(1===Math.abs(Oe+qe)?Oe+=qe:1===Math.abs(Oe-qe)&&(Oe-=qe)),Re.dem&&Le.dem&&(Le.dem.backfillBorder(Re.dem,Oe,Ue),Le.neighboringTiles&&Le.neighboringTiles[Ct]&&(Le.neighboringTiles[Ct].backfilled=!0)))}}getTile(Le){return this.getTileByID(Le.key)}getTileByID(Le){return this._tiles[Le]}_retainLoadedChildren(Le,Re,Oe,Ue){for(const qe in this._tiles){let Ct=this._tiles[qe];if(Ue[qe]||!Ct.hasData()||Ct.tileID.overscaledZ<=Re||Ct.tileID.overscaledZ>Oe)continue;let Ot=Ct.tileID;for(;Ct&&Ct.tileID.overscaledZ>Re+1;){const Le=Ct.tileID.scaledTo(Ct.tileID.overscaledZ-1);Ct=this._tiles[Le.key],Ct&&Ct.hasData()&&(Ot=Le)}let Jt=Ot;for(;Jt.overscaledZ>Re;)if(Jt=Jt.scaledTo(Jt.overscaledZ-1),Le[Jt.key]){Ue[Ot.key]=Ot;break}}}findLoadedParent(Le,Re){if(Le.key in this._loadedParentTiles){const Oe=this._loadedParentTiles[Le.key];return Oe&&Oe.tileID.overscaledZ>=Re?Oe:null}for(let Oe=Le.overscaledZ-1;Oe>=Re;Oe--){const Re=Le.scaledTo(Oe),Ue=this._getLoadedTile(Re);if(Ue)return Ue}}_getLoadedTile(Le){const Re=this._tiles[Le.key];return Re&&Re.hasData()?Re:this._cache.getByKey(this._source.reparseOverscaled?Le.wrapped().key:Le.canonical.key)}updateCacheSize(Le,Re){Re=Re||this._source.tileSize;const Oe=Math.ceil(Le.width/Re)+1,Ue=Math.ceil(Le.height/Re)+1,qe=Math.floor(Oe*Ue*5),Ct="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,qe):qe,Ot="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,Ct):Ct;this._cache.setMaxSize(Ot)}handleWrapJump(Le){const Re=Math.round((Le-(void 0===this._prevLng?Le:this._prevLng))/360);if(this._prevLng=Le,Re){const Le={};for(const Oe in this._tiles){const Ue=this._tiles[Oe];Ue.tileID=Ue.tileID.unwrapTo(Ue.tileID.wrap+Re),Le[Ue.tileID.key]=Ue}this._tiles=Le;for(const Le in this._timers)clearTimeout(this._timers[Le]),delete this._timers[Le];for(const Le in this._tiles)this._setTileReloadTimer(+Le,this._tiles[Le])}}update(Re,Oe,Ue,qe){if(this.transform=Re,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!Ue)return;this.updateCacheSize(Re,Oe),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const Ct="batched-model"===this._source.type;let Ot;if(this.used||this.usedForTerrain){if(this._source.tileID)Ot=Re.getVisibleUnwrappedCoordinates(this._source.tileID).map((Re=>new Le.aA(Re.canonical.z,Re.wrap,Re.canonical.z,Re.canonical.x,Re.canonical.y)));else if(0!==this.tileCoverLift){const qe=Re.clone();qe.tileCoverLift=this.tileCoverLift,Ot=qe.coveringTiles({tileSize:Oe||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!Ue,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:Ct}),this._source.minzoom<=1&&"globe"===Re.projection.name&&(Ot.push(new Le.aA(1,0,1,0,0)),Ot.push(new Le.aA(1,0,1,1,0)),Ot.push(new Le.aA(1,0,1,0,1)),Ot.push(new Le.aA(1,0,1,1,1)))}else if(Ot=Re.coveringTiles({tileSize:Oe||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!Ue,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:Ct}),this._source.hasTile){const Le=this._source.hasTile.bind(this._source);Ot=Ot.filter((Re=>Le(Re)))}}else Ot=[];if(Ot.length>0&&this.castsShadows&&qe&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!yt(this._source.type)){const Le=Re.coveringZoomLevel({tileSize:Oe||this._source.tileSize,roundZoom:this._source.roundZoom&&!Ue}),Jt=Math.min(Le,this._source.maxzoom);
vendor: 4,619 bytes, line 1
1if(Ct){const Le=Re.extendTileCover(Ot,Jt);for(const Re of Le)Ot.push(Re)}else{const Le=Re.extendTileCover(Ot,Jt,qe);for(const Re of Le)this._shadowCasterTiles[Re.key]=!0,Ot.push(Re)}}const Jt=this._updateRetainedTiles(Ot);if(yt(this._source.type)&&0!==Ot.length){const Re={},Oe={},Ue=Object.keys(Jt);for(const qe of Ue){const Ue=Jt[qe],Ct=this._tiles[qe];if(!Ct||Ct.fadeEndTime&&Ct.fadeEndTime<=Le.q.now())continue;const Ot=this.findLoadedParent(Ue,Math.max(Ue.overscaledZ-vt.maxOverzooming,this._source.minzoom));Ot&&(this._addTile(Ot.tileID),Re[Ot.tileID.key]=Ot.tileID),Oe[qe]=Ue}const qe=Ot[Ot.length-1].overscaledZ;for(const Le in this._tiles){const Re=this._tiles[Le];if(Jt[Le]||!Re.hasData())continue;let Ue=Re.tileID;for(;Ue.overscaledZ>qe;){Ue=Ue.scaledTo(Ue.overscaledZ-1);const qe=this._tiles[Ue.key];if(qe&&qe.hasData()&&Oe[Ue.key]){Jt[Le]=Re.tileID;break}}}for(const Le in Re)Jt[Le]||(this._coveredTiles[Le]=!0,Jt[Le]=Re[Le])}for(const Le in Jt)this._tiles[Le].clearFadeHold();const _i=Le.be(this._tiles,Jt);for(const Le of _i){const Re=this._tiles[Le];Re.hasSymbolBuckets&&!Re.holdingForFade()?Re.setHoldDuration(this.map._fadeDuration):Re.hasSymbolBuckets&&!Re.symbolFadeFinished()||this._removeTile(+Le)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const Le in this._tiles)this._tiles[Le].holdingForFade()&&this._removeTile(+Le)}_updateRetainedTiles(Le){const Re={};if(0===Le.length)return Re;const Oe={},Ue=Le.reduce(((Le,Re)=>Math.min(Le,Re.overscaledZ)),1/0),qe=Le[0].overscaledZ,Ct=Math.max(qe-vt.maxOverzooming,this._source.minzoom),Ot=Math.max(qe+vt.maxUnderzooming,this._source.minzoom),Jt={};for(const Oe of Le){const Le=this._addTile(Oe);Re[Oe.key]=Oe,Le.hasData()||Ue<this._source.maxzoom&&(Jt[Oe.key]=Oe)}this._retainLoadedChildren(Jt,Ue,Ot,Re);for(const Ue of Le){let Le=this._tiles[Ue.key];if(Le.hasData())continue;if(Ue.canonical.z>=this._source.maxzoom){const Le=Ue.children(this._source.maxzoom)[0],Oe=this.getTile(Le);if(Oe&&Oe.hasData()){Re[Le.key]=Le;continue}}else{const Le=Ue.children(this._source.maxzoom);if(Re[Le[0].key]&&Re[Le[1].key]&&Re[Le[2].key]&&Re[Le[3].key])continue}let qe=Le.wasRequested();for(let Ot=Ue.overscaledZ-1;Ot>=Ct;--Ot){const Ct=Ue.scaledTo(Ot);if(Oe[Ct.key])break;if(Oe[Ct.key]=!0,Le=this.getTile(Ct),!Le&&qe&&(Le=this._addTile(Ct)),Le&&(Re[Ct.key]=Ct,qe=Le.wasRequested(),Le.hasData()))break}}return Re}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const Le in this._tiles){const Re=[];let Oe,Ue=this._tiles[Le].tileID;for(;Ue.overscaledZ>0;){if(Ue.key in this._loadedParentTiles){Oe=this._loadedParentTiles[Ue.key];break}Re.push(Ue.key);const Le=Ue.scaledTo(Ue.overscaledZ-1);if(Oe=this._getLoadedTile(Le),Oe)break;Ue=Le}for(const Le of Re)this._loadedParentTiles[Le]=Oe}}_addTile(Re){let Oe=this._tiles[Re.key];if(Oe)return!0!==Oe.isExtraShadowCaster||!!this._shadowCasterTiles[Re.key]||this._reloadTile(Re.key,"reloading"),Oe;Oe=this._cache.getAndRemove(Re),Oe&&(this._setTileReloadTimer(Re.key,Oe),Oe.tileID=Re,this._state.initializeTileState(Oe,this.map?this.map.painter:null),this._cacheTimers[Re.key]&&(clearTimeout(this._cacheTimers[Re.key]),delete this._cacheTimers[Re.key],this._setTileReloadTimer(Re.key,Oe)));const Ue=Boolean(Oe);if(!Ue){const Le=this.map?this.map.painter:null,Ue=this._source.tileSize*Re.overscaleFactor();Oe="raster-array"===this._source.type?new mt(Re,Ue,this.transform.tileZoom,Le,this._isRaster):new pt(Re,Ue,this.transform.tileZoom,Le,this._isRaster),this._loadTile(Oe,this._tileLoaded.bind(this,Oe,Re.key,Oe.state))}return Oe?(Oe.uses++,this._tiles[Re.key]=Oe,Ue||this._source.fire(new Le.x("dataloading",{tile:Oe,coord:Oe.tileID,dataType:"source"})),Oe):null}_setTileReloadTimer(Le,Re){Le in this._timers&&(clearTimeout(this._timers[Le]),delete this._timers[Le]);const Oe=Re.getExpiryTimeout();Oe&&(this._timers[Le]=setTimeout((()=>{this._reloadTile(Le,"expired"),delete this._timers[Le]}),Oe))}_removeTile(Le){const Re=this._tiles[Le];Re&&(Re.uses--,delete this._tiles[Le],this._timers[Le]&&(clearTimeout(this._timers[Le]),delete this._timers[Le]),Re.uses>0||(Re.hasData()&&"reloading"!==Re.state||"empty"===Re.state?this._cache.add(Re.tileID,Re,Re.getExpiryTimeout()):(Re.aborted=!0,this._abortTile(Re),this._unloadTile(Re))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const Le in this._tiles)this._removeTile(+Le);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
1)}tilesIn(Re,Oe,Ue){const qe=[],Ct=this.transform;if(!Ct)return qe;const Ot="globe"===Ct.projection.name,Jt=Le.am(Ct.center.lng);for(const _i in this._tiles){const xi=this._tiles[_i];if(Ue&&xi.clearQueryDebugViz(),xi.holdingForFade())continue;let vi;if(Ot){const Re=xi.tileID.canonical;if(0===Re.z){const Oe=[Math.abs(Le.ap(Jt,...bt(Re,-1))-Jt),Math.abs(Le.ap(Jt,...bt(Re,1))-Jt)];vi=[0,2*Oe.indexOf(Math.min(...Oe))-1]}else{const Oe=[Math.abs(Le.ap(Jt,...bt(Re,-1))-Jt),Math.abs(Le.ap(Jt,...bt(Re,0))-Jt),Math.abs(Le.ap(Jt,...bt(Re,1))-Jt)];vi=[Oe.indexOf(Math.min(...Oe))-1]}}else vi=[0];for(const Le of vi){const Ue=Re.containsTile(xi,Ct,Oe,Le);Ue&&qe.push(Ue)}}return qe}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(Le){return this._getRenderableCoordinates(Le)}_getRenderableCoordinates(Le,Re){const Oe=this.getRenderableIds(Le,Re).map((Le=>this._tiles[Le].tileID)),Ue="globe"===this.transform.projection.name;for(const Le of Oe)Le.projMatrix=this.transform.calculateProjMatrix(Le.toUnwrapped()),Le.expandedProjMatrix=Ue?this.transform.calculateProjMatrix(Le.toUnwrapped(),!1,!0):Le.projMatrix;return Oe}sortCoordinatesByDistance(Le){const Re=Le.slice(),Oe=this.transform._camera.position,Ue=this.transform._camera.forward(),qe={};for(const Le of Re){const Re=1/(1<<Le.canonical.z);qe[Le.key]=((Le.canonical.x+.5)*Re+Le.wrap-Oe[0])*Ue[0]+((Le.canonical.y+.5)*Re-Oe[1])*Ue[1]-Oe[2]*Ue[2]}return Re.sort(((Le,Re)=>qe[Le.key]-qe[Re.key])),Re}hasTransition(){if(this._source.hasTransition())return!0;if(yt(this._source.type))for(const Re in this._tiles){const Oe=this._tiles[Re];if(void 0!==Oe.fadeEndTime&&Oe.fadeEndTime>=Le.q.now())return!0}return!1}setFeatureState(Le,Re,Oe){this._state.updateState(Le=Le||"_geojsonTileLayer",Re,Oe)}removeFeatureState(Le,Re,Oe){this._state.removeFeatureState(Le=Le||"_geojsonTileLayer",Re,Oe)}getFeatureState(Le,Re){return this._state.getState(Le=Le||"_geojsonTileLayer",Re)}
1setDependencies(Le,Re,Oe){const Ue=this._tiles[Le];Ue&&Ue.setDependencies(Re,Oe)}reloadTilesForDependencies(Le,Re){for(const Oe in this._tiles)this._tiles[Oe].hasDependency(Le,Re)&&this._reloadTile(+Oe,"reloading");this._cache.filter((Oe=>!Oe.hasDependency(Le,Re)))}_preloadTiles(Re,Oe){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(Re,Oe))};return void this._source.on("data",e)}const Ue=new Map,qe=Array.isArray(Re)?Re:[Re],Ct=this.map.painter.terrain,Ot=this.usedForTerrain&&Ct?Ct.getScaledDemTileSize():this._source.tileSize;for(const Le of qe){const Re=Le.coveringTiles({tileSize:Ot,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const Le of Re)Ue.set(Le.key,Le);this.usedForTerrain&&Le.updateElevation(!1)}const Jt=Array.from(Ue.values());Le.bf(Jt,((Le,Re)=>{const Oe=new pt(Le,this._source.tileSize*Le.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(Oe,(Le=>{"raster-dem"===this._source.type&&Oe.dem&&this._backfillDEM(Oe),Re(Le,Oe)}))}),Oe)}}function xt(Le,Re){const Oe=Math.abs(2*Le.wrap)-+(Le.wrap<0),Ue=Math.abs(2*Re.wrap)-+(Re.wrap<0);return Le.overscaledZ-Re.overscaledZ||Ue-Oe||Re.canonical.y-Le.canonical.y||Re.canonical.x-Le.canonical.x}function yt(Le){return"raster"===Le||"image"===Le||"video"===Le||"custom"===Le}function bt(Le,Re){const Oe=1<<Le.z;return[Le.x/Oe+Re,(Le.x+1)/Oe+Re]}vt.maxOverzooming=10,vt.maxUnderzooming=3;class wt{constructor(Le){this.style=Le,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const Le=!1,Re=!1;for(const Oe in this.style._mergedLayers){const Ue=this.style._mergedLayers[Oe];if("fill-extrusion"===Ue.type)this.layers.push({layer:Ue,visible:Le,visibilityChanged:Re});else if("model"===Ue.type){const Oe=this.style.getLayerSource(Ue);Oe&&"batched-model"===Oe.type&&this.layers.push({layer:Ue,visible:Le,visibilityChanged:Re})}}}onNewFrame(Le){this.layersGotHidden=!1;for(const Re of this.layers){const Oe=Re.layer;let Ue=!1;"fill-extrusion"===Oe.type?Ue=!Oe.isHidden(Le)&&Oe.paint.get("fill-extrusion-opacity")>0:"model"===Oe.type&&(Ue=!Oe.isHidden(Le)&&Oe.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!Ue&&Re.visible,Re.visible=Ue}}updateZOffset(Le,Re){this.currentBuildingBuckets=[];for(const Le of this.layers){const Oe=Le.layer,Ue=this.style.getLayerSourceCache(Oe);let qe=1;"fill-extrusion"===Oe.type&&(qe=Le.visible?Oe.paint.get("fill-extrusion-vertical-scale"):0);let Ct=Ue?Ue.getTile(Re):null;if(!Ct&&Ue&&Re.canonical.z>Ue.getSource().minzoom){let Le=Re.scaledTo(Math.min(Ue.getSource().maxzoom,Re.overscaledZ-1));for(;Le.overscaledZ>=Ue.getSource().minzoom&&(Ct=Ue.getTile(Le),!Ct&&0!==Le.overscaledZ);)Le=Le.scaledTo(Le.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:Ct?Ct.getBucket(Oe):null,tileID:Ct?Ct.tileID:Re,verticalScale:qe})}Le.hasAnyZOffset=!1;let Oe=!1;for(let Ue=0;Ue<Le.symbolInstances.length;Ue++){const qe=Le.symbolInstances.get(Ue),Ct=qe.zOffset,Ot=this._getHeightAtTileOffset(Re,qe.tileAnchorX,qe.tileAnchorY);qe.zOffset=Ot!==Number.NEGATIVE_INFINITY?Ot:Ct,Oe||Ct===qe.zOffset||(Oe=!0),Le.hasAnyZOffset||0===qe.zOffset||(Le.hasAnyZOffset=!0)}Oe&&(Le.zOffsetBuffersNeedUpload=!0,Le.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(Re,Oe,Ue,qe){let Ct=Oe,Ot=Ue;if(Re.canonical.z!==qe.canonical.z){const Jt=qe.canonical,_i=1/(1<<Re.canonical.z-Jt.z);Ct=(Oe+Re.canonical.x*Le.ab)*_i-Jt.x*Le.ab|0,Ot=(Ue+Re.canonical.y*Le.ab)*_i-Jt.y*Le.ab|0}return{tileX:Ct,tileY:Ot}}_getHeightAtTileOffset(Le,Re,Oe){let Ue,qe;for(let Ct=0;Ct<this.layers.length;++Ct){if("fill-extrusion"!==this.layers[Ct].layer.type)continue;const{bucket:Ot,tileID:Jt,verticalScale:_i}=this.currentBuildingBuckets[Ct];if(!Ot)continue;const{tileX:xi,tileY:vi}=this._mapCoordToOverlappingTile(Le,Re,Oe,Jt),bi=Ot.getHeightAtTileCoord(xi,vi);bi&&void 0!==bi.height&&(bi.hidden?Ue=bi.height:qe=Math.max(bi.height*_i,qe||0))}if(void 0!==qe)return qe;
vendor: 7,971 bytes, line 1
1for(let qe=0;qe<this.layers.length;++qe){const Ct=this.layers[qe];if("model"!==Ct.layer.type||!Ct.visible)continue;const{bucket:Ot,tileID:Jt}=this.currentBuildingBuckets[qe];if(!Ot)continue;const{tileX:_i,tileY:xi}=this._mapCoordToOverlappingTile(Le,Re,Oe,Jt),vi=Ot.getHeightAtTileCoord(_i,xi);if(vi&&!vi.hidden)return void 0===vi.height&&void 0!==Ue?Math.min(vi.maxHeight,Ue)*vi.verticalScale:vi.height?vi.height*vi.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Tt(Re,Oe){const Ue={};for(const Le in Re)"ref"!==Le&&(Ue[Le]=Re[Le]);return Le.bg.forEach((Le=>{Le in Oe&&(Ue[Le]=Oe[Le])})),Ue}function Et(Le){Le=Le.slice();const Re=Object.create(null);for(let Oe=0;Oe<Le.length;Oe++)Re[Le[Oe].id]=Le[Oe];for(let Oe=0;Oe<Le.length;Oe++)"ref"in Le[Oe]&&(Le[Oe]=Tt(Le[Oe],Re[Le[Oe].ref]));return Le}const Kl={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function St(Le,Re,Oe){Oe.push({command:Kl.addSource,args:[Le,Re[Le]]})}function It(Le,Re,Oe){Re.push({command:Kl.removeSource,args:[Le]}),Oe[Le]=!0}function Dt(Le,Re,Oe,Ue){It(Le,Oe,Ue),St(Le,Re,Oe)}function Rt(Re,Oe,Ue){let qe;for(qe in Re[Ue])if(Re[Ue].hasOwnProperty(qe)&&"data"!==qe&&!Le.bh(Re[Ue][qe],Oe[Ue][qe]))return!1;for(qe in Oe[Ue])if(Oe[Ue].hasOwnProperty(qe)&&"data"!==qe&&!Le.bh(Re[Ue][qe],Oe[Ue][qe]))return!1;return!0}function At(Re,Oe,Ue,qe,Ct,Ot){let Jt;for(Jt in Oe=Oe||{},Re=Re||{})Re.hasOwnProperty(Jt)&&(Le.bh(Re[Jt],Oe[Jt])||Ue.push({command:Ot,args:[qe,Jt,Oe[Jt],Ct]}));for(Jt in Oe)Oe.hasOwnProperty(Jt)&&!Re.hasOwnProperty(Jt)&&(Le.bh(Re[Jt],Oe[Jt])||Ue.push({command:Ot,args:[qe,Jt,Oe[Jt],Ct]}))}function Lt(Le){return Le.id}function Pt(Le,Re){return Le[Re.id]=Re,Le}class Mt{constructor(Le,Re){this.reset(Le,Re)}reset(Le,Re){this.points=Le||[],this._distances=[0];for(let Le=1;Le<this.points.length;Le++)this._distances[Le]=this._distances[Le-1]+this.points[Le].dist(this.points[Le-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(Re||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(Re){if(1===this.points.length)return this.points[0];Re=Le.ap(Re,0,1);let Oe=1,Ue=this._distances[Oe];const qe=Re*this.paddedLength+this.padding;for(;Ue<qe&&Oe<this._distances.length;)Ue=this._distances[++Oe];const Ct=Oe-1,Ot=this._distances[Ct],Jt=Ue-Ot,_i=Jt>0?(qe-Ot)/Jt:0;return this.points[Ct].mult(1-_i).add(this.points[Oe].mult(_i))}}class zt{constructor(Le,Re,Oe){const Ue=this.boxCells=[],qe=this.circleCells=[];this.xCellCount=Math.ceil(Le/Oe),this.yCellCount=Math.ceil(Re/Oe);for(let Le=0;Le<this.xCellCount*this.yCellCount;Le++)Ue.push([]),qe.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=Le,this.height=Re,this.xScale=this.xCellCount/Le,this.yScale=this.yCellCount/Re,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(Le,Re,Oe,Ue,qe){this._forEachCell(Re,Oe,Ue,qe,this._insertBoxCell,this.boxUid++),this.boxKeys.push(Le),this.bboxes.push(Re),this.bboxes.push(Oe),this.bboxes.push(Ue),this.bboxes.push(qe)}insertCircle(Le,Re,Oe,Ue){this._forEachCell(Re-Ue,Oe-Ue,Re+Ue,Oe+Ue,this._insertCircleCell,this.circleUid++),this.circleKeys.push(Le),this.circles.push(Re),this.circles.push(Oe),this.circles.push(Ue)}_insertBoxCell(Le,Re,Oe,Ue,qe,Ct){this.boxCells[qe].push(Ct)}_insertCircleCell(Le,Re,Oe,Ue,qe,Ct){this.circleCells[qe].push(Ct)}_query(Le,Re,Oe,Ue,qe,Ct){if(Oe<0||Le>this.width||Ue<0||Re>this.height)return!qe&&[];const Ot=[];if(Le<=0&&Re<=0&&this.width<=Oe&&this.height<=Ue){if(qe)return!0;for(let Le=0;Le<this.boxKeys.length;Le++)Ot.push({key:this.boxKeys[Le],x1:this.bboxes[4*Le],y1:this.bboxes[4*Le+1],x2:this.bboxes[4*Le+2],y2:this.bboxes[4*Le+3]});for(let Le=0;Le<this.circleKeys.length;Le++){const Re=this.circles[3*Le],Oe=this.circles[3*Le+1],Ue=this.circles[3*Le+2];Ot.push({key:this.circleKeys[Le],x1:Re-Ue,y1:Oe-Ue,x2:Re+Ue,y2:Oe+Ue})}return Ct?Ot.filter(Ct):Ot}return this._forEachCell(Le,Re,Oe,Ue,this._queryCell,Ot,{hitTest:qe,seenUids:{box:{},circle:{}}},Ct),qe?Ot.length>0:Ot}_queryCircle(Le,Re,Oe,Ue,qe){const Ct=Le-Oe,Ot=Le+Oe,Jt=Re-Oe,_i=Re+Oe;if(Ot<0||Ct>this.width||_i<0||Jt>this.height)return!Ue&&[];const xi=[];return this._forEachCell(Ct,Jt,Ot,_i,this._queryCellCircle,xi,{hitTest:Ue,circle:{x:Le,y:Re,radius:Oe},seenUids:{box:{},circle:{}}},qe),Ue?xi.length>0:xi}query(Le,Re,Oe,Ue,qe){return this._query(Le,Re,Oe,Ue,!1,qe)}hitTest(Le,Re,Oe,Ue,qe){return this._query(Le,Re,Oe,Ue,!0,qe)}hitTestCircle(Le,Re,Oe,Ue){return this._queryCircle(Le,Re,Oe,!0,Ue)}_queryCell(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Ot.seenUids,xi=this.boxCells[qe];if(null!==xi){const qe=this.bboxes;for(const vi of xi)if(!_i.box[vi]){_i.box[vi]=!0;const xi=4*vi;if(Le<=qe[xi+2]&&Re<=qe[xi+3]&&Oe>=qe[xi+0]&&Ue>=qe[xi+1]&&(!Jt||Jt(this.boxKeys[vi]))){if(Ot.hitTest)return Ct.push(!0),!0;Ct.push({key:this.boxKeys[vi],x1:qe[xi],y1:qe[xi+1],x2:qe[xi+2],y2:qe[xi+3]})}}}const vi=this.circleCells[qe];if(null!==vi){const qe=this.circles;for(const xi of vi)if(!_i.circle[xi]){_i.circle[xi]=!0;const vi=3*xi;if(this._circleAndRectCollide(qe[vi],qe[vi+1],qe[vi+2],Le,Re,Oe,Ue)&&(!Jt||Jt(this.circleKeys[xi]))){if(Ot.hitTest)return Ct.push(!0),!0;{const Le=qe[vi],Re=qe[vi+1],Oe=qe[vi+2];Ct.push({key:this.circleKeys[xi],x1:Le-Oe,y1:Re-Oe,x2:Le+Oe,y2:Re+Oe})}}}}}_queryCellCircle(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Ot.circle,xi=Ot.seenUids,vi=this.boxCells[qe];if(null!==vi){const Le=this.bboxes;for(const Re of vi)if(!xi.box[Re]){xi.box[Re]=!0;const Oe=4*Re;if(this._circleAndRectCollide(_i.x,_i.y,_i.radius,Le[Oe+0],Le[Oe+1],Le[Oe+2],Le[Oe+3])&&(!Jt||Jt(this.boxKeys[Re])))return Ct.push(!0),!0}}const bi=this.circleCells[qe];if(null!==bi){const Le=this.circles;for(const Re of bi)if(!xi.circle[Re]){xi.circle[Re]=!0;const Oe=3*Re;if(this._circlesCollide(Le[Oe],Le[Oe+1],Le[Oe+2],_i.x,_i.y,_i.radius)&&(!Jt||Jt(this.circleKeys[Re])))return Ct.push(!0),!0}}}_forEachCell(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=this._convertToXCellCoord(Le),xi=this._convertToYCellCoord(Re),vi=this._convertToXCellCoord(Oe),bi=this._convertToYCellCoord(Ue);for(let Pi=_i;Pi<=vi;Pi++)for(let _i=xi;_i<=bi;_i++)if(qe.call(this,Le,Re,Oe,Ue,this.xCellCount*_i+Pi,Ct,Ot,Jt))return}_convertToXCellCoord(Le){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(Le*this.xScale)))}_convertToYCellCoord(Le){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(Le*this.yScale)))}_circlesCollide(Le,Re,Oe,Ue,qe,Ct){const Ot=Ue-Le,Jt=qe-Re,_i=Oe+Ct;return _i*_i>Ot*Ot+Jt*Jt}_circleAndRectCollide(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=(Ct-Ue)/2,_i=Math.abs(Le-(Ue+Jt));if(_i>Jt+Oe)return!1;const xi=(Ot-qe)/2,vi=Math.abs(Re-(qe+xi));if(vi>xi+Oe)return!1;if(_i<=Jt||vi<=xi)return!0;const bi=_i-Jt,Pi=vi-xi;return bi*bi+Pi*Pi<=Oe*Oe}}const Ql={unknown:0,flipRequired:1,flipNotRequired:2},oc=Math.tan(85*Math.PI/180);function kt(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Le.a6.mat4.create();if(Ue)if("globe"===Ot.name){const Re=Le.bi(Ct,Oe);Le.a6.mat4.multiply(_i,_i,Re)}else{const Re=Le.a6.mat2.invert([],Jt);_i[0]=Re[0],_i[1]=Re[1],_i[4]=Re[2],_i[5]=Re[3],qe||Le.a6.mat4.rotateZ(_i,_i,Ct.angle)}else Le.a6.mat4.multiply(_i,Ct.labelPlaneMatrix,Re);return _i}function Bt(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=kt(Le,Re,Oe,Ue,qe,Ct,Ot);return"globe"===Ct.name&&Oe||(Jt[2]=Jt[6]=Jt[10]=Jt[14]=0),Jt}
1function Nt(Re,Oe,Ue,qe,Ct,Ot,Jt){if(Ue){if("globe"===Ot.name){const _i=kt(Re,Oe,Ue,qe,Ct,Ot,Jt);return Le.a6.mat4.invert(_i,_i),Le.a6.mat4.multiply(_i,Re,_i),_i}{const Oe=Le.a6.mat4.clone(Re),Ue=Le.a6.mat4.identity([]);return Ue[0]=Jt[0],Ue[1]=Jt[1],Ue[4]=Jt[2],Ue[5]=Jt[3],Le.a6.mat4.multiply(Oe,Oe,Ue),qe||Le.a6.mat4.rotateZ(Oe,Oe,-Ct.angle),Oe}}return Ct.glCoordMatrix}function Ut(Re,Oe,Ue,qe){const Ct=[Re,Oe,Ue,1];Ue?Le.a6.vec4.transformMat4(Ct,Ct,qe):Kt(Ct,Ct,qe);const Ot=Ct[3];return Ct[0]/=Ot,Ct[1]/=Ot,Ct[2]/=Ot,Ct}function Gt(Le,Re){return Math.min(.5+Le/Re*.5,1.5)}function jt(Le,Re){const Oe=Le[0]/Le[3],Ue=Le[1]/Le[3];return Oe>=-Re[0]&&Oe<=Re[0]&&Ue>=-Re[1]&&Ue<=Re[1]}function Vt(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi){const bi=Ue.transform,Pi=qe?Re.textSizeData:Re.iconSizeData,Hr=Le.bj(Pi,Ue.transform.zoom),Jr="globe"===bi.projection.name,Ln=[256/Ue.width*2+1,256/Ue.height*2+1],Nn=qe?Re.text.dynamicLayoutVertexArray:Re.icon.dynamicLayoutVertexArray;Nn.clear();let Gn=null;Jr&&(Gn=qe?Re.text.globeExtVertexArray:Re.icon.globeExtVertexArray);const qn=Re.lineVertexArray,Zn=qe?Re.text.placedSymbolArray:Re.icon.placedSymbolArray,$n=Ue.transform.width/Ue.transform.height;let Xn,Yn=!1;for(let qe=0;qe<Zn.length;qe++){const Jr=Zn.get(qe),{numGlyphs:lo,writingMode:uo}=Jr;if(uo!==Le.bk.vertical||Yn||Xn===Le.bk.horizontal||(Yn=!0),Xn=uo,(Jr.hidden||uo===Le.bk.vertical)&&!Yn){Yt(lo,Nn);continue}Yn=!1;const po=new Le.P(Jr.tileAnchorX,Jr.tileAnchorY);let{x:fo,y:Io,z:is}=bi.projection.projectTilePoint(po.x,po.y,vi.canonical);if(xi){const[Le,Re,Oe]=xi(po);fo+=Le,Io+=Re,is+=Oe}const as=[fo,Io,is,1];if(Le.a6.vec4.transformMat4(as,as,Oe),!jt(as,Ln)){Yt(lo,Nn);continue}const Is=as[3],Xs=Gt(Ue.transform.getCameraToCenterDistance(bi.projection),Is),ta=Le.bl(Pi,Hr,Jr),ha=Jt?ta/Xs:ta*Xs,el=Ut(fo,Io,is,Ct);if(el[3]<=0){Yt(lo,Nn);continue}let tl={};const il=Jt?null:xi,sl=Ht(Jr,ha,!1,_i,Oe,Ct,Ot,Re.glyphOffsetArray,qn,Nn,Gn,el,po,tl,$n,il,bi.projection,vi,Jt);Yn=sl.useVertical,il&&sl.needsFlipping&&(tl={}),(sl.notEnoughRoom||Yn||sl.needsFlipping&&Ht(Jr,ha,!0,_i,Oe,Ct,Ot,Re.glyphOffsetArray,qn,Nn,Gn,el,po,tl,$n,il,bi.projection,vi,Jt).notEnoughRoom)&&Yt(lo,Nn)}qe?(Re.text.dynamicLayoutVertexBuffer.updateData(Nn),Gn&&Re.text.globeExtVertexBuffer&&Re.text.globeExtVertexBuffer.updateData(Gn)):(Re.icon.dynamicLayoutVertexBuffer.updateData(Nn),Gn&&Re.icon.globeExtVertexBuffer&&Re.icon.globeExtVertexBuffer.updateData(Gn))}function qt(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln){const{lineStartIndex:Nn,glyphStartIndex:Gn,segment:qn}=Jt,Zn=Gn+Jt.numGlyphs,$n=Nn+Jt.lineLength,Xn=Re.getoffsetX(Gn),Yn=Re.getoffsetX(Zn-1),lo=Xt(Le*Xn,Oe,Ue,qe,Ct,Ot,qn,Nn,$n,_i,xi,vi,bi,Pi,!0,Hr,Jr,Ln);if(!lo)return null;const uo=Xt(Le*Yn,Oe,Ue,qe,Ct,Ot,qn,Nn,$n,_i,xi,vi,bi,Pi,!0,Hr,Jr,Ln);return uo?{first:lo,last:uo}:null}function Zt(Re,Oe,Ue,qe){return Re===Le.bk.horizontal&&Math.abs(qe)>Math.abs(Ue)?{useVertical:!0}:Re===Le.bk.vertical?qe>0?{needsFlipping:!0}:null:Oe!==Ql.unknown&&function(Le,Re){return 0===Le||Math.abs(Re/Le)>oc}(Ue,qe)?Oe===Ql.flipRequired?{needsFlipping:!0}:null:Ue<0?{needsFlipping:!0}:null}function Ht(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn){const $n=Oe/24,Xn=Re.lineOffsetX*$n,Yn=Re.lineOffsetY*$n,{lineStartIndex:lo,glyphStartIndex:uo,numGlyphs:po,segment:fo,writingMode:Io,flipState:is}=Re,as=lo+Re.lineLength,A=Re=>{if(bi){const[Oe,Ue,qe]=Re.up,Ct=vi.length;Le.bm(bi,Ct+0,Oe,Ue,qe),Le.bm(bi,Ct+1,Oe,Ue,qe),Le.bm(bi,Ct+2,Oe,Ue,qe),Le.bm(bi,Ct+3,Oe,Ue,qe)}const[Oe,Ue,qe]=Re.point;Le.bn(vi,Oe,Ue,qe,Re.angle)};if(po>1){const Le=qt($n,_i,Xn,Yn,Ue,Pi,Hr,Re,xi,Ot,Jr,Nn,!1,Gn,qn,Zn);if(!Le)return{notEnoughRoom:!0};if(qe&&!Ue){let[Oe,Ue,qe]=Le.first.point,[Ct,Ot,_i]=Le.last.point;[Oe,Ue]=Ut(Oe,Ue,qe,Jt),[Ct,Ot]=Ut(Ct,Ot,_i,Jt);const xi=Zt(Io,is,(Ct-Oe)*Ln,Ot-Ue);if(Re.flipState=xi&&xi.needsFlipping?Ql.flipRequired:Ql.flipNotRequired,xi)return xi}A(Le.first);for(let Le=uo+1;Le<uo+po-1;Le++){const Re=Xt($n*_i.getoffsetX(Le),Xn,Yn,Ue,Pi,Hr,fo,lo,as,xi,Ot,Jr,Nn,!1,!1,Gn,qn,Zn);if(!Re)return vi.length-=4*(Le-uo),{notEnoughRoom:!0};A(Re)}A(Le.last)}else{if(qe&&!Ue){const Oe=Ut(Hr.x,Hr.y,0,Ct),Ue=lo+fo+1,qe=new Le.P(xi.getx(Ue),xi.gety(Ue)),Ot=Ut(qe.x,qe.y,0,Ct),Jt=Ot[3]>0?Ot:$t(Hr,qe,Oe,1,Ct,void 0,Gn,qn.canonical),_i=Zt(Io,is,(Jt[0]-Oe[0])*Ln,Jt[1]-Oe[1]);if(Re.flipState=_i&&_i.needsFlipping?Ql.flipRequired:Ql.flipNotRequired,_i)return _i}const Oe=Xt($n*_i.getoffsetX(uo),Xn,Yn,Ue,Pi,Hr,fo,lo,as,xi,Ot,Jr,Nn,!1,!1,Gn,qn,Zn);if(!Oe)return{notEnoughRoom:!0};A(Oe)}return{}}function Wt(Le,Re,Oe,Ue,qe){const{x:Ct,y:Ot,z:Jt}=Ue.projectTilePoint(Le.x,Le.y,Re);if(!qe)return Ut(Ct,Ot,Jt,Oe);const[_i,xi,vi]=qe(Le);return Ut(Ct+_i,Ot+xi,Jt+vi,Oe)}function $t(Re,Oe,Ue,qe,Ct,Ot,Jt,_i){const xi=Wt(Re.sub(Oe)._unit()._add(Re),_i,Ct,Jt,Ot);return Le.a6.vec3.sub(xi,Ue,xi),Le.a6.vec3.normalize(xi,xi),Le.a6.vec3.scaleAndAdd(xi,Ue,xi,qe)}function Xt(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn){const Zn=qe?Re-Oe:Re+Oe;let $n=Zn>0?1:-1,Xn=0;qe&&($n*=-1,Xn=Math.PI),$n<0&&(Xn+=Math.PI);let Yn=_i+Jt+($n>0?0:1)|0,lo=Ct,uo=Ct,po=0,fo=0;const Io=Math.abs(Zn),is=[],as=[];let Is=Ot,Xs=Is;const P=()=>$t(Xs,Is,uo,Io-po+1,bi,Hr,Nn,Gn.canonical);for(;po+fo<=Io;){if(Yn+=$n,Yn<_i||Yn>=xi)return null;if(uo=lo,Xs=Is,is.push(uo),Jr&&as.push(Xs),Is=new Le.P(vi.getx(Yn),vi.gety(Yn)),lo=Pi[Yn],!lo){const Le=Wt(Is,Gn.canonical,bi,Nn,Hr);lo=Le[3]>0?Pi[Yn]=Le:P()}po+=fo,fo=Le.a6.vec3.distance(uo,lo)}Ln&&Hr&&(Pi[Yn]&&(lo=P(),fo=Le.a6.vec3.distance(uo,lo)),Pi[Yn]=lo);const ta=(Io-po)/fo,ha=Is.sub(Xs)._mult(ta)._add(Xs),el=Le.a6.vec3.sub([],lo,uo),tl=Le.a6.vec3.scaleAndAdd([],uo,el,ta);let il=[0,0,1],sl=el[0],fl=el[1];if(qn&&(il=Nn.upVector(Gn.canonical,ha.x,ha.y),0!==il[0]||0!==il[1]||1!==il[2])){const Re=[il[2],0,-il[0]],Oe=Le.a6.vec3.cross([],il,Re);Le.a6.vec3.normalize(Re,Re),Le.a6.vec3.normalize(Oe,Oe),sl=Le.a6.vec3.dot(el,Re),fl=Le.a6.vec3.dot(el,Oe)}if(Ue){const Re=Le.a6.vec3.cross([],il,el);Le.a6.vec3.normalize(Re,Re),Le.a6.vec3.scaleAndAdd(tl,tl,Re,Ue*$n)}const Ml=Xn+Math.atan2(fl,sl);return is.push(tl),Jr&&as.push(ha),{point:tl,angle:Ml,path:is,tilePath:as,up:il}}function Yt(Le,Re){const Oe=Re.length,Ue=Oe+4*Le;Re.resize(Ue),Re.float32.fill(-1/0,4*Oe,4*Ue)}function Kt(Le,Re,Oe){const Ue=Re[0],qe=Re[1];return Le[0]=Oe[0]*Ue+Oe[4]*qe+Oe[12],Le[1]=Oe[1]*Ue+Oe[5]*qe+Oe[13],Le[3]=Oe[3]*Ue+Oe[7]*qe+Oe[15],Le}const lc=100;class Qt{constructor(Le,Re,Oe=new zt(Le.width+200,Le.height+200,25),Ue=new zt(Le.width+200,Le.height+200,25)){this.transform=Le,this.grid=Oe,this.ignoredGrid=Ue,this.pitchfactor=Math.cos(Le._pitch)*Le.cameraToCenterDistance,this.screenRightBoundary=Le.width+lc,this.screenBottomBoundary=Le.height+lc,this.gridRightBoundary=Le.width+200,this.gridBottomBoundary=Le.height+200,this.fogState=Re}placeCollisionBox(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){let _i=Oe.projectedAnchorX,xi=Oe.projectedAnchorY,vi=Oe.projectedAnchorZ;const bi=Oe.elevation,Pi=Oe.tileID,Hr=Le.getProjection();if(bi&&Pi){const[Le,Re,Ue]=Hr.upVector(Pi.canonical,Oe.tileAnchorX,Oe.tileAnchorY),qe=Hr.upVectorScale(Pi.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;_i+=Le*bi*qe,xi+=Re*bi*qe,vi+=Ue*bi*qe}const Jr=this.projectAndGetPerspectiveRatio(Ot,_i,xi,vi,Oe.tileID,"globe"===Hr.name||!!bi||this.transform.pitch>0,Hr),Ln=Ct*Jr.perspectiveRatio,Nn=(Oe.x1*Re+Ue.x-Oe.padding)*Ln+Jr.point.x,Gn=(Oe.y1*Re+Ue.y-Oe.padding)*Ln+Jr.point.y,qn=(Oe.x2*Re+Ue.x+Oe.padding)*Ln+Jr.point.x,Zn=(Oe.y2*Re+Ue.y+Oe.padding)*Ln+Jr.point.y,$n=Jr.perspectiveRatio<=.55||Jr.occluded;return!this.isInsideGrid(Nn,Gn,qn,Zn)||!qe&&this.grid.hitTest(Nn,Gn,qn,Zn,Jt)||$n?{box:[],offscreen:!1,occluded:Jr.occluded}:{box:[Nn,Gn,qn,Zn],offscreen:this.isOffscreen(Nn,Gn,qn,Zn),occluded:!1}}placeCollisionCircles(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln){const Nn=[],Gn=this.transform.elevation,qn=Re.getProjection(),Zn=Gn?Gn.getAtTileOffsetFunc(Ln,this.transform.center.lat,this.transform.worldSize,qn):null,$n=new Le.P(Ue.tileAnchorX,Ue.tileAnchorY);let{x:Xn,y:Yn,z:lo}=qn.projectTilePoint($n.x,$n.y,Ln.canonical);if(Zn){const[Le,Re,Oe]=Zn($n);Xn+=Le,Yn+=Re,lo+=Oe}const uo="globe"===qn.name,po=this.projectAndGetPerspectiveRatio(Jt,Xn,Yn,lo,Ln,uo||!!Gn||this.transform.pitch>0,qn),{perspectiveRatio:fo}=po,Io=(bi?Ot/fo:Ot*fo)/Le.bq,is=Ut(Xn,Yn,lo,_i),as=po.signedDistanceFromCamera>0?qt(Io,Ct,Ue.lineOffsetX*Io,Ue.lineOffsetY*Io,!1,is,$n,Ue,qe,_i,{},Gn&&!bi?Zn:null,bi&&!!Gn,qn,Ln,bi):null;let Is=!1,Xs=!1,ta=!0;if(as&&!po.occluded){const Re=.5*Hr*fo+Jr,Ue=new Le.P(-100,-100),qe=new Le.P(this.screenRightBoundary,this.screenBottomBoundary),Ct=new Mt,{first:Ot,last:Jt}=as,_i=Ot.path.length;let bi=[];for(let Le=_i-1;Le>=1;Le--)bi.push(Ot.path[Le]);for(let Le=1;Le<Jt.path.length;Le++)bi.push(Jt.path[Le]);const Ln=2.5*Re;xi&&(bi=bi.map((([Le,Re,Oe],Ue)=>(Zn&&!uo&&(Oe=Zn(Ue<_i-1?Ot.tilePath[_i-1-Ue]:Jt.tilePath[Ue-_i+2])[2]),Ut(Le,Re,Oe,xi)))),bi.some((Le=>Le[3]<=0))&&(bi=[]));let Gn=[];if(bi.length>0){let Re=1/0,Oe=-1/0,Ct=1/0,Ot=-1/0;for(const Le of bi)Re=Math.min(Re,Le[0]),Ct=Math.min(Ct,Le[1]),Oe=Math.max(Oe,Le[0]),Ot=Math.max(Ot,Le[1]);Oe>=Ue.x&&Re<=qe.x&&Ot>=Ue.y&&Ct<=qe.y&&(Gn=[bi.map((Re=>new Le.P(Re[0],Re[1])))],(Re<Ue.x||Oe>qe.x||Ct<Ue.y||Ot>
vendor: 4,373 bytes, line 1
1qe.y)&&(Gn=Le.bo(Gn,Ue.x,Ue.y,qe.x,qe.y)))}for(const Le of Gn){Ct.reset(Le,.25*Re);let Ue=0;Ue=Ct.length<=.5*Re?1:Math.ceil(Ct.paddedLength/Ln)+1;for(let Le=0;Le<Ue;Le++){const qe=Le/Math.max(Ue-1,1),Ot=Ct.lerp(qe),Jt=Ot.x+lc,_i=Ot.y+lc;Nn.push(Jt,_i,Re,0);const xi=Jt-Re,bi=_i-Re,Hr=Jt+Re,Jr=_i+Re;if(ta=ta&&this.isOffscreen(xi,bi,Hr,Jr),Xs=Xs||this.isInsideGrid(xi,bi,Hr,Jr),!Oe&&this.grid.hitTestCircle(Jt,_i,Re,Pi)&&(Is=!0,!vi))return{circles:[],offscreen:!1,collisionDetected:Is,occluded:!1}}}}return{circles:!vi&&Is||!Xs?[]:Nn,offscreen:ta,collisionDetected:Is,occluded:po.occluded}}queryRenderedSymbols(Re){if(0===Re.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const Oe=[];let Ue=1/0,qe=1/0,Ct=-1/0,Ot=-1/0;for(const Jt of Re){const Re=new Le.P(Jt.x+lc,Jt.y+lc);Ue=Math.min(Ue,Re.x),qe=Math.min(qe,Re.y),Ct=Math.max(Ct,Re.x),Ot=Math.max(Ot,Re.y),Oe.push(Re)}const Jt=this.grid.query(Ue,qe,Ct,Ot).concat(this.ignoredGrid.query(Ue,qe,Ct,Ot)),_i={},xi={};for(const Re of Jt){const Ue=Re.key;if(void 0===_i[Ue.bucketInstanceId]&&(_i[Ue.bucketInstanceId]={}),_i[Ue.bucketInstanceId][Ue.featureIndex])continue;const qe=[new Le.P(Re.x1,Re.y1),new Le.P(Re.x2,Re.y1),new Le.P(Re.x2,Re.y2),new Le.P(Re.x1,Re.y2)];Le.bp(Oe,qe)&&(_i[Ue.bucketInstanceId][Ue.featureIndex]=!0,void 0===xi[Ue.bucketInstanceId]&&(xi[Ue.bucketInstanceId]=[]),xi[Ue.bucketInstanceId].push(Ue.featureIndex))}return xi}insertCollisionBox(Le,Re,Oe,Ue,qe){(Re?this.ignoredGrid:this.grid).insert({bucketInstanceId:Oe,featureIndex:Ue,collisionGroupID:qe},Le[0],Le[1],Le[2],Le[3])}insertCollisionCircles(Le,Re,Oe,Ue,qe){const Ct=Re?this.ignoredGrid:this.grid,Ot={bucketInstanceId:Oe,featureIndex:Ue,collisionGroupID:qe};for(let Re=0;Re<Le.length;Re+=4)Ct.insertCircle(Ot,Le[Re],Le[Re+1],Le[Re+2])}projectAndGetPerspectiveRatio(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=[Oe,Ue,qe,1];let xi=!1;if(qe||this.transform.pitch>0){if(Le.a6.vec4.transformMat4(_i,_i,Re),this.fogState&&Ct&&"globe"!==Jt.name){const Re=function(Re,Oe,Ue,qe,Ct,Ot){const Jt=Ot.calculateFogTileMatrix(Ct),_i=[Oe,Ue,qe];return Le.a6.vec3.transformMat4(_i,_i,Jt),Fe(Re,Le.a6.vec3.length(_i),Ot.pitch,Ot._fov)}(this.fogState,Oe,Ue,qe,Ct.toUnwrapped(),this.transform);xi=Re>.9}}else Kt(_i,_i,Re);const vi=_i[3];return{point:new Le.P((_i[0]/vi+1)/2*this.transform.width+lc,(-_i[1]/vi+1)/2*this.transform.height+lc),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(Jt)/vi*.5,1.5),signedDistanceFromCamera:vi,occluded:Ot&&_i[2]>vi||xi}}isOffscreen(Le,Re,Oe,Ue){return Oe<lc||Le>=this.screenRightBoundary||Ue<lc||Re>this.screenBottomBoundary}isInsideGrid(Le,Re,Oe,Ue){return Oe>=0&&Le<this.gridRightBoundary&&Ue>=0&&Re<this.gridBottomBoundary}getViewportMatrix(){const Re=Le.a6.mat4.identity([]);return Le.a6.mat4.translate(Re,Re,[-100,-100,0]),Re}}function ei(Re,Oe,Ue){const qe=Oe.createTileMatrix(Re,Re.worldSize,Ue.toUnwrapped());return Le.a6.mat4.multiply(new Float32Array(16),Re.projMatrix,qe)}function ti(Le,Re,Oe){if(Re.projection.name===Oe.projection.name)return Le.projMatrix;const Ue=Oe.clone();return Ue.setProjection(Re.projection),ei(Ue,Re.getProjection(),Le)}function ii(Le,Re,Oe){return Re.name===Oe.projection.name?Le.projMatrix:ei(Oe,Re,Le)}class oi{constructor(Le,Re,Oe,Ue){this.opacity=Le?Math.max(0,Math.min(1,Le.opacity+(Le.placed?Re:-Re))):Ue&&Oe?1:0,this.placed=Oe}isHidden(){return 0===this.opacity&&!this.placed}}class ri{constructor(Le,Re,Oe,Ue,qe,Ct=!1){this.text=new oi(Le?Le.text:null,Re,Oe,qe),this.icon=new oi(Le?Le.icon:null,Re,Ue,qe),this.clipped=Ct}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class si{constructor(Le,Re,Oe,Ue=!1){this.text=Le,this.icon=Re,this.skipFade=Oe,this.clipped=Ue}}class ai{constructor(){this.invProjMatrix=Le.a6.mat4.create(),this.viewportMatrix=Le.a6.mat4.create(),this.circles=[]}}class ni{constructor(Le,Re,Oe,Ue,qe){this.bucketInstanceId=Le,this.featureIndex=Re,this.sourceLayerIndex=Oe,this.bucketIndex=Ue,this.tileID=qe}}class li{constructor(Le){this.crossSourceCollisions=Le,this.maxGroupID=0,this.collisionGroups={}}get(Le){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[Le]){const Re=++this.maxGroupID;this.collisionGroups[Le]={ID:Re,predicate:Le=>Le.collisionGroupID===Re}}return this.collisionGroups[Le]}}function ci(Re,Oe,Ue,qe,Ct){const{horizontalAlign:Ot,verticalAlign:Jt}
1=Le.bx(Re),_i=-(Ot-.5)*Oe,xi=-(Jt-.5)*Ue,vi=Le.bw(Re,qe);return new Le.P(_i+vi[0]*Ct,xi+vi[1]*Ct)}function hi(Re,Oe,Ue,qe,Ct){const Ot=new Le.P(Re,Oe);return Ue&&Ot._rotate(qe?Ct:-Ct),Ot}class ui{constructor(Le,Re,Oe,Ue,qe,Ct){this.transform=Le.clone(),this.projection=Le.projection.name,this.collisionIndex=new Qt(this.transform,qe),this.buildingIndex=Ct,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=Re,this.retainedQueryData={},this.collisionGroups=new li(Oe),this.collisionCircleArrays={},this.prevPlacement=Ue,Ue&&(Ue.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(Re,Oe,Ue,qe){const Ct=Ue.getBucket(Oe),Ot=Ue.latestFeatureIndex;if(!Ct||!Ot||Oe.fqid!==Ct.layerIds[0])return;const Jt=Ct.layers[0].layout,_i=Ct.layers[0].paint,xi=Ue.collisionBoxArray,vi=Math.pow(2,this.transform.zoom-Ue.tileID.overscaledZ),bi=Ue.tileSize/Le.ab,Pi=Ue.tileID.toUnwrapped();this.transform.setProjection(Ct.projection);const Hr=(Jr=Ue.tileID,Ln=Ct.getProjection(),Nn=this.transform,Ln.name===this.projection?Nn.calculateProjMatrix(Jr.toUnwrapped()):ei(Nn,Ln,Jr));var Jr,Ln,Nn;const Gn="map"===Jt.get("text-pitch-alignment"),qn="map"===Jt.get("text-rotation-alignment");Oe.compileFilter();const Zn=Oe.dynamicFilter(),$n=Oe.dynamicFilterNeedsFeature(),Xn=this.transform.calculatePixelsToTileUnitsMatrix(Ue),Yn=Bt(Hr,Ue.tileID.canonical,Gn,qn,this.transform,Ct.getProjection(),Xn);let lo=null;if(Gn){const Re=Nt(Hr,Ue.tileID.canonical,Gn,qn,this.transform,Ct.getProjection(),Xn);lo=Le.a6.mat4.multiply([],this.transform.labelPlaneMatrix,Re)}let uo=null;Zn&&Ue.latestFeatureIndex&&(uo={unwrappedTileID:Pi,dynamicFilter:Zn,dynamicFilterNeedsFeature:$n}),this.retainedQueryData[Ct.bucketInstanceId]=new ni(Ct.bucketInstanceId,Ot,Ct.sourceLayerIndex,Ct.index,Ue.tileID);const po={bucket:Ct,layout:Jt,paint:_i,posMatrix:Hr,textLabelPlaneMatrix:Yn,labelToScreenMatrix:lo,clippingData:uo,scale:vi,textPixelRatio:bi,holdingForFade:Ue.holdingForFade(),collisionBoxArray:xi,partiallyEvaluatedTextSize:Le.bj(Ct.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:Le.bj(Ct.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(Ct.sourceID),latestFeatureIndex:Ue.latestFeatureIndex};if(qe)for(const Le of Ct.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:Ue,symbolInstanceEnd:qe}=Le;Re.push({sortKey:Oe,symbolInstanceStart:Ue,symbolInstanceEnd:qe,parameters:po})}else Re.push({symbolInstanceStart:0,symbolInstanceEnd:Ct.symbolInstances.length,parameters:po})}attemptAnchorPlacement(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn){const{textOffset0:qn,textOffset1:Zn,crossTileID:$n}=bi,Xn=[qn,Zn],Yn=ci(Le,Oe,Ue,Xn,qe),lo=this.collisionIndex.placeCollisionBox(Hr,qe,Re,hi(Yn.x,Yn.y,Ct,Ot,this.transform.angle),vi,Jt,_i,xi.predicate);if(Ln){const Le=Hr.getSymbolInstanceIconSize(Gn,this.transform.zoom,bi.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(Hr,Le,Ln,hi(Yn.x,Yn.y,Ct,Ot,this.transform.angle),vi,Jt,_i,xi.predicate).box.length)return}if(lo.box.length>0){let Re;return this.prevPlacement&&this.prevPlacement.variableOffsets[$n]&&this.prevPlacement.placements[$n]&&this.prevPlacement.placements[$n].text&&(Re=this.prevPlacement.variableOffsets[$n].anchor),this.variableOffsets[$n]={textOffset:Xn,width:Oe,height:Ue,anchor:Le,textScale:qe,prevAnchor:Re},this.markUsedJustification(Hr,Le,bi,Jr),Hr.allowVerticalPlacement&&(this.markUsedOrientation(Hr,Jr,bi),this.placedOrientations[$n]=Jr),{shift:Yn,placedGlyphBoxes:lo}}}placeLayerBucketPart(Re,Oe,Ue,qe){const{bucket:Ct,layout:Ot,paint:Jt,posMatrix:_i,textLabelPlaneMatrix:xi,labelToScreenMatrix:vi,clippingData:bi,textPixelRatio:Pi,holdingForFade:Hr,collisionBoxArray:Jr,partiallyEvaluatedTextSize:Ln,partiallyEvaluatedIconSize:Nn,collisionGroup:Gn,latestFeatureIndex:qn}=Re.parameters,Zn=Ot.get("text-optional"),$n=Ot.get("icon-optional"),Xn=Ot.get("text-allow-overlap"),Yn=Ot.get("icon-allow-overlap"),lo="map"===Ot.get("text-rotation-alignment"),uo="map"===Ot.get("text-pitch-alignment"),po=Ot.get("symbol-z-elevate"),fo=Jt.get("symbol-z-offset"),Io="sea"===Jt.get("symbol-elevation-reference");this.transform.setProjection(Ct.projection);let is=Xn&&(Yn||!Ct.hasIconData()||$n),as=Yn&&(Xn||!Ct.hasTextData()||Zn);const Is=!fo.isConstant();!Ct.collisionArrays&&Jr&&Ct.deserializeCollisionBoxes(Jr),Ue&&qe&&Ct.updateCollisionDebugBuffers(this.transform.zoom,Jr);const L=(Re,qe,Jt)=>{const{crossTileID:Jr,numVerticalGlyphVertices:po}=Re;let Xs=null;if(bi&&bi.dynamicFilterNeedsFeature||Is){const Le=this.retainedQueryData[Ct.bucketInstanceId];Xs=qn.loadFeature({featureIndex:Re.featureIndex,bucketIndex:Le.bucketIndex,sourceLayerIndex:Le.s
vendor: 4,553 bytes, line 1
1ourceLayerIndex,layoutVertexArrayOffset:0})}if(bi&&!(0,bi.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},Xs,this.retainedQueryData[Ct.bucketInstanceId].tileID.canonical,new Le.P(Re.tileAnchorX,Re.tileAnchorY),this.transform.calculateDistanceTileData(bi.unwrappedTileID)))return this.placements[Jr]=new si(!1,!1,!1,!0),void Oe.add(Jr);const ta=fo.evaluate(Xs,{});if(Oe.has(Jr))return;if(Hr)return void(this.placements[Jr]=new si(!1,!1,!1));let ha=!1,el=!1,tl=!0,il=!1,sl=!1,fl=null,Ml={box:null,offscreen:null,occluded:null},Al={box:null,offscreen:null,occluded:null},Hl=null,Wl=null,Jl=null,Kl=0,Ql=0,oc=0;Jt.textFeatureIndex?Kl=Jt.textFeatureIndex:Re.useRuntimeCollisionCircles&&(Kl=Re.featureIndex),Jt.verticalTextFeatureIndex&&(Ql=Jt.verticalTextFeatureIndex);const W=Le=>{Le.tileID=this.retainedQueryData[Ct.bucketInstanceId].tileID;const Oe=this.transform.elevation;Le.elevation=Io?ta:ta+(Oe?Oe.getAtTileOffset(Le.tileID,Le.tileAnchorX,Le.tileAnchorY):0),Le.elevation+=Re.zOffset},lc=Jt.textBox;if(lc){W(lc);const i=Oe=>{let Ue=Le.bk.horizontal;if(Ct.allowVerticalPlacement&&!Oe&&this.prevPlacement){const Le=this.prevPlacement.placedOrientations[Jr];Le&&(this.placedOrientations[Jr]=Le,Ue=Le,this.markUsedOrientation(Ct,Ue,Re))}return Ue},o=(Re,Oe)=>{if(Ct.allowVerticalPlacement&&po>0&&Jt.verticalTextBox){for(const Ue of Ct.writingModes)if(Ue===Le.bk.vertical?(Ml=Oe(),Al=Ml):Ml=Re(),Ml&&Ml.box&&Ml.box.length)break}else Ml=Re()};if(Ot.get("text-variable-anchor")){let Oe=Ot.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Jr]){const Le=this.prevPlacement.variableOffsets[Jr];Oe.indexOf(Le.anchor)>0&&(Oe=Oe.filter((Re=>Re!==Le.anchor)),Oe.unshift(Le.anchor))}const h=(Le,Ue,Ot)=>{const Jt=Ct.getSymbolInstanceTextSize(Ln,Re,this.transform.zoom,qe),xi=(Le.x2-Le.x1)*Jt+2*Le.padding,vi=(Le.y2-Le.y1)*Jt+2*Le.padding,bi=Re.hasIconTextFit&&!Yn?Ue:null;bi&&W(bi);let Hr={box:[],offscreen:!1,occluded:!1};const Jr=Xn?2*Oe.length:Oe.length;for(let Ue=0;Ue<Jr;++Ue){const Jr=this.attemptAnchorPlacement(Oe[Ue%Oe.length],Le,xi,vi,Jt,lo,uo,Pi,_i,Gn,Ue>=Oe.length,Re,qe,Ct,Ot,bi,Ln,Nn);if(Jr&&(Hr=Jr.placedGlyphBoxes,Hr&&Hr.box&&Hr.box.length)){ha=!0,fl=Jr.shift;break}}return Hr};o((()=>h(lc,Jt.iconBox,Le.bk.horizontal)),(()=>{const Re=Jt.verticalTextBox;return Re&&W(Re),Ct.allowVerticalPlacement&&!(Ml&&Ml.box&&Ml.box.length)&&po>0&&Re?h(Re,Jt.verticalIconBox,Le.bk.vertical):{box:null,offscreen:null,occluded:null}})),Ml&&(ha=Ml.box,tl=Ml.offscreen,il=Ml.occluded);const Ue=i(!(!Ml||!Ml.box));if(!ha&&this.prevPlacement){const Le=this.prevPlacement.variableOffsets[Jr];Le&&(this.variableOffsets[Jr]=Le,this.markUsedJustification(Ct,Le.anchor,Re,Ue))}}else{const a=(Oe,Ue)=>{const Ot=Ct.getSymbolInstanceTextSize(Ln,Re,this.transform.zoom,qe),Jt=this.collisionIndex.placeCollisionBox(Ct,Ot,Oe,new Le.P(0,0),Xn,Pi,_i,Gn.predicate);return Jt&&Jt.box&&Jt.box.length&&(this.markUsedOrientation(Ct,Ue,Re),this.placedOrientations[Jr]=Ue),Jt};o((()=>a(lc,Le.bk.horizontal)),(()=>{const Re=Jt.verticalTextBox;return Ct.allowVerticalPlacement&&po>0&&Re?(W(Re),a(Re,Le.bk.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(Ml&&Ml.box&&Ml.box.length))}}if(Hl=Ml,ha=Hl&&Hl.box&&Hl.box.length>0,tl=Hl&&Hl.offscreen,il=Hl&&Hl.occluded,Re.useRuntimeCollisionCircles){const Oe=Ct.text.placedSymbolArray.get(Re.centerJustifiedTextSymbolIndex>=0?Re.centerJustifiedTextSymbolIndex:Re.verticalPlacedTextSymbolIndex),qe=Le.bl(Ct.textSizeData,Ln,Oe),Jt=Ot.get("text-padding");Wl=this.collisionIndex.placeCollisionCircles(Ct,Xn,Oe,Ct.lineVertexArray,Ct.glyphOffsetArray,qe,_i,xi,vi,Ue,uo,Gn.predicate,Re.collisionCircleDiameter*qe/Le.bq,Jt,this.retainedQueryData[Ct.bucketInstanceId].tileID),ha=Xn||Wl.circles.length>0&&!Wl.collisionDetected,tl=tl&&Wl.offscreen,il=Wl.occluded}if(Jt.iconFeatureIndex&&(oc=Jt.iconFeatureIndex),Jt.iconBox){const i=Oe=>{W(Oe);const Ue=Re.hasIconTextFit&&fl?hi(fl.x,fl.y,lo,uo,this.transform.angle):new Le.P(0,0),qe=Ct.getSymbolInstanceIconSize(Nn,this.transform.zoom,Re.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(Ct,qe,Oe,Ue,Yn,Pi,_i,Gn.predicate)};Al&&Al.box&&Al.box.length&&Jt.verticalIconBox?(Jl=i(Jt.verticalIconBox),el=Jl.box.length>0):(Jl=i(Jt.iconBox),el=Jl.box.length>0),tl=tl&&Jl.offscreen,sl=Jl.occluded}const Oc=Zn||0===Re.numHorizontalGlyphVertices&&0===po,Nc=$n||0===Re.numIconVertices;if(Oc||Nc?Nc?Oc||(el=el&&ha):ha=el&&ha:el=ha=el&&ha,ha&&Hl&&Hl.box&&this.collisionIndex.insertCollisionBox(Hl.box,Ot.get("text-ignore-placement"),Ct.bu
vendor: 4,742 bytes, line 1
1cketInstanceId,Al&&Al.box&&Ql?Ql:Kl,Gn.ID),el&&Jl&&this.collisionIndex.insertCollisionBox(Jl.box,Ot.get("icon-ignore-placement"),Ct.bucketInstanceId,oc,Gn.ID),Wl&&(ha&&this.collisionIndex.insertCollisionCircles(Wl.circles,Ot.get("text-ignore-placement"),Ct.bucketInstanceId,Kl,Gn.ID),Ue)){const Le=Ct.bucketInstanceId;let Re=this.collisionCircleArrays[Le];void 0===Re&&(Re=this.collisionCircleArrays[Le]=new ai);for(let Le=0;Le<Wl.circles.length;Le+=4)Re.circles.push(Wl.circles[Le+0]),Re.circles.push(Wl.circles[Le+1]),Re.circles.push(Wl.circles[Le+2]),Re.circles.push(Wl.collisionDetected?1:0)}const Uc="globe"!==Ct.projection.name;is=is&&(Uc||!il),as=as&&(Uc||!sl),this.placements[Jr]=new si(ha||is,el||as,tl||Ct.justReloaded),Oe.add(Jr)};if(po&&this.buildingIndex&&(this.buildingIndex.updateZOffset(Ct,this.retainedQueryData[Ct.bucketInstanceId].tileID),Ct.updateZOffset()),Ct.sortFeaturesByY){const Re=Ct.getSortedSymbolIndexes(this.transform.angle);for(let Le=Re.length-1;Le>=0;--Le){const Oe=Re[Le];L(Ct.symbolInstances.get(Oe),Oe,Ct.collisionArrays[Oe])}Ct.hasAnyZOffset&&Le.w(`${Ct.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(Ct.hasAnyZOffset){const Le=Ct.getSortedIndexesByZOffset();for(let Re=0;Re<Le.length;++Re){const Oe=Le[Re];L(Ct.symbolInstances.get(Oe),Oe,Ct.collisionArrays[Oe])}}else for(let Le=Re.symbolInstanceStart;Le<Re.symbolInstanceEnd;Le++)L(Ct.symbolInstances.get(Le),Le,Ct.collisionArrays[Le]);if(Ue&&Ct.bucketInstanceId in this.collisionCircleArrays){const Re=this.collisionCircleArrays[Ct.bucketInstanceId];Le.a6.mat4.invert(Re.invProjMatrix,_i),Re.viewportMatrix=this.collisionIndex.getViewportMatrix()}Ct.justReloaded=!1}markUsedJustification(Re,Oe,Ue,qe){const{leftJustifiedTextSymbolIndex:Ct,centerJustifiedTextSymbolIndex:Ot,rightJustifiedTextSymbolIndex:Jt,verticalPlacedTextSymbolIndex:_i,crossTileID:xi}=Ue,vi=Le.bv(Oe),bi=qe===Le.bk.vertical?_i:"left"===vi?Ct:"center"===vi?Ot:"right"===vi?Jt:-1;Ct>=0&&(Re.text.placedSymbolArray.get(Ct).crossTileID=bi>=0&&Ct!==bi?0:xi),Ot>=0&&(Re.text.placedSymbolArray.get(Ot).crossTileID=bi>=0&&Ot!==bi?0:xi),Jt>=0&&(Re.text.placedSymbolArray.get(Jt).crossTileID=bi>=0&&Jt!==bi?0:xi),_i>=0&&(Re.text.placedSymbolArray.get(_i).crossTileID=bi>=0&&_i!==bi?0:xi)}markUsedOrientation(Re,Oe,Ue){const qe=Oe===Le.bk.horizontal||Oe===Le.bk.horizontalOnly?Oe:0,Ct=Oe===Le.bk.vertical?Oe:0,{leftJustifiedTextSymbolIndex:Ot,centerJustifiedTextSymbolIndex:Jt,rightJustifiedTextSymbolIndex:_i,verticalPlacedTextSymbolIndex:xi}=Ue,vi=Re.text.placedSymbolArray;Ot>=0&&(vi.get(Ot).placedOrientation=qe),Jt>=0&&(vi.get(Jt).placedOrientation=qe),_i>=0&&(vi.get(_i).placedOrientation=qe),xi>=0&&(vi.get(xi).placedOrientation=Ct)}commit(Le){this.commitTime=Le,this.zoomAtLastRecencyCheck=this.transform.zoom;const Re=this.prevPlacement;let Oe=!1;this.prevZoomAdjustment=Re?Re.zoomAdjustment(this.transform.zoom):0;const Ue=Re?Re.symbolFadeChange(Le):1,qe=Re?Re.opacities:{},Ct=Re?Re.variableOffsets:{},Ot=Re?Re.placedOrientations:{};for(const Le in this.placements){const Re=this.placements[Le],Ct=qe[Le];Ct?(this.opacities[Le]=new ri(Ct,Ue,Re.text,Re.icon,null,Re.clipped),Oe=Oe||Re.text!==Ct.text.placed||Re.icon!==Ct.icon.placed):(this.opacities[Le]=new ri(null,Ue,Re.text,Re.icon,Re.skipFade,Re.clipped),Oe=Oe||Re.text||Re.icon)}for(const Le in qe){const Re=qe[Le];if(!this.opacities[Le]){const qe=new ri(Re,Ue,!1,!1);qe.isHidden()||(this.opacities[Le]=qe,Oe=Oe||Re.text.placed||Re.icon.placed)}}for(const Le in Ct)this.variableOffsets[Le]||!this.opacities[Le]||this.opacities[Le].isHidden()||(this.variableOffsets[Le]=Ct[Le]);for(const Le in Ot)this.placedOrientations[Le]||!this.opacities[Le]||this.opacities[Le].isHidden()||(this.placedOrientations[Le]=Ot[Le]);Oe?this.lastPlacementChangeTime=Le:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=Re?Re.lastPlacementChangeTime:Le)}updateLayerOpacities(Le,Re,Oe,Ue){const qe=new Set;for(const Ct of Re){const Re=Ct.getBucket(Le);Re&&Ct.latestFeatureIndex&&Le.fqid===Re.layerIds[0]&&(this.updateBucketOpacities(Re,qe,Ct,Ct.collisionBoxArray,Oe,Ue,Ct.tileID,Le.scope),Re.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(Re,Ct.tileID),Re.updateZOffset()))}}updateBucketOpacities(Re,Oe,Ue,qe,Ct,Ot,Jt,_i){Re.hasTextData()&&Re.text.opacityVertexArray.clear(),Re.hasIconData()&&Re.icon.opacityVertexArray.clear(),Re.hasIconCollisionBoxData()&&Re.iconCollisionBox.collisionVertexArray.clear(),Re.hasTextCollisionBoxData()&&Re.textCollisionBox.collisionVertexArray.clear();const xi=Re.layers[0].layout,vi=Re.layers[0].paint,bi=!!Re.layers[0].dynamicFilter(),Pi=new ri(null,0,!1,!1,
vendor: 7,332 bytes, line 1
1!0),Hr=xi.get("text-allow-overlap"),Jr=xi.get("icon-allow-overlap"),Ln=xi.get("text-variable-anchor"),Nn="map"===xi.get("text-rotation-alignment"),Gn="map"===xi.get("text-pitch-alignment"),qn=vi.get("symbol-z-offset"),Zn="sea"===vi.get("symbol-elevation-reference"),$n=!qn.isConstant(),Xn=new ri(null,0,Hr&&(Jr||!Re.hasIconData()||xi.get("icon-optional")),Jr&&(Hr||!Re.hasTextData()||xi.get("text-optional")),!0);!Re.collisionArrays&&qe&&(Re.hasIconCollisionBoxData()||Re.hasTextCollisionBoxData())&&Re.deserializeCollisionBoxes(qe);const w=(Le,Re,Oe)=>{for(let Ue=0;Ue<Re/4;Ue++)Le.opacityVertexArray.emplaceBack(Oe)};let Yn=0;Ot&&Re.updateReplacement(Jt,Ot);for(let qe=0;qe<Re.symbolInstances.length;qe++){const xi=Re.symbolInstances.get(qe),{numHorizontalGlyphVertices:vi,numVerticalGlyphVertices:Hr,crossTileID:Jr,numIconVertices:lo,tileAnchorX:uo,tileAnchorY:po}=xi;let fo=null;if(xi&&$n){const Le=this.retainedQueryData[Re.bucketInstanceId];fo=Ue.latestFeatureIndex.loadFeature({featureIndex:xi.featureIndex,bucketIndex:Le.bucketIndex,sourceLayerIndex:Le.sourceLayerIndex,layoutVertexArrayOffset:0})}const Io=qn.evaluate(fo,{}),is=Oe.has(Jr);let as=this.opacities[Jr];is?as=Pi:as||(as=Xn,this.opacities[Jr]=as),Oe.add(Jr);const Is=vi>0||Hr>0,Xs=lo>0,ta=this.placedOrientations[Jr],ha=ta===Le.bk.vertical,el=ta===Le.bk.horizontal||ta===Le.bk.horizontalOnly;!Is&&!Xs||as.isHidden()||Yn++;let tl=!1;if((Is||Xs)&&Ot)for(const Oe of Re.activeReplacements){if(Le.br(Oe,Ct,Le.bs.Symbol,_i))continue;if(Oe.min.x>uo||uo>Oe.max.x||Oe.min.y>po||po>Oe.max.y)continue;const Re=Le.bt(uo,po,Jt.canonical,Oe.footprintTileId.canonical);if(tl=Le.bu(Re,Oe.footprint),tl)break}if(Is){const Le=tl?Xc:yi(as.text);w(Re.text,vi,ha?Xc:Le),w(Re.text,Hr,el?Xc:Le);const Oe=as.text.isHidden(),{leftJustifiedTextSymbolIndex:Ue,centerJustifiedTextSymbolIndex:qe,rightJustifiedTextSymbolIndex:Ct,verticalPlacedTextSymbolIndex:Ot}=xi,Jt=Re.text.placedSymbolArray,_i=Oe||ha?1:0;Ue>=0&&(Jt.get(Ue).hidden=_i),qe>=0&&(Jt.get(qe).hidden=_i),Ct>=0&&(Jt.get(Ct).hidden=_i),Ot>=0&&(Jt.get(Ot).hidden=Oe||el?1:0);const bi=this.variableOffsets[Jr];bi&&this.markUsedJustification(Re,bi.anchor,xi,ta);const Pi=this.placedOrientations[Jr];Pi&&(this.markUsedJustification(Re,"left",xi,Pi),this.markUsedOrientation(Re,Pi,xi))}if(Xs){const Le=tl?Xc:yi(as.icon),{placedIconSymbolIndex:Oe,verticalPlacedIconSymbolIndex:Ue}=xi,qe=Re.icon.placedSymbolArray,Ct=as.icon.isHidden()?1:0;Oe>=0&&(w(Re.icon,lo,ha?Xc:Le),qe.get(Oe).hidden=Ct),Ue>=0&&(w(Re.icon,xi.numVerticalIconVertices,el?Xc:Le),qe.get(Ue).hidden=Ct)}if(Re.hasIconCollisionBoxData()||Re.hasTextCollisionBoxData()){const Oe=Re.collisionArrays[qe];if(Oe){let Ue=new Le.P(0,0),qe=!0;if(Oe.textBox||Oe.verticalTextBox){if(Ln){const Le=this.variableOffsets[Jr];Le?(Ue=ci(Le.anchor,Le.width,Le.height,Le.textOffset,Le.textScale),Nn&&Ue._rotate(Gn?this.transform.angle:-this.transform.angle)):qe=!1}bi&&(qe=!as.clipped),Oe.textBox&&di(Re.textCollisionBox.collisionVertexArray,as.text.placed,!qe||ha,Io,Zn,Ue.x,Ue.y),Oe.verticalTextBox&&di(Re.textCollisionBox.collisionVertexArray,as.text.placed,!qe||el,Io,Zn,Ue.x,Ue.y)}const Ct=qe&&Boolean(!el&&Oe.verticalIconBox);Oe.iconBox&&di(Re.iconCollisionBox.collisionVertexArray,as.icon.placed,Ct,Io,Zn,xi.hasIconTextFit?Ue.x:0,xi.hasIconTextFit?Ue.y:0),Oe.verticalIconBox&&di(Re.iconCollisionBox.collisionVertexArray,as.icon.placed,!Ct,Io,Zn,xi.hasIconTextFit?Ue.x:0,xi.hasIconTextFit?Ue.y:0)}}}if(Re.fullyClipped=0===Yn,Re.sortFeatures(this.transform.angle),this.retainedQueryData[Re.bucketInstanceId]&&(this.retainedQueryData[Re.bucketInstanceId].featureSortOrder=Re.featureSortOrder),Re.hasTextData()&&Re.text.opacityVertexBuffer&&Re.text.opacityVertexBuffer.updateData(Re.text.opacityVertexArray),Re.hasIconData()&&Re.icon.opacityVertexBuffer&&Re.icon.opacityVertexBuffer.updateData(Re.icon.opacityVertexArray),Re.hasIconCollisionBoxData()&&Re.iconCollisionBox.collisionVertexBuffer&&Re.iconCollisionBox.collisionVertexBuffer.updateData(Re.iconCollisionBox.collisionVertexArray),Re.hasTextCollisionBoxData()&&Re.textCollisionBox.collisionVertexBuffer&&Re.textCollisionBox.collisionVertexBuffer.updateData(Re.textCollisionBox.collisionVertexArray),Re.bucketInstanceId in this.collisionCircleArrays){const Le=this.collisionCircleArrays[Re.bucketInstanceId];Re.placementInvProjMatrix=Le.invProjMatrix,Re.placementViewportMatrix=Le.viewportMatrix,Re.collisionCircleArray=Le.circles,delete this.collisionCircleArrays[Re.bucketInstanceId]}}symbolFadeChange(Le){return 0===this.fadeDuration?1:(Le-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(Le){return Math.max(0,(this.transform.zoom-Le)/1.5)}hasTransitions(Le){return this.stale||Le-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(Le,Re){const Oe=this.zoomAtLastRecencyCheck===Re?1-this.zoomAdjustment(Re):1;return this.zoomAtLastRecencyCheck=Re,this.commitTime+this.fadeDuration*Oe>Le}setStale(){this.stale=!0}}function di(Le,Re,Oe,Ue,qe,Ct,Ot){Le.emplaceBack(Re?1:0,Oe?1:0,Ct||0,Ot||0,Ue,qe?1:0),Le.emplaceBack(Re?1:0,Oe?1:0,Ct||0,Ot||0,Ue,qe?1:0),Le.emplaceBack(Re?1:0,Oe?1:0,Ct||0,Ot||0,Ue,qe?1:0),Le.emplaceBack(Re?1:0,Oe?1:0,Ct||0,Ot||0,Ue,qe?1:0)}const Oc=Math.pow(2,25),Nc=Math.pow(2,24),Uc=Math.pow(2,17),jc=Math.pow(2,16),Zc=Math.pow(2,9),Hc=Math.pow(2,8),Wc=Math.pow(2,1);function yi(Le){if(0===Le.opacity&&!Le.placed)return 0;if(1===Le.opacity&&Le.placed)return 4294967295;const Re=Le.placed?1:0,Oe=Math.floor(127*Le.opacity);return Oe*Oc+Re*Nc+Oe*Uc+Re*jc+Oe*Zc+Re*Hc+Oe*Wc+Re}const Xc=0;class wi{constructor(Le){this._sortAcrossTiles="viewport-y"!==Le.layout.get("symbol-z-order")&&void 0!==Le.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(Le,Re,Oe,Ue,qe){const Ct=this._bucketParts;for(;this._currentTileIndex<Le.length;)if(Re.getBucketParts(Ct,Ue,Le[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,qe())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,Ct.sort(((Le,Re)=>Le.sortKey-Re.sortKey)));this._currentPartIndex<Ct.length;){const Le=Ct[this._currentPartIndex];if(Re.placeLayerBucketPart(Le,this._seenCrossTileIDs,Oe,0===Le.symbolInstanceStart),this._currentPartIndex++,qe())return!0}return!1}}class Ti{constructor(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i){this.placement=new ui(Le,qe,Ct,Ot,Jt,_i),this._currentPlacementIndex=Re.length-1,this._forceFullPlacement=Oe,this._showCollisionBoxes=Ue,this._done=!1}isDone(){return this._done}continuePlacement(Re,Oe,Ue,qe){const Ct=Le.q.now(),a=()=>{const Re=Le.q.now()-Ct;return!this._forceFullPlacement&&Re>2};for(;this._currentPlacementIndex>=0;){const Ct=Oe[Re[this._currentPlacementIndex]],Ot=this.placement.collisionIndex.transform.zoom;if("symbol"===Ct.type&&(!Ct.minzoom||Ct.minzoom<=Ot)&&(!Ct.maxzoom||Ct.maxzoom>Ot)){const Re=Ct,Oe=Re.layout.get("symbol-z-elevate"),Ot=void 0!==Re.layout.get("symbol-sort-key").constantOr(1),Jt=Re.layout.get("symbol-z-order"),_i="viewport-y"===Jt||"auto"===Jt&&!("viewport-y"!==Jt&&Ot),xi=Re.layout.get("text-allow-overlap")||Re.layout.get("icon-allow-overlap")||Re.layout.get("text-ignore-placement")||Re.layout.get("icon-ignore-placement"),vi=_i&&xi,bi=this._inProgressLayer=this._inProgressLayer||new wi(Re),Pi=Le.av(Ct.source,Ct.scope);
vendor: 5,661 bytes, line 1
1if(bi.continuePlacement(Oe||vi?qe[Pi]:Ue[Pi],this.placement,this._showCollisionBoxes,Ct,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(Le){return this.placement.commit(Le),this.placement}}const Yc=512/Le.ab/2;class Ci{constructor(Re,Oe,Ue){this.tileID=Re,this.bucketInstanceId=Ue,this.index=new Le.by(Oe.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const qe=Re.canonical.x*Le.ab,Ct=Re.canonical.y*Le.ab;for(let Le=0;Le<Oe.length;Le++){const{key:Re,crossTileID:Ue,tileAnchorX:Ot,tileAnchorY:Jt}=Oe.get(Le),_i=Math.floor((qe+Ot)*Yc),xi=Math.floor((Ct+Jt)*Yc);this.index.add(_i,xi),this.keys.push(Re),this.crossTileIDs.push(Ue)}this.index.finish()}findMatches(Re,Oe,Ue){const qe=this.tileID.canonical.z<Oe.canonical.z?1:Math.pow(2,this.tileID.canonical.z-Oe.canonical.z),Ct=Yc/Math.pow(2,Oe.canonical.z-this.tileID.canonical.z),Ot=Oe.canonical.x*Le.ab,Jt=Oe.canonical.y*Le.ab;for(let Le=0;Le<Re.length;Le++){const Oe=Re.get(Le);if(Oe.crossTileID)continue;const{key:_i,tileAnchorX:xi,tileAnchorY:vi}=Oe,bi=Math.floor((Ot+xi)*Ct),Pi=Math.floor((Jt+vi)*Ct),Hr=this.index.range(bi-qe,Pi-qe,bi+qe,Pi+qe);for(const Le of Hr){const Re=this.crossTileIDs[Le];if(this.keys[Le]===_i&&!Ue.has(Re)){Ue.add(Re),Oe.crossTileID=Re;break}}}}}class Si{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ii{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(Le){const Re=Math.round((Le-this.lng)/360);if(0!==Re)for(const Le in this.indexes){const Oe=this.indexes[Le],Ue={};for(const Le in Oe){const qe=Oe[Le];qe.tileID=qe.tileID.unwrapTo(qe.tileID.wrap+Re),Ue[qe.tileID.key]=qe}this.indexes[Le]=Ue}this.lng=Le}addBucket(Le,Re,Oe){if(this.indexes[Le.overscaledZ]&&this.indexes[Le.overscaledZ][Le.key]){if(this.indexes[Le.overscaledZ][Le.key].bucketInstanceId===Re.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(Le.overscaledZ,this.indexes[Le.overscaledZ][Le.key])}for(let Le=0;Le<Re.symbolInstances.length;Le++)Re.symbolInstances.get(Le).crossTileID=0;this.usedCrossTileIDs[Le.overscaledZ]||(this.usedCrossTileIDs[Le.overscaledZ]=new Set);const Ue=this.usedCrossTileIDs[Le.overscaledZ];for(const Oe in this.indexes){const qe=this.indexes[Oe];if(Number(Oe)>Le.overscaledZ)for(const Oe in qe){const Ct=qe[Oe];Ct.tileID.isChildOf(Le)&&Ct.findMatches(Re.symbolInstances,Le,Ue)}else{const Ct=qe[Le.scaledTo(Number(Oe)).key];Ct&&Ct.findMatches(Re.symbolInstances,Le,Ue)}}for(let Le=0;Le<Re.symbolInstances.length;Le++){const qe=Re.symbolInstances.get(Le);qe.crossTileID||(qe.crossTileID=Oe.generate(),Ue.add(qe.crossTileID))}return void 0===this.indexes[Le.overscaledZ]&&(this.indexes[Le.overscaledZ]={}),this.indexes[Le.overscaledZ][Le.key]=new Ci(Le,Re.symbolInstances,Re.bucketInstanceId),!0}removeBucketCrossTileIDs(Le,Re){for(const Oe of Re.crossTileIDs)this.usedCrossTileIDs[Le].delete(Oe)}removeStaleBuckets(Le){let Re=!1;for(const Oe in this.indexes){const Ue=this.indexes[Oe];for(const qe in Ue)Le[Ue[qe].bucketInstanceId]||(this.removeBucketCrossTileIDs(Oe,Ue[qe]),delete Ue[qe],Re=!0)}return Re}}class Di{constructor(){this.layerIndexes={},this.crossTileIDs=new Si,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(Le,Re,Oe,Ue){let qe=this.layerIndexes[Le.fqid];void 0===qe&&(qe=this.layerIndexes[Le.fqid]=new Ii);let Ct=!1;const Ot={};"globe"!==Ue.name&&qe.handleWrapJump(Oe);for(const Oe of Re){const Re=Oe.getBucket(Le);Re&&Le.fqid===Re.layerIds[0]&&(Re.bucketInstanceId||(Re.bucketInstanceId=++this.maxBucketInstanceId),qe.addBucket(Oe.tileID,Re,this.crossTileIDs)&&(Ct=!0),Ot[Re.bucketInstanceId]=!0)}return qe.removeStaleBuckets(Ot)&&(Ct=!0),Ct}pruneUnusedLayers(Le){const Re={};Le.forEach((Le=>{Re[Le]=!0}));for(const Le in this.layerIndexes)Re[Le]||delete this.layerIndexes[Le]}}const Jc=771;class Ai{constructor(Le,Re,Oe,Ue){this.blendFunction=Le,this.blendColor=Re,this.mask=Oe,this.blendEquation=Ue}}Ai.Replace=[1,0,1,0],Ai.disabled=new Ai(Ai.Replace,Le.bz.transparent,[!1,!1,!1,!1]),Ai.unblended=new Ai(Ai.Replace,Le.bz.transparent,[!0,!0,!0,!0]),Ai.alphaBlended=new Ai([1,Jc,1,Jc],Le.bz.transparent,[!0,!0,!0,!0]),Ai.alphaBlendedNonPremultiplied=new Ai([770,Jc,770,Jc],Le.bz.transparent,[!0,!0,!0,!0]),Ai.multiply=new Ai([774,0,774,0],Le.bz.transparent,[!0,!0,!0,!0]);class Li{constructor(Le,Re,Oe){this.func=Le,this.mask=Re,this.range=Oe}}Li.ReadOnly=!1,Li.ReadWrite=!0,Li.disabled=new Li(519,Li.ReadOnly,[0,1]);const Kc=7680;class Mi{constructor(Le,Re,Oe,Ue,qe,Ct){this.test=Le,this.ref=Re,this.mask=Oe,this.fail=Ue,this.depthFail=qe,this.pass=Ct}}Mi.disabled=new Mi({func:519,mask:0},0,0,Kc,Kc,Kc);const Qc=1029,eh=2305;class Fi{constructor(Le,Re,Oe){this.enable=Le,this.mode=Re,this.frontFace=Oe}}function ki(Re,Oe){const Ue=Le.bC(Re,3);Le.a6.mat4.fromQuat(Re,Oe),Le.bE(Re,3,Ue)}function Bi(Re,Oe){const Ue=Le.a6.quat.identity([]);return Le.a6.quat.rotateZ(Ue,Ue,-Oe),Le.a6.quat.rotateX(Ue,Ue,-Re),Ue}function Ni(Re,Oe){const Ue=[Re[0],Re[1],0],qe=[Oe[0],Oe[1],0];if(Le.a6.vec3.length(Ue)>=1e-15){const Re=Le.a6.vec3.normalize([],Ue);Le.a6.vec3.scale(qe,Re,Le.a6.vec3.dot(qe,Re)),Oe[0]=qe[0],Oe[1]=qe[1]}const Ct=Le.a6.vec3.cross([],Oe,Re);if(Le.a6.vec3.len(Ct)<1e-15)return null;const Ot=Math.atan2(-Ct[1],Ct[0]);return Bi(Math.atan2(Math.sqrt(Re[0]*Re[0]+Re[1]*Re[1]),-Re[2]),Ot)}Fi.disabled=new Fi(!1,Qc,eh),Fi.backCCW=new Fi(!0,Qc,eh),Fi.backCW=new Fi(!0,Qc,2304),Fi.frontCW=new Fi(!0,1028,2304),Fi.frontCCW=new Fi(!0,1028,eh);class Ui{constructor(Le,Re){this.position=Le,this.orientation=Re}get position(){return this._position}set position(Re){if(Re){const Oe=Re instanceof Le.a5?Re:new Le.a5(Re[0],Re[1],Re[2]);
vendor: 4,782 bytes, line 1
1this._renderWorldCopies&&(Oe.x=Le.bA(Oe.x,0,1)),this._position=Oe}else this._position=null}lookAtPoint(Re,Oe){if(this.orientation=null,!this.position)return;const Ue=this.position,qe=this._elevation?this._elevation.getAtPointOrZero(Le.a5.fromLngLat(Re)):0,Ct=Le.a5.fromLngLat(Re,qe),Ot=[Ct.x-Ue.x,Ct.y-Ue.y,Ct.z-Ue.z];Oe||(Oe=[0,0,1]),Oe[2]=Math.abs(Oe[2]),this.orientation=Ni(Ot,Oe)}setPitchBearing(Re,Oe){this.orientation=Bi(Le.bB(Re),Le.bB(-Oe))}}class Gi{constructor(Re,Oe){this._transform=Le.a6.mat4.identity([]),this.orientation=Oe,this.position=Re}get mercatorPosition(){const Re=this.position;return new Le.a5(Re[0],Re[1],Re[2])}get position(){const Re=Le.bC(this._transform,3);return[Re[0],Re[1],Re[2]]}set position(Re){var Oe;Re&&Le.bE(this._transform,3,[(Oe=Re)[0],Oe[1],Oe[2],1])}get orientation(){return this._orientation}set orientation(Re){this._orientation=Re||Le.a6.quat.identity([]),Re&&ki(this._transform,this._orientation)}getPitchBearing(){const Le=this.forward(),Re=this.right();return{bearing:Math.atan2(-Re[1],Re[0]),pitch:Math.atan2(Math.sqrt(Le[0]*Le[0]+Le[1]*Le[1]),-Le[2])}}setPitchBearing(Le,Re){this._orientation=Bi(Le,Re),ki(this._transform,this._orientation)}forward(){const Re=Le.bC(this._transform,2);return[-Re[0],-Re[1],-Re[2]]}up(){const Re=Le.bC(this._transform,1);return[-Re[0],-Re[1],-Re[2]]}right(){const Re=Le.bC(this._transform,0);return[Re[0],Re[1],Re[2]]}getCameraToWorld(Re,Oe){const Ue=new Float64Array(16);return Le.a6.mat4.invert(Ue,this.getWorldToCamera(Re,Oe)),Ue}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(Re,Oe,Ue){const qe=this.position;Le.a6.vec3.scale(qe,qe,-Re);const Ct=new Float64Array(16);return Le.a6.mat4.fromScaling(Ct,[Ue,Ue,Ue]),Le.a6.mat4.translate(Ct,Ct,qe),Ct[10]*=Oe,Ct}getWorldToCamera(Re,Oe){const Ue=new Float64Array(16),qe=new Float64Array(4),Ct=this.position;return Le.a6.quat.conjugate(qe,this._orientation),Le.a6.vec3.scale(Ct,Ct,-Re),Le.a6.mat4.fromQuat(Ue,qe),Le.a6.mat4.translate(Ue,Ue,Ct),Ue[1]*=-1,Ue[5]*=-1,Ue[9]*=-1,Ue[13]*=-1,Ue[8]*=Oe,Ue[9]*=Oe,Ue[10]*=Oe,Ue[11]*=Oe,Ue}getCameraToClipPerspective(Re,Oe,Ue,qe){const Ct=new Float64Array(16);return Le.a6.mat4.perspective(Ct,Re,Oe,Ue,qe),Ct}getCameraToClipOrthographic(Re,Oe,Ue,qe,Ct,Ot){const Jt=new Float64Array(16);return Le.a6.mat4.ortho(Jt,Re,Oe,Ue,qe,Ct,Ot),Jt}getDistanceToElevation(Re,Oe=!1){const Ue=0===Re?0:Le.bD(Re,Oe?Le.aM(this.position[1]):this.position[1]),qe=this.forward();return(Ue-this.position[2])/qe[2]}clone(){return new Gi([...this.position],[...this.orientation])}}const th={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Vi{constructor(Le=0,Re=0,Oe=0,Ue=0){if(isNaN(Le)||Le<0||isNaN(Re)||Re<0||isNaN(Oe)||Oe<0||isNaN(Ue)||Ue<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=Le,this.bottom=Re,this.left=Oe,this.right=Ue}interpolate(Re,Oe,Ue){return null!=Oe.top&&null!=Re.top&&(this.top=Le.aa(Re.top,Oe.top,Ue)),null!=Oe.bottom&&null!=Re.bottom&&(this.bottom=Le.aa(Re.bottom,Oe.bottom,Ue)),null!=Oe.left&&null!=Re.left&&(this.left=Le.aa(Re.left,Oe.left,Ue)),null!=Oe.right&&null!=Re.right&&(this.right=Le.aa(Re.right,Oe.right,Ue)),this}getCenter(Re,Oe){const Ue=Le.ap((this.left+Re-this.right)/2,0,Re),qe=Le.ap((this.top+Oe-this.bottom)/2,0,Oe);return new Le.P(Ue,qe)}equals(Le){return this.top===Le.top&&this.bottom===Le.bottom&&this.left===Le.left&&this.right===Le.right}clone(){return new Vi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const qi=(Le,Re,Oe)=>(1-Oe)*Le+Oe*Re,Zi=Le=>Le*Le*Le*Le*Le;class Hi{constructor(Re,Oe,Ue,qe,Ct,Ot,Jt){this.tileSize=512,this._renderWorldCopies=void 0===Ct||Ct,this._minZoom=Re||0,this._maxZoom=Oe||22,this._minPitch=Ue??0,this._maxPitch=qe??60,this.setProjection(Ot),this.setMaxBounds(Jt),this.width=0,this.height=0,this._center=new Le.bK(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Vi,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Gi,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const Le=new Hi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return Le._elevation=this._elevation,Le._centerAltitude=this._centerAltitude,Le._centerAltitudeValidForE
vendor: 5,276 bytes, line 1
1xaggeration=this._centerAltitudeValidForExaggeration,Le.tileSize=this.tileSize,Le.mercatorFromTransition=this.mercatorFromTransition,Le.width=this.width,Le.height=this.height,Le.cameraElevationReference=this.cameraElevationReference,Le._center=this._center,Le._setZoom(this.zoom),Le._seaLevelZoom=this._seaLevelZoom,Le.angle=this.angle,Le._fov=this._fov,Le._pitch=this._pitch,Le._nearZ=this._nearZ,Le._farZ=this._farZ,Le._averageElevation=this._averageElevation,Le._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,Le._unmodified=this._unmodified,Le._edgeInsets=this._edgeInsets.clone(),Le._camera=this._camera.clone(),Le._calcMatrices(),Le.freezeTileCoverage=this.freezeTileCoverage,Le.frustumCorners=this.frustumCorners,Le}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(Le){this._elevation!==Le&&(this._elevation=Le,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(Le,Re=!1){const Oe=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||Oe)&&this._updateCameraOnTerrain(),(Le||Oe)&&this._constrainCamera(Re),this._calcMatrices()}getProjection(){return Le.ar(this.projection,["name","center","parallels"])}setProjection(Re){this.projectionOptions=Re||{name:"mercator"};const Oe=this.projection?this.getProjection():void 0;this.projection=Le.bL(this.projectionOptions);const Ue=this.getProjection(),qe=!Le.bh(Oe,Ue);return qe&&this._calcMatrices(),this.mercatorFromTransition=!1,qe}setOrthographicProjectionAtLowPitch(Le){return this._orthographicProjectionAtLowPitch!==Le&&(this._orthographicProjectionAtLowPitch=Le,this._calcMatrices(),!0)}setMercatorFromTransition(){const Re=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=Le.bL({name:"mercator"});const Oe=Re!==this.projection.name;return Oe&&this._calcMatrices(),Oe}get minZoom(){return this._minZoom}set minZoom(Le){this._minZoom!==Le&&(this._minZoom=Le,this.zoom=Math.max(this.zoom,Le))}get maxZoom(){return this._maxZoom}set maxZoom(Le){this._maxZoom!==Le&&(this._maxZoom=Le,this.zoom=Math.min(this.zoom,Le))}get minPitch(){return this._minPitch}set minPitch(Le){this._minPitch!==Le&&(this._minPitch=Le,this.pitch=Math.max(this.pitch,Le))}get maxPitch(){return this._maxPitch}set maxPitch(Le){this._maxPitch!==Le&&(this._maxPitch=Le,this.pitch=Math.min(this.pitch,Le))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(Le){void 0===Le?Le=!0:null===Le&&(Le=!1),this._renderWorldCopies=Le}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const Le=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(Le))}get cameraWorldSize(){const Le=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(Le))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return Le.bD(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Le.P(this.width,this.height)}get bearing(){return Le.bA(this.rotation,-180,180)}set bearing(Le){this.rotation=Le}get rotation(){return-this.angle/Math.PI*180}set rotation(Re){const Oe=-Re*Math.PI/180;this.angle!==Oe&&(this._unmodified=!1,this.angle=Oe,this._calcMatrices(),this.rotationMatrix=Le.a6.mat2.create(),Le.a6.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(Re){const Oe=Le.ap(Re,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==Oe&&(this._unmodified=!1,this._pitch=Oe,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const Le=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/Le)}set fov(Re){Re=Math.max(.01,Math.min(60,Re)),this._fov!==Re&&(this._unmodified=!1,this._fov=Le.bB(Re),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(Le){this._averageElevation=Le,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(Le){const Re=Math.min(Math.max(Le,this.minZoom),this.maxZoom);this._zoom!==Re&&(this._unmodified=!1,this._setZoom(Re),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(Le){this._zoom=Le,this.scale=this.zoomScale(Le),this.tileZoom=Math.floor(Le),this.zoomFraction=Le-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(Le){this._tileCoverLift!==Le&&(this._tileCoverLift=Le)}_updateCameraOnTerrain(){const Le=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,Re=this.elevation&&Le===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
10&&this._centerAltitudeValidForExaggeration;if(!this._elevation||Le===Number.NEGATIVE_INFINITY&&(!Re||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const Oe=this._elevation;Re||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&Oe.exaggeration()&&this._centerAltitudeValidForExaggeration!==Oe.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*Oe.exaggeration(),this._centerAltitudeValidForExaggeration=Oe.exaggeration()):(this._centerAltitude=Le||0,this._centerAltitudeValidForExaggeration=Oe.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const Re=this._elevation,Oe=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],Ue=this.horizonLineFromTop();let qe=0,Ct=0;for(let Ot=0;Ot<Oe.length;Ot++){const Jt=new Le.P(Oe[Ot][0]*this.width,Ue+Oe[Ot][1]*(this.height-Ue)),_i=Re.pointCoordinate(Jt);if(!_i)continue;const xi=1/Math.hypot(_i[0]-this._camera.position[0],_i[1]-this._camera.position[1]);qe+=_i[3]*xi,Ct+=xi}return 0===Ct?NaN:qe/Ct}get center(){return this._center}set center(Le){Le.lat===this._center.lat&&Le.lng===this._center.lng||(this._unmodified=!1,this._center=Le,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const Le=this._seaLevelZoom,Re=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),Oe=this.pixelsPerMeter/this.worldSize*Re,Ue=this._mercatorZfromZoom(Le),qe=this._mercatorZfromZoom(this._maxZoom),Ct=Math.max(Ue-Oe,qe);this._setZoom(this._zoomFromMercatorZ(Ct))}get padding(){return this._edgeInsets.toJSON()}set padding(Le){this._edgeInsets.equals(Le)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,Le,1),this._calcMatrices())}computeZoomRelativeTo(Re){const Oe=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,Re.toAltitude()));let Ue;Ue=Re.z<this._camera.position[2]?[Oe.x,Oe.y,Oe.z]:[Re.x,Re.y,Re.z];const qe=Le.a6.vec3.length(Le.a6.vec3.sub([],this._camera.position,Ue));return Le.ap(this._zoomFromMercatorZ(qe),this._minZoom,this._maxZoom)}setFreeCameraOptions(Re){if(!this.height)return;if(!Re.position&&!Re.orientation)return;this._updateCameraState();let Oe=!1;if(Re.orientation&&!Le.a6.quat.exactEquals(Re.orientation,this._camera.orientation)&&(Oe=this._setCameraOrientation(Re.orientation)),Re.position){const Ue=[Re.position.x,Re.position.y,Re.position.z];Le.a6.vec3.exactEquals(Ue,this._camera.position)||(this._setCameraPosition(Ue),Oe=!0)}Oe&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const Re=this._camera.position,Oe=new Ui;return Oe.position=new Le.a5(Re[0],Re[1],Re[2]),Oe.orientation=this._camera.orientation,Oe._elevation=this.elevation,Oe._renderWorldCopies=this.renderWorldCopies,Oe}_setCameraOrientation(Re){if(!Le.a6.quat.length(Re))return!1;Le.a6.quat.normalize(Re,Re);const Oe=Le.a6.vec3.transformQuat([],[0,0,-1],Re),Ue=Le.a6.vec3.transformQuat([],[0,-1,0],Re);if(Ue[2]<0)return!1;const qe=Ni(Oe,Ue);return!!qe&&(this._camera.orientation=qe,!0)}_setCameraPosition(Re){const Oe=this.zoomScale(this.minZoom)*this.tileSize,Ue=this.zoomScale(this.maxZoom)*this.tileSize,qe=this.cameraToCenterDistance;Re[2]=Le.ap(Re[2],qe/Ue,qe/Oe),this._camera.position=Re}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(Le){return this._edgeInsets.equals(Le)}interpolatePadding(Le,Re,Oe){this._unmodified=!1,this._edgeInsets.interpolate(Le,Re,Oe),this._constrain(),this._calcMatrices()}coveringZoomLevel(Le){const Re=(Le.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/Le.tileSize));return Math.max(0,Re)}getVisibleUnwrappedCoordinates(Re){const Oe=[new Le.bM(0,Re)];if(this.renderWorldCopies){const Ue=this.pointCoordinate(new Le.P(0,0)),qe=this.pointCoordinate(new Le.P(this.width,0)),Ct=this.pointCoordinate(new Le.P(this.width,this.height)),Ot=this.pointCoordinate(new Le.P(0,this.height)),Jt=Math.floor(Math.min(Ue.x,qe.x,Ct.x,Ot.x)),_i=Math.floor(Math.max(Ue.x,qe.x,Ct.x,Ot.x)),xi=1;for(let Ue=Jt-xi;Ue<=_i+xi;Ue++)0!==Ue&&Oe.push(new Le.bM(Ue,Re))}return Oe}isLODDisabled(Le){return(!Le||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(Re,Oe,Ue){let qe=[];const Ct=void 0!==Ue,Ot=!Ct;if(Ot&&this.zoom<Oe)return qe;if(Ct&&0===Ue[0]&&0===Ue[1])return qe;const Jt=new Set,l=(Re,Oe,Ue,Ct,Ot)=>{const _i=Le.c1(Oe,Re,Ue,Ct,Ot);Jt.has(_i)||(qe.push(new Le.aA(Re,Oe,Ue,Ct,Ot)),Jt.add(_i))};for(let Le=0;Le<Re.length;Le++){const qe=Re[Le];if(Ot&&qe.canonical.z!==Oe)continue;const Jt=qe.canonical,_i=qe.overscaledZ,xi=qe.wrap,vi=1<<Jt.z,bi=Jt.x+1<vi,Pi=Jt.x>
vendor: 4,574 bytes, line 1
10,Hr=Jt.y+1<vi,Jr=Jt.y>0,Ln=qe.wrap-(Pi?0:1),Nn=qe.wrap+(bi?0:1),Gn=Pi?Jt.x-1:vi-1,qn=bi?Jt.x+1:0;if(Ct)Ue[0]<0?(l(_i,Nn,Jt.z,qn,Jt.y),Ue[1]<0&&Hr&&(l(_i,xi,Jt.z,Jt.x,Jt.y+1),l(_i,Nn,Jt.z,qn,Jt.y+1)),Ue[1]>0&&Jr&&(l(_i,xi,Jt.z,Jt.x,Jt.y-1),l(_i,Nn,Jt.z,qn,Jt.y-1))):Ue[0]>0?(l(_i,Ln,Jt.z,Gn,Jt.y),Ue[1]<0&&Hr&&(l(_i,xi,Jt.z,Jt.x,Jt.y+1),l(_i,Ln,Jt.z,Gn,Jt.y+1)),Ue[1]>0&&Jr&&(l(_i,xi,Jt.z,Jt.x,Jt.y-1),l(_i,Ln,Jt.z,Gn,Jt.y-1))):Ue[1]<0&&Hr?l(_i,xi,Jt.z,Jt.x,Jt.y+1):Jr&&l(_i,xi,Jt.z,Jt.x,Jt.y-1);else{const Le=qe.visibleQuadrants;1&Le&&(l(_i,Ln,Jt.z,Gn,Jt.y),Jr&&(l(_i,xi,Jt.z,Jt.x,Jt.y-1),l(_i,Ln,Jt.z,Gn,Jt.y-1))),2&Le&&(l(_i,Nn,Jt.z,qn,Jt.y),Jr&&(l(_i,xi,Jt.z,Jt.x,Jt.y-1),l(_i,Nn,Jt.z,qn,Jt.y-1))),4&Le&&(l(_i,Ln,Jt.z,Gn,Jt.y),Hr&&(l(_i,xi,Jt.z,Jt.x,Jt.y+1),l(_i,Ln,Jt.z,Gn,Jt.y+1))),8&Le&&(l(_i,Nn,Jt.z,qn,Jt.y),Hr&&(l(_i,xi,Jt.z,Jt.x,Jt.y+1),l(_i,Nn,Jt.z,qn,Jt.y+1)))}}const _i=[];for(const Le of qe)qe.some((Re=>Le.isChildOf(Re)))||_i.push(Le);if(qe=_i.filter((Le=>!Re.some((Re=>!!(Le.overscaledZ<Oe&&Re.isChildOf(Le))||Le.equals(Re)||Le.isChildOf(Re))))),Ot){const Le=1<<Oe,Re="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),Ue=[Le*Re.x,Le*Re.y],Ct=4,Ot=Ct*Ct;qe=qe.filter((Le=>{const Re=Le.canonical.x+.5-Ue[0],Oe=Le.canonical.y+.5-Ue[1];return Re*Re+Oe*Oe<Ot}))}return qe}coveringTiles(Re){let Oe=this.coveringZoomLevel(Re);const Ue=Oe,qe=this.elevation&&this.elevation.exaggeration(),Ct=qe&&!Re.isTerrainDEM,Ot="mercator"===this.projection.name;if(void 0!==Re.minzoom&&Oe<Re.minzoom)return[];void 0!==Re.maxzoom&&Oe>Re.maxzoom&&(Oe=Re.maxzoom);const Jt=this.locationCoordinate(this.center),_i=this.center.lat,xi=1<<Oe,vi=[xi*Jt.x,xi*Jt.y,0],bi="globe"===this.projection.name,Pi=!bi,Hr=Le.bN.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,Oe,Pi),Jr=bi?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),Ln=xi*Le.bD(1,this.center.lat),Nn=this._camera.position[2]/Le.bD(1,this.center.lat),Gn=[xi*Jr.x,xi*Jr.y,Nn*(Pi?1:Ln)],qn=bi||qe,Zn=this.cameraToCenterDistance/Re.tileSize*(Re.roundZoom?1:.502),$n=this.isLODDisabled(!0)?Oe:0;let Xn;if(this._elevation&&Re.isTerrainDEM)Xn=1e4*this._elevation.exaggeration();else if(this._elevation){const Le=this._elevation.getMinMaxForVisibleTiles();Xn=Le?Le.max:this._centerAltitude}else Xn=this._centerAltitude;const Yn=Re.isTerrainDEM?-Xn:this._elevation?this._elevation.getMinElevationBelowMSL():0,lo=this.projection.isReprojectedInTileSpace?Le.bO(this):1,E=Re=>{const Oe=1/4e4,Ue=new Le.a5(Re.x+Oe,Re.y,Re.z),qe=new Le.a5(Re.x,Re.y+Oe,Re.z),Ct=Re.toLngLat(),Ot=Ue.toLngLat(),Jt=qe.toLngLat(),_i=this.locationCoordinate(Ct),xi=this.locationCoordinate(Ot),vi=this.locationCoordinate(Jt),bi=Math.hypot(xi.x-_i.x,xi.y-_i.y),Pi=Math.hypot(vi.x-_i.x,vi.y-_i.y);return Math.sqrt(bi*Pi)*lo/Oe},C=Re=>{const Oe=Xn,Ue=Yn;return{aabb:Le.bR(this,xi,0,0,0,Re,Ue,Oe,this.projection),zoom:0,x:0,y:0,minZ:Ue,maxZ:Oe,wrap:Re,fullyVisible:!1}},uo=[];let po=[];const fo=Oe,Io=Re.reparseOverscaled?Ue:Oe,is=(Nn-this._centerAltitude)*Ln,L=Le=>{if(!this._elevation||!Le.tileID||!Ot)return;const Re=this._elevation.getMinMaxForTile(Le.tileID),Oe=Le.aabb;Re?(Oe.min[2]=Re.min,Oe.max[2]=Re.max,Oe.center[2]=(Oe.min[2]+Oe.max[2])/2):(Le.shouldSplit=M(Le),Le.shouldSplit||(Oe.min[2]=Oe.max[2]=Oe.center[2]=this._centerAltitude))},P=(Le,Re)=>{if(.707*Re<Le)return 1;const Oe=Re/Le;return Oe/(1.4144271570014144+(Math.pow(1.1,Oe-1.4144271570014144+1)-1)/(1.1-1)-1)},M=Re=>{if(Re.zoom<$n)return!0;if(Re.zoom===fo)return!1;if(null!=Re.shouldSplit)return Re.shouldSplit;const Oe=Re.aabb.distanceX(Gn),qe=Re.aabb.distanceY(Gn);let Jt=is,xi=1;if(bi){Jt=Re.aabb.distanceZ(Gn);const Oe=Math.pow(2,Re.zoom),Ue=Le.aM((Re.y+1)/Oe),qe=Le.aM(Re.y/Oe),Ct=Math.min(Math.max(_i,Ue),qe),Ot=Le.c5(Ct)/Le.c5(_i);if(xi=Ct===_i?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Ot/this._mercatorScaleRatio),this.zoom<=Le.c2&&Re.zoom===fo-1&&Ot>=.9)return!0}else if(Ct&&(Jt=Re.aabb.distanceZ(Gn)*Ln),this.projection.isReprojectedInTileSpace&&Ue<=5){const Oe=Math.pow(2,Re.zoom),Ue=E(new Le.a5((Re.x+.5)/Oe,(Re.y+.5)/Oe));xi=Ue>.85?1:Ue}if(!Ot){const Le=Math.sqrt(Oe*Oe+qe*qe+Jt*Jt);let Ue=(1<<fo-Re.zoom)*Zn*xi;return Ue*=P(Math.max(Jt,is),Le),Le<Ue}let Pi=Number.MAX_VALUE,Hr=0;const Jr=Re.aabb.getCorners(),Nn=[];for(const Re of Jr){Le.a6.vec3.sub(Nn,Re,Gn),bi||(Ct?Nn[2]*=Ln:Nn[2]=is);const Oe=Le.a6.vec3.dot(Nn,this._camera.forward());Oe<Pi&&(Pi=Oe,Hr=Math.abs(Nn[2]))}let qn=(1<<fo-Re.zoom)*Zn*xi;if(qn*=P(Math.max(Hr,is),Pi),Pi<qn)return!0;const Xn=Re.aabb.closestPoint(vi);
1return Xn[0]===vi[0]&&Xn[1]===vi[1]};if(this.renderWorldCopies)for(let Le=1;Le<=3;Le++)uo.push(C(-Le)),uo.push(C(Le));for(uo.push(C(0));uo.length>0;){const Ue=uo.pop(),qe=Ue.x,Jt=Ue.y;let _i=Ue.fullyVisible;const d=()=>"globe"===this.projection.name&&(0===Ue.y||Ue.y===(1<<Ue.zoom)-1);if(!_i){let Re=qn?Ue.aabb.intersects(Hr):Ue.aabb.intersectsFlat(Hr);if(0===Re&&d()){const Oe=new Le.bP(Ue.zoom,qe,Jt);Re=Le.bQ(this,xi,Oe,!0).intersects(Hr)}if(0===Re)continue;_i=2===Re}if(Ue.zoom!==fo&&M(Ue))for(let Re=0;Re<4;Re++){const Oe=(qe<<1)+Re%2,vi=(Jt<<1)+(Re>>1),Pi={aabb:Ot?Ue.aabb.quadrant(Re):Le.bR(this,xi,Ue.zoom+1,Oe,vi,Ue.wrap,Ue.minZ,Ue.maxZ,this.projection),zoom:Ue.zoom+1,x:Oe,y:vi,wrap:Ue.wrap,fullyVisible:_i,tileID:void 0,shouldSplit:void 0,minZ:Ue.minZ,maxZ:Ue.maxZ};Ct&&!bi&&(Pi.tileID=new Le.aA(Ue.zoom+1===fo?Io:Ue.zoom+1,Ue.wrap,Ue.zoom+1,Oe,vi),L(Pi)),uo.push(Pi)}else{const Ct=Ue.zoom===fo?Io:Ue.zoom;if(Re.minzoom&&Re.minzoom>Ct)continue;let Ot=0;if(!_i){let Oe=qn?Ue.aabb.intersectsPrecise(Hr):Ue.aabb.intersectsPreciseFlat(Hr);if(0===Oe&&d()){const Re=new Le.bP(Ue.zoom,qe,Jt);Oe=Le.bQ(this,xi,Re,!0).intersectsPrecise(Hr)}if(0===Oe)continue;if(Re.calculateQuadrantVisibility)if(Hr.containsPoint(Ue.aabb.center))Ot=15;else for(let Le=0;Le<4;Le++)0!==Ue.aabb.quadrant(Le).intersects(Hr)&&(Ot|=1<<Le)}const bi=vi[0]-(.5+qe+(Ue.wrap<<Ue.zoom))*(1<<Oe-Ue.zoom),Pi=vi[1]-.5-Jt,Jr=Ue.tileID?Ue.tileID:new Le.aA(Ct,Ue.wrap,Ue.zoom,qe,Jt);Re.calculateQuadrantVisibility&&(Jr.visibleQuadrants=Ot),po.push({tileID:Jr,distanceSq:bi*bi+Pi*Pi})}}if(this.fogCullDistSq){const Oe=this.fogCullDistSq,Ue=this.horizonLineFromTop();po=po.filter((qe=>{const Ct=[0,0,0,1],Ot=[Le.ab,Le.ab,0,1],Jt=this.calculateFogTileMatrix(qe.tileID.toUnwrapped());Le.a6.vec4.transformMat4(Ct,Ct,Jt),Le.a6.vec4.transformMat4(Ot,Ot,Jt);const _i=Le.a6.vec4.min([],Ct,Ot),xi=Le.a6.vec4.max([],Ct,Ot),vi=Le.bS(_i,xi);if(0===vi)return!0;let bi=!1;const Pi=this._elevation;if(Pi&&vi>Oe&&0!==Ue){const Oe=this.calculateProjMatrix(qe.tileID.toUnwrapped());let Ct;Re.isTerrainDEM||(Ct=Pi.getMinMaxForTile(qe.tileID)),Ct||(Ct={min:Yn,max:Xn});const Ot=Le.c3(this.rotation),Jt=[Ot[0]*Le.ab,Ot[1]*Le.ab,Ct.max];Le.a6.vec3.transformMat4(Jt,Jt,Oe),bi=(1-Jt[1])*this.height*.5<Ue}return vi<Oe||bi}))}return po.sort(((Le,Re)=>Le.distanceSq-Re.distanceSq)).map((Le=>Le.tileID))}resize(Le,Re){this.width=Le,this.height=Re,this.pixelsToGLUnits=[2/Le,-2/Re],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(Le){return Math.pow(2,Le)}scaleZoom(Le){return Math.log(Le)/Math.LN2}project(Re){const Oe=Le.ap(Re.lat,-Le.bT,Le.bT),Ue=this.projection.project(Re.lng,Oe);return new Le.P(Ue.x*this.worldSize,Ue.y*this.worldSize)}unproject(Le){return this.projection.unproject(Le.x/this.worldSize,Le.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/Le.bD(1,this.center.lat)/this.worldSize}setLocationAtPoint(Re,Oe){let Ue,qe;const Ct=this.centerPoint;if("globe"===this.projection.name){const Le=this.worldSize;Ue=(Oe.x-Ct.x)/Le,qe=(Oe.y-Ct.y)/Le}else{const Le=this.pointCoordinate(Oe),Re=this.pointCoordinate(Ct);Ue=Le.x-Re.x,qe=Le.y-Re.y}const Ot=this.locationCoordinate(Re);this.setLocation(new Le.a5(Ot.x-Ue,Ot.y-qe))}setLocation(Le){this.center=this.coordinateLocation(Le),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(Le){return this.projection.locationPoint(this,Le)}locationPoint3D(Le){return this.projection.locationPoint(this,Le,!0)}pointLocation(Le){return this.coordinateLocation(this.pointCoordinate(Le))}pointLocation3D(Le){return this.coordinateLocation(this.pointCoordinate3D(Le))}locationCoordinate(Re,Oe){const Ue=Oe?Le.bD(Oe,Re.lat):void 0,qe=this.projection.project(Re.lng,Re.lat);return new Le.a5(qe.x,qe.y,Ue)}coordinateLocation(Le){return this.projection.unproject(Le.x,Le.y)}pointRayIntersection(Re,Oe){const Ue=null!=Oe?Oe:this._centerAltitude,qe=[Re.x,Re.y,0,1],Ct=[Re.x,Re.y,1,1];Le.a6.vec4.transformMat4(qe,qe,this.pixelMatrixInverse),Le.a6.vec4.transformMat4(Ct,Ct,this.pixelMatrixInverse);const Ot=Ct[3];Le.a6.vec4.scale(qe,qe,1/qe[3]),Le.a6.vec4.scale(Ct,Ct,1/Ot);const Jt=qe[2],_i=Ct[2];return{p0:qe,p1:Ct,t:Jt===_i?0:(Ue-Jt)/(_i-Jt)}}screenPointToMercatorRay(Re){const Oe=[Re.x,Re.y,0,1],Ue=[Re.x,Re.y,1,1];return Le.a6.vec4.transformMat4(Oe,Oe,this.pixelMatrixInverse),Le.a6.vec4.transformMat4(Ue,Ue,this.pixelMatrixInverse),Le.a6.vec4.scale(Oe,Oe,1/Oe[3]),Le.a6.vec4.scale(Ue,Ue,1/Ue[3]),Oe[2]=Le.bD(Oe[2],this._center.lat)*this.worldSize,Ue[2]=Le.bD(Ue[2],this._center.lat)*this.worldSize,Le.a6.vec4.scale(Oe,Oe,1/this.worldSize),Le.a6.vec4.scale(Ue,Ue,1/this.worldSize),new Le.aj([Oe[0],Oe[1],Oe[2]],Le.a6.vec3.normalize([],Le.a6.vec3.sub([],Ue,Oe)))}rayIntersectionCoordinate(Re){const{p0:Oe,p1:Ue,t:qe}=Re,Ct=Le.bD(Oe[2],this._center.lat),Ot=Le.bD(Ue[2],this._center.lat);return new Le.a5(Le.aa(Oe[0],Ue[0],qe)/this.worldSize,Le.aa(Oe[1],Ue[1],qe)/this.worldSize,Le.aa(Ct,Ot,qe))}pointCoordinate(Le,Re=this._centerAltitude){return this.projection.pointCoordinate(this,Le.x,Le.y,Re)}pointCoordinate3D(Re){if(!this.elevation)return this.pointCoordinate(Re);let Oe=this.projection.pointCoordinate3D(this,Re.x,Re.y);if(Oe)return new Le.a5(Oe[0],Oe[1],Oe[2]);let Ue=0,qe=this.horizonLineFromTop();if(Re.y>qe)return this.pointCoordinate(Re);const Ct=.02*qe,Ot=Re.clone();for(let Re=0;Re<10&&qe-Ue>Ct;Re++){Ot.y=Le.aa(Ue,qe,.66);const Re=this.projection.pointCoordinate3D(this,Ot.x,Ot.y);Re?(qe=Ot.y,Oe=Re):Ue=Ot.y}return Oe?new Le.a5(Oe[0],Oe[1],Oe[2]):this.pointCoordinate(Re)}isPointAboveHorizon(Le){return this.projection.isPointAboveHorizon(this,Le)}isPointOnSurface(Re){if(Re.y<0||Re.y>this.height||Re.x<0||Re.x>this.width)return!1;if(this.elevation||this.zoom>=Le.bU)return!this.isPointAboveHorizon(Re);const Oe=this.pointCoordinate(Re);return Oe.y>=0&&Oe.y<=1}_coordinatePoint(Re,Oe){const Ue=Oe&&this.elevation?this.elevation.getAtPointOrZero(Re,this._centerAltitude):this._centerAltitude,qe=[Re.x*this.worldSize,Re.y*this.worldSize,Ue+Re.toAltitude(),1];return Le.a6.vec4.transformMat4(qe,qe,this.pixelMatrix),qe[3]>0?new Le.P(qe[0]/qe[3],qe[1]/qe[3]):new Le.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:Re,left:Oe}=this._edgeInsets,Ue=this.height-this._edgeInsets.bottom,qe=this.width-this._edgeInsets.right,Ct=this.pointLocation3D(new Le.P(Oe,Re)),Ot=this.pointLocation3D(new Le.P(qe,Re)),Jt=this.pointLocation3D(new Le.P(qe,Ue)),_i=this.pointLocation3D(new Le.P(Oe,Ue));let xi=Math.min(Ct.lng,Ot.lng,Jt.lng,_i.lng),vi=Math.max(Ct.lng,Ot.lng,Jt.lng,_i.lng),bi=Math.min(Ct.lat,Ot.lat,Jt.lat,_i.lat),Pi=Math.max(Ct.lat,Ot.lat,Jt.lat,_i.lat);const Hr=Math.pow(2,-this.zoom)/16*270,Jr="globe"===this.projection.name?1:4,m=(Re,Oe,Ue,qe,Ct)=>{const Ot=(Re+Ue)/2,Jt=(Oe+qe)/2,_i=new Le.P(Ot,Jt),{lng:Ln,lat:Nn}=this.pointLocation3D(_i),Gn=Math.max(0,xi-Ln,bi-Nn,Ln-vi,Nn-Pi);xi=Math.min(xi,Ln),vi=Math.max(vi,Ln),bi=Math.min(bi,Nn),Pi=Math.max(Pi,Nn),(Ct<Jr||Gn>Hr)&&(m(Re,Oe,Ot,Jt,Ct+1),m(Ot,Jt,Ue,qe,Ct+1))};if(m(Oe,Re,qe,Re,1),m(qe,Re,qe,Ue,1),m(qe,Ue,Oe,Ue,1),m(Oe,Ue,Oe,Re,1),"globe"===this.projection.name){const[Re,Oe]=Le.bV(this);Re?(Pi=90,vi=180,xi=-180):Oe&&(bi=-90,vi=180,xi=-180)}return new Le.as(new Le.bK(xi,bi),new Le.bK(vi,Pi))}
vendor: 6,714 bytes, line 1
1_getBoundsRectangular(Re,Oe){const{top:Ue,left:qe}=this._edgeInsets,Ct=this.height-this._edgeInsets.bottom,Ot=this.width-this._edgeInsets.right,Jt=new Le.P(qe,Ue),_i=new Le.P(Ot,Ue),xi=new Le.P(Ot,Ct),vi=new Le.P(qe,Ct);let bi=this.pointCoordinate(Jt,Re),Pi=this.pointCoordinate(_i,Re);const Hr=this.pointCoordinate(xi,Oe),Jr=this.pointCoordinate(vi,Oe),m=(Le,Re)=>(Re.y-Le.y)/(Re.x-Le.x);return bi.y>1&&Pi.y>=0?bi=new Le.a5((1-Jr.y)/m(Jr,bi)+Jr.x,1):bi.y<0&&Pi.y<=1&&(bi=new Le.a5(-Jr.y/m(Jr,bi)+Jr.x,0)),Pi.y>1&&bi.y>=0?Pi=new Le.a5((1-Hr.y)/m(Hr,Pi)+Hr.x,1):Pi.y<0&&bi.y<=1&&(Pi=new Le.a5(-Hr.y/m(Hr,Pi)+Hr.x,0)),(new Le.as).extend(this.coordinateLocation(bi)).extend(this.coordinateLocation(Pi)).extend(this.coordinateLocation(Jr)).extend(this.coordinateLocation(Hr))}_getBoundsRectangularTerrain(){const Le=this.elevation;if(!Le.visibleDemTiles.length||Le.isUsingMockSource())return this._getBoundsRectangular(0,0);const Re=Le.visibleDemTiles.reduce(((Le,Re)=>{if(Re.dem){const Oe=Re.dem.tree;Le.min=Math.min(Le.min,Oe.minimums[0]),Le.max=Math.max(Le.max,Oe.maximums[0])}return Le}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(Re.min*Le.exaggeration(),Re.max*Le.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(Le=!0){const Re=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,Oe=this.height/2-Re*(1-this._horizonShift);return Le?Math.max(0,Oe):Oe}getMaxBounds(){return this.maxBounds}setMaxBounds(Re){this.maxBounds=Re,this.minLat=-Le.bT,this.maxLat=Le.bT,this.minLng=-180,this.maxLng=180,Re&&(this.minLat=Re.getSouth(),this.maxLat=Re.getNorth(),this.minLng=Re.getWest(),this.maxLng=Re.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=Le.am(this.minLng)*this.tileSize,this.worldMaxX=Le.am(this.maxLng)*this.tileSize,this.worldMinY=Le.at(this.maxLat)*this.tileSize,this.worldMaxY=Le.at(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(Le,Re){return this.projection.createTileMatrix(this,Re,Le)}calculateDistanceTileData(Re){const Oe=Re.key,Ue=this._distanceTileDataCache;if(Ue[Oe])return Ue[Oe];const qe=Re.canonical,Ct=1/this.height,Ot=this.cameraWorldSize,Jt=Ot/this.zoomScale(qe.z),_i=(qe.x+Math.pow(2,qe.z)*Re.wrap)*Jt,xi=qe.y*Jt,vi=this.point;vi.x*=Ot/this.worldSize,vi.y*=Ot/this.worldSize;const bi=this.angle,Pi=Math.sin(-bi),Hr=-Math.cos(-bi);return Ue[Oe]={bearing:[Pi,Hr],center:[(vi.x-_i)*Ct,(vi.y-xi)*Ct],scale:Jt/Le.ab*Ct},Ue[Oe]}calculateFogTileMatrix(Re){const Oe=Re.key,Ue=this._fogTileMatrixCache;if(Ue[Oe])return Ue[Oe];const qe=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,Re);return Le.a6.mat4.multiply(qe,this.worldToFogMatrix,qe),Ue[Oe]=new Float32Array(qe),Ue[Oe]}calculateProjMatrix(Re,Oe=!1,Ue=!1){const qe=Re.key;let Ct;if(Ct=Ue?this._expandedProjMatrixCache:Oe?this._alignedProjMatrixCache:this._projMatrixCache,Ct[qe])return Ct[qe];const Ot=this.calculatePosMatrix(Re,this.worldSize);let Jt;return Jt=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:Ue?this.expandedFarZProjMatrix:Oe?this.alignedProjMatrix:this.projMatrix,Le.a6.mat4.multiply(Ot,Jt,Ot),Ct[qe]=new Float32Array(Ot),Ct[qe]}calculatePixelsToTileUnitsMatrix(Re){const Oe=Re.tileID.key,Ue=this._pixelsToTileUnitsCache;if(Ue[Oe])return Ue[Oe];const qe=Le.bW(Re,this);return Ue[Oe]=qe,Ue[Oe]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){const Re=1/this.worldSize,Oe=Le.a6.mat4.fromScaling([],[Re,Re,Re]);return Le.a6.mat4.multiply(Oe,Oe,this.globeMatrix),Oe}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;const Re=this._elevation;this._updateCameraState();const Oe=Le.bD(1,this._center.lat)*this.worldSize,Ue=this._computeCameraPosition(Oe),qe=this._camera.forward(),Ct=Le.bD(1,this._center.lat);Ue[2]/=Ct,qe[2]/=Ct,Le.a6.vec3.normalize(qe,qe);const Ot=Re.raycast(Ue,qe,Re.exaggeration());if(Ot){const Re=Le.a6.vec3.scaleAndAdd([],Ue,qe,Ot),Oe=new Le.a5(Re[0],Re[1],Le.bD(Re[2],Le.aM(Re[1]))),Jt=(Oe.z+Le.a6.vec3.length([Oe.x-Ue[0],Oe.y-Ue[1],Oe.z-Ue[2]*Ct]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(Jt),this._centerAltitude=Oe.toAltitude(),this._center=this.coordinateLocation(Oe),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(Re=!1){if(!this._elevation)return;const Oe=this._elevation,Ue=Le.bD(1,this._center.lat)*this.worldSize,qe=this._computeCameraPosition(Ue),Ct=Oe.getAtPointOrZero(new Le.a5(...qe)),Ot=this.pixelsPerMeter/this.worldSize*Ct,Jt=this._minimumHeightOverTerrain(),_i=qe[2]-Ot;if(_i<=Jt)if(_i<0||Re){const Re=this.locationCoordinate(this._center,this._centerAltitude),Oe=[qe[0],qe[1],Re.z-qe[2]],Ue=Le.a6.vec3.length(Oe);Oe[2]-=(Jt-_i)/this._pixelsPerMercatorPixel;const Ct=Le.a6.vec3.length(Oe);if(0===Ct)return;Le.a6.vec3.scale(Oe,Oe,Ue/Ct*this._pixelsPerMercatorPixel),this._camera.position=[qe[0],qe[1],Re.z*this._pixelsPerMercatorPixel-Oe[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const Re="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||Re){const Oe=this.center;return Oe.lat=Le.ap(Oe.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!Re)&&(Oe.lng=Le.ap(Oe.lng,this.minLng,this.maxLng)),this.center=Oe,void(this._constraining=!1)}const Oe=this._unmodified,{x:Ue,y:qe}=this.point;let Ct=0,Ot=Ue,Jt=qe;const _i=this.width/2,xi=this.height/2,vi=this.worldMinY*this.scale,bi=this.worldMaxY*this.scale;if(qe-xi<vi&&(Jt=vi+xi),qe+xi>bi&&(Jt=bi-xi),bi-vi<this.height&&(Ct=Math.max(Ct,this.height/(bi-vi)),Jt=(bi+vi)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const Le=this.worldMinX*this.scale,Re=this.worldMaxX*this.scale,Oe=this.worldSize/2-(Le+Re)/2;Ot=(Ue+Oe+this.worldSize)%this.worldSize-Oe,Ot-_i<Le&&(Ot=Le+_i),Ot+_i>Re&&(Ot=Re-_i),Re-Le<this.width&&(Ct=Math.max(Ct,this.width/(Re-Le)),Ot=(Re+Le)/2)}Ot===Ue&&Jt===qe||(this.center=this.unproject(new Le.P(Ot,Jt))),Ct&&(this.zoom+=this.scaleZoom(Ct)),this._constrainCamera(),this._unmodified=Oe,this._constraining=!1}_minZoomForBounds(){let Le=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(Le=Math.max(Le,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),Le}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
1_calcMatrices(){if(!this.height)return;const Re=this.centerOffset,Oe="globe"===this.projection.name,Ue=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=Le.bD(1,this.center.lat)/Le.bD(1,Le.c4));const qe=Le.bX(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,qe),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const Ct="meters"===this.projection.zAxisUnit?Ue:1,Ot=this._camera.getWorldToCamera(this.worldSize,Ct);let Jt;const _i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(_i[8]=2*-Re.x/this.width,_i[9]=2*Re.y/this.height,this.isOrthographic){let Le=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),Oe=Le*this.aspect,Ue=-Oe,qe=-Le;Oe-=Re.x,Ue-=Re.x,Le+=Re.y,qe+=Re.y,Jt=this._camera.getCameraToClipOrthographic(Ue,Oe,qe,Le,this._nearZ,this._farZ),((Le,Re,Oe,Ue)=>{for(let qe=0;qe<16;qe++)Le[qe]=qi(Re[qe],Oe[qe],Ue)})(Jt,Jt,_i,Zi(this.pitch>=15?1:this.pitch/15))}else Jt=_i;const xi=Le.a6.mat4.mul([],_i,Ot);let vi=Le.a6.mat4.mul([],Jt,Ot);if(this.projection.isReprojectedInTileSpace){const Re=this.locationCoordinate(this.center),Oe=Le.a6.mat4.identity([]);Le.a6.mat4.translate(Oe,Oe,[Re.x*this.worldSize,Re.y*this.worldSize,0]),Le.a6.mat4.multiply(Oe,Oe,Le.bY(this)),Le.a6.mat4.translate(Oe,Oe,[-Re.x*this.worldSize,-Re.y*this.worldSize,0]),Le.a6.mat4.multiply(vi,vi,Oe),Le.a6.mat4.multiply(xi,xi,Oe),this.inverseAdjustmentMatrix=Le.bZ(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=Le.a6.mat4.scale([],vi,[this.worldSize,this.worldSize,this.worldSize/Ct,1]),this.projMatrix=vi,this.invProjMatrix=Le.a6.mat4.invert(new Float64Array(16),this.projMatrix),Oe){const Oe=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);Oe[8]=2*-Re.x/this.width,Oe[9]=2*Re.y/this.height,this.expandedFarZProjMatrix=Le.a6.mat4.mul([],Oe,Ot)}else this.expandedFarZProjMatrix=this.projMatrix;const bi=Le.a6.mat4.invert([],Jt);this.frustumCorners=Le.b_.fromInvProjectionMatrix(bi,this.horizonLineFromTop(),this.height),this.cameraFrustum=Le.bN.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!Oe);const Pi=new Float32Array(16);Le.a6.mat4.identity(Pi),Le.a6.mat4.scale(Pi,Pi,[1,-1,1]),Le.a6.mat4.rotateX(Pi,Pi,this._pitch),Le.a6.mat4.rotateZ(Pi,Pi,this.angle);const Hr=Le.a6.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=Le.a6.mat4.clone(Hr);const Jr=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;Hr[8]=2*-Re.x/this.width,Hr[9]=2*(Re.y+Jr)/this.height,this.skyboxMatrix=Le.a6.mat4.multiply(Pi,Hr,Pi);const Ln=this.point,Nn=Ln.x,Gn=Ln.y,qn=this.width%2/2,Zn=this.height%2/2,$n=Math.cos(this.angle),Xn=Math.sin(this.angle),Yn=Nn-Math.round(Nn)+$n*qn+Xn*Zn,lo=Gn-Math.round(Gn)+$n*Zn+Xn*qn,uo=new Float64Array(vi);if(Le.a6.mat4.translate(uo,uo,[Yn>.5?Yn-1:Yn,lo>.5?lo-1:lo,0]),this.alignedProjMatrix=uo,vi=Le.a6.mat4.create(),Le.a6.mat4.scale(vi,vi,[this.width/2,-this.height/2,1]),Le.a6.mat4.translate(vi,vi,[1,-1,0]),this.labelPlaneMatrix=vi,vi=Le.a6.mat4.create(),Le.a6.mat4.scale(vi,vi,[1,-1,1]),Le.a6.mat4.translate(vi,vi,[-1,-1,0]),Le.a6.mat4.scale(vi,vi,[2/this.width,2/this.height,1]),this.glCoordMatrix=vi,this.pixelMatrix=Le.a6.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,xi),this._calcFogMatrices(),this._distanceTileDataCache={},vi=Le.a6.mat4.invert(new Float64Array(16),this.pixelMatrix),!vi)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=vi,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=Le.b$(this);const Re=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=Le.a6.vec3.transformMat4(Re,Re,Ot),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=vi;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const Re=this.cameraWorldSizeForFog,Oe=this.cameraPixelsPerMeter,Ue=this._camera.position,qe=1/this.height/this._pixelsPerMercatorPixel,Ct=[Re,Re,Oe];Le.a6.vec3.scale(Ct,Ct,qe),Le.a6.vec3.scale(Ue,Ue,-1),Le.a6.vec3.multiply(Ue,Ue,Ct);const Ot=Le.a6.mat4.create();Le.a6.mat4.translate(Ot,Ot,Ue),Le.a6.mat4.scale(Ot,Ot,Ct),this.mercatorFogMatrix=Ot,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(Re,Oe,qe)}_computeCameraPosition(Le){const Re=(Le=Le||this.pixelsPerMeter)/this.pixelsPerMeter,Oe=this._camera.forward(),Ue=this.point,qe=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*Re-Le/this.worldSize*this._centerAltitude;return[Ue.x/this.worldSize-Oe[0]*qe,Ue.y/this.worldSize-Oe[1]*qe,Le/this.worldSize*this._centerAltitude-Oe[2]*qe]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(Re){const Oe=this._maxCameraBoundsDistance()*Math.cos(this._pitch),Ue=this._camera.position[2],qe=Re[2];let Ct=1;this.projection.wrap&&(this.center=this.center.wrap()),qe>0&&(Ct=Math.min((Oe-Ue)/qe,1)),this._camera.position=Le.a6.vec3.scaleAndAdd([],this._camera.position,Re,Ct),this._updateStateFromCamera()}_updateStateFromCamera(){const Re=this._camera.position,Oe=this._camera.forward(),{pitch:Ue,bearing:qe}=this._camera.getPitchBearing(),Ct=Le.bD(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,Ot=this._mercatorZfromZoom(this._maxZoom)*Math.cos(Le.bB(this._maxPitch)),Jt=Math.max((Re[2]-Ct)/Math.cos(Ue),Ot),_i=this._zoomFromMercatorZ(Jt);Le.a6.vec3.scaleAndAdd(Re,Re,Oe,Jt),this._pitch=Le.ap(Ue,Le.bB(this.minPitch),Le.bB(this.maxPitch)),this.angle=Le.bA(qe,-Math.PI,Math.PI),this._setZoom(Le.ap(_i,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new Le.a5(Re[0],Re[1],Re[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(Le){return Math.pow(2,Le)*this.tileSize}_mercatorZfromZoom(Le){return this.cameraToCenterDistance/this._worldSizeFromZoom(Le)}_minimumHeightOverTerrain(){const Le=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(Le)}_zoomFromMercatorZ(Le){return this.scaleZoom(this.cameraToCenterDistance/(Le*this.tileSize))}zoomFromMercatorZAdjusted(Re){let Oe=0,Ue=Le.bU,qe=0,Ct=1/0;for(;
1Ue-Oe>1e-6&&Ue>Oe;){const Le=Oe+.5*(Ue-Oe),Ot=this.tileSize*Math.pow(2,Le),Jt=this.getCameraToCenterDistance(this.projection,Le,Ot),_i=this.scaleZoom(Jt/(Re*this.tileSize)),xi=Math.abs(Le-_i);xi<Ct&&(Ct=xi,qe=Le),Le<_i?Oe=Le:Ue=Le}return qe}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(Le.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(Re,Oe){const Ue=Math.min(Re.x,Oe.x),qe=Math.max(Re.x,Oe.x),Ct=Math.min(Re.y,Oe.y),Ot=Math.max(Re.y,Oe.y);if(Ct<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;const Jt=[new Le.P(Ue,Ct),new Le.P(qe,Ot),new Le.P(Ue,Ot),new Le.P(qe,Ct)],_i=this.renderWorldCopies?-3:0,xi=this.renderWorldCopies?4:1;for(const Le of Jt){const Re=this.pointRayIntersection(Le);if(Re.t<0)return!0;const Oe=this.rayIntersectionCoordinate(Re);if(Oe.x<_i||Oe.y<0||Oe.x>xi||Oe.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+Le.c0(this.fovAboveCenter)>88||this.anyCornerOffEdge(new Le.P(0,0),new Le.P(this.width,this.height))}zoomDeltaToMovement(Re,Oe){const Ue=Le.a6.vec3.length(Le.a6.vec3.sub([],this._camera.position,Re)),qe=this._zoomFromMercatorZ(Ue)+Oe;return Ue-this._mercatorZfromZoom(qe)}getCameraPoint(){if("globe"===this.projection.name){const Re=function([Re,Oe,Ue],qe){const Ct=[Re,Oe,Ue,1];Le.a6.vec4.transformMat4(Ct,Ct,qe);const Ot=Ct[3]=Math.max(Ct[3],1e-6);return Ct[0]/=Ot,Ct[1]/=Ot,Ct[2]/=Ot,Ct}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new Le.P(Re[0],Re[1])}{const Re=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Le.P(0,Re))}}getCameraToCenterDistance(Re,Oe=this.zoom,Ue=this.worldSize){const qe=Le.bX(Re,Oe,this.width,this.height,1024),Ct=Re.pixelSpaceConversion(this.center.lat,Ue,qe);let Ot=.5/Math.tan(.5*this._fov)*this.height*Ct;return this.isOrthographic&&(Ot=qi(1,Ot,Zi(this.pitch>=15?1:this.pitch/15))),Ot}getWorldToCameraMatrix(){const Re=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&Le.a6.mat4.multiply(Re,Re,this.globeMatrix),Re}getFrustum(Re){return Le.bN.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,Re,"meters"===this.projection.zAxisUnit)}}const Wi=(Re,Oe)=>{if(Oe>0&&Re.terrain&&Le.w("Cutoff is currently disabled on terrain"),Oe<=0||Re.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const Ue=Re.transform,qe=Math.max(Math.abs(Ue._zoom-(Re.minCutoffZoom-1)),1),Ct=Ue.isLODDisabled(!1)?Le.a7(60,45,Ue.pitch):Le.a7(30,15,Ue.pitch),Ot=Ue._farZ-Ue._nearZ,Jt=Oe*Ue.height,_i=((1-(xi=Ct))*Ue.cameraToCenterDistance+xi*(Ue._farZ+Jt))*qe;var xi;return{shouldRenderCutoff:Ct<1,uniformValues:{u_cutoff_params:[Ue._nearZ,Ue._farZ,(_i-Ue._nearZ)/Ot,(_i-Jt-Ue._nearZ)/Ot]}}},ih={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class Xi{constructor(Le,Re){this.aabb=Le,this.lastCascade=Re}}class Yi{add(Le,Re){const Oe=this.receivers[Le.key];void 0!==Oe?(Oe.aabb.min[0]=Math.min(Oe.aabb.min[0],Re.min[0]),Oe.aabb.min[1]=Math.min(Oe.aabb.min[1],Re.min[1]),Oe.aabb.min[2]=Math.min(Oe.aabb.min[2],Re.min[2]),Oe.aabb.max[0]=Math.max(Oe.aabb.max[0],Re.max[0]),Oe.aabb.max[1]=Math.max(Oe.aabb.max[1],Re.max[1]),Oe.aabb.max[2]=Math.max(Oe.aabb.max[2],Re.max[2])):this.receivers[Le.key]=new Xi(Re,null)}clear(){this.receivers={}}get(Le){return this.receivers[Le.key]}computeRequiredCascades(Re,Oe,Ue){const qe=Le.c9.fromPoints(Re.points);let Ct=0;for(const Re in this.receivers){const Ot=this.receivers[Re];if(!Ot)continue;if(!qe.intersectsAabb(Ot.aabb))continue;Ot.aabb.min=qe.closestPoint(Ot.aabb.min),Ot.aabb.max=qe.closestPoint(Ot.aabb.max);const Jt=Ot.aabb.getCorners();for(let Re=0;Re<Ue.length;Re++){let qe=!0;for(const Ct of Jt){const Ot=[Ct[0]*Oe,Ct[1]*Oe,Ct[2]];if(Le.a6.vec3.transformMat4(Ot,Ot,Ue[Re].matrix),Ot[0]<-1||Ot[0]>1||Ot[1]<-1||Ot[1]>1){qe=!1;break}}if(Ot.lastCascade=Re,Ct=Math.max(Ct,Re),qe)break}}return Ct+1}}class Ki{constructor(Le){this.painter=Le,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Yi,this._depthMode=new Li(Le.context.gl.LEQUAL,Li.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,Le.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},(()=>{this.painter.style.map.triggerRepaint()})),Le.tp.registerParameter(ih,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),Le.tp.registerParameter(ih,["Shadows"],"normalOffset",{min:0,max:10,step:.
105}),Le.tp.registerParameter(ih,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),Le.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const Le of this._cascades)Le.texture.destroy(),Le.framebuffer.destroy();this._cascades=[]}updateShadowParameters(Re,Oe){const Ue=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!Oe||!Oe.properties)return;const qe=Oe.properties.get("shadow-intensity");if(!Oe.shadowsEnabled()||qe<=0)return;if(this._shadowLayerCount=Ue.style.order.reduce(((Le,Oe)=>{const qe=Ue.style._mergedLayers[Oe];return Le+(qe.hasShadowPass()&&!qe.isHidden(Re.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const Ct=Ue.context,Ot=ih.shadowMapResolution,Jt=ih.shadowMapResolution;if(0===this._cascades.length||ih.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let Re=0;Re<ih.cascadeCount;++Re){const Re=Ue._shadowMapDebug,Oe=Ct.gl,qe=Ct.createFramebuffer(Ot,Jt,Re,"texture"),_i=new Le.T(Ct,{width:Ot,height:Jt,data:null},Oe.DEPTH_COMPONENT16);if(qe.depthAttachment.set(_i.texture),Re){const Re=new Le.T(Ct,{width:Ot,height:Jt,data:null},Oe.RGBA8);qe.colorAttachment.set(Re.texture)}this._cascades.push({framebuffer:qe,texture:_i,matrix:[],far:0,boundingSphereRadius:0,frustum:new Le.bN,scale:0})}}this.shadowDirection=Qi(Oe);let _i=0;if(Re.elevation){const Le=Re.elevation,Oe=[1e4,-1e4];Le.visibleDemTiles.filter((Le=>Le.dem)).forEach((Le=>{const Re=Le.dem.tree;Oe[0]=Math.min(Oe[0],Re.minimums[0]),Oe[1]=Math.max(Oe[1],Re.maximums[0])})),1e4!==Oe[0]&&(_i=(Oe[1]-Oe[0])*Le.exaggeration())}const xi=1.5*Re.cameraToCenterDistance,vi=3*xi,bi=new Float64Array(16);for(let Oe=0;Oe<this._cascades.length;++Oe){const Ue=this._cascades[Oe];let qe=Re.height/50,Ct=1;1===ih.cascadeCount?Ct=vi:0===Oe?Ct=xi:(qe=xi,Ct=vi);const[Ot,Jt]=to(Re,this.shadowDirection,qe,Ct,ih.shadowMapResolution,_i);Ue.scale=Re.scale,Ue.matrix=Ot,Ue.boundingSphereRadius=Jt,Le.a6.mat4.invert(bi,Ue.matrix),Ue.frustum=Le.bN.fromInvProjectionMatrix(bi,1,0,!0),Ue.far=Ct}const Pi=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[Pi].far,this._cascades[Pi].far],this._uniformValues.u_shadow_intensity=qe,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/ih.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=ih.shadowMapResolution,this._uniformValues.u_shadowmap_0=th.ShadowMap0,this._uniformValues.u_shadowmap_1=th.ShadowMap0+1,this._groundShadowTiles=Ue.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const Hr=Ue.transform.elevation;for(const Le of this._groundShadowTiles){let Re={min:0,max:0};if(Hr){const Oe=Hr.getMinMaxForTile(Le);Oe&&(Re=Oe)}this.addShadowReceiver(Le.toUnwrapped(),Re.min,Re.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(Le){this._enabled=Le}drawShadowPass(Re,Oe){if(!this.enabled)return;const Ue=this.painter,qe=Ue.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(Ue.transform.getFrustum(0),Ue.transform.worldSize,this._cascades),qe.viewport.set([0,0,ih.shadowMapResolution,ih.shadowMapResolution]);for(let Ct=0;Ct<this._numCascadesToRender;++Ct){Ue.currentShadowCascade=Ct,qe.bindFramebuffer.set(this._cascades[Ct].framebuffer.framebuffer),qe.clear({color:Le.bz.white,depth:1});for(const Le of Re.order){const qe=Re._mergedLayers[Le];if(!qe.hasShadowPass()||qe.isHidden(Ue.transform.zoom))continue;const Ct=Re.getLayerSourceCache(qe),Ot=Ct?Oe[Ct.id]:void 0;("model"===qe.type||Ot&&Ot.length)&&Ue.renderLayer(Ue,Ct,qe,Ot)}}Ue.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const Le=this.painter,Re=Le.style,Oe=Le.context,Ue=Re.directionalLight,qe=Re.ambientLight;if(!Ue||!qe)return;const Ct=[],Ot=Wi(Le,Le.longestCutoffRange);Ot.shouldRenderCutoff&&Ct.push("RENDER_CUTOFF");const Jt=eo(Re,Ue,qe),_i=new Li(Oe.gl.LEQUAL,Li.ReadOnly,Le.depthRangeFor3D);for(const Re of this._groundShadowTiles){const Ue=Re.toUnwrapped(),qe=Le.isTileAffectedByFog(Re),xi=Le.getOrCreateProgram("groundShadow",{defines:Ct,overrideFog:qe});this.setupShadows(Ue,xi),Le.uploadCommonUniforms(Oe,xi,Ue,null,Ot);const vi={u_matrix:Le.transform.calculateProjMatrix(Ue),u_ground_shadow_factor:Jt};xi.draw(Le,Oe.gl.TRIANGLES,_i,Mi.disabled,Ai.multiply,Fi.disabled,vi,"ground_shadow",Le.tileExtentBuffer,Le.quadTriangleIndexBuffer,Le.tileExtentSegments,{},Le.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Ai.unblended:Ai.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(Re){const Oe=this.painter.transform,Ue=Oe.calculatePosMatrix(Re,Oe.worldSize);return Le.a6.mat4.multiply(Ue,this._cascades[this.painter.currentShadowCascade].matrix,Ue),Float32Array.from(Ue)}
1calculateShadowPassMatrixFromMatrix(Re){return Le.a6.mat4.multiply(Re,this._cascades[this.painter.currentShadowCascade].matrix,Re),Float32Array.from(Re)}setupShadows(Re,Oe,Ue,qe=0){if(!this.enabled)return;const Ct=this.painter.transform,Ot=this.painter.context,Jt=Ot.gl,_i=this._uniformValues,xi=new Float64Array(16),vi=Ct.calculatePosMatrix(Re,Ct.worldSize);for(let Re=0;Re<this._cascades.length;Re++)Le.a6.mat4.multiply(xi,this._cascades[Re].matrix,vi),_i[0===Re?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(xi),Ot.activeTexture.set(Jt.TEXTURE0+th.ShadowMap0+Re),this._cascades[Re].texture.bind(Jt.NEAREST,Jt.CLAMP_TO_EDGE);if(this.useNormalOffset=!!Ue,this.useNormalOffset){const Oe=Le.c8(Re.canonical),Ot=2/Ct.tileSize*Le.ab/ih.shadowMapResolution,Jt=Ot*this._cascades[0].boundingSphereRadius,xi=Ot*this._cascades[this._cascades.length-1].boundingSphereRadius,vi=("vector-tile"===Ue?1:3)/Math.pow(2,qe-Re.canonical.z-(1-Ct.zoom+Math.floor(Ct.zoom)));_i.u_shadow_normal_offset=[Oe,Jt*vi,xi*vi],_i.u_shadow_bias=[6e-5,.0012,.012]}else _i.u_shadow_bias=[36e-5,.0012,.012];Oe.setShadowUniformValues(Ot,_i)}setupShadowsFromMatrix(Re,Oe,Ue=!1){if(!this.enabled)return;const qe=this.painter.context,Ct=qe.gl,Ot=this._uniformValues,Jt=new Float64Array(16);for(let Oe=0;Oe<ih.cascadeCount;Oe++)Le.a6.mat4.multiply(Jt,this._cascades[Oe].matrix,Re),Ot[0===Oe?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(Jt),qe.activeTexture.set(Ct.TEXTURE0+th.ShadowMap0+Oe),this._cascades[Oe].texture.bind(Ct.NEAREST,Ct.CLAMP_TO_EDGE);if(this.useNormalOffset=Ue,Ue){const Le=ih.normalOffset;Ot.u_shadow_normal_offset=[1,Le,Le],Ot.u_shadow_bias=[6e-5,.0012,.012]}else Ot.u_shadow_bias=[36e-5,.0012,.012];Oe.setShadowUniformValues(qe,Ot)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(Re,Oe,Ue,qe){if(qe[2]>=0)return{};const Ct=function(Re,Oe,Ue){const qe=Ue/(1<<Re.canonical.z);return new Le.c9([Re.canonical.x*qe+Re.wrap*Ue,Re.canonical.y*qe+Re.wrap*Ue,0],[(Re.canonical.x+1)*qe+Re.wrap*Ue,(Re.canonical.y+1)*qe+Re.wrap*Ue,Oe])}(Re,Oe,Ue).getCorners(),Ot=Oe/-qe[2];qe[0]<0?(Le.a6.vec3.add(Ct[0],Ct[0],[qe[0]*Ot,0,0]),Le.a6.vec3.add(Ct[3],Ct[3],[qe[0]*Ot,0,0])):qe[0]>0&&(Le.a6.vec3.add(Ct[1],Ct[1],[qe[0]*Ot,0,0]),Le.a6.vec3.add(Ct[2],Ct[2],[qe[0]*Ot,0,0])),qe[1]<0?(Le.a6.vec3.add(Ct[0],Ct[0],[0,qe[1]*Ot,0]),Le.a6.vec3.add(Ct[1],Ct[1],[0,qe[1]*Ot,0])):qe[1]>0&&(Le.a6.vec3.add(Ct[2],Ct[2],[0,qe[1]*Ot,0]),Le.a6.vec3.add(Ct[3],Ct[3],[0,qe[1]*Ot,0]));const Jt={};return Jt.vertices=Ct,Jt.planes=[Ji(Ct[1],Ct[0],Ct[4]),Ji(Ct[2],Ct[1],Ct[5]),Ji(Ct[3],Ct[2],Ct[6]),Ji(Ct[0],Ct[3],Ct[7])],Jt}addShadowReceiver(Re,Oe,Ue){this._receivers.add(Re,Le.c9.fromTileIdAndHeight(Re,Oe,Ue))}getMaxCascadeForTile(Le){const Re=this._receivers.get(Le);return Re&&Re.lastCascade?Re.lastCascade:0}}function Ji(Re,Oe,Ue){const qe=Le.a6.vec3.sub([],Ue,Oe),Ct=Le.a6.vec3.sub([],Re,Oe),Ot=Le.a6.vec3.cross([],qe,Ct),Jt=Le.a6.vec3.length(Ot);return 0===Jt?[0,0,1,0]:(Le.a6.vec3.scale(Ot,Ot,1/Jt),[Ot[0],Ot[1],Ot[2],-Le.a6.vec3.dot(Ot,Oe)])}function Qi(Re){const Oe=Re.properties.get("direction"),Ue=Le.c7(Oe.x,Oe.y,Oe.z);Ue[2]=Le.ap(Ue[2],0,75);const qe=Le.ca([Ue[0],Ue[1],Ue[2]]);return Le.a6.vec3.fromValues(qe.x,qe.y,qe.z)}function eo(Re,Oe,Ue){const qe=Oe.properties.get("color"),Ct=Oe.properties.get("intensity"),Ot=Oe.properties.get("direction"),Jt=[Ot.x,Ot.y,Ot.z],_i=Ue.properties.get("color"),xi=Ue.properties.get("intensity"),vi=Math.max(Le.a6.vec3.dot([0,0,1],Jt),0),bi=[0,0,0];Le.a6.vec3.scale(bi,_i.toRenderColor(Re.getLut(Oe.scope)).toArray01Linear().slice(0,3),xi);const Pi=[0,0,0];return Le.a6.vec3.scale(Pi,qe.toRenderColor(Re.getLut(Ue.scope)).toArray01Linear().slice(0,3),vi*Ct),Le.cb([bi[0]>0?bi[0]/(bi[0]+Pi[0]):0,bi[1]>0?bi[1]/(bi[1]+Pi[1]):0,bi[2]>0?bi[2]/(bi[2]+Pi[2]):0])}function to(Re,Oe,Ue,qe,Ct,Ot){const Jt=Re.zoom,_i=Re.scale,xi=Re.worldSize,vi=1/xi,bi=Re.aspect,Pi=Math.sqrt(1+bi*bi)*Math.tan(.5*Re.fovX),Hr=Pi*Pi,Jr=qe-Ue,Ln=qe+Ue;let Nn,Gn;Hr>Jr/Ln?(Nn=qe,Gn=qe*Pi):(Nn=.5*Ln*(1+Hr),Gn=.5*Math.sqrt(Jr*Jr+2*(qe*qe+Ue*Ue)*Hr+Ln*Ln*Hr*Hr));const qn=Re.projection.pixelsPerMeter(Re.center.lat,xi),Zn=Re._camera.getCameraToWorldMercator(),$n=[0,0,-Nn*vi];Le.a6.vec3.transformMat4($n,$n,Zn);let Xn=Gn*vi;const Yn=Re._edgeInsets;if(!(0===Yn.left&&0===Yn.top&&0===Yn.right&&0===Yn.bottom||Yn.left===Yn.right&&Yn.top===Yn.bottom)){const Oe=Re._camera.getWorldToCamera(Re.worldSize,"meters"===Re.projection.zAxisUnit?qn:1),Ct=Re._camera.getCameraToClipPerspective(Re._fov,Re.width/Re.height,Ue,qe);Ct[8]=2*-Re.centerOffset.x/Re.width,Ct[9]=2*Re.centerOffset.y/Re.height;const Ot=new Float64Array(16);Le.a6.mat4.mul(Ot,Ct,Oe);const vi=new Float64Array(16);Le.a6.mat4.invert(vi,Ot);const bi=Le.bN.fromInvProjectionMatrix(vi,xi,Jt,!0);for(const Oe of bi.points){const Ue=((lo=Oe)[0]/=_i,lo[1]/=_i,lo[2]=Le.bD(lo[2],Re._center.lat),lo);Xn=Math.max(Xn,Le.a6.vec3.len(Le.a6.vec3.subtract([],$n,Ue)))}}var lo;Xn*=Ct/(Ct-1);const uo=Math.acos(Oe[2]),po=Math.atan2(-Oe[0],-Oe[1]),fo=new Gi;fo.position=$n,fo.setPitchBearing(uo,po);const Io=fo.getWorldToCamera(xi,qn),is=Xn*xi,as=Math.min(Re._mercatorZfromZoom(17)*xi*-2,-2*is),Is=fo.getCameraToClipOrthographic(-is,is,-is,is,as,(is+Ot*qn)/Oe[2]),Xs=new Float64Array(16);Le.a6.mat4.multiply(Xs,Is,Io);const ta=Le.a6.vec3.fromValues(Math.floor(1e6*$n[0])/1e6*xi,Math.floor(1e6*$n[1])/1e6*xi,0),ha=.5*Ct,el=[0,0,0];Le.a6.vec3.transformMat4(el,ta,Xs),Le.a6.vec3.scale(el,el,ha);const tl=[Math.floor(el[0]),Math.floor(el[1]),Math.floor(el[2])],il=[0,0,0];Le.a6.vec3.sub(il,el,tl),Le.a6.vec3.scale(il,il,-1/ha);const sl=new Float64Array(16);return Le.a6.mat4.identity(sl),Le.a6.mat4.translate(sl,sl,il),Le.a6.mat4.multiply(Xs,sl,Xs),[Xs,is]}class io extends Le.E{constructor(Le){super(),this.requestManager=Le,this.models={"":{}},this.numModelsLoading={}}loadModel(Re,Oe){return Le.aG(this.requestManager.transformRequest(Oe,Le.R.Model).url).then((Oe=>{if(!Oe)return;const Ue=Le.aH(Oe),qe=new Le.aI(Re,void 0,void 0,Ue);return qe.computeBoundsAndApplyParent(),qe})).catch((Ue=>{if(Ue&&404===Ue.status)return null;this.fire(new Le.t(new Error(`Could not load model ${Re} from ${Oe}: ${Ue.message}`)))}))}load(Re,Oe){this.models[Oe]||(this.models[Oe]={});const Ue=Object.keys(Re);this.numModelsLoading[Oe]=(this.numModelsLoading[Oe]||0)+Ue.length;const qe=[];for(const Le of Ue)qe.push(this.loadModel(Le,Re[Le]));Promise.allSettled(qe).then((Re=>{for(let Le=0;Le<Re.length;Le++){const{status:qe,value:Ct}=Re[Le];"fulfilled"===qe&&Ct&&(this.models[Oe][Ue[Le]]={model:Ct,numReferences:1})}this.numModelsLoading[Oe]-=Ue.length,this.fire(new Le.x("data",{dataType:"style"}))})).catch((Re=>{this.fire(new Le.t(new Error(`Could not load models: ${Re.message}`)))}))}isLoaded(){for(const Le in this.numModelsLoading)if(this.numModelsLoading[Le]>0)return!1;return!0}hasModel(Le,Re){return!!this.getModel(Le,Re)}getModel(Le,Re){return this.models[Re]||(this.models[Re]={}),this.models[Re][Le]?this.models[Re][Le].model:void 0}
1addModel(Le,Re,Oe){this.models[Oe]||(this.models[Oe]={}),this.hasModel(Le,Oe)&&this.models[Oe][Le].numReferences++,this.load({[Le]:this.requestManager.normalizeModelURL(Re)},Oe)}addModels(Le,Re){this.models[Re]||(this.models[Re]={});const Oe={};for(const Ue in Le)this.models[Re][Ue]={},Oe[Ue]=this.requestManager.normalizeModelURL(Le[Ue]);this.load(Oe,Re)}addModelsFromBucket(Le,Re){this.models[Re]||(this.models[Re]={});const Oe={};for(const Ue of Le)this.hasModel(Ue,Re)?this.models[Re][Ue].numReferences++:Oe[Ue]=this.requestManager.normalizeModelURL(Ue);this.load(Oe,Re)}removeModel(Le,Re){if(this.models[Re]&&this.models[Re][Le]&&(this.models[Re][Le].numReferences--,0===this.models[Re][Le].numReferences)){const Oe=this.models[Re][Le].model;delete this.models[Re][Le],Oe.destroy()}}listModels(Le){return this.models[Le]||(this.models[Le]={}),Object.keys(this.models[Le])}upload(Le,Re){this.models[Re]||(this.models[Re]={});for(const Oe in this.models[Re])this.models[Re][Oe].model&&this.models[Re][Oe].model.upload(Le.context)}}const rh=new Le.a0({data:new Le.a1(Le._.colorTheme.data)}),ro=(Le,Re)=>De(Le,Re&&Re.filter((Le=>"source.canvas"!==Le.identifier))),nh=Le.ar(Kl,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),sh=Le.ar(Kl,["setCenter","setZoom","setBearing","setPitch"]),ah={version:8,layers:[],sources:{}},ch={duration:300,delay:0};class co extends Le.E{constructor(Re,Oe={}){super(),this.map=Re,this.scope=Oe.scope||"",this.globalId=null,this.fragments=[],this.importDepth=Oe.importDepth||0,this.importsCache=Oe.importsCache||new Map,this.resolvedImports=Oe.resolvedImports||new Set,this.transition=Le.l({},ch),this._buildingIndex=new wt(this),this.crossTileSymbolIndex=new Di,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=Oe.styleChanges||new j,this.dispatcher=Oe.dispatcher?Oe.dispatcher:new Le.cd(Le.ce(),this),Oe.imageManager?this.imageManager=Oe.imageManager:(this.imageManager=new q,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=Oe.glyphManager?Oe.glyphManager:new Le.cf(Re._requestManager,Oe.localFontFamily?Le.cg.all:Oe.localIdeographFontFamily?Le.cg.ideographs:Le.cg.none,Oe.localFontFamily||Oe.localIdeographFontFamily),Oe.modelManager?this.modelManager=Oe.modelManager:(this.modelManager=new io(Re._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=Oe.configOptions?Oe.configOptions:new Map,this._configDependentLayers=Oe.configDependentLayers?Oe.configDependentLayers:new Set,this._config=Oe.config,this._initialConfig=Oe.initialConfig,this.dispatcher.broadcast("setReferrer",Le.ch());const Ue=this;this._rtlTextPluginCallback=co.registerForPluginStateChange((Re=>{Ue.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:Re.pluginStatus,pluginURL:Re.pluginURL},((Re,Oe)=>{if(Le.ci(Re),Oe&&Oe.every((Le=>Le)))for(const Le in Ue._sourceCaches){const Re=Ue._sourceCaches[Le],Oe=Re.getSource().type;"vector"!==Oe&&"geojson"!==Oe||Re.reload()}}))})),this.on("data",(Le=>{if("source"!==Le.dataType||"metadata"!==Le.sourceDataType)return;const Re=this.getOwnSource(Le.sourceId);if(Re&&Re.vectorLayerIds)for(const Le in this._layers){const Oe=this._layers[Le];Oe.source===Re.id&&this._validateLayer(Oe)}}))}load(Le){return Le?("string"==typeof Le?this.loadURL(Le):this.loadJSON(Le),this):this}_getGlobalId(Re){if(!Re)return null;if("string"==typeof Re){if(Le.f(Re))return Re;const Oe=Le.cj(Re);if(!Oe.startsWith("http"))try{return new URL(Oe,location.href).toString()}catch(Le){return Oe}return Oe}return`json://${Le.ck(JSON.stringify(Re))}`}_diffStyle(Re,Oe,Ue){this.globalId=this._getGlobalId(Re);const r=(Le,Re)=>{try{Re(null,this.setState(Le,Ue))}catch(Le){Re(Le,!1)}};if("string"==typeof Re){const Ue=this.map._requestManager.normalizeStyleURL(Re),qe=this.map._requestManager.transformRequest(Ue,Le.R.Style);Le.n(qe,((Re,Ue)=>{Re?this.fire(new Le.t(Re)):Ue&&r(Ue,Oe)}))}else"object"==typeof Re&&r(Re,Oe)}loadURL(Re,Oe={}){this.fire(new Le.x("dataloading",{dataType:"style"}));const Ue="boolean"==typeof Oe.validate?Oe.validate:!Le.f(Re);this.globalId=this._getGlobalId(Re),Re=this.map._requestManager.normalizeStyleURL(Re,Oe.accessToken),this.resolvedImports.add(Re);const qe=this.importsCache.get(Re);if(qe)return this._load(qe,Ue);const Ct=this.map._requestManager.transformRequest(Re,Le.R.Style);this._request=Le.n(Ct,((Oe,qe)=>{if(this._request=null,Oe)this.fire(new Le.t(Oe));else if(qe)return this.importsCache.set(Re,qe),this._load(qe,Ue)}))}loadJSON(Re,Oe={}){this.fire(new Le.x("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(Re),this._request=Le.q.frame((()=>{this._request=null,this._load(Re,!1!==Oe.validate)}))}loadEmpty(){this.fire(new Le.x("dataloading",{dataType:"style"})),this._load(ah,!1)}_loadImports(Re,Oe,Ue){if(this.importDepth>=4)return Le.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const qe=[];for(const Le of Re){const Re=this._createFragmentStyle(Le),Ct=new Promise((Le=>{Re.once("style.import.load",Le),Re.once("error",Le)})).then((()=>this.mergeAll()));if(qe.push(Ct),this.resolvedImports.has(Le.url)){Re.loadEmpty();continue}const Ot=Le.data||this.importsCache.get(Le.url);
1Ot?(Re.loadJSON(Ot,{validate:Oe}),this._isInternalStyle(Ot)&&(Re.globalId=null)):Le.url?Re.loadURL(Le.url,{validate:Oe}):Re.loadEmpty();const Jt={style:Re,id:Le.id,config:Le.config};if(Ue){const Le=this.fragments.findIndex((({id:Le})=>Le===Ue));this.fragments=this.fragments.slice(0,Le).concat(Jt).concat(this.fragments.slice(Le))}else this.fragments.push(Jt)}return Promise.allSettled(qe)}getImportGlobalIds(Le=this,Re=new Set){for(const Oe of Le.fragments)Oe.style.globalId&&Re.add(Oe.style.globalId),this.getImportGlobalIds(Oe.style,Re);return[...Re.values()]}_createFragmentStyle(Re){const Oe=this.scope?Le.av(Re.id,this.scope):Re.id;let Ue;const qe=this._initialConfig&&this._initialConfig[Oe];(Re.config||qe)&&(Ue=Le.l({},Re.config,qe));const Ct=new co(this.map,{scope:Oe,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:Ue,configOptions:this.options,configDependentLayers:this._configDependentLayers});return Ct.setEventedParent(this.map,{style:Ct}),Ct}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(Le){return this.isRootStyle()&&(Le.fragment||!!Le.schema&&!1!==Le.fragment)}_load(Re,Oe){const Ue=Re.schema;if(this._isInternalStyle(Re)){const Ue=Le.l({},ah,{imports:[{id:"basemap",data:Re,url:""}]});return void this._load(Ue,Oe)}if(this.updateConfig(this._config,Ue),Oe&&ro(this,fe(Re)))return;this._loaded=!0,this.stylesheet=Le.cl(Re);const r=()=>{for(const Le in Re.sources)this.addSource(Le,Re.sources[Le],{validate:!1,isInitialLoad:!0});Re.sprite?this._loadSprite(Re.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(Re.glyphs,this.scope);const Ue=Et(this.stylesheet.layers);if(this._order=Ue.map((Le=>Le.id)),this.stylesheet.light&&Le.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const Le=this.stylesheet.lights[0];this.light=new Ae(Le.properties,Le.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Ae(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const Re of Ue){const Oe=Le.cq(Re,this.scope,this._styleColorTheme.lut,this.options);0!==Oe.configDependencies.size&&this._configDependentLayers.add(Oe.fqid),Oe.setEventedParent(this,{layer:{id:Oe.id}}),this._layers[Oe.id]=Oe,this._serializedLayers[Oe.id]=Oe.serialize();const Ue=this.getOwnLayerSourceCache(Oe),qe=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Ue&&Oe.canCastShadows()&&qe&&(Ue.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const qe=this.stylesheet.terrain;qe&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(qe,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new Le.x("data",{dataType:"style"}));const Ct=this.isRootStyle();Re.imports?this._loadImports(Re.imports,Oe).then((()=>{this._reloadImports(),this.fire(new Le.x(Ct?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new Le.x(Ct?"style.load":"style.import.load")))},qe=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=qe,qe){const Re=this._evaluateColorThemeData(qe);this._loadColorTheme(Re).then((()=>{r()})).catch((Re=>{Le.w(`Couldn't load color theme from the stylesheet: ${Re}`),r()}))}else this._styleColorTheme.lut=null,r()}isRootStyle(){return 0===this.importDepth}mergeAll(){let Re,Oe,Ue,qe,Ct,Ot,Jt,_i;const xi={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((Le=>{if(Le.stylesheet){if(null!=Le.light&&(Re=Le.light),Le.stylesheet.lights)for(const Re of Le.stylesheet.lights)"ambient"===Re.type&&null!=Le.ambientLight&&(Oe=Le.ambientLight),"directional"===Re.type&&null!=Le.directionalLight&&(Ue=Le.directionalLight);qe=this._prioritizeTerrain(qe,Le.terrain,Le.stylesheet.terrain),Le.stylesheet.fog&&null!=Le.fog&&(Ct=Le.fog),null!=Le.stylesheet.camera&&(_i=Le.stylesheet.camera),null!=Le.stylesheet.projection&&(Ot=Le.stylesheet.projection),null!=Le.stylesheet.transition&&(Jt=Le.stylesheet.transition),xi[Le.scope]=Le._styleColorTheme}})),this.light=Re,this.ambientLight=Oe,this.directionalLight=Ue,this.fog=Ct,this._styleColorThemeForScope=xi,null===qe?delete this.terrain:this.terrain=qe,this.camera=_i||{"camera-projection":"perspective"},this.projection=Ot||{name:"mercator"},this.transition=Le.l({},ch,Jt),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(Le){const t=Re=>{for(const Le of Re.fragments)t(Le.style);Le(Re)};t(this)}_prioritizeTerrain(Le,Re,Oe){const Ue=Le&&0===Le.drapeRenderMode;return null===Oe?Re&&0===Re.drapeRenderMode?Re:Ue?Le:null:null!=Re&&(!Le||Ue||Re&&1===Re.drapeRenderMode)?Re:Le}mergeTerrain(){let Le;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((Re=>{Le=this._prioritizeTerrain(Le,Re.terrain,Re.stylesheet.terrain)})),null===Le?delete this.terrain:this.terrain=Le}mergeProjection(){let Le;this.forEachFragmentStyle((Re=>{null!=Re.stylesheet.projection&&(Le=Re.stylesheet.projection)})),this.projection=Le||{name:"mercator"}}mergeSources(){const Re={},Oe={},Ue={};this.forEachFragmentStyle((qe=>{for(const Oe in qe._sourceCaches){const Ue=Le.av(Oe,qe.scope);Re[Ue]=qe._sourceCaches[Oe]}for(const Re in qe._otherSourceCaches){const Ue=Le.av(Re,qe.scope);Oe[Ue]=qe._otherSourceCaches[Re]}for(const Re in qe._symbolSourceCaches){const Oe=Le.av(Re,qe.scope);Ue[Oe]=qe._symbolSourceCaches[Re]}})),this._mergedSourceCaches=Re,this._mergedOtherSourceCaches=Oe,this._mergedSymbolSourceCaches=Ue}mergeLayers(){const Re={},Oe=[],Ue={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((Ue=>{for(const qe of Ue._order){const Ct=Ue._layers[qe];if("slot"===Ct.type){const Oe=Le.cm(qe);if(Re[Oe])continue;Re[Oe]=[]}Ct.slot&&Re[Ct.slot]?Re[Ct.slot].push(Ct):Oe.push(Ct)}})),this._mergedOrder=[];const r=(Oe=[])=>{for(const qe of Oe)if("slot"===qe.type){const Oe=Le.cm(qe.id);Re[Oe]&&r(Re[Oe]),this._mergedSlots.push(Oe)}else{const Re=Le.av(qe.id,qe.scope);this._mergedOrder.push(Re),Ue[Re]=qe,qe.is3D()&&(this._has3DLayers=!0),"circle"===qe.type&&(this._hasCircleLayers=!0),"symbol"===qe.type&&(this._hasSymbolLayers=!0),"clip"===qe.type&&(this._clipLayerPresent=!0)}};r(Oe),this._mergedOrder.sort(((Le,Re)=>{const Oe=Ue[Le],qe=Ue[Re];return Oe.hasInitialOcclusionOpacityProperties?qe.is3D()?1:0:Oe.is3D()&&qe.hasInitialOcclusionOpacityProperties?-1:0})),this._mergedLayers=Ue,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(Re){return this.stylesheet.camera=Le.l({},this.stylesheet.camera,Re),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(Re){return Re.data?function(Re,Oe,Ue){const qe=Le.l({},Oe);for(const Re of Object.keys(Le._.colorTheme))void 0===qe[Re]&&(qe[Re]=Le._.colorTheme[Re].default);const Ct=new Le.$(rh,Re,new Map(Ue));return Ct.setTransitionOrValue(qe,Ue),Ct.untransitioned().possiblyEvaluate(new Le.a3(0))}(this.scope,Re,this.options).get("data"):null}_loadColorTheme(Re){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const Oe=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((Ue,qe)=>{const Ct="data:image/png;base64,";if(!Re||0===Re.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void Ue();let Ot=Re;Ot.startsWith(Ct)||(Ot=Ct+Ot);const Jt="mapbox-reserved-lut",_i=new Image;_i.src=Ot,_i.onerror=()=>{this._styleColorTheme.lutLoading=!1,qe(new Error("Failed to load image data"))},_i.onload=()=>
1{if(this._styleColorTheme.lutLoadingCorrelationID!==Oe)return void Ue();this._styleColorTheme.lutLoading=!1;const{width:Ct,height:Ot,data:xi}=Le.q.getImageData(_i);if(Ot>32)return void qe(new Error("The height of the image must be less than or equal to 32 pixels."));if(Ct!==Ot*Ot)return void qe(new Error("The width of the image must be equal to the height squared."));this.getImage(Jt)&&this.removeImage(Jt),this.addImage(Jt,{data:new Le.r({width:Ct,height:Ot},xi),pixelRatio:1,sdf:!1,version:0});const vi=this.imageManager.getImage(Jt,this.scope);vi?(this._styleColorTheme.lut={image:vi.data,data:Re},Ue()):qe(new Error("Missing LUT image."))}}))}getLut(Le){const Re=this._styleColorThemeForScope[Le];return Re?Re.lut:null}setProjection(Le){Le?this.stylesheet.projection=Le:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(Re){this._spriteRequest=function(Re,Oe,Ue){let qe,Ct,Ot;const Jt=Le.q.devicePixelRatio>1?"@2x":"";let _i=Le.n(Oe.transformRequest(Oe.normalizeSpriteURL(Re,Jt,".json"),Le.R.SpriteJSON),((Le,Re)=>{_i=null,Ot||(Ot=Le,qe=Re,h())})),xi=Le.o(Oe.transformRequest(Oe.normalizeSpriteURL(Re,Jt,".png"),Le.R.SpriteImage),((Le,Re)=>{xi=null,Ot||(Ot=Le,Ct=Re,h())}));function h(){if(Ot)Ue(Ot);else if(qe&&Ct){const Re=Le.q.getImageData(Ct),Oe={};for(const Ue in qe){const{width:Ct,height:Ot,x:Jt,y:_i,sdf:xi,pixelRatio:vi,stretchX:bi,stretchY:Pi,content:Hr}=qe[Ue],Jr=new Le.r({width:Ct,height:Ot});Le.r.copy(Re,Jr,{x:Jt,y:_i},{x:0,y:0},{width:Ct,height:Ot},null),Oe[Ue]={data:Jr,pixelRatio:vi,sdf:xi,stretchX:bi,stretchY:Pi,content:Hr}}Ue(null,Oe)}}return{cancel(){_i&&(_i.cancel(),_i=null),xi&&(xi.cancel(),xi=null)}}}(Re,this.map._requestManager,((Re,Oe)=>{if(this._spriteRequest=null,Re)this.fire(new Le.t(Re));else if(Oe)for(const Le in Oe)this.imageManager.addImage(Le,this.scope,Oe[Le]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new Le.x("data",{dataType:"style"}))}))}_validateLayer(Re){const Oe=this.getOwnSource(Re.source);if(!Oe)return;const Ue=Re.sourceLayer;Ue&&("geojson"===Oe.type||Oe.vectorLayerIds&&-1===Oe.vectorLayerIds.indexOf(Ue))&&this.fire(new Le.t(new Error(`Source layer "${Ue}" does not exist on source "${Oe.id}" as specified by style layer "${Re.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const Le in this._sourceCaches)if(!this._sourceCaches[Le].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:Le}of this.fragments)if(!Le.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map(((Le,Re)=>{const Oe=this.fragments[Re];return Oe&&Oe.style&&(Le.data=Oe.style.serialize()),Le}))}_serializeSources(){const Le={};for(const Re in this._sourceCaches){const Oe=this._sourceCaches[Re].getSource();Le[Oe.id]||(Le[Oe.id]=Oe.serialize())}return Le}_serializeLayers(Le){const Re=[];for(const Oe of Le){const Le=this._layers[Oe];Le&&"custom"!==Le.type&&Re.push(Le.serialize())}return Re}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;
1if(this.hasFogTransition())return!0;for(const Le in this._sourceCaches)if(this._sourceCaches[Le].hasTransition())return!0;for(const Le in this._layers)if(this._layers[Le].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(Le){return!!this.terrain&&Le.isDraped(this.getLayerSourceCache(Le))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(Re){const Oe=this.getOwnLayer(Re);if(Oe)return Oe;this.fire(new Le.t(new Error(`The layer '${Re}' does not exist in the map's style.`)))}_checkSource(Re){const Oe=this.getOwnSource(Re);if(Oe)return Oe;this.fire(new Le.t(new Error(`The source '${Re}' does not exist in the map's style.`)))}precompilePrograms(Le,Re){const Oe=this.map.painter;if(Oe)for(let Ue=Le.minzoom||0;Ue<(Le.maxzoom||25.5);Ue++){const Ue=Le.getProgramIds();if(Ue)for(const qe of Ue){const Ue=Le.getDefaultProgramParams(qe,Re.zoom,this._styleColorTheme.lut);Ue&&(Oe.style=this,this.fog&&(Oe._fogVisible=!0,Ue.overrideFog=!0,Oe.getOrCreateProgram(qe,Ue)),Oe._fogVisible=!1,Ue.overrideFog=!1,Oe.getOrCreateProgram(qe,Ue),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(Ue.overrideRtt=!0,Oe.getOrCreateProgram(qe,Ue)))}}}update(Re){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(Re),this.directionalLight&&this.directionalLight.recalculate(Re);const Oe=this.calculateLightsBrightness();Re.brightness=Oe||0,Oe!==this._brightness&&(this._brightness=Oe,this.dispatcher.broadcast("setBrightness",Oe));const Ue=this._changes.isDirty();let qe=!1;if(this._changes.isDirty()){const Le=this._changes.getLayerUpdatesByScope();for(const Re in Le){const{updatedIds:Oe,removedIds:Ue}=Le[Re];(Oe||Ue)&&(this._updateWorkerLayers(Re,Oe,Ue),qe=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(Re),this.light&&this.light.updateTransitions(Re),this.ambientLight&&this.ambientLight.updateTransitions(Re),this.directionalLight&&this.directionalLight.updateTransitions(Re),this.fog&&this.fog.updateTransitions(Re),this._changes.reset()}const Ct={};for(const Le in this._mergedSourceCaches){const Re=this._mergedSourceCaches[Le];Ct[Le]=Re.used,Re.used=!1,Re.tileCoverLift=0}for(const Le of this._mergedOrder){const Oe=this._mergedLayers[Le];if(Oe.recalculate(Re,this._availableImages),!Oe.isHidden(Re.zoom)){const Le=this.getLayerSourceCache(Oe);Le&&(Le.used=!0,Le.tileCoverLift=Math.max(Le.tileCoverLift,Oe.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>{this.precompilePrograms(Oe,Re)})):this.precompilePrograms(Oe,Re))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&qe&&this.mergeLayers();for(const Re in Ct){const Oe=this._mergedSourceCaches[Re];Ct[Re]!==Oe.used&&Oe.getSource().fire(new Le.x("data",{sourceDataType:"visibility",dataType:"source",sourceId:Oe.getSource().id}))}this.light&&this.light.recalculate(Re),this.terrain&&this.terrain.recalculate(Re),this.fog&&this.fog.recalculate(Re),this.z=Re.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),Ue&&this.fire(new Le.x("data",{dataType:"style"}))}_updateTilesForChangedImages(){const Le=this._changes.getUpdatedImages();if(Le.length){for(const Re in this._sourceCaches)this._sourceCaches[Re].reloadTilesForDependencies(["icons","patterns"],Le);this._changes.resetUpdatedImages()}}_updateWorkerLayers(Le,Re,Oe){const Ue=this.getFragmentStyle(Le);Ue&&this.dispatcher.broadcast("updateLayers",{layers:Re?Ue._serializeLayers(Re):[],scope:Le,removedIds:Oe||[],options:Ue.options})}setState(Re,Oe){if(this._checkLoaded(),ro(this,fe(Re)))return!1;(Re=Le.cl(Re)).layers=Et(Re.layers);const Ue=function(Re,Oe){if(!Re)return[{command:Kl.setStyle,args:[Oe]}];let Ue=[];try{if(!Le.bh(Re.version,Oe.version))return[{command:Kl.setStyle,args:[Oe]}];if(Le.bh(Re.center,Oe.center)||Ue.push({command:Kl.setCenter,args:[Oe.center]}),Le.bh(Re.zoom,Oe.zoom)||Ue.push({command:Kl.setZoom,args:[Oe.zoom]}),Le.bh(Re.bearing,Oe.bearing)||Ue.push({command:Kl.setBearing,args:[Oe.bearing]}),Le.bh(Re.pitch,Oe.pitch)||Ue.push({command:Kl.setPitch,args:[Oe.pitch]}),Le.bh(Re.sprite,Oe.sprite)||Ue.push({command:Kl.setSprite,args:[Oe.sprite]}),Le.bh(Re.glyphs,Oe.glyphs)||Ue.push({command:Kl.setGlyphs,args:[Oe.glyphs]}),Le.bh(Re.imports,Oe.imports)||function(Re=[],Oe=[],Ue){Oe=Oe||[];const qe=(Re=Re||[]).map(Lt),Ct=Oe.map(Lt),Ot=Re.reduce(Pt,{}),Jt=Oe.reduce(Pt,{}),_i=qe.slice();let xi,vi,bi,Pi;for(xi=0,vi=0;xi<qe.length;xi++)bi=qe[xi],Jt.hasOwnProperty(bi)?vi++:(Ue.push({command:Kl.removeImport,args:[bi]}),_i.splice(_i.indexOf(bi,vi),1));for(xi=0,vi=0;xi<Ct.length;xi++)bi=Ct[Ct.length-1-xi],_i[_i.length-1-xi]!==bi&&(Ot.hasOwnProperty(bi)?(Ue.push({command:Kl.removeImport,args:[bi]}),_i.splice(_i.lastIndexOf(bi,_i.length-vi),1)):vi++,Pi=_i[_i.length-xi],Ue.pu
1sh({command:Kl.addImport,args:[Jt[bi],Pi]}),_i.splice(_i.length-xi,0,bi));for(const Re of Oe){const Oe=Ot[Re.id];Oe&&!Le.bh(Oe,Re)&&Ue.push({command:Kl.updateImport,args:[Re.id,Re]})}}(Re.imports,Oe.imports,Ue),Le.bh(Re.transition,Oe.transition)||Ue.push({command:Kl.setTransition,args:[Oe.transition]}),Le.bh(Re.light,Oe.light)||Ue.push({command:Kl.setLight,args:[Oe.light]}),Le.bh(Re.fog,Oe.fog)||Ue.push({command:Kl.setFog,args:[Oe.fog]}),Le.bh(Re.projection,Oe.projection)||Ue.push({command:Kl.setProjection,args:[Oe.projection]}),Le.bh(Re.lights,Oe.lights)||Ue.push({command:Kl.setLights,args:[Oe.lights]}),Le.bh(Re.camera,Oe.camera)||Ue.push({command:Kl.setCamera,args:[Oe.camera]}),!Le.bh(Re["color-theme"],Oe["color-theme"]))return[{command:Kl.setStyle,args:[Oe]}];const qe={},Ct=[];!function(Re,Oe,Ue,qe){let Ct;for(Ct in Oe=Oe||{},Re=Re||{})Re.hasOwnProperty(Ct)&&(Oe.hasOwnProperty(Ct)||It(Ct,Ue,qe));for(Ct in Oe){if(!Oe.hasOwnProperty(Ct))continue;const Ot=Oe[Ct];Re.hasOwnProperty(Ct)?Le.bh(Re[Ct],Ot)||("geojson"===Re[Ct].type&&"geojson"===Ot.type&&Rt(Re,Oe,Ct)?Ue.push({command:Kl.setGeoJSONSourceData,args:[Ct,Ot.data]}):Dt(Ct,Oe,Ue,qe)):St(Ct,Oe,Ue)}}(Re.sources,Oe.sources,Ct,qe);const Ot=[];Re.layers&&Re.layers.forEach((Le=>{Le.source&&qe[Le.source]?Ue.push({command:Kl.removeLayer,args:[Le.id]}):Ot.push(Le)}));let Jt=Re.terrain;Jt&&qe[Jt.source]&&(Ue.push({command:Kl.setTerrain,args:[void 0]}),Jt=void 0),Ue=Ue.concat(Ct),Le.bh(Jt,Oe.terrain)||Ue.push({command:Kl.setTerrain,args:[Oe.terrain]}),function(Re,Oe,Ue){Oe=Oe||[];const qe=(Re=Re||[]).map(Lt),Ct=Oe.map(Lt),Ot=Re.reduce(Pt,{}),Jt=Oe.reduce(Pt,{}),_i=qe.slice(),xi=Object.create(null);let vi,bi,Pi,Hr,Jr,Ln,Nn;for(vi=0,bi=0;vi<qe.length;vi++)Pi=qe[vi],Jt.hasOwnProperty(Pi)?bi++:(Ue.push({command:Kl.removeLayer,args:[Pi]}),_i.splice(_i.indexOf(Pi,bi),1));for(vi=0,bi=0;vi<Ct.length;vi++)Pi=Ct[Ct.length-1-vi],_i[_i.length-1-vi]!==Pi&&(Ot.hasOwnProperty(Pi)?(Ue.push({command:Kl.removeLayer,args:[Pi]}),_i.splice(_i.lastIndexOf(Pi,_i.length-bi),1)):bi++,Ln=_i[_i.length-vi],Ue.push({command:Kl.addLayer,args:[Jt[Pi],Ln]}),_i.splice(_i.length-vi,0,Pi),xi[Pi]=!0);for(vi=0;vi<Ct.length;vi++)if(Pi=Ct[vi],Hr=Ot[Pi],Jr=Jt[Pi],!xi[Pi]&&!Le.bh(Hr,Jr))if(Le.bh(Hr.source,Jr.source)&&Le.bh(Hr["source-layer"],Jr["source-layer"])&&Le.bh(Hr.type,Jr.type)){for(Nn in At(Hr.layout,Jr.layout,Ue,Pi,null,Kl.setLayoutProperty),At(Hr.paint,Jr.paint,Ue,Pi,null,Kl.setPaintProperty),Le.bh(Hr.slot,Jr.slot)||Ue.push({command:Kl.setSlot,args:[Pi,Jr.slot]}),Le.bh(Hr.filter,Jr.filter)||Ue.push({command:Kl.setFilter,args:[Pi,Jr.filter]}),Le.bh(Hr.minzoom,Jr.minzoom)&&Le.bh(Hr.maxzoom,Jr.maxzoom)||Ue.push({command:Kl.setLayerZoomRange,args:[Pi,Jr.minzoom,Jr.maxzoom]}),Hr)Hr.hasOwnProperty(Nn)&&"layout"!==Nn&&"paint"!==Nn&&"filter"!==Nn&&"metadata"!==Nn&&"minzoom"!==Nn&&"maxzoom"!==Nn&&"slot"!==Nn&&(0===Nn.indexOf("paint.")?At(Hr[Nn],Jr[Nn],Ue,Pi,Nn.slice(6),Kl.setPaintProperty):Le.bh(Hr[Nn],Jr[Nn])||Ue.push({command:Kl.setLayerProperty,args:[Pi,Nn,Jr[Nn]]}));for(Nn in Jr)Jr.hasOwnProperty(Nn)&&!Hr.hasOwnProperty(Nn)&&"layout"!==Nn&&"paint"!==Nn&&"filter"!==Nn&&"metadata"!==Nn&&"minzoom"!==Nn&&"maxzoom"!==Nn&&"slot"!==Nn&&(0===Nn.indexOf("paint.")?At(Hr[Nn],Jr[Nn],Ue,Pi,Nn.slice(6),Kl.setPaintProperty):Le.bh(Hr[Nn],Jr[Nn])||Ue.push({command:Kl.setLayerProperty,args:[Pi,Nn,Jr[Nn]]}))}else Ue.push({command:Kl.removeLayer,args:[Pi]}),Ln=_i[_i.lastIndexOf(Pi)+1],Ue.push({command:Kl.addLayer,args:[Jr,Ln]})}(Ot,Oe.layers,Ue)}catch(Le){console.warn("Unable to compute style diff:",Le),Ue=[{command:Kl.setStyle,args:[Oe]}]}return Ue}(this.serialize(),Re).filter((Le=>!(Le.command in sh)));if(0===Ue.length)return!1;const qe=Ue.filter((Le=>!(Le.command in nh)));if(qe.length>0)throw new Error(`Unimplemented: ${qe.map((Le=>Le.command)).join(", ")}.`);const Ct=[];return Ue.forEach((Le=>{Ct.push(this[Le.command].apply(this,Le.args))})),Oe&&Promise.all(Ct).then(Oe),this.stylesheet=Re,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(Re,Oe){return this.getImage(Re)?this.fire(new Le.t(new Error("An image with this name already exists."))):(this.imageManager.addImage(Re,this.scope,Oe),this._afterImageUpdated(Re),this)}updateImage(Le,Re){this.imageManager.updateImage(Le,this.scope,Re)}getImage(Le){return this.imageManager.getImage(Le,this.scope)}removeImage(Re){return this.getImage(Re)?(this.imageManager.removeImage(Re,this.scope),this._afterImageUpdated(Re),this):this.fire(new Le.t(new Error("No image with this name exists.")))}_afterImageUpdated(Re){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(Re),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new Le.x("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(Le,Re,Oe={}
1){return this._checkLoaded(),this._validate(Se,`models.${Le}`,Re,null,Oe)||(this.modelManager.addModel(Le,Re,this.scope),this._changes.setDirty()),this}hasModel(Le){return this.modelManager.hasModel(Le,this.scope)}removeModel(Re){return this.hasModel(Re)?(this.modelManager.removeModel(Re,this.scope),this):this.fire(new Le.t(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(Re,Oe,Ue={}){if(this._checkLoaded(),void 0!==this.getOwnSource(Re))throw new Error(`There is already a source with ID "${Re}".`);if(!Oe.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(Oe).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(Oe.type)>=0&&this._validate(ge,`sources.${Re}`,Oe,null,Ue))return;this.map&&this.map._collectResourceTiming&&(Oe.collectResourceTiming=!0);const qe=tt(Re,Oe,this.dispatcher,this);qe.scope=this.scope,qe.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(qe.id),source:qe.serialize(),sourceId:qe.id})));const s=Re=>{const Oe=(Re?"symbol:":"other:")+qe.id,Ue=Le.av(Oe,this.scope),Ct=this._sourceCaches[Oe]=new vt(Ue,qe,Re);(Re?this._symbolSourceCaches:this._otherSourceCaches)[qe.id]=Ct,Ct.onAdd(this.map)};s(!1),"vector"!==Oe.type&&"geojson"!==Oe.type||s(!0),qe.onAdd&&qe.onAdd(this.map),Ue.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(Re){this._checkLoaded();const Oe=this.getOwnSource(Re);if(!Oe)throw new Error("There is no source with this ID");for(const Oe in this._layers)if(this._layers[Oe].source===Re)return this.fire(new Le.t(new Error(`Source "${Re}" cannot be removed while layer "${Oe}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===Re)return this.fire(new Le.t(new Error(`Source "${Re}" cannot be removed while terrain is using it.`)));const Ue=this.getOwnSourceCaches(Re);for(const Re of Ue){const Oe=Le.cm(Re.id);delete this._sourceCaches[Oe],this._changes.discardSourceCacheUpdate(Re.id),Re.fire(new Le.x("data",{sourceDataType:"metadata",dataType:"source",sourceId:Re.getSource().id})),Re.setEventedParent(null),Re.clearTiles()}return delete this._otherSourceCaches[Re],delete this._symbolSourceCaches[Re],this.mergeSources(),Oe.setEventedParent(null),Oe.onRemove&&Oe.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(Le,Re){this._checkLoaded(),this.getOwnSource(Le).setData(Re),this._changes.setDirty()}getOwnSource(Le){const Re=this.getOwnSourceCache(Le);return Re&&Re.getSource()}getOwnSources(){const Le=[];for(const Re in this._otherSourceCaches){const Oe=this.getOwnSourceCache(Re);Oe&&Le.push(Oe.getSource())}return Le}areTilesLoaded(){const Le=this._mergedSourceCaches;for(const Re in Le){const Oe=Le[Re]._tiles;for(const Le in Oe){const Re=Oe[Le];if("loaded"!==Re.state&&"errored"!==Re.state)return!1}}return!0}setLights(Re){if(this._checkLoaded(),!Re)return delete this.ambientLight,void delete this.directionalLight;const Oe=this._getTransitionParameters();for(const Ue of Re){if(this._validate(xe,"lights",Ue))return;switch(Ue.type){case"ambient":if(this.ambientLight){const Le=this.ambientLight;Le.set(Ue),Le.updateTransitions(Oe)}else this.ambientLight=new je(Ue,el||(el=new Le.a0({color:new Le.a1(Le._.properties_light_ambient.color),intensity:new Le.a1(Le._.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const Le=this.directionalLight;Le.set(Ue),Le.updateTransitions(Oe)}else this.directionalLight=new je(Ue,tl||(tl=new Le.a0({direction:new Le.ad(Le._.properties_light_directional.direction),color:new Le.a1(Le._.properties_light_directional.color),intensity:new Le.a1(Le._.properties_light_directional.intensity),"cast-shadows":new Le.a1(Le._.properties_light_directional["cast-shadows"]),"shadow-intensity":new Le.a1(Le._.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const Ue=new Le.a3(this.z||0,Oe);this.ambientLight&&this.ambientLight.recalculate(Ue),this.directionalLight&&this.directionalLight.recalculate(Ue),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const Re=this.directionalLight,Oe=this.ambientLight;if(!Re||!Oe)return;const o=Le=>.2126*(Le[0]<=.03928?Le[0]/12.92:Math.pow((Le[0]+.055)/1.055,2.4))+.7152*(Le[1]<=.03928?Le[1]/12.92:Math.pow((Le[1]+.055)/1.055,2.4))+.0722*(Le[2]<=.03928?Le[2]/12.92:Math.pow((Le[2]+.055)/1.055,2.4)),Ue=Re.properties.get("color").toRenderColor(null).toArray01(),qe=Re.properties.get("intensity"),Ct=Re.properties.get("direction"),Ot=1-Le.c7(Ct.x,Ct.y,Ct.z)[2]/90,Jt=o(Ue)*qe*Ot,_i=Oe.properties.get("color").toRenderColor(null).toArray01(),xi=Oe.properties.get("intensity");return(Jt+o(_i)*xi)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const Le=[];return this.directionalLight&&Le.push(this.directionalLight.get()),this.ambientLight&&Le.push(this.ambientLight.get()),Le}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(Re){if(!Re)return this;if(Le.cn(Re)){const Oe=Le.co(Re),Ue=this.fragments.find((({id:Le})=>Le===Oe));if(!Ue)throw new Error(`Style import not found: ${Re}`);const qe=Le.cm(Re);return Ue.style.getFragmentStyle(qe)}{const Le=this.fragments.find((({id:Le})=>Le===Re));if(!Le)throw new Error(`Style import not found: ${Re}`);return Le.style}}getConfigProperty(Re,Oe){const Ue=this.getFragmentStyle(Re);
1if(!Ue)return null;const qe=Le.av(Oe,Ue.scope),Ct=Ue.options.get(qe),Ot=Ct?Ct.value||Ct.default:null;return Ot?Ot.serialize():null}setConfigProperty(Re,Oe,Ue){const qe=this.getFragmentStyle(Re);if(!qe)return;const Ct=qe.stylesheet.schema;if(!Ct||!Ct[Oe])return;const Ot=Le.M(Ue);if("success"!==Ot.result)return void ro(this,Ot.value);const Jt=Ot.value.expression,_i=Le.av(Oe,qe.scope),xi=qe.options.get(_i);if(!xi)return;let vi;const{minValue:bi,maxValue:Pi,stepValue:Hr,type:Jr,values:Ln}=Ct[Oe],Nn=Le.M(Ct[Oe].default);"success"===Nn.result&&(vi=Nn.value.expression),vi?(this.options.set(_i,{...xi,value:Jt,default:vi,minValue:bi,maxValue:Pi,stepValue:Hr,type:Jr,values:Ln}),this.updateConfigDependencies(Oe)):this.fire(new Le.t(new Error(`No schema defined for the config option "${Oe}" in the "${Re}" fragment.`)))}getConfig(Re){const Oe=this.getFragmentStyle(Re);if(!Oe)return null;const Ue=Oe.stylesheet.schema;if(!Ue)return null;const qe={};for(const Re in Ue){const Ue=Le.av(Re,Oe.scope),Ct=Oe.options.get(Ue),Ot=Ct?Ct.value||Ct.default:null;qe[Re]=Ot?Ot.serialize():null}return qe}setConfig(Le,Re){const Oe=this.getFragmentStyle(Le);Oe&&(Oe.updateConfig(Re,Oe.stylesheet.schema),this.updateConfigDependencies())}getSchema(Le){const Re=this.getFragmentStyle(Le);return Re?Re.stylesheet.schema:null}setSchema(Le,Re){const Oe=this.getFragmentStyle(Le);Oe&&(Oe.stylesheet.schema=Re,Oe.updateConfig(Oe._config,Re),this.updateConfigDependencies())}updateConfig(Re,Oe){if(this._config=Re,Re||Oe)if(Oe)for(const Ue in Oe){let qe,Ct;const Ot=Le.M(Oe[Ue].default);if("success"===Ot.result&&(qe=Ot.value.expression),Re&&void 0!==Re[Ue]){const Oe=Le.M(Re[Ue]);"success"===Oe.result&&(Ct=Oe.value.expression)}const{minValue:Jt,maxValue:_i,stepValue:xi,type:vi,values:bi}=Oe[Ue];if(qe){const Re=Le.av(Ue,this.scope);this.options.set(Re,{default:qe,value:Ct,minValue:Jt,maxValue:_i,stepValue:xi,type:vi,values:bi})}else this.fire(new Le.t(new Error(`No schema defined for config option "${Ue}".`)))}else this.fire(new Le.t(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(Le){for(const Re of this._configDependentLayers){const Oe=this.getLayer(Re);if(Oe){if(Le&&!Oe.configDependencies.has(Le))continue;Oe.possiblyEvaluateVisibility(),this._updateLayer(Oe)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle((Le=>{if(Le._styleColorTheme.colorTheme){const Re=Le._evaluateColorThemeData(Le._styleColorTheme.colorTheme);(!Le._styleColorTheme.lut&&""!==Re||Le._styleColorTheme.lut&&Re!==Le._styleColorTheme.lut.data)&&Le.setColorTheme(Le._styleColorTheme.colorTheme)}})),this._changes.setDirty()}addLayer(Re,Oe,Ue={}){this._checkLoaded();const qe=Re.id;if(this._layers[qe])return void this.fire(new Le.t(new Error(`Layer with i
1d "${qe}" already exists on this map`)));let Ct;if("custom"===Re.type){if(ro(this,Le.cp(Re)))return;Ct=Le.cq(Re,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof Re.source&&(this.addSource(qe,Re.source),Re=Le.cl(Re),Re=Le.l(Re,{source:qe})),this._validate(we,`layers.${qe}`,Re,{arrayIndex:-1},Ue))return;Ct=Le.cq(Re,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(Ct),Ct.setEventedParent(this,{layer:{id:qe}}),this._serializedLayers[Ct.id]=Ct.serialize()}0!==Ct.configDependencies.size&&this._configDependentLayers.add(Ct.fqid);let Ot=this._order.length;if(Oe){const Re=this._order.indexOf(Oe);if(-1===Re)return void this.fire(new Le.t(new Error(`Layer with id "${Oe}" does not exist on this map.`)));Ct.slot===this._layers[Oe].slot?Ot=Re:Le.w(`Layer with id "${Oe}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(Ot,0,qe),this._layerOrderChanged=!0,this._layers[qe]=Ct;const Jt=this.getOwnLayerSourceCache(Ct),_i=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Jt&&Ct.canCastShadows()&&_i&&(Jt.castsShadows=!0);const xi=this._changes.getRemovedLayer(Ct);if(xi&&Ct.source&&Jt&&"custom"!==Ct.type){this._changes.discardLayerRemoval(Ct);const Re=Le.av(Ct.source,Ct.scope);xi.type!==Ct.type?this._changes.updateSourceCache(Re,"clear"):(this._changes.updateSourceCache(Re,"reload"),Jt.pause())}this._updateLayer(Ct),Ct.onAdd&&Ct.onAdd(this.map),Ct.scope=this.scope,this.mergeLayers()}moveLayer(Re,Oe){this._checkLoaded();const Ue=this._checkLayer(Re);if(!Ue)return;if(Re===Oe)return;const qe=this._order.indexOf(Re);this._order.splice(qe,1);let Ct=this._order.length;if(Oe){const Re=this._order.indexOf(Oe);if(-1===Re)return void this.fire(new Le.t(new Error(`Layer with i
1d "${Oe}" does not exist on this map.`)));Ue.slot===this._layers[Oe].slot?Ct=Re:Le.w(`Layer with id "${Oe}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(Ct,0,Re),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(Le){this._checkLoaded();const Re=this._checkLayer(Le);if(!Re)return;Re.setEventedParent(null);const Oe=this._order.indexOf(Le);this._order.splice(Oe,1),delete this._layers[Le],delete this._serializedLayers[Le],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(Re.fqid),this._changes.removeLayer(Re);const Ue=this.getOwnLayerSourceCache(Re);if(Ue&&Ue.castsShadows){let Le=!1;for(const Oe in this._layers)if(this._layers[Oe].source===Re.source&&this._layers[Oe].canCastShadows()){Le=!0;break}Ue.castsShadows=Le}Re.onRemove&&Re.onRemove(this.map),this.mergeLayers()}getOwnLayer(Le){return this._layers[Le]}hasLayer(Le){return Le in this._mergedLayers}hasLayerType(Le){for(const Re in this._layers)if(this._layers[Re].type===Le)return!0;return!1}setLayerZoomRange(Le,Re,Oe){this._checkLoaded();const Ue=this._checkLayer(Le);Ue&&(Ue.minzoom===Re&&Ue.maxzoom===Oe||(null!=Re&&(Ue.minzoom=Re),null!=Oe&&(Ue.maxzoom=Oe),this._updateLayer(Ue)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(Le,Re){this._checkLoaded();const Oe=this._checkLayer(Le);Oe&&Oe.slot!==Re&&(Oe.slot=Re,this._updateLayer(Oe))}setFilter(Re,Oe,Ue={}){this._checkLoaded();const qe=this._checkLayer(Re);if(qe&&!Le.bh(qe.filter,Oe))return null==Oe?(qe.filter=void 0,void this._updateLayer(qe)):void(this._validate(Te,`layers.${qe.id}.filter`,Oe,{layerType:qe.type},Ue)||(qe.filter=Le.cl(Oe),this._updateLayer(qe)))}getFilter(Re){const Oe=this._checkLayer(Re);if(Oe)return Le.cl(Oe.filter)}setLayoutProperty(Re,Oe,Ue,qe={}){this._checkLoaded();const Ct=this._checkLayer(Re);if(Ct&&!Le.bh(Ct.getLayoutProperty(Oe),Ue)){if(null!=Ue&&(!qe||!1!==qe.validate)&&ro(Ct,Ce.call(fe,{key:`layers.${Re}.layout.${Oe}`,layerType:Ct.type,objectKey:Oe,value:Ue,styleSpec:Le._,style:{glyphs:!0,sprite:!0}})))return;Ct.setLayoutProperty(Oe,Ue),0!==Ct.configDependencies.size&&this._configDependentLayers.add(Ct.fqid),this._updateLayer(Ct)}}getLayoutProperty(Le,Re){const Oe=this._checkLayer(Le);if(Oe)return Oe.getLayoutProperty(Re)}setPaintProperty(Re,Oe,Ue,qe={}){this._checkLoaded();const Ct=this._checkLayer(Re);if(!Ct)return;if(Le.bh(Ct.getPaintProperty(Oe),Ue))return;if(null!=Ue&&(!qe||!1!==qe.validate)&&ro(Ct,Ee.call(fe,{key:`layers.${Re}.paint.${Oe}`,layerType:Ct.type,objectKey:Oe,value:Ue,styleSpec:Le._})))return;const Ot=Ct.setPaintProperty(Oe,Ue);0!==Ct.configDependencies.size&&this._configDependentLayers.add(Ct.fqid),Ot&&this._updateLayer(Ct),this._changes.updatePaintProperties(Ct)}getPaintProperty(Le,Re){const Oe=this._checkLayer(Le);if(Oe)return Oe.getPaintProperty(Re)}setFeatureState(Re,Oe){this._checkLoaded();const Ue=Re.source,qe=Re.sourceLayer,Ct=this._checkSource(Ue);if(!Ct)return;const Ot=Ct.type;if("geojson"===Ot&&qe)return void this.fire(new Le.t(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===Ot&&!qe)return void this.fire(new Le.t(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===Re.id&&this.fire(new Le.t(new Error("The feature id parameter must be provided.")));const Jt=this.getOwnSourceCaches(Ue);for(const Le of Jt)Le.setFeatureState(qe,Re.id,Oe)}removeFeatureState(Re,Oe){this._checkLoaded();const Ue=Re.source,qe=this._checkSource(Ue);if(!qe)return;const Ct=qe.type,Ot="vector"===Ct?Re.sourceLayer:void 0;if("vector"===Ct&&!Ot)return void this.fire(new Le.t(new Error("The sourceLayer parameter must be provided for vector source types.")));if(Oe&&"string"!=typeof Re.id&&"number"!=typeof Re.id)return void this.fire(new Le.t(new Error("A feature id is required to remove its specific state property.")));const Jt=this.getOwnSourceCaches(Ue);for(const Le of Jt)Le.removeFeatureState(Ot,Re.id,Oe)}getFeatureState(Re){this._checkLoaded();const Oe=Re.source,Ue=Re.sourceLayer,qe=this._checkSource(Oe);if(qe){if("vector"!==qe.type||Ue)return void 0===Re.id&&this.fire(new Le.t(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(Oe)[0].getFeatureState(Ue,Re.id);this.fire(new Le.t(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(Re){return this.stylesheet.transition=Le.l({},this.stylesheet.transition,Re),this.transition=this.stylesheet.transition,this}getTransition(){return Le.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();const Re=this.getTerrain(),Oe=Re&&this.terrain&&this.terrain.scope===this.scope?Re:this.stylesheet.terrain;return Le.cr({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:Oe,fog:this.stylesheet.fog,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(Le=>void 0!==Le))}_updateLayer(Re){this._changes.updateLayer(Re);const Oe=this.getLayerSourceCache(Re),Ue=Le.av(Re.source,Re.scope),qe=this._changes.getUpd
1atedSourceCaches();Re.source&&!qe[Ue]&&Oe&&"raster"!==Oe.getSource().type&&(this._changes.updateSourceCache(Ue,"reload"),Oe.pause()),Re.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(Le){const t=Le=>this._mergedLayers[Le].is3D(),Re=this.order,Oe={},Ue=[];for(let qe=Re.length-1;qe>=0;qe--){const Ct=Re[qe];if(t(Ct)){Oe[Ct]=qe;for(const Re of Le){const Le=Re[Ct];if(Le)for(const Re of Le)Ue.push(Re)}}}Ue.sort(((Le,Re)=>Re.intersectionZ-Le.intersectionZ));const qe=[];for(let Ct=Re.length-1;Ct>=0;Ct--){const Ot=Re[Ct];if(t(Ot))for(let Le=Ue.length-1;Le>=0;Le--){const Re=Ue[Le].feature;if(Re.layer&&Oe[Re.layer.id]<Ct)break;qe.push(Re),Ue.pop()}else for(const Re of Le){const Le=Re[Ot];if(Le)for(const Re of Le)qe.push(Re.feature)}}return qe}queryRenderedFeatures(Re,Oe,Ue){Oe&&Oe.filter&&this._validate(Te,"queryRenderedFeatures.filter",Oe.filter,null,Oe),Oe.scope=this.scope,Oe.availableImages=this._availableImages,Oe.serializedLayers=this._serializedLayers;const qe={};if(Oe&&Oe.layers){if(!Array.isArray(Oe.layers))return this.fire(new Le.t(new Error("parameters.layers must be an Array."))),[];for(const Re of Oe.layers){const Oe=this._mergedLayers[Re];if(!Oe)return this.fire(new Le.t(new Error(`The layer '${Re}' does not exist in the map's style and cannot be queried for features.`))),[];qe[Oe.source]=!0}}const Ct=[],Ot=Oe.serializedLayers||{},Jt=Oe&&Oe.layers?Oe.layers.some((Le=>{const Re=this.getLayer(Le);return Re&&Re.is3D()})):this.has3DLayers(),_i=Ze.createFromScreenPoints(Re,Ue);for(const Le in this._mergedSourceCaches){const Re=this._mergedSourceCaches[Le].getSource();if(!Re||Re.scope!==Oe.scope)continue;const xi=this._mergedSourceCaches[Le].getSource().id;Oe.layers&&!qe[xi]||Ct.push(ot(this._mergedSourceCaches[Le],this._mergedLayers,Ot,_i,Oe,Ue,Jt,!!this.map._showQueryGeometry))}return this.placement&&Ct.push(function(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt={},_i=Ct.queryRenderedSymbols(Ue),xi=[];for(const Le of Object.keys(_i).map(Number))xi.push(Ot[Le]);xi.sort(st);for(const Oe of xi){const Ue=Oe.featureIndex.lookupSymbolFeatures(_i[Oe.bucketInstanceId],Re,Oe.bucketIndex,Oe.sourceLayerIndex,qe.filter,qe.layers,qe.availableImages,Le);for(const Le in Ue){const Re=Jt[Le]=Jt[Le]||[],qe=Ue[Le];qe.sort(((Le,Re)=>{const Ue=Oe.featureSortOrder;if(Ue){const Oe=Ue.indexOf(Le.featureIndex);return Ue.indexOf(Re.featureIndex)-Oe}return Re.featureIndex-Le.featureIndex}));for(const Le of qe)Re.push(Le)}}for(const Re in Jt)Jt[Re].forEach((Ue=>{const qe=Ue.feature,Ct=Oe(Le[Re]);if(!Ct)return;const Ot=Ct.getFeatureState(qe.layer["source-layer"],qe.id);qe.source=qe.layer.source,qe.layer["source-layer"]&&(qe.sourceLayer=qe.layer["source-layer"]),qe.state=Ot}));return Jt}(this._mergedLayers,Ot,this.getLayerSourceCache.bind(this),_i.screenGeometry,Oe,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(Ct)}querySourceFeatures(Le,Re){Re&&Re.filter&&this._validate(Te,"querySourceFeatures.filter",Re.filter,null,Re);const Oe=this.getOwnSourceCaches(Le);let Ue=[];for(const Le of Oe)Ue=Ue.concat(rt(Le,Re));return Ue}addSourceType(Le,Re,Oe){return co.getSourceType(Le)?Oe(new Error(`A source type called "${Le}" already exists.`)):(co.setSourceType(Le,Re),Re.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:Le,url:Re.workerSourceURL},Oe):Oe(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(Re,Oe,Ue={}){this._checkLoaded();const qe=this.light.getLight();let Ct=!1;for(const Oe in Re)if(!Le.bh(Re[Oe],qe[Oe])){Ct=!0;break}if(!Ct)return;const Ot=this._getTransitionParameters();this.light.setLight(Re,Oe,Ue),this.light.updateTransitions(Ot)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=Le.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&Le.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(Re,Oe=1){if(this._checkLoaded(),!Re)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===Oe&&delete this.terrain,null===Re?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedU
1pdate=!0);this.checkCanvasFingerprintNoise();let Ue=Re;const qe=null==Re.source;if(1===Oe){if(this.disableElevatedTerrain)return;if("object"==typeof Ue.source){const Re="terrain-dem-src";this.addSource(Re,Ue.source),Ue=Le.cl(Ue),Ue=Le.l(Ue,{source:Re})}const Re=Le.l({},Ue),Oe={};if(this.terrain&&qe){Re.source=this.terrain.get().source;const Le=this.terrain?this.getFragmentStyle(this.terrain.scope):null;Le&&(Oe.style=Le.serialize())}if(this._validate(ye,"terrain",Re,Oe))return}if(!this.terrain||this.terrain.scope!==this.scope&&!qe||this.terrain&&Oe!==this.terrain.drapeRenderMode){if(!Ue)return;this._createTerrain(Ue,Oe),this.fire(new Le.x("data",{dataType:"style"}))}else{const Oe=this.terrain,qe=Oe.get();for(const Re of Object.keys(Le._.terrain))!Ue.hasOwnProperty(Re)&&Le._.terrain[Re].default&&(Ue[Re]=Le._.terrain[Re].default);for(const Ue in Re)if(!Le.bh(Re[Ue],qe[Ue])){Oe.set(Re,this.options),this.stylesheet.terrain=Re;const Ue=this._getTransitionParameters({duration:0});Oe.updateTransitions(Ue),this.fire(new Le.x("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(Le){const Re=this.fog=new Ge(Le,this.map.transform,this.scope,this.options);this.stylesheet.fog=Re.get();const Oe=this._getTransitionParameters({duration:0});Re.updateTransitions(Oe)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const Le of this.map._markers)Le._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(Re){if(this._checkLoaded(),!Re)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const Oe=this.fog;if(!Le.bh(Oe.get(),Re)){Oe.set(Re,this.options),this.stylesheet.fog=Oe.get();const Le=this._getTransitionParameters({duration:0});Oe.updateTransitions(Le)}}else this._createFog(Re);this._markersNeedUpdate=!0}setColorTheme(Re){this._checkLoaded();const i=()=>{for(const Le in this._layers)this._layers[Le].lut=this._styleColorTheme.lut;for(const Le in this._sourceCaches)this._sourceCaches[Le].clearTiles()};if(this._styleColorTheme.colorTheme=Re,!Re)return this._styleColorTheme.lut=null,void i();const Oe=this._evaluateColorThemeData(Re);this._loadColorTheme(Oe).then((()=>{this.fire(new Le.x("colorthemeset")),i()})).catch((Re=>{Le.w(`Couldn't set color theme: ${Re}`)}))}_getTransitionParameters(Re){return{now:Le.q.now(),transition:Le.l(this.transition,Re)}}updateDrapeFirstLayers(){if(!this.terrain)return;const Le=[],Re=[];for(const Oe of this._mergedOrder)this.isLayerDraped(this._mergedLayers[Oe])?Le.push(Oe):Re.push(Oe);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...Le),this._drapedFirstOrder.push(...Re)}_createTerrain(Le,Re){const Oe=this.terrain=new as(Le,Re,this.scope,this.options);1===Re&&(this.stylesheet.terrain=Le),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const Ue=this._getTransitionParameters({duration:0});Oe.updateTransitions(Ue)}_force3DLayerUpdate(){for(const Le in this._layers){const Re=this._layers[Le];"fill-extrusion"===Re.type&&this._updateLayer(Re)}}_forceSymbolLayerUpdate(){for(const Le in this._layers){const Re=this._layers[Le];"symbol"===Re.type&&this._updateLayer(Re)}}_validate(Re,Oe,Ue,qe,Ct={}){if(Ct&&!1===Ct.validate)return!1;const Ot=Le.l({},this.serialize());return ro(this,Re.call(fe,Le.l({key:Oe,style:Ot,value:Ue,styleSpec:Le._},qe)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),Le.cs.off("pluginStateChange",this._rtlTextPluginCallback);for(const Le in this._mergedLayers)this._mergedLayers[Le].setEventedParent(null);for(const Le in this._mergedSourceCaches)this._mergedSourceCaches[Le].clearTiles(),this._mergedSourceCaches[Le].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(Le){const Re=this.getSourceCaches(Le);for(const Le of Re)Le.clearTiles()}clearSources(){for(const Le in this._mergedSourceCaches)this._mergedSourceCaches[Le].clearTiles()}reloadSource(Le){const Re=this.getSourceCaches(Le);for(const Le of Re)Le.resume(),Le.reload()}
1reloadSources(){for(const Le of this.getSources())Le.reload&&Le.reload()}updateSources(Le){let Re;this.directionalLight&&(Re=Qi(this.directionalLight));for(const Oe in this._mergedSourceCaches)this._mergedSourceCaches[Oe].update(Le,void 0,void 0,Re)}_generateCollisionBoxes(){for(const Le in this._sourceCaches){const Re=this._sourceCaches[Le];Re.resume(),Re.reload()}}_updatePlacement(Re,Oe,Ue,qe,Ct,Ot,Jt=!1){let _i=!1,xi=!1;const vi={},bi={};for(const Re of this._mergedOrder){const Ue=this._mergedLayers[Re];if("symbol"!==Ue.type)continue;const qe=Le.av(Ue.source,Ue.scope);let Ct=vi[qe];if(!Ct){const Le=this.getLayerSourceCache(Ue);if(!Le)continue;const Re=Le.getRenderableIds(!0).map((Re=>Le.getTileByID(Re)));bi[qe]=Re.slice(),Ct=vi[qe]=Re.sort(((Le,Re)=>Re.tileID.overscaledZ-Le.tileID.overscaledZ||(Le.tileID.isLessThan(Re.tileID)?-1:1)))}const Ot=this.crossTileSymbolIndex.addLayer(Ue,Ct,Oe.center.lng,Oe.projection);_i=_i||Ot}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),Jt=Jt||this._layerOrderChanged||0===qe,this._layerOrderChanged&&this.fire(new Le.x("neworder")),(Jt||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Le.q.now(),Oe.zoom))&&(this.pauseablePlacement=new Ti(Oe,this._mergedOrder,Jt,Ue,qe,Ct,this.placement,this.fog&&Oe.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,vi,bi),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Le.q.now()),xi=!0),_i&&this.pauseablePlacement.placement.setStale()),xi||_i){this._buildingIndex.onNewFrame(Oe.zoom);for(let Re=0;Re<this._mergedOrder.length;Re++){const Oe=this._mergedLayers[this._mergedOrder[Re]];if("symbol"!==Oe.type)continue;const Ue=this.isLayerClipped(Oe);this.placement.updateLayerOpacities(Oe,vi[Le.av(Oe.source,Oe.scope)],Re,Ue?Ot:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Le.q.now())}}_releaseSymbolFadeTiles(){for(const Le in this._sourceCaches)this._sourceCaches[Le].releaseSymbolFadeTiles()}addImport(Re,Oe){this._checkLoaded();const Ue=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==Ue.findIndex((({id:Le})=>Le===Re.id)))return void this.fire(new Le.t(new Error(`Import with id '${Re.id}' already exists in the map's style.`)));if(!Oe)return Ue.push(Re),this._loadImports([Re],!0);const qe=Ue.findIndex((({id:Le})=>Le===Oe));return-1===qe&&this.fire(new Le.t(new Error(`Import with id "${Oe}" does not exist on this map.`))),this.stylesheet.imports=Ue.slice(0,qe).concat(Re).concat(Ue.slice(qe)),this._loadImports([Re],!0,Oe)}updateImport(Re,Oe){this._checkLoaded();const Ue=this.stylesheet.imports||[],qe=this.getImportIndex(Re);return-1===qe?this:"string"==typeof Oe?(this.setImportUrl(Re,Oe),this):(Oe.url&&Oe.url!==Ue[qe].url&&this.setImportUrl(Re,Oe.url),Le.bh(Oe.config,Ue[qe].config)||this.setImportConfig(Re,Oe.config),Le.bh(Oe.data,Ue[qe].data)||this.setImportData(Re,Oe.data),this)}moveImport(Le,Re){this._checkLoaded();let Oe=this.stylesheet.imports||[];const Ue=this.getImportIndex(Le);if(-1===Ue)return this;const qe=this.getImportIndex(Re);if(-1===qe)return this;const Ct=Oe[Ue],Ot=this.fragments[Ue];return Oe=Oe.filter((({id:Re})=>Re!==Le)),this.fragments=this.fragments.filter((({id:Re})=>Re!==Le)),this.stylesheet.imports=Oe.slice(0,qe).concat(Ct).concat(Oe.slice(qe)),this.fragments=this.fragments.slice(0,qe).concat(Ot).concat(this.fragments.slice(qe)),this.mergeLayers(),this}setImportUrl(Le,Re){this._checkLoaded();const Oe=this.stylesheet.imports||[],Ue=this.getImportIndex(Le);if(-1===Ue)return this;Oe[Ue].url=Re;const qe=this.fragments[Ue];return qe.style=this._createFragmentStyle(Oe[Ue]),qe.style.on("style.import.load",(()=>this.mergeAll())),qe.style.loadURL(Re),this}setImportData(Le,Re){this._checkLoaded();const Oe=this.getImportIndex(Le),Ue=this.stylesheet.imports||[];return-1===Oe?this:Re?(this.fragments[Oe].style.setState(Re),this._reloadImports(),this):(delete Ue[Oe].data,this.setImportUrl(Le,Ue[Oe].url))}setImportConfig(Le,Re){this._checkLoaded();const Oe=this.getImportIndex(Le),Ue=this.stylesheet.imports||[];if(-1===Oe)return this;Re?Ue[Oe].config=Re:delete Ue[Oe].config;const qe=this.fragments[Oe],Ct=qe.style.stylesheet&&qe.style.stylesheet.schema;return qe.config=Re,qe.style.updateConfig(Re,Ct),this.updateConfigDependencies(),this}removeImport(Le){this._checkLoaded();const Re=this.stylesheet.imports||[],Oe=this.getImportIndex(Le);-1!==Oe&&(Re.splice(Oe,1),this.fragments[Oe].style._remove(),this.fragments.splice(Oe,1),this._reloadImports())}getImportIndex(Re){const Oe=(this.stylesheet.imports||[]).findIndex((Le=>Le.id===Re));return-1===Oe&&this.fire(new Le.t(new Error(`Import '${Re}' does not exist in the map's style and cannot be updated.`))),Oe}getLayer(Le){return this._mergedLayers[Le]}getSources(){const Le=[];for(const Re in this._mergedOtherSourceCaches){const Oe=this._mergedOtherSourceCaches[Re];Oe&&Le.push(Oe.getSource())}return Le}getSource(Le,Re){const Oe=this.getSourceCache(Le,Re);return Oe&&Oe.getSource()}getLayerSource(Le){const Re=this.getLayerSourceCache(Le);return Re&&Re.getSource()}getSourceCache(Re,Oe){const Ue=Le.av(Re,Oe);return this._mergedOtherSourceCaches[Ue]}
1getLayerSourceCache(Re){const Oe=Le.av(Re.source,Re.scope);return"symbol"===Re.type?this._mergedSymbolSourceCaches[Oe]:this._mergedOtherSourceCaches[Oe]}getSourceCaches(Le){if(null==Le)return Object.values(this._mergedSourceCaches);const Re=[];return this._mergedOtherSourceCaches[Le]&&Re.push(this._mergedOtherSourceCaches[Le]),this._mergedSymbolSourceCaches[Le]&&Re.push(this._mergedSymbolSourceCaches[Le]),Re}updateSourceCaches(){const Le=this._changes.getUpdatedSourceCaches();for(const Re in Le){const Oe=Le[Re];"reload"===Oe?this.reloadSource(Re):"clear"===Oe&&this.clearSource(Re)}}updateLayers(Le){const Re=this._changes.getUpdatedPaintProperties();for(const Oe of Re){const Re=this.getLayer(Oe);Re&&Re.updateTransitions(Le)}}getImages(Le,Re,Oe){this.imageManager.getImages(Re.icons,Re.scope,Oe),this._updateTilesForChangedImages();const o=Le=>{Le&&Le.setDependencies(Re.tileID.key,Re.type,Re.icons)};o(this._otherSourceCaches[Re.source]),o(this._symbolSourceCaches[Re.source])}getGlyphs(Le,Re,Oe){this.glyphManager.getGlyphs(Re.stacks,Re.scope,Oe)}getResource(Re,Oe,Ue){return Le.ct(Oe,Ue)}getOwnSourceCache(Le){return this._otherSourceCaches[Le]}getOwnLayerSourceCache(Le){return"symbol"===Le.type?this._symbolSourceCaches[Le.source]:this._otherSourceCaches[Le.source]}getOwnSourceCaches(Le){const Re=[];return this._otherSourceCaches[Le]&&Re.push(this._otherSourceCaches[Le]),this._symbolSourceCaches[Le]&&Re.push(this._symbolSourceCaches[Le]),Re}_isSourceCacheLoaded(Re){const Oe=this.getOwnSourceCaches(Re);return 0===Oe.length?(this.fire(new Le.t(new Error(`There is no source with ID '${Re}'`))),!1):Oe.every((Le=>Le.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(Le,Re){if(!this._clipLayerPresent&&"fill-extrusion"!==Le.type)return!1;const Oe="fill-extrusion"===Le.type&&"building"===Le.sourceLayer;if(Le.is3D()){if(Oe||Re&&"batched-model"===Re.type)return!0;if("model"===Le.type)return!0}else if("symbol"===Le.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach((Le=>{Le.style._remove()})),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}co.getSourceType=function(Le){return il[Le]},co.setSourceType=function(Le,Re){il[Le]=Re},co.registerForPluginStateChange=Le.cc;var yh="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",Th="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,high
1p vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",Eh="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",Ch="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",zh="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}
1float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
1size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",Dh="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",Rh="highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
1vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",Bh="#ifdef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",Vh="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",Gh="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
1\n#endif//RENDER_SHADOWS",iu="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef NATIVE\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const ou=[];Do(yh,ou),Do(Eh,ou),Do(Th,ou);const su={"_prelude_fog.vertex.glsl":Dh,"_prelude_terrain.vertex.glsl":zh,"_prelude_shadow.vertex.glsl":Gh,"_prelude_fog.fragment.glsl":Rh,"_prelude_shadow.fragment.glsl":iu,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
1));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":Bh,"_prelude_raster_particle.glsl":Vh},au={};Ro("",zh),Ro(Rh,Dh),Ro(iu,Gh),Ro(Bh,""),Ro(Vh,"");const lu=Ro(Th,Eh),xu=yh;var Tu={background:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
1/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radiu
1s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:Ro("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ro('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:Ro("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Ro("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:Ro("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Ro("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutline:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:Ro("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
1\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:Ro('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:Ro("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:Ro("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
1float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform highp float u_device_pixel_ratio;
1uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 v_uv;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\n#endif\n#ifdef LINE_JOIN_NONE\nfloat pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_ground(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec4 v_uv;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef LINE_JOIN_NONE\nv_width=floorwidth+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),raster:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:Ro("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:Ro("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}
1"),rasterParticleUpdate:Ro('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Ro('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n}'),terrainRaster:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:Ro("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:Ro('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Ch),skyboxGradient:Ro('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',Ch),skyboxCapture:Ro
vendor: 3,689 bytes, line 1
1("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\n#define MIE_G                   0.76\n#define DENSITY_HEIGHT_SCALE_R  8000.0\n#define DENSITY_HEIGHT_SCALE_M  1200.0\n#define PLANET_RADIUS           6360e3\n#define ATMOSPHERE_RADIUS       6420e3\n#define SAMPLE_STEPS            10\n#define DENSITY_STEPS           4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
1v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:Ro('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
1vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:Ro('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
1Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
1Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
1y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
1\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:Ro("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
1rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:Ro("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),occlusion:Ro("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function Do(Le,Re){const Oe=Le.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let Le of Oe)if(Le=Le.trim(),"#"===Le[0]&&Le.includes("if")&&!Le.includes("endif")){Le=Le.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const Oe=Le.split(" ");for(const Le of Oe)Re.includes(Le)||Re.push(Le)}}function Ro(Le,Re){const Oe=/#include\s+"([^"]+)"/g,Ue=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let qe=Re.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);qe&&(qe=qe.map((Le=>{const Re=Le.split(" ");return Re[Re.length-1]})),qe=[...new Set(qe)]);const Ct={},Ot=[],Jt=[];if(Le=Le.replace(Oe,((Le,Re)=>(Jt.push(Re),""))),(Re=Re.replace(Oe,((Le,Re)=>(Ot.push(Re),"")))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let _i=[...ou];Do(Le,_i),Do(Re,_i);for(const Le of[...Ot,...Jt])su[Le]||console.error(`Undefined include: ${Le}`),au[Le]||(au[Le]=[],Do(su[Le],au[Le])),_i=[..._i,...au[Le]];return{fragmentSource:Le=Le.replace(Ue,((Le,Re,Oe,Ue,qe)=>(Ct[qe]=!0,"define"===Re?`\n#ifndef HAS_UNIFORM_u_${qe}\nin ${Oe} ${Ue} ${qe};\n#else\nuniform ${Oe} ${Ue} u_${qe};\n#endif\n`:"initialize"===Re?`\n#ifdef HAS_UNIFORM_u_${qe}\n    ${Oe} ${Ue} ${qe} = u_${qe};\n#endif\n`:"define-attribute"===Re?`\n#ifdef HAS_ATTRIBUTE_a_${qe}\n    in ${Oe} ${Ue} ${qe};\n#endif\n`:"initialize-attribute"===Re?"":void 0))),vertexSource:Re=Re.replace(Ue,((Le,Re,Oe,Ue,qe)=>{const Ot="float"===Ue?"vec2":Ue,Jt=qe.match(/color/)?"color":Ot;return"define-attribute-vertex-shader-only"===Re?`\n#ifdef HAS_ATTRIBUTE_a_${qe}\nin ${Oe} ${Ue} a_${qe};\n#endif\n`:Ct[qe]?"define"===Re?`\n#ifndef HAS_UNIFORM_u_${qe}\nuniform lowp float u_${qe}_t;\nin ${Oe} ${Ot} a_${qe};\nout ${Oe} ${Ue} ${qe};\n#else\nuniform ${Oe} ${Ue} u_${qe};\n#endif\n`:"initialize"===Re?"vec4"===Jt?`\n#ifndef HAS_UNIFORM_u_${qe}\n    ${qe} = a_${qe};\n#else\n    ${Oe} ${Ue} ${qe} = u_${qe};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${qe}\n    ${qe} = unpack_mix_${Jt}(a_${qe}, u_${qe}_t);\n#else\n    ${Oe} ${Ue} ${qe} = u_${qe};\n#endif\n`:"define-attribute"===Re?`\n#ifdef HAS_ATTRIBUTE_a_${qe}\n    in ${Oe} ${Ue} a_${qe};\n    out ${Oe} ${Ue} ${qe};\n#endif\n`:"initialize-attribute"===Re?`\n#ifdef HAS_ATTRIBUTE_a_${qe}\n    ${qe} = a_${qe};\n#endif\n`:void 0:"define"===Re?`\n#ifndef HAS_UNIFORM_u_${qe}\nuniform lowp float u_${qe}_t;\nin ${Oe} ${Ot} a_${qe};\n#else\nuniform ${Oe} ${Ue} u_${qe};\n#endif\n`:"define-instanced"===Re?"mat4"===Jt?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${qe}0;\nin vec4 a_${qe}1;\nin vec4 a_${qe}2;\nin vec4 a_${qe}3;\n#else\nuniform ${Oe} ${Ue} u_${qe};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${Oe} ${Ot} a_${qe};\n#else\nuniform ${Oe} ${Ue} u_${qe};\n#endif\n`:"initialize-attribute-custom"===Re?`\n#ifdef HAS_ATTRIBUTE_a_${qe}\n    ${Oe} ${Ue} ${qe} = a_${qe};\n#endif\n`:"vec4"===Jt?`\n#ifndef HAS_UNIFORM_u_${qe}\n    ${Oe} ${Ue} ${qe} = a_${qe};\n#else\n    ${Oe} ${Ue} ${qe} = u_${qe};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${qe}\n    ${Oe} ${Ue} ${qe} = unpack_mix_${Jt}(a_${qe}, u_${qe}_t);\n#else\n    ${Oe} ${Ue} ${qe} = u_${qe};\n#endif\n`})),staticAttributes:qe,usedDefines:_i,vertexIncludes:Ot,fragmentIncludes:Jt}}class Ao{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(Le,Re,Oe,Ue,qe,Ct,Ot,Jt){this.context=Le;let _i=this.boundPaintVertexBuffers.length!==Ue.length;for(let Le=0;!_i&&Le<Ue.length;Le++)this.boundPaintVertexBuffers[Le]!==Ue[Le]&&(_i=!0);let xi=this.boundDynamicVertexBuffers.length!==Ot.length;for(let Le=0;!xi&&Le<Ot.length;Le++)this.boundDynamicVertexBuffers[Le]!==Ot[Le]&&(xi=!0);if(!this.vao||this.boundProgram!==Re||this.boundLayoutVertexBuffer!==Oe||_i||xi||this.boundIndexBuffer!==qe||this.boundVertexOffset!==Ct)this.freshBind(Re,Oe,Ue,qe,Ct,Ot,Jt);else{Le.bindVertexArrayOES.set(this.vao);for(const Oe of Ot)Oe&&(Oe.bind(),Jt&&Oe.instanceCount&&Oe.setVertexAttribDivisor(Le.gl,Re,Jt));qe&&qe.dynamicDraw&&qe.bind()}}freshBind(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=Le.numAttributes,_i=this.context,xi=_i.gl;this.vao&&this.destroy(),this.vao=_i.gl.createVertexArray(),_i.bindVertexArrayOES.set(this.vao),this.boundProgram=Le,this.boundLayoutVertexBuffer=Re,this.boundPaintVertexBuffers=Oe,this.boundIndexBuffer=Ue,this.boundVertexOffset=qe,this.boundDynamicVertexBuffers=Ct,Re.enableAttributes(xi,Le),Re.bind(),Re.setVertexAttribPointers(xi,Le,qe);for(const Re of Oe)Re.enableAttributes(xi,Le),Re.bind(),Re.setVertexAttribPointers(xi,Le,qe);for(const Re of Ct)Re&&(Re.enableAttributes(xi,Le),Re.bind(),Re.setVertexAttribPointers(xi,Le,qe),Ot&&Re.instanceCount&&Re.setVertexAttribDivisor(xi,Le,Ot));Ue&&Ue.bind(),_i.currentNumAttributes=Jt}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Lo(Re,Oe){const Ue=Math.pow(2,Oe.canonical.z),qe=Oe.canonical.y;return[new Le.a5(0,qe/Ue).toLngLat().lat,new Le.a5(0,(qe+1)/Ue).toLngLat().lat]}function Po(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Re.context,xi=_i.gl,vi=Ue.hillshadeFBO;if(!vi)return;Re.prepareDrawTile();const bi=Re.isTileAffectedByFog(Oe),Pi=Re.getOrCreateProgram("hillshade",{overrideFog:bi});_i.activeTexture.set(xi.TEXTURE0),xi.bindTexture(xi.TEXTURE_2D,vi.colorAttachment.get());const Hr=((Re,Oe,Ue,qe)=>{const Ct=Ue.paint.get("hillshade-shadow-color"),Ot=Ue.paint.get("hillshade-highlight-color"),Jt=Ue.paint.get("hillshade-accent-color"),_i=Ue.paint.get("hillshade-emissive-strength");let xi=Le.bB(Ue.paint.get("hillshade-illumination-direction"));if("viewport"===Ue.paint.get("hillshade-illumination-anchor"))xi-=Re.transform.angle;else if(Re.style&&Re.style.enable3dLights()&&Re.style.directionalLight){const Oe=Re.style.directionalLight.properties.get("direction"),Ue=Le.c7(Oe.x,Oe.y,Oe.z);xi=Le.bB(Ue[1])}const vi=!Re.options.moving;return{u_matrix:qe||Re.transform.calculateProjMatrix(Oe.tileID.toUnwrapped(),vi),u_image:0,u_latrange:Lo(0,Oe.tileID),u_light:[Ue.paint.get("hillshade-exaggeration"),xi],u_shadow:Ct.toRenderColor(Ue.lut),u_highlight:Ot.toRenderColor(Ue.lut),u_emissive_strength:_i,u_accent:Jt.toRenderColor(Ue.lut)}})(Re,Ue,qe,Re.terrain?Oe.projMatrix:null);Re.uploadCommonUniforms(_i,Pi,Oe.toUnwrapped());const{tileBoundsBuffer:Jr,tileBoundsIndexBuffer:Ln,tileBoundsSegments:Nn}=Re.getTileBoundsBuffers(Ue);Pi.draw(Re,xi.TRIANGLES,Ct,Ot,Jt,Fi.disabled,Hr,qe.id,Jr,Ln,Nn)}function Mo(Re,Oe,Ue){if(!Oe.needsDEMTextureUpload)return;const qe=Re.context,Ct=qe.gl;qe.pixelStoreUnpackPremultiplyAlpha.set(!1),Oe.demTexture=Oe.demTexture||Re.getTileTexture(Ue.stride);const Ot=Ue.getPixels();Oe.demTexture?Oe.demTexture.update(Ot,{premultiply:!1}):Oe.demTexture=new Le.T(qe,Ot,Ct.R32F,{premultiply:!1}),Oe.needsDEMTextureUpload=!1}function zo(Re,Oe,Ue){const qe=Re.context,Ct=qe.gl;if(!Oe.dem)return;const Ot=Oe.dem;if(qe.activeTexture.set(Ct.TEXTURE1),Mo(Re,Oe,Ot),!Oe.demTexture)return;Oe.demTexture.bind(Ct.NEAREST,Ct.CLAMP_TO_EDGE);const Jt=Ot.dim;qe.activeTexture.set(Ct.TEXTURE0);let _i=Oe.hillshadeFBO;if(!_i){const Re=new Le.T(qe,{width:Jt,height:Jt,data:null},Ct.RGBA8);Re.bind(Ct.LINEAR,Ct.CLAMP_TO_EDGE),_i=Oe.hillshadeFBO=qe.createFramebuffer(Jt,Jt,!0,"renderbuffer"),_i.colorAttachment.set(Re.texture)}qe.bindFramebuffer.set(_i.framebuffer),qe.viewport.set([0,0,Jt,Jt]);const{tileBoundsBuffer:xi,tileBoundsIndexBuffer:vi,tileBoundsSegments:bi}=Re.getMercatorTileBoundsBuffers(),Pi=[];Re.linearFloatFilteringSupported()&&Pi.push("TERRAIN_DEM_FLOAT_FORMAT"),Re.getOrCreateProgram("hillshadePrepare",{defines:Pi}).draw(Re,Ct.TRIANGLES,Li.disabled,Mi.disabled,Ai.unblended,Fi.disabled,((Re,Oe)=>{const Ue=Oe.stride,qe=Le.a6.mat4.create();return Le.a6.mat4.ortho(qe,0,Le.ab,-Le.ab,0,0,1),Le.a6.mat4.translate(qe,qe,[0,-Le.ab,0]),{u_matrix:qe,u_image:1,u_dimension:[Ue,Ue],u_zoom:Re.overscaledZ}})(Oe.tileID,Ot),Ue.id,xi,vi,bi),Oe.needsHillshadePrepare=!1}class Oo{constructor(Le){this.gl=Le.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(Le){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Fo extends Oo{getDefault(){return Le.bz.transparent}set(Le){const Re=this.current;(Le.r!==Re.r||Le.g!==Re.g||Le.b!==Re.b||Le.a!==Re.a||this.dirty)&&(this.gl.clearColor(Le.r,Le.g,Le.b,Le.a),this.current=Le,this.dirty=!1)}}class ko extends Oo{getDefault(){return 1}set(Le){(Le!==this.current||this.dirty)&&(this.gl.clearDepth(Le),this.current=Le,this.dirty=!1)}}class Bo extends Oo{getDefault(){return 0}set(Le){(Le!==this.current||this.dirty)&&(this.gl.clearStencil(Le),this.current=Le,this.dirty=!1)}}
vendor: 4,133 bytes, line 1
1class No extends Oo{getDefault(){return[!0,!0,!0,!0]}set(Le){const Re=this.current;(Le[0]!==Re[0]||Le[1]!==Re[1]||Le[2]!==Re[2]||Le[3]!==Re[3]||this.dirty)&&(this.gl.colorMask(Le[0],Le[1],Le[2],Le[3]),this.current=Le,this.dirty=!1)}}class Uo extends Oo{getDefault(){return!0}set(Le){(Le!==this.current||this.dirty)&&(this.gl.depthMask(Le),this.current=Le,this.dirty=!1)}}class Go extends Oo{getDefault(){return 255}set(Le){(Le!==this.current||this.dirty)&&(this.gl.stencilMask(Le),this.current=Le,this.dirty=!1)}}class jo extends Oo{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(Le){const Re=this.current;(Le.func!==Re.func||Le.ref!==Re.ref||Le.mask!==Re.mask||this.dirty)&&(this.gl.stencilFunc(Le.func,Le.ref,Le.mask),this.current=Le,this.dirty=!1)}}class Vo extends Oo{getDefault(){const Le=this.gl;return[Le.KEEP,Le.KEEP,Le.KEEP]}set(Le){const Re=this.current;(Le[0]!==Re[0]||Le[1]!==Re[1]||Le[2]!==Re[2]||this.dirty)&&(this.gl.stencilOp(Le[0],Le[1],Le[2]),this.current=Le,this.dirty=!1)}}class qo extends Oo{getDefault(){return!1}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Le?Re.enable(Re.STENCIL_TEST):Re.disable(Re.STENCIL_TEST),this.current=Le,this.dirty=!1}}class Zo extends Oo{getDefault(){return[0,1]}set(Le){const Re=this.current;(Le[0]!==Re[0]||Le[1]!==Re[1]||this.dirty)&&(this.gl.depthRange(Le[0],Le[1]),this.current=Le,this.dirty=!1)}}class Ho extends Oo{getDefault(){return!1}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Le?Re.enable(Re.DEPTH_TEST):Re.disable(Re.DEPTH_TEST),this.current=Le,this.dirty=!1}}class Wo extends Oo{getDefault(){return this.gl.LESS}set(Le){(Le!==this.current||this.dirty)&&(this.gl.depthFunc(Le),this.current=Le,this.dirty=!1)}}class $o extends Oo{getDefault(){return!1}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Le?Re.enable(Re.BLEND):Re.disable(Re.BLEND),this.current=Le,this.dirty=!1}}class Xo extends Oo{getDefault(){const Le=this.gl;return[Le.ONE,Le.ZERO,Le.ONE,Le.ZERO]}set(Le){const Re=this.current;(Le[0]!==Re[0]||Le[1]!==Re[1]||Le[2]!==Re[2]||Le[3]!==Re[3]||this.dirty)&&(this.gl.blendFuncSeparate(Le[0],Le[1],Le[2],Le[3]),this.current=Le,this.dirty=!1)}}class Yo extends Oo{getDefault(){return Le.bz.transparent}set(Le){const Re=this.current;(Le.r!==Re.r||Le.g!==Re.g||Le.b!==Re.b||Le.a!==Re.a||this.dirty)&&(this.gl.blendColor(Le.r,Le.g,Le.b,Le.a),this.current=Le,this.dirty=!1)}}class Ko extends Oo{getDefault(){return this.gl.FUNC_ADD}set(Le){(Le!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(Le,Le),this.current=Le,this.dirty=!1)}}class Jo extends Oo{getDefault(){return!1}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Le?Re.enable(Re.CULL_FACE):Re.disable(Re.CULL_FACE),this.current=Le,this.dirty=!1}}class Qo extends Oo{getDefault(){return this.gl.BACK}set(Le){(Le!==this.current||this.dirty)&&(this.gl.cullFace(Le),this.current=Le,this.dirty=!1)}}class er extends Oo{getDefault(){return this.gl.CCW}set(Le){(Le!==this.current||this.dirty)&&(this.gl.frontFace(Le),this.current=Le,this.dirty=!1)}}let Ou=class extends Oo{getDefault(){return null}set(Le){(Le!==this.current||this.dirty)&&(this.gl.useProgram(Le),this.current=Le,this.dirty=!1)}};class ir extends Oo{getDefault(){return this.gl.TEXTURE0}set(Le){(Le!==this.current||this.dirty)&&(this.gl.activeTexture(Le),this.current=Le,this.dirty=!1)}}class or extends Oo{getDefault(){const Le=this.gl;return[0,0,Le.drawingBufferWidth,Le.drawingBufferHeight]}set(Le){const Re=this.current;(Le[0]!==Re[0]||Le[1]!==Re[1]||Le[2]!==Re[2]||Le[3]!==Re[3]||this.dirty)&&(this.gl.viewport(Le[0],Le[1],Le[2],Le[3]),this.current=Le,this.dirty=!1)}}class rr extends Oo{getDefault(){return null}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Re.bindFramebuffer(Re.FRAMEBUFFER,Le),this.current=Le,this.dirty=!1}}class sr extends Oo{getDefault(){return null}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Re.bindRenderbuffer(Re.RENDERBUFFER,Le),this.current=Le,this.dirty=!1}}class ar extends Oo{getDefault(){return null}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;
vendor: 6,493 bytes, line 1
1Re.bindTexture(Re.TEXTURE_2D,Le),this.current=Le,this.dirty=!1}}class nr extends Oo{getDefault(){return null}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Re.bindBuffer(Re.ARRAY_BUFFER,Le),this.current=Le,this.dirty=!1}}class lr extends Oo{getDefault(){return null}set(Le){const Re=this.gl;Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,Le),this.current=Le,this.dirty=!1}}class cr extends Oo{getDefault(){return null}set(Le){this.gl&&(Le!==this.current||this.dirty)&&(this.gl.bindVertexArray(Le),this.current=Le,this.dirty=!1)}}class hr extends Oo{getDefault(){return 4}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Re.pixelStorei(Re.UNPACK_ALIGNMENT,Le),this.current=Le,this.dirty=!1}}class ur extends Oo{getDefault(){return!1}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Re.pixelStorei(Re.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Le),this.current=Le,this.dirty=!1}}class dr extends Oo{getDefault(){return!1}set(Le){if(Le===this.current&&!this.dirty)return;const Re=this.gl;Re.pixelStorei(Re.UNPACK_FLIP_Y_WEBGL,Le),this.current=Le,this.dirty=!1}}class _r extends Oo{constructor(Le,Re){super(Le),this.context=Le,this.parent=Re}getDefault(){return null}}class pr extends _r{setDirty(){this.dirty=!0}set(Le){if(Le===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const Re=this.gl;Re.framebufferTexture2D(Re.FRAMEBUFFER,Re.COLOR_ATTACHMENT0,Re.TEXTURE_2D,Le,0),this.current=Le,this.dirty=!1}}class mr extends _r{attachment(){return this.gl.DEPTH_ATTACHMENT}set(Le){if(Le===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const Re=this.gl;Re.framebufferRenderbuffer(Re.FRAMEBUFFER,this.attachment(),Re.RENDERBUFFER,Le),this.current=Le,this.dirty=!1}}class fr extends _r{attachment(){return this.gl.DEPTH_ATTACHMENT}set(Le){if(Le===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const Re=this.gl;Re.framebufferTexture2D(Re.FRAMEBUFFER,this.attachment(),Re.TEXTURE_2D,Le,0),this.current=Le,this.dirty=!1}}class gr extends mr{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const vr=(Le,Re,Oe)=>({u_matrix:Le,u_image0:0,u_skirt_height:Re,u_ground_shadow_factor:Oe}),xr=(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln)=>({u_proj_matrix:Float32Array.from(Le),u_globe_matrix:Re,u_normalize_matrix:Float32Array.from(Ue),u_merc_matrix:Oe,u_zoom_transition:qe,u_merc_center:Ct,u_image0:0,u_frustum_tl:Ot,u_frustum_tr:Jt,u_frustum_br:_i,u_frustum_bl:xi,u_globe_pos:vi,u_globe_radius:bi,u_viewport:Pi,u_grid_matrix:Ln?Float32Array.from(Ln):new Float32Array(9),u_skirt_height:Hr,u_far_z_cutoff:Jr});function yr(Le,Re){return null!=Le&&null!=Re&&!(!Le.hasData()||!Re.hasData())&&null!=Le.demTexture&&null!=Re.demTexture&&Le.tileID.key!==Re.tileID.key}const Nu=new class{constructor(){this.operations={}}newMorphing(Le,Re,Oe,Ue,qe){if(Le in this.operations){const Re=this.operations[Le];Re.to.tileID.key!==Oe.tileID.key&&(Re.queued=Oe)}else this.operations[Le]={startTime:Ue,phase:0,duration:qe,from:Re,to:Oe,queued:null}}getMorphValuesForProxy(Le){if(!(Le in this.operations))return null;const Re=this.operations[Le];return{from:Re.from,to:Re.to,phase:Re.phase}}update(Le){for(const Re in this.operations){const Oe=this.operations[Re];for(Oe.phase=(Le-Oe.startTime)/Oe.duration;Oe.phase>=1||!this._validOp(Oe);)if(!this._nextOp(Oe,Le)){delete this.operations[Re];break}}}_nextOp(Le,Re){return!!Le.queued&&(Le.from=Le.to,Le.to=Le.queued,Le.queued=null,Le.phase=0,Le.startTime=Re,!0)}_validOp(Le){return Le.from.hasData()&&Le.to.hasData()}},Uu={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Tr(Le,Re,Oe){if(0===Re)return 0;const Ue=Re<1&&514===Oe?.25/Re:1;return 6*Math.pow(1.5,22-Le)*Math.max(Re,1)*Ue}function Er(Le,Re){const Oe=1<<Le.z;return!Re&&(0===Le.x||Le.x===Oe-1)||0===Le.y||Le.y===Oe-1}const Cr=Le=>({u_matrix:Le});function Sr(Re,Oe,Ue,qe,Ct){if(Ct>0){const Ot=Le.q.now(),Jt=(Ot-Re.timeAdded)/Ct,_i=Oe?(Ot-Oe.timeAdded)/Ct:-1,xi=Ue.getSource(),vi=qe.coveringZoomLevel({tileSize:xi.tileSize,roundZoom:xi.roundZoom}),bi=!Oe||Math.abs(Oe.tileID.overscaledZ-vi)>Math.abs(Re.tileID.overscaledZ-vi),Pi=bi&&Re.refreshedUponExpiration?1:Le.ap(bi?Jt:1-_i,0,1);return Re.refreshedUponExpiration&&Jt>=1&&(Re.refreshedUponExpiration=!1),Oe?{opacity:1,mix:1-Pi}:{opacity:Pi,mix:0}}return{opacity:1,mix:0}}class Ir extends vt{constructor(Re){const Oe={type:"raster-dem",maxzoom:Re.transform.maxZoom},Ue=new Le.cd(Le.ce(),null),qe=tt("mock-dem",Oe,Ue,Re.style);super("mock-dem",qe,!1),qe.setEventedParent(this),this._sourceLoaded=!0}_loadTile(Le,Re){Le.state="loaded",Re(null)}}class Dr extends vt{constructor(Re){const Oe=tt("proxy",{type:"geojson",maxzoom:Re.transform.maxZoom},new Le.cd(Le.ce(),null),Re.style);super("proxy",Oe,!1),Oe.setEventedParent(this),this.map=this.getSource().map=Re,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(Le,Re,Oe){if(Le.freezeTileCoverage)return;this.transform=Le;const Ue=Le.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((Re,Oe)=>{if(Re[Oe.key]="",!this._tiles[Oe.key]){const Re=new pt(Oe,this._source.tileSize*Oe.overscaleFactor(),Le.tileZoom);Re.state="loaded",this._tiles[Oe.key]=Re}return Re}),{});for(const Le in this._tiles)Le in Ue||(this.freeFBO(Le),this._tiles[Le].unloadVectorData(),delete this._tiles[Le])}freeFBO(Le){const Re=this.proxyCachedFBO[Le];if(void 0!==Re){const Oe=Object.values(Re);this.renderCachePool.push(...Oe),delete this.proxyCachedFBO[Le]}}deallocRenderCache(){this.renderCache.forEach((Le=>Le.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Rr extends Le.aA{constructor(Le,Re,Oe){super(Le.overscaledZ,Le.wrap,Le.canonical.z,Le.canonical.x,Le.canonical.y),this.proxyTileKey=Re,this.projMatrix=Oe}}class Ar extends Le.cE{constructor(Re,Oe){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},Re.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},(()=>{this._style.map.triggerRepaint()})),Re.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},(()=>{this._style.map.triggerRepaint()})),Re.tp.registerButton(["Terrain"],"Invalidate Render Cache",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()})),this.painter=Re,this.terrainTileForTile={},this.prevTerrainTileForTile={};
vendor: 4,169 bytes, line 1
1const[Ue,qe,Ct]=function(Re){const Oe=new Le.a_,Ue=new Le.aO,qe=131;Oe.reserve(17161),Ue.reserve(33800);const Ct=Le.ab/128,Ot=Le.ab+Ct/2,Jt=Ot+Ct;for(let Re=-Ct;Re<Jt;Re+=Ct)for(let Ue=-Ct;Ue<Jt;Ue+=Ct){const qe=Ue<0||Ue>Ot||Re<0||Re>Ot?24575:0,Ct=Le.ap(Math.round(Ue),0,Le.ab),Jt=Le.ap(Math.round(Re),0,Le.ab);Oe.emplaceBack(Ct+qe,Jt)}const l=(Le,Re)=>{const Oe=Re*qe+Le;Ue.emplaceBack(Oe+1,Oe,Oe+qe),Ue.emplaceBack(Oe+qe,Oe+qe+1,Oe+1)};for(let Le=1;Le<129;Le++)for(let Re=1;Re<129;Re++)l(Re,Le);return[0,129].forEach((Le=>{for(let Re=0;Re<130;Re++)l(Re,Le),l(Le,Re)})),[Oe,Ue,32768]}(),Ot=Re.context;this.gridBuffer=Ot.createVertexBuffer(Ue,Le.b0.members),this.gridIndexBuffer=Ot.createIndexBuffer(qe),this.gridSegments=Le.b1.simpleSegment(0,0,Ue.length,qe.length),this.gridNoSkirtSegments=Le.b1.simpleSegment(0,0,Ue.length,Ct),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Dr(Oe.map),this.orthoMatrix=Le.a6.mat4.create(),Le.a6.mat4.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,Le.ab,0,Le.ab,0,1);const Jt=Ot.gl;this._overlapStencilMode=new Mi({func:Jt.GEQUAL,mask:255},0,255,Jt.KEEP,Jt.KEEP,Jt.REPLACE),this._previousZoom=Re.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=Oe,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Ir(Oe.map),this._pendingGroundEffectLayers=[]}set style(Le){Le.on("data",this._onStyleDataEvent.bind(this)),this._style=Le,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(Re,Oe,Ue){if(Re&&Re.terrain){this._style!==Re&&(this.style=Re,this._evaluationZoom=void 0);const qe=Re.terrain.properties,Ct=0===Re.terrain.drapeRenderMode,Ot=Re.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=Le.q.now();const Jt=Re.terrain&&Re.terrain.scope,_i=qe.get("source"),xi=Ct?this._mockSourceCache:Re.getSourceCache(_i,Jt);if(!xi)return void Le.w(`Couldn't find terrain source "${_i}".`);if(this.sourceCache=xi,this._exaggeration=Ot?this.calculateExaggeration(Oe):qe.get("exaggeration"),!Oe.projection.requiresDraping&&Ot&&0===this._exaggeration)return void this._disable();this.enabled=!0;const h=()=>{this.sourceCache.used&&Le.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const Re=this.getScaledDemTileSize();this.sourceCache.update(Oe,Re,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,h(),this._initializing=!0),h(),Oe.updateElevation(!0,Ue),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(Oe),this._emptyDEMTextureDirty=!0,this._previousZoom=Oe.zoom}else this._disable()}calculateExaggeration(Re){const Oe=this._previousCameraAltitude,Ue=Re.getFreeCameraOptions().position.z/Re.pixelsPerMeter*Re.worldSize;this._previousCameraAltitude=Ue;const qe=null!=Oe?Ue-Oe:Number.MAX_VALUE;if(Math.abs(qe)<2)return this._exaggeration;const Ct=Re.zoom,Ot=this._style.terrain;if(!this._previousUpdateTimestamp)return Ot.getExaggeration(Ct);let Jt=Ct-this._previousZoom;const _i=this._previousUpdateTimestamp;let xi=Ct;null!=this._evaluationZoom&&(xi=this._evaluationZoom,Math.abs(Ct-xi)>.5&&(Jt=.5*(Ct-xi+Jt)),Jt*qe<0&&(xi+=Jt)),this._evaluationZoom=xi;const vi=Ot.getExaggeration(xi),bi=vi===Ot.getExaggeration(Math.max(0,xi-.1));if(bi&&Math.abs(vi-this._exaggeration)<.01)return vi;let Pi=Math.min(.1,.00375*(this._updateTimestamp-_i));return(bi||vi<.1||Math.abs(Jt)<1e-4)&&(Pi=Math.min(.2,4*Pi)),Le.aa(this._exaggeration,vi,Pi)}resetTileLookupCache(Le){this._findCoveringTileCache[Le]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(Le){Le.coord&&"source"===Le.dataType?this._clearRenderCacheForTile(Le.sourceCacheId,Le.co
vendor: 4,758 bytes, line 1
1ord):"style"===Le.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const Le in this._style._mergedSourceCaches)this._style._mergedSourceCaches[Le].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((Le=>Le.fb.destroy())),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const Le=2*this.proxySourceCache.getSource().tileSize;return[Le,Le]}set useVertexMorphing(Le){this._useVertexMorphing=Le}updateTileBinding(Re){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const Oe=this.proxySourceCache,Ue=this.painter.transform;this._initializing&&(this._initializing=0===Ue._centerAltitude&&-1===this.getAtPointOrZero(Le.a5.fromLngLat(Ue.center),-1),this._emptyDEMTextureDirty=!this._initializing);const qe=this.proxyCoords=Oe.getIds().map((Le=>{const Re=Oe.getTileByID(Le).tileID;return Re.projMatrix=Ue.calculateProjMatrix(Re.toUnwrapped()),Re}));!function(Re,Oe){const Ue=Oe.transform.pointCoordinate(Oe.transform.getCameraPoint()),qe=new Le.P(Ue.x,Ue.y);Re.sort(((Re,Oe)=>{if(Oe.overscaledZ-Re.overscaledZ)return Oe.overscaledZ-Re.overscaledZ;const Ue=new Le.P(Re.canonical.x+(1<<Re.canonical.z)*Re.wrap,Re.canonical.y),Ct=new Le.P(Oe.canonical.x+(1<<Oe.canonical.z)*Oe.wrap,Oe.canonical.y),Ot=qe.mult(1<<Re.canonical.z);return Ot.x-=.5,Ot.y-=.5,Ot.distSqr(Ue)-Ot.distSqr(Ct)}))}(qe,this.painter);const Ct=this.proxyToSource||{};this.proxyToSource={},qe.forEach((Le=>{this.proxyToSource[Le.key]={}})),this.terrainTileForTile={};const Ot=this._style._mergedSourceCaches;for(const Le in Ot){const Oe=Ot[Le];if(!Oe.used)continue;if(Oe!==this.sourceCache&&this.resetTileLookupCache(Oe.id),this._setupProxiedCoordsForOrtho(Oe,Re[Le],Ct),Oe.usedForTerrain)continue;const Ue=Re[Le];Oe.getSource().reparseOverscaled&&this._assignTerrainTiles(Ue)}this.proxiedCoords[Oe.id]=qe.map((Le=>new Rr(Le,Le.key,this.orthoMatrix))),this._assignTerrainTiles(qe),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(Ct),this.renderingToTexture=!1;const Jt={};this._visibleDemTiles=[];for(const Le of this.proxyCoords){const Re=this.terrainTileForTile[Le.key];if(!Re)continue;const Oe=Re.tileID.key;Oe in Jt||(this._visibleDemTiles.push(Re),Jt[Oe]=Oe)}}_assignTerrainTiles(Le){this._initializing||Le.forEach((Le=>{if(this.terrainTileForTile[Le.key])return;const Re=this._findTileCoveringTileID(Le,this.sourceCache);Re&&(this.terrainTileForTile[Le.key]=Re)}))}_prepareDEMTextures(){const Le=this.painter.context,Re=Le.gl;for(const Oe in this.terrainTileForTile){const Ue=this.terrainTileForTile[Oe],qe=Ue.dem;!qe||Ue.demTexture&&!Ue.needsDEMTextureUpload||(Le.activeTexture.set(Re.TEXTURE1),Mo(this.painter,Ue,qe))}}_prepareDemTileUniforms(Le,Re,Oe,Ue){if(!Re||null==Re.demTexture)return!1;const qe=Le.tileID.canonical,Ct=Math.pow(2,Re.tileID.canonical.z-qe.z),Ot=Ue||"";return Oe[`u_dem_tl${Ot}`]=[qe.x*Ct%1,qe.y*Ct%1],Oe[`u_dem_scale${Ot}`]=Ct,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let Le=0;const Re=this._visibleDemTiles.reduce(((Re,Oe)=>{if(!Oe.dem)return Re;const Ue=Oe.dem.tree.minimums[0];return Ue>0&&Le++,Re+Ue}),0);return Le?Re/Le:0}_updateEmptyDEMTexture(){const Re=this.painter.context,Oe=Re.gl;Re.activeTexture.set(Oe.TEXTURE2);const Ue=this._getLoadedAreaMinimum(),qe=new Le.cF({width:1,height:1},new Float32Array([Ue]));this._emptyDEMTextureDirty=!1;let Ct=this._emptyDEMTexture;return Ct?Ct.update(qe,{premultiply:!1}):Ct=this._emptyDEMTexture=new Le.T(Re,qe,Oe.R32F,{premultiply:!1}),Ct}setupElevationDraw(Re,Oe,Ue){const qe=this.painter.context,Ct=qe.gl,Ot={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};Ot.u_exaggeration=this.exaggeration();let Jt=null,_i=null,xi=1;if(Ue&&Ue.morphing&&this._useVertexMorphing){const Le=Ue.morphing.srcDemTile,Oe=Ue.morphing.dstDemTile;
vendor: 6,736 bytes, line 1
1xi=Ue.morphing.phase,Le&&Oe&&(this._prepareDemTileUniforms(Re,Le,Ot,"_prev")&&(_i=Le),this._prepareDemTileUniforms(Re,Oe,Ot)&&(Jt=Oe))}const h=Le=>Le&&Le.demTexture&&this.painter.linearFloatFilteringSupported()?Ct.LINEAR:Ct.NEAREST;let vi=null;var bi;if(this.enabled?_i&&Jt?(vi=Jt.demTexture,qe.activeTexture.set(Ct.TEXTURE4),_i.demTexture.bind(h(_i),Ct.CLAMP_TO_EDGE),Ot.u_dem_lerp=xi):(Jt=this.terrainTileForTile[Re.tileID.key],vi=this._prepareDemTileUniforms(Re,Jt,Ot)?Jt.demTexture:this.emptyDEMTexture):vi=this.emptyDEMTexture,qe.activeTexture.set(Ct.TEXTURE2),vi&&(Ot.u_dem_size=1===(bi=vi).size[0]?1:bi.size[0]-2,vi.bind(h(Jt),Ct.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(Ue&&Ue.useDepthForOcclusion,Oe,Ot),Ue&&Ue.useMeterToDem&&Jt){const Re=(1<<Jt.tileID.canonical.z)*Le.bD(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;Ot.u_meter_to_dem=Re}if(Ue&&Ue.labelPlaneMatrixInv&&(Ot.u_label_plane_matrix_inv=Ue.labelPlaneMatrixInv),Oe.setTerrainUniformValues(qe,Ot),"globe"===this.painter.transform.projection.name){const Le=this.globeUniformValues(this.painter.transform,Re.tileID.canonical,Ue&&Ue.useDenormalizedUpVectorScale);Oe.setGlobeUniformValues(qe,Le)}}globeUniformValues(Re,Oe,Ue){const qe=Re.projection;return{u_tile_tl_up:qe.upVector(Oe,0,0),u_tile_tr_up:qe.upVector(Oe,Le.ab,0),u_tile_br_up:qe.upVector(Oe,Le.ab,Le.ab),u_tile_bl_up:qe.upVector(Oe,0,Le.ab),u_tile_up_scale:Ue?Le.cG(1):qe.upVectorScale(Oe,Re.center.lat,Re.worldSize).metersToTile}}renderToBackBuffer(Re){const Oe=this.painter,Ue=this.painter.context;0!==Re.length&&(Ue.bindFramebuffer.set(null),Ue.viewport.set([0,0,Oe.width,Oe.height]),Oe.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(Re,Oe,Ue,qe,Ct){if("globe"===Re.transform.projection.name)!function(Re,Oe,Ue,qe,Ct){const Ot=Re.context,Jt=Ot.gl;let _i,xi;const vi=Re.transform,bi=Le.cx(Re,Ot,vi),d=(Le,Oe)=>{if(xi===Oe)return;const Ue=[Uu[Oe],"PROJECTION_GLOBE_VIEW"];bi&&Ue.push("CUSTOM_ANTIALIASING");const qe=Re.isTileAffectedByFog(Le);_i=Re.getOrCreateProgram("globeRaster",{defines:Ue,overrideFog:qe}),xi=Oe},Pi=Re.colorModeForRenderPass(),Hr=new Li(Jt.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D);Nu.update(Ct);const Jr=Le.cy(vi),Ln=[Le.am(vi.center.lng),Le.at(vi.center.lat)],Nn=Re.globeSharedBuffers,Gn=[vi.width*Le.q.devicePixelRatio,vi.height*Le.q.devicePixelRatio],qn=Float32Array.from(vi.globeMatrix),Zn={useDenormalizedUpVectorScale:!0};{const vi=Re.transform,bi=Tr(vi.zoom,Oe.exaggeration(),Oe.sourceCache._source.tileSize);xi=-1;const $n=Jt.TRIANGLES;for(const xi of qe){const qe=Ue.getTile(xi),Xn=Mi.disabled,Yn=Oe.prevTerrainTileForTile[xi.key],lo=Oe.terrainTileForTile[xi.key];yr(Yn,lo)&&Nu.newMorphing(xi.key,Yn,lo,Ct,250),Ot.activeTexture.set(Jt.TEXTURE0),qe.texture&&qe.texture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE);const uo=Nu.getMorphValuesForProxy(xi.key),po=uo?1:0;uo&&Le.C(Zn,{morphing:{srcDemTile:uo.from,dstDemTile:uo.to,phase:Le.cw(uo.phase)}});const fo=Le.cz(xi.canonical),Io=Le.cA(fo.getCenter().lat),is=Le.cB(xi.canonical,fo,Io,vi.worldSize/vi._pixelsPerMercatorPixel),as=Le.b5(Le.cC(xi.canonical)),Is=xr(vi.expandedFarZProjMatrix,qn,Jr,as,Le.a9(vi.zoom),Ln,vi.frustumCorners.TL,vi.frustumCorners.TR,vi.frustumCorners.BR,vi.frustumCorners.BL,vi.globeCenterInViewSpace,vi.globeRadius,Gn,bi,vi._farZ,is);if(d(xi,po),_i&&(Oe.setupElevationDraw(qe,_i,Zn),Re.uploadCommonUniforms(Ot,_i,xi.toUnwrapped()),Nn)){const[Le,Oe,Ue]=Nn.getGridBuffers(Io,0!==bi);_i.draw(Re,$n,Hr,Xn,Pi,Fi.backCCW,Is,"globe_raster",Le,Oe,Ue)}}}if(Nn&&(Re.renderDefaultNorthPole||Re.renderDefaultSouthPole)){const Ct=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];bi&&Ct.push("CUSTOM_ANTIALIASING"),_i=Re.getOrCreateProgram("globeRaster",{defines:Ct});for(const Ct of qe){const{x:qe,y:xi,z:bi}=Ct.canonical,Jr=0===xi,qn=xi===(1<<bi)-1,[$n,Xn,Yn,lo]=Nn.getPoleBuffers(bi,!1);if(lo&&(Jr||qn)){const xi=Ue.getTile(Ct);Ot.activeTexture.set(Jt.TEXTURE0),xi.texture&&xi.texture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE);let Nn=Le.cD(bi,qe,vi);const uo=Le.b5(Le.cC(Ct.canonical)),C=(Le,Oe)=>Le.draw(Re,Jt.TRIANGLES,Hr,Mi.disabled,Pi,Fi.disabled,xr(vi.expandedFarZProjMatrix,Nn,Nn,uo,0,Ln,vi.frustumCorners.TL,vi.frustumCorners.TR,vi.frustumCorners.BR,vi.frustumCorners.BL,vi.globeCenterInViewSpace,vi.globeRadius,Gn,0,vi._farZ),"globe_pole_raster",Oe,Yn,lo);Oe.setupElevationDraw(xi,_i,Zn),Re.uploadCommonUniforms(Ot,_i,Ct.toUnwrapped()),Jr&&Re.renderDefaultNorthPole&&C(_i,$n),qn&&Re.renderDefaultSouthPole&&(Nn=Le.a6.mat4.scale(Le.a6.mat4.create(),Nn,[1,-1,1]),C(_i,Xn))}}}}(Re,Oe,Ue,qe,Ct);else{const Ot=Re.context,Jt=Ot.gl;let _i,xi;const vi=Re.shadowRenderer,bi=Wi(Re,Re.longestCutoffRange),d=Le=>{if(xi===Le)return;const Oe=[];Oe.push(Uu[Le]),bi.shouldRenderCutoff&&Oe.push("RENDER_CUTOFF"),_i=Re.getOrCreateProgram("terrainRaster",{defines:Oe}),xi=Le},Pi=Re.colorModeForRenderPass(),Hr=new Li(Jt.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D);Nu.update(Ct);const Jr=Re.transform,Ln=Tr(Jr.zoom,Oe.exaggeration(),Oe.sourceCache._source.tileSize);let Nn=[0,0,0];if(vi){const Le=Re.style.directionalLight,Oe=Re.style.ambientLight;Le&&Oe&&(Nn=eo(Re.style,Le,Oe))}{xi=-1;const Gn=Jt.TRIANGLES,[qn,Zn]=[Oe.gridIndexBuffer,Oe.gridSegments];for(const xi of qe){const qe=Ue.getTile(xi),$n=Mi.disabled,Xn=Oe.prevTerrainTileForTile[xi.key],Yn=Oe.terrainTileForTile[xi.key];yr(Xn,Yn)&&Nu.newMorphing(xi.key,Xn,Yn,Ct,250),Ot.activeTexture.set(Jt.TEXTURE0),qe.texture&&qe.texture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE);const lo=Nu.getMorphValuesForProxy(xi.key),uo=lo?1:0;let po;lo&&(po={morphing:{srcDemTile:lo.from,dstDemTile:lo.to,phase:Le.cw(lo.phase)}});const fo=vr(xi.projMatrix,Er(xi.canonical,Jr.renderWorldCopies)?Ln/10:Ln,Nn);if(d(uo),!_i)continue;Oe.setupElevationDraw(qe,_i,po);const Io=xi.toUnwrapped();vi&&vi.setupShadows(Io,_i),Re.uploadCommonUniforms(Ot,_i,Io,null,bi),_i.draw(Re,Gn,Hr,$n,Pi,Fi.backCCW,fo,"terrain_raster",Oe.gridBuffer,qn,Zn)}}}}(Oe,this,this.proxySourceCache,Re,this._updateTimestamp),this.renderingToTexture=!0,Oe.gpuTimingDeferredRenderEnd(),Re.splice(0,Re.length))}renderBatch(Re){if(0===this._drapedRenderBatches.length)return Re+1;this.renderingToTexture=!0;const Oe=this.painter,Ue=this.painter.context,qe=this.proxySourceCache,Ct=this.proxiedCoords[qe.id],Ot=this._drapedRenderBatches.shift(),Jt=Oe.style.order,_i=[];let xi=0;for(const vi of Ct){const Ct=qe.getTileByID(vi.proxyTileKey),bi=qe.proxyCachedFBO[vi.key]?qe.proxyCachedFBO[vi.key][Re]:void 0,Pi=void 0!==bi?qe.renderCache[bi]:this.pool[xi++],Hr=void 0!==bi;if(Ct.texture=Pi.tex,Hr&&!Pi.dirty){_i.push(Ct.tileID);continue}let Jr;Ue.bindFramebuffer.set(Pi.fb.framebuffer),this.renderedToTile=!1,Pi.dirty&&(Ue.clear({color:Le.bz.transparent,stencil:0}),Pi.dirty=!1);for(let Le=Ot.start;Le<=Ot.end;
1++Le){const Re=Oe.style._mergedLayers[Jt[Le]];if(Re.isHidden(Oe.transform.zoom))continue;const qe=Oe.style.getLayerSourceCache(Re),Ct=qe?this.proxyToSource[vi.key][qe.id]:[vi];if(!Ct)continue;const Ot=Ct;Ue.viewport.set([0,0,Pi.fb.width,Pi.fb.height]),Jr!==(qe?qe.id:null)&&(this._setupStencil(Pi,Ct,Re,qe),Jr=qe?qe.id:null),Oe.renderLayer(Oe,qe,Re,Ot)}if(0===this._drapedRenderBatches.length)for(const Le of this._pendingGroundEffectLayers){const Re=Oe.style._mergedLayers[Jt[Le]];if(Re.isHidden(Oe.transform.zoom))continue;const qe=Oe.style.getLayerSourceCache(Re),Ct=qe?this.proxyToSource[vi.key][qe.id]:[vi];if(!Ct)continue;const Ot=Ct;Ue.viewport.set([0,0,Pi.fb.width,Pi.fb.height]),Jr!==(qe?qe.id:null)&&(this._setupStencil(Pi,Ct,Re,qe),Jr=qe?qe.id:null),Oe.renderLayer(Oe,qe,Re,Ot)}this.renderedToTile?(Pi.dirty=!0,_i.push(Ct.tileID)):Hr||--xi,5===xi&&(xi=0,this.renderToBackBuffer(_i))}return this.renderToBackBuffer(_i),this.renderingToTexture=!1,Ue.bindFramebuffer.set(null),Ue.viewport.set([0,0,Oe.width,Oe.height]),Ot.end+1}postRender(){}isLayerOrderingCorrect(Le){const Re=Le.order.length;let Oe=-1,Ue=Re;for(let qe=0;qe<Re;++qe)this._style.isLayerDraped(Le._mergedLayers[Le.order[qe]])?Oe=Math.max(Oe,qe):Ue=Math.min(Ue,qe);return Ue>Oe}getMinElevationBelowMSL(){let Le=0;return this._visibleDemTiles.filter((Le=>Le.dem)).forEach((Re=>{Le=Math.min(Le,Re.dem.tree.minimums[0])})),0===Le?Le:(Le-30)*this._exaggeration}raycast(Le,Re,Oe){if(!this._visibleDemTiles)return null;const Ue=this._visibleDemTiles.filter((Le=>Le.dem)).map((Ue=>{const qe=Ue.tileID,Ct=1<<qe.overscaledZ,{x:Ot,y:Jt}=qe.canonical,_i=Ot/Ct,xi=(Ot+1)/Ct,vi=Jt/Ct,bi=(Jt+1)/Ct;return{minx:_i,miny:vi,maxx:xi,maxy:bi,t:Ue.dem.tree.raycastRoot(_i,vi,xi,bi,Le,Re,Oe),tile:Ue}}));Ue.sort(((Le,Re)=>(null!==Le.t?Le.t:Number.MAX_VALUE)-(null!==Re.t?Re.t:Number.MAX_VALUE)));for(const qe of Ue){if(null==qe.t)return null;const Ue=qe.tile.dem.tree.raycast(qe.minx,qe.miny,qe.maxx,qe.maxy,Le,Re,Oe);if(null!=Ue)return Ue}return null}_createFBO(){const Re=this.painter.context,Oe=Re.gl,Ue=this.drapeBufferSize;Re.activeTexture.set(Oe.TEXTURE0);const qe=new Le.T(Re,{width:Ue[0],height:Ue[1],data:null},Oe.RGBA8);qe.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE);const Ct=Re.createFramebuffer(Ue[0],Ue[1],!0,null);return Ct.colorAttachment.set(qe.texture),Ct.depthAttachment=new gr(Re,Ct.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=Re.createRenderbuffer(Re.gl.DEPTH_STENCIL,Ue[0],Ue[1]),this._stencilRef=0,Ct.depthAttachment.set(this._sharedDepthStencil),Re.clear({stencil:0})):Ct.depthAttachment.set(this._sharedDepthStencil),Re.extTextureFilterAnisotropic&&Oe.texParameterf(Oe.TEXTURE_2D,Re.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Re.extTextureFilterAnisotropicMax),{fb:Ct,tex:qe,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache)return!0;if(this._style.hasLightTransitions())return!0;for(const Le in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[Le].hasTransition())return!0;return this._style.order.some((Le=>{const Re=this._style._mergedLayers[Le],Oe=Re.isHidden(this.painter.transform.zoom);return"hillshade"===Re.type||"custom"===Re.type?!Oe&&Re.shouldRedrape():!Oe&&Re.hasTransition()}))}_clearLineLayersFromRenderCache(){let Re=!1;for(const Le of this._style.getSources())if(Le instanceof Ke){Re=!0;break}if(!Re)return;const Oe={};for(let Re=0;Re<this._style.order.length;++Re){const Ue=this._style._mergedLayers[this._style.order[Re]],qe=this._style.getLayerSourceCache(Ue);if(qe&&!Oe[qe.id]&&!Ue.isHidden(this.painter.transform.zoom)&&"line"===Ue.type&&Ue.widthExpression()instanceof Le.a4){Oe[qe.id]=!0;for(const Le of this.proxyCoords){const Re=this.proxyToSource[Le.key][qe.id];
vendor: 5,895 bytes, line 1
1if(Re)for(const Le of Re)this._clearRenderCacheForTile(qe.id,Le)}}}}_clearRasterLayersFromRenderCache(){let Le=!1;for(const Re in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[Re]._source instanceof Je){Le=!0;break}if(!Le)return;const Re={};for(let Le=0;Le<this._style.order.length;++Le){const Oe=this._style._mergedLayers[this._style.order[Le]],Ue=this._style.getLayerSourceCache(Oe);if(!Ue||Re[Ue.id])continue;if(Oe.isHidden(this.painter.transform.zoom)||"raster"!==Oe.type)continue;const qe=Oe.paint.get("raster-fade-duration");for(const Le of this.proxyCoords){const Re=this.proxyToSource[Le.key][Ue.id];if(Re)for(const Le of Re){const Re=Sr(Ue.getTile(Le),Ue.findLoadedParent(Le,0),Ue,this.painter.transform,qe);(1!==Re.opacity||0!==Re.mix)&&this._clearRenderCacheForTile(Ue.id,Le)}}}}_setupDrapedRenderBatches(){const Re=this._style.order,Oe=Re.length;if(0===Oe)return;const Ue=[];this._pendingGroundEffectLayers=[];let qe,Ct=0,Ot=this._style._mergedLayers[Re[Ct]];for(;!this._style.isLayerDraped(Ot)&&Ot.isHidden(this.painter.transform.zoom)&&++Ct<Oe;)Ot=this._style._mergedLayers[Re[Ct]];for(;Ct<Oe;++Ct){const Le=this._style._mergedLayers[Re[Ct]];Le.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(Le)?void 0===qe&&(qe=Ct):("fill-extrusion"===Le.type&&this._pendingGroundEffectLayers.push(Ct),void 0!==qe&&(Ue.push({start:qe,end:Ct-1}),qe=void 0)))}if(void 0!==qe&&Ue.push({start:qe,end:Ct-1}),0!==Ue.length){const Re=Ue[Ue.length-1];this._pendingGroundEffectLayers.every((Le=>Le>Re.end))||Le.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=Ue}_setupRenderCache(Le){const Re=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,Re.renderCache.length>Re.renderCachePool.length){const Le=Object.values(Re.proxyCachedFBO);Re.proxyCachedFBO={};for(let Oe=0;Oe<Le.length;++Oe){const Ue=Object.values(Le[Oe]);Re.renderCachePool.push(...Ue)}}return}this._clearRasterLayersFromRenderCache();const Oe=this.proxyCoords,Ue=this._tilesDirty;for(let qe=Oe.length-1;qe>=0;qe--){const Ct=Oe[qe];if(Re.getTileByID(Ct.key),void 0!==Re.proxyCachedFBO[Ct.key]){const Oe=Le[Ct.key],qe=this.proxyToSource[Ct.key];let Ot=0;for(const Le in qe){const Re=qe[Le],Ct=Oe[Le];if(!Ct||Ct.length!==Re.length||Re.some(((Re,Oe)=>Re!==Ct[Oe]||Ue[Le]&&Ue[Le].hasOwnProperty(Re.key)))){Ot=-1;break}++Ot}for(const Le in Re.proxyCachedFBO[Ct.key])Re.renderCache[Re.proxyCachedFBO[Ct.key][Le]].dirty=Ot<0||Ot!==Object.values(Oe).length}}const qe=[...this._drapedRenderBatches];qe.sort(((Le,Re)=>Re.end-Re.start-(Le.end-Le.start)));for(const Le of qe)for(const Ue of Oe){if(Re.proxyCachedFBO[Ue.key])continue;let Oe=Re.renderCachePool.pop();void 0===Oe&&Re.renderCache.length<50&&(Oe=Re.renderCache.length,Re.renderCache.push(this._createFBO())),void 0!==Oe&&(Re.proxyCachedFBO[Ue.key]={},Re.proxyCachedFBO[Ue.key][Le.start]=Oe,Re.renderCache[Oe].dirty=!0)}this._tilesDirty={}}_setupStencil(Le,Re,Oe,Ue){if(!Ue||!this._sourceTilesOverlap[Ue.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const qe=this.painter.context,Ct=qe.gl;if(Re.length<=1)return void(this._overlapStencilType=!1);let Ot;if(Oe.isTileClipped())Ot=Re.length,this._overlapStencilMode.test={func:Ct.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(Re[0].overscaledZ>Re[Re.length-1].overscaledZ))return void(this._overlapStencilType=!1);Ot=1,this._overlapStencilMode.test={func:Ct.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+Ot>255&&(qe.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=Ot,this._overlapStencilMode.ref=this._stencilRef,Oe.isTileClipped()&&this._renderTileClippingMasks(Re,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(Le){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[Le.key]),this._overlapStencilMode):Mi.disabled}_renderTileClippingMasks(Le,Re){const Oe=this.painter,Ue=this.painter.context,qe=Ue.gl;Oe._tileClippingMaskIDs={},Ue.setColorMode(Ai.disabled),Ue.setDepthMode(Li.disabled);const Ct=Oe.getOrCreateProgram("clippingMask");for(const Ue of Le){const Le=Oe._tileClippingMaskIDs[Ue.key]=--Re;Ct.draw(Oe,qe.TRIANGLES,Li.disabled,new Mi({func:qe.ALWAYS,mask:0},Le,255,qe.KEEP,qe.KEEP,qe.REPLACE),Ai.disabled,Fi.disabled,Cr(Ue.projMatrix),"$clipping",Oe.tileExtentBuffer,Oe.quadTriangleIndexBuffer,Oe.tileExtentSegments)}}pointCoordinate(Re){const Oe=this.painter.transform;if(Re.x<0||Re.x>Oe.width||Re.y<0||Re.y>Oe.height)return null;const Ue=[Re.x,Re.y,1,1];Le.a6.vec4.transformMat4(Ue,Ue,Oe.pixelMatrixInverse),Le.a6.vec4.scale(Ue,Ue,1/Ue[3]),Ue[0]/=Oe.worldSize,Ue[1]/=Oe.worldSize;const qe=Oe._camera.position,Ct=Le.bD(1,Oe.center.lat),Ot=[qe[0],qe[1],qe[2]/Ct,0],Jt=Le.a6.vec3.subtract([],Ue.slice(0,3),Ot);Le.a6.vec3.normalize(Jt,Jt);const _i=this.raycast(Ot,Jt,this._exaggeration);return null!==_i&&_i?(Le.a6.vec3.scaleAndAdd(Ot,Ot,Jt,_i),Ot[3]=Ot[2],Ot[2]*=Ct,Ot):null}_setupProxiedCoordsForOrtho(Re,Oe,Ue){if(Re.getSource()instanceof Le.aD)return this._setupProxiedCoordsForImageSource(Re,Oe,Ue);this._findCoveringTileCache[Re.id]=this._findCoveringTileCache[Re.id]||{};const qe=this.proxiedCoords[Re.id]=[],Ct=this.proxyCoords;for(let Le=0;Le<Ct.length;Le++){const Oe=Ct[Le],Ot=this._findTileCoveringTileID(Oe,Re);if(Ot){const Le=this._createProxiedId(Oe,Ot,Ue[Oe.key]&&Ue[Oe.key][Re.id]);qe.push(Le),this.proxyToSource[Oe.key][Re.id]=[Le]}}let Ot=!1;const Jt=new Set;for(let Le=0;Le<Oe.length;Le++){const Ct=Re.getTile(Oe[Le]);if(!Ct||!Ct.hasData())continue;const _i=this._findTileCoveringTileID(Ct.tileID,this.proxySourceCache);
1if(_i&&_i.tileID.canonical.z!==Ct.tileID.canonical.z){const Le=this.proxyToSource[_i.tileID.key][Re.id],Oe=this._createProxiedId(_i.tileID,Ct,Ue[_i.tileID.key]&&Ue[_i.tileID.key][Re.id]);Le?Le.splice(Le.length-1,0,Oe):this.proxyToSource[_i.tileID.key][Re.id]=[Oe];const xi=this.proxyToSource[_i.tileID.key][Re.id];Jt.has(xi)||Jt.add(xi),qe.push(Oe),Ot=!0}}if(this._sourceTilesOverlap[Re.id]=Ot,Ot&&this._debugParams.sortTilesHiZFirst)for(const Le of Jt)Le.sort(((Le,Re)=>Re.overscaledZ-Le.overscaledZ))}_setupProxiedCoordsForImageSource(Re,Oe,Ue){if(!Re.getSource().loaded())return;const qe=this.proxiedCoords[Re.id]=[],Ct=this.proxyCoords,Ot=Re.getSource(),Jt=Ot.tileID;if(!Jt)return;const _i=new Le.P(Jt.x,Jt.y)._div(1<<Jt.z),xi=Ot.coordinates.map(Le.a5.fromLngLat).reduce(((Le,Re)=>(Le.min.x=Math.min(Le.min.x,Re.x-_i.x),Le.min.y=Math.min(Le.min.y,Re.y-_i.y),Le.max.x=Math.max(Le.max.x,Re.x-_i.x),Le.max.y=Math.max(Le.max.y,Re.y-_i.y),Le)),{min:new Le.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new Le.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),h=(Re,Oe)=>{const Ue=Re.wrap+Re.canonical.x/(1<<Re.canonical.z),qe=Re.canonical.y/(1<<Re.canonical.z),Ct=Le.ab/(1<<Re.canonical.z),Ot=Oe.wrap+Oe.canonical.x/(1<<Oe.canonical.z),Jt=Oe.canonical.y/(1<<Oe.canonical.z);return Ue+Ct<Ot+xi.min.x||Ue>Ot+xi.max.x||qe+Ct<Jt+xi.min.y||qe>Jt+xi.max.y};for(let Le=0;Le<Ct.length;Le++){const Ot=Ct[Le];for(let Le=0;Le<Oe.length;Le++){const Ct=Re.getTile(Oe[Le]);if(!Ct||!Ct.hasData())continue;if(h(Ot,Ct.tileID))continue;const Jt=this._createProxiedId(Ot,Ct,Ue[Ot.key]&&Ue[Ot.key][Re.id]),_i=this.proxyToSource[Ot.key][Re.id];_i?_i.push(Jt):this.proxyToSource[Ot.key][Re.id]=[Jt],qe.push(Jt)}}}_createProxiedId(Re,Oe,Ue){let qe=this.orthoMatrix;if(Ue){const Le=Ue.find((Le=>Le.key===Oe.tileID.key));if(Le)return Le}if(Oe.tileID.key!==Re.key){const Ue=Re.canonical.z-Oe.tileID.canonical.z;let Ct,Ot,Jt;qe=Le.a6.mat4.create();const _i=Oe.tileID.wrap-Re.wrap<<Re.overscaledZ;Ue>0?(Ct=Le.ab>>Ue,Ot=Ct*((Oe.tileID.canonical.x<<Ue)-Re.canonical.x+_i),Jt=Ct*((Oe.tileID.canonical.y<<Ue)-Re.canonical.y)):(Ct=Le.ab<<-Ue,Ot=Le.ab*(Oe.tileID.canonical.x-(Re.canonical.x+_i<<-Ue)),Jt=Le.ab*(Oe.tileID.canonical.y-(Re.canonical.y<<-Ue))),Le.a6.mat4.ortho(qe,0,Ct,0,Ct,0,1),Le.a6.mat4.translate(qe,qe,[Ot,Jt,0])}return new Rr(Oe.tileID,Re.key,qe)}_findTileCoveringTileID(Re,Oe){let Ue=Oe.getTile(Re);if(Ue&&Ue.hasData())return Ue;const qe=this._findCoveringTileCache[Oe.id],Ct=qe[Re.key];if(Ue=Ct?Oe.getTileByID(Ct):null,Ue&&Ue.hasData()||null===Ct)return Ue;let Ot=Ue?Ue.tileID:Re,Jt=Ot.overscaledZ;const _i=Oe.getSource().minzoom,xi=[];if(!Ct){const qe=Oe.getSource().maxzoom;if(Re.canonical.z>=qe){const Ue=Re.canonical.z-qe;Oe.getSource().reparseOverscaled?(Jt=Math.max(Re.canonical.z+2,Oe.transform.tileZoom),Ot=new Le.aA(Jt,Re.wrap,qe,Re.canonical.x>>Ue,Re.canonical.y>>Ue)):0!==Ue&&(Jt=qe,Ot=new Le.aA(Jt,Re.wrap,qe,Re.canonical.x>>Ue,Re.canonical.y>>Ue))}Ot.key!==Re.key&&(xi.push(Ot.key),Ue=Oe.getTile(Ot))}const h=Le=>{xi.forEach((Re=>{qe[Re]=Le})),xi.length=0};for(Jt-=1;Jt>=_i&&(!Ue||!Ue.hasData());Jt--){Ue&&h(Ue.tileID.key);const Le=Ot.calculateScaledKey(Jt);if(Ue=Oe.getTileByID(Le),Ue&&Ue.hasData())break;const Re=qe[Le];if(null===Re)break;void 0===Re?xi.push(Le):Ue=Oe.getTileByID(Re)}return h(Ue?Ue.tileID.key:null),Ue&&Ue.hasData()?Ue:null}findDEMTileFor(Le){return this.enabled?this._findTileCoveringTileID(Le,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(Le,Re){let Oe=this._tilesDirty[Le];Oe||(Oe=this._tilesDirty[Le]={}),Oe[Re.key]=!0}}function Lr(Re,Oe,Ue){const qe=function(Re,Oe,Ue){const qe=Le.a6.vec3.dot(Oe,Re),Ct=Le.a6.vec3.dot(Ue,[.2126,.7152,.0722]),a=(Le,Re,Oe)=>(1-Oe)*Le+Oe*Re,Ot=a(1-.3*Math.min(Ct,1),1,Math.min(qe+1,1));return a(.92,1,Math.asin(Le.ap(Oe[2],-1,1))/Math.PI+.5)*Ot}(Re,[0,0,1],Oe),Ct=[0,0,0];Le.a6.vec3.scale(Ct,Ue.slice(0,3),qe);const Ot=[0,0,0];Le.a6.vec3.scale(Ot,Oe.slice(0,3),Re[2]);const Jt=[0,0,0];return Le.a6.vec3.add(Jt,Ct,Ot),Le.cb(Jt)}const ju=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Hu=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbol"];class zr{static cacheKey(Le,Re,Oe,Ue){let qe=`${Re}${Ue?Ue.cacheKey:""}`;for(const Re of Oe)Le.usedDefines.includes(Re)&&(qe+=`/${Re}`);return qe}constructor(Re,Oe,Ue,qe,Ct,Ot){const Jt=Re.gl;this.program=Jt.createProgram(),this.configuration=qe,this.name=Oe,this.fixedDefines=[...Ot];const _i=qe?qe.getBinderAttributes():[],xi=(Ue.staticAttributes||[]).concat(_i);let vi=qe?qe.defines():[];vi=vi.concat(Ot.map((Le=>`#define ${Le}`)));const bi="#version 300 es\n";let Pi=bi+vi.concat("precision mediump float;",xu,lu.fragmentSource).join("\n");for(const Le of Ue.fragmentIncludes)Pi+=`\n${su[Le]}`;Pi+=`\n${Ue.fragmentSource}`;let Hr=bi+vi.concat("precision highp float;",xu,lu.vertexSource).join("\n");for(const Le of Ue.vertexIncludes)Hr+=`\n${su[Le]}`;Hr+=`\n${Ue.vertexSource}`;const Jr=Jt.createShader(Jt.FRAGMENT_SHADER);if(Jt.isContextLost())return void(this.failedToCreate=!0);Jt.shaderSource(Jr,Pi),Jt.compileShader(Jr),Jt.attachShader(this.program,Jr);const Ln=Jt.createShader(Jt.VERTEX_SHADER);if(Jt.isContextLost())this.failedToCreate=!0;else{Jt.shaderSource(Ln,Hr),Jt.compileShader(Ln),Jt.attachShader(this.program,Ln),this.attributes={},this.numAttributes=xi.length;for(let Le=0;Le<this.numAttributes;Le++)if(xi[Le]){const Re=xi[Le].startsWith("a_")?xi[Le]:`a_${xi[Le]}`;Jt.bindAttribLocation(this.program,Le,Re),this.attributes[Re]=Le}Jt.linkProgram(this.program),Jt.deleteShader(Ln),Jt.deleteShader(Jr),this.fixedUniforms=Ct(Re),this.binderUniforms=qe?qe.getUniforms(Re):[],(Ot.includes("TERRAIN")||-1!==Oe.indexOf("symbol")||-1!==Oe.indexOf("circle"))&&(this.terrainUniforms=(Re=>({u_dem:new Le.bJ(Re),u_dem_prev:new Le.bJ(Re),u_dem_tl:new Le.bG(Re),u_dem_scale:new Le.bI(Re),u_dem_tl_prev:new Le.bG(Re),u_dem_scale_prev:new Le.bI(Re),u_dem_size:new Le.bI(Re),u_dem_lerp:new Le.bI(Re),u_exaggeration:new Le.bI(Re),u_depth:new Le.bJ(Re),u_depth_size_inv:new Le.bG(Re),u_depth_range_unpack:new Le.bG(Re),u_occluder_half_size:new Le.bI(Re),u_occlusion_depth_offset:new Le.bI(Re),u_meter_to_dem:new Le.bI(Re),u_label_plane_matrix_inv:new Le.bF(Re)}))(Re)),Ot.includes("GLOBE")&&(this.globeUniforms=(Re=>({u_tile_tl_up:new Le.bH(Re),u_tile_tr_up:new Le.bH(Re),u_tile_br_up:new Le.bH(Re),u_tile_bl_up:new Le.bH(Re),u_tile_up_scale:new Le.bI(Re)}))(Re)),Ot.includes("FOG")&&(this.fogUniforms=(Re=>({u_fog_matrix:new Le.bF(Re),u_fog_range:new Le.bG(Re),u_fog_color:new Le.c6(Re),u_fog_horizon_blend:new Le.bI(Re),u_fog_vertical_limit:new Le.bG(Re),u_fog_temporal_offset:new Le.bI(Re),u_frustum_tl:new Le.bH(Re),u_frustum_tr:new Le.bH(Re),u_frustum_br:new Le.bH(Re),u_frustum_bl:new Le.bH(Re),u_globe_pos:new Le.bH(Re),u_globe_radius:new Le.bI(Re),u_globe_transition:new Le.bI(Re),u_is_globe:new Le.bJ(Re),u_viewport:new Le.bG(Re)}))(Re)),Ot.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(Re=>({u_cutoff_params:new Le.c6(Re)}))(Re)),Ot.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(Re=>({u_lighting_ambient_color:new Le.bH(Re),u_lighting_directional_dir:new Le.bH(Re),u_lighting_directional_color:new Le.bH(Re),u_ground_radiance:new Le.bH(Re)}))(Re)),Ot.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(Re=>({u_light_matrix_0:new Le.bF(Re),u_light_matrix_1:new Le.bF(Re),u_fade_range:new Le.bG(Re),u_shadow_normal_offset:new Le.bH(Re),u_shadow_intensity:new Le.bI(Re),u_shadow_texel_size:new Le.bI(Re),u_shadow_map_resolution:new Le.bI(Re),u_shadow_direction:new Le.bH(Re),u_shadow_bias:new Le.bH(Re),u_shadowmap_0:new Le.bJ(Re),u_shadowmap_1:new Le.bJ(Re)}))(Re))}}setTerrainUniformValues(Le,Re){if(!this.terrainUniforms)return;const Oe=this.terrainUniforms;if(!this.failedToCreate){Le.program.set(this.program);for(const Le in Re)Oe[Le]&&Oe[Le].set(this.program,Le,Re[Le])}}setGlobeUniformValues(Le,Re){if(!this.globeUniforms)return;const Oe=this.globeUniforms;if(!this.failedToCreate){Le.program.set(this.program);for(const Le in Re)Oe[Le]&&Oe[Le].set(this.program,Le,Re[Le])}}setFogUniformValues(Le,Re){if(!this.fogUniforms)return;const Oe=this.fogUniforms;if(!this.failedToCreate){Le.program.set(this.program);for(const Le in Re)Oe[Le].set(this.program,Le,Re[Le])}}setCutoffUniformValues(Le,Re){if(!this.cutoffUniforms)return;const Oe=this.cutoffUniforms;if(!this.failedToCreate){Le.program.set(this.program);for(const Le in Re)Oe[Le].set(this.program,Le,Re[Le])}}setLightsUniformValues(Le,Re){if(!this.lightsUniforms)return;const Oe=this.lightsUniforms;if(!this.failedToCreate){Le.program.set(this.program);for(const Le in Re)Oe[Le].set(this.program,Le,Re[Le])}}setShadowUniformValues(Le,Re){if(this.failedToCreate||!this.shadowUniforms)return;const Oe=this.shadowUniforms;Le.program.set(this.program);for(const Le in Re)Oe[Le].set(this.program,Le,Re[Le])}_drawDebugWireframe(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi){const bi=Re.options.wireframe;if(!1===bi.terrain&&!1===bi.layers2D&&!1===bi.layers3D)return;const Pi=Re.context;if(!(()=>!(!bi.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!bi.layers2D||Re._terrain&&Re._terrain.renderingToTexture||!ju.includes(this.name))||!(!bi.layers3D||!Hu.includes(this.name)))())return;
1const Hr=Pi.gl,Jr=Re.wireframeDebugCache.getLinesFromTrianglesBuffer(Re.frameCounter,Ct,Pi);if(!Jr)return;const Ln=[...this.fixedDefines];Ln.push("DEBUG_WIREFRAME");const Nn=Re.getOrCreateProgram(this.name,{config:this.configuration,defines:Ln});Pi.program.set(Nn.program);const g=(Le,Re,Oe)=>{if(Re[Le]&&Oe[Le])for(const Ue in Re[Le])Oe[Le][Ue]&&Oe[Le][Ue].set(Oe.program,Ue,Re[Le][Ue].current)};xi&&xi.setUniforms(Nn.program,Pi,Nn.binderUniforms,Jt,{zoom:_i}),g("fixedUniforms",this,Nn),g("terrainUniforms",this,Nn),g("globeUniforms",this,Nn),g("fogUniforms",this,Nn),g("lightsUniforms",this,Nn),g("shadowUniforms",this,Nn),Jr.bind(),Pi.setColorMode(new Ai([Hr.ONE,Hr.ONE_MINUS_SRC_ALPHA,Hr.ZERO,Hr.ONE],Le.bz.transparent,[!0,!0,!0,!1])),Pi.setDepthMode(new Li(Oe.func===Hr.LESS?Hr.LEQUAL:Oe.func,Li.ReadOnly,Oe.range)),Pi.setStencilMode(Mi.disabled);const Gn=3*Ot.primitiveLength*2,qn=3*Ot.primitiveOffset*2*2;vi&&vi>1?Hr.drawElementsInstanced(Hr.LINES,Gn,Hr.UNSIGNED_SHORT,qn,vi):Hr.drawElements(Hr.LINES,Gn,Hr.UNSIGNED_SHORT,qn),Ct.bind(),Pi.program.set(this.program),Pi.setDepthMode(Oe),Pi.setStencilMode(Ue),Pi.setColorMode(qe)}draw(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln){const Nn=Le.context,Gn=Nn.gl;if(this.failedToCreate)return;Nn.program.set(this.program),Nn.setDepthMode(Oe),Nn.setStencilMode(Ue),Nn.setColorMode(qe),Nn.setCullFace(Ct);for(const Le of Object.keys(this.fixedUniforms))this.fixedUniforms[Le].set(this.program,Le,Ot[Le]);Hr&&Hr.setUniforms(this.program,Nn,this.binderUniforms,bi,{zoom:Pi});const qn={[Gn.POINTS]:1,[Gn.LINES]:2,[Gn.TRIANGLES]:3,[Gn.LINE_STRIP]:1}[Re],Zn=Ln&&Ln>0?1:void 0;for(const Ct of vi.get()){const Ot=Ct.vaos||(Ct.vaos={});(Ot[Jt]||(Ot[Jt]=new Ao)).bind(Nn,this,_i,Hr?Hr.getPaintVertexBuffers():[],xi,Ct.vertexOffset,Jr||[],Zn),Ln&&Ln>1?Gn.drawElementsInstanced(Re,Ct.primitiveLength*qn,Gn.UNSIGNED_SHORT,Ct.primitiveOffset*qn*2,Ln):xi?Gn.drawElements(Re,Ct.primitiveLength*qn,Gn.UNSIGNED_SHORT,Ct.primitiveOffset*qn*2):Gn.drawArrays(Re,Ct.vertexOffset,Ct.vertexLength),Re===Gn.TRIANGLES&&xi&&this._drawDebugWireframe(Le,Oe,Ue,qe,xi,Ct,bi,Pi,Hr,Ln)}}}function Or(Re,Oe){const Ue=Math.pow(2,Oe.tileID.overscaledZ),qe=Oe.tileSize*Math.pow(2,Re.transform.tileZoom)/Ue,Ct=qe*(Oe.tileID.canonical.x+Oe.tileID.wrap*Ue),Ot=qe*Oe.tileID.canonical.y;return{u_image:0,u_texsize:Oe.imageAtlasTexture?Oe.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/Le.ak(Oe,1,Re.transform.tileZoom),u_pixel_coord_upper:[Ct>>16,Ot>>16],u_pixel_coord_lower:[65535&Ct,65535&Ot]}}const Xu=Le.a6.mat4.create(),kr=(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn)=>{const Gn=Oe.style.light,qn=Gn.properties.get("position"),Zn=[qn.x,qn.y,qn.z],$n=Le.a6.mat3.create();"viewport"===Gn.properties.get("anchor")&&(Le.a6.mat3.fromRotation($n,-Oe.transform.angle),Le.a6.vec3.transformMat3(Zn,Zn,$n));const Xn=Gn.properties.get("color"),Yn=Oe.transform,lo={u_matrix:Re,u_lightpos:Zn,u_lightintensity:Gn.properties.get("intensity"),u_lightcolor:[Xn.r,Xn.g,Xn.b],u_vertical_gradient:+Ue,u_opacity:qe,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Xu,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:Ct,u_edge_radius:Ot,u_width_scale:Jt,u_flood_light_color:Hr,u_vertical_scale:Jr,u_flood_light_intensity:Ln,u_ground_shadow_factor:Nn};return"globe"===Yn.projection.name&&(lo.u_tile_id=[_i.canonical.x,_i.canonical.y,1<<_i.canonical.z],lo.u_zoom_transition=vi,lo.u_inv_rot_matrix=Pi,lo.u_merc_center=bi,lo.u_up_dir=Yn.projection.upVector(new Le.bP(0,0,0),bi[0]*Le.ab,bi[1]*Le.ab),lo.u_height_lift=xi),lo},Br=(Le,Re,Oe,Ue)=>({u_matrix:Le,u_edge_radius:Re,u_width_scale:Oe,u_vertical_scale:Ue}),Nr=(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln)=>{const Nn=kr(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,vi,bi,Pi,Hr,Jr,Ln,1,[0,0,0]),Gn={u_height_factor:-Math.pow(2,_i.overscaledZ)/xi.tileSize/8};return Le.l(Nn,Or(Oe,xi),Gn)},Ur=(Le,Re)=>({u_matrix:Le,u_emissive_strength:Re}),Gr=(Re,Oe,Ue,qe)=>Le.l(Ur(Re,Oe),Or(Ue,qe)),jr=(Le,Re,Oe)=>({u_matrix:Le,u_world:Oe,u_emissive_strength:Re}),Vr=(Re,Oe,Ue,qe,Ct)=>Le.l(Gr(Re,Oe,Ue,qe),{u_world:Ct}),qr=(Re,Oe,Ue,qe)=>{const Ct=Le.ab/Ue.tileSize;return{u_matrix:Re,u_camera_to_center_distance:Oe.getCameraToCenterDistance(qe),u_extrude_scale:[Oe.pixelsToGLUnits[0]/Ct,Oe.pixelsToGLUnits[1]/Ct]}},Zr=(Le,Re,Oe=1)=>({u_matrix:Le,u_color:Re.toRenderColor(null),u_overlay:0,u_overlay_scale:Oe}),Yu=Le.a6.mat4.create(),Wr=(Re,Oe,Ue,qe,Ct,Ot,Jt)=>{const _i=Re.transform,xi="globe"===_i.projection.name,vi=xi?Le.cI(_i.zoom,Oe.canonical)*_i._pixelsPerMercatorPixel:Le.ak(Ue,1,Ot),bi={u_matrix:Oe.projMatrix,u_extrude_scale:vi,u_intensity:Jt,u_inv_rot_matrix:Yu,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(xi){bi.u_inv_rot_matrix=qe,bi.u_merc_center=Ct,bi.u_tile_id=[Oe.canonical.x,Oe.canonical.y,1<<Oe.canonical.z],bi.u_zoom_transition=Le.a9(_i.zoom);const Re=Ct[0]*Le.ab,Ue=Ct[1]*Le.ab;bi.u_up_dir=_i.projection.upVector(new Le.bP(0,0,0),Re,Ue)}return bi};function $r(Le,[Re,Oe,Ue,qe],[Ct,Ot]){if(Ct===Ot)return[0,0,0,0];const Jt=255*(Le-1)/(Le*(Ot-Ct));return[Re*Jt,Oe*Jt,Ue*Jt,qe*Jt]}
vendor: 4,207 bytes, line 1
1function Xr(Le,Re,[Oe,Ue]){return Oe===Ue?0:.5/Le+(Re-Oe)*(Le-1)/(Le*(Ue-Oe))}const Yr=(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn)=>({u_matrix:Re,u_normalize_matrix:Oe,u_globe_matrix:Ue,u_merc_matrix:qe,u_grid_matrix:Ct,u_tl_parent:Ot,u_scale_parent:vi,u_fade_t:bi.mix,u_opacity:bi.opacity*Pi.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:Pi.paint.get("raster-brightness-min"),u_brightness_high:Pi.paint.get("raster-brightness-max"),u_saturation_factor:Le.cJ(Pi.paint.get("raster-saturation")),u_contrast_factor:Le.cK(Pi.paint.get("raster-contrast")),u_spin_weights:Kr(Pi.paint.get("raster-hue-rotate")),u_perspective_transform:Hr,u_raster_elevation:Jr,u_zoom_transition:Jt,u_merc_center:_i,u_cutoff_params:xi,u_colorization_mix:$r(Le.cL,Nn,qn),u_colorization_offset:Xr(Le.cL,Gn,qn),u_color_ramp:Ln,u_texture_offset:[$n/(Zn+2*$n),Zn/(Zn+2*$n)],u_texture_res:[Zn+2*$n,Zn+2*$n],u_emissive_strength:Xn});function Kr(Le){Le*=Math.PI/180;const Re=Math.sin(Le),Oe=Math.cos(Le);return[(2*Oe+1)/3,(-Math.sqrt(3)*Re-Oe+1)/3,(Math.sqrt(3)*Re-Oe+1)/3]}const Ju=.05,Qr=(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi)=>({u_matrix:Le,u_normalize_matrix:Re,u_globe_matrix:Oe,u_merc_matrix:Ue,u_grid_matrix:qe,u_tl_parent:Ct,u_scale_parent:xi,u_fade_t:vi.mix,u_opacity:vi.opacity,u_image0:0,u_image1:1,u_raster_elevation:bi,u_zoom_transition:Ot,u_merc_center:Jt,u_cutoff_params:_i}),es=(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi)=>({u_particle_texture:Le,u_particle_texture_side_len:Re,u_tile_offset:Oe,u_velocity:Ue,u_color_ramp:Ct,u_velocity_res:qe,u_max_speed:Ot,u_uv_offset:Jt,u_data_scale:[255*_i[0],255*_i[1]],u_data_offset:xi,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ju,Ju]}),ts=(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi)=>({u_particle_texture:Le,u_particle_texture_side_len:Re,u_velocity:Oe,u_velocity_res:Ue,u_max_speed:qe,u_speed_factor:Ct,u_reset_rate:Ot,u_rand_seed:Math.random(),u_uv_offset:Jt,u_data_scale:[255*_i[0],255*_i[1]],u_data_offset:xi,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ju,Ju]}),Ku=Le.a6.mat4.create(),os=(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn,$n,Xn)=>{const Yn=Ct.transform,lo={u_is_size_zoom_constant:+("constant"===Re||"source"===Re),u_is_size_feature_constant:+("constant"===Re||"camera"===Re),u_size_t:Oe?Oe.uSizeT:0,u_size:Oe?Oe.uSize:0,u_camera_to_center_distance:Yn.getCameraToCenterDistance(Zn),u_rotate_symbol:+Ue,u_aspect_ratio:Yn.width/Yn.height,u_fade_change:Ct.options.fadeDuration?Ct.symbolFadeChange:1,u_matrix:Ot,u_label_plane_matrix:Jt,u_coord_matrix:_i,u_is_text:+vi,u_elevation_from_sea:xi?1:0,u_pitch_with_map:+qe,u_texsize:bi,u_texsize_icon:Pi,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ku,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Ku,u_up_vector:[0,-1,0],u_color_adj_mat:$n,u_icon_transition:Xn||0,u_gamma_scale:qe?Ct.transform.getCameraToCenterDistance(Zn)*Math.cos(Ct.terrain?0:Ct.transform._pitch):1,u_device_pixel_ratio:Le.q.devicePixelRatio,u_is_halo:+Hr};return"globe"===Zn.name&&(lo.u_tile_id=[Jr.canonical.x,Jr.canonical.y,1<<Jr.canonical.z],lo.u_zoom_transition=Ln,lo.u_inv_rot_matrix=Gn,lo.u_merc_center=Nn,lo.u_camera_forward=Yn._camera.forward(),lo.u_ecef_origin=Le.cM(Yn.globeMatrix,Jr.toUnwrapped()),lo.u_tile_matrix=Float32Array.from(Yn.globeMatrix),lo.u_up_vector=qn),lo},rs=(Le,Re,Oe,Ue)=>({u_matrix:Le,u_emissive_strength:Re,u_opacity:Oe,u_color:Ue}),ss=(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi)=>Le.l(function(Re,Oe,Ue,qe,Ct,Ot){const{width:Jt,height:_i}=qe.imageManager.getPixelSize(Oe),xi=Math.pow(2,Ot.tileID.overscaledZ),vi=Ot.tileSize*Math.pow(2,qe.transform.tileZoom)/xi,bi=vi*(Ot.tileID.canonical.x+Ot.tileID.wrap*xi),Pi=vi*Ot.tileID.canonical.y;return{u_image:0,u_pattern_tl:Ue.tl,u_pattern_br:Ue.br,u_texsize:[Jt,_i],u_pattern_size:Ue.displaySize,u_pattern_units_to_pixels:Ct?[qe.transform.width,-1*qe.transform.height]:[1/Le.ak(Ot,1,qe.transform.tileZoom),1/Le.ak(Ot,1,qe.transform.tileZoom)],u_pixel_coord_upper:[bi>>16,Pi>>16],u_pixel_coord_lower:[65535&bi,65535&Pi]}}(0,Ot,Jt,qe,_i,xi),{u_matrix:Re,u_emissive_strength:Oe,u_opacity:Ue}),Qu=new Float32Array(Le.a6.mat4.identity([])),ns=(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr=[
10,0,0],Ln)=>{const Nn=Ct.style.light,Gn=Nn.properties.get("position"),qn=[-Gn.x,-Gn.y,Gn.z],Zn=Le.a6.mat3.create();"viewport"===Nn.properties.get("anchor")&&(Le.a6.mat3.fromRotation(Zn,-Ct.transform.angle),Le.a6.vec3.transformMat3(qn,qn,Zn));const $n="MASK"===bi.alphaMode,Xn=Nn.properties.get("color").toRenderColor(null),Yn=Hr.paint.get("model-ambient-occlusion-intensity"),lo=Hr.paint.get("model-color").constantOr(Le.bz.white).toRenderColor(null),uo=Hr.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:Re,u_lighting_matrix:Oe,u_normal_matrix:Ue,u_node_matrix:qe||Qu,u_lightpos:qn,u_lightintensity:Nn.properties.get("intensity"),u_lightcolor:[Xn.r,Xn.g,Xn.b],u_camera_pos:Jr,u_opacity:Ot,u_baseTextureIsAlpha:0,u_alphaMask:+$n,u_alphaCutoff:bi.alphaCutoff,u_baseColorFactor:[Jt.r,Jt.g,Jt.b,Jt.a],u_emissiveFactor:[_i[0],_i[1],_i[2],1],u_metallicFactor:xi,u_roughnessFactor:vi,u_baseColorTexture:th.BaseColor,u_metallicRoughnessTexture:th.MetallicRoughness,u_normalTexture:th.Normal,u_occlusionTexture:th.Occlusion,u_emissionTexture:th.Emission,u_lutTexture:th.LUT,u_color_mix:[lo.r,lo.g,lo.b,uo],u_aoIntensity:Yn,u_emissive_strength:Pi,u_occlusionTextureTransform:Ln||[0,0,0,0]}},ls=(Le,Re=Qu,Oe=Qu)=>({u_matrix:Le,u_instance:Re,u_node_matrix:Oe}),id={fillExtrusion:Re=>({u_matrix:new Le.bF(Re),u_lightpos:new Le.bH(Re),u_lightintensity:new Le.bI(Re),u_lightcolor:new Le.bH(Re),u_vertical_gradient:new Le.bI(Re),u_opacity:new Le.bI(Re),u_edge_radius:new Le.bI(Re),u_width_scale:new Le.bI(Re),u_ao:new Le.bG(Re),u_tile_id:new Le.bH(Re),u_zoom_transition:new Le.bI(Re),u_inv_rot_matrix:new Le.bF(Re),u_merc_center:new Le.bG(Re),u_up_dir:new Le.bH(Re),u_height_lift:new Le.bI(Re),u_flood_light_color:new Le.bH(Re),u_vertical_scale:new Le.bI(Re),u_flood_light_intensity:new Le.bI(Re),u_ground_shadow_factor:new Le.bH(Re)}),fillExtrusionDepth:Re=>({u_matrix:new Le.bF(Re),u_edge_radius:new Le.bI(Re),u_width_scale:new Le.bI(Re),u_vertical_scale:new Le.bI(Re)}),fillExtrusionPattern:Re=>({u_matrix:new Le.bF(Re),u_lightpos:new Le.bH(Re),u_lightintensity:new Le.bI(Re),u_lightcolor:new Le.bH(Re),u_vertical_gradient:new Le.bI(Re),u_height_factor:new Le.bI(Re),u_edge_radius:new Le.bI(Re),u_width_scale:new Le.bI(Re),u_ao:new Le.bG(Re),u_tile_id:new Le.bH(Re),u_zoom_transition:new Le.bI(Re),u_inv_rot_matrix:new Le.bF(Re),u_merc_center:new Le.bG(Re),u_up_dir:new Le.bH(Re),u_height_lift:new Le.bI(Re),u_image:new Le.bJ(Re),u_texsize:new Le.bG(Re),u_pixel_coord_upper:new Le.bG(Re),u_pixel_coord_lower:new Le.bG(Re),u_tile_units_to_pixels:new Le.bI(Re),u_opacity:new Le.bI(Re)}),fillExtrusionGroundEffect:Re=>({u_matrix:new Le.bF(Re),u_opacity:new Le.bI(Re),u_ao_pass:new Le.bI(Re),u_meter_to_tile:new Le.bI(Re),u_ao:new Le.bG(Re),u_flood_light_intensity:new Le.bI(Re),u_flood_light_color:new Le.bH(Re),u_attenuation:new Le.bI(Re),u_edge_radius:new Le.bI(Re),u_fb:new Le.bJ(Re),u_fb_size:new Le.bI(Re),u_dynamic_offset:new Le.bI(Re)}),fill:Re=>({u_matrix:new Le.bF(Re),u_emissive_strength:new Le.bI(Re)}),fillPattern:Re=>({u_matrix:new Le.bF(Re),u_emissive_strength:new Le.bI(Re),u_image:new Le.bJ(Re),u_texsize:new Le.bG(Re),u_pixel_coord_upper:new Le.bG(Re),u_pixel_coord_lower:new Le.bG(Re),u_tile_units_to_pixels:new Le.bI(Re)}),fillOutline:Re=>({u_matrix:new Le.bF(Re),u_emissive_strength:new Le.bI(Re),u_world:new Le.bG(Re)}),fillOutlinePattern:Re=>({u_matrix:new Le.bF(Re),u_emissive_strength:new Le.bI(Re),u_world:new Le.bG(Re),u_image:new Le.bJ(Re),u_texsize:new Le.bG(Re),u_pixel_coord_upper:new Le.bG(Re),u_pixel_coord_lower:new Le.bG(Re),u_tile_units_to_pixels:new Le.bI(Re)}),circle:Le.cN,collisionBox:Re=>({u_matrix:new Le.bF(Re),u_camera_to_center_distance:new Le.bI(Re),u_extrude_scale:new Le.bG(Re)}),collisionCircle:Re=>({u_matrix:new Le.bF(Re),u_inv_matrix:new Le.bF(Re),u_camera_to_center_distance:new Le.bI(Re),u_viewport_size:new Le.bG(Re)}),debug:Re=>({u_color:new Le.cu(Re),u_matrix:new Le.bF(Re),u_overlay:new Le.bJ(Re),u_overlay_scale:new Le.bI(Re)}),clippingMask:Re=>({u_matrix:new Le.bF(Re)}),heatmap:Re=>({u_extrude_scale:new Le.bI(Re),u_intensity:new Le.bI(Re),u_matrix:new Le.bF(Re),u_inv_rot_matrix:new Le.bF(Re),u_merc_center:new Le.bG(Re),u_tile_id:new Le.bH(Re),u_zoom_transition:new Le.bI(Re),u_up_dir:new Le.bH(Re)}),heatmapTexture:Re=>({u_image:new Le.bJ(Re),u_color_ramp:new Le.bJ(Re),u_opacity:new Le.bI(Re)}),hillshade:Re=>({u_matrix:new Le.bF(Re),u_image:new Le.bJ(Re),u_latrange:new Le.bG(Re),u_light:new Le.bG(Re),u_shadow:new Le.cu(Re),u_highlight:new Le.cu(Re),u_emissive_strength:new Le.bI(Re),u_accent:new Le.cu(Re)}),hillshadePrepare:Re=>({u_matrix:new Le.bF(Re),u_image:new Le.bJ(Re),u_dimension:new Le.bG(Re),u_zoom:new Le.bI(Re)}),line:Le.cO,linePattern:Le.cP,raster:Re=>({u_matrix:new Le.bF(Re),u_normalize_matrix:new Le.bF(Re),u_globe_matrix:new Le.bF(Re),u_merc_matrix:new Le.bF(Re),u_grid_matrix:new Le.cv(Re),u_tl_parent:new Le.bG(Re),u_scale_parent:new Le.bI(Re),u_fade_t:new Le.bI(Re),u_opacity:new Le.bI(Re),u_image0:new Le.bJ(Re),u_image1:new Le.bJ(Re),u_brightness_low:new Le.bI(Re),u_brightness_high:new Le.bI(Re),u_saturation_factor:new Le.bI(Re),u_contrast_factor:new Le.bI(Re),u_spin_weights:new Le.bH(Re),u_perspective_transform:new Le.bG(Re),u_raster_elevation:new Le.bI(Re),u_zoom_transition:new Le.bI(Re),u_merc_center:new Le.bG(Re),u_cutoff_params:new Le.c6(Re),u_colorization_mix:new Le.c6(Re),u_colorization_offset:new Le.bI(Re),u_color_ramp:new Le.bJ(Re),u_texture_offset:new Le.bG(Re),u_texture_res:new Le.bG(Re),u_emissive_strength:new Le.bI(Re)}),rasterParticle:Re=>({u_matrix:new Le.bF(Re),u_normalize_matrix:new Le.bF(Re),u_globe_matrix:new Le.bF(Re),u_merc_matrix:new Le.bF(Re),u_grid_matrix:new Le.cv(Re),u_tl_parent:new Le.bG(Re),u_scale_parent:new Le.bI(Re),u_fade_t:new Le.bI(Re),u_opacity:new Le.bI(Re),u_image0:new Le.bJ(Re),u_image1:new Le.bJ(Re),u_raster_elevation:new Le.bI(Re),u_zoom_transition:new Le.bI(Re),u_merc_center:new Le.bG(Re),u_cutoff_params:new Le.c6(Re)}),rasterParticleTexture:Re=>({u_texture:new Le.bJ(Re),u_opacity:new Le.bI(Re)}),rasterParticleDraw:Re=>({u_particle_texture:new Le.bJ(Re),u_particle_texture_side_len:new Le.bI(Re),u_tile_offset:new Le.bG(Re),u_velocity:new Le.bJ(Re),u_color_ramp:new Le.bJ(Re),u_velocity_res:new Le.bG(Re),u_max_speed:new Le.bI(Re),u_uv_offset:new Le.bG(Re),u_data_scale:new Le.bG(Re),u_data_offset:new Le.bI(Re),u_particle_pos_scale:new Le.bI(Re),u_particle_pos_offset:new Le.bG(Re)}),rasterParticleUpdate:Re=>({u_particle_texture:new Le.bJ(Re),u_particle_texture_side_len:new Le.bI(Re),u_velocity:new Le.bJ(Re),u_velocity_res:new Le.bG(Re),u_max_speed:new Le.bI(Re),u_speed_factor:new Le.bI(Re),u_reset_rate:new Le.bI(Re),u_rand_seed:new Le.bI(Re),u_uv_offset:new Le.bG(Re),u_data_scale:new Le.bG(Re),u_data_offset:new Le.bI(Re),u_particle_pos_scale:new Le.bI(Re),u_particle_pos_offset:new Le.bG(Re)}),symbol:Re=>({u_is_size_zoom_constant:new Le.bJ(Re),u_is_size_feature_constant:new Le.bJ(Re),u_size_t:new Le.bI(Re),u_size:new Le.bI(Re),u_camera_to_center_distance:new Le.bI(Re),u_rotate_symbol:new Le.bJ(Re),u_aspect_ratio:new Le.bI(Re),u_fade_change:new Le.bI(Re),u_matrix:new Le.bF(Re),u_label_plane_matrix:new Le.bF(Re),u_coord_matrix:new Le.bF(Re),u_is_text:new Le.bJ(Re),u_elevation_from_sea:new Le.bJ(Re),u_pitch_with_map:new Le.bJ(Re),u_texsize:new Le.bG(Re),u_texsize_icon:new Le.bG(Re),u_texture:new Le.bJ(Re),u_texture_icon:new Le.bJ(Re),u_gamma_scale:new Le.bI(Re),u_device_pixel_ratio:new Le.bI(Re),u_tile_id:new Le.bH(Re),u_zoom_transition:new Le.bI(Re),u_inv_rot_matrix:new Le.bF(Re),u_merc_center:new Le.bG(Re),u_camera_forward:new Le.bH(Re),u_tile_matrix:new Le.bF(Re),u_up_vector:new Le.bH(Re),u_ecef_origin:new Le.bH(Re),u_is_halo:new Le.bJ(Re),u_icon_transition:new Le.bI(Re),u_color_adj_mat:new Le.bF(Re)}),background:Re=>({u_matrix:new Le.bF(Re),u_emissive_strength:new Le.bI(Re),u_opacity:new Le.bI(Re),u_color:new Le.cu(Re)}),backgroundPattern:Re=>({u_matrix:new Le.bF(Re),u_emissive_strength:new Le.bI(Re),u_opacity:new Le.bI(Re),u_image:new Le.bJ(Re),u_pattern_tl:new Le.bG(Re),u_pattern_br:new Le.bG(Re),u_texsize:new Le.bG(Re),u_pattern_size:new Le.bG(Re),u_pixel_coord_upper:new Le.bG(Re),u_pixel_coord_lower:new Le.bG(Re),u_pattern_units_to_pixels:new Le.bG(Re)}),terrainRaster:Re=>({u_matrix:new Le.bF(Re),u_image0:new Le.bJ(Re),u_skirt_height:new Le.bI(Re),u_ground_shadow_factor:new Le.bH(Re)}),skybox:Re=>({u_matrix:new Le.bF(Re),u_sun_direction:new Le.bH(Re),u_cubemap:new Le.bJ(Re),u_opacity:new Le.bI(Re),u_temporal_offset:new Le.bI(Re)}),skyboxGradient:Re=>({u_matrix:new Le.bF(Re),u_color_ramp:new Le.bJ(Re),u_center_direction:new Le.bH(Re),u_radius:new Le.bI(Re),u_opacity:new Le.bI(Re),u_temporal_offset:new Le.bI(Re)}),skyboxCapture:Re=>({u_matrix_3f:new Le.cv(Re),u_sun_direction:new Le.bH(Re),u_sun_intensity:new Le.bI(Re),u_color_tint_r:new Le.c6(Re),u_color_tint_m:new Le.c6(Re),u_luminance:new Le.bI(Re)}),globeRaster:Re=>({u_proj_matrix:new Le.bF(Re),u_globe_matrix:new Le.bF(Re),u_normalize_matrix:new Le.bF(Re),u_merc_matrix:new Le.bF(Re),u_zoom_transition:new Le.bI(Re),u_merc_center:new Le.bG(Re),u_image0:new Le.bJ(Re),u_grid_matrix:new Le.cv(Re),u_skirt_height:new Le.bI(Re),u_far_z_cutoff:new Le.bI(Re),u_frustum_tl:new Le.bH(Re),u_frustum_tr:new Le.bH(Re),u_frustum_br:new Le.bH(Re),u_frustum_bl:new Le.bH(Re),u_globe_pos:new Le.bH(Re),u_globe_radius:new Le.bI(Re),u_viewport:new Le.bG(Re)}),globeAtmosphere:Re=>({u_frustum_tl:new Le.bH(Re),u_frustum_tr:new Le.bH(Re),u_frustum_br:new Le.bH(Re),u_frustum_bl:new Le.bH(Re),u_horizon:new Le.bI(Re),u_transition:new Le.bI(Re),u_fadeout_range:new Le.bI(Re),u_color:new Le.c6(Re),u_high_color:new Le.c6(Re),u_space_color:new Le.c6(Re),u_temporal_offset:new Le.bI(Re),u_horizon_angle:new Le.bI(Re)}),model:Re=>({u_matrix:new Le.bF(Re),u_lighting_matrix:new Le.bF(Re),u_normal_matrix:new Le.bF(Re),u_node_matrix:new Le.bF(Re),u_lightpos:new Le.bH(Re),u_lightintensity:new Le.bI(Re),u_lightcolor:new Le.bH(Re),u_camera_pos:new Le.bH(Re),u_opacity:new Le.bI(Re),u_baseColorFactor:new Le.c6(Re),u_emissiveFactor:new Le.c6(Re),u_metallicFactor:new Le.bI(Re),u_roughnessFactor:new Le.bI(Re),u_baseTextureIsAlpha:new Le.bJ(Re),u_alphaMask:new Le.bJ(Re),u_alphaCutoff:new Le.bI(Re),u_baseColorTexture:new Le.bJ(Re),u_metallicRoughnessTexture:new Le.bJ(Re),u_normalTexture:new Le.bJ(Re),u_occlusionTexture:new Le.bJ(Re),u_emissionTexture:new Le.bJ(Re),u_lutTexture:new Le.bJ(Re),u_color_mix:new Le.c6(Re),u_aoIntensity:new Le.bI(Re),u_emissive_strength:new Le.bI(Re),u_occlusionTextureTransform:new Le.c6(Re)}),modelDepth:Re=>({u_matrix:new Le.bF(Re),u_instance:new Le.bF(Re),u_node_matrix:new Le.bF(Re)}),groundShadow:Re=>({u_matrix:new Le.bF(Re),u_ground_shadow_factor:new Le.bH(Re)}),stars:Re=>({u_matrix:new Le.bF(Re),u_up:new Le.bH(Re),u_right:new Le.bH(Re),u_intensity_multiplier:new Le.bI(Re)}),occlusion:Re=>({u_matrix:new Le.bF(Re),u_anchorPos:new Le.bH(Re),u_screenSizePx:new Le.bG(Re),u_occluderSizePx:new Le.bG(Re),u_color:new Le.c6(Re)})};class hs{constructor(Le,Re,Oe,Ue){this.id=hs.uniqueIdxCounter,hs.uniqueIdxCounter++,this.context=Le;const qe=Le.gl;this.buffer=qe.createBuffer(),this.dynamicDraw=Boolean(Oe),this.context.unbindVAO(),Le.bindElementBuffer.set(this.buffer),qe.bufferData(qe.ELEMENT_ARRAY_BUFFER,Re.arrayBuffer,this.dynamicDraw?qe.DYNAMIC_DRAW:qe.STATIC_DRAW),this.dynamicDraw||Ue||Re.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(Le){this.id=hs.uniqueIdxCounter,hs.uniqueIdxCounter++;const Re=this.context.gl;this.context.unbindVAO(),this.bind(),Re.bufferSubData(Re.ELEMENT_ARRAY_BUFFER,0,Le.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}hs.uniqueIdxCounter=0;const nd={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ds{constructor(Le,Re,Oe,Ue,qe,Ct){this.length=Re.length,this.attributes=Oe,this.itemSize=Re.bytesPerElement,this.dynamicDraw=Ue,this.instanceCount=Ct,this.context=Le;const Ot=Le.gl;this.buffer=Ot.createBuffer(),Le.bindVertexBuffer.set(this.buffer),Ot.bufferData(Ot.ARRAY_BUFFER,Re.arrayBuffer,this.dynamicDraw?Ot.DYNAMIC_DRAW:Ot.STATIC_DRAW),this.dynamicDraw||qe||Re.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(Le){const Re=this.context.gl;this.bind(),Re.bufferSubData(Re.ARRAY_BUFFER,0,Le.arrayBuffer)}
vendor: 7,222 bytes, line 1
1enableAttributes(Le,Re){for(let Oe=0;Oe<this.attributes.length;Oe++){const Ue=Re.attributes[this.attributes[Oe].name];void 0!==Ue&&Le.enableVertexAttribArray(Ue)}}setVertexAttribPointers(Le,Re,Oe){for(let Ue=0;Ue<this.attributes.length;Ue++){const qe=this.attributes[Ue],Ct=Re.attributes[qe.name];void 0!==Ct&&Le.vertexAttribPointer(Ct,qe.components,Le[nd[qe.type]],!1,this.itemSize,qe.offset+this.itemSize*(Oe||0))}}setVertexAttribDivisor(Le,Re,Oe){for(let Ue=0;Ue<this.attributes.length;Ue++){const qe=Re.attributes[this.attributes[Ue].name];void 0!==qe&&this.instanceCount&&this.instanceCount>0&&Le.vertexAttribDivisor(qe,Oe)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class _s{constructor(Le,Re,Oe,Ue,qe){this.context=Le,this.width=Re,this.height=Oe;const Ct=this.framebuffer=Le.gl.createFramebuffer();Ue&&(this.colorAttachment=new pr(Le,Ct)),qe&&(this.depthAttachmentType=qe,this.depthAttachment="renderbuffer"===qe?new mr(Le,Ct):new fr(Le,Ct))}destroy(){const Le=this.context.gl;if(this.colorAttachment){const Re=this.colorAttachment.get();Re&&Le.deleteTexture(Re)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const Re=this.depthAttachment.get();Re&&Le.deleteRenderbuffer(Re)}else{const Re=this.depthAttachment.get();Re&&Le.deleteTexture(Re)}Le.deleteFramebuffer(this.framebuffer)}}class ps{constructor(Le,Re){this.gl=Le,this.clearColor=new Fo(this),this.clearDepth=new ko(this),this.clearStencil=new Bo(this),this.colorMask=new No(this),this.depthMask=new Uo(this),this.stencilMask=new Go(this),this.stencilFunc=new jo(this),this.stencilOp=new Vo(this),this.stencilTest=new qo(this),this.depthRange=new Zo(this),this.depthTest=new Ho(this),this.depthFunc=new Wo(this),this.blend=new $o(this),this.blendFunc=new Xo(this),this.blendColor=new Yo(this),this.blendEquation=new Ko(this),this.cullFace=new Jo(this),this.cullFaceSide=new Qo(this),this.frontFace=new er(this),this.program=new Ou(this),this.activeTexture=new ir(this),this.viewport=new or(this),this.bindFramebuffer=new rr(this),this.bindRenderbuffer=new sr(this),this.bindTexture=new ar(this),this.bindVertexBuffer=new nr(this),this.bindElementBuffer=new lr(this),this.bindVertexArrayOES=new cr(this),this.pixelStoreUnpack=new hr(this),this.pixelStoreUnpackPremultiplyAlpha=new ur(this),this.pixelStoreUnpackFlipY=new dr(this),this.options=Re?{...Re}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=Le.getExtension("EXT_texture_filter_anisotropic")||Le.getExtension("MOZ_EXT_texture_filter_anisotropic")||Le.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=Le.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=Le.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=Le.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=Le.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=Le.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=Le.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=Le.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=Le.getParameter(Le.MAX_TEXTURE_SIZE),this.maxPointSize=Le.getParameter(Le.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(Le,Re,Oe){return new hs(this,Le,Re,Oe)}createVertexBuffer(Le,Re,Oe,Ue,qe){return new ds(this,Le,Re,Oe,Ue,qe)}createRenderbuffer(Le,Re,Oe){const Ue=this.gl,qe=Ue.createRenderbuffer();return this.bindRenderbuffer.set(qe),Ue.renderbufferStorage(Ue.RENDERBUFFER,Le,Re,Oe),this.bindRenderbuffer.set(null),qe}createFramebuffer(Le,Re,Oe,Ue){return new _s(this,Le,Re,Oe,Ue)}clear({color:Le,depth:Re,stencil:Oe,colorMask:Ue}){const qe=this.gl;let Ct=0;Le&&(Ct|=qe.COLOR_BUFFER_BIT,this.clearColor.set(Le),this.colorMask.set(Ue||[!0,!0,!0,!0])),void 0!==Re&&(Ct|=qe.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(Re),this.depthMask.set(!0)),void 0!==Oe&&(Ct|=qe.STENCIL_BUFFER_BIT,this.clearStencil.set(Oe),this.stencilMask.set(255)),qe.clear(Ct)}setCullFace(Le){!1===Le.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(Le.mode),this.frontFace.set(Le.frontFace))}setDepthMode(Le){Le.func!==this.gl.ALWAYS||Le.mask?(this.depthTest.set(!0),this.depthFunc.set(Le.func),this.depthMask.set(Le.mask),this.depthRange.set(Le.range)):this.depthTest.set(!1)}setStencilMode(Le){Le.test.func!==this.gl.ALWAYS||Le.mask?(this.stencilTest.set(!0),this.stencilMask.set(Le.mask),this.stencilOp.set([Le.fail,Le.depthFail,Le.pass]),this.stencilFunc.set({func:Le.test.func,ref:Le.ref,mask:Le.test.mask})):this.stencilTest.set(!1)}setColorMode(Re){Le.bh(Re.blendFunction,Ai.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(Re.blendFunction),this.blendColor.set(Re.blendColor),Re.blendEquation?this.blendEquation.set(Re.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(Re.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let ld;function fs(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Re.context,xi=_i.gl,vi=Re.transform,bi=Re.getOrCreateProgram("collisionBox"),Pi=[];let Hr=0,Jr=0;for(let _i=0;_i<qe.length;_i++){const Ln=qe[_i],Nn=Oe.getTile(Ln),Gn=Nn.getBucket(Ue);if(!Gn)continue;const qn=ti(Ln,Gn,vi);let Zn=qn;0===Ct[0]&&0===Ct[1]||(Zn=Re.translatePosMatrix(qn,Nn,Ct,Ot));const $n=Jt?Gn.textCollisionBox:Gn.iconCollisionBox,Xn=Gn.collisionCircleArray;
1if(Xn.length>0){const Re=Le.a6.mat4.create(),Oe=Zn;Le.a6.mat4.mul(Re,Gn.placementInvProjMatrix,vi.glCoordMatrix),Le.a6.mat4.mul(Re,Re,Gn.placementViewportMatrix),Pi.push({circleArray:Xn,circleOffset:Jr,transform:Oe,invTransform:Re,projection:Gn.getProjection()}),Hr+=Xn.length/4,Jr=Hr}$n&&(Re.terrain&&Re.terrain.setupElevationDraw(Nn,bi),bi.draw(Re,xi.LINES,Li.disabled,Mi.disabled,Re.colorModeForRenderPass(),Fi.disabled,qr(Zn,vi,Nn,Gn.getProjection()),Ue.id,$n.layoutVertexBuffer,$n.indexBuffer,$n.segments,null,vi.zoom,null,[$n.collisionVertexBuffer,$n.collisionVertexBufferExt]))}if(!Jt||!Pi.length)return;const Ln=Re.getOrCreateProgram("collisionCircle"),Nn=new Le.cQ;Nn.resize(4*Hr),Nn._trim();let Gn=0;for(const Le of Pi)for(let Re=0;Re<Le.circleArray.length/4;Re++){const Oe=4*Re,Ue=Le.circleArray[Oe+0],qe=Le.circleArray[Oe+1],Ct=Le.circleArray[Oe+2],Ot=Le.circleArray[Oe+3];Nn.emplace(Gn++,Ue,qe,Ct,Ot,0),Nn.emplace(Gn++,Ue,qe,Ct,Ot,1),Nn.emplace(Gn++,Ue,qe,Ct,Ot,2),Nn.emplace(Gn++,Ue,qe,Ct,Ot,3)}(!ld||ld.length<2*Hr)&&(ld=function(Re){const Oe=2*Re,Ue=new Le.aO;Ue.resize(Oe),Ue._trim();for(let Le=0;Le<Oe;Le++){const Re=6*Le;Ue.uint16[Re+0]=4*Le+0,Ue.uint16[Re+1]=4*Le+1,Ue.uint16[Re+2]=4*Le+2,Ue.uint16[Re+3]=4*Le+2,Ue.uint16[Re+4]=4*Le+3,Ue.uint16[Re+5]=4*Le+0}return Ue}(Hr));const qn=_i.createIndexBuffer(ld,!0),Zn=_i.createVertexBuffer(Nn,Le.cR.members,!0);for(const Oe of Pi){const qe={u_matrix:Oe.transform,u_inv_matrix:Oe.invTransform,u_camera_to_center_distance:($n=vi).getCameraToCenterDistance(Oe.projection),u_viewport_size:[$n.width,$n.height]};Ln.draw(Re,xi.TRIANGLES,Li.disabled,Mi.disabled,Re.colorModeForRenderPass(),Fi.disabled,qe,Ue.id,Zn,qn,Le.b1.simpleSegment(0,2*Oe.circleOffset,Oe.circleArray.length,Oe.circleArray.length/2),null,vi.zoom)}var $n;Zn.destroy(),qn.destroy()}const ud=Le.a6.mat4.create();function vs(Re){const Oe=Re._camera.getWorldToCamera(Re.worldSize,1),Ue=Le.a6.mat4.multiply([],Oe,Re.globeMatrix);Le.a6.mat4.invert(Ue,Ue);const qe=[0,0,0],Ct=[0,1,0,0];return Le.a6.vec4.transformMat4(Ct,Ct,Ue),qe[0]=Ct[0],qe[1]=Ct[1],qe[2]=Ct[2],Le.a6.vec3.normalize(qe,qe),qe}function xs({width:Re,height:Oe,anchor:Ue,textOffset:qe,textScale:Ct},Ot){const{horizontalAlign:Jt,verticalAlign:_i}=Le.bx(Ue),xi=-(Jt-.5)*Re,vi=-(_i-.5)*Oe,bi=Le.bw(Ue,qe);return new Le.P((xi/Ct+bi[0])*Ot,(vi/Ct+bi[1])*Ot)}function ys(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi){const Pi=Re.text.placedSymbolArray,Hr=Re.text.dynamicLayoutVertexArray,Jr=Re.icon.dynamicLayoutVertexArray,Ln={},Nn=Re.getProjection(),Gn=ii(_i,Nn,Ot),qn=Ot.elevation,Zn=Nn.upVectorScale(_i.canonical,Ot.center.lat,Ot.worldSize).metersToTile;Hr.clear();for(let Jr=0;Jr<Pi.length;Jr++){const $n=Pi.get(Jr),{tileAnchorX:Xn,tileAnchorY:Yn,numGlyphs:lo}=$n,uo=$n.hidden||!$n.crossTileID||Re.allowVerticalPlacement&&!$n.placedOrientation?null:qe[$n.crossTileID];if(uo){let qe=0,Pi=0,Jr=0;if(qn){const Le=qn?qn.getAtTileOffset(_i,Xn,Yn):0,[Re,Oe,Ue]=Nn.upVector(_i.canonical,Xn,Yn);qe=Le*Re*Zn,Pi=Le*Oe*Zn,Jr=Le*Ue*Zn}let[po,fo,Io,is]=Ut($n.projectedAnchorX+qe,$n.projectedAnchorY+Pi,$n.projectedAnchorZ+Jr,Ue?Gn:Jt);const as=Gt(Ot.getCameraToCenterDistance(Nn),is);let Is=Ct.evaluateSizeForFeature(Re.textSizeData,vi,$n)*as/Le.bq;Ue&&(Is*=Re.tilePixelRatio/xi);const Xs=xs(uo,Is);Ue?(({x:po,y:fo,z:Io}=Nn.projectTilePoint(Xn+Xs.x,Yn+Xs.y,_i.canonical)),[po,fo,Io]=Ut(po+qe,fo+Pi,Io+Jr,Jt)):(Oe&&Xs._rotate(-Ot.angle),po+=Xs.x,fo+=Xs.y,Io=0);const ta=Re.allowVerticalPlacement&&$n.placedOrientation===Le.bk.vertical?Math.PI/2:0;for(let Re=0;Re<lo;Re++)Le.bn(Hr,po,fo,Io,ta);bi&&$n.associatedIconIndex>=0&&(Ln[$n.associatedIconIndex]={x:po,y:fo,z:Io,angle:ta})}else Yt(lo,Hr)}if(bi){Jr.clear();const Oe=Re.icon.placedSymbolArray;for(let Re=0;Re<Oe.length;Re++){const Ue=Oe.get(Re),{numGlyphs:qe}=Ue,Ct=Ln[Re];if(Ue.hidden||!Ct)Yt(qe,Jr);else{const{x:Re,y:Oe,z:Ue,angle:Ot}=Ct;for(let Ct=0;Ct<qe;Ct++)Le.bn(Jr,Re,Oe,Ue,Ot)}}Re.icon.dynamicLayoutVertexBuffer.updateData(Jr)}Re.text.dynamicLayoutVertexBuffer.updateData(Hr)}function bs(Re,Oe,Ue,qe,Ct,Ot,Jt={}){const _i=Ue.paint.get("icon-translate"),xi=Ue.paint.get("text-translate"),vi=Ue.paint.get("icon-translate-anchor"),bi=Ue.paint.get("text-translate-anchor"),Pi=Ue.layout.get("icon-rotation-alignment"),Hr=Ue.layout.get("text-rotation-alignment"),Jr=Ue.layout.get("icon-pitch-alignment"),Ln=Ue.layout.get("text-pitch-alignment"),Nn=Ue.layout.get("icon-keep-upright"),Gn=Ue.layout.get("text-keep-upright"),qn=Ue.paint.get("icon-color-saturation"),Zn=Ue.paint.get("icon-color-contrast"),$n=Ue.paint.get("icon-color-brightness-min"),Xn=Ue.paint.get("icon-color-brightness-max"),Yn="sea"===Ue.paint.get("symbol-elevation-reference"),lo=Ue.paint.get("text-occlusion-opacity").constantOr(0),uo=Re.context,po=uo.gl,fo=Re.transform,Io="map"===Pi,is="map"===Hr,as="map"===Jr,Is="map"===Ln,Xs=void 0!==Ue.layout.get("symbol-sort-key").constantOr(1);let ta=!1;const ha=Re.depthModeForSublayer(0,Li.ReadOnly),el=[Le.am(fo.center.lng),Le.at(fo.center.lat)],tl=Ue.layout.get("text-variable-anchor"),il="globe"===fo.projection.name,sl=[],fl=[0,-1,0];for(const Ct of qe){const qe=Oe.getTile(Ct),Ot=qe.getBucket(Ue);if(!Ot)continue;if("mercator"===Ot.projection.name&&il)continue;if(Ot.fullyClipped)continue;const Pi="globe"===Ot.projection.name,Hr=Pi?Le.a9(fo.zoom):0,Jr=ii(Ct,Ot.getProjection(),fo),Ln=fo.calculatePixelsToTileUnitsMatrix(qe),uo=tl&&Ot.hasTextData(),ha=Ot.hasIconTextFit()&&uo&&Ot.hasIconData(),Ml=Ot.getProjection().createInversionMatrix(fo,Ct.canonical),U=Le=>{fo.depthOcclusionForSymbolsAndCircles&&(Ue.hasInitialOcclusionOpacityProperties||Re.terrain)&&(Le.push("DEPTH_D24"),Le.pu
1sh("DEPTH_OCCLUSION"))},G=()=>{const Oe=Io&&"point"!==Ue.layout.get("symbol-placement"),Jt=[];U(Jt);const xi=Oe||ha,bi=Ue.paint.get("icon-image-cross-fade").constantOr(0);Re.terrainRenderModeElevated()&&as&&Jt.push("PITCH_WITH_MAP_TERRAIN"),Pi&&(Jt.push("PROJECTION_GLOBE_VIEW"),xi&&Jt.push("PROJECTED_POS_ON_VIEWPORT")),bi>0&&Jt.push("ICON_TRANSITION"),Ot.icon.zOffsetVertexBuffer&&Jt.push("Z_OFFSET"),0===qn&&0===Zn&&0===$n&&1===Xn||Jt.push("COLOR_ADJUSTMENT"),Ot.sdfIcons&&Jt.push("RENDER_SDF");const Gn=Ot.icon.programConfigurations.get(Ue.id),lo=Re.getOrCreateProgram("symbol",{config:Gn,defines:Jt}),uo=qe.imageAtlasTexture?qe.imageAtlasTexture.size:[0,0],is=Ot.iconSizeData,Is=Le.bj(is,fo.zoom),Xs=as||0!==fo.pitch,ta=kt(Jr,qe.tileID.canonical,as,Io,fo,Ot.getProjection(),Ln),tl=Nt(Jr,qe.tileID.canonical,as,Io,fo,Ot.getProjection(),Ln),sl=Re.translatePosMatrix(tl,qe,_i,vi,!0),Al=Re.translatePosMatrix(Jr,qe,_i,vi),Hl=xi?ud:ta,Wl=Io&&!as&&!Oe;let Jl=fl;!il&&!fo.mercatorFromTransition||Io||(Jl=vs(fo));const Kl=Pi?Jl:fl,Ql=Ue.getColorAdjustmentMatrix(qn,Zn,$n,Xn),oc=os(is.kind,Is,Wl,as,Re,Al,Hl,sl,Yn,!1,uo,[0,0],!0,Ct,Hr,el,Ml,Kl,Ot.getProjection(),Ql,bi),lc=qe.imageAtlasTexture?qe.imageAtlasTexture:null,Oc=1!==Ue.layout.get("icon-size").constantOr(0)||Ot.iconsNeedLinear,Nc=Ot.sdfIcons||Re.options.rotating||Re.options.zooming||Oc||Xs?po.LINEAR:po.NEAREST,Uc=Ot.sdfIcons&&0!==Ue.paint.get("icon-halo-width").constantOr(1),jc=Re.terrain&&as&&Oe?Le.a6.mat4.invert(Le.a6.mat4.create(),ta):ud;if(Oe&&Ot.icon){const Le=fo.elevation,Oe=Le?Le.getAtTileOffsetFunc(Ct,fo.center.lat,fo.worldSize,Ot.getProjection()):null,Ue=Bt(Jr,qe.tileID.canonical,as,Io,fo,Ot.getProjection(),Ln);Vt(Ot,Jr,Re,!1,Ue,tl,as,Nn,Oe,Ct)}return{program:lo,buffers:Ot.icon,uniformValues:oc,atlasTexture:lc,atlasTextureIcon:null,atlasInterpolation:Nc,atlasInterpolationIcon:null,isSDF:Ot.sdfIcons,hasHalo:Uc,tile:qe,labelPlaneMatrixInv:jc}},j=()=>{const Oe=is&&"point"!==Ue.layout.get("symbol-placement"),Jt=[],_i=Oe||tl||ha;Re.terrainRenderModeElevated()&&Is&&Jt.push("PITCH_WITH_MAP_TERRAIN"),Pi&&(Jt.push("PROJECTION_GLOBE_VIEW"),_i&&Jt.push("PROJECTED_POS_ON_VIEWPORT")),Ot.text.zOffsetVertexBuffer&&Jt.push("Z_OFFSET"),Ot.iconsInText&&Jt.push("RENDER_TEXT_AND_SYMBOL"),Jt.push("RENDER_SDF"),U(Jt);const vi=Ot.text.programConfigurations.get(Ue.id),Nn=Re.getOrCreateProgram("symbol",{config:vi,defines:Jt});let qn,Zn=[0,0],$n=null;const Xn=Ot.textSizeData;Ot.iconsInText&&(Zn=qe.imageAtlasTexture?qe.imageAtlasTexture.size:[0,0],$n=qe.imageAtlasTexture?qe.imageAtlasTexture:null,qn=Is||0!==fo.pitch||Re.options.rotating||Re.options.zooming||"composite"===Xn.kind||"camera"===Xn.kind?po.LINEAR:po.NEAREST);const uo=qe.glyphAtlasTexture?qe.glyphAtlasTexture.size:[0,0],Io=Le.bj(Xn,fo.zoom),as=kt(Jr,qe.tileID.canonical,Is,is,fo,Ot.getProjection(),Ln),Xs=Nt(Jr,qe.tileID.canonical,Is,is,fo,Ot.getProjection(),Ln),ta=Re.translatePosMatrix(Xs,qe,xi,bi,!0),sl=Re.translatePosMatrix(Jr,qe,xi,bi),Al=_i?ud:as,Hl=is&&!Is&&!Oe;let Wl=fl;!il&&!fo.mercatorFromTransition||is||(Wl=vs(fo));const Jl=os(Xn.kind,Io,Hl,Is,Re,sl,Al,ta,Yn,!0,uo,Zn,!0,Ct,Hr,el,Ml,Pi?Wl:fl,Ot.getProjection(),lo),Kl=qe.glyphAtlasTexture?qe.glyphAtlasTexture:null,Ql=po.LINEAR,oc=0!==Ue.paint.get("text-halo-width").constantOr(1),lc=Re.terrain&&Is&&Oe?Le.a6.mat4.invert(Le.a6.mat4.create(),as):ud;if(Oe&&Ot.text){const Le=fo.elevation,Oe=Le?Le.getAtTileOffsetFunc(Ct,fo.center.lat,fo.worldSize,Ot.getProjection()):null,Ue=Bt(Jr,qe.tileID.canonical,Is,is,fo,Ot.getProjection(),Ln);Vt(Ot,Jr,Re,!0,Ue,Xs,Is,Gn,Oe,Ct)}return{program:Nn,buffers:Ot.text,uniformValues:Jl,atlasTexture:Kl,atlasTextureIcon:$n,atlasInterpolation:Ql,atlasInterpolationIcon:qn,isSDF:!0,hasHalo:oc,tile:qe,labelPlaneMatrixInv:lc}},Al=Ot.icon.segments.get().length,Hl=Ot.text.segments.get().length,Wl=Al&&!Jt.onlyText?G():null,Jl=Hl&&!Jt.onlyIcons?j():null,Kl=Ue.paint.get("icon-opacity").constantOr(1),Ql=Ue.paint.get("text-opacity").constantOr(1);if(Xs&&Ot.canOverlap){ta=!0;const Re=Kl&&!Jt.onlyText?Ot.icon.segments.get():[],Oe=Ql&&!Jt.onlyIcons?Ot.text.segments.get():[];for(const Oe of Re)sl.push({segments:new Le.b1([Oe]),sortKey:Oe.sortKey,state:Wl});for(const Re of Oe)sl.push({segments:new Le.b1([Re]),sortKey:Re.sortKey,state:Jl})}else Jt.onlyText||sl.push({segments:Kl?Ot.icon.segments:new Le.b1([]),sortKey:0,state:Wl}
1),Jt.onlyIcons||sl.push({segments:Ql?Ot.text.segments:new Le.b1([]),sortKey:0,state:Jl})}ta&&sl.sort(((Le,Re)=>Le.sortKey-Re.sortKey));for(const Le of sl){const Oe=Le.state;if(Oe)if(Re.terrain?Re.terrain.setupElevationDraw(Oe.tile,Oe.program,{useDepthForOcclusion:fo.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Oe.labelPlaneMatrixInv}):Re.setupDepthForOcclusion(fo.depthOcclusionForSymbolsAndCircles,Oe.program),uo.activeTexture.set(po.TEXTURE0),Oe.atlasTexture&&Oe.atlasTexture.bind(Oe.atlasInterpolation,po.CLAMP_TO_EDGE,!0),Oe.atlasTextureIcon&&(uo.activeTexture.set(po.TEXTURE1),Oe.atlasTextureIcon&&Oe.atlasTextureIcon.bind(Oe.atlasInterpolationIcon,po.CLAMP_TO_EDGE,!0)),Re.uploadCommonLightUniforms(Re.context,Oe.program),Oe.hasHalo){const qe=Oe.uniformValues;qe.u_is_halo=1,ws(Oe.buffers,Le.segments,Ue,Re,Oe.program,ha,Ct,Ot,qe,2),qe.u_is_halo=0}else{if(Oe.isSDF){const qe=Oe.uniformValues;Oe.hasHalo&&(qe.u_is_halo=1,ws(Oe.buffers,Le.segments,Ue,Re,Oe.program,ha,Ct,Ot,qe,1)),qe.u_is_halo=0}ws(Oe.buffers,Le.segments,Ue,Re,Oe.program,ha,Ct,Ot,Oe.uniformValues,1)}}}function ws(Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi){const vi=[Le.dynamicLayoutVertexBuffer,Le.opacityVertexBuffer,Le.iconTransitioningVertexBuffer,Le.globeExtVertexBuffer,Le.zOffsetVertexBuffer];qe.draw(Ue,Ue.context.gl.TRIANGLES,Ct,Ot,Jt,Fi.disabled,_i,Oe.id,Le.layoutVertexBuffer,Le.indexBuffer,Re,Oe.paint,Ue.transform.zoom,Le.programConfigurations.get(Oe.id),vi,xi)}function Ts(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=Le.context.gl,_i=Oe.paint.get("fill-pattern"),xi=Oe.is3D(),vi=xi?Le.stencilModeFor3D():Mi.disabled,bi=_i&&_i.constantOr(1);let Pi,Hr,Jr,Ln,Nn;Ot?(Hr=bi&&!Oe.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Pi=Jt.LINES):(Hr=bi?"fillPattern":"fill",Pi=Jt.TRIANGLES);for(const Gn of Ue){const Ue=Re.getTile(Gn);if(bi&&!Ue.patternsLoaded())continue;const qn=Ue.getBucket(Oe);if(!qn)continue;Le.prepareDrawTile();const Zn=qn.programConfigurations.get(Oe.id),$n=Le.isTileAffectedByFog(Gn),Xn=Le.getOrCreateProgram(Hr,{config:Zn,overrideFog:$n});bi&&(Le.context.activeTexture.set(Jt.TEXTURE0),Ue.imageAtlasTexture&&Ue.imageAtlasTexture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE),Zn.updatePaintBuffers());const Yn=_i.constantOr(null);if(Yn&&Ue.imageAtlas){const Le=Ue.imageAtlas.patternPositions[Yn.toString()];Le&&Zn.setConstantPatternPositions(Le)}const lo=Le.translatePosMatrix(Gn.projMatrix,Ue,Oe.paint.get("fill-translate"),Oe.paint.get("fill-translate-anchor")),uo=Oe.paint.get("fill-emissive-strength");if(Ot){Ln=qn.indexBuffer2,Nn=qn.segments2;const Re=Le.terrain&&Le.terrain.renderingToTexture?Le.terrain.drapeBufferSize:[Jt.drawingBufferWidth,Jt.drawingBufferHeight];Jr="fillOutlinePattern"===Hr&&bi?Vr(lo,uo,Le,Ue,Re):jr(lo,uo,Re)}else Ln=qn.indexBuffer,Nn=qn.segments,Jr=bi?Gr(lo,uo,Le,Ue):Ur(lo,uo);Le.uploadCommonUniforms(Le.context,Xn,Gn.toUnwrapped()),Xn.draw(Le,Pi,qe,xi?vi:Le.stencilModeForClipping(Gn),Ct,Fi.disabled,Jr,Oe.id,qn.layoutVertexBuffer,Ln,Nn,Oe.paint,Le.transform.zoom,Zn,void 0)}}function Es(Re,Oe,Ue,qe,Ct,Ot,Jt,_i){Ue.resetLayerRenderingStats(Re);const xi=Re.context,vi=xi.gl,bi=Re.transform,Pi=Ue.paint.get("fill-extrusion-pattern"),Hr=Pi.constantOr(1),Jr=Ue.paint.get("fill-extrusion-opacity"),Ln=Re.style.enable3dLights(),Nn=Ue.paint.get(Ln&&!Hr?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),Gn=[Ue.paint.get("fill-extrusion-ambient-occlusion-intensity"),Nn],qn=Ue.layout.get("fill-extrusion-edge-radius"),Zn=qn>0&&!Ue.paint.get("fill-extrusion-rounded-roof"),$n=Zn?0:qn,Xn="globe"===bi.projection.name?Le.c_():0,Yn="globe"===bi.projection.name,lo=Yn?Le.a9(bi.zoom):0,uo=[Le.am(bi.center.lng),Le.at(bi.center.lat)],po=Ue.paint.get("fill-extrusion-flood-light-color").toRenderColor(Ue.lut).toArray01().slice(0,3),fo=Ue.paint.get("fill-extrusion-flood-light-intensity"),Io=Ue.paint.get("fill-extrusion-vertical-scale"),is=0!==Ue.paint.get("fill-extrusion-line-width").constantOr(1),as=Wi(Re,Ue.paint.get("fill-extrusion-cutoff-fade-range")),Is=[];let Xs;Yn&&Is.push("PROJECTION_GLOBE_VIEW"),Gn[0]>0&&Is.push("FAUX_AO"),Zn&&Is.push("ZERO_ROOF_RADIUS"),_i&&Is.push("HAS_CENTROID"),fo>0&&Is.push("FLOOD_LIGHT"),as.shouldRenderCutoff&&Is.push("RENDER_CUTOFF"),is&&Is.push("RENDER_WALL_MODE");const ta="shadow"===Re.renderPass,ha=Re.shadowRenderer,el=ta&&!!ha;Re.shadowRenderer&&(Re.shadowRenderer.useNormalOffset=!0);let tl=[0,0,0];if(ha){const Le=Re.style.directionalLight,Oe=Re.style.ambientLight;Le&&Oe&&(tl=eo(Re.style,Le,Oe)),Xs=Is.concat(["SHADOWS_SINGLE_CASCADE"])}const il=el?"fillExtrusionDepth":Hr?"fillExtrusionPattern":"fillExtrusion",sl=Ue.getLayerRenderingStats();for(const Le of qe){const qe=Oe.getTile(Le),Ln=qe.getBucket(Ue);if(!Ln||Ln.projection.name!==bi.projection.name)continue;let Nn=!1;ha&&(Nn=0===ha.getMaxCascadeForTile(Le.toUnwrapped()));const qn=Re.isTileAffectedByFog(Le),Zn=Ln.programConfigurations.get(Ue.id),el=Re.getOrCreateProgram(il,{config:Zn,defines:Nn?Xs:Is,overrideFog:qn});if(Re.terrain&&Re.terrain.setupElevationDraw(qe,el,{useMeterToDem:!0}),!Ln.centroidVertexBuffer){const Le=el.attributes.a_centroid_pos;void 0!==Le&&vi.vertexAttrib2f(Le,0,0)}!ta&&ha&&ha.setupShadows(qe.tileID.toUnwrapped(),el,"vector-tile",qe.tileID.overscaledZ
1),Hr&&(Re.context.activeTexture.set(vi.TEXTURE0),qe.imageAtlasTexture&&qe.imageAtlasTexture.bind(vi.LINEAR,vi.CLAMP_TO_EDGE),Zn.updatePaintBuffers());const fl=Pi.constantOr(null);if(fl&&qe.imageAtlas){const Le=qe.imageAtlas.patternPositions[fl.toString()];Le&&Zn.setConstantPatternPositions(Le)}const Ml=Ue.paint.get("fill-extrusion-vertical-gradient"),Al=1/Ln.tileToMeter;let Hl;if(ta&&ha){if(As(qe.tileID,Ln,Re))continue;const Le=ha.calculateShadowPassMatrixFromTile(qe.tileID.toUnwrapped());Hl=Br(Le,$n,Al,Io)}else{const Oe=Re.translatePosMatrix(Le.expandedProjMatrix,qe,Ue.paint.get("fill-extrusion-translate"),Ue.paint.get("fill-extrusion-translate-anchor")),Ct=bi.projection.createInversionMatrix(bi,Le.canonical);Hl=Hr?Nr(Oe,Re,Ml,Jr,Gn,$n,Al,Le,qe,Xn,lo,uo,Ct,po,Io):kr(Oe,Re,Ml,Jr,Gn,$n,Al,Le,Xn,lo,uo,Ct,po,Io,fo,tl)}Re.uploadCommonUniforms(xi,el,Le.toUnwrapped(),null,as);let Wl=Ln.segments;if("mercator"===bi.projection.name&&!ta&&(Wl=Ln.getVisibleSegments(qe.tileID,Re.terrain,Re.transform.getFrustum(0)),!Wl.get().length))continue;if(sl)if(ta)for(const Le of Wl.get())sl.numRenderedVerticesInShadowPass+=Le.primitiveLength;else for(const Le of Wl.get())sl.numRenderedVerticesInTransparentPass+=Le.primitiveLength;const Jl=[];(Re.terrain||_i)&&Jl.push(Ln.centroidVertexBuffer),Yn&&Jl.push(Ln.layoutVertexExtBuffer),is&&Jl.push(Ln.wallVertexBuffer),el.draw(Re,xi.gl.TRIANGLES,Ct,Ot,Jt,Fi.backCCW,Hl,Ue.id,Ln.layoutVertexBuffer,Ln.indexBuffer,Wl,Ue.paint,Re.transform.zoom,Zn,Jl)}Re.shadowRenderer&&(Re.shadowRenderer.useNormalOffset=!1)}function Cs(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi,Hr,Jr,Ln,Nn,Gn,qn,Zn){const $n=Re.context,Xn=$n.gl,Yn=Re.transform,lo=Re.transform.zoom,uo=[],po=Wi(Re,Ue.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===vi?(uo.push("CLEAR_SUBPASS"),Zn&&(uo.push("CLEAR_FROM_TEXTURE"),$n.activeTexture.set(Xn.TEXTURE0),Zn.bind(Xn.LINEAR,Xn.CLAMP_TO_EDGE))):"sdf"===vi&&uo.push("SDF_SUBPASS"),Gn&&uo.push("HAS_CENTROID"),po.shouldRenderCutoff&&uo.push("RENDER_CUTOFF");const fo=Ue.layout.get("fill-extrusion-edge-radius"),I=(Le,Oe,qe,vi,qn)=>{const Xn=Oe.programConfigurations.get(Ue.id),Yn=Re.isTileAffectedByFog(Le),Io=Re.getOrCreateProgram("fillExtrusionGroundEffect",{config:Xn,defines:uo,overrideFog:Yn}),is=((Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi)=>({u_matrix:Re,u_opacity:Oe,u_ao_pass:Ue?1:0,u_meter_to_tile:qe,u_ao:Ct,u_flood_light_intensity:Ot,u_flood_light_color:Jt,u_attenuation:_i,u_edge_radius:xi,u_fb:0,u_fb_size:vi,u_dynamic_offset:1}))(0,vi,bi,xi,qn,[Pi,Hr*qn],Jr,Ln,Nn,lo>=17?0:fo*qn,Zn?Zn.size[0]:0),as=[];Gn&&as.push(Oe.hiddenByLandmarkVertexBuffer),Re.uploadCommonUniforms($n,Io,Le.toUnwrapped(),null,po),Io.draw(Re,$n.gl.TRIANGLES,Ct,Ot,Jt,_i,is,Ue.id,Oe.vertexBuffer,Oe.indexBuffer,qe,Ue.paint,lo,Xn,as)};for(const Ct of qe){const qe=Oe.getTile(Ct),Ot=qe.getBucket(Ue);if(!Ot||Ot.projection.name!==Yn.projection.name||!Ot.groundEffect||Ot.groundEffect&&!Ot.groundEffect.hasData())continue;const Jt=Ot.groundEffect,_i=1/Ot.tileToMeter;{const Le=Re.translatePosMatrix(Ct.projMatrix,qe,Ue.paint.get("fill-extrusion-translate"),Ue.paint.get("fill-extrusion-translate-anchor")),Oe=Jt.getDefaultSegment();I(Ct,Jt,Oe,Le,_i)}if(qn)for(let Ot=0;Ot<4;Ot++){const Jt=Le.c$[Ot](Ct),xi=Oe.getTile(Jt);if(!xi)continue;const vi=xi.getBucket(Ue);if(!vi||vi.projection.name!==Yn.projection.name||!vi.groundEffect||vi.groundEffect&&!vi.groundEffect.hasData())continue;const bi=vi.groundEffect;let Pi,Hr;0===Ot?(Pi=[-Le.ab,0,0],Hr=1):1===Ot?(Pi=[Le.ab,0,0],Hr=0):2===Ot?(Pi=[0,-Le.ab,0],Hr=3):(Pi=[0,Le.ab,0],Hr=2);const Jr=bi.regionSegments[Hr];if(!Jr)continue;const Ln=new Float32Array(16);Le.a6.mat4.translate(Ln,Ct.projMatrix,Pi),I(Ct,bi,Jr,Re.translatePosMatrix(Ln,qe,Ue.paint.get("fill-extrusion-translate"),Ue.paint.get("fill-extrusion-translate-anchor")),_i)}}}function Ss(Re,Oe,Ue,qe,Ct,Ot,Jt){0===qe.centroidVertexArray.length&&qe.createCentroidsBuffer();const _i=Ot?Ot.findDEMTileFor(Ue):null;if(!(_i&&_i.dem||Jt))return;const c=Re=>new Le.P(Math.ceil((Re+Le.d2)*Le.d3),0),h=Le=>{const Re=Oe.getSource().minzoom,o=Le=>{const Re=Oe.getTileByID(Le);if(Re&&Re.hasData())return Re.getBucket(Ct)},Ue=[0,-1,1];for(const Oe of Ue){if(Le.overscaledZ+Oe<Re)continue;const Ue=o(Le.calculateScaledKey(Le.overscaledZ+Oe));if(Ue)return Ue}},xi=[0,0,0],d=(Re,Oe)=>(xi[0]=Math.min(Re.min.y,Oe.min.y),xi[1]=Math.max(Re.max.y,Oe.max.y),xi[2]=Le.ab-Oe.min.x>Re.max.x?Oe.min.x-Le.ab:Re.max.x,xi),_=(Re,Oe)=>(xi[0]=Math.min(Re.min.x,Oe.min.x),xi[1]=Math.max(Re.max.x,Oe.max.x),xi[2]=Le.ab-Oe.min.y>Re.max.y?Oe.min.y-Le.ab:Re.max.y,xi),vi=[(Le,Re)=>d(Le,Re),(Le,Re)=>d(Re,Le),(Le,Re)=>_(Le,Re),(Le,Re)=>_(Re,Le)],m=(Re,Oe,qe,Ct,Jt,xi,vi)=>{if(!Ot)return 0;const bi=[[xi?qe:Re,xi?Re:qe,0],[xi?qe:Oe,xi?Oe:qe,0]],Pi=vi<0?Le.ab+vi:vi,Hr=[xi?Pi:(Re+Oe)/2,xi?(Re+Oe)/2:Pi,0];return 0===qe&&vi<0||0!==qe&&vi>0?Ot.getForTilePoints(Jt,[Hr],!0,Ct):bi.push(Hr),Ot.getForTilePoints(Ue,bi,!0,_i),Math.max(bi[0][2],bi[1][2],Hr[2])/Ot.exaggeration()};for(let Re=0;Re<4;Re++){const Oe=qe.borderFeatureIndices[Re];if(0===Oe.length)continue;const Ct=Le.c$[Re](Ue),_i=h(Ct);if(!(_i&&_i instanceof Le.d0))continue;
1if(qe.borderDoneWithNeighborZ[Re]===_i.canonical.z)continue;0===_i.centroidVertexArray.length&&_i.createCentroidsBuffer();const xi=Ot?Ot.findDEMTileFor(Ct):null;if(!(xi&&xi.dem||Jt))continue;const Hr=(Re<2?1:5)-Re,Jr=_i.borderDoneWithNeighborZ[Hr]!==qe.canonical.z,Ln=_i.borderFeatureIndices[Hr];let Nn=0;if(qe.canonical.z!==_i.canonical.z){for(const Le of Oe)qe.showCentroid(qe.featuresOnBorder[Le]);if(Jr)for(const Le of Ln)_i.showCentroid(_i.featuresOnBorder[Le]);qe.borderDoneWithNeighborZ[Re]=_i.canonical.z,_i.borderDoneWithNeighborZ[Hr]=qe.canonical.z}for(const Ue of Oe){const Oe=qe.featuresOnBorder[Ue],Ot=qe.centroidData[Oe.centroidDataIndex],Jr=Oe.borders[Re];let Gn;for(;Nn<Ln.length;){Gn=_i.featuresOnBorder[Ln[Nn]];const Le=Gn.borders[Hr];if(Le[1]>Jr[0]+3||Le[0]>Jr[0]-3)break;_i.showCentroid(Gn),Nn++}if(Gn&&Nn<Ln.length){const Ue=Nn;let qn=0;for(;!(Gn.borders[Hr][0]>Jr[1]-3)&&(qn++,++Nn!==Ln.length);)Gn=_i.featuresOnBorder[Ln[Nn]];Gn=_i.featuresOnBorder[Ln[Ue]];let Zn=!1;if(qn>=1){const Le=Gn.borders[Hr];Math.abs(Jr[0]-Le[0])<3&&Math.abs(Jr[1]-Le[1])<3&&(qn=1,Zn=!0,Nn=Ue+1)}else if(0===qn){qe.showCentroid(Oe);continue}const $n=_i.centroidData[Gn.centroidDataIndex];Jt&&Zn&&(((bi=Ot).flags|(Pi=$n).flags)&Le.d1?(bi.flags|=Le.d1,Pi.flags|=Le.d1):(bi.flags&=~Le.d1,Pi.flags&=~Le.d1));const Xn=Oe.intersectsCount()>1||Gn.intersectsCount()>1;if(qn>1)Nn=Ue,Ot.centroidXY=$n.centroidXY=new Le.P(0,0);else if(xi&&xi.dem&&!Xn){const Oe=vi[Re](Ot,$n),Ue=Re%2?Le.ab-1:0,qe=m(Oe[0],Math.min(Le.ab-1,Oe[1]),Ue,xi,Ct,Re<2,Oe[2]);Ot.centroidXY=$n.centroidXY=c(qe)}else Xn?Ot.centroidXY=$n.centroidXY=new Le.P(0,0):(Ot.centroidXY=qe.encodeBorderCentroid(Oe),$n.centroidXY=_i.encodeBorderCentroid(Gn));qe.writeCentroidToBuffer(Ot),_i.writeCentroidToBuffer($n)}else qe.showCentroid(Oe)}qe.borderDoneWithNeighborZ[Re]=_i.canonical.z,_i.borderDoneWithNeighborZ[Hr]=qe.canonical.z}var bi,Pi;(qe.needsCentroidUpdate||!qe.centroidVertexBuffer&&0!==qe.centroidVertexArray.length)&&qe.uploadCentroid(Re)}const _d=[1,0,0],xd=[0,1,0],wd=[0,0,1];function As(Re,Oe,Ue){const qe=Ue.transform,Ct=Ue.shadowRenderer;if(!Ct)return!0;const Ot=Re.toUnwrapped(),Jt=qe.tileSize*Ct._cascades[Ue.currentShadowCascade].scale;let _i=Oe.maxHeight;if(qe.elevation){const Le=qe.elevation.getMinMaxForTile(Re);Le&&(_i+=Le.max)}const xi=[...Ct.shadowDirection];xi[2]=-xi[2];const vi=Ct.computeSimplifiedTileShadowVolume(Ot,_i,Jt,xi);if(!vi)return!1;const bi=[_d,xd,wd,xi,[xi[0],0,xi[2]],[0,xi[1],xi[2]]],Pi="globe"===qe.projection.name,Hr=qe.scaleZoom(Jt),Jr=Le.bN.fromInvProjectionMatrix(qe.invProjMatrix,qe.worldSize,Hr,!Pi),Ln=Ct.getCurrentCascadeFrustum();return 0===Jr.intersectsPrecise(vi.vertices,vi.planes,bi)||0===Ln.intersectsPrecise(vi.vertices,vi.planes,bi)}function Ls(Re){return[Re[0]*Le.d4,Re[1]*Le.d4,Re[2]*Le.d4,0]}function Ps(Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi){const vi=qe.getSource(),bi=Ue.globeSharedBuffers;if(!bi)return;let Pi,Hr,Jr;if(Oe&&(Pi=qe.getTile(Oe)),vi instanceof Le.aD?(Hr=vi.texture,Jr=Le.cD(0,0,Ue.transform)):Pi&&Oe&&(Hr=Pi.texture,Jr=Le.cD(Oe.canonical.z,Oe.canonical.x,Ue.transform)),!Hr||!Jr)return;Re||(Jr=Le.a6.mat4.scale(Le.a6.mat4.create(),Jr,[1,-1,1]));const Ln=Ue.context,Nn=Ln.gl,Gn="nearest"===Ct.paint.get("raster-resampling")?Nn.NEAREST:Nn.LINEAR,qn=Ue.colorModeForDrapableLayerRenderPass(Ot),Zn=Jt.defines;Zn.push("GLOBE_POLES");const $n=new Li(Nn.LEQUAL,Li.ReadWrite,Ue.depthRangeFor3D),Xn=Float32Array.from(Ue.transform.expandedFarZProjMatrix),Yn=Float32Array.from(Le.b5(Le.cC(new Le.bP(0,0,0))));Ue.terrain&&Ue.terrain.prepareDrawTile(),Ln.activeTexture.set(Nn.TEXTURE0),Hr.bind(Gn,Nn.CLAMP_TO_EDGE),Ln.activeTexture.set(Nn.TEXTURE1),Hr.bind(Gn,Nn.CLAMP_TO_EDGE),Hr.useMipmap&&Ln.extTextureFilterAnisotropic&&Ue.transform.pitch>20&&Nn.texParameterf(Nn.TEXTURE_2D,Ln.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Ln.extTextureFilterAnisotropicMax);const[lo,uo,po,fo]=Oe?bi.getPoleBuffers(Oe.canonical.z,!1):bi.getPoleBuffers(0,!0),Io=Ct.paint.get("raster-elevation");let is;Re?(is=lo,Ue.renderDefaultNorthPole=0!==Io):(is=uo,Ue.renderDefaultSouthPole=0!==Io);const as=Ls(Jt.mix),Is=((Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi)=>Yr(Le,Re,Oe,new Float32Array(16),new Float32Array(9),[0,0],Ue,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ct,[0,0]||[0,0],Jt,2,xi,vi,bi,1,0,Pi))(Xn,Yn,Jr,Le.a9(Ue.transform.zoom),0,Ct,0,Io,0,as,Jt.offset,Jt.range,Ot),Xs=Ue.getOrCreateProgram("raster",{defines:Zn});Ue.uploadCommonUniforms(Ln,Xs,null),Xs.draw(Ue,Nn.TRIANGLES,$n,xi,qn,_i,Is,Ct.id,is,po,fo)}function Ms(Le){const Re=Le._nearZ,Oe=Le.projection.farthestPixelDistance(Le),Ue=Oe-Re,qe=.2*Le.height,Ct=Re+qe;return[Re,Oe,(Ct-qe-Re)/Ue,(Ct-Re)/Ue]}function zs(Le,Re,Oe,Ue){if(Le)return Re instanceof Qe&&Le instanceof mt?Re.getTextureDescriptor(Le,Oe,!0):{texture:Le.texture,mix:Ls(Ue.mix),offset:Ue.offset,buffer:0,tileSize:1}}var Md=Le.d5([{name:"a_index",type:"Int16",components:1}]);class Fs{constructor(Re,Oe,Ue,qe){const Ct={width:Ue[0],height:Ue[1],data:null},Ot=Re.gl;this.targetColorTexture=new Le.T(Re,Ct,Ot.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new Le.T(Re,Ct,Ot.RGBA8,{useMipmap:!1}),this.context=Re,this.updateParticleTexture(Oe,qe),this.lastInvalidatedAt=0}updateParticleTexture(Re,Oe){if(this.particleTextureDimension===Oe.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const Ue=this.context.gl,qe=Oe.width*Oe.height;this.particleTexture0=new Le.T(this.context,Oe,Ue.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new Le.T(this.context,Oe,Ue.RGBA8,{premultiply:!1,useMipmap:!1});const Ct=new Le.d6;Ct.reserve(qe);for(let Le=0;Le<qe;Le++)Ct.emplaceBack(Le);this.particleIndexBuffer=this.context.createVertexBuffer(Ct,Md.members,!0),this.particleSegment=Le.b1.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=Oe.width}update(Re){return!(this.lastInvalidatedAt<Re&&(this.lastInvalidatedAt=Le.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function ks(Re,Oe,Ue){if(!Re)return null;const qe=Oe.getTextureDescriptor(Re,Ue,!0);if(!qe)return null;let{texture:Ct,mix:Ot,offset:Jt,tileSize:_i,buffer:xi,format:vi}=qe;if(!Ct||!vi)return null;let bi=!1;return"uint32"===vi&&(bi=!0,Ot[3]=0,Ot=$r(Le.d7,Ot,[0,Ue.paint.get("raster-particle-max-speed")]),Jt=Xr(Le.d7,Jt,[0,Ue.paint.get("raster-particle-max-speed")])),{texture:Ct,textureOffset:[xi/(_i+2*xi),_i/(_i+2*xi)],tileSize:_i,scalarData:bi,scale:Ot,offset:Jt,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[vi]]}}function Bs(Le){const Re=Le._nearZ,Oe=Le.projection.farthestPixelDistance(Le),Ue=Oe-Re,qe=.2*Le.height,Ct=Re+qe;return[Re,Oe,(Ct-qe-Re)/Ue,(Ct-Re)/Ue]}const Sd=new Le.bz(1,0,0,1),Ad=new Le.bz(0,1,0,1),Cd=new Le.bz(0,0,1,1),zd=new Le.bz(1,0,1,1),Od=new Le.bz(0,1,1,1);function qs(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Re.context,xi=Re.transform,vi=_i.gl,bi="globe"===xi.projection.name,Pi=bi?["PROJECTION_GLOBE_VIEW"]:[];let Hr=Le.a6.mat4.clone(Ue.projMatrix);if(bi&&Le.a9(xi.zoom)>0){const Re=Le.b4(Ue.canonical,xi),Oe=Le.d8(Re);Hr=Le.a6.mat4.multiply(new Float32Array(16),xi.globeMatrix,Oe),Le.a6.mat4.multiply(Hr,xi.projMatrix,Hr)}const Jr=Le.a6.mat4.create();Jr[12]+=2*Ct/(Le.q.devicePixelRatio*xi.width),Jr[13]+=2*Ot/(Le.q.devicePixelRatio*xi.height),Le.a6.mat4.multiply(Hr,Jr,Hr);const Ln=Re.getOrCreateProgram("debug",{defines:Pi}),Nn=Oe.getTileByID(Ue.key);Re.terrain&&Re.terrain.setupElevationDraw(Nn,Ln);const Gn=Li.disabled,qn=Mi.disabled,Zn=Re.colorModeForRenderPass(),$n="$debug";_i.activeTexture.set(vi.TEXTURE0),Re.emptyTexture.bind(vi.LINEAR,vi.CLAMP_TO_EDGE),bi?Nn._makeGlobeTileDebugBuffers(Re.context,xi):Nn._makeDebugTileBoundsBuffers(Re.context,xi.projection);const Xn=Nn._tileDebugBuffer||Re.debugBuffer,Yn=Nn._tileDebugIndexBuffer||Re.debugIndexBuffer,lo=Nn._tileDebugSegments||Re.debugSegments;if(Ln.draw(Re,vi.LINE_STRIP,Gn,qn,Zn,Fi.disabled,Zr(Hr,qe),$n,Xn,Yn,lo,null,
1null,null,[Nn._globeTileDebugBorderBuffer]),Jt){const Le=Nn.latestRawTileData,Oe=Math.floor((Le&&Le.byteLength||0)/1024);let qe=Ue.canonical.toString();Ue.overscaledZ!==Ue.canonical.z&&(qe+=` => ${Ue.overscaledZ}`),qe+=` ${Nn.state}`,qe+=` ${Oe}kb`,function(Le,Re){Le.initDebugOverlayCanvas();const Oe=Le.debugOverlayCanvas,Ue=Le.context.gl,qe=Le.debugOverlayCanvas.getContext("2d");qe.clearRect(0,0,Oe.width,Oe.height),qe.shadowColor="white",qe.shadowBlur=2,qe.lineWidth=1.5,qe.strokeStyle="white",qe.textBaseline="top",qe.font="bold 36px Open Sans, sans-serif",qe.fillText(Re,5,5),qe.strokeText(Re,5,5),Le.debugOverlayTexture.update(Oe),Le.debugOverlayTexture.bind(Ue.LINEAR,Ue.CLAMP_TO_EDGE)}(Re,qe)}const uo=Oe.getTile(Ue).tileSize,po=512/Math.min(uo,512)*(Ue.overscaledZ/xi.zoom)*.5,fo=Nn._tileDebugTextBuffer||Re.debugBuffer,Io=Nn._tileDebugTextIndexBuffer||Re.quadTriangleIndexBuffer,is=Nn._tileDebugTextSegments||Re.debugSegments;Ln.draw(Re,vi.TRIANGLES,Gn,qn,Ai.alphaBlended,Fi.disabled,Zr(Hr,Le.bz.transparent,po),$n,fo,Io,is,null,null,null,[Nn._globeTileDebugTextBuffer])}function Zs(Le,Re,Oe,Ue){Ws(Le,0,Re+Oe/2,Le.transform.width,Oe,Ue)}function Hs(Le,Re,Oe,Ue){Ws(Le,Re-Oe/2,0,Oe,Le.transform.height,Ue)}function Ws(Re,Oe,Ue,qe,Ct,Ot){const Jt=Re.context,_i=Jt.gl;_i.enable(_i.SCISSOR_TEST),_i.scissor(Oe*Le.q.devicePixelRatio,Ue*Le.q.devicePixelRatio,qe*Le.q.devicePixelRatio,Ct*Le.q.devicePixelRatio),Jt.clear({color:Ot}),_i.disable(_i.SCISSOR_TEST)}const Bd=Le.d5([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Ud}=Bd;function Ys(Le,Re,Oe,Ue){Le.emplaceBack(Re,Oe,Ue)}class Ks{constructor(Re){this.vertexArray=new Le.d9,this.indices=new Le.aO,Ys(this.vertexArray,-1,-1,1),Ys(this.vertexArray,1,-1,1),Ys(this.vertexArray,-1,1,1),Ys(this.vertexArray,1,1,1),Ys(this.vertexArray,-1,-1,-1),Ys(this.vertexArray,1,-1,-1),Ys(this.vertexArray,-1,1,-1),Ys(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=Re.createVertexBuffer(this.vertexArray,Ud),this.indexBuffer=Re.createIndexBuffer(this.indices),this.segment=Le.b1.simpleSegment(0,0,36,12)}}function Js(Re,Oe,Ue,qe,Ct,Ot){const Jt=Re.context.gl,_i=Oe.paint.get("sky-atmosphere-color"),xi=Oe.paint.get("sky-atmosphere-halo-color"),vi=Oe.paint.get("sky-atmosphere-sun-intensity"),bi=((Le,Re,Oe,Ue,qe)=>({u_matrix_3f:Le,u_sun_direction:Re,u_sun_intensity:Oe,u_color_tint_r:[Ue.r,Ue.g,Ue.b,Ue.a],u_color_tint_m:[qe.r,qe.g,qe.b,qe.a],u_luminance:5e-5}))(Le.a6.mat3.fromMat4(Le.a6.mat3.create(),qe),Ct,vi,_i,xi);Jt.framebufferTexture2D(Jt.FRAMEBUFFER,Jt.COLOR_ATTACHMENT0,Jt.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,Oe.skyboxTexture,0),Ue.draw(Re,Jt.TRIANGLES,Li.disabled,Mi.disabled,Ai.unblended,Fi.frontCW,bi,"skyboxCapture",Oe.skyboxGeometry.vertexBuffer,Oe.skyboxGeometry.indexBuffer,Oe.skyboxGeometry.segment)}const Hd=Le.d5([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class ea{constructor(Re){const Oe=new Le.da;Oe.emplaceBack(-1,1,1,0,0),Oe.emplaceBack(1,1,1,1,0),Oe.emplaceBack(1,-1,1,1,1),Oe.emplaceBack(-1,-1,1,0,1);const Ue=new Le.aO;Ue.emplaceBack(0,1,2),Ue.emplaceBack(2,3,0),this.vertexBuffer=Re.createVertexBuffer(Oe,Hd.members),this.indexBuffer=Re.createIndexBuffer(Ue),this.segments=Le.b1.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Wd=Le.d5([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class ia{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class oa{constructor(Re){this.colorModeAlphaBlendedWriteRGB=new Ai([1,Jc,1,Jc],Le.bz.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Ai([1,0,1,0],Le.bz.transparent,[!1,!1,!1,!0]),this.params=new ia,this.updateNeeded=!0,Re.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0})),Re.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),Re.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0})),Re.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0}))}update(Re){const Oe=Re.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new ea(Oe);const Re=this.params.sizeRange,Ue=this.params.intensityRange,qe=function(Re){const Oe=Le.dd(30),Ue=[];for(let qe=0;qe<Re;++qe){const Re=2*Math.PI*Oe(),qe=Math.acos(1-2*Oe())-.5*Math.PI;Ue.push(Le.a6.vec3.fromValues(Math.cos(qe)*Math.cos(Re),Math.cos(qe)*Math.sin(Re),Math.sin(qe)))}return Ue}(this.params.starsCount),Ct=Le.dd(300),Ot=new Le.db,Jt=new Le.aO;let _i=0;for(let Oe=0;Oe<qe.length;++Oe){const xi=Le.a6.vec3.scale([],qe[Oe],200),vi=Math.max(0,1+.01*Re*(1*Ct()-.5)),bi=Math.max(0,1+.01*Ue*(1*Ct()-.5));Ot.emplaceBack(xi[0],xi[1],xi[2],-1,-1,vi,bi),Ot.emplaceBack(xi[0],xi[1],xi[2],1,-1,vi,bi),Ot.emplaceBack(xi[0],xi[1],xi[2],1,1,vi,bi),Ot.emplaceBack(xi[0],xi[1],xi[2],-1,1,vi,bi),Jt.emplaceBack(_i+0,_i+1,_i+2),Jt.emplaceBack(_i+0,_i+2,_i+3),_i+=4}this.starsVx=Oe.createVertexBuffer(Ot,Wd.members),this.starsIdx=Oe.createIndexBuffer(Jt),this.starsSegments=Le.b1.simpleSegment(0,0,Ot.length,Jt.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(Re,Oe){const Ue=Re.context,qe=Ue.gl,Ct=Re.transform,Ot=new Li(qe.LEQUAL,Li.ReadOnly,[0,1]),Jt=Le.a9(Ct.zoom),_i=Re.style.getLut(Oe.scope),xi=Oe.properties.get("color").toRenderColor(_i).toArray01(),vi=Oe.properties.get("high-color").toRenderColor(_i).toArray01(),bi=Oe.properties.get("space-color").toRenderColor(_i).toArray01PremultipliedAlpha(),Pi=5e-4,Hr=Le.dc(Oe.properties.get("horizon-blend"),0,1,Pi,.25),Jr=Le.cx(Re,Ue,Ct)&&Hr===Pi?Ct.worldSize/(2*Math.PI*1.025)-1:Ct.globeRadius,Ln=Re.frameCounter/1e3%1,Nn=Le.a6.vec3.length(Ct.globeCenterInViewSpace),Gn=Math.sqrt(Math.pow(Nn,2)-Math.pow(Jr,2)),qn=Math.acos(Gn/Nn),x=Le=>{const Oe="globe"===Ct.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Le&&Oe.push("ALPHA_PASS");const _i=Re.getOrCreateProgram("globeAtmosphere",{defines:Oe}),Pi=((Le,Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi)=>({u_frustum_tl:Le,u_frustum_tr:Re,u_frustum_br:Oe,u_frustum_bl:Ue,u_horizon:qe,u_transition:Ct,u_fadeout_range:Ot,u_color:Jt,u_high_color:_i,u_space_color:xi,u_temporal_offset:vi,u_horizon_angle:bi}))(Ct.frustumCorners.TL,Ct.frustumCorners.TR,Ct.frustumCorners.BR,Ct.frustumCorners.BL,Ct.frustumCorners.horizon,Jt,Hr,xi,vi,bi,Ln,qn);Re.uploadCommonUniforms(Ue,_i);const Jr=this.atmosphereBuffer;Jr&&_i.draw(Re,qe.TRIANGLES,Ot,Mi.disabled,Le?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Fi.backCW,Pi,Le?"atmosphere_glow_alpha":"atmosphere_glow",Jr.vertexBuffer,Jr.indexBuffer,Jr.segments)};x(!1),x(!0)}drawStars(Re,Oe){const Ue=Le.ap(Oe.properties.get("star-intensity"),0,1);if(0===Ue)return;const qe=Re.context,Ct=qe.gl,Ot=Re.transform,Jt=Re.getOrCreateProgram("stars"),_i=Le.a6.quat.identity([]);Le.a6.quat.rotateX(_i,_i,-Ot._pitch),Le.a6.quat.rotateZ(_i,_i,-Ot.angle),Le.a6.quat.rotateX(_i,_i,Le.bB(Ot._center.lat)),Le.a6.quat.rotateY(_i,_i,-Le.bB(Ot._center.lng));const xi=Le.a6.mat4.fromQuat(new Float32Array(16),_i),vi=Le.a6.mat4.multiply([],Ot.starsProjMatrix,xi),bi=Le.a6.mat3.fromMat4([],xi),Pi=Le.a6.mat3.invert([],bi),Hr=[0,1,0];Le.a6.vec3.transformMat3(Hr,Hr,Pi),Le.a6.vec3.scale(Hr,Hr,this.params.sizeMultiplier);const Jr=[1,0,0];Le.a6.vec3.transformMat3(Jr,Jr,Pi),Le.a6.vec3.scale(Jr,Jr,this.params.sizeMultiplier);const Ln=(Nn=Hr,Gn=Jr,qn=Ue,{u_matrix:Float32Array.from(vi),u_up:Nn,u_right:Gn,u_intensity_multiplier:qn});var Nn,Gn,qn;Re.uploadCommonUniforms(qe,Jt),this.starsVx&&this.starsIdx&&Jt.draw(Re,Ct.TRIANGLES,Li.disabled,Mi.disabled,this.colorModeAlphaBlendedWriteRGB,Fi.disabled,Ln,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function ra(Re,Oe){const Ue=[...Re],qe=Oe.cameraWorldSizeForFog/Oe.worldSize,Ct=Le.a6.mat4.identity([]);return Le.a6.mat4.scale(Ct,Ct,[qe,qe,1]),Le.a6.mat4.multiply(Ue,Ct,Ue),Le.a6.mat4.multiply(Ue,Oe.worldToFogMatrix,Ue),Ue}function sa(Re,Oe,Ue,qe,Ct){const Ot=Ue.material,Jt=qe.context,{baseColorTexture:_i,metallicRoughnessTexture:xi}=Ot.pbrMetallicRoughness,{normalTexture:vi,occlusionTexture:bi,emissionTexture:Pi}=Ot;function _(Le,Oe,Ue){if(Le&&(Re.push(Oe),Jt.activeTexture.set(Jt.gl.TEXTURE0+Ue),Le.gfxTexture)){const{minFilter:Re,magFilter:Oe,wrapS:Ue,wrapT:qe}=Le.sampler;Le.gfxTexture.bindExtraParam(Re,Oe,Ue,qe)}}_(_i,"HAS_TEXTURE_u_baseColorTexture",th.BaseColor),_(xi,"HAS_TEXTURE_u_metallicRoughnessTexture",th.MetallicRoughness),_(vi,"HAS_TEXTURE_u_normalTexture",th.Normal),_(bi,"HAS_TEXTURE_u_occlusionTexture",th.Occlusion),_(Pi,"HAS_TEXTURE_u_emissionTexture",th.Emission),Ct&&(Ct.texture||(Ct.texture=new Le.df(qe.context,Ct.image,[Ct.image.height,Ct.image.height,Ct.image.height],Jt.gl.RGBA8)),Jt.activeTexture.set(Jt.gl.TEXTURE0+th.LUT),Ct.texture&&Ct.texture.bind(Jt.gl.LINEAR,Jt.gl.CLAMP_TO_EDGE),Re.push("APPLY_LUT_ON_GPU")),Ue.texcoordBuffer&&(Re.push("HAS_ATTRIBUTE_a_uv_2f"),Oe.push(Ue.texcoordBuffer)),Ue.colorBuffer&&(Re.push(12===Ue.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),Oe.push(Ue.colorBuffer)),Ue.normalBuffer&&(Re.push("HAS_ATTRIBUTE_a_normal_3f"),Oe.push(Ue.normalBuffer)),Ue.pbrBuffer&&(Re.push("HAS_ATTRIBUTE_a_pbr"),Re.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),Oe.push(Ue.pbrBuffer)),"OPAQUE"!==Ot.alphaMode&&"MASK"!==Ot.alphaMode||Re.push("UNPREMULT_TEXTURE_IN_SHADER"),Ot.defined||Re.push("DIFFUSE_SHADED"),Re.push("USE_STANDARD_DERIVATIVES")}function aa(Re,Oe,Ue,qe,Ct,Ot){const Jt=Ue.paint.get("model-opacity"),_i=Oe.context,xi=new Li(Oe.context.gl.LEQUAL,Li.ReadWrite,Oe.depthRangeFor3D),vi=Oe.transform,bi=Re.mesh,Pi=bi.material,Hr=Pi.pbrMetallicRoughness,Jr=Oe.style.fog;let Ln;Ln="pixels"===Oe.transform.projection.zAxisUnit?[...Re.nodeModelMatrix]:Le.a6.mat4.multiply([],qe.zScaleMatrix,Re.nodeModelMatrix),Le.a6.mat4.multiply(Ln,qe.negCameraPosMatrix,Ln);const Nn=Le.a6.mat4.invert([],Ln);Le.a6.mat4.transpose(Nn,Nn);const Gn=Ue.paint.get("model-emissive-strength").constantOr(0),qn=ns(new Float32Array(Re.worldViewProjection),new Float32Array(Ln),new Float32Array(Nn),null,Oe,Jt,Hr.baseColorFactor.toRenderColor(null),Pi.emissiveFactor,Hr.metallicFactor,Hr.roughnessFactor,Pi,Gn,Ue),Zn={defines:[]},$n=[];sa(Zn.defines,$n,bi,Oe,Ue.lut);const Xn=Oe.shadowRenderer;Xn&&(Xn.useNormalOffset=!1);let Yn=null;if(Jr){const Le=ra(Re.nodeModelMatrix,Oe.transform);if(Yn=new Float32Array(Le),"globe"!==vi.projection.name){const Re=bi.aabb.min,Oe=bi.aabb.max,[Ue,qe]=Jr.getOpacityForBounds(Le,Re[0],Re[1],Oe[0],Oe[1]);Zn.overrideFog=Ue>=ta||qe>=ta}}const lo=Wi(Oe,Ue.paint.get("model-cutoff-fade-range"));lo.shouldRenderCutoff&&Zn.defines.push("RENDER_CUTOFF");const uo=Oe.getOrCreateProgram("model",Zn);Oe.uploadCommonUniforms(_i,uo,null,Yn,lo),"shadow"!==Oe.renderPass&&Xn&&Xn.setupShadowsFromMatr
1ix(Re.nodeModelMatrix,uo),uo.draw(Oe,_i.gl.TRIANGLES,xi,Ct,Ot,bi.material.doubleSided?Fi.disabled:Fi.backCCW,qn,Ue.id,bi.vertexBuffer,bi.indexBuffer,bi.segments,Ue.paint,Oe.transform.zoom,void 0,$n)}function na(Re,Oe,Ue,qe,Ct,Ot,Jt){let _i;_i="globe"===Re.projection.name?Le.dg(Ue,Re):[...Ue],Le.a6.mat4.multiply(_i,_i,Oe.matrix);const xi=Le.a6.mat4.multiply([],qe,_i);if(Oe.meshes)for(const Re of Oe.meshes){if("BLEND"!==Re.material.alphaMode){Jt.push({mesh:Re,depth:0,modelIndex:Ct,worldViewProjection:xi,nodeModelMatrix:_i});continue}const Oe=Le.a6.vec3.transformMat4([],Re.centroid,xi);Oe[2]>0&&Ot.push({mesh:Re,depth:Oe[2],modelIndex:Ct,worldViewProjection:xi,nodeModelMatrix:_i})}if(Oe.children)for(const Le of Oe.children)na(Re,Le,Ue,qe,Ct,Ot,Jt)}function la(Le,Re,Oe,Ue){const qe=Oe.shadowRenderer;if(!qe)return;const Ct=qe.getShadowPassDepthMode(),Ot=qe.getShadowPassColorMode(),Jt=qe.calculateShadowPassMatrixFromMatrix(Re),_i=ls(Jt);Oe.getOrCreateProgram("modelDepth",{defines:Oe._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(Oe,Oe.context.gl.TRIANGLES,Ct,Mi.disabled,Ot,Fi.backCCW,_i,Ue.id,Le.vertexBuffer,Le.indexBuffer,Le.segments,Ue.paint,Oe.transform.zoom,void 0,void 0)}function ca(Re,Oe,Ue){const qe=Oe.updateZoomBasedPaintProperties(),Ct=function(Re,Oe,Ue){let qe,Ct,Ot,Jt=Re.terrain?Re.terrain.exaggeration():0;if(Re.terrain&&Jt>0){const Oe=Re.terrain,Ct=Oe.findDEMTileFor(Ue);Ct&&Ct.dem?qe=Le.di.create(Oe,Ue,Ct):Jt=0}if(0===Jt&&(Oe.terrainElevationMin=0,Oe.terrainElevationMax=0),Jt===Oe.validForExaggeration&&(0===Jt||qe&&qe._demTile&&qe._demTile.tileID===Oe.validForDEMTile.id&&qe._dem._timestamp===Oe.validForDEMTile.timestamp))return!1;for(const Le in Oe.instancesPerModel){const Re=Oe.instancesPerModel[Le];for(let Le=0;Le<Re.instancedDataArray.length;++Le){const Ue=(qe?Jt*qe.getElevationAt(0|Re.instancedDataArray.float32[16*Le],0|Re.instancedDataArray.float32[16*Le+1],!0,!0):0)+Re.instancesEvaluatedElevation[Le];Re.instancedDataArray.float32[16*Le+6]=Ue,Ct=Ct?Math.min(Oe.terrainElevationMin,Ue):Ue,Ot=Ot?Math.max(Oe.terrainElevationMax,Ue):Ue}}return Oe.terrainElevationMin=Ct||0,Oe.terrainElevationMax=Ot||0,Oe.validForExaggeration=Jt,Oe.validForDEMTile=qe&&qe._demTile?{id:qe._demTile.tileID,timestamp:qe._dem._timestamp}:{id:void 0,timestamp:0},!0}(Re,Oe,Ue);(qe||Ct)&&(Oe.uploaded=!1,Oe.upload(Re.context))}const Kd={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new Le.c9([0,0,0],[Le.ab,Le.ab,0])};function ua(Re,Oe){const Ue=1<<Re.canonical.z,qe=Oe.getFreeCameraOptions().position,Ct=Oe.elevation,Ot=Re.canonical.x/Ue,Jt=(Re.canonical.x+1)/Ue,_i=Re.canonical.y/Ue,xi=(Re.canonical.y+1)/Ue;let vi=Oe._centerAltitude;if(Ct){const Le=Ct.getMinMaxForTile(Re);Le&&Le.max>vi&&(vi=Le.max)}const bi=Le.ap(qe.x,Ot,Jt)-qe.x,Pi=Le.ap(qe.y,_i,xi)-qe.y,Hr=Le.bD(vi,Oe.center.lat)-qe.z;return Oe._zoomFromMercatorZ(Math.sqrt(bi*bi+Pi*Pi+Hr*Hr))}function da(Le,Re,Oe,Ue,qe,Ct,Ot){const Jt=Le.context,_i="shadow"===Le.renderPass,xi=Le.shadowRenderer,vi=_i&&xi?xi.getShadowPassDepthMode():new Li(Jt.gl.LEQUAL,Li.ReadWrite,Le.depthRangeFor3D),bi=Le.isTileAffectedByFog(Ct);if(Oe.meshes)for(const Pi of Oe.meshes){const Hr=["MODEL_POSITION_ON_GPU"],Jr=[];let Ln,Nn,Gn;Ue.instancedDataArray.length>20&&Hr.push("INSTANCED_ARRAYS");const qn=Wi(Le,Re.paint.get("model-cutoff-fade-range"));if(qn.shouldRenderCutoff&&Hr.push("RENDER_CUTOFF"),_i&&xi)Ln=Le.getOrCreateProgram("modelDepth",{defines:Hr}),Nn=ls(Ot.shadowTileMatrix,Ot.shadowTileMatrix,Float32Array.from(Oe.matrix)),Gn=xi.getShadowPassColorMode();else{sa(Hr,Jr,Pi,Le,Re.lut),Ln=Le.getOrCreateProgram("model",{defines:Hr,overrideFog:bi});const Ue=Pi.material,_i=Ue.pbrMetallicRoughness,vi=Re.paint.get("model-opacity"),Zn=Re.paint.get("model-emissive-strength").constantOr(0);Nn=ns(Ct.expandedProjMatrix,Float32Array.from(Oe.matrix),new Float32Array(16),null,Le,vi,_i.baseColorFactor.toRenderColor(null),Ue.emissiveFactor,_i.metallicFactor,_i.roughnessFactor,Ue,Zn,Re,qe),xi&&(Ot.shadowUniformsInitialized?Ln.setShadowUniformValues(Jt,xi.get
1ShadowUniformValues()):(xi.setupShadows(Ct.toUnwrapped(),Ln,"model-tile",Ct.overscaledZ),Ot.shadowUniformsInitialized=!0)),Gn=qn.shouldRenderCutoff||vi<1||"OPAQUE"!==Ue.alphaMode?Ai.alphaBlended:Ai.unblended}Le.uploadCommonUniforms(Jt,Ln,Ct.toUnwrapped(),null,qn);const Zn=Pi.material.doubleSided?Fi.disabled:Fi.backCCW;if(Ue.instancedDataArray.length>20)Jr.push(Ue.instancedDataBuffer),Ln.draw(Le,Jt.gl.TRIANGLES,vi,Mi.disabled,Gn,Zn,Nn,Re.id,Pi.vertexBuffer,Pi.indexBuffer,Pi.segments,Re.paint,Le.transform.zoom,void 0,Jr,Ue.instancedDataArray.length);else{const Oe=_i?"u_instance":"u_normal_matrix";for(let qe=0;qe<Ue.instancedDataArray.length;++qe)Nn[Oe]=new Float32Array(Ue.instancedDataArray.arrayBuffer,64*qe,16),Ln.draw(Le,Jt.gl.TRIANGLES,vi,Mi.disabled,Gn,Zn,Nn,Re.id,Pi.vertexBuffer,Pi.indexBuffer,Pi.segments,Re.paint,Le.transform.zoom,void 0,Jr)}}if(Oe.children)for(const Jt of Oe.children)da(Le,Re,Jt,Ue,qe,Ct,Ot)}const sp=[1,-1,1];function pa(Re,Oe,Ue,qe){if(!Ue.modelManager)return!0;const Ct=Ue.modelManager;if(!Ue.shadowRenderer)return!0;const Ot=Ue.shadowRenderer,Jt=Oe.aabb;let _i=!0,xi=Re.maxHeight;if(0===xi){let Le=0;for(const Oe in Re.instancesPerModel){const Re=Ct.getModel(Oe,qe);Re?Le=Math.max(Le,Math.max(Math.max(Re.aabb.max[0],Re.aabb.max[1]),Re.aabb.max[2])):_i=!1}xi=Re.maxScale*Le*1.41+Re.maxVerticalOffset,_i&&(Re.maxHeight=xi)}Jt.max[2]=xi,Jt.min[2]+=Re.terrainElevationMin,Jt.max[2]+=Re.terrainElevationMax,Le.a6.vec3.transformMat4(Jt.min,Jt.min,Oe.tileMatrix),Le.a6.vec3.transformMat4(Jt.max,Jt.max,Oe.tileMatrix);const vi=Jt.intersects(Ot.getCurrentCascadeFrustum());return 0===Ue.currentShadowCascade&&(Re.isInsideFirstShadowMapFrustum=2===vi),0===vi}function ma(Re,Oe){const Ue=Re.uniformValues.u_cutoff_params[0],qe=Re.uniformValues.u_cutoff_params[1],Ct=Re.uniformValues.u_cutoff_params[2],Ot=Re.uniformValues.u_cutoff_params[3];return qe===Ue||Ot===Ct?1:Le.ap(((Oe-Ue)/(qe-Ue)-Ct)/(Ot-Ct),0,1)}function fa(Re,Oe,Ue,qe){if(Oe.pitch<20)return 1;const Ct=Oe.getWorldToCameraMatrix();Le.a6.mat4.multiply(Ct,Ct,Re);const Ot=Le.a6.vec4.fromValues(Ue.min[0],Ue.min[1],Ue.min[2],1);let Jt=Le.a6.vec4.transformMat4(Le.a6.vec4.create(),Ot,Ct),_i=Jt,xi=Jt;Ot[1]=Ue.max[1],Jt=Le.a6.vec4.transformMat4(Le.a6.vec4.create(),Ot,Ct),_i=Jt[1]<_i[1]?Jt:_i,xi=Jt[1]>xi[1]?Jt:xi,Ot[0]=Ue.max[0],Jt=Le.a6.vec4.transformMat4(Le.a6.vec4.create(),Ot,Ct),_i=Jt[1]<_i[1]?Jt:_i,xi=Jt[1]>xi[1]?Jt:xi,Ot[1]=Ue.min[1],Jt=Le.a6.vec4.transformMat4(Le.a6.vec4.create(),Ot,Ct),_i=Jt[1]<_i[1]?Jt:_i,xi=Jt[1]>xi[1]?Jt:xi;const vi=Le.ap(qe[0],0,1),bi=100*Oe.pixelsPerMeter*Le.ap(qe[1],0,1),Pi=Le.ap(qe[2],0,1),Hr=Le.a6.vec4.lerp(Le.a6.vec4.create(),_i,xi,vi),Jr=Math.tan(.5*Oe.fovX),Ln=-Hr[2]*Jr;if(0===bi)return Hr[1]<-Math.abs(Ln)?Pi:1;const Nn=(-Math.abs(Ln)-Hr[1])/bi,g=(Le,Re,Oe)=>(1-Oe)*Le+Oe*Re,Gn=Le.ap(g(1,Pi,Nn),Pi,1);return g(1,Gn,Le.ap((Oe.pitch-20)/20,0,1))}class ga{}class va{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(Re,Oe,Ue){{const Le=this._storage.get(Oe.id);if(Le)return Le.lastUsedFrameIdx=Re,Le.buf}const qe=Ue.gl,Ct=qe.getBufferParameter(qe.ELEMENT_ARRAY_BUFFER,qe.BUFFER_SIZE),Ot=new ArrayBuffer(Ct),Jt=new Int16Array(Ot);qe.getBufferSubData(qe.ELEMENT_ARRAY_BUFFER,0,new Int16Array(Ot));const _i=new Le.dk;for(let Le=0;Le<Ct/2;Le+=3){const Re=Jt[Le],Oe=Jt[Le+1],Ue=Jt[Le+2];_i.emplaceBack(Re,Oe),_i.emplaceBack(Oe,Ue),_i.emplaceBack(Ue,Re)}const xi=Ue.bindVertexArrayOES.current,vi=new ga;return vi.buf=new hs(Ue,_i),vi.lastUsedFrameIdx=Re,this._storage.set(Oe.id,vi),Ue.bindVertexArrayOES.set(xi),vi.buf}update(Le){for(const[Re,Oe]of this._storage)Le-Oe.lastUsedFrameIdx>30&&(Oe.buf.destroy(),this._storage.delete(Re))}destroy(){for(const[Le,Re]of this._storage)Re.buf.destroy(),this._storage.delete(Le)}}class xa{constructor(Le){this.occluderSize=30,this.depthOffset=-1e-4,Le.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),Le.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const ap={symbol:function(Re,Oe,Ue,qe,Ct){if("translucent"!==Re.renderPass)return;const Ot=Mi.disabled,Jt=Re.colorModeForRenderPass();Ue.layout.get("text-variable-anchor")&&function(Re,Oe,Ue,qe,Ct,Ot,Jt){const _i=Oe.transform,xi="map"===Ct,vi="map"===Ot;for(const Oe of Re){const Re=qe.getTile(Oe),Ct=Re.getBucket(Ue);if(!Ct||!Ct.text||!Ct.text.segments.get().length)continue;const Ot=Le.bj(Ct.textSizeData,_i.zoom),bi=ii(Oe,Ct.getProjection(),_i),Pi=_i.calculatePixelsToTileUnitsMatrix(Re),Hr=kt(bi,Re.tileID.canonical,vi,xi,_i,Ct.getProjection(),Pi),Jr=Ct.hasIconTextFit()&&Ct.hasIconData();
1if(Ot){const Ue=Math.pow(2,_i.zoom-Re.tileID.overscaledZ);ys(Ct,xi,vi,Jt,Le.cS,_i,Hr,Oe,Ue,Ot,Jr)}}}(qe,Re,Ue,Oe,Ue.layout.get("text-rotation-alignment"),Ue.layout.get("text-pitch-alignment"),Ct);const _i=0!==Ue.paint.get("icon-opacity").constantOr(1),xi=0!==Ue.paint.get("text-opacity").constantOr(1);void 0!==Ue.layout.get("symbol-sort-key").constantOr(1)&&(_i||xi)?bs(Re,Oe,Ue,qe,Ot,Jt):(_i&&bs(Re,Oe,Ue,qe,Ot,Jt,{onlyIcons:!0}),xi&&bs(Re,Oe,Ue,qe,Ot,Jt,{onlyText:!0})),Oe.map.showCollisionBoxes&&(fs(Re,Oe,Ue,qe,Ue.paint.get("text-translate"),Ue.paint.get("text-translate-anchor"),!0),fs(Re,Oe,Ue,qe,Ue.paint.get("icon-translate"),Ue.paint.get("icon-translate-anchor"),!1))},circle:function(Re,Oe,Ue,qe){if("translucent"!==Re.renderPass)return;const Ct=Ue.paint.get("circle-opacity"),Ot=Ue.paint.get("circle-stroke-width"),Jt=Ue.paint.get("circle-stroke-opacity"),_i=void 0!==Ue.layout.get("circle-sort-key").constantOr(1),xi=Ue.paint.get("circle-emissive-strength");if(0===Ct.constantOr(1)&&(0===Ot.constantOr(1)||0===Jt.constantOr(1)))return;const vi=Re.context,bi=vi.gl,Pi=Re.transform,Hr=Re.depthModeForSublayer(0,Li.ReadOnly),Jr=Mi.disabled,Ln=Re.colorModeForDrapableLayerRenderPass(xi),Nn="globe"===Pi.projection.name,Gn=[Le.am(Pi.center.lng),Le.at(Pi.center.lat)],qn=[];for(let Ct=0;Ct<qe.length;Ct++){const Ot=qe[Ct],Jt=Oe.getTile(Ot),xi=Jt.getBucket(Ue);if(!xi||xi.projection.name!==Pi.projection.name)continue;const vi=xi.programConfigurations.get(Ue.id),bi=Le.cT(Ue),Hr=Re.isTileAffectedByFog(Ot);Nn&&bi.push("PROJECTION_GLOBE_VIEW"),bi.push("DEPTH_D24"),Re.terrain&&Pi.depthOcclusionForSymbolsAndCircles&&bi.push("DEPTH_OCCLUSION");const Jr=Re.getOrCreateProgram("circle",{config:vi,defines:bi,overrideFog:Hr}),Ln=xi.layoutVertexBuffer,Zn=xi.globeExtVertexBuffer,$n=xi.indexBuffer,Xn=Pi.projection.createInversionMatrix(Pi,Ot.canonical),Yn={programConfiguration:vi,program:Jr,layoutVertexBuffer:Ln,globeExtVertexBuffer:Zn,indexBuffer:$n,uniformValues:Le.cU(Re,Ot,Jt,Xn,Gn,Ue),tile:Jt};if(_i){const Re=xi.segments.get();for(const Oe of Re)qn.push({segments:new Le.b1([Oe]),sortKey:Oe.sortKey,state:Yn})}else qn.push({segments:xi.segments,sortKey:0,state:Yn})}_i&&qn.sort(((Le,Re)=>Le.sortKey-Re.sortKey));const Zn={useDepthForOcclusion:Pi.depthOcclusionForSymbolsAndCircles};for(const Le of qn){const{programConfiguration:Oe,program:qe,layoutVertexBuffer:Ct,globeExtVertexBuffer:Ot,indexBuffer:Jt,uniformValues:_i,tile:xi}=Le.state,Nn=Le.segments;Re.terrain&&Re.terrain.setupElevationDraw(xi,qe,Zn),Re.uploadCommonUniforms(vi,qe,xi.tileID.toUnwrapped()),qe.draw(Re,bi.TRIANGLES,Hr,Jr,Ln,Fi.disabled,_i,Ue.id,Ct,Jt,Nn,Ue.paint,Pi.zoom,Oe,[Ot])}},heatmap:function(Re,Oe,Ue,qe){if(0!==Ue.paint.get("heatmap-opacity"))if("offscreen"===Re.renderPass){const Ct=Re.context,Ot=Ct.gl,Jt=Mi.disabled,_i=new Ai([Ot.ONE,Ot.ONE,Ot.ONE,Ot.ONE],Le.bz.transparent,[!0,!0,!0,!0]);!function(Le,Re,Oe,Ue){const qe=Le.gl,Ct=Re.width*Ue,Ot=Re.height*Ue;Le.activeTexture.set(qe.TEXTURE1),Le.viewport.set([0,0,Ct,Ot]);let Jt=Oe.heatmapFbo;if(!Jt||Jt&&(Jt.width!==Ct||Jt.height!==Ot)){Jt&&Jt.destroy();const Re=qe.createTexture();qe.bindTexture(qe.TEXTURE_2D,Re),qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_WRAP_S,qe.CLAMP_TO_EDGE),qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_WRAP_T,qe.CLAMP_TO_EDGE),qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_MIN_FILTER,qe.LINEAR),qe.texParameteri(qe.TEXTURE_2D,qe.TEXTURE_MAG_FILTER,qe.LINEAR),Jt=Oe.heatmapFbo=Le.createFramebuffer(Ct,Ot,!0,null),function(Le,Re,Oe,Ue,qe,Ct){const Ot=Le.gl;Ot.texImage2D(Ot.TEXTURE_2D,0,Le.extRenderToTextureHalfFloat?Ot.RGBA16F:Ot.RGBA,qe,Ct,0,Ot.RGBA,Le.extRenderToTextureHalfFloat?Ot.HALF_FLOAT:Ot.UNSIGNED_BYTE,null),Ue.colorAttachment.set(Oe)}(Le,0,Re,Jt,Ct,Ot)}else qe.bindTexture(qe.TEXTURE_2D,Jt.colorAttachment.get()),Le.bindFramebuffer.set(Jt.framebuffer)}(Ct,Re,Ue,"globe"===Re.transform.projection.name?.5:.25),Ct.clear({color:Le.bz.transparent});const xi=Re.transform,vi="globe"===xi.projection.name,bi=vi?["PROJECTION_GLOBE_VIEW"]:[],Pi=vi?Fi.frontCCW:Fi.disabled,Hr=[Le.am(xi.center.lng),Le.at(xi.center.lat)];for(let Le=0;Le<qe.length;Le++){const Jr=qe[Le];if(Oe.hasRenderableParent(Jr))continue;const Ln=Oe.getTile(Jr),Nn=Ln.getBucket(Ue);if(!Nn||Nn.projection.name!==xi.projection.name)continue;const Gn=Re.isTileAffectedByFog(Jr),qn=Nn.programConfigurations.get(Ue.id),Zn=Re.getOrCreateProgram("heatmap",{config:qn,defines:bi,overrideFog:Gn}),{zoom:$n}=Re.transform;Re.terrain&&Re.terrain.setupElevationDraw(Ln,Zn),Re.uploadCommonUniforms(Ct,Zn,Jr.toUnwrapped());const Xn=xi.projection.createInversionMatrix(xi,Jr.canonical);Zn.draw(Re,Ot.TRIANGLES,Li.disabled,Jt,_i,Pi,Wr(Re,Jr,Ln,Xn,Hr,$n,Ue.paint.get("heatmap-intensity")),Ue.id,Nn.layoutVertexBuffer,Nn.indexBuffer,Nn.segments,Ue.paint,Re.transform.zoom,qn,vi?[Nn.globeExtVertexBuffer]:null)}Ct.viewport.set([0,0,Re.width,Re.height])}else"translucent"===Re.renderPass&&(Re.context.setColorMode(Re.colorModeForRenderPass()),function(Re,Oe){const Ue=Re.context,qe=Ue.gl,Ct=Oe.heatmapFbo;if(!Ct)return;Ue.activeTexture.set(qe.TEXTURE0),qe.bindTexture(qe.TEXTURE_2D,Ct.colorAttachment.get()),Ue.activeTexture.set(qe.TEXTURE1);let Ot=Oe.colorRampTexture;Ot||(Ot=Oe.colorRampTexture=new Le.T(Ue,Oe.colorRamp,qe.RGBA8)),Ot.bind(qe.LINEAR,qe.CLAMP_TO_EDGE),Re.getOrCreateProgram("heatmapTexture").draw(Re,qe.TRIANGLES,Li.disabled,Mi.disabled,Re.colorModeForRenderPass(),Fi.disabled,((Le,Re,Oe,Ue)=>({u_image:0,u_color_ramp:1,u_opacity:Re.paint.get("heatmap-opacity")}))(0,Oe),Oe.id,Re.viewportBuffer,Re.quadTriangleIndexBuffer,Re.viewportSegments,Oe.paint,Re.transform.zoom)}(Re,Ue))},line:function(Re,Oe,Ue,qe){if("translucent"!==Re.renderPass)return;const Ct=Ue.paint.get("line-opacity"),Ot=Ue.paint.get("line-width");if(0===Ct.constantOr(1)||0===Ot.constantOr(1))return;const Jt=Ue.paint.get("line-emissive-strength"),_i=Ue.paint.get("line-occlusion-opacity"),xi=Re.context,vi=xi.gl,bi=Ue.layout.get("line-z-offset"),Pi=!bi.isConstant()||!!bi.constantOr(0),Hr=Pi?new Li(Re.depthOcclusion?vi.GREATER:vi.LEQUAL,Li.ReadOnly,Re.depthRangeFor3D):Re.depthModeForSublayer(0,Li.ReadOnly),Jr=Re.colorModeForDrapableLayerRenderPass(Jt),Ln=Re.terrain&&Re.terrain.renderingToTexture,Nn=Ln?1:Le.q.devicePixelRatio,Gn=Ue.paint.get("line-dasharray"),qn=Gn.constantOr(1),Zn=Ue.layout.get("line-cap"),$n=Gn.constantOr(null),Xn=Zn.constantOr(null),Yn=Ue.paint.get("line-pattern"),lo=Yn.constantOr(1),uo=Yn.constantOr(null),po=Ue.paint.get("line-opacity").constantOr(1);let fo=!lo&&1!==po||Re.depthOcclusion&&_i>0&&_i<1;const Io=Ue.paint.get("line-gradient"),is=lo?"linePattern":"line",as=Le.cV(Ue);let Is;
1if(Ln&&Re.terrain&&Re.terrain.clipOrMaskOverlapStencilType()&&(fo=!1),0!==_i&&Re.depthOcclusion){const Re=Ue.paint._values["line-opacity"];Re&&Re.value&&"constant"===Re.value.kind?Is=Re.value:Le.w(`Occlusion opacity for layer ${Ue.id} is supported only when line-opacity isn't data-driven.`)}if(Pi&&(Re.forceTerrainMode=!0),!Pi&&0!==_i&&Re.terrain&&!Ln)return void Le.w(`Occlusion opacity for layer ${Ue.id} is supported on terrain only if the layer has non-zero line-z-offset.`);const Xs=fo&&Pi?Re.stencilModeFor3D():Mi.disabled;for(const Ct of qe){const qe=Oe.getTile(Ct);if(lo&&!qe.patternsLoaded())continue;const Ot=qe.getBucket(Ue);if(!Ot)continue;Re.prepareDrawTile();const Jt=Ot.programConfigurations.get(Ue.id),bi=Re.isTileAffectedByFog(Ct),Gn=Re.getOrCreateProgram(is,{config:Jt,defines:Pi?[...as,"ELEVATED"]:as,overrideFog:bi});if(uo&&qe.imageAtlas){const Le=qe.imageAtlas.patternPositions[uo.toString()];Le&&Jt.setConstantPatternPositions(Le)}if(!lo&&$n&&Xn&&qe.lineAtlas){const Le=qe.lineAtlas.getDash($n,Xn);Le&&Jt.setConstantPatternPositions(Le)}let[Zn,Yn]=Ue.paint.get("line-trim-offset");if("round"===Xn||"square"===Xn){const Le=1;Zn!==Yn&&(0===Zn&&(Zn-=Le),1===Yn&&(Yn+=Le))}const ta=Ln?Ct.projMatrix:null,ha=lo?Le.cW(Re,qe,Ue,ta,Nn,[Zn,Yn]):Le.cX(Re,qe,Ue,ta,Ot.lineClipsArray.length,Nn,[Zn,Yn]);if(Io){const qe=Ot.gradients[Ue.id];let Jt=qe.texture;if(Ue.gradientVersion!==qe.version){let _i=256;if(Ue.stepInterpolant){const Ue=Oe.getSource().maxzoom,qe=Ct.canonical.z===Ue?Math.ceil(1<<Re.transform.maxZoom-Ct.canonical.z):1;_i=Le.ap(Le.cY(Ot.maxLineLength/Le.ab*1024*qe),256,xi.maxTextureSize)}qe.gradient=Le.cZ({expression:Ue.gradientExpression(),evaluationKey:"lineProgress",resolution:_i,image:qe.gradient||void 0,clips:Ot.lineClipsArray}),qe.texture?qe.texture.update(qe.gradient):qe.texture=new Le.T(xi,qe.gradient,vi.RGBA8),qe.version=Ue.gradientVersion,Jt=qe.texture}xi.activeTexture.set(vi.TEXTURE1),Jt.bind(Ue.stepInterpolant?vi.NEAREST:vi.LINEAR,vi.CLAMP_TO_EDGE)}qn&&(xi.activeTexture.set(vi.TEXTURE0),qe.lineAtlasTexture&&qe.lineAtlasTexture.bind(vi.LINEAR,vi.REPEAT),Jt.updatePaintBuffers()),lo&&(xi.activeTexture.set(vi.TEXTURE0),qe.imageAtlasTexture&&qe.imageAtlasTexture.bind(vi.LINEAR,vi.CLAMP_TO_EDGE),Jt.updatePaintBuffers()),Pi&&Re.terrain.setupElevationDraw(qe,Gn),Re.uploadCommonUniforms(xi,Gn,Ct.toUnwrapped());const z=Le=>{null!=Is&&(Is.value=po*_i),Gn.draw(Re,vi.TRIANGLES,Hr,Le,Jr,Fi.disabled,ha,Ue.id,Ot.layoutVertexBuffer,Ot.indexBuffer,Ot.segments,Ue.paint,Re.transform.zoom,Jt,[Ot.layoutVertexBuffer2,Ot.patternVertexBuffer,Ot.zOffsetVertexBuffer]),null!=Is&&(Is.value=po)};if(fo&&!Pi){const Le=Re.stencilModeForClipping(Ct).ref;0===Le&&Ln&&xi.clear({stencil:0});const Oe={func:vi.EQUAL,mask:255};ha.u_alpha_discard_threshold=.8,z(new Mi(Oe,Le,255,vi.KEEP,vi.KEEP,vi.INVERT)),ha.u_alpha_discard_threshold=0,z(new Mi(Oe,Le,255,vi.KEEP,vi.KEEP,vi.KEEP))}else fo&&Pi&&(ha.u_alpha_discard_threshold=.001),z(Pi?Xs:Re.stencilModeForClipping(Ct))}fo&&(Re.resetStencilClippingMasks(),Ln&&xi.clear({stencil:0})),0===_i||Re.depthOcclusion||Ln||Re.layersWithOcclusionOpacity.push(Re.currentLayer),Pi&&(Re.forceTerrainMode=!1)},fill:function(Re,Oe,Ue,qe){const Ct=Ue.paint.get("fill-color"),Ot=Ue.paint.get("fill-opacity"),Jt=Ue.is3D(),_i=new Li(Re.context.gl.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D);if(0===Ot.constantOr(1))return;const xi=Ue.paint.get("fill-emissive-strength"),vi=Re.colorModeForDrapableLayerRenderPass(xi),bi=Ue.paint.get("fill-pattern"),Pi=Re.opaquePassEnabledForLayer()&&!bi.constantOr(1)&&1===Ct.constantOr(Le.bz.transparent).a&&1===Ot.constantOr(0)?"opaque":"translucent";if(Re.renderPass===Pi){const Le=Jt?_i:Re.depthModeForSublayer(1,"opaque"===Re.renderPass?Li.ReadWrite:Li.ReadOnly);Ts(Re,Oe,Ue,qe,Le,vi,!1)}if(!Jt&&"translucent"===Re.renderPass&&Ue.paint.get("fill-antialias")){const Le=Jt?_i:Re.depthModeForSublayer(Ue.getPaintProperty("fill-outline-color")?2:0,Li.ReadOnly);Ts(Re,Oe,Ue,qe,Le,vi,!0)}},"fill-extrusion":function(Re,Oe,Ue,qe){const Ct=Ue.paint.get("fill-extrusion-opacity"),Ot=Re.context,Jt=Ot.gl,_i=Re.terrain,xi=_i&&_i.renderingToTexture;if(0===Ct)return;const vi=Re.conflationActive&&Re.style.isLayerClipped(Ue,Oe.getSource()),bi=Re.style.order.indexOf(Ue.fqid);if(vi&&function(Le,Re,Oe,Ue,qe){for(const Ct of Ue){const Ue=Re.getTile(Ct).getBucket(Oe);Ue&&(Ue.updateReplacement(Ct,Le.replacementSource,qe),Ue.uploadCentroid(Le.context))}}(Re,Oe,Ue,qe,bi),_i||vi)for(const Le of qe){const qe=Oe.getTile(Le).getBucket(Ue);qe&&Ss(Re.context,Oe,Le,qe,Ue,_i,vi)}if("shadow"===Re.renderPass&&Re.shadowRenderer){const Ot=Re.shadowRenderer;if(_i&&Ct<.65&&Ue._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof Le.a4)return;const Jt=Ot.getShadowPassDepthMode(),xi=Ot.getShadowPassColorMode();Es(Re,Oe,Ue,qe,Jt,Mi.disabled,xi,vi)}else if("translucent"===Re.renderPass){const bi=!Ue.paint.get("fill-extrusion-pattern").constantOr(1),Pi=Ue.paint.get("fill-extrusion-color").constantOr(Le.bz.white);if(!xi&&0!==Pi.a){const Le=new Li(Re.context.gl.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D);1===Ct&&bi?Es(Re,Oe,Ue,qe,Le,Mi.disabled,Ai.unblended,vi):(Es(Re,Oe,Ue,qe,Le,Mi.disabled,Ai.disabled,vi),Es(Re,Oe,Ue,qe,Le,Re.stencilModeFor3D(),Re.colorModeForRenderPass(),vi),Re.resetStencilClippingMasks())}if(Re.style.enable3dLights()&&bi&&(!_i&&"globe"!==Re.transform.projection.name||xi)){const Ct=Ue.paint.get("fill-extrusion-opacity"),bi=Ue.paint.get("fill-extrusion-ambient-occlusion-intensity"),Pi=Ue.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Hr=Ue.paint.get("fill-extrusion-flood-light-intensity"),Jr=Ue.paint.get("fill-extrusion-flood-light-color").toRenderColor(Ue.lut).toArray01().slice(0,3),Ln=bi>0&&Pi>0,Nn=Hr>0,g=(Le,Re,Oe)=>(1-Oe)*Le+Oe*Re,v=Ot=>{const _i=Re.depthModeForSublayer(1,Li.ReadOnly,Jt.LEQUAL,!0),xi=Ue.paint.get(Ot?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ln=g(.1,3,xi),Nn=Re._showOverdrawInspector;if(!Nn){const xi=new Mi({func:Jt.ALWAYS,mask:255},255,255,Jt.KEEP,Jt.KEEP,Jt.REPLACE),Nn=new Ai([Jt.ONE,Jt.ONE,Jt.ONE,Jt.ONE],Le.bz.transparent,[!1,!1,!1,!0],Jt.MIN);Cs(Re,Oe,Ue,qe,_i,xi,Nn,Fi.disabled,Ot,"sdf",Ct,bi,Pi,Hr,Jr,Ln,vi,!1)}{const xi=Nn?Mi.disabled:new Mi({func:Jt.EQUAL,mask:255},255,255,Jt.KEEP,Jt.DECR,Jt.DECR),Gn=Nn?Re.colorModeForRenderPass():new Ai([Jt.ONE_MINUS_DST_ALPHA,Jt.DST_ALPHA,Jt.ONE,Jt.ONE],Le.bz.transparent,[!0,!0,!0,!0]);Cs(Re,Oe,Ue,qe,_i,xi,Gn,Fi.disabled,Ot,"color",Ct,bi,Pi,Hr,Jr,Ln,vi,!1)}};if(xi){const c=(Ot,_i,xi)=>{const Ln=Re.depthModeForSublayer(1,Li.ReadOnly,Jt.LEQUAL,!1),Nn=Ue.paint.get(Ot?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Gn=g(.1,3,Nn);{const xi=new Ai([Jt.ONE,Jt.ONE,Jt.ONE,Jt.ONE],Le.bz.transparent,[!1,!1,!1,!0]);Cs(Re,Oe,Ue,qe,Ln,Mi.disabled,xi,Fi.disabled,Ot,"clear",Ct,bi,Pi,Hr,Jr,Gn,vi,_i)}{const xi=new Mi({func:Jt.ALWAYS,mask:255},255,255,Jt.KEEP,Jt.KEEP,Jt.REPLACE),Nn=new Ai([Jt.ONE,Jt.ONE,Jt.ONE,Jt.ONE],Le.bz.transparent,[!1,!1,!1,!0],Jt.MIN);Cs(Re,Oe,Ue,qe,Ln,xi,Nn,Fi.disabled,Ot,"sdf",Ct,bi,Pi,Hr,Jr,Gn,vi,_i)}{const xi=Ot?Jt.ZERO:Jt.ONE_MINUS_DST_ALPHA,Nn=new Mi({func:Jt.EQUAL,mask:255},255,255,Jt.KEEP,Jt.DECR,Jt.DECR),qn=new Ai([xi,Jt.DST_ALPHA,Jt.ONE_MINUS_DST_ALPHA,Jt.ZERO],Le.bz.transparent,[!0,!0,!0,!0]);Cs(Re,Oe,Ue,qe,Ln,Nn,qn,Fi.disabled,Ot,"color",Ct,bi,Pi,Hr,Jr,Gn,vi,_i)}{const Nn=new Ai([Jt.ONE,Jt.ONE,Jt.ONE,Ot?Jt.ZERO:Jt.ONE],Le.bz.transparent,[!1,!1,!1,!0],Ot?Jt.FUNC_ADD:Jt.MAX);Cs(Re,Oe,Ue,qe,Ln,Mi.disabled,Nn,Fi.disabled,Ot,"clear",Ct,bi,Pi,Hr,Jr,Gn,vi,_i,xi)}};if(Ln||Nn){let Oe;if(Re.prepareDrawTile(),_i){const Re=_i.drapeBufferSize[0],Ue=_i.drapeBufferSize[1];Oe=_i.framebufferCopyTexture,Oe&&(!Oe||Oe.size[0]===Re&&Oe.size[1]===Ue)||(Oe&&Oe.destroy(),Oe=_i.framebufferCopyTexture=new Le.T(Ot,new Le.r({width:Re,height:Ue}),Jt.RGBA8)),Oe.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE),Jt.copyTexImage2D(Jt.TEXTURE_2D,0,Jt.RGBA,0,0,Re,Ue,0)}Ln&&c(!0,!1,Oe),Nn&&c(!1,!0,Oe)}}else Ln&&v(!0),Nn&&v(!1),(Ln||Nn)&&Re.resetStencilClippingMasks()}}},hillshade:function(Le,Re,Oe,Ue){if("offscreen"!==Le.renderPass&&"translucent"!==Le.renderPass)return;if(Le.style.disableElevatedTerrain)return;const qe=Le.context,Ct=Le.terrain&&Le.terrain.renderingToTexture,[Ot,Jt]="translucent"!==Le.renderPass||Ct?[{},Ue]:Le.stencilConfigForOverlap(Ue);for(const Ue of Jt){const qe=Re.getTile(Ue);if(qe.needsHillshadePrepare&&"offscreen"===Le.renderPass)zo(Le,qe,Oe);else if("translucent"===Le.renderPass){const Re=Le.depthModeForSublayer(0,Li.ReadOnly),Jt=Oe.paint.get("hillshade-emissive-strength"),_i=Le.colorModeForDrapableLayerRenderPass(Jt),xi=Ct&&Le.terrain?Le.terrain.stencilModeForRTTOverlap(Ue):Ot[Ue.overscaledZ];Po(Le,Ue,qe,Oe,Re,xi,_i)}}qe.viewport.set([0,0,Le.width,Le.height]),Le.resetStencilClippingMasks()},raster:function(Re,Oe,Ue,qe,Ct,Ot){if("translucent"!==Re.renderPass)return;if(0===Ue.paint.get("raster-opacity"))return;const Jt="globe"===Re.transform.projection.name,_i=0!==Ue.paint.get("raster-elevation"),xi=_i&&Jt;if(Re.renderElevatedRasterBackface&&!xi)return;const vi=Re.context,bi=vi.gl,Pi=Oe.getSource(),Hr=function(Re,Oe,Ue,qe){const Ct=Oe.paint.get("raster-color"),Ot="raster-array"===Re.type,Jt=[],_i=Oe.paint.get("raster-resampling"),xi=Oe.paint.get("raster-color-mix");let vi=Oe.paint.get("raster-color-range");const bi=[xi[0],xi[1],xi[2],0],Pi=xi[3];let Hr="nearest"===_i?qe.NEAREST:qe.LINEAR;if(Ot&&(Jt.push("RASTER_ARRAY"),Ct||Jt.push("RASTER_COLOR"),"linear"===_i&&Jt.push("RASTER_ARRAY_LINEAR"),Hr=qe.NEAREST,!vi&&Re.rasterLayers)){const Le=Re.rasterLayers.find((({id:Le})=>Le===Oe.sourceLayer));Le&&Le.fields&&Le.fields.range&&(vi=Le.fields.range)}
1if(vi=vi||[0,1],Ct){Jt.push("RASTER_COLOR"),Ue.activeTexture.set(qe.TEXTURE2),Oe.updateColorRamp(vi);let Re=Oe.colorRampTexture;Re||(Re=Oe.colorRampTexture=new Le.T(Ue,Oe.colorRamp,qe.RGBA8)),Re.bind(qe.LINEAR,qe.CLAMP_TO_EDGE)}return{mix:bi,range:vi,offset:Pi,defines:Jt,resampling:Hr}}(Pi,Ue,vi,bi);if(Pi instanceof Le.aD&&!qe.length&&!Jt)return;const Jr=Ue.paint.get("raster-emissive-strength"),Ln=Re.colorModeForDrapableLayerRenderPass(Jr),Nn=Re.terrain&&Re.terrain.renderingToTexture,Gn=!Re.options.moving,qn="nearest"===Ue.paint.get("raster-resampling")?bi.NEAREST:bi.LINEAR;if(Pi instanceof Le.aD&&!qe.length&&(Pi.onNorthPole||Pi.onSouthPole)){const Le=_i?Re.stencilModeFor3D():Mi.disabled;return void Ps(!!Pi.onNorthPole,null,Re,Oe,Ue,Jr,Hr,Fi.disabled,Le)}if(!qe.length)return;const[Zn,$n]=Pi instanceof Le.aD||Nn?[{},qe]:Re.stencilConfigForOverlap(qe),Xn=$n[$n.length-1].overscaledZ;xi&&Hr.defines.push("PROJECTION_GLOBE_VIEW"),_i&&Hr.defines.push("RENDER_CUTOFF");const w=(qe,Ct,$n)=>{for(const Yn of qe){const qe=Yn.toUnwrapped(),lo=Oe.getTile(Yn);if(Nn&&(!lo||!lo.hasData()))continue;vi.activeTexture.set(bi.TEXTURE0);const uo=zs(lo,Pi,Ue,Hr);if(!uo||!uo.texture)continue;const{texture:po,mix:fo,offset:Io,tileSize:is,buffer:as}=uo;let Is,Xs;Nn?(Is=Li.disabled,Xs=Yn.projMatrix):_i?(Is=new Li(bi.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D),Xs=Jt?Float32Array.from(Re.transform.expandedFarZProjMatrix):Re.transform.calculateProjMatrix(qe,Gn)):(Is=Re.depthModeForSublayer(Yn.overscaledZ-Xn,1===Ue.paint.get("raster-opacity")?Li.ReadWrite:Li.ReadOnly,bi.LESS),Xs=Re.transform.calculateProjMatrix(qe,Gn));const ta=Re.terrain&&Nn?Re.terrain.stencilModeForRTTOverlap(Yn):Zn[Yn.overscaledZ],ha=Ot?0:Ue.paint.get("raster-fade-duration");lo.registerFadeDuration(ha);const el=Oe.findLoadedParent(Yn,0),tl=Sr(lo,el,Oe,Re.transform,ha);let il,sl;Re.terrain&&Re.terrain.prepareDrawTile(),vi.activeTexture.set(bi.TEXTURE0),po.bind(qn,bi.CLAMP_TO_EDGE),vi.activeTexture.set(bi.TEXTURE1),el?(el.texture&&el.texture.bind(qn,bi.CLAMP_TO_EDGE),il=Math.pow(2,el.tileID.overscaledZ-lo.tileID.overscaledZ),sl=[lo.tileID.canonical.x*il%1,lo.tileID.canonical.y*il%1]):po.bind(qn,bi.CLAMP_TO_EDGE),po.useMipmap&&vi.extTextureFilterAnisotropic&&Re.transform.pitch>20&&bi.texParameterf(bi.TEXTURE_2D,vi.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,vi.extTextureFilterAnisotropicMax);const fl=Re.transform;let Ml;const Al=_i?Ms(fl):[0,0,0,0];let Hl,Wl,Jl,Kl,Ql,oc=0;if(xi&&Pi instanceof Le.aD&&Pi.coordinates.length>3)Hl=Float32Array.from(Le.b5(Le.cC(new Le.bP(0,0,0)))),Wl=Float32Array.from(fl.globeMatrix),Jl=Float32Array.from(Le.cy(fl)),Kl=[Le.am(fl.center.lng),Le.at(fl.center.lat)],Ml=Pi.elevatedGlobePerspectiveTransform,Ql=Pi.elevatedGlobeGridMatrix||new Float32Array(9);else if(xi){const Re=Le.cz(Yn.canonical);oc=Le.cA(Re.getCenter().lat),Hl=Float32Array.from(Le.b5(Le.cC(Yn.canonical))),Wl=Float32Array.from(fl.globeMatrix),Jl=Float32Array.from(Le.cy(fl)),Kl=[Le.am(fl.center.lng),Le.at(fl.center.lat)],Ml=[0,0],Ql=Float32Array.from(Le.cB(Yn.canonical,Re,oc,fl.worldSize/fl._pixelsPerMercatorPixel))}else Ml=Pi instanceof Le.aD?Pi.perspectiveTransform:[0,0],Hl=new Float32Array(16),Wl=new Float32Array(9),Jl=new Float32Array(16),Kl=[0,0],Ql=new Float32Array(9);const lc=Yr(Xs,Hl,Wl,Jl,Ql,sl||[0,0],Le.a9(Re.transform.zoom),Kl,Al,il||1,tl,Ue,Ml,_i?Ue.paint.get("raster-elevation"):0,2,fo,Io,Hr.range,is,as,Jr),Oc=Re.isTileAffectedByFog(Yn),Nc=Re.getOrCreateProgram("raster",{defines:Hr.defines,overrideFog:Oc});if(Re.uploadCommonUniforms(vi,Nc,qe),Pi instanceof Le.aD){const Oe=Pi.elevatedGlobeVertexBuffer,qe=Pi.elevatedGlobeIndexBuffer;if(Nn||!Jt)Pi.boundsBuffer&&Pi.boundsSegments&&Nc.draw(Re,bi.TRIANGLES,Is,Mi.disabled,Ln,Fi.disabled,lc,Ue.id,Pi.boundsBuffer,Re.quadTriangleIndexBuffer,Pi.boundsSegments);else if(Oe&&qe){const Ot=fl.zoom<=Le.c2?Pi.elevatedGlobeSegments:Pi.getSegmentsForLongitude(fl.center.lng);Ot&&Nc.draw(Re,bi.TRIANGLES,Is,Mi.disabled,Ln,Ct,lc,Ue.id,Oe,qe,Ot)}}else if(xi){Is=new Li(bi.LEQUAL,Li.ReadOnly,Re.depthRangeFor3D);const Le=Re.globeSharedBuffers;if(Le){const[Oe,qe,Ot]=Le.getGridBuffers(oc,!1);Nc.draw(Re,bi.TRIANGLES,Is,$n||ta,Re.colorModeForRenderPass(),Ct,lc,Ue.id,Oe,qe,Ot)}}else{const{tileBoundsBuffer:Le,tileBoundsIndexBuffer:Oe,tileBoundsSegments:qe}=Re.getTileBoundsBuffers(lo);Nc.draw(Re,bi.TRIANGLES,Is,ta,Ln,Fi.disabled,lc,Ue.id,Le,Oe,qe)}}if(!(Pi instanceof Le.aD)&&xi)for(const Le of qe){const qe=Le.canonical.y===(1<<Le.canonical.z)-1;0===Le.canonical.y&&Ps(!0,Le,Re,Oe,Ue,Jr,Hr,Ct,$n||Mi.disabled),qe&&Ps(!1,Le,Re,Oe,Ue,Jr,Hr,Ct===Fi.frontCW?Fi.backCW:Fi.frontCW,$n||Mi.disabled)}};xi?w($n,Re.renderElevatedRasterBackface?Fi.backCW:Fi.frontCW,Re.stencilModeFor3D()):w($n,Fi.disabled,void 0),Re.resetStencilClippingMasks()},"raster-particle":function(Re,Oe,Ue,qe,Ct,Ot){"offscreen"===Re.renderPass&&function(Re,Oe,Ue,qe){if(!qe.length)return;const Ct=Re.context,Ot=Ct.gl,Jt=Oe.getSource();if(!(Jt instanceof Qe))return;const _i=Math.ceil(Math.sqrt(Ue.paint.get("raster-particle-count")));let xi=Ue.particlePositionRGBAImage;if(!xi||xi.width!==_i){const Re=function(Le){const Re=Le*Le,Oe=new Uint8Array(4*Re),o=function(Le){return Le|=0,Le=Math.imul(2747636419^Le,2654435769),Le=Math.imul(Le^Le>>>16,2654435769),((Le=Math.imul(Le^Le>>>16,2654435769))>>>0)/4294967296},Ue=1/1.1;for(let Le=0;Le<Re;Le++){const Re=Ue*(o(2*Le+0)+Ju),qe=Ue*(o(2*Le+1)+Ju),Ct=255*Re%1,Ot=255*qe%1,Jt=Ct,_i=qe-Ot/255,xi=Ot;Oe[4*Le+0]=255*(Re-Ct/255),Oe[4*Le+1]=255*Jt,Oe[4*Le+2]=255*_i,Oe[4*Le+3]=255*xi}return Oe}(_i);xi=Ue.particlePositionRGBAImage=new Le.r({width:_i,height:_i},Re)}let vi=Ue.particleFramebuffer;vi?vi.width!==_i&&(vi.destroy(),vi=Ue.particleFramebuffer=Ct.createFramebuffer(_i,_i,!0,null)):vi=Ue.particleFramebuffer=Ct.createFramebuffer(_i,_i,!0,null);const bi=[];for(const Le of qe){const Re=Oe.getTile(Le);if(!(Re instanceof mt))continue;const qe=ks(Re,Jt,Ue);
vendor: 15,189 bytes, line 1
1if(!qe)continue;const Ot=[Re.tileSize,Re.tileSize];let vi=Ue.tileFramebuffer;vi||(vi=Ue.tileFramebuffer=Ct.createFramebuffer(Ot[0],Ot[1],!0,null));let Pi=Re.rasterParticleState;Pi||(Pi=Re.rasterParticleState=new Fs(Ct,Le,Ot,xi));const Hr=Pi.update(Ue.lastInvalidatedAt);Pi.particleTextureDimension!==_i&&Pi.updateParticleTexture(Le,xi);const Jr=Pi.targetColorTexture;Pi.targetColorTexture=Pi.backgroundColorTexture,Pi.backgroundColorTexture=Jr;const Ln=Pi.particleTexture0;Pi.particleTexture0=Pi.particleTexture1,Pi.particleTexture1=Ln,bi.push([Le,qe,Pi,Hr])}if(0===bi.length)return;const Pi=Le.q.now(),Hr=Ue.previousDrawTimestamp?.001*(Pi-Ue.previousDrawTimestamp):.0167;if(Ue.previousDrawTimestamp=Pi,Ue.hasColorMap()){Ct.activeTexture.set(Ot.TEXTURE0+2);let Re=Ue.colorRampTexture;Re||(Re=Ue.colorRampTexture=new Le.T(Ct,Ue.colorRamp,Ot.RGBA8)),Re.bind(Ot.LINEAR,Ot.CLAMP_TO_EDGE)}Ct.bindFramebuffer.set(Ue.tileFramebuffer.framebuffer),function(Re,Oe,Ue){const qe=Re.context,Ct=qe.gl,Ot=Oe.tileFramebuffer;qe.activeTexture.set(Ct.TEXTURE0);const Jt={u_texture:0,u_opacity:1.05*(xi=Oe.paint.get("raster-particle-fade-opacity-factor"))/(xi+.05)},_i=Re.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var xi;for(const xi of Ue){const[,,Ue,vi]=xi;Ot.colorAttachment.set(Ue.targetColorTexture.texture),qe.viewport.set([0,0,Ot.width,Ot.height]),qe.clear({color:Le.bz.transparent}),vi&&(Ue.backgroundColorTexture.bind(Ct.NEAREST,Ct.CLAMP_TO_EDGE),_i.draw(Re,Ct.TRIANGLES,Li.disabled,Mi.disabled,Ai.alphaBlended,Fi.disabled,Jt,Oe.id,Re.viewportBuffer,Re.quadTriangleIndexBuffer,Re.viewportSegments))}}(Re,Ue,bi),function(Re,Oe,Ue,qe){const Ct=Re.context,Ot=Ct.gl,Jt=Ue.tileFramebuffer,_i="globe"===Re.transform.projection.name,xi=Ue.paint.get("raster-particle-max-speed");for(const vi of qe){const[qe,bi,Pi]=vi;Ct.activeTexture.set(Ot.TEXTURE0+0),bi.texture.bind(Ot.LINEAR,Ot.CLAMP_TO_EDGE),Jt.colorAttachment.set(Pi.targetColorTexture.texture);const Hr=Re.getOrCreateProgram("rasterParticleDraw",{defines:bi.defines,overrideFog:!1});Ct.activeTexture.set(Ot.TEXTURE0+1);const Jr=bi.scalarData?[]:[0,1,2,3].map((Re=>Le.c$[Re](qe)));Jr.push(qe);const Ln=qe.canonical.x,Nn=qe.canonical.y;for(const Le of Jr){const Ct=Oe.getTile(_i?Le.wrapped():Le);if(!Ct)continue;const Jt=Ct.rasterParticleState;if(!Jt)continue;const vi=Le.canonical.x+(1<<Le.canonical.z)*(Le.wrap-qe.wrap),Pi=Le.canonical.y;Jt.particleTexture0.bind(Ot.NEAREST,Ot.CLAMP_TO_EDGE);const Jr=es(1,Jt.particleTexture0.size[0],[vi-Ln,Pi-Nn],0,bi.texture.size,2,xi,bi.textureOffset,bi.scale,bi.offset);Hr.draw(Re,Ot.POINTS,Li.disabled,Mi.disabled,Ai.alphaBlended,Fi.disabled,Jr,Ue.id,Jt.particleIndexBuffer,void 0,Jt.particleSegment)}}}(Re,Oe,Ue,bi),Ct.bindFramebuffer.set(Ue.particleFramebuffer.framebuffer),function(Re,Oe,Ue,qe){const Ct=Re.context,Ot=Ct.gl,Jt=Oe.paint.get("raster-particle-max-speed"),_i=qe*Oe.paint.get("raster-particle-speed-factor")*.15,xi=function(Le){return Math.pow(Le,6)}(.01+1*Oe.paint.get("raster-particle-reset-rate-factor")),vi=Oe.particleFramebuffer;Ct.viewport.set([0,0,vi.width,vi.height]);for(const qe of Ue){const[,Ue,bi]=qe;Ct.activeTexture.set(Ot.TEXTURE0+0),Ue.texture.bind(Ot.LINEAR,Ot.CLAMP_TO_EDGE),Ct.activeTexture.set(Ot.TEXTURE0+1);const Pi=bi.particleTexture0;Pi.bind(Ot.NEAREST,Ot.CLAMP_TO_EDGE);const Hr=ts(1,Pi.size[0],0,Ue.texture.size,Jt,_i,xi,Ue.textureOffset,Ue.scale,Ue.offset);vi.colorAttachment.set(bi.particleTexture1.texture),Ct.clear({color:Le.bz.transparent}),Re.getOrCreateProgram("rasterParticleUpdate",{defines:Ue.defines}).draw(Re,Ot.TRIANGLES,Li.disabled,Mi.disabled,Ai.unblended,Fi.disabled,Hr,Oe.id,Re.viewportBuffer,Re.quadTriangleIndexBuffer,Re.viewportSegments)}}(Re,Ue,bi,Hr)}(Re,Oe,Ue,qe),"translucent"===Re.renderPass&&(function(Re,Oe,Ue,qe,Ct){const Ot=Re.context,Jt=Ot.gl,_i=Oe.getSource().tileSize,xi=5*(1-Le.a7(Le.bU,Le.bU+1,Re.transform.zoom))*_i+Ue.paint.get("raster-particle-elevation"),vi=!Re.options.moving,bi="globe"===Re.transform.projection.name;if(!qe.length)return;const[Pi,Hr]=Re.stencilConfigForOverlap(qe),Jr=[];bi&&Jr.push("PROJECTION_GLOBE_VIEW");const Ln=Re.stencilModeFor3D();for(const qe of Hr){const Ct=qe.toUnwrapped(),_i=Oe.getTile(qe);if(!_i.rasterParticleState)continue;const Hr=_i.rasterParticleState,Nn=100;_i.registerFadeDuration(Nn);const Gn=Oe.findLoadedParent(qe,0),qn=Sr(_i,Gn,Oe,Re.transform,Nn);let Zn,$n;Re.terrain&&Re.terrain.prepareDrawTile(),Ot.activeTexture.set(Jt.TEXTURE0),Hr.targetColorTexture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE),Ot.activeTexture.set(Jt.TEXTURE1),Gn&&Gn.rasterParticleState?(Gn.rasterParticleState.targetColorTexture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE),Zn=Math.pow(2,Gn.tileID.overscaledZ-_i.tileID.overscaledZ),$n=[_i.tileID.canonical.x*Zn%1,_i.tileID.canonical.y*Zn%1]):Hr.targetColorTexture.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE);const Xn=bi?Float32Array.from(Re.transform.expandedFarZProjMatrix):Re.transform.calculateProjMatrix(Ct,vi),Yn=Re.transform,lo=Bs(Yn),uo=Le.cz(qe.canonical),po=Le.cA(uo.getCenter().lat);let fo,Io,is,as,Is;bi?(fo=Float32Array.from(Le.b5(Le.cC(qe.canonical))),Io=Float32Array.from(Yn.globeMatrix),is=Float32Array.from(Le.cy(Yn)),as=[Le.am(Yn.center.lng),Le.at(Yn.center.lat)],Is=Float32Array.from(Le.cB(qe.canonical,uo,po,Yn.worldSize/Yn._pixelsPerMercatorPixel))):(fo=new Float32Array(16),Io=new Float32Array(9),is=new Float32Array(16),as=[0,0],Is=new Float32Array(9));const Xs=Qr(Xn,fo,Io,is,Is,$n||[0,0],Le.a9(Re.transform.zoom),as,lo,Zn||1,qn,xi),ta=Re.isTileAffectedByFog(qe),ha=Re.getOrCreateProgram("rasterParticle",{defines:Jr,overrideFog:ta});if(Re.uploadCommonUniforms(Ot,ha,Ct),bi){const Le=new Li(Jt.LEQUAL,Li.ReadOnly,Re.depthRangeFor3D),Oe=0,qe=Re.globeSharedBuffers;if(qe){const[Ct,Ot,_i]=qe.getGridBuffers(po,0!==Oe);ha.draw(Re,Jt.TRIANGLES,Le,Ln,Ai.alphaBlended,Re.renderElevatedRasterBackface?Fi.frontCCW:Fi.backCCW,Xs,Ue.id,Ct,Ot,_i)}}else{const Le=Re.depthModeForSublayer(0,Li.ReadOnly),Oe=Pi[qe.overscaledZ],{tileBoundsBuffer:Ct,tileBoundsIndexBuffer:Ot,tileBoundsSegments:xi}=Re.getTileBoundsBuffers(_i);ha.draw(Re,Jt.TRIANGLES,Le,Oe,Ai.alphaBlended,Fi.disabled,Xs,Ue.id,Ct,Ot,xi)}}Re.resetStencilClippingMasks()}(Re,Oe,Ue,qe),Re.style.map.triggerRepaint())},background:function(Re,Oe,Ue,qe){const Ct=Ue.paint.get("background-color"),Ot=Ue.paint.get("background-opacity"),Jt=Ue.paint.get("background-emissive-strength"),_i="viewport"===Ue.paint.get("background-pitch-alignment");if(0===Ot)return;const xi=Re.context,vi=xi.gl,bi=Re.transform,Pi=bi.tileSize,Hr=Ue.paint.get("background-pattern");let Jr;if(void 0!==Hr){if(null===Hr)return;if(Jr=Re.imageManager.getPattern(Hr.toString(),Ue.scope,Re.style.getLut(Ue.scope)),!Jr)return}const Ln=!Hr&&1===Ct.a&&1===Ot&&Re.opaquePassEnabledForLayer()?"opaque":"translucent";if(Re.renderPass!==Ln)return;const Nn=Mi.disabled,Gn=Re.depthModeForSublayer(0,"opaque"===Ln?Li.ReadWrite:Li.ReadOnly),qn=Re.colorModeForDrapableLayerRenderPass(Jt),Zn=Hr?"backgroundPattern":"background";let $n,Xn=qe;if(Xn||($n=Re.getBackgroundTiles(),Xn=Object.values($n).map((Le=>Le.tileID))),Hr&&(xi.activeTexture.set(vi.TEXTURE0),Re.imageManager.bind(Re.context,Ue.scope)),_i){const Oe=Re.getOrCreateProgram(Zn,{overrideFog:!1,overrideRtt:!0}),qe=new Float32Array(Le.a6.mat4.identity([])),xi=new Le.aA(0,0,0,0,0),bi=Hr?ss(qe,Jt,Ot,Re,0,Ue.scope,Jr,_i,{tileID:xi,tileSize:Pi}):rs(qe,Jt,Ot,Ct.toRenderColor(Ue.lut));Oe.draw(Re,vi.TRIANGLES,Gn,Nn,qn,Fi.disabled,bi,Ue.id,Re.viewportBuffer,Re.quadTriangleIndexBuffer,Re.viewportSegments)}else for(const Le of Xn){const Ln=Re.isTileAffectedByFog(Le),Xn=Re.getOrCreateProgram(Zn,{overrideFog:Ln}),Yn=Le.toUnwrapped(),lo=qe?Le.projMatrix:Re.transform.calculateProjMatrix(Yn);Re.prepareDrawTile();const uo=Oe?Oe.getTile(Le):$n?$n[Le.key]:new pt(Le,Pi,bi.zoom,Re),po=Hr?ss(lo,Jt,Ot,Re,0,Ue.scope,Jr,_i,{tileID:Le,tileSize:Pi}):rs(lo,Jt,Ot,Ct.toRenderColor(Ue.lut));Re.uploadCommonUniforms(xi,Xn,Yn);const{tileBoundsBuffer:fo,tileBoundsIndexBuffer:Io,tileBoundsSegments:is}=Re.getTileBoundsBuffers(uo);Xn.draw(Re,vi.TRIANGLES,Gn,Nn,qn,Fi.disabled,po,Ue.id,fo,Io,is)}},sky:function(Re,Oe,Ue){const qe=Re._atmosphere?Le.a9(Re.transform.zoom):1,Ct=Ue.paint.get("sky-opacity")*qe;if(0===Ct)return;const Ot=Re.context,Jt=Ue.paint.get("sky-type"),_i=new Li(Ot.gl.LEQUAL,Li.ReadOnly,[0,1]),xi=Re.frameCounter/1e3%1;"atmosphere"===Jt?"offscreen"===Re.renderPass?Ue.needsSkyboxCapture(Re)&&(function(Re,Oe,Ue,qe){const Ct=Re.context,Ot=Ct.gl;let Jt=Oe.skyboxFbo;if(!Jt){Jt=Oe.skyboxFbo=Ct.createFramebuffer(32,32,!0,null),Oe.skyboxGeometry=new Ks(Ct),Oe.skyboxTexture=Ct.gl.createTexture(),Ot.bindTexture(Ot.TEXTURE_CUBE_MAP,Oe.skyboxTexture),Ot.texParameteri(Ot.TEXTURE_CUBE_MAP,Ot.TEXTURE_WRAP_S,Ot.CLAMP_TO_EDGE),Ot.texParameteri(Ot.TEXTURE_CUBE_MAP,Ot.TEXTURE_WRAP_T,Ot.CLAMP_TO_EDGE),Ot.texParameteri(Ot.TEXTURE_CUBE_MAP,Ot.TEXTURE_MIN_FILTER,Ot.LINEAR),Ot.texParameteri(Ot.TEXTURE_CUBE_MAP,Ot.TEXTURE_MAG_FILTER,Ot.LINEAR);for(let Le=0;Le<6;++Le)Ot.texImage2D(Ot.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,Ot.RGBA,32,32,0,Ot.RGBA,Ot.UNSIGNED_BYTE,null)}Ct.bindFramebuffer.set(Jt.framebuffer),Ct.viewport.set([0,0,32,32]);const _i=Oe.getCenter(Re,!0),xi=Re.getOrCreateProgram("skyboxCapture"),vi=new Float64Array(16);Le.a6.mat4.identity(vi),Le.a6.mat4.rotateY(vi,vi,.5*-Math.PI),Js(Re,Oe,xi,vi,_i,0),Le.a6.mat4.identity(vi),Le.a6.mat4.rotateY(vi,vi,.5*Math.PI),Js(Re,Oe,xi,vi,_i,1),Le.a6.mat4.identity(vi),Le.a6.mat4.rotateX(vi,vi,.5*-Math.PI),Js(Re,Oe,xi,vi,_i,2),Le.a6.mat4.identity(vi),Le.a6.mat4.rotateX(vi,vi,.5*Math.PI),Js(Re,Oe,xi,vi,_i,3),Le.a6.mat4.identity(vi),Js(Re,Oe,xi,vi,_i,4),Le.a6.mat4.identity(vi),Le.a6.mat4.rotateY(vi,vi,Math.PI),Js(Re,Oe,xi,vi,_i,5),Ct.viewport.set([0,0,Re.width,Re.height])}(Re,Ue),Ue.markSkyboxValid(Re)):"sky"===Re.renderPass&&function(Le,Re,Oe,Ue,qe){const Ct=Le.context,Ot=Ct.gl,Jt=Le.transform,_i=Le.getOrCreateProgram("skybox");Ct.activeTexture.set(Ot.TEXTURE0),Ot.bindTexture(Ot.TEXTURE_CUBE_MAP,Re.skyboxTexture);const xi=((Le,Re,Oe,Ue,qe)=>({u_matrix:Le,u_sun_direction:Re,u_cubemap:0,u_opacity:Ue,u_temporal_offset:qe}))(Jt.skyboxMatrix,Re.getCenter(Le,!1),0,Ue,qe);Le.uploadCommonUniforms(Ct,_i),_i.draw(Le,Ot.TRIANGLES,Oe,Mi.disabled,Le.colorModeForRenderPass(),Fi.backCW,xi,"skybox",Re.skyboxGeometry.vertexBuffer,Re.skyboxGeometry.indexBuffer,Re.skyboxGeometry.segment)}(Re,Ue,_i,Ct,xi):"gradient"===Jt&&"sky"===Re.renderPass&&function(Re,Oe,Ue,qe,Ct){const Ot=Re.context,Jt=Ot.gl,_i=Re.transform,xi=Re.getOrCreateProgram("skyboxGradient");Oe.skyboxGeometry||(Oe.skyboxGeometry=new Ks(Ot)),Ot.activeTexture.set(Jt.TEXTURE0);let vi=Oe.colorRampTexture;vi||(vi=Oe.colorRampTexture=new Le.T(Ot,Oe.colorRamp,Jt.RGBA8)),vi.bind(Jt.LINEAR,Jt.CLAMP_TO_EDGE);const bi=((Re,Oe,Ue,qe,Ct)=>({u_matrix:Re,u_color_ramp:0,u_center_direction:Oe,u_radius:Le.bB(Ue),u_opacity:qe,u_temporal_offset:Ct}))(_i.skyboxMatrix,Oe.getCenter(Re,!1),Oe.paint.get("sky-gradient-radius"),qe,Ct);Re.uploadCommonUniforms(Ot,xi),xi.draw(Re,Jt.TRIANGLES,Ue,Mi.disabled,Re.colorModeForRenderPass(),Fi.backCW,bi,"skyboxGradient",Oe.skyboxGeometry.vertexBuffer,Oe.skyboxGeometry.indexBuffer,Oe.skyboxGeometry.segment)}(Re,Ue,_i,Ct,xi)},debug:function(Re,Oe,Ue,qe,Ct,Ot){for(let Jt=0;Jt<Ue.length;Jt++)if(Ct){const Ct=1,_i=.8,xi=new Le.bz(qe.r*_i,qe.g*_i,qe.b*_i,1);qs(Re,Oe,Ue[Jt],qe,-Ct,-Ct,Ot),qs(Re,Oe,Ue[Jt],qe,-Ct,Ct,Ot),qs(Re,Oe,Ue[Jt],qe,Ct,Ct,Ot),qs(Re,Oe,Ue[Jt],qe,Ct,-Ct,Ot),qs(Re,Oe,Ue[Jt],xi,0,0,Ot)}else qs(Re,Oe,Ue[Jt],qe,0,0,Ot)},custom:function(Re,Oe,Ue,qe){const Ct=Re.context,Ot=Ue.implementation;if(!Re.transform.projection.unsupportedLayers||!Re.transform.projection.unsupportedLayers.includes("custom")||Re.terrain&&(Re.terrain.renderingToTexture||"offscreen"===Re.renderPass)&&Ue.isDraped(Oe)){if("offscreen"===Re.renderPass){const Oe=Ot.prerender;if(Oe){if(Re.setCustomLayerDefaults(),Ct.setColorMode(Re.colorModeForRenderPass()),"globe"===Re.transform.projection.name){const Ue=Re.transform.pointMerc;Oe.call(Ot,Ct.gl,Re.transform.customLayerMatrix(),Re.transform.getProjection(),Re.transform.globeToMercatorMatrix(),Le.a9(Re.transform.zoom),[Ue.x,Ue.y],Re.transform.pixelsPerMeterRatio)}else Oe.call(Ot,Ct.gl,Re.transform.customLayerMatrix());Ct.setDirty(),Re.setBaseState()}}else if("translucent"===Re.renderPass){if(Re.terrain&&Re.terrain.renderingToTexture){const Oe=Ot.renderToTile;if(Oe){const Ue=qe[0].canonical,Jt=new Le.a5(Ue.x+qe[0].wrap*(1<<Ue.z),Ue.y,Ue.z);Ct.setDepthMode(Li.disabled),Ct.setStencilMode(Mi.disabled),Ct.setColorMode(Re.colorModeForRenderPass()),Re.setCustomLayerDefaults(),Oe.call(Ot,Ct.gl,Jt),Ct.setDirty(),Re.setBaseState()}return}Re.setCustomLayerDefaults(),Ct.setColorMode(Re.colorModeForRenderPass()),Ct.setStencilMode(Mi.disabled);const Oe="3d"===Ot.renderingMode?new Li(Re.context.gl.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D):Re.depthModeForSublayer(0,Li.ReadOnly);if(Ct.setDepthMode(Oe),"globe"===Re.transform.projection.name){const Oe=Re.transform.pointMerc;Ot.render(Ct.gl,Re.transform.customLayerMatrix(),Re.transform.getProjection(),Re.transform.globeToMercatorMatrix(),Le.a9(Re.transform.zoom),[Oe.x,Oe.y],Re.transform.pixelsPerMeterRatio)}else Ot.render(Ct.gl,Re.transform.customLayerMatrix());Ct.setDirty(),Re.setBaseState(),Ct.bindFramebuffer.set(null)}}else Le.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(Re,Oe,Ue,qe){if("opaque"===Re.renderPass)return;const Ct=Ue.paint.get("model-opacity");if(0===Ct)return;const Ot=Ue.paint.get("model-cast-shadows");if("shadow"===Re.renderPass){if(!Ot)return;if(Re.terrain&&Ct<.65&&Ue._transitionablePaint._values["model-opacity"].value.expression instanceof Le.a4)return}const Jt=Re.shadowRenderer,_i=Ue.paint.get("model-receive-shadows");Jt&&(Jt.useNormalOffset=!0,_i||(Jt.enabled=!1));const c=()=>{Jt&&(Jt.useNormalOffset=!0,_i||(Jt.enabled=!0))},xi=Oe.getSource();if("light-beam"===Re.renderPass&&"batched-model"!==xi.type)return;if("vector"===xi.type||"geojson"===xi.type)return function(Re,Oe,Ue,qe,Ct){const Ot=Re.transform;if("mercator"!==Ot.projection.name)return void Le.w(`Drawing 3D models for ${Ot.projection.name} projection is not yet implemented`);const Jt=Ot.getFreeCameraOptions().position;if(!Re.modelManager)return;const _i=Re.modelManager;Ue.modelManager=_i;const xi=Re.shadowRenderer;if(!Ue._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const vi=Ue._unevaluatedLayout._values["model-id"],bi={...Ue.layout.get("model-id").parameters},Pi=Re.style.order.indexOf(Ue.fqid);for(const Hr of qe){const qe=Oe.getTile(Hr).getBucket(Ue);if(!qe||qe.projection.name!==Ot.projection.name)continue;const Jr=qe.getModelUris();Jr&&!qe.modelsRequested&&(_i.addModelsFromBucket(Jr,Ct),qe.modelsRequested=!0);const Ln=ua(Hr,Ot);bi.zoom=Ln;const Nn=vi.possiblyEvaluate(bi);if(ca(Re,qe,Hr),Kd.shadowUniformsInitialized=!1,Kd.useSingleShadowCascade=!!xi&&0===xi.getMaxCascadeForTile(Hr.toUnwrapped()),"shadow"===Re.renderPass&&xi){if(1===Re.currentShadowCascade&&qe.isInsideFirstShadowMapFrustum)continue;const Oe=Ot.calculatePosMatrix(Hr.toUnwrapped(),Ot.worldSize);if(Kd.tileMatrix.set(Oe),Kd.shadowTileMatrix=Float32Array.from(xi.calculateShadowPassMatrixFromMatr
1ix(Oe)),Kd.aabb.min.fill(0),Kd.aabb.max[0]=Kd.aabb.max[1]=Le.ab,Kd.aabb.max[2]=0,pa(qe,Kd,Re,Ue.scope))continue}const Gn=1<<Hr.canonical.z,qn=[((Jt.x-Hr.wrap)*Gn-Hr.canonical.x)*Le.ab,(Jt.y*Gn-Hr.canonical.y)*Le.ab,Jt.z*Gn*Le.ab];Re.conflationActive&&Object.keys(qe.instancesPerModel).length>0&&Re.style.isLayerClipped(Ue,Oe.getSource())&&qe.updateReplacement(Hr,Re.replacementSource,Pi,Ct)&&(qe.uploaded=!1,qe.upload(Re.context));for(let Le in qe.instancesPerModel){const Oe=qe.instancesPerModel[Le];Oe.features.length>0&&(Le=Nn.evaluate(Oe.features[0].feature,{}));const Ot=_i.getModel(Le,Ct);if(Ot&&Ot.uploaded)for(const Le of Ot.nodes)da(Re,Ue,Le,Oe,qn,Hr,Kd)}}}(Re,Oe,Ue,qe,"vector"===xi.type?Ue.scope:""),void c();if(!xi.loaded())return;if("batched-model"===xi.type)return function(Re,Oe,Ue,qe){Ue.resetLayerRenderingStats(Re);const Ct=Re.context,Ot=Re.transform,Jt=Re.style.fog,_i=Re.shadowRenderer;if("mercator"!==Ot.projection.name)return void Le.w(`Drawing 3D landmark models for ${Ot.projection.name} projection is not yet implemented`);const xi=Re.transform.getFreeCameraOptions().position,vi=Le.a6.vec3.scale([],[xi.x,xi.y,xi.z],Re.transform.worldSize),bi=Le.a6.vec3.negate([],vi),Pi=Le.a6.mat4.identity([]),Hr=Le.de(Ot.center.lat,Ot.zoom),Jr=Le.a6.mat4.fromScaling([],[1,1,1/Hr]);Le.a6.mat4.translate(Pi,Pi,bi);const Ln=Ue.paint.get("model-opacity"),Nn=new Li(Ct.gl.LEQUAL,Li.ReadWrite,Re.depthRangeFor3D),Gn=new Li(Ct.gl.LEQUAL,Li.ReadOnly,Re.depthRangeFor3D),qn=new Le.c9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Zn="shadow"===Re.renderPass,$n=Zn&&_i?_i.getCurrentCascadeFrustum():Ot.getFrustum(Ot.scaleZoom(Ot.worldSize)),Xn=Ue.paint.get("model-front-cutoff"),Yn=Xn[2]<1,lo=Wi(Re,Ue.paint.get("model-cutoff-fade-range")),uo=Ue.getLayerRenderingStats();(function(Le,Re,Oe,Ue){const qe=Le.terrain?Le.terrain.exaggeration():0,Ct=Le.transform.zoom;for(const Ot of Ue){const Ue=Re.getTile(Ot).getBucket(Oe);Ue&&(Le.conflationActive&&Ue.updateReplacement(Ot,Le.replacementSource),Ue.evaluateScale(Le,Oe),Le.terrain&&qe>0&&Ue.elevationUpdate(Le.terrain,qe,Ot,Oe.source),Ue.needsReEvaluation(Le,Ct,Oe)&&Ue.evaluate(Oe))}})(Re,Oe,Ue,qe),function(){let xi,bi,po;Yn?(xi=qe.length-1,bi=-1,po=-1):(xi=0,bi=qe.length,po=1);const fo=new Float64Array(16),Io=Le.a6.vec3.create(),is=new Le.P(0,0);for(let as=xi;as!==bi;as+=po){const xi=qe[as],bi=Oe.getTile(xi).getBucket(Ue);if(!bi||!bi.uploaded)continue;let po=!1;_i&&(po=0===_i.getMaxCascadeForTile(xi.toUnwrapped()));const Is=Ot.calculatePosMatrix(xi.toUnwrapped(),Ot.worldSize),Xs=bi.modelTraits;!Zn&&Yn&&(Le.a6.mat4.invert(fo,Is),Le.a6.vec3.transformMat4(Io,vi,fo),is.x=Io[0],is.y=Io[1]);const ha=[];for(const Oe of bi.getNodesInfo()){if(Oe.hiddenByReplacement)continue;if(!Oe.node.meshes)continue;const Ue=Oe.node;let qe=0;Re.terrain&&Ue.elevation&&(qe=Ue.elevation*Re.terrain.exaggeration());const Ct=(()=>{const Re=Oe.aabb;return qn.min=[...Re.min],qn.max=[...Re.max],qn.min[2]+=qe,qn.max[2]+=qe,Le.a6.vec3.transformMat4(qn.min,qn.min,Is),Le.a6.vec3.transformMat4(qn.max,qn.max,Is),qn})(),Jt=Oe.evaluatedScale;if(Jt[0]<=1&&Jt[1]<=1&&Jt[2]<=1&&0===Ct.intersects($n))continue;if(!Zn&&Yn){const Re=1/6;Oe.cameraCollisionOpacity=vi[0]>Ct.min[0]&&vi[0]<Ct.max[0]&&vi[1]>Ct.min[1]&&vi[1]<Ct.max[1]&&vi[2]*Hr<Ct.max[2]&&Ue.footprint&&Le.bu(is,Ue.footprint)?Math.max(Oe.cameraCollisionOpacity-Re,0):Math.min(1,Oe.cameraCollisionOpacity+Re)}const _i=[...Is],xi=Ue.anchor?Ue.anchor[0]:0,bi=Ue.anchor?Ue.anchor[1]:0;Le.a6.mat4.translate(_i,_i,[xi*(Jt[0]-1),bi*(Jt[1]-1),qe]),Le.a6.vec3.exactEquals(Jt,Le.dh)||Le.a6.mat4.scale(_i,_i,Jt);const Pi=Le.a6.mat4.multiply([],_i,Ue.matrix),Jr=Le.a6.mat4.multiply([],Ot.expandedFarZProjMatrix,Pi),Nn=Le.a6.mat4.multiply([],Ot.expandedFarZProjMatrix,_i),Gn=Le.a6.vec4.transformMat4([],[xi,bi,qe,1],Jr)[2];Ue.hidden=!1;let uo=Ln;Zn||(Yn&&(uo*=Oe.cameraCollisionOpacity,uo*=fa(_i,Ot,Oe.aabb,Xn)),uo*=ma(lo,Gn)),0!==uo?ha.push({nodeInfo:Oe,depth:Gn,opacity:uo,wvpForNode:Jr,wvpForTile:Nn,nodeModelMatrix:Pi,tileModelMatrix:_i}):Ue.hidden=!0}Zn||ha.sort(((Le,Re)=>!Yn||1===Le.opacity&&1===Re.opacity?Le.depth<Re.depth?-1:1:1===Le.opacity?-1:1===Re.opacity?1:Le.depth>Re.depth?-1:1));for(const Oe of ha){const qe=Oe.nodeInfo,xi=qe.node;let vi=Le.a6.mat4.multiply([],Jr,Oe.tileModelMatrix);Le.a6.mat4.multiply(vi,Pi,vi);const bi=Le.a6.mat4.invert([],vi);Le.a6.mat4.transpose(bi,bi),Le.a6.mat4.scale(bi,bi,sp),vi=Le.a6.mat4.multiply(vi,vi,xi.matrix
1);const Hr="light-beam"===Re.renderPass,Ln=Xs&Le.dj.HasMapboxMeshFeatures,qn=Ln?0:qe.evaluatedRMEA[0][2];for(let Le=0;Le<xi.meshes.length;++Le){const Pi=xi.meshes[Le],Jr=Le===xi.lightMeshIndex;let $n=Oe.wvpForNode;if(Jr){if(!Hr&&!Re.terrain&&Re.shadowRenderer){Re.currentLayer<Re.firstLightBeamLayer&&(Re.firstLightBeamLayer=Re.currentLayer);continue}$n=Oe.wvpForTile}else if(Hr)continue;const Xn={defines:[]},Yn=[];if(sa(Xn.defines,Yn,Pi,Re,Ue.lut),Ln||Xn.defines.push("DIFFUSE_SHADED"),po&&Xn.defines.push("SHADOWS_SINGLE_CASCADE"),uo&&(Zn?uo.numRenderedVerticesInShadowPass+=Pi.vertexArray.length:uo.numRenderedVerticesInTransparentPass+=Pi.vertexArray.length),Zn){la(Pi,Oe.nodeModelMatrix,Re,Ue);continue}let lo=null;if(Jt){const Le=ra(Oe.nodeModelMatrix,Re.transform);if(lo=new Float32Array(Le),"globe"!==Ot.projection.name){const Re=Pi.aabb.min,Oe=Pi.aabb.max,[Ue,qe]=Jt.getOpacityForBounds(Le,Re[0],Re[1],Oe[0],Oe[1]);Xn.overrideFog=Ue>=ta||qe>=ta}}const fo=Pi.material;let Io;fo.occlusionTexture&&fo.occlusionTexture.offsetScale&&(Io=fo.occlusionTexture.offsetScale,Xn.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!Zn&&_i&&(_i.useNormalOffset=!!Pi.normalBuffer);const is=Re.getOrCreateProgram("model",Xn);!Zn&&_i&&_i.setupShadowsFromMatrix(Oe.tileModelMatrix,is,_i.useNormalOffset),Re.uploadCommonUniforms(Ct,is,null,lo);const as=fo.pbrMetallicRoughness;as.metallicFactor=.9,as.roughnessFactor=.5;const Is=ns(new Float32Array($n),new Float32Array(vi),new Float32Array(bi),new Float32Array(xi.matrix),Re,Oe.opacity,as.baseColorFactor.toRenderColor(null),fo.emissiveFactor,as.metallicFactor,as.roughnessFactor,fo,qn,Ue,[0,0,0],Io);!Jr&&(qe.hasTranslucentParts||Oe.opacity<1)&&is.draw(Re,Ct.gl.TRIANGLES,Nn,Mi.disabled,Ai.disabled,Fi.backCCW,Is,Ue.id,Pi.vertexBuffer,Pi.indexBuffer,Pi.segments,Ue.paint,Re.transform.zoom,void 0,Yn),is.draw(Re,Ct.gl.TRIANGLES,Jr?Gn:Nn,Mi.disabled,Jr||Oe.opacity<1||qe.hasTranslucentParts?Ai.alphaBlended:Ai.unblended,Fi.backCCW,Is,Ue.id,Pi.vertexBuffer,Pi.indexBuffer,Pi.segments,Ue.paint,Re.transform.zoom,void 0,Yn)}}}}()}(Re,Oe,Ue,qe),void c();if("model"!==xi.type)return;const vi=xi.getModels(),bi=[],Pi=Re.transform.getFreeCameraOptions().position,Hr=Le.a6.vec3.scale([],[Pi.x,Pi.y,Pi.z],Re.transform.worldSize);Le.a6.vec3.negate(Hr,Hr);const Jr=[],Ln=[];let Nn=0;for(const Oe of vi){const qe=Ue.paint.get("model-rotation").constantOr(null),Ct=Ue.paint.get("model-scale").constantOr(null),Ot=Ue.paint.get("model-translation").constantOr(null);Oe.computeModelMatrix(Re,qe,Ct,Ot,!0,!0,!1);const Jt=Le.a6.mat4.identity([]),_i=Le.de(Oe.position.lat,Re.transform.zoom),xi=Le.a6.mat4.fromScaling([],[1,1,1/_i]);Le.a6.mat4.translate(Jt,Jt,Hr),bi.push({zScaleMatrix:xi,negCameraPosMatrix:Jt});for(const Le of Oe.nodes)na(Re.transform,Le,Oe.matrix,Re.transform.expandedFarZProjMatrix,Nn,Jr,Ln);Nn++}if(Jr.sort(((Le,Re)=>Re.depth-Le.depth)),"shadow"!==Re.renderPass){if(1===Ct)for(const Le of Ln)aa(Le,Re,Ue,bi[Le.modelIndex],Mi.disabled,Re.colorModeForRenderPass());else{for(const Le of Ln)aa(Le,Re,Ue,bi[Le.modelIndex],Mi.disabled,Ai.disabled);for(const Le of Ln)aa(Le,Re,Ue,bi[Le.modelIndex],Re.stencilModeFor3D(),Re.colorModeForRenderPass());Re.resetStencilClippingMasks()}for(const Le of Jr)aa(Le,Re,Ue,bi[Le.modelIndex],Mi.disabled,Re.colorModeForRenderPass());c()}else{for(const Le of Ln)la(Le.mesh,Le.nodeModelMatrix,Re,Ue);for(const Le of Jr)la(Le.mesh,Le.nodeModelMatrix,Re,Ue);c()}}},cp={model:function(Le,Re,Oe){const Ue=Re.getSource();if(!Ue.loaded())return;if("vector"===Ue.type||"geojson"===Ue.type)return void(Oe.modelManager&&Oe.modelManager.upload(Oe,"vector"===Ue.type?Le.scope:""));if("batched-model"===Ue.type)return;if("model"!==Ue.type)return;const qe=Ue.getModels();for(const Le of qe)Le.upload(Oe.context)},raster:function(Le,Re,Oe){const Ue=Re.getSource();if(!(Ue instanceof Qe&&Ue.loaded()))return;const qe=Le.sourceLayer||Ue.rasterLayerIds&&Ue.rasterLayerIds[0];if(!qe)return;const Ct=Le.paint.get("raster-array-band")||Ue.getInitialBand(qe);if(null==Ct)return;const Ot=Re.getIds().map((Le=>Re.getTileByID(Le)));for(const Le of Ot)Le.updateNeeded(qe,Ct)&&Ue.prepareTile(Le,qe,Ct)},"raster-particle":function(Le,Re,Oe){const Ue=Re.getSource();if(!(Ue instanceof Qe&&Ue.loaded()))return;const qe=Le.sourceLayer||Ue.rasterLayerIds&&Ue.rasterLayerIds[0];if(!qe)return;const Ct=Le.paint.get("raster-particle-array-band")||Ue.getInitialBand(qe);if(null==Ct)return;const Ot=Re.getIds().map((Le=>Re.getTileByID(Le)));for(const Le of Ot)Le.updateNeeded(qe,Ct)&&Ue.prepareTile(Le,qe,Ct)}};class wa{constructor(Re,Oe,Ue,qe){this.context=new ps(Re,Oe),this.transform=Ue,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=qe,this._timeStamp=Le.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const Ct=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const Le of Ct)this._debugParams.enabledLayers[Le]=!0;qe.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},(()=>{this.style.map.triggerRepaint()})),qe.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),qe.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),qe.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),qe.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const Le of Ct)qe.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],Le);this.occlusionParams=new xa(qe),this.setup(),this.numSublayers=vt.maxUnderzooming+vt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new Le.dl,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Ki(this),this._wireframeDebugCache=new va,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const Ot=new Le.r({width:1,height:1},Uint8Array.of(0,0,0,0));
vendor: 5,320 bytes, line 1
1this.emptyDepthTexture=new Le.T(this.context,Ot,Re.RGBA8),this._clippingActiveLastFrame=!1}updateTerrain(Le,Re){const Oe=!!Le&&!!Le.terrain&&this.transform.projection.supportsTerrain;if(!(Oe||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Ar(this,Le));const Ue=this._terrain;this.transform.elevation=Oe?Ue:null,Ue.update(Le,this.transform,Re),this.transform.elevation&&!Ue.enabled&&(this.transform.elevation=null)}_updateFog(Le){const Re=Le.fog;if(!Re||"globe"===this.transform.projection.name||Re.getOpacity(this.transform.pitch)<1||Re.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[Oe,Ue]=Re.getFovAdjustedRange(this.transform._fov);if(Oe>Ue)return void(this.transform.fogCullDistSq=null);const qe=Oe+.78*(Ue-Oe);this.transform.fogCullDistSq=qe*qe}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(Le){Le&&!this._terrain&&(this._terrain=new Ar(this,this.style)),this._forceTerrainMode=Le}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(Re,Oe){if(this.width=Re*Le.q.devicePixelRatio,this.height=Oe*Le.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const Le of this.style.order)this.style._mergedLayers[Le].resize()}setup(){const Re=this.context,Oe=new Le.a_;Oe.emplaceBack(0,0),Oe.emplaceBack(Le.ab,0),Oe.emplaceBack(0,Le.ab),Oe.emplaceBack(Le.ab,Le.ab),this.tileExtentBuffer=Re.createVertexBuffer(Oe,Le.b0.members),this.tileExtentSegments=Le.b1.simpleSegment(0,0,4,2);const Ue=new Le.a_;Ue.emplaceBack(0,0),Ue.emplaceBack(Le.ab,0),Ue.emplaceBack(0,Le.ab),Ue.emplaceBack(Le.ab,Le.ab),this.debugBuffer=Re.createVertexBuffer(Ue,Le.b0.members),this.debugSegments=Le.b1.simpleSegment(0,0,4,5);const qe=new Le.a_;qe.emplaceBack(-1,-1),qe.emplaceBack(1,-1),qe.emplaceBack(-1,1),qe.emplaceBack(1,1),this.viewportBuffer=Re.createVertexBuffer(qe,Le.b0.members),this.viewportSegments=Le.b1.simpleSegment(0,0,4,2);const Ct=new Le.aN;Ct.emplaceBack(0,0,0,0),Ct.emplaceBack(Le.ab,0,Le.ab,0),Ct.emplaceBack(0,Le.ab,0,Le.ab),Ct.emplaceBack(Le.ab,Le.ab,Le.ab,Le.ab),this.mercatorBoundsBuffer=Re.createVertexBuffer(Ct,Le.b3.members),this.mercatorBoundsSegments=Le.b1.simpleSegment(0,0,4,2);const Ot=new Le.aO;Ot.emplaceBack(0,1,2),Ot.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=Re.createIndexBuffer(Ot);const Jt=new Le.a$;for(const Le of[0,1,3,2,0])Jt.emplaceBack(Le);this.debugIndexBuffer=Re.createIndexBuffer(Jt),this.emptyTexture=new Le.T(Re,new Le.r({width:1,height:1},Uint8Array.of(0,0,0,0)),Re.gl.RGBA8),this.identityMat=Le.a6.mat4.create();const _i=this.context.gl;this.stencilClearMode=new Mi({func:_i.ALWAYS,mask:0},0,255,_i.ZERO,_i.ZERO,_i.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(Le){return Le._makeTileBoundsBuffers(this.context,this.transform.projection),Le._tileBoundsBuffer?{tileBoundsBuffer:Le._tileBoundsBuffer,tileBoundsIndexBuffer:Le._tileBoundsIndexBuffer,tileBoundsSegments:Le._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const Le=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,Le.TRIANGLES,Li.disabled,this.stencilClearMode,Ai.disabled,Fi.disabled,Cr(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(Le,Re,Oe){if(!Re||this.currentStencilSource===Re.id||!Le.isTileClipped()||!Oe||0===Oe.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let Le=!1;for(const Re of Oe)if(void 0===this._tileClippingMaskIDs[Re.key]){Le=!0;break}if(!Le)return}this.currentStencilSource=Re.id;const Ue=this.context,qe=Ue.gl;this.nextStencilID+Oe.length>256&&this.clearStencil(),Ue.setColorMode(Ai.disabled),Ue.setDepthMode(Li.disabled);const Ct=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const Le of Oe){const Oe=Re.getTile(Le),Ue=this._tileClippingMaskIDs[Le.key]=this.nextStencilID++,{tileBoundsBuffer:Ot,tileBoundsIndexBuffer:Jt,tileBoundsSegments:_i}=this.getTileBoundsBuffers(Oe);Ct.draw(this,qe.TRIANGLES,Li.disabled,new Mi({func:qe.ALWAYS,mask:0},Ue,255,qe.KEEP,qe.KEEP,qe.REPLACE),Ai.disabled,Fi.disabled,Cr(Le.projMatrix),"$clipping",Ot,Jt,_i)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const Le=this.nextStencilID++,Re=this.context.gl;return new Mi({func:Re.NOTEQUAL,mask:255},Le,255,Re.KEEP,Re.KEEP,Re.REPLACE)}stencilModeForClipping(Le){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(Le);const Re=this.context.gl;return new Mi({func:Re.EQUAL,mask:255},this._tileClippingMaskIDs[Le.key],0,Re.KEEP,Re.KEEP,Re.REPLACE)}stencilConfigForOverlap(Le){const Re=this.context.gl,Oe=Le.sort(((Le,Re)=>
1Re.overscaledZ-Le.overscaledZ)),Ue=Oe[Oe.length-1].overscaledZ,qe=Oe[0].overscaledZ-Ue+1;if(qe>1){this.currentStencilSource=void 0,this.nextStencilID+qe>256&&this.clearStencil();const Le={};for(let Oe=0;Oe<qe;Oe++)Le[Oe+Ue]=new Mi({func:Re.GEQUAL,mask:255},Oe+this.nextStencilID,255,Re.KEEP,Re.KEEP,Re.REPLACE);return this.nextStencilID+=qe,[Le,Oe]}return[{[Ue]:Mi.disabled},Oe]}colorModeForRenderPass(){const Re=this.context.gl;if(this._showOverdrawInspector){const Oe=1/8;return new Ai([Re.CONSTANT_COLOR,Re.ONE,Re.CONSTANT_COLOR,Re.ONE],new Le.bz(Oe,Oe,Oe,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Ai.unblended:Ai.alphaBlended}colorModeForDrapableLayerRenderPass(Re){const Oe=this.context.gl;return(()=>this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?new Ai([Oe.ONE,Oe.ONE_MINUS_SRC_ALPHA,Oe.CONSTANT_ALPHA,Oe.ONE_MINUS_SRC_ALPHA],new Le.bz(0,0,0,void 0===Re?0:Re),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(Le,Re,Oe,Ue=!1){if(this.depthOcclusion)return new Li(this.context.gl.GREATER,Li.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!Ue)return Li.disabled;const qe=1-((1+this.currentLayer)*this.numSublayers+Le)*this.depthEpsilon;return new Li(Oe||this.context.gl.LEQUAL,Re,[qe,qe])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const Re=this.context.gl,Oe=Math.ceil(this.width),Ue=Math.ceil(this.height),qe=this.context.bindFramebuffer.get(),Ct=Re.getParameter(Re.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===Oe&&this.depthFBO.height===Ue||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==Oe&&0!==Ue&&(this.depthFBO=new _s(this.context,Oe,Ue,!1,"texture"),this.depthTexture=new Le.T(this.context,{width:Oe,height:Ue,data:null},Re.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(qe),Re.bindTexture(Re.TEXTURE_2D,Ct),this.depthFBO&&(Re.bindFramebuffer(Re.READ_FRAMEBUFFER,null),Re.bindFramebuffer(Re.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),Re.blitFramebuffer(0,0,Oe,Ue,0,0,Oe,Ue,Re.DEPTH_BUFFER_BIT,Re.NEAREST),Re.bindFramebuffer(Re.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce(((Le,Re)=>Le+Re/this._fpsHistory.length),0))}render(Re,Oe){const Ue=Le.q.now();this._dt=Ue-this._timeStamp,this._timeStamp=Ue,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=Re.map.repaint,this.style=Re,this.options=Oe;const qe=this.style._mergedLayers,Ct=this.style.order.filter((Le=>{const Re=qe[Le];return!(Re.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Re.type]}));let Ot=!1,Jt=!1;for(const Le of Ct){const Re=qe[Le];"circle"===Re.type&&(Ot=!0),"symbol"===Re.type&&(Re.hasInitialOcclusionOpacityProperties?Jt=!0:Ot=!0)}const _i=Ct.map((Le=>qe[Le])),xi=this.style._mergedSourceCaches;this.imageManager=Re.imageManager,this.modelManager=Re.modelManager,this.symbolFadeChange=Re.placement.symbolFadeChange(Le.q.now()),this.imageManager.beginFrame();let vi=0,bi=!1;for(const Le in xi){const Re=xi[Le];Re.used&&(Re.prepare(this.context),Re.getSource().usedInConflation&&++vi)}let Pi=!1;for(const Le of _i)Le.isHidden(this.transform.zoom)||("clip"===Le.type&&(Pi=!0),this.prepareLayer(Le));const Hr={},Jr={},Ln={},Nn={},Gn={};for(const Le in xi){const Re=xi[Le];Hr[Le]=Re.getVisibleCoordinates(),Jr[Le]=Hr[Le].slice().reverse(),Ln[Le]=Re.getVisibleCoordinates(!0).reverse(),Nn[Le]=Re.getShadowCasterCoordinates(),Gn[Le]=Re.sortCoordinatesByDistance(Hr[Le])}const v=Le=>{const Re=this.style.getLayerSourceCache(Le);return Re&&Re.used?Re.getSource():null};if(vi||Pi||this._clippingActiveLastFrame){const Re=[],Oe=[];let Ue=0;for(const Le of _i)this.isSourceForClippingOrConflation(Le,v(Le))&&(Re.push(Le),Oe.push(Ue)),Ue++;if(Re&&(Pi||Re.length>1)||this._clippingActiveLastFrame){Pi=!1;const Ue=[];for(let qe=0;qe<Re.length;qe++){const Ct=Re[qe],Ot=Oe[qe],Jt=this.style.getLayerSourceCache(Ct);if(!Jt||!Jt.used||!Jt.getSource().usedInConflation&&"clip"!==Ct.type)continue;let _i=Le.dn,xi=Le.bs.None;const vi=[];let bi=!0;if("clip"===Ct.type){_i=Ot;
1for(const Re of Ct.layout.get("clip-layer-types"))xi|="model"===Re?Le.bs.Model:"symbol"===Re?Le.bs.Symbol:Le.bs.FillExtrusion;for(const Le of Ct.layout.get("clip-layer-scope"))vi.push(Le);Ct.isHidden(this.transform.zoom)?bi=!1:Pi=!0}bi&&Ue.push({layer:Ct.fqid,cache:Jt,order:_i,clipMask:xi,clipScope:vi})}this.replacementSource.setSources(Ue),bi=!0}}this._clippingActiveLastFrame=Pi,bi||this.replacementSource.clear(),this.conflationActive=bi,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Le=0;Le<_i.length;Le++){const Re=_i[Le],Oe=Re.cutoffRange();if(this.longestCutoffRange=Math.max(Oe,this.longestCutoffRange),Oe>0){const Le=v(Re);Le&&(this.minCutoffZoom=Math.max(Le.minzoom,this.minCutoffZoom)),Re.minzoom&&(this.minCutoffZoom=Math.max(Re.minzoom,this.minCutoffZoom))}Re.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Le),this._lastOcclusionLayer=Le)}const qn=this.style&&this.style.fog;qn?(this._fogVisible=0!==qn.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=qn.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(Ln),this.opaquePassCutoff=0);const Zn=this._shadowRenderer;if(Zn){Zn.updateShadowParameters(this.transform,this.style.directionalLight);for(const Le in xi)for(const Re of Hr[Le]){let Le={min:0,max:0};this.terrain&&(Le=this.terrain.getMinMaxForTile(Re)||Le),Zn.addShadowReceiver(Re.toUnwrapped(),Le.min,Le.max)}}if("globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new Le.dm(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new oa(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!uo.has(this.context.gl))return;this.renderPass="offscreen";for(const Le of _i){const Oe=Re.getLayerSourceCache(Le);if(!Le.hasOffscreenPass()||Le.isHidden(this.transform.zoom))continue;const Ue=Oe?Jr[Oe.id]:void 0;("custom"===Le.type||"raster"===Le.type||"raster-particle"===Le.type||Le.isSky()||Ue&&Ue.length)&&this.renderLayer(this,Oe,Le,Ue)}this.depthRangeFor3D=[0,1-(_i.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Nn)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const $n="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),Xn=(()=>{if(Oe.showOverdrawInspector)return Le.bz.black;const Re=this.style.fog;if(Re&&this.transform.projection.supportsFog){const Oe=this.style.getLut(Re.scope);if(!$n){const Ue=Re.properties.get("color").toRenderColor(Oe).toArray01();return new Le.bz(...Ue)}if($n){const Ue=Re.properties.get("space-color").toRenderColor(Oe).toArray01();return new Le.bz(...Ue)}}return Le.bz.transparent})();if(this.context.clear({color:Xn,depth:1}),this.clearStencil(),this._showOverdrawInspector=Oe.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&$n&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=Ct.length-1;this.currentLayer>=0;this.currentLayer--){const Le=_i[this.currentLayer],Oe=Re.getLayerSourceCache(Le);if(Le.isSky())continue;const Ue=Oe?(Le.is3D()?Gn:Jr)[Oe.id]:void 0;this._renderTileClippingMasks(Le,Oe,Ue),this.renderLayer(this,Oe,Le,Ue)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&$n&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||Le.a9(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<Ct.length;this.currentLayer++){const Le=_i[this.currentLayer],Oe=Re.getLayerSourceCache(Le);Le.isSky()&&this.renderLayer(this,Oe,Le,Oe?Jr[Oe.id]:void 0)}function T(Le,Re){let Oe;return Re&&(Oe=("symbol"===Le.type?Ln:Le.is3D()?Gn:Jr)[Re.id]),Oe}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<Ct.length;){const Le=_i[this.currentLayer];if("raster"===Le.type||"raster-particle"===Le.type){const Oe=Re.getLayerSourceCache(Le);this.renderLayer(this,Oe,Le,T(Le,Oe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Yn=0;Zn&&(Yn=Zn.getShadowCastingLayerCount());let lo=!1,po=-1;for(let Le=0;Le<Ct.length;++Le){const Re=_i[Le];Re.isHidden(this.transform.zoom)||Re.is3D()&&(po=Le)}
1for(Jt&&-1===po&&(Ot=!0);this.currentLayer<Ct.length;){const Le=_i[this.currentLayer],Oe=Re.getLayerSourceCache(Le);if(Le.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(Le)){if(Le.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(Ot&&!lo&&this.terrain&&!this.transform.isOrthographic&&(lo=!0,this.blitDepth()),Jt&&-1!==po&&this.currentLayer===po+1&&!this.transform.isOrthographic&&this.blitDepth(),Le.is3D()||this.terrain||this._renderTileClippingMasks(Le,Oe,Oe?Hr[Oe.id]:void 0),this.renderLayer(this,Oe,Le,T(Le,Oe)),!this.terrain&&Zn&&Yn>0&&Le.hasShadowPass()&&0==--Yn&&(Zn.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const Le=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Le;this.currentLayer++){const Le=_i[this.currentLayer];if(!Le.hasLightBeamPass())continue;const Oe=Re.getLayerSourceCache(Le);this.renderLayer(this,Oe,Le,Oe?Jr[Oe.id]:void 0)}this.currentLayer=Le,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Le=this.currentLayer;this.depthOcclusion=!0;for(const Le of this.layersWithOcclusionOpacity){this.currentLayer=Le;const Oe=_i[this.currentLayer],Ue=Re.getLayerSourceCache(Oe),qe=Ue?Jr[Ue.id]:void 0;Oe.is3D()||this.terrain||this._renderTileClippingMasks(Oe,Ue,Ue?Hr[Ue.id]:void 0),this.renderLayer(this,Ue,Oe,qe)}this.depthOcclusion=!1,this.currentLayer=Le,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Oe=null;_i.forEach((Le=>{const Ue=Re.getLayerSourceCache(Le);Ue&&!Le.isHidden(this.transform.zoom)&&Ue.getVisibleCoordinates().length&&(!Oe||Oe.getSource().maxzoom<Ue.getSource().maxzoom)&&(Oe=Ue)})),Oe&&this.options.showTileBoundaries&&ap.debug(this,Oe,Oe.getVisibleCoordinates(),Le.bz.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&ap.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new Le.bz(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(Le){const Re=Le.transform.padding;Zs(Le,Le.transform.height-(Re.top||0),3,Sd),Zs(Le,Re.bottom||0,3,Ad),Hs(Le,Re.left||0,3,Cd),Hs(Le,Le.transform.width-(Re.right||0),3,zd);const Oe=Le.transform.centerPoint;!function(Le,Re,Oe,Ue){Ws(Le,Re-1,Oe-10,2,20,Ue),Ws(Le,Re-10,Oe-1,20,2,Ue)}(Le,Oe.x,Le.transform.height-Oe.y,Od)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
1anvasCopy()),bi||(this.conflationActive=!1)}prepareLayer(Le){this.gpuTimingStart(Le);const{unsupportedLayers:Re}=this.transform.projection,Oe=!Re||!Re.includes(Le.type);if(cp[Le.type]&&(Oe||this.terrain&&"custom"===Le.type)){const Re=this.style.getLayerSourceCache(Le);cp[Le.type](Le,Re,this)}this.gpuTimingEnd()}renderLayer(Le,Re,Oe,Ue){Oe.isHidden(this.transform.zoom)||("background"===Oe.type||"sky"===Oe.type||"custom"===Oe.type||"model"===Oe.type||"raster"===Oe.type||"raster-particle"===Oe.type||Ue&&Ue.length)&&(this.id=Oe.id,this.gpuTimingStart(Oe),Le.transform.projection.unsupportedLayers&&Le.transform.projection.unsupportedLayers.includes(Oe.type)&&(!Le.terrain||"custom"!==Oe.type)||"clip"===Oe.type||ap[Oe.type](Le,Re,Oe,Ue,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(Le){if(!this.options.gpuTiming)return;const Re=this.context.extTimerQuery,Oe=this.context.gl;let Ue=this.gpuTimers[Le.id];Ue||(Ue=this.gpuTimers[Le.id]={calls:0,cpuTime:0,query:Oe.createQuery()}),Ue.calls++,Oe.beginQuery(Re.TIME_ELAPSED_EXT,Ue.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const Le=this.context.extTimerQuery,Re=this.context.gl,Oe=Re.createQuery();this.deferredRenderGpuTimeQueries.push(Oe),Re.beginQuery(Le.TIME_ELAPSED_EXT,Oe)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const Le=this.gpuTimers;return this.gpuTimers={},Le}collectDeferredRenderGpuQueries(){const Le=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],Le}queryGpuTimers(Le){const Re={};for(const Oe in Le){const Ue=Le[Oe],qe=this.context.extTimerQuery,Ct=qe.getQueryParameter(Ue.query,this.context.gl.QUERY_RESULT)/1e6;qe.deleteQueryEXT(Ue.query),Re[Oe]=Ct}return Re}queryGpuTimeDeferredRender(Le){if(!this.options.gpuTimingDeferredRender)return 0;const Re=this.context.extTimerQuery,Oe=this.context.gl;let Ue=0;for(const qe of Le)Ue+=Re.getQueryParameter(qe,Oe.QUERY_RESULT)/1e6,Re.deleteQueryEXT(qe);return Ue}translatePosMatrix(Re,Oe,Ue,qe,Ct){if(!Ue[0]&&!Ue[1])return Re;const Ot=Ct?"map"===qe?this.transform.angle:0:"viewport"===qe?-this.transform.angle:0;if(Ot){const Le=Math.sin(Ot),Re=Math.cos(Ot);Ue=[Ue[0]*Re-Ue[1]*Le,Ue[0]*Le+Ue[1]*Re]}const Jt=[Ct?Ue[0]:Le.ak(Oe,Ue[0],this.transform.zoom),Ct?Ue[1]:Le.ak(Oe,Ue[1],this.transform.zoom),0],_i=new Float32Array(16);return Le.a6.mat4.translate(_i,Re,Jt),_i}saveTileTexture(Le){const Re=Le.size[0],Oe=this._tileTextures[Re];Oe?Oe.push(Le):this._tileTextures[Re]=[Le]}getTileTexture(Le){const Re=this._tileTextures[Le];return Re&&Re.length>0?Re.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(Le,Re,Oe){const Ue=void 0===Oe?this.terrain&&this.terrain.renderingToTexture:Oe,qe=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===Le||"terrainRaster"===Le?(qe.push("LIGHTING_3D_MODE"),qe.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):Ue||qe.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass?this._shadowMapDebug||qe.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?qe.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):qe.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(qe.push("TERRAIN"),this.linearFloatFilteringSupported()&&qe.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&qe.push("GLOBE"),!this._fogVisible||Ue||void 0!==Re&&!Re||qe.push("FOG","FOG_DITHERING"),Ue&&qe.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&qe.push("OVERDRAW_INSPECTOR"),qe}getOrCreateProgram(Le,Re){this.cache=this.cache||{};const Oe=Re&&Re.defines||[],Ue=Re&&Re.config,qe=this.currentGlobalDefines(Le,Re&&Re.overrideFog,Re&&Re.overrideRtt).concat(Oe),Ct=zr.cacheKey(Tu[Le],Le,qe,Ue);return this.cache[Ct]||(this.cache[Ct]=new zr(this.context,Le,Tu[Le],Ue,id[Le],qe)),this.cache[Ct]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const Le=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(Le.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Le.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
vendor: 4,458 bytes, line 1
1stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(Re,Oe){if(this.style.enable3dLights()){const Ue=this.style.directionalLight,qe=this.style.ambientLight;if(Ue&&qe){const Ct=((Re,Oe,Ue)=>{const qe=Re.properties.get("direction"),Ct=Re.properties.get("color").toRenderColor(Ue.getLut(Re.scope)).toArray01(),Ot=Re.properties.get("intensity"),Jt=Oe.properties.get("color").toRenderColor(Ue.getLut(Oe.scope)).toArray01(),_i=Oe.properties.get("intensity"),xi=[qe.x,qe.y,qe.z],vi=Le.cH(Jt,_i),bi=Le.cH(Ct,Ot);return{u_lighting_ambient_color:vi,u_lighting_directional_dir:xi,u_lighting_directional_color:bi,u_ground_radiance:Lr(xi,bi,vi)}})(Ue,qe,this.style);Oe.setLightsUniformValues(Re,Ct)}}}uploadCommonUniforms(Re,Oe,Ue,qe,Ct){if(this.uploadCommonLightUniforms(Re,Oe),this.terrain&&this.terrain.renderingToTexture)return;const Ot=this.style.fog;if(Ot){const Ct=Ot.getOpacity(this.transform.pitch),Jt=((Re,Oe,Ue,qe,Ct,Ot,Jt,_i,xi,vi,bi,Pi)=>{const Hr=Re.transform,Jr=Oe.properties.get("color").toRenderColor(Re.style.getLut(Oe.scope)).toArray01();Jr[3]=qe;const Ln=Re.frameCounter/1e3%1,[Nn,Gn]=Oe.properties.get("vertical-range");return{u_fog_matrix:Ue?Hr.calculateFogTileMatrix(Ue):Pi||Re.identityMat,u_fog_range:Oe.getFovAdjustedRange(Hr._fov),u_fog_color:Jr,u_fog_horizon_blend:Oe.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(Nn,Gn),Gn],u_fog_temporal_offset:Ln,u_frustum_tl:Ct,u_frustum_tr:Ot,u_frustum_br:Jt,u_frustum_bl:_i,u_globe_pos:xi,u_globe_radius:vi,u_viewport:bi,u_globe_transition:Le.a9(Hr.zoom),u_is_globe:+("globe"===Hr.projection.name)}})(this,Ot,Ue,Ct,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*Le.q.devicePixelRatio,this.transform.height*Le.q.devicePixelRatio],qe);Oe.setFogUniformValues(Re,Jt)}Ct&&Oe.setCutoffUniformValues(Re,Ct.uniformValues)}setTileLoadedFlag(Le){this.tileLoaded=Le}saveCanvasCopy(){const Le=this.canvasCopy();Le&&(this.frameCopies.push(Le),this.tileLoaded=!1)}canvasCopy(){const Le=this.context.gl,Re=Le.createTexture();return Le.bindTexture(Le.TEXTURE_2D,Re),Le.copyTexImage2D(Le.TEXTURE_2D,0,Le.RGBA,0,0,Le.drawingBufferWidth,Le.drawingBufferHeight,0),Re}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const Le=this.style&&this.style.fog;return!!Le&&0!==Le.getOpacity(this.transform.pitch)}getBackgroundTiles(){const Le=this._backgroundTiles,Re=this._backgroundTiles={},Oe=this.transform.coveringTiles({tileSize:512});for(const Ue of Oe)Re[Ue.key]=Le[Ue.key]||new pt(Ue,512,this.transform.tileZoom,this);return Re}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(Le,Re){return!(!Le.is3D()||"clip"!==Le.type&&(Le.minzoom&&Le.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==Le.sourceLayer)&&(!Re||"batched-model"!==Re.type)))}isTileAffectedByFog(Le){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let Re=this._cachedTileFogOpacities[Le.key];return Re||(this._cachedTileFogOpacities[Le.key]=Re=this.style.fog.getOpacityForTile(Le)),Re[0]>=ta||Re[1]>=ta}setupDepthForOcclusion(Le,Re,Oe){const Ue=this.context,qe=Ue.gl,Ct=!!Oe;var Ot;Oe||(Oe={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),Ue.activeTexture.set(qe.TEXTURE3),Le&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(qe.NEAREST,qe.CLAMP_TO_EDGE),Oe.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],Oe.u_depth_range_unpack=[2/((Ot=this.depthRangeFor3D)[1]-Ot[0]),-1-2*Ot[0]/(Ot[1]-Ot[0])],Oe.u_occluder_half_size=.5*this.occlusionParams.occluderSize,Oe.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
vendor: 13,127 bytes, line 1
1DepthTexture.bind(qe.NEAREST,qe.CLAMP_TO_EDGE),Ue.activeTexture.set(qe.TEXTURE0),Ct||Re.setTerrainUniformValues(Ue,Oe)}}function Ta(Le,Re){let Oe=!1,Ue=null;const r=()=>{Ue=null,Oe&&(Le(),Ue=setTimeout(r,Re),Oe=!1)};return()=>(Oe=!0,Ue||r(),Ue)}class Ea{constructor(Re){this._hashName=Re&&encodeURIComponent(Re),Le.aJ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Ta(this._updateHashUnthrottled.bind(this),300)}addTo(Le){return this._map=Le,window.addEventListener("hashchange",this._onHashChange,!1),Le.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const Le=this._map;if(!Le)return"";const Re=Ca(Le);if(this._hashName){const Le=this._hashName;let Oe=!1;const Ue=location.hash.slice(1).split("&").map((Ue=>{const qe=Ue.split("=")[0];return qe===Le?(Oe=!0,`${qe}=${Re}`):Ue})).filter((Le=>Le));return Oe||Ue.push(`${Le}=${Re}`),`#${Ue.join("&")}`}return`#${Re}`}_getCurrentHash(){const Le=location.hash.replace("#","");if(this._hashName){let Re;return Le.split("&").map((Le=>Le.split("="))).forEach((Le=>{Le[0]===this._hashName&&(Re=Le)})),(Re&&Re[1]||"").split("/")}return Le.split("/")}_onHashChange(){const Le=this._map;if(!Le)return!1;const Re=this._getCurrentHash();if(Re.length>=3&&!Re.some((Le=>isNaN(Le)))){const Oe=Le.dragRotate.isEnabled()&&Le.touchZoomRotate.isEnabled()?+(Re[3]||0):Le.getBearing();return Le.jumpTo({center:[+Re[2],+Re[1]],zoom:+Re[0],bearing:Oe,pitch:+(Re[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Ca(Le,Re){const Oe=Le.getCenter(),Ue=Math.round(100*Le.getZoom())/100,qe=Math.ceil((Ue*Math.LN2+Math.log(512/360/.5))/Math.LN10),Ct=Math.pow(10,qe),Ot=Math.round(Oe.lng*Ct)/Ct,Jt=Math.round(Oe.lat*Ct)/Ct,_i=Le.getBearing(),xi=Le.getPitch();let vi=Re?`/${Ot}/${Jt}/${Ue}`:`${Ue}/${Jt}/${Ot}`;return(_i||xi)&&(vi+="/"+Math.round(10*_i)/10),xi&&(vi+=`/${Math.round(xi)}`),vi}const hp={linearity:.3,easing:Le.dp(0,0,.3,1)},dp=Le.l({deceleration:2500,maxSpeed:1400},hp),pp=Le.l({deceleration:20,maxSpeed:1400},hp),fp=Le.l({deceleration:1e3,maxSpeed:360},hp),mp=Le.l({deceleration:1e3,maxSpeed:90},hp);class La{constructor(Le){this._map=Le,this.clear()}clear(){this._inertiaBuffer=[]}record(Re){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Le.q.now(),settings:Re})}_drainInertiaBuffer(){const Re=this._inertiaBuffer,Oe=Le.q.now();for(;Re.length>0&&Oe-Re[0].time>160;)Re.shift()}_onMoveEnd(Re){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const Oe={zoom:0,bearing:0,pitch:0,pan:new Le.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:Le}of this._inertiaBuffer)Oe.zoom+=Le.zoomDelta||0,Oe.bearing+=Le.bearingDelta||0,Oe.pitch+=Le.pitchDelta||0,Le.panDelta&&Oe.pan._add(Le.panDelta),Le.around&&(Oe.around=Le.around),Le.pinchAround&&(Oe.pinchAround=Le.pinchAround);const Ue=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,qe={};if(Oe.pan.mag()){const Ct=Ma(Oe.pan.mag(),Ue,Le.l({},dp,Re||{}));qe.offset=Oe.pan.mult(Ct.amount/Oe.pan.mag()),qe.center=this._map.transform.center,Pa(qe,Ct)}if(Oe.zoom){const Le=Ma(Oe.zoom,Ue,pp);qe.zoom=this._map.transform.zoom+Le.amount,Pa(qe,Le)}if(Oe.bearing){const Re=Ma(Oe.bearing,Ue,fp);qe.bearing=this._map.transform.bearing+Le.ap(Re.amount,-179,179),Pa(qe,Re)}if(Oe.pitch){const Le=Ma(Oe.pitch,Ue,mp);qe.pitch=this._map.transform.pitch+Le.amount,Pa(qe,Le)}if(qe.zoom||qe.bearing){const Le=void 0===Oe.pinchAround?Oe.around:Oe.pinchAround;qe.around=Le?this._map.unproject(Le):this._map.getCenter()}return this.clear(),qe.noMoveStart=!0,qe}}function Pa(Le,Re){(!Le.duration||Le.duration<Re.duration)&&(Le.duration=Re.duration,Le.easing=Re.easing)}function Ma(Re,Oe,Ue){const{maxSpeed:qe,linearity:Ct,deceleration:Ot}=Ue,Jt=Le.ap(Re*Ct/(Oe/1e3),-qe,qe),_i=Math.abs(Jt)/(Ot*Ct);return{easing:Ue.easing,duration:1e3*_i,amount:Jt*(_i/2)}}class za extends Le.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(Re,Oe,Ue,qe={}){const Ct=g(Oe.getCanvasContainer(),Ue),Ot=Oe.unproject(Ct);super(Re,Le.l({point:Ct,lngLat:Ot,originalEvent:Ue},qe)),this._defaultPrevented=!1,this.target=Oe}}class Oa extends Le.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(Re,Oe,Ue){const qe="touchend"===Re?Ue.changedTouches:Ue.touches,Ct=v(Oe.getCanvasContainer(),qe),Ot=Ct.map((Le=>Oe.unproject(Le))),Jt=Ct.reduce(((Le,Re,Oe,Ue)=>Le.add(Re.div(Ue.length))),new Le.P(0,0));super(Re,{points:Ct,point:Jt,lngLats:Ot,lngLat:Oe.unproject(Jt),originalEvent:Ue}),this._defaultPrevented=!1}}class Fa extends Le.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(Le,Re){super("wheel",{originalEvent:Re}),this._defaultPrevented=!1}}class ka{constructor(Le,Re){this._map=Le,this._clickTolerance=Re.clickTolerance}reset(){this._mousedownPos=void 0}wheel(Le){return this._firePreventable(new Fa(this._map,Le))}mousedown(Le,Re){return this._mousedownPos=Re,this._firePreventable(new za(Le.type,this._map,Le))}mouseup(Le){this._map.fire(new za(Le.type,this._map,Le))}preclick(Re){const Oe=Le.l({},Re);Oe.type="preclick",this._map.fire(new za(Oe.type,this._map,Oe))}click(Le,Re){this._mousedownPos&&this._mousedownPos.dist(Re)>=this._clickTolerance||(this.preclick(Le),this._map.fire(new za(Le.type,this._map,Le)))}dblclick(Le){return this._firePreventable(new za(Le.type,this._map,Le))}mouseover(Le){this._map.fire(new za(Le.type,this._map,Le))}mouseout(Le){this._map.fire(new za(Le.type,this._map,Le))}touchstart(Le){return this._firePreventable(new Oa(Le.type,this._map,Le))}touchmove(Le){this._map.fire(new Oa(Le.type,this._map,Le))}touchend(Le){this._map.fire(new Oa(Le.type,this._map,Le))}touchcancel(Le){this._map.fire(new Oa(Le.type,this._map,Le))}_firePreventable(Le){if(this._map.fire(Le),Le.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ba{constructor(Le){this._map=Le}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(Le){this._map.fire(new za(Le.type,this._map,Le))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new za("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(Le){this._delayContextMenu?this._contextMenuEvent=Le:this._map.fire(new za(Le.type,this._map,Le)),this._map.listens("contextmenu")&&Le.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Na{constructor(Le,Re){this._map=Le,this._el=Le.getCanvasContainer(),this._container=Le.getContainer(),this._clickTolerance=Re.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(Le,Re){this.isEnabled()&&Le.shiftKey&&0===Le.button&&(_(),this._startPos=this._lastPos=Re,this._active=!0)}mousemoveWindow(Le,Re){if(!this._active)return;const Oe=Re,Ue=this._startPos,qe=this._lastPos;if(!Ue||!qe||qe.equals(Oe)||!this._box&&Oe.dist(Ue)<this._clickTolerance)return;this._lastPos=Oe,this._box||(this._box=l("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",Le));const Ct=Math.min(Ue.x,Oe.x),Ot=Math.max(Ue.x,Oe.x),Jt=Math.min(Ue.y,Oe.y),_i=Math.max(Ue.y,Oe.y);this._map._requestDomTask((()=>{this._box&&(this._box.style.transform=`translate(${Ct}px,${Jt}px)`,this._box.style.width=Ot-Ct+"px",this._box.style.height=_i-Jt+"px")}))}mouseupWindow(Re,Oe){if(!this._active)return;const Ue=this._startPos,qe=Oe;if(Ue&&0===Re.button){if(this.reset(),f(),Ue.x!==qe.x||Ue.y!==qe.y)return this._map.fire(new Le.x("boxzoomend",{originalEvent:Re})),{cameraAnimation:Le=>Le.fitScreenCoordinates(Ue,qe,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",Re)}}keydown(Le){this._active&&27===Le.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",Le))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),p(),delete this._startPos,delete this._lastPos}_fireEvent(Re,Oe){return this._map.fire(new Le.x(Re,{originalEvent:Oe}))}}function Ua(Le,Re){const Oe={};for(let Ue=0;Ue<Le.length;Ue++)Oe[Le[Ue].identifier]=Re[Ue];return Oe}class Ga{constructor(Le){this.reset(),this.numTouches=Le.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(Re,Oe,Ue){(this.centroid||Ue.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=Re.timeStamp),Ue.length===this.numTouches&&(this.centroid=function(Re){const Oe=new Le.P(0,0);for(const Le of Re)Oe._add(Le);return Oe.div(Re.length)}(Oe),this.touches=Ua(Ue,Oe)))}touchmove(Le,Re,Oe){if(this.aborted||!this.centroid)return;const Ue=Ua(Oe,Re);for(const Le in this.touches){const Re=Ue[Le];(!Re||Re.dist(this.touches[Le])>30)&&(this.aborted=!0)}}touchend(Le,Re,Oe){if((!this.centroid||Le.timeStamp-this.startTime>500)&&(this.aborted=!0),0===Oe.length){const Le=!this.aborted&&this.centroid;if(this.reset(),Le)return Le}}}class ja{constructor(Le){this.singleTap=new Ga(Le),this.numTaps=Le.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(Le,Re,Oe){this.singleTap.touchstart(Le,Re,Oe)}touchmove(Le,Re,Oe){this.singleTap.touchmove(Le,Re,Oe)}touchend(Le,Re,Oe){const Ue=this.singleTap.touchend(Le,Re,Oe);if(Ue){const Re=Le.timeStamp-this.lastTime<500,Oe=!this.lastTap||this.lastTap.dist(Ue)<30;if(Re&&Oe||this.reset(),this.count++,this.lastTime=Le.timeStamp,this.lastTap=Ue,this.count===this.numTaps)return this.reset(),Ue}}}class Va{constructor(){this._zoomIn=new ja({numTouches:1,numTaps:2}),this._zoomOut=new ja({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(Le,Re,Oe){this._zoomIn.touchstart(Le,Re,Oe),this._zoomOut.touchstart(Le,Re,Oe)}touchmove(Le,Re,Oe){this._zoomIn.touchmove(Le,Re,Oe),this._zoomOut.touchmove(Le,Re,Oe)}touchend(Le,Re,Oe){const Ue=this._zoomIn.touchend(Le,Re,Oe),qe=this._zoomOut.touchend(Le,Re,Oe);return Ue?(this._active=!0,Le.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:Re=>Re.easeTo({duration:300,zoom:Re.getZoom()+1,around:Re.unproject(Ue)},{originalEvent:Le})}):qe?(this._active=!0,Le.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:Re=>Re.easeTo({duration:300,zoom:Re.getZoom()-1,around:Re.unproject(qe)},{originalEvent:Le})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const yp={0:1,2:2};class Za{constructor(Le){this.reset(),this._clickTolerance=Le.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(Le,Re){return!1}_move(Le,Re){return{}}mousedown(Le,Re){if(this._lastPoint)return;const Oe=x(Le);this._correctButton(Le,Oe)&&(this._lastPoint=Re,this._eventButton=Oe)}mousemoveWindow(Le,Re){const Oe=this._lastPoint;if(Oe)if(Le.preventDefault(),null!=this._eventButton&&function(Le,Re){const Oe=yp[Re];return void 0===Le.buttons||(Le.buttons&Oe)!==Oe}(Le,this._eventButton))this.reset();else if(this._moved||!(Re.dist(Oe)<this._clickTolerance))return this._moved=!0,this._lastPoint=Re,this._move(Oe,Re)}mouseupWindow(Le){this._lastPoint&&x(Le)===this._eventButton&&(this._moved&&f(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ha extends Za{mousedown(Le,Re){super.mousedown(Le,Re),this._lastPoint&&(this._active=!0)}_correctButton(Le,Re){return 0===Re&&!Le.ctrlKey}_move(Le,Re){return{around:Re,panDelta:Re.sub(Le)}}}class Wa extends Za{_correctButton(Le,Re){return 0===Re&&Le.ctrlKey||2===Re}_move(Le,Re){const Oe=.8*(Re.x-Le.x);if(Oe)return this._active=!0,{bearingDelta:Oe}}contextmenu(Le){Le.preventDefault()}}class $a extends Za{_correctButton(Le,Re){return 0===Re&&Le.ctrlKey||2===Re}_move(Le,Re){const Oe=-.5*(Re.y-Le.y);if(Oe)return this._active=!0,{pitchDelta:Oe}}contextmenu(Le){Le.preventDefault()}}class Xa{constructor(Re,Oe){this._map=Re,this._el=Re.getCanvasContainer(),this._minTouches=1,this._clickTolerance=Oe.clickTolerance||1,this.reset(),Le.aJ(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new Le.P(0,0)}touchstart(Le,Re,Oe){return this._calculateTransform(Le,Re,Oe)}touchmove(Re,Oe,Ue){if(this._active&&!(Ue.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===Ue.length&&!Le.dq())return void this._showTouchPanBlockerAlert();
vendor: 4,090 bytes, line 1
1"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return Re.cancelable&&Re.preventDefault(),this._calculateTransform(Re,Oe,Ue)}}touchend(Le,Re,Oe){this._calculateTransform(Le,Re,Oe),this._active&&Oe.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(Re,Oe,Ue){Ue.length>0&&(this._active=!0);const qe=Ua(Ue,Oe),Ct=new Le.P(0,0),Ot=new Le.P(0,0);let Jt=0;for(const Le in qe){const Re=qe[Le],Oe=this._touches[Le];Oe&&(Ct._add(Re),Ot._add(Re.sub(Oe)),Jt++,qe[Le]=Re)}if(this._touches=qe,Jt<this._minTouches||!Ot.mag())return;const _i=Ot.div(Jt);return this._sum._add(_i),this._sum.mag()<this._clickTolerance?void 0:{around:Ct.div(Jt),panDelta:_i}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")}),500)}}class Ya{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(Le){}_move(Le,Re,Oe){return{}}touchstart(Le,Re,Oe){this._firstTwoTouches||Oe.length<2||(this._firstTwoTouches=[Oe[0].identifier,Oe[1].identifier],this._start([Re[0],Re[1]]))}touchmove(Le,Re,Oe){const Ue=this._firstTwoTouches;if(!Ue)return;Le.preventDefault();const[qe,Ct]=Ue,Ot=Ka(Oe,Re,qe),Jt=Ka(Oe,Re,Ct);if(!Ot||!Jt)return;const _i=this._aroundCenter?null:Ot.add(Jt).div(2);return this._move([Ot,Jt],_i,Le)}touchend(Le,Re,Oe){if(!this._firstTwoTouches)return;const[Ue,qe]=this._firstTwoTouches,Ct=Ka(Oe,Re,Ue),Ot=Ka(Oe,Re,qe);Ct&&Ot||(this._active&&f(),this.reset())}touchcancel(){this.reset()}enable(Le){this._enabled=!0,this._aroundCenter=!!Le&&"center"===Le.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ka(Le,Re,Oe){for(let Ue=0;Ue<Le.length;Ue++)if(Le[Ue].identifier===Oe)return Re[Ue]}function Ja(Le,Re){return Math.log(Le/Re)/Math.LN2}class Qa extends Ya{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(Le){this._startDistance=this._distance=Le[0].dist(Le[1])}_move(Le,Re){const Oe=this._distance;if(this._distance=Le[0].dist(Le[1]),this._active||!(Math.abs(Ja(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ja(this._distance,Oe),pinchAround:Re}}}function en(Le,Re){return 180*Le.angleWith(Re)/Math.PI}class tn extends Ya{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(Le){this._startVector=this._vector=Le[0].sub(Le[1]),this._minDiameter=Le[0].dist(Le[1])}_move(Le,Re){const Oe=this._vector;if(this._vector=Le[0].sub(Le[1]),Oe&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:en(this._vector,Oe),pinchAround:Re}}_isBelowThreshold(Le){this._minDiameter=Math.min(this._minDiameter,Le.mag());const Re=25/(Math.PI*this._minDiameter)*360,Oe=this._startVector;if(!Oe)return!1;const Ue=en(Le,Oe);return Math.abs(Ue)<Re}}function on(Le){return Math.abs(Le.y)>Math.abs(Le.x)}class rn extends Ya{constructor(Le){super(),this._map=Le}
vendor: 4,307 bytes, line 1
1reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(Le){this._lastPoints=Le,on(Le[0].sub(Le[1]))&&(this._valid=!1)}_move(Re,Oe,Ue){const qe=this._lastPoints;if(!qe)return;const Ct=Re[0].sub(qe[0]),Ot=Re[1].sub(qe[1]);return this._map._cooperativeGestures&&!Le.dq()&&Ue.touches.length<3||(this._valid=this.gestureBeginsVertically(Ct,Ot,Ue.timeStamp),!this._valid)?void 0:(this._lastPoints=Re,this._active=!0,{pitchDelta:(Ct.y+Ot.y)/2*-.5})}gestureBeginsVertically(Le,Re,Oe){if(void 0!==this._valid)return this._valid;const Ue=Le.mag()>=2,qe=Re.mag()>=2;if(!Ue&&!qe)return;if(!Ue||!qe)return null==this._firstMove&&(this._firstMove=Oe),Oe-this._firstMove<100&&void 0;const Ct=Le.y>0==Re.y>0;return on(Le)&&on(Re)&&Ct}}const xp={panStep:100,bearingStep:15,pitchStep:10};class an{constructor(){const Le=xp;this._panStep=Le.panStep,this._bearingStep=Le.bearingStep,this._pitchStep=Le.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(Le){if(Le.altKey||Le.ctrlKey||Le.metaKey)return;let Re=0,Oe=0,Ue=0,qe=0,Ct=0;switch(Le.keyCode){case 61:case 107:case 171:case 187:Re=1;break;case 189:case 109:case 173:Re=-1;break;case 37:Le.shiftKey?Oe=-1:(Le.preventDefault(),qe=-1);break;case 39:Le.shiftKey?Oe=1:(Le.preventDefault(),qe=1);break;case 38:Le.shiftKey?Ue=1:(Le.preventDefault(),Ct=-1);break;case 40:Le.shiftKey?Ue=-1:(Le.preventDefault(),Ct=1);break;default:return}return this._rotationDisabled&&(Oe=0,Ue=0),{cameraAnimation:Ot=>{const Jt=Ot.getZoom();Ot.easeTo({duration:300,easeId:"keyboardHandler",easing:nn,zoom:Re?Math.round(Jt)+Re*(Le.shiftKey?2:1):Jt,bearing:Ot.getBearing()+Oe*this._bearingStep,pitch:Ot.getPitch()+Ue*this._pitchStep,offset:[-qe*this._panStep,-Ct*this._panStep],center:Ot.getCenter()},{originalEvent:Le})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function nn(Le){return Le*(2-Le)}const vp=4.000244140625,bp=1/450;class hn{constructor(Re,Oe){this._map=Re,this._el=Re.getCanvasContainer(),this._handler=Oe,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=bp,Le.aJ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(Le){this._defaultZoomRate=Le}setWheelZoomRate(Le){this._wheelZoomRate=Le}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(Le){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!Le&&"center"===Le.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(Re){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(Re.ctrlKey||Re.metaKey||this.isZooming()||Le.dq()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let Oe=Re.deltaMode===WheelEvent.DOM_DELTA_LINE?40*Re.deltaY:Re.deltaY;const Ue=Le.q.now(),qe=Ue-(this._lastWheelEventTime||0);this._lastWheelEventTime=Ue,0!==Oe&&Oe%vp==0?this._type="wheel":0!==Oe&&Math.abs(Oe)<4?this._type="trackpad":qe>400?(this._type=null,this._lastValue=Oe,this._timeout=window.setTimeout(this._onTimeout,40,Re)):this._type||(this._type=Math.abs(qe*Oe)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,Oe+=this._lastValue)),Re.shiftKey&&Oe&&(Oe/=4),this._type&&(this._lastWheelEvent=Re,this._delta-=Oe,this._active||this._start(Re)),Re.preventDefault()}_onTimeout(Le){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(Le)}_start(Le){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const Re=g(this._el,Le);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:Re,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRe
vendor: 8,880 bytes, line 1
1nderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const Re=this._map.transform;"wheel"===this._type&&Re.projection.wrap&&(Re._center.lng>=180||Re._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>Re._terrainEnabled()&&this._aroundCoord?Re.computeZoomRelativeTo(this._aroundCoord):Re.zoom;if(0!==this._delta){const Le="wheel"===this._type&&Math.abs(this._delta)>vp?this._wheelZoomRate:this._defaultZoomRate;let Oe=2/(1+Math.exp(-Math.abs(this._delta*Le)));this._delta<0&&0!==Oe&&(Oe=1/Oe);const Ue=i(),qe=Math.pow(2,Ue),Ct="number"==typeof this._targetZoom?Re.zoomScale(this._targetZoom):qe;this._targetZoom=Math.min(Re.maxZoom,Math.max(Re.minZoom,Re.scaleZoom(Ct*Oe))),"wheel"===this._type&&(this._startZoom=Ue,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const Oe="number"==typeof this._targetZoom?this._targetZoom:i(),Ue=this._startZoom,qe=this._easing;let Ct,Ot=!1;if("wheel"===this._type&&Ue&&qe){const Re=Math.min((Le.q.now()-this._lastWheelEventTime)/200,1),Jt=qe(Re);Ct=Le.aa(Ue,Oe,Jt),Re<1?this._frameId||(this._frameId=!0):Ot=!0}else Ct=Oe,Ot=!0;this._active=!0,Ot&&(this._active=!1,this._finishTimeout=window.setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200));let Jt=Ct-i();return Jt*this._lastDelta<0&&(Jt=0),{noInertia:!0,needsRenderFrame:!Ot,zoomDelta:Jt,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(Re){let Oe=Le.dr;if(this._prevEase){const Re=this._prevEase,Ue=(Le.q.now()-Re.start)/Re.duration,qe=Re.easing(Ue+.01)-Re.easing(Ue),Ct=.27/Math.sqrt(qe*qe+1e-4)*.01,Ot=Math.sqrt(.0729-Ct*Ct);Oe=Le.dp(Ct,Ot,.25,1)}return this._prevEase={start:Le.q.now(),duration:Re,easing:Oe},Oe}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")}),200)}}class un{constructor(Le,Re){this._clickZoom=Le,this._tapZoom=Re}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class dn{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(Le,Re){return Le.preventDefault(),{cameraAnimation:Oe=>{Oe.easeTo({duration:300,zoom:Oe.getZoom()+(Le.shiftKey?-1:1),around:Oe.unproject(Re)},{originalEvent:Le})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _n{constructor(){this._tap=new ja({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(Le,Re,Oe){this._swipePoint||(this._tapTime&&Le.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?Oe.length>0&&(this._swipePoint=Re[0],this._swipeTouch=Oe[0].identifier):this._tap.touchstart(Le,Re,Oe))}touchmove(Le,Re,Oe){if(this._tapTime){if(this._swipePoint){if(Oe[0].identifier!==this._swipeTouch)return;const Ue=Re[0],qe=Ue.y-this._swipePoint.y;return this._swipePoint=Ue,Le.preventDefault(),this._active=!0,{zoomDelta:qe/128}}}else this._tap.touchmove(Le,Re,Oe)}touchend(Le,Re,Oe){this._tapTime?this._swipePoint&&0===Oe.length&&this.reset():this._tap.touchend(Le,Re,Oe)&&(this._tapTime=Le.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class pn{constructor(Le,Re,Oe){this._el=Le,this._mousePan=Re,this._touchPan=Oe}enable(Le){this._inertiaOptions=Le||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class mn{constructor(Le,Re,Oe){this._pitchWithRotate=Le.pitchWithRotate,this._mouseRotate=Re,this._mousePitch=Oe}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class fn{constructor(Le,Re,Oe,Ue){this._el=Le,this._touchZoom=Re,this._touchRotate=Oe,this._tapDragZoom=Ue,this._rotationDisabled=!1,this._enabled=!0}enable(Le){this._touchZoom.enable(Le),this._rotationDisabled||this._touchRotate.enable(Le),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const gn=Le=>Le.zoom||Le.drag||Le.pitch||Le.rotate;class vn extends Le.x{}class xn{constructor(){this.constants=[1,1,.01],this.radius=0}setup(Re,Oe){const Ue=Le.a6.vec3.sub([],Oe,Re);this.radius=Le.a6.vec3.length(Ue[2]<0?Le.a6.vec3.div([],Ue,this.constants):[Ue[0],Ue[1],0])}projectRay(Re){Le.a6.vec3.div(Re,Re,this.constants),Le.a6.vec3.normalize(Re,Re),Le.a6.vec3.mul(Re,Re,this.constants);const Oe=Le.a6.vec3.scale([],Re,this.radius);if(Oe[2]>0){const Re=Le.a6.vec3.scale([],[0,0,1],Le.a6.vec3.dot(Oe,[0,0,1])),Ue=Le.a6.vec3.scale([],Le.a6.vec3.normalize([],[Oe[0],Oe[1],0]),this.radius),qe=Le.a6.vec3.add([],Oe,Le.a6.vec3.scale([],Le.a6.vec3.sub([],Le.a6.vec3.add([],Ue,Re),Oe),2));Oe[0]=qe[0],Oe[1]=qe[1]}return Oe}}function yn(Le){return Le.panDelta&&Le.panDelta.mag()||Le.zoomDelta||Le.bearingDelta||Le.pitchDelta}class bn{constructor(Re,Oe){this._map=Re,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new La(Re),this._bearingSnap=Oe.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new xn,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(Oe),Le.aJ(["handleEvent","handleWindowEvent"],this);const Ue=this._el;this._listeners=[[Ue,"touchstart",{passive:!0}],[Ue,"touchmove",{passive:!1}],[Ue,"touchend",void 0],[Ue,"touchcancel",void 0],[Ue,"mousedown",void 0],[Ue,"mousemove",void 0],[Ue,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[Ue,"mouseover",void 0],[Ue,"mouseout",void 0],[Ue,"dblclick",void 0],[Ue,"click",void 0],[Ue,"keydown",{capture:!1}],[Ue,"keyup",void 0],[Ue,"wheel",{passive:!1}],[Ue,"contextmenu",void 0],[window,"blur",void 0]];for(const[Le,Re,Oe]of this._listeners){const Ue=Le===document?this.handleWindowEvent:this.handleEvent;Le.addEventListener(Re,Ue,Oe)}}destroy(){for(const[Le,Re,Oe]of this._listeners){const Ue=Le===document?this.handleWindowEvent:this.handleEvent;Le.removeEventListener(Re,Ue,Oe)}}_addDefaultHandlers(Le){const Re=this._map,Oe=Re.getCanvasContainer();this._add("mapEvent",new ka(Re,Le));const Ue=Re.boxZoom=new Na(Re,Le);this._add("boxZoom",Ue);const qe=new Va,Ct=new dn;Re.doubleClickZoom=new un(Ct,qe),this._add("tapZoom",qe),this._add("clickZoom",Ct);const Ot=new _n;this._add("tapDragZoom",Ot);const Jt=Re.touchPitch=new rn(Re);this._add("touchPitch",Jt);const _i=new Wa(Le),xi=new $a(Le);Re.dragRotate=new mn(Le,_i,xi),this._add("mouseRotate",_i,["mousePitch"]),this._add("mousePitch",xi,["mouseRotate"]);const vi=new Ha(Le),bi=new Xa(Re,Le);Re.dragPan=new pn(Oe,vi,bi),this._add("mousePan",vi),this._add("touchPan",bi,["touchZoom","touchRotate"]);
vendor: 6,346 bytes, line 1
1const Pi=new tn,Hr=new Qa;Re.touchZoomRotate=new fn(Oe,Hr,Pi,Ot),this._add("touchRotate",Pi,["touchPan","touchZoom"]),this._add("touchZoom",Hr,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Ba(Re));const Jr=Re.scrollZoom=new hn(Re,this);this._add("scrollZoom",Jr,["mousePan"]);const Ln=Re.keyboard=new an;this._add("keyboard",Ln);for(const Oe of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])Le.interactive&&Le[Oe]&&Re[Oe].enable(Le[Oe])}_add(Le,Re,Oe){this._handlers.push({handlerName:Le,handler:Re,allowed:Oe}),this._handlersById[Le]=Re}stop(Le){if(!this._updatingCamera){for(const{handler:Le}of this._handlers)Le.reset();this._inertia.clear(),this._fireEvents({},{},Le),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:Le}of this._handlers)if(Le.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!gn(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(Le,Re,Oe){for(const Ue in Le)if(Ue!==Oe&&(!Re||Re.indexOf(Ue)<0))return!0;return!1}handleWindowEvent(Le){this.handleEvent(Le,`${Le.type}Window`)}_getMapTouches(Le){const Re=[];for(const Oe of Le)this._el.contains(Oe.target)&&Re.push(Oe);return Re}handleEvent(Le,Re){this._updatingCamera=!0;const Oe="renderFrame"===Le.type,Ue=Oe?void 0:Le,qe={needsRenderFrame:!1},Ct={},Ot={},Jt=Le.touches?this._getMapTouches(Le.touches):void 0,_i=Jt?v(this._el,Jt):Oe?void 0:g(this._el,Le);for(const{handlerName:Oe,handler:xi,allowed:vi}of this._handlers){if(!xi.isEnabled())continue;let bi;this._blockedByActive(Ot,vi,Oe)?xi.reset():xi[Re||Le.type]&&(bi=xi[Re||Le.type](Le,_i,Jt),this.mergeHandlerResult(qe,Ct,bi,Oe,Ue),bi&&bi.needsRenderFrame&&this._triggerRenderFrame()),(bi||xi.isActive())&&(Ot[Oe]=xi)}const xi={};for(const Le in this._previousActiveHandlers)Ot[Le]||(xi[Le]=Ue);this._previousActiveHandlers=Ot,(Object.keys(xi).length||yn(qe))&&(this._changes.push([qe,Ct,xi]),this._triggerRenderFrame()),(Object.keys(Ot).length||yn(qe))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:vi}=qe;vi&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],vi(this._map))}mergeHandlerResult(Re,Oe,Ue,qe,Ct){if(!Ue)return;Le.l(Re,Ue);const Ot={handlerName:qe,originalEvent:Ue.originalEvent||Ct};void 0!==Ue.zoomDelta&&(Oe.zoom=Ot),void 0!==Ue.panDelta&&(Oe.drag=Ot),void 0!==Ue.pitchDelta&&(Oe.pitch=Ot),void 0!==Ue.bearingDelta&&(Oe.rotate=Ot)}_applyChanges(){const Re={},Oe={},Ue={};for(const[qe,Ct,Ot]of this._changes)qe.panDelta&&(Re.panDelta=(Re.panDelta||new Le.P(0,0))._add(qe.panDelta)),qe.zoomDelta&&(Re.zoomDelta=(Re.zoomDelta||0)+qe.zoomDelta),qe.bearingDelta&&(Re.bearingDelta=(Re.bearingDelta||0)+qe.bearingDelta),qe.pitchDelta&&(Re.pitchDelta=(Re.pitchDelta||0)+qe.pitchDelta),void 0!==qe.around&&(Re.around=qe.around),void 0!==qe.aroundCoord&&(Re.aroundCoord=qe.aroundCoord),void 0!==qe.pinchAround&&(Re.pinchAround=qe.pinchAround),qe.noInertia&&(Re.noInertia=qe.noInertia),Le.l(Oe,Ct),Le.l(Ue,Ot);this._updateMapTransform(Re,Oe,Ue),this._changes=[]}_updateMapTransform(Re,Oe,Ue){const qe=this._map,Ct=qe.transform,a=Le=>[Le.x,Le.y,Le.z];if((Le=>{const Re=this._eventsInProgress.drag;return Re&&!this._handlersById[Re.handlerName].isActive()})()&&!yn(Re)){const Le=Ct.zoom;Ct.cameraElevationReference="sea",null!=this._originalZoom&&Ct._orthographicProjectionAtLowPitch&&"globe"!==Ct.projection.name&&0===Ct.pitch?(Ct.cameraElevationReference="ground",Ct.zoom=this._originalZoom):(Ct.recenterOnTerrain(),Ct.cameraElevationReference="ground"),Le!==Ct.zoom&&this._map._update(!0)}if(Ct._isCameraConstrained&&qe._stop(!0),!yn(Re))return void this._fireEvents(Oe,Ue,!0);let{panDelta:Ot,zoomDelta:Jt,bearingDelta:_i,pitchDelta:xi,around:vi,aroundCoord:bi,pinchAround:Pi}=Re;Ct._isCameraConstrained&&(Jt>0&&(Jt=0),Ct._isCameraConstrained=!1),void 0!==Pi&&(vi=Pi),(Jt||(Le=>Oe[Le]&&!this._eventsInProgress[Le])("drag"))&&vi&&(this._dragOrigin=a(Ct.pointCoordinate3D(vi)),this._originalZoom=Ct.zoom,this._trackingEllipsoid.setup(Ct._camera.position,this._dragOrigin)),Ct.cameraElevationReference="sea",qe._stop(!0),vi=vi||qe.transform.centerPoint,_i&&(Ct.bearing+=_i),xi&&(Ct.pitch+=xi),Ct._updateCameraState();const Hr=[0,0,0];if(Ot)if("mercator"===Ct.projection.name){const Le=this._trackingEllipsoid.projectRay(Ct.screenPointToMercatorRay(vi).dir),Re=this._trackingEllipsoid.projectRay(Ct.screenPointToMercatorRay(vi.sub(Ot)).dir);Hr[0]=Re[0]-Le[0],Hr[1]=Re[1]-Le[1]}else{const Re=Ct.pointCoordinate(vi);if("globe"===Ct.projection.name){Ot=Ot.rotate(-Ct.angle);const Oe=Ct._pixelsPerMercatorPixel/Ct.worldSize;Hr[0]=-Ot.x*Le.ds(Le.aM(Re.y))*Oe,Hr[1]=-Ot.y*Le.ds(Ct.center.lat)*Oe}else{const Le=Ct.pointCoordinate(vi.sub(Ot));Re&&Le&&(Hr[0]=Le.x-Re.x,Hr[1]=Le.y-Re.y)}}const Jr=Ct.zoom,Ln=[0,0,0];if(Jt){const Re=a(bi||Ct.pointCoordinate3D(vi)),Oe={dir:Le.a6.vec3.normalize([],Le.a6.vec3.sub([],Re,Ct._camera.position))};if(Oe.dir[2]<0){const Ue=Ct.zoomDeltaToMovement(Re,Jt);Le.a6.vec3.scale(Ln,Oe.dir,Ue)}}const Nn=Le.a6.vec3.add(Hr,Hr,Ln);Ct._translateCameraConstrained(Nn),Jt&&Math.abs(Ct.zoom-Jr)>1e-4&&Ct.recenterOnTerrain(),Ct.cameraElevationReference="ground",this._map._update(),Re.noInertia||this._inertia.record(Re),this._fireEvents(Oe,Ue,!0)}_fireEvents(Re,Oe,Ue){const qe=gn(this._eventsInProgress),Ct=gn(Re),Ot={};for(const Le in Re){const{originalEvent:Oe}=Re[Le];this._eventsInProgress[Le]||(Ot[`${Le}start`]=Oe),this._eventsInProgress[Le]=Re[Le]}!qe&&Ct&&this._fireEvent("movestart",Ct.originalEvent);for(const Le in Ot)this._fireEvent(Le,Ot[Le]);Ct&&this._fireEvent("move",Ct.originalEvent);for(const Le in Re){const{originalEvent:Oe}=Re[Le];this._fireEvent(Le,Oe)}const Jt={};let _i;for(const Le in this._eventsInProgress){const{handlerName:Re,originalEvent:Ue}=this._eventsInProgress[Le];this._handlersById[Re].isActive()||(delete this._eventsInProgress[Le],_i=Oe[Re]||Ue,Jt[`${Le}end`]=_i)}for(const Le in Jt)this._fireEvent(Le,Jt[Le]);const xi=gn(this._eventsInProgress);if(Ue&&(qe||Ct)&&!xi){this._updatingCamera=!0;const Re=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=Le=>0!==Le&&-this._bearingSnap<Le&&Le<this._bearingSnap;
1Re?(i(Re.bearing||this._map.getBearing())&&(Re.bearing=0),this._map.easeTo(Re,{originalEvent:_i})):(this._map.fire(new Le.x("moveend",{originalEvent:_i})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(Re,Oe){this._map.fire(new Le.x(Re,Oe?{originalEvent:Oe}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((Le=>{this._frameId=void 0,this.handleEvent(new vn("renderFrame",{timeStamp:Le})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Tp="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Tn extends Le.E{constructor(Re,Oe){super(),this._moving=!1,this._zooming=!1,this.transform=Re,this._bearingSnap=Oe.bearingSnap,this._respectPrefersReducedMotion=!1!==Oe.respectPrefersReducedMotion,Le.aJ(["_renderFrameCallback"],this)}getCenter(){return new Le.bK(this.transform.center.lng,this.transform.center.lat)}setCenter(Le,Re){return this.jumpTo({center:Le},Re)}panBy(Re,Oe,Ue){return Re=Le.P.convert(Re).mult(-1),this.panTo(this.transform.center,Le.l({offset:Re},Oe),Ue)}panTo(Re,Oe,Ue){return this.easeTo(Le.l({center:Re},Oe),Ue)}getZoom(){return this.transform.zoom}setZoom(Le,Re){return this.jumpTo({zoom:Le},Re),this}zoomTo(Re,Oe,Ue){return this.easeTo(Le.l({zoom:Re},Oe),Ue)}zoomIn(Le,Re){return this.zoomTo(this.getZoom()+1,Le,Re),this}zoomOut(Le,Re){return this.zoomTo(this.getZoom()-1,Le,Re),this}getBearing(){return this.transform.bearing}setBearing(Le,Re){return this.jumpTo({bearing:Le},Re),this}getPadding(){return this.transform.padding}setPadding(Le,Re){return this.jumpTo({padding:Le},Re),this}rotateTo(Re,Oe,Ue){return this.easeTo(Le.l({bearing:Re},Oe),Ue)}resetNorth(Re,Oe){return this.rotateTo(0,Le.l({duration:1e3},Re),Oe),this}resetNorthPitch(Re,Oe){return this.easeTo(Le.l({bearing:0,pitch:0,duration:1e3},Re),Oe),this}snapToNorth(Le,Re){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(Le,Re):this}getPitch(){return this.transform.pitch}setPitch(Le,Re){return this.jumpTo({pitch:Le},Re),this}cameraForBounds(Re,Oe){Re=Le.as.convert(Re);const Ue=Oe&&Oe.bearing||0,qe=Oe&&Oe.pitch||0,Ct=Re.getNorthWest(),Ot=Re.getSouthEast();return this._cameraForBounds(this.transform,Ct,Ot,Ue,qe,Oe)}_extendPadding(Re){const Oe={top:0,right:0,bottom:0,left:0};return null==Re?Le.l({},Oe,this.transform.padding):"number"==typeof Re?{top:Re,bottom:Re,right:Re,left:Re}:Le.l({},Oe,Re)}_extendCameraOptions(Re){return(Re=Le.l({offset:[0,0],maxZoom:this.transform.maxZoom},Re)).padding=this._extendPadding(Re.padding),Re}_minimumAABBFrustumDistance(Le,Re){const Oe=Re.max[0]-Re.min[0],Ue=Re.max[1]-Re.min[1];return Oe/Ue>Le.aspect?Oe/(2*Math.tan(.5*Le.fovX)*Le.aspect):Ue/(2*Math.tan(.5*Le.fovY)*Le.aspect)}_cameraForBoundsOnGlobe(Re,Oe,Ue,qe,Ct,Ot){const Jt=Re.clone(),_i=this._extendCameraOptions(Ot);Jt.bearing=qe,Jt.pitch=Ct;const xi=Le.bK.convert(Oe),vi=Le.bK.convert(Ue),bi=.5*(xi.lat+vi.lat),Pi=.5*(xi.lng+vi.lng),Hr=Le.dt(bi,Pi),Jr=Le.a6.vec3.normalize([],Hr),Ln=Le.a6.vec3.normalize([],Le.a6.vec3.cross([],Jr,[0,1,0])),Nn=Le.a6.vec3.cross([],Ln,Jr),Gn=[Ln[0],Ln[1],Ln[2],0,Nn[0],Nn[1],Nn[2],0,Jr[0],Jr[1],Jr[2],0,0,0,0,1],qn=[Hr,Le.dt(xi.lat,xi.lng),Le.dt(vi.lat,xi.lng),Le.dt(vi.lat,vi.lng),Le.dt(xi.lat,vi.lng),Le.dt(bi,xi.lng),Le.dt(bi,vi.lng),Le.dt(xi.lat,Pi),Le.dt(vi.lat,Pi)];let Zn=Le.c9.fromPoints(qn.map((Re=>[Le.a6.vec3.dot(Ln,Re),Le.a6.vec3.dot(Nn,Re),Le.a6.vec3.dot(Jr,Re)])));const $n=Le.a6.vec3.transformMat4([],Zn.center,Gn);0===Le.a6.vec3.squaredLength($n)&&Le.a6.vec3.set($n,0,0,1),Le.a6.vec3.normalize($n,$n),Le.a6.vec3.scale($n,$n,Le.aq),Jt.center=Le.du($n);const Xn=Jt.getWorldToCameraMatrix(),Yn=Le.a6.mat4.invert(new Float64Array(16),Xn);Zn=Le.c9.applyTransform(Zn,Le.a6.mat4.multiply([],Xn,Gn));const lo=this._extendAABB(Zn,Jt,_i,qe);if(!lo)return void Le.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Zn=lo,Le.a6.vec3.transformMat4($n,$n,Xn);const uo=.5*(Zn.max[2]-Zn.min[2]),po=this._minimumAABBFrustumDistance(Jt,Zn),fo=Le.a6.vec3.scale([],[0,0,1],uo),Io=Le.a6.vec3.add(fo,$n,fo),is=po+(0===Jt.pitch?0:Le.a6.vec3.distance($n,Io)),as=Jt.globeCenterInViewSpace,Is=Le.a6.vec3.sub([],$n,[as[0],as[1],as[2]]);Le.a6.vec3.normalize(Is,Is),Le.a6.vec3.scale(Is,Is,is);const Xs=Le.a6.vec3.add([],$n,Is);Le.a6.vec3.transformMat4(Xs,Xs,Yn);const ta=Le.dw/Le.aq,ha=Le.a6.vec3.length(Xs),el=Le.bD(Math.max(ha*ta-Le.dw,Number.EPSILON),0),tl=Math.min(Jt.zoomFromMercatorZAdjusted(el),_i.maxZoom);return tl>.5*(Le.c2+Le.bU)?(Jt.setProjection({name:"mercator"}),Jt.zoom=tl,this._cameraForBounds(Jt,Oe,Ue,qe,Ct,Ot)):{center:Jt.center,zoom:tl,bearing:qe,pitch:Ct}}_extendAABB(Re,Oe,Ue,qe){const Ct=.5*((Ue.padding.left||0)+(Ue.padding.right||0)),Ot=.5*((Ue.padding.top||0)+(Ue.padding.bottom||0)),Jt=Ot,_i=Ct,xi=Ct,vi=Ot,bi=Oe.width-(_i+xi),Pi=Oe.height-(Jt+vi),Hr=Le.a6.vec3.sub([],Re.max,Re.min),Jr=Math.min(bi/Hr[0],Pi/Hr[1]),Ln=Math.min(Oe.scaleZoom(Oe.scale*Jr),Ue.maxZoom);if(isNaN(Ln))return null;const Nn=Oe.scale/Oe.zoomScale(Ln),Gn=new Le.c9([Re.min[0]-_i*Nn,Re.min[1]-vi*Nn,Re.min[2]],[Re.max[0]+xi*Nn,Re.max[1]+Jt*Nn,Re.max[2]]),qn=("number"==typeof Ue.offset.x&&"number"==typeof Ue.offset.y?new Le.P(Ue.offset.x,Ue.offset.y):Le.P.convert(Ue.offset)).rotate(-Le.bB(qe));return Gn.center[0]-=qn.x*Nn,Gn.center[1]+=qn.y*Nn,Gn}queryTerrainElevation(Re,Oe){const Ue=this.transform.elevation;return Ue?(Oe=Le.l({},{exaggerated:!0},Oe),Ue.getAtPoint(Le.a5.fromLngLat(Re),null,Oe.exaggerated)):null}_cameraForBounds(Re,Oe,Ue,qe,Ct,Ot){if("globe"===Re.projection.name)return this._cameraForBoundsOnGlobe(Re,Oe,Ue,qe,Ct,Ot);const Jt=Re.clone(),_i=this._extendCameraOptions(Ot);Jt.bearing=qe,Jt.pitch=Ct;const xi=Le.bK.convert(Oe),vi=Le.bK.convert(Ue),bi=new Le.bK(xi.lng,vi.lat),Pi=new Le.bK(vi.lng,xi.lat),Hr=Jt.project(xi),Jr=Jt.project(vi),Ln=this.queryTerrainElevation(xi),Nn=this.queryTerrainElevation(vi),Gn=this.queryTerrainElevation(bi),qn=this.queryTerrainElevation(Pi),Zn=[[Hr.x,Hr.y,Math.min(Ln||0,Nn||0,Gn||0,qn||0)],[Jr.x,Jr.y,Math.max(Ln||0,Nn||0,Gn||0,qn||0)]];let $n=Le.c9.fromPoints(Zn);const Xn=Jt.getWorldToCameraMatrix(),Yn=Le.a6.mat4.invert(new Float64Array(16),Xn);$n=Le.c9.applyTransform($n,Xn);const lo=this._extendAABB($n,Jt,_i,qe);if(!lo)return void Le.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");$n=lo;const uo=.5*Le.a6.vec3.sub([],$n.max,$n.min)[2],po=this._minimumAABBFrustumDistance(Jt,$n),fo=[0,0,1,0];Le.a6.vec4.transformMat4(fo,fo,Xn),Le.a6.vec4.normalize(fo,fo);const Io=Le.a6.vec3.scale([],fo,po+uo),is=Le.a6.vec3.add([],$n.center,Io);Le.a6.vec3.transformMat4($n.center,$n.center,Yn),Le.a6.vec3.transformMat4(is,is,Yn);const as=Jt.unproject(new Le.P($n.center[0],$n.center[1])),Is=Le.dv(Jt.projection,as),Xs=Math.pow(2,Is),ta=Math.min(Jt._zoomFromMercatorZ(is[2]*Jt.pixelsPerMeter*Xs/Jt.worldSize),_i.maxZoom);return Jt.mercatorFromTransition&&ta<.5*(Le.c2+Le.bU)?(Jt.setProjection({name:"globe"}),Jt.zoom=ta,this._cameraForBounds(Jt,Oe,Ue,qe,Ct,Ot)):{center:as,zoom:ta,bearing:qe,pitch:Ct}}fitBounds(Le,Re,Oe){const Ue=this.cameraForBounds(Le,Re);return this._fitInternal(Ue,Re,Oe)}fitScreenCoordinates(Re,Oe,Ue,qe,Ct){const Ot=Le.P.convert(Re),Jt=Le.P.convert(Oe),_i=new Le.P(Math.min(Ot.x,Jt.x),Math.min(Ot.y,Jt.y)),xi=new Le.P(Math.max(Ot.x,Jt.x),Math.max(Ot.y,Jt.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(Ot,Jt))return this;const vi=this.transform.pointLocation3D(_i),bi=this.transform.pointLocation3D(xi),Pi=this.transform.pointLocation3D(new Le.P(_i.x,xi.y)
vendor: 7,224 bytes, line 1
1),Hr=this.transform.pointLocation3D(new Le.P(xi.x,_i.y)),Jr=[Math.min(vi.lng,bi.lng,Pi.lng,Hr.lng),Math.min(vi.lat,bi.lat,Pi.lat,Hr.lat)],Ln=[Math.max(vi.lng,bi.lng,Pi.lng,Hr.lng),Math.max(vi.lat,bi.lat,Pi.lat,Hr.lat)],Nn=qe&&qe.pitch?qe.pitch:this.getPitch(),Gn=this._cameraForBounds(this.transform,Jr,Ln,Ue,Nn,qe);return this._fitInternal(Gn,qe,Ct)}_fitInternal(Re,Oe,Ue){return Re?(Oe=Le.l(Re,Oe)).linear?this.easeTo(Oe,Ue):this.flyTo(Oe,Ue):this}jumpTo(Re,Oe){this.stop();const Ue=Re.preloadOnly?this.transform.clone():this.transform;let qe=!1,Ct=!1,Ot=!1;"zoom"in Re&&Ue.zoom!==+Re.zoom&&(qe=!0,Ue.zoom=+Re.zoom),void 0!==Re.center&&(Ue.center=Le.bK.convert(Re.center)),"bearing"in Re&&Ue.bearing!==+Re.bearing&&(Ct=!0,Ue.bearing=+Re.bearing),"pitch"in Re&&Ue.pitch!==+Re.pitch&&(Ot=!0,Ue.pitch=+Re.pitch);const Jt="number"==typeof Re.padding?this._extendPadding(Re.padding):Re.padding;if(null!=Re.padding&&!Ue.isPaddingEqual(Jt))if(!1===Re.retainPadding){const Le=Ue.clone();Le.padding=Jt,Ue.setLocationAtPoint(Ue.center,Le.centerPoint)}else Ue.padding=Jt;return Re.preloadOnly?(this._preloadTiles(Ue),this):(this.fire(new Le.x("movestart",Oe)).fire(new Le.x("move",Oe)),qe&&this.fire(new Le.x("zoomstart",Oe)).fire(new Le.x("zoom",Oe)).fire(new Le.x("zoomend",Oe)),Ct&&this.fire(new Le.x("rotatestart",Oe)).fire(new Le.x("rotate",Oe)).fire(new Le.x("rotateend",Oe)),Ot&&this.fire(new Le.x("pitchstart",Oe)).fire(new Le.x("pitch",Oe)).fire(new Le.x("pitchend",Oe)),this.fire(new Le.x("moveend",Oe)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||Le.w(Tp),this.transform.getFreeCameraOptions()}setFreeCameraOptions(Re,Oe){const Ue=this.transform;if(!Ue.projection.supportsFreeCamera)return Le.w(Tp),this;this.stop();const qe=Ue.zoom,Ct=Ue.pitch,Ot=Ue.bearing;Ue.setFreeCameraOptions(Re);const Jt=qe!==Ue.zoom,_i=Ct!==Ue.pitch,xi=Ot!==Ue.bearing;return this.fire(new Le.x("movestart",Oe)).fire(new Le.x("move",Oe)),Jt&&this.fire(new Le.x("zoomstart",Oe)).fire(new Le.x("zoom",Oe)).fire(new Le.x("zoomend",Oe)),xi&&this.fire(new Le.x("rotatestart",Oe)).fire(new Le.x("rotate",Oe)).fire(new Le.x("rotateend",Oe)),_i&&this.fire(new Le.x("pitchstart",Oe)).fire(new Le.x("pitch",Oe)).fire(new Le.x("pitchend",Oe)),this.fire(new Le.x("moveend",Oe)),this}easeTo(Re,Oe){this._stop(!1,Re.easeId),(!1===(Re=Le.l({offset:[0,0],duration:500,easing:Le.dr},Re)).animate||this._prefersReducedMotion(Re))&&(Re.duration=0);const Ue=this.transform,qe=this.getZoom(),Ct=this.getBearing(),Ot=this.getPitch(),Jt=this.getPadding(),_i="zoom"in Re?+Re.zoom:qe,xi="bearing"in Re?this._normalizeBearing(Re.bearing,Ct):Ct,vi="pitch"in Re?+Re.pitch:Ot,bi=this._extendPadding(Re.padding),Pi=Le.P.convert(Re.offset);let Hr,Jr,Ln;if("globe"===Ue.projection.name){const Oe=Le.a5.fromLngLat(Ue.center),qe=Pi.rotate(-Ue.angle);Oe.x+=qe.x/Ue.worldSize,Oe.y+=qe.y/Ue.worldSize;const Ct=Oe.toLngLat(),Ot=Le.bK.convert(Re.center||Ct);this._normalizeCenter(Ot),Hr=Ue.centerPoint.add(qe),Jr=new Le.P(Oe.x,Oe.y).mult(Ue.worldSize),Ln=new Le.P(Le.am(Ot.lng),Le.at(Ot.lat)).mult(Ue.worldSize).sub(Jr)}else{Hr=Ue.centerPoint.add(Pi);const Oe=Ue.pointLocation(Hr),qe=Le.bK.convert(Re.center||Oe);this._normalizeCenter(qe),Jr=Ue.project(Oe),Ln=Ue.project(qe).sub(Jr)}const Nn=Ue.zoomScale(_i-qe);let Gn,qn;Re.around&&(Gn=Le.bK.convert(Re.around),qn=Ue.locationPoint(Gn));const Zn=this._zooming||_i!==qe,$n=this._rotating||Ct!==xi,Xn=this._pitching||vi!==Ot,Yn=!Ue.isPaddingEqual(bi),lo=!1===Re.retainPadding?Ue.clone():Ue,E=Ue=>uo=>{if(Zn&&(Ue.zoom=Le.aa(qe,_i,uo)),$n&&(Ue.bearing=Le.aa(Ct,xi,uo)),Xn&&(Ue.pitch=Le.aa(Ot,vi,uo)),Yn&&(lo.interpolatePadding(Jt,bi,uo),Hr=lo.centerPoint.add(Pi)),Gn)Ue.setLocationAtPoint(Gn,qn);else{const Le=Ue.zoomScale(Ue.zoom-qe),Re=_i>qe?Math.min(2,Nn):Math.max(.5,Nn),Oe=Math.pow(Re,1-uo),Ct=Ue.unproject(Jr.add(Ln.mult(uo*Oe)).mult(Le));Ue.setLocationAtPoint(Ue.renderWorldCopies?Ct.wrap():Ct,Hr)}return Re.preloadOnly||this._fireMoveEvents(Oe),Ue};if(Re.preloadOnly){const Le=this._emulate(E,Re.duration,Ue);return this._preloadTiles(Le),this}const uo={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Zn,this._rotating=$n,this._pitching=Xn,this._padding=Yn,this._easeId=Re.easeId,this._prepareEase(Oe,Re.noMoveStart,uo),this._ease(E(Ue),(Le=>{"sea"===Ue.cameraElevationReference&&Ue.recenterOnTerrain(),this._afterEase(Oe,Le)}),Re),this}_prepareEase(Re,Oe,Ue={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),Oe||Ue.moving||this.fire(new Le.x("movestart",Re)),this._zooming&&!Ue.zooming&&this.fire(new Le.x("zoomstart",Re)),this._rotating&&!Ue.rotating&&this.fire(new Le.x("rotatestart",Re)),this._pitching&&!Ue.pitching&&this.fire(new Le.x("pitchstart",Re))}_fireMoveEvents(Re){this.fire(new Le.x("move",Re)),this._zooming&&this.fire(new Le.x("zoom",Re)),this._rotating&&this.fire(new Le.x("rotate",Re)),this._pitching&&this.fire(new Le.x("pitch",Re))}_afterEase(Re,Oe){if(this._easeId&&Oe&&this._easeId===Oe)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const Ue=this._zooming,qe=this._rotating,Ct=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,Ue&&this.fire(new Le.x("zoomend",Re)),qe&&this.fire(new Le.x("rotateend",Re)),Ct&&this.fire(new Le.x("pitchend",Re)),this.fire(new Le.x("moveend",Re))}flyTo(Re,Oe){if(this._prefersReducedMotion(Re)){const Ue=Le.ar(Re,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ue,Oe)}this.stop(),Re=Le.l({offset:[0,0],speed:1.2,curve:1.42,easing:Le.dr},Re);const Ue=this.transform,qe=this.getZoom(),Ct=this.getBearing(),Ot=this.getPitch(),Jt=this.getPadding(),_i="zoom"in Re?Le.ap(+Re.zoom,Ue.minZoom,Ue.maxZoom):qe,xi="bearing"in Re?this._normalizeBearing(Re.bearing,Ct):Ct,vi="pitch"in Re?+Re.pitch:Ot,bi=this._extendPadding(Re.padding),Pi=Ue.zoomScale(_i-qe),Hr=Le.P.convert(Re.offset);let Jr=Ue.centerPoint.add(Hr);const Ln=Ue.pointLocation(Jr),Nn=Le.bK.convert(Re.center||Ln);this._normalizeCenter(Nn);const Gn=Ue.project(Ln),qn=Ue.project(Nn).sub(Gn);let Zn=Re.curve;const $n=Math.max(Ue.width,Ue.height),Xn=$n/Pi,Yn=qn.mag();if("minZoom"in Re){const Oe=Le.ap(Math.min(Re.minZoom,qe,_i),Ue.minZoom,Ue.maxZoom),Ct=$n/Ue.zoomScale(Oe-qe);Zn=Math.sqrt(Ct/Yn*2)}const lo=Zn*Zn;function E(Le){const Re=(Xn*Xn-$n*$n+(Le?-1:1)*lo*lo*Yn*Yn)/(2*(Le?Xn:$n)*lo*Yn);return Math.log(Math.sqrt(Re*Re+1)-Re)}function C(Le){return(Math.exp(Le)-Math.exp(-Le))/2}function S(Le){return(Math.exp(Le)+Math.exp(-Le))/2}const uo=E(0);let D=function(Le){return S(uo)/S(uo+Zn*Le)},R=function(Le){return $n*((S(uo)*(C(Re=uo+Zn*Le)/S(Re))-C(uo))/lo)/Yn;var Re},po=(E(1)-uo)/Zn;if(Math.abs(Yn)<1e-6||!isFinite(po)){if(Math.abs($n-Xn)<1e-6)return this.easeTo(Re,Oe);const Le=Xn<$n?-1:1;po=Math.abs(Math.log(Xn/$n))/Zn,R=function(){return 0},D=function(Re){return Math.exp(Le*Zn*Re)}}Re.duration="duration"in Re?+Re.duration:1e3*po/("screenSpeed"in Re?+Re.screenSpeed/Zn:+Re.speed),Re.maxDuration&&Re.duration>
vendor: 7,307 bytes, line 1
1Re.maxDuration&&(Re.duration=0);const fo=Ct!==xi,Io=vi!==Ot,is=!Ue.isPaddingEqual(bi),as=!1===Re.retainPadding?Ue.clone():Ue,O=Ue=>Pi=>{const Ln=Pi*po,Zn=1/D(Ln);Ue.zoom=1===Pi?_i:qe+Ue.scaleZoom(Zn),fo&&(Ue.bearing=Le.aa(Ct,xi,Pi)),Io&&(Ue.pitch=Le.aa(Ot,vi,Pi)),is&&(as.interpolatePadding(Jt,bi,Pi),Jr=as.centerPoint.add(Hr));const $n=1===Pi?Nn:Ue.unproject(Gn.add(qn.mult(R(Ln))).mult(Zn));return Ue.setLocationAtPoint(Ue.renderWorldCopies?$n.wrap():$n,Jr),Ue._updateCameraOnTerrain(),Re.preloadOnly||this._fireMoveEvents(Oe),Ue};if(Re.preloadOnly){const Le=this._emulate(O,Re.duration,Ue);return this._preloadTiles(Le),this}return this._zooming=!0,this._rotating=fo,this._pitching=Io,this._padding=is,this._prepareEase(Oe,!1),this._ease(O(Ue),(()=>this._afterEase(Oe)),Re),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(Le){}_cancelRenderFrame(Le){}_stop(Le,Re){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const Le=this._onEaseEnd;this._onEaseEnd=void 0,Le.call(this,Re)}if(!Le){const Le=this.handlers;Le&&Le.stop(!1)}return this}_ease(Re,Oe,Ue){!1===Ue.animate||0===Ue.duration?(Re(1),Oe()):(this._easeStart=Le.q.now(),this._easeOptions=Ue,this._onEaseFrame=Re,this._onEaseEnd=Oe,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const Re=Math.min((Le.q.now()-this._easeStart)/this._easeOptions.duration,1),Oe=this._onEaseFrame;Oe&&Oe(this._easeOptions.easing(Re)),Re<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(Re,Oe){Re=Le.bA(Re,-180,180);const Ue=Math.abs(Re-Oe);return Math.abs(Re-360-Oe)<Ue&&(Re-=360),Math.abs(Re+360-Oe)<Ue&&(Re+=360),Re}_normalizeCenter(Le){const Re=this.transform;if(Re.maxBounds)return;if("globe"!==Re.projection.name&&!Re.renderWorldCopies)return;const Oe=Le.lng-Re.center.lng;Le.lng+=Oe>180?-360:Oe<-180?360:0}_prefersReducedMotion(Re){return this._respectPrefersReducedMotion&&Le.q.prefersReducedMotion&&!(Re&&Re.essential)}_emulate(Le,Re,Oe){const Ue=Math.ceil(15*Re/1e3),qe=[],Ct=Le(Oe.clone());for(let Le=0;Le<=Ue;Le++){const Re=Ct(Le/Ue);qe.push(Re.clone())}return qe}_preloadTiles(Le,Re){}}class En{constructor(Re={}){this.options=Re,Le.aJ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(Le){const Re=this.options&&this.options.compact,Oe=Le._getUIString("AttributionControl.ToggleAttribution");this._map=Le,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",Oe);const Ue=l("span","mapboxgl-ctrl-icon",this._compactButton);return Ue.setAttribute("aria-hidden","true"),Ue.setAttribute("title",Oe),this._innerContainer=l("div","mapboxgl-ctrl-attrib-inner",this._container),Re&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===Re&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let Re=this._editLink;Re||(Re=this._editLink=this._container.querySelector(".mapbox-improve-map"));const Oe=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||Le.e.ACCESS_TOKEN}];if(Re){const Ue=Oe.reduce(((Le,Re,Ue)=>(Re.value&&(Le+=`${Re.key}=${Re.value}${Ue<Oe.length-1?"&":""}`),Le)),"?");Re.href=`${Le.e.FEEDBACK_URL}/${Ue}#${Ca(this._map,!0)}`,Re.rel="noopener nofollow"}}_updateData(Le){!Le||"metadata"!==Le.sourceDataType&&"visibility"!==Le.sourceDataType&&"style"!==Le.dataType||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let Le=[];if(this._map.style.stylesheet){const Le=this._map.style.stylesheet;this.styleOwner=Le.owner,this.styleId=Le.id}const Re=this._map.style._mergedSourceCaches;for(const Oe in Re){const Ue=Re[Oe];if(Ue.used){const Re=Ue.getSource();Re.attribution&&Le.indexOf(Re.attribution)<0&&Le.push(Re.attribution)}}Le.sort(((Le,Re)=>Le.length-Re.length)),Le=Le.filter(((Re,Oe)=>{for(let Ue=Oe+1;Ue<Le.length;Ue++)if(Le[Ue].indexOf(Re)>=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?Le=[...this.options.customAttribution,...Le]:Le.unshift(this.options.customAttribution));const Oe=Le.join(" | ");Oe!==this._attribHTML&&(this._attribHTML=Oe,Le.length?(this._innerContainer.innerHTML=Oe,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Cn{constructor(){Le.aJ(["_updateLogo","_updateCompact"],this)}onAdd(Le){this._map=Le,this._container=l("div","mapboxgl-ctrl");const Re=l("a","mapboxgl-ctrl-logo");return Re.target="_blank",Re.rel="noopener nofollow",Re.href="https://www.mapbox.com/",Re.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),Re.setAttribute("rel","noopener nofollow"),this._container.appendChild(Re),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(Le){Le&&"metadata"!==Le.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const Le=this._map.style._sourceCaches;if(0===Object.entries(Le).length)return!0;for(const Re in Le){const Oe=Le[Re].getSource();if(Oe.hasOwnProperty("mapbox_logo")&&!Oe.mapbox_logo)return!1}return!0}_updateCompact(){const Le=this._container.children;if(Le.length){const Re=Le[0];this._map.getCanvasContainer().offsetWidth<250?Re.classList.add("mapboxgl-compact"):Re.classList.remove("mapboxgl-compact")}}}class Sn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(Le){const Re=++this._id;return this._queue.push({callback:Le,id:Re,cancelled:!1}),Re}remove(Le){const Re=this._currentlyRunning,Oe=Re?this._queue.concat(Re):this._queue;
1for(const Re of Oe)if(Re.id===Le)return void(Re.cancelled=!0)}run(Le=0){const Re=this._currentlyRunning=this._queue;this._queue=[];for(const Oe of Re)if(!Oe.cancelled&&(Oe.callback(Le),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class In{constructor(Le){this.jumpTo(Le)}getValue(Re){if(Re<=this._startTime)return this._start;if(Re>=this._endTime)return this._end;const Oe=Le.cw((Re-this._startTime)/(this._endTime-this._startTime));return this._start*(1-Oe)+this._end*Oe}isEasing(Le){return Le>=this._startTime&&Le<=this._endTime}jumpTo(Le){this._startTime=-1/0,this._endTime=-1/0,this._start=Le,this._end=Le}easeTo(Le,Re,Oe){this._start=this.getValue(Re),this._end=Le,this._startTime=Re,this._endTime=Re+Oe}}const Mp={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Rn{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class An{constructor(Le){this.map=Le,this.interactionsByType=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this)}add(Re,Oe){if(this.typeById.has(Re))throw new Error(`Interaction id "${Re}" already exists.`);const{type:Ue,filter:qe}=Oe;if(qe){const Oe=Le.M(qe,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===Oe.result)throw new Error(Oe.value.map((Le=>`${Le.key}: ${Le.message}`)).join(", "));this.filters.set(Re,Oe.value)}const Ct=this.interactionsByType.get(Ue)||new Map;0===Ct.size&&(this.map.on(Ue,this.handleType),this.interactionsByType.set(Ue,Ct)),Ct.set(Re,Oe),this.typeById.set(Re,Ue)}remove(Le){const Re=this.typeById.get(Le);if(!Re)return;this.typeById.delete(Le),this.filters.delete(Le);const Oe=this.interactionsByType.get(Re);Oe&&(Oe.delete(Le),0===Oe.size&&this.map.off(Re,this.handleType))}handleType(Le){const Re=Le.features||this.map.queryRenderedFeatures(Le.point);if(!Re)return;const Oe=this.interactionsByType.get(Le.type),Ue={zoom:0};for(const[Le,qe]of Oe){const Oe=this.filters.get(Le),{handler:Ct,layers:Ot}=qe;for(const Jt of Re)if((!Ot||Ot.includes(Jt.layer.id))&&(!Oe||Oe.evaluate(Ue,Jt))&&!1!==Ct({id:Le,feature:Jt,interaction:qe}))break}}}const Ap={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0},Dp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Mn{constructor(Re,Oe,Ue=!1){this._clickTolerance=10,this.element=Oe,this.mouseRotate=new Wa({clickTolerance:Re.dragRotate._mouseRotate._clickTolerance}),this.map=Re,Ue&&(this.mousePitch=new $a({clickTolerance:Re.dragRotate._mousePitch._clickTolerance})),Le.aJ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),Oe.addEventListener("mousedown",this.mousedown),Oe.addEventListener("touchstart",this.touchstart,{passive:!1}),Oe.addEventListener("touchmove",this.touchmove),Oe.addEventListener("touchend",this.touchend),Oe.addEventListener("touchcancel",this.reset)}down(Le,Re){this.mouseRotate.mousedown(Le,Re),this.mousePitch&&this.mousePitch.mousedown(Le,Re),_()}move(Le,Re){const Oe=this.map,Ue=this.mouseRotate.mousemoveWindow(Le,Re),qe=Ue&&Ue.bearingDelta;if(qe&&Oe.setBearing(Oe.getBearing()+qe),this.mousePitch){const Ue=this.mousePitch.mousemoveWindow(Le,Re),qe=Ue&&Ue.pitchDelta;qe&&Oe.setPitch(Oe.getPitch()+qe)}}off(){const Le=this.element;Le.removeEventListener("mousedown",this.mousedown),Le.removeEventListener("touchstart",this.touchstart,{passive:!1}),Le.removeEventListener("touchmove",this.touchmove),Le.removeEventListener("touchend",this.touchend),Le.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){p(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(Re){this.down(Le.l({},Re,{ctrlKey:!0,preventDefault:()=>Re.preventDefault()}),g(this.element,Re)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(Le){this.move(Le,g(this.element,Le))}mouseup(Le){this.mouseRotate.mouseupWindow(Le),this.mousePitch&&this.mousePitch.mouseupWindow(Le),this.offTemp()}touchstart(Le){1!==Le.targetTouches.length?this.reset():(this._startPos=this._lastPos=v(this.element,Le.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>Le.preventDefault()},this._startPos))}touchmove(Le){1!==Le.targetTouches.length?this.reset():(this._lastPos=v(this.element,Le.targetTouches)[0],this.move({preventDefault:()=>Le.preventDefault()},this._lastPos))}touchend(Le){0===Le.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function zn(Re,Oe,Ue){if(Re=new Le.bK(Re.lng,Re.lat),Oe){const qe=new Le.bK(Re.lng-360,Re.lat),Ct=new Le.bK(Re.lng+360,Re.lat),Ot=360*Math.ceil(Math.abs(Re.lng-Ue.center.lng)/360),Jt=Ue.locationPoint(Re).distSqr(Oe),_i=Oe.x<0||Oe.y<0||Oe.x>Ue.width||Oe.y>Ue.height;Ue.locationPoint(qe).distSqr(Oe)<Jt&&(_i||Math.abs(qe.lng-Ue.center.lng)<Ot)?Re=qe:Ue.locationPoint(Ct).distSqr(Oe)<Jt&&(_i||Math.abs(Ct.lng-Ue.center.lng)<Ot)&&(Re=Ct)}for(;Math.abs(Re.lng-Ue.center.lng)>180;){const Le=Ue.locationPoint(Re);
vendor: 4,353 bytes, line 1
1if(Le.x>=0&&Le.y>=0&&Le.x<=Ue.width&&Le.y<=Ue.height)break;Re.lng>Ue.center.lng?Re.lng-=360:Re.lng+=360}return Re}const Lp={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Fn extends Le.E{constructor(Re,Oe){if(super(),(Re instanceof HTMLElement||Oe)&&(Re=Le.l({element:Re},Oe)),Le.aJ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=Re&&Re.anchor||"center",this._color=Re&&Re.color||"#3FB1CE",this._scale=Re&&Re.scale||1,this._draggable=Re&&Re.draggable||!1,this._clickTolerance=Re&&Re.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=Re&&Re.rotation||0,this._rotationAlignment=Re&&Re.rotationAlignment||"auto",this._pitchAlignment=Re&&Re.pitchAlignment&&Re.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=Re&&Re.occludedOpacity||.2,Re&&Re.element)this._element=Re.element,this._offset=Le.P.convert(Re&&Re.offset||[0,0]);else{this._defaultMarker=!0,this._element=l("div");const Oe=41,Ue=27,qe=c("svg",{display:"block",height:Oe*this._scale+"px",width:Ue*this._scale+"px",viewBox:`0 0 ${Ue} ${Oe}`},this._element),Ct=c("radialGradient",{id:"shadowGradient"},c("defs",{},qe));c("stop",{offset:"10%","stop-opacity":.4},Ct),c("stop",{offset:"100%","stop-opacity":.05},Ct),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},qe),c("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},qe),c("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},qe),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},qe),this._offset=Le.P.convert(Re&&Re.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(Le=>{Le.preventDefault()})),this._element.addEventListener("mousedown",(Le=>{Le.preventDefault()}));const Ue=this._element.classList;for(const Le in Lp)Ue.remove(`mapboxgl-marker-anchor-${Le}`);Ue.add(`mapboxgl-marker-anchor-${this._anchor}`);const qe=Re&&Re.className?Re.className.trim().split(/\s+/):[];Ue.add(...qe),this._popup=null}addTo(Le){return Le===this._map||(this.remove(),this._map=Le,Le.getCanvasContainer().appendChild(this._element),Le.on("move",this._updateMoving),Le.on("moveend",this._update),Le.on("remove",this._clearFadeTimer),Le._addMarker(this),this.setDraggable(this._draggable),this._update(),Le.on("click",this._onMapClick)),this}remove(){const Le=this._map;return Le&&(Le.off("click",this._onMapClick),Le.off("move",this._updateMoving),Le.off("moveend",this._update),Le.off("mousedown",this._addDragHandler),Le.off("touchstart",this._addDragHandler),Le.off("mouseup",this._onUp),Le.off("touchend",this._onUp),Le.off("mousemove",this._onMove),Le.off("touchmove",this._onMove),Le.off("remove",this._clearFadeTimer),Le._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(Re){return this._lngLat=Le.bK.convert(Re),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(Le){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),Le){if(!("offset"in Le.options)){const Re=38.1,Oe=13.5,Ue=Math.sqrt(Math.pow(Oe,2)/2);Le.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 3,307 bytes, line 1
10,-Re],"bottom-left":[Ue,-1*(Re-Oe+Ue)],"bottom-right":[-Ue,-1*(Re-Oe+Ue)],left:[Oe,-1*(Re-Oe)],right:[-Oe,-1*(Re-Oe)]}:this._offset}this._popup=Le,Le._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(Le){const Re=Le.code,Oe=Le.charCode||Le.keyCode;"Space"!==Re&&"Enter"!==Re&&32!==Oe&&13!==Oe||this.togglePopup()}_onMapClick(Le){const Re=Le.originalEvent.target,Oe=this._element;this._popup&&(Re===Oe||Oe.contains(Re))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const Le=this._popup;return Le?(Le.isOpen()?(Le.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(Le.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const Le=this._map,Re=this._pos;if(!Le||!Re)return!1;const Oe=Le.unproject(Re),Ue=Le.getFreeCameraOptions();if(!Ue.position)return!1;const qe=Ue.position.toLngLat();return qe.distanceTo(Oe)<.9*qe.distanceTo(this._lngLat)}_evaluateOpacity(){const Re=this._map;if(!Re)return;const Oe=this._pos;if(!Oe||Oe.x<0||Oe.x>Re.transform.width||Oe.y<0||Oe.y>Re.transform.height)return void this._clearFadeTimer();const Ue=Re.unproject(Oe);let qe;Re._showingGlobe()&&Le.dz(Re.transform,this._lngLat)?qe=0:(qe=1-Re._queryFogOpacity(Ue),Re.transform._terrainEnabled()&&Re.getTerrain()&&this._behindTerrain()&&(qe*=this._occludedOpacity)),this._element.style.opacity=`${qe}`,this._element.style.pointerEvents=qe>0?"auto":"none",this._popup&&this._popup._setOpacity(qe),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const Le=this._pos;if(!Le||!this._map)return;const Re=this._offset.mult(this._scale);this._element.style.transform=`\n            translate(${Le.x}px,${Le.y}px)\n            ${Lp[this._anchor]}\n            ${this._calculateXYTransform()} ${this._calculateZTransform()}\n            translate(${Re.x}px,${Re.y}px)\n        `}_calculateXYTransform(){const Re=this._pos,Oe=this._map,Ue=this.getPitchAlignment();if(!Oe||!Re||"map"!==Ue)return"";if(!Oe._showingGlobe()){const Le=Oe.getPitch();return Le?`rotateX(${Le}deg)`:""}const qe=Le.c0(Le.dA(Oe.transform,this._lngLat)),Ct=Re.sub(Le.dB(Oe.transform)),Ot=Math.abs(Ct.x)+Math.abs(Ct.y);if(0===Ot)return"";const Jt=qe/Ot;return`rotateX(${-Ct.y*Jt}deg) rotateY(${Ct.x*Jt}deg)`}_calculateZTransform(){const Re=this._pos,Oe=this._map;if(!Oe||!Re)return"";let Ue=0;const qe=this.getRotationAlignment();if("map"===qe)if(Oe._showingGlobe()){const Re=Oe.project(new Le.bK(this._lngLat.lng,this._lngLat.lat+.001)),qe=Oe.project(new Le.bK(this._lngLat.lng,this._lngLat.lat-.001)).sub(Re);Ue=Le.c0(Math.atan2(qe.y,qe.x))-90}else Ue=-Oe.getBearing();else if("horizon"===qe){const qe=Le.a7(4,6,Oe.getZoom()),Ct=Le.dB(Oe.transform);Ct.y+=qe*Oe.transform.height;const Ot=Re.sub(Ct),Jt=Le.c0(Math.atan2(Ot.y,Ot.x));Ue=(Jt>90?Jt-270:Jt+90)*(1-qe)}return Ue+=this._rotation,Ue?`rotateZ(${Ue}deg)`:""}_update(Le){cancelAnimationFrame(this._updateFrameId);const Re=this._map;
1Re&&(Re.transform.renderWorldCopies&&(this._lngLat=zn(this._lngLat,this._pos,Re.transform)),this._pos=Re.project(this._lngLat),!0===Le?this._updateFrameId=requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),Re._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(Re._showingGlobe()||Re.getTerrain()||Re.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(Re){return this._offset=Le.P.convert(Re),this._update(),this}addClassName(Le){return this._element.classList.add(Le),this}removeClassName(Le){return this._element.classList.remove(Le),this}toggleClassName(Le){return this._element.classList.toggle(Le)}_onMove(Re){const Oe=this._map;if(!Oe)return;const Ue=this._pointerdownPos,qe=this._positionDelta;if(Ue&&qe){if(!this._isDragging){const Le=this._clickTolerance||Oe._clickTolerance;if(Re.point.dist(Ue)<Le)return;this._isDragging=!0}this._pos=Re.point.sub(qe),this._lngLat=Oe.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new Le.x("dragstart"))),this.fire(new Le.x("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const Re=this._map;Re&&(Re.off("mousemove",this._onMove),Re.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new Le.x("dragend")),this._state="inactive"}_addDragHandler(Le){const Re=this._map,Oe=this._pos;Re&&Oe&&this._element.contains(Le.originalEvent.target)&&(Le.preventDefault(),this._positionDelta=Le.point.sub(Oe),this._pointerdownPos=Le.point,this._state="pending",Re.on("mousemove",this._onMove),Re.on("touchmove",this._onMove),Re.once("mouseup",this._onUp),Re.once("touchend",this._onUp))}setDraggable(Le){this._draggable=!!Le;const Re=this._map;return Re&&(Le?(Re.on("mousedown",this._addDragHandler),Re.on("touchstart",this._addDragHandler)):(Re.off("mousedown",this._addDragHandler),Re.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(Le){return this._rotation=Le||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(Le){return this._rotationAlignment=Le||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(Le){return this._pitchAlignment=Le||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(Le){return this._occludedOpacity=Le||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Rp={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Op={maxWidth:100,unit:"metric"},Fp={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Np={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Vp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function jn(Re=new Le.P(0,0),Oe="bottom"){if("number"==typeof Re){const Ue=Math.round(Math.sqrt(.5*Math.pow(Re,2)));switch(Oe){case"top":return new Le.P(0,Re);case"top-left":return new Le.P(Ue,Ue);case"top-right":return new Le.P(-Ue,Ue);case"bottom":return new Le.P(0,-Re);case"bottom-left":return new Le.P(Ue,-Ue);case"bottom-right":return new Le.P(-Ue,-Ue);case"left":return new Le.P(Re,0);case"right":return new Le.P(-Re,0)}return new Le.P(0,0)}return Re instanceof Le.P||Array.isArray(Re)?Le.P.convert(Re):Le.P.convert(Re[Oe]||[0,0])}return{version:Re,supported:Ot.supported,setRTLTextPlugin:Le.dC,getRTLTextPluginStatus:Le.dD,Map:class extends Tn{constructor(Re){Ue.mark(Oe.create);const qe=Re;if(null!=(Re=Le.l({},Ap,Re)).minZoom&&null!=Re.maxZoom&&Re.minZoom>Re.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=Re.minPitch&&null!=Re.maxPitch&&Re.minPitch>Re.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=Re.minPitch&&Re.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=Re.maxPitch&&Re.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(Re.antialias&&Le.dx(window)&&(Re.antialias=!1,Le.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Hi(Re.minZoom,Re.maxZoom,Re.minPitch,Re.maxPitch,Re.renderWorldCopies),Re),this._repaint=!!Re.repaint,this._interactive=Re.interactive,this._minTileCacheSize=Re.minTileCacheSize,this._maxTileC
1acheSize=Re.maxTileCacheSize,this._failIfMajorPerformanceCaveat=Re.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=Re.preserveDrawingBuffer,this._antialias=Re.antialias,this._trackResize=Re.trackResize,this._bearingSnap=Re.bearingSnap,this._refreshExpiredTiles=Re.refreshExpiredTiles,this._fadeDuration=Re.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=Re.crossSourceCollisions,this._collectResourceTiming=Re.collectResourceTiming,this._language=this._parseLanguage(Re.language),this._worldview=Re.worldview,this._renderTaskQueue=new Sn,this._domRenderTaskQueue=new Sn,this._controls=[],this._markers=[],this._popups=[],this._mapId=Le.aP(),this._locale=Le.l({},Mp,Re.locale),this._clickTolerance=Re.clickTolerance,this._cooperativeGestures=Re.cooperativeGestures,this._performanceMetricsCollection=Re.performanceMetricsCollection,this._tessellationStep=Re.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=Re.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new In(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._requestManager=new T(Re.transformRequest,Re.accessToken,Re.testMode),this._silenceAuthErrors=!!Re.testMode,this._contextCreateOptions=Re.contextCreateOptions?{...Re.contextCreateOptions}:{},"string"==typeof Re.container){const Le=document.getElementById(Re.container);if(!Le)throw new Error(`Container '${Re.container.toString()}' not found.`);this._container=Le}else{if(!(Re.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=Re.container}if(this._container.childNodes.length>0&&Le.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),Re.maxBounds&&this.setMaxBounds(Re.maxBounds),Le.aJ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Rn),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},(()=>{this._update()})),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new bn(this,Re),this._localFontFamily=Re.localFontFamily,this._localIdeographFontFamily=Re.localIdeographFontFamily,(Re.style||!Re.testMode)&&this.setStyle(Re.style||Le.e.DEFAULT_STYLE,{config:Re.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),Re.projection&&this.setProjection(Re.projection),Re.hash&&(this._hash=new Ea("string"==typeof Re.hash&&Re.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==qe.center&&null==qe.zoom||(this.transform._unmodified=!1),this.jumpTo({center:Re.center,zoom:Re.zoom,bearing:Re.bearing,pitch:Re.pitch});const Oe=Re.bounds;Oe&&(this.resize(),this.fitBounds(Oe,Le.l({},Re.fitBoundsOptions,{duration:0})))}this.resize(),Re.attributionControl&&this.addControl(new En({customAttribution:Re.customAttribution}
vendor: 5,100 bytes, line 1
1)),this._logoControl=new Cn,this.addControl(this._logoControl,Re.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()})),this.on("data",(Re=>{this._update("style"===Re.dataType),this.fire(new Le.x(`${Re.dataType}data`,Re))})),this.on("dataloading",(Re=>{this.fire(new Le.x(`${Re.dataType}dataloading`,Re))})),this._interactions=new An(this)}_getMapId(){return this._mapId}addControl(Re,Oe){if(void 0===Oe&&(Oe=Re.getDefaultPosition?Re.getDefaultPosition():"top-right"),!Re||!Re.onAdd)return this.fire(new Le.t(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const Ue=Re.onAdd(this);this._controls.push(Re);const qe=this._controlPositions[Oe];return-1!==Oe.indexOf("bottom")?qe.insertBefore(Ue,qe.firstChild):qe.appendChild(Ue),this}removeControl(Re){if(!Re||!Re.onRemove)return this.fire(new Le.t(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const Oe=this._controls.indexOf(Re);return Oe>-1&&this._controls.splice(Oe,1),Re.onRemove(this),this}hasControl(Le){return this._controls.indexOf(Le)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(Re){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const Oe=!this._moving;return Oe&&this.fire(new Le.x("movestart",Re)).fire(new Le.x("move",Re)),this.fire(new Le.x("resize",Re)),Oe&&this.fire(new Le.x("moveend",Re)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(Re){return this.transform.setMaxBounds(Le.as.convert(Re)),this._update()}setMinZoom(Re){if((Re=Re??-2)>=-2&&Re<=this.transform.maxZoom)return this.transform.minZoom=Re,this._update(),this.getZoom()<Re?this.setZoom(Re):this.fire(new Le.x("zoomstart")).fire(new Le.x("zoom")).fire(new Le.x("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(Re){if((Re=Re??22)>=this.transform.minZoom)return this.transform.maxZoom=Re,this._update(),this.getZoom()>Re?this.setZoom(Re):this.fire(new Le.x("zoomstart")).fire(new Le.x("zoom")).fire(new Le.x("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(Re){if((Re=Re??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(Re>=0&&Re<=this.transform.maxPitch)return this.transform.minPitch=Re,this._update(),this.getPitch()<Re?this.setPitch(Re):this.fire(new Le.x("pitchstart")).fire(new Le.x("pitch")).fire(new Le.x("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(Re){if((Re=Re??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(Re>=this.transform.minPitch)return this.transform.maxPitch=Re,this._update(),this.getPitch()>Re?this.setPitch(Re):this.fire(new Le.x("pitchstart")).fire(new Le.x("pitch")).fire(new Le.x("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(Le){return this.transform.renderWorldCopies=Le,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(Le){return"auto"===Le?navigator.language:Array.isArray(Le)?0===Le.length?void 0:Le.map((Le=>"auto"===Le?navigator.language:Le)):Le}setLanguage(Le){const Re=this._parseLanguage(Le);if(!this.style||Re===this._language)return this;this._language=Re,this.style.reloadSources();for(const Le of this._controls)Le._setLanguage&&Le._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(Le){return this.style&&Le!==this._worldview?(this._worldview=Le,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(Le){return this._lazyInitEmptyStyle(),Le?"string"==typeof Le&&(Le={name:Le}):Le=null,this._useExplicitProjection=!!Le,this._prioritizeAndUpdateProjection(Le,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const Re=this.transform,Oe=Re.projection.name;let Ue;"globe"===Oe&&Re.zoom>=Le.bU?(Re.setMercatorFromTransition(),Ue=!0):"mercator"===Oe&&Re.zoom<Le.bU&&(Re.setProjection({name:"globe"}),Ue=!0),Ue&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
1Update())}_prioritizeAndUpdateProjection(Le,Re){return this._updateProjection(Le||Re||{name:"mercator"})}_updateProjection(Re){let Oe;return Oe="globe"===Re.name&&this.transform.zoom>=Le.bU?this.transform.setMercatorFromTransition():this.transform.setProjection(Re),this.style.applyProjectionUpdate(),Oe&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(Re){return this.transform.locationPoint3D(Le.bK.convert(Re))}unproject(Re){return this.transform.pointLocation3D(Le.P.convert(Re))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(Le,Re,Oe){if("mouseenter"===Le||"mouseover"===Le){let Ue=!1;const r=qe=>{const Ct=Re.filter((Le=>this.getLayer(Le))),Ot=Ct.length?this.queryRenderedFeatures(qe.point,{layers:Ct}):[];Ot.length?Ue||(Ue=!0,Oe.call(this,new za(Le,this,qe.originalEvent,{features:Ot}))):Ue=!1},s=()=>{Ue=!1};return{layers:new Set(Re),listener:Oe,delegates:{mousemove:r,mouseout:s}}}if("mouseleave"===Le||"mouseout"===Le){let Ue=!1;const r=qe=>{const Ct=Re.filter((Le=>this.getLayer(Le)));(Ct.length?this.queryRenderedFeatures(qe.point,{layers:Ct}):[]).length?Ue=!0:Ue&&(Ue=!1,Oe.call(this,new za(Le,this,qe.originalEvent)))},s=Re=>{Ue&&(Ue=!1,Oe.call(this,new za(Le,this,Re.originalEvent)))};return{layers:new Set(Re),listener:Oe,delegates:{mousemove:r,mouseout:s}}}{const o=Le=>{const Ue=Re.filter((Le=>this.getLayer(Le))),qe=Ue.length?this.queryRenderedFeatures(Le.point,{layers:Ue}):[];qe.length&&(Le.features=qe,Oe.call(this,Le),delete Le.features)};return{layers:new Set(Re),listener:Oe,delegates:{[Le]:o}}}}on(Le,Re,Oe){if("function"==typeof Re||void 0===Oe)return super.on(Le,Re);if(Array.isArray(Re)||(Re=[Re]),Re)for(const Le of Re)if(!this._isValidId(Le))return this;const Ue=this._createDelegatedListener(Le,Re,Oe);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[Le]=this._delegatedListeners[Le]||[],this._delegatedListeners[Le].push(Ue);for(const Le in Ue.delegates)this.on(Le,Ue.delegates[Le]);return this}once(Le,Re,Oe){if("function"==typeof Re||void 0===Oe)return super.once(Le,Re);if(Array.isArray(Re)||(Re=[Re]),Re)for(const Le of Re)if(!this._isValidId(Le))return this;const Ue=this._createDelegatedListener(Le,Re,Oe);for(const Le in Ue.delegates)this.once(Le,Ue.delegates[Le]);return this}off(Le,Re,Oe){if("function"==typeof Re||void 0===Oe)return super.off(Le,Re);const Ue=new Set(Array.isArray(Re)?Re:[Re]);for(const Le of Ue)if(!this._isValidId(Le))return this;const r=(Le,Re)=>{if(Le.size!==Re.size)return!1;for(const Oe of Le)if(!Re.has(Oe))return!1;return!0},qe=this._delegatedListeners?this._delegatedListeners[Le]:void 0;return qe&&(Le=>{for(let Re=0;Re<Le.length;Re++){const qe=Le[Re];if(qe.listener===Oe&&r(qe.layers,Ue)){for(const Le in qe.delegates)this.off(Le,qe.delegates[Le]);return Le.splice(Re,1),this}}})(qe),this}queryRenderedFeatures(Re,Oe){if(!this.style)return[];if(void 0!==Oe||void 0===Re||Re instanceof Le.P||Array.isArray(Re)||(Oe=Re,Re=void 0),Re=Re||[[0,0],[this.transform.width,this.transform.height]],(Oe=Oe||{}).layers&&Array.isArray(Oe.layers))for(const Le of Oe.layers)if(!this._isValidId(Le))return[];return this.style.queryRenderedFeatures(Re,Oe,this.transform)}querySourceFeatures(Le,Re){return this._isValidId(Le)?this.style.querySourceFeatures(Le,Re):[]}isPointOnSurface(Re){const{name:Oe}=this.transform.projection;return"globe"!==Oe&&"mercator"!==Oe&&Le.w(`${Oe} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(Le.P.convert(Re))}addInteraction(Le,Re){return this._interactions.add(Le,Re),this}removeInteraction(Le){return this._interactions.remove(Le),this}setStyle(Re,Oe){return Oe=Le.l({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},Oe),this.style&&Re&&!1!==Oe.diff&&Oe.localFontFamily===this._localFontFamily&&Oe.localIdeographFontFamily===this._localIdeographFontFamily&&!Oe.config?(this.style._diffStyle(Re,((Ue,qe)=>{Ue?(Le.w(`Unable to perform style diff: ${String(Ue.message||Ue.error||Ue)}. Rebuilding the style from scratch.`),this._updateStyle(Re,Oe)):qe&&this._update(!0)}),(()=>{this._postStyleLoadEvent()})),this):(this._localIdeographFontFamily=Oe.localIdeographFontFamily,this._localFontFamily=Oe.localFontFamily,this._updateStyle(Re,Oe))}_getUIString(Le){const Re=this._locale[Le];if(null==Re)throw new Error(`Missing UI string '${Le}'`);return Re}_updateStyle(Re,Oe){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),Re){const Ue=Le.l({},Oe);Oe&&Oe.config&&(Ue.initialConfig=Oe.config,delete Ue.config),this.style=new co(this,Ue).load(Re),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new co(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(Le.w("There is no style added to the map."),!1)}_isValidId(Re){return null==Re?(this.fire(new Le.t(new Error("IDs can't be empty."))),!1):!Le.cn(Re)||(this.fire(new Le.t(new Error(`IDs can't 
1contain special symbols: "${Re}".`))),!1)}addSource(Le,Re){return this._isValidId(Le)?(this._lazyInitEmptyStyle(),this.style.addSource(Le,Re),this._update(!0)):this}isSourceLoaded(Le){return!!this._isValidId(Le)&&!!this.style&&this.style._isSourceCacheLoaded(Le)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(Le,Re,Oe){this._lazyInitEmptyStyle(),this.style.addSourceType(Le,Re,Oe)}removeSource(Le){return this._isValidId(Le)?(this.style.removeSource(Le),this._updateTerrain(),this._update(!0)):this}getSource(Le){return this._isValidId(Le)?this.style.getOwnSource(Le):null}addImage(Re,Oe,{pixelRatio:Ue=1,sdf:qe=!1,stretchX:Ct,stretchY:Ot,content:Jt}={}){if(this._lazyInitEmptyStyle(),Oe instanceof HTMLImageElement||ImageBitmap&&Oe instanceof ImageBitmap){const{width:_i,height:xi,data:vi}=Le.q.getImageData(Oe);this.style.addImage(Re,{data:new Le.r({width:_i,height:xi},vi),pixelRatio:Ue,stretchX:Ct,stretchY:Ot,content:Jt,sdf:qe,version:0})}else if(void 0===Oe.width||void 0===Oe.height)this.fire(new Le.t(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:_i,height:xi}=Oe,vi=Oe;this.style.addImage(Re,{data:new Le.r({width:_i,height:xi},new Uint8Array(vi.data)),pixelRatio:Ue,stretchX:Ct,stretchY:Ot,content:Jt,sdf:qe,ver
vendor: 4,358 bytes, line 1
1sion:0,userImage:vi}),vi.onAdd&&vi.onAdd(this,Re)}}updateImage(Re,Oe){this._lazyInitEmptyStyle();const Ue=this.style.getImage(Re);if(!Ue)return void this.fire(new Le.t(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const qe=Oe instanceof HTMLImageElement||ImageBitmap&&Oe instanceof ImageBitmap?Le.q.getImageData(Oe):Oe,{width:Ct,height:Ot,data:Jt}=qe;if(void 0===Ct||void 0===Ot)return void this.fire(new Le.t(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(Ct!==Ue.data.width||Ot!==Ue.data.height)return void this.fire(new Le.t(new Error(`The width and height of the updated image (${Ct}, ${Ot})\n                must be that same as the previous version of the image\n                (${Ue.data.width}, ${Ue.data.height})`)));const _i=!(Oe instanceof HTMLImageElement||ImageBitmap&&Oe instanceof ImageBitmap);Ue.data.replace(Jt,_i),this.style.updateImage(Re,Ue)}hasImage(Re){return Re?!!this.style&&!!this.style.getImage(Re):(this.fire(new Le.t(new Error("Missing required image id"))),!1)}removeImage(Le){this.style.removeImage(Le)}loadImage(Re,Oe){Le.o(this._requestManager.transformRequest(Re,Le.R.Image),((Re,Ue)=>{Oe(Re,Ue instanceof HTMLImageElement?Le.q.getImageData(Ue):Ue)}))}listImages(){return this.style.listImages()}addModel(Le,Re){this._lazyInitEmptyStyle(),this.style.addModel(Le,Re)}hasModel(Re){return Re?this.style.hasModel(Re):(this.fire(new Le.t(new Error("Missing required model id"))),!1)}removeModel(Le){this.style.removeModel(Le)}listModels(){return this.style.listModels()}addLayer(Le,Re){return this._isValidId(Le.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(Le,Re),this._update(!0)):this}getSlot(Le){const Re=this.getLayer(Le);return Re&&Re.slot||null}setSlot(Le,Re){return this.style.setSlot(Le,Re),this.style.mergeLayers(),this._update(!0)}addImport(Le,Re){return this.style.addImport(Le,Re),this}updateImport(Le,Re){return"string"!=typeof Re&&Re.id!==Le?(this.removeImport(Le),this.addImport(Re)):(this.style.updateImport(Le,Re),this._update(!0))}removeImport(Le){return this.style.removeImport(Le),this}moveImport(Le,Re){return this.style.moveImport(Le,Re),this._update(!0)}moveLayer(Le,Re){return this._isValidId(Le)?(this.style.moveLayer(Le,Re),this._update(!0)):this}removeLayer(Le){return this._isValidId(Le)?(this.style.removeLayer(Le),this._update(!0)):this}getLayer(Le){if(!this._isValidId(Le))return null;const Re=this.style.getOwnLayer(Le);return Re?"custom"===Re.type?Re.implementation:Re.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(Le,Re,Oe){return this._isValidId(Le)?(this.style.setLayerZoomRange(Le,Re,Oe),this._update(!0)):this}setFilter(Le,Re,Oe={}){return this._isValidId(Le)?(this.style.setFilter(Le,Re,Oe),this._update(!0)):this}getFilter(Le){return this._isValidId(Le)?this.style.getFilter(Le):null}setPaintProperty(Le,Re,Oe,Ue={}){return this._isValidId(Le)?(this.style.setPaintProperty(Le,Re,Oe,Ue),this._update(!0)):this}getPaintProperty(Le,Re){return this._isValidId(Le)?this.style.getPaintProperty(Le,Re):null}setLayoutProperty(Le,Re,Oe,Ue={}){return this._isValidId(Le)?(this.style.setLayoutProperty(Le,Re,Oe,Ue),this._update(!0)):this}getLayoutProperty(Le,Re){return this._isValidId(Le)?this.style.getLayoutProperty(Le,Re):null}getSchema(Le){return this.style.getSchema(Le)}setSchema(Le,Re){return this.style.setSchema(Le,Re),this._update(!0)}getConfig(Le){return this.style.getConfig(Le)}setConfig(Le,Re){return this.style.setConfig(Le,Re),this._update(!0)}getConfigProperty(Le,Re){return this.style.getConfigProperty(Le,Re)}setConfigProperty(Le,Re,Oe){return this.style.setConfigProperty(Le,Re,Oe),this._update(!0)}setLights(Le){if(this._lazyInitEmptyStyle(),Le&&1===Le.length&&"flat"===Le[0].type){const Re=Le[0];Re.properties?this.style.setFlatLight(Re.properties,Re.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(Le),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const Le=this.style.getLights()||[];return 0===Le.length&&Le.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),Le}setLight(Le,Re={}
vendor: 5,771 bytes, line 1
1){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:Le}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(Le){return this._lazyInitEmptyStyle(),!Le&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(Le),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(Le){return this._lazyInitEmptyStyle(),this.style.setFog(Le),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(Le){return this._lazyInitEmptyStyle(),this.style.setColorTheme(Le),this._update(!0)}setCamera(Le){return this.style.setCamera(Le),this._triggerCameraUpdate(Le)}_triggerCameraUpdate(Le){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===Le["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(Re){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(Le.bK.convert(Re),this.transform):0}setFeatureState(Le,Re){return this._isValidId(Le.source)?(this.style.setFeatureState(Le,Re),this._update()):this}removeFeatureState(Le,Re){return this._isValidId(Le.source)?(this.style.removeFeatureState(Le,Re),this._update()):this}getFeatureState(Le){return this._isValidId(Le.source)?this.style.getFeatureState(Le):null}_updateContainerDimensions(){if(!this._container)return;const Le=this._container.getBoundingClientRect().width||400,Re=this._container.getBoundingClientRect().height||300;let Oe,Ue,qe,Ct=this._container;for(;Ct&&(!Ue||!qe);){const Le=window.getComputedStyle(Ct).transform;Le&&"none"!==Le&&(Oe=Le.match(/matrix.*\((.+)\)/)[1].split(", "),Oe[0]&&"0"!==Oe[0]&&"1"!==Oe[0]&&(Ue=Oe[0]),Oe[3]&&"0"!==Oe[3]&&"1"!==Oe[3]&&(qe=Oe[3])),Ct=Ct.parentElement}this._containerWidth=Ue?Math.abs(Le/Ue):Le,this._containerHeight=qe?Math.abs(Re/qe):Re}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&Le.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const Le=this._container;Le.classList.add("mapboxgl-map"),(this._missingCSSCanary=l("div","mapboxgl-canary",Le)).style.visibility="hidden",this._detectMissingCSS();const Re=this._canvasContainer=l("div","mapboxgl-canvas-container",Le);this._canvas=l("canvas","mapboxgl-canvas",Re),this._interactive&&(Re.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const Oe=this._controlContainer=l("div","mapboxgl-control-container",Le),Ue=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach((Le=>{Ue[Le]=l("div",`mapboxgl-ctrl-${Le}`,Oe)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(Re,Oe){const Ue=Le.q.devicePixelRatio||1;this._canvas.width=Ue*Math.ceil(Re),this._canvas.height=Ue*Math.ceil(Oe),this._canvas.style.width=`${Re}px`,this._canvas.style.height=`${Oe}px`}_addMarker(Le){this._markers.push(Le)}_removeMarker(Le){const Re=this._markers.indexOf(Le);-1!==Re&&this._markers.splice(Re,1)}_addPopup(Le){this._popups.push(Le)}_removePopup(Le){const Re=this._popups.indexOf(Le);-1!==Re&&this._popups.splice(Re,1)}_setupPainter(){const Re=Le.l({},Ot.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),Oe=this._canvas.getContext("webgl2",Re);Oe?(G(Oe,!0),this.painter=new wa(Oe,this._contextCreateOptions,this.transform,this._tp),this.on("data",(Le=>{"source"===Le.dataType&&this.painter.setTileLoadedFlag(!0)})),Le.m.testSupport(Oe)):this.fire(new Le.t(new Error("Failed to initialize WebGL")))}_contextLost(Re){Re.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new Le.x("webglcontextlost",{originalEvent:Re}))}_contextRestored(Re){this._setupPainter(),this.resize(),this._update(),this.fire(new Le.x("webglcontextrestored",{originalEvent:Re}))}_onMapScroll(Le){if(Le.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(Le){return this.style?(this._styleDirty=this._styleDirty||Le,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(Le){return this._update(),this._renderTaskQueue.add(Le)}_cancelRenderFrame(Le){this._renderTaskQueue.remove(Le)}_requestDomTask(Le){!this.loaded()||this.loaded()&&!this.isMoving()?Le():this._domRenderTaskQueue.add(Le)}_render(Re){let qe;this.fire(new Le.x("renderstart")),++this._frameId;const Ct=this.painter.context.extTimerQuery,Ot=Le.q.now(),Jt=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(qe=Jt.createQuery(),Jt.beginQuery(Ct.TIME_ELAPSED_EXT,qe)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
1(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(Re),this._domRenderTaskQueue.run(Re),this._removed)return;this._updateProjectionTransition();const _i=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Re=this.transform.zoom,Oe=this.transform.pitch,Ue=Le.q.now(),qe=new Le.a3(Re,{now:Ue,fadeDuration:_i,pitch:Oe,transition:this.style.transition});this.style.update(qe)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let xi=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),xi=this._updateAverageElevation(Ot),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):xi=this._updateAverageElevation(Ot);const vi=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,_i,this._crossSourceCollisions,this.painter.replacementSource);if(vi&&(this._placementDirty=vi.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:_i,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new Le.x("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Ue.mark(Oe.load),this.fire(new Le.x("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),qe){const Re=Le.q.now()-Ot;Jt.endQuery(Ct.TIME_ELAPSED_EXT),setTimeout((()=>{const Oe=Jt.getQueryParameter(qe,Jt.QUERY_RESULT)/1e6;Jt.deleteQuery(qe),this.fire(new Le.x("gpu-timing-frame",{cpuTime:Re,gpuTime:Oe}))}),50)}if(this.listens("gpu-timing-layer")){const Re=this.painter.collectGpuTimers();setTimeout((()=>{const Oe=this.painter.queryGpuTimers(Re);this.fire(new Le.x("gpu-timing-layer",{layerTimes:Oe}))}),50)}if(this.listens("gpu-timing-deferred-render")){const Re=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const Oe=this.painter.queryGpuTimeDeferredRender(Re);this.fire(new Le.x("gpu-timing-deferred-render",{gpuTime:Oe}))}),50)}const bi=this._sourcesDirty||this._styleDirty||this._placementDirty||xi;if(bi||this._repaint)this.triggerRepaint();else{const Re=this.idle();if(Re&&(xi=this._updateAverageElevation(Ot,!0)),xi)this.triggerRepaint();else if(this._triggerFrame(!1),Re&&(this.fire(new Le.x("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Re=this._calculateSpeedIndex();this.fire(new Le.x("speedindexcompleted",{speedIndex:Re})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||bi||(this._fullyLoaded=!0,Ue.mark(Oe.fullLoad),this._performanceMetricsCollection&&Xn(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(Le){for(const Re of this._markers)Le&&!this.getRenderWorldCopies()&&(Re._lngLat=Re._lngLat.wrap()),Re._update();for(const Re of this._popups)!Le||this.getRenderWorldCopies()||Re._trackPointer||(Re._lngLat=Re._lngLat.wrap()),Re._update()}_updateAverageElevation(Le,Re=!1){const i=Le=>(this.transform.averageElevation=Le,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const Oe=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(Oe||(Re||Le-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(Le)){const Re=this.transform.averageElevation;let Ue=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(Ue)?Ue=0:this._averageElevationLastSampledAt=Le;const qe=Math.abs(Re-Ue);if(qe>1){if(this._isInitialLoad||Oe)return this._averageElevation.jumpTo(Ue),i(Ue);this._averageElevation.easeTo(Ue,Le,300)}else if(qe>1e-4)return this._averageElevation.jumpTo(Ue),i(Ue)}return!!this._averageElevation.isEasing(Le)&&i(this._averageElevation.getValue(Le))}_authenticate(){lo(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(Re=>{if(Re&&(Re.message===bi||401===Re.status)){const Re=this.painter.context.gl;G(Re,!1),this._logoControl instanceof Cn&&this._logoControl._updateLogo(),Re&&Re.clear(Re.DEPTH_BUFFER_BIT|Re.COLOR_BUFFER_BIT|Re.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new Le.t(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),Gn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&Zn(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const Le=this._isDragging();this.painter.updateTerrain(this.style,Le)}_calculateSpeedIndex(){const Le=this.painter.canvasCopy(),Re=this.painter.getCanvasCopiesAndTimestamps();Re.timeStamps.push(performance.now());const Oe=this.painter.context.gl,Ue=Oe.createFramebuffer();function r(Le){Oe.framebufferTexture2D(Oe.FRAMEBUFFER,Oe.COLOR_ATTACHMENT0,Oe.TEXTURE_2D,Le,0);const Re=new Uint8Array(Oe.drawingBufferWidth*Oe.drawingBufferHeight*4);return Oe.readPixels(0,0,Oe.drawingBufferWidth,Oe.drawingBufferHeight,Oe.RGBA,Oe.UNSIGNED_BYTE,Re),Re}return Oe.bindFramebuffer(Oe.FRAMEBUFFER,Ue),this._canvasPixelComparison(r(Le),Re.canvasCopies.map(r),Re.timeStamps)}_canvasPixelComparison(Le,Re,Oe){let Ue=Oe[1]-Oe[0];const qe=Le.length/4;for(let Ct=0;
vendor: 9,867 bytes, line 1
1Ct<Re.length;Ct++){const Ot=Re[Ct];let Jt=0;for(let Re=0;Re<Ot.length;Re+=4)Ot[Re]===Le[Re]&&Ot[Re+1]===Le[Re+1]&&Ot[Re+2]===Le[Re+2]&&Ot[Re+3]===Le[Re+3]&&(Jt+=1);Ue+=(Oe[Ct+2]-Oe[Ct+1])*(1-Jt/qe)}return Ue}remove(){this._hash&&this._hash.remove();for(const Le of this._controls)Le.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const Re=this.painter.context.gl.getExtension("WEBGL_lose_context");Re&&Re.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),uo.delete(this.painter.context.gl),Yn.remove(),Nn.remove(),this._removed=!0,this.fire(new Le.x("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(Re){this._renderNextFrame=this._renderNextFrame||Re,this.style&&!this._frame&&(this._frame=Le.q.frame((Le=>{const Re=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,Re&&this._render(Le)})))}_preloadTiles(Re){const Oe=this.style?this.style.getSourceCaches():[];return Le.bf(Oe,((Le,Oe)=>Le._preloadTiles(Re,Oe)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(Le){this._trackResize&&this.resize({originalEvent:Le})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(Le){this._showTileBoundaries!==Le&&(this._showTileBoundaries=Le,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(Le){this._showParseStatus!==Le&&(this._showParseStatus=Le,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(Le){this._showTerrainWireframe!==Le&&(this._showTerrainWireframe=Le,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(Le){this._showLayers2DWireframe!==Le&&(this._showLayers2DWireframe=Le,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(Le){this._showLayers3DWireframe!==Le&&(this._showLayers3DWireframe=Le,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(Le){this._speedIndexTiming!==Le&&(this._speedIndexTiming=Le,this._update())}get showPadding(){return!!this._showPadding}set showPadding(Le){this._showPadding!==Le&&(this._showPadding=Le,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(Le){this._showCollisionBoxes!==Le&&(this._showCollisionBoxes=Le,this._tp.refreshUI(),Le?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(Le){this._showOverdrawInspector!==Le&&(this._showOverdrawInspector=Le,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(Le){this._repaint!==Le&&(this._repaint=Le,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(Le){this._vertices=Le,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(Le){this._showTileAABBs!==Le&&(this._showTileAABBs=Le,this._tp.refreshUI(),Le&&this._update())}_setCacheLimits(Re,Oe){Le.dy(Re,Oe)}get version(){return Re}},NavigationControl:class{constructor(Re={}){this.options=Le.l({},Dp,Re),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(Le=>Le.preventDefault())),this.options.showZoom&&(Le.aJ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(Le=>{this._map&&this._map.zoomIn({},{originalEvent:Le})})),l("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(Le=>{this._map&&this._map.zoomOut({},{originalEvent:Le})})),l("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(Le.aJ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(Le=>{const Re=this._map;Re&&(this.options.visualizePitch?Re.resetNorthPitch({},{originalEvent:Le}):Re.resetNorth({},{originalEvent:Le}))})),this._compassIcon=l("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const Le=this._map;if(!Le)return;const Re=Le.getZoom(),Oe=Re===Le.getMaxZoom(),Ue=Re===Le.getMinZoom();this._zoomInButton.disabled=Oe,this._zoomOutButton.disabled=Ue,this._zoomInButton.setAttribute("aria-disabled",Oe.toString()),this._zoomOutButton.setAttribute("aria-disabled",Ue.toString())}_rotateCompassArrow(){const Le=this._map;if(!Le)return;const Re=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(Le.transform.pitch*(Math.PI/180)),.5)}) rotateX(${Le.transform.pitch}deg) rotateZ(${Le.transform.angle*(180/Math.PI)}deg)`:`rotate(${Le.transform.angle*(180/Math.PI)}deg)`;Le._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=Re)}))}onAdd(Le){return this._map=Le,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),Le.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&Le.on("pitch",this._rotateCompassArrow),Le.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Mn(Le,this._compass,this.options.visualizePitch)),this._container}onRemove(){const Le=this._map;Le&&(this._container.remove(),this.options.showZoom&&Le.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&Le.off("pitch",this._rotateCompassArrow),Le.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(Le,Re){const Oe=l("button",Le,this._container);return Oe.type="button",Oe.addEventListener("click",Re),Oe}_setButtonTitle(Le,Re){if(!this._map)return;const Oe=this._map._getUIString(`NavigationControl.${Re}`);Le.setAttribute("aria-label",Oe),Le.firstElementChild&&Le.firstElementChild.setAttribute("title",Oe)}},GeolocateControl:class extends Le.E{constructor(Re={}){super();const Oe=navigator.geolocation;this.options=Le.l({geolocation:Oe},Rp,Re),Le.aJ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Ta(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(Le){return this._map=Le,this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(Le){const t=(Re=!!this.options.geolocation)=>{this._supportsGeolocation=Re,Le(Re)};void 0!==this._supportsGeolocation?Le(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then((Le=>t("denied"!==Le.state))).catch((()=>t())):t()}_isOutOfMapMaxBounds(Le){const Re=this._map.getMaxBounds(),Oe=Le.coords;return!!Re&&(Oe.longitude<Re.getWest()||Oe.longitude>Re.getEast()||Oe.latitude<Re.getSouth()||Oe.latitude>Re.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(Re){if(this._map){if(this._isOutOfMapMaxBounds(Re))return this._setErrorState(),this.fire(new Le.x("outofmaxbounds",Re)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=Re,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
1RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(Re),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(Re),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new Le.x("geolocate",Re)),this._finish()}}_updateCamera(Re){const Oe=new Le.bK(Re.coords.longitude,Re.coords.latitude),Ue=Re.coords.accuracy,qe=this._map.getBearing(),Ct=Le.l({bearing:qe},this.options.fitBoundsOptions);this._map.fitBounds(Oe.toBounds(Ue),Ct,{geolocateSource:!0})}_updateMarker(Re){if(Re){const Oe=new Le.bK(Re.coords.longitude,Re.coords.latitude);this._accuracyCircleMarker.setLngLat(Oe).addTo(this._map),this._userLocationDotMarker.setLngLat(Oe).addTo(this._map),this._accuracy=Re.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const Re=this._map.transform,Oe=Le.bD(1,Re._center.lat)*Re.worldSize,Ue=Math.ceil(2*this._accuracy*Oe);this._circleElement.style.width=`${Ue}px`,this._circleElement.style.height=`${Ue}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(Re){if(this._map){if(this.options.trackUserLocation)if(1===Re.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const Le=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",Le),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",Le),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===Re.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new Le.x("error",Re)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(Re){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(Le=>Le.preventDefault())),this._geolocateButton=l("button","mapboxgl-ctrl-geolocate",this._container),l("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===Re){Le.w("Geolocation support is not available so the GeolocateControl will be disabled.");const Re=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",Re),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",Re)}else{const Le=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",Le),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",Le)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l("div","mapboxgl-user-location"),this._dotElement.appendChild(l("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Fn({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(Re=>{Re.geolocateSource||"ACTIVE_LOCK"!==this._watchState||Re.originalEvent&&"resize"===Re.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new Le.x("trackuserlocationend")))}))}}_onDeviceOrientation(Le){this._userLocationDotMarker&&(Le.webkitCompassHeading?this._heading=Le.webkitCompassHeading:!0===Le.absolute&&(this._heading=-1*Le.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return Le.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new Le.x("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new Le.x("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new Le.x("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let Le;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(Le={maximumAge:6e5,timeout:0},this._noTimeout=!0):(Le=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,Le),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((Le=>{"granted"===Le&&e()})).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:En,ScaleControl:class{constructor(Re={}){this.options=Le.l({},Op,Re),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(Le){return!1}}(),Le.aJ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const Le=this.options.maxWidth||100,Re=this._map,Oe=Re._containerHeight/2,Ue=Re._containerWidth/2-Le/2,qe=Re.unproject([Ue,Oe]),Ct=Re.unproject([Ue+Le,Oe]),Ot=qe.distanceTo(Ct);if("imperial"===this.options.unit){const Re=3.2808*Ot;Re>5280?this._setScale(Le,Re/5280,"mile"):this._setScale(Le,Re,"foot")}else"nautical"===this.options.unit?this._setScale(Le,Ot/1852,"nautical-mile"):Ot>=1e3?this._setScale(Le,Ot/1e3,"kilometer"):this._setScale(Le,Ot,"meter")}_setScale(Le,Re,Oe){this._map._requestDomTask((()=>{const Ue=function(Le){const Re=Math.pow(10,`${Math.floor(Le)}`.length-1);let Oe=Le/Re;return Oe=Oe>=10?10:Oe>=5?5:Oe>=3?3:Oe>=2?2:Oe>=1?1:function(Le){const Re=Math.pow(10,Math.ceil(-Math.log(Le)/Math.LN10));return Math.round(Le*Re)/Re}(Oe),Re*Oe}(Re),qe=Ue/Re;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==Oe?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:Oe}).format(Ue):`${Ue}&nbsp;${Fp[Oe]}`,this._container.style.width=Le*qe+"px"}))}onAdd(Le){return this._map=Le,this._language=Le.getLanguage(),this._container=l("div","mapboxgl-ctrl mapboxgl-ctrl-scale",Le.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(Le){this._language=Le,this._update()}setUnit(Le){this.options.unit=Le,this._update()}},FullscreenControl:class{constructor(Re={}){this._fullscreen=!1,Re&&Re.container&&(Re.container instanceof HTMLElement?this._container=Re.container:Le.w("Full screen control 'container' must be a DOM element.")),Le.aJ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(Re){return this._map=Re,this._container||(this._container=this._map.getContainer()),this._controlContainer=l("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",Le.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const Le=this._fullscreenButton=l("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l("span","mapboxgl-ctrl-icon",Le).setAttribute("aria-hidden","true"),Le.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const Le=this._getTitle();this._fullscreenButton.setAttribute("aria-label",Le),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",Le)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends Le.E{constructor(Re){super(),this.options=Le.l(Object.create(Np),Re),Le.aJ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(Re&&Re.className?Re.className.trim().split(/\s+/):[])}addTo(Re){return this._map&&this.remove(),this._map=Re,this.options.closeOnClick&&Re.on("preclick",this._onClose),this.options.closeOnMove&&Re.on("move",this._onClose),Re.on("remove",this.remove),this._update(),Re._addPopup(this),this._focusFirstElement(),this._trackPointer?(Re.on("mousemove",this._onMouseEvent),Re.on("mouseup",this._onMouseEvent),Re._canvasContainer.classList.add("mapboxgl-track-pointer")):Re.on("move",this._update),this.fire(new Le.x("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const Re=this._map;return Re&&(Re.off("move",this._update),Re.off("move",this._onClose),Re.off("preclick",this._onClose),Re.off("click",this._onClose),Re.off("remove",this.remove),Re.off("mousemove",this._onMouseEvent),Re.off("mouseup",this._onMouseEvent),Re.off("drag",this._onMouseEvent),Re._canvasContainer&&Re._canvasContainer.classList.remove("mapboxgl-track-pointer"),Re._removePopup(this),this._map=void 0),this.fire(new Le.x("close")),this}getLngLat(){return this._lngLat}setLngLat(Re){this._lngLat=Le.bK.convert(Re),this._pos=null,this._trackPointer=!1,this._update();const Oe=this._map;return Oe&&(Oe.on("move",this._update),Oe.off("mousemove",this._onMouseEvent),Oe._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const Le=this._map;return Le&&(Le.off("move",this._update),Le.on("mousemove",this._onMouseEvent),Le.on("drag",this._onMouseEvent),Le._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(Le){return this.setDOMContent(document.createTextNode(Le))}setHTML(Le){const Re=document.createDocumentFragment(),Oe=document.createElement("body");let Ue;
vendor: 2,907 bytes, line 1
1for(Oe.innerHTML=Le;Ue=Oe.firstChild,Ue;)Re.appendChild(Ue);return this.setDOMContent(Re)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(Le){return this.options.maxWidth=Le,this._update(),this}setDOMContent(Le){let Re=this._content;if(Re)for(;Re.hasChildNodes();)Re.firstChild&&Re.removeChild(Re.firstChild);else Re=this._content=l("div","mapboxgl-popup-content",this._container||void 0);if(Re.appendChild(Le),this.options.closeButton){const Le=this._closeButton=l("button","mapboxgl-popup-close-button",Re);Le.type="button",Le.setAttribute("aria-label","Close popup"),Le.setAttribute("aria-hidden","true"),Le.innerHTML="&#215;",Le.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(Le){return this._classList.add(Le),this._updateClassList(),this}removeClassName(Le){return this._classList.delete(Le),this._updateClassList(),this}setOffset(Le){return this.options.offset=Le,this._update(),this}toggleClassName(Le){let Re;return this._classList.delete(Le)?Re=!1:(this._classList.add(Le),Re=!0),this._updateClassList(),Re}_onMouseEvent(Le){this._update(Le.point)}_getAnchor(Le){if(this.options.anchor)return this.options.anchor;const Re=this._map,Oe=this._container,Ue=this._pos;if(!Re||!Oe||!Ue)return"bottom";const qe=Oe.offsetWidth,Ct=Oe.offsetHeight,Ot=Ue.x<qe/2,Jt=Ue.x>Re.transform.width-qe/2;if(Ue.y+Le<Ct)return Ot?"top-left":Jt?"top-right":"top";if(Ue.y>Re.transform.height-Ct){if(Ot)return"bottom-left";if(Jt)return"bottom-right"}return Ot?"left":Jt?"right":"bottom"}_updateClassList(){const Le=this._container;if(!Le)return;const Re=[...this._classList];Re.push("mapboxgl-popup"),this._anchor&&Re.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&Re.push("mapboxgl-popup-track-pointer"),Le.className=Re.join(" ")}_update(Re){const Oe=this._map,Ue=this._content;if(!Oe||!this._lngLat&&!this._trackPointer||!Ue)return;let qe=this._container;if(qe||(qe=this._container=l("div","mapboxgl-popup",Oe.getContainer()),this._tip=l("div","mapboxgl-popup-tip",qe),qe.appendChild(Ue)),this.options.maxWidth&&qe.style.maxWidth!==this.options.maxWidth&&(qe.style.maxWidth=this.options.maxWidth),Oe.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=zn(this._lngLat,this._pos,Oe.transform)),!this._trackPointer||Re){const Ue=this._pos=this._trackPointer&&Re instanceof Le.P?Re:Oe.project(this._lngLat),qe=jn(this.options.offset),Ct=this._anchor=this._getAnchor(qe.y),Ot=jn(this.options.offset,Ct),Jt=Ue.add(Ot).round();Oe._requestDomTask((()=>{this._container&&Ct&&(this._container.style.transform=`${Lp[Ct]} translate(${Jt.x}px,${Jt.y}px)`)}))}if(!this._marker&&Oe._showingGlobe()){const Re=Le.dz(Oe.transform,this._lngLat)?0:1;this._setOpacity(Re)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const Le=this._container.querySelector(Vp);
1Le&&Le.focus()}_onClose(){this.remove()}_setOpacity(Le){this._container&&(this._container.style.opacity=`${Le}`),this._content&&(this._content.style.pointerEvents=Le?"auto":"none")}},Marker:Fn,Style:co,LngLat:Le.bK,LngLatBounds:Le.as,Point:Le.P,MercatorCoordinate:Le.a5,FreeCameraOptions:Ui,Evented:Le.E,config:Le.e,prewarm:Le.dE,clearPrewarmedResources:Le.dF,get accessToken(){return Le.e.ACCESS_TOKEN},set accessToken(Re){Le.e.ACCESS_TOKEN=Re},get baseApiUrl(){return Le.e.API_URL},set baseApiUrl(Re){Le.e.API_URL=Re},get workerCount(){return Le.dG.workerCount},set workerCount(Re){Le.dG.workerCount=Re},get maxParallelImageRequests(){return Le.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(Re){Le.e.MAX_PARALLEL_IMAGE_REQUESTS=Re},clearStorage(Re){Le.dH(Re)},get workerUrl(){return Le.dI.workerUrl},set workerUrl(Re){Le.dI.workerUrl=Re},get workerClass(){return Le.dI.workerClass},set workerClass(Re){Le.dI.workerClass=Re},get workerParams(){return Le.dI.workerParams},set workerParams(Re){Le.dI.workerParams=Re},get dracoUrl(){return Le.dJ()},set dracoUrl(Re){Le.dK(Re)},get meshoptUrl(){return Le.dL()},set meshoptUrl(Re){Le.dM(Re)},setNow:Le.q.setNow,restoreNow:Le.q.restoreNow}}));var Ct=qe;return Ct}));var qe=Oe;export{qe as default};
2

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